Compare commits
No commits in common. "master" and "V.1.0.4" have entirely different histories.
6
.gitignore
vendored
@ -14,16 +14,12 @@
|
|||||||
|
|
||||||
# Source archive
|
# Source archive
|
||||||
*.tar.xz
|
*.tar.xz
|
||||||
*.tar.gz
|
|
||||||
*.sig
|
|
||||||
|
|
||||||
# Build directory
|
# Build directory
|
||||||
build/
|
build/
|
||||||
|
sources/build/
|
||||||
tmp/
|
tmp/
|
||||||
usr/
|
|
||||||
|
|
||||||
# translations
|
# translations
|
||||||
*.qm
|
*.qm
|
||||||
|
|
||||||
# temporary bckps
|
|
||||||
*~
|
|
||||||
|
12
.gitmodules
vendored
@ -1,12 +0,0 @@
|
|||||||
[submodule "sources/3rdparty/tasks"]
|
|
||||||
path = sources/3rdparty/tasks
|
|
||||||
url = https://github.com/mhogomchungu/tasks.git
|
|
||||||
[submodule "sources/3rdparty/pdebug"]
|
|
||||||
path = sources/3rdparty/pdebug
|
|
||||||
url = https://github.com/arcan1s/qtadds-pdebug.git
|
|
||||||
[submodule "sources/3rdparty/language"]
|
|
||||||
path = sources/3rdparty/language
|
|
||||||
url = https://github.com/arcan1s/qtadds-language.git
|
|
||||||
[submodule "sources/3rdparty/task"]
|
|
||||||
path = sources/3rdparty/task
|
|
||||||
url = https://github.com/arcan1s/qtadds-taskadds-qprocess.git
|
|
3
AUTHORS
@ -1,5 +1,2 @@
|
|||||||
Current developers:
|
Current developers:
|
||||||
Evgeniy Alekseev aka arcanis <esalexeev (at) gmail (dot) com>
|
Evgeniy Alekseev aka arcanis <esalexeev (at) gmail (dot) com>
|
||||||
|
|
||||||
Translators:
|
|
||||||
@nosada (Japanese translation)
|
|
||||||
|
334
CHANGELOG
@ -1,327 +1,17 @@
|
|||||||
Ver.1.4.9
|
Ver.1.0.4:
|
||||||
---------
|
+ [gui] added Qt5 gui (by default)
|
||||||
* library
|
+ [plasmoid] added notifications
|
||||||
* fix bug with invalid enabled profile definition (#46)
|
* [plasmoid] fix run command with sudo from plasmoid
|
||||||
* some imrovements inside
|
|
||||||
* plasmoid
|
|
||||||
* change rendering from Qt to native
|
|
||||||
* update plasmoid to recent plasma changes
|
|
||||||
|
|
||||||
Ver.1.4.8
|
Ver.1.0.3:
|
||||||
---------
|
+ [plasmoid] edited russian translation
|
||||||
* gui
|
* [all] refactoring
|
||||||
* update profile tab to netclt 1.10 and 1.11 changes
|
|
||||||
* plasmoid
|
|
||||||
* fix bug with no action on link activation
|
|
||||||
|
|
||||||
Ver.1.4.7
|
Ver.1.0.2:
|
||||||
---------
|
* [plasmoid] fix layout margins
|
||||||
* all
|
|
||||||
+ implement support of setting of default configuration values while building
|
|
||||||
* fix language component (refer to #45)
|
|
||||||
* gui
|
|
||||||
* more correct work with configuration file
|
|
||||||
* helper
|
|
||||||
* more correct work with configuration file
|
|
||||||
|
|
||||||
Ver.1.4.6
|
Ver.1.0.1:
|
||||||
---------
|
- [all] removed scripts
|
||||||
* all
|
|
||||||
+ implement time logging feature
|
|
||||||
* gui
|
|
||||||
+ implement autoupdate feature
|
|
||||||
- fix invalid profile path for the external editor
|
|
||||||
* library
|
|
||||||
+ implement netctl-auto support to scanWiFi() method (#44)
|
|
||||||
- fix bug with invalid data in netctl-auto profile list output
|
|
||||||
|
|
||||||
Ver.1.4.5
|
Ver.1.0:
|
||||||
---------
|
|
||||||
* plasmoid
|
|
||||||
+ add translation support to plugin part
|
|
||||||
* more correct interface painting
|
|
||||||
* more correct configuration interface painting
|
|
||||||
* move plugin from private
|
|
||||||
|
|
||||||
Ver.1.4.4
|
|
||||||
---------
|
|
||||||
* dataengine
|
|
||||||
- fix profile status definition
|
|
||||||
|
|
||||||
Ver.1.4.3
|
|
||||||
---------
|
|
||||||
* all
|
|
||||||
- fix clang build (#41)
|
|
||||||
- fix WPA_DRIVERS (#40)
|
|
||||||
* library
|
|
||||||
- fix bug in WpaSup class with invalid returning value
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
Ver.1.4.2
|
|
||||||
---------
|
|
||||||
* gui
|
|
||||||
* remove Update call to the helper
|
|
||||||
|
|
||||||
Ver.1.4.1
|
|
||||||
---------
|
|
||||||
* all
|
|
||||||
+ some Easter eggs
|
|
||||||
+ add _DEFAULT_SOURCE to avoid gcc warnings
|
|
||||||
* refactoring
|
|
||||||
* fix cppcheck warnings
|
|
||||||
* update 3rdparty components
|
|
||||||
* fix language defilition
|
|
||||||
* replace General section to Common in settings (see http://doc.qt.io/qt-5/qsettings.html#Format-enum)
|
|
||||||
* gui
|
|
||||||
+ allow to change helper control group from UI (#36)
|
|
||||||
+ allow to open profile in an external editor (#38)
|
|
||||||
+ add IP validators (#34)
|
|
||||||
+ add toolbar configuration
|
|
||||||
+ add notification on hidding to tray
|
|
||||||
+ add returnPressed() signal to lineEdits
|
|
||||||
+ implement needToBeConfigured() signal
|
|
||||||
- remove margins
|
|
||||||
- fix bug with segfault on updating UI with KF5
|
|
||||||
* rewrite ErrorWindow class
|
|
||||||
* split MainWindow class
|
|
||||||
* update WiFi menu to new library functions
|
|
||||||
* improve UI (#25, #28)
|
|
||||||
* more correct component checking (#29, #37)
|
|
||||||
* more correct callbacks with exceptions
|
|
||||||
* dataengine
|
|
||||||
+ add desktop reconfiguration (#30)
|
|
||||||
* improve performance
|
|
||||||
* helper
|
|
||||||
+ add /interface interface
|
|
||||||
+ add /ctrl/{CurrentWiFi,VerboseWiFi} calls
|
|
||||||
+ add /netctl/VerboseProfiles call
|
|
||||||
+ add /netctl/{netctlActiveProfile,netctlProfileList,netctlVerboseProfileList) calls
|
|
||||||
* library
|
|
||||||
+ add NetctlInterface class
|
|
||||||
+ add WpaSup::CurrentWiFi method
|
|
||||||
+ append structures some additional information
|
|
||||||
+ mark Netctl::getProfileDescription() as deprecated
|
|
||||||
+ now WpaSup can connect to already created session (by default)
|
|
||||||
* improve performance
|
|
||||||
* plasmoid
|
|
||||||
+ add desktop reconfiguration (#30)
|
|
||||||
- remove legacy functions from KDE4 plasmoid
|
|
||||||
* improve performance of KF5 plasmoid (#26)
|
|
||||||
* test
|
|
||||||
* fix netctl tests
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
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
|
First release
|
||||||
|
48
PKGBUILD
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
||||||
|
|
||||||
|
# comment out needed line if you dont need this component
|
||||||
|
#_use_qt5=0
|
||||||
|
#_build_gui=0
|
||||||
|
#_build_plasmoid=0
|
||||||
|
|
||||||
|
pkgname=netctl-gui
|
||||||
|
pkgver=1.0.4
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Qt4/Qt5 GUI for netctl. Provides a plasmoid for KDE4"
|
||||||
|
arch=('i686' 'x86_64')
|
||||||
|
url="http://arcanis.name/projects/netctl-gui"
|
||||||
|
license=('GPLv3')
|
||||||
|
depends=('netctl' 'qt5-base')
|
||||||
|
makedepends=('automoc4' 'cmake' 'qt5-tools')
|
||||||
|
optdepends=('kdebase-runtime: sudo support'
|
||||||
|
'sudo: sudo support'
|
||||||
|
'wpa_supplicant: wifi support')
|
||||||
|
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgname}-${pkgver}-src.tar.xz")
|
||||||
|
install="${pkgname}.install"
|
||||||
|
md5sums=('1e790c31d135b91c7ec80791508e6e92')
|
||||||
|
|
||||||
|
# flags
|
||||||
|
_cmakekeys="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release"
|
||||||
|
if [[ ${_use_qt5} == 0 ]]; then
|
||||||
|
_cmakekeys=${_cmakekeys}" -DUSE_QT5:BOOL=0"
|
||||||
|
depends=('netctl' 'qt4')
|
||||||
|
makedepends=('automoc4' 'cmake' 'desktop-file-utils' 'xdg-utils')
|
||||||
|
fi
|
||||||
|
[[ ${_build_gui} == 0 ]] && _cmakekeys=${_cmakekeys}" -DBUILD_GUI:BOOL=0"
|
||||||
|
[[ ${_build_plasmoid} == 0 ]] && _cmakekeys=${_cmakekeys}" -DBUILD_DATAENGINE:BOOL=0 -DBUILD_PLASMOID:BOOL=0" || depends+=('kdebase-workspace')
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
rm -rf "${srcdir}/build"
|
||||||
|
mkdir "${srcdir}/build"
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "${srcdir}/build"
|
||||||
|
cmake ${_cmakekeys} "../${pkgname}"
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "${srcdir}/build"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
64
README.md
@ -3,48 +3,43 @@ Netctl GUI
|
|||||||
|
|
||||||
Information
|
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!
|
||||||
|
|
||||||
**NOTE** [LOOKING FOR TRANSLATORS!](https://github.com/arcan1s/netctl-gui/issues/3)
|
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
It is recommended to use graphical interface for widget configuration. DataEngine settings are stored in `/usr/share/config/netctl.conf`:
|
||||||
|
|
||||||
It is recommended to use graphical interface for configuration. Configuration files are:
|
* `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`.
|
||||||
|
|
||||||
* `$HOME/.config/netctl-gui.conf` - GUI/helper user configuration
|
All settings of GUI are stored in `$HOME/.config/netctl-gui.conf`. It is highly recommended to edit it from graphical interface.
|
||||||
* `/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
|
Instruction
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* netctl
|
* netctl
|
||||||
* qt5-base (if Qt5 is used) or qt4 (if Qt4 is used)
|
* qt4
|
||||||
|
|
||||||
Optional dependencies
|
Optional dependencies
|
||||||
---------------------
|
---------------------
|
||||||
|
* kdebase-workspace (widget)
|
||||||
* kdebase-workspace (KDE4 widget)
|
|
||||||
* plasma-framework (KF5 widget)
|
|
||||||
* sudo (sudo support)
|
* sudo (sudo support)
|
||||||
* wpa_supplicant (WiFi support)
|
* wpa_supplicant (WiFi support)
|
||||||
|
|
||||||
Make dependencies
|
Make dependencies
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
* automoc4
|
* automoc4
|
||||||
* cmake
|
* cmake
|
||||||
* qt5-tools (if Qt5 is used)
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* download sources
|
* download sources
|
||||||
* extract it and install the application:
|
* extract it and install the application:
|
||||||
|
|
||||||
@ -54,33 +49,26 @@ Installation
|
|||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
Available cmake flags:
|
If you want install it without KDE widget just run:
|
||||||
|
|
||||||
* components:
|
cd /path/to/extracted/archive
|
||||||
* `-DBUILD_DATAENGINE:BOOL=0` - do not build DataEngine
|
mkdir build && cd build
|
||||||
* `-DBUILD_GUI:BOOL=0` - do not build GUI
|
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_DATAENGINE:BOOL=0 -DBUILD_PLASMOID:BOOL=0 ../
|
||||||
* `-DBUILD_HELPER:BOOL=0` - do not build helper daemon
|
make
|
||||||
* `-DBUILD_LIBRARY:BOOL=0` - do not build library
|
sudo make install
|
||||||
* `-DBUILD_PLASMOID:BOOL=0` - do not build Plasmoid
|
|
||||||
* additional components:
|
If you want install it without GUI run:
|
||||||
* `-DBUILD_DOCS:BOOL=0` - do not build developer documentation
|
|
||||||
* `-DBUILD_TEST:BOOL=1` - build auto tests for the library and the helper
|
cd /path/to/extracted/archive
|
||||||
* project properties:
|
mkdir build && cd build
|
||||||
* `-DDBUS_SYSTEMCONF_PATH=/etc/dbus-1/system.d/` - path to dbus system configuration files
|
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI:BOOL=0 ../
|
||||||
* `-DSYSTEMD_SERVICE_PATH=lib/systemd/system` - path to systemd services
|
make
|
||||||
* `-DUSE_CAPABILITIES:BOOL=0` - do not use setcap to get privileges to the helper
|
sudo make install
|
||||||
* `-DBUILD_KDE4:BOOL=1` - build KDE4 plasmoid instead of KF5 one
|
|
||||||
* `-DUSE_QT5:BOOL=0` - use Qt4 instead of Qt5 for GUI
|
|
||||||
|
|
||||||
Additional information
|
Additional information
|
||||||
======================
|
======================
|
||||||
|
|
||||||
TODO (wish list)
|
|
||||||
----------------
|
|
||||||
|
|
||||||
Links
|
Links
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* [Homepage](http://arcanis.name/projects/netctl-gui)
|
* [Homepage](http://arcanis.name/projects/netctl-gui)
|
||||||
* Page on [kde-apps](http://kde-apps.org/content/show.php?content=164490)
|
* Archlinux [AUR](https://aur.archlinux.org/packages/netctl-gui) package
|
||||||
* Archlinux [AUR](https://aur.archlinux.org/pkgbase/netctl-gui/) package
|
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
# 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.9
|
|
||||||
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=('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=('64c04c36eea017e7c0ddf687d60de128')
|
|
||||||
|
|
||||||
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=${pkgver}")
|
|
||||||
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=${pkgver}" 'xdg-utils')
|
|
||||||
optdepends=('plasma-netctl-gui: KF5 widget'
|
|
||||||
'netctlgui-helper: DBus helper daemon')
|
|
||||||
provides=('netctl-gui-qt4')
|
|
||||||
conflicts=('netctl-gui-qt4')
|
|
||||||
install="netctl-gui.install"
|
|
||||||
|
|
||||||
cd "${srcdir}/build-qt5/gui"
|
|
||||||
make DESTDIR="${pkgdir}" install
|
|
||||||
cd "${srcdir}/build-qt5/resources"
|
|
||||||
make DESTDIR="${pkgdir}" install
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
|
||||||
|
|
||||||
pkgbase=netctl-gui-qt4
|
|
||||||
_pkgbase=netctl-gui
|
|
||||||
pkgname=('libnetctlgui-qt4' 'netctlgui-helper-qt4' 'netctl-gui-qt4'
|
|
||||||
'kdeplasma-applets-netctl-gui')
|
|
||||||
pkgver=1.4.9
|
|
||||||
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=('64c04c36eea017e7c0ddf687d60de128')
|
|
||||||
|
|
||||||
|
|
||||||
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')
|
|
||||||
|
|
||||||
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=${pkgver}")
|
|
||||||
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=${pkgver}")
|
|
||||||
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
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
post_install() {
|
|
||||||
cat << EOF
|
|
||||||
Update plasmoids...
|
|
||||||
EOF
|
|
||||||
kbuildsycoca4 > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
post_upgrade() {
|
|
||||||
post_install "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
post_remove() {
|
|
||||||
post_install "$1"
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
post_install() {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
post_upgrade() {
|
|
||||||
post_install "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
post_remove() {
|
|
||||||
post_install "$1"
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
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"
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
post_install() {
|
|
||||||
cat << EOF
|
|
||||||
Update plasmoids...
|
|
||||||
EOF
|
|
||||||
kbuildsycoca5 > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
post_upgrade() {
|
|
||||||
post_install "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
post_remove() {
|
|
||||||
post_install "$1"
|
|
||||||
}
|
|
@ -1,30 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SRCDIR="sources"
|
|
||||||
MAJOR=$(grep -m1 PROJECT_VERSION_MAJOR ${SRCDIR}/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
|
||||||
MINOR=$(grep -m1 PROJECT_VERSION_MINOR ${SRCDIR}/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
|
||||||
PATCH=$(grep -m1 PROJECT_VERSION_PATCH ${SRCDIR}/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
|
||||||
VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
|
||||||
|
|
||||||
ARCHIVE="netctl-gui"
|
ARCHIVE="netctl-gui"
|
||||||
|
SRCDIR="sources"
|
||||||
FILES="AUTHORS CHANGELOG COPYING README.md"
|
FILES="AUTHORS CHANGELOG COPYING README.md"
|
||||||
IGNORELIST="build *.qm *.cppcheck .git* *.kdev4"
|
IGNORELIST="gui/resources/translations/english.qm gui/resources/translations/russian.qm"
|
||||||
# update submodules
|
VERSION=$(grep -m1 PROJECT_VERSION_MAJOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\
|
||||||
git submodule update --init --recursive
|
$(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)
|
||||||
|
|
||||||
# create archive
|
# create archive
|
||||||
[[ -e ${ARCHIVE}-${VERSION}-src.tar.xz ]] && rm -f "${ARCHIVE}-${VERSION}-src.tar.xz"
|
[[ -e ${ARCHIVE}-${VERSION}-src.tar.xz ]] && rm -f "${ARCHIVE}-${VERSION}-src.tar.xz"
|
||||||
[[ -d ${ARCHIVE} ]] && rm -rf "${ARCHIVE}"
|
[[ -d ${ARCHIVE} ]] && rm -rf "${ARCHIVE}"
|
||||||
cp -r "${SRCDIR}" "${ARCHIVE}"
|
cp -r "${SRCDIR}" "${ARCHIVE}"
|
||||||
for FILE in ${FILES[*]}; do cp -r "$FILE" "${ARCHIVE}"; done
|
for FILE in ${FILES[*]}; do cp -r "$FILE" "${ARCHIVE}"; done
|
||||||
for FILE in ${IGNORELIST[*]}; do find "${ARCHIVE}" -name "${FILE}" -delete; done
|
for FILE in ${IGNORELIST[*]}; do rm -f "${ARCHIVE}/${FILE}"; done
|
||||||
tar cJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}"
|
tar cvJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}" > /dev/null
|
||||||
ln -sf "../${ARCHIVE}-${VERSION}-src.tar.xz" arch
|
|
||||||
rm -rf "${ARCHIVE}"
|
rm -rf "${ARCHIVE}"
|
||||||
|
|
||||||
# update md5sum
|
# update md5sum
|
||||||
MD5SUMS=$(md5sum ${ARCHIVE}-${VERSION}-src.tar.xz | awk '{print $1}')
|
MD5SUMS=$(md5sum ${ARCHIVE}-${VERSION}-src.tar.xz | awk '{print $1}')
|
||||||
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" arch/PKGBUILD{,-qt4}
|
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" PKGBUILD
|
||||||
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" arch/PKGBUILD{,-qt4}
|
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD
|
||||||
# clear
|
|
||||||
find . -type f -name '*src.tar.xz' -not -name "*${VERSION}-src.tar.xz" -delete
|
|
||||||
find arch -type l -xtype l -delete
|
|
||||||
|
@ -4,9 +4,9 @@ post_install() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
post_upgrade() {
|
post_upgrade() {
|
||||||
post_install "$1"
|
post_install
|
||||||
}
|
}
|
||||||
|
|
||||||
post_remove() {
|
post_remove() {
|
||||||
post_install "$1"
|
post_install
|
||||||
}
|
}
|
BIN
screenshots/configuration_01.png
Normal file
After Width: | Height: | Size: 147 KiB |
BIN
screenshots/configuration_02.png
Normal file
After Width: | Height: | Size: 133 KiB |
BIN
screenshots/dataengine.png
Normal file
After Width: | Height: | Size: 108 KiB |
Before Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 31 KiB |
BIN
screenshots/gui_profile_general.png
Normal file
After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 114 KiB |
BIN
screenshots/plasmoid.png
Normal file
After Width: | Height: | Size: 100 KiB |
@ -1,23 +0,0 @@
|
|||||||
[Buildset]
|
|
||||||
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x14\x00n\x00e\x00t\x00c\x00t\x00l\x00-\x00g\x00u\x00i)
|
|
||||||
|
|
||||||
[CMake]
|
|
||||||
Build Directory Count=1
|
|
||||||
Current Build Directory Index=0
|
|
||||||
ProjectRootRelative=./
|
|
||||||
|
|
||||||
[CMake][CMake Build Directory 0]
|
|
||||||
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
|
|
||||||
Build Type=Release
|
|
||||||
CMake Binary=file:///usr/bin/cmake
|
|
||||||
Environment Profile=
|
|
||||||
Extra Arguments=
|
|
||||||
Install Directory=file:///usr
|
|
||||||
|
|
||||||
[Defines And Includes][Compiler]
|
|
||||||
Name=GCC
|
|
||||||
Path=gcc
|
|
||||||
Type=GCC
|
|
||||||
|
|
||||||
[Project]
|
|
||||||
VersionControlSupport=kdevgit
|
|
@ -1,23 +0,0 @@
|
|||||||
[Buildset]
|
|
||||||
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x14\x00n\x00e\x00t\x00c\x00t\x00l\x00-\x00g\x00u\x00i)
|
|
||||||
|
|
||||||
[CMake]
|
|
||||||
Build Directory Count=1
|
|
||||||
Current Build Directory Index=0
|
|
||||||
ProjectRootRelative=./
|
|
||||||
|
|
||||||
[CMake][CMake Build Directory 0]
|
|
||||||
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
|
|
||||||
Build Type=Debug
|
|
||||||
CMake Binary=file:///usr/bin/cmake
|
|
||||||
Environment Profile=
|
|
||||||
Extra Arguments=
|
|
||||||
Install Directory=file:///usr
|
|
||||||
|
|
||||||
[Defines And Includes][Compiler]
|
|
||||||
Name=GCC
|
|
||||||
Path=gcc
|
|
||||||
Type=GCC
|
|
||||||
|
|
||||||
[Project]
|
|
||||||
VersionControlSupport=kdevgit
|
|
218
sources/3rdparty/about/about.ui
vendored
@ -1,218 +0,0 @@
|
|||||||
<?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
@ -1 +0,0 @@
|
|||||||
Subproject commit 319125b1fafff9da14c89a94de6ba2852c90c9c2
|
|
14
sources/3rdparty/language-config.h
vendored
@ -1,14 +0,0 @@
|
|||||||
#ifndef LANGUAGE_CONFIG_H
|
|
||||||
#define LANGUAGE_CONFIG_H
|
|
||||||
|
|
||||||
|
|
||||||
// put your languages here comma separated
|
|
||||||
// the first language is default language
|
|
||||||
#define LANGUAGES "en,ja,ru"
|
|
||||||
// language key in the configuration file
|
|
||||||
#define LANGUAGE_KEY "LANGUAGE"
|
|
||||||
// name of config section in the file if any
|
|
||||||
#define LANGUAGE_SECTION "Common"
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* LANGUAGE_CONFIG_H */
|
|
41
sources/3rdparty/listmap/listmap.cpp
vendored
@ -1,41 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "listmap.h"
|
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> listToMap(const QStringList list)
|
|
||||||
{
|
|
||||||
QMap<QString, QString> map;
|
|
||||||
for (int i=0; i<list.count(); i++) {
|
|
||||||
QStringList str = list[i].split(QString("=="));
|
|
||||||
if (str.count() != 2) continue;
|
|
||||||
map[str[0]] = str[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList mapToList(const QMap<QString, QString> map)
|
|
||||||
{
|
|
||||||
QStringList list;
|
|
||||||
for (int i=0; i<map.keys().count(); i++)
|
|
||||||
list.append(QString("%1==%2").arg(map.keys()[i]).arg(map[map.keys()[i]]));
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
29
sources/3rdparty/listmap/listmap.h
vendored
@ -1,29 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef LISTMAP_H
|
|
||||||
#define LISTMAP_H
|
|
||||||
|
|
||||||
#include <QMap>
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> listToMap(const QStringList list);
|
|
||||||
QStringList mapToList(const QMap<QString,QString> map);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* LISTMAP_H */
|
|
1
sources/3rdparty/pdebug
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit 75e4a0df83478802bba53345486b42c56713fe09
|
|
1
sources/3rdparty/task
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit dd52af08c9d6a2c8652d2d5e21bc2a433efb497a
|
|
1
sources/3rdparty/tasks
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit 36f7ac299633e96f246fec160939207257ae0097
|
|
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required (VERSION 2.8.12)
|
cmake_minimum_required (VERSION 2.8)
|
||||||
|
|
||||||
cmake_policy (SET CMP0003 OLD)
|
cmake_policy (SET CMP0003 OLD)
|
||||||
cmake_policy (SET CMP0002 OLD)
|
cmake_policy (SET CMP0002 OLD)
|
||||||
@ -6,90 +6,36 @@ cmake_policy (SET CMP0011 NEW)
|
|||||||
cmake_policy (SET CMP0015 NEW)
|
cmake_policy (SET CMP0015 NEW)
|
||||||
|
|
||||||
project (netctl-gui)
|
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_MAJOR 1)
|
||||||
set (PROJECT_VERSION_MINOR 4)
|
set (PROJECT_VERSION_MINOR 0)
|
||||||
set (PROJECT_VERSION_PATCH 9)
|
set (PROJECT_VERSION_PATCH 4)
|
||||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||||
string (TIMESTAMP CURRENT_YEAR "%Y")
|
|
||||||
|
|
||||||
message (STATUS "Project: ${PROJECT_NAME}")
|
|
||||||
message (STATUS "Version: ${PROJECT_VERSION}")
|
message (STATUS "Version: ${PROJECT_VERSION}")
|
||||||
message (STATUS "Build date: ${CURRENT_DATE}")
|
|
||||||
|
|
||||||
# install options
|
# install options
|
||||||
option (USE_CAPABILITIES "Use setcap to set capabilities for the helper" ON)
|
|
||||||
option (USE_QT5 "Use Qt5 instead of Qt4" ON)
|
option (USE_QT5 "Use Qt5 instead of Qt4" ON)
|
||||||
# configuration
|
|
||||||
include (config-defs.cmake)
|
|
||||||
# components
|
|
||||||
option (BUILD_GUI "Build GUI" ON)
|
option (BUILD_GUI "Build GUI" ON)
|
||||||
option (BUILD_HELPER "Build helper" ON)
|
option (BUILD_DATAENGINE "Build data engine" ON)
|
||||||
option (BUILD_LIBRARY "Build library" ON)
|
|
||||||
option (BUILD_DATAENGINE "Build DataEngine" ON)
|
|
||||||
option (BUILD_PLASMOID "Build plasmoid" 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
|
# flags
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set (CMAKE_CXX_FLAGS "-Wall -std=c++11")
|
set (ADD_CXX_FLAGS "-Wall")
|
||||||
|
set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}")
|
||||||
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||||
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||||
# avoid newer gcc warnings
|
|
||||||
add_definitions (-D_DEFAULT_SOURCE)
|
|
||||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
||||||
set (CMAKE_CXX_FLAGS "-Wall -std=c++11 -stdlib=libc++")
|
|
||||||
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
|
||||||
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
|
||||||
# linker flags
|
|
||||||
set (CMAKE_EXE_LINKER_FLAGS "-lc++abi")
|
|
||||||
set (CMAKE_MODULE_LINKER_FLAGS "-lc++abi")
|
|
||||||
set (CMAKE_SHARED_LINKER_FLAGS "-lc++abi")
|
|
||||||
else ()
|
else ()
|
||||||
message (STATUS "Unknown compiler")
|
message (STATUS "Unknown compiler")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
add_subdirectory (icons)
|
||||||
|
|
||||||
# resources
|
if (BUILD_PLASMOID)
|
||||||
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
|
set (BUILD_DATAENGINE ON)
|
||||||
set (PROJECT_LIBRARY netctlgui)
|
endif ()
|
||||||
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)
|
if (BUILD_GUI)
|
||||||
add_subdirectory (gui)
|
add_subdirectory (gui)
|
||||||
endif ()
|
endif ()
|
||||||
@ -97,9 +43,5 @@ if (BUILD_DATAENGINE)
|
|||||||
add_subdirectory (dataengine)
|
add_subdirectory (dataengine)
|
||||||
endif ()
|
endif ()
|
||||||
if (BUILD_PLASMOID)
|
if (BUILD_PLASMOID)
|
||||||
if (BUILD_KDE4)
|
add_subdirectory (plasmoid)
|
||||||
add_subdirectory (plasmoid-kde4)
|
|
||||||
else ()
|
|
||||||
add_subdirectory (plasmoid-kf5)
|
|
||||||
endif (BUILD_KDE4)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
# default configuration options
|
|
||||||
|
|
||||||
# [Common] section
|
|
||||||
set (CFG_LANGUAGE "en" CACHE STRING "LANGUAGE key")
|
|
||||||
set (CFG_MAINUPDATE "0" CACHE STRING "MAINUPDATE key")
|
|
||||||
set (CFG_WIFIUPDATE "0" CACHE STRING "WIFIUPDATE key")
|
|
||||||
set (CFG_SYSTRAY "true" CACHE STRING "SYSTRAY key")
|
|
||||||
set (CFG_CLOSETOTRAY "true" CACHE STRING "CLOSETOTRAY key")
|
|
||||||
set (CFG_STARTTOTRAY "false" CACHE STRING "STARTTOTRAY key")
|
|
||||||
set (CFG_SKIPCOMPONENTS "false" CACHE STRING "SKIPCOMPONENTS key")
|
|
||||||
|
|
||||||
# [Helper] section
|
|
||||||
set (CFG_USE_HELPER "true" CACHE STRING "USE_HELPER key")
|
|
||||||
set (CFG_FORCE_SUDO "false" CACHE STRING "FORCE_SUDO key")
|
|
||||||
set (CFG_CLOSE_HELPER "false" CACHE STRING "CLOSE_HELPER key")
|
|
||||||
set (CFG_HELPER_PATH "netctlgui-helper" CACHE STRING "HELPER_PATH key")
|
|
||||||
set (CFG_HELPER_SERVICE "netctlgui-helper.service" CACHE STRING "HELPER_SERVICE key")
|
|
||||||
|
|
||||||
# [netctl] section
|
|
||||||
set (CFG_SYSTEMCTL_PATH "systemctl" CACHE STRING "SYSTEMCTL_PATH key")
|
|
||||||
set (CFG_NETCTL_PATH "netctl" CACHE STRING "NETCTL_PATH key")
|
|
||||||
set (CFG_NETCTLAUTO_PATH "netctl-auto" CACHE STRING "NETCTLAUTO_PATH key")
|
|
||||||
set (CFG_NETCTLAUTO_SERVICE "netctl-auto" CACHE STRING "NETCTLAUTO_SERVICE key")
|
|
||||||
set (CFG_PROFILE_DIR "/etc/netctl/" CACHE STRING "PROFILE_DIR key")
|
|
||||||
|
|
||||||
# [sudo] section
|
|
||||||
set (CFG_SUDO_PATH "kdesu" CACHE STRING "SUDO_PATH key")
|
|
||||||
|
|
||||||
# [wpa_supplicant] section
|
|
||||||
set (CFG_WPASUP_PATH "wpa_supplicant" CACHE STRING "WPASUP_PATH key")
|
|
||||||
set (CFG_WPACLI_PATH "wpa_cli" CACHE STRING "WPACLI_PATH key")
|
|
||||||
set (CFG_PID_FILE "/run/wpa_supplicant_$i.pid" CACHE STRING "PID_FILE key")
|
|
||||||
set (CFG_WPA_DRIVERS "nl80211,wext" CACHE STRING "WPA_DRIVERS key")
|
|
||||||
set (CFG_CTRL_DIR "/run/wpa_supplicant" CACHE STRING "CTRL_DIR key")
|
|
||||||
set (CFG_CTRL_GROUP "users" CACHE STRING "CTRL_GROUP key")
|
|
||||||
|
|
||||||
# [Other] section
|
|
||||||
set (CFG_EDITOR_PATH "gvim" CACHE STRING "EDITOR_PATH key")
|
|
||||||
set (CFG_IFACE_DIR "/sys/class/net/" CACHE STRING "IFACE_DIR key")
|
|
||||||
set (CFG_RFKILL_DIR "/sys/class/rfkill/" CACHE STRING "RFKILL_DIR key")
|
|
||||||
set (CFG_PREFERED_IFACE "" CACHE STRING "PREFERED_IFACE key")
|
|
@ -3,71 +3,26 @@ set (SUBPROJECT plasma_engine_netctl)
|
|||||||
message (STATUS "Subproject ${SUBPROJECT}")
|
message (STATUS "Subproject ${SUBPROJECT}")
|
||||||
|
|
||||||
# find required libaries
|
# find required libaries
|
||||||
if (BUILD_KDE4)
|
find_package (KDE4 REQUIRED)
|
||||||
find_package (KDE4 REQUIRED)
|
include (KDE4Defaults)
|
||||||
include (KDE4Defaults)
|
|
||||||
|
|
||||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||||
set (KDE_INCLUDE ${KDE4_INCLUDES})
|
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../)
|
||||||
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})
|
set (PLUGIN_NAME ${SUBPROJECT})
|
||||||
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||||
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||||
if (BUILD_KDE4)
|
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
||||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
|
||||||
else ()
|
|
||||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
|
||||||
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
|
|
||||||
endif ()
|
|
||||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
|
||||||
file (GLOB SUBPROJECT_CONF *.conf)
|
file (GLOB SUBPROJECT_CONF *.conf)
|
||||||
|
|
||||||
# prepare
|
# prepare
|
||||||
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||||
|
|
||||||
# make
|
# make
|
||||||
if (BUILD_KDE4)
|
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE})
|
||||||
qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS})
|
||||||
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
|
||||||
if (BUILD_KDE4)
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||||
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 ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||||
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||||
|
18
sources/dataengine/netctl.conf
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# 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
|
||||||
|
|
@ -18,26 +18,9 @@
|
|||||||
#include "netctl.h"
|
#include "netctl.h"
|
||||||
|
|
||||||
#include <Plasma/DataContainer>
|
#include <Plasma/DataContainer>
|
||||||
|
#include <QDir>
|
||||||
#include <QDebug>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QNetworkInterface>
|
#include <QProcess>
|
||||||
#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>
|
|
||||||
#include <pdebug/pdebug-time.h>
|
|
||||||
#endif /* BUILD_KDE4 */
|
|
||||||
|
|
||||||
|
|
||||||
Netctl::Netctl(QObject *parent, const QVariantList &args)
|
Netctl::Netctl(QObject *parent, const QVariantList &args)
|
||||||
@ -45,258 +28,190 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(args)
|
Q_UNUSED(args)
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
qInstallMessageHandler(debugString);
|
|
||||||
#endif /* QT_VERSION >= 0x050000 */
|
|
||||||
// debug
|
|
||||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
|
||||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
|
||||||
debug = (debugEnv == QString("yes"));
|
|
||||||
|
|
||||||
setMinimumPollingInterval(333);
|
setMinimumPollingInterval(333);
|
||||||
readConfiguration();
|
readConfiguration();
|
||||||
initSources();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Netctl::~Netctl()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList Netctl::sources() const
|
QStringList Netctl::sources() const
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList sources;
|
QStringList sources;
|
||||||
sources.append(QString("active"));
|
|
||||||
sources.append(QString("current"));
|
sources.append(QString("currentProfile"));
|
||||||
sources.append(QString("extip4"));
|
sources.append(QString("extIp"));
|
||||||
sources.append(QString("extip6"));
|
|
||||||
sources.append(QString("info"));
|
|
||||||
sources.append(QString("interfaces"));
|
sources.append(QString("interfaces"));
|
||||||
sources.append(QString("intip4"));
|
sources.append(QString("intIp"));
|
||||||
sources.append(QString("intip6"));
|
|
||||||
sources.append(QString("netctlauto"));
|
|
||||||
sources.append(QString("profiles"));
|
sources.append(QString("profiles"));
|
||||||
sources.append(QString("status"));
|
sources.append(QString("statusBool"));
|
||||||
|
sources.append(QString("statusString"));
|
||||||
|
|
||||||
return sources;
|
return sources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString Netctl::getCmdOutput(const QString cmd) const
|
bool Netctl::readConfiguration()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
// default configuration
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
configuration[QString("CMD")] = QString("/usr/bin/netctl");
|
||||||
|
configuration[QString("EXTIP")] = QString("false");
|
||||||
|
configuration[QString("EXTIPCMD")] = QString("wget -qO- http://ifconfig.me/ip");
|
||||||
|
configuration[QString("IPCMD")] = QString("/usr/bin/ip");
|
||||||
|
configuration[QString("NETDIR")] = QString("/sys/class/net/");
|
||||||
|
|
||||||
TaskResult process = runTask(cmd);
|
QString fileStr;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
// FIXME: define configuration file
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
return QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
while (true) {
|
||||||
}
|
fileStr = QString(confFile.readLine());
|
||||||
|
if (fileStr[0] != '#') {
|
||||||
|
if (fileStr.contains(QString("=")))
|
||||||
|
configuration[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1]
|
||||||
|
.remove(QString(" "))
|
||||||
|
.trimmed();
|
||||||
|
}
|
||||||
|
if (confFile.atEnd())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
confFile.close();
|
||||||
void Netctl::readConfiguration()
|
return true;
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
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("netctl"));
|
|
||||||
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("netctl-auto"));
|
|
||||||
settings.endGroup();
|
|
||||||
|
|
||||||
settings.beginGroup(QString("External IP"));
|
|
||||||
configuration[QString("EXTIP4")] = settings.value(QString("EXTIP4"), QString("false"));
|
|
||||||
configuration[QString("EXTIP4CMD")] = settings.value(QString("EXTIP4CMD"), QString("curl ip4.telize.com"));
|
|
||||||
configuration[QString("EXTIP6")] = settings.value(QString("EXTIP6"), QString("false"));
|
|
||||||
configuration[QString("EXTIP6CMD")] = settings.value(QString("EXTIP6CMD"), QString("curl ip6.telize.com"));
|
|
||||||
settings.endGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Netctl::sourceRequestEvent(const QString &name)
|
bool Netctl::sourceRequestEvent(const QString &name)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Source name" << name;
|
|
||||||
|
|
||||||
return updateSourceEvent(name);
|
return updateSourceEvent(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString Netctl::getExtIp(const QString cmd) const
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
|
||||||
|
|
||||||
return getCmdOutput(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString Netctl::getInfo(const QStringList profiles, const QStringList statuses) const
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (profiles.count() != statuses.count()) return QString("N\\A");
|
|
||||||
|
|
||||||
QStringList list;
|
|
||||||
for (int i=0; i<profiles.count(); i++)
|
|
||||||
list.append(QString("%1 (%2)").arg(profiles.at(i)).arg(statuses.at(i)));
|
|
||||||
if (list.isEmpty()) list.append(QString("N\\A"));
|
|
||||||
|
|
||||||
return list.join(QString(" | "));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList Netctl::getInterfaceList() const
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QList<QNetworkInterface> rawList = QNetworkInterface::allInterfaces();
|
|
||||||
QStringList interfacesList;
|
|
||||||
foreach(QNetworkInterface interface, rawList)
|
|
||||||
interfacesList.append(interface.name());
|
|
||||||
|
|
||||||
return interfacesList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString Netctl::getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol) const
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
foreach(QHostAddress address, rawList) {
|
|
||||||
if (address == QHostAddress(QHostAddress::LocalHost)) continue;
|
|
||||||
if (address == QHostAddress(QHostAddress::LocalHostIPv6)) continue;
|
|
||||||
if (address.protocol() != protocol) continue;
|
|
||||||
intIp = address.toString();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return intIp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList Netctl::getProfileList(const QString cmdNetctl, const QString cmdNetctlAuto)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QString output = getCmdOutput(QString("%1 list").arg(cmdNetctlAuto));
|
|
||||||
if (output.isEmpty()) {
|
|
||||||
output = getCmdOutput(QString("%1 list").arg(cmdNetctl));
|
|
||||||
netctlAutoStatus = false;
|
|
||||||
} else
|
|
||||||
netctlAutoStatus = true;
|
|
||||||
|
|
||||||
// parse
|
|
||||||
QStringList currentProfiles;
|
|
||||||
// workaround for first element spaces on which are trimmed
|
|
||||||
QStringList profileList = QString(" %1").arg(output).split(QChar('\n'));
|
|
||||||
for (int i=0; i<profileList.count(); i++) {
|
|
||||||
bool isActive = (profileList.at(i)[0] == QChar('*'));
|
|
||||||
profileList[i].remove(0, 2);
|
|
||||||
if (isActive) currentProfiles.append(profileList.at(i));
|
|
||||||
}
|
|
||||||
profileList.sort();
|
|
||||||
currentProfiles.sort();
|
|
||||||
|
|
||||||
// return profiles
|
|
||||||
currentProfile = currentProfiles;
|
|
||||||
status = !currentProfiles.isEmpty();
|
|
||||||
return profileList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList Netctl::getProfileStringStatus(const QString cmdNetctl) const
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList status;
|
|
||||||
if (netctlAutoStatus) {
|
|
||||||
status.append(QString("netctl-auto"));
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach(QString profile, currentProfile) {
|
|
||||||
TaskResult process = runTask(QString("%1 is-enabled %2").arg(cmdNetctl).arg(profile));
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
|
||||||
status.append(process.exitCode == 0 ? QString("enabled") : QString("static"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Netctl::initSources()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList sourcesList = sources();
|
|
||||||
foreach(QString source, sourcesList)
|
|
||||||
setData(source, QString("value"), QString("N\\A"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Netctl::updateSourceEvent(const QString &source)
|
bool Netctl::updateSourceEvent(const QString &source)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
QProcess command;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Source name" << source;
|
QString cmdOutput = QString("");
|
||||||
|
QString value = QString("");
|
||||||
|
|
||||||
QString value = QString("N\\A");
|
if (source == QString("currentProfile")) {
|
||||||
if (source == QString("active")) {
|
command.start(configuration[QString("CMD")] + QString(" list"));
|
||||||
value = status ? QString("true") : QString("false");
|
command.waitForFinished(-1);
|
||||||
} else if (source == QString("current")) {
|
cmdOutput = command.readAllStandardOutput();
|
||||||
value = currentProfile.join(QChar('|'));
|
if (!cmdOutput.isEmpty()) {
|
||||||
} else if (source == QString("extip4")) {
|
QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
|
||||||
if (configuration[QString("EXTIP4")].toString() == QString("true"))
|
for (int i=0; i<profileList.count(); i++)
|
||||||
value = getExtIp(configuration[QString("EXTIP4CMD")].toString());
|
if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) {
|
||||||
} else if (source == QString("extip6")) {
|
value = profileList[i].split(QString(" "), QString::SkipEmptyParts)[1];
|
||||||
if (configuration[QString("EXTIP6")].toString() == QString("true"))
|
break;
|
||||||
value = getExtIp(configuration[QString("EXTIP6CMD")].toString());
|
}
|
||||||
} else if (source == QString("info")) {
|
}
|
||||||
value = getInfo(currentProfile, currentStatus);
|
setData(source, QString("value"), value);
|
||||||
} else if (source == QString("interfaces")) {
|
}
|
||||||
value = getInterfaceList().join(QChar(','));
|
else if (source == QString("extIp")) {
|
||||||
} else if (source == QString("intip4")) {
|
if (configuration[QString("EXTIP")] == QString("true")) {
|
||||||
value = getIntIp(QAbstractSocket::IPv4Protocol);
|
command.start(configuration[QString("EXTIPCMD")]);
|
||||||
} else if (source == QString("intip6")) {
|
command.waitForFinished(-1);
|
||||||
value = getIntIp(QAbstractSocket::IPv6Protocol);
|
cmdOutput = command.readAllStandardOutput();
|
||||||
} else if (source == QString("netctlauto")) {
|
if (!cmdOutput.isEmpty())
|
||||||
value = netctlAutoStatus ? QString("true") : QString("false");
|
value = cmdOutput.split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||||
} else if (source == QString("profiles")) {
|
}
|
||||||
value = getProfileList(configuration[QString("NETCTLCMD")].toString(),
|
setData(source, QString("value"), value);
|
||||||
configuration[QString("NETCTLAUTOCMD")].toString()).join(QChar(','));
|
}
|
||||||
} else if (source == QString("status")) {
|
else if (source == QString("interfaces")) {
|
||||||
currentStatus = getProfileStringStatus(configuration[QString("NETCTLCMD")].toString());
|
if (QDir(configuration[QString("NETDIR")]).exists())
|
||||||
value = currentStatus.join(QChar('|'));
|
value = QDir(configuration[QString("NETDIR")]).entryList(QDir::Dirs | QDir::NoDotAndDotDot).join(QString(","));
|
||||||
|
setData(source, QString("value"), value);
|
||||||
|
}
|
||||||
|
else if (source == QString("intIp")) {
|
||||||
|
if (QDir(configuration[QString("NETDIR")]).exists()) {
|
||||||
|
value = QString("127.0.0.1/8");
|
||||||
|
QStringList netDevices = QDir(configuration[QString("NETDIR")]).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
for (int i=0; i<netDevices.count(); i++)
|
||||||
|
if (netDevices[i] != QString("lo")) {
|
||||||
|
cmdOutput = QString("");
|
||||||
|
command.start(configuration[QString("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(configuration[QString("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(configuration[QString("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(configuration[QString("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(configuration[QString("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);
|
||||||
}
|
}
|
||||||
setData(source, QString("value"), value);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef BUILD_KDE4
|
|
||||||
K_EXPORT_PLASMA_DATAENGINE(netctl, Netctl)
|
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"
|
#include "netctl.moc"
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#define NETCTL_DE_H
|
#define NETCTL_DE_H
|
||||||
|
|
||||||
#include <Plasma/DataEngine>
|
#include <Plasma/DataEngine>
|
||||||
#include <QAbstractSocket>
|
|
||||||
|
|
||||||
|
|
||||||
class Netctl : public Plasma::DataEngine
|
class Netctl : public Plasma::DataEngine
|
||||||
@ -27,34 +26,17 @@ class Netctl : public Plasma::DataEngine
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Netctl(QObject *parent, const QVariantList &args);
|
Netctl(QObject *parent, const QVariantList &args);
|
||||||
virtual ~Netctl();
|
|
||||||
QString getExtIp(const QString cmd) const;
|
|
||||||
QString getInfo(const QStringList profiles, const QStringList statuses) const;
|
|
||||||
QStringList getInterfaceList() const;
|
|
||||||
QString getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol) const;
|
|
||||||
QStringList getProfileList(const QString cmdNetctl, const QString cmdNetctlAuto);
|
|
||||||
QStringList getProfileStringStatus(const QString cmdNetctl) const;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void initSources();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool readConfiguration();
|
||||||
bool sourceRequestEvent(const QString &name);
|
bool sourceRequestEvent(const QString &name);
|
||||||
bool updateSourceEvent(const QString &source);
|
bool updateSourceEvent(const QString &source);
|
||||||
QStringList sources() const;
|
QStringList sources() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isNetctlCheckRunning = false;
|
|
||||||
bool netctlAutoStatus = false;
|
|
||||||
bool status = false;
|
|
||||||
QStringList currentProfile;
|
|
||||||
QStringList currentStatus;
|
|
||||||
// configuration
|
// configuration
|
||||||
bool debug;
|
QMap<QString, QString> configuration;
|
||||||
QVariantMap configuration;
|
|
||||||
QString getCmdOutput(const QString cmd) const;
|
|
||||||
void readConfiguration();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
[Netctl commands]
|
|
||||||
NETCTLCMD=netctl
|
|
||||||
NETCTLAUTOCMD=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
|
Comment=Data engine for netctl
|
||||||
ServiceTypes=Plasma/DataEngine
|
ServiceTypes=Plasma/DataEngine
|
||||||
Type=Service
|
Type=Service
|
||||||
Icon=netctl-gui-widget
|
Icon=netctl-gui
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/DataEngine
|
X-KDE-ServiceTypes=Plasma/DataEngine
|
||||||
X-KDE-Library=plasma_engine_netctl
|
X-KDE-Library=plasma_engine_netctl
|
||||||
X-Plasma-EngineName=netctl
|
X-Plasma-EngineName=netctl
|
||||||
|
|
||||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev
|
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||||
X-KDE-PluginInfo-Name=netctl
|
X-KDE-PluginInfo-Name=netctl
|
||||||
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
||||||
X-KDE-PluginInfo-Website=https://arcanis.me/projects/netctl-gui/
|
X-KDE-PluginInfo-Website=http://arcan1s.github.io/projects/netctlplasmoid
|
||||||
X-KDE-PluginInfo-Category=Network
|
X-KDE-PluginInfo-Category=Network
|
||||||
X-KDE-PluginInfo-Depends=
|
X-KDE-PluginInfo-Depends=
|
||||||
X-KDE-PluginInfo-License=GPLv3
|
X-KDE-PluginInfo-License=GPLv3
|
@ -5,8 +5,7 @@ message (STATUS "Subproject ${SUBPROJECT}")
|
|||||||
# set directories
|
# set directories
|
||||||
set (SUBPROJECT_BINARY_DIR bin)
|
set (SUBPROJECT_BINARY_DIR bin)
|
||||||
set (SUBPROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
set (SUBPROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
set (SUBPROJECT_DOCS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/docs)
|
set (SUBPROJECT_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
||||||
set (SUBPROJECT_RESOURCE_DIR ${PROJECT_RESOURCE_DIR})
|
|
||||||
set (SUBPROJECT_TRANSLATION_DIR ${SUBPROJECT_RESOURCE_DIR}/translations)
|
set (SUBPROJECT_TRANSLATION_DIR ${SUBPROJECT_RESOURCE_DIR}/translations)
|
||||||
# executable path
|
# executable path
|
||||||
set (EXECUTABLE_OUTPUT_PATH ${SUBPROJECT_BINARY_DIR})
|
set (EXECUTABLE_OUTPUT_PATH ${SUBPROJECT_BINARY_DIR})
|
||||||
@ -16,13 +15,5 @@ set (TARGETS "")
|
|||||||
set (HEADERS "")
|
set (HEADERS "")
|
||||||
|
|
||||||
add_subdirectory (${SUBPROJECT_SOURCE_DIR})
|
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 ${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})
|
|
||||||
|
@ -1,115 +0,0 @@
|
|||||||
###########################################################################
|
|
||||||
# This file is part of netctl-gui #
|
|
||||||
# #
|
|
||||||
# netctl-gui is free software: you can redistribute it and/or #
|
|
||||||
# modify it under the terms of the GNU General Public License as #
|
|
||||||
# published by the Free Software Foundation, either version 3 of the #
|
|
||||||
# License, or (at your option) any later version. #
|
|
||||||
# #
|
|
||||||
# netctl-gui is distributed in the hope that it will be useful, #
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
||||||
# GNU General Public License for more details. #
|
|
||||||
# #
|
|
||||||
# You should have received a copy of the GNU General Public License #
|
|
||||||
# along with netctl-gui. If not, see http://www.gnu.org/licenses/ #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
|
|
||||||
# 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
|
|
@ -1,12 +0,0 @@
|
|||||||
# 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})
|
|
Before Width: | Height: | Size: 40 KiB |
@ -1,478 +0,0 @@
|
|||||||
<!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="#interface">Helper interface 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 may 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 CurrentWiFi()</td>
|
|
||||||
<td>returns current WiFi point in format <code>NAME|SECURITY|TYPE|FREQ|MAC|SIGNAL|ACTIVE|EXISTS</code></td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>QStringList VerboseWiFi()</td>
|
|
||||||
<td>returns available WiFi points in format <code>NAME|SECURITY|TYPE|FREQS|MACS|SIGNAL|ACTIVE|EXISTS</code>. First line is always active connection (see <code>CurrentWiFi()</code>)</td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>QStringList WiFi()</td>
|
|
||||||
<td>returns available WiFi points in format <code>NAME|SECURITY|SIGNAL|ACTIVE|EXISTS</code></td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<!-- /interface path -->
|
|
||||||
<tr>
|
|
||||||
<th colspan="3" class="sub"><a href="#interface" class="anchor" id="interface"></a><code>/interface</code> path</th>
|
|
||||||
</tr>
|
|
||||||
<!-- netctl control -->
|
|
||||||
<tr>
|
|
||||||
<td>int Enable(QString profile)</td>
|
|
||||||
<td>enables or disables the profile. Returns is the profile enabled or <code>2</code> if there was an another error</td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>int Restart(QString profile)</td>
|
|
||||||
<td>restarts the profile. Returns is the profile active or <code>2</code> if there was an error</td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>int Start(QString profile)</td>
|
|
||||||
<td>starts or stops the profile. Returns is the profile active or <code>2</code> if there was an error</td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>bool StopAll()</td>
|
|
||||||
<td>synonym of <code>/ctlr/StopAll()</code></td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>bool SwitchTo(QString profile)</td>
|
|
||||||
<td>switchs to the profile (works with netctl and netctl-auto). Returns is the profile active or <code>2</code> if there was an error</td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>int 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>1</code> if action has been performed successfully, <code>0</code> if there was an error in the profile copying and <code>2</code> if there was an another error</td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>QStringList Profile(QString profile)</td>
|
|
||||||
<td>synonym of <code>/netctl/Profile()</code></td>
|
|
||||||
<td>no</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>int Remove(QString profile)</td>
|
|
||||||
<td>synonym of <code>/ctrl/Remove()</code></td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<!-- information -->
|
|
||||||
<tr>
|
|
||||||
<td>QStringList Information()</td>
|
|
||||||
<td>returns general information in format <code>[IsNetctlAutoActive, NetctlProfiles, NetctlAutoProfiles]</code></td>
|
|
||||||
<td>no</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>QStringList Status()</td>
|
|
||||||
<td>returns actual information in format <code>[IsNetctlAutoActive, ProfilesNames, ActiveProfile, ActiveProfileEnables]</code></td>
|
|
||||||
<td>no</td>
|
|
||||||
</tr>
|
|
||||||
<!-- wpa_supplicant actions -->
|
|
||||||
<tr>
|
|
||||||
<td>int Essid(QString essid, QStringList settingsList)</td>
|
|
||||||
<td>connects to WiFi point with the given ESSID, calls KnownEssid or UnknownESSID depending on whether there is a profile. Settings may be empty. To get return codes refer to <code>KnownEssid()</code> and <code>UnknownEssid()</code></td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>int KnownEssid(QString essid)</td>
|
|
||||||
<td>connects to WiFi point with the given ESSID with existent profile. Returns <code>Start()</code> if ok, in other cases returns <code>2</code></td>
|
|
||||||
<td>yes</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>int UnknownEssid(QString essid, QStringList settingsList)</td>
|
|
||||||
<td>creates a profile and connects to WiFi point with the given ESSID. Returns <code>Start()</code> if ok, in other cases returns <code>2</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>QStringList ActiveProfile()</td>
|
|
||||||
<td>returns active profile from netctl or netctl-auto</td>
|
|
||||||
<td>no</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>QStringList 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 netctlActiveProfile()</td>
|
|
||||||
<td>returns active profile from netctl even if netctl-auto is running</td>
|
|
||||||
<td>no</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>QStringList netctlProfileList()</td>
|
|
||||||
<td>returns available profiles in format <code>NAME|DESCRIPTION|ACTIVE|ENABLED</code> from netctl even if netctl-auto is running</td>
|
|
||||||
<td>no</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>QStringList netctlVerboseProfileList()</td>
|
|
||||||
<td>returns available profiles in format <code>NAME|DESCRIPTION|TYPE|INTERFACE|ESSID|ACTIVE|ENABLED|NETCTL-AUTO</code> from netctl even if netctl-auto is running</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 VerboseProfileList()</td>
|
|
||||||
<td>returns available profiles in format <code>NAME|DESCRIPTION|TYPE|INTERFACE|ESSID|ACTIVE|ENABLED|NETCTL-AUTO</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>
|
|
||||||
<tr>
|
|
||||||
<td>QStringList ProfileValues(QString profile, QStringList keys)</td>
|
|
||||||
<td>returns values of the keys by the given profile or empty lines</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>
|
|
||||||
<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>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>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h2><a href="#links" class="anchor" id="links"></a>External links</h2>
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://arcanis.me/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>
|
|
@ -1,112 +0,0 @@
|
|||||||
<!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="https://arcanis.me/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>
|
|
@ -1,79 +0,0 @@
|
|||||||
.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
|
#!/usr/bin/env xdg-open
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Name=Netctl GUI
|
Name=Netctl GUI
|
||||||
Comment=Qt graphical user interface for netctl
|
Comment=GUI written on Qt4 for netctl
|
||||||
Exec=netctl-gui
|
Exec=netctl-gui
|
||||||
Icon=netctl-gui.png
|
Icon=netctl-gui.png
|
||||||
Terminal=false
|
Terminal=false
|
||||||
|
6
sources/gui/resources/resources.qrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
|
<qresource>
|
||||||
|
<file>translations/english.qm</file>
|
||||||
|
<file>translations/russian.qm</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
1454
sources/gui/resources/translations/english.ts
Normal file
1454
sources/gui/resources/translations/russian.ts
Normal file
@ -1,68 +1,73 @@
|
|||||||
# set files
|
# set files
|
||||||
if (USE_QT5)
|
file (GLOB SOURCES *.cpp)
|
||||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
file (GLOB HEADERS *.h)
|
||||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
file (GLOB FORMS *.ui)
|
||||||
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp
|
|
||||||
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
|
|
||||||
else ()
|
|
||||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
|
||||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
|
||||||
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
|
|
||||||
endif ()
|
|
||||||
file (GLOB_RECURSE HEADERS *.h ${PROJECT_TRDPARTY_DIR}/task/*.h
|
|
||||||
${PROJECT_TRDPARTY_DIR}/language/*.h)
|
|
||||||
file (GLOB_RECURSE FORMS *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui)
|
|
||||||
|
|
||||||
file (GLOB LANGUAGES ${SUBPROJECT_TRANSLATION_DIR}/*.ts)
|
set (LANGUAGES english
|
||||||
|
russian)
|
||||||
set (RESOURCES ${SUBPROJECT_RESOURCE_DIR}/resources.qrc)
|
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_path
|
||||||
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../${PROJECT_LIBRARY}/include/
|
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../)
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
|
||||||
${CMAKE_SOURCE_DIR}
|
|
||||||
${CMAKE_BINARY_DIR}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${PROJECT_TRDPARTY_DIR})
|
|
||||||
link_directories (${PROJECT_LIBRARY}/src/lib)
|
|
||||||
|
|
||||||
if (USE_QT5)
|
if (USE_QT5)
|
||||||
find_package (Qt5 COMPONENTS Core DBus Widgets LinguistTools REQUIRED)
|
find_package(Qt5Core REQUIRED)
|
||||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5LinguistTools_DEFINITIONS})
|
find_package(Qt5Widgets REQUIRED)
|
||||||
include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
find_package(Qt5LinguistTools REQUIRED)
|
||||||
set (QT_NEEDED_LIBS ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Widgets_LIBRARIES})
|
add_definitions(${Qt5Core_DEFINITIONS})
|
||||||
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
|
add_definitions(${Qt5Widgets_DEFINITIONS})
|
||||||
qt5_wrap_ui (UI_HEADERS ${FORMS})
|
add_definitions(${Qt5LinguistTools_DEFINITIONS})
|
||||||
qt5_add_resources (QRC_SOURCES ${RESOURCES})
|
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||||
|
qt5_wrap_ui (UI_HEADERS ${FORMS})
|
||||||
|
qt5_add_resources (QRC_SOURCES ${RESOURCES})
|
||||||
|
|
||||||
foreach (LANGUAGE ${LANGUAGES})
|
foreach (LANGUAGE ${LANGUAGES})
|
||||||
set (TS ${LANGUAGE})
|
set (TS ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.ts)
|
||||||
string (REPLACE ".ts" ".qm" QM ${TS})
|
set (QM ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.qm)
|
||||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||||
add_custom_command (OUTPUT ${QM} COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
add_custom_command (OUTPUT ${QM} COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||||
endforeach ()
|
endforeach ()
|
||||||
add_custom_target (translations COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
add_custom_target (translations COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
||||||
add_custom_command (TARGET translations COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
add_custom_command (TARGET translations COMMAND ${Qt5_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})
|
||||||
|
|
||||||
|
include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
||||||
|
add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
||||||
|
target_link_libraries (${SUBPROJECT} ${Qt5Widgets_LIBRARIES} ${Qt5Core_LIBRARIES})
|
||||||
else ()
|
else ()
|
||||||
find_package (Qt4 COMPONENTS QtCore QtDBus QtGui REQUIRED)
|
find_package (Qt4 REQUIRED)
|
||||||
include (${QT_USE_FILE})
|
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_cpp (MOC_SOURCES ${HEADERS})
|
qt4_wrap_ui (UI_HEADERS ${FORMS})
|
||||||
qt4_wrap_ui (UI_HEADERS ${FORMS})
|
qt4_add_resources (QRC_SOURCES ${RESOURCES})
|
||||||
qt4_add_resources (QRC_SOURCES ${RESOURCES})
|
|
||||||
|
|
||||||
foreach (LANGUAGE ${LANGUAGES})
|
foreach (LANGUAGE ${LANGUAGES})
|
||||||
set (TS ${LANGUAGE})
|
set (TS ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.ts)
|
||||||
string (REPLACE ".ts" ".qm" QM ${TS})
|
set (QM ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.qm)
|
||||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||||
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||||
endforeach ()
|
endforeach ()
|
||||||
add_custom_target (translations COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
add_custom_target (translations COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
||||||
add_custom_command (TARGET translations COMMAND ${QT_LRELEASE_EXECUTABLE} ${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})
|
||||||
|
|
||||||
|
add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
||||||
|
target_link_libraries (${SUBPROJECT} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
|
||||||
target_link_libraries (${SUBPROJECT} ${PROJECT_LIBRARY} ${QT_NEEDED_LIBS})
|
|
||||||
# install properties
|
# install properties
|
||||||
install (TARGETS ${SUBPROJECT} DESTINATION bin)
|
install (TARGETS ${SUBPROJECT} DESTINATION bin)
|
||||||
|
@ -1,107 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "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();
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#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 */
|
|
@ -1,30 +0,0 @@
|
|||||||
<?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,69 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "bondwidget.h"
|
|
||||||
#include "ui_bondwidget.h"
|
|
||||||
|
|
||||||
|
|
||||||
BondWidget::BondWidget(QWidget *parent)
|
|
||||||
: QWidget(parent),
|
|
||||||
ui(new Ui::BondWidget)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BondWidget::~BondWidget()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BondWidget::clear()
|
|
||||||
{
|
|
||||||
ui->lineEdit_mode->setText(QString("balance-rr"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> BondWidget::getSettings()
|
|
||||||
{
|
|
||||||
QMap<QString, QString> settings;
|
|
||||||
|
|
||||||
if (isOk() != 0) return settings;
|
|
||||||
|
|
||||||
if (ui->lineEdit_mode->text() != QString("balance-rr"))
|
|
||||||
settings[QString("Mode")] = ui->lineEdit_mode->text();
|
|
||||||
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int BondWidget::isOk()
|
|
||||||
{
|
|
||||||
// all fine
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BondWidget::setSettings(const QMap<QString, QString> settings)
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
|
|
||||||
if (settings.contains(QString("Mode")))
|
|
||||||
ui->lineEdit_mode->setText(settings[QString("Mode")]);
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef BONDWIDGET_H
|
|
||||||
#define BONDWIDGET_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class BondWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
class BondWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit BondWidget(QWidget *parent = 0);
|
|
||||||
~BondWidget();
|
|
||||||
QMap<QString, QString> getSettings();
|
|
||||||
int isOk();
|
|
||||||
void setSettings(const QMap<QString, QString> settings);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::BondWidget *ui;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BONDWIDGET_H */
|
|
@ -1,71 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>BondWidget</class>
|
|
||||||
<widget class="QWidget" name="BondWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>550</width>
|
|
||||||
<height>46</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QDockWidget" name="dockWidget_bond">
|
|
||||||
<property name="features">
|
|
||||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Bond settings</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="dockWidgetContents_bond">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_mode">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_mode">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>1</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Mode</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_mode">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>The bonding policy. See the kernel documentation on bonding for details</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -40,16 +40,26 @@ void BridgeWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BridgeWidget::setShown(const bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
show();
|
||||||
|
else
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> BridgeWidget::getSettings()
|
QMap<QString, QString> BridgeWidget::getSettings()
|
||||||
{
|
{
|
||||||
QMap<QString, QString> settings;
|
QMap<QString, QString> bridgeSettings;
|
||||||
|
|
||||||
if (isOk() != 0) return settings;
|
if (isOk() != 0)
|
||||||
|
return bridgeSettings;
|
||||||
|
|
||||||
if (ui->checkBox_skip->checkState() == Qt::Checked)
|
if (ui->checkBox_skip->checkState() == Qt::Checked)
|
||||||
settings[QString("SkipForwardingDelay")] = QString("yes");
|
bridgeSettings[QString("SkipForwardingDelay")] = QString("yes");
|
||||||
|
|
||||||
return settings;
|
return bridgeSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -62,9 +72,9 @@ int BridgeWidget::isOk()
|
|||||||
|
|
||||||
void BridgeWidget::setSettings(const QMap<QString, QString> settings)
|
void BridgeWidget::setSettings(const QMap<QString, QString> settings)
|
||||||
{
|
{
|
||||||
clear();
|
QMap<QString, QString> bridgeSettings = settings;
|
||||||
|
|
||||||
if (settings.contains(QString("SkipForwardingDelay")))
|
if (bridgeSettings.contains(QString("SkipForwardingDelay")))
|
||||||
if (settings[QString("SkipForwardingDelay")] == QString("yes"))
|
if (bridgeSettings[QString("SkipForwardingDelay")].remove(QString("'")) == QString("yes"))
|
||||||
ui->checkBox_skip->setCheckState(Qt::Checked);
|
ui->checkBox_skip->setCheckState(Qt::Checked);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(const bool state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::BridgeWidget *ui;
|
Ui::BridgeWidget *ui;
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>550</width>
|
<width>424</width>
|
||||||
<height>44</height>
|
<height>76</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDockWidget" name="dockWidget_bridge">
|
<widget class="QDockWidget" name="dockWidget_bridge">
|
||||||
<property name="features">
|
<property name="features">
|
||||||
@ -24,38 +24,15 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents_bridge">
|
<widget class="QWidget" name="dockWidgetContents_bridge">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_skip">
|
<widget class="QCheckBox" name="checkBox_skip">
|
||||||
<item>
|
<property name="toolTip">
|
||||||
<widget class="QLabel" name="labe_skip">
|
<string>Skip (R)STP and immediately activate all bridge members</string>
|
||||||
<property name="sizePolicy">
|
</property>
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<property name="text">
|
||||||
<horstretch>1</horstretch>
|
<string>Skip forwarding delay</string>
|
||||||
<verstretch>0</verstretch>
|
</property>
|
||||||
</sizepolicy>
|
</widget>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_skip">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Skip (R)STP and immediately activate all bridge members</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Skip forwarding delay</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1,243 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "calls.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include <listmap/listmap.h>
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
|
|
||||||
#include "dbusoperation.h"
|
|
||||||
|
|
||||||
|
|
||||||
InterfaceAnswer createProfileSlot(const QString profile, QMap<QString,QString> settings,
|
|
||||||
NetctlInterface* interface, const bool useHelper, const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
|
||||||
|
|
||||||
if (!useHelper) return interface->createProfile(profile, settings);
|
|
||||||
try {
|
|
||||||
QList<QVariant> args;
|
|
||||||
args.append(profile);
|
|
||||||
args.append(mapToList(settings));
|
|
||||||
int responce = sendRequestToInterfaceWithArgs(QString("Create"), args, debug)[0].toInt();
|
|
||||||
return static_cast<InterfaceAnswer>(responce);
|
|
||||||
} catch (...) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
|
||||||
return InterfaceAnswer::Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InterfaceAnswer enableProfileSlot(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
|
||||||
|
|
||||||
if (!useHelper) return interface->enableProfile(profile);
|
|
||||||
try {
|
|
||||||
QList<QVariant> args;
|
|
||||||
args.append(profile);
|
|
||||||
int responce = sendRequestToInterfaceWithArgs(QString("Enable"), args, debug)[0].toInt();
|
|
||||||
return static_cast<InterfaceAnswer>(responce);
|
|
||||||
} catch (...) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
|
||||||
return InterfaceAnswer::Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InterfaceAnswer removeProfileSlot(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
|
||||||
|
|
||||||
if (!useHelper) return interface->removeProfile(profile);
|
|
||||||
try {
|
|
||||||
QList<QVariant> args;
|
|
||||||
args.append(profile);
|
|
||||||
int responce = sendRequestToInterfaceWithArgs(QString("Remove"), args, debug)[0].toInt();
|
|
||||||
return static_cast<InterfaceAnswer>(responce);
|
|
||||||
} catch (...) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
|
||||||
return InterfaceAnswer::Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InterfaceAnswer restartProfileSlot(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
|
||||||
|
|
||||||
if (!useHelper) return interface->restartProfile(profile);
|
|
||||||
try {
|
|
||||||
QList<QVariant> args;
|
|
||||||
args.append(profile);
|
|
||||||
int responce = sendRequestToInterfaceWithArgs(QString("Restart"), args, debug)[0].toInt();
|
|
||||||
return static_cast<InterfaceAnswer>(responce);
|
|
||||||
} catch (...) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
|
||||||
return InterfaceAnswer::Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InterfaceAnswer startProfileSlot(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
|
||||||
|
|
||||||
if (!useHelper) return interface->startProfile(profile);
|
|
||||||
try {
|
|
||||||
QList<QVariant> args;
|
|
||||||
args.append(profile);
|
|
||||||
int responce = sendRequestToInterfaceWithArgs(QString("Start"), args, debug)[0].toInt();
|
|
||||||
return static_cast<InterfaceAnswer>(responce);
|
|
||||||
} catch (...) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
|
||||||
return InterfaceAnswer::Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InterfaceAnswer stopAllProfilesSlot(NetctlInterface *interface, const bool useHelper,
|
|
||||||
const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
if (!useHelper) return interface->stopAllProfiles();
|
|
||||||
try {
|
|
||||||
int responce = sendRequestToInterface(QString("StopAll"), debug)[0].toInt();
|
|
||||||
return static_cast<InterfaceAnswer>(responce);
|
|
||||||
} catch (...) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
|
||||||
return InterfaceAnswer::Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InterfaceAnswer switchToProfileSlot(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
|
||||||
|
|
||||||
if (!useHelper) return interface->switchToProfile(profile);
|
|
||||||
try {
|
|
||||||
QList<QVariant> args;
|
|
||||||
args.append(profile);
|
|
||||||
int responce = sendRequestToInterfaceWithArgs(QString("SwitchTo"), args, debug)[0].toInt();
|
|
||||||
return static_cast<InterfaceAnswer>(responce);
|
|
||||||
} catch (...) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
|
||||||
return InterfaceAnswer::Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InterfaceAnswer connectToEssid(const QString essid, QMap<QString,QString> settings,
|
|
||||||
NetctlInterface* interface, const bool useHelper, const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "ESSID" << essid;
|
|
||||||
|
|
||||||
|
|
||||||
if (!useHelper) return interface->connectToEssid(essid, settings);
|
|
||||||
try {
|
|
||||||
QList<QVariant> args;
|
|
||||||
args.append(essid);
|
|
||||||
args.append(mapToList(settings));
|
|
||||||
int responce = sendRequestToInterfaceWithArgs(QString("Essid"), args, debug)[0].toInt();
|
|
||||||
return static_cast<InterfaceAnswer>(responce);
|
|
||||||
} catch (...) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
|
||||||
return InterfaceAnswer::Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
netctlInformation generalInformation(NetctlInterface *interface, const bool useHelper,
|
|
||||||
const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
if (!useHelper) return interface->information();
|
|
||||||
try {
|
|
||||||
QList<QVariant> responce = sendRequestToInterface(QString("Information"), debug);
|
|
||||||
// main
|
|
||||||
netctlInformation info;
|
|
||||||
info.netctlAuto = responce[0].toStringList().takeFirst().toInt();
|
|
||||||
info.netctlAutoEnabled = responce[0].toStringList().takeFirst().toInt();
|
|
||||||
QList<netctlProfileInfo> profiles = parseOutputNetctl(responce);
|
|
||||||
for (int i=0; i<profiles.count(); i++) {
|
|
||||||
if (profiles[i].netctlAuto)
|
|
||||||
info.netctlAutoProfiles.append(profiles[i]);
|
|
||||||
else
|
|
||||||
info.netctlProfiles.append(profiles[i]);
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
} catch (...) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
|
||||||
return netctlInformation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> profileInformation(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug)
|
|
||||||
{
|
|
||||||
if (!useHelper) return interface->profileSettings(profile);
|
|
||||||
try {
|
|
||||||
QList<QVariant> args;
|
|
||||||
args.append(profile);
|
|
||||||
QStringList responce = sendRequestToInterfaceWithArgs(QString("Profile"), args, debug)[0].toStringList();
|
|
||||||
return listToMap(responce);
|
|
||||||
} catch (...) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
|
||||||
return QMap<QString, QString>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
netctlCurrent trayInformation(NetctlInterface *interface, const bool useHelper,
|
|
||||||
const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
if (!useHelper) return interface->status();
|
|
||||||
try {
|
|
||||||
QStringList responce = sendRequestToInterface(QString("Status"), debug)[0].toStringList();
|
|
||||||
netctlCurrent status;
|
|
||||||
status.netctlAuto = responce[0].toInt();
|
|
||||||
status.profiles = responce[1].split(QChar('|'));
|
|
||||||
status.current = responce[2].split(QChar('|'));
|
|
||||||
QStringList enables = responce[3].split(QChar('|'));
|
|
||||||
for (int i=0; i<enables.count(); i++)
|
|
||||||
status.enables.append(enables[i].toInt());
|
|
||||||
return status;
|
|
||||||
} catch (...) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
|
||||||
return netctlCurrent();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef CALLS_H
|
|
||||||
#define CALLS_H
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
#include <netctlgui/netctlgui.h>
|
|
||||||
|
|
||||||
|
|
||||||
// control
|
|
||||||
InterfaceAnswer createProfileSlot(const QString profile, const QMap<QString,QString> settings,
|
|
||||||
NetctlInterface *interface, const bool useHelper,
|
|
||||||
const bool debug = false);
|
|
||||||
InterfaceAnswer enableProfileSlot(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug = false);
|
|
||||||
InterfaceAnswer removeProfileSlot(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug = false);
|
|
||||||
InterfaceAnswer restartProfileSlot(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug = false);
|
|
||||||
InterfaceAnswer startProfileSlot(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug = false);
|
|
||||||
InterfaceAnswer stopAllProfilesSlot(NetctlInterface *interface, const bool useHelper,
|
|
||||||
const bool debug = false);
|
|
||||||
InterfaceAnswer switchToProfileSlot(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug = false);
|
|
||||||
// wireless connection
|
|
||||||
InterfaceAnswer connectToEssid(const QString essid, QMap<QString,QString> settings,
|
|
||||||
NetctlInterface *interface, const bool useHelper,
|
|
||||||
const bool debug = false);
|
|
||||||
// information
|
|
||||||
netctlInformation generalInformation(NetctlInterface *interface, const bool useHelper,
|
|
||||||
const bool debug = false);
|
|
||||||
QMap<QString, QString> profileInformation(const QString profile, NetctlInterface *interface,
|
|
||||||
const bool useHelper, const bool debug = false);
|
|
||||||
netctlCurrent trayInformation(NetctlInterface *interface, const bool useHelper,
|
|
||||||
const bool debug = false);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* CALLS_H */
|
|
@ -1,88 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "commonfunctions.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
#include <task/taskadds.h>
|
|
||||||
|
|
||||||
|
|
||||||
bool checkExternalApps(const QString apps, const QMap<QString, QString> configuration,
|
|
||||||
const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Applications" << apps;
|
|
||||||
|
|
||||||
if (configuration[QString("SKIPCOMPONENTS")] == QString("true")) return true;
|
|
||||||
QStringList cmd;
|
|
||||||
cmd.append("which");
|
|
||||||
// avoid null-lines arguments
|
|
||||||
cmd.append("true");
|
|
||||||
cmd.append(externalApps(apps, configuration));
|
|
||||||
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd.join(QChar(' '));
|
|
||||||
TaskResult process = runTask(cmd.join(QChar(' ')), false);
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
|
||||||
if (process.exitCode != 0)
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
|
||||||
|
|
||||||
return (process.exitCode == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString checkStatus(const bool statusBool, const bool nullFalse)
|
|
||||||
{
|
|
||||||
if (statusBool) return QApplication::translate("MainWindow", "yes");
|
|
||||||
if (!nullFalse) return QApplication::translate("MainWindow", "no");
|
|
||||||
|
|
||||||
return QString("");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList externalApps(const QString apps, const QMap<QString, QString> configuration)
|
|
||||||
{
|
|
||||||
QStringList app;
|
|
||||||
// editor works always over cmd
|
|
||||||
if ((apps == QString("editor")) || (apps == QString("all"))) {
|
|
||||||
app.append(configuration[QString("EDITOR_PATH")]);
|
|
||||||
app.append(configuration[QString("SUDO_PATH")]);
|
|
||||||
}
|
|
||||||
if ((apps == QString("helper")) || (apps == QString("all"))) {
|
|
||||||
app.append(configuration[QString("HELPER_PATH")]);
|
|
||||||
}
|
|
||||||
if ((apps == QString("netctl")) || (apps == QString("all"))) {
|
|
||||||
app.append(configuration[QString("NETCTL_PATH")]);
|
|
||||||
app.append(configuration[QString("NETCTLAUTO_PATH")]);
|
|
||||||
}
|
|
||||||
if ((apps == QString("systemctl")) || (apps == QString("all"))) {
|
|
||||||
app.append(configuration[QString("SYSTEMCTL_PATH")]);
|
|
||||||
}
|
|
||||||
if ((apps == QString("wpasup")) || (apps == QString("wpasup-only")) || (apps == QString("all"))) {
|
|
||||||
app.append(configuration[QString("WPACLI_PATH")]);
|
|
||||||
app.append(configuration[QString("WPASUP_PATH")]);
|
|
||||||
}
|
|
||||||
// append sudo
|
|
||||||
// FORCE_SUDO is always true if helper is not running
|
|
||||||
if ((apps.contains(QRegExp(QString("(^all$|^editor$|^netctl$|^sudo$|^systemctl$|^wpasup$)")))) &&
|
|
||||||
(configuration[QString("FORCE_SUDO")] == QString("true")))
|
|
||||||
app.append(configuration[QString("SUDO_PATH")]);
|
|
||||||
|
|
||||||
return app;
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef COMMONFUNCTIONS_H
|
|
||||||
#define COMMONFUNCTIONS_H
|
|
||||||
|
|
||||||
#include <QMap>
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
|
|
||||||
bool checkExternalApps(const QString apps = QString("all"),
|
|
||||||
const QMap<QString, QString> configuration = QMap<QString, QString>(),
|
|
||||||
const bool debug = false);
|
|
||||||
QString checkStatus(const bool statusBool, const bool nullFalse = false);
|
|
||||||
QStringList externalApps(const QString apps,
|
|
||||||
const QMap<QString, QString> configuration = QMap<QString, QString>());
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* COMMONFUNCTIONS_H */
|
|
@ -1,155 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "dbusoperation.h"
|
|
||||||
|
|
||||||
#include <QDBusConnection>
|
|
||||||
#include <QDBusMessage>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
|
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
|
|
||||||
QList<netctlProfileInfo> parseOutputNetctl(const QList<QVariant> raw)
|
|
||||||
{
|
|
||||||
QList<netctlProfileInfo> profileInfo;
|
|
||||||
if (raw.isEmpty()) return profileInfo;
|
|
||||||
QStringList list = raw[0].toStringList();
|
|
||||||
for (int i=0; i<list.count(); i++) {
|
|
||||||
QStringList info = list[i].split(QChar('|'));
|
|
||||||
if (info.count() != 8) continue;
|
|
||||||
netctlProfileInfo profile;
|
|
||||||
profile.name = info[0];
|
|
||||||
profile.description = info[1];
|
|
||||||
profile.type = info[2];
|
|
||||||
profile.interface = info[3];
|
|
||||||
profile.essid = info[4];
|
|
||||||
profile.active = info[5].toInt();
|
|
||||||
profile.enabled = info[6].toInt();
|
|
||||||
profile.netctlAuto = info[7].toInt();
|
|
||||||
profileInfo.append(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
return profileInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<netctlWifiInfo> parseOutputWifi(const QList<QVariant> raw)
|
|
||||||
{
|
|
||||||
QList<netctlWifiInfo> wifiInfo;
|
|
||||||
if (raw.isEmpty()) return wifiInfo;
|
|
||||||
QStringList list = raw[0].toStringList();
|
|
||||||
for (int i=0; i<list.count(); i++) {
|
|
||||||
QStringList info = list[i].split(QChar('|'));
|
|
||||||
if (info.count() != 8) continue;
|
|
||||||
netctlWifiInfo wifi;
|
|
||||||
wifi.name = info[0];
|
|
||||||
wifi.security = info[1];
|
|
||||||
wifi.type = static_cast<PointType>(info[2].toInt());
|
|
||||||
for (int j=0; j<info[3].split(QChar(',')).count(); j++)
|
|
||||||
wifi.frequencies.append(info[3].split(QChar(','))[j].toInt());
|
|
||||||
wifi.macs = info[4].split(QChar(','));
|
|
||||||
wifi.signal = info[5].toInt();
|
|
||||||
wifi.active = info[6].toInt();
|
|
||||||
wifi.exists = info[7].toInt();
|
|
||||||
wifiInfo.append(wifi);
|
|
||||||
}
|
|
||||||
|
|
||||||
return wifiInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<QVariant> sendRequestToHelper(const QString path, const QString cmd,
|
|
||||||
const QList<QVariant> args, const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "args" << args;
|
|
||||||
|
|
||||||
QDBusConnection bus = QDBusConnection::systemBus();
|
|
||||||
QDBusMessage request = QDBusMessage::createMethodCall(DBUS_HELPER_SERVICE, path,
|
|
||||||
DBUS_HELPER_INTERFACE, cmd);
|
|
||||||
if (!args.isEmpty()) request.setArguments(args);
|
|
||||||
QDBusMessage response = bus.call(request, QDBus::BlockWithGui);
|
|
||||||
QList<QVariant> arguments = response.arguments();
|
|
||||||
if (arguments.isEmpty())
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error message" << response.errorMessage();
|
|
||||||
|
|
||||||
return arguments;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<QVariant> sendRequestToCtrl(const QString cmd, const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
|
|
||||||
return sendRequestToCtrlWithArgs(cmd, QList<QVariant>(), debug);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<QVariant> sendRequestToCtrlWithArgs(const QString cmd, const QList<QVariant> args,
|
|
||||||
const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "args" << args;
|
|
||||||
|
|
||||||
return sendRequestToHelper(DBUS_CTRL_PATH, cmd, args, debug);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList< QVariant > sendRequestToInterface(const QString cmd, const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
|
|
||||||
return sendRequestToInterfaceWithArgs(cmd, QList<QVariant>(), debug);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<QVariant> sendRequestToInterfaceWithArgs(const QString cmd, const QList<QVariant> args,
|
|
||||||
const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "args" << args;
|
|
||||||
|
|
||||||
return sendRequestToHelper(DBUS_INTERFACE_PATH, cmd, args, debug);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<QVariant> sendRequestToLib(const QString cmd, const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
|
|
||||||
return sendRequestToLibWithArgs(cmd, QList<QVariant>(), debug);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<QVariant> sendRequestToLibWithArgs(const QString cmd, const QList<QVariant> args,
|
|
||||||
const bool debug)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "args" << args;
|
|
||||||
|
|
||||||
return sendRequestToHelper(DBUS_LIB_PATH, cmd, args, debug);
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef DBUSOPERATION_H
|
|
||||||
#define DBUSOPERATION_H
|
|
||||||
|
|
||||||
#include <QList>
|
|
||||||
#include <QVariant>
|
|
||||||
|
|
||||||
#include <netctlgui/netctlgui.h>
|
|
||||||
|
|
||||||
QList<netctlProfileInfo> parseOutputNetctl(const QList<QVariant> raw);
|
|
||||||
QList<netctlWifiInfo> parseOutputWifi(const QList<QVariant> raw);
|
|
||||||
QList<QVariant> sendRequestToHelper(const QString path, const QString cmd,
|
|
||||||
const QList<QVariant> args, const bool debug = false);
|
|
||||||
QList<QVariant> sendRequestToCtrl(const QString cmd, const bool debug = false);
|
|
||||||
QList<QVariant> sendRequestToCtrlWithArgs(const QString cmd, const QList<QVariant> args,
|
|
||||||
const bool debug = false);
|
|
||||||
QList<QVariant> sendRequestToInterface(const QString cmd, const bool debug = false);
|
|
||||||
QList<QVariant> sendRequestToInterfaceWithArgs(const QString cmd, const QList<QVariant> args,
|
|
||||||
const bool debug = false);
|
|
||||||
QList<QVariant> sendRequestToLib(const QString cmd, const bool debug = false);
|
|
||||||
QList<QVariant> sendRequestToLibWithArgs(const QString cmd, const QList<QVariant> args,
|
|
||||||
const bool debug = false);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* DBUSOPERATION_H */
|
|
@ -16,193 +16,81 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "errorwindow.h"
|
#include "errorwindow.h"
|
||||||
|
#include "ui_errorwindow.h"
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QSpacerItem>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
|
|
||||||
|
ErrorWindow::ErrorWindow(QWidget *parent, const int messageNumber)
|
||||||
ErrorWindow::ErrorWindow(QWidget *parent, const bool debugCmd)
|
: QMainWindow(parent),
|
||||||
: debug(debugCmd)
|
ui(new Ui::ErrorWindow)
|
||||||
{
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
qDebug() << "[ErrorWindow]" << "[ErrorWindow]" << ":" << "Initializate with error code" << messageNumber;
|
||||||
|
setMessage(messageNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ErrorWindow::~ErrorWindow()
|
ErrorWindow::~ErrorWindow()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ErrorWindow::setMessage(const int mess)
|
||||||
QStringList ErrorWindow::getMessage(const int mess)
|
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
QString message;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Message" << mess;
|
|
||||||
|
|
||||||
QString message, title;
|
|
||||||
switch(mess) {
|
switch(mess) {
|
||||||
case 1:
|
case 1:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Could not find components");
|
message = QApplication::translate("ErrorWindow", "Could not find components");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Does not support yet");
|
message = QApplication::translate("ErrorWindow", "Does not support yet");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Profile name is not set");
|
message = QApplication::translate("ErrorWindow", "Profile name is not set");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Bind interfaces are not set");
|
message = QApplication::translate("ErrorWindow", "Bind interfaces are not set");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Description is not set");
|
message = QApplication::translate("ErrorWindow", "Description is not set");
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Ip settings are not set");
|
message = QApplication::translate("ErrorWindow", "Ip settings are not set");
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Configuration file does not exist");
|
message = QApplication::translate("ErrorWindow", "Configuration file does not exist");
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Key is not set");
|
message = QApplication::translate("ErrorWindow", "Key is not set");
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Wireless settings are not set");
|
message = QApplication::translate("ErrorWindow", "Wireless settings are not set");
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Configuration file is not set");
|
message = QApplication::translate("ErrorWindow", "Configuration file is not set");
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "ESSID is not set");
|
message = QApplication::translate("ErrorWindow", "ESSID is not set");
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "MAC address is incorrect");
|
message = QApplication::translate("ErrorWindow", "MAC address is incorrect");
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Session ID is not set");
|
message = QApplication::translate("ErrorWindow", "Session ID is not set");
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
message = QApplication::translate("ErrorWindow", "APN is not set");
|
||||||
message = QApplication::translate("ErrorWindow", "User is not in network group, helper will not be started");
|
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "APN is not set");
|
message = QApplication::translate("ErrorWindow", "APN is not set");
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Empty user/group name");
|
message = QApplication::translate("ErrorWindow", "Empty user/group name");
|
||||||
break;
|
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;
|
|
||||||
case 20:
|
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "IP address does not match the standard");
|
|
||||||
break;
|
|
||||||
case 21:
|
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Key is required for 'gre' mode");
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
title = QApplication::translate("ErrorWindow", "Error!");
|
|
||||||
message = QApplication::translate("ErrorWindow", "Unknown error");
|
message = QApplication::translate("ErrorWindow", "Unknown error");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList fullMessage;
|
ui->label->setText(message);
|
||||||
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:
|
|
||||||
case 20:
|
|
||||||
case 21:
|
|
||||||
icon = QMessageBox::Critical;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
icon = QMessageBox::NoIcon;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ErrorWindow::showWindow(const int mess, const QString sender, const bool debugCmd)
|
|
||||||
{
|
|
||||||
if (debugCmd) qDebug() << PDEBUG;
|
|
||||||
if (debugCmd) qDebug() << PDEBUG << ":" << "Message" << mess;
|
|
||||||
if (debugCmd) qDebug() << PDEBUG << ":" << "Sender" << sender;
|
|
||||||
|
|
||||||
ErrorWindow *errorWin = new ErrorWindow(0, debugCmd);
|
|
||||||
QStringList message = errorWin->getMessage(mess);
|
|
||||||
QMessageBox messageBox;
|
|
||||||
messageBox.setText(message[0]);
|
|
||||||
messageBox.setInformativeText(message[1]);
|
|
||||||
if (mess == 1)
|
|
||||||
messageBox.setDetailedText(sender);
|
|
||||||
else if (debugCmd)
|
|
||||||
messageBox.setDetailedText(QApplication::translate("ErrorWindow", "Sender : %1").arg(sender));
|
|
||||||
messageBox.setIcon(errorWin->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();
|
|
||||||
delete errorWin;
|
|
||||||
}
|
}
|
||||||
|
@ -18,29 +18,25 @@
|
|||||||
#ifndef ERRORWINDOW_H
|
#ifndef ERRORWINDOW_H
|
||||||
#define ERRORWINDOW_H
|
#define ERRORWINDOW_H
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMainWindow>
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
|
|
||||||
class ErrorWindow : public QObject
|
namespace Ui {
|
||||||
|
class ErrorWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ErrorWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ErrorWindow(QWidget *parent = 0,
|
explicit ErrorWindow(QWidget *parent = 0,
|
||||||
const bool debugCmd = false);
|
const int messageNumber = 0);
|
||||||
~ErrorWindow();
|
~ErrorWindow();
|
||||||
|
|
||||||
public slots:
|
|
||||||
static void showWindow(const int mess = 0,
|
|
||||||
const QString sender = QString(),
|
|
||||||
const bool debugCmd = false);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool debug;
|
Ui::ErrorWindow *ui;
|
||||||
QStringList getMessage(const int mess);
|
void setMessage(const int mess);
|
||||||
QMessageBox::Icon getIcon(const int mess);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* ERRORWINDOW_H */
|
#endif /* ERRORWINDOW_H */
|
||||||
|
123
sources/gui/src/errorwindow.ui
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?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>
|
@ -44,9 +44,8 @@ void EthernetWidget::clear()
|
|||||||
ui->checkBox_skip->setCheckState(Qt::Unchecked);
|
ui->checkBox_skip->setCheckState(Qt::Unchecked);
|
||||||
ui->checkBox_8021x->setCheckState(Qt::Unchecked);
|
ui->checkBox_8021x->setCheckState(Qt::Unchecked);
|
||||||
showWpa(ui->checkBox_8021x->checkState());
|
showWpa(ui->checkBox_8021x->checkState());
|
||||||
ui->lineEdit_wpaConfig->clear();
|
ui->lineEdit_wpaConfig->setText(QString("/etc/wpa_supplicant.conf"));
|
||||||
ui->comboBox_driver->setCurrentIndex(0);
|
ui->comboBox_driver->setCurrentIndex(0);
|
||||||
ui->spinBox_priority->setValue(1);
|
|
||||||
ui->spinBox_timeoutCarrier->setValue(5);
|
ui->spinBox_timeoutCarrier->setValue(5);
|
||||||
ui->spinBox_timeoutWpa->setValue(15);
|
ui->spinBox_timeoutWpa->setValue(15);
|
||||||
|
|
||||||
@ -55,6 +54,15 @@ void EthernetWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EthernetWidget::setShown(const bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
show();
|
||||||
|
else
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EthernetWidget::createActions()
|
void EthernetWidget::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->pushButton_ethernetAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
connect(ui->pushButton_ethernetAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||||
@ -65,7 +73,8 @@ void EthernetWidget::createActions()
|
|||||||
|
|
||||||
void EthernetWidget::selectWpaConfig()
|
void EthernetWidget::selectWpaConfig()
|
||||||
{
|
{
|
||||||
QString filename = QFileDialog::getOpenFileName(this,
|
QString filename = QFileDialog::getOpenFileName(
|
||||||
|
this,
|
||||||
QApplication::translate("EthernetWidget", "Select wpa configuration file"),
|
QApplication::translate("EthernetWidget", "Select wpa configuration file"),
|
||||||
QDir::currentPath(),
|
QDir::currentPath(),
|
||||||
QApplication::translate("EthernetWidget", "Configuration files (*.conf)"));
|
QApplication::translate("EthernetWidget", "Configuration files (*.conf)"));
|
||||||
@ -78,41 +87,44 @@ void EthernetWidget::showAdvanced()
|
|||||||
{
|
{
|
||||||
if (ui->pushButton_ethernetAdvanced->isChecked()) {
|
if (ui->pushButton_ethernetAdvanced->isChecked()) {
|
||||||
ui->widget_ethernetAdvanced->setHidden(false);
|
ui->widget_ethernetAdvanced->setHidden(false);
|
||||||
ui->pushButton_ethernetAdvanced->setArrowType(Qt::UpArrow);
|
ui->pushButton_ethernetAdvanced->setText(QApplication::translate("EthernetWidget", "Hide advanced"));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ui->widget_ethernetAdvanced->setHidden(true);
|
ui->widget_ethernetAdvanced->setHidden(true);
|
||||||
ui->pushButton_ethernetAdvanced->setArrowType(Qt::DownArrow);
|
ui->pushButton_ethernetAdvanced->setText(QApplication::translate("EthernetWidget", "Show advanced"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EthernetWidget::showWpa(const int state)
|
void EthernetWidget::showWpa(const int state)
|
||||||
{
|
{
|
||||||
ui->widget_wpa->setHidden(state == 0);
|
if (state == 0)
|
||||||
|
ui->widget_wpa->setHidden(true);
|
||||||
|
else
|
||||||
|
ui->widget_wpa->setHidden(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> EthernetWidget::getSettings()
|
QMap<QString, QString> EthernetWidget::getSettings()
|
||||||
{
|
{
|
||||||
QMap<QString, QString> settings;
|
QMap<QString, QString> ethernetSettings;
|
||||||
|
|
||||||
if (isOk() != 0) return settings;
|
if (isOk() != 0)
|
||||||
|
return ethernetSettings;
|
||||||
|
|
||||||
if (ui->checkBox_skip->checkState() == Qt::Checked)
|
if (ui->checkBox_skip->checkState() == Qt::Checked)
|
||||||
settings[QString("SkipNoCarrier")] = QString("yes");
|
ethernetSettings[QString("SkipNoCarrier")] = QString("yes");
|
||||||
if (ui->checkBox_8021x->checkState() == Qt::Checked) {
|
if (ui->checkBox_8021x->checkState() == Qt::Checked) {
|
||||||
settings[QString("Auth8021X")] = QString("yes");
|
ethernetSettings[QString("Auth8021X")] = QString("yes");
|
||||||
settings[QString("WPAConfigFile")] = QString("'%1'").arg(ui->lineEdit_wpaConfig->text());
|
ethernetSettings[QString("WPAConfigFile")] = QString("'") + ui->lineEdit_wpaConfig->text() + QString("'");
|
||||||
settings[QString("WPADriver")] = ui->comboBox_driver->currentText();
|
ethernetSettings[QString("WPADriver")] = ui->comboBox_driver->currentText();
|
||||||
}
|
}
|
||||||
if (ui->spinBox_priority->value() != 1)
|
|
||||||
settings[QString("Priority")] = QString::number(ui->spinBox_priority->value());
|
|
||||||
if (ui->spinBox_timeoutCarrier->value() != 5)
|
if (ui->spinBox_timeoutCarrier->value() != 5)
|
||||||
settings[QString("TimeoutCarrier")] = QString::number(ui->spinBox_timeoutCarrier->value());
|
ethernetSettings[QString("TimeoutCarrier")] = QString::number(ui->spinBox_timeoutCarrier->value());
|
||||||
if (ui->spinBox_timeoutWpa->value() != 15)
|
if (ui->spinBox_timeoutWpa->value() != 15)
|
||||||
settings[QString("TimeoutWPA")] = QString::number(ui->spinBox_timeoutWpa->value());
|
ethernetSettings[QString("TimeoutWPA")] = QString::number(ui->spinBox_timeoutWpa->value());
|
||||||
|
|
||||||
return settings;
|
return ethernetSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -120,7 +132,8 @@ int EthernetWidget::isOk()
|
|||||||
{
|
{
|
||||||
// file wpa_supplicant doesn't exists
|
// file wpa_supplicant doesn't exists
|
||||||
if (!ui->lineEdit_wpaConfig->text().isEmpty())
|
if (!ui->lineEdit_wpaConfig->text().isEmpty())
|
||||||
if (!QFile(ui->lineEdit_wpaConfig->text()).exists()) return 1;
|
if (!QFile(ui->lineEdit_wpaConfig->text()).exists())
|
||||||
|
return 1;
|
||||||
// all fine
|
// all fine
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -128,26 +141,24 @@ int EthernetWidget::isOk()
|
|||||||
|
|
||||||
void EthernetWidget::setSettings(const QMap<QString, QString> settings)
|
void EthernetWidget::setSettings(const QMap<QString, QString> settings)
|
||||||
{
|
{
|
||||||
clear();
|
QMap<QString, QString> ethernetSettings = settings;
|
||||||
|
|
||||||
if (settings.contains(QString("SkipNoCarrier")))
|
if (ethernetSettings.contains(QString("SkipNoCarrier")))
|
||||||
if (settings[QString("SkipNoCarrier")] == QString("yes"))
|
if (ethernetSettings[QString("SkipNoCarrier")].remove(QString("'")) == QString("yes"))
|
||||||
ui->checkBox_skip->setCheckState(Qt::Checked);
|
ui->checkBox_skip->setCheckState(Qt::Checked);
|
||||||
if (settings.contains(QString("Auth8021X")))
|
if (ethernetSettings.contains(QString("Auth8021X")))
|
||||||
if (settings[QString("Auth8021X")] == QString("yes"))
|
if (ethernetSettings[QString("Auth8021X")].remove(QString("'")) == QString("yes"))
|
||||||
ui->checkBox_8021x->setCheckState(Qt::Checked);
|
ui->checkBox_8021x->setCheckState(Qt::Checked);
|
||||||
if (settings.contains(QString("WPAConfigFile")))
|
if (ethernetSettings.contains(QString("WPAConfigFile")))
|
||||||
ui->lineEdit_wpaConfig->setText(settings[QString("WPAConfigFile")]);
|
ui->lineEdit_wpaConfig->setText(ethernetSettings[QString("WPAConfigFile")].remove(QString("'")));
|
||||||
if (settings.contains(QString("WPADriver"))) {
|
if (ethernetSettings.contains(QString("WPADriver")))
|
||||||
int index = ui->comboBox_driver->findText(settings[QString("WPADriver")]);
|
for (int i=0; i<ui->comboBox_driver->count(); i++)
|
||||||
ui->comboBox_driver->setCurrentIndex(index);
|
if (ethernetSettings[QString("WPADriver")].remove(QString("'")) == ui->comboBox_driver->itemText(i))
|
||||||
}
|
ui->comboBox_driver->setCurrentIndex(i);
|
||||||
if (settings.contains(QString("Priority")))
|
if (ethernetSettings.contains(QString("TimeoutCarrier")))
|
||||||
ui->spinBox_priority->setValue(settings[QString("Priority")].toInt());
|
ui->spinBox_timeoutCarrier->setValue(ethernetSettings[QString("TimeoutCarrier")].toInt());
|
||||||
if (settings.contains(QString("TimeoutCarrier")))
|
if (ethernetSettings.contains(QString("TimeoutWPA")))
|
||||||
ui->spinBox_timeoutCarrier->setValue(settings[QString("TimeoutCarrier")].toInt());
|
ui->spinBox_timeoutWpa->setValue(ethernetSettings[QString("TimeoutWPA")].toInt());
|
||||||
if (settings.contains(QString("TimeoutWPA")))
|
|
||||||
ui->spinBox_timeoutWpa->setValue(settings[QString("TimeoutWPA")].toInt());
|
|
||||||
|
|
||||||
showWpa(ui->checkBox_8021x->checkState());
|
showWpa(ui->checkBox_8021x->checkState());
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(const bool state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void selectWpaConfig();
|
void selectWpaConfig();
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>550</width>
|
<width>431</width>
|
||||||
<height>255</height>
|
<height>296</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDockWidget" name="dockWidget_ethernet">
|
<widget class="QDockWidget" name="dockWidget_ethernet">
|
||||||
<property name="features">
|
<property name="features">
|
||||||
@ -24,29 +24,29 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents_ethernet">
|
<widget class="QWidget" name="dockWidgetContents_ethernet">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_ethernetAdvanced">
|
<layout class="QHBoxLayout" name="layout_ethernetAdvanced">
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line">
|
<spacer name="spacer_ethernetAdvanced">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="pushButton_ethernetAdvanced">
|
<widget class="QPushButton" name="pushButton_ethernetAdvanced">
|
||||||
|
<property name="text">
|
||||||
|
<string>Hide advanced</string>
|
||||||
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="arrowType">
|
|
||||||
<enum>Qt::DownArrow</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -54,104 +54,49 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget_ethernetAdvanced" native="true">
|
<widget class="QWidget" name="widget_ethernetAdvanced" native="true">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_skip">
|
<widget class="QCheckBox" name="checkBox_skip">
|
||||||
<item>
|
<property name="toolTip">
|
||||||
<widget class="QLabel" name="label_skip">
|
<string><html><head/><body><p>Whether or not the absence of a carrier is acceptable</p></body></html></string>
|
||||||
<property name="sizePolicy">
|
</property>
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<property name="text">
|
||||||
<horstretch>1</horstretch>
|
<string>Skip no carrier</string>
|
||||||
<verstretch>0</verstretch>
|
</property>
|
||||||
</sizepolicy>
|
</widget>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_skip">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Whether or not the absence of a carrier is acceptable</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Skip no carrier</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_8021x">
|
<widget class="QCheckBox" name="checkBox_8021x">
|
||||||
<item>
|
<property name="toolTip">
|
||||||
<widget class="QLabel" name="label_8021x">
|
<string>Set to ‘yes’ to use 802.1x authentication</string>
|
||||||
<property name="sizePolicy">
|
</property>
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<property name="text">
|
||||||
<horstretch>1</horstretch>
|
<string>802.1x authentication</string>
|
||||||
<verstretch>0</verstretch>
|
</property>
|
||||||
</sizepolicy>
|
<property name="checked">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_8021x">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Set to ‘yes’ to use 802.1x authentication</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>802.1x authentication</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget_wpa" native="true">
|
<widget class="QWidget" name="widget_wpa" native="true">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_wpaConfig">
|
<layout class="QHBoxLayout" name="layout_wpaConfig">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_wpaConfig">
|
<widget class="QLabel" name="label_wpaConfig">
|
||||||
<property name="sizePolicy">
|
<property name="minimumSize">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<size>
|
||||||
<horstretch>7</horstretch>
|
<width>150</width>
|
||||||
<verstretch>0</verstretch>
|
<height>0</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>WPA config file</string>
|
<string>WPA config file</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_wpaConfig">
|
<widget class="QLineEdit" name="lineEdit_wpaConfig">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>10</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Path to a wpa_supplicant configuration file</string>
|
<string>Path to a wpa_supplicant configuration file</string>
|
||||||
</property>
|
</property>
|
||||||
@ -159,12 +104,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_wpaConfig">
|
<widget class="QPushButton" name="pushButton_wpaConfig">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>4</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Browse</string>
|
<string>Browse</string>
|
||||||
</property>
|
</property>
|
||||||
@ -176,28 +115,19 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_driver">
|
<layout class="QHBoxLayout" name="layout_driver">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_driver">
|
<widget class="QLabel" name="label_driver">
|
||||||
<property name="sizePolicy">
|
<property name="minimumSize">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<size>
|
||||||
<horstretch>7</horstretch>
|
<width>150</width>
|
||||||
<verstretch>0</verstretch>
|
<height>0</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>WPA driver</string>
|
<string>WPA driver</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_driver">
|
<widget class="QComboBox" name="comboBox_driver">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>14</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>The wpa_supplicant driver to use for 802.1x authentication</string>
|
<string>The wpa_supplicant driver to use for 802.1x authentication</string>
|
||||||
</property>
|
</property>
|
||||||
@ -227,28 +157,19 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_timeoutCarrier">
|
<layout class="QHBoxLayout" name="layout_timeoutCarrier">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_timeoutCarrier">
|
<widget class="QLabel" name="label_timeoutCarrier">
|
||||||
<property name="sizePolicy">
|
<property name="minimumSize">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<size>
|
||||||
<horstretch>1</horstretch>
|
<width>150</width>
|
||||||
<verstretch>0</verstretch>
|
<height>0</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Timeout carrier</string>
|
<string>Timeout carrier</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="spinBox_timeoutCarrier">
|
<widget class="QSpinBox" name="spinBox_timeoutCarrier">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Maximum time, in seconds, to wait for a carrier</string>
|
<string>Maximum time, in seconds, to wait for a carrier</string>
|
||||||
</property>
|
</property>
|
||||||
@ -266,28 +187,19 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_timeoutWpa">
|
<layout class="QHBoxLayout" name="layout_timeoutWpa">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_timeoutWpa">
|
<widget class="QLabel" name="label_timeoutWpa">
|
||||||
<property name="sizePolicy">
|
<property name="minimumSize">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<size>
|
||||||
<horstretch>1</horstretch>
|
<width>150</width>
|
||||||
<verstretch>0</verstretch>
|
<height>0</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Timeout WPA</string>
|
<string>Timeout WPA</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="spinBox_timeoutWpa">
|
<widget class="QSpinBox" name="spinBox_timeoutWpa">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Maximum time, in seconds, to wait for 802.1x authentication to succeed</string>
|
<string>Maximum time, in seconds, to wait for 802.1x authentication to succeed</string>
|
||||||
</property>
|
</property>
|
||||||
@ -301,45 +213,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_priority">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_priority">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>1</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Priority</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_priority">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Priority level of the profile. In case of automatic profile selection, profiles are tried in decreasing order of priority</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>999</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -350,6 +223,9 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
<tabstop>pushButton_ethernetAdvanced</tabstop>
|
||||||
|
<tabstop>checkBox_skip</tabstop>
|
||||||
|
<tabstop>checkBox_8021x</tabstop>
|
||||||
<tabstop>lineEdit_wpaConfig</tabstop>
|
<tabstop>lineEdit_wpaConfig</tabstop>
|
||||||
<tabstop>pushButton_wpaConfig</tabstop>
|
<tabstop>pushButton_wpaConfig</tabstop>
|
||||||
<tabstop>comboBox_driver</tabstop>
|
<tabstop>comboBox_driver</tabstop>
|
||||||
|
@ -59,7 +59,6 @@ void GeneralWidget::clear()
|
|||||||
ui->listWidget_after->clear();
|
ui->listWidget_after->clear();
|
||||||
ui->lineEdit_execUpPost->clear();
|
ui->lineEdit_execUpPost->clear();
|
||||||
ui->lineEdit_execDownPre->clear();
|
ui->lineEdit_execDownPre->clear();
|
||||||
ui->checkBox_exclude->setCheckState(Qt::Unchecked);
|
|
||||||
ui->checkBox_forceConnect->setCheckState(Qt::Unchecked);
|
ui->checkBox_forceConnect->setCheckState(Qt::Unchecked);
|
||||||
ui->checkBox_debug->setCheckState(Qt::Unchecked);
|
ui->checkBox_debug->setCheckState(Qt::Unchecked);
|
||||||
|
|
||||||
@ -68,13 +67,20 @@ void GeneralWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GeneralWidget::setShown(const bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
show();
|
||||||
|
else
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GeneralWidget::createActions()
|
void GeneralWidget::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->pushButton_generalAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
connect(ui->pushButton_generalAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||||
connect(ui->pushButton_after, SIGNAL(clicked(bool)), this, SLOT(addAfter()));
|
connect(ui->pushButton_after, SIGNAL(clicked(bool)), this, SLOT(addAfter()));
|
||||||
connect(ui->comboBox_after->lineEdit(), SIGNAL(returnPressed()), this, SLOT(addAfter()));
|
|
||||||
connect(ui->pushButton_bindto, SIGNAL(clicked(bool)), this, SLOT(addBindTo()));
|
connect(ui->pushButton_bindto, SIGNAL(clicked(bool)), this, SLOT(addBindTo()));
|
||||||
connect(ui->comboBox_bindto->lineEdit(), SIGNAL(returnPressed()), this, SLOT(addBindTo()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -94,10 +100,10 @@ void GeneralWidget::keyPressEvent(QKeyEvent *pressedKey)
|
|||||||
{
|
{
|
||||||
if (pressedKey->key() == Qt::Key_Delete) {
|
if (pressedKey->key() == Qt::Key_Delete) {
|
||||||
if (ui->listWidget_bindto->hasFocus() &&
|
if (ui->listWidget_bindto->hasFocus() &&
|
||||||
(ui->listWidget_bindto->currentItem() != nullptr))
|
(ui->listWidget_bindto->currentItem() != 0))
|
||||||
delete ui->listWidget_bindto->currentItem();
|
delete ui->listWidget_bindto->currentItem();
|
||||||
else if (ui->listWidget_after->hasFocus() &&
|
else if (ui->listWidget_after->hasFocus() &&
|
||||||
(ui->listWidget_after->currentItem() != nullptr))
|
(ui->listWidget_after->currentItem() != 0))
|
||||||
delete ui->listWidget_after->currentItem();
|
delete ui->listWidget_after->currentItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +114,8 @@ void GeneralWidget::showAdvanced()
|
|||||||
if (ui->pushButton_generalAdvanced->isChecked()) {
|
if (ui->pushButton_generalAdvanced->isChecked()) {
|
||||||
ui->widget_generalAdvanced->setHidden(false);
|
ui->widget_generalAdvanced->setHidden(false);
|
||||||
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Hide advanced"));
|
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Hide advanced"));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ui->widget_generalAdvanced->setHidden(true);
|
ui->widget_generalAdvanced->setHidden(true);
|
||||||
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Show advanced"));
|
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Show advanced"));
|
||||||
}
|
}
|
||||||
@ -117,37 +124,36 @@ void GeneralWidget::showAdvanced()
|
|||||||
|
|
||||||
QMap<QString, QString> GeneralWidget::getSettings()
|
QMap<QString, QString> GeneralWidget::getSettings()
|
||||||
{
|
{
|
||||||
QMap<QString, QString> settings;
|
QMap<QString, QString> generalSettings;
|
||||||
|
|
||||||
if (isOk() != 0) return settings;
|
if (isOk() != 0)
|
||||||
|
return generalSettings;
|
||||||
|
|
||||||
settings[QString("Description")] = QString("'%1'").arg(ui->lineEdit_description->text());
|
generalSettings[QString("Description")] = QString("'") + ui->lineEdit_description->text() + QString("'");
|
||||||
settings[QString("Connection")] = ui->comboBox_connection->currentText();
|
generalSettings[QString("Connection")] = ui->comboBox_connection->currentText();
|
||||||
settings[QString("Interface")] = ui->comboBox_interface->currentText();
|
generalSettings[QString("Interface")] = ui->comboBox_interface->currentText();
|
||||||
if (ui->listWidget_bindto->count() != 0) {
|
if (ui->listWidget_bindto->count() != 0) {
|
||||||
QStringList interfaces;
|
QStringList interfaces;
|
||||||
for (int i=0; i<ui->listWidget_bindto->count(); i++)
|
for (int i=0; i<ui->listWidget_bindto->count(); i++)
|
||||||
interfaces.append(ui->listWidget_bindto->item(i)->text());
|
interfaces.append(ui->listWidget_bindto->item(i)->text());
|
||||||
settings[QString("BindsToInterfaces")] = interfaces.join(QChar(' '));
|
generalSettings[QString("BindsToInterfaces")] = interfaces.join(QString(" "));
|
||||||
}
|
}
|
||||||
if (ui->listWidget_after->count() != 0) {
|
if (ui->listWidget_after->count() != 0) {
|
||||||
QStringList profiles;
|
QStringList profiles;
|
||||||
for (int i=0; i<ui->listWidget_after->count(); i++)
|
for (int i=0; i<ui->listWidget_after->count(); i++)
|
||||||
profiles.append(ui->listWidget_after->item(i)->text());
|
profiles.append(ui->listWidget_after->item(i)->text());
|
||||||
settings[QString("After")] = profiles.join(QChar(' '));
|
generalSettings[QString("After")] = profiles.join(QString(" "));
|
||||||
}
|
}
|
||||||
if (!ui->lineEdit_execUpPost->text().isEmpty())
|
if (!ui->lineEdit_execUpPost->text().isEmpty())
|
||||||
settings[QString("ExecUpPost")] = QString("'%1'").arg(ui->lineEdit_execUpPost->text());
|
generalSettings[QString("ExecUpPost")] = QString("'") + ui->lineEdit_execUpPost->text() + QString("'");
|
||||||
if (!ui->lineEdit_execDownPre->text().isEmpty())
|
if (!ui->lineEdit_execDownPre->text().isEmpty())
|
||||||
settings[QString("ExecDownPre")] = QString("'%1'").arg(ui->lineEdit_execDownPre->text());
|
generalSettings[QString("ExecDownPre")] = QString("'") + ui->lineEdit_execDownPre->text() + QString("'");
|
||||||
if (ui->checkBox_exclude->checkState() == Qt::Checked)
|
|
||||||
settings[QString("ExcludeAuto")] = QString("yes");
|
|
||||||
if (ui->checkBox_forceConnect->checkState() == Qt::Checked)
|
if (ui->checkBox_forceConnect->checkState() == Qt::Checked)
|
||||||
settings[QString("ForceConnect")] = QString("yes");
|
generalSettings[QString("ForceConnect")] = QString("yes");
|
||||||
if (ui->checkBox_debug->checkState() == Qt::Checked)
|
if (ui->checkBox_debug->checkState() == Qt::Checked)
|
||||||
settings[QString("NETCTL_DEBUG")] = QString("yes");
|
generalSettings[QString("NETCTL_DEBUG")] = QString("yes");
|
||||||
|
|
||||||
return settings;
|
return generalSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -155,13 +161,13 @@ int GeneralWidget::isOk()
|
|||||||
{
|
{
|
||||||
// bind interfaces is not set
|
// bind interfaces is not set
|
||||||
if ((ui->comboBox_connection->currentText() == QString("bond")) ||
|
if ((ui->comboBox_connection->currentText() == QString("bond")) ||
|
||||||
(ui->comboBox_connection->currentText() == QString("bridge")) ||
|
(ui->comboBox_connection->currentText() == QString("bridge")) ||
|
||||||
(ui->comboBox_connection->currentText() == QString("vlan")) ||
|
(ui->comboBox_connection->currentText() == QString("vlan")))
|
||||||
(ui->comboBox_connection->currentText() == QString("macvlan")) ||
|
if (ui->listWidget_bindto->count() == 0)
|
||||||
(ui->comboBox_connection->currentText() == QString("openvswitch")))
|
return 1;
|
||||||
if (ui->listWidget_bindto->count() == 0) return 1;
|
|
||||||
// empty description
|
// empty description
|
||||||
if (ui->lineEdit_description->text().isEmpty()) return 2;
|
if (ui->lineEdit_description->text().isEmpty())
|
||||||
|
return 2;
|
||||||
// all fine
|
// all fine
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -169,33 +175,30 @@ int GeneralWidget::isOk()
|
|||||||
|
|
||||||
void GeneralWidget::setSettings(const QMap<QString, QString> settings)
|
void GeneralWidget::setSettings(const QMap<QString, QString> settings)
|
||||||
{
|
{
|
||||||
clear();
|
QMap<QString, QString> generalSettings = settings;
|
||||||
|
|
||||||
if (settings.contains(QString("Description")))
|
if (generalSettings.contains(QString("Description")))
|
||||||
ui->lineEdit_description->setText(settings[QString("Description")]);
|
ui->lineEdit_description->setText(generalSettings[QString("Description")].remove(QString("'")));
|
||||||
if (settings.contains(QString("Connection"))) {
|
if (generalSettings.contains(QString("Connection")))
|
||||||
int index = ui->comboBox_connection->findText(settings[QString("Connection")]);
|
for (int i=0; i<ui->comboBox_connection->count(); i++)
|
||||||
ui->comboBox_connection->setCurrentIndex(index);
|
if (generalSettings[QString("Connection")].remove(QString("'")) == ui->comboBox_connection->itemText(i))
|
||||||
}
|
ui->comboBox_connection->setCurrentIndex(i);
|
||||||
if (settings.contains(QString("Interface"))) {
|
if (generalSettings.contains(QString("Interface")))
|
||||||
ui->comboBox_interface->addItem(settings[QString("Interface")]);
|
for (int i=0; i<ui->comboBox_interface->count(); i++)
|
||||||
ui->comboBox_interface->setCurrentIndex(ui->comboBox_interface->count() - 1);
|
if (generalSettings[QString("Interface")].remove(QString("'")) == ui->comboBox_interface->itemText(i))
|
||||||
}
|
ui->comboBox_interface->setCurrentIndex(i);
|
||||||
if (settings.contains(QString("BindsToInterfaces")))
|
if (generalSettings.contains(QString("BindsToInterfaces")))
|
||||||
ui->listWidget_bindto->addItems(settings[QString("BindsToInterfaces")].split(QChar('\n')));
|
ui->listWidget_bindto->addItems(generalSettings[QString("BindsToInterfaces")].split(QString(" ")));
|
||||||
if (settings.contains(QString("After")))
|
if (generalSettings.contains(QString("After")))
|
||||||
ui->listWidget_after->addItems(settings[QString("After")].split(QChar('\n')));
|
ui->listWidget_after->addItems(generalSettings[QString("After")].split(QString(" ")));
|
||||||
if (settings.contains(QString("ExecUpPost")))
|
if (generalSettings.contains(QString("ExecUpPost")))
|
||||||
ui->lineEdit_execUpPost->setText(settings[QString("ExecUpPost")]);
|
ui->lineEdit_execUpPost->setText(generalSettings[QString("ExecUpPost")].remove(QString("'")));
|
||||||
if (settings.contains(QString("ExecDownPre")))
|
if (generalSettings.contains(QString("ExecDownPre")))
|
||||||
ui->lineEdit_execDownPre->setText(settings[QString("ExecDownPre")]);
|
ui->lineEdit_execDownPre->setText(generalSettings[QString("ExecDownPre")].remove(QString("'")));
|
||||||
if (settings.contains(QString("ExcludeAuto")))
|
if (generalSettings.contains(QString("ForceConnect")))
|
||||||
if (settings[QString("ExcludeAuto")] == QString("yes"))
|
if (generalSettings[QString("ForceConnect")].remove(QString("'")) == QString("yes"))
|
||||||
ui->checkBox_exclude->setCheckState(Qt::Checked);
|
|
||||||
if (settings.contains(QString("ForceConnect")))
|
|
||||||
if (settings[QString("ForceConnect")] == QString("yes"))
|
|
||||||
ui->checkBox_forceConnect->setCheckState(Qt::Checked);
|
ui->checkBox_forceConnect->setCheckState(Qt::Checked);
|
||||||
if (settings.contains(QString("NETCTL_DEBUG")))
|
if (generalSettings.contains(QString("NETCTL_DEBUG")))
|
||||||
if (settings[QString("NETCTL_DEBUG")] == QString("yes"))
|
if (generalSettings[QString("NETCTL_DEBUG")].remove(QString("'")) == QString("yes"))
|
||||||
ui->checkBox_debug->setCheckState(Qt::Checked);
|
ui->checkBox_debug->setCheckState(Qt::Checked);
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(const bool state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addAfter();
|
void addAfter();
|
||||||
|
@ -6,22 +6,16 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>550</width>
|
<width>431</width>
|
||||||
<height>479</height>
|
<height>537</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDockWidget" name="dockWidget_general">
|
<widget class="QDockWidget" name="dockWidget_general">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="features">
|
<property name="features">
|
||||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||||
</property>
|
</property>
|
||||||
@ -30,37 +24,25 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents_general">
|
<widget class="QWidget" name="dockWidgetContents_general">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_description">
|
<layout class="QHBoxLayout" name="layout_description">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_description">
|
<widget class="QLabel" name="label_description">
|
||||||
<property name="sizePolicy">
|
<property name="minimumSize">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<size>
|
||||||
<horstretch>1</horstretch>
|
<width>150</width>
|
||||||
<verstretch>0</verstretch>
|
<height>0</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Description</string>
|
<string>Description</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_description">
|
<widget class="QLineEdit" name="lineEdit_description">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>A description of the profile</string>
|
<string><html><head/><body><p>A description of the profile</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -70,28 +52,19 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_connection">
|
<layout class="QHBoxLayout" name="layout_connection">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_connection">
|
<widget class="QLabel" name="label_connection">
|
||||||
<property name="sizePolicy">
|
<property name="minimumSize">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<size>
|
||||||
<horstretch>1</horstretch>
|
<width>150</width>
|
||||||
<verstretch>0</verstretch>
|
<height>0</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Connection</string>
|
<string>Connection</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_connection">
|
<widget class="QComboBox" name="comboBox_connection">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>The connection type used by the profile</string>
|
<string>The connection type used by the profile</string>
|
||||||
</property>
|
</property>
|
||||||
@ -145,16 +118,6 @@
|
|||||||
<string notr="true">vlan</string>
|
<string notr="true">vlan</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">macvlan</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">openvswitch</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -163,28 +126,19 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_interface">
|
<layout class="QHBoxLayout" name="layout_interface">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_interface">
|
<widget class="QLabel" name="label_interface">
|
||||||
<property name="sizePolicy">
|
<property name="minimumSize">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<size>
|
||||||
<horstretch>1</horstretch>
|
<width>150</width>
|
||||||
<verstretch>0</verstretch>
|
<height>0</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Interface</string>
|
<string>Interface</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_interface">
|
<widget class="QComboBox" name="comboBox_interface">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>The name of the associated network interface</string>
|
<string>The name of the associated network interface</string>
|
||||||
</property>
|
</property>
|
||||||
@ -201,27 +155,18 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_bindtoButton">
|
<layout class="QHBoxLayout" name="layout_bindtoButton">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_bindto">
|
<widget class="QLabel" name="label_bindto">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>7</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Binds to interfaces</string>
|
<string>Binds to interfaces</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_bindto">
|
<widget class="QComboBox" name="comboBox_bindto">
|
||||||
<property name="sizePolicy">
|
<property name="minimumSize">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<size>
|
||||||
<horstretch>10</horstretch>
|
<width>150</width>
|
||||||
<verstretch>0</verstretch>
|
<height>0</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="editable">
|
<property name="editable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -230,12 +175,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_bindto">
|
<widget class="QPushButton" name="pushButton_bindto">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>4</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add</string>
|
<string>Add</string>
|
||||||
</property>
|
</property>
|
||||||
@ -261,23 +200,26 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_generalAdvanced">
|
<layout class="QHBoxLayout" name="layout_generalAdvanced">
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line">
|
<spacer name="spacer_generalAdvanced">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="pushButton_generalAdvanced">
|
<widget class="QPushButton" name="pushButton_generalAdvanced">
|
||||||
|
<property name="text">
|
||||||
|
<string>Hide advanced</string>
|
||||||
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="arrowType">
|
|
||||||
<enum>Qt::DownArrow</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -285,36 +227,24 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget_generalAdvanced" native="true">
|
<widget class="QWidget" name="widget_generalAdvanced" native="true">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="layout_after">
|
<layout class="QVBoxLayout" name="layout_after">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_afterButton">
|
<layout class="QHBoxLayout" name="layout_afterButton">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_after">
|
<widget class="QLabel" name="label_after">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>7</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>After</string>
|
<string>After</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_after">
|
<widget class="QComboBox" name="comboBox_after">
|
||||||
<property name="sizePolicy">
|
<property name="minimumSize">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<size>
|
||||||
<horstretch>10</horstretch>
|
<width>150</width>
|
||||||
<verstretch>0</verstretch>
|
<height>0</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="editable">
|
<property name="editable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -323,12 +253,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_after">
|
<widget class="QPushButton" name="pushButton_after">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>4</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add</string>
|
<string>Add</string>
|
||||||
</property>
|
</property>
|
||||||
@ -355,28 +279,19 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_execUpPost">
|
<layout class="QHBoxLayout" name="layout_execUpPost">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_execUpPost">
|
<widget class="QLabel" name="label_execUpPost">
|
||||||
<property name="sizePolicy">
|
<property name="minimumSize">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<size>
|
||||||
<horstretch>7</horstretch>
|
<width>150</width>
|
||||||
<verstretch>0</verstretch>
|
<height>0</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Command after starting</string>
|
<string>Command after starting</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_execUpPost">
|
<widget class="QLineEdit" name="lineEdit_execUpPost">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>14</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>A command that is executed after a connection is established</string>
|
<string>A command that is executed after a connection is established</string>
|
||||||
</property>
|
</property>
|
||||||
@ -388,28 +303,19 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_execDownPre">
|
<layout class="QHBoxLayout" name="layout_execDownPre">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_execDownPre">
|
<widget class="QLabel" name="label_execDownPre">
|
||||||
<property name="sizePolicy">
|
<property name="minimumSize">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<size>
|
||||||
<horstretch>7</horstretch>
|
<width>150</width>
|
||||||
<verstretch>0</verstretch>
|
<height>0</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Command before stoping</string>
|
<string>Command before stoping</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_execDownPre">
|
<widget class="QLineEdit" name="lineEdit_execDownPre">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>14</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>A command that is executed before a connection is brought down</string>
|
<string>A command that is executed before a connection is brought down</string>
|
||||||
</property>
|
</property>
|
||||||
@ -418,91 +324,21 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_exclude">
|
<widget class="QCheckBox" name="checkBox_forceConnect">
|
||||||
<item>
|
<property name="toolTip">
|
||||||
<widget class="QLabel" name="label_exclude">
|
<string>Set to ‘yes’ to force connecting even if the interface is up</string>
|
||||||
<property name="sizePolicy">
|
</property>
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<property name="text">
|
||||||
<horstretch>1</horstretch>
|
<string>Force connect</string>
|
||||||
<verstretch>0</verstretch>
|
</property>
|
||||||
</sizepolicy>
|
</widget>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_exclude">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Whether or not to exclude this profile from automatic profile selection</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Exclude auto</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_forceConnect">
|
<widget class="QCheckBox" name="checkBox_debug">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QLabel" name="label_forceConnect">
|
<string>Debug mode</string>
|
||||||
<property name="sizePolicy">
|
</property>
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
</widget>
|
||||||
<horstretch>7</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_forceConnect">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>14</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Set to ‘yes’ to force connecting even if the interface is up</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Force connect</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>7</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_debug">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>14</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Debug mode</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "ipregexp.h"
|
|
||||||
|
|
||||||
|
|
||||||
IpRegExp::IpRegExp(QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IpRegExp::~IpRegExp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QRegExp IpRegExp::ip4Regex()
|
|
||||||
{
|
|
||||||
return QRegExp(QString("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QRegExp IpRegExp::ip4CidrRegex()
|
|
||||||
{
|
|
||||||
return QRegExp(QString("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(/([0-9]|[1-2][0-9]|3[0-2]))$"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QRegExp IpRegExp::ip6Regex()
|
|
||||||
{
|
|
||||||
return QRegExp(QString("^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QRegExp IpRegExp::ip6CidrRegex()
|
|
||||||
{
|
|
||||||
return QRegExp(QString("^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(/(d|dd|1[0-1]d|12[0-8]))$"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QRegExpValidator *IpRegExp::ipv4Validator()
|
|
||||||
{
|
|
||||||
return new QRegExpValidator(IpRegExp::ip4Regex());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QRegExpValidator *IpRegExp::ipv4CidrValidator()
|
|
||||||
{
|
|
||||||
return new QRegExpValidator(IpRegExp::ip4CidrRegex());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QRegExpValidator *IpRegExp::ipv6Validator()
|
|
||||||
{
|
|
||||||
return new QRegExpValidator(IpRegExp::ip6Regex());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QRegExpValidator *IpRegExp::ipv6CidrValidator()
|
|
||||||
{
|
|
||||||
return new QRegExpValidator(IpRegExp::ip6CidrRegex());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool IpRegExp::checkString(const QString input, const QRegExp regexp)
|
|
||||||
{
|
|
||||||
return regexp.exactMatch(input);
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef IPREGEXP_H
|
|
||||||
#define IPREGEXP_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QRegExp>
|
|
||||||
#include <QRegExpValidator>
|
|
||||||
|
|
||||||
|
|
||||||
class IpRegExp : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit IpRegExp(QObject *parent = 0);
|
|
||||||
~IpRegExp();
|
|
||||||
|
|
||||||
// ipv4
|
|
||||||
static QRegExp ip4Regex();
|
|
||||||
static QRegExp ip4CidrRegex();
|
|
||||||
// ipv6
|
|
||||||
static QRegExp ip6Regex();
|
|
||||||
static QRegExp ip6CidrRegex();
|
|
||||||
// validators
|
|
||||||
static QRegExpValidator *ipv4Validator();
|
|
||||||
static QRegExpValidator *ipv4CidrValidator();
|
|
||||||
static QRegExpValidator *ipv6Validator();
|
|
||||||
static QRegExpValidator *ipv6CidrValidator();
|
|
||||||
// check
|
|
||||||
static bool checkString(const QString input, const QRegExp regexp);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* IPREGEXP_H */
|
|
@ -18,11 +18,9 @@
|
|||||||
#include "ipwidget.h"
|
#include "ipwidget.h"
|
||||||
#include "ui_ipwidget.h"
|
#include "ui_ipwidget.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
#include "errorwindow.h"
|
|
||||||
#include "ipregexp.h"
|
|
||||||
|
|
||||||
|
|
||||||
IpWidget::IpWidget(QWidget *parent)
|
IpWidget::IpWidget(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
@ -92,6 +90,15 @@ void IpWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void IpWidget::setShown(const bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
show();
|
||||||
|
else
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::createActions()
|
void IpWidget::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->pushButton_ipAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
connect(ui->pushButton_ipAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||||
@ -105,36 +112,32 @@ void IpWidget::createActions()
|
|||||||
connect(ui->comboBox_dhcp, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeDhcpClient(QString)));
|
connect(ui->comboBox_dhcp, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeDhcpClient(QString)));
|
||||||
// buttons
|
// buttons
|
||||||
connect(ui->pushButton_ipAddress, SIGNAL(clicked(bool)), this, SLOT(addIp()));
|
connect(ui->pushButton_ipAddress, SIGNAL(clicked(bool)), this, SLOT(addIp()));
|
||||||
connect(ui->lineEdit_ipAddress, SIGNAL(returnPressed()), this, SLOT(addIp()));
|
|
||||||
connect(ui->pushButton_ipRoutes, SIGNAL(clicked(bool)), this, SLOT(addIpRoutes()));
|
connect(ui->pushButton_ipRoutes, SIGNAL(clicked(bool)), this, SLOT(addIpRoutes()));
|
||||||
connect(ui->pushButton_ipAddress6, SIGNAL(clicked(bool)), this, SLOT(addIp6()));
|
connect(ui->pushButton_ipAddress6, SIGNAL(clicked(bool)), this, SLOT(addIp6()));
|
||||||
connect(ui->lineEdit_ipAddress6, SIGNAL(returnPressed()), this, SLOT(addIp6()));
|
|
||||||
connect(ui->pushButton_ipRoutes6, SIGNAL(clicked(bool)), this, SLOT(addIpRoutes6()));
|
connect(ui->pushButton_ipRoutes6, SIGNAL(clicked(bool)), this, SLOT(addIpRoutes6()));
|
||||||
connect(ui->pushButton_custom, SIGNAL(clicked(bool)), this, SLOT(addCustom()));
|
connect(ui->pushButton_custom, SIGNAL(clicked(bool)), this, SLOT(addCustom()));
|
||||||
connect(ui->lineEdit_custom, SIGNAL(returnPressed()), this, SLOT(addCustom()));
|
|
||||||
connect(ui->pushButton_dns, SIGNAL(clicked(bool)), this, SLOT(addDns()));
|
connect(ui->pushButton_dns, SIGNAL(clicked(bool)), this, SLOT(addDns()));
|
||||||
connect(ui->lineEdit_dns, SIGNAL(returnPressed()), this, SLOT(addDns()));
|
|
||||||
connect(ui->pushButton_dnsOptions, SIGNAL(clicked(bool)), this, SLOT(addDnsOpt()));
|
connect(ui->pushButton_dnsOptions, SIGNAL(clicked(bool)), this, SLOT(addDnsOpt()));
|
||||||
connect(ui->lineEdit_dnsOptions, SIGNAL(returnPressed()), this, SLOT(addDnsOpt()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::createFilter()
|
void IpWidget::createFilter()
|
||||||
{
|
{
|
||||||
|
// using input mask because validators is not comfortable
|
||||||
// ipv4
|
// ipv4
|
||||||
ui->lineEdit_ipAddress->setValidator(IpRegExp::ipv4CidrValidator());
|
ui->lineEdit_ipAddress->setInputMask(QString("999.999.999.999/99"));
|
||||||
ui->lineEdit_gateway->setValidator(IpRegExp::ipv4Validator());
|
ui->lineEdit_gateway->setInputMask(QString("999.999.999.999"));
|
||||||
ui->lineEdit_ipRoutes->setValidator(IpRegExp::ipv4CidrValidator());
|
ui->lineEdit_ipRoutes->setInputMask(QString("999.999.999.999/99"));
|
||||||
ui->lineEdit_ipRoutes2->setValidator(IpRegExp::ipv4Validator());
|
ui->lineEdit_ipRoutes2->setInputMask(QString("999.999.999.999"));
|
||||||
|
|
||||||
// ipv6
|
// ipv6
|
||||||
ui->lineEdit_ipAddress6->setValidator(IpRegExp::ipv6CidrValidator());
|
ui->lineEdit_ipAddress6->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh/999"));
|
||||||
ui->lineEdit_gateway6->setValidator(IpRegExp::ipv6Validator());
|
ui->lineEdit_gateway6->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"));
|
||||||
ui->lineEdit_ipRoutes6->setValidator(IpRegExp::ipv6CidrValidator());
|
ui->lineEdit_ipRoutes6->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh/999"));
|
||||||
ui->lineEdit_ipRoutes62->setValidator(IpRegExp::ipv6Validator());
|
ui->lineEdit_ipRoutes62->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"));
|
||||||
|
|
||||||
// dns
|
// dns
|
||||||
ui->lineEdit_dns->setValidator(IpRegExp::ipv4Validator());
|
ui->lineEdit_dns->setInputMask(QString("999.999.999.999"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -142,47 +145,110 @@ void IpWidget::keyPressEvent(QKeyEvent *pressedKey)
|
|||||||
{
|
{
|
||||||
if (pressedKey->key() == Qt::Key_Delete) {
|
if (pressedKey->key() == Qt::Key_Delete) {
|
||||||
if (ui->listWidget_ipAddress->hasFocus() &&
|
if (ui->listWidget_ipAddress->hasFocus() &&
|
||||||
(ui->listWidget_ipAddress->currentItem() != nullptr))
|
(ui->listWidget_ipAddress->currentItem() != 0))
|
||||||
delete ui->listWidget_ipAddress->currentItem();
|
delete ui->listWidget_ipAddress->currentItem();
|
||||||
else if (ui->listWidget_ipRoutes->hasFocus() &&
|
else if (ui->listWidget_ipRoutes->hasFocus() &&
|
||||||
(ui->listWidget_ipRoutes->currentItem() != nullptr))
|
(ui->listWidget_ipRoutes->currentItem() != 0))
|
||||||
delete ui->listWidget_ipRoutes->currentItem();
|
delete ui->listWidget_ipRoutes->currentItem();
|
||||||
else if (ui->listWidget_ipAddress6->hasFocus() &&
|
else if (ui->listWidget_ipAddress6->hasFocus() &&
|
||||||
(ui->listWidget_ipAddress6->currentItem() != nullptr))
|
(ui->listWidget_ipAddress6->currentItem() != 0))
|
||||||
delete ui->listWidget_ipAddress6->currentItem();
|
delete ui->listWidget_ipAddress6->currentItem();
|
||||||
else if (ui->listWidget_ipRoutes6->hasFocus() &&
|
else if (ui->listWidget_ipRoutes6->hasFocus() &&
|
||||||
(ui->listWidget_ipRoutes6->currentItem() != nullptr))
|
(ui->listWidget_ipRoutes6->currentItem() != 0))
|
||||||
delete ui->listWidget_ipRoutes6->currentItem();
|
delete ui->listWidget_ipRoutes6->currentItem();
|
||||||
else if (ui->listWidget_custom->hasFocus() &&
|
else if (ui->listWidget_custom->hasFocus() &&
|
||||||
(ui->listWidget_custom->currentItem() != nullptr))
|
(ui->listWidget_custom->currentItem() != 0))
|
||||||
delete ui->listWidget_custom->currentItem();
|
delete ui->listWidget_custom->currentItem();
|
||||||
else if (ui->listWidget_dns->hasFocus() &&
|
else if (ui->listWidget_dns->hasFocus() &&
|
||||||
(ui->listWidget_dns->currentItem() != nullptr))
|
(ui->listWidget_dns->currentItem() != 0))
|
||||||
delete ui->listWidget_dns->currentItem();
|
delete ui->listWidget_dns->currentItem();
|
||||||
else if (ui->listWidget_dnsOptions->hasFocus() &&
|
else if (ui->listWidget_dnsOptions->hasFocus() &&
|
||||||
(ui->listWidget_dnsOptions->currentItem() != nullptr))
|
(ui->listWidget_dnsOptions->currentItem() != 0))
|
||||||
delete ui->listWidget_dnsOptions->currentItem();
|
delete ui->listWidget_dnsOptions->currentItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString IpWidget::getIp(const QString rawIp)
|
||||||
|
{
|
||||||
|
QStringList ip = rawIp.split(QString("."));
|
||||||
|
|
||||||
|
// fix empty fields
|
||||||
|
if (ip[0].isEmpty())
|
||||||
|
ip[0] = QString("127");
|
||||||
|
if (ip[1].isEmpty())
|
||||||
|
ip[1] = QString("0");
|
||||||
|
if (ip[2].isEmpty())
|
||||||
|
ip[2] = QString("0");
|
||||||
|
if (ip[3].isEmpty())
|
||||||
|
ip[3] = QString("1");
|
||||||
|
// fix numbers
|
||||||
|
for (int i=0; i<4; i++)
|
||||||
|
if (ip[i].toInt() > 255)
|
||||||
|
ip[i] = QString("255");
|
||||||
|
|
||||||
|
return ip.join(QString("."));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString IpWidget::getPrefix(const QString rawPrefix)
|
||||||
|
{
|
||||||
|
QString prefix;
|
||||||
|
|
||||||
|
if (rawPrefix.isEmpty())
|
||||||
|
prefix = QString("24");
|
||||||
|
else if (rawPrefix.toInt() > 32)
|
||||||
|
prefix = QString("32");
|
||||||
|
else
|
||||||
|
prefix = rawPrefix;
|
||||||
|
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString IpWidget::getIp6(const QString rawIp)
|
||||||
|
{
|
||||||
|
QString ip = rawIp;
|
||||||
|
|
||||||
|
for (int i=0; i<5; i++)
|
||||||
|
ip.replace(QString(":::"), QString("::"));
|
||||||
|
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString IpWidget::getPrefix6(const QString rawPrefix)
|
||||||
|
{
|
||||||
|
QString prefix;
|
||||||
|
|
||||||
|
if (rawPrefix.isEmpty())
|
||||||
|
prefix = QString("64");
|
||||||
|
else if (rawPrefix.toInt() > 128)
|
||||||
|
prefix = QString("128");
|
||||||
|
else
|
||||||
|
prefix = rawPrefix;
|
||||||
|
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::addIp()
|
void IpWidget::addIp()
|
||||||
{
|
{
|
||||||
if (!IpRegExp::checkString(ui->lineEdit_ipAddress->text(), IpRegExp::ip4CidrRegex()))
|
QString ip = getIp(ui->lineEdit_ipAddress->text().remove(" ").split(QString("/"))[0]);
|
||||||
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp]"));
|
QString prefix = getPrefix(ui->lineEdit_ipAddress->text().remove(" ").split(QString("/"))[1]);
|
||||||
|
|
||||||
ui->listWidget_ipAddress->addItem(ui->lineEdit_ipAddress->text());
|
ui->listWidget_ipAddress->addItem(ip + QString("/") + prefix);
|
||||||
ui->lineEdit_ipAddress->clear();
|
ui->lineEdit_ipAddress->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::addIpRoutes()
|
void IpWidget::addIpRoutes()
|
||||||
{
|
{
|
||||||
if ((!IpRegExp::checkString(ui->lineEdit_ipRoutes->text(), IpRegExp::ip4CidrRegex())) ||
|
QString ip = getIp(ui->lineEdit_ipRoutes->text().remove(" ").split(QString("/"))[0]);
|
||||||
(!IpRegExp::checkString(ui->lineEdit_ipRoutes2->text(), IpRegExp::ip4Regex())))
|
QString prefix = getPrefix(ui->lineEdit_ipRoutes->text().remove(" ").split(QString("/"))[1]);
|
||||||
return ErrorWindow::showWindow(20, QString("[IpWidget::addIpRoutes]"));
|
QString ipVia = getIp(ui->lineEdit_ipRoutes2->text().remove(" "));
|
||||||
|
|
||||||
ui->listWidget_ipRoutes->addItem(QString("%1 via %2").arg(ui->lineEdit_ipRoutes->text()).arg(ui->lineEdit_ipRoutes2->text()));
|
ui->listWidget_ipRoutes->addItem(ip + QString("/") + prefix + QString(" via ") + ipVia);
|
||||||
ui->lineEdit_ipRoutes->clear();
|
ui->lineEdit_ipRoutes->clear();
|
||||||
ui->lineEdit_ipRoutes2->clear();
|
ui->lineEdit_ipRoutes2->clear();
|
||||||
}
|
}
|
||||||
@ -190,21 +256,21 @@ void IpWidget::addIpRoutes()
|
|||||||
|
|
||||||
void IpWidget::addIp6()
|
void IpWidget::addIp6()
|
||||||
{
|
{
|
||||||
if (!IpRegExp::checkString(ui->lineEdit_ipAddress6->text(), IpRegExp::ip6CidrRegex()))
|
QString ip = getIp6(ui->lineEdit_ipAddress6->text().remove(" ").split(QString("/"))[0]);
|
||||||
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp6]"));
|
QString prefix = getPrefix6(ui->lineEdit_ipAddress6->text().remove(" ").split(QString("/"))[1]);
|
||||||
|
|
||||||
ui->listWidget_ipAddress6->addItem(ui->lineEdit_ipAddress6->text());
|
ui->listWidget_ipAddress6->addItem(ip + QString("/") + prefix);
|
||||||
ui->lineEdit_ipAddress6->clear();
|
ui->lineEdit_ipAddress6->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::addIpRoutes6()
|
void IpWidget::addIpRoutes6()
|
||||||
{
|
{
|
||||||
if ((!IpRegExp::checkString(ui->lineEdit_ipRoutes6->text(), IpRegExp::ip6CidrRegex())) ||
|
QString ip = getIp6(ui->lineEdit_ipRoutes6->text().remove(" ").split(QString("/"))[0]);
|
||||||
(!IpRegExp::checkString(ui->lineEdit_ipRoutes62->text(), IpRegExp::ip6Regex())))
|
QString prefix = getPrefix6(ui->lineEdit_ipRoutes6->text().remove(" ").split(QString("/"))[1]);
|
||||||
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp6Routes]"));
|
QString ipVia = getIp6(ui->lineEdit_ipRoutes62->text().remove(" "));
|
||||||
|
|
||||||
ui->listWidget_ipRoutes6->addItem(QString("%1 via %2").arg(ui->lineEdit_ipRoutes6->text()).arg(ui->lineEdit_ipRoutes62->text()));
|
ui->listWidget_ipRoutes6->addItem(ip + QString("/") + prefix + QString(" via ") + ipVia);
|
||||||
ui->lineEdit_ipRoutes6->clear();
|
ui->lineEdit_ipRoutes6->clear();
|
||||||
ui->lineEdit_ipRoutes62->clear();
|
ui->lineEdit_ipRoutes62->clear();
|
||||||
}
|
}
|
||||||
@ -220,10 +286,9 @@ void IpWidget::addCustom()
|
|||||||
|
|
||||||
void IpWidget::addDns()
|
void IpWidget::addDns()
|
||||||
{
|
{
|
||||||
if (!IpRegExp::checkString(ui->lineEdit_dns->text(), IpRegExp::ip4Regex()))
|
QString ip = getIp(ui->lineEdit_dns->text().remove(" "));
|
||||||
return ErrorWindow::showWindow(20, QString("[IpWidget::addDns]"));
|
|
||||||
|
|
||||||
ui->listWidget_dns->addItem(ui->lineEdit_dns->text());
|
ui->listWidget_dns->addItem(ip);
|
||||||
ui->lineEdit_dns->clear();
|
ui->lineEdit_dns->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,36 +303,64 @@ void IpWidget::addDnsOpt()
|
|||||||
|
|
||||||
void IpWidget::changeIpMode(const QString currentText)
|
void IpWidget::changeIpMode(const QString currentText)
|
||||||
{
|
{
|
||||||
ui->widget_ip->setHidden(currentText == QString("dhcp"));
|
if (currentText == QString("dhcp"))
|
||||||
|
ui->widget_ip->setHidden(true);
|
||||||
|
else if (currentText == QString("static"))
|
||||||
|
ui->widget_ip->setHidden(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::ipEnable(const int state)
|
void IpWidget::ipEnable(const int state)
|
||||||
{
|
{
|
||||||
ui->comboBox_ip->setDisabled(state == 0);
|
if (state == 0) {
|
||||||
ui->widget_ip->setDisabled(state == 0);
|
ui->comboBox_ip->setDisabled(true);
|
||||||
ui->widget_ipRoutes->setDisabled(state == 0);
|
ui->widget_ip->setDisabled(true);
|
||||||
|
ui->widget_ipRoutes->setDisabled(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->comboBox_ip->setEnabled(true);
|
||||||
|
ui->widget_ip->setEnabled(true);
|
||||||
|
ui->widget_ipRoutes->setEnabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::changeIp6Mode(const QString currentText)
|
void IpWidget::changeIp6Mode(const QString currentText)
|
||||||
{
|
{
|
||||||
ui->widget_ip6->setHidden(currentText.startsWith(QString("dhcp")));
|
if ((currentText == QString("dhcp")) ||
|
||||||
|
(currentText == QString("dhcp-noaddr")))
|
||||||
|
ui->widget_ip6->setHidden(true);
|
||||||
|
else if ((currentText == QString("static")) ||
|
||||||
|
(currentText == QString("stateless")))
|
||||||
|
ui->widget_ip6->setHidden(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::ip6Enable(const int state)
|
void IpWidget::ip6Enable(const int state)
|
||||||
{
|
{
|
||||||
ui->comboBox_ip6->setDisabled(state == 0);
|
if (state == 0) {
|
||||||
ui->widget_ip6->setDisabled(state == 0);
|
ui->comboBox_ip6->setDisabled(true);
|
||||||
ui->widget_ipRoutes6->setDisabled(state == 0);
|
ui->widget_ip6->setDisabled(true);
|
||||||
|
ui->widget_ipRoutes6->setDisabled(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->comboBox_ip6->setEnabled(true);
|
||||||
|
ui->widget_ip6->setEnabled(true);
|
||||||
|
ui->widget_ipRoutes6->setEnabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::changeDhcpClient(const QString currentText)
|
void IpWidget::changeDhcpClient(const QString currentText)
|
||||||
{
|
{
|
||||||
ui->widget_dhcpcdOpt->setHidden(currentText != QString("dhcpcd"));
|
if (currentText == QString("dhcpcd")) {
|
||||||
ui->widget_dhclientOpt->setHidden(currentText == QString("dhcpcd"));
|
ui->widget_dhcpcdOpt->setHidden(false);
|
||||||
|
ui->widget_dhclientOpt->setHidden(true);
|
||||||
|
}
|
||||||
|
else if (currentText == QString("dhclient")) {
|
||||||
|
ui->widget_dhcpcdOpt->setHidden(true);
|
||||||
|
ui->widget_dhclientOpt->setHidden(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -275,113 +368,120 @@ void IpWidget::showAdvanced()
|
|||||||
{
|
{
|
||||||
if (ui->pushButton_ipAdvanced->isChecked()) {
|
if (ui->pushButton_ipAdvanced->isChecked()) {
|
||||||
ui->widget_ipAdvanced->setHidden(false);
|
ui->widget_ipAdvanced->setHidden(false);
|
||||||
ui->pushButton_ipAdvanced->setArrowType(Qt::UpArrow);
|
ui->pushButton_ipAdvanced->setText(QApplication::translate("IpWidget", "Hide advanced"));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ui->widget_ipAdvanced->setHidden(true);
|
ui->widget_ipAdvanced->setHidden(true);
|
||||||
ui->pushButton_ipAdvanced->setArrowType(Qt::DownArrow);
|
ui->pushButton_ipAdvanced->setText(QApplication::translate("IpWidget", "Show advanced"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> IpWidget::getSettings()
|
QMap<QString, QString> IpWidget::getSettings()
|
||||||
{
|
{
|
||||||
QMap<QString, QString> settings;
|
QMap<QString, QString> ipSettings;
|
||||||
|
|
||||||
if (isOk() != 0) return settings;
|
if (isOk() != 0)
|
||||||
|
return ipSettings;
|
||||||
|
|
||||||
if (ui->checkBox_ip->checkState() == Qt::Checked) {
|
if (ui->checkBox_ip->checkState() == Qt::Checked) {
|
||||||
settings[QString("IP")] = ui->comboBox_ip->currentText();
|
ipSettings[QString("IP")] = ui->comboBox_ip->currentText();
|
||||||
if (ui->comboBox_ip->currentText() == QString("static")) {
|
if (ui->comboBox_ip->currentText() == QString("static")) {
|
||||||
QStringList addresses;
|
QStringList addresses;
|
||||||
for (int i=0; i<ui->listWidget_ipAddress->count(); i++)
|
for (int i=0; i<ui->listWidget_ipAddress->count(); i++)
|
||||||
addresses.append(QString("'%1'").arg(ui->listWidget_ipAddress->item(i)->text()));
|
addresses.append(QString("'") + ui->listWidget_ipAddress->item(i)->text() + QString("'"));
|
||||||
settings[QString("Address")] = addresses.join(QChar(' '));
|
ipSettings[QString("Address")] = addresses.join(QString(" "));
|
||||||
settings[QString("Gateway")] = QString("'%1'").arg(ui->lineEdit_gateway->text());
|
ipSettings[QString("Gateway")] = QString("'") + ui->lineEdit_gateway->text() + QString("'");
|
||||||
}
|
}
|
||||||
if (ui->listWidget_ipRoutes->count() > 0) {
|
if (ui->listWidget_ipRoutes->count() > 0) {
|
||||||
QStringList routes;
|
QStringList routes;
|
||||||
for (int i=0; i<ui->listWidget_ipRoutes->count(); i++)
|
for (int i=0; i<ui->listWidget_ipRoutes->count(); i++)
|
||||||
routes.append(QString("'%1'").arg(ui->listWidget_ipRoutes->item(i)->text()));
|
routes.append(QString("'") + ui->listWidget_ipRoutes->item(i)->text() + QString("'"));
|
||||||
settings[QString("Routes")] = routes.join(QChar(' '));
|
ipSettings[QString("Routes")] = routes.join(QString(" "));
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
settings[QString("IP")] = QString("no");
|
else
|
||||||
|
ipSettings[QString("IP")] = QString("no");
|
||||||
if (ui->checkBox_ip6->checkState() == Qt::Checked) {
|
if (ui->checkBox_ip6->checkState() == Qt::Checked) {
|
||||||
settings[QString("IP6")] = ui->comboBox_ip6->currentText();
|
ipSettings[QString("IP6")] = ui->comboBox_ip6->currentText();
|
||||||
if ((ui->comboBox_ip6->currentText() == QString("static")) ||
|
if ((ui->comboBox_ip6->currentText() == QString("static")) ||
|
||||||
(ui->comboBox_ip6->currentText() == QString("stateless"))) {
|
(ui->comboBox_ip6->currentText() == QString("stateless"))) {
|
||||||
QStringList addresses;
|
QStringList addresses;
|
||||||
for (int i=0; i<ui->listWidget_ipAddress6->count(); i++)
|
for (int i=0; i<ui->listWidget_ipAddress6->count(); i++)
|
||||||
addresses.append(QString("'%1'").arg(ui->listWidget_ipAddress6->item(i)->text()));
|
addresses.append(QString("'") + ui->listWidget_ipAddress6->item(i)->text() + QString("'"));
|
||||||
settings[QString("Address6")] = addresses.join(QChar(' '));
|
ipSettings[QString("Address6")] = addresses.join(QString(" "));
|
||||||
settings[QString("Gateway6")] = QString("'%1'").arg(ui->lineEdit_gateway6->text());
|
ipSettings[QString("Gateway6")] = QString("'") + ui->lineEdit_gateway6->text() + QString("'");
|
||||||
}
|
}
|
||||||
if (ui->listWidget_ipRoutes6->count() > 0) {
|
if (ui->listWidget_ipRoutes6->count() > 0) {
|
||||||
QStringList routes;
|
QStringList routes;
|
||||||
for (int i=0; i<ui->listWidget_ipRoutes6->count(); i++)
|
for (int i=0; i<ui->listWidget_ipRoutes6->count(); i++)
|
||||||
routes.append(QString("'%1'").arg(ui->listWidget_ipRoutes6->item(i)->text()));
|
routes.append(QString("'") + ui->listWidget_ipRoutes6->item(i)->text() + QString("'"));
|
||||||
settings[QString("Routes6")] = routes.join(QChar(' '));
|
ipSettings[QString("Routes6")] = routes.join(QString(" "));
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
settings[QString("IP6")] = QString("no");
|
else
|
||||||
|
ipSettings[QString("IP6")] = QString("no");
|
||||||
if (ui->listWidget_custom->count() > 0) {
|
if (ui->listWidget_custom->count() > 0) {
|
||||||
QStringList custom;
|
QStringList custom;
|
||||||
for (int i=0; i<ui->listWidget_custom->count(); i++)
|
for (int i=0; i<ui->listWidget_custom->count(); i++)
|
||||||
custom.append(QString("'%1'").arg(ui->listWidget_custom->item(i)->text()));
|
custom.append(QString("'") + ui->listWidget_custom->item(i)->text() + QString("'"));
|
||||||
settings[QString("IPCustom")] = custom.join(QChar(' '));
|
ipSettings[QString("IPCustom")] = custom.join(QString(" "));
|
||||||
}
|
}
|
||||||
if (!ui->lineEdit_hostname->text().isEmpty())
|
if (!ui->lineEdit_hostname->text().isEmpty())
|
||||||
settings[QString("Hostname")] = QString("'%1'").arg(ui->lineEdit_hostname->text());
|
ipSettings[QString("Hostname")] = QString("'") + ui->lineEdit_hostname->text() + QString("'");
|
||||||
if (ui->spinBox_timeoutDad->value() != 3)
|
if (ui->spinBox_timeoutDad->value() != 3)
|
||||||
settings[QString("TimeoutDAD")] = QString::number(ui->spinBox_timeoutDad->value());
|
ipSettings[QString("TimeoutDAD")] = QString::number(ui->spinBox_timeoutDad->value());
|
||||||
if (ui->comboBox_dhcp->currentText() == QString("dhcpcd")) {
|
if (ui->comboBox_dhcp->currentText() == QString("dhcpcd")) {
|
||||||
if (!ui->lineEdit_dhcpcdOpt->text().isEmpty())
|
if (!ui->lineEdit_dhcpcdOpt->text().isEmpty())
|
||||||
settings[QString("DhcpcdOptions")] = QString("'%1'").arg(ui->lineEdit_dhcpcdOpt->text());
|
ipSettings[QString("DhcpcdOptions")] = QString("'") + ui->lineEdit_dhcpcdOpt->text() + QString("'");
|
||||||
} else if (ui->comboBox_dhcp->currentText() == QString("dhclient")) {
|
}
|
||||||
settings[QString("DHCPClient")] = ui->comboBox_dhcp->currentText();
|
else if (ui->comboBox_dhcp->currentText() == QString("dhclient")) {
|
||||||
|
ipSettings[QString("DHCPClient")] = ui->comboBox_dhcp->currentText();
|
||||||
if (!ui->lineEdit_dhclientOpt->text().isEmpty())
|
if (!ui->lineEdit_dhclientOpt->text().isEmpty())
|
||||||
settings[QString("DhclientOptions")] = QString("'%1'").arg(ui->lineEdit_dhclientOpt->text());
|
ipSettings[QString("DhclientOptions")] = QString("'") + ui->lineEdit_dhclientOpt->text() + QString("'");
|
||||||
if (!ui->lineEdit_dhclientOpt6->text().isEmpty())
|
if (!ui->lineEdit_dhclientOpt6->text().isEmpty())
|
||||||
settings[QString("DhclientOptions6")] = QString("'%1'").arg(ui->lineEdit_dhclientOpt6->text());
|
ipSettings[QString("DhclientOptions6")] = QString("'") + ui->lineEdit_dhclientOpt6->text() + QString("'");
|
||||||
}
|
}
|
||||||
if (ui->spinBox_timeoutDhcp->value() != 30)
|
if (ui->spinBox_timeoutDhcp->value() != 30)
|
||||||
settings[QString("TimeoutDHCP")] = QString::number(ui->spinBox_timeoutDhcp->value());
|
ipSettings[QString("TimeoutDHCP")] = QString::number(ui->spinBox_timeoutDhcp->value());
|
||||||
if (ui->checkBox_dhcp->checkState() == Qt::Checked)
|
if (ui->checkBox_dhcp->checkState() == Qt::Checked)
|
||||||
settings[QString("DHCPReleaseOnStop")] = QString("yes");
|
ipSettings[QString("DHCPReleaseOnStop")] = QString("yes");
|
||||||
if (ui->listWidget_dns->count() > 0) {
|
if (ui->listWidget_dns->count() > 0) {
|
||||||
QStringList dns;
|
QStringList dns;
|
||||||
for (int i=0; i<ui->listWidget_dns->count(); i++)
|
for (int i=0; i<ui->listWidget_dns->count(); i++)
|
||||||
dns.append(QString("'%1'").arg(ui->listWidget_dns->item(i)->text()));
|
dns.append(QString("'") + ui->listWidget_dns->item(i)->text() + QString("'"));
|
||||||
settings[QString("DNS")] = dns.join(QChar(' '));
|
ipSettings[QString("DNS")] = dns.join(QString(" "));
|
||||||
}
|
}
|
||||||
if (!ui->lineEdit_dnsDomain->text().isEmpty())
|
if (!ui->lineEdit_dnsDomain->text().isEmpty())
|
||||||
settings[QString("DNSDomain")] = QString("'%1'").arg(ui->lineEdit_dnsDomain->text());
|
ipSettings[QString("DNSDomain")] = QString("'") + ui->lineEdit_dnsDomain->text() + QString("'");
|
||||||
if (!ui->lineEdit_dnsSearch->text().isEmpty())
|
if (!ui->lineEdit_dnsSearch->text().isEmpty())
|
||||||
settings[QString("DNSSearch")] = QString("'%1'").arg(ui->lineEdit_dnsSearch->text());
|
ipSettings[QString("DNSSearch")] = QString("'") + ui->lineEdit_dnsSearch->text() + QString("'");
|
||||||
if (ui->listWidget_dnsOptions->count() > 0) {
|
if (ui->listWidget_dnsOptions->count() > 0) {
|
||||||
QStringList dnsOpt;
|
QStringList dnsOpt;
|
||||||
for (int i=0; i<ui->listWidget_dnsOptions->count(); i++)
|
for (int i=0; i<ui->listWidget_dnsOptions->count(); i++)
|
||||||
dnsOpt.append(QString("'%1'").arg(ui->listWidget_dnsOptions->item(i)->text()));
|
dnsOpt.append(QString("'") + ui->listWidget_dnsOptions->item(i)->text() + QString("'"));
|
||||||
settings[QString("DNSOptions")] = dnsOpt.join(QChar(' '));
|
ipSettings[QString("DNSOptions")] = dnsOpt.join(QString(" "));
|
||||||
}
|
}
|
||||||
|
|
||||||
return settings;
|
return ipSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int IpWidget::isOk()
|
int IpWidget::isOk()
|
||||||
{
|
{
|
||||||
// ip settings is not set
|
// ip settings is not set
|
||||||
if ((ui->checkBox_ip->checkState() == Qt::Checked) &&
|
if (ui->checkBox_ip->checkState() == Qt::Checked)
|
||||||
(ui->comboBox_ip->currentText() == QString("static")))
|
if (ui->comboBox_ip->currentText() == QString("static"))
|
||||||
if ((ui->listWidget_ipAddress->count() == 0) ||
|
if ((ui->listWidget_ipAddress->count() == 0) ||
|
||||||
(ui->lineEdit_gateway->text().isEmpty())) return 1;
|
(ui->lineEdit_gateway->text().isEmpty()))
|
||||||
|
return 1;
|
||||||
// ipv6 settings is not set
|
// ipv6 settings is not set
|
||||||
if ((ui->checkBox_ip6->checkState() == Qt::Checked) &&
|
if (ui->checkBox_ip6->checkState() == Qt::Checked)
|
||||||
((ui->comboBox_ip6->currentText() == QString("static")) ||
|
if ((ui->comboBox_ip6->currentText() == QString("static")) ||
|
||||||
(ui->comboBox_ip6->currentText() == QString("stateless"))))
|
(ui->comboBox_ip6->currentText() == QString("stateless")))
|
||||||
if ((ui->listWidget_ipAddress6->count() == 0) ||
|
if ((ui->listWidget_ipAddress6->count() == 0) ||
|
||||||
(ui->lineEdit_gateway6->text().isEmpty())) return 2;
|
(ui->lineEdit_gateway6->text().isEmpty()))
|
||||||
|
return 2;
|
||||||
// all fine
|
// all fine
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -389,67 +489,76 @@ int IpWidget::isOk()
|
|||||||
|
|
||||||
void IpWidget::setSettings(const QMap<QString, QString> settings)
|
void IpWidget::setSettings(const QMap<QString, QString> settings)
|
||||||
{
|
{
|
||||||
clear();
|
QMap<QString, QString> ipSettings = settings;
|
||||||
|
|
||||||
if (settings.contains(QString("IP"))) {
|
if (ipSettings.contains(QString("IP"))) {
|
||||||
if (settings[QString("IP")] == QString("no"))
|
if (ipSettings[QString("IP")].remove(QString("'")) == QString("no"))
|
||||||
ui->checkBox_ip->setCheckState(Qt::Unchecked);
|
ui->checkBox_ip->setCheckState(Qt::Unchecked);
|
||||||
else {
|
else {
|
||||||
ui->checkBox_ip->setCheckState(Qt::Checked);
|
ui->checkBox_ip->setCheckState(Qt::Checked);
|
||||||
int index = ui->comboBox_ip->findText(settings[QString("IP")]);
|
for (int i=0; i<ui->comboBox_ip->count(); i++)
|
||||||
ui->comboBox_ip->setCurrentIndex(index);
|
if (ipSettings[QString("IP")].remove(QString("'")) == ui->comboBox_ip->itemText(i))
|
||||||
|
ui->comboBox_ip->setCurrentIndex(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (settings.contains(QString("Address")))
|
if (ipSettings.contains(QString("Address")))
|
||||||
ui->listWidget_ipAddress->addItems(settings[QString("Address")].split(QChar('\n')));
|
ui->listWidget_ipAddress->addItems(ipSettings[QString("Address")].remove(QString("'")).split(QString(" ")));
|
||||||
if (settings.contains(QString("Gateway")))
|
if (ipSettings.contains(QString("Gateway")))
|
||||||
ui->lineEdit_gateway->setText(settings[QString("Gateway")]);
|
ui->lineEdit_gateway->setText(ipSettings[QString("Gateway")].remove(QString("'")));
|
||||||
if (settings.contains(QString("Routes")))
|
if (ipSettings.contains(QString("Routes")))
|
||||||
ui->listWidget_ipRoutes->addItems(settings[QString("Routes")].split(QChar('\n')));
|
ui->listWidget_ipRoutes->addItems(ipSettings[QString("Routes")].remove(QString("'")).split(QString(" ")));
|
||||||
if (settings.contains(QString("IP6"))) {
|
if (ipSettings.contains(QString("IP6"))) {
|
||||||
if (settings[QString("IP6")] == QString("no"))
|
if (ipSettings[QString("IP6")].remove(QString("'")) == QString("no"))
|
||||||
ui->checkBox_ip6->setCheckState(Qt::Unchecked);
|
ui->checkBox_ip6->setCheckState(Qt::Unchecked);
|
||||||
else {
|
else {
|
||||||
ui->checkBox_ip6->setCheckState(Qt::Checked);
|
ui->checkBox_ip6->setCheckState(Qt::Checked);
|
||||||
int index = ui->comboBox_ip6->findText(settings[QString("IP6")]);
|
for (int i=0; i<ui->comboBox_ip6->count(); i++)
|
||||||
ui->comboBox_ip6->setCurrentIndex(index);
|
if (ipSettings[QString("IP6")].remove(QString("'")) == ui->comboBox_ip6->itemText(i))
|
||||||
|
ui->comboBox_ip6->setCurrentIndex(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (settings.contains(QString("Address6")))
|
if (ipSettings.contains(QString("Address6")))
|
||||||
ui->listWidget_ipAddress6->addItems(settings[QString("Address6")].split(QChar('\n')));
|
ui->listWidget_ipAddress6->addItems(ipSettings[QString("Address6")].remove(QString("'")).split(QString(" ")));
|
||||||
if (settings.contains(QString("Gateway6")))
|
if (ipSettings.contains(QString("Gateway6")))
|
||||||
ui->lineEdit_gateway6->setText(settings[QString("Gateway6")]);
|
ui->lineEdit_gateway6->setText(ipSettings[QString("Gateway6")].remove(QString("'")));
|
||||||
if (settings.contains(QString("Routes6")))
|
if (ipSettings.contains(QString("Routes6")))
|
||||||
ui->listWidget_ipRoutes6->addItems(settings[QString("Routes6")].split(QChar('\n')));
|
ui->listWidget_ipRoutes6->addItems(ipSettings[QString("Routes6")].remove(QString("'")).split(QString(" ")));
|
||||||
if (settings.contains(QString("IPCustom")))
|
if (ipSettings.contains(QString("IPCustom"))) {
|
||||||
ui->listWidget_custom->addItems(settings[QString("IPCustom")].split(QChar('\n')));
|
QStringList custom;
|
||||||
if (settings.contains(QString("Hostname")))
|
if (ipSettings[QString("IPCustom")].contains(QString("\n")))
|
||||||
ui->lineEdit_hostname->setText(settings[QString("Hostname")]);
|
custom = ipSettings[QString("IPCustom")].split(QString("'\n'"));
|
||||||
if (settings.contains(QString("TimeoutDAD")))
|
else
|
||||||
ui->spinBox_timeoutDad->setValue(settings[QString("TimeoutDAD")].toInt());
|
custom = ipSettings[QString("IPCustom")].split(QString("' '"));
|
||||||
if (settings.contains(QString("DHCPClient"))) {
|
for (int i=0; i<custom.count(); i++)
|
||||||
int index = ui->comboBox_dhcp->findText(settings[QString("DHCPClient")]);
|
ui->listWidget_custom->addItem(custom[i].remove(QString("'")));
|
||||||
ui->comboBox_dhcp->setCurrentIndex(index);
|
|
||||||
}
|
}
|
||||||
if (settings.contains(QString("DhcpcdOptions")))
|
if (ipSettings.contains(QString("Hostname")))
|
||||||
ui->lineEdit_dhcpcdOpt->setText(settings[QString("DhcpcdOptions")]);
|
ui->lineEdit_hostname->setText(ipSettings[QString("Hostname")].remove(QString("'")));
|
||||||
if (settings.contains(QString("DhclientOptions")))
|
if (ipSettings.contains(QString("TimeoutDAD")))
|
||||||
ui->lineEdit_dhclientOpt->setText(settings[QString("DhclientOptions")]);
|
ui->spinBox_timeoutDad->setValue(ipSettings[QString("TimeoutDAD")].toInt());
|
||||||
if (settings.contains(QString("DhclientOptions6")))
|
if (ipSettings.contains(QString("DHCPClient")))
|
||||||
ui->lineEdit_dhclientOpt6->setText(settings[QString("DhclientOptions6")]);
|
for (int i=0; i<ui->comboBox_dhcp->count(); i++)
|
||||||
if (settings.contains(QString("TimeoutDHCP")))
|
if (ipSettings[QString("DHCPClient")].remove(QString("'")) == ui->comboBox_dhcp->itemText(i))
|
||||||
ui->spinBox_timeoutDhcp->setValue(settings[QString("TimeoutDHCP")].toInt());
|
ui->comboBox_dhcp->setCurrentIndex(i);
|
||||||
if (settings.contains(QString("DHCPReleaseOnStop")))
|
if (ipSettings.contains(QString("DhcpcdOptions")))
|
||||||
if (settings[QString("DHCPReleaseOnStop")] == QString("yes"))
|
ui->lineEdit_dhcpcdOpt->setText(ipSettings[QString("DhcpcdOptions")].remove(QString("'")));
|
||||||
|
if (ipSettings.contains(QString("DhclientOptions")))
|
||||||
|
ui->lineEdit_dhclientOpt->setText(ipSettings[QString("DhclientOptions")].remove(QString("'")));
|
||||||
|
if (ipSettings.contains(QString("DhclientOptions6")))
|
||||||
|
ui->lineEdit_dhclientOpt6->setText(ipSettings[QString("DhclientOptions6")].remove(QString("'")));
|
||||||
|
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"))
|
||||||
ui->checkBox_dhcp->setCheckState(Qt::Checked);
|
ui->checkBox_dhcp->setCheckState(Qt::Checked);
|
||||||
if (settings.contains(QString("DNS")))
|
if (ipSettings.contains(QString("DNS")))
|
||||||
ui->listWidget_dns->addItems(settings[QString("DNS")].split(QChar('\n')));
|
ui->listWidget_dns->addItems(ipSettings[QString("DNS")].remove(QString("'")).split(QString(" ")));
|
||||||
if (settings.contains(QString("DNSDomain")))
|
if (ipSettings.contains(QString("DNSDomain")))
|
||||||
ui->lineEdit_dnsDomain->setText(settings[QString("DNSDomain")]);
|
ui->lineEdit_dnsDomain->setText(ipSettings[QString("DNSDomain")].remove(QString("'")));
|
||||||
if (settings.contains(QString("DNSSearch")))
|
if (ipSettings.contains(QString("DNSSearch")))
|
||||||
ui->lineEdit_dnsSearch->setText(settings[QString("DNSSearch")]);
|
ui->lineEdit_dnsSearch->setText(ipSettings[QString("DNSSearch")].remove(QString("'")));
|
||||||
if (settings.contains(QString("DNSOptions")))
|
if (ipSettings.contains(QString("DNSOptions")))
|
||||||
ui->listWidget_dnsOptions->addItems(settings[QString("DNSOptions")].split(QChar('\n')));
|
ui->listWidget_dnsOptions->addItems(ipSettings[QString("DNSOptions")].remove(QString("'")).split(QString(" ")));
|
||||||
|
|
||||||
ipEnable(ui->checkBox_ip->checkState());
|
ipEnable(ui->checkBox_ip->checkState());
|
||||||
changeIpMode(ui->comboBox_ip->currentText());
|
changeIpMode(ui->comboBox_ip->currentText());
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(const bool state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// buttons
|
// buttons
|
||||||
@ -63,6 +64,10 @@ private:
|
|||||||
void createActions();
|
void createActions();
|
||||||
void createFilter();
|
void createFilter();
|
||||||
void keyPressEvent(QKeyEvent *pressedKey);
|
void keyPressEvent(QKeyEvent *pressedKey);
|
||||||
|
QString getIp(const QString rawIp);
|
||||||
|
QString getPrefix(const QString rawPrefix);
|
||||||
|
QString getIp6(const QString rawIp);
|
||||||
|
QString getPrefix6(const QString rawPrefix);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include "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::createFilter()
|
|
||||||
{
|
|
||||||
// mac
|
|
||||||
ui->lineEdit_mac->setInputMask(QString(">hh:hh:hh:hh:hh:hh"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> MacvlanWidget::getSettings()
|
|
||||||
{
|
|
||||||
QMap<QString, QString> settings;
|
|
||||||
|
|
||||||
if (isOk() != 0) return settings;
|
|
||||||
|
|
||||||
settings[QString("Mode")] = ui->comboBox_mode->currentText();
|
|
||||||
if (!ui->lineEdit_mac->text().remove(QChar(':')).isEmpty())
|
|
||||||
settings[QString("MACAddress")] = ui->lineEdit_mac->text();
|
|
||||||
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MacvlanWidget::isOk()
|
|
||||||
{
|
|
||||||
// all fine
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MacvlanWidget::setSettings(const QMap<QString, QString> settings)
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
|
|
||||||
if (settings.contains(QString("Mode"))) {
|
|
||||||
int index = ui->comboBox_mode->findText(settings[QString("Mode")]);
|
|
||||||
ui->comboBox_mode->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
if (settings.contains(QString("MACAddress")))
|
|
||||||
ui->lineEdit_mac->setText(settings[QString("MACAddress")]);
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#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();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::MacvlanWidget *ui;
|
|
||||||
void createFilter();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* MACVLANWIDGET_H */
|
|
@ -1,121 +0,0 @@
|
|||||||
<?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>79</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<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">
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_mode">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_mode">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>1</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Mode</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_mode">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<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="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>1</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>MAC address</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_mac">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Optional static MAC address</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -17,196 +17,90 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDBusConnection>
|
|
||||||
#include <QDBusMessage>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QLibraryInfo>
|
#include <QTextStream>
|
||||||
#include <QProcessEnvironment>
|
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <language/language.h>
|
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "messages.h"
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
#include <pdebug/pdebug-time.h>
|
|
||||||
#endif /* QT_VERSION >= 0x050000 */
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
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() && arguments[0].toBool());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QVariantMap 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
|
||||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
|
||||||
if (!args[QString("debug")].toBool()) args[QString("debug")] = (debugEnv == QString("yes"));
|
|
||||||
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")] = static_cast<int>(3);
|
|
||||||
if (args[QString("open")].toString() != QString("PROFILE"))
|
|
||||||
args[QString("tab")] = static_cast<int>(2);
|
|
||||||
if (args[QString("select")].toString() != QString("PROFILE"))
|
|
||||||
args[QString("tab")] = static_cast<int>(1);
|
|
||||||
|
|
||||||
// check
|
|
||||||
QString robotEnv = environment.value(QString("SKYNET"), QString(""));
|
|
||||||
if (!robotEnv.isEmpty()) {
|
|
||||||
cout << "Sorry, this software is only for humans" << endl;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// detach from console
|
|
||||||
if (args[QString("detached")].toBool())
|
|
||||||
daemon(0, 0);
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
qInstallMessageHandler(debugString);
|
|
||||||
#endif
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
QApplication::setQuitOnLastWindowClosed(false);
|
|
||||||
// reread translations according to flags
|
// translation
|
||||||
QString language = Language::defineLanguage(args[QString("config")].toString(),
|
QString configPath = QDir::homePath() + QDir::separator() + QString(".config") +
|
||||||
args[QString("options")].toString());
|
QDir::separator() + QString("netctl-gui.conf");
|
||||||
QTranslator qtTranslator;
|
QFile configFile(configPath);
|
||||||
qtTranslator.load(QString("qt_%1").arg(language), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
QString fileStr;
|
||||||
a.installTranslator(&qtTranslator);
|
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();
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
translator.load(QString(":/translations/%1").arg(language));
|
translator.load(QString(":/translations/") + language);
|
||||||
a.installTranslator(&translator);
|
a.installTranslator(&translator);
|
||||||
|
|
||||||
// running
|
QString helpMessage = QString("");
|
||||||
if (args[QString("error")].toBool()) {
|
helpMessage += QApplication::translate("MainWindow", " Netctl GUI\n");
|
||||||
cout << errorMessage().toUtf8().data() << endl;
|
helpMessage += QApplication::translate("MainWindow", "Version : %1 License : GPLv3\n")
|
||||||
cout << helpMessage().toUtf8().data();
|
.arg(QString(VERSION));
|
||||||
return 1;
|
helpMessage += QApplication::translate("MainWindow", " Evgeniy Alekseev aka arcanis\n");
|
||||||
} else if (args[QString("help")].toBool()) {
|
helpMessage += QApplication::translate("MainWindow", " E-mail : esalexeev@gmail.com\n\n");
|
||||||
cout << helpMessage().toUtf8().data();
|
helpMessage += QApplication::translate("MainWindow", "Usage:\n");
|
||||||
return 0;
|
helpMessage += QApplication::translate("MainWindow", "netctl-gui [ --default ] [ -t NUM | --tab NUM ] [ -h | --help]\n\n");
|
||||||
} else if (args[QString("info")].toBool()) {
|
helpMessage += QApplication::translate("MainWindow", "Parametrs:\n");
|
||||||
cout << versionMessage().toUtf8().data() << endl;
|
helpMessage += QApplication::translate("MainWindow", " --default - start with default settings\n");
|
||||||
cout << infoMessage().toUtf8().data();
|
helpMessage += QApplication::translate("MainWindow", " -t NUM --tab NUM - open a tab with number NUM\n");
|
||||||
return 0;
|
helpMessage += QApplication::translate("MainWindow", " -h --help - show this help and exit\n");
|
||||||
} else if (args[QString("version")].toBool()) {
|
bool defaultSettings = false;
|
||||||
cout << versionMessage().toUtf8().data();
|
int tabNumber = 0;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if exists
|
for (int i=1; i<argc; i++) {
|
||||||
if (existingSessionOperation(QString("Active"))) {
|
// help message
|
||||||
if ((getuid() == getUidFromSession(0)) && (geteuid() == getUidFromSession(1))) {
|
if (((argv[i][0] == '-') && (argv[i][1] == 'h') && (argv[i][2] == '\0')) ||
|
||||||
// restore session
|
((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 'h') && (argv[i][3] == 'e') &&
|
||||||
cout << QCoreApplication::translate("MainWindow", "Restore existing session.")
|
(argv[i][4] == 'l') && (argv[i][5] == 'p') && (argv[i][6] == '\0'))) {
|
||||||
.toUtf8().data() << endl;
|
cout << helpMessage.toUtf8().data();
|
||||||
existingSessionOperation(QString("Restore"));
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((getuid() == getUidFromSession(0)) && (geteuid() != getUidFromSession(1))) {
|
}
|
||||||
cout << QCoreApplication::translate("MainWindow", "Close existing session.")
|
// default settings
|
||||||
.toUtf8().data() << endl;
|
else if ((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 'd') && (argv[i][3] == 'e') &&
|
||||||
existingSessionOperation(QString("Close"));
|
(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, args, &qtTranslator, &translator);
|
|
||||||
|
MainWindow w(0, defaultSettings, tabNumber);
|
||||||
|
w.show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
@ -1,436 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "mainwidget.h"
|
|
||||||
#include "ui_mainwidget.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QMenu>
|
|
||||||
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
|
|
||||||
#include "calls.h"
|
|
||||||
#include "commonfunctions.h"
|
|
||||||
#include "dbusoperation.h"
|
|
||||||
#include "errorwindow.h"
|
|
||||||
#include "mainwindow.h"
|
|
||||||
|
|
||||||
|
|
||||||
MainWidget::MainWidget(QWidget *parent, const QMap<QString, QString> settings, const bool debugCmd)
|
|
||||||
: QMainWindow(parent),
|
|
||||||
debug(debugCmd),
|
|
||||||
configuration(settings)
|
|
||||||
{
|
|
||||||
mainWindow = dynamic_cast<MainWindow *>(parent);
|
|
||||||
useHelper = (configuration[QString("USE_HELPER")] == QString("true"));
|
|
||||||
|
|
||||||
// windows
|
|
||||||
ui = new Ui::MainWidget;
|
|
||||||
ui->setupUi(this);
|
|
||||||
ui->tableWidget_main->setColumnHidden(2, true);
|
|
||||||
ui->tableWidget_main->setColumnHidden(3, true);
|
|
||||||
updateToolBarState(static_cast<Qt::ToolBarArea>(configuration[QString("NETCTL_TOOLBAR")].toInt()));
|
|
||||||
|
|
||||||
// append toolbar
|
|
||||||
QMenu *actionMenu = new QMenu(this);
|
|
||||||
actionMenu->addAction(ui->actionSwitch);
|
|
||||||
actionMenu->addAction(ui->actionRestart);
|
|
||||||
actionMenu->addAction(ui->actionEnable);
|
|
||||||
ui->actionStart->setMenu(actionMenu);
|
|
||||||
|
|
||||||
// auto update
|
|
||||||
timer.setSingleShot(true);
|
|
||||||
timer.setInterval(configuration[QString("MAINUPDATE")].toInt() * 1000);
|
|
||||||
|
|
||||||
createActions();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MainWidget::~MainWidget()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
if (ui != nullptr) delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Qt::ToolBarArea MainWidget::getToolBarArea()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return toolBarArea(ui->toolBar);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool MainWidget::mainTabSelectProfileSlot(const QString profile)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
|
||||||
|
|
||||||
for (int i=0; i<ui->tableWidget_main->rowCount(); i++) {
|
|
||||||
if (ui->tableWidget_main->item(i, 0)->text() != profile) continue;
|
|
||||||
ui->tableWidget_main->setCurrentCell(i, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (ui->tableWidget_main->currentItem() != nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::update()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
if (mainWindow->currentTab() == 0) {
|
|
||||||
updateMainTab();
|
|
||||||
updateMenuMain();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (timer.interval() != 0) return timer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::updateToolBarState(const Qt::ToolBarArea area)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Toolbar area" << area;
|
|
||||||
|
|
||||||
removeToolBar(ui->toolBar);
|
|
||||||
if (area != Qt::NoToolBarArea) {
|
|
||||||
addToolBar(area, ui->toolBar);
|
|
||||||
ui->toolBar->show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::updateMenuMain()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
bool selected = (ui->tableWidget_main->currentItem() != nullptr);
|
|
||||||
ui->actionStart->setEnabled(selected);
|
|
||||||
ui->actionEnable->setEnabled(selected);
|
|
||||||
ui->actionEdit->setEnabled(selected);
|
|
||||||
ui->actionRemove->setEnabled(selected);
|
|
||||||
|
|
||||||
if (selected && !ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 2)->text().isEmpty()) {
|
|
||||||
// visible
|
|
||||||
ui->actionRestart->setEnabled(true);
|
|
||||||
ui->actionSwitch->setEnabled(false);
|
|
||||||
// text
|
|
||||||
ui->actionStart->setText(QApplication::translate("MainWidget", "Stop"));
|
|
||||||
ui->actionStart->setIcon(QIcon::fromTheme("process-stop"));
|
|
||||||
} else {
|
|
||||||
// visible
|
|
||||||
ui->actionRestart->setEnabled(false);
|
|
||||||
ui->actionSwitch->setEnabled(selected);
|
|
||||||
// text
|
|
||||||
ui->actionStart->setText(QApplication::translate("MainWidget", "Start"));
|
|
||||||
ui->actionStart->setIcon(QIcon::fromTheme("system-run"));
|
|
||||||
}
|
|
||||||
if (selected && !ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 3)->text().isEmpty()) {
|
|
||||||
ui->actionEnable->setText(QApplication::translate("MainWidget", "Disable"));
|
|
||||||
ui->actionEnable->setIcon(QIcon::fromTheme("edit-remove"));
|
|
||||||
} else {
|
|
||||||
ui->actionEnable->setText(QApplication::translate("MainWidget", "Enable"));
|
|
||||||
ui->actionEnable->setIcon(QIcon::fromTheme("list-add"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::updateMainTab()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (!checkExternalApps(QString("netctl"), configuration, debug)) {
|
|
||||||
ErrorWindow::showWindow(1, externalApps(QString("netctl"), configuration).join(QChar('\n')), debug);
|
|
||||||
return mainWindow->emitNeedToBeConfigured();
|
|
||||||
}
|
|
||||||
|
|
||||||
mainWindow->setDisabled(true);
|
|
||||||
netctlInformation info = generalInformation(mainWindow->netctlInterface,
|
|
||||||
useHelper, debug);
|
|
||||||
ui->label_netctlAuto->setHidden(!info.netctlAuto);
|
|
||||||
|
|
||||||
ui->tableWidget_main->setSortingEnabled(false);
|
|
||||||
ui->tableWidget_main->selectRow(-1);
|
|
||||||
ui->tableWidget_main->sortByColumn(0, Qt::AscendingOrder);
|
|
||||||
ui->tableWidget_main->clear();
|
|
||||||
ui->tableWidget_main->setRowCount(info.netctlProfiles.count());
|
|
||||||
|
|
||||||
// create header
|
|
||||||
QStringList headerList;
|
|
||||||
headerList.append(QApplication::translate("MainWidget", "Name"));
|
|
||||||
headerList.append(QApplication::translate("MainWidget", "Description"));
|
|
||||||
headerList.append(QApplication::translate("MainWidget", "Active"));
|
|
||||||
headerList.append(QApplication::translate("MainWidget", "Enabled"));
|
|
||||||
ui->tableWidget_main->setHorizontalHeaderLabels(headerList);
|
|
||||||
// create items
|
|
||||||
for (int i=0; i<info.netctlProfiles.count(); i++) {
|
|
||||||
// font
|
|
||||||
QFont font;
|
|
||||||
font.setBold(info.netctlProfiles[i].active);
|
|
||||||
font.setItalic(info.netctlProfiles[i].enabled);
|
|
||||||
// tooltip
|
|
||||||
QString toolTip = QString("");
|
|
||||||
toolTip += QString("%1: %2@%3\n").arg(QApplication::translate("MainWidget", "Type"))
|
|
||||||
.arg(info.netctlProfiles[i].type)
|
|
||||||
.arg(info.netctlProfiles[i].interface);
|
|
||||||
toolTip += QString("%1: %2\n").arg(QApplication::translate("MainWidget", "Active"))
|
|
||||||
.arg(checkStatus(info.netctlProfiles[i].active));
|
|
||||||
toolTip += QString("%1: %2\n").arg(QApplication::translate("MainWidget", "Enabled"))
|
|
||||||
.arg(checkStatus(info.netctlProfiles[i].enabled));
|
|
||||||
toolTip += QString("%1: %2").arg(QApplication::translate("MainWidget", "Is wireless"))
|
|
||||||
.arg(checkStatus(!info.netctlProfiles[i].essid.isEmpty()));
|
|
||||||
// name
|
|
||||||
ui->tableWidget_main->setItem(i, 0, new QTableWidgetItem(info.netctlProfiles[i].name));
|
|
||||||
ui->tableWidget_main->item(i, 0)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
|
||||||
ui->tableWidget_main->item(i, 0)->setToolTip(toolTip);
|
|
||||||
ui->tableWidget_main->item(i, 0)->setFont(font);
|
|
||||||
// description
|
|
||||||
ui->tableWidget_main->setItem(i, 1, new QTableWidgetItem(info.netctlProfiles[i].description));
|
|
||||||
ui->tableWidget_main->item(i, 1)->setTextAlignment(Qt::AlignJustify | Qt::AlignVCenter);
|
|
||||||
ui->tableWidget_main->item(i, 1)->setToolTip(toolTip);
|
|
||||||
// active
|
|
||||||
ui->tableWidget_main->setItem(i, 2, new QTableWidgetItem(checkStatus(info.netctlProfiles[i].active, true)));
|
|
||||||
ui->tableWidget_main->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
||||||
// enabled
|
|
||||||
ui->tableWidget_main->setItem(i, 3, new QTableWidgetItem(checkStatus(info.netctlProfiles[i].enabled, true)));
|
|
||||||
ui->tableWidget_main->item(i, 3)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->tableWidget_main->setSortingEnabled(true);
|
|
||||||
|
|
||||||
ui->tableWidget_main->resizeRowsToContents();
|
|
||||||
ui->tableWidget_main->resizeColumnsToContents();
|
|
||||||
ui->tableWidget_main->resizeRowsToContents();
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
ui->tableWidget_main->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
|
||||||
#else
|
|
||||||
ui->tableWidget_main->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mainWindow->setDisabled(false);
|
|
||||||
mainWindow->showMessage(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::mainTabContextualMenu(const QPoint &pos)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (ui->tableWidget_main->currentItem() == nullptr) return;
|
|
||||||
|
|
||||||
// create menu
|
|
||||||
QMenu menu(this);
|
|
||||||
QAction *refreshTable = menu.addAction(QApplication::translate("MainWidget", "Refresh"));
|
|
||||||
refreshTable->setIcon(QIcon::fromTheme("view-refresh"));
|
|
||||||
menu.addSeparator();
|
|
||||||
QAction *startProfile = menu.addAction(QApplication::translate("MainWidget", "Start profile"));
|
|
||||||
QAction *restartProfile = menu.addAction(QApplication::translate("MainWidget", "Restart profile"));
|
|
||||||
restartProfile->setIcon(QIcon::fromTheme("view-refresh"));
|
|
||||||
QAction *enableProfile = menu.addAction(QApplication::translate("MainWidget", "Enable profile"));
|
|
||||||
menu.addSeparator();
|
|
||||||
QAction *editProfile = menu.addAction(QApplication::translate("MainWidget", "Edit profile"));
|
|
||||||
editProfile->setIcon(QIcon::fromTheme("document-edit"));
|
|
||||||
QAction *removeProfile = menu.addAction(QApplication::translate("MainWidget", "Remove profile"));
|
|
||||||
removeProfile->setIcon(QIcon::fromTheme("edit-delete"));
|
|
||||||
|
|
||||||
// set text
|
|
||||||
if (!ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 2)->text().isEmpty()) {
|
|
||||||
restartProfile->setVisible(true);
|
|
||||||
startProfile->setText(QApplication::translate("MainWidget", "Stop profile"));
|
|
||||||
startProfile->setIcon(QIcon::fromTheme("process-stop"));
|
|
||||||
} else {
|
|
||||||
restartProfile->setVisible(false);
|
|
||||||
startProfile->setText(QApplication::translate("MainWidget", "Start profile"));
|
|
||||||
startProfile->setIcon(QIcon::fromTheme("system-run"));
|
|
||||||
}
|
|
||||||
if (!ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 3)->text().isEmpty()) {
|
|
||||||
enableProfile->setText(QApplication::translate("MainWidget", "Disable profile"));
|
|
||||||
enableProfile->setIcon(QIcon::fromTheme("edit-remove"));
|
|
||||||
} else {
|
|
||||||
enableProfile->setText(QApplication::translate("MainWidget", "Enable profile"));
|
|
||||||
enableProfile->setIcon(QIcon::fromTheme("list-add"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// actions
|
|
||||||
QAction *action = menu.exec(ui->tableWidget_main->viewport()->mapToGlobal(pos));
|
|
||||||
if (action == refreshTable) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Refresh table";
|
|
||||||
updateMainTab();
|
|
||||||
} else if (action == startProfile) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Start profile";
|
|
||||||
mainTabStartProfile();
|
|
||||||
} else if (action == restartProfile) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Restart profile";
|
|
||||||
mainTabRestartProfile();
|
|
||||||
} else if (action == enableProfile) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Enable profile";
|
|
||||||
mainTabEnableProfile();
|
|
||||||
} else if (action == editProfile) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Edit profile";
|
|
||||||
mainTabEditProfile();
|
|
||||||
} else if (action == removeProfile) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Remove profile";
|
|
||||||
mainTabRemoveProfile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::mainTabEditProfile()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (ui->tableWidget_main->currentItem() == nullptr) return;
|
|
||||||
|
|
||||||
mainWindow->setDisabled(true);
|
|
||||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
|
||||||
mainWindow->setTab(1);
|
|
||||||
mainWindow->openProfileSlot(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::mainTabEnableProfile()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (!checkExternalApps(QString("netctl"), configuration, debug)) {
|
|
||||||
ErrorWindow::showWindow(1, externalApps(QString("netctl"), configuration).join(QChar('\n')), debug);
|
|
||||||
return mainWindow->emitNeedToBeConfigured();
|
|
||||||
}
|
|
||||||
if (ui->tableWidget_main->currentItem() == nullptr) return;
|
|
||||||
|
|
||||||
mainWindow->setDisabled(true);
|
|
||||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
|
||||||
InterfaceAnswer answer = enableProfileSlot(profile, mainWindow->netctlInterface,
|
|
||||||
useHelper, debug);
|
|
||||||
// TODO check if status has been changed?
|
|
||||||
mainWindow->showMessage(answer != InterfaceAnswer::Error);
|
|
||||||
|
|
||||||
updateMainTab();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::mainTabRemoveProfile()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (!checkExternalApps(QString("sudo"), configuration, debug)) {
|
|
||||||
ErrorWindow::showWindow(1, externalApps(QString("sudo"), configuration).join(QChar('\n')), debug);
|
|
||||||
return mainWindow->emitNeedToBeConfigured();
|
|
||||||
}
|
|
||||||
if (ui->tableWidget_main->currentItem() == nullptr) return;
|
|
||||||
|
|
||||||
mainWindow->setDisabled(true);
|
|
||||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
|
||||||
InterfaceAnswer answer = removeProfileSlot(profile, mainWindow->netctlInterface,
|
|
||||||
useHelper, debug);
|
|
||||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
|
||||||
|
|
||||||
updateMainTab();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::mainTabRestartProfile()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (!checkExternalApps(QString("netctl"), configuration, debug)) {
|
|
||||||
ErrorWindow::showWindow(1, externalApps(QString("netctl"), configuration).join(QChar('\n')), debug);
|
|
||||||
return mainWindow->emitNeedToBeConfigured();
|
|
||||||
}
|
|
||||||
if (ui->tableWidget_main->currentItem() == nullptr) return;
|
|
||||||
|
|
||||||
mainWindow->setDisabled(true);
|
|
||||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
|
||||||
InterfaceAnswer answer = restartProfileSlot(profile, mainWindow->netctlInterface,
|
|
||||||
useHelper, debug);
|
|
||||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
|
||||||
|
|
||||||
updateMainTab();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::mainTabStartProfile()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (!checkExternalApps(QString("netctl"), configuration, debug)) {
|
|
||||||
ErrorWindow::showWindow(1, externalApps(QString("netctl"), configuration).join(QChar('\n')), debug);
|
|
||||||
return mainWindow->emitNeedToBeConfigured();
|
|
||||||
}
|
|
||||||
if (ui->tableWidget_main->currentItem() == nullptr) return;
|
|
||||||
|
|
||||||
mainWindow->setDisabled(true);
|
|
||||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
|
||||||
InterfaceAnswer answer = startProfileSlot(profile, mainWindow->netctlInterface,
|
|
||||||
useHelper, debug);
|
|
||||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
|
||||||
|
|
||||||
updateMainTab();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::mainTabStopAllProfiles()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (!checkExternalApps(QString("netctl"), configuration, debug)) {
|
|
||||||
ErrorWindow::showWindow(1, externalApps(QString("netctl"), configuration).join(QChar('\n')), debug);
|
|
||||||
return mainWindow->emitNeedToBeConfigured();
|
|
||||||
}
|
|
||||||
|
|
||||||
mainWindow->setDisabled(true);
|
|
||||||
InterfaceAnswer answer = stopAllProfilesSlot(mainWindow->netctlInterface,
|
|
||||||
useHelper, debug);
|
|
||||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
|
||||||
|
|
||||||
updateMainTab();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::mainTabSwitchToProfile()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (!checkExternalApps(QString("netctl"), configuration, debug)) {
|
|
||||||
ErrorWindow::showWindow(1, externalApps(QString("netctl"), configuration).join(QChar('\n')), debug);
|
|
||||||
return mainWindow->emitNeedToBeConfigured();
|
|
||||||
}
|
|
||||||
if (ui->tableWidget_main->currentItem() == nullptr) return;
|
|
||||||
|
|
||||||
mainWindow->setDisabled(true);
|
|
||||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
|
||||||
InterfaceAnswer answer = switchToProfileSlot(profile, mainWindow->netctlInterface,
|
|
||||||
useHelper, debug);
|
|
||||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
|
||||||
|
|
||||||
updateMainTab();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::createActions()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
// menu actions
|
|
||||||
connect(&timer, SIGNAL(timeout()), this, SLOT(update()));
|
|
||||||
connect(ui->actionEnable, SIGNAL(triggered(bool)), this, SLOT(mainTabEnableProfile()));
|
|
||||||
connect(ui->actionEdit, SIGNAL(triggered(bool)), this, SLOT(mainTabEditProfile()));
|
|
||||||
connect(ui->actionRefresh, SIGNAL(triggered(bool)), this, SLOT(updateMainTab()));
|
|
||||||
connect(ui->actionRemove, SIGNAL(triggered(bool)), this, SLOT(mainTabRemoveProfile()));
|
|
||||||
connect(ui->actionRestart, SIGNAL(triggered(bool)), this, SLOT(mainTabRestartProfile()));
|
|
||||||
connect(ui->actionStart, SIGNAL(triggered(bool)), this, SLOT(mainTabStartProfile()));
|
|
||||||
connect(ui->actionStop_all, SIGNAL(triggered(bool)), this, SLOT(mainTabStopAllProfiles()));
|
|
||||||
connect(ui->actionSwitch, SIGNAL(triggered(bool)), this, SLOT(mainTabSwitchToProfile()));
|
|
||||||
// main tab events
|
|
||||||
connect(ui->tableWidget_main, SIGNAL(itemActivated(QTableWidgetItem *)), this, SLOT(mainTabStartProfile()));
|
|
||||||
connect(ui->tableWidget_main, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)),
|
|
||||||
this, SLOT(updateMenuMain()));
|
|
||||||
connect(ui->tableWidget_main, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(mainTabContextualMenu(QPoint)));
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of netctl-gui *
|
|
||||||
* *
|
|
||||||
* netctl-gui is free software: you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* netctl-gui is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef MAINWIDGET_H
|
|
||||||
#define MAINWIDGET_H
|
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QTableWidgetItem>
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#include <netctlgui/netctlgui.h>
|
|
||||||
|
|
||||||
|
|
||||||
class MainWindow;
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class MainWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
class MainWidget : public QMainWindow
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit MainWidget(QWidget *parent = 0,
|
|
||||||
const QMap<QString,QString> settings = QMap<QString,QString>(),
|
|
||||||
const bool debugCmd = false);
|
|
||||||
~MainWidget();
|
|
||||||
Qt::ToolBarArea getToolBarArea();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
bool mainTabSelectProfileSlot(const QString profile);
|
|
||||||
void update();
|
|
||||||
void updateToolBarState(const Qt::ToolBarArea area = Qt::TopToolBarArea);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
// update slots
|
|
||||||
void updateMenuMain();
|
|
||||||
void updateMainTab();
|
|
||||||
// main tab slots
|
|
||||||
void mainTabContextualMenu(const QPoint &pos);
|
|
||||||
void mainTabEditProfile();
|
|
||||||
void mainTabEnableProfile();
|
|
||||||
void mainTabRemoveProfile();
|
|
||||||
void mainTabRestartProfile();
|
|
||||||
void mainTabStartProfile();
|
|
||||||
void mainTabStopAllProfiles();
|
|
||||||
void mainTabSwitchToProfile();
|
|
||||||
|
|
||||||
private:
|
|
||||||
// ui
|
|
||||||
MainWindow *mainWindow = nullptr;
|
|
||||||
Ui::MainWidget *ui = nullptr;
|
|
||||||
// backend
|
|
||||||
void createActions();
|
|
||||||
QString configPath;
|
|
||||||
bool debug = false;
|
|
||||||
QTimer timer;
|
|
||||||
bool useHelper = true;
|
|
||||||
// configuration
|
|
||||||
QMap<QString, QString> configuration;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* MAINWIDGET_H */
|
|
@ -1,208 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>MainWidget</class>
|
|
||||||
<widget class="QMainWindow" name="MainWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>515</width>
|
|
||||||
<height>477</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="centralwidget">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<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>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</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>
|
|
||||||
<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>
|
|
||||||
<property name="textAlignment">
|
|
||||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Description</string>
|
|
||||||
</property>
|
|
||||||
<property name="textAlignment">
|
|
||||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column/>
|
|
||||||
<column/>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolBar" name="toolBar">
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Main actions toolbar</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonFollowStyle</enum>
|
|
||||||
</property>
|
|
||||||
<attribute name="toolBarArea">
|
|
||||||
<enum>TopToolBarArea</enum>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="toolBarBreak">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
<addaction name="actionRefresh"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionStart"/>
|
|
||||||
<addaction name="actionStop_all"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionEdit"/>
|
|
||||||
<addaction name="actionRemove"/>
|
|
||||||
</widget>
|
|
||||||
<action name="actionRefresh">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="view-refresh">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Refresh</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Refresh table</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+R</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionStart">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="system-run">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Start</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Start or stop selected profile</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionSwitch">
|
|
||||||
<property name="text">
|
|
||||||
<string>Switch</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Switch to selected profile</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionRestart">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="view-refresh">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Restart</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Restart selected profile</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionEnable">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="list-add">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Enable or disable selected profile</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionStop_all">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="process-stop">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Stop all</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Stop all profiles</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionEdit">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="document-edit">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Edit</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Edit selected profile</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionRemove">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="edit-delete">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Remove</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Remove selected profile</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -20,18 +20,25 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTableWidgetItem>
|
||||||
|
|
||||||
#include <netctlgui/netctlgui.h>
|
|
||||||
|
|
||||||
|
|
||||||
class AboutWindow;
|
class BridgeWidget;
|
||||||
class MainWidget;
|
class ErrorWindow;
|
||||||
class NetctlAutoWindow;
|
class EthernetWidget;
|
||||||
class NewProfileWidget;
|
class GeneralWidget;
|
||||||
|
class IpWidget;
|
||||||
|
class MobileWidget;
|
||||||
|
class Netctl;
|
||||||
|
class NetctlProfile;
|
||||||
|
class PasswdWidget;
|
||||||
|
class PppoeWidget;
|
||||||
class SettingsWindow;
|
class SettingsWindow;
|
||||||
class TrayIcon;
|
class TunnelWidget;
|
||||||
class WiFiMenuWidget;
|
class TuntapWidget;
|
||||||
|
class VlanWidget;
|
||||||
|
class WirelessWidget;
|
||||||
|
class WpaSup;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
@ -42,81 +49,61 @@ class MainWindow : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget *parent = nullptr,
|
explicit MainWindow(QWidget *parent = 0,
|
||||||
const QVariantMap args = QVariantMap(),
|
const bool defaultSettings = false,
|
||||||
QTranslator *qtAppTranslator = nullptr,
|
const int tabNum = 1);
|
||||||
QTranslator *appTranslator = nullptr);
|
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
int currentTab();
|
Netctl *netctlCommand;
|
||||||
Qt::ToolBarArea getToolBarArea();
|
NetctlProfile *netctlProfile;
|
||||||
void emitNeedToBeConfigured();
|
WpaSup *wpaCommand;
|
||||||
QStringList printSettings();
|
|
||||||
netctlCurrent printTrayInformation();
|
|
||||||
bool isHelperActive();
|
|
||||||
bool isHelperServiceActive();
|
|
||||||
// library interfaces
|
|
||||||
Netctl *netctlCommand = nullptr;
|
|
||||||
NetctlInterface *netctlInterface = nullptr;
|
|
||||||
WpaSup *wpaCommand = nullptr;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void closeEvent(QCloseEvent *event);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// actions from trayicon
|
void updateTabs(const int tab);
|
||||||
void closeMainWindow();
|
// wifi tab slots
|
||||||
void openProfileSlot(const QString profile);
|
void connectToUnknownEssid(const QString passwd);
|
||||||
void showAboutWindow();
|
|
||||||
void showMainWindow();
|
|
||||||
void showNetctlAutoWindow();
|
|
||||||
void showSettingsWindow();
|
|
||||||
// open docs
|
|
||||||
void showApi();
|
|
||||||
void showLibrary();
|
|
||||||
void showSecurityNotes();
|
|
||||||
// helper
|
|
||||||
bool forceStartHelper();
|
|
||||||
bool forceStopHelper();
|
|
||||||
bool startHelper();
|
|
||||||
// main
|
|
||||||
void setDisabled(const bool disabled = true);
|
|
||||||
void setTab(int tab);
|
|
||||||
void showMessage(const bool status);
|
|
||||||
void storeToolBars();
|
|
||||||
void updateConfiguration(const QVariantMap args = QVariantMap());
|
|
||||||
void updateToolBarState(const Qt::ToolBarArea area = Qt::TopToolBarArea);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void needToBeConfigured();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setTabByAction(QAction *action);
|
void updateMainTab();
|
||||||
void reportABug();
|
void updateProfileTab();
|
||||||
|
void updateWifiTab();
|
||||||
|
// main tab slots
|
||||||
|
void mainTabEnableProfile();
|
||||||
|
void mainTabRestartProfile();
|
||||||
|
void mainTabStartProfile();
|
||||||
|
void mainTabRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous);
|
||||||
|
// profile tab slots
|
||||||
|
void profileTabBrowseProfile();
|
||||||
|
void profileTabChangeState(const QString current);
|
||||||
|
void profileTabClear();
|
||||||
|
void profileTabCreateProfile();
|
||||||
|
void profileTabLoadProfile();
|
||||||
|
// wifi tab slots
|
||||||
|
void wifiTabSetEnabled(const bool state);
|
||||||
|
void wifiTabStart();
|
||||||
|
void wifiTabRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// ui
|
// ui
|
||||||
TrayIcon *trayIcon = nullptr;
|
Ui::MainWindow *ui;
|
||||||
Ui::MainWindow *ui = nullptr;
|
BridgeWidget *bridgeWid;
|
||||||
AboutWindow *aboutWin = nullptr;
|
EthernetWidget *ethernetWid;
|
||||||
MainWidget *mainWidget = nullptr;
|
GeneralWidget *generalWid;
|
||||||
NetctlAutoWindow *netctlAutoWin = nullptr;
|
IpWidget *ipWid;
|
||||||
NewProfileWidget *newProfileWidget = nullptr;
|
MobileWidget *mobileWid;
|
||||||
SettingsWindow *settingsWin = nullptr;
|
PppoeWidget *pppoeWid;
|
||||||
WiFiMenuWidget *wifiMenuWidget = nullptr;
|
TunnelWidget *tunnelWid;
|
||||||
|
TuntapWidget *tuntapWid;
|
||||||
|
VlanWidget *vlanWid;
|
||||||
|
WirelessWidget *wirelessWid;
|
||||||
// backend
|
// backend
|
||||||
bool checkHelperStatus();
|
ErrorWindow *errorWin;
|
||||||
|
PasswdWidget *passwdWid;
|
||||||
|
SettingsWindow *settingsWin;
|
||||||
|
bool checkExternalApps(const QString apps);
|
||||||
|
bool checkState(const QString state, const QString item);
|
||||||
void createActions();
|
void createActions();
|
||||||
void createDBusSession();
|
|
||||||
void createObjects();
|
|
||||||
void deleteObjects();
|
|
||||||
QString configPath;
|
|
||||||
bool debug = false;
|
|
||||||
bool useHelper = true;
|
|
||||||
QTranslator *qtTranslator = nullptr;
|
|
||||||
QTranslator *translator = nullptr;
|
|
||||||
// configuration
|
// configuration
|
||||||
QMap<QString, QString> configuration;
|
QMap<QString, QString> configuration;
|
||||||
QMap<QString, QString> parseOptions(const QString options);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,35 +6,357 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>491</width>
|
||||||
<height>497</height>
|
<height>519</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Netctl GUI</string>
|
<string>Netctl GUI</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<layout class="QVBoxLayout" name="centralLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="sizePolicy">
|
<property name="currentIndex">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<number>0</number>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QWidget" name="tab_main">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Connect to profile</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableWidget" name="tableWidget_main">
|
||||||
|
<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>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Description</string>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<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>
|
||||||
|
</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">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Create a new profile</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_profile">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_profile">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Profile</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_profile"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_profile">
|
||||||
|
<property name="text">
|
||||||
|
<string>Browse</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>98</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="scrollArea_layout"/>
|
||||||
|
</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="title">
|
||||||
|
<string>Connect to Wi-Fi</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_wifi">
|
||||||
|
<property name="text">
|
||||||
|
<string>Please install 'wpa_supplicant' before using it</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableWidget" name="tableWidget_wifi">
|
||||||
|
<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>
|
||||||
|
<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>Status</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Signal</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Security</string>
|
||||||
|
</property>
|
||||||
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
|
||||||
<widget class="QMenuBar" name="menuBar">
|
<widget class="QMenuBar" name="menuBar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>491</width>
|
||||||
<height>22</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuMenu">
|
<widget class="QMenu" name="menuMenu">
|
||||||
@ -42,107 +364,12 @@
|
|||||||
<string>Menu</string>
|
<string>Menu</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionSettings"/>
|
<addaction name="actionSettings"/>
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionSecurity"/>
|
|
||||||
<addaction name="actionDBus_API"/>
|
|
||||||
<addaction name="actionLibrary"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionReport_a_bug"/>
|
|
||||||
<addaction name="actionAbout"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionQuit"/>
|
<addaction name="actionQuit"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuMenu"/>
|
<addaction name="menuMenu"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Toolbar</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonFollowStyle</enum>
|
|
||||||
</property>
|
|
||||||
<attribute name="toolBarArea">
|
|
||||||
<enum>TopToolBarArea</enum>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="toolBarBreak">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
<addaction name="actionNetctl_auto"/>
|
|
||||||
<addaction name="actionNetctl"/>
|
|
||||||
<addaction name="actionProfiles"/>
|
|
||||||
<addaction name="actionWiFi_menu"/>
|
|
||||||
</widget>
|
|
||||||
<action name="actionSecurity">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="security-medium">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Security</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Show security notes</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionDBus_API">
|
|
||||||
<property name="text">
|
|
||||||
<string>DBus API</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Show DBus API</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionLibrary">
|
|
||||||
<property name="text">
|
|
||||||
<string>Library</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Show library docs</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionReport_a_bug">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="tools-report-bug">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Report a bug</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionAbout">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="help-about">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>About</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>About this application</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionQuit">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="application-exit">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Quit</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+Q</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionSettings">
|
<action name="actionSettings">
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="configure">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Settings</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
@ -150,57 +377,32 @@
|
|||||||
<string>Ctrl+S</string>
|
<string>Ctrl+S</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionNetctl">
|
<action name="actionQuit">
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../resources/resources.qrc">
|
|
||||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>netctl control</string>
|
<string>Quit</string>
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>netctl control</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Ctrl+N</string>
|
<string>Ctrl+Q</string>
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionProfiles">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="document-new">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Profiles</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Profiles</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+P</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionWiFi_menu">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../resources/resources.qrc">
|
|
||||||
<normaloff>:/wifi.png</normaloff>:/wifi.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>WiFi menu</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+W</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionNetctl_auto">
|
|
||||||
<property name="text">
|
|
||||||
<string>netctl-auto</string>
|
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<tabstops>
|
||||||
<include location="../../resources/resources.qrc"/>
|
<tabstop>tabWidget</tabstop>
|
||||||
</resources>
|
<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/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|