mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-27 20:49:57 +00:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
05a613b501 | |||
a9c7f98677 | |||
5018232c08 | |||
aed09bf798 | |||
d299e7d9a1 | |||
cf7b013726 | |||
b65ba2ebe2 | |||
69f6a3135b | |||
7dc1a5eda3 | |||
168a270c98 | |||
c3aa3f0c8f | |||
e26da85b5f | |||
f665a46346 |
34
CHANGELOG
34
CHANGELOG
@ -1,3 +1,37 @@
|
||||
Ver.1.4.7
|
||||
---------
|
||||
* all
|
||||
+ implement support of setting of default configuration values while building
|
||||
* fix language component (refer to #45)
|
||||
* gui
|
||||
* more correct work with configuration file
|
||||
* helper
|
||||
* more correct work with configuration file
|
||||
|
||||
Ver.1.4.6
|
||||
---------
|
||||
* all
|
||||
+ implement time logging feature
|
||||
* gui
|
||||
+ implement autoupdate feature
|
||||
- fix invalid profile path for the external editor
|
||||
* library
|
||||
+ implement netctl-auto support to scanWiFi() method (#44)
|
||||
- fix bug with invalid data in netctl-auto profile list output
|
||||
|
||||
Ver.1.4.5
|
||||
---------
|
||||
* plasmoid
|
||||
+ add translation support to plugin part
|
||||
* more correct interface painting
|
||||
* more correct configuration interface painting
|
||||
* move plugin from private
|
||||
|
||||
Ver.1.4.4
|
||||
---------
|
||||
* dataengine
|
||||
- fix profile status definition
|
||||
|
||||
Ver.1.4.3
|
||||
---------
|
||||
* all
|
||||
|
@ -3,7 +3,7 @@
|
||||
pkgbase=netctl-gui
|
||||
pkgname=('libnetctlgui' 'netctlgui-helper' 'netctl-gui'
|
||||
'plasma5-applet-netctl-gui')
|
||||
pkgver=1.4.3
|
||||
pkgver=1.4.7
|
||||
pkgrel=1
|
||||
pkgdesc="Qt4/Qt5 GUI for netctl. Also provides a widget for KDE"
|
||||
arch=('i686' 'x86_64')
|
||||
@ -11,7 +11,7 @@ url="http://arcanis.name/projects/netctl-gui"
|
||||
license=('GPL3')
|
||||
makedepends=('cmake' 'extra-cmake-modules' 'plasma-framework' 'qt5-tools')
|
||||
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgbase}-${pkgver}-src.tar.xz")
|
||||
md5sums=('65a62753c03e2996a05d930c0ec2d460')
|
||||
md5sums=('9723d9358412b212880c93e931f26b73')
|
||||
|
||||
prepare() {
|
||||
rm -rf "${srcdir}/build-"{plasmoid,qt5}
|
||||
|
@ -4,7 +4,7 @@ pkgbase=netctl-gui-qt4
|
||||
_pkgbase=netctl-gui
|
||||
pkgname=('libnetctlgui-qt4' 'netctlgui-helper-qt4' 'netctl-gui-qt4'
|
||||
'kdeplasma-applets-netctl-gui')
|
||||
pkgver=1.4.3
|
||||
pkgver=1.4.7
|
||||
pkgrel=1
|
||||
pkgdesc="Qt4 GUI for netctl. Also provides a widget for KDE4"
|
||||
arch=('i686' 'x86_64')
|
||||
@ -12,7 +12,7 @@ url="http://arcanis.name/projects/netctl-gui"
|
||||
license=('GPL3')
|
||||
makedepends=('automoc4' 'cmake' 'kdelibs')
|
||||
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${_pkgbase}-${pkgver}-src.tar.xz")
|
||||
md5sums=('65a62753c03e2996a05d930c0ec2d460')
|
||||
md5sums=('9723d9358412b212880c93e931f26b73')
|
||||
|
||||
|
||||
prepare() {
|
||||
|
23
sources/.kdev4/netctl-gui.kdev4
Normal file
23
sources/.kdev4/netctl-gui.kdev4
Normal file
@ -0,0 +1,23 @@
|
||||
[Buildset]
|
||||
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x14\x00n\x00e\x00t\x00c\x00t\x00l\x00-\x00g\x00u\x00i)
|
||||
|
||||
[CMake]
|
||||
Build Directory Count=1
|
||||
Current Build Directory Index=0
|
||||
ProjectRootRelative=./
|
||||
|
||||
[CMake][CMake Build Directory 0]
|
||||
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
|
||||
Build Type=Release
|
||||
CMake Binary=file:///usr/bin/cmake
|
||||
Environment Profile=
|
||||
Extra Arguments=
|
||||
Install Directory=file:///usr
|
||||
|
||||
[Defines And Includes][Compiler]
|
||||
Name=GCC
|
||||
Path=gcc
|
||||
Type=GCC
|
||||
|
||||
[Project]
|
||||
VersionControlSupport=kdevgit
|
@ -8,7 +8,7 @@ ProjectRootRelative=./
|
||||
|
||||
[CMake][CMake Build Directory 0]
|
||||
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
|
||||
Build Type=Release
|
||||
Build Type=Debug
|
||||
CMake Binary=file:///usr/bin/cmake
|
||||
Environment Profile=
|
||||
Extra Arguments=
|
||||
|
2
sources/3rdparty/language
vendored
2
sources/3rdparty/language
vendored
Submodule sources/3rdparty/language updated: 204943574a...319125b1fa
2
sources/3rdparty/language-config.h
vendored
2
sources/3rdparty/language-config.h
vendored
@ -7,6 +7,8 @@
|
||||
#define LANGUAGES "en,ja,ru"
|
||||
// language key in the configuration file
|
||||
#define LANGUAGE_KEY "LANGUAGE"
|
||||
// name of config section in the file if any
|
||||
#define LANGUAGE_SECTION "Common"
|
||||
|
||||
|
||||
#endif /* LANGUAGE_CONFIG_H */
|
||||
|
2
sources/3rdparty/pdebug
vendored
2
sources/3rdparty/pdebug
vendored
Submodule sources/3rdparty/pdebug updated: 9be4fe3681...75e4a0df83
@ -11,7 +11,7 @@ set (PROJECT_CONTACT "esalexeev@gmail.com")
|
||||
set (PROJECT_LICENSE "GPLv3")
|
||||
set (PROJECT_VERSION_MAJOR 1)
|
||||
set (PROJECT_VERSION_MINOR 4)
|
||||
set (PROJECT_VERSION_PATCH 3)
|
||||
set (PROJECT_VERSION_PATCH 7)
|
||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
||||
string (TIMESTAMP CURRENT_YEAR "%Y")
|
||||
@ -23,6 +23,8 @@ message (STATUS "Build date: ${CURRENT_DATE}")
|
||||
# install options
|
||||
option (USE_CAPABILITIES "Use setcap to set capabilities for the helper" ON)
|
||||
option (USE_QT5 "Use Qt5 instead of Qt4" ON)
|
||||
# configuration
|
||||
include (config-defs.cmake)
|
||||
# components
|
||||
option (BUILD_GUI "Build GUI" ON)
|
||||
option (BUILD_HELPER "Build helper" ON)
|
||||
|
41
sources/config-defs.cmake
Normal file
41
sources/config-defs.cmake
Normal file
@ -0,0 +1,41 @@
|
||||
# default configuration options
|
||||
|
||||
# [Common] section
|
||||
set (CFG_LANGUAGE "en" CACHE STRING "LANGUAGE key")
|
||||
set (CFG_MAINUPDATE "0" CACHE STRING "MAINUPDATE key")
|
||||
set (CFG_WIFIUPDATE "0" CACHE STRING "WIFIUPDATE key")
|
||||
set (CFG_SYSTRAY "true" CACHE STRING "SYSTRAY key")
|
||||
set (CFG_CLOSETOTRAY "true" CACHE STRING "CLOSETOTRAY key")
|
||||
set (CFG_STARTTOTRAY "false" CACHE STRING "STARTTOTRAY key")
|
||||
set (CFG_SKIPCOMPONENTS "false" CACHE STRING "SKIPCOMPONENTS key")
|
||||
|
||||
# [Helper] section
|
||||
set (CFG_USE_HELPER "true" CACHE STRING "USE_HELPER key")
|
||||
set (CFG_FORCE_SUDO "false" CACHE STRING "FORCE_SUDO key")
|
||||
set (CFG_CLOSE_HELPER "false" CACHE STRING "CLOSE_HELPER key")
|
||||
set (CFG_HELPER_PATH "netctlgui-helper" CACHE STRING "HELPER_PATH key")
|
||||
set (CFG_HELPER_SERVICE "netctlgui-helper.service" CACHE STRING "HELPER_SERVICE key")
|
||||
|
||||
# [netctl] section
|
||||
set (CFG_SYSTEMCTL_PATH "systemctl" CACHE STRING "SYSTEMCTL_PATH key")
|
||||
set (CFG_NETCTL_PATH "netctl" CACHE STRING "NETCTL_PATH key")
|
||||
set (CFG_NETCTLAUTO_PATH "netctl-auto" CACHE STRING "NETCTLAUTO_PATH key")
|
||||
set (CFG_NETCTLAUTO_SERVICE "netctl-auto" CACHE STRING "NETCTLAUTO_SERVICE key")
|
||||
set (CFG_PROFILE_DIR "/etc/netctl/" CACHE STRING "PROFILE_DIR key")
|
||||
|
||||
# [sudo] section
|
||||
set (CFG_SUDO_PATH "kdesu" CACHE STRING "SUDO_PATH key")
|
||||
|
||||
# [wpa_supplicant] section
|
||||
set (CFG_WPASUP_PATH "wpa_supplicant" CACHE STRING "WPASUP_PATH key")
|
||||
set (CFG_WPACLI_PATH "wpa_cli" CACHE STRING "WPACLI_PATH key")
|
||||
set (CFG_PID_FILE "/run/wpa_supplicant_$i.pid" CACHE STRING "PID_FILE key")
|
||||
set (CFG_WPA_DRIVERS "nl80211,wext" CACHE STRING "WPA_DRIVERS key")
|
||||
set (CFG_CTRL_DIR "/run/wpa_supplicant" CACHE STRING "CTRL_DIR key")
|
||||
set (CFG_CTRL_GROUP "users" CACHE STRING "CTRL_GROUP key")
|
||||
|
||||
# [Other] section
|
||||
set (CFG_EDITOR_PATH "gvim" CACHE STRING "EDITOR_PATH key")
|
||||
set (CFG_IFACE_DIR "/sys/class/net/" CACHE STRING "IFACE_DIR key")
|
||||
set (CFG_RFKILL_DIR "/sys/class/rfkill/" CACHE STRING "RFKILL_DIR key")
|
||||
set (CFG_PREFERED_IFACE "" CACHE STRING "PREFERED_IFACE key")
|
@ -39,7 +39,12 @@ include_directories (${CMAKE_SOURCE_DIR}
|
||||
set (PLUGIN_NAME ${SUBPROJECT})
|
||||
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
||||
if (BUILD_KDE4)
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
||||
else ()
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
|
||||
endif ()
|
||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||
file (GLOB SUBPROJECT_CONF *.conf)
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <KStandardDirs>
|
||||
#else
|
||||
#include <QStandardPaths>
|
||||
#include <pdebug/pdebug-time.h>
|
||||
#endif /* BUILD_KDE4 */
|
||||
|
||||
|
||||
@ -44,6 +45,9 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
qInstallMessageHandler(debugString);
|
||||
#endif /* QT_VERSION >= 0x050000 */
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
@ -89,10 +93,9 @@ QString Netctl::getCmdOutput(const QString cmd)
|
||||
|
||||
TaskResult process = runTask(cmd);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
if (process.exitCode != 0)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
|
||||
return QTextCodec::codecForMib(106)->toUnicode(process.output);
|
||||
return QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
||||
}
|
||||
|
||||
|
||||
@ -110,15 +113,15 @@ void Netctl::readConfiguration()
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Netctl commands"));
|
||||
configuration[QString("NETCTLCMD")] = settings.value(QString("NETCTLCMD"), QString("/usr/bin/netctl")).toString();
|
||||
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("/usr/bin/netctl-auto")).toString();
|
||||
configuration[QString("NETCTLCMD")] = settings.value(QString("NETCTLCMD"), QString("netctl"));
|
||||
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("netctl-auto"));
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("External IP"));
|
||||
configuration[QString("EXTIP4")] = settings.value(QString("EXTIP4"), QString("false")).toString();
|
||||
configuration[QString("EXTIP4CMD")] = settings.value(QString("EXTIP4CMD"), QString("curl ip4.telize.com")).toString();
|
||||
configuration[QString("EXTIP6")] = settings.value(QString("EXTIP6"), QString("false")).toString();
|
||||
configuration[QString("EXTIP6CMD")] = settings.value(QString("EXTIP6CMD"), QString("curl ip6.telize.com")).toString();
|
||||
configuration[QString("EXTIP4")] = settings.value(QString("EXTIP4"), QString("false"));
|
||||
configuration[QString("EXTIP4CMD")] = settings.value(QString("EXTIP4CMD"), QString("curl ip4.telize.com"));
|
||||
configuration[QString("EXTIP6")] = settings.value(QString("EXTIP6"), QString("false"));
|
||||
configuration[QString("EXTIP6CMD")] = settings.value(QString("EXTIP6CMD"), QString("curl ip6.telize.com"));
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
@ -137,10 +140,7 @@ QString Netctl::getExtIp(const QString cmd)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||
|
||||
// test network connection
|
||||
if (!isNetworkActive()) return QString("N\\A");
|
||||
|
||||
return getCmdOutput(cmd).trimmed();
|
||||
return getCmdOutput(cmd);
|
||||
}
|
||||
|
||||
|
||||
@ -203,20 +203,15 @@ QStringList Netctl::getProfileList(const QString cmdNetctl, const QString cmdNet
|
||||
output = getCmdOutput(QString("%1 list").arg(cmdNetctl));
|
||||
netctlAutoStatus = false;
|
||||
}
|
||||
qDebug() << output;
|
||||
|
||||
// parse
|
||||
QStringList currentProfiles;
|
||||
QStringList profileList = output.split(QChar('\n'), QString::SkipEmptyParts);
|
||||
QStringList profileList = output.split(QChar('\n'));
|
||||
for (int i=0; i<profileList.count(); i++) {
|
||||
if (profileList[i][0] != QChar('*')) continue;
|
||||
currentProfiles.append(profileList[i]);
|
||||
}
|
||||
// remove first symbols
|
||||
for (int i=0; i<profileList.count(); i++)
|
||||
bool isActive = (profileList[i][0] == QChar('*'));
|
||||
profileList[i].remove(0, 2);
|
||||
for (int i=0; i<currentProfiles.count(); i++)
|
||||
currentProfiles[i].remove(0, 2);
|
||||
if (isActive) currentProfiles.append(profileList[i]);
|
||||
}
|
||||
|
||||
// return profiles
|
||||
currentProfile = currentProfiles;
|
||||
@ -238,11 +233,8 @@ QStringList Netctl::getProfileStringStatus(const QString cmdNetctl)
|
||||
for (int i=0; i<currentProfile.count(); i++) {
|
||||
TaskResult process = runTask(QString("%1 is-enabled %2").arg(cmdNetctl).arg(currentProfile[i]));
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
if (process.exitCode != 0) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
status.append(QString("static"));
|
||||
} else
|
||||
status.append(QString("enabled"));
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
status.append(process.exitCode == 0 ? QString("enabled") : QString("static"));
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -259,19 +251,6 @@ void Netctl::initSources()
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::isNetworkActive()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString cmd = QString("ping -c 1 google.com");
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||
TaskResult process = runTask(cmd);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
|
||||
return (process.exitCode == 0);
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::updateSourceEvent(const QString &source)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -283,11 +262,11 @@ bool Netctl::updateSourceEvent(const QString &source)
|
||||
} else if (source == QString("current")) {
|
||||
value = currentProfile.join(QChar('|'));
|
||||
} else if (source == QString("extip4")) {
|
||||
if (configuration[QString("EXTIP4")] == QString("true"))
|
||||
value = getExtIp(configuration[QString("EXTIP4CMD")]);
|
||||
if (configuration[QString("EXTIP4")].toString() == QString("true"))
|
||||
value = getExtIp(configuration[QString("EXTIP4CMD")].toString());
|
||||
} else if (source == QString("extip6")) {
|
||||
if (configuration[QString("EXTIP6")] == QString("true"))
|
||||
value = getExtIp(configuration[QString("EXTIP6CMD")]);
|
||||
if (configuration[QString("EXTIP6")].toString() == QString("true"))
|
||||
value = getExtIp(configuration[QString("EXTIP6CMD")].toString());
|
||||
} else if (source == QString("info")) {
|
||||
value = getInfo(currentProfile, currentStatus);
|
||||
} else if (source == QString("interfaces")) {
|
||||
@ -299,10 +278,10 @@ bool Netctl::updateSourceEvent(const QString &source)
|
||||
} else if (source == QString("netctlauto")) {
|
||||
value = netctlAutoStatus ? QString("true") : QString("false");
|
||||
} else if (source == QString("profiles")) {
|
||||
value = getProfileList(configuration[QString("NETCTLCMD")],
|
||||
configuration[QString("NETCTLAUTOCMD")]).join(QChar(','));
|
||||
value = getProfileList(configuration[QString("NETCTLCMD")].toString(),
|
||||
configuration[QString("NETCTLAUTOCMD")].toString()).join(QChar(','));
|
||||
} else if (source == QString("status")) {
|
||||
currentStatus = getProfileStringStatus(configuration[QString("NETCTLCMD")]);
|
||||
currentStatus = getProfileStringStatus(configuration[QString("NETCTLCMD")].toString());
|
||||
value = currentStatus.join(QChar('|'));
|
||||
}
|
||||
setData(source, QString("value"), value);
|
||||
|
@ -35,7 +35,6 @@ public:
|
||||
QString getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol);
|
||||
QStringList getProfileList(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||
QStringList getProfileStringStatus(const QString cmdNetctl);
|
||||
bool isNetworkActive();
|
||||
|
||||
public slots:
|
||||
void initSources();
|
||||
@ -46,13 +45,14 @@ protected:
|
||||
QStringList sources() const;
|
||||
|
||||
private:
|
||||
bool isNetctlCheckRunning = false;
|
||||
bool netctlAutoStatus = false;
|
||||
bool status = false;
|
||||
QStringList currentProfile;
|
||||
QStringList currentStatus;
|
||||
// configuration
|
||||
bool debug;
|
||||
QMap<QString, QString> configuration;
|
||||
QVariantMap configuration;
|
||||
QString getCmdOutput(const QString cmd);
|
||||
void readConfiguration();
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
[Netctl commands]
|
||||
NETCTLCMD=/usr/bin/netctl
|
||||
NETCTLAUTOCMD=/usr/bin/netctl-auto
|
||||
NETCTLCMD=netctl
|
||||
NETCTLAUTOCMD=netctl-auto
|
||||
|
||||
[External IP]
|
||||
EXTIP4CMD=curl ip4.telize.com
|
||||
|
@ -1,7 +1,14 @@
|
||||
# set files
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
|
||||
if (USE_QT5)
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
|
||||
else ()
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
|
||||
endif ()
|
||||
file (GLOB_RECURSE HEADERS *.h ${PROJECT_TRDPARTY_DIR}/task/*.h
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.h)
|
||||
file (GLOB_RECURSE FORMS *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui)
|
||||
|
@ -32,6 +32,10 @@
|
||||
#include "messages.h"
|
||||
#include "version.h"
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <pdebug/pdebug-time.h>
|
||||
#endif /* QT_VERSION >= 0x050000 */
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -62,7 +66,7 @@ unsigned int getUidFromSession(const int type = 0)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QMap<QString, QVariant> args = getArgs();
|
||||
QVariantMap args = getArgs();
|
||||
// reading
|
||||
for (int i=1; i<argc; i++) {
|
||||
if (QString(argv[i]) == QString("--detached")) {
|
||||
@ -157,6 +161,9 @@ int main(int argc, char *argv[])
|
||||
// detach from console
|
||||
if (args[QString("detached")].toBool())
|
||||
daemon(0, 0);
|
||||
#if QT_VERSION >= 0x050000
|
||||
qInstallMessageHandler(debugString);
|
||||
#endif
|
||||
QApplication a(argc, argv);
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
// reread translations according to flags
|
||||
|
@ -52,6 +52,10 @@ MainWidget::MainWidget(QWidget *parent, const QMap<QString, QString> settings, c
|
||||
actionMenu->addAction(ui->actionEnable);
|
||||
ui->actionStart->setMenu(actionMenu);
|
||||
|
||||
// auto update
|
||||
timer.setSingleShot(true);
|
||||
timer.setInterval(configuration[QString("MAINUPDATE")].toInt() * 1000);
|
||||
|
||||
createActions();
|
||||
}
|
||||
|
||||
@ -92,6 +96,8 @@ void MainWidget::update()
|
||||
|
||||
updateMainTab();
|
||||
updateMenuMain();
|
||||
|
||||
if (timer.interval() != 0) return timer.start();
|
||||
}
|
||||
|
||||
|
||||
@ -411,6 +417,7 @@ void MainWidget::createActions()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// menu actions
|
||||
connect(&timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||
connect(ui->actionEnable, SIGNAL(triggered(bool)), this, SLOT(mainTabEnableProfile()));
|
||||
connect(ui->actionEdit, SIGNAL(triggered(bool)), this, SLOT(mainTabEditProfile()));
|
||||
connect(ui->actionRefresh, SIGNAL(triggered(bool)), this, SLOT(updateMainTab()));
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QTimer>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
@ -68,6 +69,7 @@ private:
|
||||
void createActions();
|
||||
QString configPath;
|
||||
bool debug = false;
|
||||
QTimer timer;
|
||||
bool useHelper = true;
|
||||
// configuration
|
||||
QMap<QString, QString> configuration;
|
||||
|
@ -51,10 +51,8 @@
|
||||
#include "wifimenuwidget.h"
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent,
|
||||
const QMap<QString, QVariant> args,
|
||||
QTranslator *qtAppTranslator,
|
||||
QTranslator *appTranslator)
|
||||
MainWindow::MainWindow(QWidget *parent, const QVariantMap args,
|
||||
QTranslator *qtAppTranslator, QTranslator *appTranslator)
|
||||
: QMainWindow(parent),
|
||||
configPath(args[QString("config")].toString()),
|
||||
debug(args[QString("debug")].toBool()),
|
||||
@ -369,13 +367,14 @@ void MainWindow::storeToolBars()
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::updateConfiguration(const QMap<QString, QVariant> args)
|
||||
void MainWindow::updateConfiguration(const QVariantMap args)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
deleteObjects();
|
||||
|
||||
settingsWin = new SettingsWindow(this, debug, configPath);
|
||||
QString actualConfigPath = QFile(configPath).exists() ? configPath : QString("/etc/netctl-gui.conf");
|
||||
settingsWin = new SettingsWindow(this, debug, actualConfigPath);
|
||||
if (args[QString("default")].toBool())
|
||||
settingsWin->setDefault();
|
||||
configuration = settingsWin->getSettings();
|
||||
@ -388,7 +387,7 @@ void MainWindow::updateConfiguration(const QMap<QString, QVariant> args)
|
||||
|
||||
// update translation
|
||||
qApp->removeTranslator(translator);
|
||||
QString language = Language::defineLanguage(configPath, args[QString("options")].toString());
|
||||
QString language = Language::defineLanguage(actualConfigPath, args[QString("options")].toString());
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Language is" << language;
|
||||
qtTranslator->load(QString("qt_%1").arg(language), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
qApp->installTranslator(qtTranslator);
|
||||
|
@ -43,7 +43,7 @@ class MainWindow : public QMainWindow
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0,
|
||||
const QMap<QString, QVariant> args = QMap<QString, QVariant>(),
|
||||
const QVariantMap args = QVariantMap(),
|
||||
QTranslator *qtAppTranslator = 0,
|
||||
QTranslator *appTranslator = 0);
|
||||
~MainWindow();
|
||||
@ -82,7 +82,7 @@ public slots:
|
||||
void setTab(int tab);
|
||||
void showMessage(const bool status);
|
||||
void storeToolBars();
|
||||
void updateConfiguration(const QMap<QString, QVariant> args = QMap<QString, QVariant>());
|
||||
void updateConfiguration(const QVariantMap args = QVariantMap());
|
||||
void updateToolBarState(const Qt::ToolBarArea area = Qt::TopToolBarArea);
|
||||
|
||||
signals:
|
||||
|
@ -29,9 +29,9 @@ QString errorMessage()
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QVariant> getArgs()
|
||||
QVariantMap getArgs()
|
||||
{
|
||||
QMap<QString, QVariant> args;
|
||||
QVariantMap args;
|
||||
// windows
|
||||
args[QString("detached")] = false;
|
||||
args[QString("minimized")] = static_cast<int>(0);
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
|
||||
QString errorMessage();
|
||||
QMap<QString, QVariant> getArgs();
|
||||
QVariantMap getArgs();
|
||||
QString helpMessage();
|
||||
QString infoMessage();
|
||||
QString versionMessage();
|
||||
|
@ -425,7 +425,9 @@ void NewProfileWidget::profileTabOpenInEditor()
|
||||
return mainWindow->emitNeedToBeConfigured();
|
||||
}
|
||||
|
||||
QString directory = QDir(configuration[QString("PROFILE_DIR")]).absolutePath();
|
||||
QString profile = QFileInfo(ui->comboBox_profile->currentText()).fileName();
|
||||
profile = QString("%1/%2").arg(directory).arg(profile);
|
||||
QString cmd = QString("%1 %2 %3").arg(configuration[QString("SUDO_PATH")])
|
||||
.arg(configuration[QString("EDITOR_PATH")])
|
||||
.arg(profile);
|
||||
|
@ -247,6 +247,8 @@ void SettingsWindow::saveSettings()
|
||||
|
||||
settings.beginGroup(QString("Common"));
|
||||
settings.setValue(QString("LANGUAGE"), config[QString("LANGUAGE")]);
|
||||
settings.setValue(QString("MAINUPDATE"), config[QString("MAINUPDATE")]);
|
||||
settings.setValue(QString("WIFIUPDATE"), config[QString("WIFIUPDATE")]);
|
||||
settings.setValue(QString("SYSTRAY"), config[QString("SYSTRAY")]);
|
||||
settings.setValue(QString("CLOSETOTRAY"), config[QString("CLOSETOTRAY")]);
|
||||
settings.setValue(QString("STARTTOTRAY"), config[QString("STARTTOTRAY")]);
|
||||
@ -458,6 +460,7 @@ QMap<QString, QString> SettingsWindow::readSettings()
|
||||
config[QString("HELPER_SERVICE")] = ui->lineEdit_helperService->text();
|
||||
config[QString("IFACE_DIR")] = ui->lineEdit_interfacesDir->text();
|
||||
config[QString("LANGUAGE")] = ui->comboBox_language->currentText();
|
||||
config[QString("MAINUPDATE")] = QString::number(ui->spinBox_mainAutoUpdate->value());
|
||||
config[QString("MAIN_TOOLBAR")] = QString::number(indexToToolBarPosition(ui->comboBox_mainToolbar->currentIndex()));
|
||||
config[QString("NETCTL_PATH")] = ui->lineEdit_netctlPath->text();
|
||||
config[QString("NETCTL_TOOLBAR")] = QString::number(indexToToolBarPosition(ui->comboBox_netctlToolbar->currentIndex()));
|
||||
@ -487,6 +490,7 @@ QMap<QString, QString> SettingsWindow::readSettings()
|
||||
config[QString("USE_HELPER")] = QString("true");
|
||||
else
|
||||
config[QString("USE_HELPER")] = QString("false");
|
||||
config[QString("WIFIUPDATE")] = QString::number(ui->spinBox_wifiAutoUpdate->value());
|
||||
config[QString("WIFI_TOOLBAR")] = QString::number(indexToToolBarPosition(ui->comboBox_wifiToolbar->currentIndex()));
|
||||
config[QString("WPACLI_PATH")] = ui->lineEdit_wpaCliPath->text();
|
||||
config[QString("WPASUP_PATH")] = ui->lineEdit_wpaSupPath->text();
|
||||
@ -523,6 +527,7 @@ void SettingsWindow::setSettings(const QMap<QString, QString> config)
|
||||
ui->lineEdit_interfacesDir->setText(config[QString("IFACE_DIR")]);
|
||||
int index = ui->comboBox_language->findText(config[QString("LANGUAGE")]);
|
||||
ui->comboBox_language->setCurrentIndex(index);
|
||||
ui->spinBox_mainAutoUpdate->setValue(config[QString("MAINUPDATE")].toInt());
|
||||
index = indexByToolBarPosition(static_cast<Qt::ToolBarArea>(config[QString("MAIN_TOOLBAR")].toInt()));
|
||||
ui->comboBox_mainToolbar->setCurrentIndex(index);
|
||||
ui->lineEdit_netctlPath->setText(config[QString("NETCTL_PATH")]);
|
||||
@ -556,6 +561,7 @@ void SettingsWindow::setSettings(const QMap<QString, QString> config)
|
||||
ui->checkBox_useHelper->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->checkBox_useHelper->setCheckState(Qt::Unchecked);
|
||||
ui->spinBox_wifiAutoUpdate->setValue(config[QString("WIFIUPDATE")].toInt());
|
||||
index = indexByToolBarPosition(static_cast<Qt::ToolBarArea>(config[QString("WIFI_TOOLBAR")].toInt()));
|
||||
ui->comboBox_wifiToolbar->setCurrentIndex(index);
|
||||
ui->lineEdit_wpaCliPath->setText(config[QString("WPACLI_PATH")]);
|
||||
@ -585,47 +591,49 @@ QMap<QString, QString> SettingsWindow::getSettings(QString fileName)
|
||||
|
||||
config[QString("LANGUAGE")] = Language::defineLanguage(fileName, QString());
|
||||
settings.beginGroup(QString("Common"));
|
||||
config[QString("LANGUAGE")] = settings.value(QString("LANGUAGE"), QString("en")).toString();
|
||||
config[QString("SYSTRAY")] = settings.value(QString("SYSTRAY"), QString("true")).toString();
|
||||
config[QString("CLOSETOTRAY")] = settings.value(QString("CLOSETOTRAY"), QString("true")).toString();
|
||||
config[QString("STARTTOTRAY")] = settings.value(QString("STARTTOTRAY"), QString("false")).toString();
|
||||
config[QString("SKIPCOMPONENTS")] = settings.value(QString("SKIPCOMPONENTS"), QString("false")).toString();
|
||||
config[QString("LANGUAGE")] = settings.value(QString("LANGUAGE"), config[QString("LANGUAGE")]).toString();
|
||||
config[QString("MAINUPDATE")] = settings.value(QString("MAINUPDATE"), QString(MAINUPDATE)).toString();
|
||||
config[QString("WIFIUPDATE")] = settings.value(QString("WIFIUPDATE"), QString(WIFIUPDATE)).toString();
|
||||
config[QString("SYSTRAY")] = settings.value(QString("SYSTRAY"), QString(SYSTRAY)).toString();
|
||||
config[QString("CLOSETOTRAY")] = settings.value(QString("CLOSETOTRAY"), QString(CLOSETOTRAY)).toString();
|
||||
config[QString("STARTTOTRAY")] = settings.value(QString("STARTTOTRAY"), QString(STARTTOTRAY)).toString();
|
||||
config[QString("SKIPCOMPONENTS")] = settings.value(QString("SKIPCOMPONENTS"), QString(SKIPCOMPONENTS)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Helper"));
|
||||
config[QString("USE_HELPER")] = settings.value(QString("USE_HELPER"), QString("true")).toString();
|
||||
config[QString("FORCE_SUDO")] = settings.value(QString("FORCE_SUDO"), QString("false")).toString();
|
||||
config[QString("CLOSE_HELPER")] = settings.value(QString("CLOSE_HELPER"), QString("false")).toString();
|
||||
config[QString("HELPER_PATH")] = settings.value(QString("HELPER_PATH"), QString("/usr/bin/netctlgui-helper")).toString();
|
||||
config[QString("HELPER_SERVICE")] = settings.value(QString("HELPER_SERVICE"), QString("netctlgui-helper.service")).toString();
|
||||
config[QString("USE_HELPER")] = settings.value(QString("USE_HELPER"), QString(USE_HELPER)).toString();
|
||||
config[QString("FORCE_SUDO")] = settings.value(QString("FORCE_SUDO"), QString(FORCE_SUDO)).toString();
|
||||
config[QString("CLOSE_HELPER")] = settings.value(QString("CLOSE_HELPER"), QString(CLOSE_HELPER)).toString();
|
||||
config[QString("HELPER_PATH")] = settings.value(QString("HELPER_PATH"), QString(HELPER_PATH)).toString();
|
||||
config[QString("HELPER_SERVICE")] = settings.value(QString("HELPER_SERVICE"), QString(HELPER_SERVICE)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("netctl"));
|
||||
config[QString("SYSTEMCTL_PATH")] = settings.value(QString("SYSTEMCTL_PATH"), QString("/usr/bin/systemctl")).toString();
|
||||
config[QString("NETCTL_PATH")] = settings.value(QString("NETCTL_PATH"), QString("/usr/bin/netctl")).toString();
|
||||
config[QString("NETCTLAUTO_PATH")] = settings.value(QString("NETCTLAUTO_PATH"), QString("/usr/bin/netctl-auto")).toString();
|
||||
config[QString("NETCTLAUTO_SERVICE")] = settings.value(QString("NETCTLAUTO_SERVICE"), QString("netctl-auto")).toString();
|
||||
config[QString("PROFILE_DIR")] = settings.value(QString("PROFILE_DIR"), QString("/etc/netctl")).toString();
|
||||
config[QString("SYSTEMCTL_PATH")] = settings.value(QString("SYSTEMCTL_PATH"), QString(SYSTEMCTL_PATH)).toString();
|
||||
config[QString("NETCTL_PATH")] = settings.value(QString("NETCTL_PATH"), QString(NETCTL_PATH)).toString();
|
||||
config[QString("NETCTLAUTO_PATH")] = settings.value(QString("NETCTLAUTO_PATH"), QString(NETCTLAUTO_PATH)).toString();
|
||||
config[QString("NETCTLAUTO_SERVICE")] = settings.value(QString("NETCTLAUTO_SERVICE"), QString(NETCTLAUTO_SERVICE)).toString();
|
||||
config[QString("PROFILE_DIR")] = settings.value(QString("PROFILE_DIR"), QString(PROFILE_DIR)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("sudo"));
|
||||
config[QString("SUDO_PATH")] = settings.value(QString("SUDO_PATH"), QString("/usr/bin/kdesu")).toString();
|
||||
config[QString("SUDO_PATH")] = settings.value(QString("SUDO_PATH"), QString(SUDO_PATH)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("wpa_supplicant"));
|
||||
config[QString("WPASUP_PATH")] = settings.value(QString("WPASUP_PATH"), QString("/usr/bin/wpa_supplicant")).toString();
|
||||
config[QString("WPACLI_PATH")] = settings.value(QString("WPACLI_PATH"), QString("/usr/bin/wpa_cli")).toString();
|
||||
config[QString("PID_FILE")] = settings.value(QString("PID_FILE"), QString("/run/wpa_supplicant_$i.pid")).toString();
|
||||
config[QString("WPA_DRIVERS")] = settings.value(QString("WPA_DRIVERS"), QString("nl80211,wext")).toString();
|
||||
config[QString("CTRL_DIR")] = settings.value(QString("CTRL_DIR"), QString("/run/wpa_supplicant")).toString();
|
||||
config[QString("CTRL_GROUP")] = settings.value(QString("CTRL_GROUP"), QString("users")).toString();
|
||||
config[QString("WPASUP_PATH")] = settings.value(QString("WPASUP_PATH"), QString(WPASUP_PATH)).toString();
|
||||
config[QString("WPACLI_PATH")] = settings.value(QString("WPACLI_PATH"), QString(WPACLI_PATH)).toString();
|
||||
config[QString("PID_FILE")] = settings.value(QString("PID_FILE"), QString(PID_FILE)).toString();
|
||||
config[QString("WPA_DRIVERS")] = settings.value(QString("WPA_DRIVERS"), QString(WPA_DRIVERS)).toString();
|
||||
config[QString("CTRL_DIR")] = settings.value(QString("CTRL_DIR"), QString(CTRL_DIR)).toString();
|
||||
config[QString("CTRL_GROUP")] = settings.value(QString("CTRL_GROUP"), QString(CTRL_GROUP)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Other"));
|
||||
config[QString("EDITOR_PATH")] = settings.value(QString("EDITOR_PATH"), QString("/usr/bin/gvim")).toString();
|
||||
config[QString("IFACE_DIR")] = settings.value(QString("IFACE_DIR"), QString("/sys/class/net/")).toString();
|
||||
config[QString("RFKILL_DIR")] = settings.value(QString("RFKILL_DIR"), QString("/sys/class/rfkill/")).toString();
|
||||
config[QString("PREFERED_IFACE")] = settings.value(QString("PREFERED_IFACE"), QString("")).toString();
|
||||
config[QString("EDITOR_PATH")] = settings.value(QString("EDITOR_PATH"), QString(EDITOR_PATH)).toString();
|
||||
config[QString("IFACE_DIR")] = settings.value(QString("IFACE_DIR"), QString(IFACE_DIR)).toString();
|
||||
config[QString("RFKILL_DIR")] = settings.value(QString("RFKILL_DIR"), QString(RFKILL_DIR)).toString();
|
||||
config[QString("PREFERED_IFACE")] = settings.value(QString("PREFERED_IFACE"), QString(PREFERED_IFACE)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Toolbars"));
|
||||
|
@ -190,6 +190,66 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_mainAutoUpdate">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mainAutoUpdate">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Main tab autoupdate, sec</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_mainAutoUpdate">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_wifiAutoUpdate">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_wifiAutoUpdate">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>WiFi tab autoupdate, sec</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_wifiAutoUpdate">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_enableTray">
|
||||
<item>
|
||||
@ -642,8 +702,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>173</height>
|
||||
<width>542</width>
|
||||
<height>330</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
@ -898,8 +958,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>45</height>
|
||||
<width>542</width>
|
||||
<height>330</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
@ -983,8 +1043,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>239</width>
|
||||
<height>194</height>
|
||||
<width>542</width>
|
||||
<height>330</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
|
@ -47,6 +47,10 @@ WiFiMenuWidget::WiFiMenuWidget(QWidget *parent, const QMap<QString, QString> set
|
||||
ui->tableWidget_wifi->setColumnHidden(6, true);
|
||||
updateToolBarState(static_cast<Qt::ToolBarArea>(configuration[QString("WIFI_TOOLBAR")].toInt()));
|
||||
|
||||
// auto update
|
||||
timer.setSingleShot(true);
|
||||
timer.setInterval(configuration[QString("WIFIUPDATE")].toInt() * 1000);
|
||||
|
||||
createActions();
|
||||
}
|
||||
|
||||
@ -73,6 +77,8 @@ void WiFiMenuWidget::update()
|
||||
|
||||
updateWifiTab();
|
||||
updateMenuWifi();
|
||||
|
||||
if (timer.interval() != 0) return timer.start();
|
||||
}
|
||||
|
||||
|
||||
@ -430,6 +436,7 @@ void WiFiMenuWidget::createActions()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// menu actions
|
||||
connect(&timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||
connect(ui->actionFunc, SIGNAL(triggered(bool)), this, SLOT(wifiTabShowInfo()));
|
||||
connect(ui->actionRefresh, SIGNAL(triggered(bool)), this, SLOT(updateWifiTab()));
|
||||
connect(ui->actionStart, SIGNAL(triggered(bool)), this, SLOT(wifiTabStart()));
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <QTimer>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
@ -70,6 +71,7 @@ private:
|
||||
void createActions();
|
||||
bool debug = false;
|
||||
bool hiddenNetwork = false;
|
||||
QTimer timer;
|
||||
bool useHelper = true;
|
||||
// configuration
|
||||
QMap<QString, QString> configuration;
|
||||
|
@ -18,13 +18,16 @@ add_subdirectory (${SUBPROJECT_SOURCE_DIR})
|
||||
# build man
|
||||
file (GLOB SUBPROJECT_MAN_IN *.1)
|
||||
file (GLOB SUBPROJECT_MAN5_IN *.5)
|
||||
file (GLOB SUBPROJECT_CONF_IN netctl-gui.conf)
|
||||
file (RELATIVE_PATH SUBPROJECT_MAN ${CMAKE_SOURCE_DIR} ${SUBPROJECT_MAN_IN})
|
||||
file (RELATIVE_PATH SUBPROJECT_MAN5 ${CMAKE_SOURCE_DIR} ${SUBPROJECT_MAN5_IN})
|
||||
file (RELATIVE_PATH SUBPROJECT_CONF ${CMAKE_SOURCE_DIR} ${SUBPROJECT_CONF_IN})
|
||||
configure_file (${SUBPROJECT_MAN_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN})
|
||||
configure_file (${SUBPROJECT_MAN5_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN5})
|
||||
configure_file (${SUBPROJECT_CONF_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_CONF})
|
||||
|
||||
install (FILES org.netctlgui.helper.conf DESTINATION ${DBUS_SYSTEMCONF_PATH})
|
||||
install (FILES netctl-gui.conf DESTINATION /etc)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_CONF} DESTINATION /etc)
|
||||
install (FILES netctlgui-helper.service DESTINATION ${SYSTEMD_SERVICE_PATH})
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN} DESTINATION share/man/man1/)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN5} DESTINATION share/man/man5/)
|
||||
|
@ -5,75 +5,81 @@
|
||||
|
||||
[Common]
|
||||
# application language
|
||||
LANGUAGE=en
|
||||
#LANGUAGE="@CFG_LANGUAGE@"
|
||||
# auto update interval for main tab in seconds
|
||||
# 0 means there is no updates
|
||||
#MAINUPDATE="@CFG_MAINUPDATE@"
|
||||
# auto update interval for wifi tab in seconds
|
||||
# 0 means there is no updates
|
||||
#WIFIUPDATE="@CFG_WIFIUPDATE@"
|
||||
# create system tray icon.
|
||||
# This option is not recognized by netctlgui-helper
|
||||
SYSTRAY=true
|
||||
#SYSTRAY="@CFG_SYSTRAY@"
|
||||
# close helper after GUI application quit.
|
||||
# This option is not recognized by netctlgui-helper
|
||||
CLOSETOTRAY=true
|
||||
#CLOSETOTRAY="@CFG_CLOSETOTRAY@"
|
||||
# start netctl-gui minimized to tray if it is available.
|
||||
# This option is not recognized by netctlgui-helper
|
||||
STARTTOTRAY=false
|
||||
#STARTTOTRAY="@CFG_STARTTOTRAY@"
|
||||
# skip external components checking
|
||||
# This option is not recognized by netctlgui-helper
|
||||
SKIPCOMPONENTS=false
|
||||
#SKIPCOMPONENTS="@CFG_SKIPCOMPONENTS@"
|
||||
|
||||
[Helper]
|
||||
# use netctlgui-helper if it is available.
|
||||
# This option is not recognized by netctlgui-helper
|
||||
USE_HELPER=true
|
||||
#USE_HELPER="@CFG_USE_HELPER@"
|
||||
# force use SUDO_PATH for helper instead of using setuid(3) to child processes
|
||||
FORCE_SUDO=false
|
||||
#FORCE_SUDO="@CFG_FORCE_SUDO@"
|
||||
# hide application to tray on exit if tray is available.
|
||||
# This option is not recognized by netctlgui-helper
|
||||
CLOSE_HELPER=false
|
||||
#CLOSE_HELPER="@CFG_CLOSE_HELPER@"
|
||||
# path to netctlgui-helper.
|
||||
# This option is not recognized by netctlgui-helper
|
||||
HELPER_PATH=/usr/bin/netctlgui-helper
|
||||
#HELPER_PATH="@CFG_HELPER_PATH@"
|
||||
# netctlgui-helper service name.
|
||||
# This option is not recognized by netctlgui-helper
|
||||
HELPER_SERVICE=netctlgui-helper.service
|
||||
#HELPER_SERVICE="@CFG_HELPER_SERVICE@"
|
||||
|
||||
[netctl]
|
||||
# path to systemctl
|
||||
SYSTEMCTL_PATH=/usr/bin/systemctl
|
||||
#SYSTEMCTL_PATH="@CFG_SYSTEMCTL_PATH@"
|
||||
# path to netctl
|
||||
NETCTL_PATH=/usr/bin/netctl
|
||||
#NETCTL_PATH="@CFG_NETCTL_PATH@"
|
||||
# path to netctl-auto
|
||||
NETCTLAUTO_PATH=/usr/bin/netctl-auto
|
||||
#NETCTLAUTO_PATH="@CFG_NETCTLAUTO_PATH@"
|
||||
# netctl-auto service name without .service suffix
|
||||
NETCTLAUTO_SERVICE=netctl-auto
|
||||
#NETCTLAUTO_SERVICE="@CFG_NETCTLAUTO_SERVICE@"
|
||||
# path to netctl profile directory
|
||||
PROFILE_DIR=/etc/netctl/
|
||||
#PROFILE_DIR="@CFG_PROFILE_DIR@"
|
||||
|
||||
[sudo]
|
||||
# path to sudo frontend
|
||||
SUDO_PATH=/usr/bin/sudo
|
||||
#SUDO_PATH="@CFG_SUDO_PATH@"
|
||||
|
||||
[wpa_supplicant]
|
||||
# path to wpa_supplicant
|
||||
WPASUP_PATH=/usr/bin/wpa_supplicant
|
||||
#WPASUP_PATH="@CFG_WPASUP_PATH@"
|
||||
# path to wpa_cli
|
||||
WPACLI_PATH=/usr/bin/wpa_cli
|
||||
#WPACLI_PATH="@CFG_WPACLI_PATH@"
|
||||
# wpa_supplicant PID file
|
||||
# $i is interface
|
||||
PID_FILE=/run/wpa_supplicant_$i.pid
|
||||
#PID_FILE="@CFG_PID_FILE@"
|
||||
# wpa_supplicant drivers for wireless interface comma separated
|
||||
WPA_DRIVERS="nl80211,wext"
|
||||
#WPA_DRIVERS="@CFG_WPA_DRIVERS@"
|
||||
# path to control directory which is required by wpa_supplicant
|
||||
CTRL_DIR=/run/wpa_supplicant
|
||||
#CTRL_DIR="@CFG_CTRL_DIR@"
|
||||
# group which is owner of CTRL_DIR
|
||||
CTRL_GROUP=users
|
||||
#CTRL_GROUP="@CFG_CTRL_GROUP@"
|
||||
|
||||
[Other]
|
||||
# path to external editor
|
||||
# This option is not recognized by netctlgui-helper
|
||||
EDITOR_PATH=/usr/bin/gvim
|
||||
#EDITOR_PATH="@CFG_EDITOR_PATH@"
|
||||
# path to directory which contains interface information
|
||||
IFACE_DIR=/sys/class/net/
|
||||
#IFACE_DIR="@CFG_IFACE_DIR@"
|
||||
# path to directory with rfkill devices.
|
||||
# This option is not recognized by netctlgui-helper
|
||||
RFKILL_DIR=/sys/class/rfkill/
|
||||
#RFKILL_DIR="@CFG_RFKILL_DIR@"
|
||||
# prefered wireless interface
|
||||
PREFERED_IFACE=
|
||||
#PREFERED_IFACE="@CFG_PREFERED_IFACE@"
|
||||
|
@ -32,10 +32,10 @@ force use
|
||||
for helper instead of using
|
||||
.BR setuid (3)
|
||||
to child processes
|
||||
.IP "EDITOR_PATH=/usr/bin/gvim"
|
||||
.IP "EDITOR_PATH=gvim"
|
||||
path to an external editor. This option is not recognized by
|
||||
.BR netctlgui-helper (1)
|
||||
.IP "HELPER_PATH=/usr/bin/netctlgui-helper"
|
||||
.IP "HELPER_PATH=netctlgui-helper"
|
||||
path to
|
||||
.BR netctlgui-helper (1)
|
||||
This option is not recognized by
|
||||
@ -48,10 +48,12 @@ service name. This option is not recognized by
|
||||
path to directory which contains interface information
|
||||
.IP "LANGUAGE=en"
|
||||
application language
|
||||
.IP "NETCTL_PATH=/usr/bin/netctl"
|
||||
.IP "MAINUPDATE=0"
|
||||
main tab autoupdate interval in seconds. 0 is disable autoupdate
|
||||
.IP "NETCTL_PATH=netctl"
|
||||
path to
|
||||
.BR netctl (1)
|
||||
.IP "NETCTLAUTO_PATH=/usr/bin/netctl-auto"
|
||||
.IP "NETCTLAUTO_PATH=netctl-auto"
|
||||
path to
|
||||
.BR netctl-auto (1)
|
||||
.IP "NETCTLAUTO_SERVICE=netctl-auto"
|
||||
@ -81,11 +83,11 @@ start
|
||||
.BR netctl-gui (1)
|
||||
minimized to tray if it is available. This option is not recognized by
|
||||
.BR netctlgui-helper (1)
|
||||
.IP "SUDO_PATH=/usr/bin/kdesu"
|
||||
.IP "SUDO_PATH=kdesu"
|
||||
path to
|
||||
.BR sudo (8)
|
||||
frontend
|
||||
.IP "SYSTEMCTL_PATH=/usr/bin/systemctl"
|
||||
.IP "SYSTEMCTL_PATH=systemctl"
|
||||
path to
|
||||
.BR systemctl (1)
|
||||
.IP "SYSTRAY=true"
|
||||
@ -96,10 +98,12 @@ use
|
||||
.BR netctlgui-helper (1)
|
||||
if it is available. This option is not recognized by
|
||||
.BR netctlgui-helper (1)
|
||||
.IP "WPACLI_PATH=/usr/bin/wpa_cli"
|
||||
.IP "WIFIUPDATE=0"
|
||||
WiFi tab autoupdate interval in seconds. 0 is disable autoupdate
|
||||
.IP "WPACLI_PATH=wpa_cli"
|
||||
path to
|
||||
.BR wpa_cli (8)
|
||||
.IP "WPASUP_PATH=/usr/bin/wpa_supplicant"
|
||||
.IP "WPASUP_PATH=wpa_supplicant"
|
||||
path to
|
||||
.BR wpa_supplicant (8)
|
||||
.IP "WPA_DRIVERS=nl80211,wext"
|
||||
|
@ -1,7 +1,14 @@
|
||||
# set files
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
|
||||
if (USE_QT5)
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
|
||||
else ()
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
|
||||
endif ()
|
||||
file (GLOB_RECURSE HEADERS *.h ${PROJECT_TRDPARTY_DIR}/task/*.h
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.h)
|
||||
|
||||
|
@ -112,7 +112,7 @@ QString ControlAdaptor::SecurityDocs()
|
||||
|
||||
bool ControlAdaptor::SelfDestruct(const QString approve)
|
||||
{
|
||||
if (approve == QString("Yes, please")) return SelfDestruct(approve);
|
||||
if (approve == QString("Yes please")) return SelfDestruct(approve);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -32,6 +32,10 @@
|
||||
#include "netctlhelper.h"
|
||||
#include "version.h"
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <pdebug/pdebug-time.h>
|
||||
#endif /* QT_VERSION >= 0x050000 */
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -50,7 +54,7 @@ bool existingSessionOperation(const QString operation)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QMap<QString, QVariant> args = getArgs();
|
||||
QVariantMap args = getArgs();
|
||||
// reading
|
||||
for (int i=1; i<argc; i++) {
|
||||
if ((QString(argv[i]) == QString("-c")) || (QString(argv[i]) == QString("--config"))) {
|
||||
@ -115,6 +119,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
QCoreApplication::setSetuidAllowed(true);
|
||||
qInstallMessageHandler(debugString);
|
||||
#endif
|
||||
QCoreApplication a(argc, argv);
|
||||
// reread translations according to flags
|
||||
|
@ -29,14 +29,14 @@ QString errorMessage()
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QVariant> getArgs()
|
||||
QVariantMap getArgs()
|
||||
{
|
||||
QMap<QString, QVariant> args;
|
||||
QVariantMap args;
|
||||
args[QString("config")] = QString("%1/.config/netctl-gui.conf").arg(QDir::homePath());
|
||||
args[QString("debug")] = false;
|
||||
args[QString("nodaemon")] = false;
|
||||
args[QString("session")] = false;
|
||||
args[QString("state")] = (int) 0;
|
||||
args[QString("state")] = static_cast<int>(0);
|
||||
args[QString("system")] = false;
|
||||
args[QString("help")] = false;
|
||||
args[QString("info")] = false;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
|
||||
QString errorMessage();
|
||||
QMap<QString, QVariant> getArgs();
|
||||
QVariantMap getArgs();
|
||||
QString helpMessage();
|
||||
QString infoMessage();
|
||||
QString versionMessage();
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "version.h"
|
||||
|
||||
|
||||
NetctlHelper::NetctlHelper(QObject *parent, QMap<QString, QVariant> args)
|
||||
NetctlHelper::NetctlHelper(QObject *parent, QVariantMap args)
|
||||
: QObject(parent),
|
||||
configPath(args[QString("config")].toString()),
|
||||
debug(args[QString("debug")].toBool()),
|
||||
@ -147,47 +147,49 @@ QMap<QString, QString> NetctlHelper::getSettings(const QString file)
|
||||
QSettings settings(file, QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Common"));
|
||||
config[QString("LANGUAGE")] = settings.value(QString("LANGUAGE"), QString("en")).toString();
|
||||
config[QString("SYSTRAY")] = settings.value(QString("SYSTRAY"), QString("true")).toString();
|
||||
config[QString("CLOSETOTRAY")] = settings.value(QString("CLOSETOTRAY"), QString("true")).toString();
|
||||
config[QString("STARTTOTRAY")] = settings.value(QString("STARTTOTRAY"), QString("false")).toString();
|
||||
config[QString("SKIPCOMPONENTS")] = settings.value(QString("SKIPCOMPONENTS"), QString("false")).toString();
|
||||
config[QString("LANGUAGE")] = settings.value(QString("LANGUAGE"), QString(LANGUAGE)).toString();
|
||||
config[QString("MAINUPDATE")] = settings.value(QString("MAINUPDATE"), QString(MAINUPDATE)).toString();
|
||||
config[QString("WIFIUPDATE")] = settings.value(QString("WIFIUPDATE"), QString(WIFIUPDATE)).toString();
|
||||
config[QString("SYSTRAY")] = settings.value(QString("SYSTRAY"), QString(SYSTRAY)).toString();
|
||||
config[QString("CLOSETOTRAY")] = settings.value(QString("CLOSETOTRAY"), QString(CLOSETOTRAY)).toString();
|
||||
config[QString("STARTTOTRAY")] = settings.value(QString("STARTTOTRAY"), QString(STARTTOTRAY)).toString();
|
||||
config[QString("SKIPCOMPONENTS")] = settings.value(QString("SKIPCOMPONENTS"), QString(SKIPCOMPONENTS)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Helper"));
|
||||
config[QString("USE_HELPER")] = settings.value(QString("USE_HELPER"), QString("true")).toString();
|
||||
config[QString("FORCE_SUDO")] = settings.value(QString("FORCE_SUDO"), QString("false")).toString();
|
||||
config[QString("CLOSE_HELPER")] = settings.value(QString("CLOSE_HELPER"), QString("false")).toString();
|
||||
config[QString("HELPER_PATH")] = settings.value(QString("HELPER_PATH"), QString("/usr/bin/netctlgui-helper")).toString();
|
||||
config[QString("HELPER_SERVICE")] = settings.value(QString("HELPER_SERVICE"), QString("netctlgui-helper.service")).toString();
|
||||
config[QString("USE_HELPER")] = settings.value(QString("USE_HELPER"), QString(USE_HELPER)).toString();
|
||||
config[QString("FORCE_SUDO")] = settings.value(QString("FORCE_SUDO"), QString(FORCE_SUDO)).toString();
|
||||
config[QString("CLOSE_HELPER")] = settings.value(QString("CLOSE_HELPER"), QString(CLOSE_HELPER)).toString();
|
||||
config[QString("HELPER_PATH")] = settings.value(QString("HELPER_PATH"), QString(HELPER_PATH)).toString();
|
||||
config[QString("HELPER_SERVICE")] = settings.value(QString("HELPER_SERVICE"), QString(HELPER_SERVICE)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("netctl"));
|
||||
config[QString("SYSTEMCTL_PATH")] = settings.value(QString("SYSTEMCTL_PATH"), QString("/usr/bin/systemctl")).toString();
|
||||
config[QString("NETCTL_PATH")] = settings.value(QString("NETCTL_PATH"), QString("/usr/bin/netctl")).toString();
|
||||
config[QString("NETCTLAUTO_PATH")] = settings.value(QString("NETCTLAUTO_PATH"), QString("/usr/bin/netctl-auto")).toString();
|
||||
config[QString("NETCTLAUTO_SERVICE")] = settings.value(QString("NETCTLAUTO_SERVICE"), QString("netctl-auto")).toString();
|
||||
config[QString("PROFILE_DIR")] = settings.value(QString("PROFILE_DIR"), QString("/etc/netctl")).toString();
|
||||
config[QString("SYSTEMCTL_PATH")] = settings.value(QString("SYSTEMCTL_PATH"), QString(SYSTEMCTL_PATH)).toString();
|
||||
config[QString("NETCTL_PATH")] = settings.value(QString("NETCTL_PATH"), QString(NETCTL_PATH)).toString();
|
||||
config[QString("NETCTLAUTO_PATH")] = settings.value(QString("NETCTLAUTO_PATH"), QString(NETCTLAUTO_PATH)).toString();
|
||||
config[QString("NETCTLAUTO_SERVICE")] = settings.value(QString("NETCTLAUTO_SERVICE"), QString(NETCTLAUTO_SERVICE)).toString();
|
||||
config[QString("PROFILE_DIR")] = settings.value(QString("PROFILE_DIR"), QString(PROFILE_DIR)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("sudo"));
|
||||
config[QString("SUDO_PATH")] = settings.value(QString("SUDO_PATH"), QString("/usr/bin/kdesu")).toString();
|
||||
config[QString("SUDO_PATH")] = settings.value(QString("SUDO_PATH"), QString(SUDO_PATH)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("wpa_supplicant"));
|
||||
config[QString("WPASUP_PATH")] = settings.value(QString("WPASUP_PATH"), QString("/usr/bin/wpa_supplicant")).toString();
|
||||
config[QString("WPACLI_PATH")] = settings.value(QString("WPACLI_PATH"), QString("/usr/bin/wpa_cli")).toString();
|
||||
config[QString("PID_FILE")] = settings.value(QString("PID_FILE"), QString("/run/wpa_supplicant_$i.pid")).toString();
|
||||
config[QString("WPA_DRIVERS")] = settings.value(QString("WPA_DRIVERS"), QString("nl80211,wext")).toString();
|
||||
config[QString("CTRL_DIR")] = settings.value(QString("CTRL_DIR"), QString("/run/wpa_supplicant")).toString();
|
||||
config[QString("CTRL_GROUP")] = settings.value(QString("CTRL_GROUP"), QString("users")).toString();
|
||||
config[QString("WPASUP_PATH")] = settings.value(QString("WPASUP_PATH"), QString(WPASUP_PATH)).toString();
|
||||
config[QString("WPACLI_PATH")] = settings.value(QString("WPACLI_PATH"), QString(WPACLI_PATH)).toString();
|
||||
config[QString("PID_FILE")] = settings.value(QString("PID_FILE"), QString(PID_FILE)).toString();
|
||||
config[QString("WPA_DRIVERS")] = settings.value(QString("WPA_DRIVERS"), QString(WPA_DRIVERS)).toString();
|
||||
config[QString("CTRL_DIR")] = settings.value(QString("CTRL_DIR"), QString(CTRL_DIR)).toString();
|
||||
config[QString("CTRL_GROUP")] = settings.value(QString("CTRL_GROUP"), QString(CTRL_GROUP)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Other"));
|
||||
config[QString("EDITOR_PATH")] = settings.value(QString("EDITOR_PATH"), QString("/usr/bin/gvim")).toString();
|
||||
config[QString("IFACE_DIR")] = settings.value(QString("IFACE_DIR"), QString("/sys/class/net/")).toString();
|
||||
config[QString("RFKILL_DIR")] = settings.value(QString("RFKILL_DIR"), QString("/sys/class/rfkill/")).toString();
|
||||
config[QString("PREFERED_IFACE")] = settings.value(QString("PREFERED_IFACE"), QString("")).toString();
|
||||
config[QString("EDITOR_PATH")] = settings.value(QString("EDITOR_PATH"), QString(EDITOR_PATH)).toString();
|
||||
config[QString("IFACE_DIR")] = settings.value(QString("IFACE_DIR"), QString(IFACE_DIR)).toString();
|
||||
config[QString("RFKILL_DIR")] = settings.value(QString("RFKILL_DIR"), QString(RFKILL_DIR)).toString();
|
||||
config[QString("PREFERED_IFACE")] = settings.value(QString("PREFERED_IFACE"), QString(PREFERED_IFACE)).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Toolbars"));
|
||||
@ -210,7 +212,7 @@ void NetctlHelper::updateConfiguration()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
deleteInterface();
|
||||
if (system)
|
||||
if ((system) || (!QFile(configPath).exists()))
|
||||
configuration = getSettings(QString("/etc/netctl-gui.conf"));
|
||||
else
|
||||
configuration = getSettings(configPath);
|
||||
|
@ -29,7 +29,7 @@ class NetctlHelper : public QObject
|
||||
|
||||
public:
|
||||
explicit NetctlHelper(QObject *parent = 0,
|
||||
QMap<QString, QVariant> args = QMap<QString, QVariant>());
|
||||
QVariantMap args = QVariantMap());
|
||||
~NetctlHelper();
|
||||
QStringList printSettings();
|
||||
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
class NetctlProfile;
|
||||
|
||||
@ -303,27 +305,27 @@ private:
|
||||
/**
|
||||
* @brief prefered interface for WiFi. Default is ""
|
||||
*/
|
||||
QString mainInterface = QString("");
|
||||
QString mainInterface = QString(PREFERED_IFACE);
|
||||
/**
|
||||
* @brief path to netctl command. Default is "/usr/bin/netctl"
|
||||
* @brief path to netctl command. Default is "netctl"
|
||||
*/
|
||||
QString netctlCommand = QString("/usr/bin/netctl");
|
||||
QString netctlCommand = QString(NETCTL_PATH);
|
||||
/**
|
||||
* @brief path to netctl-auto command. Default is "/usr/bin/netctl-auto"
|
||||
* @brief path to netctl-auto command. Default is "netctl-auto"
|
||||
*/
|
||||
QString netctlAutoCommand = QString("/usr/bin/netctl-auto");
|
||||
QString netctlAutoCommand = QString(NETCTLAUTO_PATH);
|
||||
/**
|
||||
* @brief netctl-auto service name. Default is "netctl-auto"
|
||||
*/
|
||||
QString netctlAutoService = QString("netctl-auto");
|
||||
QString netctlAutoService = QString(NETCTLAUTO_SERVICE);
|
||||
/**
|
||||
* @brief path to sudo command. Default is "/usr/bin/kdesu"
|
||||
* @brief path to sudo command. Default is "kdesu"
|
||||
*/
|
||||
QString sudoCommand = QString("/usr/bin/kdesu");
|
||||
QString sudoCommand = QString(SUDO_PATH);
|
||||
/**
|
||||
* @brief path to systemctl command. Default is "/usr/bin/systemctl"
|
||||
* @brief path to systemctl command. Default is "systemctl"
|
||||
*/
|
||||
QString systemctlCommand = QString("/usr/bin/systemctl");
|
||||
QString systemctlCommand = QString(SYSTEMCTL_PATH);
|
||||
// functions
|
||||
/**
|
||||
* @brief method which calls command
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief The NetctlProfile class interacts with netctl profiles
|
||||
@ -114,9 +116,9 @@ private:
|
||||
*/
|
||||
QDir *profileDirectory = nullptr;
|
||||
/**
|
||||
* @brief path to sudo command. Default is "/usr/bin/kdesu"
|
||||
* @brief path to sudo command. Default is "kdesu"
|
||||
*/
|
||||
QString sudoCommand = QString("/usr/bin/kdesu");
|
||||
QString sudoCommand = QString(SUDO_PATH);
|
||||
};
|
||||
|
||||
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
class Netctl;
|
||||
class NetctlProfile;
|
||||
@ -184,31 +186,31 @@ private:
|
||||
/**
|
||||
* @brief path to ctrl_directory. Defaults is "/run/wpa_supplicant"
|
||||
*/
|
||||
QString ctrlDir = QString("/run/wpa_supplicant");
|
||||
QString ctrlDir = QString(CTRL_DIR);
|
||||
/**
|
||||
* @brief group which is owner of CTRL_DIR. Default is "users"
|
||||
*/
|
||||
QString ctrlGroup = QString("users");
|
||||
QString ctrlGroup = QString(CTRL_GROUP);
|
||||
/**
|
||||
* @brief wpa_supplicant PID file. $i is interface. Default is "/run/wpa_supplicant_$i.pid"
|
||||
*/
|
||||
QString pidFile = QString("/run/wpa_supplicant_$i.pid");
|
||||
QString pidFile = QString(PID_FILE);
|
||||
/**
|
||||
* @brief path to sudo command. Default is "/usr/bin/kdesu"
|
||||
* @brief path to sudo command. Default is "kdesu"
|
||||
*/
|
||||
QString sudoCommand = QString("/usr/bin/kdesu");
|
||||
QString sudoCommand = QString(SUDO_PATH);
|
||||
/**
|
||||
* @brief path to wpa_cli command. Default is "/usr/bin/wpa_cli"
|
||||
* @brief path to wpa_cli command. Default is "wpa_cli"
|
||||
*/
|
||||
QString wpaCliPath = QString("/usr/bin/wpa_cli");
|
||||
QString wpaCliPath = QString(WPACLI_PATH);
|
||||
/**
|
||||
* @brief wpa_supplicant drivers comma separated. Default is "nl80211,wext"
|
||||
*/
|
||||
QString wpaDrivers = QString("nl80211,wext");
|
||||
QString wpaDrivers = QString(WPA_DRIVERS);
|
||||
/**
|
||||
* @brief path to wpa_supplicant command. Default is "/usr/bin/wpa_supplicant"
|
||||
* @brief path to wpa_supplicant command. Default is "wpa_supplicant"
|
||||
*/
|
||||
QString wpaSupPath = QString("/usr/bin/wpa_supplicant");
|
||||
QString wpaSupPath = QString(WPASUP_PATH);
|
||||
// functions
|
||||
/**
|
||||
* @brief method which calls wpa_cli and returns its output
|
||||
|
@ -1,5 +1,10 @@
|
||||
# set files
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
||||
if (USE_QT5)
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
|
||||
else ()
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
||||
endif ()
|
||||
file (GLOB_RECURSE HEADERS *.h ${SUBPROJECT_INCLUDE_DIR}/*h
|
||||
${PROJECT_TRDPARTY_DIR}/task/*.h)
|
||||
|
||||
|
@ -45,7 +45,7 @@ Netctl::Netctl(const bool debugCmd, const QMap<QString, QString> settings)
|
||||
if (settings.contains(QString("IFACE_DIR")))
|
||||
ifaceDirectory = new QDir(settings[QString("IFACE_DIR")]);
|
||||
else
|
||||
ifaceDirectory = new QDir(QString("/sys/class/net/"));
|
||||
ifaceDirectory = new QDir(QString(IFACE_DIR));
|
||||
if (settings.contains(QString("PREFERED_IFACE")))
|
||||
mainInterface = settings[QString("PREFERED_IFACE")];
|
||||
if (settings.contains(QString("NETCTL_PATH")))
|
||||
@ -238,7 +238,6 @@ QList<netctlProfileInfo> Netctl::getProfileListFromNetctlAuto()
|
||||
profileInfo.essid = profileValues[2];
|
||||
profileInfo.interface = profileValues[3];
|
||||
profileInfo.type = profileValues[0];
|
||||
profileInfo.essid = profileValues[1];
|
||||
profileInfo.netctlAuto = true;
|
||||
fullProfilesInfo.append(profileInfo);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ NetctlProfile::NetctlProfile(const bool debugCmd, const QMap<QString, QString> s
|
||||
if (settings.contains(QString("PROFILE_DIR")))
|
||||
profileDirectory = new QDir(settings[QString("PROFILE_DIR")]);
|
||||
else
|
||||
profileDirectory = new QDir(QString("/etc/netctl/"));
|
||||
profileDirectory = new QDir(QString(PROFILE_DIR));
|
||||
if (settings.contains(QString("SUDO_PATH")))
|
||||
sudoCommand = settings[QString("SUDO_PATH")];
|
||||
if (settings.contains(QString("FORCE_SUDO")))
|
||||
|
@ -346,7 +346,13 @@ QList<netctlWifiInfo> WpaSup::scanWifi()
|
||||
rawList.removeFirst();
|
||||
QStringList names;
|
||||
|
||||
QList<netctlProfileInfo> profiles = netctlCommand->getProfileList();
|
||||
// init profile list
|
||||
QList<netctlProfileInfo> profiles;
|
||||
if (netctlCommand->isNetctlAutoRunning())
|
||||
profiles = netctlCommand->getProfileListFromNetctlAuto();
|
||||
else
|
||||
profiles = netctlCommand->getProfileList();
|
||||
// iterate by wifi output
|
||||
for (int i=0; i<rawList.count(); i++) {
|
||||
QStringList line = rawList[i].split(QChar('\t'));
|
||||
if (line.count() != 5) continue;
|
||||
|
@ -154,8 +154,8 @@ QMap<QString, QString> Netctl::readDataEngineConfiguration()
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Netctl commands"));
|
||||
configuration[QString("NETCTLCMD")] = settings.value(QString("NETCTLCMD"), QString("/usr/bin/netctl")).toString();
|
||||
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("/usr/bin/netctl-auto")).toString();
|
||||
configuration[QString("NETCTLCMD")] = settings.value(QString("NETCTLCMD"), QString("netctl")).toString();
|
||||
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("netctl-auto")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("External IP"));
|
||||
@ -836,12 +836,12 @@ void Netctl::configChanged()
|
||||
KConfigGroup cg = config();
|
||||
|
||||
autoUpdateInterval = cg.readEntry("autoUpdateInterval", 1000);
|
||||
paths[QString("gui")] = cg.readEntry("guiPath", "/usr/bin/netctl-gui");
|
||||
paths[QString("helper")] = cg.readEntry("helperPath", "/usr/bin/netctlgui-helper");
|
||||
paths[QString("netctl")] = cg.readEntry("netctlPath", "/usr/bin/netctl");
|
||||
paths[QString("netctlAuto")] = cg.readEntry("netctlAutoPath", "/usr/bin/netctl-auto");
|
||||
paths[QString("sudo")] = cg.readEntry("sudoPath", "/usr/bin/kdesu");
|
||||
paths[QString("wifi")] = cg.readEntry("wifiPath", "/usr/bin/netctl-gui -t 3");
|
||||
paths[QString("gui")] = cg.readEntry("guiPath", "netctl-gui");
|
||||
paths[QString("helper")] = cg.readEntry("helperPath", "netctlgui-helper");
|
||||
paths[QString("netctl")] = cg.readEntry("netctlPath", "netctl");
|
||||
paths[QString("netctlAuto")] = cg.readEntry("netctlAutoPath", "netctl-auto");
|
||||
paths[QString("sudo")] = cg.readEntry("sudoPath", "kdesu");
|
||||
paths[QString("wifi")] = cg.readEntry("wifiPath", "netctl-gui -t 3");
|
||||
useSudo = cg.readEntry("useSudo", true);
|
||||
useWifi = cg.readEntry("useWifi", false);
|
||||
useHelper = cg.readEntry("useHelper", true);
|
||||
|
@ -11,22 +11,22 @@
|
||||
<default>100</default>
|
||||
</entry>
|
||||
<entry name="guiPath" type="string">
|
||||
<default>/usr/bin/netctl-gui</default>
|
||||
<default>netctl-gui</default>
|
||||
</entry>
|
||||
<entry name="helperPath" type="string">
|
||||
<default>/usr/bin/netctlgui-helper</default>
|
||||
<default>netctlgui-helper</default>
|
||||
</entry>
|
||||
<entry name="netctlPath" type="string">
|
||||
<default>/usr/bin/netctl</default>
|
||||
<default>netctl</default>
|
||||
</entry>
|
||||
<entry name="netctlAutoPath" type="string">
|
||||
<default>/usr/bin/netctl-auto</default>
|
||||
<default>netctl-auto</default>
|
||||
</entry>
|
||||
<entry name="sudoPath" type="string">
|
||||
<default>/usr/bin/kdesu</default>
|
||||
<default>kdesu</default>
|
||||
</entry>
|
||||
<entry name="wifiPath" type="string">
|
||||
<default>/usr/bin/netctl-gui -t 3</default>
|
||||
<default>netctl-gui -t 3</default>
|
||||
</entry>
|
||||
<entry name="useHelper" type="bool">
|
||||
<default>true</default>
|
||||
|
@ -19,7 +19,7 @@ import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
|
||||
import org.kde.plasma.private.netctl 1.0
|
||||
import org.kde.plasma.netctl 1.0
|
||||
|
||||
|
||||
Item {
|
||||
@ -33,7 +33,7 @@ Item {
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
anchors.fill: parent
|
||||
QtControls.TabView {
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
|
@ -21,7 +21,7 @@ import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
|
||||
import org.kde.plasma.private.netctl 1.0
|
||||
import org.kde.plasma.netctl 1.0
|
||||
|
||||
|
||||
Item {
|
||||
@ -52,7 +52,7 @@ Item {
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
anchors.fill: parent
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
|
@ -21,7 +21,7 @@ import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
|
||||
import org.kde.plasma.private.netctl 1.0
|
||||
import org.kde.plasma.netctl 1.0
|
||||
|
||||
|
||||
Item {
|
||||
@ -37,7 +37,7 @@ Item {
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
anchors.fill: parent
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
|
@ -17,11 +17,12 @@
|
||||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import org.kde.plasma.private.netctl 1.0
|
||||
import org.kde.plasma.netctl 1.0
|
||||
|
||||
|
||||
Item {
|
||||
@ -75,8 +76,8 @@ Item {
|
||||
}
|
||||
|
||||
// ui
|
||||
Grid {
|
||||
id: mainGrid
|
||||
GridLayout {
|
||||
anchors.fill: parent
|
||||
columns: 2
|
||||
|
||||
Image {
|
||||
@ -126,15 +127,6 @@ Item {
|
||||
text.text = NetctlAdds.parsePattern(plasmoid.configuration.textPattern)
|
||||
Plasmoid.toolTipSubText = NetctlAdds.valueByKey("info")
|
||||
needMenuUpdate()
|
||||
// updae geometry
|
||||
text.update()
|
||||
icon.height = text.contentHeight
|
||||
icon.width = text.contentHeight
|
||||
icon.update()
|
||||
height = text.contentHeight
|
||||
width = icon.paintedWidth + text.contentWidth
|
||||
update()
|
||||
|
||||
}
|
||||
|
||||
onNeedMenuUpdate: {
|
||||
|
@ -21,7 +21,7 @@ import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
|
||||
import org.kde.plasma.private.netctl 1.0
|
||||
import org.kde.plasma.netctl 1.0
|
||||
|
||||
|
||||
Item {
|
||||
@ -48,7 +48,7 @@ Item {
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
anchors.fill: parent
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
|
22
sources/plasmoid-kf5/package/metadata.desktop
Normal file
22
sources/plasmoid-kf5/package/metadata.desktop
Normal file
@ -0,0 +1,22 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=Netctl
|
||||
Comment=Plasmoid for netctl
|
||||
Type=Service
|
||||
Icon=netctl-gui-widget
|
||||
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-Plasma-NotificationArea=true
|
||||
X-Plasma-RemoteLocation=
|
||||
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=org.kde.plasma.netctl
|
||||
X-KDE-PluginInfo-Version=1.4.7
|
||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/netctl-gui
|
||||
X-KDE-PluginInfo-Category=Network
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPLv3
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
@ -1,4 +1,5 @@
|
||||
set (PLUGIN_NAME netctlplugin)
|
||||
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.netctl\")
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Qml_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||
@ -20,12 +21,13 @@ include_directories (${CMAKE_SOURCE_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE})
|
||||
|
||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE ${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp
|
||||
*.cpp)
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/netctl)
|
||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/netctl)
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/netctl)
|
||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/netctl)
|
||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||
|
@ -32,7 +32,7 @@ static QObject *netctl_singletontype_provider(QQmlEngine *engine, QJSEngine *scr
|
||||
|
||||
void NetctlPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.netctl"));
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.netctl"));
|
||||
|
||||
qmlRegisterSingletonType<NetctlAdds>(uri, 1, 0, "NetctlAdds", netctl_singletontype_provider);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <pdebug/pdebug-time.h>
|
||||
|
||||
#include "netctladds.h"
|
||||
#include "version.h"
|
||||
@ -35,10 +36,13 @@
|
||||
NetctlAdds::NetctlAdds(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
qInstallMessageHandler(debugString);
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
debug = (debugEnv == QString("yes"));
|
||||
|
||||
connect(this, SIGNAL(needToNotify(bool)), this, SLOT(notifyAboutStatusChanging(bool)));
|
||||
}
|
||||
|
||||
|
||||
@ -48,6 +52,18 @@ NetctlAdds::~NetctlAdds()
|
||||
}
|
||||
|
||||
|
||||
void NetctlAdds::notifyAboutStatusChanging(const bool currentStatus)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Status" << currentStatus;
|
||||
|
||||
if (currentStatus)
|
||||
return NetctlAdds::sendNotification(QString("Info"), i18n("Network status has been changed to active"));
|
||||
else
|
||||
return NetctlAdds::sendNotification(QString("Info"), i18n("Network status has been changed to inactive"));
|
||||
}
|
||||
|
||||
|
||||
QList<QVariant> NetctlAdds::sendDBusRequest(const QString cmd, const QList<QVariant> args)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -148,7 +164,7 @@ void NetctlAdds::runCmd(const QString cmd)
|
||||
}
|
||||
|
||||
|
||||
void NetctlAdds::setDataBySource(const QString sourceName, const QMap<QString, QVariant> data)
|
||||
void NetctlAdds::setDataBySource(const QString sourceName, const QVariantMap data)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName;
|
||||
@ -156,19 +172,26 @@ void NetctlAdds::setDataBySource(const QString sourceName, const QMap<QString, Q
|
||||
|
||||
bool needUpdate = (values[sourceName] != data[QString("value")].toString());
|
||||
values[sourceName] = data[QString("value")].toString();
|
||||
if ((needUpdate) && (sourceName == QString("active"))) {
|
||||
if (values[sourceName] == QString("true"))
|
||||
sendNotification(QString("Info"), i18n("Network status has been changed to active"));
|
||||
else
|
||||
sendNotification(QString("Info"), i18n("Network status has been changed to inactive"));
|
||||
}
|
||||
|
||||
if (needUpdate) emit(needToBeUpdated());
|
||||
if (needUpdate) {
|
||||
emit(needToBeUpdated());
|
||||
if (sourceName == QString("active"))
|
||||
emit(needToNotify(values[QString("active")] == QString("true")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NetctlAdds::sendNotification(const QString eventId, const QString message)
|
||||
{
|
||||
// since it is a static method we need to identify is debug enabled again
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
bool debugLocal = (debugEnv == QString("yes"));
|
||||
|
||||
if (debugLocal) qDebug() << PDEBUG;
|
||||
if (debugLocal) qDebug() << PDEBUG << ":" << "Event" << eventId;
|
||||
if (debugLocal) qDebug() << PDEBUG << ":" << "Message" << message;
|
||||
|
||||
KNotification *notification = KNotification::event(eventId, QString("Netctl ::: %1").arg(eventId), message);
|
||||
notification->setComponentName(QString("plasma-applet-org.kde.plasma.netctl"));
|
||||
}
|
||||
@ -310,19 +333,19 @@ void NetctlAdds::switchToProfileSlot(const bool useHelper, const QString cmd)
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QVariant> NetctlAdds::readDataEngineConfiguration()
|
||||
QVariantMap NetctlAdds::readDataEngineConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QMap<QString, QVariant> configuration;
|
||||
QVariantMap configuration;
|
||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-netctl.conf"));
|
||||
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Netctl commands"));
|
||||
configuration[QString("NETCTLCMD")] = settings.value(QString("NETCTLCMD"), QString("/usr/bin/netctl"));
|
||||
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("/usr/bin/netctl-auto"));
|
||||
configuration[QString("NETCTLCMD")] = settings.value(QString("NETCTLCMD"), QString("netctl"));
|
||||
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("netctl-auto"));
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("External IP"));
|
||||
@ -336,7 +359,7 @@ QMap<QString, QVariant> NetctlAdds::readDataEngineConfiguration()
|
||||
}
|
||||
|
||||
|
||||
void NetctlAdds::writeDataEngineConfiguration(const QMap<QString, QVariant> configuration)
|
||||
void NetctlAdds::writeDataEngineConfiguration(const QVariantMap configuration)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
|
@ -37,33 +37,37 @@ public:
|
||||
Q_INVOKABLE bool isDebugEnabled();
|
||||
Q_INVOKABLE QString parsePattern(const QString pattern);
|
||||
Q_INVOKABLE void runCmd(const QString cmd);
|
||||
Q_INVOKABLE void setDataBySource(const QString sourceName, const QMap<QString, QVariant> data);
|
||||
Q_INVOKABLE void setDataBySource(const QString sourceName, const QVariantMap data);
|
||||
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message);
|
||||
Q_INVOKABLE QString valueByKey(const QString key);
|
||||
// context menu
|
||||
Q_INVOKABLE void enableProfileSlot(const bool useHelper = true,
|
||||
const QString cmd = QString("/usr/bin/netctl"),
|
||||
const QString cmd = QString("netctl"),
|
||||
const QString sudoCmd = QString(""));
|
||||
Q_INVOKABLE void restartProfileSlot(const bool useHelper = true,
|
||||
const QString cmd = QString("/usr/bin/netctl"),
|
||||
const QString cmd = QString("netctl"),
|
||||
const QString sudoCmd = QString(""));
|
||||
Q_INVOKABLE void startProfileSlot(const bool useHelper = true,
|
||||
const QString cmd = QString("/usr/bin/netctl"),
|
||||
const QString cmd = QString("netctl"),
|
||||
const QString sudoCmd = QString(""));
|
||||
Q_INVOKABLE void stopProfileSlot(const bool useHelper = true,
|
||||
const QString cmd = QString("/usr/bin/netctl"),
|
||||
const QString cmd = QString("netctl"),
|
||||
const QString sudoCmd = QString(""));
|
||||
Q_INVOKABLE void stopAllProfilesSlot(const bool useHelper = true,
|
||||
const QString cmd = QString("/usr/bin/netctl"),
|
||||
const QString cmd = QString("netctl"),
|
||||
const QString sudoCmd = QString(""));
|
||||
Q_INVOKABLE void switchToProfileSlot(const bool useHelper = true,
|
||||
const QString cmd = QString("/usr/bin/netctl-auto"));
|
||||
const QString cmd = QString("netctl-auto"));
|
||||
// dataengine
|
||||
Q_INVOKABLE QMap<QString, QVariant> readDataEngineConfiguration();
|
||||
Q_INVOKABLE void writeDataEngineConfiguration(const QMap<QString, QVariant> configuration);
|
||||
Q_INVOKABLE QVariantMap readDataEngineConfiguration();
|
||||
Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration);
|
||||
|
||||
signals:
|
||||
void needToBeUpdated();
|
||||
void needToNotify(const bool currentStatus);
|
||||
|
||||
private slots:
|
||||
void notifyAboutStatusChanging(const bool currentStatus);
|
||||
|
||||
private:
|
||||
bool debug = false;
|
||||
|
@ -1,3 +1,3 @@
|
||||
module org.kde.plasma.private.netctl
|
||||
module org.kde.plasma.netctl
|
||||
|
||||
plugin netctlplugin
|
||||
|
@ -2285,6 +2285,14 @@ Should be according to standards</translation>
|
||||
<source>External editor</source>
|
||||
<translation>External editor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Main tab autoupdate, sec</source>
|
||||
<translation>Main tab autoupdate, sec</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>WiFi tab autoupdate, sec</source>
|
||||
<translation>WiFi tab autoupdate, sec</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TrayIcon</name>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -2284,6 +2284,14 @@ Should be according to standards</source>
|
||||
<source>External editor</source>
|
||||
<translation>Внешний редактор</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Main tab autoupdate, sec</source>
|
||||
<translation>Интервал обновления основной вкладки, сек</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>WiFi tab autoupdate, sec</source>
|
||||
<translation>Интервал обновления WiFi вкладки, сек</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TrayIcon</name>
|
||||
|
@ -52,4 +52,40 @@
|
||||
#define DBUS_INTERFACE_PATH "/interface"
|
||||
#define DBUS_LIB_PATH "/netctl"
|
||||
|
||||
// defaul configuration
|
||||
// [Common] section
|
||||
#define LANGUAGE "@CFG_LANGUAGE@"
|
||||
#define MAINUPDATE "@CFG_MAINUPDATE@"
|
||||
#define WIFIUPDATE "@CFG_WIFIUPDATE@"
|
||||
#define SYSTRAY "@CFG_SYSTRAY@"
|
||||
#define CLOSETOTRAY "@CFG_CLOSETOTRAY@"
|
||||
#define STARTTOTRAY "@CFG_STARTTOTRAY@"
|
||||
#define SKIPCOMPONENTS "@CFG_SKIPCOMPONENTS@"
|
||||
// [Helper] section
|
||||
#define USE_HELPER "@CFG_USE_HELPER@"
|
||||
#define FORCE_SUDO "@CFG_FORCE_SUDO@"
|
||||
#define CLOSE_HELPER "@CFG_CLOSE_HELPER@"
|
||||
#define HELPER_PATH "@CFG_HELPER_PATH@"
|
||||
#define HELPER_SERVICE "@CFG_HELPER_SERVICE@"
|
||||
// [netctl] section
|
||||
#define SYSTEMCTL_PATH "@CFG_SYSTEMCTL_PATH@"
|
||||
#define NETCTL_PATH "@CFG_NETCTL_PATH@"
|
||||
#define NETCTLAUTO_PATH "@CFG_NETCTLAUTO_PATH@"
|
||||
#define NETCTLAUTO_SERVICE "@CFG_NETCTLAUTO_SERVICE@"
|
||||
#define PROFILE_DIR "@CFG_PROFILE_DIR@"
|
||||
// [sudo] section
|
||||
#define SUDO_PATH "@CFG_SUDO_PATH@"
|
||||
// [wpa_supplicant] section
|
||||
#define WPASUP_PATH "@CFG_WPASUP_PATH@"
|
||||
#define WPACLI_PATH "@CFG_WPACLI_PATH@"
|
||||
#define PID_FILE "@CFG_PID_FILE@"
|
||||
#define WPA_DRIVERS "@CFG_WPA_DRIVERS@"
|
||||
#define CTRL_DIR "@CFG_CTRL_DIR@"
|
||||
#define CTRL_GROUP "@CFG_CTRL_GROUP@"
|
||||
// [Other] section
|
||||
#define EDITOR_PATH "@CFG_EDITOR_PATH@"
|
||||
#define IFACE_DIR "@CFG_IFACE_DIR@"
|
||||
#define RFKILL_DIR "@CFG_RFKILL_DIR@"
|
||||
#define PREFERED_IFACE "@CFG_PREFERED_IFACE@"
|
||||
|
||||
#endif /* VERSION_H */
|
||||
|
Reference in New Issue
Block a user