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

(-)tdelibs/tdecore/tdehw/tdestoragedevice.cpp (-29 / +156 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-645 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 epath = getenv("PATH");
609
	KTempFile passwordFile(TQString::null, "tmp", 0600);
611
    TQString path = TQString::fromLatin1("/sbin:/bin");
610
	passwordFile.setAutoDelete(true);
612
    if (!epath.isEmpty()) {
613
        path += ":" + epath;
614
    }
611
615
612
	TQString optionString;
616
	TQString command;
613
	if (mountOptions["ro"] == "true") {
617
	TQString devNode = deviceNode();
614
		optionString.append(" -r");
618
	devNode.replace("'", "'\\''");
615
	}
619
	mediaName.replace("'", "'\\''");
616
	
620
617
	if (mountOptions["atime"] != "true") {
621
	// Removes 'iocharset' option on some filesystems
618
		optionString.append(" -A");
622
	if(  (mountOptions["filesystem"] != "fat")
619
	}
623
	  && (mountOptions["filesystem"] != "iso9669")
620
	
624
	  && (mountOptions["filesystem"] != "jfs")
621
	if (mountOptions["utf8"] == "true") {
625
	  && (mountOptions["filesystem"] != "msdos")
622
		optionString.append(" -c utf8");
626
	  && (mountOptions["filesystem"] != "ntfs")
623
	}
627
	  && (mountOptions["filesystem"] != "umsdos")
624
	
628
	  && (mountOptions["filesystem"] != "vfat")
625
	if (mountOptions["sync"] == "true") {
629
	) {
626
		optionString.append(" -s");
630
		mountOptions["utf8"] = "false";
627
	}
631
	}
628
632
629
	if (mountOptions.contains("filesystem")) {
633
    // Use 'pmount' command, if available
630
		optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"]));
634
    TQString pmountProg = TDEGlobal::dirs()->findExe("pmount", path);
635
636
    if (!pmountProg.isEmpty()) {
637
		// Create dummy password file
638
		KTempFile passwordFile(TQString::null, "tmp", 0600);
639
		passwordFile.setAutoDelete(true);
640
641
		TQString optionString;
642
		if (mountOptions["ro"] == "true") {
643
			optionString.append(" -r");
644
		}
645
		
646
		if (mountOptions["atime"] != "true") {
647
			optionString.append(" -A");
648
		}
649
		
650
		if (mountOptions["utf8"] == "true") {
651
			optionString.append(" -c utf8");
652
		}
653
		
654
		if (mountOptions["sync"] == "true") {
655
			optionString.append(" -s");
656
		}
657
658
		if (mountOptions.contains("filesystem")) {
659
			optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"]));
660
		}
661
662
		if (mountOptions.contains("locale")) {
663
			optionString.append(TQString(" -c %1").arg(mountOptions["locale"]));
664
		}
665
666
		TQString passFileName = passwordFile.name();
667
		passFileName.replace("'", "'\\''");
668
669
		command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName);
631
	}
670
	}
632
671
633
	if (mountOptions.contains("locale")) {
672
#ifdef WITH_UDISKS2
634
		optionString.append(TQString(" -c %1").arg(mountOptions["locale"]));
673
	if(command.isEmpty()) {
674
		// Use 'udisksctl' command (from UDISKS2), if available
675
		TQString udisksctlProg = TDEGlobal::dirs()->findExe("udisksctl", path);
676
		if (!udisksctlProg.isEmpty()) {
677
			TQString optionString;
678
679
			// Sends the filesystem options to 'udisks' command
680
			optionString.append(TQString("-o rw"));
681
682
			if (mountOptions["ro"] == "true") {
683
				optionString.append(",ro");
684
			}
685
			
686
			if (mountOptions["atime"] != "true") {
687
				optionString.append(",noatime");
688
			}
689
			
690
			if (mountOptions["utf8"] == "true") {
691
				optionString.append(",iocharset=utf8");
692
			}
693
			
694
			if (mountOptions["sync"] == "true") {
695
				optionString.append(",sync");
696
			}
697
698
			if (mountOptions.contains("locale")) {
699
				optionString.append(TQString(",iocharset=%1").arg(mountOptions["locale"]));
700
			}
701
702
			if (mountOptions.contains("filesystem")) {
703
				optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"]));
704
			}
705
706
			command = TQString("udisksctl mount -b '%1' %2 2>&1").arg(devNode).arg(optionString);
707
		}
635
	}
708
	}
