[PATCH] Using the new KToolBarMenuAction without breaking BRANCH compatibility

Nadeem Hasan nhasan at nadmm.com
Thu May 30 19:52:03 BST 2002


Hi all,

The following patch lets the apps use the new KToolBarMenuAction transparently
without making them depend on kdelibs 3.1 (HEAD). It does that by naming the
new action same as the old one (options_show_toolbar) and renames the old one
so that apps using this name automagically get the new action without requiring
any changes to their code. The code for creating the KStdAction::showToolbar()
can then be removed from the apps just before the 3.1 release. Did I miss 
anything?

Cheers,
-- 
Nadeem Hasan
nhasan at nadmm.com
http://www.nadmm.com/


Index: kmainwindow.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kmainwindow.cpp,v
retrieving revision 1.67
diff -u -r1.67 kmainwindow.cpp
--- kmainwindow.cpp     2002/05/26 17:07:07     1.67
+++ kmainwindow.cpp     2002/05/30 16:59:32
@@ -186,7 +186,7 @@
     d->autoSaveSettings = false;
     d->autoSaveWindowSize = true; // for compatibility
     d->kaccel = actionCollection()->kaccel();
-    d->toolbarMenu=new KToolBarMenuAction(this,"toolbars_showhide");
+    d->toolbarMenu=new KToolBarMenuAction(this,"options_show_toolbar");
     if ((d->care_about_geometry = beeing_first)) {
         beeing_first = false;
         if ( kapp->geometryArgument().isNull() ) // if there is no geometry, it doesn't mater
Index: kstdaction.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kstdaction.cpp,v
retrieving revision 1.68
diff -u -r1.68 kstdaction.cpp
--- kstdaction.cpp      2002/05/29 20:48:46     1.68
+++ kstdaction.cpp      2002/05/30 16:59:32
@@ -96,7 +96,7 @@
        { Spelling,      KStdAccel::AccelNone, "tools_spelling", I18N_NOOP("&Spelling..."), 0, "spellcheck" },

        { ShowMenubar,   KStdAccel::ShowMenubar, "options_show_menubar", I18N_NOOP("Show &Menubar"), 0, "showmenu" },
-       { ShowToolbar,   KStdAccel::AccelNone, "options_show_toolbar", I18N_NOOP("Show &Toolbar"), 0, 0 },
+       { ShowToolbar,   KStdAccel::AccelNone, "options_show_toolbar_old", I18N_NOOP("Show &Toolbar"), 0, 0 },
        { ShowStatusbar, KStdAccel::AccelNone, "options_show_statusbar", I18N_NOOP("Show St&atusbar"), 0, 0 },
        { SaveOptions,   KStdAccel::AccelNone, "options_save_options", I18N_NOOP("&Save Settings"), 0, 0 },
        { KeyBindings,   KStdAccel::AccelNone, "options_configure_keybinding", I18N_NOOP("Configure S&hortcuts..."), 0,"configure_shortcuts" },





More information about the kde-core-devel mailing list