mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-08-11 20:09:57 +00:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
aed09bf798 | |||
d299e7d9a1 | |||
cf7b013726 | |||
b65ba2ebe2 | |||
69f6a3135b | |||
7dc1a5eda3 | |||
168a270c98 | |||
c3aa3f0c8f | |||
e26da85b5f |
19
CHANGELOG
19
CHANGELOG
@ -1,3 +1,22 @@
|
|||||||
|
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
|
Ver.1.4.4
|
||||||
---------
|
---------
|
||||||
* dataengine
|
* dataengine
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
pkgbase=netctl-gui
|
pkgbase=netctl-gui
|
||||||
pkgname=('libnetctlgui' 'netctlgui-helper' 'netctl-gui'
|
pkgname=('libnetctlgui' 'netctlgui-helper' 'netctl-gui'
|
||||||
'plasma5-applet-netctl-gui')
|
'plasma5-applet-netctl-gui')
|
||||||
pkgver=1.4.4
|
pkgver=1.4.6
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Qt4/Qt5 GUI for netctl. Also provides a widget for KDE"
|
pkgdesc="Qt4/Qt5 GUI for netctl. Also provides a widget for KDE"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
@ -11,7 +11,7 @@ url="http://arcanis.name/projects/netctl-gui"
|
|||||||
license=('GPL3')
|
license=('GPL3')
|
||||||
makedepends=('cmake' 'extra-cmake-modules' 'plasma-framework' 'qt5-tools')
|
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")
|
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgbase}-${pkgver}-src.tar.xz")
|
||||||
md5sums=('ea5eb54bf0ad29f392c8fe6e5ea2585e')
|
md5sums=('aed674e4c465d849c2044f9464c2671c')
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
rm -rf "${srcdir}/build-"{plasmoid,qt5}
|
rm -rf "${srcdir}/build-"{plasmoid,qt5}
|
||||||
|
@ -4,7 +4,7 @@ pkgbase=netctl-gui-qt4
|
|||||||
_pkgbase=netctl-gui
|
_pkgbase=netctl-gui
|
||||||
pkgname=('libnetctlgui-qt4' 'netctlgui-helper-qt4' 'netctl-gui-qt4'
|
pkgname=('libnetctlgui-qt4' 'netctlgui-helper-qt4' 'netctl-gui-qt4'
|
||||||
'kdeplasma-applets-netctl-gui')
|
'kdeplasma-applets-netctl-gui')
|
||||||
pkgver=1.4.4
|
pkgver=1.4.6
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Qt4 GUI for netctl. Also provides a widget for KDE4"
|
pkgdesc="Qt4 GUI for netctl. Also provides a widget for KDE4"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
@ -12,7 +12,7 @@ url="http://arcanis.name/projects/netctl-gui"
|
|||||||
license=('GPL3')
|
license=('GPL3')
|
||||||
makedepends=('automoc4' 'cmake' 'kdelibs')
|
makedepends=('automoc4' 'cmake' 'kdelibs')
|
||||||
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${_pkgbase}-${pkgver}-src.tar.xz")
|
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${_pkgbase}-${pkgver}-src.tar.xz")
|
||||||
md5sums=('ea5eb54bf0ad29f392c8fe6e5ea2585e')
|
md5sums=('aed674e4c465d849c2044f9464c2671c')
|
||||||
|
|
||||||
|
|
||||||
prepare() {
|
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]
|
[CMake][CMake Build Directory 0]
|
||||||
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
|
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
|
||||||
Build Type=Release
|
Build Type=Debug
|
||||||
CMake Binary=file:///usr/bin/cmake
|
CMake Binary=file:///usr/bin/cmake
|
||||||
Environment Profile=
|
Environment Profile=
|
||||||
Extra Arguments=
|
Extra Arguments=
|
||||||
|
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_LICENSE "GPLv3")
|
||||||
set (PROJECT_VERSION_MAJOR 1)
|
set (PROJECT_VERSION_MAJOR 1)
|
||||||
set (PROJECT_VERSION_MINOR 4)
|
set (PROJECT_VERSION_MINOR 4)
|
||||||
set (PROJECT_VERSION_PATCH 4)
|
set (PROJECT_VERSION_PATCH 6)
|
||||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
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_DATE "%Y-%m-%d %H:%M" UTC)
|
||||||
string (TIMESTAMP CURRENT_YEAR "%Y")
|
string (TIMESTAMP CURRENT_YEAR "%Y")
|
||||||
|
@ -39,7 +39,12 @@ include_directories (${CMAKE_SOURCE_DIR}
|
|||||||
set (PLUGIN_NAME ${SUBPROJECT})
|
set (PLUGIN_NAME ${SUBPROJECT})
|
||||||
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||||
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
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)
|
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||||
file (GLOB SUBPROJECT_CONF *.conf)
|
file (GLOB SUBPROJECT_CONF *.conf)
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
#else
|
#else
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
#include <pdebug/pdebug-time.h>
|
||||||
#endif /* BUILD_KDE4 */
|
#endif /* BUILD_KDE4 */
|
||||||
|
|
||||||
|
|
||||||
@ -44,6 +45,9 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(args)
|
Q_UNUSED(args)
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
qInstallMessageHandler(debugString);
|
||||||
|
#endif /* QT_VERSION >= 0x050000 */
|
||||||
// debug
|
// debug
|
||||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||||
@ -89,10 +93,9 @@ QString Netctl::getCmdOutput(const QString cmd)
|
|||||||
|
|
||||||
TaskResult process = runTask(cmd);
|
TaskResult process = runTask(cmd);
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
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);
|
QSettings settings(fileName, QSettings::IniFormat);
|
||||||
|
|
||||||
settings.beginGroup(QString("Netctl commands"));
|
settings.beginGroup(QString("Netctl commands"));
|
||||||
configuration[QString("NETCTLCMD")] = settings.value(QString("NETCTLCMD"), QString("/usr/bin/netctl")).toString();
|
configuration[QString("NETCTLCMD")] = settings.value(QString("NETCTLCMD"), QString("/usr/bin/netctl"));
|
||||||
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("/usr/bin/netctl-auto")).toString();
|
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("/usr/bin/netctl-auto"));
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(QString("External IP"));
|
settings.beginGroup(QString("External IP"));
|
||||||
configuration[QString("EXTIP4")] = settings.value(QString("EXTIP4"), QString("false")).toString();
|
configuration[QString("EXTIP4")] = settings.value(QString("EXTIP4"), QString("false"));
|
||||||
configuration[QString("EXTIP4CMD")] = settings.value(QString("EXTIP4CMD"), QString("curl ip4.telize.com")).toString();
|
configuration[QString("EXTIP4CMD")] = settings.value(QString("EXTIP4CMD"), QString("curl ip4.telize.com"));
|
||||||
configuration[QString("EXTIP6")] = settings.value(QString("EXTIP6"), QString("false")).toString();
|
configuration[QString("EXTIP6")] = settings.value(QString("EXTIP6"), QString("false"));
|
||||||
configuration[QString("EXTIP6CMD")] = settings.value(QString("EXTIP6CMD"), QString("curl ip6.telize.com")).toString();
|
configuration[QString("EXTIP6CMD")] = settings.value(QString("EXTIP6CMD"), QString("curl ip6.telize.com"));
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,10 +140,7 @@ QString Netctl::getExtIp(const QString cmd)
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||||
|
|
||||||
// test network connection
|
return getCmdOutput(cmd);
|
||||||
if (!isNetworkActive()) return QString("N\\A");
|
|
||||||
|
|
||||||
return getCmdOutput(cmd).trimmed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -198,9 +198,9 @@ QStringList Netctl::getProfileList(const QString cmdNetctl, const QString cmdNet
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
netctlAutoStatus = true;
|
netctlAutoStatus = true;
|
||||||
QString output = getCmdOutput(QString("%1 list").arg(cmdNetctlAuto)).trimmed();
|
QString output = getCmdOutput(QString("%1 list").arg(cmdNetctlAuto));
|
||||||
if (output.isEmpty()) {
|
if (output.isEmpty()) {
|
||||||
output = getCmdOutput(QString("%1 list").arg(cmdNetctl)).trimmed();
|
output = getCmdOutput(QString("%1 list").arg(cmdNetctl));
|
||||||
netctlAutoStatus = false;
|
netctlAutoStatus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,14 +208,10 @@ QStringList Netctl::getProfileList(const QString cmdNetctl, const QString cmdNet
|
|||||||
QStringList currentProfiles;
|
QStringList currentProfiles;
|
||||||
QStringList profileList = output.split(QChar('\n'));
|
QStringList profileList = output.split(QChar('\n'));
|
||||||
for (int i=0; i<profileList.count(); i++) {
|
for (int i=0; i<profileList.count(); i++) {
|
||||||
if (profileList[i][0] != QChar('*')) continue;
|
bool isActive = (profileList[i][0] == QChar('*'));
|
||||||
currentProfiles.append(profileList[i]);
|
|
||||||
}
|
|
||||||
// remove first symbols
|
|
||||||
for (int i=0; i<profileList.count(); i++)
|
|
||||||
profileList[i].remove(0, 2);
|
profileList[i].remove(0, 2);
|
||||||
for (int i=0; i<currentProfiles.count(); i++)
|
if (isActive) currentProfiles.append(profileList[i]);
|
||||||
currentProfiles[i].remove(0, 2);
|
}
|
||||||
|
|
||||||
// return profiles
|
// return profiles
|
||||||
currentProfile = currentProfiles;
|
currentProfile = currentProfiles;
|
||||||
@ -237,11 +233,8 @@ QStringList Netctl::getProfileStringStatus(const QString cmdNetctl)
|
|||||||
for (int i=0; i<currentProfile.count(); i++) {
|
for (int i=0; i<currentProfile.count(); i++) {
|
||||||
TaskResult process = runTask(QString("%1 is-enabled %2").arg(cmdNetctl).arg(currentProfile[i]));
|
TaskResult process = runTask(QString("%1 is-enabled %2").arg(cmdNetctl).arg(currentProfile[i]));
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
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;
|
status.append(process.exitCode == 0 ? QString("enabled") : QString("static"));
|
||||||
status.append(QString("static"));
|
|
||||||
} else
|
|
||||||
status.append(QString("enabled"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@ -258,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)
|
bool Netctl::updateSourceEvent(const QString &source)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -282,11 +262,11 @@ bool Netctl::updateSourceEvent(const QString &source)
|
|||||||
} else if (source == QString("current")) {
|
} else if (source == QString("current")) {
|
||||||
value = currentProfile.join(QChar('|'));
|
value = currentProfile.join(QChar('|'));
|
||||||
} else if (source == QString("extip4")) {
|
} else if (source == QString("extip4")) {
|
||||||
if (configuration[QString("EXTIP4")] == QString("true"))
|
if (configuration[QString("EXTIP4")].toString() == QString("true"))
|
||||||
value = getExtIp(configuration[QString("EXTIP4CMD")]);
|
value = getExtIp(configuration[QString("EXTIP4CMD")].toString());
|
||||||
} else if (source == QString("extip6")) {
|
} else if (source == QString("extip6")) {
|
||||||
if (configuration[QString("EXTIP6")] == QString("true"))
|
if (configuration[QString("EXTIP6")].toString() == QString("true"))
|
||||||
value = getExtIp(configuration[QString("EXTIP6CMD")]);
|
value = getExtIp(configuration[QString("EXTIP6CMD")].toString());
|
||||||
} else if (source == QString("info")) {
|
} else if (source == QString("info")) {
|
||||||
value = getInfo(currentProfile, currentStatus);
|
value = getInfo(currentProfile, currentStatus);
|
||||||
} else if (source == QString("interfaces")) {
|
} else if (source == QString("interfaces")) {
|
||||||
@ -298,10 +278,10 @@ bool Netctl::updateSourceEvent(const QString &source)
|
|||||||
} else if (source == QString("netctlauto")) {
|
} else if (source == QString("netctlauto")) {
|
||||||
value = netctlAutoStatus ? QString("true") : QString("false");
|
value = netctlAutoStatus ? QString("true") : QString("false");
|
||||||
} else if (source == QString("profiles")) {
|
} else if (source == QString("profiles")) {
|
||||||
value = getProfileList(configuration[QString("NETCTLCMD")],
|
value = getProfileList(configuration[QString("NETCTLCMD")].toString(),
|
||||||
configuration[QString("NETCTLAUTOCMD")]).join(QChar(','));
|
configuration[QString("NETCTLAUTOCMD")].toString()).join(QChar(','));
|
||||||
} else if (source == QString("status")) {
|
} else if (source == QString("status")) {
|
||||||
currentStatus = getProfileStringStatus(configuration[QString("NETCTLCMD")]);
|
currentStatus = getProfileStringStatus(configuration[QString("NETCTLCMD")].toString());
|
||||||
value = currentStatus.join(QChar('|'));
|
value = currentStatus.join(QChar('|'));
|
||||||
}
|
}
|
||||||
setData(source, QString("value"), value);
|
setData(source, QString("value"), value);
|
||||||
|
@ -35,7 +35,6 @@ public:
|
|||||||
QString getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol);
|
QString getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol);
|
||||||
QStringList getProfileList(const QString cmdNetctl, const QString cmdNetctlAuto);
|
QStringList getProfileList(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||||
QStringList getProfileStringStatus(const QString cmdNetctl);
|
QStringList getProfileStringStatus(const QString cmdNetctl);
|
||||||
bool isNetworkActive();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void initSources();
|
void initSources();
|
||||||
@ -46,13 +45,14 @@ protected:
|
|||||||
QStringList sources() const;
|
QStringList sources() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool isNetctlCheckRunning = false;
|
||||||
bool netctlAutoStatus = false;
|
bool netctlAutoStatus = false;
|
||||||
bool status = false;
|
bool status = false;
|
||||||
QStringList currentProfile;
|
QStringList currentProfile;
|
||||||
QStringList currentStatus;
|
QStringList currentStatus;
|
||||||
// configuration
|
// configuration
|
||||||
bool debug;
|
bool debug;
|
||||||
QMap<QString, QString> configuration;
|
QVariantMap configuration;
|
||||||
QString getCmdOutput(const QString cmd);
|
QString getCmdOutput(const QString cmd);
|
||||||
void readConfiguration();
|
void readConfiguration();
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
# set files
|
# set files
|
||||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
if (USE_QT5)
|
||||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||||
${PROJECT_TRDPARTY_DIR}/listmap/*.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
|
file (GLOB_RECURSE HEADERS *.h ${PROJECT_TRDPARTY_DIR}/task/*.h
|
||||||
${PROJECT_TRDPARTY_DIR}/language/*.h)
|
${PROJECT_TRDPARTY_DIR}/language/*.h)
|
||||||
file (GLOB_RECURSE FORMS *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui)
|
file (GLOB_RECURSE FORMS *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui)
|
||||||
|
@ -32,6 +32,10 @@
|
|||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
#include <pdebug/pdebug-time.h>
|
||||||
|
#endif /* QT_VERSION >= 0x050000 */
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -62,7 +66,7 @@ unsigned int getUidFromSession(const int type = 0)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QMap<QString, QVariant> args = getArgs();
|
QVariantMap args = getArgs();
|
||||||
// reading
|
// reading
|
||||||
for (int i=1; i<argc; i++) {
|
for (int i=1; i<argc; i++) {
|
||||||
if (QString(argv[i]) == QString("--detached")) {
|
if (QString(argv[i]) == QString("--detached")) {
|
||||||
@ -157,6 +161,9 @@ int main(int argc, char *argv[])
|
|||||||
// detach from console
|
// detach from console
|
||||||
if (args[QString("detached")].toBool())
|
if (args[QString("detached")].toBool())
|
||||||
daemon(0, 0);
|
daemon(0, 0);
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
qInstallMessageHandler(debugString);
|
||||||
|
#endif
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
QApplication::setQuitOnLastWindowClosed(false);
|
QApplication::setQuitOnLastWindowClosed(false);
|
||||||
// reread translations according to flags
|
// reread translations according to flags
|
||||||
|
@ -52,6 +52,10 @@ MainWidget::MainWidget(QWidget *parent, const QMap<QString, QString> settings, c
|
|||||||
actionMenu->addAction(ui->actionEnable);
|
actionMenu->addAction(ui->actionEnable);
|
||||||
ui->actionStart->setMenu(actionMenu);
|
ui->actionStart->setMenu(actionMenu);
|
||||||
|
|
||||||
|
// auto update
|
||||||
|
timer.setSingleShot(true);
|
||||||
|
timer.setInterval(configuration[QString("MAINUPDATE")].toInt() * 1000);
|
||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +96,8 @@ void MainWidget::update()
|
|||||||
|
|
||||||
updateMainTab();
|
updateMainTab();
|
||||||
updateMenuMain();
|
updateMenuMain();
|
||||||
|
|
||||||
|
if (timer.interval() != 0) return timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -411,6 +417,7 @@ void MainWidget::createActions()
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
// menu actions
|
// menu actions
|
||||||
|
connect(&timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||||
connect(ui->actionEnable, SIGNAL(triggered(bool)), this, SLOT(mainTabEnableProfile()));
|
connect(ui->actionEnable, SIGNAL(triggered(bool)), this, SLOT(mainTabEnableProfile()));
|
||||||
connect(ui->actionEdit, SIGNAL(triggered(bool)), this, SLOT(mainTabEditProfile()));
|
connect(ui->actionEdit, SIGNAL(triggered(bool)), this, SLOT(mainTabEditProfile()));
|
||||||
connect(ui->actionRefresh, SIGNAL(triggered(bool)), this, SLOT(updateMainTab()));
|
connect(ui->actionRefresh, SIGNAL(triggered(bool)), this, SLOT(updateMainTab()));
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QTableWidgetItem>
|
#include <QTableWidgetItem>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include <netctlgui/netctlgui.h>
|
#include <netctlgui/netctlgui.h>
|
||||||
|
|
||||||
@ -68,6 +69,7 @@ private:
|
|||||||
void createActions();
|
void createActions();
|
||||||
QString configPath;
|
QString configPath;
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
|
QTimer timer;
|
||||||
bool useHelper = true;
|
bool useHelper = true;
|
||||||
// configuration
|
// configuration
|
||||||
QMap<QString, QString> configuration;
|
QMap<QString, QString> configuration;
|
||||||
|
@ -51,10 +51,8 @@
|
|||||||
#include "wifimenuwidget.h"
|
#include "wifimenuwidget.h"
|
||||||
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent,
|
MainWindow::MainWindow(QWidget *parent, const QVariantMap args,
|
||||||
const QMap<QString, QVariant> args,
|
QTranslator *qtAppTranslator, QTranslator *appTranslator)
|
||||||
QTranslator *qtAppTranslator,
|
|
||||||
QTranslator *appTranslator)
|
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent),
|
||||||
configPath(args[QString("config")].toString()),
|
configPath(args[QString("config")].toString()),
|
||||||
debug(args[QString("debug")].toBool()),
|
debug(args[QString("debug")].toBool()),
|
||||||
@ -369,7 +367,7 @@ void MainWindow::storeToolBars()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::updateConfiguration(const QMap<QString, QVariant> args)
|
void MainWindow::updateConfiguration(const QVariantMap args)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class MainWindow : public QMainWindow
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget *parent = 0,
|
explicit MainWindow(QWidget *parent = 0,
|
||||||
const QMap<QString, QVariant> args = QMap<QString, QVariant>(),
|
const QVariantMap args = QVariantMap(),
|
||||||
QTranslator *qtAppTranslator = 0,
|
QTranslator *qtAppTranslator = 0,
|
||||||
QTranslator *appTranslator = 0);
|
QTranslator *appTranslator = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
@ -82,7 +82,7 @@ public slots:
|
|||||||
void setTab(int tab);
|
void setTab(int tab);
|
||||||
void showMessage(const bool status);
|
void showMessage(const bool status);
|
||||||
void storeToolBars();
|
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);
|
void updateToolBarState(const Qt::ToolBarArea area = Qt::TopToolBarArea);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -29,9 +29,9 @@ QString errorMessage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> getArgs()
|
QVariantMap getArgs()
|
||||||
{
|
{
|
||||||
QMap<QString, QVariant> args;
|
QVariantMap args;
|
||||||
// windows
|
// windows
|
||||||
args[QString("detached")] = false;
|
args[QString("detached")] = false;
|
||||||
args[QString("minimized")] = static_cast<int>(0);
|
args[QString("minimized")] = static_cast<int>(0);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
|
|
||||||
QString errorMessage();
|
QString errorMessage();
|
||||||
QMap<QString, QVariant> getArgs();
|
QVariantMap getArgs();
|
||||||
QString helpMessage();
|
QString helpMessage();
|
||||||
QString infoMessage();
|
QString infoMessage();
|
||||||
QString versionMessage();
|
QString versionMessage();
|
||||||
|
@ -425,7 +425,9 @@ void NewProfileWidget::profileTabOpenInEditor()
|
|||||||
return mainWindow->emitNeedToBeConfigured();
|
return mainWindow->emitNeedToBeConfigured();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString directory = QDir(configuration[QString("PROFILE_DIR")]).absolutePath();
|
||||||
QString profile = QFileInfo(ui->comboBox_profile->currentText()).fileName();
|
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")])
|
QString cmd = QString("%1 %2 %3").arg(configuration[QString("SUDO_PATH")])
|
||||||
.arg(configuration[QString("EDITOR_PATH")])
|
.arg(configuration[QString("EDITOR_PATH")])
|
||||||
.arg(profile);
|
.arg(profile);
|
||||||
|
@ -247,6 +247,8 @@ void SettingsWindow::saveSettings()
|
|||||||
|
|
||||||
settings.beginGroup(QString("Common"));
|
settings.beginGroup(QString("Common"));
|
||||||
settings.setValue(QString("LANGUAGE"), config[QString("LANGUAGE")]);
|
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("SYSTRAY"), config[QString("SYSTRAY")]);
|
||||||
settings.setValue(QString("CLOSETOTRAY"), config[QString("CLOSETOTRAY")]);
|
settings.setValue(QString("CLOSETOTRAY"), config[QString("CLOSETOTRAY")]);
|
||||||
settings.setValue(QString("STARTTOTRAY"), config[QString("STARTTOTRAY")]);
|
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("HELPER_SERVICE")] = ui->lineEdit_helperService->text();
|
||||||
config[QString("IFACE_DIR")] = ui->lineEdit_interfacesDir->text();
|
config[QString("IFACE_DIR")] = ui->lineEdit_interfacesDir->text();
|
||||||
config[QString("LANGUAGE")] = ui->comboBox_language->currentText();
|
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("MAIN_TOOLBAR")] = QString::number(indexToToolBarPosition(ui->comboBox_mainToolbar->currentIndex()));
|
||||||
config[QString("NETCTL_PATH")] = ui->lineEdit_netctlPath->text();
|
config[QString("NETCTL_PATH")] = ui->lineEdit_netctlPath->text();
|
||||||
config[QString("NETCTL_TOOLBAR")] = QString::number(indexToToolBarPosition(ui->comboBox_netctlToolbar->currentIndex()));
|
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");
|
config[QString("USE_HELPER")] = QString("true");
|
||||||
else
|
else
|
||||||
config[QString("USE_HELPER")] = QString("false");
|
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("WIFI_TOOLBAR")] = QString::number(indexToToolBarPosition(ui->comboBox_wifiToolbar->currentIndex()));
|
||||||
config[QString("WPACLI_PATH")] = ui->lineEdit_wpaCliPath->text();
|
config[QString("WPACLI_PATH")] = ui->lineEdit_wpaCliPath->text();
|
||||||
config[QString("WPASUP_PATH")] = ui->lineEdit_wpaSupPath->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")]);
|
ui->lineEdit_interfacesDir->setText(config[QString("IFACE_DIR")]);
|
||||||
int index = ui->comboBox_language->findText(config[QString("LANGUAGE")]);
|
int index = ui->comboBox_language->findText(config[QString("LANGUAGE")]);
|
||||||
ui->comboBox_language->setCurrentIndex(index);
|
ui->comboBox_language->setCurrentIndex(index);
|
||||||
|
ui->spinBox_mainAutoUpdate->setValue(config[QString("MAINUPDATE")].toInt());
|
||||||
index = indexByToolBarPosition(static_cast<Qt::ToolBarArea>(config[QString("MAIN_TOOLBAR")].toInt()));
|
index = indexByToolBarPosition(static_cast<Qt::ToolBarArea>(config[QString("MAIN_TOOLBAR")].toInt()));
|
||||||
ui->comboBox_mainToolbar->setCurrentIndex(index);
|
ui->comboBox_mainToolbar->setCurrentIndex(index);
|
||||||
ui->lineEdit_netctlPath->setText(config[QString("NETCTL_PATH")]);
|
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);
|
ui->checkBox_useHelper->setCheckState(Qt::Checked);
|
||||||
else
|
else
|
||||||
ui->checkBox_useHelper->setCheckState(Qt::Unchecked);
|
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()));
|
index = indexByToolBarPosition(static_cast<Qt::ToolBarArea>(config[QString("WIFI_TOOLBAR")].toInt()));
|
||||||
ui->comboBox_wifiToolbar->setCurrentIndex(index);
|
ui->comboBox_wifiToolbar->setCurrentIndex(index);
|
||||||
ui->lineEdit_wpaCliPath->setText(config[QString("WPACLI_PATH")]);
|
ui->lineEdit_wpaCliPath->setText(config[QString("WPACLI_PATH")]);
|
||||||
@ -586,6 +592,8 @@ QMap<QString, QString> SettingsWindow::getSettings(QString fileName)
|
|||||||
config[QString("LANGUAGE")] = Language::defineLanguage(fileName, QString());
|
config[QString("LANGUAGE")] = Language::defineLanguage(fileName, QString());
|
||||||
settings.beginGroup(QString("Common"));
|
settings.beginGroup(QString("Common"));
|
||||||
config[QString("LANGUAGE")] = settings.value(QString("LANGUAGE"), QString("en")).toString();
|
config[QString("LANGUAGE")] = settings.value(QString("LANGUAGE"), QString("en")).toString();
|
||||||
|
config[QString("MAINUPDATE")] = settings.value(QString("MAINUPDATE"), QString("0")).toString();
|
||||||
|
config[QString("WIFIUPDATE")] = settings.value(QString("WIFIUPDATE"), QString("0")).toString();
|
||||||
config[QString("SYSTRAY")] = settings.value(QString("SYSTRAY"), QString("true")).toString();
|
config[QString("SYSTRAY")] = settings.value(QString("SYSTRAY"), QString("true")).toString();
|
||||||
config[QString("CLOSETOTRAY")] = settings.value(QString("CLOSETOTRAY"), 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("STARTTOTRAY")] = settings.value(QString("STARTTOTRAY"), QString("false")).toString();
|
||||||
|
@ -190,6 +190,66 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_enableTray">
|
<layout class="QHBoxLayout" name="layout_enableTray">
|
||||||
<item>
|
<item>
|
||||||
@ -642,8 +702,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>436</width>
|
<width>542</width>
|
||||||
<height>173</height>
|
<height>330</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
@ -898,8 +958,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>436</width>
|
<width>542</width>
|
||||||
<height>45</height>
|
<height>330</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
@ -983,8 +1043,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>239</width>
|
<width>542</width>
|
||||||
<height>194</height>
|
<height>330</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
<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);
|
ui->tableWidget_wifi->setColumnHidden(6, true);
|
||||||
updateToolBarState(static_cast<Qt::ToolBarArea>(configuration[QString("WIFI_TOOLBAR")].toInt()));
|
updateToolBarState(static_cast<Qt::ToolBarArea>(configuration[QString("WIFI_TOOLBAR")].toInt()));
|
||||||
|
|
||||||
|
// auto update
|
||||||
|
timer.setSingleShot(true);
|
||||||
|
timer.setInterval(configuration[QString("WIFIUPDATE")].toInt() * 1000);
|
||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,6 +77,8 @@ void WiFiMenuWidget::update()
|
|||||||
|
|
||||||
updateWifiTab();
|
updateWifiTab();
|
||||||
updateMenuWifi();
|
updateMenuWifi();
|
||||||
|
|
||||||
|
if (timer.interval() != 0) return timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -430,6 +436,7 @@ void WiFiMenuWidget::createActions()
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
// menu actions
|
// menu actions
|
||||||
|
connect(&timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||||
connect(ui->actionFunc, SIGNAL(triggered(bool)), this, SLOT(wifiTabShowInfo()));
|
connect(ui->actionFunc, SIGNAL(triggered(bool)), this, SLOT(wifiTabShowInfo()));
|
||||||
connect(ui->actionRefresh, SIGNAL(triggered(bool)), this, SLOT(updateWifiTab()));
|
connect(ui->actionRefresh, SIGNAL(triggered(bool)), this, SLOT(updateWifiTab()));
|
||||||
connect(ui->actionStart, SIGNAL(triggered(bool)), this, SLOT(wifiTabStart()));
|
connect(ui->actionStart, SIGNAL(triggered(bool)), this, SLOT(wifiTabStart()));
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include <netctlgui/netctlgui.h>
|
#include <netctlgui/netctlgui.h>
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ private:
|
|||||||
void createActions();
|
void createActions();
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
bool hiddenNetwork = false;
|
bool hiddenNetwork = false;
|
||||||
|
QTimer timer;
|
||||||
bool useHelper = true;
|
bool useHelper = true;
|
||||||
// configuration
|
// configuration
|
||||||
QMap<QString, QString> configuration;
|
QMap<QString, QString> configuration;
|
||||||
|
@ -6,6 +6,12 @@
|
|||||||
[Common]
|
[Common]
|
||||||
# application language
|
# application language
|
||||||
LANGUAGE=en
|
LANGUAGE=en
|
||||||
|
# auto update interval for main tab in seconds
|
||||||
|
# 0 means there is no updates
|
||||||
|
MAINUPDATE=0
|
||||||
|
# auto update interval for wifi tab in seconds
|
||||||
|
# 0 means there is no updates
|
||||||
|
WIFIUPDATE=0
|
||||||
# create system tray icon.
|
# create system tray icon.
|
||||||
# This option is not recognized by netctlgui-helper
|
# This option is not recognized by netctlgui-helper
|
||||||
SYSTRAY=true
|
SYSTRAY=true
|
||||||
|
@ -48,6 +48,8 @@ service name. This option is not recognized by
|
|||||||
path to directory which contains interface information
|
path to directory which contains interface information
|
||||||
.IP "LANGUAGE=en"
|
.IP "LANGUAGE=en"
|
||||||
application language
|
application language
|
||||||
|
.IP "MAINUPDATE=0"
|
||||||
|
main tab autoupdate interval in seconds. 0 is disable autoupdate
|
||||||
.IP "NETCTL_PATH=/usr/bin/netctl"
|
.IP "NETCTL_PATH=/usr/bin/netctl"
|
||||||
path to
|
path to
|
||||||
.BR netctl (1)
|
.BR netctl (1)
|
||||||
@ -96,6 +98,8 @@ use
|
|||||||
.BR netctlgui-helper (1)
|
.BR netctlgui-helper (1)
|
||||||
if it is available. This option is not recognized by
|
if it is available. This option is not recognized by
|
||||||
.BR netctlgui-helper (1)
|
.BR netctlgui-helper (1)
|
||||||
|
.IP "WIFIUPDATE=0"
|
||||||
|
WiFi tab autoupdate interval in seconds. 0 is disable autoupdate
|
||||||
.IP "WPACLI_PATH=/usr/bin/wpa_cli"
|
.IP "WPACLI_PATH=/usr/bin/wpa_cli"
|
||||||
path to
|
path to
|
||||||
.BR wpa_cli (8)
|
.BR wpa_cli (8)
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
# set files
|
# set files
|
||||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
if (USE_QT5)
|
||||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||||
${PROJECT_TRDPARTY_DIR}/listmap/*.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
|
file (GLOB_RECURSE HEADERS *.h ${PROJECT_TRDPARTY_DIR}/task/*.h
|
||||||
${PROJECT_TRDPARTY_DIR}/language/*.h)
|
${PROJECT_TRDPARTY_DIR}/language/*.h)
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ QString ControlAdaptor::SecurityDocs()
|
|||||||
|
|
||||||
bool ControlAdaptor::SelfDestruct(const QString approve)
|
bool ControlAdaptor::SelfDestruct(const QString approve)
|
||||||
{
|
{
|
||||||
if (approve == QString("Yes, please")) return SelfDestruct(approve);
|
if (approve == QString("Yes please")) return SelfDestruct(approve);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,10 @@
|
|||||||
#include "netctlhelper.h"
|
#include "netctlhelper.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
#include <pdebug/pdebug-time.h>
|
||||||
|
#endif /* QT_VERSION >= 0x050000 */
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -50,7 +54,7 @@ bool existingSessionOperation(const QString operation)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QMap<QString, QVariant> args = getArgs();
|
QVariantMap args = getArgs();
|
||||||
// reading
|
// reading
|
||||||
for (int i=1; i<argc; i++) {
|
for (int i=1; i<argc; i++) {
|
||||||
if ((QString(argv[i]) == QString("-c")) || (QString(argv[i]) == QString("--config"))) {
|
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
|
#if QT_VERSION >= 0x050000
|
||||||
QCoreApplication::setSetuidAllowed(true);
|
QCoreApplication::setSetuidAllowed(true);
|
||||||
|
qInstallMessageHandler(debugString);
|
||||||
#endif
|
#endif
|
||||||
QCoreApplication a(argc, argv);
|
QCoreApplication a(argc, argv);
|
||||||
// reread translations according to flags
|
// reread translations according to flags
|
||||||
|
@ -29,9 +29,9 @@ 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("config")] = QString("%1/.config/netctl-gui.conf").arg(QDir::homePath());
|
||||||
args[QString("debug")] = false;
|
args[QString("debug")] = false;
|
||||||
args[QString("nodaemon")] = false;
|
args[QString("nodaemon")] = false;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
|
|
||||||
QString errorMessage();
|
QString errorMessage();
|
||||||
QMap<QString, QVariant> getArgs();
|
QVariantMap getArgs();
|
||||||
QString helpMessage();
|
QString helpMessage();
|
||||||
QString infoMessage();
|
QString infoMessage();
|
||||||
QString versionMessage();
|
QString versionMessage();
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
NetctlHelper::NetctlHelper(QObject *parent, QMap<QString, QVariant> args)
|
NetctlHelper::NetctlHelper(QObject *parent, QVariantMap args)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
configPath(args[QString("config")].toString()),
|
configPath(args[QString("config")].toString()),
|
||||||
debug(args[QString("debug")].toBool()),
|
debug(args[QString("debug")].toBool()),
|
||||||
|
@ -29,7 +29,7 @@ class NetctlHelper : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NetctlHelper(QObject *parent = 0,
|
explicit NetctlHelper(QObject *parent = 0,
|
||||||
QMap<QString, QVariant> args = QMap<QString, QVariant>());
|
QVariantMap args = QVariantMap());
|
||||||
~NetctlHelper();
|
~NetctlHelper();
|
||||||
QStringList printSettings();
|
QStringList printSettings();
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
# set files
|
# 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
|
file (GLOB_RECURSE HEADERS *.h ${SUBPROJECT_INCLUDE_DIR}/*h
|
||||||
${PROJECT_TRDPARTY_DIR}/task/*.h)
|
${PROJECT_TRDPARTY_DIR}/task/*.h)
|
||||||
|
|
||||||
|
@ -238,7 +238,6 @@ QList<netctlProfileInfo> Netctl::getProfileListFromNetctlAuto()
|
|||||||
profileInfo.essid = profileValues[2];
|
profileInfo.essid = profileValues[2];
|
||||||
profileInfo.interface = profileValues[3];
|
profileInfo.interface = profileValues[3];
|
||||||
profileInfo.type = profileValues[0];
|
profileInfo.type = profileValues[0];
|
||||||
profileInfo.essid = profileValues[1];
|
|
||||||
profileInfo.netctlAuto = true;
|
profileInfo.netctlAuto = true;
|
||||||
fullProfilesInfo.append(profileInfo);
|
fullProfilesInfo.append(profileInfo);
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,13 @@ QList<netctlWifiInfo> WpaSup::scanWifi()
|
|||||||
rawList.removeFirst();
|
rawList.removeFirst();
|
||||||
QStringList names;
|
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++) {
|
for (int i=0; i<rawList.count(); i++) {
|
||||||
QStringList line = rawList[i].split(QChar('\t'));
|
QStringList line = rawList[i].split(QChar('\t'));
|
||||||
if (line.count() != 5) continue;
|
if (line.count() != 5) continue;
|
||||||
|
@ -19,7 +19,7 @@ import QtQuick 2.0
|
|||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
import QtQuick.Layouts 1.0 as QtLayouts
|
import QtQuick.Layouts 1.0 as QtLayouts
|
||||||
|
|
||||||
import org.kde.plasma.private.netctl 1.0
|
import org.kde.plasma.netctl 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -33,7 +33,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
QtControls.TabView {
|
QtControls.TabView {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -21,7 +21,7 @@ import QtQuick.Controls.Styles 1.3 as QtStyles
|
|||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
import QtQuick.Layouts 1.0 as QtLayouts
|
import QtQuick.Layouts 1.0 as QtLayouts
|
||||||
|
|
||||||
import org.kde.plasma.private.netctl 1.0
|
import org.kde.plasma.netctl 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -52,7 +52,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
Row {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -21,7 +21,7 @@ import QtQuick.Dialogs 1.1 as QtDialogs
|
|||||||
import QtQuick.Layouts 1.0 as QtLayouts
|
import QtQuick.Layouts 1.0 as QtLayouts
|
||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
|
|
||||||
import org.kde.plasma.private.netctl 1.0
|
import org.kde.plasma.netctl 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -37,7 +37,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
Row {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
|
|
||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
import org.kde.plasma.plasmoid 2.0
|
import org.kde.plasma.plasmoid 2.0
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
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 {
|
Item {
|
||||||
@ -75,8 +76,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ui
|
// ui
|
||||||
Grid {
|
GridLayout {
|
||||||
id: mainGrid
|
anchors.fill: parent
|
||||||
columns: 2
|
columns: 2
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
@ -126,15 +127,6 @@ Item {
|
|||||||
text.text = NetctlAdds.parsePattern(plasmoid.configuration.textPattern)
|
text.text = NetctlAdds.parsePattern(plasmoid.configuration.textPattern)
|
||||||
Plasmoid.toolTipSubText = NetctlAdds.valueByKey("info")
|
Plasmoid.toolTipSubText = NetctlAdds.valueByKey("info")
|
||||||
needMenuUpdate()
|
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: {
|
onNeedMenuUpdate: {
|
||||||
|
@ -21,7 +21,7 @@ import QtQuick.Dialogs 1.1 as QtDialogs
|
|||||||
import QtQuick.Layouts 1.0 as QtLayouts
|
import QtQuick.Layouts 1.0 as QtLayouts
|
||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
|
|
||||||
import org.kde.plasma.private.netctl 1.0
|
import org.kde.plasma.netctl 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -48,7 +48,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
Row {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -14,7 +14,7 @@ X-Plasma-RemoteLocation=
|
|||||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev
|
X-KDE-PluginInfo-Author=Evgeniy Alekseev
|
||||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||||
X-KDE-PluginInfo-Name=org.kde.plasma.netctl
|
X-KDE-PluginInfo-Name=org.kde.plasma.netctl
|
||||||
X-KDE-PluginInfo-Version=1.4.3
|
X-KDE-PluginInfo-Version=1.4.6
|
||||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/netctl-gui
|
X-KDE-PluginInfo-Website=http://arcanis.name/projects/netctl-gui
|
||||||
X-KDE-PluginInfo-Category=Network
|
X-KDE-PluginInfo-Category=Network
|
||||||
X-KDE-PluginInfo-Depends=
|
X-KDE-PluginInfo-Depends=
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
set (PLUGIN_NAME netctlplugin)
|
set (PLUGIN_NAME netctlplugin)
|
||||||
|
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.netctl\")
|
||||||
|
|
||||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Qml_DEFINITIONS})
|
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Qml_DEFINITIONS})
|
||||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||||
@ -20,12 +21,13 @@ include_directories (${CMAKE_SOURCE_DIR}
|
|||||||
${Qt_INCLUDE}
|
${Qt_INCLUDE}
|
||||||
${Kf5_INCLUDE})
|
${Kf5_INCLUDE})
|
||||||
|
|
||||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
file (GLOB_RECURSE SUBPROJECT_SOURCE ${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp
|
||||||
|
*.cpp)
|
||||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||||
|
|
||||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
|
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
|
||||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||||
|
|
||||||
install (TARGETS ${PLUGIN_NAME} 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/private/netctl)
|
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/netctl)
|
||||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
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)
|
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);
|
qmlRegisterSingletonType<NetctlAdds>(uri, 1, 0, "NetctlAdds", netctl_singletontype_provider);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#include <pdebug/pdebug.h>
|
#include <pdebug/pdebug.h>
|
||||||
|
#include <pdebug/pdebug-time.h>
|
||||||
|
|
||||||
#include "netctladds.h"
|
#include "netctladds.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
@ -35,10 +36,13 @@
|
|||||||
NetctlAdds::NetctlAdds(QObject *parent)
|
NetctlAdds::NetctlAdds(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
|
qInstallMessageHandler(debugString);
|
||||||
// debug
|
// debug
|
||||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||||
debug = (debugEnv == QString("yes"));
|
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)
|
QList<QVariant> NetctlAdds::sendDBusRequest(const QString cmd, const QList<QVariant> args)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
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;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName;
|
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());
|
bool needUpdate = (values[sourceName] != data[QString("value")].toString());
|
||||||
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)
|
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);
|
KNotification *notification = KNotification::event(eventId, QString("Netctl ::: %1").arg(eventId), message);
|
||||||
notification->setComponentName(QString("plasma-applet-org.kde.plasma.netctl"));
|
notification->setComponentName(QString("plasma-applet-org.kde.plasma.netctl"));
|
||||||
}
|
}
|
||||||
@ -310,11 +333,11 @@ void NetctlAdds::switchToProfileSlot(const bool useHelper, const QString cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> NetctlAdds::readDataEngineConfiguration()
|
QVariantMap NetctlAdds::readDataEngineConfiguration()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QMap<QString, QVariant> configuration;
|
QVariantMap configuration;
|
||||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-netctl.conf"));
|
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-netctl.conf"));
|
||||||
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||||
@ -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;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
Q_INVOKABLE bool isDebugEnabled();
|
Q_INVOKABLE bool isDebugEnabled();
|
||||||
Q_INVOKABLE QString parsePattern(const QString pattern);
|
Q_INVOKABLE QString parsePattern(const QString pattern);
|
||||||
Q_INVOKABLE void runCmd(const QString cmd);
|
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 static void sendNotification(const QString eventId, const QString message);
|
||||||
Q_INVOKABLE QString valueByKey(const QString key);
|
Q_INVOKABLE QString valueByKey(const QString key);
|
||||||
// context menu
|
// context menu
|
||||||
@ -59,11 +59,15 @@ public:
|
|||||||
Q_INVOKABLE void switchToProfileSlot(const bool useHelper = true,
|
Q_INVOKABLE void switchToProfileSlot(const bool useHelper = true,
|
||||||
const QString cmd = QString("/usr/bin/netctl-auto"));
|
const QString cmd = QString("/usr/bin/netctl-auto"));
|
||||||
// dataengine
|
// dataengine
|
||||||
Q_INVOKABLE QMap<QString, QVariant> readDataEngineConfiguration();
|
Q_INVOKABLE QVariantMap readDataEngineConfiguration();
|
||||||
Q_INVOKABLE void writeDataEngineConfiguration(const QMap<QString, QVariant> configuration);
|
Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void needToBeUpdated();
|
void needToBeUpdated();
|
||||||
|
void needToNotify(const bool currentStatus);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void notifyAboutStatusChanging(const bool currentStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
module org.kde.plasma.private.netctl
|
module org.kde.plasma.netctl
|
||||||
|
|
||||||
plugin netctlplugin
|
plugin netctlplugin
|
||||||
|
@ -2285,6 +2285,14 @@ Should be according to standards</translation>
|
|||||||
<source>External editor</source>
|
<source>External editor</source>
|
||||||
<translation>External editor</translation>
|
<translation>External editor</translation>
|
||||||
</message>
|
</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>
|
||||||
<context>
|
<context>
|
||||||
<name>TrayIcon</name>
|
<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>
|
<source>External editor</source>
|
||||||
<translation>Внешний редактор</translation>
|
<translation>Внешний редактор</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Main tab autoupdate, sec</source>
|
||||||
|
<translation>Интервал обновления основной вкладки, сек</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>WiFi tab autoupdate, sec</source>
|
||||||
|
<translation>Интервал обновления WiFi вкладки, сек</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>TrayIcon</name>
|
<name>TrayIcon</name>
|
||||||
|
Reference in New Issue
Block a user