summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehw
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2013-08-11 02:35:58 +0400
committerAlexander Golubev <fatzer2@gmail.com>2013-08-11 02:35:58 +0400
commitb7ff6c33309224a4e598a0691e7cb2dc353a6ace (patch)
treebc003a5aeba3b0980b5098985f6c28ba965b8b52 /tdecore/tdehw
parent34f10b970c1e644842ef737b5504591997e37d59 (diff)
parent411486cc50448e91b53d28119ccec54c5c2305cd (diff)
downloadtdelibs-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')
-rw-r--r--tdecore/tdehw/tdehardwaredevices.cpp10
-rw-r--r--tdecore/tdehw/tdestoragedevice.cpp58
-rw-r--r--tdecore/tdehw/tdestoragedevice.h6
3 files changed, 68 insertions, 6 deletions
diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp
index 08646d17d..b82977d96 100644
--- a/tdecore/tdehw/tdehardwaredevices.cpp
+++ b/tdecore/tdehw/tdehardwaredevices.cpp
@@ -65,6 +65,7 @@
#include "tdeeventdevice.h"
#include "tdeinputdevice.h"
+// Compile-time configuration
#include "config.h"
// BEGIN BLOCK
@@ -2558,6 +2559,15 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist
if (nodename == "alarm") {
bdevice->internalSetAlarmEnergy(line.toDouble()/1000000.0);
}
+ if (nodename == "charge_full") {
+ bdevice->internalSetMaximumEnergy(line.toDouble()/1000000.0);
+ }
+ if (nodename == "charge_full_design") {
+ bdevice->internalSetMaximumDesignEnergy(line.toDouble()/1000000.0);
+ }
+ if (nodename == "charge_now") {
+ bdevice->internalSetEnergy(line.toDouble()/1000000.0);
+ }
if (nodename == "energy_full") {
bdevice->internalSetMaximumEnergy(line.toDouble()/1000000.0);
}
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) {
diff --git a/tdecore/tdehw/tdestoragedevice.h b/tdecore/tdehw/tdestoragedevice.h
index 0f33b03dc..7c80f5ea5 100644
--- a/tdecore/tdehw/tdestoragedevice.h
+++ b/tdecore/tdehw/tdestoragedevice.h
@@ -105,6 +105,8 @@ inline TDEDiskDeviceStatus operator~(TDEDiskDeviceStatus a)
}
};
+typedef TQMap<TQString,TQString> TDEStorageMountOptions;
+
class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
{
public:
@@ -174,7 +176,7 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
*
* @return a TQString with the mount path, if successful
*/
- TQString mountDevice(TQString mediaName=TQString::null, TQString mountOptions=TQString::null, TQString* errRet=0, int* retcode=0);
+ TQString mountDevice(TQString mediaName=TQString::null, TDEStorageMountOptions mountOptions=TDEStorageMountOptions(), TQString* errRet=0, int* retcode=0);
/**
* Mounts the encrypted device if the correct passphrase is given
@@ -187,7 +189,7 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
*
* @return a TQString with the mount path, if successful
*/
- TQString mountEncryptedDevice(TQString passphrase, TQString mediaName=TQString::null, TQString mountOptions=TQString::null, TQString* errRet=0, int* retcode=0);
+ TQString mountEncryptedDevice(TQString passphrase, TQString mediaName=TQString::null, TDEStorageMountOptions mountOptions=TDEStorageMountOptions(), TQString* errRet=0, int* retcode=0);
/**
* Unmounts the device