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

List:       kde-commits
Subject:    KDE/kdegraphics/gwenview/app
From:       Aurélien Gâteau <agateau () kde ! org>
Date:       2011-02-04 22:12:19
Message-ID: 20110204221219.31D28AC8C7 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1218838 by gateau:

Sort actions by alphabetic order

 M  +14 -1     kipiinterface.cpp  


--- trunk/KDE/kdegraphics/gwenview/app/kipiinterface.cpp #1218837:1218838
@@ -197,6 +197,13 @@
 }
 
 
+static bool actionLessThan(QAction* a1, QAction* a2) {
+	QString a1Text = a1->text().replace("&", "");
+	QString a2Text = a2->text().replace("&", "");
+	return QString::compare(a1Text, a2Text, Qt::CaseInsensitive) < 0;
+}
+
+
 void KIPIInterface::loadPlugins() {
 	// Already done
 	if (d->mPluginLoader) {
@@ -247,9 +254,15 @@
 		kWarning() << "No plugin menu found!";
 		return;
 	}
-	Q_FOREACH(const MenuInfo& info, d->mMenuInfoMap) {
+
+	MenuInfoMap::Iterator
+		it = d->mMenuInfoMap.begin(),
+		end = d->mMenuInfoMap.end();
+	for (; it != end; ++it) {
+		MenuInfo& info = it.value();
 		if (!info.mActions.isEmpty()) {
 			QMenu* menu = pluginMenu->addMenu(info.mName);
+			qSort(info.mActions.begin(), info.mActions.end(), actionLessThan);
 			Q_FOREACH(QAction* action, info.mActions) {
 				menu->addAction(action);
 			}
[prev in list] [next in list] [prev in thread] [next in thread] 

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