[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/applets/presence
From: Abner Silva <abner.silva () kdemail ! net>
Date: 2009-08-12 16:18:54
Message-ID: 1250093934.743598.25049.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1010479 by abnerf:
First draft of 'Updating presence status msg'.
This msg will appear when a new presence change is *requested* and will stay
visible till it receive a confirmation that the presence has changed. It helps
the user to see the changing status process.
BUG: 203341
M +55 -10 presencewidget.cpp
M +2 -0 presencewidget.h
--- trunk/playground/base/plasma/applets/presence/presencewidget.cpp #1010478:1010479
@@ -29,6 +29,7 @@
#include <Plasma/IconWidget>
#include <Plasma/LineEdit>
#include <Plasma/Label>
+#include <Plasma/BusyWidget>
// Kde
#include <KIconLoader>
@@ -48,7 +49,9 @@
m_currentStatusWidget(0),
m_presenceMessage(0),
m_presenceMessageLabel(0),
- m_presenceMsg("")
+ m_presenceMsg(""),
+ m_waitLayout(0),
+ m_waitWidget(0)
{
init();
}
@@ -166,17 +169,48 @@
m_currentStatusIcon->setMinimumWidth(s);
m_currentStatusIcon->setMaximumWidth(85);
+ m_currentStatusIcon->setVisible(false);
+
connect(m_currentStatusIcon, SIGNAL(clicked()),
this, SLOT(onPresenceStatusSwitch()));
- m_currentStatusLayout->addItem(m_currentStatusIcon);
+ // Create the wait widget
+ m_waitWidget = new QGraphicsWidget(this);
+ m_waitWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+
+ // Create the wait layout
+ m_waitLayout = new QGraphicsLinearLayout(m_waitWidget);
+ m_waitLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+
+ BusyWidget *busy = new BusyWidget(this);
+ busy->setMinimumHeight(s);
+ busy->setMaximumHeight(s);
+ busy->setMinimumWidth(s);
+ busy->setMaximumWidth(s);
+
+ m_waitLayout->addItem(busy);
+
+ // Create the wait msg label
+ Label *waitMessageLabel = new Label(this);
+ waitMessageLabel->nativeWidget()->setWordWrap(false);
+ waitMessageLabel->nativeWidget()->setAlignment(Qt::AlignTop);
+ waitMessageLabel->nativeWidget()->setSizePolicy(
+ QSizePolicy::Fixed, QSizePolicy::Fixed);
+ waitMessageLabel->setText(i18n("<i>Updating presence</i>"));
+
+ m_waitLayout->addItem(waitMessageLabel);
+ m_waitLayout->setContentsMargins(0, 0, 0, 0);
+ m_waitWidget->setLayout(m_waitLayout);
+
+ m_waitWidget->setMinimumHeight(s);
+ m_waitWidget->setMaximumHeight(s);
+
+ m_currentStatusLayout->addItem(m_waitWidget);
m_currentStatusWidget->setLayout(m_currentStatusLayout);
m_layout->addItem(m_currentStatusWidget);
m_layout->setAlignment(m_currentStatusWidget, Qt::AlignCenter);
- setPresenceStatus(PresenceWidget::Offline);
-
// Create the presence msg label
m_presenceMessageLabel = new Label(this);
m_presenceMessageLabel->nativeWidget()->setWordWrap(false);
@@ -217,9 +251,13 @@
{
PresenceStatus status = m_status.key(
static_cast<IconWidget *>(sender()));
- setPresenceStatus(status);
- emit presenceStatusChanged(m_currentStatus, m_presenceMsg);
+ onPresenceStatusSwitch();
+
+ if (m_currentStatus == status)
+ onPresenceStatusSwitch();
+ else
+ emit presenceStatusChanged(status, m_presenceMsg);
}
void PresenceWidget::onPresenceStatusSwitch()
@@ -231,13 +269,20 @@
m_currentStatusLayout->addItem(m_iconsWidget);
m_iconsWidget->show();
}
- else {
- m_iconsWidget->hide();
- m_currentStatusLayout->removeItem(m_iconsWidget);
+ else if (m_waitWidget->isVisible()) {
+ m_waitWidget->hide();
+ m_currentStatusLayout->removeItem(m_waitWidget);
m_currentStatusLayout->addItem(m_currentStatusIcon);
m_currentStatusIcon->show();
}
+ else if (m_iconsWidget->isVisible()) {
+ m_iconsWidget->hide();
+ m_currentStatusLayout->removeItem(m_iconsWidget);
+
+ m_currentStatusLayout->addItem(m_waitWidget);
+ m_waitWidget->show();
+ }
}
void PresenceWidget::onPresenceMsgReturn()
@@ -302,7 +347,7 @@
m_currentStatus = status;
}
- if (m_iconsWidget->isVisible())
+ if (m_iconsWidget->isVisible() || m_waitWidget->isVisible())
onPresenceStatusSwitch();
}
--- trunk/playground/base/plasma/applets/presence/presencewidget.h #1010478:1010479
@@ -83,6 +83,8 @@
QString m_presenceMsg;
QHash<PresenceStatus, Plasma::IconWidget *> m_status;
PresenceStatus m_currentStatus;
+ QGraphicsLinearLayout *m_waitLayout;
+ QGraphicsWidget *m_waitWidget;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic