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

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
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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