KDEUI
kmessagebox.cpp
Go to the documentation of this file.
102 QIcon ret = KIconLoader::global()->loadIcon(icon_name, KIconLoader::NoGroup, KIconLoader::SizeHuge, KIconLoader::DefaultState, QStringList(), 0, true);
183 iconLabel->setPixmap(icon.pixmap(mainWidget->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, &option, mainWidget)));
253 const int borderWidth = listWidget->width() - listWidget->viewport()->width() + listWidget->verticalScrollBar()->height();
303 else if (!details.isEmpty() && dialog->minimumHeight()<iconLabel->sizeHint().height()*2)//strange bug...
306 dialog->setMinimumSize(300,qMax(150,qMax(iconLabel->sizeHint().height(),messageLabel->sizeHint().height())));
381 KConfigGroup cg( KMessageBox_againConfig ? KMessageBox_againConfig : KGlobal::config().data(), "Notification Messages" );
399 KConfigGroup cg( KMessageBox_againConfig ? KMessageBox_againConfig : KGlobal::config().data(), "Notification Messages" );
413 KConfigGroup cg( KMessageBox_againConfig? KMessageBox_againConfig : KGlobal::config().data(), "Notification Messages" );
427 KConfigGroup cg( KMessageBox_againConfig? KMessageBox_againConfig: KGlobal::config().data(), "Notification Messages" );
504 return questionYesNoCancelWId( parent ? parent->effectiveWinId() : 0, text, caption, buttonYes, buttonNo, buttonCancel,
821 return errorListWId( parent ? parent->effectiveWinId() : 0, text, QStringList(), caption, options );
862 return detailedErrorWId( parent ? parent->effectiveWinId() : 0, text, details, caption, options );
884 createKMessageBox(dialog, QMessageBox::Critical, text, QStringList(), QString(), 0, options, details);
935 return detailedSorryWId( parent ? parent->effectiveWinId() : 0, text, details, caption, options );
957 createKMessageBox(dialog, QMessageBox::Warning, text, QStringList(), QString(), 0, options, details);
972 void KMessageBox::informationList(QWidget *parent,const QString &text, const QStringList & strlist,
979 void KMessageBox::informationListWId(WId parent_id,const QString &text, const QStringList & strlist,
1014 KConfig *config = KMessageBox_againConfig ? KMessageBox_againConfig : KGlobal::config().data();
1033 KConfig *config = KMessageBox_againConfig ? KMessageBox_againConfig : KGlobal::config().data();
1114 void KMessageBox::queuedMessageBox( QWidget *parent, DialogType type, const QString &text, const QString &caption, Options options )
1116 return queuedMessageBoxWId( parent ? parent->effectiveWinId() : 0, type, text, caption, options );
1119 void KMessageBox::queuedMessageBoxWId( WId parent_id, DialogType type, const QString &text, const QString &caption, Options options )
1127 void KMessageBox::queuedMessageBox( QWidget *parent, DialogType type, const QString &text, const QString &caption )
1132 void KMessageBox::queuedMessageBoxWId( WId parent_id, DialogType type, const QString &text, const QString &caption )
ButtonCode defaultButton() const
Returns the button code of the default button, or NoDefault if there is no default button...
Definition: kdialog.cpp:324
QString caption()
QString i18n(const char *text)
Definition: knotification.h:247
void setButtonGuiItem(ButtonCode id, const KGuiItem &item)
Sets the KGuiItem directly for the button instead of using 3 methods to set the text, tooltip and whatsthis strings.
Definition: kdialog.cpp:699
Definition: kmessagebox.h:73
static int warningContinueCancelListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:680
void sync()
void setWidget(QWidget *widget)
palette
Definition: kmessagebox.h:74
int width() const
void setModal(bool modal)
bool isButtonEnabled(ButtonCode id) const
Returns whether any button is enabled.
Definition: kdialog.cpp:668
static void queuedMessageBoxWId(WId parent_id, DialogType type, const QString &text, const QString &caption, Options options)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:1119
void setSelectionMode(QAbstractItemView::SelectionMode mode)
QPixmap standardIcon(Icon icon, Qt::GUIStyle style)
void setColor(ColorGroup group, ColorRole role, const QColor &color)
static KIconLoader * global()
Returns the global icon loader initialized with the global KComponentData.
static void about(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
Display an "About" dialog.
Definition: kmessagebox.cpp:1044
The window is to be modal relative to its parent. By default, it is application modal.
Definition: kmessagebox.h:97
void setWindowModality(Qt::WindowModality windowModality)
static int warningYesNoWId(WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:575
static int warningYesNoCancelWId(WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:738
void setFrameShape(Shape)
static int warningYesNo(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
Display a "warning" dialog.
Definition: kmessagebox.cpp:564
Definition: kmessagebox.h:86
static int warningYesNoCancelListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:763
void setOpenExternalLinks(bool open)
QStyle * style() const
Show Cancel-button. (this button reject()s the dialog; result set to QDialog::Rejected) ...
Definition: kdialog.h:144
static void information(QWidget *parent, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
Display an "Information" dialog.
Definition: kmessagebox.cpp:960
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const =0
void setPixmap(const QPixmap &)
void setMinimumWidth(int minw)
static void detailedError(QWidget *parent, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify)
Displays an "Error" dialog with a "Details >>" button.
Definition: kmessagebox.cpp:858
Show Yes button. (this button closes the dialog and sets the result to KDialog::Yes) ...
Definition: kdialog.h:147
bool hasGroup(const QString &group) const
static void setDontShowAskAgainConfig(KConfig *cfg)
Use cfg for all settings related to the dontShowAgainName feature.
Definition: kmessagebox.cpp:432
QWidget * viewport() const
#define I18N_FILTER_BUTTON_CONTINUE(src, dst)
Definition: kmessagebox.cpp:62
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
int height() const
static QRect desktopGeometry(const QPoint &point)
This function returns the desktop geometry for an application that needs to set the geometry of a wid...
Definition: kglobalsettings.cpp:732
static int questionYesNoWId(WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:364
static void sorryWId(WId parent_id, const QString &text, const QString &caption=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:910
static void detailedSorryWId(WId parent_id, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:938
void addSpacing(int size)
static void informationListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:979
void setButtonFocus(ButtonCode id)
Sets the focus to the button of the passed id.
Definition: kdialog.cpp:798
static int createKMessageBox(KDialog *dialog, QMessageBox::Icon icon, const QString &text, const QStringList &strlist, const QString &ask, bool *checkboxReturn, Options options, const QString &details=QString())
Create content and layout of a standard dialog.
Definition: kmessagebox.cpp:153
static bool shouldBeShownContinue(const QString &dontShowAgainName)
Definition: kmessagebox.cpp:394
Definition: kmessagebox.h:85
virtual void setCaption(const QString &caption)
Make a KDE compliant caption.
Definition: kdialog.cpp:469
static int messageBox(QWidget *parent, DialogType type, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontShowAskAgainName=QString(), Options options=Notify)
Alternate method to show a messagebox:
Definition: kmessagebox.cpp:1068
QPixmap pixmap(const QSize &size, Mode mode, State state) const
static void queuedMessageBox(QWidget *parent, DialogType type, const QString &text, const QString &caption, Options options)
Like messageBox.
Definition: kmessagebox.cpp:1114
void setWindowIcon(const QIcon &icon)
KSharedConfigPtr config()
Definition: kmessagebox.h:71
void initFrom(const QWidget *widget)
width
void deleteEntry(const QString &pKey, WriteConfigFlags pFlags=Normal)
static int warningYesNoCancel(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
Display a Yes/No/Cancel "warning" dialog.
Definition: kmessagebox.cpp:726
void setMinimumSize(const QSize &)
static int questionYesNoCancelWId(WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:508
QPixmap loadIcon(const QString &name, KIconLoader::Group group, int size=0, int state=KIconLoader::DefaultState, const QStringList &overlays=QStringList(), QString *path_store=0L, bool canReturnNull=false) const
Loads an icon.
Definition: kiconloader.cpp:1100
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
virtual void setReadOnly(bool readOnly)
Reimplemented to set a proper "deactivated" background color.
Definition: ktextedit.cpp:807
QWidget * topLevelWidget() const
static void applyOptions(KDialog *dialog, KMessageBox::Options options)
Definition: kmessagebox.cpp:145
static int messageBoxWId(WId parent_id, DialogType type, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontShowAskAgainName=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:1077
static int warningYesNoList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
Display a "warning" dialog with a listbox to show information to the user.
Definition: kmessagebox.cpp:586
static int spacingHint()
Returns the number of pixels that should be used between widgets inside a dialog according to the KDE...
Definition: kdialog.cpp:432
void setEscapeButton(ButtonCode id)
Sets the button that will be activated when the Escape key is pressed.
Definition: kdialog.cpp:282
static void informationList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
Display an "Information" dialog with a listbox.
Definition: kmessagebox.cpp:972
bool isEmpty() const
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
Display an "Sorry" dialog.
Definition: kmessagebox.cpp:904
void setObjectName(const QString &name)
bool isEmpty() const
static void sendNotification(QString message, const QStringList &strlist, QMessageBox::Icon icon, WId parent_id)
Definition: kmessagebox.cpp:111
Definition: kmessagebox.h:87
static void queuedDetailedError(QWidget *parent, const QString &text, const QString &details, const QString &caption=QString())
Like detailedError.
Definition: kmessagebox.cpp:887
WId winId() const
void setButtons(ButtonCodes buttonMask)
Creates (or recreates) the button box and all the buttons in it.
Definition: kdialog.cpp:206
QScrollBar * verticalScrollBar() const
Definition: kmessagebox.h:83
void setMargin(int margin)
void setSizePolicy(QSizePolicy)
static void informationWId(WId parent_id, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:966
Definition: kmessagebox.h:70
A replacement for QLabel that squeezes its text.
Definition: ksqueezedtextlabel.h:47
static int questionYesNo(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify)
Display a simple "question" dialog.
Definition: kmessagebox.cpp:353
Show Ok button. (this button accept()s the dialog; result set to QDialog::Accepted) ...
Definition: kdialog.h:141
iterator end()
Definition: kmessagebox.h:82
static int warningYesNoCancelList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
Display a Yes/No/Cancel "warning" dialog with a listbox to show information to the user...
Definition: kmessagebox.cpp:750
static void queuedDetailedErrorWId(WId parent_id, const QString &text, const QString &details, const QString &caption=QString())
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:894
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:403
void setFixedSize(const QSize &s)
static int questionYesNoListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:449
void setDefaultButton(ButtonCode id)
Sets the button that will be activated when the Enter key is pressed.
Definition: kdialog.cpp:287
void setWidgetResizable(bool resizable)
int width(const QString &text, int len) const
static int warningYesNoListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:598
void setDetailsWidget(QWidget *detailsWidget)
Sets the widget that gets shown when "Details" is enabled.
Definition: kdialog.cpp:806
static void setMainWindow(QWidget *subwindow, WId mainwindow)
Sets the parent window of subwindow to be mainwindow.
Definition: kwindowsystem_mac.cpp:412
void setTextInteractionFlags(QFlags< Qt::TextInteractionFlag > flags)
static KNotification * event(const QString &eventId, const QString &title, const QString &text, const QPixmap &pixmap=QPixmap(), QWidget *widget=0L, const NotificationFlags &flags=CloseOnTimeout, const KComponentData &componentData=KComponentData())
emit an event
Definition: knotification.cpp:291
static bool shouldBeShownYesNo(const QString &dontShowAgainName, ButtonCode &result)
Definition: kmessagebox.cpp:375
Show No button. (this button closes the dialog and sets the result to KDialog::No) ...
Definition: kdialog.h:146
static int questionYesNoList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify)
Display a "question" dialog with a listbox to show information to the user.
Definition: kmessagebox.cpp:437
int width() const
QFontMetrics fontMetrics() const
void addItems(const QStringList &labels)
void addStretch(int stretch)
static int warningContinueCancelWId(WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:656
QWidget * find(WId id)
bool isNull() const
Used when specifying a default button; indicates that no button should be marked by default...
Definition: kdialog.h:153
static void errorList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), Options options=Notify)
Display an "Error" dialog with a listbox.
Definition: kmessagebox.cpp:830
typedef ConstIterator
virtual QSize sizeHint() const
int height() const
static void detailedSorry(QWidget *parent, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify)
Displays a "Sorry" dialog with a "Details >>" button.
Definition: kmessagebox.cpp:931
static void enableMessage(const QString &dontShowAgainName)
Re-enable a specific dontShowAgainName messages that had previously been turned off.
Definition: kmessagebox.cpp:1031
int length() const
void setMinimumHeight(int minh)
static QIcon themedMessageBoxIcon(QMessageBox::Icon icon)
Definition: kmessagebox.cpp:81
static int warningContinueCancelList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
Display a "warning" dialog with a listbox to show information to the user.
Definition: kmessagebox.cpp:668
Definition: kmessagebox.h:79
Definition: kmessagebox.h:72
void sync()
virtual void setPlainCaption(const QString &caption)
Make a plain caption without any modifications.
Definition: kdialog.cpp:488
static void errorListWId(WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:836
WId effectiveWinId() const
The action to be confirmed by the dialog is a potentially destructive one. The default button will be...
Definition: kmessagebox.h:94
Show Details button. (this button will show the detail widget set with setDetailsWidget) ...
Definition: kdialog.h:149
The notification will be automatically closed after a timeout.
Definition: knotification.h:219
static void detailedErrorWId(WId parent_id, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:865
static void enableAllMessages()
Enable all messages which have been turned off with the dontShowAgainName feature.
Definition: kmessagebox.cpp:1012
T readEntry(const QString &key, const T &aDefault) const
static int questionYesNoCancel(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
Display a simple "question" dialog.
Definition: kmessagebox.cpp:495
static int warningContinueCancel(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
Display a "warning" dialog.
Definition: kmessagebox.cpp:644
iterator begin()
static void errorWId(WId parent_id, const QString &text, const QString &caption=QString(), Options options=Notify)
This function accepts the window id of the parent window, instead of QWidget*.
Definition: kmessagebox.cpp:824
void setWordWrap(bool on)
bool setStretchFactor(QWidget *widget, int stretch)
int lineSpacing() const
void setSpacing(int spacing)
height
static void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
Display an "Error" dialog.
Definition: kmessagebox.cpp:818
QMap< QString, QString > entryMap() const
typedef TextInteractionFlags
Definition: kmessagebox.h:80
static void saveDontShowAgainContinue(const QString &dontShowAgainName)
Save the fact that the continue/cancel message box should not be shown again.
Definition: kmessagebox.cpp:418
void addLayout(QLayout *layout, int stretch)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.