Changeset View
Changeset View
Standalone View
Standalone View
src/texteditor/commonwidget/textmessageindicator.cpp
Show All 13 Lines | 1 | /* | |||
---|---|---|---|---|---|
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to | ||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | Boston, MA 02110-1301, USA. | 17 | Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "textmessageindicator.h" | 20 | #include "textmessageindicator.h" | ||
21 | 21 | | |||
22 | #include <KIconLoader> | | |||
23 | | ||||
24 | #include <QAbstractScrollArea> | 22 | #include <QAbstractScrollArea> | ||
25 | #include <QPainter> | 23 | #include <QPainter> | ||
26 | #include <QTimer> | 24 | #include <QTimer> | ||
27 | #include <QResizeEvent> | 25 | #include <QResizeEvent> | ||
28 | #include <QApplication> | 26 | #include <QApplication> | ||
27 | #include <QStyle> | ||||
29 | 28 | | |||
30 | using namespace KPIMTextEdit; | 29 | using namespace KPIMTextEdit; | ||
31 | TextMessageIndicator::TextMessageIndicator(QWidget *parent) | 30 | TextMessageIndicator::TextMessageIndicator(QWidget *parent) | ||
32 | : QWidget(parent) | 31 | : QWidget(parent) | ||
33 | { | 32 | { | ||
34 | setObjectName(QStringLiteral("TextMessageIndicator")); | 33 | setObjectName(QStringLiteral("TextMessageIndicator")); | ||
35 | setFocusPolicy(Qt::NoFocus); | 34 | setFocusPolicy(Qt::NoFocus); | ||
36 | QPalette pal = palette(); | 35 | QPalette pal = palette(); | ||
Show All 14 Lines | 47 | { | |||
51 | } | 50 | } | ||
52 | // set text | 51 | // set text | ||
53 | mMessage = message; | 52 | mMessage = message; | ||
54 | mDetails = details; | 53 | mDetails = details; | ||
55 | // reset vars | 54 | // reset vars | ||
56 | mLineSpacing = 0; | 55 | mLineSpacing = 0; | ||
57 | // load icon (if set) | 56 | // load icon (if set) | ||
58 | mSymbol = QPixmap(); | 57 | mSymbol = QPixmap(); | ||
58 | const auto iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize); | ||||
59 | if (icon != None) { | 59 | if (icon != None) { | ||
60 | switch (icon) { | 60 | switch (icon) { | ||
61 | case Error: | 61 | case Error: | ||
62 | mSymbol = SmallIcon(QStringLiteral("dialog-error")); | 62 | mSymbol = QIcon::fromTheme(QStringLiteral("dialog-error")).pixmap(iconSize); | ||
63 | break; | 63 | break; | ||
64 | case Warning: | 64 | case Warning: | ||
65 | mSymbol = SmallIcon(QStringLiteral("dialog-warning")); | 65 | mSymbol = QIcon::fromTheme(QStringLiteral("dialog-warning")).pixmap(iconSize); | ||
66 | break; | 66 | break; | ||
67 | default: | 67 | default: | ||
68 | mSymbol = SmallIcon(QStringLiteral("dialog-information")); | 68 | mSymbol = QIcon::fromTheme(QStringLiteral("dialog-information")).pixmap(iconSize); | ||
69 | break; | 69 | break; | ||
70 | } | 70 | } | ||
71 | } | 71 | } | ||
72 | 72 | | |||
73 | computeSizeAndResize(); | 73 | computeSizeAndResize(); | ||
74 | // show widget and schedule a repaint | 74 | // show widget and schedule a repaint | ||
75 | show(); | 75 | show(); | ||
76 | update(); | 76 | update(); | ||
▲ Show 20 Lines • Show All 143 Lines • Show Last 20 Lines |