[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/applets/presence
From: Dariusz Mikulski <dariusz.mikulski () gmail ! com>
Date: 2009-01-13 22:12:08
Message-ID: 1231884728.575174.27250.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 910661 by mikulski:
update to new Plasma API
M +14 -13 presence.cpp
M +6 -6 presence.h
--- trunk/playground/base/plasma/applets/presence/presence.cpp #910660:910661
@@ -23,7 +23,6 @@
#include <plasma/theme.h>
#include <plasma/widgets/iconwidget.h>
-#include <plasma/dialog.h>
#include <KColorScheme>
#include <KDebug>
@@ -38,11 +37,14 @@
#include <QtGui/QLabel>
#include <QtGui/QStandardItemModel>
#include <QtGui/QTreeView>
-#include <QtGui/QWidget>
+#include <QtGui/QGraphicsProxyWidget>
#include <QtGui/QVBoxLayout>
+
PresenceApplet::PresenceApplet(QObject * parent, const QVariantList & args)
- : Plasma::Applet(parent, args),
+ : Plasma::PopupApplet(parent, args),
+ m_icon(0),
+ m_widget(0),
m_engine(0),
m_colorScheme(0),
m_masterStatusLayout(0),
@@ -50,13 +52,13 @@
m_masterStatusMessageLabel(0),
m_accountsModel(0),
m_accountsView(0),
- m_layout(0),
- m_widget(0),
- m_icon(0)
+ m_layout(0)
{ }
PresenceApplet::~PresenceApplet()
{
+ if(m_widget)
+ delete m_widget;
delete m_colorScheme;
}
@@ -73,7 +75,7 @@
// Set up the icon.
Q_ASSERT(!m_icon); // Pointer should still be assigned to 0.
m_icon = new Plasma::IconWidget(this);
- m_icon->setIcon(KIcon("user-offline"));
+ m_icon->setIcon(KIcon("user-online"));
// The icon has been changed.
iconChanged();
@@ -107,7 +109,7 @@
QWidget *PresenceApplet::widget()
{
- if(!m_widget)
+ if(!m_widget)
{
// Set up the accounts view.
Q_ASSERT(!m_accountsView); // Pointer should still be assigned to 0.
@@ -122,7 +124,7 @@
Q_ASSERT(!m_masterIconLabel); // Pointer should still be assigned to 0.
Q_ASSERT(!m_masterStatusMessageLabel); // Pointer should still be assigned to 0.
- m_masterStatusLayout = new QHBoxLayout(m_widget);
+ m_masterStatusLayout = new QHBoxLayout();
m_masterIconLabel = new QLabel;
m_masterStatusMessageLabel = new QLabel;
@@ -136,8 +138,8 @@
// Set up the rest of the view/layout etc. stuff.
Q_ASSERT(!m_widget); // Pointer should still be assigned to 0.
Q_ASSERT(!m_layout); // Pointer should still be assigned to 0.
- m_widget = new QWidget();
- m_layout = new QVBoxLayout(m_widget);
+ m_widget = new QWidget;
+ m_layout = new QVBoxLayout();
m_layout->addLayout(m_masterStatusLayout);
m_layout->addWidget(m_accountsView);
m_widget->setLayout(m_layout);
@@ -153,7 +155,7 @@
}
Q_ASSERT(m_widget); // We must have a valid m_widget by now.
-
+
return m_widget;
}
@@ -305,7 +307,6 @@
int accountsBusy = 0;
bool okOffline = true;
- bool okAvailable = true;
bool okAway = true;
bool okExtendedAway = true;
bool okHidden = true;
--- trunk/playground/base/plasma/applets/presence/presence.h #910660:910661
@@ -20,7 +20,7 @@
#ifndef PLASMA_APPLET_PRESENCE_H
#define PLASMA_APPLET_PRESENCE_H
-#include <plasma/applet.h>
+#include <plasma/popupapplet.h>
#include <plasma/dataengine.h>
namespace Plasma
@@ -29,18 +29,18 @@
}
#include <QtCore/QString>
+#include <QtGui/QLabel>
class KColorScheme;
class QHBoxLayout;
-class QLabel;
class QStandardItemModel;
class QString;
class QTreeView;
class QVBoxLayout;
-class QWidget;
+class QGraphicsProxyWidget;
-class PresenceApplet : public Plasma::Applet
+class PresenceApplet : public Plasma::PopupApplet
{
Q_OBJECT
@@ -48,7 +48,7 @@
PresenceApplet(QObject * parent, const QVariantList & args);
~PresenceApplet();
- QWidget * widget();
+ QWidget *widget();
void init();
@@ -74,7 +74,7 @@
QStandardItemModel * m_accountsModel;
QTreeView * m_accountsView;
QVBoxLayout * m_layout;
- QWidget * m_widget;
+ QWidget *m_widget;
QString m_masterStatusMessage;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic