mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-27 12:39:58 +00:00
Compare commits
84 Commits
V.1.3.0-al
...
V.1.4.0
Author | SHA1 | Date | |
---|---|---|---|
d23429891e | |||
cf12b3627e | |||
582459d174 | |||
08e7390f6c | |||
c8eae4b222 | |||
54583eae6e | |||
634b4c3b41 | |||
54c5e7958a | |||
6ed45fa7a5 | |||
73ba838685 | |||
924beacc23 | |||
a830fc9372 | |||
4c7459e833 | |||
00a35d75d2 | |||
3e92ec2aae | |||
3ac0484f21 | |||
cbac07b29e | |||
7972f2d6d3 | |||
afed94745a | |||
c8f260c8e2 | |||
edb386d24e | |||
f188dea8a7 | |||
6fb7da4b5b | |||
a35e9b0164 | |||
4bc428f8b5 | |||
030dec5e14 | |||
0898a99878 | |||
8dd48fa7cc | |||
287405f81a | |||
fa27b80060 | |||
c2c14c4911 | |||
e2deb8751d | |||
1fe7d6e21f | |||
e68be6d4f1 | |||
45d3a42754 | |||
cb0410a182 | |||
9d349461cf | |||
d41a34673b | |||
b199b43f58 | |||
6d212efe1e | |||
d32486d882 | |||
5afa65ce68 | |||
5b46247df2 | |||
bda5433716 | |||
835e82ca63 | |||
98cdb18d62 | |||
cd59a9b294 | |||
4780433c4d | |||
28a4934a82 | |||
4e8bbeed35 | |||
f86ef0514b | |||
4c004af1ae | |||
66e3a737d4 | |||
9cf6552c71 | |||
f18e74917b | |||
b909222db9 | |||
0c7868536a | |||
fc3956caf1 | |||
4cf3c85070 | |||
6e57baccaf | |||
5ed704e676 | |||
eb3753ab25 | |||
f9d71577f3 | |||
814f2c7904 | |||
ceca889be4 | |||
696283b1e1 | |||
15cc3a8595 | |||
e8c3441f29 | |||
2de7b26f66 | |||
8f35aeb88f | |||
b49188c104 | |||
f8bf8830be | |||
6e6c547460 | |||
d287f52ba5 | |||
8cc02a07fb | |||
28d51484b1 | |||
e7d2e0bd38 | |||
999914926a | |||
e21b2201ab | |||
d65ded6072 | |||
16662f697b | |||
35d740b778 | |||
0a16364a7a | |||
e9090ab4a9 |
6
.gitignore
vendored
6
.gitignore
vendored
@ -25,3 +25,9 @@ usr/
|
||||
# translations
|
||||
*.qm
|
||||
|
||||
# temporary bckps
|
||||
*~
|
||||
|
||||
# kdevelop files
|
||||
.kdev4
|
||||
*.kdev4
|
||||
|
12
.gitmodules
vendored
Normal file
12
.gitmodules
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
[submodule "sources/3rdparty/tasks"]
|
||||
path = sources/3rdparty/tasks
|
||||
url = https://github.com/mhogomchungu/tasks.git
|
||||
[submodule "sources/3rdparty/pdebug"]
|
||||
path = sources/3rdparty/pdebug
|
||||
url = https://github.com/arcan1s/qtadds-pdebug.git
|
||||
[submodule "sources/3rdparty/language"]
|
||||
path = sources/3rdparty/language
|
||||
url = https://github.com/arcan1s/qtadds-language.git
|
||||
[submodule "sources/3rdparty/task"]
|
||||
path = sources/3rdparty/task
|
||||
url = https://github.com/arcan1s/qtadds-taskadds-qprocess.git
|
3
AUTHORS
3
AUTHORS
@ -1,2 +1,5 @@
|
||||
Current developers:
|
||||
Evgeniy Alekseev aka arcanis <esalexeev (at) gmail (dot) com>
|
||||
|
||||
Translators:
|
||||
@nosada (Japanese translation)
|
||||
|
55
CHANGELOG
55
CHANGELOG
@ -1,3 +1,48 @@
|
||||
Ver.1.4.0
|
||||
---------
|
||||
* all
|
||||
* change settings format from shell-like to ini (#24)
|
||||
* dataengine
|
||||
+ create package for KF5
|
||||
* change NETCTLGUI_DEBUG=yes to DEBUG=yes
|
||||
* update url
|
||||
* gui:
|
||||
+ add workarounds to #22 and #23
|
||||
* plasmoid:
|
||||
+ create package and plugin for KF5
|
||||
* change NETCTLGUI_DEBUG=yes to DEBUG=yes
|
||||
* update url
|
||||
|
||||
***
|
||||
|
||||
Ver.1.3.3
|
||||
---------
|
||||
* all
|
||||
* update Japanese translation
|
||||
* dataengine
|
||||
- fix #19
|
||||
|
||||
***
|
||||
|
||||
Ver.1.3.2
|
||||
---------
|
||||
* all
|
||||
+ add Japanese translation (thanks to @nosada)
|
||||
|
||||
***
|
||||
|
||||
Ver.1.3.1
|
||||
---------
|
||||
* gui:
|
||||
* more correct calls of boolean DBus methods
|
||||
* edit helper icon
|
||||
* helper:
|
||||
* more correct calls of boolean DBus methods
|
||||
* more correct systemd service
|
||||
* add ability to create session bus
|
||||
|
||||
***
|
||||
|
||||
Ver.1.3.0
|
||||
---------
|
||||
* all:
|
||||
@ -21,10 +66,13 @@ Ver.1.3.0
|
||||
+ add ability to use helper
|
||||
+ add ability to start minimized/maximized/detached
|
||||
+ add ability to don't save profile from WiFi tab
|
||||
+ add ability to skip external components checking
|
||||
- remove buttons
|
||||
* more correct actions into SettingsWindow
|
||||
* update to library changes
|
||||
* rewrite tables to use toolTip
|
||||
* edit about window
|
||||
* change menuBar
|
||||
* helper:
|
||||
+ create daemon DBus system interface org.netctlgui.helper to the library:
|
||||
self control slots, netctl control slots and netctl information slots
|
||||
@ -36,13 +84,14 @@ Ver.1.3.0
|
||||
+ add slot stopAllProfiles()
|
||||
+ add slot reenableProfile()
|
||||
+ add slots getRecommendedConfiguration()
|
||||
+ add slots forceStartProfile() and forceStopProfile()
|
||||
+ add double quotes to profile names
|
||||
+ add tests
|
||||
* rewrite to use [tasks](https://github.com/mhogomchungu/tasks) (see #7)
|
||||
* rename getInterfaceList() to getWirelessInterfaceList()
|
||||
* change temporaty directory from $HOME/.cache to system one
|
||||
- remove functions getProfileDescriptions() and getProfileStatuses()
|
||||
- remove SleepThread class
|
||||
* rewrite to use [tasks](https://github.com/mhogomchungu/tasks) (see #7)
|
||||
* rename getInterfaceList() to getWirelessInterfaceList()
|
||||
* change temporary directory from $HOME/.cache to system one
|
||||
* plasmoid:
|
||||
+ add 3rd party license information
|
||||
+ allow plasmoid to use system tray
|
||||
|
38
README.md
38
README.md
@ -4,14 +4,19 @@ Netctl GUI
|
||||
Information
|
||||
-----------
|
||||
|
||||
Qt4/Qt5 graphical interface for netctl. It may work with profiles and may create new profiles. Also it may create a connection to WiFi. Moreover, it provides a widget and DataEngine for KDE.
|
||||
Qt4/Qt5 graphical interface for netctl. It may work with profiles and may create new profiles. Also it may create a connection to WiFi. Moreover, it provides a widget and DataEngine for KDE4/KF5.
|
||||
|
||||
**NOTE** [LOOKING FOR TRANSLATORS!](https://github.com/arcan1s/netctl-gui/issues/3)
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
It is recommended to use graphical interface for widget and DataEngine configuration. All settings of GUI are stored in `$HOME/.config/netctl-gui.conf`. It is highly recommended to edit it from graphical interface.
|
||||
It is recommended to use graphical interface for configuration. Configuration files are:
|
||||
|
||||
* `$HOME/.config/netctl-gui.conf` - GUI/helper user configuration
|
||||
* `/etc/netctl-gui.conf` - helper system-wide configuration
|
||||
* `$HOME/.config/plasma-dataengine-netctl.conf` - DataEngine user configuration
|
||||
* `/etc/xdg/plasma-dataengine-netctl.conf` - DataEngine system-wide configuration
|
||||
|
||||
Instruction
|
||||
===========
|
||||
@ -25,7 +30,8 @@ Dependencies
|
||||
Optional dependencies
|
||||
---------------------
|
||||
|
||||
* kdebase-workspace (widget)
|
||||
* kdebase-workspace (KDE4 widget)
|
||||
* plasma-framework (KF5 widget)
|
||||
* sudo (sudo support)
|
||||
* wpa_supplicant (WiFi support)
|
||||
|
||||
@ -50,14 +56,21 @@ Installation
|
||||
|
||||
Available cmake flags:
|
||||
|
||||
* `-DBUILD_DATAENGINE:BOOL=0` - do not build DataEngine
|
||||
* `-DBUILD_DOCS:BOOL=0` - do not build developer documentation
|
||||
* `-DBUILD_GUI:BOOL=0` - do not build GUI
|
||||
* `-DBUILD_HELPER:BOOL=0` - do not build helper daemon
|
||||
* `-DBUILD_LIBRARY:BOOL=0` - do not build library
|
||||
* `-DBUILD_PLASMOID:BOOL=0` - do not build Plasmoid
|
||||
* `-DBUILD_TEST:BOOL=1` - build auto tests for the library and the helper
|
||||
* `-DUSE_QT5:BOOL=0` - use Qt4 instead of Qt5 for GUI
|
||||
* components:
|
||||
* `-DBUILD_DATAENGINE:BOOL=0` - do not build DataEngine
|
||||
* `-DBUILD_GUI:BOOL=0` - do not build GUI
|
||||
* `-DBUILD_HELPER:BOOL=0` - do not build helper daemon
|
||||
* `-DBUILD_LIBRARY:BOOL=0` - do not build library
|
||||
* `-DBUILD_PLASMOID:BOOL=0` - do not build Plasmoid
|
||||
* additional components:
|
||||
* `-DBUILD_DOCS:BOOL=0` - do not build developer documentation
|
||||
* `-DBUILD_TEST:BOOL=1` - build auto tests for the library and the helper
|
||||
* project properties:
|
||||
* `-DDBUS_SYSTEMCONF_PATH=/etc/dbus-1/system.d/` - path to dbus system configuration files
|
||||
* `-DSYSTEMD_SERVICE_PATH=lib/systemd/system` - path to systemd services
|
||||
* `-DUSE_CAPABILITIES:BOOL=0` - do not use setcap to get privileges to the helper
|
||||
* `-DBUILD_KDE4:BOOL=1` - build KDE4 plasmoid instead of KF5 one
|
||||
* `-DUSE_QT5:BOOL=0` - use Qt4 instead of Qt5 for GUI
|
||||
|
||||
Additional information
|
||||
======================
|
||||
@ -65,9 +78,6 @@ Additional information
|
||||
TODO (wish list)
|
||||
----------------
|
||||
|
||||
* remove suid bit from helper (polkit/logind/etc)
|
||||
* check/update documentation
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
|
99
arch/PKGBUILD
Normal file
99
arch/PKGBUILD
Normal file
@ -0,0 +1,99 @@
|
||||
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
||||
|
||||
pkgbase=netctl-gui
|
||||
pkgname=('libnetctlgui' 'netctlgui-helper' 'netctl-gui'
|
||||
'plasma5-applet-netctl-gui')
|
||||
pkgver=1.4.0
|
||||
pkgrel=1
|
||||
pkgdesc="Qt4/Qt5 GUI for netctl. Also provides a widget for KDE"
|
||||
arch=('i686' 'x86_64')
|
||||
url="http://arcanis.name/projects/netctl-gui"
|
||||
license=('GPL3')
|
||||
makedepends=('automoc4' '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=('172fff4b59c15c991b016db35971eca1')
|
||||
|
||||
|
||||
prepare() {
|
||||
rm -rf "${srcdir}/build-"{plasmoid,qt5}
|
||||
mkdir "${srcdir}/build-"{plasmoid,qt5}
|
||||
}
|
||||
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/build-plasmoid"
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
|
||||
-DBUILD_GUI:BOOL=0 \
|
||||
-DBUILD_LIBRARY:BOOL=0 \
|
||||
-DBUILD_HELPER:BOOL=0 \
|
||||
"../${pkgbase}"
|
||||
make
|
||||
|
||||
cd "${srcdir}/build-qt5"
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_DATAENGINE:BOOL=0 \
|
||||
-DBUILD_PLASMOID:BOOL=0 \
|
||||
-DUSE_CAPABILITIES:BOOL=0 \
|
||||
"../${pkgbase}"
|
||||
make
|
||||
}
|
||||
|
||||
|
||||
package_plasma5-applet-netctl-gui() {
|
||||
pkgdesc="A KF5 plasmoid, which interacts with netctl. A part of netctl-gui"
|
||||
depends=('netctl' 'plasma-framework')
|
||||
optdepends=('netctlgui-helper: DBus helper daemon'
|
||||
'netctl-gui: graphical front-end'
|
||||
'sudo: sudo support')
|
||||
install="plasma-netctl-gui.install"
|
||||
|
||||
cd "${srcdir}/build-plasmoid"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
||||
|
||||
|
||||
package_libnetctlgui() {
|
||||
pkgdesc="Qt5 library which interacts with netctl. A part of netctl-gui"
|
||||
depends=('netctl' 'qt5-base')
|
||||
optdepends=('netctlgui-helper: DBus helper daemon'
|
||||
'sudo: sudo support'
|
||||
'wpa_supplicant: wifi support')
|
||||
provides=('libnetctlgui-qt4')
|
||||
conflicts=('libnetctlgui-qt4')
|
||||
|
||||
cd "${srcdir}/build-qt5/netctlgui"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
||||
|
||||
|
||||
package_netctlgui-helper() {
|
||||
pkgdesc="Helper daemon for netctl-gui. A part of netctl-gui"
|
||||
depends=('libnetctlgui')
|
||||
provides=('netctlgui-helper-qt4')
|
||||
conflicts=('netctlgui-helper-qt4')
|
||||
backup=('etc/netctl-gui.conf'
|
||||
'etc/dbus-1/system.d/org.netctlgui.helper.conf')
|
||||
install="netctlgui-helper.install"
|
||||
|
||||
cd "${srcdir}/build-qt5/helper"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
||||
|
||||
|
||||
package_netctl-gui() {
|
||||
pkgdesc="Qt5 graphical front-end for netctl. A part of netctl-gui"
|
||||
depends=('libnetctlgui' 'xdg-utils')
|
||||
optdepends=('plasma-netctl-gui: KF5 widget'
|
||||
'netctlgui-helper: DBus helper daemon')
|
||||
provides=('netctl-gui-qt4')
|
||||
conflicts=('netctl-gui-qt4')
|
||||
install="netctl-gui.install"
|
||||
|
||||
cd "${srcdir}/build-qt5/gui"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
cd "${srcdir}/build-qt5/resources"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
@ -1,24 +1,22 @@
|
||||
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
||||
|
||||
pkgbase=netctl-gui
|
||||
pkgname=('libnetctlgui' 'netctlgui-helper' 'netctl-gui'
|
||||
'libnetctlgui-qt4' 'netctlgui-helper-qt4' 'netctl-gui-qt4'
|
||||
pkgbase=netctl-gui-qt4
|
||||
pkgname=('libnetctlgui-qt4' 'netctlgui-helper-qt4' 'netctl-gui-qt4'
|
||||
'kdeplasma-applets-netctl-gui')
|
||||
pkgver=1.3.0
|
||||
pkgver=1.4.0
|
||||
pkgrel=1
|
||||
pkgdesc="Qt4/Qt5 GUI for netctl. Also provides a widget for KDE"
|
||||
pkgdesc="Qt4 GUI for netctl. Also provides a widget for KDE4"
|
||||
arch=('i686' 'x86_64')
|
||||
url="http://arcanis.name/projects/netctl-gui"
|
||||
license=('GPL3')
|
||||
makedepends=('automoc4' 'cmake' 'kdelibs' 'qt5-base' 'qt5-tools')
|
||||
makedepends=('automoc4' 'cmake' 'kdelibs')
|
||||
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgbase}-${pkgver}-src.tar.xz")
|
||||
install="${pkgbase}.install"
|
||||
md5sums=('d99eba4101fee42ebbfa5735aa706bc9')
|
||||
md5sums=('172fff4b59c15c991b016db35971eca1')
|
||||
|
||||
|
||||
prepare() {
|
||||
rm -rf "${srcdir}/build-"{plasmoid,qt4,qt5}
|
||||
mkdir "${srcdir}/build-"{plasmoid,qt4,qt5}
|
||||
rm -rf "${srcdir}/build-"{plasmoid,qt4}
|
||||
mkdir "${srcdir}/build-"{plasmoid,qt4}
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +27,7 @@ build() {
|
||||
-DBUILD_GUI:BOOL=0 \
|
||||
-DBUILD_LIBRARY:BOOL=0 \
|
||||
-DBUILD_HELPER:BOOL=0 \
|
||||
-DBUILD_KDE4:BOOL=1 \
|
||||
"../${pkgbase}"
|
||||
make
|
||||
|
||||
@ -37,76 +36,26 @@ build() {
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_DATAENGINE:BOOL=0 \
|
||||
-DBUILD_PLASMOID:BOOL=0 \
|
||||
-DUSE_CAPABILITIES:BOOL=0 \
|
||||
-DUSE_QT5:BOOL=0 \
|
||||
"../${pkgbase}"
|
||||
make
|
||||
|
||||
cd "${srcdir}/build-qt5"
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_DATAENGINE:BOOL=0 \
|
||||
-DBUILD_PLASMOID:BOOL=0 \
|
||||
"../${pkgbase}"
|
||||
make
|
||||
}
|
||||
|
||||
|
||||
package_kdeplasma-applets-netctl-gui() {
|
||||
pkgdesc="A plasmoid, which interacts with netctl. A part of netctl-gui"
|
||||
pkgdesc="A KDE4 plasmoid, which interacts with netctl. A part of netctl-gui"
|
||||
depends=('netctl' 'kdebase-workspace')
|
||||
optdepends=('kdebase-runtime: sudo support'
|
||||
'netctlgui-helper: DBus helper daemon'
|
||||
'netctlgui-helper-qt4: DBus helper daemon'
|
||||
'netctl-gui: graphical front-end'
|
||||
optdepends=('netctlgui-helper-qt4: DBus helper daemon'
|
||||
'netctl-gui-qt4: graphical front-end'
|
||||
'sudo: sudo support')
|
||||
install="${pkgbase}.install"
|
||||
install="kdeplasma-applets-netctl-gui.install"
|
||||
|
||||
cd "${srcdir}/build-plasmoid"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
||||
|
||||
|
||||
package_libnetctlgui() {
|
||||
pkgdesc="Qt5 library which interacts with netctl. A part of netctl-gui"
|
||||
depends=('netctl' 'qt5-base')
|
||||
optdepends=('netctlgui-helper: DBus helper daemon'
|
||||
'sudo: sudo support'
|
||||
'wpa_supplicant: wifi support')
|
||||
provides=('libnetctlgui-qt4')
|
||||
conflicts=('libnetctlgui-qt4')
|
||||
|
||||
cd "${srcdir}/build-qt5/netctlgui"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
||||
|
||||
|
||||
package_netctlgui-helper() {
|
||||
pkgdesc="Helper daemon for netctl-gui. A part of netctl-gui"
|
||||
depends=('libnetctlgui')
|
||||
provides=('netctlgui-helper-qt4')
|
||||
conflicts=('netctlgui-helper-qt4')
|
||||
backup=('etc/netctlgui-helper.conf')
|
||||
|
||||
cd "${srcdir}/build-qt5/helper"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
||||
|
||||
|
||||
package_netctl-gui() {
|
||||
pkgdesc="Qt5 graphical front-end for netctl. A part of netctl-gui"
|
||||
depends=('libnetctlgui' 'xdg-utils')
|
||||
optdepends=('kdeplasma-applets-netctl-gui: KDE widget'
|
||||
'netctlgui-helper: DBus helper daemon')
|
||||
provides=('netctl-gui-qt4')
|
||||
conflicts=('netctl-gui-qt4')
|
||||
install="${pkgbase}.install"
|
||||
|
||||
cd "${srcdir}/build-qt5/gui"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
||||
|
||||
|
||||
package_libnetctlgui-qt4() {
|
||||
pkgdesc="Qt4 library which interacts with netctl. A part of netctl-gui"
|
||||
depends=('netctl' 'qt4')
|
||||
@ -115,6 +64,7 @@ package_libnetctlgui-qt4() {
|
||||
'wpa_supplicant: wifi support')
|
||||
provides=('libnetctlgui')
|
||||
conflicts=('libnetctlgui')
|
||||
install=""
|
||||
|
||||
cd "${srcdir}/build-qt4/netctlgui"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
@ -126,7 +76,9 @@ package_netctlgui-helper-qt4() {
|
||||
depends=('libnetctlgui-qt4')
|
||||
provides=('netctlgui-helper')
|
||||
conflicts=('netctlgui-helper')
|
||||
backup=('etc/netctlgui-helper.conf')
|
||||
backup=('etc/netctl-gui.conf'
|
||||
'etc/dbus-1/system.d/org.netctlgui.helper.conf')
|
||||
install="netctlgui-helper.install"
|
||||
|
||||
cd "${srcdir}/build-qt4/helper"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
@ -140,8 +92,10 @@ package_netctl-gui-qt4() {
|
||||
'netctlgui-helper-qt4: DBus helper daemon')
|
||||
provides=('netctl-gui')
|
||||
conflicts=('netctl-gui')
|
||||
install="${pkgbase}.install"
|
||||
install="netctl-gui.install"
|
||||
|
||||
cd "${srcdir}/build-qt4/gui"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
cd "${srcdir}/build-qt4/resources"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
14
arch/kdeplasma-applets-netctl-gui.install
Normal file
14
arch/kdeplasma-applets-netctl-gui.install
Normal file
@ -0,0 +1,14 @@
|
||||
post_install() {
|
||||
cat << EOF
|
||||
Update plasmoids...
|
||||
EOF
|
||||
kbuildsycoca4 > /dev/null 2>&1
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install "$1"
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
post_install "$1"
|
||||
}
|
11
arch/libnetctlgui.install
Normal file
11
arch/libnetctlgui.install
Normal file
@ -0,0 +1,11 @@
|
||||
post_install() {
|
||||
true
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install "$1"
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
post_install "$1"
|
||||
}
|
@ -4,9 +4,9 @@ post_install() {
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install
|
||||
post_install "$1"
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
post_install
|
||||
post_install "$1"
|
||||
}
|
11
arch/netctlgui-helper.install
Normal file
11
arch/netctlgui-helper.install
Normal file
@ -0,0 +1,11 @@
|
||||
post_install() {
|
||||
setcap cap_setuid=ep usr/bin/netctlgui-helper 2>/dev/null || chmod +s usr/bin/netctlgui-helper
|
||||
cat << EOF
|
||||
Note: users should be in network group if you want to get them access to the system bus
|
||||
See http://arcanis.name/devs/netctl-gui-security-notes.html#helper
|
||||
EOF
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install "$1"
|
||||
}
|
14
arch/plasma-netctl-gui.install
Normal file
14
arch/plasma-netctl-gui.install
Normal file
@ -0,0 +1,14 @@
|
||||
post_install() {
|
||||
cat << EOF
|
||||
Update plasmoids...
|
||||
EOF
|
||||
kbuildsycoca5 > /dev/null 2>&1
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install "$1"
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
post_install "$1"
|
||||
}
|
@ -3,10 +3,12 @@
|
||||
ARCHIVE="netctl-gui"
|
||||
SRCDIR="sources"
|
||||
FILES="AUTHORS CHANGELOG COPYING README.md"
|
||||
IGNORELIST="build en.qm ru.qm netctl-gui.qm *.cppcheck"
|
||||
IGNORELIST="build *.qm *.cppcheck .git*"
|
||||
VERSION=$(grep -m1 PROJECT_VERSION_MAJOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\
|
||||
$(grep -m1 PROJECT_VERSION_MINOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\
|
||||
$(grep -m1 PROJECT_VERSION_PATCH sources/CMakeLists.txt | awk '{print $3}' | cut -c 1)
|
||||
# update submodules
|
||||
git submodule update --init --recursive
|
||||
# create archive
|
||||
[[ -e ${ARCHIVE}-${VERSION}-src.tar.xz ]] && rm -f "${ARCHIVE}-${VERSION}-src.tar.xz"
|
||||
[[ -d ${ARCHIVE} ]] && rm -rf "${ARCHIVE}"
|
||||
@ -14,8 +16,12 @@ cp -r "${SRCDIR}" "${ARCHIVE}"
|
||||
for FILE in ${FILES[*]}; do cp -r "$FILE" "${ARCHIVE}"; done
|
||||
for FILE in ${IGNORELIST[*]}; do find "${ARCHIVE}" -name "${FILE}" -exec rm -rf {} \;; done
|
||||
tar cJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}"
|
||||
ln -sf "../${ARCHIVE}-${VERSION}-src.tar.xz" arch
|
||||
rm -rf "${ARCHIVE}"
|
||||
# update md5sum
|
||||
MD5SUMS=$(md5sum ${ARCHIVE}-${VERSION}-src.tar.xz | awk '{print $1}')
|
||||
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" PKGBUILD
|
||||
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD
|
||||
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" arch/PKGBUILD{,-qt4}
|
||||
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" arch/PKGBUILD{,-qt4}
|
||||
# clear
|
||||
find . -type f -name '*src.tar.xz' -not -name "*${VERSION}-src.tar.xz" -exec rm -rf {} \;
|
||||
find arch -type l -xtype l -exec rm -rf {} \;
|
||||
|
1
sources/3rdparty/language
vendored
Submodule
1
sources/3rdparty/language
vendored
Submodule
Submodule sources/3rdparty/language added at a119b60ed1
12
sources/3rdparty/language-config.h
vendored
Normal file
12
sources/3rdparty/language-config.h
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef LANGUAGE_CONFIG_H
|
||||
#define LANGUAGE_CONFIG_H
|
||||
|
||||
|
||||
// put your languages here comma separated
|
||||
// the first language is default language
|
||||
#define LANGUAGES "en,ru"
|
||||
// language key in the configuration file
|
||||
#define LANGUAGE_KEY "LANGUAGE"
|
||||
|
||||
|
||||
#endif /* LANGUAGE_CONFIG_H */
|
1
sources/3rdparty/pdebug
vendored
Submodule
1
sources/3rdparty/pdebug
vendored
Submodule
Submodule sources/3rdparty/pdebug added at 294a590bb9
1
sources/3rdparty/task
vendored
Submodule
1
sources/3rdparty/task
vendored
Submodule
Submodule sources/3rdparty/task added at d2798204a1
41
sources/3rdparty/task/README.md
vendored
41
sources/3rdparty/task/README.md
vendored
@ -1,41 +0,0 @@
|
||||
|
||||
|
||||
Asynchronous programming in Qt/C++ using tasks,continuations and resumable functions.
|
||||
|
||||
This project is inspired by this[1] video on channel9.
|
||||
|
||||
The project seeks to do async based programming in Qt/C++ using modern C++ with lambdas.
|
||||
|
||||
The project has two sets of APIs.
|
||||
|
||||
1. Task::run().then() API provides async based programming with continuation[4].
|
||||
|
||||
2. Task::await() API provides the first API presented in a different way[5].
|
||||
|
||||
Under certain use cases,they can be used interchangeably, and in others,only one or the other can be used.Some of the problems
|
||||
the first API causes and solved by the second API are discussed in this[7] youtube video.
|
||||
|
||||
Example use case for the Task::run().then() API can be found here[0]. Additional example is [2] where an API is
|
||||
declared and [3] where the declared API is used.
|
||||
|
||||
Example use case of the Task::await() API is here[6] where a function call "blocks" waiting for a result without "hanging" the entire GUI application.
|
||||
|
||||
A short tutorial on task/async/await as implemented in C# can be viewed from this[8] link.
|
||||
|
||||
[0] https://github.com/mhogomchungu/tasks/blob/master/example.cpp
|
||||
|
||||
[1] http://channel9.msdn.com/Blogs/Charles/Asynchronous-Programming-for-C-Developers-PPL-Tasks-and-Windows-8
|
||||
|
||||
[2] https://github.com/mhogomchungu/zuluCrypt/blob/d0439a4e36521e42fa9392b82dcefd3224d53334/zuluMount-gui/zulumounttask.h#L61
|
||||
|
||||
[3] https://github.com/mhogomchungu/zuluCrypt/blob/d0439a4e36521e42fa9392b82dcefd3224d53334/zuluMount-gui/mainwindow.cpp#L812
|
||||
|
||||
[4] Disscussion about this can be found on the following link among other places: http://isocpp.org/files/papers/N3558.pdf
|
||||
|
||||
[5] Disscussion about this can be found on the following link among other places: http://isocpp.org/files/papers/N3564.pdf
|
||||
|
||||
[6] https://github.com/mhogomchungu/zuluCrypt/blob/7123e3c3a7c8c5b3b3b6958464fd92a7f780d827/zuluMount-gui/keydialog.cpp#L511
|
||||
|
||||
[7] https://www.youtube.com/watch?v=Y475RshtAHA
|
||||
|
||||
[8] http://www.youtube.com/watch?v=DqjIQiZ_ql4
|
385
sources/3rdparty/task/task.h
vendored
385
sources/3rdparty/task/task.h
vendored
@ -1,385 +0,0 @@
|
||||
/*
|
||||
* copyright: 2014
|
||||
* name : mhogo mchungu
|
||||
* email: mhogomchungu@gmail.com
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __TASK_H_INCLUDED__
|
||||
#define __TASK_H_INCLUDED__
|
||||
|
||||
#include <utility>
|
||||
#include <future>
|
||||
#include <functional>
|
||||
#include <QThread>
|
||||
#include <QEventLoop>
|
||||
|
||||
/*
|
||||
*
|
||||
* Examples on how to use the library are at the end of this file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Task
|
||||
{
|
||||
class Thread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Thread()
|
||||
{
|
||||
connect( this,SIGNAL( finished() ),this,SLOT( deleteLater() ) ) ;
|
||||
}
|
||||
protected:
|
||||
virtual ~Thread()
|
||||
{
|
||||
}
|
||||
private:
|
||||
virtual void run( void )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
class future
|
||||
{
|
||||
public:
|
||||
future() : m_function( []( T t ){ Q_UNUSED( t ) ; } )
|
||||
{
|
||||
}
|
||||
void setActions( std::function< void( void ) > start,
|
||||
std::function< void( void ) > cancel,
|
||||
std::function< T ( void ) > get )
|
||||
{
|
||||
m_start = std::move( start ) ;
|
||||
m_cancel = std::move( cancel ) ;
|
||||
m_get = std::move( get ) ;
|
||||
}
|
||||
void then( std::function< void( T ) > function )
|
||||
{
|
||||
m_function = std::move( function ) ;
|
||||
m_start() ;
|
||||
}
|
||||
T get()
|
||||
{
|
||||
return m_get() ;
|
||||
}
|
||||
T await()
|
||||
{
|
||||
QEventLoop p ;
|
||||
|
||||
T q ;
|
||||
|
||||
m_function = [ & ]( T r ){ q = std::move( r ) ; p.exit() ; } ;
|
||||
|
||||
m_start() ;
|
||||
|
||||
p.exec() ;
|
||||
|
||||
return q ;
|
||||
}
|
||||
void start()
|
||||
{
|
||||
m_start() ;
|
||||
}
|
||||
void cancel()
|
||||
{
|
||||
m_cancel() ;
|
||||
}
|
||||
void run( T r )
|
||||
{
|
||||
m_function( std::move( r ) ) ;
|
||||
}
|
||||
private:
|
||||
std::function< void( T ) > m_function ;
|
||||
std::function< void( void ) > m_start ;
|
||||
std::function< void( void ) > m_cancel ;
|
||||
std::function< T ( void ) > m_get ;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
class ThreadHelper : public Thread
|
||||
{
|
||||
public:
|
||||
ThreadHelper( std::function< T ( void ) >&& function ) : m_function( std::move( function ) )
|
||||
{
|
||||
}
|
||||
future<T>& Future( void )
|
||||
{
|
||||
m_future.setActions( [ this ](){ this->start() ; },
|
||||
[ this ](){ this->deleteLater() ; },
|
||||
[ this ](){ T r = m_function() ; this->deleteLater() ; return r ; } ) ;
|
||||
return m_future ;
|
||||
}
|
||||
private:
|
||||
~ThreadHelper()
|
||||
{
|
||||
m_future.run( std::move( m_cargo ) ) ;
|
||||
}
|
||||
void run( void )
|
||||
{
|
||||
m_cargo = m_function() ;
|
||||
}
|
||||
std::function< T ( void ) > m_function ;
|
||||
future<T> m_future ;
|
||||
T m_cargo ;
|
||||
};
|
||||
|
||||
class future_1
|
||||
{
|
||||
public:
|
||||
future_1() : m_function( [](){} )
|
||||
{
|
||||
}
|
||||
void setActions( std::function< void( void ) > start,
|
||||
std::function< void( void ) > cancel,
|
||||
std::function< void( void ) > get )
|
||||
{
|
||||
m_start = std::move( start ) ;
|
||||
m_cancel = std::move( cancel ) ;
|
||||
m_get = std::move( get ) ;
|
||||
}
|
||||
void then( std::function< void( void ) > function )
|
||||
{
|
||||
m_function = std::move( function ) ;
|
||||
m_start() ;
|
||||
}
|
||||
void get()
|
||||
{
|
||||
m_get() ;
|
||||
}
|
||||
void await()
|
||||
{
|
||||
QEventLoop p ;
|
||||
|
||||
m_function = [ & ](){ p.exit() ; } ;
|
||||
|
||||
m_start() ;
|
||||
|
||||
p.exec() ;
|
||||
}
|
||||
void start()
|
||||
{
|
||||
m_start() ;
|
||||
}
|
||||
void run()
|
||||
{
|
||||
m_function() ;
|
||||
}
|
||||
void cancel()
|
||||
{
|
||||
m_cancel() ;
|
||||
}
|
||||
private:
|
||||
std::function< void( void ) > m_function ;
|
||||
std::function< void( void ) > m_start ;
|
||||
std::function< void( void ) > m_cancel ;
|
||||
std::function< void( void ) > m_get ;
|
||||
};
|
||||
|
||||
class ThreadHelper_1 : public Thread
|
||||
{
|
||||
public:
|
||||
ThreadHelper_1( std::function< void ( void ) >&& function ) : m_function( std::move( function ) )
|
||||
{
|
||||
}
|
||||
future_1& Future( void )
|
||||
{
|
||||
m_future.setActions( [ this ](){ this->start() ; },
|
||||
[ this ](){ this->deleteLater() ; },
|
||||
[ this ](){ m_function() ; this->deleteLater() ; } ) ;
|
||||
return m_future ;
|
||||
}
|
||||
private:
|
||||
~ThreadHelper_1()
|
||||
{
|
||||
m_future.run() ;
|
||||
}
|
||||
void run( void )
|
||||
{
|
||||
m_function() ;
|
||||
}
|
||||
std::function< void ( void ) > m_function ;
|
||||
future_1 m_future ;
|
||||
};
|
||||
|
||||
/*
|
||||
* Below APIs runs two tasks,the first one will run in a different thread and
|
||||
* the second one will be run on the original thread after the completion of the
|
||||
* first one.
|
||||
*/
|
||||
|
||||
template< typename T >
|
||||
future<T>& run( std::function< T ( void ) > function )
|
||||
{
|
||||
auto t = new ThreadHelper<T>( std::move( function ) ) ;
|
||||
return t->Future() ;
|
||||
}
|
||||
|
||||
static inline future_1& run( std::function< void( void ) > function )
|
||||
{
|
||||
auto t = new ThreadHelper_1( std::move( function ) ) ;
|
||||
return t->Future() ;
|
||||
}
|
||||
|
||||
static inline void exec( std::function< void( void ) > function )
|
||||
{
|
||||
Task::run( std::move( function ) ).start() ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Below APIs implements resumable functions where a function will be "blocked"
|
||||
* waiting for the function to return without "hanging" the current thread.
|
||||
*
|
||||
* recommending reading up on C#'s await keyword to get a sense of what is being
|
||||
* discussed below.
|
||||
*/
|
||||
|
||||
static inline void await( Task::future_1& e )
|
||||
{
|
||||
e.await() ;
|
||||
}
|
||||
|
||||
static inline void await( std::function< void( void ) > function )
|
||||
{
|
||||
Task::run( std::move( function ) ).await() ;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
T await( std::function< T ( void ) > function )
|
||||
{
|
||||
return Task::run<T>( std::move( function ) ).await() ;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
T await( Task::future<T>& e )
|
||||
{
|
||||
return e.await() ;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
T await( std::future<T>&& t )
|
||||
{
|
||||
return Task::await<T>( [ & ](){ return t.get() ; } ) ;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
* Examples on how to use the library
|
||||
*/
|
||||
/*
|
||||
* templated version that passes a return value of one function to another function
|
||||
*/
|
||||
auto _a = [](){
|
||||
/*
|
||||
* task _a does what task _a does here.
|
||||
*
|
||||
* This function body will run on a different thread
|
||||
*/
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
auto _b = []( int r ){
|
||||
/*
|
||||
*
|
||||
* task _b does what task _b does here.
|
||||
*
|
||||
* r is a const reference to a value returned by _a
|
||||
*
|
||||
* This function body will run on the original thread
|
||||
*/
|
||||
}
|
||||
|
||||
Task::run<int>( _a ).then( _b ) ;
|
||||
|
||||
alternatively,
|
||||
|
||||
Task::future<int>& e = Task::run( _a ) ;
|
||||
|
||||
e.then( _b ) ;
|
||||
|
||||
/*
|
||||
* Non templated version that does not pass around return value
|
||||
*/
|
||||
auto _c = [](){
|
||||
/*
|
||||
* task _a does what task _a does here.
|
||||
*
|
||||
* This function body will run on a different thread
|
||||
*/
|
||||
}
|
||||
|
||||
auto _d = [](){
|
||||
/*
|
||||
* task _b does what task _b does here.
|
||||
*
|
||||
* r is a const reference to a value returned by _a
|
||||
*
|
||||
* This function body will run on the original thread
|
||||
*/
|
||||
}
|
||||
|
||||
Task::run( _c ).then( _d ) ;
|
||||
|
||||
/*
|
||||
* if no continuation
|
||||
*/
|
||||
Task::exec( _c ) ;
|
||||
|
||||
/*
|
||||
* Task::await() is used to "block" without "hanging" the calling thread until the function returns.
|
||||
*
|
||||
* Its use case is to do sync programming without hanging the calling thread.
|
||||
*
|
||||
* example use case for it is to "block" on function in a GUI thread withough blocking the GUI thread
|
||||
* hanging the application.
|
||||
*/
|
||||
|
||||
/*
|
||||
* await example when the called function return no result
|
||||
*/
|
||||
Task::await( _c ) ;
|
||||
|
||||
/*
|
||||
* await example when the called function return a result
|
||||
*/
|
||||
int r = Task::await<int>( _a ) ;
|
||||
|
||||
alternatively,
|
||||
|
||||
Task::future<int>& e = Task::run<int>( _a ) ;
|
||||
|
||||
int r = e.await() ;
|
||||
|
||||
alternatively,
|
||||
|
||||
int r = Task::run<int>( _a ).await() ;
|
||||
|
||||
#endif
|
||||
|
||||
#endif //__TASK_H_INCLUDED__
|
44
sources/3rdparty/task/taskadds.cpp
vendored
44
sources/3rdparty/task/taskadds.cpp
vendored
@ -1,44 +0,0 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-gui is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* netctl-gui is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "taskadds.h"
|
||||
|
||||
|
||||
TaskResult runTask(const QString cmd, const bool useSuid)
|
||||
{
|
||||
return Task::await<TaskResult>( [ & ]() {
|
||||
TaskResult r;
|
||||
if (useSuid) {
|
||||
RootProcess command;
|
||||
command.start(cmd);
|
||||
command.waitForFinished(-1);
|
||||
r.exitCode = command.exitCode();
|
||||
r.output = command.readAllStandardOutput();
|
||||
r.error = command.readAllStandardError();
|
||||
} else {
|
||||
QProcess command;
|
||||
command.start(cmd);
|
||||
command.waitForFinished(-1);
|
||||
r.exitCode = command.exitCode();
|
||||
r.output = command.readAllStandardOutput();
|
||||
r.error = command.readAllStandardError();
|
||||
}
|
||||
|
||||
return r;
|
||||
});
|
||||
}
|
1
sources/3rdparty/tasks
vendored
Submodule
1
sources/3rdparty/tasks
vendored
Submodule
Submodule sources/3rdparty/tasks added at 230bdecd2c
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
cmake_policy (SET CMP0003 OLD)
|
||||
cmake_policy (SET CMP0002 OLD)
|
||||
@ -10,7 +10,7 @@ set (PROJECT_AUTHOR "Evgeniy Alekseev")
|
||||
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
||||
set (PROJECT_LICENSE "GPLv3")
|
||||
set (PROJECT_VERSION_MAJOR 1)
|
||||
set (PROJECT_VERSION_MINOR 3)
|
||||
set (PROJECT_VERSION_MINOR 4)
|
||||
set (PROJECT_VERSION_PATCH 0)
|
||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
||||
@ -21,6 +21,7 @@ message (STATUS "Version: ${PROJECT_VERSION}")
|
||||
message (STATUS "Build date: ${CURRENT_DATE}")
|
||||
|
||||
# install options
|
||||
option (USE_CAPABILITIES "Use setcap to set capabilities for the helper" ON)
|
||||
option (USE_QT5 "Use Qt5 instead of Qt4" ON)
|
||||
# components
|
||||
option (BUILD_GUI "Build GUI" ON)
|
||||
@ -28,21 +29,22 @@ option (BUILD_HELPER "Build helper" ON)
|
||||
option (BUILD_LIBRARY "Build library" ON)
|
||||
option (BUILD_DATAENGINE "Build DataEngine" ON)
|
||||
option (BUILD_PLASMOID "Build plasmoid" ON)
|
||||
option (BUILD_KDE4 "Build on KDE4" OFF)
|
||||
if (BUILD_GUI OR BUILD_HELPER)
|
||||
set (BUILD_LIBRARY ON)
|
||||
set (BUILD_LIBRARY ON)
|
||||
endif ()
|
||||
if (BUILD_PLASMOID)
|
||||
set (BUILD_DATAENGINE ON)
|
||||
set (BUILD_DATAENGINE ON)
|
||||
endif ()
|
||||
# documentation
|
||||
option (BUILD_DOCS "Build Doxygen documentation" OFF)
|
||||
if (BUILD_DOCS)
|
||||
set (BUILD_LIBRARY ON)
|
||||
set (BUILD_LIBRARY ON)
|
||||
endif ()
|
||||
# test
|
||||
option (BUILD_TEST "Build unit tests" OFF)
|
||||
if (BUILD_TEST)
|
||||
set (BUILD_LIBRARY ON)
|
||||
set (BUILD_LIBRARY ON)
|
||||
endif ()
|
||||
# FIXME: dbus path
|
||||
set (DBUS_SYSTEMCONF_PATH "/etc/dbus-1/system.d/" CACHE STRING "Path to dbus system configuration files")
|
||||
@ -50,37 +52,42 @@ set (SYSTEMD_SERVICE_PATH "lib/systemd/system" CACHE STRING "Path to systemd ser
|
||||
|
||||
# flags
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (CMAKE_CXX_FLAGS "-Wall -std=c++11")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
set (CMAKE_CXX_FLAGS "-Wall -std=c++11")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
else ()
|
||||
message (STATUS "Unknown compiler")
|
||||
message (STATUS "Unknown compiler")
|
||||
endif ()
|
||||
|
||||
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
|
||||
# resources
|
||||
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
|
||||
set (PROJECT_LIBRARY netctlgui)
|
||||
set (PROJECT_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
||||
add_subdirectory (${PROJECT_RESOURCE_DIR})
|
||||
|
||||
# components
|
||||
if (BUILD_LIBRARY)
|
||||
add_subdirectory (${PROJECT_LIBRARY})
|
||||
add_subdirectory (${PROJECT_LIBRARY})
|
||||
endif ()
|
||||
if (BUILD_HELPER)
|
||||
add_subdirectory (helper)
|
||||
add_subdirectory (helper)
|
||||
endif ()
|
||||
if (BUILD_TEST)
|
||||
enable_testing ()
|
||||
add_subdirectory (test)
|
||||
enable_testing ()
|
||||
add_subdirectory (test)
|
||||
endif ()
|
||||
if (BUILD_GUI)
|
||||
add_subdirectory (gui)
|
||||
add_subdirectory (gui)
|
||||
endif ()
|
||||
if (BUILD_DATAENGINE)
|
||||
add_subdirectory (dataengine)
|
||||
add_subdirectory (dataengine)
|
||||
endif ()
|
||||
if (BUILD_PLASMOID)
|
||||
add_subdirectory (plasmoid)
|
||||
if (BUILD_KDE4)
|
||||
add_subdirectory (plasmoid-kde4)
|
||||
else ()
|
||||
add_subdirectory (plasmoid-kf5)
|
||||
endif (BUILD_KDE4)
|
||||
endif ()
|
||||
|
@ -3,28 +3,66 @@ set (SUBPROJECT plasma_engine_netctl)
|
||||
message (STATUS "Subproject ${SUBPROJECT}")
|
||||
|
||||
# find required libaries
|
||||
find_package (KDE4 REQUIRED)
|
||||
include (KDE4Defaults)
|
||||
if (BUILD_KDE4)
|
||||
find_package (KDE4 REQUIRED)
|
||||
include (KDE4Defaults)
|
||||
|
||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../)
|
||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||
set (KDE_INCLUDE ${KDE4_INCLUDES})
|
||||
else ()
|
||||
find_package (Qt5 REQUIRED COMPONENTS Widgets Network)
|
||||
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
find_package(KF5 REQUIRED COMPONENTS Plasma Service)
|
||||
|
||||
include (KDEInstallDirs)
|
||||
include (KDECMakeSettings)
|
||||
include (KDECompilerSettings)
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5Network_INCLUDE_DIRS})
|
||||
set (KDE_INCLUDE ${ConfigCore_INCLUDE_DIR}
|
||||
${CoreAddons_INCLUDE_DIR}
|
||||
${Plasma_INCLUDE_DIR}
|
||||
${Service_INCLUDE_DIR})
|
||||
endif ()
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${KDE_INCLUDE})
|
||||
|
||||
set (PLUGIN_NAME ${SUBPROJECT})
|
||||
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
||||
set (TASK_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/task.h)
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||
file (GLOB SUBPROJECT_CONF *.conf)
|
||||
|
||||
# prepare
|
||||
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||
|
||||
# make
|
||||
qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTNETWORK_LIBRARY})
|
||||
if (BUILD_KDE4)
|
||||
qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTNETWORK_LIBRARY})
|
||||
else ()
|
||||
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||
add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} ${Qt5Network_LIBRARIES})
|
||||
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||
endif ()
|
||||
|
||||
# install
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
if (BUILD_KDE4)
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
else ()
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
|
||||
endif ()
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="1">
|
||||
<libraries>
|
||||
<library>qt</library>
|
||||
</libraries>
|
||||
</project>
|
@ -1,17 +0,0 @@
|
||||
# Configuration file for netctl data engine
|
||||
|
||||
## Commands
|
||||
# command
|
||||
NETCTLCMD=/usr/bin/netctl
|
||||
# netctl-auto command
|
||||
NETCTLAUTOCMD=/usr/bin/netctl-auto
|
||||
|
||||
## External IP
|
||||
# external IPv4 check command
|
||||
EXTIP4CMD=curl ip4.telize.com
|
||||
# 'true' - check external IPv4
|
||||
EXTIP4=false
|
||||
# external IPv6 check command
|
||||
EXTIP6CMD=curl ip6.telize.com
|
||||
# 'true' - check external IPv6
|
||||
EXTIP6=false
|
@ -15,19 +15,28 @@
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include <KGlobal>
|
||||
#include <KStandardDirs>
|
||||
#include "netctl.h"
|
||||
|
||||
#include <Plasma/DataContainer>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QNetworkInterface>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "netctl.h"
|
||||
#include "pdebug.h"
|
||||
#include "taskadds.h"
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <task/taskadds.h>
|
||||
#include <version.h>
|
||||
|
||||
// KF5-KDE4 compability
|
||||
#ifdef BUILD_KDE4
|
||||
#include <KGlobal>
|
||||
#include <KStandardDirs>
|
||||
#else
|
||||
#include <QStandardPaths>
|
||||
#endif /* BUILD_KDE4 */
|
||||
|
||||
|
||||
Netctl::Netctl(QObject *parent, const QVariantList &args)
|
||||
@ -37,7 +46,7 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
|
||||
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("NETCTLGUI_DEBUG"), QString("no"));
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
if (debugEnv == QString("yes"))
|
||||
debug = true;
|
||||
else
|
||||
@ -45,6 +54,7 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
|
||||
|
||||
setMinimumPollingInterval(333);
|
||||
readConfiguration();
|
||||
initSources();
|
||||
}
|
||||
|
||||
|
||||
@ -78,70 +88,29 @@ void Netctl::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// default configuration
|
||||
QMap<QString, QString> rawConfig;
|
||||
rawConfig[QString("EXTIP4")] = QString("false");
|
||||
rawConfig[QString("EXTIP4CMD")] = QString("curl ip4.telize.com");
|
||||
rawConfig[QString("EXTIP6")] = QString("false");
|
||||
rawConfig[QString("EXTIP6CMD")] = QString("curl ip6.telize.com");
|
||||
rawConfig[QString("NETCTLCMD")] = QString("/usr/bin/netctl");
|
||||
rawConfig[QString("NETCTLAUTOCMD")] = QString("/usr/bin/netctl-auto");
|
||||
|
||||
QString fileName = KGlobal::dirs()->findResource("config", "netctl.conf");
|
||||
QString fileName;
|
||||
#ifdef BUILD_KDE4
|
||||
fileName = KGlobal::dirs()->findResource("config", "plasma-dataengine-netctl.conf");
|
||||
#else
|
||||
fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-netctl.conf"));
|
||||
#endif /* BUILD_KDE4 */
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||
QFile configFile(fileName);
|
||||
if (!configFile.open(QIODevice::ReadOnly)) {
|
||||
configuration = updateConfiguration(rawConfig);
|
||||
return;
|
||||
}
|
||||
QString fileStr;
|
||||
QStringList value;
|
||||
while (true) {
|
||||
fileStr = QString(configFile.readLine()).trimmed();
|
||||
if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue;
|
||||
if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue;
|
||||
if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue;
|
||||
if (fileStr.contains(QChar('='))) {
|
||||
value.clear();
|
||||
for (int i=1; i<fileStr.split(QChar('=')).count(); i++)
|
||||
value.append(fileStr.split(QChar('='))[i]);
|
||||
rawConfig[fileStr.split(QChar('='))[0]] = value.join(QChar('='));
|
||||
}
|
||||
if (configFile.atEnd()) break;
|
||||
}
|
||||
configFile.close();
|
||||
configuration = updateConfiguration(rawConfig);
|
||||
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();
|
||||
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();
|
||||
settings.endGroup();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> Netctl::updateConfiguration(const QMap<QString, QString> rawConfig)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QMap<QString, QString> config;
|
||||
QString key, value;
|
||||
// remove spaces and copy source map
|
||||
for (int i=0; i<rawConfig.keys().count(); i++) {
|
||||
key = rawConfig.keys()[i];
|
||||
value = rawConfig[key];
|
||||
key.remove(QChar(' '));
|
||||
if ((key != QString("EXTIP4CMD")) &&
|
||||
(key != QString("EXTIP6CMD")) &&
|
||||
(key != QString("NETCTLCMD")) &&
|
||||
(key != QString("NETCTLAUTOCMD")))
|
||||
value.remove(QChar(' '));
|
||||
config[key] = value;
|
||||
}
|
||||
|
||||
for (int i=0; i<config.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << config.keys()[i] + QString("=") + config[config.keys()[i]];
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::sourceRequestEvent(const QString &name)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -184,6 +153,8 @@ 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");
|
||||
TaskResult process = runTask(cmd);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
if (process.exitCode != 0)
|
||||
@ -219,6 +190,7 @@ QString Netctl::getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol)
|
||||
QList<QHostAddress> rawList = QNetworkInterface::allAddresses();
|
||||
for (int i=0; i<rawList.count(); i++) {
|
||||
if(rawList[i] == QHostAddress(QHostAddress::LocalHost)) continue;
|
||||
if(rawList[i] == QHostAddress(QHostAddress::LocalHostIPv6)) continue;
|
||||
if (rawList[i].protocol() == protocol) {
|
||||
intIp = rawList[i].toString();
|
||||
break;
|
||||
@ -315,6 +287,32 @@ QString Netctl::getStatus(const QString cmdNetctl, const QString cmdNetctlAuto)
|
||||
}
|
||||
|
||||
|
||||
void Netctl::initSources()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList sourcesList = sources();
|
||||
for (int i=0; i<sourcesList.count(); i++)
|
||||
setData(sourcesList[i], QString("value"), QString("N\\A"));
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
if (process.exitCode == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::updateSourceEvent(const QString &source)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -357,6 +355,10 @@ bool Netctl::updateSourceEvent(const QString &source)
|
||||
}
|
||||
|
||||
|
||||
#ifdef BUILD_KDE4
|
||||
K_EXPORT_PLASMA_DATAENGINE(netctl, Netctl)
|
||||
#else
|
||||
K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(netctl, Netctl, "plasma-dataengine-netctl.json")
|
||||
#endif /* BUILD_KDE4 */
|
||||
|
||||
#include "netctl.moc"
|
||||
|
@ -37,6 +37,10 @@ public:
|
||||
QStringList getProfileList(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||
QStringList getProfileStringStatus(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||
QString getStatus(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||
bool isNetworkActive();
|
||||
|
||||
public slots:
|
||||
void initSources();
|
||||
|
||||
protected:
|
||||
bool sourceRequestEvent(const QString &name);
|
||||
@ -50,7 +54,6 @@ private:
|
||||
bool debug;
|
||||
QMap<QString, QString> configuration;
|
||||
void readConfiguration();
|
||||
QMap<QString, QString> updateConfiguration(const QMap<QString, QString> rawConfig);
|
||||
};
|
||||
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
../3rdparty/pdebug/pdebug.h
|
9
sources/dataengine/plasma-dataengine-netctl.conf
Normal file
9
sources/dataengine/plasma-dataengine-netctl.conf
Normal file
@ -0,0 +1,9 @@
|
||||
[Netctl commands]
|
||||
NETCTLCMD=/usr/bin/netctl
|
||||
NETCTLAUTOCMD=/usr/bin/netctl-auto
|
||||
|
||||
[External IP]
|
||||
EXTIP4CMD=curl ip4.telize.com
|
||||
EXTIP4=false
|
||||
EXTIP6CMD=curl ip6.telize.com
|
||||
EXTIP6=false
|
@ -10,11 +10,11 @@ X-KDE-ServiceTypes=Plasma/DataEngine
|
||||
X-KDE-Library=plasma_engine_netctl
|
||||
X-Plasma-EngineName=netctl
|
||||
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=netctl
|
||||
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
||||
X-KDE-PluginInfo-Website=http://arcan1s.github.io/projects/netctlplasmoid
|
||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/netctl-gui/
|
||||
X-KDE-PluginInfo-Category=Network
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPLv3
|
@ -1 +0,0 @@
|
||||
../3rdparty/task/task.h
|
@ -1 +0,0 @@
|
||||
../3rdparty/task/taskadds.cpp
|
@ -1 +0,0 @@
|
||||
../3rdparty/task/taskadds.h
|
@ -63,6 +63,7 @@ _netctl_gui_settings=(
|
||||
'PREFERED_IFACE'
|
||||
'PROFILE_DIR'
|
||||
'RFKILL_DIR'
|
||||
'SKIPCOMPONENTS'
|
||||
'STARTTOTRAY'
|
||||
'SUDO_PATH'
|
||||
'SYSTEMCTL_PATH'
|
||||
|
@ -1,12 +1,12 @@
|
||||
# build pages
|
||||
file (GLOB SUBPROJECT_DOCS_IN *.html)
|
||||
file (GLOB SUBPROJECT_IMGS *.png)
|
||||
foreach (DOC_IN ${SUBPROJECT_DOCS_IN})
|
||||
file (RELATIVE_PATH ONE_DOC ${CMAKE_SOURCE_DIR} ${DOC_IN})
|
||||
configure_file (${DOC_IN} ${CMAKE_CURRENT_BINARY_DIR}/${ONE_DOC})
|
||||
set (SUBPROJECT_DOCS ${SUBPROJECT_DOCS} ${CMAKE_CURRENT_BINARY_DIR}/${ONE_DOC})
|
||||
endforeach ()
|
||||
|
||||
foreach (DOC_IN ${SUBPROJECT_DOCS_IN})
|
||||
file (RELATIVE_PATH ONE_DOC ${CMAKE_SOURCE_DIR} ${DOC_IN})
|
||||
configure_file (${DOC_IN} ${CMAKE_CURRENT_BINARY_DIR}/${ONE_DOC})
|
||||
set (SUBPROJECT_DOCS ${SUBPROJECT_DOCS} ${CMAKE_CURRENT_BINARY_DIR}/${ONE_DOC})
|
||||
endforeach ()
|
||||
|
||||
install (FILES ${SUBPROJECT_DOCS} DESTINATION share/doc/${PROJECT_NAME})
|
||||
install (FILES ${SUBPROJECT_IMGS} DESTINATION share/doc/${PROJECT_NAME})
|
||||
|
@ -1,3 +1,4 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
@ -20,27 +21,27 @@ th {
|
||||
th.sub {
|
||||
font-style: italic;
|
||||
font-weight: normal;
|
||||
}
|
||||
small {
|
||||
font-size: 70%;
|
||||
}
|
||||
</style>
|
||||
<h1>netctl-gui DBus API description</h1>
|
||||
<h3>Project version : @PROJECT_VERSION@</h3>
|
||||
<ol>
|
||||
<li><a href="#api">DBus API</a></li>
|
||||
<li><a href="#helper">Helper API</a></li>
|
||||
<ul>
|
||||
<li><a href="#ctrl">Helper ctrl API</a></li>
|
||||
<li><a href="#netctl">Helper netctl API</a></li>
|
||||
</ul>
|
||||
<li><a href="#gui">GUI API</a></li>
|
||||
<ul>
|
||||
<li><a href="#netctlgui">GUI netctlgui API</a></li>
|
||||
</ul>
|
||||
<li><a href="#links">External links</a></li>
|
||||
</ol>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2><a href="#api" class="anchor" name="api"></a>DBus API</h2>
|
||||
<h1>netctl-gui DBus API description</h1>
|
||||
<h3>Project version : @PROJECT_VERSION@</h3>
|
||||
<ol>
|
||||
<li><a href="#api">DBus API</a></li>
|
||||
<li><a href="#helper">Helper API</a></li>
|
||||
<li><a href="#ctrl">Helper ctrl API</a></li>
|
||||
<li><a href="#netctl">Helper netctl API</a></li>
|
||||
<li><a href="#gui">GUI API</a></li>
|
||||
<li><a href="#netctlgui">GUI netctlgui API</a></li>
|
||||
<li><a href="#links">External links</a></li>
|
||||
</ol>
|
||||
|
||||
<h2><a href="#api" class="anchor" id="api"></a>DBus API</h2>
|
||||
<table>
|
||||
<tbody><tr>
|
||||
<th>method</th>
|
||||
@ -49,11 +50,11 @@ th.sub {
|
||||
</tr>
|
||||
<!-- helper service -->
|
||||
<tr>
|
||||
<th colspan="3"><a href="#helper" class="anchor" name="helper"></a><code>org.netctlgui.helper</code> service (system bus)</th>
|
||||
<th colspan="3"><a href="#helper" class="anchor" id="helper"></a><code>org.netctlgui.helper</code> service (system bus)</th>
|
||||
</tr>
|
||||
<!-- /ctrl path -->
|
||||
<tr>
|
||||
<th colspan="3" class="sub"><a href="#ctrl" class="anchor" name="ctrl"></a><code>/ctrl</code> path</th>
|
||||
<th colspan="3" class="sub"><a href="#ctrl" class="anchor" id="ctrl"></a><code>/ctrl</code> path</th>
|
||||
</tr>
|
||||
<!-- helper actions -->
|
||||
<tr>
|
||||
@ -112,6 +113,16 @@ th.sub {
|
||||
<td>enables or disables the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool forceStart(QString profile)</td>
|
||||
<td>force starts the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool forceStop(QString profile)</td>
|
||||
<td>force stops the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool Reenable(QString profile)</td>
|
||||
<td>reenables the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||
@ -192,7 +203,7 @@ th.sub {
|
||||
</tr>
|
||||
<!-- /netctl path -->
|
||||
<tr>
|
||||
<th colspan="3" class="sub"><a href="#netctl" class="anchor" name="netctl"></a><code>/netctl</code> path</th>
|
||||
<th colspan="3" class="sub"><a href="#netctl" class="anchor" id="netctl"></a><code>/netctl</code> path</th>
|
||||
</tr>
|
||||
<!-- general information -->
|
||||
<tr>
|
||||
@ -270,11 +281,11 @@ th.sub {
|
||||
</tr>
|
||||
<!-- gui service -->
|
||||
<tr>
|
||||
<th colspan="3"><a href="#gui" class="anchor" name="gui"></a><code>org.netctlgui.netctlgui</code> service (session bus)</th>
|
||||
<th colspan="3"><a href="#gui" class="anchor" id="gui"></a><code>org.netctlgui.netctlgui</code> service (session bus)</th>
|
||||
</tr>
|
||||
<!-- /netctlgui path -->
|
||||
<tr>
|
||||
<th colspan="3" class="sub"><a href="#netctlgui" class="anchor" name="netctlgui"></a><code>/netctlgui</code> path</th>
|
||||
<th colspan="3" class="sub"><a href="#netctlgui" class="anchor" id="netctlgui"></a><code>/netctlgui</code> path</th>
|
||||
</tr>
|
||||
<!-- gui actions -->
|
||||
<tr>
|
||||
@ -354,17 +365,17 @@ th.sub {
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2><a href="#links" class="anchor" name="links"></a>External links</h2>
|
||||
<h2><a href="#links" class="anchor" id="links"></a>External links</h2>
|
||||
<ul>
|
||||
<li><a href="http://arcanis.name/projects/netctl-gui/">Homepage</a></li>
|
||||
<li><a href="https://github.com/arcan1s/netctl-gui">Repository</a></li>
|
||||
<li><a href="https://github.com/arcan1s/netctl-gui/issues">Bugtracker</a></li>
|
||||
</ul>
|
||||
|
||||
<p align="center" style="font-size: 70%">
|
||||
<small>
|
||||
© 2014-@CURRENT_YEAR@ <a href="mailto:@PROJECT_CONTACT@">@PROJECT_AUTHOR@</a><br>
|
||||
This software is licensed under @PROJECT_LICENSE@
|
||||
</p>
|
||||
</small>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,62 +1,79 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>netctl-gui secutiry notes</title>
|
||||
<style type="text/css">
|
||||
|
||||
img {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
small {
|
||||
font-size: 70%;
|
||||
}
|
||||
</style>
|
||||
<h1>netctl-gui security notes</h1>
|
||||
<h3>Project version : @PROJECT_VERSION@</h3>
|
||||
<ol>
|
||||
<li><a href="#description">Description</a></li>
|
||||
<li><a href="#arch">Architecture</a></li>
|
||||
<li><a href="#library">Library</a></li>
|
||||
<li><a href="#helper">Helper</a></li>
|
||||
<li><a href="#gui">Graphical interface</a></li>
|
||||
<li><a href="#kde">KDE components</a></li>
|
||||
<li><a href="#links">External links</a></li>
|
||||
</ol>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2><a href="#description" class="anchor" name="description"></a>Description</h2>
|
||||
<h1>netctl-gui security notes</h1>
|
||||
<h3>Project version : @PROJECT_VERSION@</h3>
|
||||
<ol>
|
||||
<li><a href="#arch">Architecture</a></li>
|
||||
<li><a href="#library">Library</a></li>
|
||||
<li><a href="#helper">Helper</a></li>
|
||||
<li><a href="#gui">Graphical interface</a></li>
|
||||
<li><a href="#kde">KDE components</a></li>
|
||||
<li><a href="#links">External links</a></li>
|
||||
</ol>
|
||||
|
||||
<h2><a href="#description" class="anchor" id="description"></a>Description</h2>
|
||||
<p></p>
|
||||
|
||||
<h2><a href="#arch" class="anchor" name="arch"></a>Architecture</h2>
|
||||
<img src="architecture.png" alt="architecture" align="middle">
|
||||
<h2><a href="#arch" class="anchor" id="arch"></a>Architecture</h2>
|
||||
<img src="architecture.png" alt="architecture">
|
||||
|
||||
<h2><a href="#library" class="anchor" name="library"></a>Library</h2>
|
||||
<p>According to <a href="#arch">the scheme<a> the library gets information from netctl and can control it. Also it provides some additional functions such as a profile creation and removal and access to wpa_supplicant functions. Some functions do not require additional permissions, but other ones do it. All dynamic arguments including profile names and paths are in double quotes to avoid white spaces problem. The functions which <b>require</b> root privileges are:</p>
|
||||
<h2><a href="#library" class="anchor" id="library"></a>Library</h2>
|
||||
<p>According to <a href="#arch">the scheme</a> the library gets information from netctl and can control it. Also it provides some additional functions such as a profile creation and removal and access to wpa_supplicant functions. Some functions do not require additional permissions, but other ones do it. All dynamic arguments including profile names and paths are in double quotes to avoid white spaces problem. The functions which <b>require</b> root privileges are:</p>
|
||||
<ul>
|
||||
<li>Netctl control module</li>
|
||||
<ul>
|
||||
<li><ul>
|
||||
<li><code>netctl stop-all|start|stop|restart|switch-to|enable|disable|reenable <profile></code>. They are commands which provide a general control to netctl.</li>
|
||||
<li><code>systemctl start|restart|enable <netctl-auto@service></code>. They are commands which provide ability to control netctl-auto systemd service.</li>
|
||||
</ul>
|
||||
</ul></li>
|
||||
<li>Netctl profiles module</li>
|
||||
<ul>
|
||||
<li><ul>
|
||||
<li>Copying of a temporary profile from home directory to netctl profiles directory. <code>cp</code> command is used for it.</li>
|
||||
<li>Removal of a profile. <code>rm</code> command is used for it.</li>
|
||||
</ul>
|
||||
</ul></li>
|
||||
<li>WiFi module</li>
|
||||
<ul>
|
||||
<li><ul>
|
||||
<li>This module require root privileges to start <code>wpa_supplicant</code> only. For the futher interaction user must be in <code>CTRL_GROUP</code>.</li>
|
||||
</ul>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p>If library will be initialized with <code>FORCE_SUDO=true</code> than it will use <code>sudo</code> command (which can be transferred to the library by <code>SUDO_PATH</code> option). Otherwise it will try to set UID of children processes to 0. Please note that <code>sudo</code> command and UID setting will be used only for those commands which require it.</p>
|
||||
|
||||
<h2><a href="#helper" class="anchor" name="helper"></a>Helper</h2>
|
||||
<p>Profiles reading should be described. Since profiles has shell-like syntax some variables (which provide an array) cannot be reading by usual ways. To do it library uses bash:</p>
|
||||
<pre>
|
||||
# define system variables
|
||||
env -i bash -c "set"
|
||||
# get profile and system variable list
|
||||
env -i bash -c "source '<profile>'; set"
|
||||
# get profile variables
|
||||
env -i bash -c "source '<profile>'; for i in ${!<key>[@]}; do echo ${<key>[$i]}; done"
|
||||
</pre>
|
||||
|
||||
<h2><a href="#helper" class="anchor" id="helper"></a>Helper</h2>
|
||||
<p>First of all the helper <b>does not interact</b> with netctl directly, it uses the library to do it. So all library security notes are applicable here. To start the helper and to create DBus services user must be in <code>network</code> group by default (or must be root). But you may change it by editing <code>$DBUS_SYSTEMCONF_PATH/org.netctlgui.helper.conf</code> policy file (<code>/etc/dbus-1/system.d/org.netctlgui.helper.conf</code> by default). Please refer to DBus documentation to do it.</p>
|
||||
|
||||
<p>There are two binaries <code>netctgui-helper</code> and <code>netctlgui-helper-suid</code>. They are the same, but the second one has SUID bit, so it can be running by normal user without any password. Please note that <b>it is dangerous</b> and recommended way is to use systemd daemon. In this case you may not install <code>netctlgui-helper-suid</code> binary.</p>
|
||||
<p>By default <code>netctgui-helper</code> binary has capabilities to set UID to the children processes (<code>CAP_SETUID</code>). If you do not want to get these capabilities you may use <code>-DUSE_CAPABILITIES</code> cmake flag. Please refer to <code>man 7 capabilities</code> for more details.</p>
|
||||
|
||||
<p>There are two configuration files <code>$HOME/.config/netctl-gui.conf</code> and <code>/etc/netctl-gui.conf</code>. The first one is a user configuration and the second one is a system-wide. Please note that by default user configuration has higher priority than system-wide, but running with <code>--system</code> flag user configuration will not be reading. The helper and GUI configurations are the same (although some keys aren't needed).</p>
|
||||
|
||||
<h2><a href="#gui" class="anchor" name="gui"></a>Graphical interface</h2>
|
||||
<h2><a href="#gui" class="anchor" id="gui"></a>Graphical interface</h2>
|
||||
<p>Graphical interface may interact with netctl over <a href="#helper">DBus (the helper)</a> and over <a href="#library">the library</a>. Please refer to their notes to any additional information. If user uses helper he should have permissions to run it.</p>
|
||||
|
||||
<h2><a href="#kde" class="anchor" name="kde"></a>KDE components</h2>
|
||||
<h2><a href="#kde" class="anchor" id="kde"></a>KDE components</h2>
|
||||
<p>There are two netctl-based commands which are run from the DataEngine</p>
|
||||
<ul>
|
||||
<li><code><cmd> list</code></li>
|
||||
@ -79,17 +96,17 @@
|
||||
|
||||
<p>The other way is to use DBus communication with <a href="#helper">the helper</a>. In this case user should have rights to start the helper.</p>
|
||||
|
||||
<h2><a href="#links" class="anchor" name="links"></a>External links</h2>
|
||||
<h2><a href="#links" class="anchor" id="links"></a>External links</h2>
|
||||
<ul>
|
||||
<li><a href="http://arcanis.name/projects/netctl-gui/">Homepage</a></li>
|
||||
<li><a href="https://github.com/arcan1s/netctl-gui">Repository</a></li>
|
||||
<li><a href="https://github.com/arcan1s/netctl-gui/issues">Bugtracker</a></li>
|
||||
</ul>
|
||||
|
||||
<p align="center" style="font-size: 70%">
|
||||
<small>
|
||||
© 2014-@CURRENT_YEAR@ <a href="mailto:@PROJECT_CONTACT@">@PROJECT_AUTHOR@</a><br>
|
||||
This software is licensed under @PROJECT_LICENSE@
|
||||
</p>
|
||||
</small>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
@ -64,7 +64,7 @@ Configuration file
|
||||
.RE
|
||||
.SH SEE ALSO
|
||||
.BR netctlgui-helper (1)
|
||||
.BR netctlgui-helper.conf (5)
|
||||
.BR netctl-gui.conf (5)
|
||||
.SH STANDARDS
|
||||
See
|
||||
.B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-dbus-api.html
|
||||
|
@ -1,7 +1,9 @@
|
||||
# set files
|
||||
file (GLOB SOURCES *.cpp)
|
||||
file (GLOB HEADERS *.h)
|
||||
file (GLOB FORMS *.ui)
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp)
|
||||
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)
|
||||
|
||||
file (GLOB LANGUAGES ${SUBPROJECT_TRANSLATION_DIR}/*.ts)
|
||||
set (RESOURCES ${SUBPROJECT_RESOURCE_DIR}/resources.qrc)
|
||||
@ -11,44 +13,45 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../${PROJECT_LIBRARY}/includ
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_TRDPARTY_DIR})
|
||||
link_directories (${PROJECT_LIBRARY}/src/lib)
|
||||
|
||||
if (USE_QT5)
|
||||
find_package(Qt5 COMPONENTS Core DBus Widgets LinguistTools REQUIRED)
|
||||
add_definitions(${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5LinguistTools_DEFINITIONS})
|
||||
include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
||||
set (QT_NEEDED_LIBS ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Widgets_LIBRARIES})
|
||||
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
qt5_wrap_ui (UI_HEADERS ${FORMS})
|
||||
qt5_add_resources (QRC_SOURCES ${RESOURCES})
|
||||
find_package (Qt5 COMPONENTS Core DBus Widgets LinguistTools REQUIRED)
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5LinguistTools_DEFINITIONS})
|
||||
include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
||||
set (QT_NEEDED_LIBS ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Widgets_LIBRARIES})
|
||||
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
qt5_wrap_ui (UI_HEADERS ${FORMS})
|
||||
qt5_add_resources (QRC_SOURCES ${RESOURCES})
|
||||
|
||||
foreach (LANGUAGE ${LANGUAGES})
|
||||
set (TS ${LANGUAGE})
|
||||
string (REPLACE ".ts" ".qm" QM ${TS})
|
||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||
add_custom_command (OUTPUT ${QM} COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||
endforeach ()
|
||||
add_custom_target (translations COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
||||
add_custom_command (TARGET translations COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
||||
foreach (LANGUAGE ${LANGUAGES})
|
||||
set (TS ${LANGUAGE})
|
||||
string (REPLACE ".ts" ".qm" QM ${TS})
|
||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||
add_custom_command (OUTPUT ${QM} COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||
endforeach ()
|
||||
add_custom_target (translations COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
||||
add_custom_command (TARGET translations COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
||||
else ()
|
||||
find_package (Qt4 COMPONENTS QtCore QtDBus QtGui REQUIRED)
|
||||
include (${QT_USE_FILE})
|
||||
set (QT_NEEDED_LIBS ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY})
|
||||
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
qt4_wrap_ui (UI_HEADERS ${FORMS})
|
||||
qt4_add_resources (QRC_SOURCES ${RESOURCES})
|
||||
find_package (Qt4 COMPONENTS QtCore QtDBus QtGui REQUIRED)
|
||||
include (${QT_USE_FILE})
|
||||
set (QT_NEEDED_LIBS ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY})
|
||||
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
qt4_wrap_ui (UI_HEADERS ${FORMS})
|
||||
qt4_add_resources (QRC_SOURCES ${RESOURCES})
|
||||
|
||||
foreach (LANGUAGE ${LANGUAGES})
|
||||
set (TS ${LANGUAGE})
|
||||
string (REPLACE ".ts" ".qm" QM ${TS})
|
||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||
endforeach ()
|
||||
add_custom_target (translations COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
||||
add_custom_command (TARGET translations COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
||||
foreach (LANGUAGE ${LANGUAGES})
|
||||
set (TS ${LANGUAGE})
|
||||
string (REPLACE ".ts" ".qm" QM ${TS})
|
||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||
endforeach ()
|
||||
add_custom_target (translations COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
||||
add_custom_command (TARGET translations COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
||||
endif()
|
||||
|
||||
add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
||||
|
@ -22,7 +22,8 @@
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "pdebug.h"
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <QDBusMessage>
|
||||
#include <QDebug>
|
||||
|
||||
#include "pdebug.h"
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
|
||||
QList<netctlProfileInfo> parseOutputNetctl(const QList<QVariant> raw,
|
||||
@ -30,11 +30,12 @@ QList<netctlProfileInfo> parseOutputNetctl(const QList<QVariant> raw,
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QList<netctlProfileInfo> profileInfo;
|
||||
if (raw.size() == 0)
|
||||
return profileInfo;
|
||||
for (int i=0; i<raw[0].toStringList().count(); i++) {
|
||||
if (raw.size() == 0) return profileInfo;
|
||||
QStringList list = raw[0].toStringList();
|
||||
for (int i=0; i<list.count(); i++) {
|
||||
QStringList info = list[i].split(QChar('|'));
|
||||
if (info.count() != 4) continue;
|
||||
netctlProfileInfo profile;
|
||||
QStringList info = raw[0].toStringList()[i].split(QChar('|'));
|
||||
profile.name = info[0];
|
||||
profile.description = info[1];
|
||||
profile.active = info[2].toInt();
|
||||
@ -52,11 +53,12 @@ QList<netctlWifiInfo> parseOutputWifi(const QList<QVariant> raw,
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QList<netctlWifiInfo> wifiInfo;
|
||||
if (raw.size() == 0)
|
||||
return wifiInfo;
|
||||
for (int i=0; i<raw[0].toStringList().count(); i++) {
|
||||
if (raw.size() == 0) return wifiInfo;
|
||||
QStringList list = raw[0].toStringList();
|
||||
for (int i=0; i<list.count(); i++) {
|
||||
QStringList info = list[i].split(QChar('|'));
|
||||
if (info.count() != 5) continue;
|
||||
netctlWifiInfo wifi;
|
||||
QStringList info = raw[0].toStringList()[i].split(QChar('|'));
|
||||
wifi.name = info[0];
|
||||
wifi.security = info[1];
|
||||
wifi.signal = info[2];
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <QSpacerItem>
|
||||
#include <QDebug>
|
||||
|
||||
#include "pdebug.h"
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
|
||||
ErrorWindow::ErrorWindow(QWidget *parent, const bool debugCmd)
|
||||
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="1">
|
||||
<libraries>
|
||||
<library>qt</library>
|
||||
</libraries>
|
||||
</project>
|
@ -1,115 +0,0 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-gui is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* netctl-gui is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "language.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QLocale>
|
||||
|
||||
|
||||
Language::Language()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QString Language::checkLanguage(const QString language, const QString defaultLanguage)
|
||||
{
|
||||
QStringList availableLanguages = getAvailableLanguages();
|
||||
for (int i=0; i<availableLanguages.count(); i++)
|
||||
if (language == availableLanguages[i])
|
||||
return availableLanguages[i];
|
||||
for (int i=0; i<availableLanguages.count(); i++)
|
||||
if (language.contains(availableLanguages[i] + QChar('_')))
|
||||
return availableLanguages[i];
|
||||
|
||||
return defaultLanguage;
|
||||
}
|
||||
|
||||
|
||||
QString Language::defineLanguage(const QString configPath, const QString options)
|
||||
{
|
||||
QMap<QString, QString> optionsDict = parseOptions(options);
|
||||
if (optionsDict.contains(QString("LANGUAGE")))
|
||||
if (getAvailableLanguages().contains(optionsDict[QString("LANGUAGE")]))
|
||||
return optionsDict[QString("LANGUAGE")];
|
||||
|
||||
QString language;
|
||||
language = defineLanguageFromFile(configPath);
|
||||
if (language.isEmpty())
|
||||
language = defineLanguageFromLocale();
|
||||
language = checkLanguage(language, QString("en"));
|
||||
|
||||
return language;
|
||||
}
|
||||
|
||||
|
||||
QString Language::defineLanguageFromFile(const QString configPath)
|
||||
{
|
||||
QMap<QString, QString> settings;
|
||||
if (configPath.isEmpty())
|
||||
return QString("");
|
||||
QFile configFile(configPath);
|
||||
QString fileStr;
|
||||
if (!configFile.open(QIODevice::ReadOnly))
|
||||
return QString("");
|
||||
while (true) {
|
||||
fileStr = QString(configFile.readLine()).trimmed();
|
||||
if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue;
|
||||
if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue;
|
||||
if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue;
|
||||
if (fileStr.contains(QChar('=')))
|
||||
settings[fileStr.split(QChar('='))[0]] = fileStr.split(QChar('='))[1];
|
||||
if (configFile.atEnd()) break;
|
||||
}
|
||||
configFile.close();
|
||||
|
||||
if (settings.contains(QString("LANGUAGE")))
|
||||
return settings[QString("LANGUAGE")];
|
||||
else
|
||||
return QString("");
|
||||
}
|
||||
|
||||
|
||||
QString Language::defineLanguageFromLocale()
|
||||
{
|
||||
return QLocale::system().name();
|
||||
}
|
||||
|
||||
|
||||
QStringList Language::getAvailableLanguages()
|
||||
{
|
||||
QStringList languages;
|
||||
languages.append(QString("en"));
|
||||
languages.append(QString("ru"));
|
||||
|
||||
return languages;
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> Language::parseOptions(const QString options)
|
||||
{
|
||||
QMap<QString, QString> optionsDict;
|
||||
for (int i=0; i<options.split(QChar(',')).count(); i++) {
|
||||
if (options.split(QChar(','))[i].split(QChar('=')).count() < 2)
|
||||
continue;
|
||||
optionsDict[options.split(QChar(','))[i].split(QChar('='))[0]] =
|
||||
options.split(QChar(','))[i].split(QChar('='))[1];
|
||||
}
|
||||
|
||||
return optionsDict;
|
||||
}
|
@ -25,7 +25,8 @@
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "language.h"
|
||||
#include <language/language.h>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "messages.h"
|
||||
#include "version.h"
|
||||
@ -42,7 +43,7 @@ bool existingSessionOperation(const QString operation)
|
||||
QDBusMessage response = bus.call(request);
|
||||
QList<QVariant> arguments = response.arguments();
|
||||
|
||||
return !arguments.isEmpty();
|
||||
return (!arguments.isEmpty() && bool(arguments[0].toInt()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,8 +22,11 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QMenu>
|
||||
#include <QUrl>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "bridgewidget.h"
|
||||
#include "dbusoperation.h"
|
||||
#include "errorwindow.h"
|
||||
@ -33,7 +36,6 @@
|
||||
#include "macvlanwidget.h"
|
||||
#include "mobilewidget.h"
|
||||
#include "passwdwidget.h"
|
||||
#include "pdebug.h"
|
||||
#include "pppoewidget.h"
|
||||
#include "tunnelwidget.h"
|
||||
#include "tuntapwidget.h"
|
||||
@ -60,72 +62,76 @@ void MainWindow::setMenuActionsShown(const bool state)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "State" << state;
|
||||
|
||||
// main
|
||||
ui->actionMainEdit->setVisible(state);
|
||||
ui->actionMainEnable->setVisible(state);
|
||||
ui->actionMainRefresh->setVisible(state);
|
||||
ui->actionMainRemove->setVisible(state);
|
||||
ui->actionMainRestart->setVisible(state);
|
||||
ui->actionMainStart->setVisible(state);
|
||||
ui->actionMainStopAll->setVisible(state);
|
||||
ui->actionMainSwitch->setVisible(state);
|
||||
toolBarActions[QString("mainRefresh")]->setVisible(state);
|
||||
toolBarActions[QString("mainStart")]->setVisible(state);
|
||||
toolBarActions[QString("mainSwitch")]->setVisible(state);
|
||||
toolBarActions[QString("mainRestart")]->setVisible(state);
|
||||
toolBarActions[QString("mainEnable")]->setVisible(state);
|
||||
toolBarActions[QString("mainStopAll")]->setVisible(state);
|
||||
toolBarActions[QString("mainEdit")]->setVisible(state);
|
||||
toolBarActions[QString("mainRemove")]->setVisible(state);
|
||||
// profile
|
||||
ui->actionProfileClear->setVisible(state);
|
||||
ui->actionProfileLoad->setVisible(state);
|
||||
ui->actionProfileRemove->setVisible(state);
|
||||
ui->actionProfileSave->setVisible(state);
|
||||
toolBarActions[QString("profileClear")]->setVisible(state);
|
||||
toolBarActions[QString("profileLoad")]->setVisible(state);
|
||||
toolBarActions[QString("profileSave")]->setVisible(state);
|
||||
toolBarActions[QString("profileRemove")]->setVisible(state);
|
||||
// wifi
|
||||
ui->actionWifiRefresh->setVisible(state);
|
||||
ui->actionWifiStart->setVisible(state);
|
||||
toolBarActions[QString("wifiRefresh")]->setVisible(state);
|
||||
toolBarActions[QString("wifiStart")]->setVisible(state);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::updateMenuMain()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
setMenuActionsShown(false);
|
||||
actionMenu->setDefaultAction(toolBarActions[QString("mainStart")]);
|
||||
|
||||
ui->actionMainRefresh->setVisible(true);
|
||||
toolBarActions[QString("mainRefresh")]->setVisible(true);
|
||||
if (ui->tableWidget_main->currentItem() == 0) return;
|
||||
if (!ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 2)->text().isEmpty()) {
|
||||
ui->actionMainRestart->setVisible(true);
|
||||
ui->actionMainStart->setText(QApplication::translate("MainWindow", "Stop profile"));
|
||||
ui->actionMainStart->setIcon(QIcon::fromTheme("process-stop"));
|
||||
toolBarActions[QString("mainRestart")]->setVisible(true);
|
||||
toolBarActions[QString("mainStart")]->setText(QApplication::translate("MainWindow", "Stop"));
|
||||
toolBarActions[QString("mainStart")]->setIcon(QIcon::fromTheme("process-stop"));
|
||||
} else {
|
||||
ui->actionMainStart->setText(QApplication::translate("MainWindow", "Start profile"));
|
||||
ui->actionMainStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
toolBarActions[QString("mainStart")]->setText(QApplication::translate("MainWindow", "Start"));
|
||||
toolBarActions[QString("mainStart")]->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
if (!mainTabGetActiveProfiles().isEmpty()) {
|
||||
if (!mainTabGetActiveProfiles()
|
||||
.contains(ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text()))
|
||||
ui->actionMainSwitch->setVisible(true);
|
||||
ui->actionMainStopAll->setVisible(true);
|
||||
toolBarActions[QString("mainSwitch")]->setVisible(true);
|
||||
toolBarActions[QString("mainStopAll")]->setVisible(true);
|
||||
}
|
||||
ui->actionMainStart->setVisible(true);
|
||||
toolBarActions[QString("mainStart")]->setVisible(true);
|
||||
if (!ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 3)->text().isEmpty()) {
|
||||
ui->actionMainEnable->setText(QApplication::translate("MainWindow", "Disable profile"));
|
||||
ui->actionMainEnable->setIcon(QIcon::fromTheme("edit-remove"));
|
||||
toolBarActions[QString("mainEnable")]->setText(QApplication::translate("MainWindow", "Disable"));
|
||||
toolBarActions[QString("mainEnable")]->setIcon(QIcon::fromTheme("edit-remove"));
|
||||
} else {
|
||||
ui->actionMainEnable->setText(QApplication::translate("MainWindow", "Enable profile"));
|
||||
ui->actionMainEnable->setIcon(QIcon::fromTheme("edit-add"));
|
||||
toolBarActions[QString("mainEnable")]->setText(QApplication::translate("MainWindow", "Enable"));
|
||||
toolBarActions[QString("mainEnable")]->setIcon(QIcon::fromTheme("edit-add"));
|
||||
}
|
||||
ui->actionMainEnable->setVisible(true);
|
||||
ui->actionMainEdit->setVisible(true);
|
||||
ui->actionMainRemove->setVisible(true);
|
||||
toolBarActions[QString("mainEnable")]->setVisible(true);
|
||||
toolBarActions[QString("mainEdit")]->setVisible(true);
|
||||
toolBarActions[QString("mainRemove")]->setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::updateMenuProfile()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
setMenuActionsShown(false);
|
||||
actionMenu->setDefaultAction(toolBarActions[QString("profileSave")]);
|
||||
|
||||
ui->actionProfileClear->setVisible(true);
|
||||
toolBarActions[QString("profileClear")]->setVisible(true);
|
||||
if (ui->comboBox_profile->currentText().isEmpty()) {
|
||||
ui->actionProfileLoad->setVisible(false);
|
||||
ui->actionProfileRemove->setVisible(false);
|
||||
ui->actionProfileSave->setVisible(false);
|
||||
toolBarActions[QString("profileLoad")]->setVisible(false);
|
||||
toolBarActions[QString("profileRemove")]->setVisible(false);
|
||||
toolBarActions[QString("profileSave")]->setVisible(false);
|
||||
} else {
|
||||
ui->actionProfileLoad->setVisible(true);
|
||||
ui->actionProfileRemove->setVisible(true);
|
||||
ui->actionProfileSave->setVisible(true);
|
||||
toolBarActions[QString("profileLoad")]->setVisible(true);
|
||||
toolBarActions[QString("profileRemove")]->setVisible(true);
|
||||
toolBarActions[QString("profileSave")]->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,22 +139,46 @@ void MainWindow::updateMenuProfile()
|
||||
void MainWindow::updateMenuWifi()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
setMenuActionsShown(false);
|
||||
actionMenu->setDefaultAction(toolBarActions[QString("wifiStart")]);
|
||||
|
||||
ui->actionWifiRefresh->setVisible(true);
|
||||
toolBarActions[QString("wifiRefresh")]->setVisible(true);
|
||||
if (ui->tableWidget_wifi->currentItem() == 0) return;
|
||||
if (!ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 4)->text().isEmpty()) {
|
||||
if (!ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 3)->text().isEmpty()) {
|
||||
ui->actionWifiStart->setText(QApplication::translate("MainWindow", "Stop WiFi"));
|
||||
ui->actionWifiStart->setIcon(QIcon::fromTheme("process-stop"));
|
||||
toolBarActions[QString("wifiStart")]->setText(QApplication::translate("MainWindow", "Stop"));
|
||||
toolBarActions[QString("wifiStart")]->setIcon(QIcon::fromTheme("process-stop"));
|
||||
} else {
|
||||
ui->actionWifiStart->setText(QApplication::translate("MainWindow", "Start WiFi"));
|
||||
ui->actionWifiStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
toolBarActions[QString("wifiStart")]->setText(QApplication::translate("MainWindow", "Start"));
|
||||
toolBarActions[QString("wifiStart")]->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
} else {
|
||||
ui->actionWifiStart->setText(QApplication::translate("MainWindow", "Start WiFi"));
|
||||
ui->actionWifiStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
toolBarActions[QString("wifiStart")]->setText(QApplication::translate("MainWindow", "Start"));
|
||||
toolBarActions[QString("wifiStart")]->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
toolBarActions[QString("wifiStart")]->setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::updateToolBars()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (sender() == ui->pushButton_menu) {
|
||||
mainToolBar->setHidden(false);
|
||||
actionToolBar->setHidden(true);
|
||||
helpToolBar->setHidden(true);
|
||||
} else if (sender() == ui->pushButton_action) {
|
||||
mainToolBar->setHidden(true);
|
||||
actionToolBar->setHidden(false);
|
||||
helpToolBar->setHidden(true);
|
||||
updateMenu();
|
||||
} else if (sender() == ui->pushButton_help) {
|
||||
mainToolBar->setHidden(true);
|
||||
actionToolBar->setHidden(true);
|
||||
helpToolBar->setHidden(false);
|
||||
|
||||
}
|
||||
ui->actionWifiStart->setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
@ -542,32 +572,6 @@ void MainWindow::mainTabSwitchToProfile()
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::mainTabRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous)
|
||||
{
|
||||
Q_UNUSED(previous);
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (!checkExternalApps(QString("netctl")))
|
||||
return errorWin->showWindow(1, QString(PDEBUG));
|
||||
if (current == 0) {
|
||||
ui->pushButton_mainRestart->setDisabled(true);
|
||||
ui->pushButton_mainStart->setDisabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
ui->pushButton_mainStart->setEnabled(true);
|
||||
|
||||
if (!ui->tableWidget_main->item(current->row(), 2)->text().isEmpty()) {
|
||||
ui->pushButton_mainRestart->setEnabled(true);
|
||||
ui->pushButton_mainStart->setText(QApplication::translate("MainWindow", "Stop"));
|
||||
ui->pushButton_mainStart->setIcon(QIcon::fromTheme("process-stop"));
|
||||
} else {
|
||||
ui->pushButton_mainRestart->setDisabled(true);
|
||||
ui->pushButton_mainStart->setText(QApplication::translate("MainWindow", "Start"));
|
||||
ui->pushButton_mainStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// profile tab slots
|
||||
void MainWindow::profileTabChangeState(const QString current)
|
||||
{
|
||||
@ -1041,12 +1045,9 @@ void MainWindow::wifiTabSetEnabled(const bool state)
|
||||
|
||||
if (state) {
|
||||
ui->tableWidget_wifi->show();
|
||||
ui->pushButton_wifiRefresh->setEnabled(true);
|
||||
ui->label_wifi->hide();
|
||||
} else {
|
||||
ui->tableWidget_wifi->hide();
|
||||
ui->pushButton_wifiRefresh->setDisabled(true);
|
||||
ui->pushButton_wifiStart->setDisabled(true);
|
||||
ui->label_wifi->show();
|
||||
}
|
||||
}
|
||||
@ -1124,34 +1125,3 @@ void MainWindow::wifiTabStart()
|
||||
|
||||
updateWifiTab();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::wifiTabRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous)
|
||||
{
|
||||
Q_UNUSED(previous);
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (!checkExternalApps(QString("wpasup")))
|
||||
return errorWin->showWindow(1, QString(PDEBUG));
|
||||
if (current == 0) {
|
||||
ui->pushButton_wifiStart->setDisabled(true);
|
||||
return;
|
||||
}
|
||||
if (ui->tableWidget_wifi->item(current->row(), 0)->text() == QString("<hidden>")) {
|
||||
ui->pushButton_wifiStart->setDisabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
ui->pushButton_wifiStart->setEnabled(true);
|
||||
if (!ui->tableWidget_wifi->item(current->row(), 4)->text().isEmpty()) {
|
||||
if (!ui->tableWidget_wifi->item(current->row(), 3)->text().isEmpty()) {
|
||||
ui->pushButton_wifiStart->setText(QApplication::translate("MainWindow", "Stop"));
|
||||
ui->pushButton_wifiStart->setIcon(QIcon::fromTheme("process-stop"));
|
||||
} else {
|
||||
ui->pushButton_wifiStart->setText(QApplication::translate("MainWindow", "Start"));
|
||||
ui->pushButton_wifiStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
} else {
|
||||
ui->pushButton_wifiStart->setText(QApplication::translate("MainWindow", "Start"));
|
||||
ui->pushButton_wifiStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
}
|
||||
|
@ -24,15 +24,16 @@
|
||||
#include <QTranslator>
|
||||
#include <QUrl>
|
||||
|
||||
#include <language/language.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <task/taskadds.h>
|
||||
|
||||
#include "aboutwindow.h"
|
||||
#include "dbusoperation.h"
|
||||
#include "errorwindow.h"
|
||||
#include "language.h"
|
||||
#include "netctlautowindow.h"
|
||||
#include "passwdwidget.h"
|
||||
#include "pdebug.h"
|
||||
#include "settingswindow.h"
|
||||
#include "taskadds.h"
|
||||
#include "trayicon.h"
|
||||
#include "version.h"
|
||||
|
||||
@ -360,6 +361,7 @@ void MainWindow::updateConfiguration(const QMap<QString, QVariant> args)
|
||||
|
||||
createObjects();
|
||||
createActions();
|
||||
createToolBars();
|
||||
|
||||
// tray
|
||||
if ((QSystemTrayIcon::isSystemTrayAvailable()) &&
|
||||
|
@ -21,6 +21,10 @@
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <task/taskadds.h>
|
||||
|
||||
#include "aboutwindow.h"
|
||||
#include "bridgewidget.h"
|
||||
@ -34,10 +38,8 @@
|
||||
#include "netctlautowindow.h"
|
||||
#include "netctlguiadaptor.h"
|
||||
#include "passwdwidget.h"
|
||||
#include "pdebug.h"
|
||||
#include "pppoewidget.h"
|
||||
#include "settingswindow.h"
|
||||
#include "taskadds.h"
|
||||
#include "trayicon.h"
|
||||
#include "tunnelwidget.h"
|
||||
#include "tuntapwidget.h"
|
||||
@ -233,7 +235,7 @@ bool MainWindow::isHelperActive()
|
||||
DBUS_HELPER_INTERFACE, QString("Active"),
|
||||
QList<QVariant>(), true, debug);
|
||||
|
||||
return (!responce.isEmpty());
|
||||
return (!responce.isEmpty() && bool(responce[0].toInt()));
|
||||
}
|
||||
|
||||
|
||||
@ -273,6 +275,7 @@ bool MainWindow::checkExternalApps(const QString apps = QString("all"))
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (configuration[QString("SKIPCOMPONENTS")] == QString("true")) return true;
|
||||
QStringList cmd;
|
||||
cmd.append("which");
|
||||
cmd.append(configuration[QString("SUDO_PATH")]);
|
||||
@ -343,52 +346,26 @@ void MainWindow::createActions()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
|
||||
connect(ui->actionAbout, SIGNAL(triggered(bool)), this, SLOT(showAboutWindow()));
|
||||
connect(ui->actionApi, SIGNAL(triggered(bool)), this, SLOT(showApi()));
|
||||
connect(ui->actionLibrary, SIGNAL(triggered(bool)), this, SLOT(showLibrary()));
|
||||
connect(ui->actionNetctlAuto, SIGNAL(triggered(bool)), this, SLOT(showNetctlAutoWindow()));
|
||||
connect(ui->actionReport, SIGNAL(triggered(bool)), this, SLOT(reportABug()));
|
||||
connect(ui->actionSecurity, SIGNAL(triggered(bool)), this, SLOT(showSecurityNotes()));
|
||||
connect(ui->actionSettings, SIGNAL(triggered(bool)), this, SLOT(showSettingsWindow()));
|
||||
connect(ui->actionQuit, SIGNAL(triggered(bool)), this, SLOT(closeMainWindow()));
|
||||
|
||||
// actions menu
|
||||
connect(ui->menuActions, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
|
||||
connect(ui->actionMainEdit, SIGNAL(triggered(bool)), this, SLOT(mainTabEditProfile()));
|
||||
connect(ui->actionMainEnable, SIGNAL(triggered(bool)), this, SLOT(mainTabEnableProfile()));
|
||||
connect(ui->actionMainRefresh, SIGNAL(triggered(bool)), this, SLOT(updateMainTab()));
|
||||
connect(ui->actionMainRemove, SIGNAL(triggered(bool)), this, SLOT(mainTabRemoveProfile()));
|
||||
connect(ui->actionMainRestart, SIGNAL(triggered(bool)), this, SLOT(mainTabRestartProfile()));
|
||||
connect(ui->actionMainStart, SIGNAL(triggered(bool)), this, SLOT(mainTabStartProfile()));
|
||||
connect(ui->actionMainStopAll, SIGNAL(triggered(bool)), this, SLOT(mainTabStopAllProfiles()));
|
||||
connect(ui->actionMainSwitch, SIGNAL(triggered(bool)), this, SLOT(mainTabSwitchToProfile()));
|
||||
connect(ui->actionProfileClear, SIGNAL(triggered(bool)), this, SLOT(profileTabClear()));
|
||||
connect(ui->actionProfileLoad, SIGNAL(triggered(bool)), this, SLOT(profileTabLoadProfile()));
|
||||
connect(ui->actionProfileRemove, SIGNAL(triggered(bool)), this, SLOT(profileTabRemoveProfile()));
|
||||
connect(ui->actionProfileSave, SIGNAL(triggered(bool)), this, SLOT(profileTabCreateProfile()));
|
||||
connect(ui->actionWifiRefresh, SIGNAL(triggered(bool)), this, SLOT(updateWifiTab()));
|
||||
connect(ui->actionWifiStart, SIGNAL(triggered(bool)), this, SLOT(wifiTabStart()));
|
||||
connect(ui->pushButton_menu, SIGNAL(clicked(bool)), this, SLOT(updateToolBars()));
|
||||
connect(ui->pushButton_action, SIGNAL(clicked(bool)), this, SLOT(updateToolBars()));
|
||||
connect(ui->pushButton_help, SIGNAL(clicked(bool)), this, SLOT(updateToolBars()));
|
||||
|
||||
// main tab events
|
||||
connect(ui->pushButton_mainRefresh, SIGNAL(clicked(bool)), this, SLOT(updateMainTab()));
|
||||
connect(ui->pushButton_mainRestart, SIGNAL(clicked(bool)), this, SLOT(mainTabRestartProfile()));
|
||||
connect(ui->pushButton_mainStart, SIGNAL(clicked(bool)), this, SLOT(mainTabStartProfile()));
|
||||
connect(ui->pushButton_netctlAuto, SIGNAL(clicked(bool)), this, SLOT(showNetctlAutoWindow()));
|
||||
connect(ui->tableWidget_main, SIGNAL(itemActivated(QTableWidgetItem *)), this, SLOT(mainTabStartProfile()));
|
||||
connect(ui->tableWidget_main, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)), this, SLOT(mainTabRefreshButtons(QTableWidgetItem *, QTableWidgetItem *)));
|
||||
connect(ui->tableWidget_main, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)),
|
||||
this, SLOT(updateMenuMain()));
|
||||
connect(ui->tableWidget_main, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(mainTabContextualMenu(QPoint)));
|
||||
|
||||
// profile tab events
|
||||
connect(ui->comboBox_profile, SIGNAL(currentIndexChanged(QString)), this, SLOT(profileTabLoadProfile()));
|
||||
connect(ui->pushButton_profileClear, SIGNAL(clicked(bool)), this, SLOT(profileTabClear()));
|
||||
connect(ui->pushButton_profileSave, SIGNAL(clicked(bool)), this, SLOT(profileTabCreateProfile()));
|
||||
connect(ui->comboBox_profile, SIGNAL(editTextChanged(QString)), this, SLOT(updateMenuProfile()));
|
||||
connect(generalWid->connectionType, SIGNAL(currentIndexChanged(QString)), this, SLOT(profileTabChangeState(QString)));
|
||||
|
||||
// wifi tab events
|
||||
connect(ui->pushButton_wifiRefresh, SIGNAL(clicked(bool)), this, SLOT(updateWifiTab()));
|
||||
connect(ui->pushButton_wifiStart, SIGNAL(clicked(bool)), this, SLOT(wifiTabStart()));
|
||||
connect(ui->tableWidget_wifi, SIGNAL(itemActivated(QTableWidgetItem *)), this, SLOT(wifiTabStart()));
|
||||
connect(ui->tableWidget_wifi, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)), this, SLOT(wifiTabRefreshButtons(QTableWidgetItem *, QTableWidgetItem *)));
|
||||
connect(ui->tableWidget_wifi, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)),
|
||||
this, SLOT(updateMenuWifi()));
|
||||
connect(ui->tableWidget_wifi, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(wifiTabContextualMenu(QPoint)));
|
||||
}
|
||||
|
||||
@ -467,6 +444,105 @@ void MainWindow::createObjects()
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::createToolBars()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
mainToolBar = new QToolBar(this);
|
||||
mainToolBar->setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
toolBarActions[QString("netctlAuto")] = mainToolBar->addAction(QApplication::translate("MainWindow", "netctl-auto"),
|
||||
this, SLOT(showNetctlAutoWindow()));
|
||||
toolBarActions[QString("settings")] = mainToolBar->addAction(QIcon::fromTheme(QString("configure")),
|
||||
QApplication::translate("MainWindow", "Settings"),
|
||||
this, SLOT(showSettingsWindow()));
|
||||
appShortcuts[QString("settingsShortcut")] = new QShortcut(QKeySequence(QApplication::translate("MainWindow", "Ctrl+S")),
|
||||
this, SLOT(showSettingsWindow()));
|
||||
toolBarActions[QString("quit")] = mainToolBar->addAction(QIcon::fromTheme(QString("exit")),
|
||||
QApplication::translate("MainWindow", "Quit"),
|
||||
this, SLOT(closeMainWindow()));
|
||||
appShortcuts[QString("quitShortcut")] = new QShortcut(QKeySequence(QApplication::translate("MainWindow", "Ctrl+Q")),
|
||||
this, SLOT(closeMainWindow()));
|
||||
ui->centralLayout->insertWidget(1, mainToolBar);
|
||||
mainToolBar->setHidden(true);
|
||||
|
||||
actionToolBar = new QToolBar(this);
|
||||
actionToolBar->setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
toolBarActions[QString("mainRefresh")] = actionToolBar->addAction(QIcon::fromTheme(QString("stock-refresh")),
|
||||
QApplication::translate("MainWindow", "Refresh"),
|
||||
this, SLOT(updateMainTab()));
|
||||
toolBarActions[QString("profileClear")] = actionToolBar->addAction(QIcon::fromTheme(QString("edit-clear")),
|
||||
QApplication::translate("MainWindow", "Clear"),
|
||||
this, SLOT(profileTabClear()));
|
||||
toolBarActions[QString("wifiRefresh")] = actionToolBar->addAction(QIcon::fromTheme(QString("stock-refresh")),
|
||||
QApplication::translate("MainWindow", "Refresh"),
|
||||
this, SLOT(updateWifiTab()));
|
||||
|
||||
actionMenu = new QToolButton(this);
|
||||
actionMenu->setPopupMode(QToolButton::DelayedPopup);
|
||||
actionMenu->setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
QMenu *menu = new QMenu(actionMenu);
|
||||
toolBarActions[QString("mainStart")] = menu->addAction(QIcon::fromTheme(QString("system-run")),
|
||||
QApplication::translate("MainWindow", "Start"),
|
||||
this, SLOT(mainTabStartProfile()));
|
||||
toolBarActions[QString("mainSwitch")] = menu->addAction(QIcon::fromTheme(QString("system-run")),
|
||||
QApplication::translate("MainWindow", "Switch"),
|
||||
this, SLOT(mainTabSwitchToProfile()));
|
||||
toolBarActions[QString("mainRestart")] = menu->addAction(QIcon::fromTheme(QString("stock-refresh")),
|
||||
QApplication::translate("MainWindow", "Restart"),
|
||||
this, SLOT(mainTabRestartProfile()));
|
||||
toolBarActions[QString("mainEnable")] = menu->addAction(QIcon::fromTheme(QString("edit-add")),
|
||||
QApplication::translate("MainWindow", "Enable"),
|
||||
this, SLOT(mainTabEnableProfile()));
|
||||
toolBarActions[QString("mainStopAll")] = menu->addAction(QIcon::fromTheme(QString("process-stop")),
|
||||
QApplication::translate("MainWindow", "Stop all"),
|
||||
this, SLOT(mainTabStopAllProfiles()));
|
||||
toolBarActions[QString("profileLoad")] = menu->addAction(QIcon::fromTheme(QString("document-open")),
|
||||
QApplication::translate("MainWindow", "Load"),
|
||||
this, SLOT(profileTabLoadProfile()));
|
||||
toolBarActions[QString("profileSave")] = menu->addAction(QIcon::fromTheme(QString("document-save")),
|
||||
QApplication::translate("MainWindow", "Save"),
|
||||
this, SLOT(profileTabCreateProfile()));
|
||||
toolBarActions[QString("wifiStart")] = menu->addAction(QIcon::fromTheme(QString("system-run")),
|
||||
QApplication::translate("MainWindow", "Start"),
|
||||
this, SLOT(wifiTabStart()));
|
||||
actionMenu->setMenu(menu);
|
||||
actionToolBar->addWidget(actionMenu);
|
||||
|
||||
toolBarActions[QString("mainEdit")] = actionToolBar->addAction(QIcon::fromTheme(QString("edit")),
|
||||
QApplication::translate("MainWindow", "Edit"),
|
||||
this, SLOT(mainTabEditProfile()));
|
||||
toolBarActions[QString("mainRemove")] = actionToolBar->addAction(QIcon::fromTheme(QString("edit-delete")),
|
||||
QApplication::translate("MainWindow", "Remove"),
|
||||
this, SLOT(mainTabRemoveProfile()));
|
||||
toolBarActions[QString("profileRemove")] = actionToolBar->addAction(QIcon::fromTheme(QString("edit-delete")),
|
||||
QApplication::translate("MainWindow", "Remove"),
|
||||
this, SLOT(profileTabRemoveProfile()));
|
||||
ui->centralLayout->insertWidget(1, actionToolBar);
|
||||
actionToolBar->setHidden(true);
|
||||
|
||||
helpToolBar = new QToolBar(this);
|
||||
helpToolBar->setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
toolBarActions[QString("security")] = helpToolBar->addAction(QIcon::fromTheme(QString("security-medium")),
|
||||
QApplication::translate("MainWindow", "Security"),
|
||||
this, SLOT(showSecurityNotes()));
|
||||
toolBarActions[QString("api")] = helpToolBar->addAction(QApplication::translate("MainWindow", "DBus API"),
|
||||
this, SLOT(showApi()));
|
||||
toolBarActions[QString("library")] = helpToolBar->addAction(QApplication::translate("MainWindow", "Library"),
|
||||
this, SLOT(showLibrary()));
|
||||
helpToolBar->addSeparator();
|
||||
toolBarActions[QString("report")] = helpToolBar->addAction(QIcon::fromTheme(QString("tools-report-bug")),
|
||||
QApplication::translate("MainWindow", "Report a bug"),
|
||||
this, SLOT(reportABug()));
|
||||
toolBarActions[QString("about")] = helpToolBar->addAction(QIcon::fromTheme(QString("help-about")),
|
||||
QApplication::translate("MainWindow", "About"),
|
||||
this, SLOT(showAboutWindow()));
|
||||
ui->centralLayout->insertWidget(1, helpToolBar);
|
||||
helpToolBar->setHidden(true);
|
||||
|
||||
ui->pushButton_menu->click();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::deleteObjects()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -493,6 +569,24 @@ void MainWindow::deleteObjects()
|
||||
if (errorWin != nullptr) delete errorWin;
|
||||
if (netctlAutoWin != nullptr) delete netctlAutoWin;
|
||||
if (settingsWin != nullptr) delete settingsWin;
|
||||
if (actionMenu != nullptr) {
|
||||
actionMenu->menu()->clear();
|
||||
delete actionMenu;
|
||||
}
|
||||
if (actionToolBar != nullptr) {
|
||||
actionToolBar->clear();
|
||||
delete actionToolBar;
|
||||
}
|
||||
if (helpToolBar != nullptr) {
|
||||
helpToolBar->clear();
|
||||
delete helpToolBar;
|
||||
}
|
||||
if (mainToolBar != nullptr) {
|
||||
mainToolBar->clear();
|
||||
delete mainToolBar;
|
||||
delete appShortcuts[QString("settingsShortcut")];
|
||||
delete appShortcuts[QString("quitShortcut")];
|
||||
}
|
||||
if (trayIcon != nullptr) delete trayIcon;
|
||||
if (ui != nullptr) delete ui;
|
||||
}
|
||||
|
@ -20,7 +20,10 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <QShortcut>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
@ -103,6 +106,7 @@ private slots:
|
||||
void updateMenuMain();
|
||||
void updateMenuProfile();
|
||||
void updateMenuWifi();
|
||||
void updateToolBars();
|
||||
// tab update slots
|
||||
void updateMainTab();
|
||||
void updateProfileTab();
|
||||
@ -117,7 +121,6 @@ private slots:
|
||||
void mainTabStartProfile();
|
||||
void mainTabStopAllProfiles();
|
||||
void mainTabSwitchToProfile();
|
||||
void mainTabRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous);
|
||||
// profile tab slots
|
||||
void profileTabChangeState(const QString current);
|
||||
void profileTabClear();
|
||||
@ -128,11 +131,16 @@ private slots:
|
||||
void wifiTabContextualMenu(const QPoint &pos);
|
||||
void wifiTabSetEnabled(const bool state);
|
||||
void wifiTabStart();
|
||||
void wifiTabRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous);
|
||||
|
||||
private:
|
||||
// ui
|
||||
TrayIcon *trayIcon = nullptr;
|
||||
QMap<QString, QShortcut *> appShortcuts;
|
||||
QMap<QString, QAction *> toolBarActions;
|
||||
QToolButton *actionMenu = nullptr;
|
||||
QToolBar *actionToolBar = nullptr;
|
||||
QToolBar *helpToolBar = nullptr;
|
||||
QToolBar *mainToolBar = nullptr;
|
||||
Ui::MainWindow *ui = nullptr;
|
||||
AboutWindow *aboutWin = nullptr;
|
||||
ErrorWindow *errorWin = nullptr;
|
||||
@ -160,6 +168,7 @@ private:
|
||||
void createActions();
|
||||
void createDBusSession();
|
||||
void createObjects();
|
||||
void createToolBars();
|
||||
void deleteObjects();
|
||||
void keyPressEvent(QKeyEvent *pressedKey);
|
||||
QString configPath;
|
||||
|
@ -14,7 +14,41 @@
|
||||
<string>Netctl GUI</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<layout class="QVBoxLayout" name="centralLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_menus">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_menu">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">border: none;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Menu</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_action">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">border: none;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Actions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_help">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">border: none;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
@ -101,77 +135,6 @@
|
||||
<column/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_mainButtons">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_mainRefresh">
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="stock-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+R</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_mainButtons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_mainRestart">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Restart</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="stock-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_mainStart">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="system-run">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_new">
|
||||
@ -228,7 +191,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>437</width>
|
||||
<height>338</height>
|
||||
<height>368</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -241,47 +204,6 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_newProfileButtons">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_profileClear">
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="edit-clear">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_newProfileButtons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_profileSave">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-save">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_wifi">
|
||||
@ -290,7 +212,7 @@
|
||||
<normaloff>:/wifi.png</normaloff>:/wifi.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Connect to Wi-Fi</string>
|
||||
<string>WiFi menu</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
@ -357,339 +279,19 @@
|
||||
<column/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_wifiButtons">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_wifiRefresh">
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="stock-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+R</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_wifiButtons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_wifiStart">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="system-run">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>469</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuMenu">
|
||||
<property name="title">
|
||||
<string>Menu</string>
|
||||
</property>
|
||||
<addaction name="actionNetctlAuto"/>
|
||||
<addaction name="actionSettings"/>
|
||||
<addaction name="actionQuit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuActions">
|
||||
<property name="title">
|
||||
<string>Actions</string>
|
||||
</property>
|
||||
<addaction name="actionMainRefresh"/>
|
||||
<addaction name="actionWifiRefresh"/>
|
||||
<addaction name="actionProfileClear"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionMainStart"/>
|
||||
<addaction name="actionMainSwitch"/>
|
||||
<addaction name="actionMainRestart"/>
|
||||
<addaction name="actionMainEnable"/>
|
||||
<addaction name="actionMainStopAll"/>
|
||||
<addaction name="actionProfileLoad"/>
|
||||
<addaction name="actionProfileSave"/>
|
||||
<addaction name="actionWifiStart"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionMainEdit"/>
|
||||
<addaction name="actionMainRemove"/>
|
||||
<addaction name="actionProfileRemove"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionSecurity"/>
|
||||
<addaction name="actionApi"/>
|
||||
<addaction name="actionLibrary"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionReport"/>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<addaction name="menuMenu"/>
|
||||
<addaction name="menuActions"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionSettings">
|
||||
<property name="icon">
|
||||
<iconset theme="configure">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionQuit">
|
||||
<property name="icon">
|
||||
<iconset theme="exit">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Quit</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Q</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMainRefresh">
|
||||
<property name="icon">
|
||||
<iconset theme="stock-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMainStart">
|
||||
<property name="icon">
|
||||
<iconset theme="system-run">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMainRestart">
|
||||
<property name="icon">
|
||||
<iconset theme="stock-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Restart profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMainEnable">
|
||||
<property name="icon">
|
||||
<iconset theme="edit-add">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMainEdit">
|
||||
<property name="icon">
|
||||
<iconset theme="edit">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMainRemove">
|
||||
<property name="icon">
|
||||
<iconset theme="edit-delete">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionProfileClear">
|
||||
<property name="icon">
|
||||
<iconset theme="edit-clear">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionWifiRefresh">
|
||||
<property name="icon">
|
||||
<iconset theme="stock-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionProfileLoad">
|
||||
<property name="icon">
|
||||
<iconset theme="document-open">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionProfileSave">
|
||||
<property name="icon">
|
||||
<iconset theme="document-save">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionWifiStart">
|
||||
<property name="icon">
|
||||
<iconset theme="system-run">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start Wi-Fi</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionProfileRemove">
|
||||
<property name="icon">
|
||||
<iconset theme="edit-delete">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNetctlAuto">
|
||||
<property name="text">
|
||||
<string>netctl-auto</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="icon">
|
||||
<iconset theme="help-about">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionReport">
|
||||
<property name="icon">
|
||||
<iconset theme="tools-report-bug">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Report a bug</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionApi">
|
||||
<property name="text">
|
||||
<string>DBus API reference</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSecurity">
|
||||
<property name="icon">
|
||||
<iconset theme="security-medium">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Security notes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLibrary">
|
||||
<property name="text">
|
||||
<string>Library documentation</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMainSwitch">
|
||||
<property name="icon">
|
||||
<iconset theme="system-run"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Switch to profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMainStopAll">
|
||||
<property name="icon">
|
||||
<iconset theme="process-stop"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Stop all profiles</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>tableWidget_main</tabstop>
|
||||
<tabstop>pushButton_mainRefresh</tabstop>
|
||||
<tabstop>pushButton_mainRestart</tabstop>
|
||||
<tabstop>pushButton_mainStart</tabstop>
|
||||
<tabstop>scrollArea</tabstop>
|
||||
<tabstop>pushButton_profileClear</tabstop>
|
||||
<tabstop>pushButton_profileSave</tabstop>
|
||||
<tabstop>tableWidget_wifi</tabstop>
|
||||
<tabstop>pushButton_wifiRefresh</tabstop>
|
||||
<tabstop>pushButton_wifiStart</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../resources/resources.qrc"/>
|
||||
|
@ -25,9 +25,7 @@
|
||||
|
||||
QString errorMessage()
|
||||
{
|
||||
QString errorMessage = QApplication::translate("MainWindow", "Unknown flag\n");
|
||||
|
||||
return errorMessage;
|
||||
return QApplication::translate("MainWindow", "Unknown flag\n");
|
||||
}
|
||||
|
||||
|
||||
@ -117,19 +115,34 @@ QString infoMessage()
|
||||
{
|
||||
QString infoMessage = QString("");
|
||||
// build information
|
||||
infoMessage += QCoreApplication::translate("MainWindow", "Build date: %1").
|
||||
infoMessage += QApplication::translate("MainWindow", "Build date: %1").
|
||||
arg(QString(BUILD_DATE));
|
||||
infoMessage += QString("\n%1:\n").arg(QCoreApplication::translate("MainWindow", "cmake flags"));
|
||||
infoMessage += QString("\t-DCMAKE_BUILD_TYPE=%1 \\\n").arg(QString(CMAKE_BUILD_TYPE));
|
||||
infoMessage += QString("\t-DCMAKE_INSTALL_PREFIX=%1 \\\n").arg(QString(CMAKE_INSTALL_PREFIX));
|
||||
infoMessage += QString("\t-DBUILD_DOCS=%1 \\\n").arg(QString(PROJECT_BUILD_DOCS));
|
||||
infoMessage += QString("\t-DBUILD_LIBRARY=%1 \\\n").arg(QString(PROJECT_BUILD_LIBRARY));
|
||||
infoMessage += QString("\t-DBUILD_GUI=%1 \\\n").arg(QString(PROJECT_BUILD_GUI));
|
||||
infoMessage += QString("\t-DUSE_QT5=%1 \\\n").arg(QString(PROJECT_USE_QT5));
|
||||
infoMessage += QString("\t-DBUILD_DATAENGINE=%1 \\\n").arg(QString(PROJECT_BUILD_DATAENGINE));
|
||||
// cmake
|
||||
infoMessage += QString("\n%1:\n").arg(QApplication::translate("MainWindow", "cmake flags"));
|
||||
// cmake properties
|
||||
infoMessage += QString("%1:\n").arg(QApplication::translate("MainWindow", "cmake properties"));
|
||||
infoMessage += QString("\t-DCMAKE_BUILD_TYPE=%1\n").arg(QString(CMAKE_BUILD_TYPE));
|
||||
infoMessage += QString("\t-DCMAKE_INSTALL_PREFIX=%1\n").arg(QString(CMAKE_INSTALL_PREFIX));
|
||||
// components
|
||||
infoMessage += QString("%1:\n").arg(QApplication::translate("MainWindow", "Components"));
|
||||
infoMessage += QString("\t-DBUILD_DATAENGINE=%1\n").arg(QString(PROJECT_BUILD_DATAENGINE));
|
||||
infoMessage += QString("\t-DBUILD_GUI=%1\n").arg(QString(PROJECT_BUILD_GUI));
|
||||
infoMessage += QString("\t-DBUILD_HELPER=%1\n").arg(QString(PROJECT_BUILD_HELPER));
|
||||
infoMessage += QString("\t-DBUILD_LIBRARY=%1\n").arg(QString(PROJECT_BUILD_LIBRARY));
|
||||
infoMessage += QString("\t-DBUILD_PLASMOID=%1\n").arg(QString(PROJECT_BUILD_PLASMOID));
|
||||
// additional components
|
||||
infoMessage += QString("%1:\n").arg(QApplication::translate("MainWindow", "Additional components"));
|
||||
infoMessage += QString("\t-DBUILD_DOCS=%1\n").arg(QString(PROJECT_BUILD_DOCS));
|
||||
infoMessage += QString("\t-DBUILD_TEST=%1\n").arg(QString(PROJECT_BUILD_TEST));
|
||||
// project properties
|
||||
infoMessage += QString("%1:\n").arg(QApplication::translate("MainWindow", "Project properties"));
|
||||
infoMessage += QString("\t-DDBUS_SYSTEMCONF_PATH=%1\n").arg(QString(PROJECT_DBUS_SYSTEMCONF_PATH));
|
||||
infoMessage += QString("\t-DSYSTEMD_SERVICE_PATH=%1\n").arg(QString(PROJECT_SYSTEMD_SERVICE_PATH));
|
||||
infoMessage += QString("\t-DUSE_CAPABILITIES=%1\n").arg(QString(PROJECT_USE_CAPABILITIES));
|
||||
infoMessage += QString("\t-DUSE_KDE4=%1\n").arg(QString(PROJECT_USE_KDE4));
|
||||
infoMessage += QString("\t-DUSE_QT5=%1\n").arg(QString(PROJECT_USE_QT5));
|
||||
// transport information
|
||||
infoMessage += QString("%1:\n").arg(QCoreApplication::translate("MainWindow", "DBus configuration"));
|
||||
infoMessage += QString("%1:\n").arg(QApplication::translate("MainWindow", "DBus configuration"));
|
||||
infoMessage += QString("\tDBUS_SERVICE=%1\n").arg(QString(DBUS_SERVICE));
|
||||
infoMessage += QString("\tDBUS_INTERFACE=%1\n").arg(QString(DBUS_INTERFACE));
|
||||
infoMessage += QString("\tDBUS_OBJECT_PATH=%1\n").arg(QString(DBUS_OBJECT_PATH));
|
||||
@ -138,11 +151,8 @@ QString infoMessage()
|
||||
infoMessage += QString("\tDBUS_CTRL_PATH=%1\n").arg(QString(DBUS_CTRL_PATH));
|
||||
infoMessage += QString("\tDBUS_LIB_PATH=%1\n").arg(QString(DBUS_LIB_PATH));
|
||||
// docs path
|
||||
infoMessage += QString("%1:\n").arg(QCoreApplication::translate("MainWindow", "Documentation"));
|
||||
infoMessage += QString("%1:\n").arg(QApplication::translate("MainWindow", "Documentation"));
|
||||
infoMessage += QString("\tDOCS_PATH=%1\n").arg(QString(DOCS_PATH));
|
||||
QStringList docs = QDir(QString(DOCS_PATH)).entryList(QDir::NoDotAndDotDot);
|
||||
for (int i=0; i<docs.count(); i++)
|
||||
infoMessage += QString("\t%1\n").arg(docs[i]);
|
||||
|
||||
return infoMessage;
|
||||
}
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "dbusoperation.h"
|
||||
#include "pdebug.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
../../3rdparty/pdebug/pdebug.h
|
@ -22,10 +22,12 @@
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
#include <QSettings>
|
||||
|
||||
#include <language/language.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "language.h"
|
||||
#include "mainwindow.h"
|
||||
#include "pdebug.h"
|
||||
|
||||
|
||||
SettingsWindow::SettingsWindow(QWidget *parent, const bool debugCmd, const QString configFile)
|
||||
@ -95,7 +97,7 @@ void SettingsWindow::addLanguages()
|
||||
|
||||
void SettingsWindow::changePage(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||
{
|
||||
Q_UNUSED(previous)
|
||||
Q_UNUSED(previous);
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=0; i<ui->treeWidget->topLevelItemCount(); i++)
|
||||
@ -120,14 +122,53 @@ void SettingsWindow::saveSettings()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QMap<QString, QString> settings = readSettings();
|
||||
QFile configFile(file);
|
||||
if (!configFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
return;
|
||||
QTextStream out(&configFile);
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
out << settings.keys()[i] << QString("=") << settings[settings.keys()[i]] << endl;
|
||||
configFile.close();
|
||||
QMap<QString, QString> config = readSettings();
|
||||
QSettings settings(file, QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("General"));
|
||||
settings.setValue(QString("LANGUAGE"), config[QString("LANGUAGE")]);
|
||||
settings.setValue(QString("SYSTRAY"), config[QString("SYSTRAY")]);
|
||||
settings.setValue(QString("CLOSETOTRAY"), config[QString("CLOSETOTRAY")]);
|
||||
settings.setValue(QString("STARTTOTRAY"), config[QString("STARTTOTRAY")]);
|
||||
settings.setValue(QString("SKIPCOMPONENTS"), config[QString("SKIPCOMPONENTS")]);
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Helper"));
|
||||
settings.setValue(QString("USE_HELPER"), config[QString("USE_HELPER")]);
|
||||
settings.setValue(QString("FORCE_SUDO"), config[QString("FORCE_SUDO")]);
|
||||
settings.setValue(QString("CLOSE_HELPER"), config[QString("CLOSE_HELPER")]);
|
||||
settings.setValue(QString("HELPER_PATH"), config[QString("HELPER_PATH")]);
|
||||
settings.setValue(QString("HELPER_SERVICE"), config[QString("HELPER_SERVICE")]);
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("netctl"));
|
||||
settings.setValue(QString("SYSTEMCTL_PATH"), config[QString("SYSTEMCTL_PATH")]);
|
||||
settings.setValue(QString("NETCTL_PATH"), config[QString("NETCTL_PATH")]);
|
||||
settings.setValue(QString("NETCTLAUTO_PATH"), config[QString("NETCTLAUTO_PATH")]);
|
||||
settings.setValue(QString("NETCTLAUTO_PATH"), config[QString("NETCTLAUTO_PATH")]);
|
||||
settings.setValue(QString("PROFILE_DIR"), config[QString("PROFILE_DIR")]);
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("sudo"));
|
||||
settings.setValue(QString("SUDO_PATH"), config[QString("SUDO_PATH")]);
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("wpa_supplicant"));
|
||||
settings.setValue(QString("WPASUP_PATH"), config[QString("WPASUP_PATH")]);
|
||||
settings.setValue(QString("WPACLI_PATH"), config[QString("WPACLI_PATH")]);
|
||||
settings.setValue(QString("PID_FILE"), config[QString("PID_FILE")]);
|
||||
settings.setValue(QString("WPA_DRIVERS"), config[QString("WPA_DRIVERS")]);
|
||||
settings.setValue(QString("CTRL_DIR"), config[QString("CTRL_DIR")]);
|
||||
settings.setValue(QString("CTRL_GROUP"), config[QString("CTRL_GROUP")]);
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Other"));
|
||||
settings.setValue(QString("IFACE_DIR"), config[QString("IFACE_DIR")]);
|
||||
settings.setValue(QString("RFKILL_DIR"), config[QString("RFKILL_DIR")]);
|
||||
settings.setValue(QString("PREFERED_IFACE"), config[QString("PREFERED_IFACE")]);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
|
||||
@ -236,107 +277,122 @@ QMap<QString, QString> SettingsWindow::readSettings()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QMap<QString, QString> settings;
|
||||
if (ui->checkBox_helperClose->checkState() == 2)
|
||||
settings[QString("CLOSE_HELPER")] = QString("true");
|
||||
else
|
||||
settings[QString("CLOSE_HELPER")] = QString("false");
|
||||
if (ui->checkBox_closeToTray->checkState() == 2)
|
||||
settings[QString("CLOSETOTRAY")] = QString("true");
|
||||
else
|
||||
settings[QString("CLOSETOTRAY")] = QString("false");
|
||||
settings[QString("CTRL_DIR")] = ui->lineEdit_wpaDir->text();
|
||||
settings[QString("CTRL_GROUP")] = ui->lineEdit_wpaGroup->text();
|
||||
if (ui->checkBox_forceSudo->checkState() == 2)
|
||||
settings[QString("FORCE_SUDO")] = QString("true");
|
||||
else
|
||||
settings[QString("FORCE_SUDO")] = QString("false");
|
||||
settings[QString("HELPER_PATH")] = ui->lineEdit_helperPath->text();
|
||||
settings[QString("HELPER_SERVICE")] = ui->lineEdit_helperService->text();
|
||||
settings[QString("IFACE_DIR")] = ui->lineEdit_interfacesDir->text();
|
||||
settings[QString("LANGUAGE")] = ui->comboBox_language->currentText();
|
||||
settings[QString("NETCTL_PATH")] = ui->lineEdit_netctlPath->text();
|
||||
settings[QString("NETCTLAUTO_PATH")] = ui->lineEdit_netctlAutoPath->text();
|
||||
settings[QString("NETCTLAUTO_SERVICE")] = ui->lineEdit_netctlAutoService->text();
|
||||
settings[QString("PID_FILE")] = ui->lineEdit_pid->text();
|
||||
settings[QString("PREFERED_IFACE")] = ui->lineEdit_interface->text();
|
||||
settings[QString("PROFILE_DIR")] = ui->lineEdit_profilePath->text();
|
||||
settings[QString("RFKILL_DIR")] = ui->lineEdit_rfkill->text();
|
||||
if (ui->checkBox_startToTray->checkState() == 2)
|
||||
settings[QString("STARTTOTRAY")] = QString("true");
|
||||
else
|
||||
settings[QString("STARTTOTRAY")] = QString("false");
|
||||
settings[QString("SUDO_PATH")] = ui->lineEdit_sudo->text();
|
||||
settings[QString("SYSTEMCTL_PATH")] = ui->lineEdit_systemctlPath->text();
|
||||
if (ui->checkBox_enableTray->checkState() == 2)
|
||||
settings[QString("SYSTRAY")] = QString("true");
|
||||
else
|
||||
settings[QString("SYSTRAY")] = QString("false");
|
||||
if (ui->checkBox_useHelper->checkState() == 2)
|
||||
settings[QString("USE_HELPER")] = QString("true");
|
||||
else
|
||||
settings[QString("USE_HELPER")] = QString("false");
|
||||
settings[QString("WPACLI_PATH")] = ui->lineEdit_wpaCliPath->text();
|
||||
settings[QString("WPASUP_PATH")] = ui->lineEdit_wpaSupPath->text();
|
||||
settings[QString("WPA_DRIVERS")] = ui->lineEdit_wpaSupDrivers->text();
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
|
||||
QMap<QString, QString> config;
|
||||
|
||||
return settings;
|
||||
if (ui->checkBox_helperClose->checkState() == 2)
|
||||
config[QString("CLOSE_HELPER")] = QString("true");
|
||||
else
|
||||
config[QString("CLOSE_HELPER")] = QString("false");
|
||||
if (ui->checkBox_closeToTray->checkState() == 2)
|
||||
config[QString("CLOSETOTRAY")] = QString("true");
|
||||
else
|
||||
config[QString("CLOSETOTRAY")] = QString("false");
|
||||
config[QString("CTRL_DIR")] = ui->lineEdit_wpaDir->text();
|
||||
config[QString("CTRL_GROUP")] = ui->lineEdit_wpaGroup->text();
|
||||
if (ui->checkBox_forceSudo->checkState() == 2)
|
||||
config[QString("FORCE_SUDO")] = QString("true");
|
||||
else
|
||||
config[QString("FORCE_SUDO")] = QString("false");
|
||||
config[QString("HELPER_PATH")] = ui->lineEdit_helperPath->text();
|
||||
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("NETCTL_PATH")] = ui->lineEdit_netctlPath->text();
|
||||
config[QString("NETCTLAUTO_PATH")] = ui->lineEdit_netctlAutoPath->text();
|
||||
config[QString("NETCTLAUTO_SERVICE")] = ui->lineEdit_netctlAutoService->text();
|
||||
config[QString("PID_FILE")] = ui->lineEdit_pid->text();
|
||||
config[QString("PREFERED_IFACE")] = ui->lineEdit_interface->text();
|
||||
config[QString("PROFILE_DIR")] = ui->lineEdit_profilePath->text();
|
||||
config[QString("RFKILL_DIR")] = ui->lineEdit_rfkill->text();
|
||||
if (ui->checkBox_components->checkState() == 2)
|
||||
config[QString("SKIPCOMPONENTS")] = QString("true");
|
||||
else
|
||||
config[QString("SKIPCOMPONENTS")] = QString("false");
|
||||
if (ui->checkBox_startToTray->checkState() == 2)
|
||||
config[QString("STARTTOTRAY")] = QString("true");
|
||||
else
|
||||
config[QString("STARTTOTRAY")] = QString("false");
|
||||
config[QString("SUDO_PATH")] = ui->lineEdit_sudo->text();
|
||||
config[QString("SYSTEMCTL_PATH")] = ui->lineEdit_systemctlPath->text();
|
||||
if (ui->checkBox_enableTray->checkState() == 2)
|
||||
config[QString("SYSTRAY")] = QString("true");
|
||||
else
|
||||
config[QString("SYSTRAY")] = QString("false");
|
||||
if (ui->checkBox_useHelper->checkState() == 2)
|
||||
config[QString("USE_HELPER")] = QString("true");
|
||||
else
|
||||
config[QString("USE_HELPER")] = QString("false");
|
||||
config[QString("WPACLI_PATH")] = ui->lineEdit_wpaCliPath->text();
|
||||
config[QString("WPASUP_PATH")] = ui->lineEdit_wpaSupPath->text();
|
||||
config[QString("WPA_DRIVERS")] = ui->lineEdit_wpaSupDrivers->text();
|
||||
|
||||
for (int i=0; i<config.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << config.keys()[i] + QString("=") +
|
||||
config[config.keys()[i]];
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::setSettings(const QMap<QString, QString> settings)
|
||||
void SettingsWindow::setSettings(const QMap<QString, QString> config)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (settings[QString("CLOSE_HELPER")] == QString("true"))
|
||||
if (config[QString("CLOSE_HELPER")] == QString("true"))
|
||||
ui->checkBox_helperClose->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->checkBox_helperClose->setCheckState(Qt::Unchecked);
|
||||
if (settings[QString("CLOSETOTRAY")] == QString("true"))
|
||||
if (config[QString("CLOSETOTRAY")] == QString("true"))
|
||||
ui->checkBox_closeToTray->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->checkBox_closeToTray->setCheckState(Qt::Unchecked);
|
||||
ui->lineEdit_wpaDir->setText(settings[QString("CTRL_DIR")]);
|
||||
ui->lineEdit_wpaGroup->setText(settings[QString("CTRL_GROUP")]);
|
||||
if (settings[QString("FORCE_SUDO")] == QString("true"))
|
||||
ui->lineEdit_wpaDir->setText(config[QString("CTRL_DIR")]);
|
||||
ui->lineEdit_wpaGroup->setText(config[QString("CTRL_GROUP")]);
|
||||
if (config[QString("FORCE_SUDO")] == QString("true"))
|
||||
ui->checkBox_forceSudo->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->checkBox_forceSudo->setCheckState(Qt::Unchecked);
|
||||
ui->lineEdit_helperPath->setText(settings[QString("HELPER_PATH")]);
|
||||
ui->lineEdit_helperService->setText(settings[QString("HELPER_SERVICE")]);
|
||||
ui->lineEdit_interfacesDir->setText(settings[QString("IFACE_DIR")]);
|
||||
ui->lineEdit_helperPath->setText(config[QString("HELPER_PATH")]);
|
||||
ui->lineEdit_helperService->setText(config[QString("HELPER_SERVICE")]);
|
||||
ui->lineEdit_interfacesDir->setText(config[QString("IFACE_DIR")]);
|
||||
ui->comboBox_language->setCurrentIndex(0);
|
||||
for (int i=0; i<ui->comboBox_language->count(); i++)
|
||||
if (ui->comboBox_language->itemText(i) == settings[QString("LANGUAGE")])
|
||||
if (ui->comboBox_language->itemText(i) == config[QString("LANGUAGE")]) {
|
||||
ui->comboBox_language->setCurrentIndex(i);
|
||||
ui->lineEdit_netctlPath->setText(settings[QString("NETCTL_PATH")]);
|
||||
ui->lineEdit_netctlAutoPath->setText(settings[QString("NETCTLAUTO_PATH")]);
|
||||
ui->lineEdit_netctlAutoService->setText(settings[QString("NETCTLAUTO_SERVICE")]);
|
||||
ui->lineEdit_pid->setText(settings[QString("PID_FILE")]);
|
||||
ui->lineEdit_interface->setText(settings[QString("PREFERED_IFACE")]);
|
||||
ui->lineEdit_profilePath->setText(settings[QString("PROFILE_DIR")]);
|
||||
ui->lineEdit_rfkill->setText(settings[QString("RFKILL_DIR")]);
|
||||
if (settings[QString("STARTTOTRAY")] == QString("true"))
|
||||
break;
|
||||
}
|
||||
ui->lineEdit_netctlPath->setText(config[QString("NETCTL_PATH")]);
|
||||
ui->lineEdit_netctlAutoPath->setText(config[QString("NETCTLAUTO_PATH")]);
|
||||
ui->lineEdit_netctlAutoService->setText(config[QString("NETCTLAUTO_SERVICE")]);
|
||||
ui->lineEdit_pid->setText(config[QString("PID_FILE")]);
|
||||
ui->lineEdit_interface->setText(config[QString("PREFERED_IFACE")]);
|
||||
ui->lineEdit_profilePath->setText(config[QString("PROFILE_DIR")]);
|
||||
ui->lineEdit_rfkill->setText(config[QString("RFKILL_DIR")]);
|
||||
if (config[QString("SKIPCOMPONENTS")] == QString("true"))
|
||||
ui->checkBox_components->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->checkBox_components->setCheckState(Qt::Unchecked);
|
||||
if (config[QString("STARTTOTRAY")] == QString("true"))
|
||||
ui->checkBox_startToTray->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->checkBox_startToTray->setCheckState(Qt::Unchecked);
|
||||
ui->lineEdit_sudo->setText(settings[QString("SUDO_PATH")]);
|
||||
ui->lineEdit_systemctlPath->setText(settings[QString("SYSTEMCTL_PATH")]);
|
||||
if (settings[QString("SYSTRAY")] == QString("true"))
|
||||
ui->lineEdit_sudo->setText(config[QString("SUDO_PATH")]);
|
||||
ui->lineEdit_systemctlPath->setText(config[QString("SYSTEMCTL_PATH")]);
|
||||
if (config[QString("SYSTRAY")] == QString("true"))
|
||||
ui->checkBox_enableTray->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->checkBox_enableTray->setCheckState(Qt::Unchecked);
|
||||
if (settings[QString("USE_HELPER")] == QString("true"))
|
||||
if (config[QString("USE_HELPER")] == QString("true"))
|
||||
ui->checkBox_useHelper->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->checkBox_useHelper->setCheckState(Qt::Unchecked);
|
||||
ui->lineEdit_wpaCliPath->setText(settings[QString("WPACLI_PATH")]);
|
||||
ui->lineEdit_wpaSupPath->setText(settings[QString("WPASUP_PATH")]);
|
||||
ui->lineEdit_wpaSupDrivers->setText(settings[QString("WPA_DRIVERS")]);
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
|
||||
ui->lineEdit_wpaCliPath->setText(config[QString("WPACLI_PATH")]);
|
||||
ui->lineEdit_wpaSupPath->setText(config[QString("WPASUP_PATH")]);
|
||||
ui->lineEdit_wpaSupDrivers->setText(config[QString("WPA_DRIVERS")]);
|
||||
|
||||
for (int i=0; i<config.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << config.keys()[i] + QString("=") +
|
||||
config[config.keys()[i]];
|
||||
}
|
||||
|
||||
|
||||
@ -344,61 +400,66 @@ QMap<QString, QString> SettingsWindow::getDefault()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QMap<QString, QString> settings;
|
||||
settings[QString("CLOSE_HELPER")] = QString("false");
|
||||
settings[QString("CLOSETOTRAY")] = QString("true");
|
||||
settings[QString("CTRL_DIR")] = QString("/run/wpa_supplicant_netctl-gui");
|
||||
settings[QString("CTRL_GROUP")] = QString("users");
|
||||
settings[QString("FORCE_SUDO")] = QString("false");
|
||||
settings[QString("HELPER_PATH")] = QString("/usr/bin/netctlgui-helper");
|
||||
settings[QString("HELPER_SERVICE")] = QString("netctlgui-helper.service");
|
||||
settings[QString("IFACE_DIR")] = QString("/sys/class/net/");
|
||||
settings[QString("LANGUAGE")] = QString("en");
|
||||
settings[QString("NETCTL_PATH")] = QString("/usr/bin/netctl");
|
||||
settings[QString("NETCTLAUTO_PATH")] = QString("/usr/bin/netctl-auto");
|
||||
settings[QString("NETCTLAUTO_SERVICE")] = QString("netctl-auto");
|
||||
settings[QString("PID_FILE")] = QString("/run/wpa_supplicant_netctl-gui.pid");
|
||||
settings[QString("PREFERED_IFACE")] = QString("");
|
||||
settings[QString("PROFILE_DIR")] = QString("/etc/netctl/");
|
||||
settings[QString("RFKILL_DIR")] = QString("/sys/class/rfkill/");
|
||||
settings[QString("STARTTOTRAY")] = QString("false");
|
||||
settings[QString("SUDO_PATH")] = QString("/usr/bin/kdesu");
|
||||
settings[QString("SYSTEMCTL_PATH")] = QString("/usr/bin/systemctl");
|
||||
settings[QString("SYSTRAY")] = QString("true");
|
||||
settings[QString("USE_HELPER")] = QString("true");
|
||||
settings[QString("WPACLI_PATH")] = QString("/usr/bin/wpa_cli");
|
||||
settings[QString("WPASUP_PATH")] = QString("/usr/bin/wpa_supplicant");
|
||||
settings[QString("WPA_DRIVERS")] = QString("nl80211,wext");
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
|
||||
|
||||
return settings;
|
||||
return getSettings(QString("/dev/null"));
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> SettingsWindow::getSettings()
|
||||
QMap<QString, QString> SettingsWindow::getSettings(QString fileName)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (fileName == QString("")) fileName = file;
|
||||
|
||||
QMap<QString, QString> settings = getDefault();
|
||||
QFile configFile(file);
|
||||
QString fileStr;
|
||||
if (!configFile.open(QIODevice::ReadOnly))
|
||||
return settings;
|
||||
while (true) {
|
||||
fileStr = QString(configFile.readLine()).trimmed();
|
||||
if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue;
|
||||
if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue;
|
||||
if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue;
|
||||
if (fileStr.contains(QChar('=')))
|
||||
settings[fileStr.split(QChar('='))[0]] = fileStr.split(QChar('='))[1];
|
||||
if (configFile.atEnd()) break;
|
||||
}
|
||||
configFile.close();
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
|
||||
QMap<QString, QString> config;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
|
||||
return settings;
|
||||
settings.beginGroup(QString("General"));
|
||||
config[QString("LANGUAGE")] = settings.value(QString("LANGUAGE"), QString("en")).toString();
|
||||
config[QString("SYSTRAY")] = settings.value(QString("SYSTRAY"), QString("true")).toString();
|
||||
config[QString("CLOSETOTRAY")] = settings.value(QString("CLOSETOTRAY"), QString("true")).toString();
|
||||
config[QString("STARTTOTRAY")] = settings.value(QString("STARTTOTRAY"), QString("false")).toString();
|
||||
config[QString("SKIPCOMPONENTS")] = settings.value(QString("SKIPCOMPONENTS"), QString("false")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Helper"));
|
||||
config[QString("USE_HELPER")] = settings.value(QString("USE_HELPER"), QString("true")).toString();
|
||||
config[QString("FORCE_SUDO")] = settings.value(QString("FORCE_SUDO"), QString("false")).toString();
|
||||
config[QString("CLOSE_HELPER")] = settings.value(QString("CLOSE_HELPER"), QString("false")).toString();
|
||||
config[QString("HELPER_PATH")] = settings.value(QString("HELPER_PATH"), QString("/usr/bin/netctlgui-helper")).toString();
|
||||
config[QString("HELPER_SERVICE")] = settings.value(QString("HELPER_SERVICE"), QString("netctlgui-helper.service")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("netctl"));
|
||||
config[QString("SYSTEMCTL_PATH")] = settings.value(QString("SYSTEMCTL_PATH"), QString("/usr/bin/systemctl")).toString();
|
||||
config[QString("NETCTL_PATH")] = settings.value(QString("NETCTL_PATH"), QString("/usr/bin/netctl")).toString();
|
||||
config[QString("NETCTLAUTO_PATH")] = settings.value(QString("NETCTLAUTO_PATH"), QString("/usr/bin/netctl-auto")).toString();
|
||||
config[QString("NETCTLAUTO_SERVICE")] = settings.value(QString("NETCTLAUTO_SERVICE"), QString("netctl-auto")).toString();
|
||||
config[QString("PROFILE_DIR")] = settings.value(QString("PROFILE_DIR"), QString("/etc/netctl")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("sudo"));
|
||||
config[QString("SUDO_PATH")] = settings.value(QString("SUDO_PATH"), QString("/usr/bin/kdesu")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("wpa_supplicant"));
|
||||
config[QString("WPASUP_PATH")] = settings.value(QString("WPASUP_PATH"), QString("/usr/bin/wpa_supplicant")).toString();
|
||||
config[QString("WPACLI_PATH")] = settings.value(QString("WPACLI_PATH"), QString("/usr/bin/wpa_cli")).toString();
|
||||
config[QString("PID_FILE")] = settings.value(QString("PID_FILE"), QString("/run/wpa_supplicant_netctl-gui.pid")).toString();
|
||||
config[QString("WPA_DRIVERS")] = settings.value(QString("WPA_DRIVERS"), QString("nl80211,wext")).toString();
|
||||
config[QString("CTRL_DIR")] = settings.value(QString("CTRL_DIR"), QString("/run/wpa_supplicant_netctl-gui")).toString();
|
||||
config[QString("CTRL_GROUP")] = settings.value(QString("CTRL_GROUP"), QString("users")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Other"));
|
||||
config[QString("IFACE_DIR")] = settings.value(QString("IFACE_DIR"), QString("/sys/class/net/")).toString();
|
||||
config[QString("RFKILL_DIR")] = settings.value(QString("RFKILL_DIR"), QString("/sys/class/rfkill/")).toString();
|
||||
config[QString("PREFERED_IFACE")] = settings.value(QString("PREFERED_IFACE"), QString("")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
for (int i=0; i<config.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << config.keys()[i] + QString("=") +
|
||||
config[config.keys()[i]];
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
const QString configFile = QString(""));
|
||||
~SettingsWindow();
|
||||
QMap<QString, QString> getDefault();
|
||||
QMap<QString, QString> getSettings();
|
||||
QMap<QString, QString> getSettings(QString fileName = QString(""));
|
||||
|
||||
public slots:
|
||||
void closeWindow();
|
||||
@ -65,7 +65,7 @@ private:
|
||||
// ESC pressed event
|
||||
void keyPressEvent(QKeyEvent *pressedKey);
|
||||
QMap<QString, QString> readSettings();
|
||||
void setSettings(const QMap<QString, QString> settings);
|
||||
void setSettings(const QMap<QString, QString> config);
|
||||
};
|
||||
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>680</width>
|
||||
<height>397</height>
|
||||
<width>678</width>
|
||||
<height>395</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -73,7 +73,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../resources/resources.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
<normaloff>:/icon-helper.png</normaloff>:/icon-helper.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -136,8 +136,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>464</width>
|
||||
<height>336</height>
|
||||
<width>462</width>
|
||||
<height>330</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
@ -180,6 +180,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_components">
|
||||
<property name="text">
|
||||
<string>Skip components checking</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_general">
|
||||
<property name="orientation">
|
||||
@ -211,8 +218,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>397</width>
|
||||
<height>322</height>
|
||||
<width>462</width>
|
||||
<height>330</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
@ -296,16 +303,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_helperPathInfo">
|
||||
<property name="text">
|
||||
<string>There are too binaries. `netctlgui-helper` should be running as root (for example from systemd), otherwise interface `/ctrl` will not be available. `netctlgui-helper-suid` may be running as normal user, but you should keep it in mind that it has SUID bit.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_helperPath">
|
||||
<item>
|
||||
@ -392,7 +389,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>165</height>
|
||||
<height>173</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
@ -579,7 +576,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>43</height>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
@ -649,7 +646,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>277</width>
|
||||
<height>190</height>
|
||||
<height>194</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
@ -846,7 +843,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>103</height>
|
||||
<height>107</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
|
@ -1 +0,0 @@
|
||||
../../3rdparty/task/task.h
|
@ -1 +0,0 @@
|
||||
../../3rdparty/task/taskadds.cpp
|
@ -1 +0,0 @@
|
||||
../../3rdparty/task/taskadds.h
|
@ -21,8 +21,9 @@
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "pdebug.h"
|
||||
|
||||
|
||||
TrayIcon::TrayIcon(QObject *parent, const bool debugCmd)
|
||||
@ -164,6 +165,8 @@ void TrayIcon::updateMenu()
|
||||
contextMenu[QString("gui")]->setText(QApplication::translate("TrayIcon", "Show"));
|
||||
else
|
||||
contextMenu[QString("gui")]->setText(QApplication::translate("TrayIcon", "Hide"));
|
||||
|
||||
setContextMenu(menuActions);
|
||||
}
|
||||
|
||||
|
||||
@ -175,6 +178,7 @@ void TrayIcon::createActions()
|
||||
|
||||
contextMenu[QString("title")] = new QAction(QIcon(":icon"), QApplication::translate("TrayIcon", "Status"), this);
|
||||
menuActions->addAction(contextMenu[QString("title")]);
|
||||
connect(contextMenu[QString("title")], SIGNAL(triggered(bool)), this, SLOT(showInformationInWindow()));
|
||||
|
||||
menuActions->addSeparator();
|
||||
|
||||
@ -232,9 +236,7 @@ void TrayIcon::init()
|
||||
setToolTip(QString("netctl-gui"));
|
||||
|
||||
createActions();
|
||||
setContextMenu(menuActions);
|
||||
|
||||
connect(this, SIGNAL(messageClicked()), this, SLOT(showInformationInWindow()));
|
||||
connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||
this, SLOT(itemActivated(QSystemTrayIcon::ActivationReason)));
|
||||
}
|
||||
@ -253,6 +255,8 @@ void TrayIcon::itemActivated(const QSystemTrayIcon::ActivationReason reason)
|
||||
mainWindow->showMainWindow();
|
||||
break;
|
||||
case QSystemTrayIcon::Context:
|
||||
// clear menu before update
|
||||
setContextMenu(0);
|
||||
updateMenu();
|
||||
break;
|
||||
default:
|
||||
|
@ -55,6 +55,7 @@ _netctl_gui_settings=(
|
||||
'PREFERED_IFACE'
|
||||
'PROFILE_DIR'
|
||||
'RFKILL_DIR'
|
||||
'SKIPCOMPONENTS'
|
||||
'STARTTOTRAY'
|
||||
'SUDO_PATH'
|
||||
'SYSTEMCTL_PATH'
|
||||
|
@ -24,7 +24,7 @@ configure_file (${SUBPROJECT_MAN_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MA
|
||||
configure_file (${SUBPROJECT_MAN5_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN5})
|
||||
|
||||
install (FILES org.netctlgui.helper.conf DESTINATION ${DBUS_SYSTEMCONF_PATH})
|
||||
install (FILES netctlgui-helper.conf DESTINATION /etc)
|
||||
install (FILES netctl-gui.conf DESTINATION /etc)
|
||||
install (FILES netctlgui-helper.service DESTINATION ${SYSTEMD_SERVICE_PATH})
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN} DESTINATION share/man/man1/)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN5} DESTINATION share/man/man5/)
|
||||
|
@ -25,6 +25,7 @@ _netctlgui_helper_arglist=(
|
||||
'--nodaemon'
|
||||
'--replace'
|
||||
'--restore'
|
||||
'--session'
|
||||
'--system'
|
||||
'-v'
|
||||
'--version'
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Configuration file for Netctl GUI project
|
||||
# /etc/netctlgui-helper.conf - system-wide configuration
|
||||
# /etc/netctl-gui.conf - system-wide configuration
|
||||
# $HOME/.config/netctl-gui.conf - user configuration
|
||||
|
||||
# close helper after GUI application quit.
|
||||
@ -39,6 +39,9 @@ PROFILE_DIR=/etc/netctl/
|
||||
# path to directory with rfkill devices.
|
||||
# This option is not recognized by netctlgui-helper
|
||||
RFKILL_DIR=/sys/class/rfkill/
|
||||
# skip external components checking
|
||||
# This option is not recognized by netctlgui-helper
|
||||
SKIPCOMPONENTS=false
|
||||
# start netctl-gui minimized to tray if it is available.
|
||||
# This option is not recognized by netctlgui-helper
|
||||
STARTTOTRAY=false
|
@ -1,13 +1,13 @@
|
||||
.TH netctlgui-helper.conf 5 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "File Formats Manual"
|
||||
.TH netctl-gui.conf 5 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "File Formats Manual"
|
||||
.SH NAME
|
||||
netctlgui-helper.conf is a configuration file of Netctl GUI project
|
||||
netctl-gui.conf is a configuration file of Netctl GUI project
|
||||
.SH SYNOPSIS
|
||||
.B /etc/netctlgui-helper.conf
|
||||
.B /etc/netctl-gui.conf
|
||||
for system-wide configuration or
|
||||
.B $HOME/.config/netctl-gui.conf
|
||||
for user one
|
||||
.SH DESCRIPTION
|
||||
.B netctlgui-helper.conf
|
||||
.B netctl-gui.conf
|
||||
is a file which contains parameters for
|
||||
.BR netctlgui-helper (1)
|
||||
and may be used as template for
|
||||
@ -70,6 +70,9 @@ path to directory with
|
||||
.BR rfkill (8)
|
||||
devices. This option is not recognized by
|
||||
.BR netctlgui-helper (1)
|
||||
.IP "SKIPCOMPONENTS=false"
|
||||
skip external components checking. This option is not recognized by
|
||||
.BR netctlgui-helper (1)
|
||||
.IP "STARTTOTRAY=false"
|
||||
start
|
||||
.BR netctl-gui (1)
|
@ -23,6 +23,8 @@ do not run as daemon
|
||||
force replace the existing session
|
||||
.IP "--restore"
|
||||
force restore the existing session
|
||||
.IP "--session"
|
||||
force create user DBus session
|
||||
.IP "--system"
|
||||
do not read user configuration
|
||||
.IP "-v, --version"
|
||||
@ -34,7 +36,7 @@ show this help and exit
|
||||
.SH FILES
|
||||
.I $HOME/.config/netctl-gui.conf
|
||||
,
|
||||
.I /etc/netctlgui-helper.conf
|
||||
.I /etc/netctl-gui.conf
|
||||
.RS
|
||||
Configuration files
|
||||
.RE
|
||||
@ -64,7 +66,7 @@ By the way it is highly recommended to copy source service file before to
|
||||
and edit copied file to avoid upgrade problems.
|
||||
.SH SEE ALSO
|
||||
.BR netctl-gui (1)
|
||||
.BR netctlgui-helper.conf (5)
|
||||
.BR netctl-gui.conf (5)
|
||||
.SH STANDARDS
|
||||
See
|
||||
.B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-dbus-api.html
|
||||
|
@ -1,9 +1,11 @@
|
||||
[Unit]
|
||||
Description=netctlgui-helper daemon
|
||||
Documentation=man:netctlgui-helper(1) man:netctl-gui.conf(5)
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/usr/bin/netctlgui-helper --system
|
||||
Type=dbus
|
||||
BusName=org.netctlgui.helper
|
||||
ExecStart=/usr/bin/netctlgui-helper --nodaemon --system
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -1,6 +1,8 @@
|
||||
# set files
|
||||
file (GLOB SOURCES *.cpp)
|
||||
file (GLOB HEADERS *.h)
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp)
|
||||
file (GLOB_RECURSE HEADERS *.h ${PROJECT_TRDPARTY_DIR}/task/*.h
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.h)
|
||||
|
||||
file (GLOB LANGUAGES ${SUBPROJECT_TRANSLATION_DIR}/*.ts)
|
||||
set (RESOURCES ${SUBPROJECT_RESOURCE_DIR}/resources-helper.qrc)
|
||||
@ -10,49 +12,49 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../${PROJECT_LIBRARY}/includ
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_TRDPARTY_DIR})
|
||||
link_directories (${PROJECT_LIBRARY}/src/lib)
|
||||
|
||||
if (USE_QT5)
|
||||
find_package(Qt5 COMPONENTS Core DBus LinguistTools REQUIRED)
|
||||
add_definitions(${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5LinguistTools_DEFINITIONS})
|
||||
include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
|
||||
set (QT_NEEDED_LIBS ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES})
|
||||
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
qt5_add_resources (QRC_SOURCES ${RESOURCES})
|
||||
find_package (Qt5 COMPONENTS Core DBus LinguistTools REQUIRED)
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5LinguistTools_DEFINITIONS})
|
||||
include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
|
||||
set (QT_NEEDED_LIBS ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES})
|
||||
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
qt5_add_resources (QRC_SOURCES ${RESOURCES})
|
||||
|
||||
foreach (LANGUAGE ${LANGUAGES})
|
||||
set (TS ${LANGUAGE})
|
||||
string (REPLACE ".ts" ".qm" QM ${TS})
|
||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||
add_custom_command (OUTPUT ${QM} COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||
endforeach ()
|
||||
add_custom_target (translations-helper COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} -ts ${TRANSLATIONS})
|
||||
add_custom_command (TARGET translations-helper COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
||||
foreach (LANGUAGE ${LANGUAGES})
|
||||
set (TS ${LANGUAGE})
|
||||
string (REPLACE ".ts" ".qm" QM ${TS})
|
||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||
add_custom_command (OUTPUT ${QM} COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||
endforeach ()
|
||||
add_custom_target (translations-helper COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} -ts ${TRANSLATIONS})
|
||||
add_custom_command (TARGET translations-helper COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
||||
else ()
|
||||
find_package (Qt4 COMPONENTS QtCore QtDBus REQUIRED)
|
||||
include (${QT_USE_FILE})
|
||||
set (QT_NEEDED_LIBS ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY})
|
||||
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
qt4_add_resources (QRC_SOURCES ${RESOURCES})
|
||||
find_package (Qt4 COMPONENTS QtCore QtDBus REQUIRED)
|
||||
include (${QT_USE_FILE})
|
||||
set (QT_NEEDED_LIBS ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY})
|
||||
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
qt4_add_resources (QRC_SOURCES ${RESOURCES})
|
||||
|
||||
foreach (LANGUAGE ${LANGUAGES})
|
||||
set (TS ${LANGUAGE})
|
||||
string (REPLACE ".ts" ".qm" QM ${TS})
|
||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||
endforeach ()
|
||||
add_custom_target (translations-header COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} -ts ${TRANSLATIONS})
|
||||
add_custom_command (TARGET translations-header COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
||||
foreach (LANGUAGE ${LANGUAGES})
|
||||
set (TS ${LANGUAGE})
|
||||
string (REPLACE ".ts" ".qm" QM ${TS})
|
||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||
endforeach ()
|
||||
add_custom_target (translations-helper COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} -ts ${TRANSLATIONS})
|
||||
add_custom_command (TARGET translations-helper COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
||||
endif()
|
||||
|
||||
add_executable (${SUBPROJECT} ${SOURCES} ${HEADERS} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
||||
target_link_libraries (${SUBPROJECT} ${PROJECT_LIBRARY} ${QT_NEEDED_LIBS})
|
||||
add_executable (${SUBPROJECT}-suid ${SOURCES} ${HEADERS} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
||||
target_link_libraries (${SUBPROJECT}-suid ${PROJECT_LIBRARY} ${QT_NEEDED_LIBS})
|
||||
# install properties
|
||||
install (TARGETS ${SUBPROJECT} DESTINATION bin)
|
||||
install (TARGETS ${SUBPROJECT}-suid DESTINATION bin
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE SETUID)
|
||||
if (USE_CAPABILITIES)
|
||||
install (CODE "exec_program (setcap ARGS \"cap_setuid=ep\" \"$ENV{DESTDIR}/bin/${SUBPROJECT}\")")
|
||||
endif ()
|
||||
|
@ -186,6 +186,18 @@ bool ControlAdaptor::Enable(const QString profile)
|
||||
}
|
||||
|
||||
|
||||
bool ControlAdaptor::forceStart(const QString profile)
|
||||
{
|
||||
return netctlCommand->forceStartProfile(profile);
|
||||
}
|
||||
|
||||
|
||||
bool ControlAdaptor::forceStop(const QString profile)
|
||||
{
|
||||
return netctlCommand->forceStopProfile(profile);
|
||||
}
|
||||
|
||||
|
||||
bool ControlAdaptor::Reenable(const QString profile)
|
||||
{
|
||||
return netctlCommand->reenableProfile(profile);
|
||||
|
@ -57,6 +57,8 @@ public slots:
|
||||
bool autoServiceRestart();
|
||||
bool autoServiceStart();
|
||||
bool Enable(const QString profile);
|
||||
bool forceStart(const QString profile);
|
||||
bool forceStop(const QString profile);
|
||||
bool Reenable(const QString profile);
|
||||
bool Restart(const QString profile);
|
||||
bool Start(const QString profile);
|
||||
|
@ -1 +0,0 @@
|
||||
../../gui/src/language.cpp
|
@ -1 +0,0 @@
|
||||
../../gui/src/language.h
|
@ -25,7 +25,8 @@
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "language.h"
|
||||
#include <language/language.h>
|
||||
|
||||
#include "messages.h"
|
||||
#include "netctlhelper.h"
|
||||
#include "version.h"
|
||||
@ -42,7 +43,7 @@ bool existingSessionOperation(const QString operation)
|
||||
QDBusMessage response = bus.call(request);
|
||||
QList<QVariant> arguments = response.arguments();
|
||||
|
||||
return !arguments.isEmpty();
|
||||
return (!arguments.isEmpty() && bool(arguments[0].toInt()));
|
||||
}
|
||||
|
||||
|
||||
@ -67,6 +68,9 @@ int main(int argc, char *argv[])
|
||||
} else if (QString(argv[i]) == QString("--restore")) {
|
||||
// restore
|
||||
args[QString("state")] = (int) 2;
|
||||
} else if (QString(argv[i]) == QString("--session")) {
|
||||
// session
|
||||
args[QString("session")] = true;
|
||||
} else if (QString(argv[i]) == QString("--system")) {
|
||||
// system
|
||||
args[QString("system")] = true;
|
||||
@ -91,10 +95,11 @@ int main(int argc, char *argv[])
|
||||
args[QString("nodaemon")] = true;
|
||||
// check euid
|
||||
if (geteuid() != 0) {
|
||||
cout << QCoreApplication::translate("NetctlHelper", "The helper is running with EUID %1. Some functions will not be available.")
|
||||
cout << QCoreApplication::translate("NetctlHelper", "The helper is running with EUID %1. Some functions may not be available.")
|
||||
.arg(QString::number(geteuid())).toUtf8().data() << endl;
|
||||
cout << QCoreApplication::translate("NetctlHelper", "See security notes for more details.")
|
||||
.toUtf8().data() << endl;
|
||||
args[QString("session")] = true;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
|
@ -25,9 +25,7 @@
|
||||
|
||||
QString errorMessage()
|
||||
{
|
||||
QString errorMessage = QCoreApplication::translate("NetctlHelper", "Unknown flag\n");
|
||||
|
||||
return errorMessage;
|
||||
return QCoreApplication::translate("NetctlHelper", "Unknown flag\n");
|
||||
}
|
||||
|
||||
|
||||
@ -37,6 +35,7 @@ QMap<QString, QVariant> getArgs()
|
||||
args[QString("config")] = QString(QDir::homePath() + QString("/.config/netctl-gui.conf"));
|
||||
args[QString("debug")] = false;
|
||||
args[QString("nodaemon")] = false;
|
||||
args[QString("session")] = false;
|
||||
args[QString("state")] = (int) 0;
|
||||
args[QString("system")] = false;
|
||||
args[QString("help")] = false;
|
||||
@ -65,6 +64,8 @@ QString helpMessage()
|
||||
.arg(QCoreApplication::translate("NetctlHelper", "force replace the existing session"));
|
||||
helpMessage += QString(" --restore - %1\n")
|
||||
.arg(QCoreApplication::translate("NetctlHelper", "force restore the existing session"));
|
||||
helpMessage += QString(" --session - %1\n")
|
||||
.arg(QCoreApplication::translate("NetctlHelper", "force create user DBus session"));
|
||||
helpMessage += QString(" --system - %1\n")
|
||||
.arg(QCoreApplication::translate("NetctlHelper", "do not read user configuration, system-wide only"));
|
||||
helpMessage += QString(" %1\n").arg(QCoreApplication::translate("NetctlHelper", "Show messages:"));
|
||||
@ -85,15 +86,30 @@ QString infoMessage()
|
||||
// build information
|
||||
infoMessage += QCoreApplication::translate("NetctlHelper", "Build date: %1").
|
||||
arg(QString(BUILD_DATE));
|
||||
// cmake
|
||||
infoMessage += QString("\n%1:\n").arg(QCoreApplication::translate("NetctlHelper", "cmake flags"));
|
||||
infoMessage += QString("\t-DCMAKE_BUILD_TYPE=%1 \\\n").arg(QString(CMAKE_BUILD_TYPE));
|
||||
infoMessage += QString("\t-DCMAKE_INSTALL_PREFIX=%1 \\\n").arg(QString(CMAKE_INSTALL_PREFIX));
|
||||
infoMessage += QString("\t-DBUILD_DOCS=%1 \\\n").arg(QString(PROJECT_BUILD_DOCS));
|
||||
infoMessage += QString("\t-DBUILD_LIBRARY=%1 \\\n").arg(QString(PROJECT_BUILD_LIBRARY));
|
||||
infoMessage += QString("\t-DBUILD_GUI=%1 \\\n").arg(QString(PROJECT_BUILD_GUI));
|
||||
infoMessage += QString("\t-DUSE_QT5=%1 \\\n").arg(QString(PROJECT_USE_QT5));
|
||||
infoMessage += QString("\t-DBUILD_DATAENGINE=%1 \\\n").arg(QString(PROJECT_BUILD_DATAENGINE));
|
||||
// cmake properties
|
||||
infoMessage += QString("%1:\n").arg(QCoreApplication::translate("NetctlHelper", "cmake properties"));
|
||||
infoMessage += QString("\t-DCMAKE_BUILD_TYPE=%1\n").arg(QString(CMAKE_BUILD_TYPE));
|
||||
infoMessage += QString("\t-DCMAKE_INSTALL_PREFIX=%1\n").arg(QString(CMAKE_INSTALL_PREFIX));
|
||||
// components
|
||||
infoMessage += QString("%1:\n").arg(QCoreApplication::translate("NetctlHelper", "Components"));
|
||||
infoMessage += QString("\t-DBUILD_DATAENGINE=%1\n").arg(QString(PROJECT_BUILD_DATAENGINE));
|
||||
infoMessage += QString("\t-DBUILD_GUI=%1\n").arg(QString(PROJECT_BUILD_GUI));
|
||||
infoMessage += QString("\t-DBUILD_HELPER=%1\n").arg(QString(PROJECT_BUILD_HELPER));
|
||||
infoMessage += QString("\t-DBUILD_LIBRARY=%1\n").arg(QString(PROJECT_BUILD_LIBRARY));
|
||||
infoMessage += QString("\t-DBUILD_PLASMOID=%1\n").arg(QString(PROJECT_BUILD_PLASMOID));
|
||||
// additional components
|
||||
infoMessage += QString("%1:\n").arg(QCoreApplication::translate("NetctlHelper", "Additional components"));
|
||||
infoMessage += QString("\t-DBUILD_DOCS=%1\n").arg(QString(PROJECT_BUILD_DOCS));
|
||||
infoMessage += QString("\t-DBUILD_TEST=%1\n").arg(QString(PROJECT_BUILD_TEST));
|
||||
// project properties
|
||||
infoMessage += QString("%1:\n").arg(QCoreApplication::translate("NetctlHelper", "Project properties"));
|
||||
infoMessage += QString("\t-DDBUS_SYSTEMCONF_PATH=%1\n").arg(QString(PROJECT_DBUS_SYSTEMCONF_PATH));
|
||||
infoMessage += QString("\t-DSYSTEMD_SERVICE_PATH=%1\n").arg(QString(PROJECT_SYSTEMD_SERVICE_PATH));
|
||||
infoMessage += QString("\t-DUSE_CAPABILITIES=%1\n").arg(QString(PROJECT_USE_CAPABILITIES));
|
||||
infoMessage += QString("\t-DUSE_KDE4=%1\n").arg(QString(PROJECT_USE_KDE4));
|
||||
infoMessage += QString("\t-DUSE_QT5=%1\n").arg(QString(PROJECT_USE_QT5));
|
||||
// transport information
|
||||
infoMessage += QString("%1:\n").arg(QCoreApplication::translate("NetctlHelper", "DBus configuration"));
|
||||
infoMessage += QString("\tDBUS_SERVICE=%1\n").arg(QString(DBUS_SERVICE));
|
||||
@ -106,9 +122,6 @@ QString infoMessage()
|
||||
// docs path
|
||||
infoMessage += QString("%1:\n").arg(QCoreApplication::translate("NetctlHelper", "Documentation"));
|
||||
infoMessage += QString("\tDOCS_PATH=%1\n").arg(QString(DOCS_PATH));
|
||||
QStringList docs = QDir(QString(DOCS_PATH)).entryList(QDir::NoDotAndDotDot);
|
||||
for (int i=0; i<docs.count(); i++)
|
||||
infoMessage += QString("\t%1\n").arg(docs[i]);
|
||||
|
||||
return infoMessage;
|
||||
}
|
||||
|
@ -21,13 +21,14 @@
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusError>
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "controladaptor.h"
|
||||
#include "netctladaptor.h"
|
||||
#include "pdebug.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
@ -35,6 +36,7 @@ NetctlHelper::NetctlHelper(QObject *parent, QMap<QString, QVariant> args)
|
||||
: QObject(parent),
|
||||
configPath(args[QString("config")].toString()),
|
||||
debug(args[QString("debug")].toBool()),
|
||||
session(args[QString("session")].toBool()),
|
||||
system(args[QString("system")].toBool())
|
||||
{
|
||||
updateConfiguration();
|
||||
@ -88,6 +90,25 @@ void NetctlHelper::createInterface()
|
||||
if (debug) qDebug() << PDEBUG << ":" << bus.lastError().message();
|
||||
return quitHelper();
|
||||
}
|
||||
// session bus
|
||||
if (!session) return;
|
||||
QDBusConnection sessionBus = QDBusConnection::sessionBus();
|
||||
if (!sessionBus.registerService(DBUS_HELPER_SERVICE)) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not register session service";
|
||||
if (debug) qDebug() << PDEBUG << ":" << sessionBus.lastError().message();
|
||||
}
|
||||
if (!sessionBus.registerObject(DBUS_LIB_PATH,
|
||||
new NetctlAdaptor(this, debug, configuration),
|
||||
QDBusConnection::ExportAllContents)) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not register session library object";
|
||||
if (debug) qDebug() << PDEBUG << ":" << sessionBus.lastError().message();
|
||||
}
|
||||
if (!sessionBus.registerObject(DBUS_CTRL_PATH,
|
||||
new ControlAdaptor(this, debug, configuration),
|
||||
QDBusConnection::ExportAllContents)) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not register session control object";
|
||||
if (debug) qDebug() << PDEBUG << ":" << sessionBus.lastError().message();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -98,72 +119,69 @@ void NetctlHelper::deleteInterface()
|
||||
QDBusConnection::systemBus().unregisterObject(DBUS_LIB_PATH);
|
||||
QDBusConnection::systemBus().unregisterObject(DBUS_CTRL_PATH);
|
||||
QDBusConnection::systemBus().unregisterService(DBUS_HELPER_SERVICE);
|
||||
// session bus
|
||||
if (!session) return;
|
||||
QDBusConnection::sessionBus().unregisterObject(DBUS_LIB_PATH);
|
||||
QDBusConnection::sessionBus().unregisterObject(DBUS_CTRL_PATH);
|
||||
QDBusConnection::sessionBus().unregisterService(DBUS_HELPER_SERVICE);
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> NetctlHelper::getDefault()
|
||||
QMap<QString, QString> NetctlHelper::getSettings(const QString file)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QMap<QString, QString> settings;
|
||||
settings[QString("CLOSE_HELPER")] = QString("false");
|
||||
settings[QString("CLOSETOTRAY")] = QString("true");
|
||||
settings[QString("CTRL_DIR")] = QString("/run/wpa_supplicant_netctl-gui");
|
||||
settings[QString("CTRL_GROUP")] = QString("users");
|
||||
settings[QString("FORCE_SUDO")] = QString("false");
|
||||
settings[QString("HELPER_PATH")] = QString("/usr/bin/netctlgui-helper");
|
||||
settings[QString("HELPER_SERVICE")] = QString("netctlgui-helper.service");
|
||||
settings[QString("IFACE_DIR")] = QString("/sys/class/net/");
|
||||
settings[QString("LANGUAGE")] = QString("en");
|
||||
settings[QString("NETCTL_PATH")] = QString("/usr/bin/netctl");
|
||||
settings[QString("NETCTLAUTO_PATH")] = QString("/usr/bin/netctl-auto");
|
||||
settings[QString("NETCTLAUTO_SERVICE")] = QString("netctl-auto");
|
||||
settings[QString("PID_FILE")] = QString("/run/wpa_supplicant_netctl-gui.pid");
|
||||
settings[QString("PREFERED_IFACE")] = QString("");
|
||||
settings[QString("PROFILE_DIR")] = QString("/etc/netctl/");
|
||||
settings[QString("RFKILL_DIR")] = QString("/sys/class/rfkill/");
|
||||
settings[QString("STARTTOTRAY")] = QString("false");
|
||||
settings[QString("SUDO_PATH")] = QString("/usr/bin/kdesu");
|
||||
settings[QString("SYSTEMCTL_PATH")] = QString("/usr/bin/systemctl");
|
||||
settings[QString("SYSTRAY")] = QString("true");
|
||||
settings[QString("USE_HELPER")] = QString("true");
|
||||
settings[QString("WPACLI_PATH")] = QString("/usr/bin/wpa_cli");
|
||||
settings[QString("WPASUP_PATH")] = QString("/usr/bin/wpa_supplicant");
|
||||
settings[QString("WPA_DRIVERS")] = QString("nl80211,wext");
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
|
||||
QMap<QString, QString> config;
|
||||
QSettings settings(file, QSettings::IniFormat);
|
||||
|
||||
return settings;
|
||||
}
|
||||
settings.beginGroup(QString("General"));
|
||||
config[QString("LANGUAGE")] = settings.value(QString("LANGUAGE"), QString("en")).toString();
|
||||
config[QString("SYSTRAY")] = settings.value(QString("SYSTRAY"), QString("true")).toString();
|
||||
config[QString("CLOSETOTRAY")] = settings.value(QString("CLOSETOTRAY"), QString("true")).toString();
|
||||
config[QString("STARTTOTRAY")] = settings.value(QString("STARTTOTRAY"), QString("false")).toString();
|
||||
config[QString("SKIPCOMPONENTS")] = settings.value(QString("SKIPCOMPONENTS"), QString("false")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Helper"));
|
||||
config[QString("USE_HELPER")] = settings.value(QString("USE_HELPER"), QString("true")).toString();
|
||||
config[QString("FORCE_SUDO")] = settings.value(QString("FORCE_SUDO"), QString("false")).toString();
|
||||
config[QString("CLOSE_HELPER")] = settings.value(QString("CLOSE_HELPER"), QString("false")).toString();
|
||||
config[QString("HELPER_PATH")] = settings.value(QString("HELPER_PATH"), QString("/usr/bin/netctlgui-helper")).toString();
|
||||
config[QString("HELPER_SERVICE")] = settings.value(QString("HELPER_SERVICE"), QString("netctlgui-helper.service")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
QMap<QString, QString> NetctlHelper::getSettings(const QString file, const QMap<QString, QString> existing)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
settings.beginGroup(QString("netctl"));
|
||||
config[QString("SYSTEMCTL_PATH")] = settings.value(QString("SYSTEMCTL_PATH"), QString("/usr/bin/systemctl")).toString();
|
||||
config[QString("NETCTL_PATH")] = settings.value(QString("NETCTL_PATH"), QString("/usr/bin/netctl")).toString();
|
||||
config[QString("NETCTLAUTO_PATH")] = settings.value(QString("NETCTLAUTO_PATH"), QString("/usr/bin/netctl-auto")).toString();
|
||||
config[QString("NETCTLAUTO_SERVICE")] = settings.value(QString("NETCTLAUTO_SERVICE"), QString("netctl-auto")).toString();
|
||||
config[QString("PROFILE_DIR")] = settings.value(QString("PROFILE_DIR"), QString("/etc/netctl")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
QMap<QString, QString> settings;
|
||||
if (existing.isEmpty())
|
||||
settings = getDefault();
|
||||
else
|
||||
settings = existing;
|
||||
QFile configFile(file);
|
||||
QString fileStr;
|
||||
if (!configFile.open(QIODevice::ReadOnly))
|
||||
return settings;
|
||||
while (true) {
|
||||
fileStr = QString(configFile.readLine()).trimmed();
|
||||
if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue;
|
||||
if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue;
|
||||
if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue;
|
||||
if (fileStr.contains(QChar('=')))
|
||||
settings[fileStr.split(QChar('='))[0]] = fileStr.split(QChar('='))[1];
|
||||
if (configFile.atEnd()) break;
|
||||
}
|
||||
configFile.close();
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
|
||||
settings.beginGroup(QString("sudo"));
|
||||
config[QString("SUDO_PATH")] = settings.value(QString("SUDO_PATH"), QString("/usr/bin/kdesu")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
return settings;
|
||||
settings.beginGroup(QString("wpa_supplicant"));
|
||||
config[QString("WPASUP_PATH")] = settings.value(QString("WPASUP_PATH"), QString("/usr/bin/wpa_supplicant")).toString();
|
||||
config[QString("WPACLI_PATH")] = settings.value(QString("WPACLI_PATH"), QString("/usr/bin/wpa_cli")).toString();
|
||||
config[QString("PID_FILE")] = settings.value(QString("PID_FILE"), QString("/run/wpa_supplicant_netctl-gui.pid")).toString();
|
||||
config[QString("WPA_DRIVERS")] = settings.value(QString("WPA_DRIVERS"), QString("nl80211,wext")).toString();
|
||||
config[QString("CTRL_DIR")] = settings.value(QString("CTRL_DIR"), QString("/run/wpa_supplicant_netctl-gui")).toString();
|
||||
config[QString("CTRL_GROUP")] = settings.value(QString("CTRL_GROUP"), QString("users")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("Other"));
|
||||
config[QString("IFACE_DIR")] = settings.value(QString("IFACE_DIR"), QString("/sys/class/net/")).toString();
|
||||
config[QString("RFKILL_DIR")] = settings.value(QString("RFKILL_DIR"), QString("/sys/class/rfkill/")).toString();
|
||||
config[QString("PREFERED_IFACE")] = settings.value(QString("PREFERED_IFACE"), QString("")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
for (int i=0; i<config.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << config.keys()[i] + QString("=") +
|
||||
config[config.keys()[i]];
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
@ -172,9 +190,10 @@ void NetctlHelper::updateConfiguration()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
deleteInterface();
|
||||
configuration = getSettings(QString("/etc/netctlgui-helper.conf"));
|
||||
if (!system)
|
||||
configuration = getSettings(configPath, configuration);
|
||||
if (system)
|
||||
configuration = getSettings(QString("/etc/netctl-gui.conf"));
|
||||
else
|
||||
configuration = getSettings(configPath);
|
||||
createInterface();
|
||||
}
|
||||
|
||||
|
@ -41,12 +41,11 @@ private:
|
||||
QString configPath;
|
||||
QMap<QString, QString> configuration;
|
||||
bool debug;
|
||||
bool session;
|
||||
bool system;
|
||||
void createInterface();
|
||||
void deleteInterface();
|
||||
QMap<QString, QString> getDefault();
|
||||
QMap<QString, QString> getSettings(const QString file,
|
||||
const QMap<QString, QString> existing = QMap<QString, QString>());
|
||||
QMap<QString, QString> getSettings(const QString file);
|
||||
};
|
||||
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
../../3rdparty/pdebug/pdebug.h
|
@ -24,6 +24,7 @@ _netctlgui_helper_arglist=(
|
||||
{'--nodaemon','--nodaemon'}'[do not start as daemon]'
|
||||
{'--replace','--replace'}'[force replace the existing session]'
|
||||
{'--restore','--restore'}'[force restore the existing session]'
|
||||
{'--session','--session'}'[force create user DBus session]'
|
||||
{'--system','--system'}'[do not read user configuration]'
|
||||
{'(--version)-v','(-v)--version'}'[show version and exit]'
|
||||
{'(--info)-i','(-i)--info'}'[show build information and exit]'
|
||||
|
@ -15,5 +15,5 @@ add_subdirectory (${SUBPROJECT_SOURCE_DIR})
|
||||
install (DIRECTORY ${SUBPROJECT_INCLUDE_DIR}/ DESTINATION include/)
|
||||
# documentation
|
||||
if (BUILD_DOCS)
|
||||
include (docs.cmake)
|
||||
include (docs.cmake)
|
||||
endif ()
|
||||
|
@ -1,9 +1,5 @@
|
||||
# doxygen documentation
|
||||
find_package (Doxygen)
|
||||
if (NOT DOXYGEN_FOUND)
|
||||
message (STATUS "WARNING: Doxygen not found - Reference manual will not be created")
|
||||
return ()
|
||||
endif ()
|
||||
|
||||
configure_file (doxygen.conf.in ${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf)
|
||||
add_custom_target (oxygen-docs ALL COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf)
|
||||
|
@ -176,6 +176,20 @@ public slots:
|
||||
* @return true if the method was completed without errors
|
||||
*/
|
||||
bool enableProfile(const QString profile);
|
||||
/**
|
||||
* @brief method which force starts profile
|
||||
* @param profile profile name
|
||||
* @return false if components are not found or command exit code is not equal to 0
|
||||
* @return true if the method was completed without errors
|
||||
*/
|
||||
bool forceStartProfile(const QString profile);
|
||||
/**
|
||||
* @brief method which force stops profile
|
||||
* @param profile profile name
|
||||
* @return false if components are not found or command exit code is not equal to 0
|
||||
* @return true if the method was completed without errors
|
||||
*/
|
||||
bool forceStopProfile(const QString profile);
|
||||
/**
|
||||
* @brief method which reenables profile
|
||||
* @param profile profile name
|
||||
|
@ -1,25 +1,27 @@
|
||||
# set files
|
||||
file (GLOB SOURCES *.cpp)
|
||||
file (GLOB HEADERS *.h)
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
||||
file (GLOB_RECURSE HEADERS *.h ${SUBPROJECT_INCLUDE_DIR}/*h
|
||||
${PROJECT_TRDPARTY_DIR}/task/*.h)
|
||||
|
||||
# include_path
|
||||
include_directories (${SUBPROJECT_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_TRDPARTY_DIR})
|
||||
|
||||
if (USE_QT5)
|
||||
find_package(Qt5 COMPONENTS Core REQUIRED)
|
||||
add_definitions(${Qt5Core_DEFINITIONS})
|
||||
include_directories (${Qt5Core_INCLUDE_DIRS})
|
||||
set (QT_NEEDED_LIBS ${Qt5Core_LIBRARIES})
|
||||
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
find_package (Qt5 COMPONENTS Core REQUIRED)
|
||||
add_definitions (${Qt5Core_DEFINITIONS})
|
||||
include_directories (${Qt5Core_INCLUDE_DIRS})
|
||||
set (QT_NEEDED_LIBS ${Qt5Core_LIBRARIES})
|
||||
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
else ()
|
||||
find_package (Qt4 COMPONENTS QtCore REQUIRED)
|
||||
include (${QT_USE_FILE})
|
||||
set (QT_NEEDED_LIBS ${QT_QTCORE_LIBRARY})
|
||||
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
find_package (Qt4 COMPONENTS QtCore REQUIRED)
|
||||
include (${QT_USE_FILE})
|
||||
set (QT_NEEDED_LIBS ${QT_QTCORE_LIBRARY})
|
||||
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
endif()
|
||||
|
||||
add_library (${SUBPROJECT} SHARED ${SOURCES} ${HEADERS} ${MOC_SOURCES})
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "netctlgui.h"
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1 +0,0 @@
|
||||
../include/netctlgui/netctlgui.h
|
@ -26,9 +26,9 @@
|
||||
#include <QDebug>
|
||||
#include <QDirIterator>
|
||||
|
||||
#include "netctlgui.h"
|
||||
#include "pdebug.h"
|
||||
#include "taskadds.h"
|
||||
#include <netctlgui/netctlgui.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <task/taskadds.h>
|
||||
|
||||
|
||||
/**
|
||||
@ -542,6 +542,30 @@ bool Netctl::enableProfile(const QString profile)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @fn forceStartProfile
|
||||
*/
|
||||
bool Netctl::forceStartProfile(const QString profile)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||
|
||||
return cmdCall(true, netctlCommand, QString("start"), profile);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @fn forceStopProfile
|
||||
*/
|
||||
bool Netctl::forceStopProfile(const QString profile)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||
|
||||
return cmdCall(true, netctlCommand, QString("stop"), profile);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @fn reenableProfile
|
||||
*/
|
||||
|
@ -1 +0,0 @@
|
||||
../include/netctlgui/netctlinteract.h
|
@ -29,9 +29,9 @@
|
||||
#include <QFileInfo>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "netctlgui.h"
|
||||
#include "pdebug.h"
|
||||
#include "taskadds.h"
|
||||
#include <netctlgui/netctlgui.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <task/taskadds.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1 +0,0 @@
|
||||
../include/netctlgui/netctlprofile.h
|
@ -1 +0,0 @@
|
||||
../../3rdparty/pdebug/pdebug.h
|
@ -1 +0,0 @@
|
||||
../../3rdparty/task/task.h
|
@ -1 +0,0 @@
|
||||
../../3rdparty/task/taskadds.cpp
|
@ -1 +0,0 @@
|
||||
../../3rdparty/task/taskadds.h
|
@ -26,9 +26,9 @@
|
||||
#include <QDebug>
|
||||
#include <grp.h>
|
||||
|
||||
#include "netctlgui.h"
|
||||
#include "pdebug.h"
|
||||
#include "taskadds.h"
|
||||
#include <netctlgui/netctlgui.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <task/taskadds.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1 +0,0 @@
|
||||
../include/netctlgui/wpasupinteract.h
|
@ -9,9 +9,12 @@ find_package (KDE4 REQUIRED)
|
||||
include (KDE4Defaults)
|
||||
|
||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../)
|
||||
|
||||
add_subdirectory (po)
|
||||
include_directories (${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${KDE4_INCLUDES}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR})
|
||||
|
||||
# set sources
|
||||
set (PLUGIN_NAME ${SUBPROJECT})
|
||||
@ -19,7 +22,7 @@ file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
||||
file (GLOB SUBPROJECT_UI *.ui)
|
||||
file (GLOB_RECURSE SUBPROJECT_UI *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui)
|
||||
|
||||
# prepare
|
||||
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
@ -28,9 +28,11 @@
|
||||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QSettings>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "netctl.h"
|
||||
#include "pdebug.h"
|
||||
#include "ui_about.h"
|
||||
#include "ui_appearance.h"
|
||||
#include "ui_dataengine.h"
|
||||
@ -65,7 +67,7 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
|
||||
{
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("NETCTLGUI_DEBUG"), QString("no"));
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
if (debugEnv == QString("yes"))
|
||||
debug = true;
|
||||
else
|
||||
@ -149,80 +151,49 @@ QMap<QString, QString> Netctl::readDataEngineConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QMap<QString, QString> rawConfig;
|
||||
rawConfig[QString("EXTIP4")] = QString("false");
|
||||
rawConfig[QString("EXTIP4CMD")] = QString("curl ip4.telize.com");
|
||||
rawConfig[QString("EXTIP6")] = QString("false");
|
||||
rawConfig[QString("EXTIP6CMD")] = QString("curl ip6.telize.com");
|
||||
rawConfig[QString("NETCTLCMD")] = QString("/usr/bin/netctl");
|
||||
rawConfig[QString("NETCTLAUTOCMD")] = QString("/usr/bin/netctl-auto");
|
||||
|
||||
QString fileName = KGlobal::dirs()->findResource("config", "netctl.conf");
|
||||
QMap<QString, QString> configuration;
|
||||
QString fileName;
|
||||
fileName = KGlobal::dirs()->findResource("config", "plasma-dataengine-netctl.conf");
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||
QFile configFile(fileName);
|
||||
if (!configFile.open(QIODevice::ReadOnly))
|
||||
return updateDataEngineConfiguration(rawConfig);
|
||||
QString fileStr;
|
||||
QStringList value;
|
||||
while (true) {
|
||||
fileStr = QString(configFile.readLine()).trimmed();
|
||||
if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue;
|
||||
if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue;
|
||||
if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue;
|
||||
if (fileStr.contains(QChar('='))) {
|
||||
value.clear();
|
||||
for (int i=1; i<fileStr.split(QChar('=')).count(); i++)
|
||||
value.append(fileStr.split(QChar('='))[i]);
|
||||
rawConfig[fileStr.split(QChar('='))[0]] = value.join(QChar('='));
|
||||
}
|
||||
if (configFile.atEnd()) break;
|
||||
}
|
||||
configFile.close();
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
|
||||
return updateDataEngineConfiguration(rawConfig);
|
||||
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();
|
||||
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();
|
||||
settings.endGroup();
|
||||
|
||||
return configuration;
|
||||
}
|
||||
|
||||
|
||||
void Netctl::writeDataEngineConfiguration(const QMap<QString, QString> settings)
|
||||
void Netctl::writeDataEngineConfiguration(const QMap<QString, QString> configuration)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QMap<QString, QString> config = updateDataEngineConfiguration(settings);
|
||||
QString fileName = KGlobal::dirs()->locateLocal("config", "netctl.conf");
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||
QFile configFile(fileName);
|
||||
if (!configFile.open(QIODevice::WriteOnly)) return;
|
||||
for (int i=0; i<config.keys().count(); i++) {
|
||||
QByteArray string = (config.keys()[i] + QString("=") + config[config.keys()[i]] + QString("\n")).toUtf8();
|
||||
configFile.write(string);
|
||||
}
|
||||
configFile.close();
|
||||
}
|
||||
QString fileName = KGlobal::dirs()->locateLocal("config", "plasma-dataengine-netctl.conf");
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Netctl commands"));
|
||||
settings.setValue(QString("NETCTLCMD"), configuration[QString("NETCTLCMD")]);
|
||||
settings.setValue(QString("NETCTLAUTOCMD"), configuration[QString("NETCTLAUTOCMD")]);
|
||||
settings.endGroup();
|
||||
|
||||
QMap<QString, QString> Netctl::updateDataEngineConfiguration(const QMap<QString, QString> rawConfig)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
settings.beginGroup(QString("External IP"));
|
||||
settings.setValue(QString("EXTIP4"), configuration[QString("EXTIP4")]);
|
||||
settings.setValue(QString("EXTIP4CMD"), configuration[QString("EXTIP4CMD")]);
|
||||
settings.setValue(QString("EXTIP6"), configuration[QString("EXTIP6")]);
|
||||
settings.setValue(QString("EXTIP6CMD"), configuration[QString("EXTIP6CMD")]);
|
||||
settings.endGroup();
|
||||
|
||||
QMap<QString, QString> config;
|
||||
QString key, value;
|
||||
// remove spaces and copy source map
|
||||
for (int i=0; i<rawConfig.keys().count(); i++) {
|
||||
key = rawConfig.keys()[i];
|
||||
value = rawConfig[key];
|
||||
key.remove(QChar(' '));
|
||||
if ((key != QString("EXTIP4CMD")) &&
|
||||
(key != QString("EXTIP6CMD")) &&
|
||||
(key != QString("NETCTLCMD")) &&
|
||||
(key != QString("NETCTLAUTOCMD")))
|
||||
value.remove(QChar(' '));
|
||||
config[key] = value;
|
||||
}
|
||||
|
||||
for (int i=0; i<config.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << config.keys()[i] + QString("=") + config[config.keys()[i]];
|
||||
|
||||
return config;
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,7 @@ public:
|
||||
void init();
|
||||
QString parsePattern(const QString rawLine);
|
||||
QMap<QString, QString> readDataEngineConfiguration();
|
||||
void writeDataEngineConfiguration(const QMap<QString, QString> settings);
|
||||
QMap<QString, QString> updateDataEngineConfiguration(const QMap<QString, QString> rawConfig);
|
||||
void writeDataEngineConfiguration(const QMap<QString, QString> configuration);
|
||||
|
||||
public slots:
|
||||
// events
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user