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

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