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

KDEUI

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.5
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