updated on Tue Jan 24 12:00:22 UTC 2012
[aur-mirror.git] / plasma-widget-message-indicator / indicator_status.diff
blobefd93dbc813b7e1be4223ceda4f9035a3c09bd5c
1 Description: Fix the indicator icon sometimes turning green when clicking on it.
2 Author: Felix Geyer <debfx-pkg@fobos.de>
3 Bug: https://bugs.launchpad.net/bugs/755537
5 --- plasma-widget-message-indicator-0.5.7.orig/src/message-indicator.h
6 +++ plasma-widget-message-indicator-0.5.7/src/message-indicator.h
7 @@ -61,6 +61,7 @@ private:
8 Plasma::Svg* mSvg;
9 QLabel* mNoIndicatorLabel;
10 QWidget* mCurrentWidget;
11 + Plasma::ItemStatus m_status;
13 void initIcon();
14 void initSourceModel();
15 --- plasma-widget-message-indicator-0.5.7.orig/src/message-indicator.cpp
16 +++ plasma-widget-message-indicator-0.5.7/src/message-indicator.cpp
17 @@ -45,6 +45,7 @@ MessageIndicator::MessageIndicator(QObje
18 , mView(new ExpandedTreeView(mStack))
19 , mSvg(new Plasma::Svg(this))
20 , mNoIndicatorLabel(new QLabel(mStack))
21 +, m_status(Plasma::UnknownStatus)
23 setBackgroundHints(StandardBackground);
24 setAspectRatioMode(Plasma::ConstrainedSquare);
25 @@ -191,7 +192,7 @@ void MessageIndicator::toolTipAboutToSho
26 QSizeF oldSize = mSvg->size();
27 // FIXME: Hardcoded size
28 mSvg->resize(32, 32);
29 - QString element = status() == Plasma::NeedsAttentionStatus ? NEW_STUFF_ICON : NO_NEW_STUFF_ICON;
30 + QString element = m_status == Plasma::NeedsAttentionStatus ? NEW_STUFF_ICON : NO_NEW_STUFF_ICON;
31 QPixmap pix = mSvg->pixmap(element);
32 mSvg->resize(oldSize);
33 toolTip.setImage(pix);
34 @@ -237,7 +238,7 @@ void MessageIndicator::paintInterface(QP
35 int minSize = qMin(contentsRect.height(), contentsRect.width());
36 QRect contentsSquare = QRect(contentsRect.x() + (contentsRect.width() - minSize) / 2, contentsRect.y() + (contentsRect.height() - minSize) / 2, minSize, minSize);
38 - QString element = status() == Plasma::NeedsAttentionStatus ? NEW_STUFF_ICON : NO_NEW_STUFF_ICON;
39 + QString element = m_status == Plasma::NeedsAttentionStatus ? NEW_STUFF_ICON : NO_NEW_STUFF_ICON;
40 mSvg->paint(painter, contentsSquare, element);
43 @@ -274,7 +275,6 @@ void MessageIndicator::slotDrawAttention
45 void MessageIndicator::updateStatus()
47 - Plasma::ItemStatus status;
48 if (mSourceModel && mSourceModel->rowCount() > 0) {
49 // Check if one of the indicators want to draw attention
50 QModelIndexList lst = mSourceModel->match(mSourceModel->index(0, 0),
51 @@ -282,18 +282,18 @@ void MessageIndicator::updateStatus()
52 QVariant(true),
53 1 /* hits */,
54 Qt::MatchExactly | Qt::MatchRecursive);
55 - status = lst.isEmpty() ? Plasma::ActiveStatus : Plasma::NeedsAttentionStatus;
56 + m_status = lst.isEmpty() ? Plasma::ActiveStatus : Plasma::NeedsAttentionStatus;
57 } else {
58 - status = Plasma::PassiveStatus;
59 + m_status = Plasma::PassiveStatus;
62 - setStatus(status);
63 + setStatus(m_status);
65 // Update icon
66 update();
68 // Update views
69 - if (status == Plasma::PassiveStatus) {
70 + if (m_status == Plasma::PassiveStatus) {
71 mView->hide();
72 mNoIndicatorLabel->show();
73 mCurrentWidget = mNoIndicatorLabel;