Changeset View
Changeset View
Standalone View
Standalone View
src/kstyle/kstyle.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | |||||
52 | #include <QIcon> | 52 | #include <QIcon> | ||
53 | #include <QStyleOption> | 53 | #include <QStyleOption> | ||
54 | #include <QPushButton> | 54 | #include <QPushButton> | ||
55 | #include <QToolBar> | 55 | #include <QToolBar> | ||
56 | #include <QShortcut> | 56 | #include <QShortcut> | ||
57 | 57 | | |||
58 | #include <kconfiggroup.h> | 58 | #include <kconfiggroup.h> | ||
59 | #include <kiconloader.h> | 59 | #include <kiconloader.h> | ||
60 | #include <KMessageWidget> | ||||
60 | #include <kcolorscheme.h> | 61 | #include <kcolorscheme.h> | ||
61 | 62 | | |||
62 | // ---------------------------------------------------------------------------- | 63 | // ---------------------------------------------------------------------------- | ||
63 | 64 | | |||
64 | static const QStyle::StyleHint SH_KCustomStyleElement = (QStyle::StyleHint)0xff000001; | 65 | static const QStyle::StyleHint SH_KCustomStyleElement = (QStyle::StyleHint)0xff000001; | ||
65 | static const int X_KdeBase = 0xff000000; | 66 | static const int X_KdeBase = 0xff000000; | ||
66 | 67 | | |||
67 | class KStylePrivate | 68 | class KStylePrivate | ||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Line(s) | 198 | { | |||
203 | if (QDialogButtonBox *box = qobject_cast<QDialogButtonBox *>(w)) { | 204 | if (QDialogButtonBox *box = qobject_cast<QDialogButtonBox *>(w)) { | ||
204 | QPushButton *button = box->button(QDialogButtonBox::Ok); | 205 | QPushButton *button = box->button(QDialogButtonBox::Ok); | ||
205 | 206 | | |||
206 | if (button) { | 207 | if (button) { | ||
207 | auto shortcut = new QShortcut(Qt::CTRL | Qt::Key_Return, button); | 208 | auto shortcut = new QShortcut(Qt::CTRL | Qt::Key_Return, button); | ||
208 | QObject::connect(shortcut, &QShortcut::activated, button, &QPushButton::click); | 209 | QObject::connect(shortcut, &QShortcut::activated, button, &QPushButton::click); | ||
209 | } | 210 | } | ||
210 | } | 211 | } | ||
212 | if (auto messageWidget = qobject_cast<KMessageWidget*>(w)) { | ||||
213 | KColorScheme scheme; | ||||
214 | QColor color; | ||||
215 | QPalette palette = messageWidget->palette(); | ||||
216 | switch (messageWidget->messageType()) { | ||||
217 | case KMessageWidget::Positive: | ||||
218 | color = scheme.foreground(KColorScheme::PositiveText).color(); | ||||
219 | break; | ||||
220 | case KMessageWidget::Information: | ||||
221 | color = scheme.foreground(KColorScheme::ActiveText).color(); | ||||
222 | break; | ||||
223 | case KMessageWidget::Warning: | ||||
224 | color = scheme.foreground(KColorScheme::NeutralText).color(); | ||||
225 | break; | ||||
226 | case KMessageWidget::Error: | ||||
227 | color = scheme.foreground(KColorScheme::NegativeText).color(); | ||||
228 | break; | ||||
229 | } | ||||
230 | palette.setColor(QPalette::Window, color); | ||||
231 | messageWidget->setPalette(palette); | ||||
232 | } | ||||
211 | QCommonStyle::polish(w); | 233 | QCommonStyle::polish(w); | ||
212 | } | 234 | } | ||
213 | 235 | | |||
214 | QPalette KStyle::standardPalette() const | 236 | QPalette KStyle::standardPalette() const | ||
215 | { | 237 | { | ||
216 | return KColorScheme::createApplicationPalette(KSharedConfig::openConfig()); | 238 | return KColorScheme::createApplicationPalette(KSharedConfig::openConfig()); | ||
217 | } | 239 | } | ||
218 | 240 | | |||
▲ Show 20 Lines • Show All 238 Lines • Show Last 20 Lines |