mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-27 20:49:57 +00:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
aed09bf798 | |||
d299e7d9a1 | |||
cf7b013726 | |||
b65ba2ebe2 | |||
69f6a3135b | |||
7dc1a5eda3 | |||
168a270c98 | |||
c3aa3f0c8f |
11
CHANGELOG
11
CHANGELOG
@ -1,3 +1,14 @@
|
||||
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
|
||||
|
@ -3,7 +3,7 @@
|
||||
pkgbase=netctl-gui
|
||||
pkgname=('libnetctlgui' 'netctlgui-helper' 'netctl-gui'
|
||||
'plasma5-applet-netctl-gui')
|
||||
pkgver=1.4.5
|
||||
pkgver=1.4.6
|
||||
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=('9c1ddad6163290ed3fb52c3d233e1ee3')
|
||||
md5sums=('aed674e4c465d849c2044f9464c2671c')
|
||||
|
||||
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.5
|
||||
pkgver=1.4.6
|
||||
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=('9c1ddad6163290ed3fb52c3d233e1ee3')
|
||||
md5sums=('aed674e4c465d849c2044f9464c2671c')
|
||||
|
||||
|
||||
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/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 5)
|
||||
set (PROJECT_VERSION_PATCH 6)
|
||||
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")
|
||||
|
@ -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("/usr/bin/netctl"));
|
||||
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("/usr/bin/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);
|
||||
}
|
||||
|
||||
|
||||
@ -198,9 +198,9 @@ QStringList Netctl::getProfileList(const QString cmdNetctl, const QString cmdNet
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
netctlAutoStatus = true;
|
||||
QString output = getCmdOutput(QString("%1 list").arg(cmdNetctlAuto)).trimmed();
|
||||
QString output = getCmdOutput(QString("%1 list").arg(cmdNetctlAuto));
|
||||
if (output.isEmpty()) {
|
||||
output = getCmdOutput(QString("%1 list").arg(cmdNetctl)).trimmed();
|
||||
output = getCmdOutput(QString("%1 list").arg(cmdNetctl));
|
||||
netctlAutoStatus = false;
|
||||
}
|
||||
|
||||
@ -208,14 +208,10 @@ QStringList Netctl::getProfileList(const QString cmdNetctl, const QString cmdNet
|
||||
QStringList currentProfiles;
|
||||
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;
|
||||
@ -237,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;
|
||||
@ -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)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -282,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")) {
|
||||
@ -298,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,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,7 +367,7 @@ void MainWindow::storeToolBars()
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::updateConfiguration(const QMap<QString, QVariant> args)
|
||||
void MainWindow::updateConfiguration(const QVariantMap args)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
|
@ -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")]);
|
||||
@ -586,6 +592,8 @@ 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("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("CLOSETOTRAY")] = settings.value(QString("CLOSETOTRAY"), QString("true")).toString();
|
||||
config[QString("STARTTOTRAY")] = settings.value(QString("STARTTOTRAY"), QString("false")).toString();
|
||||
|
@ -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;
|
||||
|
@ -6,6 +6,12 @@
|
||||
[Common]
|
||||
# application language
|
||||
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.
|
||||
# This option is not recognized by netctlgui-helper
|
||||
SYSTRAY=true
|
||||
|
@ -48,6 +48,8 @@ service name. This option is not recognized by
|
||||
path to directory which contains interface information
|
||||
.IP "LANGUAGE=en"
|
||||
application language
|
||||
.IP "MAINUPDATE=0"
|
||||
main tab autoupdate interval in seconds. 0 is disable autoupdate
|
||||
.IP "NETCTL_PATH=/usr/bin/netctl"
|
||||
path to
|
||||
.BR netctl (1)
|
||||
@ -96,6 +98,8 @@ use
|
||||
.BR netctlgui-helper (1)
|
||||
if it is available. This option is not recognized by
|
||||
.BR netctlgui-helper (1)
|
||||
.IP "WIFIUPDATE=0"
|
||||
WiFi tab autoupdate interval in seconds. 0 is disable autoupdate
|
||||
.IP "WPACLI_PATH=/usr/bin/wpa_cli"
|
||||
path to
|
||||
.BR wpa_cli (8)
|
||||
|
@ -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,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("debug")] = false;
|
||||
args[QString("nodaemon")] = 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()),
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -14,7 +14,7 @@ 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.4
|
||||
X-KDE-PluginInfo-Version=1.4.6
|
||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/netctl-gui
|
||||
X-KDE-PluginInfo-Category=Network
|
||||
X-KDE-PluginInfo-Depends=
|
||||
|
@ -21,7 +21,8 @@ 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})
|
||||
|
@ -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,11 +333,11 @@ 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;
|
||||
@ -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,7 +37,7 @@ 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
|
||||
@ -59,11 +59,15 @@ public:
|
||||
Q_INVOKABLE void switchToProfileSlot(const bool useHelper = true,
|
||||
const QString cmd = QString("/usr/bin/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;
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user