[rkward-cvs] [rkward/development/plugin_management_to_loadlibs] rkward/plugin: Fix menu ordering when groups are appended to "bottom" group.
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Dec 30 21:26:52 UTC 2014
Git commit a95473a8b062ca4868ed35592f0cb4a0b43da108 by Thomas Friedrichsmeier.
Committed on 30/12/2014 at 21:26.
Pushed by tfry into branch 'development/plugin_management_to_loadlibs'.
Fix menu ordering when groups are appended to "bottom" group.
M +6 -2 rkward/plugin/rkcomponentmap.cpp
http://commits.kde.org/rkward/a95473a8b062ca4868ed35592f0cb4a0b43da108
diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp
index ed33c8e..e0692b8 100644
--- a/rkward/plugin/rkcomponentmap.cpp
+++ b/rkward/plugin/rkcomponentmap.cpp
@@ -166,11 +166,15 @@ void RKComponentGUIXML::Menu::clear () {
RKComponentGUIXML::Group *findOrCreateGroup (RKComponentGUIXML::Menu *parent, const QString group) {
// try to find group
+ int bottom_index = -1;
QList<RKComponentGUIXML::Group*> &list = parent->groups;
for (int i = 0; i < list.size (); ++i) {
if (list[i]->id == group) {
return list[i];
}
+ if (list[i]->id == QLatin1String ("bottom")) {
+ bottom_index = i;
+ }
}
RK_TRACE (PLUGIN);
@@ -182,10 +186,10 @@ RKComponentGUIXML::Group *findOrCreateGroup (RKComponentGUIXML::Menu *parent, co
} else if (group == QLatin1String ("bottom")) {
list.append (new_group);
} else {
- if (list.isEmpty () || list.last ()->id != QLatin1String ("bottom")) { // no "bottom" is defined, yet
+ if (bottom_index < 0) { // no "bottom" is defined, yet
list.append (new_group);
} else { // a bottom group already exists, add new group _above_ that
- list.insert (list.size () - 1, new_group);
+ list.insert (bottom_index, new_group);
}
}
return new_group;
More information about the rkward-tracker
mailing list