By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 1708
Collapse All | Expand All

(-)b/tdecore/tdehw/tdestoragedevice.cpp (-50 / +175 lines)
Lines 32-37 Link Here
32
#include "tdeglobal.h" 
32
#include "tdeglobal.h" 
33
#include "kiconloader.h" 
33
#include "kiconloader.h" 
34
#include "tdetempfile.h" 
34
#include "tdetempfile.h" 
35
#include "kstandarddirs.h"
35
36
36
#include "tdehardwaredevices.h" 
37
#include "tdehardwaredevices.h" 
37
38
Lines 601-661 Link Here
601
602
602
	TQString ret = mountPath();
603
	TQString ret = mountPath();
603
604
605
	// Device is already mounted
604
	if (!ret.isNull()) {
606
	if (!ret.isNull()) {
605
		return ret;
607
		return ret;
606
	}
608
	}
607
609
608
	// Create dummy password file
610
	TQString command;
609
	KTempFile passwordFile(TQString::null, "tmp", 0600);
611
	TQString devNode = deviceNode();
610
	passwordFile.setAutoDelete(true);
612
	devNode.replace("'", "'\\''");
613
	mediaName.replace("'", "'\\''");
611
614
615
#if defined(WITH_UDISKS2) || defined(WITH_UDISKS)
616
	// Prepare filesystem options for mount
612
	TQString optionString;
617
	TQString optionString;
618
613
	if (mountOptions["ro"] == "true") {
619
	if (mountOptions["ro"] == "true") {
614
		optionString.append(" -r");
620
		optionString.append(",ro");
615
	}
621
	}
616
	
622
617
	if (mountOptions["atime"] != "true") {
623
	if (mountOptions["atime"] != "true") {
618
		optionString.append(" -A");
624
		optionString.append(",noatime");
619
	}
620
	
621
	if (mountOptions["utf8"] == "true") {
622
		optionString.append(" -c utf8");
623
	}
625
	}
624
	
626
625
	if (mountOptions["sync"] == "true") {
627
	if (mountOptions["sync"] == "true") {
626
		optionString.append(" -s");
628
		optionString.append(",sync");
627
	}
629
	}
628
630
629
	if (mountOptions.contains("filesystem")) {
631
	if(  (mountOptions["filesystem"] == "fat")
630
		optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"]));
632
	  || (mountOptions["filesystem"] == "vfat")
633
	  || (mountOptions["filesystem"] == "msdos")
634
	  || (mountOptions["filesystem"] == "umsdos")
635
	) {
636
		if (mountOptions.contains("shortname")) {
637
			optionString.append(TQString(",shortname=%1").arg(mountOptions["shortname"]));
638
		}
631
	}
639
	}
632
640
633
	if (mountOptions.contains("locale")) {
641
	if( (mountOptions["filesystem"] == "jfs")) {
634
		optionString.append(TQString(" -c %1").arg(mountOptions["locale"]));
642
		if (mountOptions["utf8"] == "true") {
643
			optionString.append(",iocharset=utf8");
644
		}
635
	}
645
	}
636
646
637
	TQString passFileName = passwordFile.name();
647
	if( (mountOptions["filesystem"] == "ntfs-3g") ) {
638
	TQString devNode = deviceNode();
648
		if (mountOptions.contains("locale")) {
639
	passFileName.replace("'", "'\\''");
649
			optionString.append(TQString(",locale=%1").arg(mountOptions["locale"]));
640
	devNode.replace("'", "'\\''");
650
		}
641
	mediaName.replace("'", "'\\''");
651
	}
642
	TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName);
643
652
644
	FILE *exepipe = popen(command.ascii(), "r");
653
	if(  (mountOptions["filesystem"] == "ext3")
645
	if (exepipe) {
654
	  || (mountOptions["filesystem"] == "ext4")
646
		TQString pmount_output;
655
	) {
647
		char buffer[8092];
656
		if (mountOptions.contains("journaling")) {
648
		pmount_output = fgets(buffer, sizeof(buffer), exepipe);
657
			optionString.append(TQString(",data=%1").arg(mountOptions["journaling"]));
649
		*retcode = pclose(exepipe);
650
		if (errRet) {
651
			*errRet = pmount_output;
652
		}
658
		}
653
	}
659
	}
654
660
655
	// Update internal mount data
661
	if (!optionString.isEmpty()) {
656
	TDEGlobal::hardwareDevices()->processModifiedMounts();
662
		optionString.remove(0, 1);
663
	}
664
#endif // defined(WITH_UDISKS2) || defined(WITH_UDISKS)
657
665
658
	ret = mountPath();
666
#ifdef WITH_UDISKS2
667
	if(command.isEmpty()) {
668
		// Use 'udisksctl' command (from UDISKS2), if available
669
		TQString udisksctlProg = TDEGlobal::dirs()->findExe("udisksctl");
670
		if (!udisksctlProg.isEmpty()) {
671
672
			if(!optionString.isEmpty()) {
673
				optionString.insert(0, "-o ");
674
			}
675
676
			if (mountOptions.contains("filesystem")) {
677
				optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"]));
678
			}
679
680
			command = TQString("udisksctl mount -b '%1' %2 2>&1").arg(devNode).arg(optionString);
681
		}
682
	}
