Compare commits
292 Commits
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 | |||
8bf33d4369 | |||
4e76d52671 | |||
47dc016da2 | |||
8b58f6d383 | |||
709431ead2 | |||
f90b2d97a7 | |||
5416ef841f | |||
e4cff2baf4 | |||
d047eaf2f2 | |||
56f4a75b25 | |||
dd05782f80 | |||
2c2919160b | |||
d7c8490724 | |||
1930eeb33c | |||
4cc9d0ec11 | |||
a7911d48d1 | |||
012c725e12 | |||
1907d3ac2f | |||
87376f1a5c | |||
f238ba3a6a | |||
abbc5641cd | |||
82c3690dcb | |||
d3e1c4bca0 | |||
b63d883eb2 | |||
529e2dd995 | |||
1d34a65f38 | |||
fea0bedef0 | |||
ec8fc79dd7 | |||
07e07ee777 | |||
5c8dca22d0 | |||
dba3eeabaa | |||
eabfac7323 | |||
3b1701f8b5 | |||
b65f761520 | |||
fddd4703cc | |||
f4e3848fa7 | |||
3e0ae6d4cc | |||
80f6ccf1d1 | |||
863b49eaec | |||
4785e358ec | |||
f0adbb60e5 | |||
61d814d9a2 | |||
d166668feb | |||
db3bfe9ad7 | |||
d2ea9d96d9 | |||
d4c82fce0c | |||
fe672aa8cc | |||
501b43002e | |||
43ed28de52 | |||
f7352f5c59 | |||
d112446d87 | |||
b863eedd96 | |||
e19c9fef53 | |||
10499691b3 | |||
bf6d7cd53b | |||
11db0fcf8d | |||
d44979e95e | |||
41f58c1448 | |||
2ff76e9c8e | |||
0b2cc3ba79 | |||
fb430b036e | |||
42194295cc | |||
558a206a8d | |||
172624b494 | |||
e64e8810f8 | |||
23f4a7f141 | |||
d01bb8834a | |||
0989a6584b | |||
c75f5ec135 | |||
d0a0b0eb4a | |||
6b7d5d3800 | |||
6a3e3b14b3 | |||
1ae30b0821 | |||
c15e387472 | |||
d04a0b0920 | |||
e8e0c71c05 | |||
516c4b5a22 | |||
4e027ec19f | |||
4788ad0081 | |||
891b3b43ef | |||
dee47b0ffc | |||
86753070e8 | |||
ff78d390ae | |||
447bcf8a0e | |||
e8a7865e99 | |||
fdb5b46ea1 | |||
0432579f5b | |||
2aa6b43e61 | |||
0bade9c42f | |||
067115280c | |||
873f84c447 | |||
4c9c7b00a1 | |||
64937105c6 | |||
297a18d530 | |||
8c0226c9db | |||
1abc4a5ac9 | |||
7ed3e4e01b | |||
dc81a44034 | |||
7febf94233 | |||
3a0f0c252e | |||
209c3b9616 | |||
a79cbd4429 | |||
eb6bd34489 | |||
ccc62ffb67 | |||
fc2d338450 | |||
eefe196b69 | |||
c1e23d38a9 | |||
e9c10e262e | |||
0d26d6230e | |||
0aa162b71b | |||
78a4aeb0eb | |||
ec5dff4b75 | |||
0070f910cc | |||
6cba836d98 | |||
4600aae8bc | |||
79e7aa1926 | |||
32683a89b9 | |||
43de4e5738 | |||
099b4e3792 | |||
389726379c | |||
9c0dcfe621 | |||
75a95661f8 | |||
31f52e5d22 | |||
78827d833d | |||
c0207a108e | |||
bb7af8da40 | |||
81ff9340cc | |||
3d040e9bab | |||
3542901781 | |||
8b91f43f0b | |||
7e622ad33b | |||
48a879bd71 | |||
bc8655aaeb | |||
05f9759d47 | |||
51659c7a42 | |||
39b8ff834f | |||
ea522b3864 | |||
79fc70efa1 | |||
5e1a4be134 | |||
63ae04cd8d | |||
4fb02058b1 | |||
e02a6a8ce1 | |||
2f40ae7913 | |||
2e35cd356e | |||
341a19a955 | |||
f7e39c7834 | |||
7660deb787 | |||
3fb847a7b6 | |||
dbb9ba70c4 | |||
ceb7f3bd0f | |||
8ce4b03399 | |||
44f0b6a06a | |||
b37272d875 | |||
ea91aa4ca4 | |||
cc250a643a | |||
9b01fcd4e1 | |||
021a870220 | |||
ae001b4d7f | |||
ec6834d90e | |||
de22663156 | |||
c3f090d9a0 | |||
d17543a075 | |||
ace3a141e4 | |||
06bd1ce198 | |||
9852fb8f68 | |||
eccb6b6578 | |||
c1457d3ef0 | |||
6dab355d87 | |||
e81f7714f9 | |||
2a3011bdef | |||
bf799ce061 | |||
a845e32960 | |||
028546540c | |||
2bf1d0f78e | |||
cce4ef4811 | |||
4051d2f2c8 | |||
8a031f2183 | |||
7c013310ab | |||
d5f0bbc3bf | |||
cb033140ac | |||
d582445597 | |||
3506bd46a9 | |||
727619bb85 | |||
d59345c0e4 | |||
4c1685164c | |||
d515e4a51f | |||
2778f654ef | |||
92ec04cae1 | |||
501151828d | |||
4a788aa05f | |||
2cf91930f8 | |||
4bb5d4925d | |||
10d44f786e | |||
c69ff2165e | |||
4d455d93e8 | |||
046ae119a3 | |||
b958d0b78b | |||
7529cd7af0 | |||
7e85f1f933 | |||
c4c407542f | |||
cc2b3faf85 | |||
b983f4424e | |||
72782a40c2 | |||
9a5b61be4e | |||
7d7a24c23d | |||
1366852a62 | |||
b1e455b976 | |||
1a7d3cb50a |
10
.gitignore
vendored
@ -14,12 +14,20 @@
|
||||
|
||||
# Source archive
|
||||
*.tar.xz
|
||||
*.tar.gz
|
||||
*.sig
|
||||
|
||||
# Build directory
|
||||
build/
|
||||
sources/build/
|
||||
tmp/
|
||||
usr/
|
||||
|
||||
# translations
|
||||
*.qm
|
||||
|
||||
# temporary bckps
|
||||
*~
|
||||
|
||||
# kdevelop files
|
||||
.kdev4
|
||||
*.kdev4
|
||||
|
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
|
5
AUTHORS
Normal file
@ -0,0 +1,5 @@
|
||||
Current developers:
|
||||
Evgeniy Alekseev aka arcanis <esalexeev (at) gmail (dot) com>
|
||||
|
||||
Translators:
|
||||
@nosada (Japanese translation)
|
212
CHANGELOG
Normal file
@ -0,0 +1,212 @@
|
||||
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:
|
||||
+ add processes error messages
|
||||
+ add support of several active profiles
|
||||
* some bug fixes and refactoring
|
||||
* rewrite debug messages
|
||||
* dataengine:
|
||||
+ add new sources: intIp6, extIp6, netctlAutoStatus
|
||||
* rewrite to use [tasks](https://github.com/mhogomchungu/tasks) (see #7)
|
||||
* change default command to define external IP
|
||||
* change interface list definition
|
||||
* change internal IP definition
|
||||
* gui:
|
||||
+ add 3rd party license information
|
||||
+ add system tray icon as an alternative to the plasmoid
|
||||
+ add DBus session interface org.netctlgui.netctlgui
|
||||
+ add dynamic settings load
|
||||
+ add support of openvswitch
|
||||
+ add security notes and API descriptions
|
||||
+ 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
|
||||
+ add tests
|
||||
* library:
|
||||
+ add custom structures netctlWifiInfo and netctlProfileInfo
|
||||
+ add methods getActiveProfile(), autoGetActiveProfile()
|
||||
+ add slot switchToProfile()
|
||||
+ add slot stopAllProfiles()
|
||||
+ add slot reenableProfile()
|
||||
+ add slots getRecommendedConfiguration()
|
||||
+ add slots forceStartProfile() and forceStopProfile()
|
||||
+ add double quotes to profile names
|
||||
+ add tests
|
||||
- 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
|
||||
+ add ability to use helper
|
||||
* change all running processes to detached (see #7)
|
||||
* rewrite text label to use tags
|
||||
* update to dataengine changes
|
||||
* edit about window
|
||||
|
||||
***
|
||||
|
||||
Ver.1.2.0
|
||||
---------
|
||||
* all:
|
||||
+ add icons
|
||||
+ add support of netctl-auto
|
||||
* changes in the project architecture
|
||||
* refactoring
|
||||
* dataengine:
|
||||
+ add debug information (NETCTLGUI_DEBUG=yes)
|
||||
* gui:
|
||||
+ add support of macvlan
|
||||
+ add ability to remove profile
|
||||
+ add support of hidden wifi network
|
||||
+ add contextual menu to tables
|
||||
+ add actions menu
|
||||
+ add clear() function to profileTab
|
||||
+ add about window
|
||||
+ more command line options
|
||||
+ add workaround for wireless-wep example
|
||||
+ add shell completions
|
||||
+ add "Report a bug" action
|
||||
- fix possible segfaults with null arrays (#5)
|
||||
* more debug information
|
||||
* change lineEdit_profile to comboBox
|
||||
* refactoring of configuration interface
|
||||
* change setting of the interface to profile tab
|
||||
* rewrite ErrorWindow class
|
||||
* library:
|
||||
+ detach backend from frontend
|
||||
+ add error checking
|
||||
+ add doxygen documentation
|
||||
* more debug information
|
||||
* rewrite getSettingsFromProfile() function
|
||||
* plasmoid:
|
||||
+ add dataengine configuration
|
||||
+ add about window
|
||||
+ add debug information (NETCTLGUI_DEBUG=yes)
|
||||
* edit configuration interface
|
||||
* change double click event to click event
|
||||
* change class from Applet to PopupApplet
|
||||
|
||||
***
|
||||
|
||||
Ver.1.1.0 (netctl-1.7 update)
|
||||
-----------------------------
|
||||
* dataengine:
|
||||
* change definition if profile is enabled
|
||||
* gui:
|
||||
+ add frequency
|
||||
* change definition if profile is enabled
|
||||
* plasmoid:
|
||||
+ add menu title
|
||||
|
||||
***
|
||||
|
||||
Ver.1.0.6
|
||||
---------
|
||||
* gui:
|
||||
* fix error checking
|
||||
|
||||
***
|
||||
|
||||
Ver.1.0.5
|
||||
---------
|
||||
* plasmoid:
|
||||
+ add "Start WiFi menu" function
|
||||
* refactoring
|
||||
* edit icon
|
||||
|
||||
***
|
||||
|
||||
Ver.1.0.4
|
||||
---------
|
||||
* gui:
|
||||
+ add Qt5 gui (by default)
|
||||
* plasmoid:
|
||||
+ add notifications
|
||||
* fix run command with sudo from plasmoid
|
||||
|
||||
***
|
||||
|
||||
Ver.1.0.3
|
||||
---------
|
||||
* all:
|
||||
* refactoring
|
||||
* plasmoid:
|
||||
+ edit russian translation
|
||||
|
||||
***
|
||||
|
||||
Ver.1.0.2
|
||||
---------
|
||||
* plasmoid:
|
||||
- fix layout margins
|
||||
|
||||
***
|
||||
|
||||
Ver.1.0.1
|
||||
---------
|
||||
* all:
|
||||
- remove scripts
|
||||
|
||||
***
|
||||
|
||||
Ver.1.0
|
||||
-------
|
||||
First release
|
@ -631,7 +631,7 @@ to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
netctl-plasmoid
|
||||
netctl-gui
|
||||
Copyright (C) 2014 Evgeniy Alekseev
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
netctl-plasmoid Copyright (C) 2014 Evgeniy Alekseev
|
||||
netctl-gui Copyright (C) 2014 Evgeniy Alekseev
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
39
PKGBUILD
@ -1,39 +0,0 @@
|
||||
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
||||
|
||||
# comment out needed line if you dont need this component
|
||||
#_build_gui=0
|
||||
#_build_plasmoid=0
|
||||
|
||||
pkgname=netctl-gui
|
||||
pkgver=1.0.2
|
||||
pkgrel=1
|
||||
pkgdesc="Qt4 GUI for netctl. Provides a plasmoid for KDE4"
|
||||
arch=('i686' 'x86_64')
|
||||
url="http://arcanis.name/projects/netctl-gui"
|
||||
license=('GPLv3')
|
||||
depends=('netctl' 'qt4')
|
||||
makedepends=('automoc4' 'cmake' 'desktop-file-utils' 'xdg-utils')
|
||||
optdepends=('kdebase-runtime: sudo support'
|
||||
'sudo: sudo support'
|
||||
'wpa_supplicant: wifi support')
|
||||
source=("https://github.com/arcan1s/netctlplasmoid/releases/download/V.${pkgver}/${pkgname}-${pkgver}-src.tar.xz")
|
||||
install="${pkgname}.install"
|
||||
md5sums=('9bbdf2bc3dfbbde0ff63e04d7d081c0d')
|
||||
|
||||
# flags
|
||||
_cmakekeys="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release"
|
||||
[[ ${_build_gui} == 0 ]] && _cmakekeys=${_cmakekeys}" -DBUILD_GUI:BOOL=0"
|
||||
[[ ${_build_plasmoid} == 0 ]] && _cmakekeys=${_cmakekeys}" -DBUILD_DATAENGINE:BOOL=0 -DBUILD_PLASMOID:BOOL=0" || depends[1]='kdebase-workspace'
|
||||
|
||||
build() {
|
||||
rm -rf "${srcdir}/build"
|
||||
mkdir "${srcdir}/build"
|
||||
cd "${srcdir}/build"
|
||||
cmake ${_cmakekeys} "../${pkgname}"
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/build"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
56
README.md
@ -3,41 +3,48 @@ Netctl GUI
|
||||
|
||||
Information
|
||||
-----------
|
||||
Graphical interface for netctl. Now 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 configuration. DataEngine settings are stored in `/usr/share/config/netctl.conf`:
|
||||
|
||||
* `CMD` - netctl command. Default value is `/usr/bin/netctl`.
|
||||
* `IPCMD` - ip command. `/usr/bin/ip` by default.
|
||||
* `NETDIR` - a directory, which contains subdirectories with names of network interfaces. Default is `/sys/class/net/`.
|
||||
* `EXTIPCMD` - a command, which returns external IP address. Default value is `wget -qO- http://ifconfig.me/ip`.
|
||||
* `EXTIP` - `true` will enable external IP definition. Default is `false`.
|
||||
It is recommended to use graphical interface for configuration. Configuration files are:
|
||||
|
||||
All settings of GUI are stored in `$HOME/.config/netctl-gui.conf`. It is highly recommended to edit it from graphical interface.
|
||||
* `$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
|
||||
===========
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
* netctl
|
||||
* qt4
|
||||
* qt5-base (if Qt5 is used) or qt4 (if Qt4 is used)
|
||||
|
||||
Optional dependencies
|
||||
---------------------
|
||||
* kdebase-workspace (widget)
|
||||
|
||||
* kdebase-workspace (KDE4 widget)
|
||||
* plasma-framework (KF5 widget)
|
||||
* sudo (sudo support)
|
||||
* wpa_supplicant (WiFi support)
|
||||
|
||||
Make dependencies
|
||||
-----------------
|
||||
|
||||
* automoc4
|
||||
* cmake
|
||||
* qt5-tools (if Qt5 is used)
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
* download sources
|
||||
* extract it and install the application:
|
||||
|
||||
@ -47,18 +54,33 @@ Installation
|
||||
make
|
||||
sudo make install
|
||||
|
||||
If you want install it without KDE widget just run:
|
||||
Available cmake flags:
|
||||
|
||||
cd /path/to/extracted/archive
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_DATAENGINE:BOOL=0 -DBUILD_PLASMOID:BOOL=0 ../
|
||||
make
|
||||
sudo make install
|
||||
* 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
|
||||
======================
|
||||
|
||||
TODO (wish list)
|
||||
----------------
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
* [Homepage](http://arcanis.name/projects/netctl-gui)
|
||||
* Archlinux [AUR](https://aur.archlinux.org/packages/netctl-gui) package
|
||||
* Page on [kde-apps](http://kde-apps.org/content/show.php?content=164490)
|
||||
* Archlinux [AUR](https://aur.archlinux.org/pkgbase/netctl-gui/) package
|
||||
|
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
|
||||
}
|
101
arch/PKGBUILD-qt4
Normal file
@ -0,0 +1,101 @@
|
||||
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
||||
|
||||
pkgbase=netctl-gui-qt4
|
||||
pkgname=('libnetctlgui-qt4' 'netctlgui-helper-qt4' 'netctl-gui-qt4'
|
||||
'kdeplasma-applets-netctl-gui')
|
||||
pkgver=1.4.0
|
||||
pkgrel=1
|
||||
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')
|
||||
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgbase}-${pkgver}-src.tar.xz")
|
||||
md5sums=('172fff4b59c15c991b016db35971eca1')
|
||||
|
||||
|
||||
prepare() {
|
||||
rm -rf "${srcdir}/build-"{plasmoid,qt4}
|
||||
mkdir "${srcdir}/build-"{plasmoid,qt4}
|
||||
}
|
||||
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/build-plasmoid"
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_GUI:BOOL=0 \
|
||||
-DBUILD_LIBRARY:BOOL=0 \
|
||||
-DBUILD_HELPER:BOOL=0 \
|
||||
-DBUILD_KDE4:BOOL=1 \
|
||||
"../${pkgbase}"
|
||||
make
|
||||
|
||||
cd "${srcdir}/build-qt4"
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_DATAENGINE:BOOL=0 \
|
||||
-DBUILD_PLASMOID:BOOL=0 \
|
||||
-DUSE_CAPABILITIES:BOOL=0 \
|
||||
-DUSE_QT5:BOOL=0 \
|
||||
"../${pkgbase}"
|
||||
make
|
||||
}
|
||||
|
||||
|
||||
package_kdeplasma-applets-netctl-gui() {
|
||||
pkgdesc="A KDE4 plasmoid, which interacts with netctl. A part of netctl-gui"
|
||||
depends=('netctl' 'kdebase-workspace')
|
||||
optdepends=('netctlgui-helper-qt4: DBus helper daemon'
|
||||
'netctl-gui-qt4: graphical front-end'
|
||||
'sudo: sudo support')
|
||||
install="kdeplasma-applets-netctl-gui.install"
|
||||
|
||||
cd "${srcdir}/build-plasmoid"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
||||
|
||||
|
||||
package_libnetctlgui-qt4() {
|
||||
pkgdesc="Qt4 library which interacts with netctl. A part of netctl-gui"
|
||||
depends=('netctl' 'qt4')
|
||||
optdepends=('netctlgui-helper-qt4: DBus helper daemon'
|
||||
'sudo: sudo support'
|
||||
'wpa_supplicant: wifi support')
|
||||
provides=('libnetctlgui')
|
||||
conflicts=('libnetctlgui')
|
||||
install=""
|
||||
|
||||
cd "${srcdir}/build-qt4/netctlgui"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
||||
|
||||
|
||||
package_netctlgui-helper-qt4() {
|
||||
pkgdesc="Helper daemon for netctl-gui. A part of netctl-gui"
|
||||
depends=('libnetctlgui-qt4')
|
||||
provides=('netctlgui-helper')
|
||||
conflicts=('netctlgui-helper')
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
package_netctl-gui-qt4() {
|
||||
pkgdesc="Qt4 graphical front-end for netctl. A part of netctl-gui"
|
||||
depends=('libnetctlgui-qt4')
|
||||
optdepends=('kdeplasma-applets-netctl-gui: KDE widget'
|
||||
'netctlgui-helper-qt4: DBus helper daemon')
|
||||
provides=('netctl-gui')
|
||||
conflicts=('netctl-gui')
|
||||
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
@ -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
@ -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
@ -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
@ -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"
|
||||
}
|
@ -2,22 +2,26 @@
|
||||
|
||||
ARCHIVE="netctl-gui"
|
||||
SRCDIR="sources"
|
||||
FILES="LICENSE README.md"
|
||||
IGNORELIST="gui/resources/translations/english.qm gui/resources/translations/russian.qm"
|
||||
FILES="AUTHORS CHANGELOG COPYING README.md"
|
||||
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}"
|
||||
cp -r "${SRCDIR}" "${ARCHIVE}"
|
||||
for FILE in ${FILES[*]}; do cp "$FILE" "${ARCHIVE}"; done
|
||||
for FILE in ${IGNORELIST[*]}; do rm -f "${ARCHIVE}/${FILE}"; done
|
||||
tar cvJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}" > /dev/null
|
||||
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 {} \;
|
||||
|
Before Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 133 KiB |
Before Width: | Height: | Size: 108 KiB |
BIN
screenshots/de-main.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
screenshots/gui-about.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
screenshots/gui-main_tab.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
screenshots/gui-netctl-auto.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
screenshots/gui-profile_tab.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
screenshots/gui-settings.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
screenshots/gui-wifi_tab.png
Normal file
After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 105 KiB |
BIN
screenshots/plasmoid-config_1.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
screenshots/plasmoid-config_2.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
screenshots/plasmoid-config_3.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
screenshots/plasmoid-main.png
Normal file
After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 100 KiB |
218
sources/3rdparty/about/about.ui
vendored
Normal file
@ -0,0 +1,218 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>About</class>
|
||||
<widget class="QWidget" name="About">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>450</width>
|
||||
<height>359</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_About">
|
||||
<attribute name="title">
|
||||
<string>About</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_about">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_about">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>418</width>
|
||||
<height>284</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_version">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_description">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_links">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_about">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_ackn">
|
||||
<attribute name="title">
|
||||
<string>Acknowledgement</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_ackn">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_ackn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>418</width>
|
||||
<height>284</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_translators">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_trdparty">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_ackn">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>229</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_license">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
1
sources/3rdparty/language
vendored
Submodule
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/task
vendored
Submodule
1
sources/3rdparty/tasks
vendored
Submodule
@ -1,39 +1,83 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
cmake_policy (SET CMP0003 OLD)
|
||||
cmake_policy (SET CMP0002 OLD)
|
||||
cmake_policy (SET CMP0011 NEW)
|
||||
cmake_policy (SET CMP0015 NEW)
|
||||
|
||||
project (netctl-plasmoid)
|
||||
project (netctl-gui)
|
||||
set (PROJECT_AUTHOR "Evgeniy Alekseev")
|
||||
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
||||
set (PROJECT_LICENSE "GPLv3")
|
||||
set (PROJECT_VERSION_MAJOR 1)
|
||||
set (PROJECT_VERSION_MINOR 0)
|
||||
set (PROJECT_VERSION_PATCH 2)
|
||||
set (PROJECT_VERSION_MINOR 4)
|
||||
set (PROJECT_VERSION_PATCH 0)
|
||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
||||
string (TIMESTAMP CURRENT_YEAR "%Y")
|
||||
|
||||
message (STATUS "Project: ${PROJECT_NAME}")
|
||||
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)
|
||||
option (BUILD_DATAENGINE "Build data engine" ON)
|
||||
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)
|
||||
endif ()
|
||||
if (BUILD_PLASMOID)
|
||||
set (BUILD_DATAENGINE ON)
|
||||
endif ()
|
||||
# documentation
|
||||
option (BUILD_DOCS "Build Doxygen documentation" OFF)
|
||||
if (BUILD_DOCS)
|
||||
set (BUILD_LIBRARY ON)
|
||||
endif ()
|
||||
# test
|
||||
option (BUILD_TEST "Build unit tests" OFF)
|
||||
if (BUILD_TEST)
|
||||
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")
|
||||
set (SYSTEMD_SERVICE_PATH "lib/systemd/system" CACHE STRING "Path to systemd services")
|
||||
|
||||
# flags
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (ADD_CXX_FLAGS "-Wall")
|
||||
set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}")
|
||||
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")
|
||||
endif ()
|
||||
|
||||
if (BUILD_PLASMOID)
|
||||
set (BUILD_DATAENGINE ON)
|
||||
endif ()
|
||||
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
|
||||
add_subdirectory (icons)
|
||||
# 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})
|
||||
endif ()
|
||||
if (BUILD_HELPER)
|
||||
add_subdirectory (helper)
|
||||
endif ()
|
||||
if (BUILD_TEST)
|
||||
enable_testing ()
|
||||
add_subdirectory (test)
|
||||
endif ()
|
||||
if (BUILD_GUI)
|
||||
add_subdirectory (gui)
|
||||
endif ()
|
||||
@ -41,5 +85,9 @@ if (BUILD_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,26 +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)
|
||||
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
|
||||
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS})
|
||||
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,18 +0,0 @@
|
||||
# Configuration file for netctl data engine
|
||||
|
||||
## Commands
|
||||
# command
|
||||
CMD=/usr/bin/netctl
|
||||
# ip command
|
||||
IPCMD=/usr/bin/ip
|
||||
|
||||
## Network
|
||||
# path to list of network devices
|
||||
NETDIR=/sys/class/net/
|
||||
|
||||
## External IP
|
||||
# external ip check command
|
||||
EXTIPCMD=wget -qO- http://ifconfig.me/ip
|
||||
# 'true' - check external IP
|
||||
EXTIP=false
|
||||
|
@ -1,26 +1,42 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "netctl.h"
|
||||
|
||||
#include <Plasma/DataContainer>
|
||||
#include <QDir>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
#include <QNetworkInterface>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
|
||||
#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)
|
||||
@ -28,198 +44,321 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
if (debugEnv == QString("yes"))
|
||||
debug = true;
|
||||
else
|
||||
debug = false;
|
||||
|
||||
setMinimumPollingInterval(333);
|
||||
readConfiguration();
|
||||
initSources();
|
||||
}
|
||||
|
||||
|
||||
Netctl::~Netctl()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
}
|
||||
|
||||
|
||||
QStringList Netctl::sources() const
|
||||
{
|
||||
QStringList sources;
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
sources.append(QString("currentProfile"));
|
||||
sources.append(QString("extIp"));
|
||||
QStringList sources;
|
||||
sources.append(QString("active"));
|
||||
sources.append(QString("current"));
|
||||
sources.append(QString("extip4"));
|
||||
sources.append(QString("extip6"));
|
||||
sources.append(QString("interfaces"));
|
||||
sources.append(QString("intIp"));
|
||||
sources.append(QString("intip4"));
|
||||
sources.append(QString("intip6"));
|
||||
sources.append(QString("netctlauto"));
|
||||
sources.append(QString("profiles"));
|
||||
sources.append(QString("statusBool"));
|
||||
sources.append(QString("statusString"));
|
||||
sources.append(QString("status"));
|
||||
|
||||
return sources;
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::readConfiguration()
|
||||
void Netctl::readConfiguration()
|
||||
{
|
||||
// default configuration
|
||||
checkExtIP = QString("false");
|
||||
cmd = QString("/usr/bin/netctl");
|
||||
extIpCmd = QString("wget -qO- http://ifconfig.me/ip");
|
||||
ipCmd = QString("/usr/bin/ip");
|
||||
netDir = QString("/sys/class/net/");
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString fileStr;
|
||||
// FIXME: define configuration file
|
||||
QFile confFile(QString(getenv("HOME")) + QString("/.kde4/share/config/netctl.conf"));
|
||||
bool exists = confFile.open(QIODevice::ReadOnly);
|
||||
if (!exists) {
|
||||
confFile.setFileName("/usr/share/config/netctl.conf");
|
||||
exists = confFile.open(QIODevice::ReadOnly);
|
||||
if (!exists)
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
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();
|
||||
|
||||
while (true) {
|
||||
fileStr = QString(confFile.readLine());
|
||||
if (fileStr[0] != '#') {
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2) {
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("EXTIP"))
|
||||
checkExtIP = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("CMD"))
|
||||
cmd = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("EXTIPCMD"))
|
||||
extIpCmd = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("IPCMD"))
|
||||
ipCmd = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("NETDIR"))
|
||||
netDir = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
}
|
||||
}
|
||||
if (confFile.atEnd())
|
||||
break;
|
||||
}
|
||||
|
||||
confFile.close();
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::sourceRequestEvent(const QString &name)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Source name" << name;
|
||||
|
||||
return updateSourceEvent(name);
|
||||
}
|
||||
|
||||
|
||||
QStringList Netctl::getCurrentProfile(const QString cmdNetctl, const QString cmdNetctlAuto)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
getNetctlAutoStatus(cmdNetctlAuto);
|
||||
|
||||
QString cmd;
|
||||
if (netctlAutoStatus)
|
||||
cmd = cmdNetctlAuto;
|
||||
else
|
||||
cmd = cmdNetctl;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||
TaskResult process = runTask(cmd + QString(" list"));
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
if (process.exitCode != 0)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
QStringList currentProfile;
|
||||
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(process.output);
|
||||
QStringList profileList = cmdOutput.split(QChar('\n'), QString::SkipEmptyParts);
|
||||
for (int i=0; i<profileList.count(); i++)
|
||||
if (profileList[i][0] == QChar('*'))
|
||||
currentProfile.append(profileList[i]);
|
||||
for (int i=0; i<currentProfile.count(); i++)
|
||||
currentProfile[i].remove(0, 2);
|
||||
|
||||
return currentProfile;
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
QString extIp = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
||||
|
||||
return extIp;
|
||||
}
|
||||
|
||||
|
||||
QStringList Netctl::getInterfaceList()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QList<QNetworkInterface> rawList = QNetworkInterface::allInterfaces();
|
||||
QStringList interfacesList;
|
||||
for (int i=0; i<rawList.count(); i++)
|
||||
interfacesList.append(rawList[i].name());
|
||||
|
||||
return interfacesList;
|
||||
}
|
||||
|
||||
|
||||
QString Netctl::getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString intIp = QString("");
|
||||
if (protocol == QAbstractSocket::IPv4Protocol)
|
||||
intIp = QString("127.0.0.1/8");
|
||||
else if (protocol == QAbstractSocket::IPv6Protocol)
|
||||
intIp = QString("::1/128");
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return intIp;
|
||||
}
|
||||
|
||||
|
||||
QString Netctl::getNetctlAutoStatus(const QString cmdNetctlAuto)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
TaskResult process = runTask(cmdNetctlAuto + QString(" list"));
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
if (process.exitCode != 0)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
QString status;
|
||||
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(process.output);
|
||||
if (cmdOutput.isEmpty()) {
|
||||
netctlAutoStatus = false;
|
||||
status = QString("false");
|
||||
} else {
|
||||
netctlAutoStatus = true;
|
||||
status = QString("true");
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
QStringList Netctl::getProfileList(const QString cmdNetctl, const QString cmdNetctlAuto)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
getNetctlAutoStatus(cmdNetctlAuto);
|
||||
|
||||
QString cmd;
|
||||
if (netctlAutoStatus)
|
||||
cmd = cmdNetctlAuto;
|
||||
else
|
||||
cmd = cmdNetctl;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||
TaskResult process = runTask(cmd + QString(" list"));
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
if (process.exitCode != 0)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(process.output);
|
||||
QStringList profileList = cmdOutput.split(QChar('\n'), QString::SkipEmptyParts);
|
||||
for (int i=0; i<profileList.count(); i++)
|
||||
profileList[i].remove(0, 2);
|
||||
|
||||
return profileList;
|
||||
}
|
||||
|
||||
|
||||
QStringList Netctl::getProfileStringStatus(const QString cmdNetctl, const QString cmdNetctlAuto)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
getNetctlAutoStatus(cmdNetctlAuto);
|
||||
|
||||
QStringList status;
|
||||
if (netctlAutoStatus)
|
||||
status.append(QString("netctl-auto"));
|
||||
else {
|
||||
QStringList profiles = getCurrentProfile(cmdNetctl, cmdNetctlAuto);
|
||||
for (int i=0; i<profiles.count(); i++) {
|
||||
TaskResult process = runTask(cmdNetctl + QString(" is-enabled ") + profiles[i]);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
if (process.exitCode != 0)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
if (process.exitCode == 0)
|
||||
status.append(QString("enabled"));
|
||||
else
|
||||
status.append(QString("static"));
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
QString Netctl::getStatus(const QString cmdNetctl, const QString cmdNetctlAuto)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
getNetctlAutoStatus(cmdNetctlAuto);
|
||||
|
||||
QString status = QString("false");
|
||||
QStringList currentProfile = getCurrentProfile(cmdNetctl, cmdNetctlAuto);
|
||||
if (!currentProfile.isEmpty())
|
||||
status = QString("true");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
QProcess command;
|
||||
QString cmdOutput = QString("");
|
||||
QString value = QString("");
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Source name" << source;
|
||||
|
||||
if (source == QString("currentProfile")) {
|
||||
command.start(cmd + QString(" list"));
|
||||
command.waitForFinished(-1);
|
||||
cmdOutput = command.readAllStandardOutput();
|
||||
if (!cmdOutput.isEmpty()) {
|
||||
QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
|
||||
for (int i=0; i<profileList.count(); i++)
|
||||
if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) {
|
||||
value = profileList[i].split(QString(" "), QString::SkipEmptyParts)[1];
|
||||
break;
|
||||
}
|
||||
QString value = QString("N\\A");
|
||||
if (source == QString("active")) {
|
||||
value = getStatus(configuration[QString("NETCTLCMD")],
|
||||
configuration[QString("NETCTLAUTOCMD")]);
|
||||
} else if (source == QString("current")) {
|
||||
value = getCurrentProfile(configuration[QString("NETCTLCMD")],
|
||||
configuration[QString("NETCTLAUTOCMD")])
|
||||
.join(QChar('|'));
|
||||
} else if (source == QString("extip4")) {
|
||||
if (configuration[QString("EXTIP4")] == QString("true"))
|
||||
value = getExtIp(configuration[QString("EXTIP4CMD")]);
|
||||
} else if (source == QString("extip6")) {
|
||||
if (configuration[QString("EXTIP6")] == QString("true"))
|
||||
value = getExtIp(configuration[QString("EXTIP6CMD")]);
|
||||
} else if (source == QString("interfaces")) {
|
||||
value = getInterfaceList().join(QChar(','));
|
||||
} else if (source == QString("intip4")) {
|
||||
value = getIntIp(QAbstractSocket::IPv4Protocol);
|
||||
} else if (source == QString("intip6")) {
|
||||
value = getIntIp(QAbstractSocket::IPv6Protocol);
|
||||
} else if (source == QString("netctlauto")) {
|
||||
value = getNetctlAutoStatus(configuration[QString("NETCTLAUTOCMD")]);
|
||||
} else if (source == QString("profiles")) {
|
||||
value = getProfileList(configuration[QString("NETCTLCMD")],
|
||||
configuration[QString("NETCTLAUTOCMD")])
|
||||
.join(QChar(','));
|
||||
} else if (source == QString("status")) {
|
||||
value = getProfileStringStatus(configuration[QString("NETCTLCMD")],
|
||||
configuration[QString("NETCTLAUTOCMD")])
|
||||
.join(QChar('|'));
|
||||
}
|
||||
setData(source, QString("value"), value);
|
||||
}
|
||||
else if (source == QString("extIp")) {
|
||||
if (checkExtIP == QString("true")) {
|
||||
command.start(extIpCmd);
|
||||
command.waitForFinished(-1);
|
||||
cmdOutput = command.readAllStandardOutput();
|
||||
if (!cmdOutput.isEmpty())
|
||||
value = cmdOutput.split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
}
|
||||
setData(source, QString("value"), value);
|
||||
}
|
||||
else if (source == QString("interfaces")) {
|
||||
if (QDir(netDir).exists())
|
||||
value = QDir(netDir).entryList(QDir::Dirs | QDir::NoDotAndDotDot).join(QString(","));
|
||||
setData(source, QString("value"), value);
|
||||
}
|
||||
else if (source == QString("intIp")) {
|
||||
if (QDir(netDir).exists()) {
|
||||
value = QString("127.0.0.1/8");
|
||||
QStringList netDevices = QDir(netDir).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
for (int i=0; i<netDevices.count(); i++)
|
||||
if (netDevices[i] != QString("lo")) {
|
||||
cmdOutput = QString("");
|
||||
command.start(ipCmd + QString(" addr show ") + netDevices[i]);
|
||||
command.waitForFinished(-1);
|
||||
cmdOutput = command.readAllStandardOutput();
|
||||
if (!cmdOutput.isEmpty()) {
|
||||
QStringList deviceInfo = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
|
||||
for (int j=0; j<deviceInfo.count(); j++)
|
||||
if (deviceInfo[j].split(QString(" "), QString::SkipEmptyParts)[0] == QString("inet"))
|
||||
value = deviceInfo[j].split(QString(" "), QString::SkipEmptyParts)[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
setData(source, QString("value"), value);
|
||||
}
|
||||
else if (source == QString("profiles")) {
|
||||
command.start(cmd + QString(" list"));
|
||||
command.waitForFinished(-1);
|
||||
cmdOutput = command.readAllStandardOutput();
|
||||
QStringList list;
|
||||
if (!cmdOutput.isEmpty()) {
|
||||
QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
|
||||
for (int i=0; i<profileList.count(); i++)
|
||||
if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 1)
|
||||
list.append(profileList[i].split(QString(" "), QString::SkipEmptyParts)[0]);
|
||||
else if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2)
|
||||
list.append(profileList[i].split(QString(" "), QString::SkipEmptyParts)[1]);
|
||||
}
|
||||
value = list.join(QString(","));
|
||||
setData(source, QString("value"), value);
|
||||
}
|
||||
else if (source == QString("statusBool")) {
|
||||
command.start(cmd + QString(" list"));
|
||||
command.waitForFinished(-1);
|
||||
cmdOutput = command.readAllStandardOutput();
|
||||
value = QString("false");
|
||||
if (!cmdOutput.isEmpty()) {
|
||||
QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
|
||||
for (int i=0; i<profileList.count(); i++)
|
||||
if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) {
|
||||
value = QString("true");
|
||||
break;
|
||||
}
|
||||
}
|
||||
setData(source, QString("value"), value);
|
||||
}
|
||||
else if (source == QString("statusString")) {
|
||||
command.start(cmd + QString(" list"));
|
||||
command.waitForFinished(-1);
|
||||
cmdOutput = command.readAllStandardOutput();
|
||||
QString currentProfile;
|
||||
if (!cmdOutput.isEmpty()) {
|
||||
QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
|
||||
for (int i=0; i<profileList.count(); i++)
|
||||
if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) {
|
||||
currentProfile = profileList[i].split(QString(" "), QString::SkipEmptyParts)[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
command.start(cmd + QString(" status ") + currentProfile);
|
||||
command.waitForFinished(-1);
|
||||
cmdOutput = command.readAllStandardOutput();
|
||||
if (!cmdOutput.isEmpty()) {
|
||||
QStringList profile = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
|
||||
for (int i=0; i<profile.count(); i++)
|
||||
if (profile[i].split(QString(" "), QString::SkipEmptyParts)[0] == QString("Loaded:")) {
|
||||
if (profile[i].contains(QString("enabled")))
|
||||
value = QString("enabled");
|
||||
else if (profile[i].contains(QString("static")))
|
||||
value = QString("static");
|
||||
break;
|
||||
}
|
||||
}
|
||||
setData(source, QString("value"), value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#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"
|
||||
|
@ -1,24 +1,25 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef NETCTL_DE_H
|
||||
#define NETCTL_DE_H
|
||||
|
||||
#include <Plasma/DataEngine>
|
||||
#include <QAbstractSocket>
|
||||
|
||||
|
||||
class Netctl : public Plasma::DataEngine
|
||||
@ -27,25 +28,32 @@ class Netctl : public Plasma::DataEngine
|
||||
|
||||
public:
|
||||
Netctl(QObject *parent, const QVariantList &args);
|
||||
~Netctl();
|
||||
QStringList getCurrentProfile(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||
QString getExtIp(const QString cmd);
|
||||
QStringList getInterfaceList();
|
||||
QString getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol);
|
||||
QString getNetctlAutoStatus(const QString cmdNetctlAuto);
|
||||
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 readConfiguration();
|
||||
bool sourceRequestEvent(const QString &name);
|
||||
bool updateSourceEvent(const QString &source);
|
||||
QStringList sources() const;
|
||||
|
||||
private:
|
||||
bool netctlAutoStatus;
|
||||
QString currentProfile;
|
||||
// configuration
|
||||
// enable check external IP
|
||||
QString checkExtIP;
|
||||
// path to netctl command
|
||||
QString cmd;
|
||||
// command to check external IP
|
||||
QString extIpCmd;
|
||||
// path to ip command
|
||||
QString ipCmd;
|
||||
// path to directory with network device configuration
|
||||
QString netDir;
|
||||
bool debug;
|
||||
QMap<QString, QString> configuration;
|
||||
void readConfiguration();
|
||||
};
|
||||
|
||||
|
||||
|
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
|
@ -4,17 +4,17 @@ Name=Netctl
|
||||
Comment=Data engine for netctl
|
||||
ServiceTypes=Plasma/DataEngine
|
||||
Type=Service
|
||||
Icon=netctl-gui
|
||||
Icon=netctl-gui-widget
|
||||
|
||||
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
|
@ -5,7 +5,8 @@ message (STATUS "Subproject ${SUBPROJECT}")
|
||||
# set directories
|
||||
set (SUBPROJECT_BINARY_DIR bin)
|
||||
set (SUBPROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
set (SUBPROJECT_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
||||
set (SUBPROJECT_DOCS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/docs)
|
||||
set (SUBPROJECT_RESOURCE_DIR ${PROJECT_RESOURCE_DIR})
|
||||
set (SUBPROJECT_TRANSLATION_DIR ${SUBPROJECT_RESOURCE_DIR}/translations)
|
||||
# executable path
|
||||
set (EXECUTABLE_OUTPUT_PATH ${SUBPROJECT_BINARY_DIR})
|
||||
@ -15,5 +16,13 @@ set (TARGETS "")
|
||||
set (HEADERS "")
|
||||
|
||||
add_subdirectory (${SUBPROJECT_SOURCE_DIR})
|
||||
add_subdirectory (${SUBPROJECT_DOCS_DIR})
|
||||
# build man
|
||||
file (GLOB SUBPROJECT_MAN_IN *.1)
|
||||
file (RELATIVE_PATH SUBPROJECT_MAN ${CMAKE_SOURCE_DIR} ${SUBPROJECT_MAN_IN})
|
||||
configure_file (${SUBPROJECT_MAN_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN})
|
||||
|
||||
install (FILES ${SUBPROJECT}.desktop DESTINATION share/applications/)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN} DESTINATION share/man/man1/)
|
||||
install (FILES bash-completions DESTINATION share/bash-completion/completions/ RENAME ${SUBPROJECT})
|
||||
install (FILES zsh-completions DESTINATION share/zsh/site-functions/ RENAME _${SUBPROJECT})
|
||||
|
115
sources/gui/bash-completions
Normal file
@ -0,0 +1,115 @@
|
||||
###########################################################################
|
||||
# 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/ #
|
||||
###########################################################################
|
||||
|
||||
|
||||
# variables
|
||||
_netctl_gui_arglist=(
|
||||
'--detached'
|
||||
'--maximized'
|
||||
'--minimized'
|
||||
'--about'
|
||||
'--netctl-auto'
|
||||
'--settings'
|
||||
'-e'
|
||||
'--essid'
|
||||
'-o'
|
||||
'--open'
|
||||
'-s'
|
||||
'--select'
|
||||
'-c'
|
||||
'--config'
|
||||
'-d'
|
||||
'--debug'
|
||||
'--default'
|
||||
'--set-opts'
|
||||
'-t'
|
||||
'--tab'
|
||||
'-v'
|
||||
'--version'
|
||||
'-i'
|
||||
'--info'
|
||||
'-h'
|
||||
'--help'
|
||||
)
|
||||
|
||||
_netctl_gui_settings=(
|
||||
'CLOSE_HELPER'
|
||||
'CLOSETOTRAY'
|
||||
'CTRL_DIR'
|
||||
'CTRL_GROUP'
|
||||
'FORCE_SUDO'
|
||||
'HELPER_PATH'
|
||||
'HELPER_SERVICE'
|
||||
'IFACE_DIR'
|
||||
'LANGUAGE'
|
||||
'NETCTL_PATH'
|
||||
'NETCTLAUTO_PATH'
|
||||
'NETCTLAUTO_SERVICE'
|
||||
'PID_FILE'
|
||||
'PREFERED_IFACE'
|
||||
'PROFILE_DIR'
|
||||
'RFKILL_DIR'
|
||||
'SKIPCOMPONENTS'
|
||||
'STARTTOTRAY'
|
||||
'SUDO_PATH'
|
||||
'SYSTEMCTL_PATH'
|
||||
'SYSTRAY'
|
||||
'USE_HELPER'
|
||||
'WPACLI_PATH'
|
||||
'WPASUP_PATH'
|
||||
'WPA_DRIVERS'
|
||||
)
|
||||
|
||||
_netctl_gui_tabs=(
|
||||
'1'
|
||||
'2'
|
||||
'3'
|
||||
)
|
||||
|
||||
_netctl_profiles() {
|
||||
echo $(find /etc/netctl -maxdepth 1 -type f -printf "%f\n")
|
||||
}
|
||||
|
||||
|
||||
# work block
|
||||
_netctl_gui() {
|
||||
COMPREPLY=()
|
||||
wantfiles='-@(c|-config)'
|
||||
wantprofiles='-@(o|-open|s|-select)'
|
||||
wantsettings='-@(-set-opts)'
|
||||
wantstring='-@(e|-essid)'
|
||||
wanttabs='-@(t|-tab)'
|
||||
_get_comp_words_by_ref cur prev words cword
|
||||
|
||||
if [[ $prev = $wantfiles ]]; then
|
||||
_filedir
|
||||
elif [[ $prev = $wantprofiles ]]; then
|
||||
COMPREPLY=($(compgen -W '$(_netctl_profiles)' -- "$cur"))
|
||||
elif [[ $prev = $wantsettings ]]; then
|
||||
COMPREPLY=($(compgen -S ',' -W '${_netctl_gui_settings[@]}' -- "$cur"))
|
||||
elif [[ $prev = $wantstring ]]; then
|
||||
COMPREPLY=()
|
||||
elif [[ $prev = $wanttabs ]]; then
|
||||
COMPREPLY=($(compgen -W '${_netctl_gui_tabs[@]}' -- "$cur"))
|
||||
else
|
||||
COMPREPLY=($(compgen -W '${_netctl_gui_arglist[@]}' -- "$cur"))
|
||||
fi
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
complete -F _netctl_gui netctl-gui
|
12
sources/gui/docs/CMakeLists.txt
Normal file
@ -0,0 +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 ()
|
||||
|
||||
install (FILES ${SUBPROJECT_DOCS} DESTINATION share/doc/${PROJECT_NAME})
|
||||
install (FILES ${SUBPROJECT_IMGS} DESTINATION share/doc/${PROJECT_NAME})
|
BIN
sources/gui/docs/architecture.png
Normal file
After Width: | Height: | Size: 40 KiB |
381
sources/gui/docs/netctl-gui-dbus-api.html
Normal file
@ -0,0 +1,381 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>netctl-gui DBus API desription</title>
|
||||
<style type="text/css">
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #000000;
|
||||
};
|
||||
td {
|
||||
text-align: justify;
|
||||
}
|
||||
th {
|
||||
text-align: center;
|
||||
}
|
||||
th.sub {
|
||||
font-style: italic;
|
||||
font-weight: normal;
|
||||
}
|
||||
small {
|
||||
font-size: 70%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<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>
|
||||
<th>responce</th>
|
||||
<th>run as root</th>
|
||||
</tr>
|
||||
<!-- helper service -->
|
||||
<tr>
|
||||
<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" id="ctrl"></a><code>/ctrl</code> path</th>
|
||||
</tr>
|
||||
<!-- helper actions -->
|
||||
<tr>
|
||||
<td>bool Active()</td>
|
||||
<td><code>true</code> if the helper is active</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString ApiDocs()</td>
|
||||
<td>returns path to this API documentation</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool Close()</td>
|
||||
<td><code>true</code> and closes the helper</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList FindSettings()</td>
|
||||
<td>scans system and suggests the recommended configuration which will be used by the library</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString LibraryDocs()</td>
|
||||
<td>returns path to the library documentation</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString Pony()</td>
|
||||
<td>prints Pinkie Pie to stdout. Really, just try</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString SecurityDocs()</td>
|
||||
<td>returns path to the security documentation</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList Settings()</td>
|
||||
<td>current helper settings <code>KEY==VALUE</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList UIDs()</td>
|
||||
<td>returns the helper process UIDs <code>[UID, EUID]</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool Update()</td>
|
||||
<td>calls update the helper configuration. Returns <code>true</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<!-- netctl actions -->
|
||||
<tr>
|
||||
<td>bool Enable(QString profile)</td>
|
||||
<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>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool Restart(QString profile)</td>
|
||||
<td>restarts the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool Start(QString profile)</td>
|
||||
<td>starts or stops the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool StopAll()</td>
|
||||
<td>stops all active profiles. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool SwitchTo(QString profile)</td>
|
||||
<td>switchs to the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool Create(QString profile, QStringList settingsList)</td>
|
||||
<td>creates the profile with specified settings. Settings should be given in the format <code>KEY==VALUE</code>. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool Remove(QString profile)</td>
|
||||
<td>removes the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<!-- netctl-auto actions -->
|
||||
<tr>
|
||||
<td>bool autoDisableAll()</td>
|
||||
<td>disables all profiles (netctl-auto). Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>no?</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool autoEnable(QString profile)</td>
|
||||
<td>enables or disables the profile (netctl-auto). Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>no?</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool autoEnableAll()</td>
|
||||
<td>enables all profiles (netctl-auto). Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>no?</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool autoStart(QString profile)</td>
|
||||
<td>switchs to the profile (netctl-auto). Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>no?</td>
|
||||
</tr>
|
||||
<!-- netctl-auto service actions -->
|
||||
<tr>
|
||||
<td>bool autoServiceEnable()</td>
|
||||
<td>enables or disables netctl-auto systemd service. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool autoServiceRestart()</td>
|
||||
<td>restarts netctl-auto systemd service. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool autoServiceStart()</td>
|
||||
<td>starts or stops netctl-auto systemd service. Returns <code>true</code> if action has been performed successfully</td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<!-- wpa_supplicant actions -->
|
||||
<tr>
|
||||
<td>QStringList WiFi()</td>
|
||||
<td>returns available WiFi points in format <code>NAME|SECURITY|SIGNAL|ACTIVE|EXISTS</code></td>
|
||||
<td>yes</td>
|
||||
</tr>
|
||||
<!-- /netctl path -->
|
||||
<tr>
|
||||
<th colspan="3" class="sub"><a href="#netctl" class="anchor" id="netctl"></a><code>/netctl</code> path</th>
|
||||
</tr>
|
||||
<!-- general information -->
|
||||
<tr>
|
||||
<td>QString ActiveProfile()</td>
|
||||
<td>returns active profile from netctl or netctl-auto</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString ActiveProfileStatus()</td>
|
||||
<td>returns active profile status from netctl or netctl-auto. May be <code>netctl-auto</code>, <code>active (enabled)</code>, <code>active (static)</code>, <code>inactive (enabled)</code>, <code>inactive (static)</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList Information()</td>
|
||||
<td>returns general information in format <code>[ActiveProfile, ActiveProfileStatus]</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList ProfileList()</td>
|
||||
<td>returns available profiles in format <code>NAME|DESCRIPTION|ACTIVE|ENABLED</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList WirelessInterface()</td>
|
||||
<td>returns wireless interfaces</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<!-- netctl specific information -->
|
||||
<tr>
|
||||
<td>bool isProfileActive(QString profile)</td>
|
||||
<td>returns <code>true</code> if the profile is active</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool isProfileEnabled(QString profile)</td>
|
||||
<td>returns <code>true</code> if the profile is enabled</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<!-- netctl-auto specific information -->
|
||||
<tr>
|
||||
<td>bool autoIsProfileActive(QString profile)</td>
|
||||
<td>returns <code>true</code> if the profile is active (netctl-auto)</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool autoIsProfileEnabled(QString profile)</td>
|
||||
<td>returns <code>true</code> if the profile is enabled (netctl-auto)</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool isNetctlAutoActive()</td>
|
||||
<td>returns <code>true</code> if netctl-auto is active</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool isNetctlAutoEnabled()</td>
|
||||
<td>returns <code>true</code> if netctl-auto is enabled</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<!-- profile information -->
|
||||
<tr>
|
||||
<td>QStringList Profile(QString profile)</td>
|
||||
<td>returns the profile settings in format <code>KEY==VALUE</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString ProfileByEssid(QString essid)</td>
|
||||
<td>returns the profile name by the given ESSID or empty line</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString ProfileValue(QString profile, QString key)</td>
|
||||
<td>returns value of the key by the given profile or empty line</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<!-- gui service -->
|
||||
<tr>
|
||||
<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" id="netctlgui"></a><code>/netctlgui</code> path</th>
|
||||
</tr>
|
||||
<!-- gui actions -->
|
||||
<tr>
|
||||
<td>bool Active()</td>
|
||||
<td><code>true</code> if the application is active</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>void ApiDocs()</td>
|
||||
<td>opens this API documentation</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool Close()</td>
|
||||
<td><code>true</code> and closes the application</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString Information()</td>
|
||||
<td>returns general information in format <code>[ActiveProfile, ActiveProfileStatus]</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>void LibraryDocs()</td>
|
||||
<td>opens the library documentation</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString Pony()</td>
|
||||
<td>prints Pinkie Pie to stdout. Really, just try</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool Restore()</td>
|
||||
<td><code>true</code> and restores the application</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>void SecurityDocs()</td>
|
||||
<td>opens the security documentation</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList Settings()</td>
|
||||
<td>current application settings <code>KEY==VALUE</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool ShowAbout()</td>
|
||||
<td><code>true</code> and shows about window</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool ShowMain()</td>
|
||||
<td><code>true</code> and shows main window</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool ShowNetctlAuto()</td>
|
||||
<td><code>true</code> and shows netctl-auto window</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool ShowSettings()</td>
|
||||
<td><code>true</code> and shows settings window</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList UIDs()</td>
|
||||
<td>returns the application process UIDs <code>[UID, EUID]</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList VerboseInformation()</td>
|
||||
<td>returns information in format <code>[isNetctlAutoActive, ProfileList, ActiveProfile, isProfileEnabled/autoIsProfileEnabled]</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<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>
|
||||
|
||||
<small>
|
||||
© 2014-@CURRENT_YEAR@ <a href="mailto:@PROJECT_CONTACT@">@PROJECT_AUTHOR@</a><br>
|
||||
This software is licensed under @PROJECT_LICENSE@
|
||||
</small>
|
||||
|
||||
</body>
|
||||
</html>
|
112
sources/gui/docs/netctl-gui-security-notes.html
Normal file
@ -0,0 +1,112 @@
|
||||
<!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>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<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" id="arch"></a>Architecture</h2>
|
||||
<img src="architecture.png" alt="architecture">
|
||||
|
||||
<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>
|
||||
<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></li>
|
||||
<li>Netctl profiles module</li>
|
||||
<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></li>
|
||||
<li>WiFi module</li>
|
||||
<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></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>
|
||||
|
||||
<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>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" 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" 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>
|
||||
<li><code>netctl is-enabled <profile></code></li>
|
||||
</ul>
|
||||
<p>Both of them do not require any additional privileges normally. Also DataEngine has two other command which will be run from; they should define external IP. According to the idea that user can set <b>any</b> command to run, this module is not secure. But running commands will not do more than user can do from console himself.</p>
|
||||
|
||||
<p>The widget gets information from DataEngine, thus it does not require any additional permissions to show information. But netctl calls are used to control netctl. In this case used commands are</p>
|
||||
<ul>
|
||||
<li><code>netctl enable <profile></code></li>
|
||||
<li><code>netctl disable <profile></code></li>
|
||||
<li><code>netctl restart <profile></code></li>
|
||||
<li><code>netctl start <profile></code></li>
|
||||
<li><code>netctl stop <profile></code></li>
|
||||
<li><code>netctl stop-all</code></li>
|
||||
<li><code>netctl switch-to <profile></code></li>
|
||||
<li><code>netctl-auto switch-to <profile></code></li>
|
||||
</ul>
|
||||
<p>All netctl-based commands <b>require</b> root privileges and <code>sudo</code> (and any other alternatives) is used normally as prefix to the commands. The netctl-auto command <b>does not require</b> additional permissions.</p>
|
||||
|
||||
<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" 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>
|
||||
|
||||
<small>
|
||||
© 2014-@CURRENT_YEAR@ <a href="mailto:@PROJECT_CONTACT@">@PROJECT_AUTHOR@</a><br>
|
||||
This software is licensed under @PROJECT_LICENSE@
|
||||
</small>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
sources/gui/docs/rawscheme.ppt
Normal file
79
sources/gui/netctl-gui.1
Normal file
@ -0,0 +1,79 @@
|
||||
.TH netctl-gui 1 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "General Commands Manual"
|
||||
.SH NAME
|
||||
netctl-gui is a graphical interface for netctl
|
||||
.SH SYNOPSIS
|
||||
.B netctl-gui
|
||||
[ options ]
|
||||
.SH DESCRIPTION
|
||||
.B netctl-gui
|
||||
is a project which provides graphical user interface for
|
||||
.B netctl
|
||||
written on C++ using Qt toolkit. It provides shared library and DBus API (through helper daemon) and Plasmoid and DataEngine for KDE.
|
||||
.SH OPTIONS
|
||||
.IP "--detached"
|
||||
run detached from console
|
||||
.IP "--maximized"
|
||||
run maximized
|
||||
.IP "--minimized"
|
||||
run to system tray if it is available
|
||||
.IP "--about"
|
||||
show about window
|
||||
.IP "--netctl-auto"
|
||||
show netctl-auto window
|
||||
.IP "--settings"
|
||||
show settings window
|
||||
.IP "-e, --essid ESSID"
|
||||
select ESSID
|
||||
.I ESSID
|
||||
This option will set tab to 3 automatically
|
||||
.IP "-o, --open PROFILE"
|
||||
open profile
|
||||
.I PROFILE
|
||||
This option will set tab to 2 automatically
|
||||
.IP "-s, --select PROFILE"
|
||||
select profile
|
||||
.I PROFILE
|
||||
This option will set tab to 1 automatically
|
||||
.IP "-c, --config FILE"
|
||||
read configuration from file
|
||||
.I FILE
|
||||
.IP "-d, --debug"
|
||||
print debug information
|
||||
.IP "--default"
|
||||
start with default settings
|
||||
.IP "--set-opts OPTIONS"
|
||||
set options
|
||||
.I OPTIONS
|
||||
for this run, comma separated. Example:
|
||||
.nf
|
||||
LANGUAGE=en,NETCTL_PATH=/path/to/ponies
|
||||
.fi
|
||||
.IP "-t, --tab NUM"
|
||||
open a tab with number
|
||||
.I NUM
|
||||
.IP "-v, --version"
|
||||
show version and exit
|
||||
.IP "-i, --info"
|
||||
show build information and exit
|
||||
.IP "-h, --help"
|
||||
show this help and exit
|
||||
.SH FILES
|
||||
.I $HOME/.config/netctl-gui.conf
|
||||
.RS
|
||||
Configuration file
|
||||
.RE
|
||||
.SH SEE ALSO
|
||||
.BR netctlgui-helper (1)
|
||||
.BR netctl-gui.conf (5)
|
||||
.SH STANDARDS
|
||||
See
|
||||
.B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-dbus-api.html
|
||||
for more details.
|
||||
.SH SECURITY CONSIDERATIONS
|
||||
See
|
||||
.B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-security-notes.html
|
||||
for more details.
|
||||
.SH AUTHOR
|
||||
@PROJECT_AUTHOR@ <\fI@PROJECT_CONTACT@\fR>
|
||||
.SH LICENSE
|
||||
This software is licensed under @PROJECT_LICENSE@
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env xdg-open
|
||||
[Desktop Entry]
|
||||
Name=Netctl GUI
|
||||
Comment=GUI written on Qt4 for netctl
|
||||
Comment=Qt graphical user interface for netctl
|
||||
Exec=netctl-gui
|
||||
Icon=netctl-gui.png
|
||||
Terminal=false
|
||||
|
@ -1,6 +0,0 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>translations/english.qm</file>
|
||||
<file>translations/russian.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,42 +1,60 @@
|
||||
# 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)
|
||||
|
||||
set (LANGUAGES english
|
||||
russian)
|
||||
file (GLOB LANGUAGES ${SUBPROJECT_TRANSLATION_DIR}/*.ts)
|
||||
set (RESOURCES ${SUBPROJECT_RESOURCE_DIR}/resources.qrc)
|
||||
|
||||
message (STATUS "${SUBPROJECT} Sources: ${SOURCES}")
|
||||
message (STATUS "${SUBPROJECT} Headers: ${HEADERS}")
|
||||
message (STATUS "${SUBPROJECT} Forms: ${FORMS}")
|
||||
|
||||
# include_path
|
||||
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../)
|
||||
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../${PROJECT_LIBRARY}/include/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_TRDPARTY_DIR})
|
||||
link_directories (${PROJECT_LIBRARY}/src/lib)
|
||||
|
||||
find_package (Qt4 REQUIRED)
|
||||
include (${QT_USE_FILE})
|
||||
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||
qt4_wrap_ui (UI_HEADERS ${FORMS})
|
||||
qt4_add_resources (QRC_SOURCES ${RESOURCES})
|
||||
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})
|
||||
|
||||
foreach (LANGUAGE ${LANGUAGES})
|
||||
set (TS ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.ts)
|
||||
set (QM ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.qm)
|
||||
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})
|
||||
|
||||
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})
|
||||
message (STATUS "${SUBPROJECT} Translations: ${TRANSLATIONS_BINARY}")
|
||||
|
||||
source_group ("Header Files" FILES ${HEADERS})
|
||||
source_group ("Source Files" FILES ${SOURCES})
|
||||
source_group ("Generated Files" FILES ${MOC_SOURCES})
|
||||
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})
|
||||
target_link_libraries (${SUBPROJECT} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
|
||||
|
||||
target_link_libraries (${SUBPROJECT} ${PROJECT_LIBRARY} ${QT_NEEDED_LIBS})
|
||||
# install properties
|
||||
install (TARGETS ${SUBPROJECT} DESTINATION bin)
|
||||
|
107
sources/gui/src/aboutwindow.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
/***************************************************************************
|
||||
* 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 "aboutwindow.h"
|
||||
#include "ui_aboutwindow.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
AboutWindow::AboutWindow(QWidget *parent, const bool debugCmd)
|
||||
: QMainWindow(parent),
|
||||
ui(new Ui::AboutWindow),
|
||||
debug(debugCmd)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
createUi();
|
||||
}
|
||||
|
||||
|
||||
AboutWindow::~AboutWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
delete uiAbout;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void AboutWindow::createText()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// 1st tab
|
||||
uiAbout->label_name->setText(QString(NAME));
|
||||
uiAbout->label_version->setText(QApplication::translate("AboutWindow", "Version %1\n(build date %2)")
|
||||
.arg(QString(VERSION)).arg(QString(BUILD_DATE)));
|
||||
uiAbout->label_description->setText(QApplication::translate("AboutWindow", "Qt-based graphical interface for netctl."));
|
||||
uiAbout->label_links->setText(QApplication::translate("AboutWindow", "Links:") + QString("<br>") +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(HOMEPAGE))
|
||||
.arg(QApplication::translate("AboutWindow", "Homepage")) +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY))
|
||||
.arg(QApplication::translate("AboutWindow", "Repository")) +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER))
|
||||
.arg(QApplication::translate("AboutWindow", "Bugtracker")) +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION))
|
||||
.arg(QApplication::translate("AboutWindow", "Translation issue")) +\
|
||||
QString("<a href=\"%1\">%2</a>").arg(QString(AUR_PACKAGES))
|
||||
.arg(QApplication::translate("AboutWindow", "AUR packages")));
|
||||
uiAbout->label_license->setText(QString("<small>© %1 <a href=\"mailto:%2\">%3</a><br>")
|
||||
.arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) +
|
||||
QApplication::translate("AboutWindow", "This software is licensed under %1").arg(QString(LICENSE)) +
|
||||
QString("</small>"));
|
||||
// 2nd tab
|
||||
QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts);
|
||||
for (int i=0; i<trdPartyList.count(); i++)
|
||||
trdPartyList[i] = QString("<a href=\"%3\">%1</a> (%2 license)")
|
||||
.arg(trdPartyList[i].split(QChar(','))[0])
|
||||
.arg(trdPartyList[i].split(QChar(','))[1])
|
||||
.arg(trdPartyList[i].split(QChar(','))[2]);
|
||||
uiAbout->label_translators->setText(QApplication::translate("AboutWindow", "Translators: %1").arg(QString(TRANSLATORS)));
|
||||
uiAbout->label_trdparty->setText(QApplication::translate("AboutWindow", "This software uses: %1").arg(trdPartyList.join(QString(", "))));
|
||||
}
|
||||
|
||||
|
||||
void AboutWindow::createUi()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QWidget *aboutWidget = new QWidget();
|
||||
uiAbout = new Ui::About;
|
||||
uiAbout->setupUi(aboutWidget);
|
||||
ui->verticalLayout->insertWidget(0, aboutWidget);
|
||||
createText();
|
||||
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked(bool)), this, SLOT(close()));
|
||||
}
|
||||
|
||||
|
||||
// ESC press event
|
||||
void AboutWindow::keyPressEvent(QKeyEvent *pressedKey)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (pressedKey->key() == Qt::Key_Escape)
|
||||
close();
|
||||
}
|
51
sources/gui/src/aboutwindow.h
Normal file
@ -0,0 +1,51 @@
|
||||
/***************************************************************************
|
||||
* 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/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ABOUTWINDOW_H
|
||||
#define ABOUTWINDOW_H
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "ui_about.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class AboutWindow;
|
||||
}
|
||||
|
||||
class AboutWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutWindow(QWidget *parent = 0,
|
||||
const bool debugCmd = false);
|
||||
~AboutWindow();
|
||||
|
||||
private:
|
||||
Ui::AboutWindow *ui;
|
||||
Ui::About *uiAbout;
|
||||
bool debug;
|
||||
void createText();
|
||||
void createUi();
|
||||
// ESC pressed event
|
||||
void keyPressEvent(QKeyEvent *pressedKey);
|
||||
};
|
||||
|
||||
|
||||
#endif /* ABOUTWINDOW_H */
|
30
sources/gui/src/aboutwindow.ui
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AboutWindow</class>
|
||||
<widget class="QMainWindow" name="AboutWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>516</width>
|
||||
<height>431</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "bridgewidget.h"
|
||||
@ -72,9 +72,10 @@ int BridgeWidget::isOk()
|
||||
|
||||
void BridgeWidget::setSettings(const QMap<QString, QString> settings)
|
||||
{
|
||||
clear();
|
||||
QMap<QString, QString> bridgeSettings = settings;
|
||||
|
||||
if (bridgeSettings.contains(QString("SkipForwardingDelay")))
|
||||
if (bridgeSettings[QString("SkipForwardingDelay")].remove(QString("'")) == QString("yes"))
|
||||
if (bridgeSettings[QString("SkipForwardingDelay")] == QString("yes"))
|
||||
ui->checkBox_skip->setCheckState(Qt::Checked);
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef BRIDGEWIDGET_H
|
||||
|
107
sources/gui/src/dbusoperation.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
/***************************************************************************
|
||||
* 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 "dbusoperation.h"
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QDebug>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
|
||||
QList<netctlProfileInfo> parseOutputNetctl(const QList<QVariant> raw,
|
||||
const bool debug)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QList<netctlProfileInfo> profileInfo;
|
||||
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;
|
||||
profile.name = info[0];
|
||||
profile.description = info[1];
|
||||
profile.active = info[2].toInt();
|
||||
profile.enabled = info[3].toInt();
|
||||
profileInfo.append(profile);
|
||||
}
|
||||
|
||||
return profileInfo;
|
||||
}
|
||||
|
||||
|
||||
QList<netctlWifiInfo> parseOutputWifi(const QList<QVariant> raw,
|
||||
const bool debug)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QList<netctlWifiInfo> wifiInfo;
|
||||
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;
|
||||
wifi.name = info[0];
|
||||
wifi.security = info[1];
|
||||
wifi.signal = info[2];
|
||||
wifi.active = info[3].toInt();
|
||||
wifi.exists = info[4].toInt();
|
||||
wifiInfo.append(wifi);
|
||||
}
|
||||
|
||||
return wifiInfo;
|
||||
}
|
||||
|
||||
|
||||
QList<QVariant> sendDBusRequest(const QString service, const QString path,
|
||||
const QString interface, const QString cmd,
|
||||
const QList<QVariant> args, const bool system,
|
||||
const bool debug)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Service" << service;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Path" << path;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Interface" << interface;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "args" << args;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "is system bus" << system;
|
||||
|
||||
QList<QVariant> arguments;
|
||||
QDBusMessage response;
|
||||
if (system) {
|
||||
QDBusConnection bus = QDBusConnection::systemBus();
|
||||
QDBusMessage request = QDBusMessage::createMethodCall(service, path, interface, cmd);
|
||||
if (!args.isEmpty())
|
||||
request.setArguments(args);
|
||||
response = bus.call(request, QDBus::BlockWithGui);
|
||||
} else {
|
||||
QDBusConnection bus = QDBusConnection::sessionBus();
|
||||
QDBusMessage request = QDBusMessage::createMethodCall(service, path, interface, cmd);
|
||||
if (!args.isEmpty())
|
||||
request.setArguments(args);
|
||||
response = bus.call(request, QDBus::BlockWithGui);
|
||||
}
|
||||
arguments = response.arguments();
|
||||
if (arguments.size() == 0)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error message" << response.errorMessage();
|
||||
|
||||
return arguments;
|
||||
}
|
36
sources/gui/src/dbusoperation.h
Normal file
@ -0,0 +1,36 @@
|
||||
/***************************************************************************
|
||||
* 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/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef DBUSOPERATION_H
|
||||
#define DBUSOPERATION_H
|
||||
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
QList<netctlProfileInfo> parseOutputNetctl(const QList<QVariant> raw,
|
||||
const bool debug = false);
|
||||
QList<netctlWifiInfo> parseOutputWifi(const QList<QVariant> raw,
|
||||
const bool debug = false);
|
||||
QList<QVariant> sendDBusRequest(const QString service, const QString path,
|
||||
const QString interface, const QString cmd,
|
||||
const QList<QVariant> args = QList<QVariant>(),
|
||||
const bool system = true, const bool debug = false);
|
||||
|
||||
|
||||
#endif /* DBUSOPERATION_H */
|
@ -1,96 +1,200 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "errorwindow.h"
|
||||
#include "ui_errorwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QGridLayout>
|
||||
#include <QSpacerItem>
|
||||
#include <QDebug>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
ErrorWindow::ErrorWindow(QWidget *parent, const int messageNumber)
|
||||
: QMainWindow(parent),
|
||||
ui(new Ui::ErrorWindow)
|
||||
|
||||
ErrorWindow::ErrorWindow(QWidget *parent, const bool debugCmd)
|
||||
: debug(debugCmd)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
qDebug() << "[ErrorWindow]" << "[ErrorWindow]" << ":" << "Initializate with error code" << messageNumber;
|
||||
setMessage(messageNumber);
|
||||
}
|
||||
|
||||
|
||||
ErrorWindow::~ErrorWindow()
|
||||
{
|
||||
delete ui;
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
}
|
||||
|
||||
void ErrorWindow::setMessage(const int mess)
|
||||
|
||||
QStringList ErrorWindow::getMessage(const int mess, const QString custom)
|
||||
{
|
||||
QString message;
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Message" << mess;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Custom message" << custom;
|
||||
|
||||
QString message, title;
|
||||
switch(mess) {
|
||||
case 1:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Could not find components");
|
||||
break;
|
||||
case 2:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Does not support yet");
|
||||
break;
|
||||
case 3:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Profile name is not set");
|
||||
break;
|
||||
case 4:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Bind interfaces are not set");
|
||||
break;
|
||||
case 5:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Description is not set");
|
||||
break;
|
||||
case 6:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Ip settings are not set");
|
||||
break;
|
||||
case 7:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Configuration file does not exist");
|
||||
break;
|
||||
case 8:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Key is not set");
|
||||
break;
|
||||
case 9:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Wireless settings are not set");
|
||||
break;
|
||||
case 10:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Configuration file is not set");
|
||||
break;
|
||||
case 11:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "ESSID is not set");
|
||||
break;
|
||||
case 12:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "MAC address is incorrect");
|
||||
break;
|
||||
case 13:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Session ID is not set");
|
||||
break;
|
||||
case 14:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "APN is not set");
|
||||
break;
|
||||
case 15:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "APN is not set");
|
||||
break;
|
||||
case 16:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Empty user/group name");
|
||||
break;
|
||||
case 17:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Could not find profile");
|
||||
break;
|
||||
case 18:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Could not find ESSID");
|
||||
break;
|
||||
case 19:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Could not run helper");
|
||||
break;
|
||||
default:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Unknown error");
|
||||
break;
|
||||
}
|
||||
if (!custom.isEmpty())
|
||||
message = custom;
|
||||
|
||||
ui->label->setText(message);
|
||||
QStringList fullMessage;
|
||||
fullMessage.append(title);
|
||||
fullMessage.append(message);
|
||||
return fullMessage;
|
||||
}
|
||||
|
||||
|
||||
QMessageBox::Icon ErrorWindow::getIcon(const int mess)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Message" << mess;
|
||||
|
||||
QMessageBox::Icon icon;
|
||||
switch(mess) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
case 17:
|
||||
case 18:
|
||||
case 19:
|
||||
icon = QMessageBox::Critical;
|
||||
break;
|
||||
default:
|
||||
icon = QMessageBox::NoIcon;
|
||||
break;
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
||||
void ErrorWindow::showWindow(const int mess, const QString sender, const QString custom)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Message" << mess;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Sender" << sender;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Custom message" << custom;
|
||||
|
||||
QStringList message = getMessage(mess, custom);
|
||||
QMessageBox messageBox;
|
||||
messageBox.setText(message[0]);
|
||||
messageBox.setInformativeText(message[1]);
|
||||
if (debug)
|
||||
messageBox.setDetailedText(QApplication::translate("ErrorWindow", "Sender : %1").
|
||||
arg(sender));
|
||||
messageBox.setIcon(getIcon(mess));
|
||||
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||
messageBox.setDefaultButton(QMessageBox::Ok);
|
||||
|
||||
QSpacerItem *horizontalSpacer = new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
QGridLayout *layout = (QGridLayout *)messageBox.layout();
|
||||
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
||||
|
||||
messageBox.exec();
|
||||
return;
|
||||
}
|
||||
|
@ -1,42 +1,46 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ERRORWINDOW_H
|
||||
#define ERRORWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMessageBox>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class ErrorWindow;
|
||||
}
|
||||
|
||||
class ErrorWindow : public QMainWindow
|
||||
class ErrorWindow : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ErrorWindow(QWidget *parent = 0,
|
||||
const int messageNumber = 0);
|
||||
const bool debugCmd = false);
|
||||
~ErrorWindow();
|
||||
|
||||
public slots:
|
||||
void showWindow(const int mess = 0,
|
||||
const QString sender = QString(),
|
||||
const QString custom = QString());
|
||||
|
||||
private:
|
||||
Ui::ErrorWindow *ui;
|
||||
void setMessage(const int mess);
|
||||
bool debug;
|
||||
QStringList getMessage(const int mess, const QString custom = QString());
|
||||
QMessageBox::Icon getIcon(const int mess);
|
||||
};
|
||||
|
||||
|
||||
#endif /* ERRORWINDOW_H */
|
||||
|
@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ErrorWindow</class>
|
||||
<widget class="QMainWindow" name="ErrorWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>287</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Error</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<spacer name="spacer2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_main">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Error text</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_button">
|
||||
<item>
|
||||
<spacer name="spacer_button1">
|
||||
<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">
|
||||
<property name="text">
|
||||
<string>Ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_button2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>clicked(bool)</signal>
|
||||
<receiver>ErrorWindow</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>143</x>
|
||||
<y>83</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>252</x>
|
||||
<y>80</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "ethernetwidget.h"
|
||||
@ -44,7 +44,7 @@ void EthernetWidget::clear()
|
||||
ui->checkBox_skip->setCheckState(Qt::Unchecked);
|
||||
ui->checkBox_8021x->setCheckState(Qt::Unchecked);
|
||||
showWpa(ui->checkBox_8021x->checkState());
|
||||
ui->lineEdit_wpaConfig->setText(QString("/etc/wpa_supplicant.conf"));
|
||||
ui->lineEdit_wpaConfig->clear();
|
||||
ui->comboBox_driver->setCurrentIndex(0);
|
||||
ui->spinBox_timeoutCarrier->setValue(5);
|
||||
ui->spinBox_timeoutWpa->setValue(15);
|
||||
@ -86,10 +86,9 @@ void EthernetWidget::selectWpaConfig()
|
||||
void EthernetWidget::showAdvanced()
|
||||
{
|
||||
if (ui->pushButton_ethernetAdvanced->isChecked()) {
|
||||
ui->widget_ethernetAdvanced->setShown(true);
|
||||
ui->widget_ethernetAdvanced->setHidden(false);
|
||||
ui->pushButton_ethernetAdvanced->setText(QApplication::translate("EthernetWidget", "Hide advanced"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->widget_ethernetAdvanced->setHidden(true);
|
||||
ui->pushButton_ethernetAdvanced->setText(QApplication::translate("EthernetWidget", "Show advanced"));
|
||||
}
|
||||
@ -101,7 +100,7 @@ void EthernetWidget::showWpa(const int state)
|
||||
if (state == 0)
|
||||
ui->widget_wpa->setHidden(true);
|
||||
else
|
||||
ui->widget_wpa->setShown(true);
|
||||
ui->widget_wpa->setHidden(false);
|
||||
}
|
||||
|
||||
|
||||
@ -141,19 +140,20 @@ int EthernetWidget::isOk()
|
||||
|
||||
void EthernetWidget::setSettings(const QMap<QString, QString> settings)
|
||||
{
|
||||
clear();
|
||||
QMap<QString, QString> ethernetSettings = settings;
|
||||
|
||||
if (ethernetSettings.contains(QString("SkipNoCarrier")))
|
||||
if (ethernetSettings[QString("SkipNoCarrier")].remove(QString("'")) == QString("yes"))
|
||||
if (ethernetSettings[QString("SkipNoCarrier")] == QString("yes"))
|
||||
ui->checkBox_skip->setCheckState(Qt::Checked);
|
||||
if (ethernetSettings.contains(QString("Auth8021X")))
|
||||
if (ethernetSettings[QString("Auth8021X")].remove(QString("'")) == QString("yes"))
|
||||
if (ethernetSettings[QString("Auth8021X")] == QString("yes"))
|
||||
ui->checkBox_8021x->setCheckState(Qt::Checked);
|
||||
if (ethernetSettings.contains(QString("WPAConfigFile")))
|
||||
ui->lineEdit_wpaConfig->setText(ethernetSettings[QString("WPAConfigFile")].remove(QString("'")));
|
||||
ui->lineEdit_wpaConfig->setText(ethernetSettings[QString("WPAConfigFile")]);
|
||||
if (ethernetSettings.contains(QString("WPADriver")))
|
||||
for (int i=0; i<ui->comboBox_driver->count(); i++)
|
||||
if (ethernetSettings[QString("WPADriver")].remove(QString("'")) == ui->comboBox_driver->itemText(i))
|
||||
if (ethernetSettings[QString("WPADriver")] == ui->comboBox_driver->itemText(i))
|
||||
ui->comboBox_driver->setCurrentIndex(i);
|
||||
if (ethernetSettings.contains(QString("TimeoutCarrier")))
|
||||
ui->spinBox_timeoutCarrier->setValue(ethernetSettings[QString("TimeoutCarrier")].toInt());
|
||||
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ETHERNETWIDGET_H
|
||||
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "generalwidget.h"
|
||||
@ -112,10 +112,9 @@ void GeneralWidget::keyPressEvent(QKeyEvent *pressedKey)
|
||||
void GeneralWidget::showAdvanced()
|
||||
{
|
||||
if (ui->pushButton_generalAdvanced->isChecked()) {
|
||||
ui->widget_generalAdvanced->setShown(true);
|
||||
ui->widget_generalAdvanced->setHidden(false);
|
||||
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Hide advanced"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->widget_generalAdvanced->setHidden(true);
|
||||
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Show advanced"));
|
||||
}
|
||||
@ -136,13 +135,13 @@ QMap<QString, QString> GeneralWidget::getSettings()
|
||||
QStringList interfaces;
|
||||
for (int i=0; i<ui->listWidget_bindto->count(); i++)
|
||||
interfaces.append(ui->listWidget_bindto->item(i)->text());
|
||||
generalSettings[QString("BindsToInterfaces")] = interfaces.join(QString(" "));
|
||||
generalSettings[QString("BindsToInterfaces")] = interfaces.join(QChar(' '));
|
||||
}
|
||||
if (ui->listWidget_after->count() != 0) {
|
||||
QStringList profiles;
|
||||
for (int i=0; i<ui->listWidget_after->count(); i++)
|
||||
profiles.append(ui->listWidget_after->item(i)->text());
|
||||
generalSettings[QString("After")] = profiles.join(QString(" "));
|
||||
generalSettings[QString("After")] = profiles.join(QChar(' '));
|
||||
}
|
||||
if (!ui->lineEdit_execUpPost->text().isEmpty())
|
||||
generalSettings[QString("ExecUpPost")] = QString("'") + ui->lineEdit_execUpPost->text() + QString("'");
|
||||
@ -162,7 +161,9 @@ int GeneralWidget::isOk()
|
||||
// bind interfaces is not set
|
||||
if ((ui->comboBox_connection->currentText() == QString("bond")) ||
|
||||
(ui->comboBox_connection->currentText() == QString("bridge")) ||
|
||||
(ui->comboBox_connection->currentText() == QString("vlan")))
|
||||
(ui->comboBox_connection->currentText() == QString("vlan")) ||
|
||||
(ui->comboBox_connection->currentText() == QString("macvlan")) ||
|
||||
(ui->comboBox_connection->currentText() == QString("openvswitch")))
|
||||
if (ui->listWidget_bindto->count() == 0)
|
||||
return 1;
|
||||
// empty description
|
||||
@ -175,30 +176,31 @@ int GeneralWidget::isOk()
|
||||
|
||||
void GeneralWidget::setSettings(const QMap<QString, QString> settings)
|
||||
{
|
||||
clear();
|
||||
QMap<QString, QString> generalSettings = settings;
|
||||
|
||||
if (generalSettings.contains(QString("Description")))
|
||||
ui->lineEdit_description->setText(generalSettings[QString("Description")].remove(QString("'")));
|
||||
ui->lineEdit_description->setText(generalSettings[QString("Description")]);
|
||||
if (generalSettings.contains(QString("Connection")))
|
||||
for (int i=0; i<ui->comboBox_connection->count(); i++)
|
||||
if (generalSettings[QString("Connection")].remove(QString("'")) == ui->comboBox_connection->itemText(i))
|
||||
if (generalSettings[QString("Connection")] == ui->comboBox_connection->itemText(i))
|
||||
ui->comboBox_connection->setCurrentIndex(i);
|
||||
if (generalSettings.contains(QString("Interface")))
|
||||
for (int i=0; i<ui->comboBox_interface->count(); i++)
|
||||
if (generalSettings[QString("Interface")].remove(QString("'")) == ui->comboBox_interface->itemText(i))
|
||||
ui->comboBox_interface->setCurrentIndex(i);
|
||||
if (generalSettings.contains(QString("Interface"))) {
|
||||
ui->comboBox_interface->addItem(generalSettings[QString("Interface")]);
|
||||
ui->comboBox_interface->setCurrentIndex(ui->comboBox_interface->count()-1);
|
||||
}
|
||||
if (generalSettings.contains(QString("BindsToInterfaces")))
|
||||
ui->listWidget_bindto->addItems(generalSettings[QString("BindsToInterfaces")].split(QString(" ")));
|
||||
ui->listWidget_bindto->addItems(generalSettings[QString("BindsToInterfaces")].split(QChar('\n')));
|
||||
if (generalSettings.contains(QString("After")))
|
||||
ui->listWidget_after->addItems(generalSettings[QString("After")].split(QString(" ")));
|
||||
ui->listWidget_after->addItems(generalSettings[QString("After")].split(QChar('\n')));
|
||||
if (generalSettings.contains(QString("ExecUpPost")))
|
||||
ui->lineEdit_execUpPost->setText(generalSettings[QString("ExecUpPost")].remove(QString("'")));
|
||||
ui->lineEdit_execUpPost->setText(generalSettings[QString("ExecUpPost")]);
|
||||
if (generalSettings.contains(QString("ExecDownPre")))
|
||||
ui->lineEdit_execDownPre->setText(generalSettings[QString("ExecDownPre")].remove(QString("'")));
|
||||
ui->lineEdit_execDownPre->setText(generalSettings[QString("ExecDownPre")]);
|
||||
if (generalSettings.contains(QString("ForceConnect")))
|
||||
if (generalSettings[QString("ForceConnect")].remove(QString("'")) == QString("yes"))
|
||||
if (generalSettings[QString("ForceConnect")] == QString("yes"))
|
||||
ui->checkBox_forceConnect->setCheckState(Qt::Checked);
|
||||
if (generalSettings.contains(QString("NETCTL_DEBUG")))
|
||||
if (generalSettings[QString("NETCTL_DEBUG")].remove(QString("'")) == QString("yes"))
|
||||
if (generalSettings[QString("NETCTL_DEBUG")] == QString("yes"))
|
||||
ui->checkBox_debug->setCheckState(Qt::Checked);
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef GENERALWIDGET_H
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>431</width>
|
||||
<height>537</height>
|
||||
<width>425</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -118,6 +118,16 @@
|
||||
<string notr="true">vlan</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">macvlan</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">openvswitch</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "ipwidget.h"
|
||||
#include "ui_ipwidget.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QKeyEvent>
|
||||
|
||||
|
||||
@ -171,7 +170,7 @@ void IpWidget::keyPressEvent(QKeyEvent *pressedKey)
|
||||
|
||||
QString IpWidget::getIp(const QString rawIp)
|
||||
{
|
||||
QStringList ip = rawIp.split(QString("."));
|
||||
QStringList ip = rawIp.split(QChar('.'));
|
||||
|
||||
// fix empty fields
|
||||
if (ip[0].isEmpty())
|
||||
@ -187,7 +186,7 @@ QString IpWidget::getIp(const QString rawIp)
|
||||
if (ip[i].toInt() > 255)
|
||||
ip[i] = QString("255");
|
||||
|
||||
return ip.join(QString("."));
|
||||
return ip.join(QChar('.'));
|
||||
}
|
||||
|
||||
|
||||
@ -234,8 +233,8 @@ QString IpWidget::getPrefix6(const QString rawPrefix)
|
||||
|
||||
void IpWidget::addIp()
|
||||
{
|
||||
QString ip = getIp(ui->lineEdit_ipAddress->text().remove(" ").split(QString("/"))[0]);
|
||||
QString prefix = getPrefix(ui->lineEdit_ipAddress->text().remove(" ").split(QString("/"))[1]);
|
||||
QString ip = getIp(ui->lineEdit_ipAddress->text().remove(QChar(' ')).split(QChar('/'))[0]);
|
||||
QString prefix = getPrefix(ui->lineEdit_ipAddress->text().remove(QChar(' ')).split(QChar('/'))[1]);
|
||||
|
||||
ui->listWidget_ipAddress->addItem(ip + QString("/") + prefix);
|
||||
ui->lineEdit_ipAddress->clear();
|
||||
@ -244,9 +243,9 @@ void IpWidget::addIp()
|
||||
|
||||
void IpWidget::addIpRoutes()
|
||||
{
|
||||
QString ip = getIp(ui->lineEdit_ipRoutes->text().remove(" ").split(QString("/"))[0]);
|
||||
QString prefix = getPrefix(ui->lineEdit_ipRoutes->text().remove(" ").split(QString("/"))[1]);
|
||||
QString ipVia = getIp(ui->lineEdit_ipRoutes2->text().remove(" "));
|
||||
QString ip = getIp(ui->lineEdit_ipRoutes->text().remove(QChar(' ')).split(QChar('/'))[0]);
|
||||
QString prefix = getPrefix(ui->lineEdit_ipRoutes->text().remove(QChar(' ')).split(QChar('/'))[1]);
|
||||
QString ipVia = getIp(ui->lineEdit_ipRoutes2->text().remove(QChar(' ')));
|
||||
|
||||
ui->listWidget_ipRoutes->addItem(ip + QString("/") + prefix + QString(" via ") + ipVia);
|
||||
ui->lineEdit_ipRoutes->clear();
|
||||
@ -256,8 +255,8 @@ void IpWidget::addIpRoutes()
|
||||
|
||||
void IpWidget::addIp6()
|
||||
{
|
||||
QString ip = getIp6(ui->lineEdit_ipAddress6->text().remove(" ").split(QString("/"))[0]);
|
||||
QString prefix = getPrefix6(ui->lineEdit_ipAddress6->text().remove(" ").split(QString("/"))[1]);
|
||||
QString ip = getIp6(ui->lineEdit_ipAddress6->text().remove(QChar(' ')).split(QChar('/'))[0]);
|
||||
QString prefix = getPrefix6(ui->lineEdit_ipAddress6->text().remove(QChar(' ')).split(QChar('/'))[1]);
|
||||
|
||||
ui->listWidget_ipAddress6->addItem(ip + QString("/") + prefix);
|
||||
ui->lineEdit_ipAddress6->clear();
|
||||
@ -266,9 +265,9 @@ void IpWidget::addIp6()
|
||||
|
||||
void IpWidget::addIpRoutes6()
|
||||
{
|
||||
QString ip = getIp6(ui->lineEdit_ipRoutes6->text().remove(" ").split(QString("/"))[0]);
|
||||
QString prefix = getPrefix6(ui->lineEdit_ipRoutes6->text().remove(" ").split(QString("/"))[1]);
|
||||
QString ipVia = getIp6(ui->lineEdit_ipRoutes62->text().remove(" "));
|
||||
QString ip = getIp6(ui->lineEdit_ipRoutes6->text().remove(QChar(' ')).split(QChar('/'))[0]);
|
||||
QString prefix = getPrefix6(ui->lineEdit_ipRoutes6->text().remove(QChar(' ')).split(QChar('/'))[1]);
|
||||
QString ipVia = getIp6(ui->lineEdit_ipRoutes62->text().remove(QChar(' ')));
|
||||
|
||||
ui->listWidget_ipRoutes6->addItem(ip + QString("/") + prefix + QString(" via ") + ipVia);
|
||||
ui->lineEdit_ipRoutes6->clear();
|
||||
@ -286,7 +285,7 @@ void IpWidget::addCustom()
|
||||
|
||||
void IpWidget::addDns()
|
||||
{
|
||||
QString ip = getIp(ui->lineEdit_dns->text().remove(" "));
|
||||
QString ip = getIp(ui->lineEdit_dns->text().remove(QChar(' ')));
|
||||
|
||||
ui->listWidget_dns->addItem(ip);
|
||||
ui->lineEdit_dns->clear();
|
||||
@ -306,7 +305,7 @@ void IpWidget::changeIpMode(const QString currentText)
|
||||
if (currentText == QString("dhcp"))
|
||||
ui->widget_ip->setHidden(true);
|
||||
else if (currentText == QString("static"))
|
||||
ui->widget_ip->setShown(true);
|
||||
ui->widget_ip->setHidden(false);
|
||||
}
|
||||
|
||||
|
||||
@ -316,8 +315,7 @@ void IpWidget::ipEnable(const int state)
|
||||
ui->comboBox_ip->setDisabled(true);
|
||||
ui->widget_ip->setDisabled(true);
|
||||
ui->widget_ipRoutes->setDisabled(true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->comboBox_ip->setEnabled(true);
|
||||
ui->widget_ip->setEnabled(true);
|
||||
ui->widget_ipRoutes->setEnabled(true);
|
||||
@ -332,7 +330,7 @@ void IpWidget::changeIp6Mode(const QString currentText)
|
||||
ui->widget_ip6->setHidden(true);
|
||||
else if ((currentText == QString("static")) ||
|
||||
(currentText == QString("stateless")))
|
||||
ui->widget_ip6->setShown(true);
|
||||
ui->widget_ip6->setHidden(false);
|
||||
}
|
||||
|
||||
|
||||
@ -342,8 +340,7 @@ void IpWidget::ip6Enable(const int state)
|
||||
ui->comboBox_ip6->setDisabled(true);
|
||||
ui->widget_ip6->setDisabled(true);
|
||||
ui->widget_ipRoutes6->setDisabled(true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->comboBox_ip6->setEnabled(true);
|
||||
ui->widget_ip6->setEnabled(true);
|
||||
ui->widget_ipRoutes6->setEnabled(true);
|
||||
@ -354,12 +351,11 @@ void IpWidget::ip6Enable(const int state)
|
||||
void IpWidget::changeDhcpClient(const QString currentText)
|
||||
{
|
||||
if (currentText == QString("dhcpcd")) {
|
||||
ui->widget_dhcpcdOpt->setShown(true);
|
||||
ui->widget_dhcpcdOpt->setHidden(false);
|
||||
ui->widget_dhclientOpt->setHidden(true);
|
||||
}
|
||||
else if (currentText == QString("dhclient")) {
|
||||
} else if (currentText == QString("dhclient")) {
|
||||
ui->widget_dhcpcdOpt->setHidden(true);
|
||||
ui->widget_dhclientOpt->setShown(true);
|
||||
ui->widget_dhclientOpt->setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,10 +363,9 @@ void IpWidget::changeDhcpClient(const QString currentText)
|
||||
void IpWidget::showAdvanced()
|
||||
{
|
||||
if (ui->pushButton_ipAdvanced->isChecked()) {
|
||||
ui->widget_ipAdvanced->setShown(true);
|
||||
ui->widget_ipAdvanced->setHidden(false);
|
||||
ui->pushButton_ipAdvanced->setText(QApplication::translate("IpWidget", "Hide advanced"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->widget_ipAdvanced->setHidden(true);
|
||||
ui->pushButton_ipAdvanced->setText(QApplication::translate("IpWidget", "Show advanced"));
|
||||
}
|
||||
@ -390,17 +385,16 @@ QMap<QString, QString> IpWidget::getSettings()
|
||||
QStringList addresses;
|
||||
for (int i=0; i<ui->listWidget_ipAddress->count(); i++)
|
||||
addresses.append(QString("'") + ui->listWidget_ipAddress->item(i)->text() + QString("'"));
|
||||
ipSettings[QString("Address")] = addresses.join(QString(" "));
|
||||
ipSettings[QString("Address")] = addresses.join(QChar(' '));
|
||||
ipSettings[QString("Gateway")] = QString("'") + ui->lineEdit_gateway->text() + QString("'");
|
||||
}
|
||||
if (ui->listWidget_ipRoutes->count() > 0) {
|
||||
QStringList routes;
|
||||
for (int i=0; i<ui->listWidget_ipRoutes->count(); i++)
|
||||
routes.append(QString("'") + ui->listWidget_ipRoutes->item(i)->text() + QString("'"));
|
||||
ipSettings[QString("Routes")] = routes.join(QString(" "));
|
||||
ipSettings[QString("Routes")] = routes.join(QChar(' '));
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
ipSettings[QString("IP")] = QString("no");
|
||||
if (ui->checkBox_ip6->checkState() == Qt::Checked) {
|
||||
ipSettings[QString("IP6")] = ui->comboBox_ip6->currentText();
|
||||
@ -409,23 +403,22 @@ QMap<QString, QString> IpWidget::getSettings()
|
||||
QStringList addresses;
|
||||
for (int i=0; i<ui->listWidget_ipAddress6->count(); i++)
|
||||
addresses.append(QString("'") + ui->listWidget_ipAddress6->item(i)->text() + QString("'"));
|
||||
ipSettings[QString("Address6")] = addresses.join(QString(" "));
|
||||
ipSettings[QString("Address6")] = addresses.join(QChar(' '));
|
||||
ipSettings[QString("Gateway6")] = QString("'") + ui->lineEdit_gateway6->text() + QString("'");
|
||||
}
|
||||
if (ui->listWidget_ipRoutes6->count() > 0) {
|
||||
QStringList routes;
|
||||
for (int i=0; i<ui->listWidget_ipRoutes6->count(); i++)
|
||||
routes.append(QString("'") + ui->listWidget_ipRoutes6->item(i)->text() + QString("'"));
|
||||
ipSettings[QString("Routes6")] = routes.join(QString(" "));
|
||||
ipSettings[QString("Routes6")] = routes.join(QChar(' '));
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
ipSettings[QString("IP6")] = QString("no");
|
||||
if (ui->listWidget_custom->count() > 0) {
|
||||
QStringList custom;
|
||||
for (int i=0; i<ui->listWidget_custom->count(); i++)
|
||||
custom.append(QString("'") + ui->listWidget_custom->item(i)->text() + QString("'"));
|
||||
ipSettings[QString("IPCustom")] = custom.join(QString(" "));
|
||||
ipSettings[QString("IPCustom")] = custom.join(QChar(' '));
|
||||
}
|
||||
if (!ui->lineEdit_hostname->text().isEmpty())
|
||||
ipSettings[QString("Hostname")] = QString("'") + ui->lineEdit_hostname->text() + QString("'");
|
||||
@ -434,8 +427,7 @@ QMap<QString, QString> IpWidget::getSettings()
|
||||
if (ui->comboBox_dhcp->currentText() == QString("dhcpcd")) {
|
||||
if (!ui->lineEdit_dhcpcdOpt->text().isEmpty())
|
||||
ipSettings[QString("DhcpcdOptions")] = QString("'") + ui->lineEdit_dhcpcdOpt->text() + QString("'");
|
||||
}
|
||||
else if (ui->comboBox_dhcp->currentText() == QString("dhclient")) {
|
||||
} else if (ui->comboBox_dhcp->currentText() == QString("dhclient")) {
|
||||
ipSettings[QString("DHCPClient")] = ui->comboBox_dhcp->currentText();
|
||||
if (!ui->lineEdit_dhclientOpt->text().isEmpty())
|
||||
ipSettings[QString("DhclientOptions")] = QString("'") + ui->lineEdit_dhclientOpt->text() + QString("'");
|
||||
@ -450,7 +442,7 @@ QMap<QString, QString> IpWidget::getSettings()
|
||||
QStringList dns;
|
||||
for (int i=0; i<ui->listWidget_dns->count(); i++)
|
||||
dns.append(QString("'") + ui->listWidget_dns->item(i)->text() + QString("'"));
|
||||
ipSettings[QString("DNS")] = dns.join(QString(" "));
|
||||
ipSettings[QString("DNS")] = dns.join(QChar(' '));
|
||||
}
|
||||
if (!ui->lineEdit_dnsDomain->text().isEmpty())
|
||||
ipSettings[QString("DNSDomain")] = QString("'") + ui->lineEdit_dnsDomain->text() + QString("'");
|
||||
@ -460,7 +452,7 @@ QMap<QString, QString> IpWidget::getSettings()
|
||||
QStringList dnsOpt;
|
||||
for (int i=0; i<ui->listWidget_dnsOptions->count(); i++)
|
||||
dnsOpt.append(QString("'") + ui->listWidget_dnsOptions->item(i)->text() + QString("'"));
|
||||
ipSettings[QString("DNSOptions")] = dnsOpt.join(QString(" "));
|
||||
ipSettings[QString("DNSOptions")] = dnsOpt.join(QChar(' '));
|
||||
}
|
||||
|
||||
return ipSettings;
|
||||
@ -489,76 +481,71 @@ int IpWidget::isOk()
|
||||
|
||||
void IpWidget::setSettings(const QMap<QString, QString> settings)
|
||||
{
|
||||
clear();
|
||||
QMap<QString, QString> ipSettings = settings;
|
||||
|
||||
if (ipSettings.contains(QString("IP"))) {
|
||||
if (ipSettings[QString("IP")].remove(QString("'")) == QString("no"))
|
||||
if (ipSettings[QString("IP")] == QString("no"))
|
||||
ui->checkBox_ip->setCheckState(Qt::Unchecked);
|
||||
else {
|
||||
ui->checkBox_ip->setCheckState(Qt::Checked);
|
||||
for (int i=0; i<ui->comboBox_ip->count(); i++)
|
||||
if (ipSettings[QString("IP")].remove(QString("'")) == ui->comboBox_ip->itemText(i))
|
||||
if (ipSettings[QString("IP")] == ui->comboBox_ip->itemText(i))
|
||||
ui->comboBox_ip->setCurrentIndex(i);
|
||||
}
|
||||
}
|
||||
if (ipSettings.contains(QString("Address")))
|
||||
ui->listWidget_ipAddress->addItems(ipSettings[QString("Address")].remove(QString("'")).split(QString(" ")));
|
||||
ui->listWidget_ipAddress->addItems(ipSettings[QString("Address")].split(QChar('\n')));
|
||||
if (ipSettings.contains(QString("Gateway")))
|
||||
ui->lineEdit_gateway->setText(ipSettings[QString("Gateway")].remove(QString("'")));
|
||||
ui->lineEdit_gateway->setText(ipSettings[QString("Gateway")]);
|
||||
if (ipSettings.contains(QString("Routes")))
|
||||
ui->listWidget_ipRoutes->addItems(ipSettings[QString("Routes")].remove(QString("'")).split(QString(" ")));
|
||||
ui->listWidget_ipRoutes->addItems(ipSettings[QString("Routes")].split(QChar('\n')));
|
||||
if (ipSettings.contains(QString("IP6"))) {
|
||||
if (ipSettings[QString("IP6")].remove(QString("'")) == QString("no"))
|
||||
if (ipSettings[QString("IP6")] == QString("no"))
|
||||
ui->checkBox_ip6->setCheckState(Qt::Unchecked);
|
||||
else {
|
||||
ui->checkBox_ip6->setCheckState(Qt::Checked);
|
||||
for (int i=0; i<ui->comboBox_ip6->count(); i++)
|
||||
if (ipSettings[QString("IP6")].remove(QString("'")) == ui->comboBox_ip6->itemText(i))
|
||||
if (ipSettings[QString("IP6")] == ui->comboBox_ip6->itemText(i))
|
||||
ui->comboBox_ip6->setCurrentIndex(i);
|
||||
}
|
||||
}
|
||||
if (ipSettings.contains(QString("Address6")))
|
||||
ui->listWidget_ipAddress6->addItems(ipSettings[QString("Address6")].remove(QString("'")).split(QString(" ")));
|
||||
ui->listWidget_ipAddress6->addItems(ipSettings[QString("Address6")].split(QChar('\n')));
|
||||
if (ipSettings.contains(QString("Gateway6")))
|
||||
ui->lineEdit_gateway6->setText(ipSettings[QString("Gateway6")].remove(QString("'")));
|
||||
ui->lineEdit_gateway6->setText(ipSettings[QString("Gateway6")]);
|
||||
if (ipSettings.contains(QString("Routes6")))
|
||||
ui->listWidget_ipRoutes6->addItems(ipSettings[QString("Routes6")].remove(QString("'")).split(QString(" ")));
|
||||
if (ipSettings.contains(QString("IPCustom"))) {
|
||||
QStringList custom;
|
||||
if (ipSettings[QString("IPCustom")].contains(QString("\n")))
|
||||
custom = ipSettings[QString("IPCustom")].split(QString("'\n'"));
|
||||
else
|
||||
custom = ipSettings[QString("IPCustom")].split(QString("' '"));
|
||||
for (int i=0; i<custom.count(); i++)
|
||||
ui->listWidget_custom->addItem(custom[i].remove(QString("'")));
|
||||
}
|
||||
ui->listWidget_ipRoutes6->addItems(ipSettings[QString("Routes6")].split(QChar('\n')));
|
||||
if (ipSettings.contains(QString("IPCustom")))
|
||||
ui->listWidget_custom->addItems(ipSettings[QString("IPCustom")].split(QChar('\n')));
|
||||
if (ipSettings.contains(QString("Hostname")))
|
||||
ui->lineEdit_hostname->setText(ipSettings[QString("Hostname")].remove(QString("'")));
|
||||
ui->lineEdit_hostname->setText(ipSettings[QString("Hostname")]);
|
||||
if (ipSettings.contains(QString("TimeoutDAD")))
|
||||
ui->spinBox_timeoutDad->setValue(ipSettings[QString("TimeoutDAD")].toInt());
|
||||
if (ipSettings.contains(QString("DHCPClient")))
|
||||
for (int i=0; i<ui->comboBox_dhcp->count(); i++)
|
||||
if (ipSettings[QString("DHCPClient")].remove(QString("'")) == ui->comboBox_dhcp->itemText(i))
|
||||
if (ipSettings[QString("DHCPClient")] == ui->comboBox_dhcp->itemText(i))
|
||||
ui->comboBox_dhcp->setCurrentIndex(i);
|
||||
if (ipSettings.contains(QString("DhcpcdOptions")))
|
||||
ui->lineEdit_dhcpcdOpt->setText(ipSettings[QString("DhcpcdOptions")].remove(QString("'")));
|
||||
ui->lineEdit_dhcpcdOpt->setText(ipSettings[QString("DhcpcdOptions")]
|
||||
.remove(QChar('\'')).remove(QChar('"')));
|
||||
if (ipSettings.contains(QString("DhclientOptions")))
|
||||
ui->lineEdit_dhclientOpt->setText(ipSettings[QString("DhclientOptions")].remove(QString("'")));
|
||||
ui->lineEdit_dhclientOpt->setText(ipSettings[QString("DhclientOptions")]);
|
||||
if (ipSettings.contains(QString("DhclientOptions6")))
|
||||
ui->lineEdit_dhclientOpt6->setText(ipSettings[QString("DhclientOptions6")].remove(QString("'")));
|
||||
ui->lineEdit_dhclientOpt6->setText(ipSettings[QString("DhclientOptions6")]);
|
||||
if (ipSettings.contains(QString("TimeoutDHCP")))
|
||||
ui->spinBox_timeoutDhcp->setValue(ipSettings[QString("TimeoutDHCP")].toInt());
|
||||
if (ipSettings.contains(QString("DHCPReleaseOnStop")))
|
||||
if (ipSettings[QString("DHCPReleaseOnStop")].remove(QString("'")) == QString("yes"))
|
||||
if (ipSettings[QString("DHCPReleaseOnStop")] == QString("yes"))
|
||||
ui->checkBox_dhcp->setCheckState(Qt::Checked);
|
||||
if (ipSettings.contains(QString("DNS")))
|
||||
ui->listWidget_dns->addItems(ipSettings[QString("DNS")].remove(QString("'")).split(QString(" ")));
|
||||
ui->listWidget_dns->addItems(ipSettings[QString("DNS")].split(QChar('\n')));
|
||||
if (ipSettings.contains(QString("DNSDomain")))
|
||||
ui->lineEdit_dnsDomain->setText(ipSettings[QString("DNSDomain")].remove(QString("'")));
|
||||
ui->lineEdit_dnsDomain->setText(ipSettings[QString("DNSDomain")]);
|
||||
if (ipSettings.contains(QString("DNSSearch")))
|
||||
ui->lineEdit_dnsSearch->setText(ipSettings[QString("DNSSearch")].remove(QString("'")));
|
||||
ui->lineEdit_dnsSearch->setText(ipSettings[QString("DNSSearch")]);
|
||||
if (ipSettings.contains(QString("DNSOptions")))
|
||||
ui->listWidget_dnsOptions->addItems(ipSettings[QString("DNSOptions")].remove(QString("'")).split(QString(" ")));
|
||||
ui->listWidget_dnsOptions->addItems(ipSettings[QString("DNSOptions")].split(QChar('\n')));
|
||||
|
||||
ipEnable(ui->checkBox_ip->checkState());
|
||||
changeIpMode(ui->comboBox_ip->currentText());
|
||||
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef IPWIDGET_H
|
||||
|
94
sources/gui/src/macvlanwidget.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
/***************************************************************************
|
||||
* 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 "macvlanwidget.h"
|
||||
#include "ui_macvlanwidget.h"
|
||||
|
||||
|
||||
MacvlanWidget::MacvlanWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui(new Ui::MacvlanWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
createFilter();
|
||||
}
|
||||
|
||||
|
||||
MacvlanWidget::~MacvlanWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void MacvlanWidget::clear()
|
||||
{
|
||||
ui->comboBox_mode->setCurrentIndex(0);
|
||||
ui->lineEdit_mac->clear();
|
||||
}
|
||||
|
||||
|
||||
void MacvlanWidget::setShown(const bool state)
|
||||
{
|
||||
if (state)
|
||||
show();
|
||||
else
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
void MacvlanWidget::createFilter()
|
||||
{
|
||||
// mac
|
||||
ui->lineEdit_mac->setInputMask(QString(">HH:HH:HH:HH:HH:HH"));
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> MacvlanWidget::getSettings()
|
||||
{
|
||||
QMap<QString, QString> macvlanSettings;
|
||||
|
||||
if (isOk() != 0)
|
||||
return macvlanSettings;
|
||||
|
||||
macvlanSettings[QString("Mode")] = ui->comboBox_mode->currentText();
|
||||
if (!ui->lineEdit_mac->text().remove(QChar(':')).remove(QChar(' ')).isEmpty())
|
||||
macvlanSettings[QString("MACAddress")] = ui->lineEdit_mac->text();
|
||||
|
||||
return macvlanSettings;
|
||||
}
|
||||
|
||||
|
||||
int MacvlanWidget::isOk()
|
||||
{
|
||||
// all fine
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void MacvlanWidget::setSettings(const QMap<QString, QString> settings)
|
||||
{
|
||||
clear();
|
||||
QMap<QString, QString> macvlanSettings = settings;
|
||||
|
||||
if (macvlanSettings.contains(QString("Mode")))
|
||||
for (int i=0; i<ui->comboBox_mode->count(); i++)
|
||||
if (macvlanSettings[QString("Mode")] == ui->comboBox_mode->itemText(i))
|
||||
ui->comboBox_mode->setCurrentIndex(i);
|
||||
if (macvlanSettings.contains(QString("MACAddress")))
|
||||
ui->lineEdit_mac->setText(macvlanSettings[QString("MACAddress")]);
|
||||
}
|
49
sources/gui/src/macvlanwidget.h
Normal file
@ -0,0 +1,49 @@
|
||||
/***************************************************************************
|
||||
* 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/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MACVLANWIDGET_H
|
||||
#define MACVLANWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class MacvlanWidget;
|
||||
}
|
||||
|
||||
class MacvlanWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MacvlanWidget(QWidget *parent = 0);
|
||||
~MacvlanWidget();
|
||||
QMap<QString, QString> getSettings();
|
||||
int isOk();
|
||||
void setSettings(const QMap<QString, QString> settings);
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
void setShown(const bool state);
|
||||
|
||||
private:
|
||||
Ui::MacvlanWidget *ui;
|
||||
void createFilter();
|
||||
};
|
||||
|
||||
|
||||
#endif /* MACVLANWIDGET_H */
|
94
sources/gui/src/macvlanwidget.ui
Normal file
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MacvlanWidget</class>
|
||||
<widget class="QWidget" name="MacvlanWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>396</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_macvlan">
|
||||
<property name="features">
|
||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>macvlan settings</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_macvlan">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="layout_mode">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mode">
|
||||
<property name="text">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_mode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">bridge</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">vepa</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">private</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">passthru</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="layout_mac">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mac">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>MAC address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_mac">
|
||||
<property name="toolTip">
|
||||
<string>Optional static MAC address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,106 +1,194 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QDir>
|
||||
#include <QTextStream>
|
||||
#include <QLibraryInfo>
|
||||
#include <QTranslator>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <language/language.h>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "messages.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
bool existingSessionOperation(const QString operation)
|
||||
{
|
||||
QDBusConnection bus = QDBusConnection::sessionBus();
|
||||
QDBusMessage request = QDBusMessage::createMethodCall(DBUS_SERVICE, DBUS_OBJECT_PATH,
|
||||
DBUS_INTERFACE, operation);
|
||||
QDBusMessage response = bus.call(request);
|
||||
QList<QVariant> arguments = response.arguments();
|
||||
|
||||
return (!arguments.isEmpty() && bool(arguments[0].toInt()));
|
||||
}
|
||||
|
||||
|
||||
unsigned int getUidFromSession(const int type = 0)
|
||||
{
|
||||
QDBusConnection bus = QDBusConnection::sessionBus();
|
||||
QDBusMessage request = QDBusMessage::createMethodCall(DBUS_SERVICE, DBUS_OBJECT_PATH,
|
||||
DBUS_INTERFACE, QString("UIDs"));
|
||||
QDBusMessage response = bus.call(request);
|
||||
QList<QVariant> arguments = response.arguments();
|
||||
|
||||
return arguments[0].toStringList()[type].toUInt();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
QMap<QString, QVariant> args = getArgs();
|
||||
// reading
|
||||
for (int i=1; i<argc; i++) {
|
||||
if (QString(argv[i]) == QString("--detached")) {
|
||||
// detached
|
||||
args[QString("detached")] = true;
|
||||
} else if (QString(argv[i]) == QString("--maximized")) {
|
||||
// maximized
|
||||
args[QString("minimized")] = (int) 1;
|
||||
} else if (QString(argv[i]) == QString("--minimized")) {
|
||||
// minimized
|
||||
args[QString("minimized")] = (int) 2;
|
||||
} else if (QString(argv[i]) == QString("--about")) {
|
||||
// about
|
||||
args[QString("about")] = true;
|
||||
} else if (QString(argv[i]) == QString("--netctl-auto")) {
|
||||
// netctl-auto
|
||||
args[QString("auto")] = true;
|
||||
} else if (QString(argv[i]) == QString("--settings")) {
|
||||
// settings
|
||||
args[QString("settings")] = true;
|
||||
} else if ((QString(argv[i]) == QString("-e")) || (QString(argv[i]) == QString("--essid"))) {
|
||||
// select ESSID
|
||||
args[QString("essid")] = QString(argv[i+1]);
|
||||
i++;
|
||||
} else if ((QString(argv[i]) == QString("-o")) || (QString(argv[i]) == QString("--open"))) {
|
||||
// open profile
|
||||
args[QString("open")] = QString(argv[i+1]);
|
||||
i++;
|
||||
} else if ((QString(argv[i]) == QString("-s")) || (QString(argv[i]) == QString("--select"))) {
|
||||
// select profile
|
||||
args[QString("select")] = QString(argv[i+1]);
|
||||
i++;
|
||||
} else if ((QString(argv[i]) == QString("-c")) || (QString(argv[i]) == QString("--config"))) {
|
||||
// config path
|
||||
args[QString("config")] = QDir().absoluteFilePath(argv[i+1]);
|
||||
i++;
|
||||
} else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug"))) {
|
||||
// debug
|
||||
args[QString("debug")] = true;
|
||||
} else if (QString(argv[i]) == QString("--default")) {
|
||||
// default settings
|
||||
args[QString("default")] = true;
|
||||
} else if (QString(argv[i]) == QString("--set-opts")) {
|
||||
// options
|
||||
args[QString("options")] = QString(argv[i+1]);
|
||||
i++;
|
||||
} else if ((QString(argv[i]) == QString("-t")) || (QString(argv[i]) == QString("--tab"))) {
|
||||
// tab number
|
||||
if (atoi(argv[i+1]) > 3)
|
||||
args[QString("tab")] = (int) 3;
|
||||
else if (atoi(argv[i+1]) < 1)
|
||||
args[QString("tab")] = (int) 1;
|
||||
else
|
||||
args[QString("tab")] = atoi(argv[i+1]);
|
||||
i++;
|
||||
} else if ((QString(argv[i]) == QString("-h")) || (QString(argv[i]) == QString("--help"))) {
|
||||
// help message
|
||||
args[QString("help")] = true;
|
||||
} else if ((QString(argv[i]) == QString("-i")) || (QString(argv[i]) == QString("--info"))) {
|
||||
// info message
|
||||
args[QString("info")] = true;
|
||||
} else if ((QString(argv[i]) == QString("-v")) || (QString(argv[i]) == QString("--version"))) {
|
||||
// version message
|
||||
args[QString("version")] = true;
|
||||
} else {
|
||||
args[QString("error")] = true;
|
||||
}
|
||||
}
|
||||
if ((args[QString("debug")].toBool()) ||
|
||||
(args[QString("help")].toBool()) ||
|
||||
(args[QString("info")].toBool()) ||
|
||||
(args[QString("version")].toBool()) ||
|
||||
(args[QString("error")].toBool()))
|
||||
args[QString("detached")] = false;
|
||||
if (args[QString("essid")].toString() != QString("ESSID"))
|
||||
args[QString("tab")] = (int) 3;
|
||||
if (args[QString("open")].toString() != QString("PROFILE"))
|
||||
args[QString("tab")] = (int) 2;
|
||||
if (args[QString("select")].toString() != QString("PROFILE"))
|
||||
args[QString("tab")] = (int) 1;
|
||||
|
||||
// translation
|
||||
QString configPath = QDir::homePath() + QDir::separator() + QString(".config") +
|
||||
QDir::separator() + QString("netctl-gui.conf");
|
||||
QFile configFile(configPath);
|
||||
QString fileStr;
|
||||
QString language = QString("english");
|
||||
if (configFile.open(QIODevice::ReadOnly))
|
||||
while (true) {
|
||||
fileStr = QString(configFile.readLine());
|
||||
if (fileStr[0] != '#') {
|
||||
if (fileStr.contains(QString("LANGUAGE=")))
|
||||
language = fileStr.split(QString("="))[1]
|
||||
.remove(QString(" "))
|
||||
.trimmed();
|
||||
}
|
||||
if (configFile.atEnd())
|
||||
break;
|
||||
}
|
||||
configFile.close();
|
||||
// detach from console
|
||||
if (args[QString("detached")].toBool())
|
||||
daemon(0, 0);
|
||||
QApplication a(argc, argv);
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
// reread translations according to flags
|
||||
QString language = Language::defineLanguage(args[QString("config")].toString(),
|
||||
args[QString("options")].toString());
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load(QString("qt_") + language, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
a.installTranslator(&qtTranslator);
|
||||
QTranslator translator;
|
||||
translator.load(QString(":/translations/") + language);
|
||||
a.installTranslator(&translator);
|
||||
|
||||
QString helpMessage = QString("");
|
||||
helpMessage += QApplication::translate("MainWindow", " Netctl GUI\n");
|
||||
helpMessage += QApplication::translate("MainWindow", "Version : %1 License : GPLv3\n")
|
||||
.arg(QString(VERSION));
|
||||
helpMessage += QApplication::translate("MainWindow", " Evgeniy Alekseev aka arcanis\n");
|
||||
helpMessage += QApplication::translate("MainWindow", " E-mail : esalexeev@gmail.com\n\n");
|
||||
helpMessage += QApplication::translate("MainWindow", "Usage:\n");
|
||||
helpMessage += QApplication::translate("MainWindow", "netctl-gui [ --default ] [ -t NUM | --tab NUM ] [ -h | --help]\n\n");
|
||||
helpMessage += QApplication::translate("MainWindow", "Parametrs:\n");
|
||||
helpMessage += QApplication::translate("MainWindow", " --default - start with default settings\n");
|
||||
helpMessage += QApplication::translate("MainWindow", " -t NUM --tab NUM - open a tab with number NUM\n");
|
||||
helpMessage += QApplication::translate("MainWindow", " -h --help - show this help and exit\n");
|
||||
bool defaultSettings = false;
|
||||
int tabNumber = 0;
|
||||
|
||||
for (int i=1; i<argc; i++) {
|
||||
// help message
|
||||
if (((argv[i][0] == '-') && (argv[i][1] == 'h') && (argv[i][2] == '\0')) ||
|
||||
((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 'h') && (argv[i][3] == 'e') &&
|
||||
(argv[i][4] == 'l') && (argv[i][5] == 'p') && (argv[i][6] == '\0'))) {
|
||||
cout << helpMessage.toUtf8().data();
|
||||
// running
|
||||
if (args[QString("error")].toBool()) {
|
||||
cout << errorMessage().toUtf8().data() << endl;
|
||||
cout << helpMessage().toUtf8().data();
|
||||
return 127;
|
||||
} else if (args[QString("help")].toBool()) {
|
||||
cout << helpMessage().toUtf8().data();
|
||||
return 0;
|
||||
} else if (args[QString("info")].toBool()) {
|
||||
cout << versionMessage().toUtf8().data() << endl;
|
||||
cout << infoMessage().toUtf8().data();
|
||||
return 0;
|
||||
} else if (args[QString("version")].toBool()) {
|
||||
cout << versionMessage().toUtf8().data();
|
||||
return 0;
|
||||
}
|
||||
// default settings
|
||||
else if ((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 'd') && (argv[i][3] == 'e') &&
|
||||
(argv[i][4] == 'f') && (argv[i][5] == 'a') && (argv[i][6] == 'u') && (argv[i][7] == 'l') &&
|
||||
(argv[i][8] == 't') && (argv[i][9] == '\0')) {
|
||||
defaultSettings = true;
|
||||
}
|
||||
// tab number
|
||||
else if (((argv[i][0] == '-') && (argv[i][1] == 't') && (argv[i][2] == '\0')) ||
|
||||
((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 't') &&
|
||||
(argv[i][3] == 'a') && (argv[i][4] == 'b') && (argv[i][5] == '\0'))) {
|
||||
if (atoi(argv[i+1]) > 3)
|
||||
tabNumber = 3;
|
||||
else if (atoi(argv[i+1]) < 1)
|
||||
tabNumber = 1;
|
||||
else
|
||||
tabNumber = atoi(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow w(0, defaultSettings, tabNumber);
|
||||
w.show();
|
||||
// check if exists
|
||||
if (existingSessionOperation(QString("Active"))) {
|
||||
if ((getuid() == getUidFromSession(0)) && (geteuid() == getUidFromSession(1))) {
|
||||
// restore session
|
||||
cout << QCoreApplication::translate("MainWindow", "Restore existing session.")
|
||||
.toUtf8().data() << endl;
|
||||
existingSessionOperation(QString("Restore"));
|
||||
return 0;
|
||||
} else if ((getuid() == getUidFromSession(0)) && (geteuid() != getUidFromSession(1))) {
|
||||
cout << QCoreApplication::translate("MainWindow", "Close existing session.")
|
||||
.toUtf8().data() << endl;
|
||||
existingSessionOperation(QString("Close"));
|
||||
}
|
||||
}
|
||||
MainWindow w(0, args, &qtTranslator, &translator);
|
||||
return a.exec();
|
||||
}
|
||||
|
1127
sources/gui/src/mainprivateslots.cpp
Normal file
523
sources/gui/src/mainpublicslots.cpp
Normal file
@ -0,0 +1,523 @@
|
||||
/***************************************************************************
|
||||
* 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 "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
#include <QLibraryInfo>
|
||||
#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 "netctlautowindow.h"
|
||||
#include "passwdwidget.h"
|
||||
#include "settingswindow.h"
|
||||
#include "trayicon.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
void MainWindow::closeMainWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::showAboutWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
aboutWin->show();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::showMainWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (isHidden()) {
|
||||
updateTabs(ui->tabWidget->currentIndex());
|
||||
show();
|
||||
} else
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::showNetctlAutoWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
netctlAutoWin->showWindow();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::showSettingsWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
settingsWin->showWindow();
|
||||
}
|
||||
|
||||
|
||||
bool MainWindow::enableProfileSlot(const QString profile)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||
|
||||
bool current;
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("Enable"),
|
||||
args, true, debug);
|
||||
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileEnabled"),
|
||||
args, true, debug)[0].toBool();
|
||||
} else {
|
||||
netctlCommand->enableProfile(profile);
|
||||
current = netctlCommand->isProfileEnabled(profile);
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
bool MainWindow::restartProfileSlot(const QString profile)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||
|
||||
bool current;
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("Restart"),
|
||||
args, true, debug)[0].toBool();
|
||||
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||
args, true, debug)[0].toBool();
|
||||
} else {
|
||||
netctlCommand->restartProfile(profile);
|
||||
current = netctlCommand->isProfileActive(profile);
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
bool MainWindow::startProfileSlot(const QString profile)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||
|
||||
bool current;
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
QStringList currentProfile = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("ActiveProfile"),
|
||||
QList<QVariant>(), true, debug)[0]
|
||||
.toString().split(QChar('|'));
|
||||
if ((currentProfile.isEmpty()) || (currentProfile.contains(profile)))
|
||||
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("Start"),
|
||||
args, true, debug);
|
||||
else
|
||||
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("SwitchTo"),
|
||||
args, true, debug);
|
||||
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||
args, true, debug)[0].toBool();
|
||||
} else {
|
||||
QStringList currentProfile = netctlCommand->getActiveProfile();
|
||||
if ((currentProfile.isEmpty()) || (currentProfile.contains(profile)))
|
||||
netctlCommand->startProfile(profile);
|
||||
else
|
||||
netctlCommand->switchToProfile(profile);
|
||||
current = netctlCommand->isProfileActive(profile);
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
bool MainWindow::stopAllProfilesSlot()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (useHelper)
|
||||
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("StopAll"),
|
||||
QList<QVariant>(), true, debug);
|
||||
else
|
||||
netctlCommand->stopAllProfiles();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool MainWindow::switchToProfileSlot(const QString profile)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||
|
||||
bool netctlAutoStatus = false;
|
||||
if (useHelper)
|
||||
netctlAutoStatus = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isNetctlAutoActive"),
|
||||
QList<QVariant>(), true, debug)[0].toBool();
|
||||
else
|
||||
netctlAutoStatus = netctlCommand->isNetctlAutoRunning();
|
||||
|
||||
bool current;
|
||||
if (netctlAutoStatus) {
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("autoStart"),
|
||||
args, true, debug);
|
||||
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("autoIsProfileActive"),
|
||||
args, true, debug)[0].toBool();
|
||||
} else {
|
||||
netctlCommand->autoStartProfile(profile);
|
||||
current = netctlCommand->autoIsProfileActive(profile);
|
||||
}
|
||||
} else {
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("SwitchTo"),
|
||||
args, true, debug);
|
||||
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||
args, true, debug)[0].toBool();
|
||||
} else {
|
||||
netctlCommand->switchToProfile(profile);
|
||||
current = netctlCommand->isProfileActive(profile);
|
||||
}
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::showApi()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (QDesktopServices::openUrl(QUrl(QString(DOCS_PATH) + QString("netctl-gui-dbus-api.html"))))
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||
else
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::showLibrary()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (QDesktopServices::openUrl(QUrl(QString(DOCS_PATH) + QString("html/index.html"))))
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||
else
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::showSecurityNotes()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (QDesktopServices::openUrl(QUrl(QString(DOCS_PATH) + QString("netctl-gui-security-notes.html"))))
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||
else
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||
}
|
||||
|
||||
|
||||
bool MainWindow::forceStartHelper()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (!checkExternalApps(QString("helper"))) {
|
||||
errorWin->showWindow(1, QString(PDEBUG));
|
||||
return false;
|
||||
}
|
||||
|
||||
QString cmd = configuration[QString("HELPER_PATH")] + QString(" -c ") + configPath;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd;
|
||||
TaskResult process = runTask(cmd, false);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
if (process.exitCode != 0)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
|
||||
if (process.exitCode == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool MainWindow::forceStopHelper()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QList<QVariant> responce = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("Close"),
|
||||
QList<QVariant>(), true, debug);
|
||||
|
||||
return !responce.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
bool MainWindow::startHelper()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (isHelperActive())
|
||||
return forceStopHelper();
|
||||
else
|
||||
return forceStartHelper();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::setTab(int tab)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Update tab" << tab;
|
||||
|
||||
switch (tab) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
break;
|
||||
default:
|
||||
tab = 0;
|
||||
break;
|
||||
}
|
||||
ui->tabWidget->setCurrentIndex(tab);
|
||||
|
||||
updateTabs(tab);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::updateConfiguration(const QMap<QString, QVariant> args)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
deleteObjects();
|
||||
|
||||
settingsWin = new SettingsWindow(this, debug, configPath);
|
||||
if (args[QString("default")].toBool())
|
||||
settingsWin->setDefault();
|
||||
configuration = settingsWin->getSettings();
|
||||
delete settingsWin;
|
||||
QMap<QString, QString> optionsDict = parseOptions(args[QString("options")].toString());
|
||||
for (int i=0; i<optionsDict.keys().count(); i++)
|
||||
configuration[optionsDict.keys()[i]] = optionsDict[optionsDict.keys()[i]];
|
||||
if ((configuration[QString("USE_HELPER")] == QString("true")) &&
|
||||
(checkExternalApps(QString("helper"))))
|
||||
useHelper = true;
|
||||
else {
|
||||
useHelper = false;
|
||||
configuration[QString("USE_HELPER")] = QString("false");
|
||||
}
|
||||
|
||||
// update translation
|
||||
qApp->removeTranslator(translator);
|
||||
QString language = Language::defineLanguage(configPath,
|
||||
args[QString("options")].toString());
|
||||
qtTranslator->load(QString("qt_") + language, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
qApp->installTranslator(qtTranslator);
|
||||
translator->load(QString(":/translations/") + language);
|
||||
qApp->installTranslator(translator);
|
||||
|
||||
createObjects();
|
||||
createActions();
|
||||
createToolBars();
|
||||
|
||||
// tray
|
||||
if ((QSystemTrayIcon::isSystemTrayAvailable()) &&
|
||||
(configuration[QString("SYSTRAY")] == QString("true")))
|
||||
trayIcon->setVisible(true);
|
||||
else
|
||||
trayIcon->setVisible(false);
|
||||
if (trayIcon->isVisible()) {
|
||||
if (configuration[QString("STARTTOTRAY")] == QString("true"))
|
||||
hide();
|
||||
else
|
||||
show();
|
||||
if (args[QString("minimized")].toInt() == 1)
|
||||
show();
|
||||
else if (args[QString("minimized")].toInt() == 2)
|
||||
hide();
|
||||
}
|
||||
else
|
||||
show();
|
||||
|
||||
// update ui
|
||||
setTab(args[QString("tab")].toInt() - 1);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::updateMenu()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
int tab = ui->tabWidget->currentIndex();
|
||||
setMenuActionsShown(false);
|
||||
|
||||
if (tab == 0)
|
||||
updateMenuMain();
|
||||
else if (tab == 1)
|
||||
updateMenuProfile();
|
||||
else if (tab == 2)
|
||||
updateMenuWifi();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::updateTabs(const int tab)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Update tab" << tab;
|
||||
|
||||
if (tab == 0)
|
||||
updateMainTab();
|
||||
else if (tab == 1)
|
||||
updateProfileTab();
|
||||
else if (tab == 2)
|
||||
updateWifiTab();
|
||||
updateMenu();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::connectToUnknownEssid(const QString passwd)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (passwdWid != 0)
|
||||
delete passwdWid;
|
||||
QStringList interfaces;
|
||||
if (useHelper)
|
||||
interfaces = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("WirelessInterfaces"),
|
||||
QList<QVariant>(), true, debug)[0].toStringList();
|
||||
else
|
||||
interfaces = netctlCommand->getWirelessInterfaceList();
|
||||
if (interfaces.isEmpty()) return;
|
||||
|
||||
QMap<QString, QString> settings;
|
||||
settings[QString("Description")] = QString("'Automatically generated profile by Netctl GUI'");
|
||||
settings[QString("Interface")] = interfaces[0];
|
||||
settings[QString("Connection")] = QString("wireless");
|
||||
QString security = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 2)->text();
|
||||
if (security.contains(QString("WPA")))
|
||||
settings[QString("Security")] = QString("wpa");
|
||||
else if (security.contains(QString("WEP")))
|
||||
settings[QString("Security")] = QString("wep");
|
||||
else
|
||||
settings[QString("Security")] = QString("none");
|
||||
settings[QString("ESSID")] = QString("'") +
|
||||
ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text() +
|
||||
QString("'");
|
||||
if (!passwd.isEmpty())
|
||||
settings[QString("Key")] = QString("'") + passwd + QString("'");
|
||||
settings[QString("IP")] = QString("dhcp");
|
||||
if (hiddenNetwork)
|
||||
settings[QString("Hidden")] = QString("yes");
|
||||
|
||||
QString profile = QString("netctl-gui-") + settings[QString("ESSID")];
|
||||
profile.remove(QChar('"')).remove(QChar('\''));
|
||||
bool status = false;
|
||||
if (useHelper) {
|
||||
QStringList settingsList;
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
settingsList.append(settings.keys()[i] + QString("==") + settings[settings.keys()[i]]);
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
args.append(settingsList);
|
||||
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("Create"),
|
||||
args, true, debug);
|
||||
args.clear();
|
||||
args.append(profile);
|
||||
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("Start"),
|
||||
args, true, debug);
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||
args, true, debug)[0].toBool();
|
||||
} else {
|
||||
QString profileTempName = netctlProfile->createProfile(profile, settings);
|
||||
netctlProfile->copyProfile(profileTempName);
|
||||
netctlCommand->startProfile(profile);
|
||||
status = netctlCommand->isProfileActive(profile);
|
||||
}
|
||||
QString message;
|
||||
if (status) {
|
||||
message = QApplication::translate("MainWindow", "Connection is successfully.");
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||
} else {
|
||||
message = QApplication::translate("MainWindow", "Connection failed.");
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||
}
|
||||
message += QString("\n");
|
||||
message += QApplication::translate("MainWindow", "Do you want to save profile %1?").arg(profile);
|
||||
int select = QMessageBox::question(this, QApplication::translate("MainWindow", "WiFi menu"),
|
||||
message, QMessageBox::Save | QMessageBox::Discard, QMessageBox::Save);
|
||||
switch (select) {
|
||||
case QMessageBox::Save:
|
||||
break;
|
||||
case QMessageBox::Discard:
|
||||
default:
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("Remove"),
|
||||
args, true, debug)[0].toBool();
|
||||
} else
|
||||
netctlProfile->removeProfile(profile);
|
||||
break;
|
||||
}
|
||||
|
||||
updateWifiTab();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::setHiddenName(const QString name)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Set name" << name;
|
||||
|
||||
ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->setText(name);
|
||||
|
||||
wifiTabStart();
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MAINWINDOW_H
|
||||
@ -20,25 +20,31 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <QShortcut>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
|
||||
class AboutWindow;
|
||||
class BridgeWidget;
|
||||
class ErrorWindow;
|
||||
class EthernetWidget;
|
||||
class GeneralWidget;
|
||||
class IpWidget;
|
||||
class MacvlanWidget;
|
||||
class MobileWidget;
|
||||
class Netctl;
|
||||
class NetctlProfile;
|
||||
class NetctlAutoWindow;
|
||||
class PasswdWidget;
|
||||
class PppoeWidget;
|
||||
class SettingsWindow;
|
||||
class TrayIcon;
|
||||
class TunnelWidget;
|
||||
class TuntapWidget;
|
||||
class VlanWidget;
|
||||
class WirelessWidget;
|
||||
class WpaSup;
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
@ -50,60 +56,130 @@ class MainWindow : public QMainWindow
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0,
|
||||
const bool defaultSettings = false,
|
||||
const int tabNum = 1);
|
||||
const QMap<QString, QVariant> args = QMap<QString, QVariant>(),
|
||||
QTranslator *qtAppTranslator = 0,
|
||||
QTranslator *appTranslator = 0);
|
||||
~MainWindow();
|
||||
Netctl *netctlCommand;
|
||||
NetctlProfile *netctlProfile;
|
||||
WpaSup *wpaCommand;
|
||||
QStringList printInformation();
|
||||
QStringList printSettings();
|
||||
QStringList printTrayInformation();
|
||||
bool isHelperActive();
|
||||
bool isHelperServiceActive();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
public slots:
|
||||
// actions from trayicon
|
||||
void closeMainWindow();
|
||||
void showAboutWindow();
|
||||
void showMainWindow();
|
||||
void showNetctlAutoWindow();
|
||||
void showSettingsWindow();
|
||||
// trayicon control slots
|
||||
bool enableProfileSlot(const QString profile);
|
||||
bool startProfileSlot(const QString profile);
|
||||
bool stopAllProfilesSlot();
|
||||
bool switchToProfileSlot(const QString profile);
|
||||
bool restartProfileSlot(const QString profile);
|
||||
// open docs
|
||||
void showApi();
|
||||
void showLibrary();
|
||||
void showSecurityNotes();
|
||||
// helper
|
||||
bool forceStartHelper();
|
||||
bool forceStopHelper();
|
||||
bool startHelper();
|
||||
// main
|
||||
void setTab(int tab);
|
||||
void updateConfiguration(const QMap<QString, QVariant> args = QMap<QString, QVariant>());
|
||||
void updateMenu();
|
||||
void updateTabs(const int tab);
|
||||
// wifi tab slots
|
||||
void connectToUnknownEssid(const QString passwd);
|
||||
void setHiddenName(const QString name);
|
||||
|
||||
private slots:
|
||||
void reportABug();
|
||||
// menu update slots
|
||||
void setMenuActionsShown(const bool state = true);
|
||||
void updateMenuMain();
|
||||
void updateMenuProfile();
|
||||
void updateMenuWifi();
|
||||
void updateToolBars();
|
||||
// tab update slots
|
||||
void updateMainTab();
|
||||
void updateProfileTab();
|
||||
void updateWifiTab();
|
||||
// main tab slots
|
||||
void mainTabContextualMenu(const QPoint &pos);
|
||||
void mainTabEditProfile();
|
||||
void mainTabEnableProfile();
|
||||
QStringList mainTabGetActiveProfiles();
|
||||
void mainTabRemoveProfile();
|
||||
void mainTabRestartProfile();
|
||||
void mainTabStartProfile();
|
||||
void mainTabRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous);
|
||||
void mainTabStopAllProfiles();
|
||||
void mainTabSwitchToProfile();
|
||||
// profile tab slots
|
||||
void profileTabBrowseProfile();
|
||||
void profileTabChangeState(const QString current);
|
||||
void profileTabClear();
|
||||
void profileTabCreateProfile();
|
||||
void profileTabLoadProfile();
|
||||
void profileTabRemoveProfile();
|
||||
// wifi tab slots
|
||||
void wifiTabContextualMenu(const QPoint &pos);
|
||||
void wifiTabSetEnabled(const bool state);
|
||||
void wifiTabStart();
|
||||
void wifiTabRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous);
|
||||
|
||||
private:
|
||||
// ui
|
||||
Ui::MainWindow *ui;
|
||||
BridgeWidget *bridgeWid;
|
||||
EthernetWidget *ethernetWid;
|
||||
GeneralWidget *generalWid;
|
||||
IpWidget *ipWid;
|
||||
MobileWidget *mobileWid;
|
||||
PppoeWidget *pppoeWid;
|
||||
TunnelWidget *tunnelWid;
|
||||
TuntapWidget *tuntapWid;
|
||||
VlanWidget *vlanWid;
|
||||
WirelessWidget *wirelessWid;
|
||||
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;
|
||||
NetctlAutoWindow *netctlAutoWin = nullptr;
|
||||
PasswdWidget *passwdWid = nullptr;
|
||||
SettingsWindow *settingsWin = nullptr;
|
||||
BridgeWidget *bridgeWid = nullptr;
|
||||
EthernetWidget *ethernetWid = nullptr;
|
||||
GeneralWidget *generalWid = nullptr;
|
||||
IpWidget *ipWid = nullptr;
|
||||
MacvlanWidget *macvlanWid = nullptr;
|
||||
MobileWidget *mobileWid = nullptr;
|
||||
PppoeWidget *pppoeWid = nullptr;
|
||||
TunnelWidget *tunnelWid = nullptr;
|
||||
TuntapWidget *tuntapWid = nullptr;
|
||||
VlanWidget *vlanWid = nullptr;
|
||||
WirelessWidget *wirelessWid = nullptr;
|
||||
// backend
|
||||
ErrorWindow *errorWin;
|
||||
PasswdWidget *passwdWid;
|
||||
SettingsWindow *settingsWin;
|
||||
Netctl *netctlCommand = nullptr;
|
||||
NetctlProfile *netctlProfile = nullptr;
|
||||
WpaSup *wpaCommand = nullptr;
|
||||
bool checkExternalApps(const QString apps);
|
||||
bool checkState(const QString state, const QString item);
|
||||
bool checkHelperStatus();
|
||||
QString checkStatus(const bool statusBool, const bool nullFalse = false);
|
||||
void createActions();
|
||||
void createDBusSession();
|
||||
void createObjects();
|
||||
void createToolBars();
|
||||
void deleteObjects();
|
||||
void keyPressEvent(QKeyEvent *pressedKey);
|
||||
QString configPath;
|
||||
bool debug = false;
|
||||
bool hiddenNetwork;
|
||||
bool useHelper = true;
|
||||
QTranslator *qtTranslator = nullptr;
|
||||
QTranslator *translator = nullptr;
|
||||
// configuration
|
||||
QMap<QString, QString> configuration;
|
||||
QMap<QString, QString> parseOptions(const QString options);
|
||||
};
|
||||
|
||||
|
||||
|
@ -6,27 +6,94 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>491</width>
|
||||
<height>519</height>
|
||||
<width>469</width>
|
||||
<height>497</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<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">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_main">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../../resources/resources.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Connect to profile</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_netctlAuto" native="true">
|
||||
<layout class="QHBoxLayout" name="layout_netctlAuto">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_netctlAuto">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>netctl-auto is running</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_netctlAuto">
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_main">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@ -39,6 +106,9 @@
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
@ -61,85 +131,10 @@
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Status</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column/>
|
||||
<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="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_mainEnable">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_mainRestart">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Restart</string>
|
||||
</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="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_new">
|
||||
@ -149,6 +144,11 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<attribute name="icon">
|
||||
<iconset theme="document-new">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Create a new profile</string>
|
||||
</attribute>
|
||||
@ -169,12 +169,12 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_profile"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_profile">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
<widget class="QComboBox" name="comboBox_profile">
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -190,8 +190,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
<width>437</width>
|
||||
<height>368</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -204,49 +204,15 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_newProfileButtons">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_profileClear">
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_profileLoad">
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
</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>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_wifi">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../../resources/resources.qrc">
|
||||
<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>
|
||||
@ -261,6 +227,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_wifi">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@ -273,6 +242,9 @@
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
@ -283,126 +255,46 @@
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Status</string>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Signal</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Security</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column/>
|
||||
<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="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="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>491</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuMenu">
|
||||
<property name="title">
|
||||
<string>Menu</string>
|
||||
</property>
|
||||
<addaction name="actionSettings"/>
|
||||
<addaction name="actionQuit"/>
|
||||
</widget>
|
||||
<addaction name="menuMenu"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionSettings">
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionQuit">
|
||||
<property name="text">
|
||||
<string>Quit</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Q</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>tableWidget_main</tabstop>
|
||||
<tabstop>pushButton_mainRefresh</tabstop>
|
||||
<tabstop>pushButton_mainEnable</tabstop>
|
||||
<tabstop>pushButton_mainRestart</tabstop>
|
||||
<tabstop>pushButton_mainStart</tabstop>
|
||||
<tabstop>lineEdit_profile</tabstop>
|
||||
<tabstop>pushButton_profile</tabstop>
|
||||
<tabstop>scrollArea</tabstop>
|
||||
<tabstop>pushButton_profileClear</tabstop>
|
||||
<tabstop>pushButton_profileLoad</tabstop>
|
||||
<tabstop>pushButton_profileSave</tabstop>
|
||||
<tabstop>tableWidget_wifi</tabstop>
|
||||
<tabstop>pushButton_wifiRefresh</tabstop>
|
||||
<tabstop>pushButton_wifiStart</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../../resources/resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
176
sources/gui/src/messages.cpp
Normal file
@ -0,0 +1,176 @@
|
||||
/***************************************************************************
|
||||
* 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 <QApplication>
|
||||
#include <QDir>
|
||||
|
||||
#include "messages.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
QString errorMessage()
|
||||
{
|
||||
return QApplication::translate("MainWindow", "Unknown flag\n");
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QVariant> getArgs()
|
||||
{
|
||||
QMap<QString, QVariant> args;
|
||||
// windows
|
||||
args[QString("detached")] = false;
|
||||
args[QString("minimized")] = (int) 0;
|
||||
args[QString("about")] = false;
|
||||
args[QString("auto")] = false;
|
||||
args[QString("settings")] = false;
|
||||
// main functions
|
||||
args[QString("essid")] = QString("ESSID");
|
||||
args[QString("open")] = QString("PROFILE");
|
||||
args[QString("select")] = QString("PROFILE");
|
||||
// additional functions
|
||||
args[QString("config")] = QString(QDir::homePath() + QString("/.config/netctl-gui.conf"));
|
||||
args[QString("debug")] = false;
|
||||
args[QString("defaults")] = false;
|
||||
args[QString("options")] = QString("OPTIONS");
|
||||
args[QString("tab")] = (int) 1;
|
||||
// messages
|
||||
args[QString("error")] = false;
|
||||
args[QString("help")] = false;
|
||||
args[QString("info")] = false;
|
||||
args[QString("version")] = false;
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
|
||||
QString helpMessage()
|
||||
{
|
||||
QString helpMessage = QString("");
|
||||
helpMessage += QString("%1\n").arg(QApplication::translate("MainWindow", "Usage:"));
|
||||
helpMessage += QString("netctl-gui [ options ]\n");
|
||||
helpMessage += QString("%1\n").arg(QApplication::translate("MainWindow", "Options:"));
|
||||
// windows
|
||||
helpMessage += QString(" %1\n").arg(QApplication::translate("MainWindow", "Open window:"));
|
||||
helpMessage += QString(" --detached - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "start detached from console"));
|
||||
helpMessage += QString(" --maximized - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "start maximized"));
|
||||
helpMessage += QString(" --minimized - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "start minimized to tray"));
|
||||
helpMessage += QString(" --about - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "show about window"));
|
||||
helpMessage += QString(" --netctl-auto - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "show netctl-auto window"));
|
||||
helpMessage += QString(" --settings - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "show settings window"));
|
||||
// main functions
|
||||
helpMessage += QString(" %1\n").arg(QApplication::translate("MainWindow", "Functions:"));
|
||||
helpMessage += QString(" -e, --essid <arg> - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "select this ESSID"));
|
||||
helpMessage += QString(" -o, --open <arg> - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "open this profile"));
|
||||
helpMessage += QString(" -s, --select <arg> - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "select this profile"));
|
||||
// additional functions
|
||||
helpMessage += QString(" %1\n").arg(QApplication::translate("MainWindow", "Additional flags:"));
|
||||
helpMessage += QString(" -c, --config <arg> - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "read configuration from this file"));
|
||||
helpMessage += QString(" -d, --debug - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "print debug information"));
|
||||
helpMessage += QString(" --default - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "start with default settings"));
|
||||
helpMessage += QString(" --set-opts <arg> - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "set options for this run, comma separated"));
|
||||
helpMessage += QString(" -t, --tab <arg> - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "open a tab with this number"));
|
||||
// messages
|
||||
helpMessage += QString(" %1\n").arg(QApplication::translate("MainWindow", "Show messages:"));
|
||||
helpMessage += QString(" -v, --version - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "show version and exit"));
|
||||
helpMessage += QString(" -i, --info - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "show build information and exit"));
|
||||
helpMessage += QString(" -h, --help - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "show this help and exit"));
|
||||
|
||||
return helpMessage;
|
||||
}
|
||||
|
||||
|
||||
QString infoMessage()
|
||||
{
|
||||
QString infoMessage = QString("");
|
||||
// build information
|
||||
infoMessage += QApplication::translate("MainWindow", "Build date: %1").
|
||||
arg(QString(BUILD_DATE));
|
||||
// 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(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));
|
||||
infoMessage += QString("\tDBUS_HELPER_SERVICE=%1\n").arg(QString(DBUS_HELPER_SERVICE));
|
||||
infoMessage += QString("\tDBUS_HELPER_INTERFACE=%1\n").arg(QString(DBUS_HELPER_INTERFACE));
|
||||
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(QApplication::translate("MainWindow", "Documentation"));
|
||||
infoMessage += QString("\tDOCS_PATH=%1\n").arg(QString(DOCS_PATH));
|
||||
|
||||
return infoMessage;
|
||||
}
|
||||
|
||||
|
||||
QString versionMessage()
|
||||
{
|
||||
QString versionMessage = QString("");
|
||||
versionMessage += QString("%1\n").arg(QString(NAME));
|
||||
versionMessage += QString("%1 : %2\n")
|
||||
.arg(QApplication::translate("MainWindow", "Version"))
|
||||
.arg(QString(VERSION));
|
||||
versionMessage += QString("%1 : %2\n")
|
||||
.arg(QApplication::translate("MainWindow", "Author"))
|
||||
.arg(QString(AUTHOR));
|
||||
versionMessage += QString("%1 : %2\n")
|
||||
.arg(QApplication::translate("MainWindow", "License"))
|
||||
.arg(QString(LICENSE));
|
||||
|
||||
return versionMessage;
|
||||
}
|
34
sources/gui/src/messages.h
Normal file
@ -0,0 +1,34 @@
|
||||
/***************************************************************************
|
||||
* 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/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MESSAGES_H
|
||||
#define MESSAGES_H
|
||||
|
||||
#include <QChar>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
QString errorMessage();
|
||||
QMap<QString, QVariant> getArgs();
|
||||
QString helpMessage();
|
||||
QString infoMessage();
|
||||
QString versionMessage();
|
||||
|
||||
|
||||
#endif /* MESSAGES_H */
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mobilewidget.h"
|
||||
@ -87,10 +87,9 @@ void MobileWidget::selectOptionsFile()
|
||||
void MobileWidget::showAdvanced()
|
||||
{
|
||||
if (ui->pushButton_mobileAdvanced->isChecked()) {
|
||||
ui->widget_mobileAdvanced->setShown(true);
|
||||
ui->widget_mobileAdvanced->setHidden(false);
|
||||
ui->pushButton_mobileAdvanced->setText(QApplication::translate("MobileWidget", "Hide advanced"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->widget_mobileAdvanced->setHidden(true);
|
||||
ui->pushButton_mobileAdvanced->setText(QApplication::translate("MobileWidget", "Show advanced"));
|
||||
}
|
||||
@ -143,28 +142,29 @@ int MobileWidget::isOk()
|
||||
|
||||
void MobileWidget::setSettings(const QMap<QString, QString> settings)
|
||||
{
|
||||
clear();
|
||||
QMap<QString, QString> mobileSettings = settings;
|
||||
|
||||
if (mobileSettings.contains(QString("User")))
|
||||
ui->lineEdit_username->setText(mobileSettings[QString("User")].remove(QString("'")));
|
||||
ui->lineEdit_username->setText(mobileSettings[QString("User")]);
|
||||
if (mobileSettings.contains(QString("Password")))
|
||||
ui->lineEdit_password->setText(mobileSettings[QString("Password")].remove(QString("'")));
|
||||
ui->lineEdit_password->setText(mobileSettings[QString("Password")]);
|
||||
if (mobileSettings.contains(QString("AccessPointName")))
|
||||
ui->lineEdit_apn->setText(mobileSettings[QString("AccessPointName")].remove(QString("'")));
|
||||
ui->lineEdit_apn->setText(mobileSettings[QString("AccessPointName")]);
|
||||
if (mobileSettings.contains(QString("PIN")))
|
||||
ui->lineEdit_pin->setText(mobileSettings[QString("PIN")].remove(QString("'")));
|
||||
ui->lineEdit_pin->setText(mobileSettings[QString("PIN")]);
|
||||
if (mobileSettings.contains(QString("Mode")))
|
||||
for (int i=0; i<ui->comboBox_mode->count(); i++)
|
||||
if (mobileSettings[QString("Mode")].remove(QString("'")) == ui->comboBox_mode->itemText(i))
|
||||
if (mobileSettings[QString("Mode")] == ui->comboBox_mode->itemText(i))
|
||||
ui->comboBox_mode->setCurrentIndex(i);
|
||||
if (mobileSettings.contains(QString("MaxFail")))
|
||||
ui->spinBox_fail->setValue(mobileSettings[QString("MaxFail")].toInt());
|
||||
if (mobileSettings.contains(QString("DefaultRoute")))
|
||||
if (mobileSettings[QString("DefaultRoute")].remove(QString("'")) == QString("false"))
|
||||
if (mobileSettings[QString("DefaultRoute")] == QString("false"))
|
||||
ui->checkBox_route->setCheckState(Qt::Unchecked);
|
||||
if (mobileSettings.contains(QString("UsePeerDNS")))
|
||||
if (mobileSettings[QString("UsePeerDNS")].remove(QString("'")) == QString("false"))
|
||||
if (mobileSettings[QString("UsePeerDNS")] == QString("false"))
|
||||
ui->checkBox_dns->setCheckState(Qt::Unchecked);
|
||||
if (mobileSettings.contains(QString("OptionsFile")))
|
||||
ui->lineEdit_options->setText(mobileSettings[QString("OptionsFile")].remove(QString("'")));
|
||||
ui->lineEdit_options->setText(mobileSettings[QString("OptionsFile")]);
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MOBILEWIDGET_H
|
||||
|
467
sources/gui/src/netctlautowindow.cpp
Normal file
@ -0,0 +1,467 @@
|
||||
/***************************************************************************
|
||||
* 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 "netctlautowindow.h"
|
||||
#include "ui_netctlautowindow.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "dbusoperation.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
NetctlAutoWindow::NetctlAutoWindow(QWidget *parent, const bool debugCmd, const QMap<QString, QString> settings)
|
||||
: QMainWindow(parent),
|
||||
ui(new Ui::NetctlAutoWindow),
|
||||
debug(debugCmd)
|
||||
{
|
||||
if (settings[QString("USE_HELPER")] == QString("true"))
|
||||
useHelper = true;
|
||||
else
|
||||
useHelper = false;
|
||||
ui->setupUi(this);
|
||||
ui->tableWidget->setColumnHidden(2, true);
|
||||
ui->tableWidget->setColumnHidden(3, true);
|
||||
netctlCommand = new Netctl(debug, settings);
|
||||
|
||||
createActions();
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Ready"));
|
||||
}
|
||||
|
||||
|
||||
NetctlAutoWindow::~NetctlAutoWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
delete ui;
|
||||
delete netctlCommand;
|
||||
}
|
||||
|
||||
|
||||
QString NetctlAutoWindow::checkStatus(const bool statusBool, const bool nullFalse)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Status" << statusBool;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Return null false" << nullFalse;
|
||||
|
||||
if (statusBool)
|
||||
return QApplication::translate("NetctlAutoWindow", "yes");
|
||||
if (nullFalse)
|
||||
return QString("");
|
||||
else
|
||||
return QApplication::translate("NetctlAutoWindow", "no");
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::createActions()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// menu actions
|
||||
connect(ui->actionClose, SIGNAL(triggered(bool)), this, SLOT(close()));
|
||||
connect(ui->actionDisableAll, SIGNAL(triggered(bool)), this, SLOT(netctlAutoDisableAllProfiles()));
|
||||
connect(ui->actionEnable, SIGNAL(triggered(bool)), this, SLOT(netctlAutoEnableProfile()));
|
||||
connect(ui->actionEnableAll, SIGNAL(triggered(bool)), this, SLOT(netctlAutoEnableAllProfiles()));\
|
||||
connect(ui->actionRefresh, SIGNAL(triggered(bool)), this, SLOT(netctlAutoUpdateTable()));
|
||||
connect(ui->actionSwitch, SIGNAL(triggered(bool)), this, SLOT(netctlAutoStartProfile()));
|
||||
// service
|
||||
connect(ui->actionEnableService, SIGNAL(triggered(bool)), this, SLOT(netctlAutoEnableService()));
|
||||
connect(ui->actionRestartService, SIGNAL(triggered(bool)), this, SLOT(netctlAutoRestartService()));
|
||||
connect(ui->actionStartService, SIGNAL(triggered(bool)), this, SLOT(netctlAutoStartService()));
|
||||
|
||||
// table actions
|
||||
connect(ui->tableWidget, SIGNAL(itemActivated(QTableWidgetItem *)), this, SLOT(netctlAutoStartProfile()));
|
||||
connect(ui->tableWidget, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)), this, SLOT(netctlAutoRefreshButtons(QTableWidgetItem *, QTableWidgetItem *)));
|
||||
connect(ui->tableWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(netctlAutoContextualMenu(QPoint)));
|
||||
|
||||
// buttons
|
||||
connect(ui->pushButton_enable, SIGNAL(clicked(bool)), this, SLOT(netctlAutoEnableProfile()));
|
||||
connect(ui->pushButton_refresh, SIGNAL(clicked(bool)), this, SLOT(netctlAutoUpdateTable()));
|
||||
connect(ui->pushButton_switch, SIGNAL(clicked(bool)), this, SLOT(netctlAutoStartProfile()));
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::showWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
netctlAutoUpdateTable();
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::netctlAutoContextualMenu(const QPoint &pos)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (ui->tableWidget->currentItem() == 0)
|
||||
return;
|
||||
// create menu
|
||||
QMenu menu(this);
|
||||
QAction *startProfile = menu.addAction(QApplication::translate("NetctlAutoWindow", "Switch to profile"));
|
||||
startProfile->setIcon(QIcon::fromTheme("system-run"));
|
||||
QAction *enableProfile = menu.addAction(QApplication::translate("NetctlAutoWindow", "Enable profile"));
|
||||
menu.addSeparator();
|
||||
QAction *enableAllProfiles = menu.addAction(QApplication::translate("NetctlAutoWindow", "Enable all profiles"));
|
||||
enableAllProfiles->setIcon(QIcon::fromTheme("edit-add"));
|
||||
QAction *disableAllProfiles = menu.addAction(QApplication::translate("NetctlAutoWindow", "Disable all profiles"));
|
||||
disableAllProfiles->setIcon(QIcon::fromTheme("edit-delete"));
|
||||
|
||||
// set text
|
||||
if (!ui->tableWidget->item(ui->tableWidget->currentItem()->row(), 2)->text().isEmpty()) {
|
||||
enableProfile->setVisible(false);
|
||||
startProfile->setVisible(false);
|
||||
} else {
|
||||
enableProfile->setVisible(true);
|
||||
startProfile->setVisible(true);
|
||||
if (!ui->tableWidget->item(ui->tableWidget->currentItem()->row(), 3)->text().isEmpty()) {
|
||||
enableProfile->setText(QApplication::translate("NetctlAutoWindow", "Enable"));
|
||||
enableProfile->setIcon(QIcon::fromTheme("edit-add"));
|
||||
} else {
|
||||
enableProfile->setText(QApplication::translate("NetctlAutoWindow", "Disable"));
|
||||
enableProfile->setIcon(QIcon::fromTheme("edit-delete"));
|
||||
}
|
||||
}
|
||||
|
||||
// actions
|
||||
QAction *action = menu.exec(ui->tableWidget->viewport()->mapToGlobal(pos));
|
||||
if (action == startProfile) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Switch to profile";
|
||||
netctlAutoStartProfile();
|
||||
} else if (action == enableProfile) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Enable profile";
|
||||
netctlAutoEnableProfile();
|
||||
} else if (action == enableAllProfiles) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Enable all profiles";
|
||||
netctlAutoEnableAllProfiles();
|
||||
} else if (action == disableAllProfiles) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Disable all profiles";
|
||||
netctlAutoDisableAllProfiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::netctlAutoUpdateTable()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->tableWidget->setDisabled(true);
|
||||
// actions
|
||||
bool enabled = false;
|
||||
bool running = false;
|
||||
if (useHelper) {
|
||||
enabled = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isNetctlAutoEnabled"),
|
||||
QList<QVariant>(), true, debug)[0].toBool();
|
||||
running = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isNetctlAutoActive"),
|
||||
QList<QVariant>(), true, debug)[0].toBool();
|
||||
} else {
|
||||
enabled = netctlCommand->isNetctlAutoEnabled();
|
||||
running = netctlCommand->isNetctlAutoRunning();
|
||||
}
|
||||
if (enabled)
|
||||
ui->actionEnableService->setText(QApplication::translate("NetctlAutoWindow", "Disable service"));
|
||||
else
|
||||
ui->actionEnableService->setText(QApplication::translate("NetctlAutoWindow", "Enable service"));
|
||||
ui->actionEnableService->setVisible(true);
|
||||
if (running) {
|
||||
ui->label_info->setText(QApplication::translate("NetctlAutoWindow", "netctl-auto is running"));
|
||||
ui->actionStartService->setText(QApplication::translate("NetctlAutoWindow", "Stop service"));
|
||||
ui->actionDisableAll->setVisible(true);
|
||||
ui->actionEnableAll->setVisible(true);
|
||||
ui->actionRestartService->setVisible(true);
|
||||
} else {
|
||||
ui->label_info->setText(QApplication::translate("NetctlAutoWindow", "netctl-auto is not running"));
|
||||
ui->actionStartService->setText(QApplication::translate("NetctlAutoWindow", "Start service"));
|
||||
ui->actionDisableAll->setVisible(false);
|
||||
ui->actionEnableAll->setVisible(false);
|
||||
ui->actionRestartService->setVisible(false);
|
||||
netctlAutoRefreshButtons(0, 0);
|
||||
return;
|
||||
}
|
||||
QList<netctlProfileInfo> profiles;
|
||||
if (useHelper)
|
||||
profiles = parseOutputNetctl(sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("ProfileList"),
|
||||
QList<QVariant>(), true, debug), debug);
|
||||
else
|
||||
profiles = netctlCommand->getProfileListFromNetctlAuto();
|
||||
|
||||
ui->tableWidget->setSortingEnabled(false);
|
||||
ui->tableWidget->selectRow(-1);
|
||||
ui->tableWidget->sortByColumn(0, Qt::AscendingOrder);
|
||||
ui->tableWidget->clear();
|
||||
ui->tableWidget->setRowCount(profiles.count());
|
||||
|
||||
// create header
|
||||
QStringList headerList;
|
||||
headerList.append(QApplication::translate("NetctlAutoWindow", "Name"));
|
||||
headerList.append(QApplication::translate("NetctlAutoWindow", "Description"));
|
||||
headerList.append(QApplication::translate("NetctlAutoWindow", "Active"));
|
||||
headerList.append(QApplication::translate("NetctlAutoWindow", "Disabled"));
|
||||
ui->tableWidget->setHorizontalHeaderLabels(headerList);
|
||||
// create items
|
||||
for (int i=0; i<profiles.count(); i++) {
|
||||
// font
|
||||
QFont font;
|
||||
font.setBold(profiles[i].active);
|
||||
font.setItalic(profiles[i].enabled);
|
||||
// tooltip
|
||||
QString toolTip = QString("");
|
||||
toolTip += QString("%1: %2\n").arg(QApplication::translate("NetctlAutoWindow", "Profile")).arg(profiles[i].name);
|
||||
toolTip += QString("%1: %2\n").arg(QApplication::translate("NetctlAutoWindow", "Active")).arg(checkStatus(profiles[i].active));
|
||||
toolTip += QString("%1: %2").arg(QApplication::translate("NetctlAutoWindow", "Disabled")).arg(checkStatus(!profiles[i].enabled));
|
||||
// name
|
||||
ui->tableWidget->setItem(i, 0, new QTableWidgetItem(profiles[i].name));
|
||||
ui->tableWidget->item(i, 0)->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
ui->tableWidget->item(i, 0)->setToolTip(toolTip);
|
||||
ui->tableWidget->item(i, 0)->setFont(font);
|
||||
// description
|
||||
ui->tableWidget->setItem(i, 1, new QTableWidgetItem(profiles[i].description));
|
||||
ui->tableWidget->item(i, 1)->setTextAlignment(Qt::AlignJustify | Qt::AlignVCenter);
|
||||
ui->tableWidget->item(i, 1)->setToolTip(toolTip);
|
||||
// active
|
||||
ui->tableWidget->setItem(i, 2, new QTableWidgetItem(checkStatus(profiles[i].active, true)));
|
||||
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
// enabled
|
||||
ui->tableWidget->setItem(i, 3, new QTableWidgetItem(checkStatus(!profiles[i].enabled, true)));
|
||||
ui->tableWidget->item(i, 3)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
ui->tableWidget->setSortingEnabled(true);
|
||||
|
||||
ui->tableWidget->resizeRowsToContents();
|
||||
ui->tableWidget->resizeColumnsToContents();
|
||||
ui->tableWidget->resizeRowsToContents();
|
||||
#if QT_VERSION >= 0x050000
|
||||
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
#else
|
||||
ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
ui->tableWidget->setEnabled(true);
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Updated"));
|
||||
|
||||
netctlAutoRefreshButtons(0, 0);
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::netctlAutoDisableAllProfiles()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->tableWidget->setDisabled(true);
|
||||
bool status = false;
|
||||
if (useHelper)
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("autoDisableAll"),
|
||||
QList<QVariant>(), true, debug)[0].toBool();
|
||||
else
|
||||
status = netctlCommand->autoDisableAllProfiles();
|
||||
if (status)
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done"));
|
||||
else
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error"));
|
||||
|
||||
netctlAutoUpdateTable();
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::netctlAutoEnableProfile()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (ui->tableWidget->currentItem() == 0)
|
||||
return;
|
||||
ui->tableWidget->setDisabled(true);
|
||||
QString profile = ui->tableWidget->item(ui->tableWidget->currentItem()->row(), 0)->text();
|
||||
bool status = false;
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("autoEnable"),
|
||||
args, true, debug)[0].toBool();
|
||||
} else
|
||||
status = netctlCommand->autoEnableProfile(profile);
|
||||
if (status)
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done"));
|
||||
else
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error"));
|
||||
|
||||
netctlAutoUpdateTable();
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::netctlAutoEnableAllProfiles()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->tableWidget->setDisabled(true);
|
||||
bool status = false;
|
||||
if (useHelper)
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("autoEnableAll"),
|
||||
QList<QVariant>(), true, debug)[0].toBool();
|
||||
else
|
||||
status = netctlCommand->autoEnableAllProfiles();
|
||||
if (status)
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done"));
|
||||
else
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error"));
|
||||
|
||||
netctlAutoUpdateTable();
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::netctlAutoStartProfile()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (ui->tableWidget->currentItem() == 0)
|
||||
return;
|
||||
ui->tableWidget->setDisabled(true);
|
||||
QString profile = ui->tableWidget->item(ui->tableWidget->currentItem()->row(), 0)->text();
|
||||
bool status = false;
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("autoStart"),
|
||||
args, true, debug)[0].toBool();
|
||||
} else
|
||||
status = netctlCommand->autoStartProfile(profile);
|
||||
if (status)
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done"));
|
||||
else
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error"));
|
||||
|
||||
netctlAutoUpdateTable();
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::netctlAutoEnableService()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
bool status = false;
|
||||
if (useHelper)
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("autoServiceEnable"),
|
||||
QList<QVariant>(), true, debug)[0].toBool();
|
||||
else
|
||||
status = netctlCommand->autoEnableService();
|
||||
if (status)
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done"));
|
||||
else
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error"));
|
||||
|
||||
netctlAutoUpdateTable();
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::netctlAutoRestartService()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
bool status = false;
|
||||
if (useHelper)
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("autoServiceRestart"),
|
||||
QList<QVariant>(), true, debug)[0].toBool();
|
||||
else
|
||||
status = netctlCommand->autoRestartService();
|
||||
if (status)
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done"));
|
||||
else
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error"));
|
||||
|
||||
netctlAutoUpdateTable();
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::netctlAutoStartService()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
bool status = false;
|
||||
if (useHelper)
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("autoServiceStart"),
|
||||
QList<QVariant>(), true, debug)[0].toBool();
|
||||
else
|
||||
status = netctlCommand->autoStartService();
|
||||
if (status)
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done"));
|
||||
else
|
||||
ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error"));
|
||||
|
||||
netctlAutoUpdateTable();
|
||||
}
|
||||
|
||||
|
||||
void NetctlAutoWindow::netctlAutoRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous)
|
||||
{
|
||||
Q_UNUSED(previous);
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (current == 0) {
|
||||
// buttons
|
||||
ui->pushButton_enable->setDisabled(true);
|
||||
ui->pushButton_switch->setDisabled(true);
|
||||
// menu
|
||||
ui->actionEnable->setVisible(false);
|
||||
ui->actionSwitch->setVisible(false);
|
||||
return;
|
||||
}
|
||||
if (!ui->tableWidget->item(current->row(), 2)->text().isEmpty()) {
|
||||
// buttons
|
||||
ui->pushButton_enable->setDisabled(true);
|
||||
ui->pushButton_switch->setDisabled(true);
|
||||
// menu
|
||||
ui->actionEnable->setVisible(false);
|
||||
ui->actionSwitch->setVisible(false);
|
||||
} else {
|
||||
// buttons
|
||||
ui->pushButton_enable->setEnabled(true);
|
||||
ui->pushButton_switch->setEnabled(true);
|
||||
// menu
|
||||
ui->actionEnable->setVisible(true);
|
||||
ui->actionSwitch->setVisible(true);
|
||||
if (!ui->tableWidget->item(current->row(), 3)->text().isEmpty()) {
|
||||
// buttons
|
||||
ui->pushButton_enable->setText(QApplication::translate("NetctlAutoWindow", "Enable"));
|
||||
ui->pushButton_enable->setIcon(QIcon::fromTheme("edit-add"));
|
||||
// menu
|
||||
ui->actionEnable->setText(QApplication::translate("NetctlAutoWindow", "Enable profile"));
|
||||
ui->actionEnable->setIcon(QIcon::fromTheme("edit-add"));
|
||||
} else {
|
||||
// buttons
|
||||
ui->pushButton_enable->setText(QApplication::translate("NetctlAutoWindow", "Disable"));
|
||||
ui->pushButton_enable->setIcon(QIcon::fromTheme("edit-delete"));
|
||||
// menu
|
||||
ui->actionEnable->setText(QApplication::translate("NetctlAutoWindow", "Disable profile"));
|
||||
ui->actionEnable->setIcon(QIcon::fromTheme("edit-delete"));
|
||||
}
|
||||
}
|
||||
}
|
70
sources/gui/src/netctlautowindow.h
Normal file
@ -0,0 +1,70 @@
|
||||
/***************************************************************************
|
||||
* 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/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef NETCTLAUTOWINDOW_H
|
||||
#define NETCTLAUTOWINDOW_H
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QMainWindow>
|
||||
#include <QTableWidgetItem>
|
||||
|
||||
|
||||
class Netctl;
|
||||
|
||||
namespace Ui {
|
||||
class NetctlAutoWindow;
|
||||
}
|
||||
|
||||
class NetctlAutoWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NetctlAutoWindow(QWidget *parent = 0,
|
||||
const bool debugCmd = false,
|
||||
const QMap<QString, QString> settings = QMap<QString, QString>());
|
||||
~NetctlAutoWindow();
|
||||
|
||||
public slots:
|
||||
void showWindow();
|
||||
|
||||
private slots:
|
||||
// table
|
||||
void netctlAutoContextualMenu(const QPoint &pos);
|
||||
void netctlAutoUpdateTable();
|
||||
// netctl-auto
|
||||
void netctlAutoDisableAllProfiles();
|
||||
void netctlAutoEnableProfile();
|
||||
void netctlAutoEnableAllProfiles();
|
||||
void netctlAutoStartProfile();
|
||||
void netctlAutoRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous);
|
||||
// service
|
||||
void netctlAutoEnableService();
|
||||
void netctlAutoRestartService();
|
||||
void netctlAutoStartService();
|
||||
|
||||
private:
|
||||
Netctl *netctlCommand = nullptr;
|
||||
Ui::NetctlAutoWindow *ui = nullptr;
|
||||
bool debug = false;
|
||||
bool useHelper = true;
|
||||
QString checkStatus(const bool statusBool, const bool nullFalse = false);
|
||||
void createActions();
|
||||
};
|
||||
|
||||
|
||||
#endif /* NETCTLAUTOWINDOW_H */
|
238
sources/gui/src/netctlautowindow.ui
Normal file
@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NetctlAutoWindow</class>
|
||||
<widget class="QMainWindow" name="NetctlAutoWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>428</width>
|
||||
<height>339</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>netctl-auto</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_info">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</column>
|
||||
<column/>
|
||||
<column/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_buttons">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_refresh">
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="stock-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_buttons">
|
||||
<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_enable">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="edit-add"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_switch">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Switch</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="system-run">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>428</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuMenu">
|
||||
<property name="title">
|
||||
<string>Menu</string>
|
||||
</property>
|
||||
<addaction name="actionRefresh"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSwitch"/>
|
||||
<addaction name="actionEnable"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionEnableAll"/>
|
||||
<addaction name="actionDisableAll"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionStartService"/>
|
||||
<addaction name="actionRestartService"/>
|
||||
<addaction name="actionEnableService"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionClose"/>
|
||||
</widget>
|
||||
<addaction name="menuMenu"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionEnable">
|
||||
<property name="icon">
|
||||
<iconset theme="edit-add">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSwitch">
|
||||
<property name="icon">
|
||||
<iconset theme="system-run">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Switch to profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClose">
|
||||
<property name="icon">
|
||||
<iconset theme="exit">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Esc</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnableAll">
|
||||
<property name="icon">
|
||||
<iconset theme="edit-add">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable all profiles</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDisableAll">
|
||||
<property name="icon">
|
||||
<iconset theme="edit-delete">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Disable all profiles</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionStartService">
|
||||
<property name="text">
|
||||
<string>Start service</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRestartService">
|
||||
<property name="text">
|
||||
<string>Restart service</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnableService">
|
||||
<property name="text">
|
||||
<string>Enable service</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRefresh">
|
||||
<property name="icon">
|
||||
<iconset theme="stock-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
142
sources/gui/src/netctlguiadaptor.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
/***************************************************************************
|
||||
* 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 "netctlguiadaptor.h"
|
||||
|
||||
#include <QTextCodec>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
NetctlGuiAdaptor::NetctlGuiAdaptor(MainWindow *parent)
|
||||
: QDBusAbstractAdaptor(parent),
|
||||
mainWindow(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NetctlGuiAdaptor::~NetctlGuiAdaptor()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool NetctlGuiAdaptor::Active()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void NetctlGuiAdaptor::ApiDocs()
|
||||
{
|
||||
return mainWindow->showApi();
|
||||
}
|
||||
|
||||
|
||||
bool NetctlGuiAdaptor::Close()
|
||||
{
|
||||
mainWindow->closeMainWindow();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QStringList NetctlGuiAdaptor::Information()
|
||||
{
|
||||
return mainWindow->printInformation();
|
||||
}
|
||||
|
||||
|
||||
void NetctlGuiAdaptor::LibraryDocs()
|
||||
{
|
||||
return mainWindow->showLibrary();
|
||||
}
|
||||
|
||||
|
||||
QString NetctlGuiAdaptor::Pony()
|
||||
{
|
||||
QString pony;
|
||||
QFile ponyFile(QString(":pinkiepie"));
|
||||
if (!ponyFile.open(QIODevice::ReadOnly))
|
||||
return pony;
|
||||
pony = QTextCodec::codecForMib(106)->toUnicode(ponyFile.readAll());
|
||||
ponyFile.close();
|
||||
|
||||
return pony;
|
||||
}
|
||||
|
||||
|
||||
bool NetctlGuiAdaptor::Restore()
|
||||
{
|
||||
mainWindow->show();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void NetctlGuiAdaptor::SecurityDocs()
|
||||
{
|
||||
return mainWindow->showSecurityNotes();
|
||||
}
|
||||
|
||||
|
||||
QStringList NetctlGuiAdaptor::Settings()
|
||||
{
|
||||
return mainWindow->printSettings();
|
||||
}
|
||||
|
||||
|
||||
bool NetctlGuiAdaptor::ShowAbout()
|
||||
{
|
||||
mainWindow->showAboutWindow();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool NetctlGuiAdaptor::ShowMain()
|
||||
{
|
||||
mainWindow->showMainWindow();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool NetctlGuiAdaptor::ShowNetctlAuto()
|
||||
{
|
||||
mainWindow->showNetctlAutoWindow();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool NetctlGuiAdaptor::ShowSettings()
|
||||
{
|
||||
mainWindow->showSettingsWindow();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QStringList NetctlGuiAdaptor::UIDs()
|
||||
{
|
||||
QStringList uids;
|
||||
uids.append(QString::number(getuid()));
|
||||
uids.append(QString::number(geteuid()));
|
||||
|
||||
return uids;
|
||||
}
|
||||
|
||||
|
||||
QStringList NetctlGuiAdaptor::VerboseInformation()
|
||||
{
|
||||
return mainWindow->printTrayInformation();
|
||||
}
|
58
sources/gui/src/netctlguiadaptor.h
Normal file
@ -0,0 +1,58 @@
|
||||
/***************************************************************************
|
||||
* 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/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef NETCTLGUIADAPTOR_H
|
||||
#define NETCTLGUIADAPTOR_H
|
||||
|
||||
#include <QDBusAbstractAdaptor>
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
class MainWindow;
|
||||
|
||||
class NetctlGuiAdaptor : public QDBusAbstractAdaptor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "org.netctlgui.netctlgui")
|
||||
|
||||
public:
|
||||
explicit NetctlGuiAdaptor(MainWindow *parent = 0);
|
||||
~NetctlGuiAdaptor();
|
||||
|
||||
public slots:
|
||||
bool Active();
|
||||
void ApiDocs();
|
||||
bool Close();
|
||||
QStringList Information();
|
||||
void LibraryDocs();
|
||||
QString Pony();
|
||||
bool Restore();
|
||||
void SecurityDocs();
|
||||
QStringList Settings();
|
||||
bool ShowAbout();
|
||||
bool ShowMain();
|
||||
bool ShowNetctlAuto();
|
||||
bool ShowSettings();
|
||||
QStringList UIDs();
|
||||
QStringList VerboseInformation();
|
||||
|
||||
private:
|
||||
MainWindow *mainWindow;
|
||||
};
|
||||
|
||||
|
||||
#endif /* NETCTLGUIADAPTOR_H */
|
@ -1,228 +0,0 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* *
|
||||
* netctl-plasmoid 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-plasmoid 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "netctlinteract.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
Netctl::Netctl(MainWindow *wid, const QMap<QString, QString> settings)
|
||||
: parent(wid)
|
||||
{
|
||||
netctlCommand = settings[QString("NETCTL_PATH")];
|
||||
profileDirectory = new QDir(settings[QString("PROFILE_DIR")]);
|
||||
sudoCommand = settings[QString("SUDO_PATH")];
|
||||
}
|
||||
|
||||
|
||||
Netctl::~Netctl()
|
||||
{
|
||||
delete profileDirectory;
|
||||
}
|
||||
|
||||
|
||||
// functions
|
||||
QString Netctl::getNetctlOutput(const bool sudo, const QString commandLine, const QString profile)
|
||||
{
|
||||
QProcess command;
|
||||
QString commandText;
|
||||
if (sudo)
|
||||
commandText = sudoCommand + QString(" ") + netctlCommand + QString(" ") + commandLine +
|
||||
QString(" ") + profile;
|
||||
else
|
||||
commandText = netctlCommand + QString(" ") + commandLine + QString(" ") + profile;
|
||||
qDebug() << "[Netctl]" << "[getNetctlOutput]" << ":" << "Run cmd" << commandText;
|
||||
command.start(commandText);
|
||||
command.waitForFinished(-1);
|
||||
return command.readAllStandardOutput();
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::netctlCall(const bool sudo, const QString commandLine, const QString profile)
|
||||
{
|
||||
QProcess command;
|
||||
QString commandText;
|
||||
if (sudo)
|
||||
commandText = sudoCommand + QString(" ") + netctlCommand + QString(" ") + commandLine +
|
||||
QString(" ") + profile;
|
||||
else
|
||||
commandText = netctlCommand + QString(" ") + commandLine + QString(" ") + profile;
|
||||
qDebug() << "[Netctl]" << "[netctlCall]" << ":" << "Run cmd" << commandText;
|
||||
command.start(commandText);
|
||||
command.waitForFinished(-1);
|
||||
qDebug() << "[Netctl]" << "[netctlCall]" << ":" << "Cmd returns" << command.exitCode();
|
||||
if (command.exitCode() == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// general information
|
||||
QList<QStringList> Netctl::getProfileList()
|
||||
{
|
||||
QList<QStringList> fullProfilesInfo;
|
||||
QStringList profiles = profileDirectory->entryList(QDir::Files);
|
||||
QStringList descriptions = getProfileDescriptions(profiles);
|
||||
QStringList statuses = getProfileStatuses(profiles);
|
||||
|
||||
for (int i=0; i<profiles.count(); i++) {
|
||||
QStringList profileInfo;
|
||||
profileInfo.append(profiles[i]);
|
||||
profileInfo.append(descriptions[i]);
|
||||
profileInfo.append(statuses[i]);
|
||||
fullProfilesInfo.append(profileInfo);
|
||||
}
|
||||
return fullProfilesInfo;
|
||||
}
|
||||
|
||||
|
||||
QStringList Netctl::getProfileDescriptions(const QStringList profileList)
|
||||
{
|
||||
QStringList descriptions;
|
||||
|
||||
for (int i=0; i<profileList.count(); i++) {
|
||||
QString profileUrl = profileDirectory->absolutePath() + QDir::separator() + profileList[i];
|
||||
qDebug() << "[Netctl]" << "[getProfileDescriptions]" << ":" << "Check" << profileUrl;
|
||||
QFile profile(profileUrl);
|
||||
QString fileStr;
|
||||
if (profile.open(QIODevice::ReadOnly))
|
||||
while (true) {
|
||||
fileStr = QString(profile.readLine());
|
||||
if (fileStr[0] != '#')
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2)
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("Description"))
|
||||
descriptions.append(fileStr.split(QString("="), QString::SkipEmptyParts)[1].trimmed());
|
||||
if (profile.atEnd())
|
||||
break;
|
||||
}
|
||||
else
|
||||
descriptions.append(QString("<unknown>"));
|
||||
}
|
||||
|
||||
for (int i=0; i<profileList.count(); i++) {
|
||||
descriptions[i].remove(QChar('\''));
|
||||
descriptions[i].remove(QChar('"'));
|
||||
}
|
||||
|
||||
return descriptions;
|
||||
}
|
||||
|
||||
|
||||
QStringList Netctl::getProfileStatuses(const QStringList profileList)
|
||||
{
|
||||
QStringList statuses;
|
||||
|
||||
for (int i=0; i<profileList.count(); i++) {
|
||||
QString status;
|
||||
if (isProfileActive(profileList[i]))
|
||||
status = QString("active");
|
||||
else
|
||||
status = QString("inactive");
|
||||
if (isProfileEnabled(profileList[i]))
|
||||
status = status + QString(" (enabled)");
|
||||
else
|
||||
status = status + QString(" (static)");
|
||||
statuses.append(status);
|
||||
}
|
||||
|
||||
return statuses;
|
||||
}
|
||||
|
||||
|
||||
QString Netctl::getSsidFromProfile(const QString profile)
|
||||
{
|
||||
QString ssidName = QString("");
|
||||
QString profileUrl = profileDirectory->absolutePath() + QDir::separator() + profile;
|
||||
qDebug() << "[Netctl]" << "[getSsidFromProfile]" << ":" << "Check" << profileUrl;
|
||||
QFile profileFile(profileUrl);
|
||||
QString fileStr;
|
||||
if (!profileFile.open(QIODevice::ReadOnly))
|
||||
return ssidName;
|
||||
|
||||
while (true) {
|
||||
fileStr = QString(profileFile.readLine());
|
||||
if (fileStr[0] != '#') {
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2)
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("ESSID"))
|
||||
ssidName = fileStr.split(QString("="), QString::SkipEmptyParts)[1].trimmed();
|
||||
}
|
||||
if (profileFile.atEnd())
|
||||
break;
|
||||
}
|
||||
|
||||
profileFile.close();
|
||||
|
||||
ssidName.remove(QChar('\''));
|
||||
ssidName.remove(QChar('"'));
|
||||
return ssidName;
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::isProfileActive(const QString profile)
|
||||
{
|
||||
bool status = false;
|
||||
QString cmdOutput = getNetctlOutput(false, QString("status"), profile);
|
||||
if (!cmdOutput.isEmpty())
|
||||
if (cmdOutput.contains(QString("Active: active")))
|
||||
status = true;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::isProfileEnabled(const QString profile)
|
||||
{
|
||||
bool status = false;
|
||||
QString cmdOutput = getNetctlOutput(false, QString("status"), profile);
|
||||
if (!cmdOutput.isEmpty()) {
|
||||
QStringList profileStatus = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
|
||||
for (int i=0; i<profileStatus.count(); i++)
|
||||
if (profileStatus[i].split(QString(" "), QString::SkipEmptyParts)[0] == QString("Loaded:"))
|
||||
if (profileStatus[i].contains(QString("enabled")))
|
||||
status = true;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
// functions
|
||||
bool Netctl::enableProfile(const QString profile)
|
||||
{
|
||||
if (isProfileEnabled(profile))
|
||||
return netctlCall(true, QString("disable"), profile);
|
||||
else
|
||||
return netctlCall(true, QString("enable"), profile);
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::restartProfile(const QString profile)
|
||||
{
|
||||
return netctlCall(true, QString("restart"), profile);
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::startProfile(const QString profile)
|
||||
{
|
||||
if (isProfileActive(profile))
|
||||
return netctlCall(true, QString("stop"), profile);
|
||||
else
|
||||
return netctlCall(true, QString("start"), profile);
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* *
|
||||
* netctl-plasmoid 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-plasmoid 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef NETCTLINTERACT_H
|
||||
#define NETCTLINTERACT_H
|
||||
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
class MainWindow;
|
||||
|
||||
class Netctl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Netctl(MainWindow *wid = 0,
|
||||
const QMap<QString, QString> settings = QMap<QString, QString>());
|
||||
~Netctl();
|
||||
// general information
|
||||
QList<QStringList> getProfileList();
|
||||
QStringList getProfileDescriptions(const QStringList profileList);
|
||||
QStringList getProfileStatuses(const QStringList profileList);
|
||||
QString getSsidFromProfile(const QString profile);
|
||||
bool isProfileActive(const QString profile);
|
||||
bool isProfileEnabled(const QString profile);
|
||||
|
||||
public slots:
|
||||
// functions
|
||||
bool enableProfile(const QString profile);
|
||||
bool restartProfile(const QString profile);
|
||||
bool startProfile(const QString profile);
|
||||
|
||||
private:
|
||||
MainWindow *parent;
|
||||
QString netctlCommand;
|
||||
QDir *profileDirectory;
|
||||
QString sudoCommand;
|
||||
// functions
|
||||
QString getNetctlOutput(const bool sudo, const QString commandLine, const QString profile);
|
||||
bool netctlCall(const bool sudo, const QString commandLine, const QString profile);
|
||||
};
|
||||
|
||||
|
||||
#endif /* NETCTLINTERACT_H */
|
@ -1,156 +0,0 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* *
|
||||
* netctl-plasmoid 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-plasmoid 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "netctlprofile.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QProcess>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
NetctlProfile::NetctlProfile(MainWindow *wid, const QMap<QString, QString> settings)
|
||||
: parent(wid)
|
||||
{
|
||||
profileDirectory = new QDir(settings[QString("PROFILE_DIR")]);
|
||||
sudoCommand = settings[QString("SUDO_PATH")];
|
||||
}
|
||||
|
||||
|
||||
NetctlProfile::~NetctlProfile()
|
||||
{
|
||||
delete profileDirectory;
|
||||
}
|
||||
|
||||
|
||||
bool NetctlProfile::copyProfile(const QString oldPath)
|
||||
{
|
||||
QString newPath = profileDirectory->absolutePath() + QDir::separator() + QFileInfo(oldPath).fileName();
|
||||
QProcess command;
|
||||
QString commandText = sudoCommand + QString(" /usr/bin/mv ") + oldPath + QString(" ") + newPath;
|
||||
qDebug() << "[NetctlProfile]" << "[copyProfile]" << ":" << "Run cmd" << commandText;
|
||||
command.start(commandText);
|
||||
command.waitForFinished(-1);
|
||||
if (command.exitCode() == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString NetctlProfile::createProfile(const QString profile, const QMap<QString, QString> settings)
|
||||
{
|
||||
|
||||
QString profileTempName = QDir::homePath() + QDir::separator() +
|
||||
QString(".cache") + QDir::separator() + QFileInfo(profile).fileName();
|
||||
QFile profileFile(profileTempName);
|
||||
qDebug() << "[NetctlProfile]" << "[createProfile]" << ":" << "Save to" << profileTempName;
|
||||
|
||||
if (!profileFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
return profileTempName;
|
||||
|
||||
QTextStream out(&profileFile);
|
||||
for (int i=0; i<settings.keys().count(); i++) {
|
||||
out << settings.keys()[i] << QString("=");
|
||||
if ((settings.keys()[i] == QString("BindsToInterfaces")) ||
|
||||
(settings.keys()[i] == QString("After")) ||
|
||||
(settings.keys()[i] == QString("Address")) ||
|
||||
(settings.keys()[i] == QString("Routes")) ||
|
||||
(settings.keys()[i] == QString("Address6")) ||
|
||||
(settings.keys()[i] == QString("Routes6")) ||
|
||||
(settings.keys()[i] == QString("IPCustom")) ||
|
||||
(settings.keys()[i] == QString("DNS")) ||
|
||||
(settings.keys()[i] == QString("DNSOptions")) ||
|
||||
(settings.keys()[i] == QString("WPAConfigSection")) ||
|
||||
(settings.keys()[i] == QString("WPAConfigSection")))
|
||||
out << QString("(") + settings[settings.keys()[i]] << QString(")\n");
|
||||
else
|
||||
out << settings[settings.keys()[i]] << QString("\n");
|
||||
}
|
||||
profileFile.close();
|
||||
|
||||
return profileTempName;
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> NetctlProfile::getSettingsFromProfile(const QString profile)
|
||||
{
|
||||
QMap<QString, QString> settings;
|
||||
QString fileStr, profileUrl;
|
||||
if (profile[0] == QDir::separator())
|
||||
profileUrl = profile;
|
||||
else
|
||||
profileUrl = profileDirectory->absolutePath() + QDir::separator() + profile;
|
||||
QFile profileFile(profileUrl);
|
||||
qDebug() << "[NetctlProfile]" << "[getSettingsFromProfile]" << ":" << "Read from" << profileUrl;
|
||||
|
||||
if (!profileFile.open(QIODevice::ReadOnly))
|
||||
return settings;
|
||||
while (true) {
|
||||
fileStr = QString(profileFile.readLine());
|
||||
if (fileStr[0] != '#') {
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2) {
|
||||
if ((fileStr.split(QString("="))[1][0] == QChar('(')) &&
|
||||
(fileStr.split(QString("="))[1][fileStr.split(QString("="))[1].size()-2] == QChar(')')))
|
||||
settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1]
|
||||
.remove(QString("("))
|
||||
.remove(QString(")"))
|
||||
.trimmed();
|
||||
else if (fileStr.split(QString("="))[1][0] == QChar('(')) {
|
||||
QString parameterName = fileStr.split(QString("="))[0];
|
||||
QStringList parameter;
|
||||
if (!fileStr.split(QString("="))[1]
|
||||
.remove(QString("("))
|
||||
.remove(QString(")"))
|
||||
.trimmed()
|
||||
.isEmpty())
|
||||
parameter.append(fileStr.split(QString("="))[1]
|
||||
.remove(QString("("))
|
||||
.remove(QString(")"))
|
||||
.trimmed());
|
||||
while(true) {
|
||||
fileStr = QString(profileFile.readLine());
|
||||
if (fileStr[fileStr.size()-2] == QChar(')'))
|
||||
break;
|
||||
if (!fileStr.remove(QString("("))
|
||||
.remove(QString(")"))
|
||||
.trimmed()
|
||||
.isEmpty())
|
||||
parameter.append(fileStr.remove(QString("("))
|
||||
.remove(QString(")"))
|
||||
.trimmed());
|
||||
if (profileFile.atEnd())
|
||||
break;
|
||||
}
|
||||
settings[parameterName] = parameter.join(QString("\n"));
|
||||
}
|
||||
else
|
||||
settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1]
|
||||
.trimmed();
|
||||
}
|
||||
|
||||
}
|
||||
if (profileFile.atEnd())
|
||||
break;
|
||||
}
|
||||
|
||||
profileFile.close();
|
||||
return settings;
|
||||
}
|
@ -1,23 +1,25 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "passwdwidget.h"
|
||||
#include "ui_passwdwidget.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
@ -59,6 +61,18 @@ void PasswdWidget::setFocusToLineEdit()
|
||||
}
|
||||
|
||||
|
||||
void PasswdWidget::setPassword(const bool mode)
|
||||
{
|
||||
if (mode) {
|
||||
ui->lineEdit->setEchoMode(QLineEdit::Password);
|
||||
ui->label->setText(QApplication::translate("PasswdWidget", "Password"));
|
||||
} else {
|
||||
ui->lineEdit->setEchoMode(QLineEdit::Normal);
|
||||
ui->label->setText(QApplication::translate("PasswdWidget", "ESSID"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PasswdWidget::cancel()
|
||||
{
|
||||
hide();
|
||||
@ -70,5 +84,8 @@ void PasswdWidget::cancel()
|
||||
void PasswdWidget::passwdApply()
|
||||
{
|
||||
hide();
|
||||
if (ui->lineEdit->echoMode() == QLineEdit::Normal)
|
||||
return parent->setHiddenName(ui->lineEdit->text());
|
||||
else
|
||||
return parent->connectToUnknownEssid(ui->lineEdit->text());
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef PASSWDWIDGET_H
|
||||
@ -39,6 +39,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void setFocusToLineEdit();
|
||||
void setPassword(const bool mode = true);
|
||||
|
||||
private slots:
|
||||
void cancel();
|
||||
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "pppoewidget.h"
|
||||
@ -96,7 +96,7 @@ void PppoeWidget::changeMode(const QString currentText)
|
||||
if (currentText == QString("persist"))
|
||||
ui->widget_timeout->setHidden(true);
|
||||
else if (currentText == QString("demand"))
|
||||
ui->widget_timeout->setShown(true);
|
||||
ui->widget_timeout->setHidden(false);
|
||||
}
|
||||
|
||||
|
||||
@ -115,10 +115,9 @@ void PppoeWidget::selectOptionsFile()
|
||||
void PppoeWidget::showAdvanced()
|
||||
{
|
||||
if (ui->pushButton_pppoeAdvanced->isChecked()) {
|
||||
ui->widget_pppoeAdvanced->setShown(true);
|
||||
ui->widget_pppoeAdvanced->setHidden(false);
|
||||
ui->pushButton_pppoeAdvanced->setText(QApplication::translate("PppoeWidget", "Hide advanced"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->widget_pppoeAdvanced->setHidden(true);
|
||||
ui->pushButton_pppoeAdvanced->setText(QApplication::translate("PppoeWidget", "Show advanced"));
|
||||
}
|
||||
@ -157,9 +156,10 @@ QMap<QString, QString> PppoeWidget::getSettings()
|
||||
pppoeSettings[QString("PPPoEService")] = QString("'") + ui->lineEdit_service->text() + QString("'");
|
||||
if (!ui->lineEdit_ac->text().isEmpty())
|
||||
pppoeSettings[QString("PPPoEAC")] = QString("'") + ui->lineEdit_ac->text() + QString("'");
|
||||
if (!ui->lineEdit_session->text().split(QString(":")).join(QString("")).remove(QString(" ")).isEmpty())
|
||||
pppoeSettings[QString("PPPoESession")] = QString("'") + ui->lineEdit_session->text().remove(QString(" ")) + QString("'");
|
||||
if (!ui->lineEdit_mac->text().split(QString(":")).join(QString("")).remove(QString(" ")).isEmpty())
|
||||
if (!ui->lineEdit_session->text().remove(QChar(':')).remove(QChar(' ')).isEmpty())
|
||||
pppoeSettings[QString("PPPoESession")] = QString("'") + ui->lineEdit_session->text()
|
||||
.remove(QChar('\'')).remove(QChar('"')) + QString("'");
|
||||
if (!ui->lineEdit_mac->text().remove(QChar(':')).remove(QChar(' ')).isEmpty())
|
||||
pppoeSettings[QString("PPPoEMAC")] = QString("'") + ui->lineEdit_mac->text() + QString("'");
|
||||
if (ui->checkBox_ipv6->checkState() == Qt::Checked)
|
||||
pppoeSettings[QString("PPPoEIP6")] = QString("yes");
|
||||
@ -175,18 +175,18 @@ int PppoeWidget::isOk()
|
||||
if (!QFile(ui->lineEdit_options->text()).exists())
|
||||
return 1;
|
||||
// mac address
|
||||
if (!ui->lineEdit_mac->text().split(QString(":")).join(QString("")).remove(QString(" ")).isEmpty())
|
||||
if (ui->lineEdit_mac->text().contains(QString(" ")))
|
||||
if (!ui->lineEdit_mac->text().remove(QChar(':')).remove(QChar(' ')).isEmpty())
|
||||
if (ui->lineEdit_mac->text().contains(QChar(' ')))
|
||||
return 2;
|
||||
// session id is not set
|
||||
if (!ui->lineEdit_session->text().split(QString(":")).join(QString("")).remove(QString(" ")).isEmpty())
|
||||
if (ui->lineEdit_session->text().split(QString(":"))[0].remove(QString(" ")).isEmpty())
|
||||
if (!ui->lineEdit_session->text().remove(QChar(':')).remove(QChar(' ')).isEmpty())
|
||||
if (ui->lineEdit_session->text().split(QChar(':'))[0].remove(QChar(' ')).isEmpty())
|
||||
return 3;
|
||||
// session mac address
|
||||
if (!ui->lineEdit_session->text().split(QString(":")).join(QString("")).remove(QString(" ")).isEmpty()) {
|
||||
QStringList item = ui->lineEdit_session->text().split(QString(":"));
|
||||
if (!ui->lineEdit_session->text().remove(QChar(':')).remove(QChar(' ')).isEmpty()) {
|
||||
QStringList item = ui->lineEdit_session->text().split(QChar(':'));
|
||||
for (int i=1; i<7; i++)
|
||||
if (item[i].contains(QString(" ")))
|
||||
if (item[i].contains(QChar(' ')))
|
||||
return 4;
|
||||
}
|
||||
// all fine
|
||||
@ -196,25 +196,26 @@ int PppoeWidget::isOk()
|
||||
|
||||
void PppoeWidget::setSettings(const QMap<QString, QString> settings)
|
||||
{
|
||||
clear();
|
||||
QMap<QString, QString> pppoeSettings = settings;
|
||||
|
||||
if (pppoeSettings.contains(QString("User")))
|
||||
ui->lineEdit_username->setText(pppoeSettings[QString("User")].remove(QString("'")));
|
||||
ui->lineEdit_username->setText(pppoeSettings[QString("User")]);
|
||||
if (pppoeSettings.contains(QString("Password")))
|
||||
ui->lineEdit_password->setText(pppoeSettings[QString("Password")].remove(QString("'")));
|
||||
ui->lineEdit_password->setText(pppoeSettings[QString("Password")]);
|
||||
if (pppoeSettings.contains(QString("ConnectionMode")))
|
||||
for (int i=0; i<ui->comboBox_connection->count(); i++)
|
||||
if (pppoeSettings[QString("ConnectionMode")].remove(QString("'")) == ui->comboBox_connection->itemText(i))
|
||||
if (pppoeSettings[QString("ConnectionMode")] == ui->comboBox_connection->itemText(i))
|
||||
ui->comboBox_connection->setCurrentIndex(i);
|
||||
if (pppoeSettings.contains(QString("IdleTimeout")))
|
||||
ui->spinBox_timeout->setValue(pppoeSettings[QString("IdleTimeout")].toInt());
|
||||
if (pppoeSettings.contains(QString("MaxFail")))
|
||||
ui->spinBox_fail->setValue(pppoeSettings[QString("MaxFail")].toInt());
|
||||
if (pppoeSettings.contains(QString("DefaultRoute")))
|
||||
if (pppoeSettings[QString("DefaultRoute")].remove(QString("'")) == QString("false"))
|
||||
if (pppoeSettings[QString("DefaultRoute")] == QString("false"))
|
||||
ui->checkBox_route->setCheckState(Qt::Unchecked);
|
||||
if (pppoeSettings.contains(QString("UsePeerDNS")))
|
||||
if (pppoeSettings[QString("UsePeerDNS")].remove(QString("'")) == QString("false"))
|
||||
if (pppoeSettings[QString("UsePeerDNS")] == QString("false"))
|
||||
ui->checkBox_dns->setCheckState(Qt::Unchecked);
|
||||
if (pppoeSettings.contains(QString("PPPUnit")))
|
||||
ui->lineEdit_unit->setText(pppoeSettings[QString("PPPUnit")]);
|
||||
@ -223,15 +224,15 @@ void PppoeWidget::setSettings(const QMap<QString, QString> settings)
|
||||
if (pppoeSettings.contains(QString("LCPEchoFailure")))
|
||||
ui->spinBox_lcpFailure->setValue(pppoeSettings[QString("LCPEchoFailure")].toInt());
|
||||
if (pppoeSettings.contains(QString("OptionsFile")))
|
||||
ui->lineEdit_options->setText(pppoeSettings[QString("OptionsFile")].remove(QString("'")));
|
||||
ui->lineEdit_options->setText(pppoeSettings[QString("OptionsFile")]);
|
||||
if (pppoeSettings.contains(QString("PPPoEService")))
|
||||
ui->lineEdit_service->setText(pppoeSettings[QString("PPPoEService")].remove(QString("'")));
|
||||
ui->lineEdit_service->setText(pppoeSettings[QString("PPPoEService")]);
|
||||
if (pppoeSettings.contains(QString("PPPoEAC")))
|
||||
ui->lineEdit_ac->setText(pppoeSettings[QString("PPPoEAC")].remove(QString("'")));
|
||||
ui->lineEdit_ac->setText(pppoeSettings[QString("PPPoEAC")]);
|
||||
if (pppoeSettings.contains(QString("PPPoESession")))
|
||||
ui->lineEdit_session->setText(pppoeSettings[QString("PPPoESession")].remove(QString("'")));
|
||||
ui->lineEdit_session->setText(pppoeSettings[QString("PPPoESession")]);
|
||||
if (pppoeSettings.contains(QString("PPPoEMAC")))
|
||||
ui->lineEdit_mac->setText(pppoeSettings[QString("PPPoEMAC")].remove(QString("'")));
|
||||
ui->lineEdit_mac->setText(pppoeSettings[QString("PPPoEMAC")]);
|
||||
if (pppoeSettings.contains(QString("PPPoEIP6")))
|
||||
if (pppoeSettings[QString("PPPoEIP6")] == QString("yes"))
|
||||
ui->checkBox_dns->setCheckState(Qt::Checked);
|
||||
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef PPPOEWIDGET_H
|
||||
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "settingswindow.h"
|
||||
@ -22,13 +22,17 @@
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
#include <QSettings>
|
||||
|
||||
#include <language/language.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
SettingsWindow::SettingsWindow(MainWindow *wid, const QString configFile)
|
||||
: QMainWindow(wid),
|
||||
parent(wid),
|
||||
SettingsWindow::SettingsWindow(QWidget *parent, const bool debugCmd, const QString configFile)
|
||||
: QMainWindow(parent),
|
||||
debug(debugCmd),
|
||||
file(configFile),
|
||||
ui(new Ui::SettingsWindow)
|
||||
{
|
||||
@ -40,31 +44,43 @@ SettingsWindow::SettingsWindow(MainWindow *wid, const QString configFile)
|
||||
|
||||
SettingsWindow::~SettingsWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::createActions()
|
||||
{
|
||||
connect(ui->comboBox_language, SIGNAL(currentIndexChanged(int)), ui->label_info, SLOT(show()));
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked(bool)), this, SLOT(close()));
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked(bool)), this, SLOT(setDefault()));
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked(bool)), this, SLOT(saveSettings()));
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked(bool)), this, SLOT(close()));
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked(bool)), this, SLOT(closeWindow()));
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked(bool)), this, SLOT(restoreSettings()));
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked(bool)), this, SLOT(setDefault()));
|
||||
connect(ui->checkBox_enableTray, SIGNAL(stateChanged(int)), this, SLOT(setTray()));
|
||||
connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
|
||||
this, SLOT(changePage(QTreeWidgetItem *, QTreeWidgetItem *)));
|
||||
// buttons
|
||||
connect(ui->pushButton_interfaceDir, SIGNAL(clicked(bool)), SLOT(selectIfaceDir()));
|
||||
connect(ui->pushButton_netctlPath, SIGNAL(clicked(bool)), SLOT(selectNetctlPath()));
|
||||
connect(ui->pushButton_profilePath, SIGNAL(clicked(bool)), SLOT(selectProfileDir()));
|
||||
connect(ui->pushButton_rfkill, SIGNAL(clicked(bool)), SLOT(selectRfkillDir()));
|
||||
connect(ui->pushButton_sudo, SIGNAL(clicked(bool)), SLOT(selectSudoPath()));
|
||||
connect(ui->pushButton_wpaCliPath, SIGNAL(clicked(bool)), SLOT(selectWpaCliPath()));
|
||||
connect(ui->pushButton_wpaSupPath, SIGNAL(clicked(bool)), SLOT(selectWpaSupPath()));
|
||||
connect(ui->pushButton_helperPath, SIGNAL(clicked(bool)), this, SLOT(selectAbstractSomething()));
|
||||
connect(ui->pushButton_interfacesDir, SIGNAL(clicked(bool)), this, SLOT(selectAbstractSomething()));
|
||||
connect(ui->pushButton_netctlPath, SIGNAL(clicked(bool)), this, SLOT(selectAbstractSomething()));
|
||||
connect(ui->pushButton_netctlAutoPath, SIGNAL(clicked(bool)), this, SLOT(selectAbstractSomething()));
|
||||
connect(ui->pushButton_profilePath, SIGNAL(clicked(bool)), this, SLOT(selectAbstractSomething()));
|
||||
connect(ui->pushButton_rfkill, SIGNAL(clicked(bool)), this, SLOT(selectAbstractSomething()));
|
||||
connect(ui->pushButton_status, SIGNAL(clicked(bool)), this, SLOT(startHelper()));
|
||||
connect(ui->pushButton_sudo, SIGNAL(clicked(bool)), this, SLOT(selectAbstractSomething()));
|
||||
connect(ui->pushButton_systemctlPath, SIGNAL(clicked(bool)), this, SLOT(selectAbstractSomething()));
|
||||
connect(ui->pushButton_wpaCliPath, SIGNAL(clicked(bool)), this, SLOT(selectAbstractSomething()));
|
||||
connect(ui->pushButton_wpaSupPath, SIGNAL(clicked(bool)), this, SLOT(selectAbstractSomething()));
|
||||
}
|
||||
|
||||
|
||||
// ESC press event
|
||||
void SettingsWindow::keyPressEvent(QKeyEvent *pressedKey)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (pressedKey->key() == Qt::Key_Escape)
|
||||
close();
|
||||
}
|
||||
@ -72,223 +88,408 @@ void SettingsWindow::keyPressEvent(QKeyEvent *pressedKey)
|
||||
|
||||
void SettingsWindow::addLanguages()
|
||||
{
|
||||
ui->comboBox_language->addItem(QString("english"));
|
||||
ui->comboBox_language->addItem(QString("russian"));
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->comboBox_language->clear();
|
||||
ui->comboBox_language->addItems(Language::getAvailableLanguages());
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::changePage(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||
{
|
||||
Q_UNUSED(previous);
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=0; i<ui->treeWidget->topLevelItemCount(); i++)
|
||||
if (current == ui->treeWidget->topLevelItem(i)) {
|
||||
ui->stackedWidget->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::closeWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
saveSettings();
|
||||
close();
|
||||
((MainWindow *)parent())->updateConfiguration();
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::saveSettings()
|
||||
{
|
||||
QMap<QString, QString> settings = readSettings();
|
||||
QFile configFile(file);
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
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]] << QString("\n");
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::setTray()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (ui->checkBox_enableTray->checkState() == 0) {
|
||||
ui->checkBox_closeToTray->setDisabled(true);
|
||||
ui->checkBox_startToTray->setDisabled(true);
|
||||
} else if (ui->checkBox_enableTray->checkState() == 2) {
|
||||
ui->checkBox_closeToTray->setEnabled(true);
|
||||
ui->checkBox_startToTray->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::restoreSettings()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
setSettings(getSettings());
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::setDefault()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
setSettings(getDefault());
|
||||
if (sender() != ui->buttonBox->button(QDialogButtonBox::Reset))
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::selectIfaceDir()
|
||||
void SettingsWindow::selectAbstractSomething()
|
||||
{
|
||||
QString directory = QFileDialog::getExistingDirectory(
|
||||
this,
|
||||
QApplication::translate("SettingsWindow", "Select path to directory with interfaces"),
|
||||
QString("/sys/"));
|
||||
if (!directory.isEmpty())
|
||||
ui->lineEdit_interfacesDir->setText(directory);
|
||||
}
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
bool isDir = false;
|
||||
QString path = QString("/usr/bin");
|
||||
QString text = QApplication::translate("SettingsWindow", "Select helper command");
|
||||
QLineEdit *lineEdit = ui->lineEdit_helperPath;
|
||||
if (sender() == ui->pushButton_helperPath) {
|
||||
text = QApplication::translate("SettingsWindow", "Select helper command");
|
||||
lineEdit = ui->lineEdit_helperPath;
|
||||
} else if (sender() == ui->pushButton_interfacesDir) {
|
||||
isDir = true;
|
||||
text = QApplication::translate("SettingsWindow", "Select path to directory with interfaces");
|
||||
path = QString("/sys");
|
||||
lineEdit = ui->lineEdit_interfacesDir;
|
||||
} else if (sender() == ui->pushButton_netctlPath) {
|
||||
text = QApplication::translate("SettingsWindow", "Select netctl command");
|
||||
lineEdit = ui->lineEdit_netctlPath;
|
||||
} else if (sender() == ui->pushButton_netctlAutoPath) {
|
||||
text = QApplication::translate("SettingsWindow", "Select netctl-auto command");
|
||||
lineEdit = ui->lineEdit_netctlAutoPath;
|
||||
} else if (sender() == ui->pushButton_profilePath) {
|
||||
isDir = true;
|
||||
text = QApplication::translate("SettingsWindow", "Select path to profile directory");
|
||||
path = QString("/etc");
|
||||
lineEdit = ui->lineEdit_profilePath;
|
||||
} else if (sender() == ui->pushButton_rfkill) {
|
||||
isDir = true;
|
||||
text = QApplication::translate("SettingsWindow", "Select path to directory with rfkill devices");
|
||||
path = QString("/sys");
|
||||
lineEdit = ui->lineEdit_rfkill;
|
||||
} else if (sender() == ui->pushButton_sudo) {
|
||||
text = QApplication::translate("SettingsWindow", "Select sudo command");
|
||||
lineEdit = ui->lineEdit_sudo;
|
||||
} else if (sender() == ui->pushButton_systemctlPath) {
|
||||
text = QApplication::translate("SettingsWindow", "Select systemctl command");
|
||||
lineEdit = ui->lineEdit_systemctlPath;
|
||||
} else if (sender() == ui->pushButton_wpaCliPath) {
|
||||
text = QApplication::translate("SettingsWindow", "Select wpa_cli command");
|
||||
lineEdit = ui->lineEdit_wpaCliPath;
|
||||
} else if (sender() == ui->pushButton_wpaSupPath) {
|
||||
text = QApplication::translate("SettingsWindow", "Select wpa_supplicant command");
|
||||
lineEdit = ui->lineEdit_wpaSupPath;
|
||||
}
|
||||
|
||||
void SettingsWindow::selectNetctlPath()
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
QApplication::translate("SettingsWindow", "Select netctl command"),
|
||||
QString("/usr/bin/"),
|
||||
QString filename;
|
||||
if (isDir)
|
||||
filename = QFileDialog::getExistingDirectory(this, text, path);
|
||||
else
|
||||
filename = QFileDialog::getOpenFileName(this, text, path,
|
||||
QApplication::translate("SettingsWindow", "All files (*)"));
|
||||
if (!filename.isEmpty())
|
||||
ui->lineEdit_netctlPath->setText(filename);
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::selectProfileDir()
|
||||
{
|
||||
QString directory = QFileDialog::getExistingDirectory(
|
||||
this,
|
||||
QApplication::translate("SettingsWindow", "Select path to profile directory"),
|
||||
QString("/etc/"));
|
||||
if (!directory.isEmpty())
|
||||
ui->lineEdit_profilePath->setText(directory);
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::selectRfkillDir()
|
||||
{
|
||||
QString directory = QFileDialog::getExistingDirectory(
|
||||
this,
|
||||
QApplication::translate("SettingsWindow", "Select path to directory with rfkill devices"),
|
||||
QString("/sys/"));
|
||||
if (!directory.isEmpty())
|
||||
ui->lineEdit_rfkill->setText(directory);
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::selectSudoPath()
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
QApplication::translate("SettingsWindow", "Select sudo command"),
|
||||
QString("/usr/bin/"),
|
||||
QApplication::translate("SettingsWindow", "All files (*)"));
|
||||
if (!filename.isEmpty())
|
||||
ui->lineEdit_sudo->setText(filename);
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::selectWpaCliPath()
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
QApplication::translate("SettingsWindow", "Select wpa_cli command"),
|
||||
QString("/usr/bin/"),
|
||||
QApplication::translate("SettingsWindow", "All files (*)"));
|
||||
if (!filename.isEmpty())
|
||||
ui->lineEdit_wpaCliPath->setText(filename);
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::selectWpaSupPath()
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
QApplication::translate("SettingsWindow", "Select wpa_supplicant command"),
|
||||
QString("/usr/bin/"),
|
||||
QApplication::translate("SettingsWindow", "All files (*)"));
|
||||
if (!filename.isEmpty())
|
||||
ui->lineEdit_wpaSupPath->setText(filename);
|
||||
lineEdit->setText(filename);
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::showWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
setSettings(getSettings());
|
||||
ui->label_info->hide();
|
||||
setTray();
|
||||
updateHelper();
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> SettingsWindow::readSettings()
|
||||
{
|
||||
QMap<QString, QString> settings;
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
settings[QString("CTRL_DIR")] = ui->lineEdit_wpaDir->text();
|
||||
settings[QString("CTRL_GROUP")] = ui->lineEdit_wpaGroup->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("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();
|
||||
settings[QString("SUDO_PATH")] = ui->lineEdit_sudo->text();
|
||||
settings[QString("WPACLI_PATH")] = ui->lineEdit_wpaCliPath->text();
|
||||
settings[QString("WPASUP_PATH")] = ui->lineEdit_wpaSupPath->text();
|
||||
settings[QString("WPA_DRIVERS")] = ui->lineEdit_wpaSupDrivers->text();
|
||||
QMap<QString, QString> config;
|
||||
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
qDebug() << "[SettingsWindow]" << "[readSettings]" << ":" <<
|
||||
settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
|
||||
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();
|
||||
|
||||
return settings;
|
||||
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)
|
||||
{
|
||||
ui->lineEdit_wpaDir->setText(settings[QString("CTRL_DIR")]);
|
||||
ui->lineEdit_wpaGroup->setText(settings[QString("CTRL_GROUP")]);
|
||||
ui->lineEdit_interfacesDir->setText(settings[QString("IFACE_DIR")]);
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (config[QString("CLOSE_HELPER")] == QString("true"))
|
||||
ui->checkBox_helperClose->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->checkBox_helperClose->setCheckState(Qt::Unchecked);
|
||||
if (config[QString("CLOSETOTRAY")] == QString("true"))
|
||||
ui->checkBox_closeToTray->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->checkBox_closeToTray->setCheckState(Qt::Unchecked);
|
||||
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(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_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")]);
|
||||
ui->lineEdit_sudo->setText(settings[QString("SUDO_PATH")]);
|
||||
ui->lineEdit_wpaCliPath->setText(settings[QString("WPACLI_PATH")]);
|
||||
ui->lineEdit_wpaSupPath->setText(settings[QString("WPASUP_PATH")]);
|
||||
ui->lineEdit_wpaSupDrivers->setText(settings[QString("WPA_DRIVERS")]);
|
||||
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(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 (config[QString("USE_HELPER")] == QString("true"))
|
||||
ui->checkBox_useHelper->setCheckState(Qt::Checked);
|
||||
else
|
||||
ui->checkBox_useHelper->setCheckState(Qt::Unchecked);
|
||||
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<settings.keys().count(); i++)
|
||||
qDebug() << "[SettingsWindow]" << "[setSettings]" << ":" <<
|
||||
settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
|
||||
for (int i=0; i<config.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << config.keys()[i] + QString("=") +
|
||||
config[config.keys()[i]];
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> SettingsWindow::getDefault()
|
||||
{
|
||||
QMap<QString, QString> settings;
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
settings[QString("CTRL_DIR")] = QString("/run/wpa_supplicant_netctl-gui");
|
||||
settings[QString("CTRL_GROUP")] = QString("users");
|
||||
settings[QString("IFACE_DIR")] = QString("/sys/class/net/");
|
||||
settings[QString("LANGUAGE")] = QString("english");
|
||||
settings[QString("NETCTL_PATH")] = QString("/usr/bin/netctl");
|
||||
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("SUDO_PATH")] = QString("/usr/bin/kdesu");
|
||||
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++)
|
||||
qDebug() << "[SettingsWindow]" << "[getDefault]" << ":" <<
|
||||
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)
|
||||
{
|
||||
QMap<QString, QString> settings;
|
||||
QFile configFile(file);
|
||||
QString fileStr;
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (fileName == QString("")) fileName = file;
|
||||
|
||||
if (!configFile.open(QIODevice::ReadOnly))
|
||||
return getDefault();
|
||||
while (true) {
|
||||
fileStr = QString(configFile.readLine());
|
||||
if (fileStr[0] != '#') {
|
||||
if (fileStr.contains(QString("=")))
|
||||
settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1]
|
||||
.remove(QString(" "))
|
||||
.trimmed();
|
||||
}
|
||||
if (configFile.atEnd())
|
||||
break;
|
||||
}
|
||||
QMap<QString, QString> config;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
|
||||
configFile.close();
|
||||
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();
|
||||
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
qDebug() << "[SettingsWindow]" << "[getSettings]" << ":" <<
|
||||
settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
|
||||
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();
|
||||
|
||||
return settings;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::startHelper()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
((MainWindow *)parent())->startHelper();
|
||||
updateHelper();
|
||||
}
|
||||
|
||||
|
||||
void SettingsWindow::updateHelper()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (((MainWindow *)parent())->isHelperServiceActive()) {
|
||||
ui->label_status->setText(QApplication::translate("SettingsWindow", "Active (systemd)"));
|
||||
ui->pushButton_status->setText(QApplication::translate("SettingsWindow", "Stop"));
|
||||
ui->pushButton_status->setIcon(QIcon::fromTheme("process-stop"));
|
||||
ui->pushButton_status->setDisabled(true);
|
||||
} else if (((MainWindow *)parent())->isHelperActive()) {
|
||||
ui->label_status->setText(QApplication::translate("SettingsWindow", "Active"));
|
||||
ui->pushButton_status->setText(QApplication::translate("SettingsWindow", "Stop"));
|
||||
ui->pushButton_status->setIcon(QIcon::fromTheme("process-stop"));
|
||||
ui->pushButton_status->setEnabled(true);
|
||||
} else {
|
||||
ui->label_status->setText(QApplication::translate("SettingsWindow", "Inactive"));
|
||||
ui->pushButton_status->setText(QApplication::translate("SettingsWindow", "Start"));
|
||||
ui->pushButton_status->setIcon(QIcon::fromTheme("system-run"));
|
||||
ui->pushButton_status->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-plasmoid is free software: you can redistribute it and/or *
|
||||
* 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-plasmoid is distributed in the hope that it will be useful, *
|
||||
* 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef SETTINGSWINDOW_H
|
||||
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QMainWindow>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
|
||||
class MainWindow;
|
||||
@ -33,37 +34,38 @@ class SettingsWindow : public QMainWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SettingsWindow(MainWindow *wid = 0,
|
||||
explicit SettingsWindow(QWidget *parent = 0,
|
||||
const bool debugCmd = false,
|
||||
const QString configFile = QString(""));
|
||||
~SettingsWindow();
|
||||
QMap<QString, QString> getDefault();
|
||||
QMap<QString, QString> getSettings();
|
||||
QMap<QString, QString> getSettings(QString fileName = QString(""));
|
||||
|
||||
public slots:
|
||||
void closeWindow();
|
||||
void restoreSettings();
|
||||
void setDefault();
|
||||
void showWindow();
|
||||
|
||||
private slots:
|
||||
void addLanguages();
|
||||
void changePage(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||
void saveSettings();
|
||||
void setTray();
|
||||
void updateHelper();
|
||||
// buttons
|
||||
void selectIfaceDir();
|
||||
void selectNetctlPath();
|
||||
void selectProfileDir();
|
||||
void selectRfkillDir();
|
||||
void selectSudoPath();
|
||||
void selectWpaCliPath();
|
||||
void selectWpaSupPath();
|
||||
void selectAbstractSomething();
|
||||
void startHelper();
|
||||
|
||||
private:
|
||||
MainWindow *parent;
|
||||
bool debug;
|
||||
QString file;
|
||||
Ui::SettingsWindow *ui;
|
||||
void createActions();
|
||||
// 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,25 +6,141 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>461</width>
|
||||
<height>287</height>
|
||||
<width>678</width>
|
||||
<height>395</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="indentation">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="itemsExpandable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>General</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="preferences-system">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Helper</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../resources/resources.qrc">
|
||||
<normaloff>:/icon-helper.png</normaloff>:/icon-helper.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>netctl</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../resources/resources.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>sudo</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="gksu">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>wpa_supplicant</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../resources/resources.qrc">
|
||||
<normaloff>:/wifi.png</normaloff>:/wifi.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Other</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="configure">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_general">
|
||||
<attribute name="title">
|
||||
<string>General</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<widget class="QWidget" name="page_general">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_general">
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_general">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>462</width>
|
||||
<height>330</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_language">
|
||||
<item>
|
||||
@ -44,17 +160,202 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_info">
|
||||
<widget class="QCheckBox" name="checkBox_enableTray">
|
||||
<property name="text">
|
||||
<string>You will need to restart the application</string>
|
||||
<string>Enable system tray</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_closeToTray">
|
||||
<property name="text">
|
||||
<string>Minimize to tray instead of closing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_startToTray">
|
||||
<property name="text">
|
||||
<string>Start minimized to tray</string>
|
||||
</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">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>223</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_helper">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_helper">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>462</width>
|
||||
<height>330</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_helperInfo">
|
||||
<property name="text">
|
||||
<string>It is recommended to use systemd integration. See `man 1 netctlgui-helper` for more details.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_status">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_statusText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Helper status</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_status">
|
||||
<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="QLabel" name="label_status">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_status">
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="system-run">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_useHelper">
|
||||
<property name="text">
|
||||
<string>Use helper</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_forceSudo">
|
||||
<property name="text">
|
||||
<string>Force use sudo in helper</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_helperClose">
|
||||
<property name="text">
|
||||
<string>Close helper after exit (doesn't work while systemd service is active)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_helperPath">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_helperPath">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Helper command</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_helperPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_helperPath">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_helperService">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_helperService">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Helper service</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_helperService">
|
||||
<property name="toolTip">
|
||||
<string>Name of netctlgui-helper service</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_helper">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@ -68,11 +369,61 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_netctl">
|
||||
<attribute name="title">
|
||||
<string>netctl</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_netctl">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_netctl">
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_netctl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>173</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_systemctlPath">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_systemctlPath">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>systemctl path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_systemctlPath">
|
||||
<property name="toolTip">
|
||||
<string>Path to systemctl</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_systemctlPath">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_netctlPath">
|
||||
<item>
|
||||
@ -104,6 +455,61 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_netctlAutoPath">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_netctlAutoPath">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>netctl-auto path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_netctlAutoPath">
|
||||
<property name="toolTip">
|
||||
<string>Path to netctl-auto</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_netctlAutoPath">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_netctlAutoService">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_netctlAutoService">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>netctl-auto service</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_netctlAutoService">
|
||||
<property name="toolTip">
|
||||
<string>Name of netctl-auto systemd service</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_profilePath">
|
||||
<item>
|
||||
@ -142,19 +548,38 @@
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<width>424</width>
|
||||
<height>122</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_sudo">
|
||||
<attribute name="title">
|
||||
<string>sudo</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_sudo">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_sudo">
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_sudo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_sudo">
|
||||
<item>
|
||||
@ -193,19 +618,38 @@
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>192</height>
|
||||
<width>424</width>
|
||||
<height>244</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_wpaSup">
|
||||
<attribute name="title">
|
||||
<string>wpa_supplicant</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_wpaSup">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_wpaSup">
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_wpaSup">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>277</width>
|
||||
<height>194</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_wpaSupPath">
|
||||
<item>
|
||||
@ -372,18 +816,37 @@
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<height>66</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_other">
|
||||
<attribute name="title">
|
||||
<string>Other</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_other">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_other">
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_other">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>107</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_interfacesDir">
|
||||
<item>
|
||||
@ -407,7 +870,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_interfaceDir">
|
||||
<widget class="QPushButton" name="pushButton_interfacesDir">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
@ -477,8 +940,8 @@
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>130</height>
|
||||
<width>424</width>
|
||||
<height>184</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -487,16 +950,24 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset|QDialogButtonBox::RestoreDefaults</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../../resources/resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|