[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-runtime/KDE/4.11] solid-device-automounter: - Automount Unknown device option has wrong logic,
From:       Helio Chissini de Castro <helio () kde ! org>
Date:       2013-09-25 16:39:53
Message-ID: E1VOs81-0008Da-TL () scm ! kde ! org
[Download RAW message or body]

Git commit 39daad79cda8a339a0fce4763655ea271643b3ea by Helio Chissini de Castro.
Committed on 25/09/2013 at 14:59.
Pushed by helio into branch 'KDE/4.11'.

- Automount Unknown device option has wrong logic, and the only way to
  make automount is by having a known device, turning the
  AutomountUnknownDevices option useless. Detected by
  george.tavares@sabiaexperience.com.br

M  +4    -4    solid-device-automounter/kcm/DeviceAutomounterKCM.cpp
M  +4    -1    solid-device-automounter/kded/DeviceAutomounter.cpp
M  +1    -3    solid-device-automounter/lib/AutomounterSettings.cpp

http://commits.kde.org/kde-runtime/39daad79cda8a339a0fce4763655ea271643b3ea

diff --git a/solid-device-automounter/kcm/DeviceAutomounterKCM.cpp \
b/solid-device-automounter/kcm/DeviceAutomounterKCM.cpp index 42fbfae..d5ece6b 100644
--- a/solid-device-automounter/kcm/DeviceAutomounterKCM.cpp
+++ b/solid-device-automounter/kcm/DeviceAutomounterKCM.cpp
@@ -130,9 +130,9 @@ DeviceAutomounterKCM::load()
         automountEnabled->setCheckState(Qt::Unchecked);
 
     if (AutomounterSettings::automountUnknownDevices())
-        automountUnknownDevices->setCheckState(Qt::Unchecked);
-    else
         automountUnknownDevices->setCheckState(Qt::Checked);
+    else
+        automountUnknownDevices->setCheckState(Qt::Unchecked);
 
     if (AutomounterSettings::automountOnLogin())
         automountOnLogin->setCheckState(Qt::Checked);
@@ -159,9 +159,9 @@ DeviceAutomounterKCM::save()
         AutomounterSettings::setAutomountEnabled(false);
 
     if (this->automountUnknownDevices->checkState() == Qt::Checked)
-        AutomounterSettings::setAutomountUnknownDevices(false);
-    else
         AutomounterSettings::setAutomountUnknownDevices(true);
+    else
+        AutomounterSettings::setAutomountUnknownDevices(false);
 
     if (this->automountOnLogin->checkState() == Qt::Checked)
         AutomounterSettings::setAutomountOnLogin(true);
diff --git a/solid-device-automounter/kded/DeviceAutomounter.cpp \
b/solid-device-automounter/kded/DeviceAutomounter.cpp index 9939c96..14b4e87 100644
--- a/solid-device-automounter/kded/DeviceAutomounter.cpp
+++ b/solid-device-automounter/kded/DeviceAutomounter.cpp
@@ -76,7 +76,10 @@ DeviceAutomounter::automountDevice(Solid::Device &dev, \
                AutomounterSettings::Auto
         AutomounterSettings::setDeviceLastSeenMounted(dev.udi(), \
sa->isAccessible());  AutomounterSettings::saveDevice(dev);
 		kDebug() << "Saving as" << dev.description();
-        if (AutomounterSettings::shouldAutomountDevice(dev.udi(), type)) {
+        if (!AutomounterSettings::automountUnknownDevices()) {
+			if(!AutomounterSettings::shouldAutomountDevice(dev.udi(), type)) {
+				return;
+			}
             Solid::StorageVolume *sv = dev.as<Solid::StorageVolume>();
             if (!sv->isIgnored()) {
                 kDebug() << "Mounting" << dev.udi();
diff --git a/solid-device-automounter/lib/AutomounterSettings.cpp \
b/solid-device-automounter/lib/AutomounterSettings.cpp index 87860da..2b3e6be 100644
--- a/solid-device-automounter/lib/AutomounterSettings.cpp
+++ b/solid-device-automounter/lib/AutomounterSettings.cpp
@@ -63,7 +63,6 @@ AutomounterSettings::shouldAutomountDevice(const QString &udi, \
                AutomountType typ
      */
     bool known = deviceIsKnown(udi);
     bool enabled = automountEnabled();
-    bool automountKnown = !automountUnknownDevices();
     bool deviceAutomount = deviceAutomountIsForced(udi, type);
     bool lastSeenMounted = deviceSettings(udi).readEntry("LastSeenMounted", false);
     bool typeCondition = false;
@@ -75,12 +74,11 @@ AutomounterSettings::shouldAutomountDevice(const QString &udi, \
AutomountType typ  typeCondition = automountOnPlugin();
             break;
     }
-    bool shouldAutomount = deviceAutomount || (enabled && typeCondition && \
((automountKnown && known) || lastSeenMounted)); +    bool shouldAutomount = \
deviceAutomount || (enabled && typeCondition && (known || lastSeenMounted));  
     kDebug() << "Processing" << udi;
     kDebug() << "type:" << type;
     kDebug() << "typeCondition:" << typeCondition;
-    kDebug() << "automountKnownDevices:" << automountKnown;
     kDebug() << "deviceIsKnown:" << known;
     kDebug() << "AutomountEnabled:" << enabled;
     kDebug() << "Automount:" << deviceAutomount;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic