Compare commits

..

No commits in common. "master" and "V.1.0.4" have entirely different histories.

248 changed files with 9767 additions and 41115 deletions

6
.gitignore vendored
View File

@ -14,16 +14,12 @@
# Source archive
*.tar.xz
*.tar.gz
*.sig
# Build directory
build/
sources/build/
tmp/
usr/
# translations
*.qm
# temporary bckps
*~

12
.gitmodules vendored
View File

@ -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

View File

@ -1,5 +1,2 @@
Current developers:
Evgeniy Alekseev aka arcanis <esalexeev (at) gmail (dot) com>
Translators:
@nosada (Japanese translation)

334
CHANGELOG
View File

@ -1,327 +1,17 @@
Ver.1.4.9
---------
* library
* fix bug with invalid enabled profile definition (#46)
* some imrovements inside
* plasmoid
* change rendering from Qt to native
* update plasmoid to recent plasma changes
Ver.1.0.4:
+ [gui] added Qt5 gui (by default)
+ [plasmoid] added notifications
* [plasmoid] fix run command with sudo from plasmoid
Ver.1.4.8
---------
* gui
* update profile tab to netclt 1.10 and 1.11 changes
* plasmoid
* fix bug with no action on link activation
Ver.1.0.3:
+ [plasmoid] edited russian translation
* [all] refactoring
Ver.1.4.7
---------
* 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.0.2:
* [plasmoid] fix layout margins
Ver.1.4.6
---------
* all
+ implement time logging feature
* gui
+ implement autoupdate feature
- fix invalid profile path for the external editor
* library
+ implement netctl-auto support to scanWiFi() method (#44)
- fix bug with invalid data in netctl-auto profile list output
Ver.1.0.1:
- [all] removed scripts
Ver.1.4.5
---------
* plasmoid
+ add translation support to plugin part
* more correct interface painting
* more correct configuration interface painting
* move plugin from private
Ver.1.4.4
---------
* 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
-------
Ver.1.0:
First release

48
PKGBUILD Normal file
View 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
}

View File

@ -3,48 +3,43 @@ Netctl GUI
Information
-----------
Graphical interface for netctl. Now it may work with profiles and may create new profiles. Also it may create a connection to WiFi. Moreover, it provides a widget and DataEngine for KDE.
Qt4/Qt5 graphical interface for netctl. It may work with profiles and may create new profiles. Also it may create a connection to WiFi. Moreover, it provides a widget and DataEngine for KDE4/KF5.
**NOTE** [LOOKING FOR TRANSLATORS!](https://github.com/arcan1s/netctl-gui/issues/3)
**NOTE** LOOKING FOR TRANSLATORS!
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
* `/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
All settings of GUI are stored in `$HOME/.config/netctl-gui.conf`. It is highly recommended to edit it from graphical interface.
Instruction
===========
Dependencies
------------
* netctl
* qt5-base (if Qt5 is used) or qt4 (if Qt4 is used)
* qt4
Optional dependencies
---------------------
* kdebase-workspace (KDE4 widget)
* plasma-framework (KF5 widget)
* kdebase-workspace (widget)
* sudo (sudo support)
* wpa_supplicant (WiFi support)
Make dependencies
-----------------
* automoc4
* cmake
* qt5-tools (if Qt5 is used)
Installation
------------
* download sources
* extract it and install the application:
@ -54,33 +49,26 @@ Installation
make
sudo make install
Available cmake flags:
If you want install it without KDE widget just run:
* components:
* `-DBUILD_DATAENGINE:BOOL=0` - do not build DataEngine
* `-DBUILD_GUI:BOOL=0` - do not build GUI
* `-DBUILD_HELPER:BOOL=0` - do not build helper daemon
* `-DBUILD_LIBRARY:BOOL=0` - do not build library
* `-DBUILD_PLASMOID:BOOL=0` - do not build Plasmoid
* additional components:
* `-DBUILD_DOCS:BOOL=0` - do not build developer documentation
* `-DBUILD_TEST:BOOL=1` - build auto tests for the library and the helper
* project properties:
* `-DDBUS_SYSTEMCONF_PATH=/etc/dbus-1/system.d/` - path to dbus system configuration files
* `-DSYSTEMD_SERVICE_PATH=lib/systemd/system` - path to systemd services
* `-DUSE_CAPABILITIES:BOOL=0` - do not use setcap to get privileges to the helper
* `-DBUILD_KDE4:BOOL=1` - build KDE4 plasmoid instead of KF5 one
* `-DUSE_QT5:BOOL=0` - use Qt4 instead of Qt5 for GUI
cd /path/to/extracted/archive
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_DATAENGINE:BOOL=0 -DBUILD_PLASMOID:BOOL=0 ../
make
sudo make install
If you want install it without GUI run:
cd /path/to/extracted/archive
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI:BOOL=0 ../
make
sudo make install
Additional information
======================
TODO (wish list)
----------------
Links
-----
* [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/pkgbase/netctl-gui/) package
* Archlinux [AUR](https://aur.archlinux.org/packages/netctl-gui) package

View File

@ -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
}

View File

@ -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
}

View File

@ -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"
}

View File

@ -1,11 +0,0 @@
post_install() {
true
}
post_upgrade() {
post_install "$1"
}
post_remove() {
post_install "$1"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -1,30 +1,23 @@
#!/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"
SRCDIR="sources"
FILES="AUTHORS CHANGELOG COPYING README.md"
IGNORELIST="build *.qm *.cppcheck .git* *.kdev4"
# update submodules
git submodule update --init --recursive
IGNORELIST="gui/resources/translations/english.qm gui/resources/translations/russian.qm"
VERSION=$(grep -m1 PROJECT_VERSION_MAJOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\
$(grep -m1 PROJECT_VERSION_MINOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\
$(grep -m1 PROJECT_VERSION_PATCH sources/CMakeLists.txt | awk '{print $3}' | cut -c 1)
# create archive
[[ -e ${ARCHIVE}-${VERSION}-src.tar.xz ]] && rm -f "${ARCHIVE}-${VERSION}-src.tar.xz"
[[ -d ${ARCHIVE} ]] && rm -rf "${ARCHIVE}"
cp -r "${SRCDIR}" "${ARCHIVE}"
for FILE in ${FILES[*]}; do cp -r "$FILE" "${ARCHIVE}"; done
for FILE in ${IGNORELIST[*]}; do find "${ARCHIVE}" -name "${FILE}" -delete; done
tar cJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}"
ln -sf "../${ARCHIVE}-${VERSION}-src.tar.xz" arch
for FILE in ${IGNORELIST[*]}; do rm -f "${ARCHIVE}/${FILE}"; done
tar cvJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}" > /dev/null
rm -rf "${ARCHIVE}"
# update md5sum
MD5SUMS=$(md5sum ${ARCHIVE}-${VERSION}-src.tar.xz | awk '{print $1}')
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" arch/PKGBUILD{,-qt4}
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" arch/PKGBUILD{,-qt4}
# clear
find . -type f -name '*src.tar.xz' -not -name "*${VERSION}-src.tar.xz" -delete
find arch -type l -xtype l -delete
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" PKGBUILD
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD

View File

@ -4,9 +4,9 @@ post_install() {
}
post_upgrade() {
post_install "$1"
post_install
}
post_remove() {
post_install "$1"
post_install
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
screenshots/dataengine.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

BIN
screenshots/plasmoid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -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

View File

@ -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

View File

@ -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 +0,0 @@
Subproject commit 319125b1fafff9da14c89a94de6ba2852c90c9c2

View File

@ -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 */

View File

@ -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;
}

View File

@ -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 +0,0 @@
Subproject commit 75e4a0df83478802bba53345486b42c56713fe09

@ -1 +0,0 @@
Subproject commit dd52af08c9d6a2c8652d2d5e21bc2a433efb497a

@ -1 +0,0 @@
Subproject commit 36f7ac299633e96f246fec160939207257ae0097

View File

@ -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 CMP0002 OLD)
@ -6,90 +6,36 @@ cmake_policy (SET CMP0011 NEW)
cmake_policy (SET CMP0015 NEW)
project (netctl-gui)
set (PROJECT_AUTHOR "Evgeniy Alekseev")
set (PROJECT_CONTACT "esalexeev@gmail.com")
set (PROJECT_LICENSE "GPLv3")
set (PROJECT_VERSION_MAJOR 1)
set (PROJECT_VERSION_MINOR 4)
set (PROJECT_VERSION_PATCH 9)
set (PROJECT_VERSION_MINOR 0)
set (PROJECT_VERSION_PATCH 4)
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
string (TIMESTAMP CURRENT_YEAR "%Y")
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
message (STATUS "Project: ${PROJECT_NAME}")
message (STATUS "Version: ${PROJECT_VERSION}")
message (STATUS "Build date: ${CURRENT_DATE}")
# install options
option (USE_CAPABILITIES "Use setcap to set capabilities for the helper" ON)
option (USE_QT5 "Use Qt5 instead of Qt4" ON)
# configuration
include (config-defs.cmake)
# components
option (BUILD_GUI "Build GUI" ON)
option (BUILD_HELPER "Build helper" ON)
option (BUILD_LIBRARY "Build library" ON)
option (BUILD_DATAENGINE "Build DataEngine" ON)
option (BUILD_DATAENGINE "Build data engine" ON)
option (BUILD_PLASMOID "Build plasmoid" ON)
option (BUILD_KDE4 "Build on KDE4" OFF)
if (BUILD_GUI OR BUILD_HELPER)
set (BUILD_LIBRARY ON)
endif ()
if (BUILD_PLASMOID)
set (BUILD_DATAENGINE ON)
endif ()
# documentation
option (BUILD_DOCS "Build Doxygen documentation" OFF)
if (BUILD_DOCS)
set (BUILD_LIBRARY ON)
endif ()
# test
option (BUILD_TEST "Build unit tests" OFF)
if (BUILD_TEST)
set (BUILD_LIBRARY ON)
endif ()
# FIXME: dbus path
set (DBUS_SYSTEMCONF_PATH "/etc/dbus-1/system.d/" CACHE STRING "Path to dbus system configuration files")
set (SYSTEMD_SERVICE_PATH "lib/systemd/system" CACHE STRING "Path to systemd services")
# flags
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set (CMAKE_CXX_FLAGS "-Wall -std=c++11")
if (CMAKE_COMPILER_IS_GNUCXX)
set (ADD_CXX_FLAGS "-Wall")
set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
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 ()
message (STATUS "Unknown compiler")
endif ()
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
add_subdirectory (icons)
# resources
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
set (PROJECT_LIBRARY netctlgui)
set (PROJECT_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
add_subdirectory (${PROJECT_RESOURCE_DIR})
if (BUILD_PLASMOID)
set (BUILD_DATAENGINE ON)
endif ()
# components
if (BUILD_LIBRARY)
add_subdirectory (${PROJECT_LIBRARY})
endif ()
if (BUILD_HELPER)
add_subdirectory (helper)
endif ()
if (BUILD_TEST)
enable_testing ()
add_subdirectory (test)
endif ()
if (BUILD_GUI)
add_subdirectory (gui)
endif ()
@ -97,9 +43,5 @@ if (BUILD_DATAENGINE)
add_subdirectory (dataengine)
endif ()
if (BUILD_PLASMOID)
if (BUILD_KDE4)
add_subdirectory (plasmoid-kde4)
else ()
add_subdirectory (plasmoid-kf5)
endif (BUILD_KDE4)
add_subdirectory (plasmoid)
endif ()

View File

@ -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")

View File

@ -3,71 +3,26 @@ set (SUBPROJECT plasma_engine_netctl)
message (STATUS "Subproject ${SUBPROJECT}")
# find required libaries
if (BUILD_KDE4)
find_package (KDE4 REQUIRED)
include (KDE4Defaults)
find_package (KDE4 REQUIRED)
include (KDE4Defaults)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
set (KDE_INCLUDE ${KDE4_INCLUDES})
else ()
find_package (Qt5 REQUIRED COMPONENTS Widgets Network)
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(KF5 REQUIRED COMPONENTS Plasma Service)
include (KDEInstallDirs)
include (KDECMakeSettings)
include (KDECompilerSettings)
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS})
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
${Qt5Network_INCLUDE_DIRS})
set (KDE_INCLUDE ${ConfigCore_INCLUDE_DIR}
${CoreAddons_INCLUDE_DIR}
${Plasma_INCLUDE_DIR}
${Service_INCLUDE_DIR})
endif ()
include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/../
${PROJECT_TRDPARTY_DIR}
${Qt_INCLUDE}
${KDE_INCLUDE})
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../)
set (PLUGIN_NAME ${SUBPROJECT})
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
if (BUILD_KDE4)
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
else ()
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
endif ()
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
file (GLOB SUBPROJECT_SOURCE *.cpp)
file (GLOB SUBPROJECT_CONF *.conf)
# prepare
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
# make
if (BUILD_KDE4)
qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE})
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTNETWORK_LIBRARY})
else ()
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE})
target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} ${Qt5Network_LIBRARIES})
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
endif ()
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE})
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS})
# install
if (BUILD_KDE4)
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
else ()
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
endif ()
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})

View 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

View File

@ -18,26 +18,9 @@
#include "netctl.h"
#include <Plasma/DataContainer>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QNetworkInterface>
#include <QProcessEnvironment>
#include <QSettings>
#include <QTextCodec>
#include <pdebug/pdebug.h>
#include <task/taskadds.h>
#include <version.h>
// KF5-KDE4 compability
#ifdef BUILD_KDE4
#include <KGlobal>
#include <KStandardDirs>
#else
#include <QStandardPaths>
#include <pdebug/pdebug-time.h>
#endif /* BUILD_KDE4 */
#include <QProcess>
Netctl::Netctl(QObject *parent, const QVariantList &args)
@ -45,258 +28,190 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
{
Q_UNUSED(args)
#if QT_VERSION >= 0x050000
qInstallMessageHandler(debugString);
#endif /* QT_VERSION >= 0x050000 */
// debug
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
debug = (debugEnv == QString("yes"));
setMinimumPollingInterval(333);
readConfiguration();
initSources();
}
Netctl::~Netctl()
{
if (debug) qDebug() << PDEBUG;
}
QStringList Netctl::sources() const
{
if (debug) qDebug() << PDEBUG;
QStringList sources;
sources.append(QString("active"));
sources.append(QString("current"));
sources.append(QString("extip4"));
sources.append(QString("extip6"));
sources.append(QString("info"));
sources.append(QString("currentProfile"));
sources.append(QString("extIp"));
sources.append(QString("interfaces"));
sources.append(QString("intip4"));
sources.append(QString("intip6"));
sources.append(QString("netctlauto"));
sources.append(QString("intIp"));
sources.append(QString("profiles"));
sources.append(QString("status"));
sources.append(QString("statusBool"));
sources.append(QString("statusString"));
return sources;
}
QString Netctl::getCmdOutput(const QString cmd) const
bool Netctl::readConfiguration()
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
// default configuration
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);
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
QString fileStr;
// FIXME: define configuration file
QFile confFile(QString(getenv("HOME")) + QString("/.kde4/share/config/netctl.conf"));
bool exists = confFile.open(QIODevice::ReadOnly);
if (!exists) {
confFile.setFileName("/usr/share/config/netctl.conf");
exists = confFile.open(QIODevice::ReadOnly);
if (!exists)
return false;
}
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;
}
void Netctl::readConfiguration()
{
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();
confFile.close();
return true;
}
bool Netctl::sourceRequestEvent(const QString &name)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Source name" << 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)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Source name" << source;
QProcess command;
QString cmdOutput = QString("");
QString value = QString("");
QString value = QString("N\\A");
if (source == QString("active")) {
value = status ? QString("true") : QString("false");
} else if (source == QString("current")) {
value = currentProfile.join(QChar('|'));
} else if (source == QString("extip4")) {
if (configuration[QString("EXTIP4")].toString() == QString("true"))
value = getExtIp(configuration[QString("EXTIP4CMD")].toString());
} else if (source == QString("extip6")) {
if (configuration[QString("EXTIP6")].toString() == QString("true"))
value = getExtIp(configuration[QString("EXTIP6CMD")].toString());
} else if (source == QString("info")) {
value = getInfo(currentProfile, currentStatus);
} else if (source == QString("interfaces")) {
value = getInterfaceList().join(QChar(','));
} else if (source == QString("intip4")) {
value = getIntIp(QAbstractSocket::IPv4Protocol);
} else if (source == QString("intip6")) {
value = getIntIp(QAbstractSocket::IPv6Protocol);
} else if (source == QString("netctlauto")) {
value = netctlAutoStatus ? QString("true") : QString("false");
} else if (source == QString("profiles")) {
value = getProfileList(configuration[QString("NETCTLCMD")].toString(),
configuration[QString("NETCTLAUTOCMD")].toString()).join(QChar(','));
} else if (source == QString("status")) {
currentStatus = getProfileStringStatus(configuration[QString("NETCTLCMD")].toString());
value = currentStatus.join(QChar('|'));
if (source == QString("currentProfile")) {
command.start(configuration[QString("CMD")] + QString(" list"));
command.waitForFinished(-1);
cmdOutput = command.readAllStandardOutput();
if (!cmdOutput.isEmpty()) {
QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
for (int i=0; i<profileList.count(); i++)
if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) {
value = profileList[i].split(QString(" "), QString::SkipEmptyParts)[1];
break;
}
}
setData(source, QString("value"), value);
}
else if (source == QString("extIp")) {
if (configuration[QString("EXTIP")] == QString("true")) {
command.start(configuration[QString("EXTIPCMD")]);
command.waitForFinished(-1);
cmdOutput = command.readAllStandardOutput();
if (!cmdOutput.isEmpty())
value = cmdOutput.split(QString("\n"), QString::SkipEmptyParts)[0];
}
setData(source, QString("value"), value);
}
else if (source == QString("interfaces")) {
if (QDir(configuration[QString("NETDIR")]).exists())
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;
}
#ifdef BUILD_KDE4
K_EXPORT_PLASMA_DATAENGINE(netctl, Netctl)
#else
K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(netctl, Netctl, "plasma-dataengine-netctl.json")
#endif /* BUILD_KDE4 */
#include "netctl.moc"

View File

@ -19,7 +19,6 @@
#define NETCTL_DE_H
#include <Plasma/DataEngine>
#include <QAbstractSocket>
class Netctl : public Plasma::DataEngine
@ -27,34 +26,17 @@ class Netctl : public Plasma::DataEngine
Q_OBJECT
public:
explicit 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();
Netctl(QObject *parent, const QVariantList &args);
protected:
bool readConfiguration();
bool sourceRequestEvent(const QString &name);
bool updateSourceEvent(const QString &source);
QStringList sources() const;
private:
bool isNetctlCheckRunning = false;
bool netctlAutoStatus = false;
bool status = false;
QStringList currentProfile;
QStringList currentStatus;
// configuration
bool debug;
QVariantMap configuration;
QString getCmdOutput(const QString cmd) const;
void readConfiguration();
QMap<QString, QString> configuration;
};

View File

@ -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

View File

@ -4,17 +4,17 @@ Name=Netctl
Comment=Data engine for netctl
ServiceTypes=Plasma/DataEngine
Type=Service
Icon=netctl-gui-widget
Icon=netctl-gui
X-KDE-ServiceTypes=Plasma/DataEngine
X-KDE-Library=plasma_engine_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-Name=netctl
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-Depends=
X-KDE-PluginInfo-License=GPLv3

View File

@ -5,8 +5,7 @@ message (STATUS "Subproject ${SUBPROJECT}")
# set directories
set (SUBPROJECT_BINARY_DIR bin)
set (SUBPROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set (SUBPROJECT_DOCS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/docs)
set (SUBPROJECT_RESOURCE_DIR ${PROJECT_RESOURCE_DIR})
set (SUBPROJECT_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
set (SUBPROJECT_TRANSLATION_DIR ${SUBPROJECT_RESOURCE_DIR}/translations)
# executable path
set (EXECUTABLE_OUTPUT_PATH ${SUBPROJECT_BINARY_DIR})
@ -16,13 +15,5 @@ set (TARGETS "")
set (HEADERS "")
add_subdirectory (${SUBPROJECT_SOURCE_DIR})
add_subdirectory (${SUBPROJECT_DOCS_DIR})
# build man
file (GLOB SUBPROJECT_MAN_IN *.1)
file (RELATIVE_PATH SUBPROJECT_MAN ${CMAKE_SOURCE_DIR} ${SUBPROJECT_MAN_IN})
configure_file (${SUBPROJECT_MAN_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN})
install (FILES ${SUBPROJECT}.desktop DESTINATION share/applications/)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN} DESTINATION share/man/man1/)
install (FILES bash-completions DESTINATION share/bash-completion/completions/ RENAME ${SUBPROJECT})
install (FILES zsh-completions DESTINATION share/zsh/site-functions/ RENAME _${SUBPROJECT})

View File

@ -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

View File

@ -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})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View File

@ -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>
&copy; 2014-@CURRENT_YEAR@ <a href="mailto:@PROJECT_CONTACT@">@PROJECT_AUTHOR@</a><br>
This software is licensed under @PROJECT_LICENSE@
</small>
</body>
</html>

View File

@ -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 &lt;profile&gt;</code>. They are commands which provide a general control to netctl.</li>
<li><code>systemctl start|restart|enable &lt;netctl-auto@service&gt;</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 '&lt;profile&gt;'; set"
# get profile variables
env -i bash -c "source '&lt;profile&gt;'; for i in &#36;{!&lt;key&gt;[@]}; do echo &#36;{&lt;key&gt;[$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>&lt;cmd&gt; list</code></li>
<li><code>netctl is-enabled &lt;profile&gt;</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 &lt;profile&gt;</code></li>
<li><code>netctl disable &lt;profile&gt;</code></li>
<li><code>netctl restart &lt;profile&gt;</code></li>
<li><code>netctl start &lt;profile&gt;</code></li>
<li><code>netctl stop &lt;profile&gt;</code></li>
<li><code>netctl stop-all</code></li>
<li><code>netctl switch-to &lt;profile&gt;</code></li>
<li><code>netctl-auto switch-to &lt;profile&gt;</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>
&copy; 2014-@CURRENT_YEAR@ <a href="mailto:@PROJECT_CONTACT@">@PROJECT_AUTHOR@</a><br>
This software is licensed under @PROJECT_LICENSE@
</small>
</body>
</html>

Binary file not shown.

View File

@ -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@

View File

@ -1,7 +1,7 @@
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Netctl GUI
Comment=Qt graphical user interface for netctl
Comment=GUI written on Qt4 for netctl
Exec=netctl-gui
Icon=netctl-gui.png
Terminal=false

View File

@ -0,0 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>translations/english.qm</file>
<file>translations/russian.qm</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,68 +1,73 @@
# set files
if (USE_QT5)
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
${PROJECT_TRDPARTY_DIR}/language/*.cpp
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
else ()
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
${PROJECT_TRDPARTY_DIR}/language/*.cpp
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
endif ()
file (GLOB_RECURSE HEADERS *.h ${PROJECT_TRDPARTY_DIR}/task/*.h
${PROJECT_TRDPARTY_DIR}/language/*.h)
file (GLOB_RECURSE FORMS *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui)
file (GLOB SOURCES *.cpp)
file (GLOB HEADERS *.h)
file (GLOB FORMS *.ui)
file (GLOB LANGUAGES ${SUBPROJECT_TRANSLATION_DIR}/*.ts)
set (LANGUAGES english
russian)
set (RESOURCES ${SUBPROJECT_RESOURCE_DIR}/resources.qrc)
message (STATUS "${SUBPROJECT} Sources: ${SOURCES}")
message (STATUS "${SUBPROJECT} Headers: ${HEADERS}")
message (STATUS "${SUBPROJECT} Forms: ${FORMS}")
# include_path
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../${PROJECT_LIBRARY}/include/
${CMAKE_CURRENT_BINARY_DIR}/../
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_TRDPARTY_DIR})
link_directories (${PROJECT_LIBRARY}/src/lib)
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../)
if (USE_QT5)
find_package (Qt5 COMPONENTS Core DBus Widgets LinguistTools REQUIRED)
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5LinguistTools_DEFINITIONS})
include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
set (QT_NEEDED_LIBS ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Widgets_LIBRARIES})
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
qt5_wrap_ui (UI_HEADERS ${FORMS})
qt5_add_resources (QRC_SOURCES ${RESOURCES})
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5LinguistTools REQUIRED)
add_definitions(${Qt5Core_DEFINITIONS})
add_definitions(${Qt5Widgets_DEFINITIONS})
add_definitions(${Qt5LinguistTools_DEFINITIONS})
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
qt5_wrap_ui (UI_HEADERS ${FORMS})
qt5_add_resources (QRC_SOURCES ${RESOURCES})
foreach (LANGUAGE ${LANGUAGES})
set (TS ${LANGUAGE})
string (REPLACE ".ts" ".qm" QM ${TS})
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
add_custom_command (OUTPUT ${QM} COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
endforeach ()
add_custom_target (translations COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
add_custom_command (TARGET translations COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
foreach (LANGUAGE ${LANGUAGES})
set (TS ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.ts)
set (QM ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.qm)
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
add_custom_command (OUTPUT ${QM} COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
endforeach ()
add_custom_target (translations COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
add_custom_command (TARGET translations COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
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 ()
find_package (Qt4 COMPONENTS QtCore QtDBus QtGui REQUIRED)
include (${QT_USE_FILE})
set (QT_NEEDED_LIBS ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY})
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
qt4_wrap_ui (UI_HEADERS ${FORMS})
qt4_add_resources (QRC_SOURCES ${RESOURCES})
find_package (Qt4 REQUIRED)
include (${QT_USE_FILE})
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
qt4_wrap_ui (UI_HEADERS ${FORMS})
qt4_add_resources (QRC_SOURCES ${RESOURCES})
foreach (LANGUAGE ${LANGUAGES})
set (TS ${LANGUAGE})
string (REPLACE ".ts" ".qm" QM ${TS})
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
endforeach ()
add_custom_target (translations COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
add_custom_command (TARGET translations COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
foreach (LANGUAGE ${LANGUAGES})
set (TS ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.ts)
set (QM ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.qm)
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
endforeach ()
add_custom_target (translations COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
add_custom_command (TARGET translations COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
message (STATUS "${SUBPROJECT} Translations: ${TRANSLATIONS_BINARY}")
source_group ("Header Files" FILES ${HEADERS})
source_group ("Source Files" FILES ${SOURCES})
source_group ("Generated Files" FILES ${MOC_SOURCES})
add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
target_link_libraries (${SUBPROJECT} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
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 (TARGETS ${SUBPROJECT} DESTINATION bin)

View File

@ -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>&copy; %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();
}

View File

@ -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 */

View File

@ -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>

View File

@ -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")]);
}

View File

@ -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 */

View File

@ -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>

View File

@ -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> settings;
QMap<QString, QString> bridgeSettings;
if (isOk() != 0) return settings;
if (isOk() != 0)
return bridgeSettings;
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)
{
clear();
QMap<QString, QString> bridgeSettings = settings;
if (settings.contains(QString("SkipForwardingDelay")))
if (settings[QString("SkipForwardingDelay")] == QString("yes"))
if (bridgeSettings.contains(QString("SkipForwardingDelay")))
if (bridgeSettings[QString("SkipForwardingDelay")].remove(QString("'")) == QString("yes"))
ui->checkBox_skip->setCheckState(Qt::Checked);
}

View File

@ -38,6 +38,7 @@ public:
public slots:
void clear();
void setShown(const bool state);
private:
Ui::BridgeWidget *ui;

View File

@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<height>44</height>
<width>424</width>
<height>76</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QDockWidget" name="dockWidget_bridge">
<property name="features">
@ -24,38 +24,15 @@
</property>
<widget class="QWidget" name="dockWidgetContents_bridge">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="layout_skip">
<item>
<widget class="QLabel" name="labe_skip">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>
<widget class="QCheckBox" name="checkBox_skip">
<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>
</widget>

View File

@ -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();
}
}

View File

@ -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 */

View File

@ -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;
}

View File

@ -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 */

View File

@ -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);
}

View File

@ -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 */

View File

@ -16,193 +16,81 @@
***************************************************************************/
#include "errorwindow.h"
#include "ui_errorwindow.h"
#include <QApplication>
#include <QGridLayout>
#include <QSpacerItem>
#include <QDebug>
#include <pdebug/pdebug.h>
ErrorWindow::ErrorWindow(QWidget *parent, const bool debugCmd)
: debug(debugCmd)
ErrorWindow::ErrorWindow(QWidget *parent, const int messageNumber)
: QMainWindow(parent),
ui(new Ui::ErrorWindow)
{
ui->setupUi(this);
qDebug() << "[ErrorWindow]" << "[ErrorWindow]" << ":" << "Initializate with error code" << messageNumber;
setMessage(messageNumber);
}
ErrorWindow::~ErrorWindow()
{
if (debug) qDebug() << PDEBUG;
delete ui;
}
QStringList ErrorWindow::getMessage(const int mess)
void ErrorWindow::setMessage(const int mess)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Message" << mess;
QString message, title;
QString message;
switch(mess) {
case 1:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Could not find components");
break;
case 2:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Does not support yet");
break;
case 3:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Profile name is not set");
break;
case 4:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Bind interfaces are not set");
break;
case 5:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Description is not set");
break;
case 6:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Ip settings are not set");
break;
case 7:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Configuration file does not exist");
break;
case 8:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Key is not set");
break;
case 9:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Wireless settings are not set");
break;
case 10:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Configuration file is not set");
break;
case 11:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "ESSID is not set");
break;
case 12:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "MAC address is incorrect");
break;
case 13:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Session ID is not set");
break;
case 14:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "User is not in network group, helper will not be started");
message = QApplication::translate("ErrorWindow", "APN is not set");
break;
case 15:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "APN is not set");
break;
case 16:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Empty user/group name");
break;
case 17:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Could not find profile");
break;
case 18:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Could not find ESSID");
break;
case 19:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Could not run helper");
break;
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:
title = QApplication::translate("ErrorWindow", "Error!");
message = QApplication::translate("ErrorWindow", "Unknown error");
break;
}
QStringList fullMessage;
fullMessage.append(title);
fullMessage.append(message);
return fullMessage;
}
QMessageBox::Icon ErrorWindow::getIcon(const int mess)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Message" << mess;
QMessageBox::Icon icon;
switch(mess) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
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;
ui->label->setText(message);
}

View File

@ -18,29 +18,25 @@
#ifndef ERRORWINDOW_H
#define ERRORWINDOW_H
#include <QMessageBox>
#include <QObject>
#include <QMainWindow>
class ErrorWindow : public QObject
namespace Ui {
class ErrorWindow;
}
class ErrorWindow : public QMainWindow
{
Q_OBJECT
public:
explicit ErrorWindow(QWidget *parent = 0,
const bool debugCmd = false);
const int messageNumber = 0);
~ErrorWindow();
public slots:
static void showWindow(const int mess = 0,
const QString sender = QString(),
const bool debugCmd = false);
private:
bool debug;
QStringList getMessage(const int mess);
QMessageBox::Icon getIcon(const int mess);
Ui::ErrorWindow *ui;
void setMessage(const int mess);
};
#endif /* ERRORWINDOW_H */

View 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>

View File

@ -44,9 +44,8 @@ void EthernetWidget::clear()
ui->checkBox_skip->setCheckState(Qt::Unchecked);
ui->checkBox_8021x->setCheckState(Qt::Unchecked);
showWpa(ui->checkBox_8021x->checkState());
ui->lineEdit_wpaConfig->clear();
ui->lineEdit_wpaConfig->setText(QString("/etc/wpa_supplicant.conf"));
ui->comboBox_driver->setCurrentIndex(0);
ui->spinBox_priority->setValue(1);
ui->spinBox_timeoutCarrier->setValue(5);
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()
{
connect(ui->pushButton_ethernetAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
@ -65,7 +73,8 @@ void EthernetWidget::createActions()
void EthernetWidget::selectWpaConfig()
{
QString filename = QFileDialog::getOpenFileName(this,
QString filename = QFileDialog::getOpenFileName(
this,
QApplication::translate("EthernetWidget", "Select wpa configuration file"),
QDir::currentPath(),
QApplication::translate("EthernetWidget", "Configuration files (*.conf)"));
@ -78,41 +87,44 @@ void EthernetWidget::showAdvanced()
{
if (ui->pushButton_ethernetAdvanced->isChecked()) {
ui->widget_ethernetAdvanced->setHidden(false);
ui->pushButton_ethernetAdvanced->setArrowType(Qt::UpArrow);
} else {
ui->pushButton_ethernetAdvanced->setText(QApplication::translate("EthernetWidget", "Hide advanced"));
}
else {
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)
{
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> settings;
QMap<QString, QString> ethernetSettings;
if (isOk() != 0) return settings;
if (isOk() != 0)
return ethernetSettings;
if (ui->checkBox_skip->checkState() == Qt::Checked)
settings[QString("SkipNoCarrier")] = QString("yes");
ethernetSettings[QString("SkipNoCarrier")] = QString("yes");
if (ui->checkBox_8021x->checkState() == Qt::Checked) {
settings[QString("Auth8021X")] = QString("yes");
settings[QString("WPAConfigFile")] = QString("'%1'").arg(ui->lineEdit_wpaConfig->text());
settings[QString("WPADriver")] = ui->comboBox_driver->currentText();
ethernetSettings[QString("Auth8021X")] = QString("yes");
ethernetSettings[QString("WPAConfigFile")] = QString("'") + ui->lineEdit_wpaConfig->text() + QString("'");
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)
settings[QString("TimeoutCarrier")] = QString::number(ui->spinBox_timeoutCarrier->value());
ethernetSettings[QString("TimeoutCarrier")] = QString::number(ui->spinBox_timeoutCarrier->value());
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
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
return 0;
}
@ -128,26 +141,24 @@ int EthernetWidget::isOk()
void EthernetWidget::setSettings(const QMap<QString, QString> settings)
{
clear();
QMap<QString, QString> ethernetSettings = settings;
if (settings.contains(QString("SkipNoCarrier")))
if (settings[QString("SkipNoCarrier")] == QString("yes"))
if (ethernetSettings.contains(QString("SkipNoCarrier")))
if (ethernetSettings[QString("SkipNoCarrier")].remove(QString("'")) == QString("yes"))
ui->checkBox_skip->setCheckState(Qt::Checked);
if (settings.contains(QString("Auth8021X")))
if (settings[QString("Auth8021X")] == QString("yes"))
if (ethernetSettings.contains(QString("Auth8021X")))
if (ethernetSettings[QString("Auth8021X")].remove(QString("'")) == QString("yes"))
ui->checkBox_8021x->setCheckState(Qt::Checked);
if (settings.contains(QString("WPAConfigFile")))
ui->lineEdit_wpaConfig->setText(settings[QString("WPAConfigFile")]);
if (settings.contains(QString("WPADriver"))) {
int index = ui->comboBox_driver->findText(settings[QString("WPADriver")]);
ui->comboBox_driver->setCurrentIndex(index);
}
if (settings.contains(QString("Priority")))
ui->spinBox_priority->setValue(settings[QString("Priority")].toInt());
if (settings.contains(QString("TimeoutCarrier")))
ui->spinBox_timeoutCarrier->setValue(settings[QString("TimeoutCarrier")].toInt());
if (settings.contains(QString("TimeoutWPA")))
ui->spinBox_timeoutWpa->setValue(settings[QString("TimeoutWPA")].toInt());
if (ethernetSettings.contains(QString("WPAConfigFile")))
ui->lineEdit_wpaConfig->setText(ethernetSettings[QString("WPAConfigFile")].remove(QString("'")));
if (ethernetSettings.contains(QString("WPADriver")))
for (int i=0; i<ui->comboBox_driver->count(); i++)
if (ethernetSettings[QString("WPADriver")].remove(QString("'")) == ui->comboBox_driver->itemText(i))
ui->comboBox_driver->setCurrentIndex(i);
if (ethernetSettings.contains(QString("TimeoutCarrier")))
ui->spinBox_timeoutCarrier->setValue(ethernetSettings[QString("TimeoutCarrier")].toInt());
if (ethernetSettings.contains(QString("TimeoutWPA")))
ui->spinBox_timeoutWpa->setValue(ethernetSettings[QString("TimeoutWPA")].toInt());
showWpa(ui->checkBox_8021x->checkState());
}

View File

@ -39,6 +39,7 @@ public:
public slots:
void clear();
void setShown(const bool state);
private slots:
void selectWpaConfig();

View File

@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<height>255</height>
<width>431</width>
<height>296</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QDockWidget" name="dockWidget_ethernet">
<property name="features">
@ -24,29 +24,29 @@
</property>
<widget class="QWidget" name="dockWidgetContents_ethernet">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="layout_ethernetAdvanced">
<item>
<widget class="Line" name="line">
<spacer name="spacer_ethernetAdvanced">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</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">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="arrowType">
<enum>Qt::DownArrow</enum>
</property>
</widget>
</item>
</layout>
@ -54,104 +54,49 @@
<item>
<widget class="QWidget" name="widget_ethernetAdvanced" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="layout_skip">
<item>
<widget class="QLabel" name="label_skip">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether or not the absence of a carrier is acceptable&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Skip no carrier</string>
</property>
</widget>
</item>
</layout>
<widget class="QCheckBox" name="checkBox_skip">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether or not the absence of a carrier is acceptable&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Skip no carrier</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="layout_8021x">
<item>
<widget class="QLabel" name="label_8021x">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<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>
<widget class="QCheckBox" name="checkBox_8021x">
<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>
<item>
<widget class="QWidget" name="widget_wpa" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="layout_wpaConfig">
<item>
<widget class="QLabel" name="label_wpaConfig">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>7</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>WPA config file</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<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">
<string>Path to a wpa_supplicant configuration file</string>
</property>
@ -159,12 +104,6 @@
</item>
<item>
<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">
<string>Browse</string>
</property>
@ -176,28 +115,19 @@
<layout class="QHBoxLayout" name="layout_driver">
<item>
<widget class="QLabel" name="label_driver">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>7</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>WPA driver</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<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">
<string>The wpa_supplicant driver to use for 802.1x authentication</string>
</property>
@ -227,28 +157,19 @@
<layout class="QHBoxLayout" name="layout_timeoutCarrier">
<item>
<widget class="QLabel" name="label_timeoutCarrier">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Timeout carrier</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<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">
<string>Maximum time, in seconds, to wait for a carrier</string>
</property>
@ -266,28 +187,19 @@
<layout class="QHBoxLayout" name="layout_timeoutWpa">
<item>
<widget class="QLabel" name="label_timeoutWpa">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Timeout WPA</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<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">
<string>Maximum time, in seconds, to wait for 802.1x authentication to succeed</string>
</property>
@ -301,45 +213,6 @@
</item>
</layout>
</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>
</widget>
</item>
@ -350,6 +223,9 @@
</layout>
</widget>
<tabstops>
<tabstop>pushButton_ethernetAdvanced</tabstop>
<tabstop>checkBox_skip</tabstop>
<tabstop>checkBox_8021x</tabstop>
<tabstop>lineEdit_wpaConfig</tabstop>
<tabstop>pushButton_wpaConfig</tabstop>
<tabstop>comboBox_driver</tabstop>

View File

@ -59,7 +59,6 @@ void GeneralWidget::clear()
ui->listWidget_after->clear();
ui->lineEdit_execUpPost->clear();
ui->lineEdit_execDownPre->clear();
ui->checkBox_exclude->setCheckState(Qt::Unchecked);
ui->checkBox_forceConnect->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()
{
connect(ui->pushButton_generalAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
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->comboBox_bindto->lineEdit(), SIGNAL(returnPressed()), this, SLOT(addBindTo()));
}
@ -94,10 +100,10 @@ void GeneralWidget::keyPressEvent(QKeyEvent *pressedKey)
{
if (pressedKey->key() == Qt::Key_Delete) {
if (ui->listWidget_bindto->hasFocus() &&
(ui->listWidget_bindto->currentItem() != nullptr))
(ui->listWidget_bindto->currentItem() != 0))
delete ui->listWidget_bindto->currentItem();
else if (ui->listWidget_after->hasFocus() &&
(ui->listWidget_after->currentItem() != nullptr))
(ui->listWidget_after->currentItem() != 0))
delete ui->listWidget_after->currentItem();
}
}
@ -108,7 +114,8 @@ void GeneralWidget::showAdvanced()
if (ui->pushButton_generalAdvanced->isChecked()) {
ui->widget_generalAdvanced->setHidden(false);
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Hide advanced"));
} else {
}
else {
ui->widget_generalAdvanced->setHidden(true);
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Show advanced"));
}
@ -117,37 +124,36 @@ void GeneralWidget::showAdvanced()
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());
settings[QString("Connection")] = ui->comboBox_connection->currentText();
settings[QString("Interface")] = ui->comboBox_interface->currentText();
generalSettings[QString("Description")] = QString("'") + ui->lineEdit_description->text() + QString("'");
generalSettings[QString("Connection")] = ui->comboBox_connection->currentText();
generalSettings[QString("Interface")] = ui->comboBox_interface->currentText();
if (ui->listWidget_bindto->count() != 0) {
QStringList interfaces;
for (int i=0; i<ui->listWidget_bindto->count(); i++)
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) {
QStringList profiles;
for (int i=0; i<ui->listWidget_after->count(); i++)
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())
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())
settings[QString("ExecDownPre")] = QString("'%1'").arg(ui->lineEdit_execDownPre->text());
if (ui->checkBox_exclude->checkState() == Qt::Checked)
settings[QString("ExcludeAuto")] = QString("yes");
generalSettings[QString("ExecDownPre")] = QString("'") + ui->lineEdit_execDownPre->text() + QString("'");
if (ui->checkBox_forceConnect->checkState() == Qt::Checked)
settings[QString("ForceConnect")] = QString("yes");
generalSettings[QString("ForceConnect")] = QString("yes");
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
if ((ui->comboBox_connection->currentText() == QString("bond")) ||
(ui->comboBox_connection->currentText() == QString("bridge")) ||
(ui->comboBox_connection->currentText() == QString("vlan")) ||
(ui->comboBox_connection->currentText() == QString("macvlan")) ||
(ui->comboBox_connection->currentText() == QString("openvswitch")))
if (ui->listWidget_bindto->count() == 0) return 1;
(ui->comboBox_connection->currentText() == QString("bridge")) ||
(ui->comboBox_connection->currentText() == QString("vlan")))
if (ui->listWidget_bindto->count() == 0)
return 1;
// empty description
if (ui->lineEdit_description->text().isEmpty()) return 2;
if (ui->lineEdit_description->text().isEmpty())
return 2;
// all fine
return 0;
}
@ -169,33 +175,30 @@ int GeneralWidget::isOk()
void GeneralWidget::setSettings(const QMap<QString, QString> settings)
{
clear();
QMap<QString, QString> generalSettings = settings;
if (settings.contains(QString("Description")))
ui->lineEdit_description->setText(settings[QString("Description")]);
if (settings.contains(QString("Connection"))) {
int index = ui->comboBox_connection->findText(settings[QString("Connection")]);
ui->comboBox_connection->setCurrentIndex(index);
}
if (settings.contains(QString("Interface"))) {
ui->comboBox_interface->addItem(settings[QString("Interface")]);
ui->comboBox_interface->setCurrentIndex(ui->comboBox_interface->count() - 1);
}
if (settings.contains(QString("BindsToInterfaces")))
ui->listWidget_bindto->addItems(settings[QString("BindsToInterfaces")].split(QChar('\n')));
if (settings.contains(QString("After")))
ui->listWidget_after->addItems(settings[QString("After")].split(QChar('\n')));
if (settings.contains(QString("ExecUpPost")))
ui->lineEdit_execUpPost->setText(settings[QString("ExecUpPost")]);
if (settings.contains(QString("ExecDownPre")))
ui->lineEdit_execDownPre->setText(settings[QString("ExecDownPre")]);
if (settings.contains(QString("ExcludeAuto")))
if (settings[QString("ExcludeAuto")] == QString("yes"))
ui->checkBox_exclude->setCheckState(Qt::Checked);
if (settings.contains(QString("ForceConnect")))
if (settings[QString("ForceConnect")] == QString("yes"))
if (generalSettings.contains(QString("Description")))
ui->lineEdit_description->setText(generalSettings[QString("Description")].remove(QString("'")));
if (generalSettings.contains(QString("Connection")))
for (int i=0; i<ui->comboBox_connection->count(); i++)
if (generalSettings[QString("Connection")].remove(QString("'")) == ui->comboBox_connection->itemText(i))
ui->comboBox_connection->setCurrentIndex(i);
if (generalSettings.contains(QString("Interface")))
for (int i=0; i<ui->comboBox_interface->count(); i++)
if (generalSettings[QString("Interface")].remove(QString("'")) == ui->comboBox_interface->itemText(i))
ui->comboBox_interface->setCurrentIndex(i);
if (generalSettings.contains(QString("BindsToInterfaces")))
ui->listWidget_bindto->addItems(generalSettings[QString("BindsToInterfaces")].split(QString(" ")));
if (generalSettings.contains(QString("After")))
ui->listWidget_after->addItems(generalSettings[QString("After")].split(QString(" ")));
if (generalSettings.contains(QString("ExecUpPost")))
ui->lineEdit_execUpPost->setText(generalSettings[QString("ExecUpPost")].remove(QString("'")));
if (generalSettings.contains(QString("ExecDownPre")))
ui->lineEdit_execDownPre->setText(generalSettings[QString("ExecDownPre")].remove(QString("'")));
if (generalSettings.contains(QString("ForceConnect")))
if (generalSettings[QString("ForceConnect")].remove(QString("'")) == QString("yes"))
ui->checkBox_forceConnect->setCheckState(Qt::Checked);
if (settings.contains(QString("NETCTL_DEBUG")))
if (settings[QString("NETCTL_DEBUG")] == QString("yes"))
if (generalSettings.contains(QString("NETCTL_DEBUG")))
if (generalSettings[QString("NETCTL_DEBUG")].remove(QString("'")) == QString("yes"))
ui->checkBox_debug->setCheckState(Qt::Checked);
}

View File

@ -43,6 +43,7 @@ public:
public slots:
void clear();
void setShown(const bool state);
private slots:
void addAfter();

View File

@ -6,22 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<height>479</height>
<width>431</width>
<height>537</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
<number>0</number>
</property>
<item>
<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">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>
@ -30,37 +24,25 @@
</property>
<widget class="QWidget" name="dockWidgetContents_general">
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="layout_description">
<item>
<widget class="QLabel" name="label_description">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Description</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<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">
<string>A description of the profile</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;A description of the profile&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -70,28 +52,19 @@
<layout class="QHBoxLayout" name="layout_connection">
<item>
<widget class="QLabel" name="label_connection">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Connection</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<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">
<string>The connection type used by the profile</string>
</property>
@ -145,16 +118,6 @@
<string notr="true">vlan</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">macvlan</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">openvswitch</string>
</property>
</item>
</widget>
</item>
</layout>
@ -163,28 +126,19 @@
<layout class="QHBoxLayout" name="layout_interface">
<item>
<widget class="QLabel" name="label_interface">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Interface</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<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">
<string>The name of the associated network interface</string>
</property>
@ -201,27 +155,18 @@
<layout class="QHBoxLayout" name="layout_bindtoButton">
<item>
<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">
<string>Binds to interfaces</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_bindto">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
@ -230,12 +175,6 @@
</item>
<item>
<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">
<string>Add</string>
</property>
@ -261,23 +200,26 @@
<item>
<layout class="QHBoxLayout" name="layout_generalAdvanced">
<item>
<widget class="Line" name="line">
<spacer name="spacer_generalAdvanced">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</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">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="arrowType">
<enum>Qt::DownArrow</enum>
</property>
</widget>
</item>
</layout>
@ -285,36 +227,24 @@
<item>
<widget class="QWidget" name="widget_generalAdvanced" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="layout_after">
<item>
<layout class="QHBoxLayout" name="layout_afterButton">
<item>
<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">
<string>After</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_after">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
@ -323,12 +253,6 @@
</item>
<item>
<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">
<string>Add</string>
</property>
@ -355,28 +279,19 @@
<layout class="QHBoxLayout" name="layout_execUpPost">
<item>
<widget class="QLabel" name="label_execUpPost">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>7</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Command after starting</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<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">
<string>A command that is executed after a connection is established</string>
</property>
@ -388,28 +303,19 @@
<layout class="QHBoxLayout" name="layout_execDownPre">
<item>
<widget class="QLabel" name="label_execDownPre">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>7</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Command before stoping</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<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">
<string>A command that is executed before a connection is brought down</string>
</property>
@ -418,91 +324,21 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_exclude">
<item>
<widget class="QLabel" name="label_exclude">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>
<widget class="QCheckBox" name="checkBox_forceConnect">
<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>
<item>
<layout class="QHBoxLayout" name="layout_forceConnect">
<item>
<widget class="QLabel" name="label_forceConnect">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<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>
<widget class="QCheckBox" name="checkBox_debug">
<property name="text">
<string>Debug mode</string>
</property>
</widget>
</item>
</layout>
</widget>

View File

@ -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);
}

View File

@ -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 */

View File

@ -18,11 +18,9 @@
#include "ipwidget.h"
#include "ui_ipwidget.h"
#include <QDebug>
#include <QKeyEvent>
#include "errorwindow.h"
#include "ipregexp.h"
IpWidget::IpWidget(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()
{
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)));
// buttons
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_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_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->lineEdit_dns, SIGNAL(returnPressed()), this, SLOT(addDns()));
connect(ui->pushButton_dnsOptions, SIGNAL(clicked(bool)), this, SLOT(addDnsOpt()));
connect(ui->lineEdit_dnsOptions, SIGNAL(returnPressed()), this, SLOT(addDnsOpt()));
}
void IpWidget::createFilter()
{
// using input mask because validators is not comfortable
// ipv4
ui->lineEdit_ipAddress->setValidator(IpRegExp::ipv4CidrValidator());
ui->lineEdit_gateway->setValidator(IpRegExp::ipv4Validator());
ui->lineEdit_ipRoutes->setValidator(IpRegExp::ipv4CidrValidator());
ui->lineEdit_ipRoutes2->setValidator(IpRegExp::ipv4Validator());
ui->lineEdit_ipAddress->setInputMask(QString("999.999.999.999/99"));
ui->lineEdit_gateway->setInputMask(QString("999.999.999.999"));
ui->lineEdit_ipRoutes->setInputMask(QString("999.999.999.999/99"));
ui->lineEdit_ipRoutes2->setInputMask(QString("999.999.999.999"));
// ipv6
ui->lineEdit_ipAddress6->setValidator(IpRegExp::ipv6CidrValidator());
ui->lineEdit_gateway6->setValidator(IpRegExp::ipv6Validator());
ui->lineEdit_ipRoutes6->setValidator(IpRegExp::ipv6CidrValidator());
ui->lineEdit_ipRoutes62->setValidator(IpRegExp::ipv6Validator());
ui->lineEdit_ipAddress6->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh/999"));
ui->lineEdit_gateway6->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"));
ui->lineEdit_ipRoutes6->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh/999"));
ui->lineEdit_ipRoutes62->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"));
// 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 (ui->listWidget_ipAddress->hasFocus() &&
(ui->listWidget_ipAddress->currentItem() != nullptr))
(ui->listWidget_ipAddress->currentItem() != 0))
delete ui->listWidget_ipAddress->currentItem();
else if (ui->listWidget_ipRoutes->hasFocus() &&
(ui->listWidget_ipRoutes->currentItem() != nullptr))
(ui->listWidget_ipRoutes->currentItem() != 0))
delete ui->listWidget_ipRoutes->currentItem();
else if (ui->listWidget_ipAddress6->hasFocus() &&
(ui->listWidget_ipAddress6->currentItem() != nullptr))
(ui->listWidget_ipAddress6->currentItem() != 0))
delete ui->listWidget_ipAddress6->currentItem();
else if (ui->listWidget_ipRoutes6->hasFocus() &&
(ui->listWidget_ipRoutes6->currentItem() != nullptr))
(ui->listWidget_ipRoutes6->currentItem() != 0))
delete ui->listWidget_ipRoutes6->currentItem();
else if (ui->listWidget_custom->hasFocus() &&
(ui->listWidget_custom->currentItem() != nullptr))
(ui->listWidget_custom->currentItem() != 0))
delete ui->listWidget_custom->currentItem();
else if (ui->listWidget_dns->hasFocus() &&
(ui->listWidget_dns->currentItem() != nullptr))
(ui->listWidget_dns->currentItem() != 0))
delete ui->listWidget_dns->currentItem();
else if (ui->listWidget_dnsOptions->hasFocus() &&
(ui->listWidget_dnsOptions->currentItem() != nullptr))
(ui->listWidget_dnsOptions->currentItem() != 0))
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()
{
if (!IpRegExp::checkString(ui->lineEdit_ipAddress->text(), IpRegExp::ip4CidrRegex()))
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp]"));
QString ip = getIp(ui->lineEdit_ipAddress->text().remove(" ").split(QString("/"))[0]);
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();
}
void IpWidget::addIpRoutes()
{
if ((!IpRegExp::checkString(ui->lineEdit_ipRoutes->text(), IpRegExp::ip4CidrRegex())) ||
(!IpRegExp::checkString(ui->lineEdit_ipRoutes2->text(), IpRegExp::ip4Regex())))
return ErrorWindow::showWindow(20, QString("[IpWidget::addIpRoutes]"));
QString ip = getIp(ui->lineEdit_ipRoutes->text().remove(" ").split(QString("/"))[0]);
QString prefix = getPrefix(ui->lineEdit_ipRoutes->text().remove(" ").split(QString("/"))[1]);
QString ipVia = getIp(ui->lineEdit_ipRoutes2->text().remove(" "));
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_ipRoutes2->clear();
}
@ -190,21 +256,21 @@ void IpWidget::addIpRoutes()
void IpWidget::addIp6()
{
if (!IpRegExp::checkString(ui->lineEdit_ipAddress6->text(), IpRegExp::ip6CidrRegex()))
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp6]"));
QString ip = getIp6(ui->lineEdit_ipAddress6->text().remove(" ").split(QString("/"))[0]);
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();
}
void IpWidget::addIpRoutes6()
{
if ((!IpRegExp::checkString(ui->lineEdit_ipRoutes6->text(), IpRegExp::ip6CidrRegex())) ||
(!IpRegExp::checkString(ui->lineEdit_ipRoutes62->text(), IpRegExp::ip6Regex())))
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp6Routes]"));
QString ip = getIp6(ui->lineEdit_ipRoutes6->text().remove(" ").split(QString("/"))[0]);
QString prefix = getPrefix6(ui->lineEdit_ipRoutes6->text().remove(" ").split(QString("/"))[1]);
QString ipVia = getIp6(ui->lineEdit_ipRoutes62->text().remove(" "));
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_ipRoutes62->clear();
}
@ -220,10 +286,9 @@ void IpWidget::addCustom()
void IpWidget::addDns()
{
if (!IpRegExp::checkString(ui->lineEdit_dns->text(), IpRegExp::ip4Regex()))
return ErrorWindow::showWindow(20, QString("[IpWidget::addDns]"));
QString ip = getIp(ui->lineEdit_dns->text().remove(" "));
ui->listWidget_dns->addItem(ui->lineEdit_dns->text());
ui->listWidget_dns->addItem(ip);
ui->lineEdit_dns->clear();
}
@ -238,36 +303,64 @@ void IpWidget::addDnsOpt()
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)
{
ui->comboBox_ip->setDisabled(state == 0);
ui->widget_ip->setDisabled(state == 0);
ui->widget_ipRoutes->setDisabled(state == 0);
if (state == 0) {
ui->comboBox_ip->setDisabled(true);
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)
{
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)
{
ui->comboBox_ip6->setDisabled(state == 0);
ui->widget_ip6->setDisabled(state == 0);
ui->widget_ipRoutes6->setDisabled(state == 0);
if (state == 0) {
ui->comboBox_ip6->setDisabled(true);
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)
{
ui->widget_dhcpcdOpt->setHidden(currentText != QString("dhcpcd"));
ui->widget_dhclientOpt->setHidden(currentText == QString("dhcpcd"));
if (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()) {
ui->widget_ipAdvanced->setHidden(false);
ui->pushButton_ipAdvanced->setArrowType(Qt::UpArrow);
} else {
ui->pushButton_ipAdvanced->setText(QApplication::translate("IpWidget", "Hide advanced"));
}
else {
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> settings;
QMap<QString, QString> ipSettings;
if (isOk() != 0) return settings;
if (isOk() != 0)
return ipSettings;
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")) {
QStringList addresses;
for (int i=0; i<ui->listWidget_ipAddress->count(); i++)
addresses.append(QString("'%1'").arg(ui->listWidget_ipAddress->item(i)->text()));
settings[QString("Address")] = addresses.join(QChar(' '));
settings[QString("Gateway")] = QString("'%1'").arg(ui->lineEdit_gateway->text());
addresses.append(QString("'") + ui->listWidget_ipAddress->item(i)->text() + QString("'"));
ipSettings[QString("Address")] = addresses.join(QString(" "));
ipSettings[QString("Gateway")] = QString("'") + ui->lineEdit_gateway->text() + QString("'");
}
if (ui->listWidget_ipRoutes->count() > 0) {
QStringList routes;
for (int i=0; i<ui->listWidget_ipRoutes->count(); i++)
routes.append(QString("'%1'").arg(ui->listWidget_ipRoutes->item(i)->text()));
settings[QString("Routes")] = routes.join(QChar(' '));
routes.append(QString("'") + ui->listWidget_ipRoutes->item(i)->text() + QString("'"));
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) {
settings[QString("IP6")] = ui->comboBox_ip6->currentText();
ipSettings[QString("IP6")] = ui->comboBox_ip6->currentText();
if ((ui->comboBox_ip6->currentText() == QString("static")) ||
(ui->comboBox_ip6->currentText() == QString("stateless"))) {
(ui->comboBox_ip6->currentText() == QString("stateless"))) {
QStringList addresses;
for (int i=0; i<ui->listWidget_ipAddress6->count(); i++)
addresses.append(QString("'%1'").arg(ui->listWidget_ipAddress6->item(i)->text()));
settings[QString("Address6")] = addresses.join(QChar(' '));
settings[QString("Gateway6")] = QString("'%1'").arg(ui->lineEdit_gateway6->text());
addresses.append(QString("'") + ui->listWidget_ipAddress6->item(i)->text() + QString("'"));
ipSettings[QString("Address6")] = addresses.join(QString(" "));
ipSettings[QString("Gateway6")] = QString("'") + ui->lineEdit_gateway6->text() + QString("'");
}
if (ui->listWidget_ipRoutes6->count() > 0) {
QStringList routes;
for (int i=0; i<ui->listWidget_ipRoutes6->count(); i++)
routes.append(QString("'%1'").arg(ui->listWidget_ipRoutes6->item(i)->text()));
settings[QString("Routes6")] = routes.join(QChar(' '));
routes.append(QString("'") + ui->listWidget_ipRoutes6->item(i)->text() + QString("'"));
ipSettings[QString("Routes6")] = routes.join(QString(" "));
}
} else
settings[QString("IP6")] = QString("no");
}
else
ipSettings[QString("IP6")] = QString("no");
if (ui->listWidget_custom->count() > 0) {
QStringList custom;
for (int i=0; i<ui->listWidget_custom->count(); i++)
custom.append(QString("'%1'").arg(ui->listWidget_custom->item(i)->text()));
settings[QString("IPCustom")] = custom.join(QChar(' '));
custom.append(QString("'") + ui->listWidget_custom->item(i)->text() + QString("'"));
ipSettings[QString("IPCustom")] = custom.join(QString(" "));
}
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)
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->lineEdit_dhcpcdOpt->text().isEmpty())
settings[QString("DhcpcdOptions")] = QString("'%1'").arg(ui->lineEdit_dhcpcdOpt->text());
} else if (ui->comboBox_dhcp->currentText() == QString("dhclient")) {
settings[QString("DHCPClient")] = ui->comboBox_dhcp->currentText();
ipSettings[QString("DhcpcdOptions")] = QString("'") + ui->lineEdit_dhcpcdOpt->text() + QString("'");
}
else if (ui->comboBox_dhcp->currentText() == QString("dhclient")) {
ipSettings[QString("DHCPClient")] = ui->comboBox_dhcp->currentText();
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())
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)
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)
settings[QString("DHCPReleaseOnStop")] = QString("yes");
ipSettings[QString("DHCPReleaseOnStop")] = QString("yes");
if (ui->listWidget_dns->count() > 0) {
QStringList dns;
for (int i=0; i<ui->listWidget_dns->count(); i++)
dns.append(QString("'%1'").arg(ui->listWidget_dns->item(i)->text()));
settings[QString("DNS")] = dns.join(QChar(' '));
dns.append(QString("'") + ui->listWidget_dns->item(i)->text() + QString("'"));
ipSettings[QString("DNS")] = dns.join(QString(" "));
}
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())
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) {
QStringList dnsOpt;
for (int i=0; i<ui->listWidget_dnsOptions->count(); i++)
dnsOpt.append(QString("'%1'").arg(ui->listWidget_dnsOptions->item(i)->text()));
settings[QString("DNSOptions")] = dnsOpt.join(QChar(' '));
dnsOpt.append(QString("'") + ui->listWidget_dnsOptions->item(i)->text() + QString("'"));
ipSettings[QString("DNSOptions")] = dnsOpt.join(QString(" "));
}
return settings;
return ipSettings;
}
int IpWidget::isOk()
{
// ip settings is not set
if ((ui->checkBox_ip->checkState() == Qt::Checked) &&
(ui->comboBox_ip->currentText() == QString("static")))
if ((ui->listWidget_ipAddress->count() == 0) ||
(ui->lineEdit_gateway->text().isEmpty())) return 1;
if (ui->checkBox_ip->checkState() == Qt::Checked)
if (ui->comboBox_ip->currentText() == QString("static"))
if ((ui->listWidget_ipAddress->count() == 0) ||
(ui->lineEdit_gateway->text().isEmpty()))
return 1;
// ipv6 settings is not set
if ((ui->checkBox_ip6->checkState() == Qt::Checked) &&
((ui->comboBox_ip6->currentText() == QString("static")) ||
(ui->comboBox_ip6->currentText() == QString("stateless"))))
if ((ui->listWidget_ipAddress6->count() == 0) ||
(ui->lineEdit_gateway6->text().isEmpty())) return 2;
if (ui->checkBox_ip6->checkState() == Qt::Checked)
if ((ui->comboBox_ip6->currentText() == QString("static")) ||
(ui->comboBox_ip6->currentText() == QString("stateless")))
if ((ui->listWidget_ipAddress6->count() == 0) ||
(ui->lineEdit_gateway6->text().isEmpty()))
return 2;
// all fine
return 0;
}
@ -389,67 +489,76 @@ int IpWidget::isOk()
void IpWidget::setSettings(const QMap<QString, QString> settings)
{
clear();
QMap<QString, QString> ipSettings = settings;
if (settings.contains(QString("IP"))) {
if (settings[QString("IP")] == QString("no"))
if (ipSettings.contains(QString("IP"))) {
if (ipSettings[QString("IP")].remove(QString("'")) == QString("no"))
ui->checkBox_ip->setCheckState(Qt::Unchecked);
else {
ui->checkBox_ip->setCheckState(Qt::Checked);
int index = ui->comboBox_ip->findText(settings[QString("IP")]);
ui->comboBox_ip->setCurrentIndex(index);
for (int i=0; i<ui->comboBox_ip->count(); i++)
if (ipSettings[QString("IP")].remove(QString("'")) == ui->comboBox_ip->itemText(i))
ui->comboBox_ip->setCurrentIndex(i);
}
}
if (settings.contains(QString("Address")))
ui->listWidget_ipAddress->addItems(settings[QString("Address")].split(QChar('\n')));
if (settings.contains(QString("Gateway")))
ui->lineEdit_gateway->setText(settings[QString("Gateway")]);
if (settings.contains(QString("Routes")))
ui->listWidget_ipRoutes->addItems(settings[QString("Routes")].split(QChar('\n')));
if (settings.contains(QString("IP6"))) {
if (settings[QString("IP6")] == QString("no"))
if (ipSettings.contains(QString("Address")))
ui->listWidget_ipAddress->addItems(ipSettings[QString("Address")].remove(QString("'")).split(QString(" ")));
if (ipSettings.contains(QString("Gateway")))
ui->lineEdit_gateway->setText(ipSettings[QString("Gateway")].remove(QString("'")));
if (ipSettings.contains(QString("Routes")))
ui->listWidget_ipRoutes->addItems(ipSettings[QString("Routes")].remove(QString("'")).split(QString(" ")));
if (ipSettings.contains(QString("IP6"))) {
if (ipSettings[QString("IP6")].remove(QString("'")) == QString("no"))
ui->checkBox_ip6->setCheckState(Qt::Unchecked);
else {
ui->checkBox_ip6->setCheckState(Qt::Checked);
int index = ui->comboBox_ip6->findText(settings[QString("IP6")]);
ui->comboBox_ip6->setCurrentIndex(index);
for (int i=0; i<ui->comboBox_ip6->count(); i++)
if (ipSettings[QString("IP6")].remove(QString("'")) == ui->comboBox_ip6->itemText(i))
ui->comboBox_ip6->setCurrentIndex(i);
}
}
if (settings.contains(QString("Address6")))
ui->listWidget_ipAddress6->addItems(settings[QString("Address6")].split(QChar('\n')));
if (settings.contains(QString("Gateway6")))
ui->lineEdit_gateway6->setText(settings[QString("Gateway6")]);
if (settings.contains(QString("Routes6")))
ui->listWidget_ipRoutes6->addItems(settings[QString("Routes6")].split(QChar('\n')));
if (settings.contains(QString("IPCustom")))
ui->listWidget_custom->addItems(settings[QString("IPCustom")].split(QChar('\n')));
if (settings.contains(QString("Hostname")))
ui->lineEdit_hostname->setText(settings[QString("Hostname")]);
if (settings.contains(QString("TimeoutDAD")))
ui->spinBox_timeoutDad->setValue(settings[QString("TimeoutDAD")].toInt());
if (settings.contains(QString("DHCPClient"))) {
int index = ui->comboBox_dhcp->findText(settings[QString("DHCPClient")]);
ui->comboBox_dhcp->setCurrentIndex(index);
if (ipSettings.contains(QString("Address6")))
ui->listWidget_ipAddress6->addItems(ipSettings[QString("Address6")].remove(QString("'")).split(QString(" ")));
if (ipSettings.contains(QString("Gateway6")))
ui->lineEdit_gateway6->setText(ipSettings[QString("Gateway6")].remove(QString("'")));
if (ipSettings.contains(QString("Routes6")))
ui->listWidget_ipRoutes6->addItems(ipSettings[QString("Routes6")].remove(QString("'")).split(QString(" ")));
if (ipSettings.contains(QString("IPCustom"))) {
QStringList custom;
if (ipSettings[QString("IPCustom")].contains(QString("\n")))
custom = ipSettings[QString("IPCustom")].split(QString("'\n'"));
else
custom = ipSettings[QString("IPCustom")].split(QString("' '"));
for (int i=0; i<custom.count(); i++)
ui->listWidget_custom->addItem(custom[i].remove(QString("'")));
}
if (settings.contains(QString("DhcpcdOptions")))
ui->lineEdit_dhcpcdOpt->setText(settings[QString("DhcpcdOptions")]);
if (settings.contains(QString("DhclientOptions")))
ui->lineEdit_dhclientOpt->setText(settings[QString("DhclientOptions")]);
if (settings.contains(QString("DhclientOptions6")))
ui->lineEdit_dhclientOpt6->setText(settings[QString("DhclientOptions6")]);
if (settings.contains(QString("TimeoutDHCP")))
ui->spinBox_timeoutDhcp->setValue(settings[QString("TimeoutDHCP")].toInt());
if (settings.contains(QString("DHCPReleaseOnStop")))
if (settings[QString("DHCPReleaseOnStop")] == QString("yes"))
if (ipSettings.contains(QString("Hostname")))
ui->lineEdit_hostname->setText(ipSettings[QString("Hostname")].remove(QString("'")));
if (ipSettings.contains(QString("TimeoutDAD")))
ui->spinBox_timeoutDad->setValue(ipSettings[QString("TimeoutDAD")].toInt());
if (ipSettings.contains(QString("DHCPClient")))
for (int i=0; i<ui->comboBox_dhcp->count(); i++)
if (ipSettings[QString("DHCPClient")].remove(QString("'")) == ui->comboBox_dhcp->itemText(i))
ui->comboBox_dhcp->setCurrentIndex(i);
if (ipSettings.contains(QString("DhcpcdOptions")))
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);
if (settings.contains(QString("DNS")))
ui->listWidget_dns->addItems(settings[QString("DNS")].split(QChar('\n')));
if (settings.contains(QString("DNSDomain")))
ui->lineEdit_dnsDomain->setText(settings[QString("DNSDomain")]);
if (settings.contains(QString("DNSSearch")))
ui->lineEdit_dnsSearch->setText(settings[QString("DNSSearch")]);
if (settings.contains(QString("DNSOptions")))
ui->listWidget_dnsOptions->addItems(settings[QString("DNSOptions")].split(QChar('\n')));
if (ipSettings.contains(QString("DNS")))
ui->listWidget_dns->addItems(ipSettings[QString("DNS")].remove(QString("'")).split(QString(" ")));
if (ipSettings.contains(QString("DNSDomain")))
ui->lineEdit_dnsDomain->setText(ipSettings[QString("DNSDomain")].remove(QString("'")));
if (ipSettings.contains(QString("DNSSearch")))
ui->lineEdit_dnsSearch->setText(ipSettings[QString("DNSSearch")].remove(QString("'")));
if (ipSettings.contains(QString("DNSOptions")))
ui->listWidget_dnsOptions->addItems(ipSettings[QString("DNSOptions")].remove(QString("'")).split(QString(" ")));
ipEnable(ui->checkBox_ip->checkState());
changeIpMode(ui->comboBox_ip->currentText());

View File

@ -38,6 +38,7 @@ public:
public slots:
void clear();
void setShown(const bool state);
private slots:
// buttons
@ -63,6 +64,10 @@ private:
void createActions();
void createFilter();
void keyPressEvent(QKeyEvent *pressedKey);
QString getIp(const QString rawIp);
QString getPrefix(const QString rawPrefix);
QString getIp6(const QString rawIp);
QString getPrefix6(const QString rawPrefix);
};

File diff suppressed because it is too large Load Diff

View File

@ -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")]);
}

View File

@ -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 */

View File

@ -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>

View File

@ -17,196 +17,90 @@
#include <QApplication>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDir>
#include <QLibraryInfo>
#include <QProcessEnvironment>
#include <QTextStream>
#include <QTranslator>
#include <iostream>
#include <unistd.h>
#include <language/language.h>
#include "mainwindow.h"
#include "messages.h"
#include "version.h"
#if QT_VERSION >= 0x050000
#include <pdebug/pdebug-time.h>
#endif /* QT_VERSION >= 0x050000 */
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[])
{
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::setQuitOnLastWindowClosed(false);
// reread translations according to flags
QString language = Language::defineLanguage(args[QString("config")].toString(),
args[QString("options")].toString());
QTranslator qtTranslator;
qtTranslator.load(QString("qt_%1").arg(language), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
a.installTranslator(&qtTranslator);
// translation
QString configPath = QDir::homePath() + QDir::separator() + QString(".config") +
QDir::separator() + QString("netctl-gui.conf");
QFile configFile(configPath);
QString fileStr;
QString language = QString("english");
if (configFile.open(QIODevice::ReadOnly))
while (true) {
fileStr = QString(configFile.readLine());
if (fileStr[0] != '#') {
if (fileStr.contains(QString("LANGUAGE=")))
language = fileStr.split(QString("="))[1]
.remove(QString(" "))
.trimmed();
}
if (configFile.atEnd())
break;
}
configFile.close();
QTranslator translator;
translator.load(QString(":/translations/%1").arg(language));
translator.load(QString(":/translations/") + language);
a.installTranslator(&translator);
// running
if (args[QString("error")].toBool()) {
cout << errorMessage().toUtf8().data() << endl;
cout << helpMessage().toUtf8().data();
return 1;
} else if (args[QString("help")].toBool()) {
cout << helpMessage().toUtf8().data();
return 0;
} else if (args[QString("info")].toBool()) {
cout << versionMessage().toUtf8().data() << endl;
cout << infoMessage().toUtf8().data();
return 0;
} else if (args[QString("version")].toBool()) {
cout << versionMessage().toUtf8().data();
return 0;
}
QString helpMessage = QString("");
helpMessage += QApplication::translate("MainWindow", " Netctl GUI\n");
helpMessage += QApplication::translate("MainWindow", "Version : %1 License : GPLv3\n")
.arg(QString(VERSION));
helpMessage += QApplication::translate("MainWindow", " Evgeniy Alekseev aka arcanis\n");
helpMessage += QApplication::translate("MainWindow", " E-mail : esalexeev@gmail.com\n\n");
helpMessage += QApplication::translate("MainWindow", "Usage:\n");
helpMessage += QApplication::translate("MainWindow", "netctl-gui [ --default ] [ -t NUM | --tab NUM ] [ -h | --help]\n\n");
helpMessage += QApplication::translate("MainWindow", "Parametrs:\n");
helpMessage += QApplication::translate("MainWindow", " --default - start with default settings\n");
helpMessage += QApplication::translate("MainWindow", " -t NUM --tab NUM - open a tab with number NUM\n");
helpMessage += QApplication::translate("MainWindow", " -h --help - show this help and exit\n");
bool defaultSettings = false;
int tabNumber = 0;
// check if exists
if (existingSessionOperation(QString("Active"))) {
if ((getuid() == getUidFromSession(0)) && (geteuid() == getUidFromSession(1))) {
// restore session
cout << QCoreApplication::translate("MainWindow", "Restore existing session.")
.toUtf8().data() << endl;
existingSessionOperation(QString("Restore"));
for (int i=1; i<argc; i++) {
// help message
if (((argv[i][0] == '-') && (argv[i][1] == 'h') && (argv[i][2] == '\0')) ||
((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 'h') && (argv[i][3] == 'e') &&
(argv[i][4] == 'l') && (argv[i][5] == 'p') && (argv[i][6] == '\0'))) {
cout << helpMessage.toUtf8().data();
return 0;
} else if ((getuid() == getUidFromSession(0)) && (geteuid() != getUidFromSession(1))) {
cout << QCoreApplication::translate("MainWindow", "Close existing session.")
.toUtf8().data() << endl;
existingSessionOperation(QString("Close"));
}
// default settings
else if ((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 'd') && (argv[i][3] == 'e') &&
(argv[i][4] == 'f') && (argv[i][5] == 'a') && (argv[i][6] == 'u') && (argv[i][7] == 'l') &&
(argv[i][8] == 't') && (argv[i][9] == '\0')) {
defaultSettings = true;
}
// tab number
else if (((argv[i][0] == '-') && (argv[i][1] == 't') && (argv[i][2] == '\0')) ||
((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 't') &&
(argv[i][3] == 'a') && (argv[i][4] == 'b') && (argv[i][5] == '\0'))) {
if (atoi(argv[i+1]) > 3)
tabNumber = 3;
else if (atoi(argv[i+1]) < 1)
tabNumber = 1;
else
tabNumber = atoi(argv[i+1]);
i++;
}
}
MainWindow w(0, args, &qtTranslator, &translator);
MainWindow w(0, defaultSettings, tabNumber);
w.show();
return a.exec();
}

View File

@ -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)));
}

View File

@ -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 */

View File

@ -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>

File diff suppressed because it is too large Load Diff

View File

@ -20,18 +20,25 @@
#include <QApplication>
#include <QMainWindow>
#include <QTreeWidgetItem>
#include <netctlgui/netctlgui.h>
#include <QTableWidgetItem>
class AboutWindow;
class MainWidget;
class NetctlAutoWindow;
class NewProfileWidget;
class BridgeWidget;
class ErrorWindow;
class EthernetWidget;
class GeneralWidget;
class IpWidget;
class MobileWidget;
class Netctl;
class NetctlProfile;
class PasswdWidget;
class PppoeWidget;
class SettingsWindow;
class TrayIcon;
class WiFiMenuWidget;
class TunnelWidget;
class TuntapWidget;
class VlanWidget;
class WirelessWidget;
class WpaSup;
namespace Ui {
class MainWindow;
@ -42,81 +49,61 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr,
const QVariantMap args = QVariantMap(),
QTranslator *qtAppTranslator = nullptr,
QTranslator *appTranslator = nullptr);
explicit MainWindow(QWidget *parent = 0,
const bool defaultSettings = false,
const int tabNum = 1);
~MainWindow();
int currentTab();
Qt::ToolBarArea getToolBarArea();
void emitNeedToBeConfigured();
QStringList printSettings();
netctlCurrent printTrayInformation();
bool isHelperActive();
bool isHelperServiceActive();
// library interfaces
Netctl *netctlCommand = nullptr;
NetctlInterface *netctlInterface = nullptr;
WpaSup *wpaCommand = nullptr;
protected:
void closeEvent(QCloseEvent *event);
Netctl *netctlCommand;
NetctlProfile *netctlProfile;
WpaSup *wpaCommand;
public slots:
// actions from trayicon
void closeMainWindow();
void openProfileSlot(const QString profile);
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();
void updateTabs(const int tab);
// wifi tab slots
void connectToUnknownEssid(const QString passwd);
private slots:
void setTabByAction(QAction *action);
void reportABug();
void updateMainTab();
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:
// ui
TrayIcon *trayIcon = nullptr;
Ui::MainWindow *ui = nullptr;
AboutWindow *aboutWin = nullptr;
MainWidget *mainWidget = nullptr;
NetctlAutoWindow *netctlAutoWin = nullptr;
NewProfileWidget *newProfileWidget = nullptr;
SettingsWindow *settingsWin = nullptr;
WiFiMenuWidget *wifiMenuWidget = nullptr;
Ui::MainWindow *ui;
BridgeWidget *bridgeWid;
EthernetWidget *ethernetWid;
GeneralWidget *generalWid;
IpWidget *ipWid;
MobileWidget *mobileWid;
PppoeWidget *pppoeWid;
TunnelWidget *tunnelWid;
TuntapWidget *tuntapWid;
VlanWidget *vlanWid;
WirelessWidget *wirelessWid;
// 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 createDBusSession();
void createObjects();
void deleteObjects();
QString configPath;
bool debug = false;
bool useHelper = true;
QTranslator *qtTranslator = nullptr;
QTranslator *translator = nullptr;
// configuration
QMap<QString, QString> configuration;
QMap<QString, QString> parseOptions(const QString options);
};

View File

@ -6,35 +6,357 @@
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>497</height>
<width>491</width>
<height>519</height>
</rect>
</property>
<property name="windowTitle">
<string>Netctl GUI</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="centralLayout">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</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>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>22</height>
<width>491</width>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuMenu">
@ -42,107 +364,12 @@
<string>Menu</string>
</property>
<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"/>
</widget>
<addaction name="menuMenu"/>
</widget>
<widget class="QToolBar" name="toolBar">
<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>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionSettings">
<property name="icon">
<iconset theme="configure">
<normaloff/>
</iconset>
</property>
<property name="text">
<string>Settings</string>
</property>
@ -150,57 +377,32 @@
<string>Ctrl+S</string>
</property>
</action>
<action name="actionNetctl">
<property name="icon">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<action name="actionQuit">
<property name="text">
<string>netctl control</string>
</property>
<property name="toolTip">
<string>netctl control</string>
<string>Quit</string>
</property>
<property name="shortcut">
<string>Ctrl+N</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>
<string>Ctrl+Q</string>
</property>
</action>
</widget>
<resources>
<include location="../../resources/resources.qrc"/>
</resources>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>tableWidget_main</tabstop>
<tabstop>pushButton_mainRefresh</tabstop>
<tabstop>pushButton_mainEnable</tabstop>
<tabstop>pushButton_mainRestart</tabstop>
<tabstop>pushButton_mainStart</tabstop>
<tabstop>lineEdit_profile</tabstop>
<tabstop>pushButton_profile</tabstop>
<tabstop>scrollArea</tabstop>
<tabstop>pushButton_profileClear</tabstop>
<tabstop>pushButton_profileLoad</tabstop>
<tabstop>pushButton_profileSave</tabstop>
<tabstop>tableWidget_wifi</tabstop>
<tabstop>pushButton_wifiRefresh</tabstop>
<tabstop>pushButton_wifiStart</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

Some files were not shown because too many files have changed in this diff Show More