• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

kmessagebox.cpp

Go to the documentation of this file.
00001 /*  This file is part of the KDE libraries
00002     Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; version 2
00007     of the License.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "kmessagebox.h"
00021 
00022 #include <QtCore/QPointer>
00023 #include <QtGui/QCheckBox>
00024 #include <QtGui/QGroupBox>
00025 #include <QtGui/QLabel>
00026 #include <QtGui/QLayout>
00027 #include <QtGui/QListWidget>
00028 #include <QtGui/QScrollArea>
00029 #include <QtGui/QTextDocumentFragment>
00030 
00031 #include <kapplication.h>
00032 #include <kconfig.h>
00033 #include <kdialog.h>
00034 #include <kdialogqueue_p.h>
00035 #include <kglobalsettings.h>
00036 #include <klocale.h>
00037 #include <knotification.h>
00038 #include <kiconloader.h>
00039 #include <kconfiggroup.h>
00040 #include <ktextedit.h>
00041 
00042 #ifdef Q_WS_X11
00043 #include <qx11info_x11.h>
00044 #include <X11/Xlib.h>
00045 #include <fixx11h.h>
00046 #endif
00047 
00048 // Some i18n filters, that standard button texts are piped through
00049 // (the new KGuiItem object with filtered text is created from the old one).
00050 
00051 // i18n: Filter for the Yes-button text in standard message dialogs,
00052 // after the message caption/text have been translated.
00053 #define I18N_FILTER_BUTTON_YES(src, dst) \
00054     KGuiItem dst(src); \
00055     dst.setText( i18nc( "@action:button filter-yes", "%1", src.text() ) );
00056 
00057 // i18n: Filter for the No-button text in standard message dialogs,
00058 // after the message caption/text have been translated.
00059 #define I18N_FILTER_BUTTON_NO(src, dst) \
00060     KGuiItem dst(src); \
00061     dst.setText( i18nc( "@action:button filter-no", "%1", src.text() ) );
00062 
00063 // i18n: Filter for the Continue-button text in standard message dialogs,
00064 // after the message caption/text have been translated.
00065 #define I18N_FILTER_BUTTON_CONTINUE(src, dst) \
00066     KGuiItem dst(src); \
00067     dst.setText( i18nc( "@action:button filter-continue", "%1", src.text() ) );
00068 
00069 // i18n: Filter for the Cancel-button text in standard message dialogs,
00070 // after the message caption/text have been translated.
00071 #define I18N_FILTER_BUTTON_CANCEL(src, dst) \
00072     KGuiItem dst(src); \
00073     dst.setText( i18nc( "@action:button filter-cancel", "%1", src.text() ) );
00074 
00075 // i18n: Called after the button texts in standard message dialogs
00076 // have been filtered by the messages above. Not visible to user.
00077 #define I18N_POST_BUTTON_FILTER \
00078     i18nc( "@action:button post-filter", "." );
00079 
00080 static bool KMessageBox_queue = false;
00081 KConfig* KMessageBox_againConfig = 0;
00082 
00083 
00084 static QIcon themedMessageBoxIcon(QMessageBox::Icon icon)
00085 {
00086     QString icon_name;
00087 
00088     switch (icon) {
00089     case QMessageBox::NoIcon:
00090         return QIcon();
00091         break;
00092     case QMessageBox::Information:
00093         icon_name = "dialog-information";
00094         break;
00095     case QMessageBox::Warning:
00096         icon_name = "dialog-warning";
00097         break;
00098     case QMessageBox::Critical:
00099         icon_name = "dialog-error";
00100         break;
00101     default:
00102         break;
00103     }
00104 
00105    QIcon ret = KIconLoader::global()->loadIcon(icon_name, KIconLoader::NoGroup, KIconLoader::SizeHuge, KIconLoader::DefaultState, QStringList(), 0, true);
00106 
00107    if (ret.isNull()) {
00108        return QMessageBox::standardIcon(icon);
00109    } else {
00110        return ret;
00111    }
00112 }
00113 
00114 static void sendNotification( QString message, //krazy:exclude=passbyvalue
00115                               const QStringList& strlist,
00116                               QMessageBox::Icon icon,
00117                               WId parent_id )
00118 {
00119     // create the message for KNotify
00120     QString messageType;
00121     switch (icon) {
00122     case QMessageBox::Warning:
00123         messageType = "messageWarning";
00124         break;
00125     case QMessageBox::Critical:
00126         messageType = "messageCritical";
00127         break;
00128     case QMessageBox::Question:
00129         messageType = "messageQuestion";
00130         break;
00131     default:
00132         messageType = "messageInformation";
00133         break;
00134     }
00135 
00136     if ( !strlist.isEmpty() ) {
00137         for ( QStringList::ConstIterator it = strlist.begin(); it != strlist.end(); ++it ) {
00138             message += '\n' + *it;
00139         }
00140     }
00141 
00142     if ( !message.isEmpty() ) {
00143         KNotification::event( messageType, message , QPixmap() , QWidget::find( parent_id ) );
00144     }
00145 }
00146 
00147 
00148 int KMessageBox::createKMessageBox(KDialog *dialog, QMessageBox::Icon icon,
00149                              const QString &text, const QStringList &strlist,
00150                              const QString &ask, bool *checkboxReturn,
00151                              Options options, const QString &details)
00152 {
00153     return createKMessageBox(dialog, themedMessageBoxIcon(icon), text, strlist,
00154                       ask, checkboxReturn, options, details, icon);
00155 }
00156 
00157 static int longest_line( const QFontMetrics & fm, const QString & text ) {
00158     const QStringList lines = QTextDocumentFragment::fromHtml( text ).toPlainText().split( QLatin1String( "\n" ) );
00159     int len = 0;
00160     Q_FOREACH( const QString & line, lines )
00161         len = qMax( len, fm.width( line ) );
00162     return len;
00163 }
00164 
00165 int KMessageBox::createKMessageBox(KDialog *dialog, const QIcon &icon,
00166                              const QString &text, const QStringList &strlist,
00167                              const QString &ask, bool *checkboxReturn, Options options,
00168                              const QString &details, QMessageBox::Icon notifyType)
00169 {
00170     QWidget *mainWidget = new QWidget(dialog);
00171     QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget);
00172     mainLayout->setSpacing(KDialog::spacingHint() * 2);
00173     mainLayout->setMargin(0);
00174 
00175     QHBoxLayout *hLayout = new QHBoxLayout();
00176     hLayout->setMargin(0);
00177     hLayout->setSpacing(KDialog::spacingHint());
00178     mainLayout->addLayout(hLayout);
00179     mainLayout->addStretch();
00180 
00181     QLabel *iconLabel = new QLabel(mainWidget);
00182 
00183     if (!icon.isNull()) {
00184        iconLabel->setPixmap(icon.pixmap(KIconLoader::SizeHuge));
00185     }
00186 
00187     QVBoxLayout *iconLayout = new QVBoxLayout();
00188     iconLayout->addStretch(1);
00189     iconLayout->addWidget(iconLabel);
00190     iconLayout->addStretch(5);
00191 
00192     hLayout->addLayout(iconLayout);
00193     hLayout->addSpacing(KDialog::spacingHint());
00194 
00195     QLabel *messageLabel = new QLabel(text, mainWidget);
00196     messageLabel->setOpenExternalLinks(options & KMessageBox::AllowLink );
00197     Qt::TextInteractionFlags flags = Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard;
00198     if ( options & KMessageBox::AllowLink )
00199         flags |= Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard;;
00200     messageLabel->setTextInteractionFlags(flags);
00201     QPalette messagePal(messageLabel->palette());
00202     messagePal.setColor(QPalette::Window, Qt::transparent);
00203     messageLabel->setPalette(messagePal);
00204 
00205     QRect desktop = KGlobalSettings::desktopGeometry(dialog);
00206     if (desktop.width() / 3 < longest_line(messageLabel->fontMetrics(), text)) {
00207         // do only enable automatic wrapping of messages which are longer than one third of the current screen
00208         messageLabel->setWordWrap(true);
00209     }
00210 
00211     QScrollArea* messageScrollArea = new QScrollArea(mainWidget);
00212     messageScrollArea->setWidget(messageLabel);
00213     messageScrollArea->setFrameShape(QFrame::NoFrame);
00214     messageScrollArea->setWidgetResizable(true);
00215     QPalette scrollPal(messageScrollArea->palette());
00216     scrollPal.setColor(QPalette::Window, Qt::transparent);
00217     messageScrollArea->setPalette(scrollPal);
00218 
00219     hLayout->addWidget(messageScrollArea);
00220 
00221     QListWidget *listWidget = 0;
00222     if (!strlist.isEmpty()) {
00223         // enable automatic wrapping since the listwidget has already a good initial width
00224         messageLabel->setWordWrap(true);
00225         listWidget = new QListWidget(mainWidget);
00226         mainLayout->addWidget(listWidget);
00227         listWidget->addItems(strlist);
00228         listWidget->setSelectionMode(QListWidget::NoSelection);
00229         mainLayout->setStretchFactor(listWidget, 1);
00230     }
00231 
00232     QPointer<QCheckBox> checkbox = 0;
00233     if (!ask.isEmpty()) {
00234         checkbox = new QCheckBox(ask, mainWidget);
00235         mainLayout->addWidget(checkbox);
00236         if (checkboxReturn) {
00237             checkbox->setChecked(*checkboxReturn);
00238         }
00239     }
00240 
00241     if (!details.isEmpty()) {
00242         QGroupBox *detailsGroup = new QGroupBox(i18n("Details"));
00243         QVBoxLayout *detailsLayout = new QVBoxLayout(detailsGroup);
00244         if (details.length() < 512) {
00245             QLabel *detailsLabel = new QLabel(details);
00246             detailsLabel->setOpenExternalLinks(options & KMessageBox::AllowLink);
00247             Qt::TextInteractionFlags flags = Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard;
00248             if ( options & KMessageBox::AllowLink )
00249                 flags |= Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard;;
00250             detailsLabel->setTextInteractionFlags(flags);
00251             detailsLabel->setWordWrap(true);
00252             detailsLayout->addWidget(detailsLabel);
00253         } else {
00254             KTextEdit *detailTextEdit = new KTextEdit(details);
00255             detailTextEdit->setReadOnly(true);
00256             detailTextEdit->setMinimumHeight(detailTextEdit->fontMetrics().lineSpacing() * 11);
00257             detailsLayout->addWidget(detailTextEdit);
00258         }
00259         dialog->setDetailsWidget(detailsGroup);
00260     }
00261 
00262     dialog->setMainWidget(mainWidget);
00263     dialog->showButtonSeparator(true);
00264     if (!listWidget) {
00265         int hfw = messageLabel->heightForWidth(messageScrollArea->sizeHint().width() - 2);
00266         if (hfw != messageScrollArea->sizeHint().height() && hfw < desktop.height() / 2) {
00267             messageScrollArea->setMinimumHeight(hfw);
00268         }
00269         if (details.isEmpty())
00270             dialog->setFixedSize(dialog->sizeHint() + QSize( 10, 10 ));
00271     }
00272 
00273     if ((options & KMessageBox::Dangerous)) {
00274         if (dialog->isButtonEnabled(KDialog::Cancel))
00275             dialog->setDefaultButton(KDialog::Cancel);
00276         else if (dialog->isButtonEnabled(KDialog::No))
00277             dialog->setDefaultButton(KDialog::No);
00278     }
00279 
00280     KDialog::ButtonCode defaultCode = dialog->defaultButton();
00281     if (defaultCode != KDialog::NoDefault) {
00282         dialog->setButtonFocus(defaultCode);
00283     }
00284 
00285 #ifndef Q_WS_WIN // FIXME problems with KNotify on Windows
00286     if ((options & KMessageBox::Notify)) {
00287         sendNotification(text, strlist, notifyType, dialog->topLevelWidget()->winId());
00288     }
00289 #endif
00290 
00291     if (KMessageBox_queue) {
00292         KDialogQueue::queueDialog(dialog);
00293         return KMessageBox::Cancel; // We have to return something.
00294     }
00295 
00296     if ((options & KMessageBox::NoExec)) {
00297         return KMessageBox::Cancel; // We have to return something.
00298     }
00299 
00300     // We use a QPointer because the dialog may get deleted
00301     // during exec() if the parent of the dialog gets deleted.
00302     // In that case the QPointer will reset to 0.
00303     QPointer<KDialog> guardedDialog = dialog;
00304 
00305     int result = guardedDialog->exec();
00306     if (checkbox && checkboxReturn) {
00307         *checkboxReturn = checkbox->isChecked();
00308     }
00309 
00310     delete (KDialog *) guardedDialog;
00311     return result;
00312 }
00313 
00314 int KMessageBox::questionYesNo(QWidget *parent, const QString &text,
00315                            const QString &caption,
00316                            const KGuiItem &buttonYes,
00317                            const KGuiItem &buttonNo,
00318                            const QString &dontAskAgainName,
00319                            Options options)
00320 {
00321     return questionYesNoList(parent, text, QStringList(), caption,
00322                             buttonYes, buttonNo, dontAskAgainName, options);
00323 }
00324 
00325 int KMessageBox::questionYesNoWId(WId parent_id, const QString &text,
00326                            const QString &caption,
00327                            const KGuiItem &buttonYes,
00328                            const KGuiItem &buttonNo,
00329                            const QString &dontAskAgainName,
00330                            Options options)
00331 {
00332     return questionYesNoListWId(parent_id, text, QStringList(), caption,
00333                             buttonYes, buttonNo, dontAskAgainName, options);
00334 }
00335 
00336 bool KMessageBox::shouldBeShownYesNo(const QString &dontShowAgainName,
00337                                 ButtonCode &result)
00338 {
00339     if ( dontShowAgainName.isEmpty() ) {
00340         return true;
00341     }
00342     KConfigGroup cg( KMessageBox_againConfig ? KMessageBox_againConfig : KGlobal::config().data(), "Notification Messages" );
00343     QString dontAsk = cg.readEntry(dontShowAgainName, QString()).toLower();
00344     if (dontAsk == "yes" || dontAsk == "true") {
00345         result = Yes;
00346         return false;
00347     }
00348     if (dontAsk == "no" || dontAsk == "false") {
00349         result = No;
00350         return false;
00351     }
00352     return true;
00353 }
00354 
00355 bool KMessageBox::shouldBeShownContinue(const QString &dontShowAgainName)
00356 {
00357     if ( dontShowAgainName.isEmpty() ) {
00358         return true;
00359     }
00360     KConfigGroup cg( KMessageBox_againConfig ? KMessageBox_againConfig : KGlobal::config().data(), "Notification Messages" );
00361     return cg.readEntry(dontShowAgainName, true);
00362 }
00363 
00364 void KMessageBox::saveDontShowAgainYesNo(const QString &dontShowAgainName,
00365                                     ButtonCode result)
00366 {
00367     if ( dontShowAgainName.isEmpty() ) {
00368         return;
00369     }
00370     KConfigGroup::WriteConfigFlags flags = KConfig::Persistent;
00371     if (dontShowAgainName[0] == ':') {
00372         flags |= KConfigGroup::Global;
00373     }
00374     KConfigGroup cg( KMessageBox_againConfig? KMessageBox_againConfig : KGlobal::config().data(), "Notification Messages" );
00375     cg.writeEntry( dontShowAgainName, result==Yes, flags );
00376     cg.sync();
00377 }
00378 
00379 void KMessageBox::saveDontShowAgainContinue(const QString &dontShowAgainName)
00380 {
00381     if ( dontShowAgainName.isEmpty() ) {
00382         return;
00383     }
00384     KConfigGroup::WriteConfigFlags flags = KConfigGroup::Persistent;
00385     if (dontShowAgainName[0] == ':') {
00386         flags |= KConfigGroup::Global;
00387     }
00388     KConfigGroup cg( KMessageBox_againConfig? KMessageBox_againConfig: KGlobal::config().data(), "Notification Messages" );
00389     cg.writeEntry( dontShowAgainName, false, flags );
00390     cg.sync();
00391 }
00392 
00393 void KMessageBox::setDontShowAskAgainConfig(KConfig* cfg)
00394 {
00395     KMessageBox_againConfig = cfg;
00396 }
00397 
00398 int KMessageBox::questionYesNoList(QWidget *parent, const QString &text,
00399                            const QStringList &strlist,
00400                            const QString &caption,
00401                            const KGuiItem &buttonYes,
00402                            const KGuiItem &buttonNo,
00403                            const QString &dontAskAgainName,
00404                            Options options)
00405 { // in order to avoid code duplication, convert to WId, it will be converted back
00406     return questionYesNoListWId( parent ? parent->effectiveWinId() : 0, text, strlist,
00407         caption, buttonYes, buttonNo, dontAskAgainName, options );
00408 }
00409 
00410 int KMessageBox::questionYesNoListWId(WId parent_id, const QString &text,
00411                            const QStringList &strlist,
00412                            const QString &caption,
00413                            const KGuiItem &buttonYes_,
00414                            const KGuiItem &buttonNo_,
00415                            const QString &dontAskAgainName,
00416                            Options options)
00417 {
00418     ButtonCode res;
00419     if ( !shouldBeShownYesNo(dontAskAgainName, res) ) {
00420         return res;
00421     }
00422 
00423     I18N_FILTER_BUTTON_YES(buttonYes_, buttonYes)
00424     I18N_FILTER_BUTTON_NO(buttonNo_, buttonNo)
00425     I18N_POST_BUTTON_FILTER
00426 
00427     QWidget* parent = QWidget::find( parent_id );
00428     KDialog *dialog = new KDialog(parent, Qt::Dialog);
00429     dialog->setCaption( caption.isEmpty() ? i18n("Question") : caption );
00430     dialog->setButtons( KDialog::Yes | KDialog::No );
00431     dialog->setObjectName( "questionYesNo" );
00432     dialog->setModal( true );
00433     dialog->showButtonSeparator( true );
00434     dialog->setButtonGuiItem( KDialog::Yes, buttonYes );
00435     dialog->setButtonGuiItem( KDialog::No, buttonNo );
00436     dialog->setDefaultButton( KDialog::Yes );
00437     dialog->setEscapeButton( KDialog::No );
00438     if ( options & PlainCaption ) {
00439         dialog->setPlainCaption( caption );
00440     }
00441 #ifdef Q_WS_X11
00442     if ( parent == NULL && parent_id ) {
00443         XSetTransientForHint( QX11Info::display(), dialog->winId(), parent_id );
00444     }
00445 #endif
00446 
00447     bool checkboxResult = false;
00448     int result = createKMessageBox(dialog, QMessageBox::Information, text, strlist,
00449                        dontAskAgainName.isEmpty() ? QString() : i18n("Do not ask again"),
00450                        &checkboxResult, options);
00451     res = (result==KDialog::Yes ? Yes : No);
00452 
00453     if (checkboxResult) {
00454         saveDontShowAgainYesNo(dontAskAgainName, res);
00455     }
00456     return res;
00457 }
00458 
00459 int KMessageBox::questionYesNoCancel(QWidget *parent,
00460                           const QString &text,
00461                           const QString &caption,
00462                           const KGuiItem &buttonYes,
00463                           const KGuiItem &buttonNo,
00464                           const KGuiItem &buttonCancel,
00465                           const QString &dontAskAgainName,
00466                           Options options)
00467 {
00468     return questionYesNoCancelWId( parent ? parent->effectiveWinId() : 0, text, caption, buttonYes, buttonNo, buttonCancel,
00469         dontAskAgainName, options );
00470 }
00471 
00472 int KMessageBox::questionYesNoCancelWId(WId parent_id,
00473                           const QString &text,
00474                           const QString &caption,
00475                           const KGuiItem &buttonYes_,
00476                           const KGuiItem &buttonNo_,
00477                           const KGuiItem &buttonCancel_,
00478                           const QString &dontAskAgainName,
00479                           Options options)
00480 {
00481     ButtonCode res;
00482     if ( !shouldBeShownYesNo(dontAskAgainName, res) ) {
00483         return res;
00484     }
00485 
00486     I18N_FILTER_BUTTON_YES(buttonYes_, buttonYes)
00487     I18N_FILTER_BUTTON_NO(buttonNo_, buttonNo)
00488     I18N_FILTER_BUTTON_CANCEL(buttonCancel_, buttonCancel)
00489     I18N_POST_BUTTON_FILTER
00490 
00491     QWidget* parent = QWidget::find( parent_id );
00492     KDialog *dialog= new KDialog(parent, Qt::Dialog);
00493     dialog->setCaption( caption.isEmpty() ? i18n("Question") : caption );
00494     dialog->setButtons( KDialog::Yes | KDialog::No | KDialog::Cancel );
00495     dialog->setObjectName( "questionYesNoCancel" );
00496     dialog->setModal( true );
00497     dialog->showButtonSeparator( true );
00498     dialog->setButtonGuiItem( KDialog::Yes, buttonYes );
00499     dialog->setButtonGuiItem( KDialog::No, buttonNo );
00500     dialog->setButtonGuiItem( KDialog::Cancel, buttonCancel );
00501     dialog->setDefaultButton( KDialog::Yes );
00502     if ( options & PlainCaption ) {
00503         dialog->setPlainCaption( caption );
00504     }
00505 #ifdef Q_WS_X11
00506     if ( parent == NULL && parent_id ) {
00507         XSetTransientForHint( QX11Info::display(), dialog->winId(), parent_id );
00508     }
00509 #endif
00510 
00511     bool checkboxResult = false;
00512     int result = createKMessageBox(dialog, QMessageBox::Information,
00513                        text, QStringList(),
00514                        dontAskAgainName.isEmpty() ? QString() : i18n("Do not ask again"),
00515                        &checkboxResult, options);
00516 
00517     if ( result == KDialog::Yes ) {
00518         res = Yes;
00519     } else if ( result == KDialog::No ) {
00520         res = No;
00521     } else {
00522         return Cancel;
00523     }
00524 
00525     if (checkboxResult) {
00526         saveDontShowAgainYesNo(dontAskAgainName, res);
00527     }
00528     return res;
00529 }
00530 
00531 int KMessageBox::warningYesNo(QWidget *parent, const QString &text,
00532                           const QString &caption,
00533                           const KGuiItem &buttonYes,
00534                           const KGuiItem &buttonNo,
00535                           const QString &dontAskAgainName,
00536                           Options options)
00537 {
00538     return warningYesNoList(parent, text, QStringList(), caption,
00539                        buttonYes, buttonNo, dontAskAgainName, options);
00540 }
00541 
00542 int KMessageBox::warningYesNoWId(WId parent_id, const QString &text,
00543                           const QString &caption,
00544                           const KGuiItem &buttonYes,
00545                           const KGuiItem &buttonNo,
00546                           const QString &dontAskAgainName,
00547                           Options options)
00548 {
00549     return warningYesNoListWId(parent_id, text, QStringList(), caption,
00550                        buttonYes, buttonNo, dontAskAgainName, options);
00551 }
00552 
00553 int KMessageBox::warningYesNoList(QWidget *parent, const QString &text,
00554                               const QStringList &strlist,
00555                               const QString &caption,
00556                               const KGuiItem &buttonYes,
00557                               const KGuiItem &buttonNo,
00558                               const QString &dontAskAgainName,
00559                               Options options)
00560 {
00561     return warningYesNoListWId( parent ? parent->effectiveWinId() : 0, text, strlist, caption,
00562         buttonYes, buttonNo, dontAskAgainName, options );
00563 }
00564 
00565 int KMessageBox::warningYesNoListWId(WId parent_id, const QString &text,
00566                               const QStringList &strlist,
00567                               const QString &caption,
00568                               const KGuiItem &buttonYes_,
00569                               const KGuiItem &buttonNo_,
00570                               const QString &dontAskAgainName,
00571                               Options options)
00572 {
00573     ButtonCode res;
00574     if ( !shouldBeShownYesNo(dontAskAgainName, res) ) {
00575         return res;
00576     }
00577 
00578     I18N_FILTER_BUTTON_YES(buttonYes_, buttonYes)
00579     I18N_FILTER_BUTTON_NO(buttonNo_, buttonNo)
00580     I18N_POST_BUTTON_FILTER
00581 
00582     QWidget* parent = QWidget::find( parent_id );
00583     KDialog *dialog = new KDialog(parent, Qt::Dialog);
00584     dialog->setCaption( caption.isEmpty() ? i18n("Warning") : caption );
00585     dialog->setButtons( KDialog::Yes | KDialog::No );
00586     dialog->setObjectName( "warningYesNoList" );
00587     dialog->setModal( true );
00588     dialog->showButtonSeparator( true );
00589     dialog->setButtonGuiItem( KDialog::Yes, buttonYes );
00590     dialog->setButtonGuiItem( KDialog::No, buttonNo );
00591     dialog->setDefaultButton( KDialog::No );
00592     dialog->setEscapeButton( KDialog::No );
00593     if ( options & PlainCaption ) {
00594         dialog->setPlainCaption( caption );
00595     }
00596 #ifdef Q_WS_X11
00597     if ( parent == NULL && parent_id ) {
00598         XSetTransientForHint( QX11Info::display(), dialog->winId(), parent_id );
00599     }
00600 #endif
00601 
00602     bool checkboxResult = false;
00603     int result = createKMessageBox(dialog, QMessageBox::Warning, text, strlist,
00604                        dontAskAgainName.isEmpty() ? QString() : i18n("Do not ask again"),
00605                        &checkboxResult, options);
00606     res = (result==KDialog::Yes ? Yes : No);
00607 
00608     if (checkboxResult) {
00609         saveDontShowAgainYesNo(dontAskAgainName, res);
00610     }
00611     return res;
00612 }
00613 
00614 int KMessageBox::warningContinueCancel(QWidget *parent,
00615                                    const QString &text,
00616                                    const QString &caption,
00617                                    const KGuiItem &buttonContinue,
00618                                    const KGuiItem &buttonCancel,
00619                                    const QString &dontAskAgainName,
00620                                    Options options)
00621 {
00622     return warningContinueCancelList(parent, text, QStringList(), caption,
00623                                 buttonContinue, buttonCancel, dontAskAgainName, options);
00624 }
00625 
00626 int KMessageBox::warningContinueCancelWId(WId parent_id,
00627                                    const QString &text,
00628                                    const QString &caption,
00629                                    const KGuiItem &buttonContinue,
00630                                    const KGuiItem &buttonCancel,
00631                                    const QString &dontAskAgainName,
00632                                    Options options)
00633 {
00634     return warningContinueCancelListWId(parent_id, text, QStringList(), caption,
00635                                 buttonContinue, buttonCancel, dontAskAgainName, options);
00636 }
00637 
00638 int KMessageBox::warningContinueCancelList(QWidget *parent, const QString &text,
00639                              const QStringList &strlist,
00640                              const QString &caption,
00641                              const KGuiItem &buttonContinue,
00642                              const KGuiItem &buttonCancel,
00643                              const QString &dontAskAgainName,
00644                              Options options)
00645 {
00646     return warningContinueCancelListWId( parent ? parent->effectiveWinId() : 0, text, strlist,
00647         caption, buttonContinue, buttonCancel, dontAskAgainName, options );
00648 }
00649 
00650 int KMessageBox::warningContinueCancelListWId(WId parent_id, const QString &text,
00651                              const QStringList &strlist,
00652                              const QString &caption,
00653                              const KGuiItem &buttonContinue_,
00654                              const KGuiItem &buttonCancel_,
00655                              const QString &dontAskAgainName,
00656                              Options options)
00657 {
00658     if ( !shouldBeShownContinue(dontAskAgainName) )
00659         return Continue;
00660 
00661     I18N_FILTER_BUTTON_CONTINUE(buttonContinue_, buttonContinue)
00662     I18N_FILTER_BUTTON_CANCEL(buttonCancel_, buttonCancel)
00663     I18N_POST_BUTTON_FILTER
00664 
00665     QWidget* parent = QWidget::find( parent_id );
00666     KDialog *dialog = new KDialog(parent, Qt::Dialog);
00667     dialog->setCaption( caption.isEmpty() ? i18n("Warning") : caption );
00668     dialog->setButtons( KDialog::Yes | KDialog::No );
00669     dialog->setObjectName( "warningYesNo" );
00670     dialog->setModal( true );
00671     dialog->showButtonSeparator( true );
00672     dialog->setButtonGuiItem( KDialog::Yes, buttonContinue );
00673     dialog->setButtonGuiItem( KDialog::No, buttonCancel );
00674     dialog->setDefaultButton( KDialog::Yes );
00675     dialog->setEscapeButton( KDialog::No );
00676     if ( options & PlainCaption ) {
00677         dialog->setPlainCaption( caption );
00678     }
00679 #ifdef Q_WS_X11
00680     if ( parent == NULL && parent_id ) {
00681         XSetTransientForHint( QX11Info::display(), dialog->winId(), parent_id );
00682     }
00683 #endif
00684 
00685     bool checkboxResult = false;
00686     int result = createKMessageBox(dialog, QMessageBox::Warning, text, strlist,
00687                        dontAskAgainName.isEmpty() ? QString() : i18n("Do not ask again"),
00688                        &checkboxResult, options);
00689 
00690     if ( result != KDialog::Yes ) {
00691         return Cancel;
00692     }
00693     if (checkboxResult) {
00694         saveDontShowAgainContinue(dontAskAgainName);
00695     }
00696     return Continue;
00697 }
00698 
00699 int KMessageBox::warningYesNoCancel(QWidget *parent, const QString &text,
00700                                 const QString &caption,
00701                                 const KGuiItem &buttonYes,
00702                                 const KGuiItem &buttonNo,
00703                                 const KGuiItem &buttonCancel,
00704                                 const QString &dontAskAgainName,
00705                                 Options options)
00706 {
00707     return warningYesNoCancelList(parent, text, QStringList(), caption,
00708                       buttonYes, buttonNo, buttonCancel, dontAskAgainName, options);
00709 }
00710 
00711 int KMessageBox::warningYesNoCancelWId(WId parent_id, const QString &text,
00712                                 const QString &caption,
00713                                 const KGuiItem &buttonYes,
00714                                 const KGuiItem &buttonNo,
00715                                 const KGuiItem &buttonCancel,
00716                                 const QString &dontAskAgainName,
00717                                 Options options)
00718 {
00719     return warningYesNoCancelListWId(parent_id, text, QStringList(), caption,
00720                       buttonYes, buttonNo, buttonCancel, dontAskAgainName, options);
00721 }
00722 
00723 int KMessageBox::warningYesNoCancelList(QWidget *parent, const QString &text,
00724                                     const QStringList &strlist,
00725                                     const QString &caption,
00726                                     const KGuiItem &buttonYes,
00727                                     const KGuiItem &buttonNo,
00728                                     const KGuiItem &buttonCancel,
00729                                     const QString &dontAskAgainName,
00730                                     Options options)
00731 {
00732     return warningYesNoCancelListWId( parent ? parent->effectiveWinId() : 0, text, strlist,
00733         caption, buttonYes, buttonNo, buttonCancel, dontAskAgainName, options );
00734 }
00735 
00736 int KMessageBox::warningYesNoCancelListWId(WId parent_id, const QString &text,
00737                                     const QStringList &strlist,
00738                                     const QString &caption,
00739                                     const KGuiItem &buttonYes_,
00740                                     const KGuiItem &buttonNo_,
00741                                     const KGuiItem &buttonCancel_,
00742                                     const QString &dontAskAgainName,
00743                                     Options options)
00744 {
00745     ButtonCode res;
00746     if ( !shouldBeShownYesNo(dontAskAgainName, res) ) {
00747         return res;
00748     }
00749 
00750     I18N_FILTER_BUTTON_YES(buttonYes_, buttonYes)
00751     I18N_FILTER_BUTTON_NO(buttonNo_, buttonNo)
00752     I18N_FILTER_BUTTON_CANCEL(buttonCancel_, buttonCancel)
00753     I18N_POST_BUTTON_FILTER
00754 
00755     QWidget* parent = QWidget::find( parent_id );
00756     KDialog *dialog = new KDialog(parent, Qt::Dialog);
00757     dialog->setCaption( caption.isEmpty() ? i18n("Warning") : caption );
00758     dialog->setButtons( KDialog::Yes | KDialog::No | KDialog::Cancel );
00759     dialog->setObjectName( "warningYesNoCancel" );
00760     dialog->setModal( true );
00761     dialog->showButtonSeparator( true );
00762     dialog->setButtonGuiItem( KDialog::Yes, buttonYes );
00763     dialog->setButtonGuiItem( KDialog::No, buttonNo );
00764     dialog->setButtonGuiItem( KDialog::Cancel, buttonCancel );
00765     dialog->setDefaultButton( KDialog::Yes );
00766     if ( options & PlainCaption ) {
00767         dialog->setPlainCaption( caption );
00768     }
00769 #ifdef Q_WS_X11
00770     if ( parent == NULL && parent_id ) {
00771         XSetTransientForHint( QX11Info::display(), dialog->winId(), parent_id );
00772     }
00773 #endif
00774 
00775     bool checkboxResult = false;
00776     int result = createKMessageBox(dialog, QMessageBox::Warning, text, strlist,
00777                        dontAskAgainName.isEmpty() ? QString() : i18n("Do not ask again"),
00778                        &checkboxResult, options);
00779 
00780     if ( result == KDialog::Yes ) {
00781         res = Yes;
00782     } else if ( result == KDialog::No ) {
00783         res = No;
00784     } else {
00785         return Cancel;
00786     }
00787 
00788     if (checkboxResult) {
00789         saveDontShowAgainYesNo(dontAskAgainName, res);
00790     }
00791     return res;
00792 }
00793 
00794 void KMessageBox::error(QWidget *parent,  const QString &text,
00795                    const QString &caption, Options options)
00796 {
00797     return errorListWId( parent ? parent->effectiveWinId() : 0, text, QStringList(), caption, options );
00798 }
00799 
00800 void KMessageBox::errorWId(WId parent_id, const QString &text,
00801                       const QString &caption, Options options)
00802 {
00803     errorListWId( parent_id, text, QStringList(), caption, options );
00804 }
00805 
00806 void KMessageBox::errorList(QWidget *parent, const QString &text, const QStringList &strlist,
00807                        const QString &caption, Options options)
00808 {
00809     return errorListWId( parent ? parent->effectiveWinId() : 0, text, strlist, caption, options );
00810 }
00811 
00812 void KMessageBox::errorListWId(WId parent_id,  const QString &text, const QStringList &strlist,
00813                    const QString &caption, Options options)
00814 {
00815     QWidget* parent = QWidget::find( parent_id );
00816     KDialog *dialog = new KDialog(parent, Qt::Dialog);
00817     dialog->setCaption( caption.isEmpty() ? i18n("Error") : caption );
00818     dialog->setButtons( KDialog::Yes );
00819     dialog->setObjectName( "error" );
00820     dialog->setModal( true );
00821     dialog->showButtonSeparator( true );
00822     dialog->setButtonText( KDialog::Yes, KStandardGuiItem::ok().text() );
00823     dialog->setButtonToolTip( KDialog::Yes, QString() );
00824     dialog->setDefaultButton( KDialog::Yes );
00825     dialog->setEscapeButton( KDialog::Yes );
00826     if ( options & PlainCaption ) {
00827         dialog->setPlainCaption( caption );
00828     }
00829 #ifdef Q_WS_X11
00830     if ( parent == NULL && parent_id ) {
00831         XSetTransientForHint( QX11Info::display(), dialog->winId(), parent_id );
00832     }
00833 #endif
00834 
00835     createKMessageBox(dialog, QMessageBox::Critical, text, strlist, QString(), 0, options);
00836 }
00837 
00838 void
00839 KMessageBox::detailedError(QWidget *parent,  const QString &text,
00840                    const QString &details,
00841                    const QString &caption, Options options)
00842 {
00843     return detailedErrorWId( parent ? parent->effectiveWinId() : 0, text, details, caption, options );
00844 }
00845 
00846 void KMessageBox::detailedErrorWId(WId parent_id,  const QString &text,
00847                    const QString &details,
00848                    const QString &caption, Options options)
00849 {
00850     QWidget* parent = QWidget::find( parent_id );
00851     KDialog *dialog = new KDialog(parent, Qt::Dialog);
00852     dialog->setCaption( caption.isEmpty() ? i18n("Error") : caption );
00853     dialog->setButtons( KDialog::Yes | KDialog::Details );
00854     dialog->setObjectName( "error" );
00855     dialog->setModal( true );
00856     dialog->showButtonSeparator( true );
00857     dialog->setButtonText( KDialog::Yes, KStandardGuiItem::ok().text() );
00858     dialog->setDefaultButton( KDialog::Yes );
00859     dialog->setEscapeButton( KDialog::Yes );
00860     if( options & PlainCaption ) {
00861         dialog->setPlainCaption( caption );
00862     }
00863 #ifdef Q_WS_X11
00864     if ( parent == NULL && parent_id ) {
00865         XSetTransientForHint( QX11Info::display(), dialog->winId(), parent_id );
00866     }
00867 #endif
00868 
00869     createKMessageBox(dialog, QMessageBox::Critical, text, QStringList(), QString(), 0, options, details);
00870 }
00871 
00872 void KMessageBox::queuedDetailedError(QWidget *parent,  const QString &text,
00873                    const QString &details,
00874                    const QString &caption)
00875 {
00876     return queuedDetailedErrorWId( parent ? parent->effectiveWinId() : 0, text, details, caption );
00877 }
00878 
00879 void KMessageBox::queuedDetailedErrorWId(WId parent_id,  const QString &text,
00880                    const QString &details,
00881                    const QString &caption)
00882 {
00883    KMessageBox_queue = true;
00884    (void) detailedErrorWId(parent_id, text, details, caption);
00885    KMessageBox_queue = false;
00886 }
00887 
00888 
00889 void KMessageBox::sorry(QWidget *parent, const QString &text,
00890                    const QString &caption, Options options)
00891 {
00892     return sorryWId( parent ? parent->effectiveWinId() : 0, text, caption, options );
00893 }
00894 
00895 void KMessageBox::sorryWId(WId parent_id, const QString &text,
00896                    const QString &caption, Options options)
00897 {
00898     QWidget* parent = QWidget::find( parent_id );
00899     KDialog *dialog = new KDialog(parent, Qt::Dialog);
00900     dialog->setCaption( caption.isEmpty() ? i18n("Sorry") : caption );
00901     dialog->setButtons( KDialog::Yes );
00902     dialog->setObjectName( "sorry" );
00903     dialog->setModal( true );
00904     dialog->showButtonSeparator( true );
00905     dialog->setButtonText( KDialog::Yes, KStandardGuiItem::ok().text() );
00906     dialog->setDefaultButton( KDialog::Yes );
00907     dialog->setEscapeButton( KDialog::Yes );
00908     if ( options & PlainCaption ) {
00909         dialog->setPlainCaption( caption );
00910     }
00911 #ifdef Q_WS_X11
00912     if ( parent == NULL && parent_id ) {
00913         XSetTransientForHint( QX11Info::display(), dialog->winId(), parent_id );
00914     }
00915 #endif
00916 
00917     createKMessageBox(dialog, QMessageBox::Warning, text, QStringList(), QString(), 0, options);
00918 }
00919 
00920 void KMessageBox::detailedSorry(QWidget *parent, const QString &text,
00921                    const QString &details,
00922                    const QString &caption, Options options)
00923 {
00924     return detailedSorryWId( parent ? parent->effectiveWinId() : 0, text, details, caption, options );
00925 }
00926 
00927 void KMessageBox::detailedSorryWId(WId parent_id, const QString &text,
00928                    const QString &details,
00929                    const QString &caption, Options options)
00930 {
00931     QWidget* parent = QWidget::find( parent_id );
00932     KDialog *dialog = new KDialog(parent, Qt::Dialog);
00933     dialog->setCaption( caption.isEmpty() ? i18n("Sorry") : caption );
00934     dialog->setButtons( KDialog::Yes | KDialog::Details );
00935     dialog->setObjectName( "sorry" );
00936     dialog->setModal( true );
00937     dialog->showButtonSeparator( true );
00938     dialog->setButtonText( KDialog::Yes, KStandardGuiItem::ok().text() );
00939     dialog->setDefaultButton( KDialog::Yes );
00940     dialog->setEscapeButton( KDialog::Yes );
00941     if ( options & PlainCaption ) {
00942         dialog->setPlainCaption( caption );
00943     }
00944 #ifdef Q_WS_X11
00945     if ( parent == NULL && parent_id ) {
00946         XSetTransientForHint( QX11Info::display(), dialog->winId(), parent_id );
00947     }
00948 #endif
00949 
00950     createKMessageBox(dialog, QMessageBox::Warning, text, QStringList(), QString(), 0, options, details);
00951 }
00952 
00953 void KMessageBox::information(QWidget *parent,const QString &text,
00954              const QString &caption, const QString &dontShowAgainName, Options options)
00955 {
00956     informationList(parent, text, QStringList(), caption, dontShowAgainName, options);
00957 }
00958 
00959 void KMessageBox::informationWId(WId parent_id,const QString &text,
00960              const QString &caption, const QString &dontShowAgainName, Options options)
00961 {
00962     informationListWId(parent_id, text, QStringList(), caption, dontShowAgainName, options);
00963 }
00964 
00965 void KMessageBox::informationList(QWidget *parent,const QString &text, const QStringList & strlist,
00966                          const QString &caption, const QString &dontShowAgainName, Options options)
00967 {
00968     return informationListWId( parent ? parent->effectiveWinId() : 0, text, strlist, caption,
00969         dontShowAgainName, options );
00970 }
00971 
00972 void KMessageBox::informationListWId(WId parent_id,const QString &text, const QStringList & strlist,
00973                          const QString &caption, const QString &dontShowAgainName, Options options)
00974 {
00975     if ( !shouldBeShownContinue(dontShowAgainName) ) {
00976         return;
00977     }
00978 
00979     QWidget* parent = QWidget::find( parent_id );
00980     KDialog *dialog = new KDialog(parent, Qt::Dialog);
00981     dialog->setCaption( caption.isEmpty() ? i18n("Information") : caption );
00982     dialog->setButtons( KDialog::Yes );
00983     dialog->setObjectName( "information" );
00984     dialog->setModal( true );
00985     dialog->showButtonSeparator( true );
00986     dialog->setButtonText( KDialog::Yes, KStandardGuiItem::ok().text() );
00987     dialog->setDefaultButton( KDialog::Yes );
00988     dialog->setEscapeButton( KDialog::Yes );
00989     if ( options & PlainCaption ) {
00990         dialog->setPlainCaption( caption );
00991     }
00992 #ifdef Q_WS_X11
00993     if ( parent == NULL && parent_id ) {
00994         XSetTransientForHint( QX11Info::display(), dialog->winId(), parent_id );
00995     }
00996 #endif
00997 
00998     bool checkboxResult = false;
00999 
01000     createKMessageBox(dialog, QMessageBox::Information, text, strlist,
01001         dontShowAgainName.isEmpty() ? QString() : i18n("Do not show this message again"),
01002                 &checkboxResult, options);
01003 
01004     if (checkboxResult) {
01005         saveDontShowAgainContinue(dontShowAgainName);
01006     }
01007 }
01008 
01009 void KMessageBox::enableAllMessages()
01010 {
01011    KConfig *config = KMessageBox_againConfig ? KMessageBox_againConfig : KGlobal::config().data();
01012    if (!config->hasGroup("Notification Messages")) {
01013       return;
01014    }
01015 
01016    KConfigGroup cg(config, "Notification Messages" );
01017 
01018    typedef QMap<QString, QString> configMap;
01019 
01020    const configMap map = cg.entryMap();
01021 
01022    configMap::ConstIterator it;
01023    for (it = map.begin(); it != map.end(); ++it) {
01024       cg.deleteEntry( it.key() );
01025    }
01026 }
01027 
01028 void KMessageBox::enableMessage(const QString &dontShowAgainName)
01029 {
01030    KConfig *config = KMessageBox_againConfig ? KMessageBox_againConfig : KGlobal::config().data();
01031    if (!config->hasGroup("Notification Messages")) {
01032       return;
01033    }
01034 
01035    KConfigGroup cg( config, "Notification Messages" );
01036 
01037    cg.deleteEntry(dontShowAgainName);
01038    config->sync();
01039 }
01040 
01041 void KMessageBox::about(QWidget *parent, const QString &text,
01042                    const QString &caption, Options options)
01043 {
01044     QString _caption = caption;
01045     if (_caption.isEmpty()) {
01046         _caption = i18n("About %1", KGlobal::caption());
01047     }
01048 
01049     KDialog *dialog = new KDialog(parent, Qt::Dialog);
01050     dialog->setCaption( caption );
01051     dialog->setButtons( KDialog::Yes );
01052     dialog->setObjectName( "about" );
01053     dialog->setModal( true );
01054     dialog->showButtonSeparator( true );
01055     dialog->setButtonText( KDialog::Yes, KStandardGuiItem::ok().text() );
01056     dialog->setDefaultButton( KDialog::Yes );
01057     dialog->setEscapeButton( KDialog::Yes );
01058     if (qApp->windowIcon().isNull()) {
01059         QPixmap ret = QMessageBox::standardIcon(QMessageBox::Information);
01060         dialog->setWindowIcon(ret);
01061     }
01062 
01063     createKMessageBox(dialog, qApp->windowIcon(), text, QStringList(), QString(), 0, options);
01064     return;
01065 }
01066 
01067 int KMessageBox::messageBox( QWidget *parent, DialogType type, const QString &text,
01068                              const QString &caption, const KGuiItem &buttonYes,
01069                              const KGuiItem &buttonNo, const KGuiItem &buttonCancel,
01070                              const QString &dontShowAskAgainName, Options options )
01071 {
01072     return messageBoxWId( parent ? parent->effectiveWinId() : 0, type, text, caption,
01073         buttonYes, buttonNo, buttonCancel, dontShowAskAgainName, options );
01074 }
01075 
01076 int KMessageBox::messageBoxWId( WId parent_id, DialogType type, const QString &text,
01077                              const QString &caption, const KGuiItem &buttonYes,
01078                              const KGuiItem &buttonNo, const KGuiItem &buttonCancel,
01079                              const QString &dontShow, Options options )
01080 {
01081     switch (type) {
01082     case QuestionYesNo:
01083         return KMessageBox::questionYesNoWId( parent_id,
01084                                             text, caption, buttonYes, buttonNo, dontShow, options );
01085     case QuestionYesNoCancel:
01086         return KMessageBox::questionYesNoCancelWId( parent_id,
01087                                             text, caption, buttonYes, buttonNo, buttonCancel, dontShow, options );
01088     case WarningYesNo:
01089         return KMessageBox::warningYesNoWId( parent_id,
01090                                             text, caption, buttonYes, buttonNo, dontShow, options );
01091     case WarningContinueCancel:
01092         return KMessageBox::warningContinueCancelWId( parent_id,
01093                                             text, caption, KGuiItem(buttonYes.text()), buttonCancel, dontShow, options );
01094     case WarningYesNoCancel:
01095         return KMessageBox::warningYesNoCancelWId( parent_id,
01096                                             text, caption, buttonYes, buttonNo, buttonCancel, dontShow, options );
01097     case Information:
01098         KMessageBox::informationWId( parent_id,
01099                                     text, caption, dontShow, options );
01100         return KMessageBox::Ok;
01101 
01102     case Error:
01103         KMessageBox::errorWId( parent_id, text, caption, options );
01104         return KMessageBox::Ok;
01105 
01106     case Sorry:
01107         KMessageBox::sorryWId( parent_id, text, caption, options );
01108         return KMessageBox::Ok;
01109     }
01110     return KMessageBox::Cancel;
01111 }
01112 
01113 void KMessageBox::queuedMessageBox( QWidget *parent, DialogType type, const QString &text, const QString &caption, Options options )
01114 {
01115     return queuedMessageBoxWId( parent ? parent->effectiveWinId() : 0, type, text, caption, options );
01116 }
01117 
01118 void KMessageBox::queuedMessageBoxWId( WId parent_id, DialogType type, const QString &text, const QString &caption, Options options )
01119 {
01120     KMessageBox_queue = true;
01121     (void) messageBoxWId(parent_id, type, text, caption, KStandardGuiItem::yes(),
01122                      KStandardGuiItem::no(), KStandardGuiItem::cancel(), QString(), options);
01123     KMessageBox_queue = false;
01124 }
01125 
01126 void KMessageBox::queuedMessageBox( QWidget *parent, DialogType type, const QString &text, const QString &caption )
01127 {
01128     return queuedMessageBoxWId( parent ? parent->effectiveWinId() : 0, type, text, caption );
01129 }
01130 
01131 void KMessageBox::queuedMessageBoxWId( WId parent_id, DialogType type, const QString &text, const QString &caption )
01132 {
01133     KMessageBox_queue = true;
01134     (void) messageBoxWId(parent_id, type, text, caption);
01135     KMessageBox_queue = false;
01136 }

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal