mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
okay, buttons now work
This commit is contained in:
parent
71a8922ff0
commit
8a1cd25d6e
@ -27,7 +27,7 @@ configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJEC
|
|||||||
# make
|
# make
|
||||||
kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI})
|
kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI})
|
||||||
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE})
|
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE})
|
||||||
target_link_libraries (${PLUGIN_NAME} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS})
|
target_link_libraries (${PLUGIN_NAME} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
|
||||||
|
|
||||||
# install
|
# install
|
||||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||||
|
@ -30,6 +30,16 @@
|
|||||||
<string>Configuration</string>
|
<string>Configuration</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_info">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_autoUpdate">
|
<layout class="QHBoxLayout" name="layout_autoUpdate">
|
||||||
<item>
|
<item>
|
||||||
@ -124,6 +134,42 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_netctl">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_netctl">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Path to netctl</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_netctl"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_netctl">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Browse</string>
|
||||||
|
</property>
|
||||||
|
<property name="default">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_showBigInterface">
|
<widget class="QCheckBox" name="checkBox_showBigInterface">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -576,6 +622,8 @@
|
|||||||
<tabstop>spinBox_autoUpdate</tabstop>
|
<tabstop>spinBox_autoUpdate</tabstop>
|
||||||
<tabstop>lineEdit_gui</tabstop>
|
<tabstop>lineEdit_gui</tabstop>
|
||||||
<tabstop>pushButton_gui</tabstop>
|
<tabstop>pushButton_gui</tabstop>
|
||||||
|
<tabstop>lineEdit_netctl</tabstop>
|
||||||
|
<tabstop>pushButton_netctl</tabstop>
|
||||||
<tabstop>checkBox_showBigInterface</tabstop>
|
<tabstop>checkBox_showBigInterface</tabstop>
|
||||||
<tabstop>checkBox_showNetDev</tabstop>
|
<tabstop>checkBox_showNetDev</tabstop>
|
||||||
<tabstop>checkBox_showExtIp</tabstop>
|
<tabstop>checkBox_showExtIp</tabstop>
|
||||||
|
@ -17,9 +17,12 @@
|
|||||||
|
|
||||||
#include "netctl.h"
|
#include "netctl.h"
|
||||||
#include "ui_configwindow.h"
|
#include "ui_configwindow.h"
|
||||||
|
#include <version.h>
|
||||||
|
|
||||||
#include <KConfigDialog>
|
#include <KConfigDialog>
|
||||||
|
#include <KFileDialog>
|
||||||
#include <KNotification>
|
#include <KNotification>
|
||||||
|
#include <KUrl>
|
||||||
#include <Plasma/DataEngine>
|
#include <Plasma/DataEngine>
|
||||||
#include <plasma/theme.h>
|
#include <plasma/theme.h>
|
||||||
|
|
||||||
@ -51,6 +54,7 @@ Netctl::~Netctl()
|
|||||||
|
|
||||||
void Netctl::init()
|
void Netctl::init()
|
||||||
{
|
{
|
||||||
|
createActions();
|
||||||
// generate ui
|
// generate ui
|
||||||
// main layout
|
// main layout
|
||||||
fullSpaceLayout = new QGraphicsLinearLayout();
|
fullSpaceLayout = new QGraphicsLinearLayout();
|
||||||
@ -82,6 +86,21 @@ void Netctl::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Netctl::createActions()
|
||||||
|
{
|
||||||
|
// helpAction = new QAction( KIcon( "help-about" ), i18n( "Help" ), this );
|
||||||
|
// helpAction->setMenu( ( QMenu* ) (new KHelpMenu( NULL, about, false ) )->menu() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<QAction*> Netctl::contextualActions()
|
||||||
|
{
|
||||||
|
QList<QAction*> menuActions;
|
||||||
|
|
||||||
|
return menuActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int Netctl::showGui()
|
int Netctl::showGui()
|
||||||
{
|
{
|
||||||
QProcess command;
|
QProcess command;
|
||||||
@ -150,7 +169,7 @@ void Netctl::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Da
|
|||||||
QString value = data[QString("value")].toString();;
|
QString value = data[QString("value")].toString();;
|
||||||
|
|
||||||
if (sourceName == QString("currentProfile")) {
|
if (sourceName == QString("currentProfile")) {
|
||||||
if (value == QString(""))
|
if (value.isEmpty())
|
||||||
value = QString("N\\A");
|
value = QString("N\\A");
|
||||||
profileName = value;
|
profileName = value;
|
||||||
|
|
||||||
@ -166,17 +185,17 @@ void Netctl::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Da
|
|||||||
textLabel->setText(formatLine[0] + text.join(QString("<br>")) + formatLine[1]);
|
textLabel->setText(formatLine[0] + text.join(QString("<br>")) + formatLine[1]);
|
||||||
}
|
}
|
||||||
else if (sourceName == QString("extIp")) {
|
else if (sourceName == QString("extIp")) {
|
||||||
if (value == QString(""))
|
if (value.isEmpty())
|
||||||
value = QString("N\\A");
|
value = QString("N\\A");
|
||||||
extIp = value;
|
extIp = value;
|
||||||
}
|
}
|
||||||
else if (sourceName == QString("intIp")) {
|
else if (sourceName == QString("intIp")) {
|
||||||
if (value == QString(""))
|
if (value.isEmpty())
|
||||||
value = QString("N\\A");
|
value = QString("N\\A");
|
||||||
intIp = value;
|
intIp = value;
|
||||||
}
|
}
|
||||||
else if (sourceName == QString("interfaces")) {
|
else if (sourceName == QString("interfaces")) {
|
||||||
if (value == QString(""))
|
if (value.isEmpty())
|
||||||
value = QString("N\\A");
|
value = QString("N\\A");
|
||||||
interfaces = value;
|
interfaces = value;
|
||||||
}
|
}
|
||||||
@ -198,13 +217,48 @@ void Netctl::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Da
|
|||||||
|
|
||||||
|
|
||||||
// configuration interface
|
// configuration interface
|
||||||
|
void Netctl::selectGuiExe()
|
||||||
|
{
|
||||||
|
KUrl guiUrl = KFileDialog::getOpenUrl(KUrl(), "*");
|
||||||
|
if (!guiUrl.isEmpty())
|
||||||
|
uiConfig.lineEdit_gui->setText(guiUrl.path());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Netctl::selectNetctlExe()
|
||||||
|
{
|
||||||
|
KUrl netctlUrl = KFileDialog::getOpenUrl(KUrl(), "*");
|
||||||
|
if (!netctlUrl.isEmpty())
|
||||||
|
uiConfig.lineEdit_netctl->setText(netctlUrl.path());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Netctl::selectActiveIcon()
|
||||||
|
{
|
||||||
|
KUrl activeIconUrl = KFileDialog::getOpenUrl(KUrl(), "*");
|
||||||
|
if (!activeIconUrl.isEmpty())
|
||||||
|
uiConfig.lineEdit_activeIcon->setText(activeIconUrl.path());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Netctl::selectInactiveIcon()
|
||||||
|
{
|
||||||
|
KUrl inactiveIconUrl = KFileDialog::getOpenUrl(KUrl(), "*");
|
||||||
|
if (!inactiveIconUrl.isEmpty())
|
||||||
|
uiConfig.lineEdit_inactiveIcon->setText(inactiveIconUrl.path());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Netctl::createConfigurationInterface(KConfigDialog *parent)
|
void Netctl::createConfigurationInterface(KConfigDialog *parent)
|
||||||
{
|
{
|
||||||
QWidget *configwin = new QWidget;
|
QWidget *configwin = new QWidget;
|
||||||
uiConfig.setupUi(configwin);
|
uiConfig.setupUi(configwin);
|
||||||
|
QString text = QString(NAME) + " - " + QString(VERSION) + "\n" + "(c) " + QString(DATE) + " " + QString(AUTHOR);
|
||||||
|
uiConfig.label_info->setText(text);
|
||||||
|
|
||||||
uiConfig.spinBox_autoUpdate->setValue(autoUpdateInterval);
|
uiConfig.spinBox_autoUpdate->setValue(autoUpdateInterval);
|
||||||
uiConfig.lineEdit_gui->setText(guiPath);
|
uiConfig.lineEdit_gui->setText(guiPath);
|
||||||
|
uiConfig.lineEdit_netctl->setText(netctlPath);
|
||||||
if (showBigInterface)
|
if (showBigInterface)
|
||||||
uiConfig.checkBox_showBigInterface->setCheckState(Qt::Checked);
|
uiConfig.checkBox_showBigInterface->setCheckState(Qt::Checked);
|
||||||
else
|
else
|
||||||
@ -236,8 +290,16 @@ void Netctl::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
uiConfig.lineEdit_inactiveIcon->setText(inactiveIconPath);
|
uiConfig.lineEdit_inactiveIcon->setText(inactiveIconPath);
|
||||||
|
|
||||||
parent->addPage(configwin, i18n("Netctl plasmoid"), Applet::icon());
|
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()));
|
connect(uiConfig.checkBox_showBigInterface, SIGNAL(stateChanged(int)), this, SLOT(setBigInterface()));
|
||||||
|
|
||||||
|
connect(uiConfig.pushButton_gui, SIGNAL(clicked()), this, SLOT(selectGuiExe()));
|
||||||
|
connect(uiConfig.pushButton_netctl, SIGNAL(clicked()), this, SLOT(selectNetctlExe()));
|
||||||
|
connect(uiConfig.pushButton_activeIcon, SIGNAL(clicked()), this, SLOT(selectActiveIcon()));
|
||||||
|
connect(uiConfig.pushButton_inactiveIcon, SIGNAL(clicked()), this, SLOT(selectInactiveIcon()));
|
||||||
|
|
||||||
|
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
|
||||||
|
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -248,6 +310,7 @@ void Netctl::configAccepted()
|
|||||||
|
|
||||||
cg.writeEntry("autoUpdateInterval", uiConfig.spinBox_autoUpdate->value());
|
cg.writeEntry("autoUpdateInterval", uiConfig.spinBox_autoUpdate->value());
|
||||||
cg.writeEntry("guiPath", uiConfig.lineEdit_gui->text());
|
cg.writeEntry("guiPath", uiConfig.lineEdit_gui->text());
|
||||||
|
cg.writeEntry("netctlPath", uiConfig.lineEdit_netctl->text());
|
||||||
if (uiConfig.checkBox_showBigInterface->checkState() == 0)
|
if (uiConfig.checkBox_showBigInterface->checkState() == 0)
|
||||||
cg.writeEntry("showBigInterface", false);
|
cg.writeEntry("showBigInterface", false);
|
||||||
else
|
else
|
||||||
@ -281,6 +344,7 @@ void Netctl::configChanged()
|
|||||||
|
|
||||||
autoUpdateInterval = cg.readEntry("autoUpdateInterval", 1000);
|
autoUpdateInterval = cg.readEntry("autoUpdateInterval", 1000);
|
||||||
guiPath = cg.readEntry("guiPath", "/usr/bin/netctl-gui");
|
guiPath = cg.readEntry("guiPath", "/usr/bin/netctl-gui");
|
||||||
|
netctlPath = cg.readEntry("netctlPath", "/usr/bin/netctl");
|
||||||
showBigInterface = cg.readEntry("showBigInterface", true);
|
showBigInterface = cg.readEntry("showBigInterface", true);
|
||||||
showNetDev = cg.readEntry("showNetDev", true);
|
showNetDev = cg.readEntry("showNetDev", true);
|
||||||
showExtIp = cg.readEntry("showExtIp", true);
|
showExtIp = cg.readEntry("showExtIp", true);
|
||||||
|
@ -47,8 +47,15 @@ public slots:
|
|||||||
void configChanged();
|
void configChanged();
|
||||||
int setBigInterface();
|
int setBigInterface();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void selectGuiExe();
|
||||||
|
void selectNetctlExe();
|
||||||
|
void selectActiveIcon();
|
||||||
|
void selectInactiveIcon();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void createConfigurationInterface(KConfigDialog *parent);
|
void createConfigurationInterface(KConfigDialog *parent);
|
||||||
|
QList<QAction*> contextualActions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// ui
|
// ui
|
||||||
@ -65,6 +72,11 @@ private:
|
|||||||
QString extIp;
|
QString extIp;
|
||||||
QString interfaces;
|
QString interfaces;
|
||||||
QStringList formatLine;
|
QStringList formatLine;
|
||||||
|
// context menu
|
||||||
|
void createActions();
|
||||||
|
QAction *startProfile;
|
||||||
|
QAction *restartProfile;
|
||||||
|
QAction *enableProfileAutoload;
|
||||||
// data engine
|
// data engine
|
||||||
void connectToEngine();
|
void connectToEngine();
|
||||||
void disconnectFromEngine();
|
void disconnectFromEngine();
|
||||||
@ -73,6 +85,7 @@ private:
|
|||||||
// configuration
|
// configuration
|
||||||
int autoUpdateInterval;
|
int autoUpdateInterval;
|
||||||
QString guiPath;
|
QString guiPath;
|
||||||
|
QString netctlPath;
|
||||||
bool showBigInterface;
|
bool showBigInterface;
|
||||||
bool showNetDev;
|
bool showNetDev;
|
||||||
bool showExtIp;
|
bool showExtIp;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#ifndef VERSION_H
|
#ifndef VERSION_H
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
#ifndef PROJ_VERSION
|
#define AUTHOR "Evgeniy Alekseev"
|
||||||
#define PROJ_VERSION "@PROJECT_VERSION@"
|
#define DATE "2014-2014"
|
||||||
#endif /* PROJ_VERSION */
|
#define NAME "Netctl plasmoid"
|
||||||
|
#define VERSION "@PROJECT_VERSION@"
|
||||||
|
|
||||||
#endif /* VERSION_H */
|
#endif /* VERSION_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user