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