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

List:       kde-commits
Subject:    KDE/kdelibs
From:       David Faure <faure () kde ! org>
Date:       2008-01-04 12:22:35
Message-ID: 1199449355.152150.25242.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 757188 by dfaure:

Reimplement configureToolbars() slot in KParts::MainWindow so that it can call
 new KEditToolBar(guiFactory(), this) instead of new KEditToolBar(actionCollection(), this).
Otherwise KParts apps would be missing the toolbars and actions of their parts in the toolbar editor.
 (which is currently solved by duplicating this slot's code in every app)


 M  +1 -4      kdeui/widgets/kmainwindow.cpp  
 M  +1 -1      kdeui/xmlgui/kxmlguiwindow.h  
 M  +28 -12    kparts/mainwindow.cpp  
 M  +3 -0      kparts/mainwindow.h  
 M  +5 -0      kparts/tests/example.cpp  
 M  +4 -1      kparts/tests/kpartstest_part1.rc  
 M  +1 -1      kparts/tests/kpartstest_shell.rc  
 M  +3 -1      kparts/tests/parts.cpp  


--- trunk/KDE/kdelibs/kdeui/widgets/kmainwindow.cpp #757187:757188
@@ -43,16 +43,13 @@
 #include <QtGui/QSessionManager>
 #include <QtGui/QStyle>
 #include <QtGui/QWidget>
-#if 0
-#include <qdom.h>
-#endif
 
 #include <kaction.h>
 #include <kapplication.h>
 #include <kauthorized.h>
 #include <kconfig.h>
 #include <kdebug.h>
-#include <kedittoolbar.h>
+#include <kdialog.h>
 #include <khelpmenu.h>
 #include <klocale.h>
 #include <kmenubar.h>
--- trunk/KDE/kdelibs/kdeui/xmlgui/kxmlguiwindow.h #757187:757188
@@ -326,7 +326,7 @@
      *                                actionCollection() );
      * \endcode
      */
-    virtual void configureToolbars(); // TODO KDE4: reimplement in KParts::MainWindow
+    virtual void configureToolbars();
 
     /**
      * Apply a state change
--- trunk/KDE/kdelibs/kparts/mainwindow.cpp #757187:757188
@@ -18,6 +18,8 @@
    Boston, MA 02110-1301, USA.
 */
 
+#include "mainwindow.h"
+#include <kedittoolbar.h>
 #include <kparts/mainwindow.h>
 #include <kparts/event.h>
 #include <kparts/part.h>
@@ -41,19 +43,21 @@
 class MainWindowPrivate
 {
 public:
-  MainWindowPrivate()
-  {
-    m_activePart = 0;
-    m_bShellGUIActivated = false;
-    m_helpMenu = 0;
-  }
-  ~MainWindowPrivate()
-  {
-  }
+    MainWindowPrivate()
+        : m_activePart(0),
+          m_bShellGUIActivated(false),
+          m_helpMenu(0),
+          toolBarEditor(0)
+    {
+    }
+    ~MainWindowPrivate()
+    {
+    }
 
-  QPointer<Part> m_activePart;
-  bool m_bShellGUIActivated;
-  KHelpMenu *m_helpMenu;
+    QPointer<Part> m_activePart;
+    bool m_bShellGUIActivated;
+    KHelpMenu *m_helpMenu;
+    QPointer<KEditToolBar> toolBarEditor;
 };
 }
 
@@ -183,4 +187,16 @@
     applyMainWindowSettings(cg);
 }
 
+void KParts::MainWindow::configureToolbars()
+{
+    KConfigGroup cg(KGlobal::config(), QString());
+    saveMainWindowSettings(cg);
+    if (!d->toolBarEditor) {
+      d->toolBarEditor = new KEditToolBar(guiFactory(), this);
+      d->toolBarEditor->setAttribute(Qt::WA_DeleteOnClose);
+      connect(d->toolBarEditor, SIGNAL(newToolBarConfig()), SLOT(saveNewToolbarConfig()));
+    }
+    d->toolBarEditor->show();
+}
+
 #include "mainwindow.moc"
--- trunk/KDE/kdelibs/kparts/mainwindow.h #757187:757188
@@ -58,6 +58,9 @@
    */
   virtual ~MainWindow();
 
+public Q_SLOTS:
+  virtual void configureToolbars();
+
 protected Q_SLOTS:
 
   /**
--- trunk/KDE/kdelibs/kparts/tests/example.cpp #757187:757188
@@ -10,6 +10,7 @@
 #include <kiconloader.h>
 #include <kstandarddirs.h>
 #include <kapplication.h>
+#include <kxmlguifactory.h>
 #include <kmessagebox.h>
 #include <kaction.h>
 #include <kactioncollection.h>
@@ -17,6 +18,7 @@
 #include <kicon.h>
 
 Shell::Shell()
+    : KParts::MainWindow()
 {
     // KXMLGUIClient looks in the "data" resource for the .rc files
     // This line is for test programs only!
@@ -62,6 +64,9 @@
 //  (void)new KAction( "Yet another menu item", coll, "shell_yami" );
 //  (void)new KAction( "Yet another submenu item", coll, "shell_yasmi" );
 
+    KStandardAction::configureToolbars(this, SLOT(configureToolbars() ), actionCollection());
+    KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());
+
     setCentralWidget( m_splitter );
     m_splitter->setMinimumSize( 400, 300 );
 
--- trunk/KDE/kdelibs/kparts/tests/kpartstest_part1.rc #757187:757188
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="Part">
+<kpartgui name="Part" version="4">
 <MenuBar>
  <Menu name="file"><Text>&amp;File</Text>
   <Action name="p1_blah"/>
@@ -11,6 +11,9 @@
   </Menu>
  </Menu>
 </MenuBar>
+<ToolBar name="mainToolBar">
+ <Action name="p1_blah"/>
+</ToolBar>
 <ToolBar name="Part1-ToolBar">
  <Action name="p1_blah"/>
 </ToolBar>
--- trunk/KDE/kdelibs/kparts/tests/kpartstest_shell.rc #757187:757188
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="Shell">
+<kpartgui name="Shell" version="4">
 <MenuBar>
   <Menu name="file"><Text>&amp;File</Text>
    <Action name="open_local_file"/>
--- trunk/KDE/kdelibs/kparts/tests/parts.cpp #757187:757188
@@ -2,6 +2,7 @@
 #include <kparts/event.h>
 
 #include "parts.h"
+#include <kactioncollection.h>
 
 #include <QtGui/QCheckBox>
 #include <QtCore/QFile>
@@ -32,7 +33,8 @@
     m_componentData.dirs()->addResourceDir( "data", KDESRCDIR );
     setXMLFile( "kpartstest_part1.rc" );
 
-    /*KAction * paBlah = */ //new KAction( "Blah", "filemail", 0, actionCollection(), "p1_blah" );
+    KAction* testAction = actionCollection()->addAction("p1_blah");
+    testAction->setText("Part1's action");
 }
 
 Part1::~Part1()
[prev in list] [next in list] [prev in thread] [next in thread] 

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