Blame SOURCES/kde-workspace-4.10-bz#921742.patch

b5cc75
diff --git a/powerdevil/daemon/powerdevilactionpool.cpp b/powerdevil/daemon/powerdevilactionpool.cpp
b5cc75
index 970aa18..6ca0d57 100644
b5cc75
--- a/powerdevil/daemon/powerdevilactionpool.cpp
b5cc75
+++ b/powerdevil/daemon/powerdevilactionpool.cpp
b5cc75
@@ -82,6 +82,7 @@ void ActionPool::clearCache()
b5cc75
         i.value()->deleteLater();
b5cc75
         i = m_actionPool.erase(i);
b5cc75
     }
b5cc75
+    m_initErrors.clear();
b5cc75
 }
b5cc75
 
b5cc75
 void ActionPool::init(PowerDevil::Core *parent)
b5cc75
@@ -99,6 +100,7 @@ void ActionPool::init(PowerDevil::Core *parent)
b5cc75
         if (!retaction) {
b5cc75
             // Troubles...
b5cc75
             kWarning() << "failed to load" << offer->desktopEntryName();
b5cc75
+            m_initErrors.insert(actionId, LoadFailed);
b5cc75
             continue;
b5cc75
         }
b5cc75
 
b5cc75
@@ -106,6 +108,7 @@ void ActionPool::init(PowerDevil::Core *parent)
b5cc75
         if (!retaction->isSupported()) {
b5cc75
             // Skip that
b5cc75
             retaction->deleteLater();
b5cc75
+            m_initErrors.insert(actionId, NotSupported);
b5cc75
             continue;
b5cc75
         }
b5cc75
 
b5cc75
@@ -169,7 +172,13 @@ Action* ActionPool::loadAction(const QString& actionId, const KConfigGroup& grou
b5cc75
 
b5cc75
         return retaction;
b5cc75
     } else {
b5cc75
-        // Hmm... troubles in configuration. Np, let's just return 0 and let the core handle this
b5cc75
+        // may be a misconfiguration.
b5cc75
+        // Set the error code and return 0 and let the caller handle this as it sees fit
b5cc75
+        if (m_initErrors.contains(actionId)) {
b5cc75
+            m_error = m_initErrors[actionId];
b5cc75
+        } else {  // no error recorded during initialisation, therefore action does not exist
b5cc75
+            m_error = NoAction;
b5cc75
+        }
b5cc75
         return 0;
b5cc75
     }
b5cc75
 }
b5cc75
@@ -183,4 +192,9 @@ void ActionPool::unloadAllActiveActions()
b5cc75
     m_activeActions.clear();
b5cc75
 }
b5cc75
 
b5cc75
+ActionPool::ErrorCode ActionPool::error()
b5cc75
+{
b5cc75
+    return m_error;
b5cc75
+}
b5cc75
+
b5cc75
 }
b5cc75
diff --git a/powerdevil/daemon/powerdevilactionpool.h b/powerdevil/daemon/powerdevilactionpool.h
b5cc75
index ca436ff..816449e 100644
b5cc75
--- a/powerdevil/daemon/powerdevilactionpool.h
b5cc75
+++ b/powerdevil/daemon/powerdevilactionpool.h
b5cc75
@@ -36,6 +36,11 @@ class Action;
b5cc75
 class KDE_EXPORT ActionPool
b5cc75
 {
b5cc75
 public:
b5cc75
+    enum ErrorCode {
b5cc75
+        NoAction,
b5cc75
+        LoadFailed,
b5cc75
+        NotSupported
b5cc75
+    };
b5cc75
     static ActionPool *instance();
b5cc75
 
b5cc75
     virtual ~ActionPool();
b5cc75
@@ -48,11 +53,15 @@ public:
b5cc75
 
b5cc75
     void clearCache();
b5cc75
 
b5cc75
+    ErrorCode error();
b5cc75
+
b5cc75
 private:
b5cc75
     ActionPool();
b5cc75
 
b5cc75
     QHash< QString, Action* > m_actionPool;
b5cc75
     QStringList m_activeActions;
b5cc75
+    ErrorCode m_error;
b5cc75
+    QHash< QString, ErrorCode > m_initErrors;
b5cc75
 };
b5cc75
 
b5cc75
 }
b5cc75
diff --git a/powerdevil/daemon/powerdevilcore.cpp b/powerdevil/daemon/powerdevilcore.cpp
b5cc75
index d096d74..c35b29d 100644
b5cc75
--- a/powerdevil/daemon/powerdevilcore.cpp
b5cc75
+++ b/powerdevil/daemon/powerdevilcore.cpp
b5cc75
@@ -357,11 +357,23 @@ void Core::loadProfile(bool force)
b5cc75
             if (action) {
b5cc75
                 action->onProfileLoad();
b5cc75
             } else {
b5cc75
-                // Ouch, error. But let's just warn and move on anyway
b5cc75
-                //TODO Maybe Remove from the configuration if unsupported
b5cc75
-                kWarning() << "The profile " << profileId <<  "tried to activate"
b5cc75
-                                << actionName << "a non existent action. This is usually due to an installation problem"
b5cc75
-                                " or to a configuration problem. or simlpy the action is not supported";
b5cc75
+                switch (ActionPool::instance()->error()) {
b5cc75
+                    case ActionPool::NotSupported:
b5cc75
+                        kWarning().nospace() << "Attempted to load unsupported action " << actionName
b5cc75
+                                             << ", skipping";
b5cc75
+                        break;
b5cc75
+                    case ActionPool::LoadFailed:
b5cc75
+                        kWarning() << "Action" << actionName << "failed during initialisation";
b5cc75
+                        // fallthrough
b5cc75
+                    case ActionPool::NoAction:
b5cc75
+                    default:
b5cc75
+                        // Ouch, error. But let's just warn and move on anyway
b5cc75
+                        //TODO Maybe Remove from the configuration if unsupported
b5cc75
+                        kWarning() << "The profile " << profileId <<  "tried to activate"
b5cc75
+                                   << actionName << "a non existent action. This is usually due to an installation problem"
b5cc75
+                                      " or to a configuration problem. or simlpy the action is not supported";
b5cc75
+                        break;
b5cc75
+                }
b5cc75
             }
b5cc75
         }
b5cc75