kmessagebox.cpp
/* This file is part of the KDE libraries
Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; version 2
of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include <qcheckbox.h>
#include <qguardedptr.h>
#include <qhbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qmessagebox.h>
#include <qstringlist.h>
#include <qvbox.h>
#include <qvgroupbox.h>
#include <qstylesheet.h>
#include <qsimplerichtext.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kdialogbase.h>
#include <kguiitem.h>
#include <klistbox.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <knotifyclient.h>
#include <kstdguiitem.h>
#include <kactivelabel.h>
#include <kiconloader.h>
#include <kglobalsettings.h>
#ifdef Q_WS_X11
#include <X11/Xlib.h>
#endif
static bool KMessageBox_queue = false;
static QPixmap themedMessageBoxIcon(QMessageBox::Icon icon)
{
QString icon_name;
switch(icon)
{
case QMessageBox::NoIcon:
return QPixmap();
break;
case QMessageBox::Information:
icon_name = "messagebox_info";
break;
case QMessageBox::Warning:
icon_name = "messagebox_warning";
break;
case QMessageBox::Critical:
icon_name = "messagebox_critical";
break;
default:
break;
}
QPixmap ret = KGlobal::iconLoader()->loadIcon(icon_name, KIcon::NoGroup, KIcon::SizeMedium, KIcon::DefaultState, 0, true);
if (ret.isNull())
return QMessageBox::standardIcon(icon);
else
return ret;
}
static void sendNotification( QString message,
const QStringList& strlist,
QMessageBox::Icon icon,
WId parent_id )
{
// create the message for KNotify
QString messageType;
switch ( icon )
{
case QMessageBox::Warning:
messageType = "messageWarning";
break;
case QMessageBox::Critical:
messageType = "messageCritical";
break;
case QMessageBox::Question:
messageType = "messageQuestion";
break;
default:
messageType = "messageInformation";
break;
}
if ( !strlist.isEmpty() )
{
for ( QStringList::ConstIterator it = strlist.begin(); it != strlist.end(); ++it )
message += "\n" + *it;
}
if ( !message.isEmpty() )
KNotifyClient::event( (int)parent_id, messageType, message );
}
static QString qrichtextify( const QString& text )
{
if ( text.isEmpty() || text[0] == '<' )
return text;
QStringList lines = QStringList::split('\n', text);
for(QStringList::Iterator it = lines.begin(); it != lines.end(); ++it)
{
*it = QStyleSheet::convertFromPlainText( *it, QStyleSheetItem::WhiteSpaceNormal );
}
return lines.join(QString::null);
}
int KMessageBox::createKMessageBox(KDialogBase *dialog, QMessageBox::Icon icon,
const QString &text, const QStringList &strlist,
const QString &ask, bool *checkboxReturn,
int options, const QString &details)
{
return createKMessageBox(dialog, themedMessageBoxIcon(icon), text, strlist,
ask, checkboxReturn, options, details, icon);
}
int KMessageBox::createKMessageBox(KDialogBase *dialog, QPixmap icon,
const QString &text, const QStringList &strlist,
const QString &ask, bool *checkboxReturn, int options,
const QString &details, QMessageBox::Icon notifyType)
{
QVBox *topcontents = new QVBox (dialog);
topcontents->setSpacing(KDialog::spacingHint()*2);
topcontents->setMargin(KDialog::marginHint());
QWidget *contents = new QWidget(topcontents);
QHBoxLayout * lay = new QHBoxLayout(contents);
lay->setSpacing(KDialog::spacingHint());
QLabel *label1 = new QLabel( contents);
if (!icon.isNull())
label1->setPixmap(icon);
lay->addWidget( label1, 0, Qt::AlignCenter );
lay->addSpacing(KDialog::spacingHint());
// Enforce <p>text</p> otherwise the word-wrap doesn't work well
QString qt_text = qrichtextify( text );
int pref_width = 0;
int pref_height = 0;
// Calculate a proper size for the text.
{
QSimpleRichText rt(qt_text, dialog->font());
QRect d = KGlobalSettings::desktopGeometry(dialog);
pref_width = d.width() / 3;
rt.setWidth(pref_width);
int used_width = rt.widthUsed();
pref_height = rt.height();
if (3*pref_height > 2*d.height())
{
// Very high dialog.. make it wider
pref_width = d.width() / 2;
rt.setWidth(pref_width);
used_width = rt.widthUsed();
pref_height = rt.height();
}
if (used_width <= pref_width)
{
while(true)
{
int new_width = (used_width * 9) / 10;
rt.setWidth(new_width);
int new_height = rt.height();
if (new_height > pref_height)
break;
used_width = rt.widthUsed();
if (used_width > new_width)
break;
}
pref_width = used_width;
}
else
{
if (used_width > (pref_width *2))
pref_width = pref_width *2;
else
pref_width = used_width;
}
}
KActiveLabel *label2 = new KActiveLabel( qt_text, contents );
if (!(options & KMessageBox::AllowLink))
{
QObject::disconnect(label2, SIGNAL(linkClicked(const QString &)),
label2, SLOT(openLink(const QString &)));
}
// We add 10 pixels extra to compensate for some KActiveLabel margins.
// TODO: find out why this is 10.
label2->setFixedSize(QSize(pref_width+10, pref_height));
lay->addWidget( label2 );
lay->addStretch();
KListBox *listbox = 0;
if (!strlist.isEmpty())
{
listbox=new KListBox( topcontents );
listbox->insertStringList( strlist );
listbox->setSelectionMode( QListBox::NoSelection );
topcontents->setStretchFactor(listbox, 1);
}
QGuardedPtr<QCheckBox> checkbox = 0;
if (!ask.isEmpty())
{
checkbox = new QCheckBox(ask, topcontents);
if (checkboxReturn)
checkbox->setChecked(*checkboxReturn);
}
if (!details.isEmpty())
{
QVGroupBox *detailsGroup = new QVGroupBox( i18n("Details"), dialog);
if ( details.length() < 512 ) {
KActiveLabel *label3 = new KActiveLabel(qrichtextify(details),
detailsGroup);
label3->setMinimumSize(label3->sizeHint());
if (!(options & KMessageBox::AllowLink))
{
QObject::disconnect(label3, SIGNAL(linkClicked(const QString &)),
label3, SLOT(openLink(const QString &)));
}
} else {
QTextEdit* te = new QTextEdit(details, QString::null, detailsGroup);
te->setReadOnly( true );
te->setMinimumHeight( te->fontMetrics().lineSpacing() * 11 );
}
dialog->setDetailsWidget(detailsGroup);
}
dialog->setMainWidget(topcontents);
dialog->enableButtonSeparator(false);
if (!listbox)
dialog->disableResize();
const KDialogBase::ButtonCode buttons[] = {
KDialogBase::Help,
KDialogBase::Default,
KDialogBase::Ok,
KDialogBase::Apply,
KDialogBase::Try,
KDialogBase::Cancel,
KDialogBase::Close,
KDialogBase::User1,
KDialogBase::User2,
KDialogBase::User3,
KDialogBase::No,
KDialogBase::Yes,
KDialogBase::Details };
for( unsigned int i = 0;
i < sizeof( buttons )/sizeof( buttons[ 0 ] );
++i )
if( QPushButton* btn = dialog->actionButton( buttons[ i ] ))
if( btn->isDefault())
btn->setFocus();
if ( (options & KMessageBox::Notify) )
sendNotification( text, strlist, notifyType, dialog->topLevelWidget()->winId());
if (KMessageBox_queue)
{
KDialogQueue::queueDialog(dialog);
return KMessageBox::Cancel; // We have to return something.
}
if ( (options & KMessageBox::NoExec) )
{
return KMessageBox::Cancel; // We have to return something.
}
// We use a QGuardedPtr because the dialog may get deleted
// during exec() if the parent of the dialog gets deleted.
// In that case the guarded ptr will reset to 0.
QGuardedPtr<KDialogBase> guardedDialog = dialog;
int result = guardedDialog->exec();
if (checkbox && checkboxReturn)
*checkboxReturn = checkbox->isChecked();
delete (KDialogBase *) guardedDialog;
return result;
}
int
KMessageBox::questionYesNo(QWidget *parent, const QString &text,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
return questionYesNoList(parent, text, QStringList(), caption,
buttonYes, buttonNo, dontAskAgainName, options);
}
int
KMessageBox::questionYesNoWId(WId parent_id, const QString &text,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
return questionYesNoListWId(parent_id, text, QStringList(), caption,
buttonYes, buttonNo, dontAskAgainName, options);
}
bool
KMessageBox::shouldBeShownYesNo(const QString &dontShowAgainName,
ButtonCode &result)
{
if ( dontShowAgainName.isEmpty() ) return true;
QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
KConfig *config = againConfig ? againConfig : KGlobal::config();
KConfigGroupSaver saver( config, grpNotifMsgs );
QString dontAsk = config->readEntry(dontShowAgainName).lower();
if (dontAsk == "yes") {
result = Yes;
return false;
}
if (dontAsk == "no") {
result = No;
return false;
}
return true;
}
bool
KMessageBox::shouldBeShownContinue(const QString &dontShowAgainName)
{
if ( dontShowAgainName.isEmpty() ) return true;
QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
KConfig *config = againConfig ? againConfig : KGlobal::config();
KConfigGroupSaver saver( config, grpNotifMsgs );
return config->readBoolEntry(dontShowAgainName, true);
}
void
KMessageBox::saveDontShowAgainYesNo(const QString &dontShowAgainName,
ButtonCode result)
{
if ( dontShowAgainName.isEmpty() ) return;
QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
KConfig *config = againConfig ? againConfig : KGlobal::config();
KConfigGroupSaver saver( config, grpNotifMsgs );
config->writeEntry( dontShowAgainName, result==Yes ? "yes" : "no", true, (dontShowAgainName[0] == ':'));
config->sync();
}
void
KMessageBox::saveDontShowAgainContinue(const QString &dontShowAgainName)
{
if ( dontShowAgainName.isEmpty() ) return;
QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
KConfig *config = againConfig ? againConfig : KGlobal::config();
KConfigGroupSaver saver( config, grpNotifMsgs );
config->writeEntry( dontShowAgainName, false, true, (dontShowAgainName[0] == ':'));
config->sync();
}
KConfig* KMessageBox::againConfig = NULL;
void
KMessageBox::setDontShowAskAgainConfig(KConfig* cfg)
{
againConfig = cfg;
}
int
KMessageBox::questionYesNoList(QWidget *parent, const QString &text,
const QStringList &strlist,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{ // in order to avoid code duplication, convert to WId, it will be converted back
return questionYesNoListWId( parent ? parent->winId() : 0, text, strlist,
caption, buttonYes, buttonNo, dontAskAgainName, options );
}
int
KMessageBox::questionYesNoListWId(WId parent_id, const QString &text,
const QStringList &strlist,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
ButtonCode res;
if ( !shouldBeShownYesNo(dontAskAgainName, res) )
return res;
QWidget* parent = QWidget::find( parent_id );
KDialogBase *dialog= new KDialogBase(
caption.isEmpty() ? i18n("Question") : caption,
KDialogBase::Yes | KDialogBase::No,
KDialogBase::Yes, KDialogBase::No,
parent, "questionYesNo", true, true,
buttonYes, buttonNo);
if( options & PlainCaption )
dialog->setPlainCaption( caption );
#ifdef Q_WS_X11
if( parent == NULL && parent_id )
XSetTransientForHint( qt_xdisplay(), dialog->winId(), parent_id );
#endif
bool checkboxResult = false;
int result = createKMessageBox(dialog, QMessageBox::Information, text, strlist,
dontAskAgainName.isEmpty() ? QString::null : i18n("Do not ask again"),
&checkboxResult, options);
res = (result==KDialogBase::Yes ? Yes : No);
if (checkboxResult)
saveDontShowAgainYesNo(dontAskAgainName, res);
return res;
}
int
KMessageBox::questionYesNoCancel(QWidget *parent,
const QString &text,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
return questionYesNoCancelWId( parent ? parent->winId() : 0, text, caption, buttonYes, buttonNo,
dontAskAgainName, options );
}
int
KMessageBox::questionYesNoCancelWId(WId parent_id,
const QString &text,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
ButtonCode res;
if ( !shouldBeShownYesNo(dontAskAgainName, res) )
return res;
QWidget* parent = QWidget::find( parent_id );
KDialogBase *dialog= new KDialogBase(
caption.isEmpty() ? i18n("Question") : caption,
KDialogBase::Yes | KDialogBase::No | KDialogBase::Cancel,
KDialogBase::Yes, KDialogBase::Cancel,
parent, "questionYesNoCancel", true, true,
buttonYes, buttonNo);
if( options & PlainCaption )
dialog->setPlainCaption( caption );
#ifdef Q_WS_X11
if( parent == NULL && parent_id )
XSetTransientForHint( qt_xdisplay(), dialog->winId(), parent_id );
#endif
bool checkboxResult = false;
int result = createKMessageBox(dialog, QMessageBox::Information,
text, QStringList(),
dontAskAgainName.isEmpty() ? QString::null : i18n("Do not ask again"),
&checkboxResult, options);
if ( result==KDialogBase::Cancel ) return Cancel;
res = (result==KDialogBase::Yes ? Yes : No);
if (checkboxResult)
saveDontShowAgainYesNo(dontAskAgainName, res);
return res;
}
int
KMessageBox::warningYesNo(QWidget *parent, const QString &text,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
return warningYesNoList(parent, text, QStringList(), caption,
buttonYes, buttonNo, dontAskAgainName, options);
}
int
KMessageBox::warningYesNoWId(WId parent_id, const QString &text,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
return warningYesNoListWId(parent_id, text, QStringList(), caption,
buttonYes, buttonNo, dontAskAgainName, options);
}
int
KMessageBox::warningYesNoList(QWidget *parent, const QString &text,
const QStringList &strlist,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
return warningYesNoListWId( parent ? parent->winId() : 0, text, strlist, caption,
buttonYes, buttonNo, dontAskAgainName, options );
}
int
KMessageBox::warningYesNoListWId(WId parent_id, const QString &text,
const QStringList &strlist,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
// warningYesNo and warningYesNoList are always "dangerous"
// ### Remove this line for KDE 4, when the 'options' default parameter
// takes effects.
options |= Dangerous;
ButtonCode res;
if ( !shouldBeShownYesNo(dontAskAgainName, res) )
return res;
QWidget* parent = QWidget::find( parent_id );
KDialogBase *dialog= new KDialogBase(
caption.isEmpty() ? i18n("Warning") : caption,
KDialogBase::Yes | KDialogBase::No,
KDialogBase::No, KDialogBase::No,
parent, "warningYesNoList", true, true,
buttonYes, buttonNo);
if( options & PlainCaption )
dialog->setPlainCaption( caption );
#ifdef Q_WS_X11
if( parent == NULL && parent_id )
XSetTransientForHint( qt_xdisplay(), dialog->winId(), parent_id );
#endif
bool checkboxResult = false;
int result = createKMessageBox(dialog, QMessageBox::Warning, text, strlist,
dontAskAgainName.isEmpty() ? QString::null : i18n("Do not ask again"),
&checkboxResult, options);
res = (result==KDialogBase::Yes ? Yes : No);
if (checkboxResult)
saveDontShowAgainYesNo(dontAskAgainName, res);
return res;
}
int
KMessageBox::warningContinueCancel(QWidget *parent,
const QString &text,
const QString &caption,
const KGuiItem &buttonContinue,
const QString &dontAskAgainName,
int options)
{
return warningContinueCancelList(parent, text, QStringList(), caption,
buttonContinue, dontAskAgainName, options);
}
int
KMessageBox::warningContinueCancelWId(WId parent_id,
const QString &text,
const QString &caption,
const KGuiItem &buttonContinue,
const QString &dontAskAgainName,
int options)
{
return warningContinueCancelListWId(parent_id, text, QStringList(), caption,
buttonContinue, dontAskAgainName, options);
}
int
KMessageBox::warningContinueCancelList(QWidget *parent, const QString &text,
const QStringList &strlist,
const QString &caption,
const KGuiItem &buttonContinue,
const QString &dontAskAgainName,
int options)
{
return warningContinueCancelListWId( parent ? parent->winId() : 0, text, strlist,
caption, buttonContinue, dontAskAgainName, options );
}
int
KMessageBox::warningContinueCancelListWId(WId parent_id, const QString &text,
const QStringList &strlist,
const QString &caption,
const KGuiItem &buttonContinue,
const QString &dontAskAgainName,
int options)
{
if ( !shouldBeShownContinue(dontAskAgainName) )
return Continue;
QWidget* parent = QWidget::find( parent_id );
KDialogBase *dialog= new KDialogBase(
caption.isEmpty() ? i18n("Warning") : caption,
KDialogBase::Yes | KDialogBase::No,
KDialogBase::Yes, KDialogBase::No,
parent, "warningYesNo", true, true,
buttonContinue, KStdGuiItem::cancel() );
if( options & PlainCaption )
dialog->setPlainCaption( caption );
#ifdef Q_WS_X11
if( parent == NULL && parent_id )
XSetTransientForHint( qt_xdisplay(), dialog->winId(), parent_id );
#endif
bool checkboxResult = false;
int result = createKMessageBox(dialog, QMessageBox::Warning, text, strlist,
dontAskAgainName.isEmpty() ? QString::null : i18n("Do not ask again"),
&checkboxResult, options);
if ( result==KDialogBase::No )
return Cancel;
if (checkboxResult)
saveDontShowAgainContinue(dontAskAgainName);
return Continue;
}
int
KMessageBox::warningYesNoCancel(QWidget *parent, const QString &text,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
return warningYesNoCancelList(parent, text, QStringList(), caption,
buttonYes, buttonNo, dontAskAgainName, options);
}
int
KMessageBox::warningYesNoCancelWId(WId parent_id, const QString &text,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
return warningYesNoCancelListWId(parent_id, text, QStringList(), caption,
buttonYes, buttonNo, dontAskAgainName, options);
}
int
KMessageBox::warningYesNoCancelList(QWidget *parent, const QString &text,
const QStringList &strlist,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
return warningYesNoCancelListWId( parent ? parent->winId() : 0, text, strlist,
caption, buttonYes, buttonNo, dontAskAgainName, options );
}
int
KMessageBox::warningYesNoCancelListWId(WId parent_id, const QString &text,
const QStringList &strlist,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontAskAgainName,
int options)
{
ButtonCode res;
if ( !shouldBeShownYesNo(dontAskAgainName, res) )
return res;
QWidget* parent = QWidget::find( parent_id );
KDialogBase *dialog= new KDialogBase(
caption.isEmpty() ? i18n("Warning") : caption,
KDialogBase::Yes | KDialogBase::No | KDialogBase::Cancel,
KDialogBase::Yes, KDialogBase::Cancel,
parent, "warningYesNoCancel", true, true,
buttonYes, buttonNo);
if( options & PlainCaption )
dialog->setPlainCaption( caption );
#ifdef Q_WS_X11
if( parent == NULL && parent_id )
XSetTransientForHint( qt_xdisplay(), dialog->winId(), parent_id );
#endif
bool checkboxResult = false;
int result = createKMessageBox(dialog, QMessageBox::Warning, text, strlist,
dontAskAgainName.isEmpty() ? QString::null : i18n("Do not ask again"),
&checkboxResult, options);
if ( result==KDialogBase::Cancel ) return Cancel;
res = (result==KDialogBase::Yes ? Yes : No);
if (checkboxResult)
saveDontShowAgainYesNo(dontAskAgainName, res);
return res;
}
void
KMessageBox::error(QWidget *parent, const QString &text,
const QString &caption, int options)
{
return errorListWId( parent ? parent->winId() : 0, text, QStringList(), caption, options );
}
void
KMessageBox::errorWId(WId parent_id, const QString &text,
const QString &caption, int options)
{
errorListWId( parent_id, text, QStringList(), caption, options );
}
void
KMessageBox::errorList(QWidget *parent, const QString &text, const QStringList &strlist,
const QString &caption, int options)
{
return errorListWId( parent ? parent->winId() : 0, text, strlist, caption, options );
}
void
KMessageBox::errorListWId(WId parent_id, const QString &text, const QStringList &strlist,
const QString &caption, int options)
{
QWidget* parent = QWidget::find( parent_id );
KDialogBase *dialog= new KDialogBase(
caption.isEmpty() ? i18n("Error") : caption,
KDialogBase::Yes,
KDialogBase::Yes, KDialogBase::Yes,
parent, "error", true, true,
KStdGuiItem::ok() );
if( options & PlainCaption )
dialog->setPlainCaption( caption );
#ifdef Q_WS_X11
if( parent == NULL && parent_id )
XSetTransientForHint( qt_xdisplay(), dialog->winId(), parent_id );
#endif
createKMessageBox(dialog, QMessageBox::Critical, text, strlist, QString::null, 0, options);
}
void
KMessageBox::detailedError(QWidget *parent, const QString &text,
const QString &details,
const QString &caption, int options)
{
return detailedErrorWId( parent ? parent->winId() : 0, text, details, caption, options );
}
void
KMessageBox::detailedErrorWId(WId parent_id, const QString &text,
const QString &details,
const QString &caption, int options)
{
QWidget* parent = QWidget::find( parent_id );
KDialogBase *dialog= new KDialogBase(
caption.isEmpty() ? i18n("Error") : caption,
KDialogBase::Yes | KDialogBase::Details,
KDialogBase::Yes, KDialogBase::Yes,
parent, "error", true, true,
KStdGuiItem::ok() );
if( options & PlainCaption )
dialog->setPlainCaption( caption );
#ifdef Q_WS_X11
if( parent == NULL && parent_id )
XSetTransientForHint( qt_xdisplay(), dialog->winId(), parent_id );
#endif
createKMessageBox(dialog, QMessageBox::Critical, text, QStringList(), QString::null, 0, options, details);
}
void
KMessageBox::queuedDetailedError(QWidget *parent, const QString &text,
const QString &details,
const QString &caption)
{
return queuedDetailedErrorWId( parent ? parent->winId() : 0, text, details, caption );
}
void
KMessageBox::queuedDetailedErrorWId(WId parent_id, const QString &text,
const QString &details,
const QString &caption)
{
KMessageBox_queue = true;
(void) detailedErrorWId(parent_id, text, details, caption);
KMessageBox_queue = false;
}
void
KMessageBox::sorry(QWidget *parent, const QString &text,
const QString &caption, int options)
{
return sorryWId( parent ? parent->winId() : 0, text, caption, options );
}
void
KMessageBox::sorryWId(WId parent_id, const QString &text,
const QString &caption, int options)
{
QWidget* parent = QWidget::find( parent_id );
KDialogBase *dialog= new KDialogBase(
caption.isEmpty() ? i18n("Sorry") : caption,
KDialogBase::Yes,
KDialogBase::Yes, KDialogBase::Yes,
parent, "sorry", true, true,
KStdGuiItem::ok() );
if( options & PlainCaption )
dialog->setPlainCaption( caption );
#ifdef Q_WS_X11
if( parent == NULL && parent_id )
XSetTransientForHint( qt_xdisplay(), dialog->winId(), parent_id );
#endif
createKMessageBox(dialog, QMessageBox::Warning, text, QStringList(), QString::null, 0, options);
}
void
KMessageBox::detailedSorry(QWidget *parent, const QString &text,
const QString &details,
const QString &caption, int options)
{
return detailedSorryWId( parent ? parent->winId() : 0, text, details, caption, options );
}
void
KMessageBox::detailedSorryWId(WId parent_id, const QString &text,
const QString &details,
const QString &caption, int options)
{
QWidget* parent = QWidget::find( parent_id );
KDialogBase *dialog= new KDialogBase(
caption.isEmpty() ? i18n("Sorry") : caption,
KDialogBase::Yes | KDialogBase::Details,
KDialogBase::Yes, KDialogBase::Yes,
parent, "sorry", true, true,
KStdGuiItem::ok() );
if( options & PlainCaption )
dialog->setPlainCaption( caption );
#ifdef Q_WS_X11
if( parent == NULL && parent_id )
XSetTransientForHint( qt_xdisplay(), dialog->winId(), parent_id );
#endif
createKMessageBox(dialog, QMessageBox::Warning, text, QStringList(), QString::null, 0, options, details);
}
void
KMessageBox::information(QWidget *parent,const QString &text,
const QString &caption, const QString &dontShowAgainName, int options)
{
informationList(parent, text, QStringList(), caption, dontShowAgainName, options);
}
void
KMessageBox::informationWId(WId parent_id,const QString &text,
const QString &caption, const QString &dontShowAgainName, int options)
{
informationListWId(parent_id, text, QStringList(), caption, dontShowAgainName, options);
}
void
KMessageBox::informationList(QWidget *parent,const QString &text, const QStringList & strlist,
const QString &caption, const QString &dontShowAgainName, int options)
{
return informationListWId( parent ? parent->winId() : 0, text, strlist, caption,
dontShowAgainName, options );
}
void
KMessageBox::informationListWId(WId parent_id,const QString &text, const QStringList & strlist,
const QString &caption, const QString &dontShowAgainName, int options)
{
if ( !shouldBeShownContinue(dontShowAgainName) )
return;
QWidget* parent = QWidget::find( parent_id );
KDialogBase *dialog= new KDialogBase(
caption.isEmpty() ? i18n("Information") : caption,
KDialogBase::Yes,
KDialogBase::Yes, KDialogBase::Yes,
parent, "information", true, true,
KStdGuiItem::ok() );
if( options & PlainCaption )
dialog->setPlainCaption( caption );
#ifdef Q_WS_X11
if( parent == NULL && parent_id )
XSetTransientForHint( qt_xdisplay(), dialog->winId(), parent_id );
#endif
bool checkboxResult = false;
createKMessageBox(dialog, QMessageBox::Information, text, strlist,
dontShowAgainName.isEmpty() ? QString::null : i18n("Do not show this message again"),
&checkboxResult, options);
if (checkboxResult)
saveDontShowAgainContinue(dontShowAgainName);
}
void
KMessageBox::enableAllMessages()
{
KConfig *config = againConfig ? againConfig : KGlobal::config();
QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
if (!config->hasGroup(grpNotifMsgs))
return;
KConfigGroupSaver saver( config, grpNotifMsgs );
typedef QMap<QString, QString> configMap;
configMap map = config->entryMap(grpNotifMsgs);
configMap::Iterator it;
for (it = map.begin(); it != map.end(); ++it)
config->deleteEntry( it.key() );
config->sync();
}
void
KMessageBox::enableMessage(const QString &dontShowAgainName)
{
KConfig *config = againConfig ? againConfig : KGlobal::config();
QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
if (!config->hasGroup(grpNotifMsgs))
return;
KConfigGroupSaver saver( config, grpNotifMsgs );
config->deleteEntry(dontShowAgainName);
config->sync();
}
void
KMessageBox::about(QWidget *parent, const QString &text,
const QString &caption, int options)
{
QString _caption = caption;
if (_caption.isEmpty())
_caption = i18n("About %1").arg(kapp->caption());
KDialogBase *dialog = new KDialogBase(
caption,
KDialogBase::Yes,
KDialogBase::Yes, KDialogBase::Yes,
parent, "about", true, true,
KStdGuiItem::ok() );
QPixmap ret = KApplication::kApplication()->icon();
if (ret.isNull())
ret = QMessageBox::standardIcon(QMessageBox::Information);
dialog->setIcon(ret);
createKMessageBox(dialog, ret, text, QStringList(), QString::null, 0, options);
return;
}
int KMessageBox::messageBox( QWidget *parent, DialogType type, const QString &text,
const QString &caption, const KGuiItem &buttonYes,
const KGuiItem &buttonNo, const QString &dontShowAskAgainName,
int options )
{
return messageBoxWId( parent ? parent->winId() : 0, type, text, caption,
buttonYes, buttonNo, dontShowAskAgainName, options );
}
int KMessageBox::messageBox( QWidget *parent, DialogType type, const QString &text,
const QString &caption, const KGuiItem &buttonYes,
const KGuiItem &buttonNo, int options )
{
return messageBoxWId( parent ? parent->winId() : 0, type, text, caption,
buttonYes, buttonNo, QString::null, options );
}
int KMessageBox::messageBoxWId( WId parent_id, DialogType type, const QString &text,
const QString &caption, const KGuiItem &buttonYes,
const KGuiItem &buttonNo, const QString &dontShow,
int options )
{
switch (type) {
case QuestionYesNo:
return KMessageBox::questionYesNoWId( parent_id,
text, caption, buttonYes, buttonNo, dontShow, options );
case QuestionYesNoCancel:
return KMessageBox::questionYesNoCancelWId( parent_id,
text, caption, buttonYes, buttonNo, dontShow, options );
case WarningYesNo:
return KMessageBox::warningYesNoWId( parent_id,
text, caption, buttonYes, buttonNo, dontShow, options );
case WarningContinueCancel:
return KMessageBox::warningContinueCancelWId( parent_id,
text, caption, buttonYes.text(), dontShow, options );
case WarningYesNoCancel:
return KMessageBox::warningYesNoCancelWId( parent_id,
text, caption, buttonYes, buttonNo, dontShow, options );
case Information:
KMessageBox::informationWId( parent_id,
text, caption, dontShow, options );
return KMessageBox::Ok;
case Error:
KMessageBox::errorWId( parent_id, text, caption, options );
return KMessageBox::Ok;
case Sorry:
KMessageBox::sorryWId( parent_id, text, caption, options );
return KMessageBox::Ok;
}
return KMessageBox::Cancel;
}
void KMessageBox::queuedMessageBox( QWidget *parent, DialogType type, const QString &text, const QString &caption, int options )
{
return queuedMessageBoxWId( parent ? parent->winId() : 0, type, text, caption, options );
}
void KMessageBox::queuedMessageBoxWId( WId parent_id, DialogType type, const QString &text, const QString &caption, int options )
{
KMessageBox_queue = true;
(void) messageBoxWId(parent_id, type, text, caption, KStdGuiItem::yes(),
KStdGuiItem::no(), QString::null, options);
KMessageBox_queue = false;
}
void KMessageBox::queuedMessageBox( QWidget *parent, DialogType type, const QString &text, const QString &caption )
{
return queuedMessageBoxWId( parent ? parent->winId() : 0, type, text, caption );
}
void KMessageBox::queuedMessageBoxWId( WId parent_id, DialogType type, const QString &text, const QString &caption )
{
KMessageBox_queue = true;
(void) messageBoxWId(parent_id, type, text, caption);
KMessageBox_queue = false;
}
KDialogBase::Details
Show Details button.
Definition: kdialogbase.h:211
KDialog::marginHint
static int marginHint()
Return the number of pixels you shall use between a dialog edge and the outermost widget(s) according...
Definition: kdialog.cpp:97
KDialogBase::Close
Show Close-button.
Definition: kdialogbase.h:205
KMessageBox::informationList
static void informationList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const QString &dontShowAgainName=QString::null, int options=Notify)
Display an "Information" dialog with a listbox.
Definition: kmessagebox.cpp:897
KDialogBase::Ok
Show Ok button.
Definition: kdialogbase.h:201
KActiveLabel
Label with support for selection and clickable links.
Definition: kactivelabel.h:37
KMessageBox::questionYesNoWId
static int questionYesNoWId(WId parent_id, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:329
KMessageBox::messageBoxWId
static int messageBoxWId(WId parent_id, DialogType type, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontShowAskAgainName=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:1011
KIcon::NoGroup
KMessageBox::warningYesNoListWId
static int warningYesNoListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify|Dangerous)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:542
KMessageBox::NoExec
Do not call exec() in createKMessageBox()
Definition: kmessagebox.h:80
KMessageBox::informationListWId
static void informationListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const QString &dontShowAgainName=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:905
KMessageBox::errorList
static void errorList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString::null, int options=Notify)
Display an "Error" dialog with a listbox.
Definition: kmessagebox.cpp:748
KMessageBox::errorListWId
static void errorListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:755
KMessageBox::questionYesNoCancelWId
static int questionYesNoCancelWId(WId parent_id, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:465
KGlobal::iconLoader
static KIconLoader * iconLoader()
KMessageBox::Notify
Emit a KNotifyClient event.
Definition: kmessagebox.h:74
KMessageBox::questionYesNo
static int questionYesNo(QWidget *parent, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
Display a simple "question" dialog.
Definition: kmessagebox.cpp:317
KDialogBase::disableResize
void disableResize()
Convenience method.
Definition: kdialogbase.cpp:531
KConfig::hasGroup
bool hasGroup(const QString &group) const
KMessageBox::setDontShowAskAgainConfig
static void setDontShowAskAgainConfig(KConfig *cfg)
Use cfg for all settings related to the dontShowAgainName feature.
Definition: kmessagebox.cpp:395
KGlobalSettings::desktopGeometry
static QRect desktopGeometry(const QPoint &point)
KMessageBox::messageBox
static int messageBox(QWidget *parent, DialogType type, const QString &text, const QString &caption, const KGuiItem &buttonYes, const KGuiItem &buttonNo, const QString &dontShowAskAgainName, int options=Notify)
Alternate method to show a messagebox:
Definition: kmessagebox.cpp:994
KDialogBase::Apply
Show Apply button.
Definition: kdialogbase.h:202
KMessageBox::detailedErrorWId
static void detailedErrorWId(WId parent_id, const QString &text, const QString &details, const QString &caption=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:784
KConfig::sync
virtual void sync()
KDialogBase::Cancel
Show Cancel-button.
Definition: kdialogbase.h:204
klocale.h
KDialogBase::ButtonCode
ButtonCode
Definition: kdialogbase.h:197
KMessageBox::shouldBeShownContinue
static bool shouldBeShownContinue(const QString &dontShowAgainName)
Definition: kmessagebox.cpp:361
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:191
KMessageBox::sorry
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString::null, int options=Notify)
Display an "Sorry" dialog.
Definition: kmessagebox.cpp:825
KConfig::entryMap
virtual QMap< QString, QString > entryMap(const QString &pGroup) const
KMessageBox::questionYesNoList
static int questionYesNoList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
Display a "question" dialog with a listbox to show information to the user.
Definition: kmessagebox.cpp:401
KDialogBase::User1
Show User defined button 1.
Definition: kdialogbase.h:206
KIcon::SizeMedium
KDialog::spacingHint
static int spacingHint()
Return the number of pixels you shall use between widgets inside a dialog according to the KDE standa...
Definition: kdialog.cpp:103
KMessageBox::warningContinueCancelWId
static int warningContinueCancelWId(WId parent_id, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonContinue=KStdGuiItem::cont(), const QString &dontAskAgainName=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:597
KDialogBase::Help
Show Help button.
Definition: kdialogbase.h:199
KGuiItem
An abstract class for GUI data such as ToolTip and Icon.
Definition: kguiitem.h:38
KMessageBox::ButtonCode
ButtonCode
Button types.
Definition: kmessagebox.h:50
KMessageBox::warningYesNoCancelList
static int warningYesNoCancelList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
Display a Yes/No/Cancel "warning" dialog with a listbox to show information to the user...
Definition: kmessagebox.cpp:682
KMessageBox::warningContinueCancelList
static int warningContinueCancelList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonContinue=KStdGuiItem::cont(), const QString &dontAskAgainName=QString::null, int options=Notify)
Display a "warning" dialog with a listbox to show information to the user.
Definition: kmessagebox.cpp:609
KMessageBox::warningYesNoCancelListWId
static int warningYesNoCancelListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:695
KMessageBox::queuedMessageBoxWId
static void queuedMessageBoxWId(WId parent_id, DialogType type, const QString &text, const QString &caption, int options)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:1053
KMessageBox::questionYesNoListWId
static int questionYesNoListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:414
KMessageBox::warningYesNoWId
static int warningYesNoWId(WId parent_id, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify|Dangerous)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:517
KMessageBox::error
static void error(QWidget *parent, const QString &text, const QString &caption=QString::null, int options=Notify)
Display an "Error" dialog.
Definition: kmessagebox.cpp:734
KMessageBox::errorWId
static void errorWId(WId parent_id, const QString &text, const QString &caption=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:741
KDialogBase::User2
Show User defined button 2.
Definition: kdialogbase.h:207
KConfigGroupSaver
KMessageBox::warningContinueCancel
static int warningContinueCancel(QWidget *parent, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonContinue=KStdGuiItem::cont(), const QString &dontAskAgainName=QString::null, int options=Notify)
Display a "warning" dialog.
Definition: kmessagebox.cpp:585
KMessageBox::queuedDetailedError
static void queuedDetailedError(QWidget *parent, const QString &text, const QString &details, const QString &caption=QString::null)
Like detailedError.
Definition: kmessagebox.cpp:806
KApplication::icon
QPixmap icon() const
KMessageBox::information
static void information(QWidget *parent, const QString &text, const QString &caption=QString::null, const QString &dontShowAgainName=QString::null, int options=Notify)
Display an "Information" dialog.
Definition: kmessagebox.cpp:883
KDialogBase::actionButton
QPushButton * actionButton(ButtonCode id)
Returns the action button that corresponds to the id.
Definition: kdialogbase.cpp:832
KMessageBox::saveDontShowAgainYesNo
static void saveDontShowAgainYesNo(const QString &dontShowAgainName, ButtonCode result)
Save the fact that the yes/no message box should not be shown again.
Definition: kmessagebox.cpp:371
KConfig::deleteEntry
void deleteEntry(const QString &pKey, bool bNLS=false, bool bGlobal=false)
KMessageBox::warningYesNoList
static int warningYesNoList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify|Dangerous)
Display a "warning" dialog with a listbox to show information to the user.
Definition: kmessagebox.cpp:529
KMessageBox::questionYesNoCancel
static int questionYesNoCancel(QWidget *parent, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
Display a simple "question" dialog.
Definition: kmessagebox.cpp:452
KConfig
KMessageBox::warningYesNoCancel
static int warningYesNoCancel(QWidget *parent, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
Display a Yes/No/Cancel "warning" dialog.
Definition: kmessagebox.cpp:658
KApplication::kApplication
static KApplication * kApplication()
KMessageBox::shouldBeShownYesNo
static bool shouldBeShownYesNo(const QString &dontShowAgainName, ButtonCode &result)
Definition: kmessagebox.cpp:341
KMessageBox::informationWId
static void informationWId(WId parent_id, const QString &text, const QString &caption=QString::null, const QString &dontShowAgainName=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:890
KMessageBox::queuedDetailedErrorWId
static void queuedDetailedErrorWId(WId parent_id, const QString &text, const QString &details, const QString &caption=QString::null)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:814
KConfig::readEntry
QString readEntry(const QString &pKey, const QString &aDefault=QString::null) const
KMessageBox::queuedMessageBox
static void queuedMessageBox(QWidget *parent, DialogType type, const QString &text, const QString &caption, int options)
Like messageBox.
Definition: kmessagebox.cpp:1048
KMessageBox::detailedSorryWId
static void detailedSorryWId(WId parent_id, const QString &text, const QString &details, const QString &caption=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:861
KDialogBase::setMainWidget
void setMainWidget(QWidget *widget)
Sets the main user definable widget.
Definition: kdialogbase.cpp:1431
KDialogBase::enableButtonSeparator
void enableButtonSeparator(bool state)
Hide or display the a separator line drawn between the action buttons an the main widget...
Definition: kdialogbase.cpp:389
KMessageBox::enableMessage
static void enableMessage(const QString &dontShowAgainName)
Re-enable a specific dontShowAgainName messages that had previously been turned off.
Definition: kmessagebox.cpp:956
KConfig::readBoolEntry
bool readBoolEntry(const QString &pKey, bool bDefault=false) const
KMessageBox::createKMessageBox
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)
Create content and layout of a standard dialog.
Definition: kmessagebox.cpp:140
KIconLoader::loadIcon
QPixmap loadIcon(const QString &name, KIcon::Group group, int size=0, int state=KIcon::DefaultState, QString *path_store=0L, bool canReturnNull=false) const
KDialogBase::setDetailsWidget
void setDetailsWidget(QWidget *detailsWidget)
Sets the widget that gets shown when "Details" is enabled.
Definition: kdialogbase.cpp:1112
KMessageBox::detailedSorry
static void detailedSorry(QWidget *parent, const QString &text, const QString &details, const QString &caption=QString::null, int options=Notify)
Displays a "Sorry" dialog with a "Details >>" button.
Definition: kmessagebox.cpp:853
KMessageBox::warningYesNo
static int warningYesNo(QWidget *parent, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify|Dangerous)
Display a "warning" dialog.
Definition: kmessagebox.cpp:505
KMessageBox::warningContinueCancelListWId
static int warningContinueCancelListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonContinue=KStdGuiItem::cont(), const QString &dontAskAgainName=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:621
KDialogBase::No
Show No button.
Definition: kdialogbase.h:209
KDialogBase::Default
Show Default button.
Definition: kdialogbase.h:200
KDialogBase::Try
Show Try button.
Definition: kdialogbase.h:203
KDialog::setPlainCaption
virtual void setPlainCaption(const QString &caption)
Make a plain caption without any modifications.
Definition: kdialog.cpp:122
KMessageBox::detailedError
static void detailedError(QWidget *parent, const QString &text, const QString &details, const QString &caption=QString::null, int options=Notify)
Displays an "Error" dialog with a "Details >>" button.
Definition: kmessagebox.cpp:776
KMessageBox::AllowLink
The message may contain links.
Definition: kmessagebox.h:75
KMessageBox::PlainCaption
Do not use KApplication::makeStdCaption()
Definition: kmessagebox.h:77
KConfig::writeEntry
void writeEntry(const QString &pKey, const QString &pValue, bool bPersistent=true, bool bGlobal=false, bool bNLS=false)
KMessageBox::enableAllMessages
static void enableAllMessages()
Enable all messages which have been turned off with the dontShowAgainName feature.
Definition: kmessagebox.cpp:936
KMessageBox::sorryWId
static void sorryWId(WId parent_id, const QString &text, const QString &caption=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:832
KListBox
A variant of QListBox that honors KDE's system-wide settings.
Definition: klistbox.h:40
KNotifyClient::event
int event(const QString &message, const QString &text=QString::null) KDE_DEPRECATED
KIcon::DefaultState
KDialogBase::Yes
Show Yes button.
Definition: kdialogbase.h:210
KGlobal::config
static KConfig * config()
KMessageBox::Dangerous
The action to be confirmed by the dialog is a potentially destructive one.
Definition: kmessagebox.h:76
KDialogBase::User3
Show User defined button 3.
Definition: kdialogbase.h:208
KMessageBox::warningYesNoCancelWId
static int warningYesNoCancelWId(WId parent_id, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:670
KMessageBox::about
static void about(QWidget *parent, const QString &text, const QString &caption=QString::null, int options=Notify)
Display an "About" dialog.
Definition: kmessagebox.cpp:970
KMessageBox::saveDontShowAgainContinue
static void saveDontShowAgainContinue(const QString &dontShowAgainName)
Save the fact that the continue/cancel message box should not be shown again.
Definition: kmessagebox.cpp:383

KDE Home | KDE Accessibility Home | Description of Access Keys