709
#endif // WITH_UDISKS2
636
710
637
	TQString passFileName = passwordFile.name();
711
#ifdef WITH_UDISKS
638
	TQString devNode = deviceNode();
712
	if(command.isEmpty()) {
639
	passFileName.replace("'", "'\\''");
713
		// Use 'udisks' command (from UDISKS1), if available
640
	devNode.replace("'", "'\\''");
714
		TQString udisksProg = TDEGlobal::dirs()->findExe("udisks", path);
641
	mediaName.replace("'", "'\\''");
715
		if (!udisksProg.isEmpty()) {
642
	TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName);
716
			TQString optionString;
717
718
			// Sends the filesystem options to 'udisks' command
719
			optionString.append(TQString("--mount-options rw"));
720
721
			if (mountOptions["ro"] == "true") {
722
				optionString.append(",ro");
723
			}
724
			
725
			if (mountOptions["atime"] != "true") {
726
				optionString.append(",noatime");
727
			}
728
			
729
			if (mountOptions["utf8"] == "true") {
730
				optionString.append(",iocharset=utf8");
731
			}
732
			
733
			if (mountOptions["sync"] == "true") {
734
				optionString.append(",sync");
735
			}
736
737
			if (mountOptions.contains("locale")) {
738
				optionString.append(TQString(",iocharset=%1").arg(mountOptions["locale"]));
739
			}
740
741
			if (mountOptions.contains("filesystem")) {
742
				optionString.append(TQString(" --mount-fstype %1").arg(mountOptions["filesystem"]));
743
			}
744
745
			command = TQString("udisks --mount '%1' %2 2>&1").arg(devNode).arg(optionString);
746
		}
747
	}
748
#endif // WITH_UDISKS
643
749
644
	FILE *exepipe = popen(command.ascii(), "r");
750
	FILE *exepipe = popen(command.ascii(), "r");
645
	if (exepipe) {
751
	if (exepipe) {
Lines 741-753 Link Here
741
	}
847
	}
742
848
743
	TQString mountpoint = mountPath();
849
	TQString mountpoint = mountPath();
850
	TQString devNode = deviceNode();
744
851
745
	if (mountpoint.isNull()) {
852
	if (mountpoint.isNull()) {
746
		return true;
853
		return true;
747
	}
854
	}
748
855
749
	mountpoint.replace("'", "'\\''");
856
	mountpoint.replace("'", "'\\''");
750
	TQString command = TQString("pumount '%1' 2>&1").arg(mountpoint);
857
858
    TQString epath = getenv("PATH");
859
    TQString path = TQString::fromLatin1("/sbin:/bin");
860
    if (!epath.isEmpty()) {
861
        path += ":" + epath;
862
    }
863
864
	TQString command;
865
866
	if(!(TDEGlobal::dirs()->findExe("pumount", path).isEmpty())) {
867
		command = TQString("pumount '%1' 2>&1").arg(mountpoint);
868
#ifdef WITH_UDISKS2
869
	} else if(!(TDEGlobal::dirs()->findExe("udisksctl", path).isEmpty())) {
870
		command = TQString("udisksctl unmount -b '%1' 2>&1").arg(devNode);
871
#endif // WITH_UDISKS2
872
#ifdef WITH_UDISKS
873
	} else if(!(TDEGlobal::dirs()->findExe("udisks", path).isEmpty()) ){
874
		command = TQString("udisks --unmount '%1' 2>&1").arg(devNode);
875
#endif // WITH_UDISKS
876
	}
877
751
	FILE *exepipe = popen(command.ascii(), "r");
878
	FILE *exepipe = popen(command.ascii(), "r");
752
	if (exepipe) {
879
	if (exepipe) {
753
		TQString pmount_output;
880
		TQString pmount_output;

Return to bug 1708