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

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
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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