[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kdepim/enterprise4/kdelibs-4.0.83/kdeui
From: Jaroslaw Staniek <js () iidea ! pl>
Date: 2008-07-09 23:46:55
Message-ID: 1215647215.735794.20373.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 830201 by staniek:
KdePrint::createPrintDialog() on non-X11
Based on the fact that only X11 supports custom setting tabs in the print dialog \
(http://doc.trolltech.com/4.4/qabstractprintdialog.html#setOptionTabs)
On non-X11 tagets:
- do not build kcupsoptions*.{cpp|ui} and do not instantiate KCupsOptions*
objects
- reparent widgets from QList<QWidget*> customTabs to the dialog even if we
don't use them, to avoid leaks
Also:
- simplify the code by calling one overload of createPrintDialog() from another
- add more docs for non-X11 systems and about object ownership
(backported from trunk r830200)
M +10 -6 CMakeLists.txt
M +12 -9 dialogs/kdeprintdialog.cpp
M +10 -5 dialogs/kdeprintdialog.h
--- branches/kdepim/enterprise4/kdelibs-4.0.83/kdeui/CMakeLists.txt #830200:830201
@@ -65,9 +65,6 @@
dialogs/kassistantdialog.cpp
dialogs/kconfigdialog.cpp
dialogs/kconfigdialogmanager.cpp
- dialogs/kcupsoptionswidget_p.cpp
- dialogs/kcupsoptionsjobwidget_p.cpp
- dialogs/kcupsoptionspageswidget_p.cpp
dialogs/kbugreport.cpp
dialogs/kdeprintdialog.cpp
dialogs/kdialog.cpp
@@ -236,7 +233,10 @@
)
if (Q_WS_X11)
- set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} util/kkeyserver_x11.cpp )
+ set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} util/kkeyserver_x11.cpp
+ dialogs/kcupsoptionswidget_p.cpp
+ dialogs/kcupsoptionsjobwidget_p.cpp
+ dialogs/kcupsoptionspageswidget_p.cpp )
endif (Q_WS_X11)
if (Q_WS_MAC)
set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} util/kkeyserver_mac.cpp )
@@ -267,8 +267,6 @@
endif(MINGW)
set( kdeui_UI
- dialogs/kcupsoptionspageswidget.ui
- dialogs/kcupsoptionsjobwidget.ui
dialogs/kpassworddialog.ui
dialogs/knewpassworddialog.ui
dialogs/kshortcutsdialog.ui
@@ -277,6 +275,12 @@
sonnet/configui.ui
)
+if (Q_WS_X11)
+ set( kdeui_UI ${kdeui_UI} dialogs/kcupsoptionspageswidget.ui
+ dialogs/kcupsoptionsjobwidget.ui
+ )
+endif (Q_WS_X11)
+
kde4_add_ui_files(kdeui_LIB_SRCS ${kdeui_UI} )
--- branches/kdepim/enterprise4/kdelibs-4.0.83/kdeui/dialogs/kdeprintdialog.cpp \
#830200:830201 @@ -21,8 +21,11 @@
**/
#include "kdeprintdialog.h"
+#ifdef Q_WS_X11
#include "kcupsoptionspageswidget_p.h"
#include "kcupsoptionsjobwidget_p.h"
+#endif
+
#include "kdebug.h"
#include "kdialog.h"
#include "klocale.h"
@@ -31,25 +34,25 @@
#include <QPrintDialog>
QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
- const QList<QWidget*> &customTabs,
- QWidget *parent)
+ const QList<QWidget*> &customTabs,
+ QWidget *parent)
{
QPrintDialog *dialog = new QPrintDialog( printer, parent );
+#ifdef Q_WS_X11
KCupsOptionsPagesWidget *cupsOptionsPagesTab = new KCupsOptionsPagesWidget( \
dialog );
KCupsOptionsJobWidget *cupsOptionsJobTab = new KCupsOptionsJobWidget( dialog );
dialog->setOptionTabs( QList<QWidget*>() << cupsOptionsPagesTab << \
cupsOptionsJobTab << customTabs ); +#else
+ foreach( QWidget* w, customTabs ) // reparent to avoid leaks
+ w->setParent( dialog );
+#endif
dialog->setWindowTitle( KDialog::makeStandardCaption( i18nc( "@title:window", \
"Print" ) ) ); return dialog;
}
QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
- QWidget *parent)
+ QWidget *parent)
{
- QPrintDialog *dialog = new QPrintDialog( printer, parent );
- KCupsOptionsPagesWidget *cupsOptionsPagesTab = new KCupsOptionsPagesWidget( \
dialog );
- KCupsOptionsJobWidget *cupsOptionsJobTab = new KCupsOptionsJobWidget( dialog );
- dialog->setOptionTabs( QList<QWidget*>() << cupsOptionsPagesTab << \
cupsOptionsJobTab );
- dialog->setWindowTitle( KDialog::makeStandardCaption( i18nc( "@title:window", \
"Print" ) ) );
- return dialog;
+ return KdePrint::createPrintDialog(printer, QList<QWidget*>(), parent);
}
--- branches/kdepim/enterprise4/kdelibs-4.0.83/kdeui/dialogs/kdeprintdialog.h \
#830200:830201 @@ -37,9 +37,13 @@
/**
* Creates a printer dialog for a QPrinter with the given custom widgets.
*
- * Note that the custom widgets will @b not be shown on Qt versions prior to
- * 4.3.2.
+ * Note that the custom widgets are only supported on X11
+ * and will @b not be shown on Qt versions prior to 4.3.2.
+ * On non-X11 systems it is preferred to provide the widgets
+ * within configuration dialog of the application.
*
+ * Setting the widgets will transfer their ownership to the print dialog
+ * even on non-X11 systems.
* The caller takes ownership of the dialog and is responsible
* for deleting it.
*
@@ -48,10 +52,11 @@
* @param customTabs a list of custom widgets to show as tabs, the name printed \
on the tab will
* be taken from the widgets windowTitle().
* @see QWidget::setWindowTitle()
+ * @see QAbstractPrintDialog::setOptionTabs()
*/
KDEUI_EXPORT QPrintDialog *createPrintDialog(QPrinter *printer,
- const QList<QWidget*> \
&customTabs,
- QWidget *parent = 0);
+ const QList<QWidget*> &customTabs,
+ QWidget *parent = 0);
/**
* Creates a printer dialog for a QPrinter
@@ -63,7 +68,7 @@
* @param parent the parent for the dialog
*/
KDEUI_EXPORT QPrintDialog *createPrintDialog(QPrinter *printer,
- QWidget *parent = 0);
+ QWidget *parent = 0);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic