KDialogBase

Benjamin Meyer ben at meyerhome.net
Sat Apr 12 18:17:10 BST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday 12 April 2003 5:55 am, Stephan Kulow wrote:
> Am Saturday 12 April 2003 06:32 schrieb Benjamin Meyer:
> > Can I add the following comment to KDialogBase so that develoers can
> > overrider the default wflags post kde4?
> >
> > /**
> >  * In KDE4 add paramater wflags=WStyle_DialogBorder
> >  */
>
> You can do that for 3.2 too. Add a new method with that parameter (and no
> default argument) and make the old method calling the new one with
> WStyle_DialogBorder. And then you can add a comment to merge them
> in KDE4.
>
> Greetings, Stephan

Ok I have added a new function with the given ability along with comments in 
the old function.  How does this look:

- -Benjamin Meyer

Index: kdialogbase.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kdialogbase.cpp,v
retrieving revision 1.80
diff -u -3 -p -r1.80 kdialogbase.cpp
- --- kdialogbase.cpp     6 Mar 2003 18:02:08 -0000       1.80
+++ kdialogbase.cpp     12 Apr 2003 16:14:11 -0000
@@ -147,6 +147,35 @@ KDialogBase::KDialogBase( int dialogFace
   setupLayout();
 }

+KDialogBase::KDialogBase( int dialogFace, const QString &caption,
+                         int buttonMask, ButtonCode defaultButton,
+                         QWidget *parent, const char *name, bool modal, 
WFlags f,
+                         bool separator, const KGuiItem &user1,
+                         const KGuiItem &user2, const KGuiItem &user3 )
+  :KDialog( parent, name, modal, f ),
+   mTopLayout(0), mMainWidget(0), mUrlHelp(0), mJanus(0), mActionSep(0),
+   mIsActivated(false), mShowTile(false), mMessageBoxMode(false),
+   mButtonOrientation(Horizontal)
+{
+  d = new KDialogBasePrivate;
+  setCaption( caption );
+
+  makeRelay();
+  connect( this, SIGNAL(layoutHintChanged()), this, SLOT(updateGeometry()) );
+
+  mJanus = new KJanusWidget( this, "janus", dialogFace );
+  connect(mJanus, SIGNAL(aboutToShowPage(QWidget *)),
+          this, SIGNAL(aboutToShowPage(QWidget *)));
+
+  if( mJanus == 0 || mJanus->isValid() == false ) { return; }
+
+  enableButtonSeparator( separator );
+  makeButtonBox( buttonMask, defaultButton, user1, user2, user3 );
+
+  mIsActivated = true;
+  setupLayout();
+}
+
 KDialogBase::KDialogBase( const QString &caption, int buttonMask,
                          ButtonCode defaultButton, ButtonCode escapeButton,
                          QWidget *parent, const char *name, bool modal,
Index: kdialogbase.h
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kdialogbase.h,v
retrieving revision 1.83
diff -u -3 -p -r1.83 kdialogbase.h
- --- kdialogbase.h       11 Feb 2003 19:00:27 -0000      1.83
+++ kdialogbase.h       12 Apr 2003 16:14:11 -0000
@@ -291,6 +291,10 @@ class KDialogBase : public KDialog
                 const KGuiItem &user3=KGuiItem() );

     /**
+     * @depriciated see next function which now has WFlags
+     * remove this in KDE4 and give default values for parent, name model and 
f
+     * in next function.  Also add WFlag to rest of the constructors.
+     *
      * Constructor for the predefined layout mode where you specify the
      * kind of layout (face).
      *
@@ -317,6 +321,39 @@ class KDialogBase : public KDialog
                 int buttonMask, ButtonCode defaultButton,
                 QWidget *parent=0, const char *name=0, bool modal=true,
                 bool separator=false,
+                const KGuiItem &user1=KGuiItem(),
+                const KGuiItem &user2=KGuiItem(),
+                const KGuiItem &user3=KGuiItem() );
+
+
+    /**
+     * Constructor for the predefined layout mode where you specify the
+     * kind of layout (face).
+     *
+     * @param dialogFace You can use TreeList, Tabbed, Plain, Swallow or
+     *        IconList.
+     * @param caption The dialog caption. Do not specify the application name
+     *        here. The class will take care of that.
+     * @param buttonMask Specifies which buttons will be visible. If zero
+     *        (0) no button box will be made.
+     * @param defaultButton Specifies which button will be marked as
+     *        the default.
+     * @param parent Parent of the dialog.
+     * @param name Dialog name (for internal use only).
+     * @param modal Controls dialog modality. If @p false, the rest of the
+     *        program interface (example: other dialogs) is accessible while
+     *        the dialog is open.
+     * @param f widget flags, by default just set to WStyle_DialogBorder.
+     * @param separator If @p true, a separator line is drawn between the
+     *        action buttons and the main widget.
+     * @param user1 User button1 text item.
+     * @param user2 User button2 text item.
+     * @param user3 User button3 text item.
+     */
+    KDialogBase( int dialogFace, const QString &caption,
+                int buttonMask, ButtonCode defaultButton,
+                QWidget *parent, const char *name, bool modal, WFlags f,
+                bool separator=false,
                 const KGuiItem &user1=KGuiItem(),
                 const KGuiItem &user2=KGuiItem(),
                 const KGuiItem &user3=KGuiItem() );
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+mEoZ1rZ3LTw38vIRAkFvAJ4tucxsRzhNiqf0MnoT6sXp3DYQmwCfSOY4
ZhZYY8TksqOHYmd14y9Ynr0=
=qrG6
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list