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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/generic/runners/solid
From:       Jacopo De Simoi <wilderkde () gmail ! com>
Date:       2010-11-05 11:29:36
Message-ID: 20101105112936.69CE6AC89B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1193271 by jacopods:

Add dedicated syntaxes for encrypted containers


 M  +4 -0      devicewrapper.cpp  
 M  +1 -0      devicewrapper.h  
 M  +20 -2     solidrunner.cpp  


--- trunk/KDE/kdebase/workspace/plasma/generic/runners/solid/devicewrapper.cpp \
#1193270:1193271 @@ -111,6 +111,10 @@
     return m_isAccessible;
 }
 
+bool DeviceWrapper::isEncryptedContainer() const {
+    return m_isEncryptedContainer;
+}
+
 QString DeviceWrapper::description() const {
     return m_device.description();
 }
--- trunk/KDE/kdebase/workspace/plasma/generic/runners/solid/devicewrapper.h \
#1193270:1193271 @@ -43,6 +43,7 @@
     KIcon icon() const;
     bool isStorageAccess() const;
     bool isAccessible() const;
+    bool isEncryptedContainer() const;
     QString description() const;
     QString defaultAction() const;
     void runAction(QAction *) ;
--- trunk/KDE/kdebase/workspace/plasma/generic/runners/solid/solidrunner.cpp \
#1193270:1193271 @@ -51,8 +51,13 @@
                                    i18n("Lists all devices and allows them to be \
                mounted, unmounted or ejected.")));
     addSyntax(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", "mount"),
                                    i18n("Lists all devices which can be mounted, and \
allows them to be mounted."))); +    addSyntax(Plasma::RunnerSyntax(i18nc("Note this \
is a KRunner keyword", "unlock"), +                                   i18n("Lists all \
                encrypted devices which can be unlocked, and allows them to be \
                unlocked.")));
     addSyntax(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", \
                "unmount"),
                                    i18n("Lists all devices which can be unmounted, \
and allows them to be unmounted."))); +    addSyntax(Plasma::RunnerSyntax(i18nc("Note \
this is a KRunner keyword", "lock"), +                                   i18n("Lists \
all encrypted devices which can be locked, and allows them to be locked."))); +
     addSyntax(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", "eject"),
                                    i18n("Lists all devices which can be ejected, and \
allows them to be ejected.")));  
@@ -127,6 +132,7 @@
     QString deviceDescription;
     bool onlyMounted = false;
     bool onlyMountable = false;
+    bool onlyEncrypted = false;
     bool showDevices = false;
     if (keywords[0].startsWith(i18nc("Note this is a KRunner keyword", "device") , \
Qt::CaseInsensitive)) {  showDevices = true;
@@ -142,6 +148,16 @@
             showDevices = true;
             onlyMounted = true;
             keywords.removeFirst();
+        } else if (keywords[0].startsWith(i18nc("Note this is a KRunner keyword", \
"unlock") , Qt::CaseInsensitive)) { +            showDevices = true;
+            onlyMountable = true;
+            onlyEncrypted = true;
+            keywords.removeFirst();
+        } else if (keywords[0].startsWith(i18nc("Note this is a KRunner keyword", \
"lock") , Qt::CaseInsensitive)) { +            showDevices = true;
+            onlyMounted = true;
+            onlyEncrypted = true;
+            keywords.removeFirst();
         }
     }
 
@@ -152,9 +168,11 @@
     foreach (const QString& udi,  udiList) {
         DeviceWrapper * dev = m_deviceList.value(udi);
         if ((deviceDescription.isEmpty() && showDevices) || \
                dev->description().contains(deviceDescription, Qt::CaseInsensitive)) \
                {
-            if ((onlyMounted && dev->isAccessible()) ||
+            // This is getting quite messy indeed
+            if (((!onlyEncrypted) || (onlyEncrypted && dev->isEncryptedContainer())) \
&& +                ((onlyMounted && dev->isAccessible()) ||
                 (onlyMountable && dev->isStorageAccess() && !dev->isAccessible()) ||
-                (!onlyMounted && !onlyMountable)) {
+                 (!onlyMounted && !onlyMountable))) {
 
                 Plasma::QueryMatch match = deviceMatch(dev);
                 if (dev->description().compare(deviceDescription, \
Qt::CaseInsensitive)) {


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

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