Changeset View
Changeset View
Standalone View
Standalone View
plasma-windowed/plasmawindowedview.cpp
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | 62 | { | |||
---|---|---|---|---|---|
105 | minimumWidthChanged(); | 105 | minimumWidthChanged(); | ||
106 | minimumHeightChanged(); | 106 | minimumHeightChanged(); | ||
107 | QObject::connect(applet->containment(), &Plasma::Containment::configureRequested, | 107 | QObject::connect(applet->containment(), &Plasma::Containment::configureRequested, | ||
108 | this, &PlasmaWindowedView::showConfigurationInterface); | 108 | this, &PlasmaWindowedView::showConfigurationInterface); | ||
109 | 109 | | |||
110 | Q_ASSERT(!m_statusNotifier); | 110 | Q_ASSERT(!m_statusNotifier); | ||
111 | if (m_withStatusNotifier) { | 111 | if (m_withStatusNotifier) { | ||
112 | m_statusNotifier = new KStatusNotifierItem(this); | 112 | m_statusNotifier = new KStatusNotifierItem(this); | ||
113 | m_statusNotifier->setIconByName(applet->icon()); | 113 | | ||
114 | m_statusNotifier->setTitle(applet->title()); | 114 | updateSniIcon(); | ||
115 | m_statusNotifier->setToolTipTitle(applet->title()); | 115 | connect(applet, &Plasma::Applet::iconChanged, this, &PlasmaWindowedView::updateSniIcon); | ||
116 | | ||||
117 | updateSniTitle(); | ||||
118 | connect(applet, &Plasma::Applet::titleChanged, this, &PlasmaWindowedView::updateSniTitle); | ||||
119 | | ||||
120 | updateSniStatus(); | ||||
121 | connect(applet, &Plasma::Applet::statusChanged, this, &PlasmaWindowedView::updateSniStatus); | ||||
116 | 122 | | |||
117 | connect(m_statusNotifier, &KStatusNotifierItem::activateRequested, this, [this](bool active, const QPoint& /*pos*/){ | 123 | connect(m_statusNotifier, &KStatusNotifierItem::activateRequested, this, [this](bool active, const QPoint& /*pos*/){ | ||
118 | setVisible(active); | 124 | setVisible(active); | ||
119 | if (active) { | 125 | if (active) { | ||
120 | raise(); | 126 | raise(); | ||
121 | } | 127 | } | ||
122 | }); | 128 | }); | ||
123 | } | 129 | } | ||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Line(s) | |||||
249 | { | 255 | { | ||
250 | if (!m_layout) { | 256 | if (!m_layout) { | ||
251 | return; | 257 | return; | ||
252 | } | 258 | } | ||
253 | 259 | | |||
254 | setMaximumHeight(m_layout->property("maximumHeight").toInt()); | 260 | setMaximumHeight(m_layout->property("maximumHeight").toInt()); | ||
255 | } | 261 | } | ||
256 | 262 | | |||
263 | void PlasmaWindowedView::updateSniIcon() | ||||
264 | { | ||||
265 | m_statusNotifier->setIconByName(m_applet->icon()); | ||||
266 | } | ||||
267 | | ||||
268 | void PlasmaWindowedView::updateSniTitle() | ||||
269 | { | ||||
270 | m_statusNotifier->setTitle(m_applet->title()); | ||||
271 | m_statusNotifier->setToolTipTitle(m_applet->title()); | ||||
272 | } | ||||
273 | | ||||
274 | void PlasmaWindowedView::updateSniStatus() | ||||
275 | { | ||||
276 | switch (m_applet->status()) { | ||||
277 | case Plasma::Types::UnknownStatus: | ||||
278 | case Plasma::Types::PassiveStatus: | ||||
279 | case Plasma::Types::HiddenStatus: | ||||
280 | m_statusNotifier->setStatus(KStatusNotifierItem::Passive); | ||||
281 | break; | ||||
282 | case Plasma::Types::ActiveStatus: | ||||
283 | case Plasma::Types::AcceptingInputStatus: | ||||
284 | m_statusNotifier->setStatus(KStatusNotifierItem::Active); | ||||
285 | break; | ||||
286 | case Plasma::Types::NeedsAttentionStatus: | ||||
287 | case Plasma::Types::RequiresAttentionStatus: | ||||
288 | m_statusNotifier->setStatus(KStatusNotifierItem::NeedsAttention); | ||||
289 | break; | ||||
290 | } | ||||
291 | } |