diff --git a/PKGBUILD b/PKGBUILD index 46ec667..9d36e83 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -12,7 +12,7 @@ depends=('kdebase-workspace') makedepends=('cmake' 'automoc4') source=(https://github.com/arcan1s/netctlplasmoid/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz) install=${pkgname}.install -md5sums=('d3ab03ddea1e4793cfc5f35a0f7a5ff1') +md5sums=('5ac750e391936a6f3494a819b7b4d0b2') _cmakekeys="-DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix) -DBUILD_GUI:BOOL=1 -DBUILD_PLASMOID:BOOL=1 diff --git a/sources/plasmoid/configwindow.ui b/sources/plasmoid/configwindow.ui index b22c4c8..2534014 100644 --- a/sources/plasmoid/configwindow.ui +++ b/sources/plasmoid/configwindow.ui @@ -23,7 +23,7 @@ - 0 + 1 @@ -196,7 +196,7 @@ - Show big interface + Show more detailed interface true @@ -537,6 +537,12 @@ + + 5 + + + 5 + Qt::Horizontal diff --git a/sources/plasmoid/netctl.cpp b/sources/plasmoid/netctl.cpp index 1918424..57cb958 100644 --- a/sources/plasmoid/netctl.cpp +++ b/sources/plasmoid/netctl.cpp @@ -23,12 +23,11 @@ #include #include #include -#include #include #include #include -#include +#include Netctl::Netctl(QObject *parent, const QVariantList &args) : @@ -44,14 +43,23 @@ Netctl::Netctl(QObject *parent, const QVariantList &args) : Netctl::~Netctl() { + delete startProfileMenu; + delete startProfile; + delete stopProfile; + delete restartProfile; + delete enableProfileAutoload; + delete iconWidget; delete iconFrame; delete textFrame; + + delete netctlEngine; } void Netctl::init() { + netctlEngine = dataEngine(QString("netctl")); createActions(); // generate ui // main layout @@ -80,12 +88,11 @@ void Netctl::init() // read variables configChanged(); - resize(150,64); } // context menu -void Netctl::startProfileSlot(QAction *action) +void Netctl::startProfileSlot(QAction *profile) { QProcess command; QString commandLine; @@ -93,9 +100,9 @@ void Netctl::startProfileSlot(QAction *action) if (status) commandLine = netctlPath + QString(" stop ") + profileName + QString(" && "); if (useSudo) - commandLine = sudoPath + QString(" \"") + commandLine + netctlPath + QString(" start ") + action->text().mid(1) + QString("\""); + commandLine = sudoPath + QString(" \"") + commandLine + netctlPath + QString(" start ") + profile->text().mid(1) + QString("\""); else - commandLine = commandLine + netctlPath + QString(" start ") + action->text().mid(1); + commandLine = commandLine + netctlPath + QString(" start ") + profile->text().mid(1); command.startDetached(commandLine); } @@ -191,7 +198,6 @@ QList Netctl::contextualActions() startProfileMenu->addAction(profile); } - return menuActions; } @@ -204,12 +210,12 @@ void Netctl::showGui() } -void Netctl::sendNotification(const QString eventId, const int num) +void Netctl::sendNotification(const QString eventId, const QString message) { KNotification *notification = new KNotification(eventId); notification->setComponentData(KComponentData("plasma_applet_netctl")); - notification->setTitle(QString(i18n("Netctl plasmoid"))); - notification->setText("test"); + notification->setTitle(eventId); + notification->setText(message); notification->sendEvent(); delete notification; } @@ -218,7 +224,6 @@ void Netctl::sendNotification(const QString eventId, const int num) // data engine interaction void Netctl::connectToEngine() { - Plasma::DataEngine *netctlEngine = dataEngine(QString("netctl")); netctlEngine->connectSource(QString("profiles"), this, autoUpdateInterval); netctlEngine->connectSource(QString("statusBool"), this, autoUpdateInterval); netctlEngine->connectSource(QString("currentProfile"), this, autoUpdateInterval); @@ -237,7 +242,6 @@ void Netctl::connectToEngine() void Netctl::disconnectFromEngine() { - Plasma::DataEngine *netctlEngine = dataEngine(QString("netctl")); netctlEngine->disconnectSource(QString("profiles"), this); netctlEngine->disconnectSource(QString("statusBool"), this); netctlEngine->disconnectSource(QString("currentProfile"), this); @@ -455,7 +459,7 @@ void Netctl::configChanged() showIntIp = cg.readEntry("showIntIp", true); fontFamily = cg.readEntry("fontFamily", "Terminus"); - fontSize = cg.readEntry("fontSize", 12); + fontSize = cg.readEntry("fontSize", 10); fontColor = cg.readEntry("fontColor", "#000000"); fontWeight = cg.readEntry("fontWeight", 400); fontStyle = cg.readEntry("fontStyle", "normal"); diff --git a/sources/plasmoid/netctl.h b/sources/plasmoid/netctl.h index 9dbca26..81b884c 100644 --- a/sources/plasmoid/netctl.h +++ b/sources/plasmoid/netctl.h @@ -19,9 +19,11 @@ #define NETCTL_PLASMOID_H #include +#include #include #include #include +#include #include @@ -39,7 +41,7 @@ public: public slots: // events void showGui(); - void sendNotification(const QString eventId, const int num); + void sendNotification(const QString eventId, const QString message); // dataengine void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data); // configuration interface @@ -55,7 +57,7 @@ private slots: void selectActiveIcon(); void selectInactiveIcon(); // context menu - void startProfileSlot(QAction *action); + void startProfileSlot(QAction *profile); void stopProfileSlot(); void restartProfileSlot(); void enableProfileAutoloadSlot(); @@ -90,8 +92,11 @@ private: QAction *restartProfile; QAction *enableProfileAutoload; // data engine + Plasma::DataEngine *netctlEngine; void connectToEngine(); void disconnectFromEngine(); + // notification + // configuration interface Ui::ConfigWindow uiConfig; // configuration diff --git a/sources/plasmoid/plasma_applet_netctl.notifyrc b/sources/plasmoid/plasma_applet_netctl.notifyrc index 16413ca..336e1d5 100644 --- a/sources/plasmoid/plasma_applet_netctl.notifyrc +++ b/sources/plasmoid/plasma_applet_netctl.notifyrc @@ -1,9 +1,14 @@ [Global] IconName=netctl-gui Name=Netctl plasmoid -Comment=Netctl plasmoid +Comment=Netctl plasmoid popups -[Event/NewEvent] -Name=New event -Comment=Comment +[Event/Error] +Name=Error +Comment=There is an error from netctl plasmoid +Action=Popup + +[Event/Info] +Name=Information +Comment=There is an information from netctl plasmoid Action=Popup