Add support for warning messages.
This commit is contained in:
committed by
craig.p.drummond
parent
f5c6887ca9
commit
aeeccd3d4e
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user