683
#endif // WITH_UDISKS2
684
685
#ifdef WITH_UDISKS
686
	if(command.isEmpty()) {
687
		// Use 'udisks' command (from UDISKS1), if available
688
		TQString udisksProg = TDEGlobal::dirs()->findExe("udisks");
689
		if (!udisksProg.isEmpty()) {
690
			TQString optionString;
691
692
			if(!optionString.isEmpty()) {
693
				optionString.insert(0, "--mount-options ");
694
			}
695
696
			if (mountOptions.contains("filesystem")) {
697
				optionString.append(TQString(" --mount-fstype %1").arg(mountOptions["filesystem"]));
698
			}
699
700
			command = TQString("udisks --mount '%1' %2 2>&1").arg(devNode).arg(optionString);
701
		}
702
	}
703
#endif // WITH_UDISKS
704
705
	if(command.isEmpty()) {
706
		// Use 'pmount' command, if available
707
		TQString pmountProg = TDEGlobal::dirs()->findExe("pmount");
708
		if (!pmountProg.isEmpty()) {
709
			// Create dummy password file
710
			KTempFile passwordFile(TQString::null, "tmp", 0600);
711
			passwordFile.setAutoDelete(true);
712
713
			TQString optionString;
714
			if (mountOptions["ro"] == "true") {
715
				optionString.append(" -r");
716
			}
717
718
			if (mountOptions["atime"] != "true") {
719
				optionString.append(" -A");
720
			}
721
722
			if (mountOptions["utf8"] == "true") {
723
				optionString.append(" -c utf8");
724
			}
725
726
			if (mountOptions["sync"] == "true") {
727
				optionString.append(" -s");
728
			}
729
730
			if (mountOptions.contains("filesystem")) {
731
				optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"]));
732
			}
733
734
			if (mountOptions.contains("locale")) {
735
				optionString.append(TQString(" -c %1").arg(mountOptions["locale"]));
736
			}
737
738
			TQString passFileName = passwordFile.name();
739
			passFileName.replace("'", "'\\''");
740
741
			command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName);
742
		}
743
	}
744
745
	if(!command.isEmpty()) {
746
		FILE *exepipe = popen(command.local8Bit(), "r");
747
		if (exepipe) {
748
			TQString pmount_output;
749
			char buffer[8092];
750
			pmount_output = fgets(buffer, sizeof(buffer), exepipe);
751
			*retcode = pclose(exepipe);
752
			if (errRet) {
753
				*errRet = pmount_output;
754
			}
755
		}
756
757
		// Update internal mount data
758
		TDEGlobal::hardwareDevices()->processModifiedMounts();
759
760
		ret = mountPath();
761
	}
659
762
660
	return ret;
763
	return ret;
661
}
764
}
Lines 715-721 Link Here
715
	mediaName.replace("'", "'\\''");
818
	mediaName.replace("'", "'\\''");
716
	TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName);
819
	TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName);
717
820
718
	FILE *exepipe = popen(command.ascii(), "r");
821
	FILE *exepipe = popen(command.local8Bit(), "r");
719
	if (exepipe) {
822
	if (exepipe) {
720
		TQString pmount_output;
823
		TQString pmount_output;
721
		char buffer[8092];
824
		char buffer[8092];
Lines 741-771 Link Here
741
	}
844
	}
742
845
743
	TQString mountpoint = mountPath();
846
	TQString mountpoint = mountPath();
847
	TQString devNode = deviceNode();
744
848
745
	if (mountpoint.isNull()) {
849
	if (mountpoint.isNull()) {
746
		return true;
850
		return true;
747
	}
851
	}
748
852
749
	mountpoint.replace("'", "'\\''");
853
	mountpoint.replace("'", "'\\''");
750
	TQString command = TQString("pumount '%1' 2>&1").arg(mountpoint);
854
751
	FILE *exepipe = popen(command.ascii(), "r");
855
	TQString command;
752
	if (exepipe) {
856
753
		TQString pmount_output;
857
#ifdef WITH_UDISKS2
754
		char buffer[8092];
858
	if(command.isEmpty() &&
755
		pmount_output = fgets(buffer, sizeof(buffer), exepipe);
859
	   !(TDEGlobal::dirs()->findExe("udisksctl").isEmpty())) {
756
		*retcode = pclose(exepipe);
860
		command = TQString("udisksctl unmount -b '%1' 2>&1").arg(devNode);
757
		if (*retcode == 0) {
861
	}
758
			return true;
862
#endif // WITH_UDISKS2
759
		}
863
#ifdef WITH_UDISKS
760
		else {
864
	if(command.isEmpty() &&
761
			if (errRet) {
865
	   !(TDEGlobal::dirs()->findExe("udisks").isEmpty()) ) {
762
				*errRet = pmount_output;
866
		command = TQString("udisks --unmount '%1' 2>&1").arg(devNode);
867
	}
868
#endif // WITH_UDISKS
869
	if(command.isEmpty() &&
870
	   !(TDEGlobal::dirs()->findExe("pumount").isEmpty())) {
871
		command = TQString("pumount '%1' 2>&1").arg(mountpoint);
872
	}
873
874
	if(!command.isEmpty()) {
875
		FILE *exepipe = popen(command.local8Bit(), "r");
876
		if (exepipe) {
877
			TQString pmount_output;
878
			char buffer[8092];
879
			pmount_output = fgets(buffer, sizeof(buffer), exepipe);
880
			*retcode = pclose(exepipe);
881
			if (*retcode == 0) {
882
				return true;
883
			}
884
			else {
885
				if (errRet) {
886
					*errRet = pmount_output;
887
				}
763
			}
888
			}
764
		}
889
		}
765
	}
766
890
767
	// Update internal mount data
891
		// Update internal mount data
768
	TDEGlobal::hardwareDevices()->processModifiedMounts();
892
		TDEGlobal::hardwareDevices()->processModifiedMounts();
893
	}
769
894
770
	return false;
895
	return false;
771
}
896
}

Return to bug 1708