00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <qcheckbox.h>
00024 #include <qguardedptr.h>
00025 #include <qhbox.h>
00026 #include <qlabel.h>
00027 #include <qlineedit.h>
00028 #include <qmessagebox.h>
00029 #include <qstringlist.h>
00030 #include <qvbox.h>
00031 #include <qvgroupbox.h>
00032 #include <qstylesheet.h>
00033 #include <qsimplerichtext.h>
00034
00035 #include <kapplication.h>
00036 #include <kconfig.h>
00037 #include <kdebug.h>
00038 #include <kdialogbase.h>
00039 #include <kguiitem.h>
00040 #include <klistbox.h>
00041 #include <klocale.h>
00042 #include <kmessagebox.h>
00043 #include <qlayout.h>
00044 #include <kstdguiitem.h>
00045 #include <kactivelabel.h>
00046 #include <kiconloader.h>
00047
00058 #ifdef __GNUC__
00059 #warning FIXME - Implement Notification
00060 #endif
00061
00062 static bool KMessageBox_queue = false;
00063
00064 static QPixmap themedMessageBoxIcon(QMessageBox::Icon icon)
00065 {
00066 QString icon_name;
00067
00068 switch(icon)
00069 {
00070 case QMessageBox::NoIcon:
00071 return QPixmap();
00072 break;
00073 case QMessageBox::Information:
00074 icon_name = "messagebox_info";
00075 break;
00076 case QMessageBox::Warning:
00077 icon_name = "messagebox_warning";
00078 break;
00079 case QMessageBox::Critical:
00080 icon_name = "messagebox_critical";
00081 break;
00082 }
00083
00084 QPixmap ret = KApplication::kApplication()->iconLoader()->loadIcon(icon_name, KIcon::NoGroup, KIcon::SizeMedium, KIcon::DefaultState, 0, true);
00085
00086 if (ret.isNull())
00087 return QMessageBox::standardIcon(icon);
00088 else
00089 return ret;
00090 }
00091
00092 static int createKMessageBox(KDialogBase *dialog, QMessageBox::Icon icon, const QString &text, const QStringList &strlist, const QString &ask, bool *checkboxReturn, int options, const QString &details=QString::null)
00093 {
00094 QVBox *topcontents = new QVBox (dialog);
00095 topcontents->setSpacing(KDialog::spacingHint()*2);
00096 topcontents->setMargin(KDialog::marginHint());
00097
00098 QWidget *contents = new QWidget(topcontents);
00099 QHBoxLayout * lay = new QHBoxLayout(contents);
00100 lay->setSpacing(KDialog::spacingHint()*2);
00101
00102 QLabel *label1 = new QLabel( contents);
00103
00104 if (icon != QMessageBox::NoIcon)
00105 label1->setPixmap(themedMessageBoxIcon(icon));
00106
00107 lay->addWidget( label1, 0, Qt::AlignCenter );
00108 lay->addSpacing(KDialog::spacingHint());
00109
00110 QString qt_text;
00111 if ( !text.isEmpty() && (text[0] != '<') )
00112 {
00113 QStringList lines = QStringList::split('\n', text);
00114 for(QStringList::Iterator it = lines.begin(); it != lines.end(); ++it)
00115 {
00116 *it = QStyleSheet::convertFromPlainText( *it, QStyleSheetItem::WhiteSpaceNormal );
00117 }
00118 qt_text = lines.join(QString::null);
00119 }
00120 else
00121 qt_text = text;
00122
00123
00124 int pref_width = 0;
00125 int pref_height = 0;
00126
00127 {
00128 QSimpleRichText rt(qt_text, dialog->font());
00129 int scr = QApplication::desktop()->screenNumber(dialog);
00130
00131 pref_width = QApplication::desktop()->screenGeometry(scr).width() / 3;
00132 rt.setWidth(pref_width);
00133 int used_width = rt.widthUsed();
00134 pref_height = rt.height();
00135 if (used_width <= pref_width)
00136 {
00137 while(true)
00138 {
00139 int new_width = (used_width * 9) / 10;
00140 rt.setWidth(new_width);
00141 int new_height = rt.height();
00142 if (new_height > pref_height)
00143 break;
00144 used_width = rt.widthUsed();
00145 if (used_width > new_width)
00146 break;
00147 }
00148 pref_width = used_width;
00149 }
00150 else
00151 {
00152 if (used_width > (pref_width *2))
00153 pref_width = pref_width *2;
00154 else
00155 pref_width = used_width;
00156 }
00157 }
00158 KActiveLabel *label2 = new KActiveLabel( qt_text, contents );
00159 if ((options & KMessageBox::AllowLink) == 0)
00160 {
00161 QObject::disconnect(label2, SIGNAL(linkClicked(const QString &)),
00162 label2, SLOT(openLink(const QString &)));
00163 }
00164
00165
00166
00167 label2->setFixedSize(QSize(pref_width+10, pref_height));
00168 lay->addWidget( label2 );
00169
00170 KListBox *listbox = 0;
00171 if (!strlist.isEmpty())
00172 {
00173 listbox=new KListBox( topcontents );
00174 listbox->insertStringList( strlist );
00175 topcontents->setStretchFactor(listbox, 1);
00176 }
00177
00178 QGuardedPtr<QCheckBox> checkbox = 0;
00179 if (!ask.isEmpty())
00180 {
00181 checkbox = new QCheckBox(ask, topcontents);
00182 }
00183
00184 if (!details.isEmpty())
00185 {
00186 QVGroupBox *detailsGroup = new QVGroupBox( i18n("Details:"), dialog);
00187 QLabel *label3 = new QLabel(details, detailsGroup);
00188 label3->setMinimumSize(label3->sizeHint());
00189 dialog->setDetailsWidget(detailsGroup);
00190 }
00191
00192 dialog->setMainWidget(topcontents);
00193 dialog->enableButtonSeparator(false);
00194 if (!listbox)
00195 dialog->disableResize();
00196
00197 if (KMessageBox_queue)
00198 {
00199 KDialogQueue::queueDialog(dialog);
00200 return KMessageBox::Cancel;
00201 }
00202
00203
00204
00205
00206 QGuardedPtr<KDialogBase> guardedDialog = dialog;
00207
00208 int result = guardedDialog->exec();
00209 if (checkbox && checkboxReturn)
00210 *checkboxReturn = checkbox->isChecked();
00211 delete (KDialogBase *) guardedDialog;
00212 return result;
00213 }
00214
00215 int
00216 KMessageBox::questionYesNo(QWidget *parent, const QString &text,
00217 const QString &caption,
00218 const KGuiItem &buttonYes,
00219 const KGuiItem &buttonNo,
00220 const QString &dontAskAgainName,
00221 int options)
00222 {
00223 return questionYesNoList(parent, text, QStringList(), caption,
00224 buttonYes, buttonNo, dontAskAgainName, options);
00225 }
00226
00227
00228 int
00229 KMessageBox::questionYesNoList(QWidget *parent, const QString &text,
00230 const QStringList &strlist,
00231 const QString &caption,
00232 const KGuiItem &buttonYes,
00233 const KGuiItem &buttonNo,
00234 const QString &dontAskAgainName,
00235 int options)
00236 {
00237 KConfig *config = 0;
00238 QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
00239
00240 if (!dontAskAgainName.isEmpty())
00241 {
00242 config = KGlobal::config();
00243 KConfigGroupSaver saver( config, grpNotifMsgs );
00244 QString dontAsk = config->readEntry( dontAskAgainName).lower();
00245 if (dontAsk == "yes")
00246 {
00247 return Yes;
00248 }
00249 if (dontAsk == "no")
00250 {
00251 return No;
00252 }
00253 }
00254 KDialogBase *dialog= new KDialogBase(
00255 caption.isEmpty() ? i18n("Question") : caption,
00256 KDialogBase::Yes | KDialogBase::No,
00257 KDialogBase::Yes, KDialogBase::No,
00258 parent, "questionYesNo", true, true,
00259 buttonYes, buttonNo);
00260
00261 bool checkboxResult = false;
00262 int result = createKMessageBox(dialog, QMessageBox::Information, text, strlist,
00263 dontAskAgainName.isEmpty() ? QString::null : i18n("&Do not ask again"),
00264 &checkboxResult, options);
00265
00266 switch( result )
00267 {
00268 case KDialogBase::Yes:
00269 if (!dontAskAgainName.isEmpty())
00270 {
00271 if (checkboxResult)
00272 {
00273 KConfigGroupSaver saver( config, grpNotifMsgs );
00274 config->writeEntry( dontAskAgainName, "Yes");
00275 }
00276 config->sync();
00277 }
00278 return Yes;
00279
00280 case KDialogBase::No:
00281 if (!dontAskAgainName.isEmpty())
00282 {
00283 if (checkboxResult)
00284 {
00285 KConfigGroupSaver saver( config, grpNotifMsgs );
00286 config->writeEntry( dontAskAgainName, "No");
00287 }
00288 config->sync();
00289 }
00290 return No;
00291
00292 default:
00293 break;
00294 }
00295
00296 return Yes;
00297 }
00298 int
00299 KMessageBox::questionYesNoCancel(QWidget *parent,
00300 const QString &text,
00301 const QString &caption,
00302 const KGuiItem &buttonYes,
00303 const KGuiItem &buttonNo,
00304 const QString &dontAskAgainName,
00305 int options)
00306 {
00307 KConfig *config = 0;
00308 QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
00309
00310 if (!dontAskAgainName.isEmpty())
00311 {
00312 config = KGlobal::config();
00313 KConfigGroupSaver saver( config, grpNotifMsgs );
00314 QString dontAsk = config->readEntry( dontAskAgainName).lower();
00315 if (dontAsk == "yes")
00316 {
00317 return Yes;
00318 }
00319 if (dontAsk == "no")
00320 {
00321 return No;
00322 }
00323 }
00324 KDialogBase *dialog= new KDialogBase(
00325 caption.isEmpty() ? i18n("Question") : caption,
00326 KDialogBase::Yes | KDialogBase::No | KDialogBase::Cancel,
00327 KDialogBase::Yes, KDialogBase::Cancel,
00328 parent, "questionYesNoCancel", true, true,
00329 buttonYes, buttonNo);
00330
00331 bool checkboxResult = false;
00332 int result = createKMessageBox(dialog, QMessageBox::Information,
00333 text, QStringList(),
00334 dontAskAgainName.isEmpty() ? QString::null : i18n("&Do not ask again"),
00335 &checkboxResult, options);
00336
00337 switch( result )
00338 {
00339 case KDialogBase::Yes:
00340 if (!dontAskAgainName.isEmpty())
00341 {
00342 if (checkboxResult)
00343 {
00344 KConfigGroupSaver saver( config, grpNotifMsgs );
00345 config->writeEntry( dontAskAgainName, "Yes");
00346 }
00347 config->sync();
00348 }
00349 return Yes;
00350
00351 case KDialogBase::No:
00352 if (!dontAskAgainName.isEmpty())
00353 {
00354 if (checkboxResult)
00355 {
00356 KConfigGroupSaver saver( config, grpNotifMsgs );
00357 config->writeEntry( dontAskAgainName, "No");
00358 }
00359 config->sync();
00360 }
00361 return No;
00362
00363 case KDialogBase::Cancel:
00364 return Cancel;
00365
00366 default:
00367 break;
00368 }
00369
00370 return Cancel;
00371 }
00372
00373 int
00374 KMessageBox::warningYesNo(QWidget *parent, const QString &text,
00375 const QString &caption,
00376 const KGuiItem &buttonYes,
00377 const KGuiItem &buttonNo,
00378 const QString &dontAskAgainName,
00379 int options)
00380 {
00381 KConfig *config = 0;
00382 QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
00383
00384 if (!dontAskAgainName.isEmpty())
00385 {
00386 config = KGlobal::config();
00387 KConfigGroupSaver saver( config, grpNotifMsgs );
00388 QString dontAsk = config->readEntry( dontAskAgainName).lower();
00389 if (dontAsk == "yes")
00390 {
00391 return Yes;
00392 }
00393 if (dontAsk == "no")
00394 {
00395 return No;
00396 }
00397 }
00398 KDialogBase *dialog= new KDialogBase(
00399 caption.isEmpty() ? i18n("Warning") : caption,
00400 KDialogBase::Yes | KDialogBase::No,
00401 KDialogBase::No, KDialogBase::No,
00402 parent, "warningYesNo", true, true,
00403 buttonYes, buttonNo);
00404
00405 bool checkboxResult = false;
00406 int result = createKMessageBox(dialog, QMessageBox::Warning, text, QStringList(),
00407 dontAskAgainName.isEmpty() ? QString::null : i18n("&Do not ask again"),
00408 &checkboxResult, options);
00409
00410 switch( result )
00411 {
00412 case KDialogBase::Yes:
00413 if (!dontAskAgainName.isEmpty())
00414 {
00415 if (checkboxResult)
00416 {
00417 KConfigGroupSaver saver( config, grpNotifMsgs );
00418 config->writeEntry( dontAskAgainName, "Yes");
00419 }
00420 config->sync();
00421 }
00422 return Yes;
00423
00424 case KDialogBase::No:
00425 if (!dontAskAgainName.isEmpty())
00426 {
00427 if (checkboxResult)
00428 {
00429 KConfigGroupSaver saver( config, grpNotifMsgs );
00430 config->writeEntry( dontAskAgainName, "No");
00431 }
00432 config->sync();
00433 }
00434 return No;
00435
00436 default:
00437 break;
00438 }
00439
00440 return No;
00441 }
00442
00443 int
00444 KMessageBox::warningContinueCancel(QWidget *parent,
00445 const QString &text,
00446 const QString &caption,
00447 const KGuiItem &buttonContinue,
00448 const QString &dontAskAgainName,
00449 int options)
00450 {
00451 return warningContinueCancelList(parent, text, QStringList(), caption,
00452 buttonContinue, dontAskAgainName, options);
00453 }
00454
00455 int
00456 KMessageBox::warningContinueCancelList(QWidget *parent, const QString &text,
00457 const QStringList &strlist,
00458 const QString &caption,
00459 const KGuiItem &buttonContinue,
00460 const QString &dontAskAgainName,
00461 int options)
00462 {
00463 KConfig *config = 0;
00464 QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
00465 bool showMsg = true;
00466
00467 if (!dontAskAgainName.isEmpty())
00468 {
00469 config = KGlobal::config();
00470 KConfigGroupSaver saver( config, grpNotifMsgs );
00471 showMsg = config->readBoolEntry( dontAskAgainName, true);
00472 if (!showMsg)
00473 {
00474 return Continue;
00475 }
00476 }
00477
00478 KDialogBase *dialog= new KDialogBase(
00479 caption.isEmpty() ? i18n("Warning") : caption,
00480 KDialogBase::Yes | KDialogBase::No,
00481 KDialogBase::Yes, KDialogBase::No,
00482 parent, "warningYesNo", true, true,
00483 buttonContinue, KStdGuiItem::cancel() );
00484
00485 bool checkboxResult = false;
00486 int result = createKMessageBox(dialog, QMessageBox::Warning, text, strlist,
00487 dontAskAgainName.isEmpty() ? QString::null : i18n("&Do not ask again"),
00488 &checkboxResult, options);
00489
00490 switch( result )
00491 {
00492 case KDialogBase::Yes:
00493 {
00494 if (!dontAskAgainName.isEmpty())
00495 {
00496 showMsg = !checkboxResult;
00497 if (!showMsg)
00498 {
00499 KConfigGroupSaver saver( config, grpNotifMsgs );
00500 config->writeEntry( dontAskAgainName, showMsg);
00501 }
00502 config->sync();
00503 }
00504 return Continue;
00505 }
00506
00507 case KDialogBase::No:
00508 return Cancel;
00509
00510 default:
00511 break;
00512 }
00513
00514 return Cancel;
00515 }
00516
00517
00518 int
00519 KMessageBox::warningYesNoCancel(QWidget *parent, const QString &text,
00520 const QString &caption,
00521 const KGuiItem &buttonYes,
00522 const KGuiItem &buttonNo,
00523 const QString &dontAskAgainName,
00524 int options)
00525 {
00526 KConfig *config = 0;
00527 QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
00528
00529 if (!dontAskAgainName.isEmpty())
00530 {
00531 config = KGlobal::config();
00532 KConfigGroupSaver saver( config, grpNotifMsgs );
00533 QString dontAsk = config->readEntry( dontAskAgainName).lower();
00534 if (dontAsk == "yes")
00535 {
00536 return Yes;
00537 }
00538 if (dontAsk == "no")
00539 {
00540 return No;
00541 }
00542 }
00543 KDialogBase *dialog= new KDialogBase(
00544 caption.isEmpty() ? i18n("Warning") : caption,
00545 KDialogBase::Yes | KDialogBase::No | KDialogBase::Cancel,
00546 KDialogBase::Yes, KDialogBase::Cancel,
00547 parent, "warningYesNoCancel", true, true,
00548 buttonYes, buttonNo);
00549
00550 bool checkboxResult = false;
00551 int result = createKMessageBox(dialog, QMessageBox::Warning, text, QStringList(),
00552 dontAskAgainName.isEmpty() ? QString::null : i18n("&Do not ask again"),
00553 &checkboxResult, options);
00554
00555 switch( result )
00556 {
00557 case KDialogBase::Yes:
00558 if (!dontAskAgainName.isEmpty())
00559 {
00560 if (checkboxResult)
00561 {
00562 KConfigGroupSaver saver( config, grpNotifMsgs );
00563 config->writeEntry( dontAskAgainName, "Yes");
00564 }
00565 config->sync();
00566 }
00567 return Yes;
00568
00569 case KDialogBase::No:
00570 if (!dontAskAgainName.isEmpty())
00571 {
00572 if (checkboxResult)
00573 {
00574 KConfigGroupSaver saver( config, grpNotifMsgs );
00575 config->writeEntry( dontAskAgainName, "No");
00576 }
00577 config->sync();
00578 }
00579 return No;
00580
00581 case KDialogBase::Cancel:
00582 return Cancel;
00583
00584 default:
00585 break;
00586 }
00587
00588 return Cancel;
00589 }
00590
00591 void
00592 KMessageBox::error(QWidget *parent, const QString &text,
00593 const QString &caption, int options)
00594 {
00595 KDialogBase *dialog= new KDialogBase(
00596 caption.isEmpty() ? i18n("Error") : caption,
00597 KDialogBase::Yes,
00598 KDialogBase::Yes, KDialogBase::Yes,
00599 parent, "error", true, true,
00600 KStdGuiItem::ok() );
00601
00602 createKMessageBox(dialog, QMessageBox::Critical, text, QStringList(), QString::null, 0, options);
00603 }
00604
00605 void
00606 KMessageBox::detailedError(QWidget *parent, const QString &text,
00607 const QString &details,
00608 const QString &caption, int options)
00609 {
00610 KDialogBase *dialog= new KDialogBase(
00611 caption.isEmpty() ? i18n("Error") : caption,
00612 KDialogBase::Yes | KDialogBase::Details,
00613 KDialogBase::Yes, KDialogBase::Yes,
00614 parent, "error", true, true,
00615 KStdGuiItem::ok() );
00616
00617 createKMessageBox(dialog, QMessageBox::Critical, text, QStringList(), QString::null, 0, options, details);
00618 }
00619
00620 void
00621 KMessageBox::queuedDetailedError(QWidget *parent, const QString &text,
00622 const QString &details,
00623 const QString &caption)
00624 {
00625 KMessageBox_queue = true;
00626 (void) detailedError(parent, text, details, caption);
00627 KMessageBox_queue = false;
00628 }
00629
00630
00631 void
00632 KMessageBox::sorry(QWidget *parent, const QString &text,
00633 const QString &caption, int options)
00634 {
00635 KDialogBase *dialog= new KDialogBase(
00636 caption.isEmpty() ? i18n("Sorry") : caption,
00637 KDialogBase::Yes,
00638 KDialogBase::Yes, KDialogBase::Yes,
00639 parent, "sorry", true, true,
00640 KStdGuiItem::ok() );
00641
00642 createKMessageBox(dialog, QMessageBox::Warning, text, QStringList(), QString::null, 0, options);
00643 }
00644
00645 void
00646 KMessageBox::detailedSorry(QWidget *parent, const QString &text,
00647 const QString &details,
00648 const QString &caption, int options)
00649 {
00650 KDialogBase *dialog= new KDialogBase(
00651 caption.isEmpty() ? i18n("Sorry") : caption,
00652 KDialogBase::Yes | KDialogBase::Details,
00653 KDialogBase::Yes, KDialogBase::Yes,
00654 parent, "sorry", true, true,
00655 KStdGuiItem::ok() );
00656
00657 createKMessageBox(dialog, QMessageBox::Warning, text, QStringList(), QString::null, 0, options, details);
00658 }
00659
00660 void
00661 KMessageBox::information(QWidget *parent,const QString &text,
00662 const QString &caption, const QString &dontShowAgainName, int options)
00663 {
00664 informationList(parent, text, QStringList(), caption, dontShowAgainName, options);
00665 }
00666
00667 void
00668 KMessageBox::informationList(QWidget *parent,const QString &text, const QStringList & strlist,
00669 const QString &caption, const QString &dontShowAgainName, int options)
00670 {
00671 KConfig *config = 0;
00672 QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
00673 bool showMsg = true;
00674
00675 if (!dontShowAgainName.isEmpty())
00676 {
00677 config = KGlobal::config();
00678 KConfigGroupSaver saver( config, grpNotifMsgs );
00679 showMsg = config->readBoolEntry( dontShowAgainName, true);
00680 if (!showMsg)
00681 {
00682 return;
00683 }
00684 }
00685
00686 KDialogBase *dialog= new KDialogBase(
00687 caption.isEmpty() ? i18n("Information") : caption,
00688 KDialogBase::Yes,
00689 KDialogBase::Yes, KDialogBase::Yes,
00690 parent, "information", true, true,
00691 KStdGuiItem::ok() );
00692
00693 bool checkboxResult = false;
00694
00695 createKMessageBox(dialog, QMessageBox::Information, text, strlist,
00696 dontShowAgainName.isEmpty() ? QString::null : i18n("&Do not show this message again"),
00697 &checkboxResult, options);
00698
00699 if (!dontShowAgainName.isEmpty())
00700 {
00701 showMsg = !checkboxResult;
00702 if (!showMsg)
00703 {
00704 KConfigGroupSaver saver( config, grpNotifMsgs );
00705 config->writeEntry( dontShowAgainName, showMsg);
00706 }
00707 config->sync();
00708 }
00709
00710 return;
00711 }
00712
00713 void
00714 KMessageBox::enableAllMessages()
00715 {
00716 KConfig *config = KGlobal::config();
00717 QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
00718 if (!config->hasGroup(grpNotifMsgs))
00719 return;
00720
00721 KConfigGroupSaver saver( config, grpNotifMsgs );
00722
00723 typedef QMap<QString, QString> configMap;
00724
00725 configMap map = config->entryMap(grpNotifMsgs);
00726
00727 configMap::Iterator it;
00728 for (it = map.begin(); it != map.end(); ++it)
00729 config->writeEntry( it.key(), true);
00730 config->sync();
00731 }
00732
00733 void
00734 KMessageBox::about(QWidget *parent, const QString &text,
00735 const QString &caption, int )
00736 {
00737 QString _caption = caption;
00738 if (_caption.isEmpty())
00739 _caption = i18n("About %1").arg(kapp->caption());
00740
00741 QMessageBox *box = new QMessageBox( _caption, text,
00742 QMessageBox::Information,
00743 QMessageBox::Ok | QMessageBox::Default | QMessageBox::Escape,
00744 0, 0,
00745 parent, "about" );
00746
00747 box->setButtonText(QMessageBox::Ok, i18n("&OK"));
00748 box->setIconPixmap(kapp->icon());
00749 box->adjustSize();
00750 box->setFixedSize(box->size());
00751
00752 box->exec();
00753 delete box;
00754 return;
00755 }
00756
00757 int KMessageBox::messageBox( QWidget *parent, DialogType type, const QString &text, const QString &caption, const KGuiItem &buttonYes, const KGuiItem &buttonNo, int options )
00758 {
00759 switch (type) {
00760 case QuestionYesNo:
00761 return KMessageBox::questionYesNo( parent,
00762 text, caption, buttonYes, buttonNo, QString::null, options );
00763 case QuestionYesNoCancel:
00764 return KMessageBox::questionYesNoCancel( parent,
00765 text, caption, buttonYes, buttonNo, QString::null, options );
00766 case WarningYesNo:
00767 return KMessageBox::warningYesNo( parent,
00768 text, caption, buttonYes, buttonNo, QString::null, options );
00769 case WarningContinueCancel:
00770 return KMessageBox::warningContinueCancel( parent,
00771 text, caption, buttonYes.text(), QString::null, options );
00772 case WarningYesNoCancel:
00773 return KMessageBox::warningYesNoCancel( parent,
00774 text, caption, buttonYes, buttonNo, QString::null, options );
00775 case Information:
00776 KMessageBox::information( parent,
00777 text, caption, QString::null, options );
00778 return KMessageBox::Ok;
00779
00780 case Error:
00781 KMessageBox::error( parent, text, caption, options );
00782 return KMessageBox::Ok;
00783
00784 case Sorry:
00785 KMessageBox::sorry( parent, text, caption, options );
00786 return KMessageBox::Ok;
00787 }
00788 return KMessageBox::Cancel;
00789 }
00790
00791 void KMessageBox::queuedMessageBox( QWidget *parent, DialogType type, const QString &text, const QString &caption, int options )
00792 {
00793 KMessageBox_queue = true;
00794 (void) messageBox(parent, type, text, caption, KStdGuiItem::yes(),
00795 KStdGuiItem::no(), options);
00796 KMessageBox_queue = false;
00797 }
00798
00799 void KMessageBox::queuedMessageBox( QWidget *parent, DialogType type, const QString &text, const QString &caption )
00800 {
00801 KMessageBox_queue = true;
00802 (void) messageBox(parent, type, text, caption);
00803 KMessageBox_queue = false;
00804 }