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

List:       kde-devel
Subject:    Re: KParts using clarification
From:       Rafael =?iso-8859-1?q?Fern=E1ndez_L=F3pez?= <ereslibre () kde ! org>
Date:       2008-08-31 14:55:01
Message-ID: 200808311655.03587.ereslibre () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Hi Nick,

> but api docs say that this is the wrong way to do: I should use
>   createGUI(m_doc)
>   setupGUI(ToolBar | Keys | StatusBar | Save,"editorui.rc"))
> but this approach doesn't work.
>
> What are your suggestions?

I have been doing some changes on xmlgui. It seems this actions in the order 

>   createGUI(m_doc);
>   setupGUI(ToolBar | Keys | StatusBar | Save,"editorui.rc"));

is not working. You need to do:

>   setupGUI(ToolBar | Keys | StatusBar | Save,"editorui.rc"));
>   createGUI(m_doc);

Where in the docs is said the inverse order ?

I have been working on the Save flag for setupGUI, and I have done some changes 
in certain apps changing:

setupGUI
createGUI

with

createGUI
setupGUI

what is wrong. I thought the actions were being added when they were created 
directly... but seems that no.

Please try the attached patch with order:

setupGUI
createGUI


Regards,
Rafael Fernández López.


["kdelibs.diff" (text/x-patch)]

diff --git a/kdeui/xmlgui/kxmlguiwindow.cpp b/kdeui/xmlgui/kxmlguiwindow.cpp
index f1d8de7..027f7ba 100644
--- a/kdeui/xmlgui/kxmlguiwindow.cpp
+++ b/kdeui/xmlgui/kxmlguiwindow.cpp
@@ -76,6 +76,7 @@
 class KXmlGuiWindowPrivate : public KMainWindowPrivate {
 public:
     bool showHelpMenu:1;
+    bool saveFlag:1;
 
     KDEPrivate::ToolBarHandler *toolBarHandler;
     KToggleAction *showStatusBarAction;
@@ -88,6 +89,7 @@ KXmlGuiWindow::KXmlGuiWindow( QWidget* parent, Qt::WFlags f )
 {
     K_D(KXmlGuiWindow);
     d->showHelpMenu = true;
+    d->saveFlag = false;
     d->toolBarHandler = 0;
     d->showStatusBarAction = 0;
     d->factory = 0;
@@ -180,6 +182,8 @@ void KXmlGuiWindow::setupGUI( StandardWindowOptions options, \
const QString & xml  }
 
 void KXmlGuiWindow::setupGUI( const QSize & defaultSize, StandardWindowOptions \
options, const QString & xmlfile ) { +    K_D(KXmlGuiWindow);
+
     if( options & Keys ){
         KStandardAction::keyBindings(guiFactory(),
                     SLOT(configureShortcuts()), actionCollection());
@@ -195,11 +199,13 @@ void KXmlGuiWindow::setupGUI( const QSize & defaultSize, \
StandardWindowOptions o  SLOT(configureToolbars() ), actionCollection());
     }
 
+    d->saveFlag = options & Save;
+
     if( options & Create ){
         createGUI(xmlfile);
     }
 
-    if( options & Save ){
+    if (d->saveFlag) {
         // setupGUI() is typically called in the constructor before show(),
         // so the default window size will be incorrect unless the application
         // hard coded the size which they should try not to do (i.e. use
@@ -216,9 +222,7 @@ void KXmlGuiWindow::setupGUI( const QSize & defaultSize, \
StandardWindowOptions o  {
           adjustSize();
         }
-        setAutoSaveSettings();
     }
-
 }
 
 void KXmlGuiWindow::createGUI( const QString &xmlfile )
@@ -227,6 +231,11 @@ void KXmlGuiWindow::createGUI( const QString &xmlfile )
     // disabling the updates prevents unnecessary redraws
     //setUpdatesEnabled( false );
 
+    if (d->saveFlag) {
+        setAutoSaveSettings();
+        d->saveFlag = false;
+    }
+
     // just in case we are rebuilding, let's remove our old client
     guiFactory()->removeClient( this );
 


["signature.asc" (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


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

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