Commit b13705d8 authored by Jan Möbius's avatar Jan Möbius

Marlin:

Fixed bug 194 ( Race condition when adding context menus)

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9049 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 593f9754
...@@ -479,10 +479,15 @@ bool CoreWidget::addContextMenus( QMenu* _menu , ContextMenuType _type , int _id ...@@ -479,10 +479,15 @@ bool CoreWidget::addContextMenus( QMenu* _menu , ContextMenuType _type , int _id
} }
/// \todo Sort the menu entries by the order given in visibleContextMenus /// \todo Sort the menu entries by the order given in visibleContextMenus
//first add all menus //first add all menus
QMapIterator<QString, QAction*> it(menuMap); QMapIterator<QString, QAction*> it(menuMap);
QStringList visible = viewModes_[id]->visibleContextMenus; QStringList visible = viewModes_[id]->visibleContextMenus;
if (visible.contains("ALL_THAT_EXIST")) {
//this plugin adds all context menus, no special configuration so far.
visible = viewModes_[0]->visibleContextMenus;
}
visible.replaceInStrings(QRegExp(".*>"), ""); visible.replaceInStrings(QRegExp(".*>"), "");
while (it.hasNext()) { while (it.hasNext()) {
......
...@@ -110,7 +110,7 @@ void CoreWidget::slotAddViewModeToolboxes(QString _mode, bool _custom, QStringLi ...@@ -110,7 +110,7 @@ void CoreWidget::slotAddViewModeToolboxes(QString _mode, bool _custom, QStringLi
vm->icon = "Unknown.png"; vm->icon = "Unknown.png";
vm->visibleToolbars = QString("Main Toolbar;Viewer Toolbar").split(";"); vm->visibleToolbars = QString("Main Toolbar;Viewer Toolbar").split(";");
vm->visibleContextMenus = viewModes_[0]->visibleContextMenus; vm->visibleContextMenus = QString("ALL_THAT_EXIST").split(" ");
if (_custom) { if (_custom) {
viewModes_.push_back(vm); viewModes_.push_back(vm);
...@@ -156,7 +156,7 @@ void CoreWidget::slotAddViewModeToolbars(QString _mode, bool _custom, QStringLis ...@@ -156,7 +156,7 @@ void CoreWidget::slotAddViewModeToolbars(QString _mode, bool _custom, QStringLis
vm->custom = _custom; vm->custom = _custom;
vm->icon = "Unknown.png"; vm->icon = "Unknown.png";
vm->visibleContextMenus = viewModes_[0]->visibleContextMenus; vm->visibleContextMenus = QString("ALL_THAT_EXIST").split(" ");
if (_custom) { if (_custom) {
viewModes_.push_back(vm); viewModes_.push_back(vm);
......
...@@ -296,7 +296,7 @@ void viewModeWidget::slotSetIcon() { ...@@ -296,7 +296,7 @@ void viewModeWidget::slotSetIcon() {
} }
// ======================================================================================================= // =======================================================================================================
// ToolBox and ToolBar Lists update functions // ToolBox, ToolBar and ContextMenu Lists update functions
// ======================================================================================================= // =======================================================================================================
void viewModeWidget::slotSetAllWidgets(){ void viewModeWidget::slotSetAllWidgets(){
toolboxList->clear(); toolboxList->clear();
...@@ -319,6 +319,8 @@ void viewModeWidget::slotSetAllWidgets(){ ...@@ -319,6 +319,8 @@ void viewModeWidget::slotSetAllWidgets(){
toolboxes = modes_[i]->visibleToolboxes; toolboxes = modes_[i]->visibleToolboxes;
toolbars = modes_[i]->visibleToolbars; toolbars = modes_[i]->visibleToolbars;
contextmenus = modes_[i]->visibleContextMenus; contextmenus = modes_[i]->visibleContextMenus;
if (contextmenus.contains("ALL_THAT_EXIST"))
contextmenus = modes_[0]->visibleContextMenus;
toolboxList->addItems(toolboxes); //add corresponding widgets toolboxList->addItems(toolboxes); //add corresponding widgets
toolbarList->addItems(toolbars); toolbarList->addItems(toolbars);
contextMenuList->addItems(contextmenus); contextMenuList->addItems(contextmenus);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment