Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/tests/statusnotifier/statusnotifiertest.cpp
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 56 | { | |||
---|---|---|---|---|---|
58 | d->job = nullptr; | 58 | d->job = nullptr; | ||
59 | 59 | | |||
60 | init(); | 60 | init(); | ||
61 | 61 | | |||
62 | setupUi(this); | 62 | setupUi(this); | ||
63 | connect(updateButton, &QPushButton::clicked, this, &StatusNotifierTest::updateNotifier); | 63 | connect(updateButton, &QPushButton::clicked, this, &StatusNotifierTest::updateNotifier); | ||
64 | connect(jobEnabledCheck, &QCheckBox::toggled, this, &StatusNotifierTest::enableJob); | 64 | connect(jobEnabledCheck, &QCheckBox::toggled, this, &StatusNotifierTest::enableJob); | ||
65 | updateUi(); | 65 | updateUi(); | ||
66 | iconName->setText(QStringLiteral("plasma")); | ||||
66 | show(); | 67 | show(); | ||
67 | raise(); | 68 | raise(); | ||
68 | log(QStringLiteral("started")); | 69 | log(QStringLiteral("started")); | ||
69 | } | 70 | } | ||
70 | 71 | | |||
71 | void StatusNotifierTest::init() | 72 | void StatusNotifierTest::init() | ||
72 | { | 73 | { | ||
73 | d->systemNotifier = new KStatusNotifierItem(this); | 74 | d->systemNotifier = new KStatusNotifierItem(this); | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 118 | { | |||
121 | statusActive->setChecked(d->systemNotifier->status() == KStatusNotifierItem::Active); | 122 | statusActive->setChecked(d->systemNotifier->status() == KStatusNotifierItem::Active); | ||
122 | statusPassive->setChecked(d->systemNotifier->status() == KStatusNotifierItem::Passive); | 123 | statusPassive->setChecked(d->systemNotifier->status() == KStatusNotifierItem::Passive); | ||
123 | statusNeedsAttention->setChecked(d->systemNotifier->status() == KStatusNotifierItem::NeedsAttention); | 124 | statusNeedsAttention->setChecked(d->systemNotifier->status() == KStatusNotifierItem::NeedsAttention); | ||
124 | 125 | | |||
125 | statusActive->setEnabled(!statusAuto->isChecked()); | 126 | statusActive->setEnabled(!statusAuto->isChecked()); | ||
126 | statusPassive->setEnabled(!statusAuto->isChecked()); | 127 | statusPassive->setEnabled(!statusAuto->isChecked()); | ||
127 | statusNeedsAttention->setEnabled(!statusAuto->isChecked()); | 128 | statusNeedsAttention->setEnabled(!statusAuto->isChecked()); | ||
128 | 129 | | |||
129 | iconName->setText(d->systemNotifier->iconName()); | | |||
130 | tooltipText->setText(d->systemNotifier->toolTipTitle()); | 130 | tooltipText->setText(d->systemNotifier->toolTipTitle()); | ||
131 | tooltipSubtext->setText(d->systemNotifier->toolTipSubTitle()); | 131 | tooltipSubtext->setText(d->systemNotifier->toolTipSubTitle()); | ||
132 | 132 | | |||
133 | } | 133 | } | ||
134 | 134 | | |||
135 | void StatusNotifierTest::updateNotifier() | 135 | void StatusNotifierTest::updateNotifier() | ||
136 | { | 136 | { | ||
137 | //log("update"); | 137 | //log("update"); | ||
Show All 20 Lines | |||||
158 | KStatusNotifierItem::ItemStatus s = KStatusNotifierItem::Passive; | 158 | KStatusNotifierItem::ItemStatus s = KStatusNotifierItem::Passive; | ||
159 | if (statusActive->isChecked()) { | 159 | if (statusActive->isChecked()) { | ||
160 | s = KStatusNotifierItem::Active; | 160 | s = KStatusNotifierItem::Active; | ||
161 | } else if (statusNeedsAttention->isChecked()) { | 161 | } else if (statusNeedsAttention->isChecked()) { | ||
162 | s = KStatusNotifierItem::NeedsAttention; | 162 | s = KStatusNotifierItem::NeedsAttention; | ||
163 | } | 163 | } | ||
164 | d->systemNotifier->setStatus(s); | 164 | d->systemNotifier->setStatus(s); | ||
165 | 165 | | |||
166 | d->systemNotifier->setIconByName(iconName->text()); | 166 | iconPixmapCheckbox->isChecked() ? d->systemNotifier->setIconByPixmap(QIcon::fromTheme(iconName->text())) | ||
167 | : d->systemNotifier->setIconByName(iconName->text()); | ||||
168 | overlayIconPixmapCheckbox->isChecked() ? d->systemNotifier->setOverlayIconByPixmap(QIcon::fromTheme(overlayIconName->text())) | ||||
169 | : d->systemNotifier->setOverlayIconByName(overlayIconName->text()); | ||||
170 | attentionIconPixmapCheckbox->isChecked() ? d->systemNotifier->setAttentionIconByPixmap(QIcon::fromTheme(attentionIconName->text())) | ||||
171 | : d->systemNotifier->setAttentionIconByName(attentionIconName->text()); | ||||
167 | 172 | | |||
168 | d->systemNotifier->setToolTip(iconName->text(), tooltipText->text(), tooltipSubtext->text()); | 173 | d->systemNotifier->setToolTip(iconName->text(), tooltipText->text(), tooltipSubtext->text()); | ||
169 | 174 | | |||
170 | updateUi(); | 175 | updateUi(); | ||
171 | } | 176 | } | ||
172 | 177 | | |||
173 | 178 | | |||
174 | 179 | | |||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |