From bd27b8e587811a2d607905fcd822ee2da7fcddc7 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 15 Sep 2011 07:07:43 +0000 Subject: Split out system modal dialog header widget git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1253788 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdeui/kdialog.cpp | 52 +++++++++++++++++++++++++++++++++++++++------------- kdeui/kdialog.h | 16 ++++++++++++++++ 2 files changed, 55 insertions(+), 13 deletions(-) diff --git a/kdeui/kdialog.cpp b/kdeui/kdialog.cpp index 9988aecba..b41c8c479 100644 --- a/kdeui/kdialog.cpp +++ b/kdeui/kdialog.cpp @@ -324,24 +324,18 @@ void KDialogQueue::slotShowQueuedDialog() void KDialog::virtual_hook( int, void* ) { /*BASE::virtual_hook( id, data );*/ } -KSMModalDialog::KSMModalDialog(TQWidget* parent) - : TQWidget( 0, "", Qt::WStyle_Customize | Qt::WType_Dialog | Qt::WStyle_Title | Qt::WStyle_StaysOnTop | Qt::WDestructiveClose ), m_allowClose(false) - +KSMModalDialogHeader::KSMModalDialogHeader(TQWidget* parent) + : TQWidget( parent, "", Qt::WDestructiveClose ) { - // Signal that we do not want any window controls to be shown at all - Atom kde_wm_system_modal_notification; - kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); - XChangeProperty(qt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); - TQVBoxLayout* vbox = new TQVBoxLayout( this ); - + TQFrame* frame = new TQFrame( this ); frame->setFrameStyle( TQFrame::NoFrame ); - frame->setLineWidth( tqstyle().tqpixelMetric( TQStyle::PM_DefaultFrameWidth, frame ) ); + frame->setLineWidth( 0 ); // we need to set the minimum size for the window frame->setMinimumWidth(400); vbox->addWidget( frame ); - TQGridLayout* gbox = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); + TQGridLayout* gbox = new TQGridLayout( frame, 1, 1, 0, KDialog::spacingHint() ); TQHBoxLayout* centerbox = new TQHBoxLayout( frame, 0, KDialog::spacingHint() ); TQHBoxLayout* seperatorbox = new TQHBoxLayout( frame, 0, 0 ); @@ -388,15 +382,47 @@ KSMModalDialog::KSMModalDialog(TQWidget* parent) label->setFont( fnt ); centerbox->addWidget( label, AlignCenter ); + gbox->addLayout(centerbox, 0, 0); + gbox->addLayout(seperatorbox, 1, 0); + + setFixedSize( sizeHint() ); +} + +KSMModalDialogHeader::~KSMModalDialogHeader() +{ +} + +KSMModalDialog::KSMModalDialog(TQWidget* parent) + : TQWidget( 0, "", Qt::WStyle_Customize | Qt::WType_Dialog | Qt::WStyle_Title | Qt::WStyle_StaysOnTop | Qt::WDestructiveClose ), m_allowClose(false) + +{ + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(qt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + + TQVBoxLayout* vbox = new TQVBoxLayout( this ); + + TQFrame* frame = new TQFrame( this ); + frame->setFrameStyle( TQFrame::NoFrame ); + frame->setLineWidth( tqstyle().tqpixelMetric( TQStyle::PM_DefaultFrameWidth, frame ) ); + // we need to set the minimum size for the window + frame->setMinimumWidth(400); + vbox->addWidget( frame ); + TQGridLayout* gbox = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); + TQHBoxLayout* centerbox = new TQHBoxLayout( frame, 0, KDialog::spacingHint() ); + m_statusLabel = new TQLabel( i18n("Pondering what to do next").append("..."), frame ); - fnt = m_statusLabel->font(); + TQFont fnt = m_statusLabel->font(); fnt.setBold( false ); fnt.setPointSize( fnt.pointSize() * 1 ); m_statusLabel->setFont( fnt ); gbox->addMultiCellWidget( m_statusLabel, 2, 2, 0, 0, AlignLeft | AlignVCenter ); + KSMModalDialogHeader *theader = new KSMModalDialogHeader(this); + centerbox->addWidget( theader, AlignCenter ); + gbox->addLayout(centerbox, 0, 0); - gbox->addLayout(seperatorbox, 1, 0); setFixedSize( sizeHint() ); setCaption( i18n("Please wait...") ); diff --git a/kdeui/kdialog.h b/kdeui/kdialog.h index 07aa31f24..f26e82f41 100644 --- a/kdeui/kdialog.h +++ b/kdeui/kdialog.h @@ -208,6 +208,22 @@ protected: static KDialogQueue *_self; }; + /** + * \brief The default system modal dialog header + * + * Internal use only + * + * @author Timothy Pearson + */ +class KDEUI_EXPORT KSMModalDialogHeader : public TQWidget +{ + Q_OBJECT + +public: + KSMModalDialogHeader( TQWidget* parent ); + ~KSMModalDialogHeader(); +}; + /** * \brief The default system modal dialog * -- cgit v1.2.1