Bug 306258 - Changing the toolbar contents breaks Okular menus
Summary: Changing the toolbar contents breaks Okular menus
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Unclassified
Component: kdeui (show other bugs)
Version: 4.9
Platform: unspecified Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 290400 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-09-04 17:25 UTC by Albert Astals Cid
Modified: 2013-01-08 14:17 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Astals Cid 2012-09-04 17:25:30 UTC
The can be reproduced as follows.
  * Make sure you have no .kde/share/apps/okular/part.rc nor .kde/share/apps/okular/shell.rc
  * Open okular
  * Check the File menu looks nice
  * Go to configure toolbars
  * Add something to the first toolbar (e.g. Open Recent)
  * Check the File menu looks crap

Reproducible: Always
Comment 1 Albert Astals Cid 2012-09-04 17:25:55 UTC
David's answer/suggestion

Yep. If you diff the global and the local shell.rc, you can see that the 
ui_standards.rc merging got "expanded" into the local file. I.e. it saves the 
result of the merging, rather than the input for it.

When okular reloads shell.rc (e.g. on startup), it will then do the 
ui_standards.rc merging again, which seems to do wrong things (didn't look 
exactly into details, but nothing says that doing ui_standards.rc merging 
twice should lead to the same result...).

IIRC we have no other choice than to save the after-merging xml tree, so we 
should add noMerge="1" to all menus in the saved xml. Tested by modifying 
shell.rc locally, fixes the problem.
Comment 2 Albert Astals Cid 2012-09-23 08:52:36 UTC
Git commit eafa8bf55e87595bf975b0654506b932f4b19a76 by Albert Astals Cid.
Committed on 23/09/2012 at 10:51.
Pushed by aacid into branch 'KDE/4.9'.

Set noMerge=1 for menus when saving the xml file in kedittoolbar

As discussed with David add a noMerge=1 to xmlgui menus when saving them due to a edit toolbar action

REVIEW: 106535
FIXED-IN: 4.9.2

M  +10   -0    kdeui/dialogs/kedittoolbar.cpp

http://commits.kde.org/kdelibs/eafa8bf55e87595bf975b0654506b932f4b19a76
Comment 3 Jekyll Wu 2012-09-24 13:25:46 UTC
*** Bug 290400 has been marked as a duplicate of this bug. ***
Comment 4 Robby Stephenson 2013-01-07 05:15:10 UTC
I believe this broke Tellico's menus. If I edit the toolbar in Tellico, my local copy of tellicoui.rc gets saved with noMerge="1" everywhere. But, it doesn't appear to be the actual merged xml tree, just the original tellicoui.rc installed on the system.

I'm not sure what I'm doing wrong with Tellico such that it breaks, but okular doesn't have a problem. Any suggestions to what I should check? I'm not doing anything more in Tellico that createGUI() along with using KEditToolBar dlg(actionCollection());

This showed up in a forum discussion, http://forum.kde.org/viewtopic.php?f=200&t=109528

My system is currently KDE 4.9.4 if that matters.
Comment 5 Albert Astals Cid 2013-01-07 18:51:20 UTC
I'd say your slotNewToolbarConfig looks a bit of "i'm doing lots of xmlgui i don't really understand but works but now it stopped working". Which is a typical shortcoming of XMLGUI, it's hard to do it right (i don't think i understand it totally either).

The following patch should make XMLGui take care of that making everyone happier :-)  (I'm not saying there's a bug in the old patch i wrote here, but this patch fixes the issue and removes code, so I'm all for you using this code)

Comments?

diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2b0b644..5e6af73 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -603,9 +603,6 @@ void MainWindow::initActions() {
   setStandardToolBarMenuEnabled(true);
   createStandardStatusBarAction();
 
-  KStandardAction::configureToolbars(this, SLOT(slotConfigToolbar()), actionCollection());
-  KStandardAction::keyBindings(this, SLOT(slotConfigKeys()), actionCollection());
-
   m_toggleGroupWidget = new KToggleAction(i18n("Show Grou&p View"), this);
   m_toggleGroupWidget->setToolTip(i18n("Enable/disable the group view"));
   connect(m_toggleGroupWidget, SIGNAL(triggered()), SLOT(slotToggleGroupWidget()));
@@ -672,6 +669,7 @@ void MainWindow::initActions() {
   action->setShortcutConfigurable(false);
   actionCollection()->addAction(QLatin1String("quick_filter"), action);
 
+  setupGUI(Keys | ToolBar);
 #ifdef UIFILE
   myWarning() << "call!";
   createGUI(UIFILE);
@@ -1377,32 +1375,6 @@ void MainWindow::slotEditDeselect() {
   Controller::self()->slotUpdateSelection(Data::EntryList());
 }
 
-void MainWindow::slotConfigToolbar() {
-  KConfigGroup config(KGlobal::config(), QLatin1String("Main Window Options"));
-  saveMainWindowSettings(config);
-#ifdef UIFILE
-  KEditToolBar dlg(actionCollection(), UIFILE);
-#else
-  KEditToolBar dlg(actionCollection());
-#endif
-  connect(&dlg, SIGNAL(newToolbarConfig()), this, SLOT(slotNewToolbarConfig()));
-  dlg.exec();
-}
-
-void MainWindow::slotNewToolbarConfig() {
-  KConfigGroup config(KGlobal::config(), QLatin1String("Main Window Options"));
-  applyMainWindowSettings(config);
-#ifdef UIFILE
-  createGUI(UIFILE);
-#else
-  createGUI();
-#endif
-}
-
-void MainWindow::slotConfigKeys() {
-  KShortcutsDialog::configure(actionCollection());
-}
-
 void MainWindow::slotToggleGroupWidget() {
   if(m_toggleGroupWidget->isChecked()) {
     m_viewTabs->show();
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 47dc54e..2d74164 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -237,18 +237,6 @@ public slots:
   void slotStatusMsg(const QString& text);
   void slotClearStatus();
   /**
-   * Shows the configuration window for the toolbars.
-   */
-  void slotConfigToolbar();
-  /**
-   * Updates the toolbars;
-   */
-  void slotNewToolbarConfig();
-  /**
-   * Shows the configuration window for the key bindgins.
-   */
-  void slotConfigKeys();
-  /**
    * Updates the entry count in the status bar.
    */
   void slotEntryCount();
Comment 6 Robby Stephenson 2013-01-08 14:17:04 UTC
(In reply to comment #5)
> I'd say your slotNewToolbarConfig looks a bit of "i'm doing lots of xmlgui i
> don't really understand but works but now it stopped working".

I'd say that's exactly right! Thanks so much for taking a look, and your patch does indeed seem to work. The one thing I noticed after applying it is that one toolbar had "Text Under Icon" and one had "Text Alongside Icon", but that's easily tweaked. That may be a consequence of some old config setting I had laying around.