Skip to content

Commit

Permalink
Merge pull request #347 from keepassxreboot/feature/optimize-message-…
Browse files Browse the repository at this point in the history
…widget

Feature/optimize message widget
  • Loading branch information
phoerious authored Feb 25, 2017
2 parents 1f6f7b6 + 9ba8883 commit 0f1c518
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions share/icons/svg/message-close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions src/gui/KMessageWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*/
#include "KMessageWidget.h"

#include "core/FilePath.h"

#include <QAction>
#include <QEvent>
#include <QGridLayout>
Expand Down Expand Up @@ -89,13 +91,19 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr)
QAction *closeAction = new QAction(q);
closeAction->setText(KMessageWidget::tr("&Close"));
closeAction->setToolTip(KMessageWidget::tr("Close message"));
closeAction->setIcon(q->style()->standardIcon(QStyle::SP_DialogCloseButton));
closeAction->setIcon(FilePath::instance()->icon("actions", "message-close", false));

QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(animatedHide()));

closeButton = new QToolButton(content);
closeButton->setAutoRaise(true);
closeButton->setDefaultAction(closeAction);
#ifdef Q_OS_MAC
closeButton->setStyleSheet("QToolButton { background: transparent;"
"border-radius: 2px; padding: 3px; }"
"QToolButton::hover, QToolButton::focus {"
"border: 1px solid rgb(90, 200, 250); }");
#endif

q->setMessageType(KMessageWidget::Information);
}
Expand Down Expand Up @@ -285,7 +293,7 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
}

// Colors
fg = palette().highlightedText().color();
fg = palette().light().color();
bg0 = bg1.lighter(110);
bg2 = bg1.darker(110);
border = darkShade(bg1);
Expand All @@ -299,6 +307,7 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
"border-radius: 5px;"
"border: 1px solid %4;"
"margin: %5px;"
"padding: 5px;"
"}"
".QLabel { color: %6; }"
))
Expand Down

0 comments on commit 0f1c518

Please sign in to comment.