diff --git a/sources/dataengine/plasma-engine-netctl.desktop b/sources/dataengine/plasma-engine-netctl.desktop
index 6423956..f4affd2 100644
--- a/sources/dataengine/plasma-engine-netctl.desktop
+++ b/sources/dataengine/plasma-engine-netctl.desktop
@@ -1,7 +1,7 @@
[Desktop Entry]
Encoding=UTF-8
Name=Netctl DataEngine
-Comment=data engine for netctl
+Comment=Data engine for netctl
ServiceTypes=Plasma/DataEngine
Type=Service
Icon=netctl-gui
@@ -14,6 +14,7 @@ X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
X-KDE-PluginInfo-Email=esalexeev@gmail.com
X-KDE-PluginInfo-Name=netctl
X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Website=http://arcan1s.github.io/projects/netctlplasmoid
X-KDE-PluginInfo-Category=Network
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPLv3
diff --git a/sources/plasmoid/configwindow.ui b/sources/plasmoid/configwindow.ui
new file mode 100644
index 0000000..62a6309
--- /dev/null
+++ b/sources/plasmoid/configwindow.ui
@@ -0,0 +1,557 @@
+
+
+ ConfigWindow
+
+
+
+ 0
+ 0
+ 480
+ 320
+
+
+
+
+ 480
+ 320
+
+
+
+ Configuration Window
+
+
+ -
+
+
+ 0
+
+
+
+ Configuration
+
+
+
-
+
+
-
+
+
+
+ 100
+ 23
+
+
+
+ Auto update interval, msec
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 100
+ 0
+
+
+
+ Qt::LeftToRight
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ 333
+
+
+ 10000
+
+
+ 500
+
+
+ 1000
+
+
+
+
+
+ -
+
+
+ Show big interface
+
+
+ true
+
+
+
+ -
+
+
+ Show network devices
+
+
+ true
+
+
+
+ -
+
+
+ Show external IP
+
+
+ true
+
+
+
+ -
+
+
+ Show internal IP
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+ Appearance
+
+
+ -
+
+
-
+
+
+
+ 80
+ 23
+
+
+
+ Font
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 180
+ 23
+
+
+
+ Set font family
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 80
+ 23
+
+
+
+ Font size
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 100
+ 23
+
+
+
+ Set font size
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ 7
+
+
+ 48
+
+
+ 12
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 80
+ 23
+
+
+
+ Font color
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 100
+ 23
+
+
+
+ Set font color
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 80
+ 23
+
+
+
+ Font weight
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 100
+ 23
+
+
+
+ Set font weight
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ 300
+
+
+ 600
+
+
+ 50
+
+
+ 400
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 80
+ 23
+
+
+
+ Font style
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 100
+ 23
+
+
+
+ Set font style
+
+
-
+
+ normal
+
+
+ -
+
+ italic
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
-
+
+
+
+ 80
+ 23
+
+
+
+ Active icon
+
+
+
+ -
+
+
+ -
+
+
+
+ 100
+ 0
+
+
+
+ Browse
+
+
+ true
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 80
+ 23
+
+
+
+ Inactive icon
+
+
+
+ -
+
+
+ -
+
+
+
+ 100
+ 0
+
+
+
+ Browse
+
+
+ true
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
+
+
+ KColorCombo
+ QComboBox
+
+
+
+
+ tabWidget
+ spinBox_autoUpdate
+ checkBox_showBigInterface
+ checkBox_showNetDev
+ checkBox_showExtIp
+ checkBox_showIntIp
+ fontComboBox_font
+ spinBox_fontSize
+ kcolorcombo_fontColor
+ spinBox_fontWeight
+ comboBox_fontStyle
+ lineEdit_activeIcon
+ pushButton_activeIcon
+ lineEdit_inactiveIcon
+ pushButton_inactiveIcon
+
+
+
+
diff --git a/sources/plasmoid/netctl.cpp b/sources/plasmoid/netctl.cpp
new file mode 100644
index 0000000..7777c00
--- /dev/null
+++ b/sources/plasmoid/netctl.cpp
@@ -0,0 +1,204 @@
+/***************************************************************************
+ * This file is part of netctl-plasmoid *
+ * *
+ * netctl-plasmoid is free software: you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * netctl-plasmoid is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with Foobar. If not, see . *
+ ***************************************************************************/
+
+#include "netctl.h"
+#include "ui_configwindow.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+Netctl::Netctl(QObject *parent, const QVariantList &args) :
+ Plasma::Applet(parent, args)
+{
+ setBackgroundHints(DefaultBackground);
+ setHasConfigurationInterface(true);
+}
+
+
+Netctl::~Netctl()
+{
+ delete main_label;
+}
+
+
+void Netctl::init()
+{
+ // generate ui
+ // layout
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this);
+ layout->setOrientation(Qt::Vertical);
+ // label
+ layout->addStretch(1);
+ main_label = new Plasma::Label(this);
+ main_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ main_label->setToolTip(qApp->translate("tooltip", "Click here to update message"));
+ layout->addItem(main_label);
+ layout->addStretch(1);
+ // read variables
+ configChanged();
+}
+
+
+void Netctl::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+{
+ // mouse double click event
+ // add gui support
+ return;
+}
+
+
+int Netctl::sendNotification(QString eventId, int num)
+{
+ // send notification
+ KNotification *notification = new KNotification(eventId);
+ notification->setComponentData(KComponentData("plasma_applet_netctl"));
+ notification->setTitle(QString(i18n("Netctl plasmoid")));
+ notification->setText("test");
+ notification->sendEvent();
+ delete notification;
+ return 0;
+}
+
+
+// configuration interface
+void Netctl::createConfigurationInterface(KConfigDialog *parent)
+{
+ QWidget *configwin = new QWidget;
+ uiConfig.setupUi(configwin);
+
+ uiConfig.spinBox_autoUpdate->setValue(autoUpdateInterval);
+ if (showBigInterface)
+ uiConfig.checkBox_showBigInterface->setCheckState(Qt::Checked);
+ else
+ uiConfig.checkBox_showBigInterface->setCheckState(Qt::Unchecked);
+ if (showNetDev)
+ uiConfig.checkBox_showNetDev->setCheckState(Qt::Checked);
+ else
+ uiConfig.checkBox_showNetDev->setCheckState(Qt::Unchecked);
+ if (showExtIp)
+ uiConfig.checkBox_showExtIp->setCheckState(Qt::Checked);
+ else
+ uiConfig.checkBox_showExtIp->setCheckState(Qt::Unchecked);
+ if (showIntIp)
+ uiConfig.checkBox_showIntIp->setCheckState(Qt::Checked);
+ else
+ uiConfig.checkBox_showIntIp->setCheckState(Qt::Unchecked);
+ setBigInterface();
+
+ QFont font = QFont(fontFamily, 12, 400, FALSE);
+ uiConfig.fontComboBox_font->setCurrentFont(font);
+ uiConfig.spinBox_fontSize->setValue(fontSize);
+ uiConfig.kcolorcombo_fontColor->setColor(fontColor);
+ uiConfig.spinBox_fontWeight->setValue(fontWeight);
+ if (fontStyle == "normal")
+ uiConfig.comboBox_fontStyle->setCurrentIndex(0);
+ else if (fontStyle == "italic")
+ uiConfig.comboBox_fontStyle->setCurrentIndex(1);
+ uiConfig.lineEdit_activeIcon->setText(activeIconPath);
+ uiConfig.lineEdit_inactiveIcon->setText(inactiveIconPath);
+
+ parent->addPage(configwin, i18n("Netctl plasmoid"), Applet::icon());
+ connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
+ connect(uiConfig.checkBox_showBigInterface, SIGNAL(stateChanged(int)), this, SLOT(setBigInterface()));
+}
+
+
+void Netctl::configAccepted()
+{
+ KConfigGroup cg = config();
+
+ cg.writeEntry("autoUpdateInterval", uiConfig.spinBox_autoUpdate->value());
+ if (uiConfig.checkBox_showBigInterface->checkState() == 0)
+ cg.writeEntry("showBigInterface", false);
+ else
+ cg.writeEntry("showBigInterface", true);
+ if (uiConfig.checkBox_showNetDev->checkState() == 0)
+ cg.writeEntry("showNetDev", false);
+ else
+ cg.writeEntry("showNetDev", true);
+ if (uiConfig.checkBox_showExtIp->checkState() == 0)
+ cg.writeEntry("showExtIp", false);
+ else
+ cg.writeEntry("showExtIp", true);
+ if (uiConfig.checkBox_showIntIp->checkState() == 0)
+ cg.writeEntry("showIntIp", false);
+ else
+ cg.writeEntry("showIntIp", true);
+
+ cg.writeEntry("fontFamily", uiConfig.fontComboBox_font->currentFont().family());
+ cg.writeEntry("fontSize", uiConfig.spinBox_fontSize->value());
+ cg.writeEntry("fontColor", uiConfig.kcolorcombo_fontColor->color().name());
+ cg.writeEntry("fontWeight", uiConfig.spinBox_fontWeight->value());
+ cg.writeEntry("fontStyle", uiConfig.comboBox_fontStyle->currentText());
+ cg.writeEntry("activeIconPath", uiConfig.lineEdit_activeIcon->text());
+ cg.writeEntry("inactiveIconPath", uiConfig.lineEdit_inactiveIcon->text());
+}
+
+
+void Netctl::configChanged()
+{
+ KConfigGroup cg = config();
+
+ autoUpdateInterval = cg.readEntry("autoUpdateInterval", 1000);
+ showBigInterface = cg.readEntry("showBigInterface", true);
+ showNetDev = cg.readEntry("showNetDev", true);
+ showExtIp = cg.readEntry("showExtIp", true);
+ showIntIp = cg.readEntry("showIntIp", true);
+
+ fontFamily = cg.readEntry("fontFamily", "Terminus");
+ fontSize = cg.readEntry("fontSize", 12);
+ fontColor = cg.readEntry("fontColor", "#000000");
+ fontWeight = cg.readEntry("fontWeight", 400);
+ fontStyle = cg.readEntry("fontStyle", "normal");
+ activeIconPath = cg.readEntry("activeIconPath", "/usr/share/icons/hicolor/48x48/apps/network-idle-64x64.png");
+ inactiveIconPath = cg.readEntry("inactiveIconPath", "/usr/share/icons/hicolor/48x48/apps/network-offline-64x64.png");
+
+ formatLine[0] = ("");
+ formatLine[1] = ("
");
+}
+
+
+int Netctl::setBigInterface()
+{
+ if (uiConfig.checkBox_showBigInterface->checkState() == 0) {
+ uiConfig.checkBox_showNetDev->setDisabled(true);
+ uiConfig.checkBox_showExtIp->setDisabled(true);
+ uiConfig.checkBox_showIntIp->setDisabled(true);
+ }
+ else if (uiConfig.checkBox_showBigInterface->checkState() == 2) {
+ uiConfig.checkBox_showNetDev->setEnabled(true);
+ uiConfig.checkBox_showExtIp->setEnabled(true);
+ uiConfig.checkBox_showIntIp->setEnabled(true);
+ }
+ else
+ return 1;
+ return 0;
+}
+
+
+#include "netctl.moc"
diff --git a/sources/plasmoid/netctl.h b/sources/plasmoid/netctl.h
new file mode 100644
index 0000000..cde93c2
--- /dev/null
+++ b/sources/plasmoid/netctl.h
@@ -0,0 +1,71 @@
+/***************************************************************************
+ * This file is part of netctl-plasmoid *
+ * *
+ * netctl-plasmoid is free software: you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * netctl-plasmoid is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with Foobar. If not, see . *
+ ***************************************************************************/
+
+#ifndef NETCTL_PLASMOID_H
+#define NETCTL_PLASMOID_H
+
+#include
+#include
+
+#include
+
+class QGraphicsLinearLayout;
+
+class Netctl : public Plasma::Applet
+{
+ Q_OBJECT
+
+public:
+ Netctl(QObject *parent, const QVariantList &args);
+ ~Netctl();
+ void init();
+
+public slots:
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
+ int sendNotification(QString eventId, int num);
+ // for configuration interface
+ void configAccepted();
+ void configChanged();
+ int setBigInterface();
+
+protected:
+ void createConfigurationInterface(KConfigDialog *parent);
+
+private:
+ // ui
+ Plasma::Label *main_label;
+ QStringList formatLine;
+ // configuration
+ int autoUpdateInterval;
+ bool showBigInterface;
+ bool showNetDev;
+ bool showExtIp;
+ bool showIntIp;
+ QString fontFamily;
+ int fontSize;
+ QString fontColor;
+ int fontWeight;
+ QString fontStyle;
+ QString activeIconPath;
+ QString inactiveIconPath;
+ // configuration interface
+ Ui::ConfigWindow uiConfig;
+};
+
+K_EXPORT_PLASMA_APPLET(netctl, Netctl)
+
+#endif /* NETCTL_PLASMOID_H */
diff --git a/sources/plasmoid/plasma-applet-netctl.desktop b/sources/plasmoid/plasma-applet-netctl.desktop
new file mode 100644
index 0000000..94a6a00
--- /dev/null
+++ b/sources/plasmoid/plasma-applet-netctl.desktop
@@ -0,0 +1,19 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Netctl
+Comment=Plasmoid for netctl
+Type=Service
+Icon=netctl-gui
+
+X-KDE-ServiceTypes=Plasma/Applet
+X-KDE-Library=plasma_applet_netctl
+
+X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
+X-KDE-PluginInfo-Email=esalexeev@gmail.com
+X-KDE-PluginInfo-Name=netctl
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Website=http://arcan1s.github.io/projects/netctlplasmoid
+X-KDE-PluginInfo-Category=Network
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPLv3
+X-KDE-PluginInfo-EnabledByDefault=true
diff --git a/sources/plasmoid/plasma_applet_netctl.notifyrc b/sources/plasmoid/plasma_applet_netctl.notifyrc
new file mode 100644
index 0000000..16413ca
--- /dev/null
+++ b/sources/plasmoid/plasma_applet_netctl.notifyrc
@@ -0,0 +1,9 @@
+[Global]
+IconName=netctl-gui
+Name=Netctl plasmoid
+Comment=Netctl plasmoid
+
+[Event/NewEvent]
+Name=New event
+Comment=Comment
+Action=Popup