diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2013-08-11 02:35:58 +0400 |
---|---|---|
committer | Alexander Golubev <fatzer2@gmail.com> | 2013-08-11 02:35:58 +0400 |
commit | b7ff6c33309224a4e598a0691e7cb2dc353a6ace (patch) | |
tree | bc003a5aeba3b0980b5098985f6c28ba965b8b52 /tdecore/tdehw/tdestoragedevice.cpp | |
parent | 34f10b970c1e644842ef737b5504591997e37d59 (diff) | |
parent | 411486cc50448e91b53d28119ccec54c5c2305cd (diff) | |
download | tdelibs-b7ff6c33309224a4e598a0691e7cb2dc353a6ace.tar.gz tdelibs-b7ff6c33309224a4e598a0691e7cb2dc353a6ace.zip |
Merge branch 'master' into HEAD
Conflicts:
tdecore/CMakeLists.txt
tdecore/tdehardwaredevices.h
tdecore/tdehw/tdehardwaredevices.cpp
Diffstat (limited to 'tdecore/tdehw/tdestoragedevice.cpp')
-rw-r--r-- | tdecore/tdehw/tdestoragedevice.cpp | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/tdecore/tdehw/tdestoragedevice.cpp b/tdecore/tdehw/tdestoragedevice.cpp index ac80b8856..f13146b00 100644 --- a/tdecore/tdehw/tdestoragedevice.cpp +++ b/tdecore/tdehw/tdestoragedevice.cpp @@ -592,7 +592,7 @@ TQString TDEStorageDevice::mountPath() { return TQString::null; } -TQString TDEStorageDevice::mountDevice(TQString mediaName, TQString mountOptions, TQString* errRet, int* retcode) { +TQString TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageMountOptions mountOptions, TQString* errRet, int* retcode) { int internal_retcode; if (!retcode) { retcode = &internal_retcode; @@ -608,12 +608,37 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TQString mountOptions KTempFile passwordFile(TQString::null, "tmp", 0600); passwordFile.setAutoDelete(true); + TQString optionString; + if (mountOptions["ro"] == "true") { + optionString.append(" -r"); + } + + if (mountOptions["atime"] != "true") { + optionString.append(" -A"); + } + + if (mountOptions["utf8"] == "true") { + optionString.append(" -c utf8"); + } + + if (mountOptions["sync"] == "true") { + optionString.append(" -s"); + } + + if (mountOptions.contains("filesystem")) { + optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"])); + } + + if (mountOptions.contains("locale")) { + optionString.append(TQString(" -c %1").arg(mountOptions["locale"])); + } + TQString passFileName = passwordFile.name(); TQString devNode = deviceNode(); passFileName.replace("'", "'\\''"); devNode.replace("'", "'\\''"); mediaName.replace("'", "'\\''"); - TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(mountOptions).arg(devNode).arg(mediaName); + TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName); FILE *exepipe = popen(command.ascii(), "r"); if (exepipe) { @@ -634,7 +659,7 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TQString mountOptions return ret; } -TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString mediaName, TQString mountOptions, TQString* errRet, int* retcode) { +TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString mediaName, TDEStorageMountOptions mountOptions, TQString* errRet, int* retcode) { int internal_retcode; if (!retcode) { retcode = &internal_retcode; @@ -657,12 +682,37 @@ TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString me pwFile->writeBlock(passphrase.ascii(), passphrase.length()); pwFile->flush(); + TQString optionString; + if (mountOptions["ro"] == "true") { + optionString.append(" -r"); + } + + if (mountOptions["atime"] != "true") { + optionString.append(" -A"); + } + + if (mountOptions["utf8"] == "true") { + optionString.append(" -c utf8"); + } + + if (mountOptions["sync"] == "true") { + optionString.append(" -s"); + } + + if (mountOptions.contains("filesystem")) { + optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"])); + } + + if (mountOptions.contains("locale")) { + optionString.append(TQString(" -c %1").arg(mountOptions["locale"])); + } + TQString passFileName = passwordFile.name(); TQString devNode = deviceNode(); passFileName.replace("'", "'\\''"); devNode.replace("'", "'\\''"); mediaName.replace("'", "'\\''"); - TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(mountOptions).arg(devNode).arg(mediaName); + TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName); FILE *exepipe = popen(command.ascii(), "r"); if (exepipe) { |