Permalink
Browse files

Patch to allow configuring order of plugins

  • Loading branch information...
1 parent 19cb83c commit 53cb8341e3ff96caa67dbd7c3e2eb4fef7f1fed8 @MohammadAG MohammadAG committed Jul 11, 2012
@@ -0,0 +1,7 @@
+statusindicatormenu-volume.desktop
+statusindicatormenu-call.desktop
+statusindicatormenu-internetconnection.desktop
+statusindicatormenu-bluetooth.desktop
+statusindicatormenu-dlna.desktop
+statusindicatormenu-presence.desktop
+statusindicatormenu-transfer.desktop
@@ -41,14 +41,8 @@ StatusIndicatorMenuVerticalView::StatusIndicatorMenuVerticalView(StatusIndicator
connect(extensionArea, SIGNAL(extensionInstantiated(MApplicationExtensionInterface*)), this, SLOT(setExtensionLayoutPosition(MApplicationExtensionInterface*)));
extensionArea->setObjectName("StatusIndicatorMenuExtensionArea");
extensionArea->setInProcessFilter(QRegExp());
- extensionArea->setOutOfProcessFilter(QRegExp();
- extensionArea->setOrder((QStringList() << "statusindicatormenu-volume.desktop"
- << "statusindicatormenu-call.desktop"
- << "statusindicatormenu-internetconnection.desktop"
- << "statusindicatormenu-bluetooth.desktop"
- << "statusindicatormenu-dlna.desktop"
- << "statusindicatormenu-presence.desktop"
- << "statusindicatormenu-transfer.desktop"));
+ extensionArea->setOutOfProcessFilter(QRegExp());
+ extensionArea->setOrder(getOrderList());
extensionArea->init();
// Add panning to the expension area
@@ -117,4 +111,41 @@ StatusIndicatorMenuVerticalView::~StatusIndicatorMenuVerticalView()
delete containerWidget;
}
+QStringList StatusIndicatorMenuVerticalView::getOrderList()
+{
+ QFile configFile("/etc/status-menu-items-order.conf");
+ if (!configFile.exists()) {
+ QStringList list;
+ list << "statusindicatormenu-volume.desktop"
+ << "statusindicatormenu-call.desktop"
+ << "statusindicatormenu-internetconnection.desktop"
+ << "statusindicatormenu-bluetooth.desktop"
+ << "statusindicatormenu-dlna.desktop"
+ << "statusindicatormenu-presence.desktop"
+ << "statusindicatormenu-transfer.desktop";
+ return list;
+ };
+
+ configFile.open(QIODevice::ReadOnly);
+ QString orderListString = configFile.readAll();
+ configFile.close();
+ QStringList orderList = orderListString.split("\n");
+
+ QDir pluginDir("/usr/share/meegotouch/applicationextensions");
+ // It should, but do it the right way anyway...
+ if (pluginDir.exists()) {
+ QStringList filters;
+ filters << "statusindicatormenu*.desktop";
+ QStringList pluginNames = pluginDir.entryList(filters);
+ foreach (QString plugin, orderList) {
+ if (pluginNames.contains(plugin))
+ pluginNames.removeAll(plugin);
+ }
+
+ orderList.append(pluginNames);
+ }
+
+ return orderList;
+}
+
M_REGISTER_VIEW_NEW(StatusIndicatorMenuVerticalView, StatusIndicatorMenu)
@@ -21,6 +21,7 @@
#define STATUSINDICATORMENUVERTICALVIEW_H_
#include <mscenewindowview.h>
+#include <QDir>
#include "statusindicatormenustyle.h"
class QGraphicsLinearLayout;
@@ -75,6 +76,12 @@ public slots:
#ifdef UNIT_TEST
friend class Ut_StatusIndicatorMenuVerticalView;
#endif
+
+private:
+ /*!
+ * Returns the order of plugins from a config file
+ */
+ QStringList getOrderList();
};
#endif /* STATUSINDICATORMENUVERTICALVIEW_H_ */

0 comments on commit 53cb834

Please sign in to comment.