From c1e23d38a915ced442984e0fb979648ab0edbfe9 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Fri, 1 Aug 2014 12:20:06 +0400 Subject: [PATCH] plasmoid is now popupapplet --- CHANGELOG | 2 ++ sources/plasmoid/netctl.cpp | 35 +++++++++++++++++++++++++++-------- sources/plasmoid/netctl.h | 5 ++++- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e38907f..86d7ee5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,7 @@ Ver.1.2.0: + [gui] more command line options + [gui] added workaround for wireless-wep example + [gui] added shell completions ++ [gui] added "Report a bug" action + [lib] detached backend from frontend + [lib] added error checking + [lib] added doxygen documentation @@ -30,6 +31,7 @@ Ver.1.2.0: * [lib] rewrited getSettingsFromProfile() function * [plasmoid] edited configuration interface * [plasmoid] changed double click event to click event +* [plasmoid] change class from Applet to PopupApplet Ver.1.1.0 (netctl-1.7 update): + [gui] added frequency diff --git a/sources/plasmoid/netctl.cpp b/sources/plasmoid/netctl.cpp index 696f431..f6005ef 100644 --- a/sources/plasmoid/netctl.cpp +++ b/sources/plasmoid/netctl.cpp @@ -36,7 +36,7 @@ Netctl::Netctl(QObject *parent, const QVariantList &args) - : Plasma::Applet(parent, args) + : Plasma::PopupApplet(parent, args) { // debug QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); @@ -46,8 +46,8 @@ Netctl::Netctl(QObject *parent, const QVariantList &args) else debug = false; - setBackgroundHints(DefaultBackground); - setHasConfigurationInterface(true); + this->setBackgroundHints(DefaultBackground); + this->setHasConfigurationInterface(true); // text format init formatLine.append(QString("")); formatLine.append(QString("")); @@ -62,6 +62,8 @@ Netctl::~Netctl() // delete switchToProfileMenu; // delete iconWidget; // delete textLabel; +// delete fullSpaceLayout; +// delete graphicsWidget; // delete netctlEngine; } @@ -79,10 +81,12 @@ void Netctl::init() netctlEngine = dataEngine(QString("netctl")); createActions(); // generate ui + graphicsWidget = new QGraphicsWidget(); + this->setGraphicsWidget(graphicsWidget); // main layout - fullSpaceLayout = new QGraphicsLinearLayout(); + fullSpaceLayout = new QGraphicsLinearLayout(graphicsWidget); fullSpaceLayout->setContentsMargins(1, 1, 1, 1); - setLayout(fullSpaceLayout); + graphicsWidget->setLayout(fullSpaceLayout); // frames // icon @@ -183,6 +187,22 @@ QMap Netctl::updateDataEngineConfiguration(const QMapsetIcon(icon); + this->setPopupIcon(KIcon(icon)); +} + + void Netctl::updateInterface(bool setShown) { if (debug) qDebug() << "[PLASMOID]" << "[updateInterface]"; @@ -522,20 +542,19 @@ void Netctl::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Da if (!status) sendNotification(QString("Info"), i18n("Network is up")); status = true; - iconWidget->setIcon(paths[QString("active")]); } else { if (status) sendNotification(QString("Info"), i18n("Network is down")); status = false; - iconWidget->setIcon(paths[QString("inactive")]); } + updateIcon(); } else if (sourceName == QString("statusString")) { info[QString("status")] = QString("(") + value + QString(")"); } - update(); + this->update(); } diff --git a/sources/plasmoid/netctl.h b/sources/plasmoid/netctl.h index 2964df8..359dcb3 100644 --- a/sources/plasmoid/netctl.h +++ b/sources/plasmoid/netctl.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -33,7 +34,7 @@ class QGraphicsLinearLayout; -class Netctl : public Plasma::Applet +class Netctl : public Plasma::PopupApplet { Q_OBJECT @@ -62,6 +63,7 @@ public slots: private slots: // ui + void updateIcon(); void updateInterface(bool setHidden); // configuration interface void selectActiveIcon(); @@ -90,6 +92,7 @@ protected: private: // ui + QGraphicsWidget *graphicsWidget; QGraphicsLinearLayout *fullSpaceLayout; // icon Plasma::IconWidget *iconWidget;