diff --git a/support/messagewidget.cpp b/support/messagewidget.cpp index 841c05ac7..d9a632f0a 100644 --- a/support/messagewidget.cpp +++ b/support/messagewidget.cpp @@ -40,7 +40,7 @@ MessageWidget::~MessageWidget() #endif #endif -void MessageWidget::setMessage(const QString &msg, bool isError) +void MessageWidget::setMessage(const QString &msg, MessageType type, bool showCloseButton) { if (msg.isEmpty() && isVisible()) { setVisible(false); @@ -56,7 +56,8 @@ void MessageWidget::setMessage(const QString &msg, bool isError) setToolTip(msg); } setText(text); - setMessageType(isError ? Error : Information); + setMessageType(type); + setCloseButtonVisible(showCloseButton); #if defined NO_ANIMATED_SHOW setVisible(true); #else diff --git a/support/messagewidget.h b/support/messagewidget.h index f270f7ef5..5edaef4fe 100644 --- a/support/messagewidget.h +++ b/support/messagewidget.h @@ -40,10 +40,12 @@ class MessageWidget : public KMsgWidget { Q_OBJECT public: + MessageWidget(QWidget *parent); virtual ~MessageWidget(); - void setError(const QString &msg) { setMessage(msg, true); } - void setInformation(const QString &msg) { setMessage(msg, false); } + void setError(const QString &msg, bool showCloseButton=true) { setMessage(msg, Error, showCloseButton); } + void setInformation(const QString &msg, bool showCloseButton=true) { setMessage(msg, Information, showCloseButton); } + void setWarning(const QString &msg, bool showCloseButton=true) { setMessage(msg, Warning, showCloseButton); } void setVisible(bool v); bool isActive() const { return active; } @@ -51,7 +53,7 @@ Q_SIGNALS: void visible(bool); private: - void setMessage(const QString &msg, bool isError); + void setMessage(const QString &msg, MessageType type, bool showCloseButton); private: bool active;