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

List:       kde-commits
Subject:    kdeextragear-3/kiosktool
From:       Waldo Bastian <bastian () kde ! org>
Date:       2004-11-04 11:53:14
Message-ID: 20041104115314.7475B16C90 () office ! kde ! org
[Download RAW message or body]

CVS commit by waba: 

* Add resource restrictions
* Use resource restrictions to ignore existing menu changes made by the user
when menu editing is diabled.


  M +1 -0      kiosk_data.xml   1.18
  M +11 -0     kioskdata.cpp   1.7
  M +1 -1      kioskdata.h   1.5
  M +25 -0     pageWidget.cpp   1.11


--- kdeextragear-3/kiosktool/kiosk_data.xml  #1.17:1.18
@@ -237,4 +237,5 @@
          able to make changes to their personal application menu.
          </description>
+         <action type="resource restriction" key="xdgconf-menu" />
        </action>
     </actions>

--- kdeextragear-3/kiosktool/kioskdata.cpp  #1.6:1.7
@@ -24,4 +24,5 @@
 
 #include <kaction.h>
+#include <kdebug.h>
 #include <klocale.h>
 #include <kstandarddirs.h>
@@ -85,4 +86,6 @@ ComponentAction::load(const QDomElement 
   else if (_type == "action restriction")
     type = ActRestrict;
+  else if (_type == "resource restriction")
+    type = ActResource;
   else if (_type == "module")
     type = ActModule;
@@ -92,5 +95,13 @@ ComponentAction::load(const QDomElement 
     type = ActConfig;
   else 
+  {  
+#ifndef NDEBUG
+    if (_type.isEmpty())
+       kdFatal() << "'type' attribute missing or empty in action." << endl;
+    else
+       kdFatal() << "Unknown 'type' attribute '" << _type << "' in action." << endl;
+#endif
     return false;
+  }
    
   file = docElem.attribute("file");

--- kdeextragear-3/kiosktool/kioskdata.h  #1.4:1.5
@@ -39,5 +39,5 @@ public:
    QString caption;
    QString description;
-   typedef enum {ActImmutable, ActRestrict, ActCustom, ActModule, ActConfig } ActionType;
+   typedef enum {ActImmutable, ActRestrict, ActCustom, ActModule, ActConfig, ActResource } ActionType;
    ActionType type;
    QString file;

--- kdeextragear-3/kiosktool/pageWidget.cpp  #1.10:1.11
@@ -72,4 +72,14 @@ PageWidget::fillActionList(KListView *li
         item->setOn(restricted);
      }
+     else if (action->type == ComponentAction::ActResource)
+     {
+        QString file = action->file;
+        if (file.isEmpty())
+           file = "kdeglobals";
+        KConfig *cfg = KioskRun::self()->configFile(file);
+        cfg->setGroup("KDE Resource Restrictions");
+        bool restricted = !cfg->readBoolEntry(action->key, true);
+        item->setOn(restricted);
+     }
      else if (action->type == ComponentAction::ActModule)
      {
@@ -127,4 +137,19 @@ PageWidget::saveActionListItem(Component
      }
   }
+  else if (action->type == ComponentAction::ActResource)
+  {
+     QString file = action->file;
+     if (file.isEmpty())
+        file = "kdeglobals";
+     KConfig *cfg = KioskRun::self()->configFile(file);
+     cfg->setGroup("KDE Resource Restrictions");
+        
+     bool allowed = !b; // reverse logic
+     if (cfg->readBoolEntry(action->key, true) != allowed)
+     {
+        cfg->writeEntry(action->key, allowed);
+        KioskRun::self()->scheduleSycocaUpdate();
+     }
+  }
   else if (action->type == ComponentAction::ActModule)
   {


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

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