Compare commits

..

341 Commits

Author SHA1 Message Date
5a171f6c67 fix url links 2016-03-06 18:29:36 +03:00
arcan1s
c2e4ea2258 fix #46, release 1.4.9 2015-12-21 11:26:54 +03:00
arcan1s
d2714dca02 some library refactoring 2015-08-20 00:13:09 +03:00
arcan1s
5efb25dca3 edit mobilewidget.ui, main and wifi tab now only will be update if they
are active
2015-08-19 00:42:29 +03:00
arcan1s
e67493f5c0 plasmoid fixes 2015-08-15 02:35:09 +03:00
arcan1s
32f7b9344c fix font rendering 2015-07-11 01:22:24 +03:00
arcan1s
2041e01caa Fix pkgbuild 2015-07-06 01:28:29 +03:00
arcan1s
271fdb0d99 release 1.4.8 2015-07-06 01:25:15 +03:00
arcan1s
45904db741 fix no actions on links activation 2015-07-05 00:32:46 +03:00
arcan1s
a216060447 update to netctl 1.10 and 1.11 changes 2015-07-02 00:08:14 +03:00
arcan1s
05a613b501 release 1.4.7 2015-06-28 14:30:56 +03:00
arcan1s
a9c7f98677 more correct work with configration files (use /etc/netctl-gui.conf if
no configuration present in the home directory)
2015-06-28 00:07:44 +03:00
arcan1s
5018232c08 * drop absolute path from configuration
* add configuration from cmake building
* update submodules
2015-06-27 05:10:56 +03:00
arcan1s
aed09bf798 release 1.4.6 2015-06-25 12:23:04 +03:00
arcan1s
d299e7d9a1 some changes in netctl engine 2015-06-24 02:10:27 +03:00
arcan1s
cf7b013726 drop call which does not lead to crash 2015-06-22 09:25:55 +03:00
arcan1s
b65ba2ebe2 fix #44
possible fix #43
2015-06-21 01:13:37 +03:00
arcan1s
69f6a3135b derop notification on status changing since it causes plasmacrash 2015-06-20 15:20:01 +03:00
arcan1s
7dc1a5eda3 implement datetime logging feature 2015-06-19 02:23:44 +03:00
arcan1s
168a270c98 translation update 2015-06-15 22:12:51 +03:00
arcan1s
c3aa3f0c8f implement autoupdate feature
fix bug with invalid profile path using by external editor
2015-06-03 14:31:09 +03:00
arcan1s
e26da85b5f release 1.4.5
+ add translation support to plugin part
* more correct interface painting
* more correct configuration interface painting (fix #42)
* move plugin from private
2015-05-13 00:02:48 +03:00
arcan1s
f665a46346 release 1.4.4
Fix minfo
2015-04-30 01:08:12 +03:00
arcan1s
d541d0a755 bump version 2015-04-23 17:54:56 +03:00
arcan1s
0f5bf03e38 release 1.4.3 2015-04-23 17:52:57 +03:00
arcan1s
3695914226 update submodules, add clang build, fix bug in wpasup 2015-04-23 17:51:52 +03:00
arcan1s
03dbfce482 1.4.2-2 2015-03-21 00:41:02 +03:00
arcan1s
6a8d2701b0 fix drivers 2015-03-21 00:30:04 +03:00
arcan1s
ff3e000688 release 1.4.2
* fix work with helper from GUI
2015-03-21 00:00:47 +03:00
arcan1s
824a11457b release 1.4.1 2015-03-20 00:20:44 +03:00
arcan1s
b7fa17df4e improve dataengine permofrmance (fix #39) - TODO: need to be tested 2015-03-19 11:45:13 +03:00
arcan1s
35af460b7b fix crash on null connection 2015-03-18 06:13:35 +03:00
arcan1s
9aa1f6d715 implement #38
freeze code base to release 1.4.1
2015-03-18 03:33:30 +03:00
arcan1s
308f9824b4 implement #37 2015-03-17 14:07:05 +03:00
arcan1s
bf7521481a implement #36
update translations
2015-03-17 13:22:45 +03:00
arcan1s
e4bcfb1653 fix kde4 build
fix tray destruction on KF5
2015-03-16 08:52:23 +03:00
arcan1s
a2b1d46900 Prepare to release 1.4.1
update docs, update ui
deprecate description function
2015-03-16 05:14:53 +03:00
arcan1s
3f49988cef update submodule
update netctl-auto
update interfaces
2015-03-15 18:17:49 +03:00
arcan1s
f80d6aae6b end work on interfaces 2015-03-14 06:42:06 +03:00
arcan1s
ef2694d7a7 add calls
create interface dbus interface
2015-03-13 08:22:02 +03:00
arcan1s
26afd90df9 + add toolbar config
+ create interface class
* update UI
2015-03-13 05:12:06 +03:00
arcan1s
02432be630 edit ui
* remove margins
* create more pretty toolbars
* edit toolbar update action (s/setVisible/setEnabled/g)
2015-03-12 02:02:20 +03:00
arcan1s
275d71d75f rewrite ui (refactoring, simplification, improvement of user expierence) 2015-03-11 07:19:20 +03:00
arcan1s
b90f441fde roll back interfaces to wpa_cli
improvement of wpa_supplicant control
2015-03-10 07:53:15 +03:00
arcan1s
19976819a1 + add CurrentWiFi method
+ add support of pid files with interface name to provide compability
with netctl module
* change default wpa_sup ctrl paths
* optimization of wifi calls
2015-03-10 00:52:45 +03:00
arcan1s
362a11f0bc + new Verbose* DBus calls
+ new force request to netctl (DBus)
+ PointType enum
+ notification on hidding,
+ new columns in WiFi menu
* improve user expierence
* fix language definition
* fix tests
* update 3rdparty components
* small refactoring
2015-03-09 08:29:26 +03:00
arcan1s
d94aa4ebf7 update KDE4 plasmoid 2015-03-08 19:24:21 +03:00
arcan1s
2cf876cf32 * edit WiFi and ProfileList calls
* optimization of WifiMenu
* small refactoring
2015-03-07 17:12:33 +03:00
arcan1s
9993fee336 rewrite netctlautowindow ui 2015-03-05 12:05:34 +03:00
arcan1s
de0c1f208d edit dbus calls
TODO edit dbus call in netctlautowindow (create callbacks too)
2015-03-03 16:11:38 +03:00
arcan1s
25ca2ef1d9 rewrite private slots
TODO: add more methods to dbusinteraction, check dbus calls
2015-03-02 06:00:42 +03:00
arcan1s
1333967535 rewrite ui part (except for privateslots) 2015-02-28 04:05:34 +03:00
arcan1s
e70ebe318d small refactoring 2015-02-27 18:46:28 +03:00
arcan1s
dcdf03f639 refactoring of profile widgets 2015-02-27 18:10:23 +03:00
arcan1s
8b33ec859b refactoring of library part 2015-02-26 06:20:23 +03:00
arcan1s
53ff63b792 + add ja to available langs
+ add signals to lineEdits
* rewrite errorwindow class to static methods
* replace mask in ip lineedits to validators (fix #34)
* fix advanced lines
* move AdHoc and Hidden options to advanced (#28)
* fix default wpa_supplicant conf path (#28)
* update toolbars to #2
* replace General settings section to Common (see http://doc.qt.io/qt-5/qsettings.html#Format-enum)
2015-02-24 05:32:37 +03:00
arcan1s
b46ce1620b fix #25 2015-02-19 13:06:06 +03:00
arcan1s
4c20a54d7e small update 2015-02-18 16:23:07 +03:00
arcan1s
a73968f98b * refactoring and optimization KF5 part (#26, #31)
* add info instrument
* implement needToBeConfigured() slot, see #29
* fix (#30)
some improvements
2015-02-17 10:44:51 +03:00
arcan1s
9033c51bb4 update files
add _DEFAULT_SOURCE to avoid warnings
fix cppcheck messages
2015-01-14 00:59:42 +03:00
arcan1s
d23429891e release 1.4.0 2015-01-12 19:30:49 +03:00
arcan1s
cf12b3627e update ChangeLog
update CmakeLists
update PKGBUILDs
fix GUI building
2015-01-12 01:14:40 +03:00
arcan1s
582459d174 fix #24
update gitignore
2015-01-11 00:38:47 +03:00
arcan1s
08e7390f6c Merge branch 'master' of github.com:arcan1s/netctl-gui 2015-01-10 00:36:26 +03:00
arcan1s
c8eae4b222 fix painting
update translations
fix PKGBUILD
2015-01-10 00:35:52 +03:00
arcan1s
54583eae6e update interface painting 2015-01-09 02:40:24 +03:00
arcan1s
634b4c3b41 try to paint more pretty interface 2015-01-08 02:00:59 +03:00
arcan1s
54c5e7958a kf5 update
* implement resizing
* implement debug
* implement notifications
* update interface
* correct work with helper
2015-01-07 07:03:41 +03:00
arcan1s
6ed45fa7a5 change in updates 2015-01-06 00:46:28 +03:00
arcan1s
73ba838685 + add de page
* rewrite de configuration to use qsettings
- remove cppcheck
+ add notifyrc
2015-01-05 00:29:52 +03:00
arcan1s
924beacc23 implement actions 2015-01-04 02:01:07 +03:00
arcan1s
a830fc9372 Merge branch 'kf5' 2015-01-03 13:58:17 +03:00
arcan1s
4c7459e833 Merge branch 'kf5' of github.com:arcan1s/netctl-gui into kf5 2015-01-03 13:56:33 +03:00
arcan1s
00a35d75d2 add ability to build kde4 and kf5 packages 2015-01-03 13:56:00 +03:00
Evgeniy Alekseev
3e92ec2aae Update CMakeLists.txt
bump to 1.4.0
2015-01-03 13:23:16 +03:00
arcan1s
3ac0484f21 some test with actions 2014-12-31 08:09:53 +03:00
arcan1s
cbac07b29e move method from original one 2014-12-30 14:39:25 +03:00
arcan1s
7972f2d6d3 some configuration interface changes 2014-12-29 23:37:21 +03:00
arcan1s
afed94745a fix plugin 2014-12-29 20:56:35 +03:00
arcan1s
c8f260c8e2 rename applet to *plasma* 2014-12-29 08:35:23 +03:00
arcan1s
edb386d24e implement binary module 2014-12-28 17:42:08 +03:00
arcan1s
f188dea8a7 add wdiget.qml 2014-12-27 12:24:05 +03:00
arcan1s
6fb7da4b5b add appearance.qml 2014-12-27 03:50:31 +03:00
arcan1s
a35e9b0164 first work on plasmoid 2014-12-26 08:22:26 +03:00
arcan1s
4bc428f8b5 add workaround to #23
(fix?)
2014-12-05 03:52:27 +03:00
arcan1s
030dec5e14 end porting of DE to KF5 2014-10-21 16:26:35 +04:00
arcan1s
0898a99878 updte dataengine skel 2014-10-21 13:06:57 +04:00
arcan1s
8dd48fa7cc release 1.3.3
fix #19
2014-10-19 17:50:24 +04:00
arcan1s
287405f81a try fix #19 2014-10-18 01:17:15 +04:00
arcan1s
fa27b80060 add some w\o 2014-10-17 13:52:46 +04:00
Evgeniy Alekseev
c2c14c4911 Merge pull request #18 from nosada/translate_to_ja
Fix translation on plasmoid
2014-10-13 11:58:23 +04:00
NOGISAKA Sadata
e2deb8751d fix translation at plasmoid 2014-10-13 16:43:37 +09:00
NOGISAKA Sadata
1fe7d6e21f change translation at plasmoid (again) 2014-10-13 16:43:37 +09:00
NOGISAKA Sadata
e68be6d4f1 change translation at plasmoid 2014-10-13 16:43:37 +09:00
arcan1s
45d3a42754 update tasks 2014-10-09 22:58:13 +04:00
arcan1s
cb0410a182 update pkgbuild #17 2014-09-27 18:25:41 +04:00
arcan1s
9d349461cf release 1.3.2 2014-09-22 00:56:12 +04:00
arcan1s
d41a34673b add translations to resources
fix plasmoid icon
2014-09-21 14:28:58 +04:00
NOGISAKA Sadata
b199b43f58 fix mistakes and fluctuation of description at plasmoid 2014-09-19 13:55:43 +09:00
NOGISAKA Sadata
6d212efe1e fix mistakes and fluctuation of description at netctlgui-helper 2014-09-19 13:55:43 +09:00
NOGISAKA Sadata
d32486d882 fix mistakes and fluctuation of description at netctl-gui 2014-09-19 13:55:43 +09:00
arcan1s
5afa65ce68 edit authors 2014-09-19 00:44:55 +04:00
NOGISAKA Sadata
5b46247df2 finished 2014-09-19 01:09:56 +09:00
NOGISAKA Sadata
bda5433716 translating netctl-gui to Japanese (yet not finished) 2014-09-19 01:09:56 +09:00
NOGISAKA Sadata
835e82ca63 translated netctlgui-helper to Japanese 2014-09-19 01:09:56 +09:00
NOGISAKA Sadata
98cdb18d62 translating netctl-gui to Japanese (yet not finished), and modify plasmoid translating file 2014-09-19 01:09:56 +09:00
NOGISAKA Sadata
cd59a9b294 translating netctl-gui to Japanese (not finished) 2014-09-19 01:09:56 +09:00
NOGISAKA Sadata
4780433c4d translated plasmoid to Japanese 2014-09-19 01:09:56 +09:00
arcan1s
28a4934a82 change appmenu to button set to better user experience
(if user will have global appmenu enabled)
2014-09-09 09:38:59 +04:00
arcan1s
4e8bbeed35 update archlinux install scripts 2014-09-06 15:24:42 +04:00
arcan1s
f86ef0514b release 1.3.1 2014-09-06 15:02:05 +04:00
arcan1s
4c004af1ae add dbus configuration to backup 2014-08-27 22:30:49 +04:00
arcan1s
66e3a737d4 rollback some changes since
1) systemd-user doesn't work correctly with session bus
2) systemd-user cannot set capabilities
2014-08-27 22:24:19 +04:00
arcan1s
9cf6552c71 update install files 2014-08-27 18:20:12 +04:00
arcan1s
f18e74917b more correct checking dbus response 2014-08-27 18:14:22 +04:00
arcan1s
b909222db9 better submodules integration (hope =))
add --session support to the helper
2014-08-27 17:23:12 +04:00
arcan1s
0c7868536a update to changes 2014-08-27 17:12:52 +04:00
arcan1s
fc3956caf1 ya submodules fix 2014-08-27 17:07:00 +04:00
arcan1s
4cf3c85070 fix submodules (see #14) 2014-08-27 16:26:38 +04:00
arcan1s
6e57baccaf remove description from security notes 2014-08-27 11:47:44 +04:00
arcan1s
5ed704e676 rewrite to use submodules 2014-08-26 16:06:13 +04:00
arcan1s
eb3753ab25 update 3rdparty/language 2014-08-26 10:46:14 +04:00
arcan1s
f9d71577f3 update html docs to standards 2014-08-25 23:52:10 +04:00
arcan1s
814f2c7904 update license agreement to trdparty items 2014-08-25 20:29:30 +04:00
arcan1s
ceca889be4 release 1.3.0 2014-08-25 16:06:31 +04:00
arcan1s
696283b1e1 update readme/prepare to release 2014-08-25 15:06:03 +04:00
arcan1s
15cc3a8595 rename wifi tab 2014-08-25 14:59:34 +04:00
arcan1s
e8c3441f29 add profile reading description 2014-08-25 11:53:14 +04:00
arcan1s
2de7b26f66 change name to id in html docs 2014-08-25 11:42:50 +04:00
arcan1s
8f35aeb88f rewrite actions to qtoolbutton 2014-08-25 11:34:08 +04:00
arcan1s
b49188c104 remove kde runtime from optdep list 2014-08-25 10:56:45 +04:00
arcan1s
f8bf8830be fix mans 2014-08-25 10:55:34 +04:00
arcan1s
6e6c547460 unify configuration names 2014-08-25 10:54:18 +04:00
arcan1s
d287f52ba5 rename layout 2014-08-25 10:48:01 +04:00
arcan1s
8cc02a07fb update translations 2014-08-24 16:45:19 +04:00
arcan1s
28d51484b1 fix update toolboxes 2014-08-24 16:40:01 +04:00
arcan1s
e7d2e0bd38 change menu to toolboxes 2014-08-24 16:30:37 +04:00
arcan1s
999914926a add force* slots 2014-08-24 13:08:13 +04:00
arcan1s
e21b2201ab small tray fixes 2014-08-24 13:00:50 +04:00
arcan1s
d65ded6072 update messages 2014-08-20 23:37:37 +04:00
arcan1s
16662f697b cleanup!
(remove symlinks)
2014-08-20 22:16:06 +04:00
arcan1s
35d740b778 update build script 2014-08-20 21:25:56 +04:00
arcan1s
0a16364a7a update docs
change building
2014-08-20 21:16:31 +04:00
arcan1s
e9090ab4a9 remove suid bit to use capabilities 2014-08-20 20:21:34 +04:00
arcan1s
8bf33d4369 edit about window, update translations 2014-08-20 12:01:56 +04:00
arcan1s
4e76d52671 update configuration file 2014-08-20 08:32:14 +04:00
arcan1s
47dc016da2 update man pages
more correct behavior to --daemon option (renamed to --detached)
2014-08-19 11:26:03 +04:00
arcan1s
8b58f6d383 small edit of showing information 2014-08-18 21:17:53 +04:00
arcan1s
709431ead2 change temporary profile directory 2014-08-18 12:49:36 +04:00
arcan1s
f90b2d97a7 update translations 2014-08-18 10:12:02 +04:00
arcan1s
5416ef841f more pretty CMakeLists.txt 2014-08-18 09:55:55 +04:00
arcan1s
e4cff2baf4 small stuff update 2014-08-17 21:26:50 +04:00
arcan1s
d047eaf2f2 update changelog 2014-08-17 19:02:17 +04:00
arcan1s
56f4a75b25 end work on tests 2014-08-17 18:26:04 +04:00
arcan1s
dd05782f80 add dbus functions to netctlauto and wpasup 2014-08-17 16:38:28 +04:00
arcan1s
2c2919160b add dbus test to testnetctl 2014-08-17 16:34:51 +04:00
arcan1s
d7c8490724 add wpasup test 2014-08-17 15:54:08 +04:00
arcan1s
1930eeb33c add testnetctlprofile 2014-08-17 14:54:16 +04:00
arcan1s
4cc9d0ec11 more pretty tests 2014-08-17 11:05:49 +04:00
arcan1s
a7911d48d1 add tests to netctl control
(todo: netctl-auto tests)
2014-08-17 09:42:52 +04:00
arcan1s
012c725e12 update readme 2014-08-16 22:02:27 +04:00
arcan1s
1907d3ac2f add several active profiles support to de and plasmoid 2014-08-16 22:01:10 +04:00
arcan1s
87376f1a5c add test support of several active profiles to gui, library and helper 2014-08-16 21:47:22 +04:00
arcan1s
f238ba3a6a fix startprofileslot 2014-08-15 20:46:18 +04:00
arcan1s
abbc5641cd do not block gui for dbus requests 2014-08-15 20:38:33 +04:00
arcan1s
82c3690dcb add actions 2014-08-14 17:00:51 +04:00
arcan1s
d3e1c4bca0 add FindSettings key 2014-08-13 11:41:30 +04:00
arcan1s
b63d883eb2 add getrecommended to wpasup class 2014-08-13 09:29:49 +04:00
arcan1s
529e2dd995 add error output to gui 2014-08-13 07:58:54 +04:00
arcan1s
1d34a65f38 add new API to the helper 2014-08-13 07:53:22 +04:00
arcan1s
fea0bedef0 add stopAllProfiles and reenableProfile slots 2014-08-13 07:49:27 +04:00
arcan1s
ec8fc79dd7 rewrite library to use pdebug 2014-08-13 07:45:00 +04:00
arcan1s
07e07ee777 rewrite plasmoid, de and helper to use pdebug 2014-08-13 07:26:15 +04:00
arcan1s
5c8dca22d0 rewrite gui to use pdebug 2014-08-13 07:12:32 +04:00
arcan1s
dba3eeabaa add error output to dataengine 2014-08-13 04:22:25 +04:00
arcan1s
eabfac7323 add --system flag to the helper
add security notes
2014-08-12 23:49:35 +04:00
arcan1s
3b1701f8b5 some fixes including adding double quotes 2014-08-12 22:58:13 +04:00
arcan1s
b65f761520 some improvements in helper and gui APIs and replacement and restoring
sessions
2014-08-12 14:01:00 +04:00
arcan1s
fddd4703cc some applet and dataengine fixes 2014-08-12 10:17:18 +04:00
arcan1s
f4e3848fa7 update changelog and some translations fixes 2014-08-12 00:59:56 +04:00
arcan1s
3e0ae6d4cc moved helper daemonization
add abillity to own users org.netctlgui.helper service
2014-08-12 00:23:11 +04:00
arcan1s
80f6ccf1d1 fix #10, #11 2014-08-11 23:56:26 +04:00
arcan1s
863b49eaec add euid checking to the helper 2014-08-11 23:23:18 +04:00
arcan1s
4785e358ec rewrite mainwindow class 2014-08-11 23:12:52 +04:00
arcan1s
f0adbb60e5 some gui fixes 2014-08-11 22:38:54 +04:00
arcan1s
61d814d9a2 add Pony() call <3
helper and library refatoring
2014-08-11 21:51:50 +04:00
arcan1s
d166668feb prepare dataengine to release 2014-08-11 20:54:35 +04:00
arcan1s
db3bfe9ad7 prepare plasmoid to release 2014-08-11 20:49:48 +04:00
arcan1s
d2ea9d96d9 split MainWindow into mainwindow, mainpublicslots, mainprivateslots 2014-08-11 17:21:11 +04:00
arcan1s
d4c82fce0c update plasmoid translation 2014-08-10 22:33:15 +04:00
arcan1s
fe672aa8cc add plasmoid helper integration 2014-08-10 22:29:42 +04:00
arcan1s
501b43002e add openvswitch support 2014-08-10 21:21:18 +04:00
arcan1s
43ed28de52 allow applet to move into notifications area 2014-08-10 16:17:00 +04:00
arcan1s
f7352f5c59 edit todo list 2014-08-10 15:08:39 +04:00
arcan1s
d112446d87 add translation to the helper 2014-08-10 14:51:47 +04:00
arcan1s
b863eedd96 change message class from helper to mainwindow 2014-08-10 14:28:45 +04:00
arcan1s
e19c9fef53 update mainwindow translations 2014-08-10 14:26:59 +04:00
arcan1s
10499691b3 rewrite tray 2014-08-10 14:22:23 +04:00
arcan1s
bf6d7cd53b add == checking 2014-08-10 11:11:34 +04:00
arcan1s
11db0fcf8d add docs integration 2014-08-10 11:05:29 +04:00
arcan1s
d44979e95e update man pagesand translations 2014-08-09 23:27:58 +04:00
arcan1s
41f58c1448 fix security hole in helper 2014-08-09 22:33:13 +04:00
arcan1s
2ff76e9c8e add additional docs to helper 2014-08-09 22:05:29 +04:00
arcan1s
0b2cc3ba79 update readme / TODO 2014-08-09 21:41:53 +04:00
arcan1s
fb430b036e update main funtions
Beta release of helper
2014-08-09 21:35:55 +04:00
arcan1s
42194295cc rename CONTROL to CTRL 2014-08-09 20:55:14 +04:00
arcan1s
558a206a8d rewrite netctlautowindow 2014-08-09 20:48:12 +04:00
arcan1s
172624b494 test fix #9 2014-08-09 20:19:52 +04:00
arcan1s
e64e8810f8 rewrite mainwindow to use helper 2014-08-09 18:08:01 +04:00
arcan1s
23f4a7f141 rewrite mainwindow.cpp to use helper 2014-08-09 12:56:05 +04:00
arcan1s
d01bb8834a refactoring mainwindow class 2014-08-09 12:02:48 +04:00
arcan1s
0989a6584b update pkgbuild to the current changes 2014-08-09 11:27:59 +04:00
arcan1s
c75f5ec135 update todo 2014-08-09 08:06:33 +04:00
arcan1s
d0a0b0eb4a update readme 2014-08-09 07:59:28 +04:00
arcan1s
6b7d5d3800 intermediate commit 2014-08-09 07:56:17 +04:00
arcan1s
6a3e3b14b3 add helper proto 2014-08-08 19:33:36 +04:00
arcan1s
1ae30b0821 commit before starting work on helper 2014-08-08 17:01:33 +04:00
arcan1s
c15e387472 update translation 2014-08-07 17:24:55 +04:00
arcan1s
d04a0b0920 small fix 2014-08-07 17:22:00 +04:00
arcan1s
e8e0c71c05 fix some bugs 2014-08-07 17:16:35 +04:00
arcan1s
516c4b5a22 add dynamic settings load
fix setTray() function
2014-08-07 17:06:52 +04:00
arcan1s
4e027ec19f rewrite main() 2014-08-07 15:46:37 +04:00
arcan1s
4788ad0081 add daemonized option 2014-08-07 00:59:43 +04:00
arcan1s
891b3b43ef add control interface 2014-08-06 22:56:01 +04:00
arcan1s
dee47b0ffc end work to dbus interface 2014-08-06 22:36:10 +04:00
arcan1s
86753070e8 add org.netctlgui.netctlgui /netctlgui 2014-08-06 21:47:54 +04:00
arcan1s
ff78d390ae start work on dbus module 2014-08-06 21:10:08 +04:00
arcan1s
447bcf8a0e add dbus interface proto 2014-08-06 19:01:03 +04:00
arcan1s
e8a7865e99 update gui translations 2014-08-06 17:15:22 +04:00
arcan1s
fdb5b46ea1 add system tray 2014-08-06 17:12:22 +04:00
arcan1s
0432579f5b fix table resize 2014-08-06 13:58:51 +04:00
arcan1s
2aa6b43e61 rewrite tables 2014-08-06 13:12:18 +04:00
arcan1s
0bade9c42f update netctlProfileInfo structure 2014-08-06 01:43:08 +04:00
arcan1s
067115280c update readme 2014-08-06 00:36:17 +04:00
arcan1s
873f84c447 update changelog 2014-08-06 00:35:59 +04:00
arcan1s
4c9c7b00a1 update gui 2014-08-06 00:12:52 +04:00
arcan1s
64937105c6 rewrite library to use task 2014-08-05 23:32:12 +04:00
arcan1s
297a18d530 edit project structure 2014-08-05 20:53:55 +04:00
arcan1s
8c0226c9db fix dataengine
update plasmoid translations
2014-08-05 20:37:16 +04:00
arcan1s
1abc4a5ac9 add task definitions to dataengine 2014-08-05 16:55:23 +04:00
arcan1s
7ed3e4e01b rewrited plasmoid 2014-08-05 12:57:27 +04:00
arcan1s
dc81a44034 rewrited dataengine
+ add ipv6 definition (internal and external)
+ add netctlAuto source
* rewrite interface list definition to use QtNetwork module
* rewrite internal ip definition to use QtNetwork module
- fix #7
2014-08-05 00:22:01 +04:00
arcan1s
7febf94233 add roadmap to dataengine 2014-08-04 22:35:26 +04:00
arcan1s
3a0f0c252e (?) fix #8
fucking heisenbug
2014-08-04 22:05:29 +04:00
arcan1s
209c3b9616 edit plasmoid netctl calls (see #7) 2014-08-04 16:28:12 +04:00
arcan1s
a79cbd4429 fix building 2014-08-02 12:12:13 +04:00
arcan1s
eb6bd34489 update po 2014-08-01 21:28:23 +04:00
arcan1s
ccc62ffb67 end of refactoring of plasmoid 2014-08-01 21:22:30 +04:00
arcan1s
fc2d338450 fix resize event 2014-08-01 20:49:10 +04:00
arcan1s
eefe196b69 add click event, remove button
TODO: refactoring (including removal of unneeded pointers) and normal resize event
2014-08-01 20:24:40 +04:00
arcan1s
c1e23d38a9 plasmoid is now popupapplet 2014-08-01 12:20:06 +04:00
arcan1s
e9c10e262e update about window
add report a bug link
2014-08-01 09:54:26 +04:00
arcan1s
0d26d6230e roll back 2014-08-01 09:37:09 +04:00
arcan1s
0aa162b71b add reportabug 1.0.2 2014-07-31 19:59:55 +04:00
arcan1s
78a4aeb0eb removed unneede libraries 2014-07-27 23:47:05 +04:00
arcan1s
ec5dff4b75 yae reading files` 2014-07-21 12:11:30 +04:00
arcan1s
0070f910cc add debug information
fix reading files
2014-07-21 11:58:42 +04:00
arcan1s
6cba836d98 small edit 2014-07-21 10:55:15 +04:00
arcan1s
4600aae8bc add netctlgui.h
rewrited some functions
2014-07-21 10:25:10 +04:00
arcan1s
79e7aa1926 fix completions names
deatached library in PKGBUILD
2014-07-20 13:30:10 +04:00
arcan1s
32683a89b9 small fix 2014-07-20 12:47:43 +04:00
arcan1s
43de4e5738 fix possible segfaults with null arrays (#5) 2014-07-20 12:20:26 +04:00
arcan1s
099b4e3792 update desktop file 2014-07-20 11:30:00 +04:00
arcan1s
389726379c update archive 2014-07-20 11:03:26 +04:00
arcan1s
9c0dcfe621 small update 2014-07-18 00:05:10 +04:00
arcan1s
75a95661f8 fix completions 2014-07-17 23:40:25 +04:00
arcan1s
31f52e5d22 small fixes 2014-07-17 19:36:15 +04:00
arcan1s
78827d833d added completions
removed wpa_actiond dependency
2014-07-17 18:18:40 +04:00
arcan1s
c0207a108e update screenshots 2014-07-16 22:18:08 +04:00
arcan1s
bb7af8da40 update russian translation 2014-07-15 21:26:38 +04:00
arcan1s
81ff9340cc fix build 2014-07-15 21:23:03 +04:00
arcan1s
3d040e9bab small text update / prerelease 1.2.0 2014-07-15 20:56:46 +04:00
arcan1s
3542901781 added flag --config
updated translations
2014-07-15 20:40:20 +04:00
arcan1s
8b91f43f0b added doxygen documentation building 2014-07-15 20:01:19 +04:00
arcan1s
7e622ad33b added all documentation 2014-07-15 17:31:29 +04:00
arcan1s
48a879bd71 added documentation to wpasupinteract 2014-07-15 15:08:55 +04:00
arcan1s
bc8655aaeb add documentation to netctlprofile 2014-07-15 13:32:22 +04:00
arcan1s
05f9759d47 small edit of about.ui 2014-07-15 13:05:16 +04:00
arcan1s
51659c7a42 added --set-opts 2014-07-15 06:11:22 +04:00
arcan1s
39b8ff834f added man page 2014-07-14 22:43:17 +04:00
arcan1s
ea522b3864 added flags 2014-07-14 21:57:29 +04:00
arcan1s
79fc70efa1 rewrite errorwindow 2014-07-14 20:37:46 +04:00
arcan1s
5e1a4be134 add openProfile 2014-07-14 19:36:14 +04:00
arcan1s
63ae04cd8d edit changelog 2014-07-14 19:11:22 +04:00
arcan1s
4fb02058b1 added workarounds 2014-07-14 19:07:17 +04:00
arcan1s
e02a6a8ce1 update plasmoid translations 2014-07-14 18:35:15 +04:00
arcan1s
2f40ae7913 added about window 2014-07-14 18:31:35 +04:00
arcan1s
2e35cd356e edited cmake files 2014-07-14 14:22:04 +04:00
arcan1s
341a19a955 fix profile reading 2014-07-14 14:03:38 +04:00
arcan1s
f7e39c7834 edited profile reading 2014-07-13 15:51:44 +04:00
arcan1s
7660deb787 end of refactoring 2014-07-13 11:45:20 +04:00
arcan1s
3fb847a7b6 edited main.cpp 2014-07-13 11:26:42 +04:00
arcan1s
dbb9ba70c4 end of refactoring of the widgets
refactoring of settingswindow
2014-07-13 10:48:46 +04:00
arcan1s
ceb7f3bd0f edited configuration interface 2014-07-13 09:56:07 +04:00
arcan1s
8ce4b03399 end of refactoring of the library 2014-07-13 09:44:20 +04:00
arcan1s
44f0b6a06a refactoring of netctlprofile 2014-07-13 00:13:24 +04:00
arcan1s
b37272d875 refactoring of netctlinteract 2014-07-12 23:41:52 +04:00
arcan1s
ea91aa4ca4 refactoring of dataengine and plasmoid
update plasmoid translations
2014-07-12 23:00:59 +04:00
arcan1s
cc250a643a small update of documentation 2014-07-12 22:31:08 +04:00
arcan1s
9b01fcd4e1 refactoring of the configuration interface 2014-07-12 22:15:39 +04:00
arcan1s
021a870220 add support of netctl-auto to plasmoid and dataengine 2014-07-12 18:19:19 +04:00
arcan1s
ae001b4d7f added netctl-auto support to profiles 2014-07-12 13:36:06 +04:00
arcan1s
ec6834d90e edited todo list 2014-07-12 13:25:40 +04:00
arcan1s
de22663156 add gui for netctl-auto 2014-07-12 13:23:43 +04:00
arcan1s
c3f090d9a0 intermediate commit 2014-07-11 23:31:27 +04:00
arcan1s
d17543a075 add null translation file 2014-07-11 20:59:01 +04:00
arcan1s
ace3a141e4 change lineEdit to comboBox
add clear() function to profile tab
2014-07-11 11:06:01 +04:00
arcan1s
06bd1ce198 remove soversioned 2014-07-11 10:26:16 +04:00
arcan1s
9852fb8f68 detached backend from frontend 2014-07-11 09:56:48 +04:00
arcan1s
eccb6b6578 fix settings 2014-07-11 07:03:53 +04:00
arcan1s
c1457d3ef0 add language class 2014-07-11 07:00:16 +04:00
arcan1s
6dab355d87 added all icons 2014-07-10 14:33:04 +04:00
arcan1s
e81f7714f9 added icons
changes in the project architecture
2014-07-10 13:48:21 +04:00
arcan1s
2a3011bdef edited configuration interface of the plasmoid 2014-07-10 10:44:33 +04:00
arcan1s
bf799ce061 add contextual actions to wifi tab 2014-07-10 10:30:26 +04:00
arcan1s
a845e32960 add contextual actions to the main table 2014-07-10 10:15:11 +04:00
arcan1s
028546540c add debug flug 2014-07-10 09:44:23 +04:00
arcan1s
2bf1d0f78e update pkgbuilds 2014-06-20 02:22:44 +04:00
arcan1s
cce4ef4811 add support of hidden network (test) 2014-06-04 00:18:04 +04:00
arcan1s
4051d2f2c8 add support of macvlan
add support of profile removal
2014-06-02 00:43:13 +04:00
arcan1s
8a031f2183 added todo list 2014-05-28 10:17:10 +04:00
arcan1s
7c013310ab fix default tabnumber 2014-05-22 01:29:13 +04:00
arcan1s
d5f0bbc3bf release 1.1.0 2014-05-21 19:50:12 +04:00
arcan1s
cb033140ac added menu title 2014-05-17 08:46:55 +04:00
arcan1s
d582445597 release 1.1.0 2014-05-14 23:55:13 +04:00
arcan1s
3506bd46a9 release 1.0.6 2014-04-19 12:09:58 +04:00
arcan1s
727619bb85 fix rel 2014-04-14 01:23:30 +04:00
arcan1s
d59345c0e4 Release 1.0.5 2014-04-14 01:19:36 +04:00
arcan1s
4c1685164c updated translations 2014-04-12 18:58:36 +04:00
arcan1s
d515e4a51f added cppcheck to gui 2014-04-12 16:34:04 +04:00
arcan1s
2778f654ef refactoring of dataengine 2014-04-12 16:31:19 +04:00
arcan1s
92ec04cae1 refactoring of plasmoid
added function to start wifi menu
2014-04-12 15:27:14 +04:00
arcan1s
501151828d pkgbuild fixes 2014-04-10 12:14:10 +04:00
arcan1s
4a788aa05f edited gitignore 2014-04-10 11:39:54 +04:00
arcan1s
2cf91930f8 added pkgbuilds for different builds 2014-04-10 11:34:22 +04:00
arcan1s
4bb5d4925d F*CKING icu 2014-04-07 03:02:50 +04:00
arcan1s
10d44f786e removed plasmoid only =) 2014-04-07 02:32:07 +04:00
arcan1s
c69ff2165e removed cmakelists from root 2014-04-07 02:29:15 +04:00
arcan1s
4d455d93e8 added only plasmoid archive 2014-04-07 02:28:07 +04:00
arcan1s
046ae119a3 updated screenshots 2014-04-07 00:58:29 +04:00
arcan1s
b958d0b78b edited readme 2014-04-07 00:49:53 +04:00
248 changed files with 41116 additions and 9768 deletions

6
.gitignore vendored
View File

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

12
.gitmodules vendored Normal file
View File

@ -0,0 +1,12 @@
[submodule "sources/3rdparty/tasks"]
path = sources/3rdparty/tasks
url = https://github.com/mhogomchungu/tasks.git
[submodule "sources/3rdparty/pdebug"]
path = sources/3rdparty/pdebug
url = https://github.com/arcan1s/qtadds-pdebug.git
[submodule "sources/3rdparty/language"]
path = sources/3rdparty/language
url = https://github.com/arcan1s/qtadds-language.git
[submodule "sources/3rdparty/task"]
path = sources/3rdparty/task
url = https://github.com/arcan1s/qtadds-taskadds-qprocess.git

View File

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

334
CHANGELOG
View File

@ -1,17 +1,327 @@
Ver.1.0.4:
+ [gui] added Qt5 gui (by default)
+ [plasmoid] added notifications
* [plasmoid] fix run command with sudo from plasmoid
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.3:
+ [plasmoid] edited russian translation
* [all] refactoring
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.2:
* [plasmoid] fix layout margins
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.1:
- [all] removed scripts
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:
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
-------
First release

View File

@ -1,48 +0,0 @@
# 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,43 +3,48 @@ Netctl GUI
Information
-----------
Graphical interface for netctl. Now it may work with profiles and may create new profiles. Also it may create a connection to WiFi. Moreover, it provides a widget and DataEngine for KDE.
**NOTE** LOOKING FOR TRANSLATORS!
Qt4/Qt5 graphical interface for netctl. It may work with profiles and may create new profiles. Also it may create a connection to WiFi. Moreover, it provides a widget and DataEngine for KDE4/KF5.
**NOTE** [LOOKING FOR TRANSLATORS!](https://github.com/arcan1s/netctl-gui/issues/3)
Configuration
-------------
It is recommended to use graphical interface for widget configuration. DataEngine settings are stored in `/usr/share/config/netctl.conf`:
* `CMD` - netctl command. Default value is `/usr/bin/netctl`.
* `IPCMD` - ip command. `/usr/bin/ip` by default.
* `NETDIR` - a directory, which contains subdirectories with names of network interfaces. Default is `/sys/class/net/`.
* `EXTIPCMD` - a command, which returns external IP address. Default value is `wget -qO- http://ifconfig.me/ip`.
* `EXTIP` - `true` will enable external IP definition. Default is `false`.
It is recommended to use graphical interface for configuration. Configuration files are:
All settings of GUI are stored in `$HOME/.config/netctl-gui.conf`. It is highly recommended to edit it from graphical interface.
* `$HOME/.config/netctl-gui.conf` - GUI/helper user configuration
* `/etc/netctl-gui.conf` - helper system-wide configuration
* `$HOME/.config/plasma-dataengine-netctl.conf` - DataEngine user configuration
* `/etc/xdg/plasma-dataengine-netctl.conf` - DataEngine system-wide configuration
Instruction
===========
Dependencies
------------
* netctl
* qt4
* qt5-base (if Qt5 is used) or qt4 (if Qt4 is used)
Optional dependencies
---------------------
* kdebase-workspace (widget)
* kdebase-workspace (KDE4 widget)
* plasma-framework (KF5 widget)
* sudo (sudo support)
* wpa_supplicant (WiFi support)
Make dependencies
-----------------
* automoc4
* cmake
* qt5-tools (if Qt5 is used)
Installation
------------
* download sources
* extract it and install the application:
@ -49,26 +54,33 @@ Installation
make
sudo make install
If you want install it without KDE widget just run:
Available cmake flags:
cd /path/to/extracted/archive
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_DATAENGINE:BOOL=0 -DBUILD_PLASMOID:BOOL=0 ../
make
sudo make install
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
* components:
* `-DBUILD_DATAENGINE:BOOL=0` - do not build DataEngine
* `-DBUILD_GUI:BOOL=0` - do not build GUI
* `-DBUILD_HELPER:BOOL=0` - do not build helper daemon
* `-DBUILD_LIBRARY:BOOL=0` - do not build library
* `-DBUILD_PLASMOID:BOOL=0` - do not build Plasmoid
* additional components:
* `-DBUILD_DOCS:BOOL=0` - do not build developer documentation
* `-DBUILD_TEST:BOOL=1` - build auto tests for the library and the helper
* project properties:
* `-DDBUS_SYSTEMCONF_PATH=/etc/dbus-1/system.d/` - path to dbus system configuration files
* `-DSYSTEMD_SERVICE_PATH=lib/systemd/system` - path to systemd services
* `-DUSE_CAPABILITIES:BOOL=0` - do not use setcap to get privileges to the helper
* `-DBUILD_KDE4:BOOL=1` - build KDE4 plasmoid instead of KF5 one
* `-DUSE_QT5:BOOL=0` - use Qt4 instead of Qt5 for GUI
Additional information
======================
TODO (wish list)
----------------
Links
-----
* [Homepage](http://arcanis.name/projects/netctl-gui)
* Archlinux [AUR](https://aur.archlinux.org/packages/netctl-gui) package
* Page on [kde-apps](http://kde-apps.org/content/show.php?content=164490)
* Archlinux [AUR](https://aur.archlinux.org/pkgbase/netctl-gui/) package

98
arch/PKGBUILD Normal file
View File

@ -0,0 +1,98 @@
# 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
}

101
arch/PKGBUILD-qt4 Normal file
View File

@ -0,0 +1,101 @@
# 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

@ -0,0 +1,14 @@
post_install() {
cat << EOF
Update plasmoids...
EOF
kbuildsycoca4 > /dev/null 2>&1
}
post_upgrade() {
post_install "$1"
}
post_remove() {
post_install "$1"
}

11
arch/libnetctlgui.install Normal file
View File

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

View File

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

View File

@ -0,0 +1,11 @@
post_install() {
setcap cap_setuid=ep usr/bin/netctlgui-helper 2>/dev/null || chmod +s usr/bin/netctlgui-helper
cat << EOF
Note: users should be in network group if you want to get them access to the system bus
See http://arcanis.name/devs/netctl-gui-security-notes.html#helper
EOF
}
post_upgrade() {
post_install "$1"
}

View File

@ -0,0 +1,14 @@
post_install() {
cat << EOF
Update plasmoids...
EOF
kbuildsycoca5 > /dev/null 2>&1
}
post_upgrade() {
post_install "$1"
}
post_remove() {
post_install "$1"
}

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

BIN
screenshots/de-main.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
screenshots/gui-about.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

View File

@ -0,0 +1,23 @@
[Buildset]
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x14\x00n\x00e\x00t\x00c\x00t\x00l\x00-\x00g\x00u\x00i)
[CMake]
Build Directory Count=1
Current Build Directory Index=0
ProjectRootRelative=./
[CMake][CMake Build Directory 0]
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
Build Type=Release
CMake Binary=file:///usr/bin/cmake
Environment Profile=
Extra Arguments=
Install Directory=file:///usr
[Defines And Includes][Compiler]
Name=GCC
Path=gcc
Type=GCC
[Project]
VersionControlSupport=kdevgit

View File

@ -0,0 +1,23 @@
[Buildset]
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x14\x00n\x00e\x00t\x00c\x00t\x00l\x00-\x00g\x00u\x00i)
[CMake]
Build Directory Count=1
Current Build Directory Index=0
ProjectRootRelative=./
[CMake][CMake Build Directory 0]
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
Build Type=Debug
CMake Binary=file:///usr/bin/cmake
Environment Profile=
Extra Arguments=
Install Directory=file:///usr
[Defines And Includes][Compiler]
Name=GCC
Path=gcc
Type=GCC
[Project]
VersionControlSupport=kdevgit

218
sources/3rdparty/about/about.ui vendored Normal file
View File

@ -0,0 +1,218 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>About</class>
<widget class="QWidget" name="About">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>359</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_About">
<attribute name="title">
<string>About</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QScrollArea" name="scrollArea_about">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_about">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>418</width>
<height>284</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_name">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_version">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_description">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_links">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<spacer name="spacer_about">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_ackn">
<attribute name="title">
<string>Acknowledgement</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QScrollArea" name="scrollArea_ackn">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_ackn">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>418</width>
<height>284</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="label_translators">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_trdparty">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<spacer name="spacer_ackn">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>229</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QLabel" name="label_license">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

1
sources/3rdparty/language vendored Submodule

@ -0,0 +1 @@
Subproject commit 319125b1fafff9da14c89a94de6ba2852c90c9c2

14
sources/3rdparty/language-config.h vendored Normal file
View File

@ -0,0 +1,14 @@
#ifndef LANGUAGE_CONFIG_H
#define LANGUAGE_CONFIG_H
// put your languages here comma separated
// the first language is default language
#define LANGUAGES "en,ja,ru"
// language key in the configuration file
#define LANGUAGE_KEY "LANGUAGE"
// name of config section in the file if any
#define LANGUAGE_SECTION "Common"
#endif /* LANGUAGE_CONFIG_H */

41
sources/3rdparty/listmap/listmap.cpp vendored Normal file
View File

@ -0,0 +1,41 @@
/***************************************************************************
* This file is part of netctl-gui *
* *
* netctl-gui is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-gui is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#include "listmap.h"
QMap<QString, QString> listToMap(const QStringList list)
{
QMap<QString, QString> map;
for (int i=0; i<list.count(); i++) {
QStringList str = list[i].split(QString("=="));
if (str.count() != 2) continue;
map[str[0]] = str[1];
}
return map;
}
QStringList mapToList(const QMap<QString, QString> map)
{
QStringList list;
for (int i=0; i<map.keys().count(); i++)
list.append(QString("%1==%2").arg(map.keys()[i]).arg(map[map.keys()[i]]));
return list;
}

29
sources/3rdparty/listmap/listmap.h vendored Normal file
View File

@ -0,0 +1,29 @@
/***************************************************************************
* This file is part of netctl-gui *
* *
* netctl-gui is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-gui is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef LISTMAP_H
#define LISTMAP_H
#include <QMap>
#include <QStringList>
QMap<QString, QString> listToMap(const QStringList list);
QStringList mapToList(const QMap<QString,QString> map);
#endif /* LISTMAP_H */

1
sources/3rdparty/pdebug vendored Submodule

@ -0,0 +1 @@
Subproject commit 75e4a0df83478802bba53345486b42c56713fe09

1
sources/3rdparty/task vendored Submodule

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

1
sources/3rdparty/tasks vendored Submodule

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

View File

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

41
sources/config-defs.cmake Normal file
View File

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

View File

@ -1,18 +0,0 @@
# Configuration file for netctl data engine
## Commands
# command
CMD=/usr/bin/netctl
# ip command
IPCMD=/usr/bin/ip
## Network
# path to list of network devices
NETDIR=/sys/class/net/
## External IP
# external ip check command
EXTIPCMD=wget -qO- http://ifconfig.me/ip
# 'true' - check external IP
EXTIP=false

View File

@ -18,9 +18,26 @@
#include "netctl.h"
#include <Plasma/DataContainer>
#include <QDir>
#include <QDebug>
#include <QFile>
#include <QProcess>
#include <QNetworkInterface>
#include <QProcessEnvironment>
#include <QSettings>
#include <QTextCodec>
#include <pdebug/pdebug.h>
#include <task/taskadds.h>
#include <version.h>
// KF5-KDE4 compability
#ifdef BUILD_KDE4
#include <KGlobal>
#include <KStandardDirs>
#else
#include <QStandardPaths>
#include <pdebug/pdebug-time.h>
#endif /* BUILD_KDE4 */
Netctl::Netctl(QObject *parent, const QVariantList &args)
@ -28,190 +45,258 @@ 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
{
QStringList sources;
if (debug) qDebug() << PDEBUG;
sources.append(QString("currentProfile"));
sources.append(QString("extIp"));
QStringList sources;
sources.append(QString("active"));
sources.append(QString("current"));
sources.append(QString("extip4"));
sources.append(QString("extip6"));
sources.append(QString("info"));
sources.append(QString("interfaces"));
sources.append(QString("intIp"));
sources.append(QString("intip4"));
sources.append(QString("intip6"));
sources.append(QString("netctlauto"));
sources.append(QString("profiles"));
sources.append(QString("statusBool"));
sources.append(QString("statusString"));
sources.append(QString("status"));
return sources;
}
bool Netctl::readConfiguration()
QString Netctl::getCmdOutput(const QString cmd) const
{
// 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/");
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
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;
TaskResult process = runTask(cmd);
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
return QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
}
while (true) {
fileStr = QString(confFile.readLine());
if (fileStr[0] != '#') {
if (fileStr.contains(QString("=")))
configuration[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1]
.remove(QString(" "))
.trimmed();
}
if (confFile.atEnd())
break;
}
confFile.close();
return true;
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();
}
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)
{
QProcess command;
QString cmdOutput = QString("");
QString value = QString("");
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Source name" << source;
if (source == QString("currentProfile")) {
command.start(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;
}
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('|'));
}
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);
}
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,6 +19,7 @@
#define NETCTL_DE_H
#include <Plasma/DataEngine>
#include <QAbstractSocket>
class Netctl : public Plasma::DataEngine
@ -26,17 +27,34 @@ class Netctl : public Plasma::DataEngine
Q_OBJECT
public:
Netctl(QObject *parent, const QVariantList &args);
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();
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
QMap<QString, QString> configuration;
bool debug;
QVariantMap configuration;
QString getCmdOutput(const QString cmd) const;
void readConfiguration();
};

View File

@ -0,0 +1,9 @@
[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
Icon=netctl-gui-widget
X-KDE-ServiceTypes=Plasma/DataEngine
X-KDE-Library=plasma_engine_netctl
X-Plasma-EngineName=netctl
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
X-KDE-PluginInfo-Author=Evgeniy Alekseev
X-KDE-PluginInfo-Email=esalexeev@gmail.com
X-KDE-PluginInfo-Name=netctl
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
X-KDE-PluginInfo-Website=http://arcan1s.github.io/projects/netctlplasmoid
X-KDE-PluginInfo-Website=https://arcanis.me/projects/netctl-gui/
X-KDE-PluginInfo-Category=Network
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPLv3

View File

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

View File

@ -0,0 +1,115 @@
###########################################################################
# This file is part of netctl-gui #
# #
# netctl-gui is free software: you can redistribute it and/or #
# modify it under the terms of the GNU General Public License as #
# published by the Free Software Foundation, either version 3 of the #
# License, or (at your option) any later version. #
# #
# netctl-gui is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with netctl-gui. If not, see http://www.gnu.org/licenses/ #
###########################################################################
# variables
_netctl_gui_arglist=(
'--detached'
'--maximized'
'--minimized'
'--about'
'--netctl-auto'
'--settings'
'-e'
'--essid'
'-o'
'--open'
'-s'
'--select'
'-c'
'--config'
'-d'
'--debug'
'--default'
'--set-opts'
'-t'
'--tab'
'-v'
'--version'
'-i'
'--info'
'-h'
'--help'
)
_netctl_gui_settings=(
'CLOSE_HELPER'
'CLOSETOTRAY'
'CTRL_DIR'
'CTRL_GROUP'
'FORCE_SUDO'
'HELPER_PATH'
'HELPER_SERVICE'
'IFACE_DIR'
'LANGUAGE'
'NETCTL_PATH'
'NETCTLAUTO_PATH'
'NETCTLAUTO_SERVICE'
'PID_FILE'
'PREFERED_IFACE'
'PROFILE_DIR'
'RFKILL_DIR'
'SKIPCOMPONENTS'
'STARTTOTRAY'
'SUDO_PATH'
'SYSTEMCTL_PATH'
'SYSTRAY'
'USE_HELPER'
'WPACLI_PATH'
'WPASUP_PATH'
'WPA_DRIVERS'
)
_netctl_gui_tabs=(
'1'
'2'
'3'
)
_netctl_profiles() {
echo $(find /etc/netctl -maxdepth 1 -type f -printf "%f\n")
}
# work block
_netctl_gui() {
COMPREPLY=()
wantfiles='-@(c|-config)'
wantprofiles='-@(o|-open|s|-select)'
wantsettings='-@(-set-opts)'
wantstring='-@(e|-essid)'
wanttabs='-@(t|-tab)'
_get_comp_words_by_ref cur prev words cword
if [[ $prev = $wantfiles ]]; then
_filedir
elif [[ $prev = $wantprofiles ]]; then
COMPREPLY=($(compgen -W '$(_netctl_profiles)' -- "$cur"))
elif [[ $prev = $wantsettings ]]; then
COMPREPLY=($(compgen -S ',' -W '${_netctl_gui_settings[@]}' -- "$cur"))
elif [[ $prev = $wantstring ]]; then
COMPREPLY=()
elif [[ $prev = $wanttabs ]]; then
COMPREPLY=($(compgen -W '${_netctl_gui_tabs[@]}' -- "$cur"))
else
COMPREPLY=($(compgen -W '${_netctl_gui_arglist[@]}' -- "$cur"))
fi
true
}
complete -F _netctl_gui netctl-gui

View File

@ -0,0 +1,12 @@
# build pages
file (GLOB SUBPROJECT_DOCS_IN *.html)
file (GLOB SUBPROJECT_IMGS *.png)
foreach (DOC_IN ${SUBPROJECT_DOCS_IN})
file (RELATIVE_PATH ONE_DOC ${CMAKE_SOURCE_DIR} ${DOC_IN})
configure_file (${DOC_IN} ${CMAKE_CURRENT_BINARY_DIR}/${ONE_DOC})
set (SUBPROJECT_DOCS ${SUBPROJECT_DOCS} ${CMAKE_CURRENT_BINARY_DIR}/${ONE_DOC})
endforeach ()
install (FILES ${SUBPROJECT_DOCS} DESTINATION share/doc/${PROJECT_NAME})
install (FILES ${SUBPROJECT_IMGS} DESTINATION share/doc/${PROJECT_NAME})

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,478 @@
<!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

@ -0,0 +1,112 @@
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>netctl-gui secutiry notes</title>
<style type="text/css">
img {
display: block;
margin: 0 auto;
}
small {
font-size: 70%;
}
</style>
</head>
<body>
<h1>netctl-gui security notes</h1>
<h3>Project version : @PROJECT_VERSION@</h3>
<ol>
<li><a href="#arch">Architecture</a></li>
<li><a href="#library">Library</a></li>
<li><a href="#helper">Helper</a></li>
<li><a href="#gui">Graphical interface</a></li>
<li><a href="#kde">KDE components</a></li>
<li><a href="#links">External links</a></li>
</ol>
<h2><a href="#description" class="anchor" id="description"></a>Description</h2>
<p></p>
<h2><a href="#arch" class="anchor" id="arch"></a>Architecture</h2>
<img src="architecture.png" alt="architecture">
<h2><a href="#library" class="anchor" id="library"></a>Library</h2>
<p>According to <a href="#arch">the scheme</a> the library gets information from netctl and can control it. Also it provides some additional functions such as a profile creation and removal and access to wpa_supplicant functions. Some functions do not require additional permissions, but other ones do it. All dynamic arguments including profile names and paths are in double quotes to avoid white spaces problem. The functions which <b>require</b> root privileges are:</p>
<ul>
<li>Netctl control module</li>
<li><ul>
<li><code>netctl stop-all|start|stop|restart|switch-to|enable|disable|reenable &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.

79
sources/gui/netctl-gui.1 Normal file
View File

@ -0,0 +1,79 @@
.TH netctl-gui 1 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "General Commands Manual"
.SH NAME
netctl-gui is a graphical interface for netctl
.SH SYNOPSIS
.B netctl-gui
[ options ]
.SH DESCRIPTION
.B netctl-gui
is a project which provides graphical user interface for
.B netctl
written on C++ using Qt toolkit. It provides shared library and DBus API (through helper daemon) and Plasmoid and DataEngine for KDE.
.SH OPTIONS
.IP "--detached"
run detached from console
.IP "--maximized"
run maximized
.IP "--minimized"
run to system tray if it is available
.IP "--about"
show about window
.IP "--netctl-auto"
show netctl-auto window
.IP "--settings"
show settings window
.IP "-e, --essid ESSID"
select ESSID
.I ESSID
This option will set tab to 3 automatically
.IP "-o, --open PROFILE"
open profile
.I PROFILE
This option will set tab to 2 automatically
.IP "-s, --select PROFILE"
select profile
.I PROFILE
This option will set tab to 1 automatically
.IP "-c, --config FILE"
read configuration from file
.I FILE
.IP "-d, --debug"
print debug information
.IP "--default"
start with default settings
.IP "--set-opts OPTIONS"
set options
.I OPTIONS
for this run, comma separated. Example:
.nf
LANGUAGE=en,NETCTL_PATH=/path/to/ponies
.fi
.IP "-t, --tab NUM"
open a tab with number
.I NUM
.IP "-v, --version"
show version and exit
.IP "-i, --info"
show build information and exit
.IP "-h, --help"
show this help and exit
.SH FILES
.I $HOME/.config/netctl-gui.conf
.RS
Configuration file
.RE
.SH SEE ALSO
.BR netctlgui-helper (1)
.BR netctl-gui.conf (5)
.SH STANDARDS
See
.B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-dbus-api.html
for more details.
.SH SECURITY CONSIDERATIONS
See
.B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-security-notes.html
for more details.
.SH AUTHOR
@PROJECT_AUTHOR@ <\fI@PROJECT_CONTACT@\fR>
.SH LICENSE
This software is licensed under @PROJECT_LICENSE@

View File

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

View File

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

@ -0,0 +1,107 @@
/***************************************************************************
* This file is part of netctl-gui *
* *
* netctl-gui is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-gui is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#include "aboutwindow.h"
#include "ui_aboutwindow.h"
#include <QDebug>
#include <QDialogButtonBox>
#include <QPushButton>
#include <pdebug/pdebug.h>
#include "version.h"
AboutWindow::AboutWindow(QWidget *parent, const bool debugCmd)
: QMainWindow(parent),
ui(new Ui::AboutWindow),
debug(debugCmd)
{
ui->setupUi(this);
createUi();
}
AboutWindow::~AboutWindow()
{
if (debug) qDebug() << PDEBUG;
delete uiAbout;
delete ui;
}
void AboutWindow::createText()
{
if (debug) qDebug() << PDEBUG;
// 1st tab
uiAbout->label_name->setText(QString(NAME));
uiAbout->label_version->setText(QApplication::translate("AboutWindow", "Version %1\n(build date %2)")
.arg(QString(VERSION)).arg(QString(BUILD_DATE)));
uiAbout->label_description->setText(QApplication::translate("AboutWindow", "Qt-based graphical interface for netctl."));
uiAbout->label_links->setText(QApplication::translate("AboutWindow", "Links:") + QString("<br>") +
QString("<a href=\"%1\">%2</a><br>").arg(QString(HOMEPAGE))
.arg(QApplication::translate("AboutWindow", "Homepage")) +
QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY))
.arg(QApplication::translate("AboutWindow", "Repository")) +
QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER))
.arg(QApplication::translate("AboutWindow", "Bugtracker")) +
QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION))
.arg(QApplication::translate("AboutWindow", "Translation issue")) +\
QString("<a href=\"%1\">%2</a>").arg(QString(AUR_PACKAGES))
.arg(QApplication::translate("AboutWindow", "AUR packages")));
uiAbout->label_license->setText(QString("<small>&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

@ -0,0 +1,51 @@
/***************************************************************************
* This file is part of netctl-gui *
* *
* netctl-gui is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-gui is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef ABOUTWINDOW_H
#define ABOUTWINDOW_H
#include <QKeyEvent>
#include <QMainWindow>
#include "ui_about.h"
namespace Ui {
class AboutWindow;
}
class AboutWindow : public QMainWindow
{
Q_OBJECT
public:
explicit AboutWindow(QWidget *parent = 0,
const bool debugCmd = false);
~AboutWindow();
private:
Ui::AboutWindow *ui;
Ui::About *uiAbout;
bool debug;
void createText();
void createUi();
// ESC pressed event
void keyPressEvent(QKeyEvent *pressedKey);
};
#endif /* ABOUTWINDOW_H */

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutWindow</class>
<widget class="QMainWindow" name="AboutWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>516</width>
<height>431</height>
</rect>
</property>
<property name="windowTitle">
<string>About</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,69 @@
/***************************************************************************
* 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

@ -0,0 +1,47 @@
/***************************************************************************
* 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

@ -0,0 +1,71 @@
<?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,26 +40,16 @@ void BridgeWidget::clear()
}
void BridgeWidget::setShown(const bool state)
{
if (state)
show();
else
hide();
}
QMap<QString, QString> BridgeWidget::getSettings()
{
QMap<QString, QString> bridgeSettings;
QMap<QString, QString> settings;
if (isOk() != 0)
return bridgeSettings;
if (isOk() != 0) return settings;
if (ui->checkBox_skip->checkState() == Qt::Checked)
bridgeSettings[QString("SkipForwardingDelay")] = QString("yes");
settings[QString("SkipForwardingDelay")] = QString("yes");
return bridgeSettings;
return settings;
}
@ -72,9 +62,9 @@ int BridgeWidget::isOk()
void BridgeWidget::setSettings(const QMap<QString, QString> settings)
{
QMap<QString, QString> bridgeSettings = settings;
clear();
if (bridgeSettings.contains(QString("SkipForwardingDelay")))
if (bridgeSettings[QString("SkipForwardingDelay")].remove(QString("'")) == QString("yes"))
if (settings.contains(QString("SkipForwardingDelay")))
if (settings[QString("SkipForwardingDelay")] == QString("yes"))
ui->checkBox_skip->setCheckState(Qt::Checked);
}

View File

@ -38,7 +38,6 @@ 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>424</width>
<height>76</height>
<width>550</width>
<height>44</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,8 +24,29 @@
</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>
@ -35,6 +56,8 @@
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>

243
sources/gui/src/calls.cpp Normal file
View File

@ -0,0 +1,243 @@
/***************************************************************************
* 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();
}
}

55
sources/gui/src/calls.h Normal file
View File

@ -0,0 +1,55 @@
/***************************************************************************
* 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

@ -0,0 +1,88 @@
/***************************************************************************
* 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

@ -0,0 +1,33 @@
/***************************************************************************
* 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

@ -0,0 +1,155 @@
/***************************************************************************
* 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

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

View File

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

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ErrorWindow</class>
<widget class="QMainWindow" name="ErrorWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>287</width>
<height>101</height>
</rect>
</property>
<property name="windowTitle">
<string>Error</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="spacer2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="layout_main">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Error text</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="spacer1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="layout_button">
<item>
<spacer name="spacer_button1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Ok</string>
</property>
</widget>
</item>
<item>
<spacer name="spacer_button2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>pushButton</sender>
<signal>clicked(bool)</signal>
<receiver>ErrorWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>143</x>
<y>83</y>
</hint>
<hint type="destinationlabel">
<x>252</x>
<y>80</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -44,8 +44,9 @@ void EthernetWidget::clear()
ui->checkBox_skip->setCheckState(Qt::Unchecked);
ui->checkBox_8021x->setCheckState(Qt::Unchecked);
showWpa(ui->checkBox_8021x->checkState());
ui->lineEdit_wpaConfig->setText(QString("/etc/wpa_supplicant.conf"));
ui->lineEdit_wpaConfig->clear();
ui->comboBox_driver->setCurrentIndex(0);
ui->spinBox_priority->setValue(1);
ui->spinBox_timeoutCarrier->setValue(5);
ui->spinBox_timeoutWpa->setValue(15);
@ -54,15 +55,6 @@ 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()));
@ -73,8 +65,7 @@ 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)"));
@ -87,44 +78,41 @@ void EthernetWidget::showAdvanced()
{
if (ui->pushButton_ethernetAdvanced->isChecked()) {
ui->widget_ethernetAdvanced->setHidden(false);
ui->pushButton_ethernetAdvanced->setText(QApplication::translate("EthernetWidget", "Hide advanced"));
}
else {
ui->pushButton_ethernetAdvanced->setArrowType(Qt::UpArrow);
} else {
ui->widget_ethernetAdvanced->setHidden(true);
ui->pushButton_ethernetAdvanced->setText(QApplication::translate("EthernetWidget", "Show advanced"));
ui->pushButton_ethernetAdvanced->setArrowType(Qt::DownArrow);
}
}
void EthernetWidget::showWpa(const int state)
{
if (state == 0)
ui->widget_wpa->setHidden(true);
else
ui->widget_wpa->setHidden(false);
ui->widget_wpa->setHidden(state == 0);
}
QMap<QString, QString> EthernetWidget::getSettings()
{
QMap<QString, QString> ethernetSettings;
QMap<QString, QString> settings;
if (isOk() != 0)
return ethernetSettings;
if (isOk() != 0) return settings;
if (ui->checkBox_skip->checkState() == Qt::Checked)
ethernetSettings[QString("SkipNoCarrier")] = QString("yes");
settings[QString("SkipNoCarrier")] = QString("yes");
if (ui->checkBox_8021x->checkState() == Qt::Checked) {
ethernetSettings[QString("Auth8021X")] = QString("yes");
ethernetSettings[QString("WPAConfigFile")] = QString("'") + ui->lineEdit_wpaConfig->text() + QString("'");
ethernetSettings[QString("WPADriver")] = ui->comboBox_driver->currentText();
settings[QString("Auth8021X")] = QString("yes");
settings[QString("WPAConfigFile")] = QString("'%1'").arg(ui->lineEdit_wpaConfig->text());
settings[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)
ethernetSettings[QString("TimeoutCarrier")] = QString::number(ui->spinBox_timeoutCarrier->value());
settings[QString("TimeoutCarrier")] = QString::number(ui->spinBox_timeoutCarrier->value());
if (ui->spinBox_timeoutWpa->value() != 15)
ethernetSettings[QString("TimeoutWPA")] = QString::number(ui->spinBox_timeoutWpa->value());
settings[QString("TimeoutWPA")] = QString::number(ui->spinBox_timeoutWpa->value());
return ethernetSettings;
return settings;
}
@ -132,8 +120,7 @@ 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;
}
@ -141,24 +128,26 @@ int EthernetWidget::isOk()
void EthernetWidget::setSettings(const QMap<QString, QString> settings)
{
QMap<QString, QString> ethernetSettings = settings;
clear();
if (ethernetSettings.contains(QString("SkipNoCarrier")))
if (ethernetSettings[QString("SkipNoCarrier")].remove(QString("'")) == QString("yes"))
if (settings.contains(QString("SkipNoCarrier")))
if (settings[QString("SkipNoCarrier")] == QString("yes"))
ui->checkBox_skip->setCheckState(Qt::Checked);
if (ethernetSettings.contains(QString("Auth8021X")))
if (ethernetSettings[QString("Auth8021X")].remove(QString("'")) == QString("yes"))
if (settings.contains(QString("Auth8021X")))
if (settings[QString("Auth8021X")] == QString("yes"))
ui->checkBox_8021x->setCheckState(Qt::Checked);
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());
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());
showWpa(ui->checkBox_8021x->checkState());
}

View File

@ -39,7 +39,6 @@ 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>431</width>
<height>296</height>
<width>550</width>
<height>255</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>
<spacer name="spacer_ethernetAdvanced">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_ethernetAdvanced">
<property name="text">
<string>Hide advanced</string>
</property>
<widget class="QToolButton" name="pushButton_ethernetAdvanced">
<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,8 +54,29 @@
<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>
@ -64,8 +85,28 @@
</property>
</widget>
</item>
</layout>
</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>
@ -77,26 +118,40 @@
</property>
</widget>
</item>
</layout>
</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="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>7</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>
@ -104,6 +159,12 @@
</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>
@ -115,19 +176,28 @@
<layout class="QHBoxLayout" name="layout_driver">
<item>
<widget class="QLabel" name="label_driver">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>7</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>
@ -157,19 +227,28 @@
<layout class="QHBoxLayout" name="layout_timeoutCarrier">
<item>
<widget class="QLabel" name="label_timeoutCarrier">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>
@ -187,19 +266,28 @@
<layout class="QHBoxLayout" name="layout_timeoutWpa">
<item>
<widget class="QLabel" name="label_timeoutWpa">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>
@ -213,6 +301,45 @@
</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>
@ -223,9 +350,6 @@
</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,6 +59,7 @@ 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);
@ -67,20 +68,13 @@ 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()));
}
@ -100,10 +94,10 @@ void GeneralWidget::keyPressEvent(QKeyEvent *pressedKey)
{
if (pressedKey->key() == Qt::Key_Delete) {
if (ui->listWidget_bindto->hasFocus() &&
(ui->listWidget_bindto->currentItem() != 0))
(ui->listWidget_bindto->currentItem() != nullptr))
delete ui->listWidget_bindto->currentItem();
else if (ui->listWidget_after->hasFocus() &&
(ui->listWidget_after->currentItem() != 0))
(ui->listWidget_after->currentItem() != nullptr))
delete ui->listWidget_after->currentItem();
}
}
@ -114,8 +108,7 @@ 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"));
}
@ -124,36 +117,37 @@ void GeneralWidget::showAdvanced()
QMap<QString, QString> GeneralWidget::getSettings()
{
QMap<QString, QString> generalSettings;
QMap<QString, QString> settings;
if (isOk() != 0)
return generalSettings;
if (isOk() != 0) return settings;
generalSettings[QString("Description")] = QString("'") + ui->lineEdit_description->text() + QString("'");
generalSettings[QString("Connection")] = ui->comboBox_connection->currentText();
generalSettings[QString("Interface")] = ui->comboBox_interface->currentText();
settings[QString("Description")] = QString("'%1'").arg(ui->lineEdit_description->text());
settings[QString("Connection")] = ui->comboBox_connection->currentText();
settings[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());
generalSettings[QString("BindsToInterfaces")] = interfaces.join(QString(" "));
settings[QString("BindsToInterfaces")] = interfaces.join(QChar(' '));
}
if (ui->listWidget_after->count() != 0) {
QStringList profiles;
for (int i=0; i<ui->listWidget_after->count(); i++)
profiles.append(ui->listWidget_after->item(i)->text());
generalSettings[QString("After")] = profiles.join(QString(" "));
settings[QString("After")] = profiles.join(QChar(' '));
}
if (!ui->lineEdit_execUpPost->text().isEmpty())
generalSettings[QString("ExecUpPost")] = QString("'") + ui->lineEdit_execUpPost->text() + QString("'");
settings[QString("ExecUpPost")] = QString("'%1'").arg(ui->lineEdit_execUpPost->text());
if (!ui->lineEdit_execDownPre->text().isEmpty())
generalSettings[QString("ExecDownPre")] = QString("'") + ui->lineEdit_execDownPre->text() + QString("'");
settings[QString("ExecDownPre")] = QString("'%1'").arg(ui->lineEdit_execDownPre->text());
if (ui->checkBox_exclude->checkState() == Qt::Checked)
settings[QString("ExcludeAuto")] = QString("yes");
if (ui->checkBox_forceConnect->checkState() == Qt::Checked)
generalSettings[QString("ForceConnect")] = QString("yes");
settings[QString("ForceConnect")] = QString("yes");
if (ui->checkBox_debug->checkState() == Qt::Checked)
generalSettings[QString("NETCTL_DEBUG")] = QString("yes");
settings[QString("NETCTL_DEBUG")] = QString("yes");
return generalSettings;
return settings;
}
@ -162,12 +156,12 @@ 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")))
if (ui->listWidget_bindto->count() == 0)
return 1;
(ui->comboBox_connection->currentText() == QString("vlan")) ||
(ui->comboBox_connection->currentText() == QString("macvlan")) ||
(ui->comboBox_connection->currentText() == QString("openvswitch")))
if (ui->listWidget_bindto->count() == 0) return 1;
// empty description
if (ui->lineEdit_description->text().isEmpty())
return 2;
if (ui->lineEdit_description->text().isEmpty()) return 2;
// all fine
return 0;
}
@ -175,30 +169,33 @@ int GeneralWidget::isOk()
void GeneralWidget::setSettings(const QMap<QString, QString> settings)
{
QMap<QString, QString> generalSettings = settings;
clear();
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"))
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"))
ui->checkBox_forceConnect->setCheckState(Qt::Checked);
if (generalSettings.contains(QString("NETCTL_DEBUG")))
if (generalSettings[QString("NETCTL_DEBUG")].remove(QString("'")) == QString("yes"))
if (settings.contains(QString("NETCTL_DEBUG")))
if (settings[QString("NETCTL_DEBUG")] == QString("yes"))
ui->checkBox_debug->setCheckState(Qt::Checked);
}

View File

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

View File

@ -6,16 +6,22 @@
<rect>
<x>0</x>
<y>0</y>
<width>431</width>
<height>537</height>
<width>550</width>
<height>479</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>
@ -24,25 +30,37 @@
</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="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>&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>
<string>A description of the profile</string>
</property>
</widget>
</item>
@ -52,19 +70,28 @@
<layout class="QHBoxLayout" name="layout_connection">
<item>
<widget class="QLabel" name="label_connection">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>
@ -118,6 +145,16 @@
<string notr="true">vlan</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">macvlan</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">openvswitch</string>
</property>
</item>
</widget>
</item>
</layout>
@ -126,19 +163,28 @@
<layout class="QHBoxLayout" name="layout_interface">
<item>
<widget class="QLabel" name="label_interface">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>
@ -155,18 +201,27 @@
<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="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool>
@ -175,6 +230,12 @@
</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>
@ -200,26 +261,23 @@
<item>
<layout class="QHBoxLayout" name="layout_generalAdvanced">
<item>
<spacer name="spacer_generalAdvanced">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_generalAdvanced">
<property name="text">
<string>Hide advanced</string>
</property>
<widget class="QToolButton" name="pushButton_generalAdvanced">
<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>
@ -227,24 +285,36 @@
<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="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool>
@ -253,6 +323,12 @@
</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>
@ -279,19 +355,28 @@
<layout class="QHBoxLayout" name="layout_execUpPost">
<item>
<widget class="QLabel" name="label_execUpPost">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>7</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>
@ -303,19 +388,28 @@
<layout class="QHBoxLayout" name="layout_execDownPre">
<item>
<widget class="QLabel" name="label_execDownPre">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>7</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>
@ -323,8 +417,56 @@
</item>
</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>
</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>
@ -333,14 +475,36 @@
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>7</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_debug">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>14</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Debug mode</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>

View File

@ -0,0 +1,83 @@
/***************************************************************************
* 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

@ -0,0 +1,49 @@
/***************************************************************************
* This file is part of netctl-gui *
* *
* netctl-gui is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-gui is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef 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,9 +18,11 @@
#include "ipwidget.h"
#include "ui_ipwidget.h"
#include <QDebug>
#include <QKeyEvent>
#include "errorwindow.h"
#include "ipregexp.h"
IpWidget::IpWidget(QWidget *parent)
: QWidget(parent),
@ -90,15 +92,6 @@ 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()));
@ -112,32 +105,36 @@ 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->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"));
ui->lineEdit_ipAddress->setValidator(IpRegExp::ipv4CidrValidator());
ui->lineEdit_gateway->setValidator(IpRegExp::ipv4Validator());
ui->lineEdit_ipRoutes->setValidator(IpRegExp::ipv4CidrValidator());
ui->lineEdit_ipRoutes2->setValidator(IpRegExp::ipv4Validator());
// ipv6
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"));
ui->lineEdit_ipAddress6->setValidator(IpRegExp::ipv6CidrValidator());
ui->lineEdit_gateway6->setValidator(IpRegExp::ipv6Validator());
ui->lineEdit_ipRoutes6->setValidator(IpRegExp::ipv6CidrValidator());
ui->lineEdit_ipRoutes62->setValidator(IpRegExp::ipv6Validator());
// dns
ui->lineEdit_dns->setInputMask(QString("999.999.999.999"));
ui->lineEdit_dns->setValidator(IpRegExp::ipv4Validator());
}
@ -145,110 +142,47 @@ void IpWidget::keyPressEvent(QKeyEvent *pressedKey)
{
if (pressedKey->key() == Qt::Key_Delete) {
if (ui->listWidget_ipAddress->hasFocus() &&
(ui->listWidget_ipAddress->currentItem() != 0))
(ui->listWidget_ipAddress->currentItem() != nullptr))
delete ui->listWidget_ipAddress->currentItem();
else if (ui->listWidget_ipRoutes->hasFocus() &&
(ui->listWidget_ipRoutes->currentItem() != 0))
(ui->listWidget_ipRoutes->currentItem() != nullptr))
delete ui->listWidget_ipRoutes->currentItem();
else if (ui->listWidget_ipAddress6->hasFocus() &&
(ui->listWidget_ipAddress6->currentItem() != 0))
(ui->listWidget_ipAddress6->currentItem() != nullptr))
delete ui->listWidget_ipAddress6->currentItem();
else if (ui->listWidget_ipRoutes6->hasFocus() &&
(ui->listWidget_ipRoutes6->currentItem() != 0))
(ui->listWidget_ipRoutes6->currentItem() != nullptr))
delete ui->listWidget_ipRoutes6->currentItem();
else if (ui->listWidget_custom->hasFocus() &&
(ui->listWidget_custom->currentItem() != 0))
(ui->listWidget_custom->currentItem() != nullptr))
delete ui->listWidget_custom->currentItem();
else if (ui->listWidget_dns->hasFocus() &&
(ui->listWidget_dns->currentItem() != 0))
(ui->listWidget_dns->currentItem() != nullptr))
delete ui->listWidget_dns->currentItem();
else if (ui->listWidget_dnsOptions->hasFocus() &&
(ui->listWidget_dnsOptions->currentItem() != 0))
(ui->listWidget_dnsOptions->currentItem() != nullptr))
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()
{
QString ip = getIp(ui->lineEdit_ipAddress->text().remove(" ").split(QString("/"))[0]);
QString prefix = getPrefix(ui->lineEdit_ipAddress->text().remove(" ").split(QString("/"))[1]);
if (!IpRegExp::checkString(ui->lineEdit_ipAddress->text(), IpRegExp::ip4CidrRegex()))
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp]"));
ui->listWidget_ipAddress->addItem(ip + QString("/") + prefix);
ui->listWidget_ipAddress->addItem(ui->lineEdit_ipAddress->text());
ui->lineEdit_ipAddress->clear();
}
void IpWidget::addIpRoutes()
{
QString ip = getIp(ui->lineEdit_ipRoutes->text().remove(" ").split(QString("/"))[0]);
QString prefix = getPrefix(ui->lineEdit_ipRoutes->text().remove(" ").split(QString("/"))[1]);
QString ipVia = getIp(ui->lineEdit_ipRoutes2->text().remove(" "));
if ((!IpRegExp::checkString(ui->lineEdit_ipRoutes->text(), IpRegExp::ip4CidrRegex())) ||
(!IpRegExp::checkString(ui->lineEdit_ipRoutes2->text(), IpRegExp::ip4Regex())))
return ErrorWindow::showWindow(20, QString("[IpWidget::addIpRoutes]"));
ui->listWidget_ipRoutes->addItem(ip + QString("/") + prefix + QString(" via ") + ipVia);
ui->listWidget_ipRoutes->addItem(QString("%1 via %2").arg(ui->lineEdit_ipRoutes->text()).arg(ui->lineEdit_ipRoutes2->text()));
ui->lineEdit_ipRoutes->clear();
ui->lineEdit_ipRoutes2->clear();
}
@ -256,21 +190,21 @@ void IpWidget::addIpRoutes()
void IpWidget::addIp6()
{
QString ip = getIp6(ui->lineEdit_ipAddress6->text().remove(" ").split(QString("/"))[0]);
QString prefix = getPrefix6(ui->lineEdit_ipAddress6->text().remove(" ").split(QString("/"))[1]);
if (!IpRegExp::checkString(ui->lineEdit_ipAddress6->text(), IpRegExp::ip6CidrRegex()))
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp6]"));
ui->listWidget_ipAddress6->addItem(ip + QString("/") + prefix);
ui->listWidget_ipAddress6->addItem(ui->lineEdit_ipAddress6->text());
ui->lineEdit_ipAddress6->clear();
}
void IpWidget::addIpRoutes6()
{
QString ip = getIp6(ui->lineEdit_ipRoutes6->text().remove(" ").split(QString("/"))[0]);
QString prefix = getPrefix6(ui->lineEdit_ipRoutes6->text().remove(" ").split(QString("/"))[1]);
QString ipVia = getIp6(ui->lineEdit_ipRoutes62->text().remove(" "));
if ((!IpRegExp::checkString(ui->lineEdit_ipRoutes6->text(), IpRegExp::ip6CidrRegex())) ||
(!IpRegExp::checkString(ui->lineEdit_ipRoutes62->text(), IpRegExp::ip6Regex())))
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp6Routes]"));
ui->listWidget_ipRoutes6->addItem(ip + QString("/") + prefix + QString(" via ") + ipVia);
ui->listWidget_ipRoutes6->addItem(QString("%1 via %2").arg(ui->lineEdit_ipRoutes6->text()).arg(ui->lineEdit_ipRoutes62->text()));
ui->lineEdit_ipRoutes6->clear();
ui->lineEdit_ipRoutes62->clear();
}
@ -286,9 +220,10 @@ void IpWidget::addCustom()
void IpWidget::addDns()
{
QString ip = getIp(ui->lineEdit_dns->text().remove(" "));
if (!IpRegExp::checkString(ui->lineEdit_dns->text(), IpRegExp::ip4Regex()))
return ErrorWindow::showWindow(20, QString("[IpWidget::addDns]"));
ui->listWidget_dns->addItem(ip);
ui->listWidget_dns->addItem(ui->lineEdit_dns->text());
ui->lineEdit_dns->clear();
}
@ -303,64 +238,36 @@ void IpWidget::addDnsOpt()
void IpWidget::changeIpMode(const QString currentText)
{
if (currentText == QString("dhcp"))
ui->widget_ip->setHidden(true);
else if (currentText == QString("static"))
ui->widget_ip->setHidden(false);
ui->widget_ip->setHidden(currentText == QString("dhcp"));
}
void IpWidget::ipEnable(const int state)
{
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);
}
ui->comboBox_ip->setDisabled(state == 0);
ui->widget_ip->setDisabled(state == 0);
ui->widget_ipRoutes->setDisabled(state == 0);
}
void IpWidget::changeIp6Mode(const QString currentText)
{
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);
ui->widget_ip6->setHidden(currentText.startsWith(QString("dhcp")));
}
void IpWidget::ip6Enable(const int state)
{
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);
}
ui->comboBox_ip6->setDisabled(state == 0);
ui->widget_ip6->setDisabled(state == 0);
ui->widget_ipRoutes6->setDisabled(state == 0);
}
void IpWidget::changeDhcpClient(const QString currentText)
{
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);
}
ui->widget_dhcpcdOpt->setHidden(currentText != QString("dhcpcd"));
ui->widget_dhclientOpt->setHidden(currentText == QString("dhcpcd"));
}
@ -368,120 +275,113 @@ void IpWidget::showAdvanced()
{
if (ui->pushButton_ipAdvanced->isChecked()) {
ui->widget_ipAdvanced->setHidden(false);
ui->pushButton_ipAdvanced->setText(QApplication::translate("IpWidget", "Hide advanced"));
}
else {
ui->pushButton_ipAdvanced->setArrowType(Qt::UpArrow);
} else {
ui->widget_ipAdvanced->setHidden(true);
ui->pushButton_ipAdvanced->setText(QApplication::translate("IpWidget", "Show advanced"));
ui->pushButton_ipAdvanced->setArrowType(Qt::DownArrow);
}
}
QMap<QString, QString> IpWidget::getSettings()
{
QMap<QString, QString> ipSettings;
QMap<QString, QString> settings;
if (isOk() != 0)
return ipSettings;
if (isOk() != 0) return settings;
if (ui->checkBox_ip->checkState() == Qt::Checked) {
ipSettings[QString("IP")] = ui->comboBox_ip->currentText();
settings[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("'") + ui->listWidget_ipAddress->item(i)->text() + QString("'"));
ipSettings[QString("Address")] = addresses.join(QString(" "));
ipSettings[QString("Gateway")] = QString("'") + ui->lineEdit_gateway->text() + QString("'");
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());
}
if (ui->listWidget_ipRoutes->count() > 0) {
QStringList routes;
for (int i=0; i<ui->listWidget_ipRoutes->count(); i++)
routes.append(QString("'") + ui->listWidget_ipRoutes->item(i)->text() + QString("'"));
ipSettings[QString("Routes")] = routes.join(QString(" "));
routes.append(QString("'%1'").arg(ui->listWidget_ipRoutes->item(i)->text()));
settings[QString("Routes")] = routes.join(QChar(' '));
}
}
else
ipSettings[QString("IP")] = QString("no");
} else
settings[QString("IP")] = QString("no");
if (ui->checkBox_ip6->checkState() == Qt::Checked) {
ipSettings[QString("IP6")] = ui->comboBox_ip6->currentText();
settings[QString("IP6")] = ui->comboBox_ip6->currentText();
if ((ui->comboBox_ip6->currentText() == QString("static")) ||
(ui->comboBox_ip6->currentText() == QString("stateless"))) {
QStringList addresses;
for (int i=0; i<ui->listWidget_ipAddress6->count(); i++)
addresses.append(QString("'") + ui->listWidget_ipAddress6->item(i)->text() + QString("'"));
ipSettings[QString("Address6")] = addresses.join(QString(" "));
ipSettings[QString("Gateway6")] = QString("'") + ui->lineEdit_gateway6->text() + QString("'");
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());
}
if (ui->listWidget_ipRoutes6->count() > 0) {
QStringList routes;
for (int i=0; i<ui->listWidget_ipRoutes6->count(); i++)
routes.append(QString("'") + ui->listWidget_ipRoutes6->item(i)->text() + QString("'"));
ipSettings[QString("Routes6")] = routes.join(QString(" "));
routes.append(QString("'%1'").arg(ui->listWidget_ipRoutes6->item(i)->text()));
settings[QString("Routes6")] = routes.join(QChar(' '));
}
}
else
ipSettings[QString("IP6")] = QString("no");
} else
settings[QString("IP6")] = QString("no");
if (ui->listWidget_custom->count() > 0) {
QStringList custom;
for (int i=0; i<ui->listWidget_custom->count(); i++)
custom.append(QString("'") + ui->listWidget_custom->item(i)->text() + QString("'"));
ipSettings[QString("IPCustom")] = custom.join(QString(" "));
custom.append(QString("'%1'").arg(ui->listWidget_custom->item(i)->text()));
settings[QString("IPCustom")] = custom.join(QChar(' '));
}
if (!ui->lineEdit_hostname->text().isEmpty())
ipSettings[QString("Hostname")] = QString("'") + ui->lineEdit_hostname->text() + QString("'");
settings[QString("Hostname")] = QString("'%1'").arg(ui->lineEdit_hostname->text());
if (ui->spinBox_timeoutDad->value() != 3)
ipSettings[QString("TimeoutDAD")] = QString::number(ui->spinBox_timeoutDad->value());
settings[QString("TimeoutDAD")] = QString::number(ui->spinBox_timeoutDad->value());
if (ui->comboBox_dhcp->currentText() == QString("dhcpcd")) {
if (!ui->lineEdit_dhcpcdOpt->text().isEmpty())
ipSettings[QString("DhcpcdOptions")] = QString("'") + ui->lineEdit_dhcpcdOpt->text() + QString("'");
}
else if (ui->comboBox_dhcp->currentText() == QString("dhclient")) {
ipSettings[QString("DHCPClient")] = ui->comboBox_dhcp->currentText();
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();
if (!ui->lineEdit_dhclientOpt->text().isEmpty())
ipSettings[QString("DhclientOptions")] = QString("'") + ui->lineEdit_dhclientOpt->text() + QString("'");
settings[QString("DhclientOptions")] = QString("'%1'").arg(ui->lineEdit_dhclientOpt->text());
if (!ui->lineEdit_dhclientOpt6->text().isEmpty())
ipSettings[QString("DhclientOptions6")] = QString("'") + ui->lineEdit_dhclientOpt6->text() + QString("'");
settings[QString("DhclientOptions6")] = QString("'%1'").arg(ui->lineEdit_dhclientOpt6->text());
}
if (ui->spinBox_timeoutDhcp->value() != 30)
ipSettings[QString("TimeoutDHCP")] = QString::number(ui->spinBox_timeoutDhcp->value());
settings[QString("TimeoutDHCP")] = QString::number(ui->spinBox_timeoutDhcp->value());
if (ui->checkBox_dhcp->checkState() == Qt::Checked)
ipSettings[QString("DHCPReleaseOnStop")] = QString("yes");
settings[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("'") + ui->listWidget_dns->item(i)->text() + QString("'"));
ipSettings[QString("DNS")] = dns.join(QString(" "));
dns.append(QString("'%1'").arg(ui->listWidget_dns->item(i)->text()));
settings[QString("DNS")] = dns.join(QChar(' '));
}
if (!ui->lineEdit_dnsDomain->text().isEmpty())
ipSettings[QString("DNSDomain")] = QString("'") + ui->lineEdit_dnsDomain->text() + QString("'");
settings[QString("DNSDomain")] = QString("'%1'").arg(ui->lineEdit_dnsDomain->text());
if (!ui->lineEdit_dnsSearch->text().isEmpty())
ipSettings[QString("DNSSearch")] = QString("'") + ui->lineEdit_dnsSearch->text() + QString("'");
settings[QString("DNSSearch")] = QString("'%1'").arg(ui->lineEdit_dnsSearch->text());
if (ui->listWidget_dnsOptions->count() > 0) {
QStringList dnsOpt;
for (int i=0; i<ui->listWidget_dnsOptions->count(); i++)
dnsOpt.append(QString("'") + ui->listWidget_dnsOptions->item(i)->text() + QString("'"));
ipSettings[QString("DNSOptions")] = dnsOpt.join(QString(" "));
dnsOpt.append(QString("'%1'").arg(ui->listWidget_dnsOptions->item(i)->text()));
settings[QString("DNSOptions")] = dnsOpt.join(QChar(' '));
}
return ipSettings;
return settings;
}
int IpWidget::isOk()
{
// ip settings is not set
if (ui->checkBox_ip->checkState() == Qt::Checked)
if (ui->comboBox_ip->currentText() == QString("static"))
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;
(ui->lineEdit_gateway->text().isEmpty())) return 1;
// ipv6 settings is not set
if (ui->checkBox_ip6->checkState() == Qt::Checked)
if ((ui->comboBox_ip6->currentText() == QString("static")) ||
(ui->comboBox_ip6->currentText() == QString("stateless")))
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;
(ui->lineEdit_gateway6->text().isEmpty())) return 2;
// all fine
return 0;
}
@ -489,76 +389,67 @@ int IpWidget::isOk()
void IpWidget::setSettings(const QMap<QString, QString> settings)
{
QMap<QString, QString> ipSettings = settings;
clear();
if (ipSettings.contains(QString("IP"))) {
if (ipSettings[QString("IP")].remove(QString("'")) == QString("no"))
if (settings.contains(QString("IP"))) {
if (settings[QString("IP")] == QString("no"))
ui->checkBox_ip->setCheckState(Qt::Unchecked);
else {
ui->checkBox_ip->setCheckState(Qt::Checked);
for (int i=0; i<ui->comboBox_ip->count(); i++)
if (ipSettings[QString("IP")].remove(QString("'")) == ui->comboBox_ip->itemText(i))
ui->comboBox_ip->setCurrentIndex(i);
int index = ui->comboBox_ip->findText(settings[QString("IP")]);
ui->comboBox_ip->setCurrentIndex(index);
}
}
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"))
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"))
ui->checkBox_ip6->setCheckState(Qt::Unchecked);
else {
ui->checkBox_ip6->setCheckState(Qt::Checked);
for (int i=0; i<ui->comboBox_ip6->count(); i++)
if (ipSettings[QString("IP6")].remove(QString("'")) == ui->comboBox_ip6->itemText(i))
ui->comboBox_ip6->setCurrentIndex(i);
int index = ui->comboBox_ip6->findText(settings[QString("IP6")]);
ui->comboBox_ip6->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("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("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"))
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"))
ui->checkBox_dhcp->setCheckState(Qt::Checked);
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(" ")));
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')));
ipEnable(ui->checkBox_ip->checkState());
changeIpMode(ui->comboBox_ip->currentText());

View File

@ -38,7 +38,6 @@ public:
public slots:
void clear();
void setShown(const bool state);
private slots:
// buttons
@ -64,10 +63,6 @@ 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

@ -0,0 +1,83 @@
/***************************************************************************
* 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

@ -0,0 +1,48 @@
/***************************************************************************
* 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

@ -0,0 +1,121 @@
<?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,90 +17,196 @@
#include <QApplication>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDir>
#include <QTextStream>
#include <QLibraryInfo>
#include <QProcessEnvironment>
#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[])
{
QApplication a(argc, 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);
// 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();
// check
QString robotEnv = environment.value(QString("SKYNET"), QString(""));
if (!robotEnv.isEmpty()) {
cout << "Sorry, this software is only for humans" << endl;
return 2;
}
if (configFile.atEnd())
break;
}
configFile.close();
// 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);
QTranslator translator;
translator.load(QString(":/translations/") + language);
translator.load(QString(":/translations/%1").arg(language));
a.installTranslator(&translator);
QString helpMessage = QString("");
helpMessage += QApplication::translate("MainWindow", " Netctl GUI\n");
helpMessage += QApplication::translate("MainWindow", "Version : %1 License : GPLv3\n")
.arg(QString(VERSION));
helpMessage += QApplication::translate("MainWindow", " Evgeniy Alekseev aka arcanis\n");
helpMessage += QApplication::translate("MainWindow", " E-mail : esalexeev@gmail.com\n\n");
helpMessage += QApplication::translate("MainWindow", "Usage:\n");
helpMessage += QApplication::translate("MainWindow", "netctl-gui [ --default ] [ -t NUM | --tab NUM ] [ -h | --help]\n\n");
helpMessage += QApplication::translate("MainWindow", "Parametrs:\n");
helpMessage += QApplication::translate("MainWindow", " --default - start with default settings\n");
helpMessage += QApplication::translate("MainWindow", " -t NUM --tab NUM - open a tab with number NUM\n");
helpMessage += QApplication::translate("MainWindow", " -h --help - show this help and exit\n");
bool defaultSettings = false;
int tabNumber = 0;
for (int i=1; i<argc; i++) {
// help message
if (((argv[i][0] == '-') && (argv[i][1] == 'h') && (argv[i][2] == '\0')) ||
((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 'h') && (argv[i][3] == 'e') &&
(argv[i][4] == 'l') && (argv[i][5] == 'p') && (argv[i][6] == '\0'))) {
cout << helpMessage.toUtf8().data();
// running
if (args[QString("error")].toBool()) {
cout << errorMessage().toUtf8().data() << endl;
cout << helpMessage().toUtf8().data();
return 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;
}
// default settings
else if ((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 'd') && (argv[i][3] == 'e') &&
(argv[i][4] == 'f') && (argv[i][5] == 'a') && (argv[i][6] == 'u') && (argv[i][7] == 'l') &&
(argv[i][8] == 't') && (argv[i][9] == '\0')) {
defaultSettings = true;
}
// tab number
else if (((argv[i][0] == '-') && (argv[i][1] == 't') && (argv[i][2] == '\0')) ||
((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 't') &&
(argv[i][3] == 'a') && (argv[i][4] == 'b') && (argv[i][5] == '\0'))) {
if (atoi(argv[i+1]) > 3)
tabNumber = 3;
else if (atoi(argv[i+1]) < 1)
tabNumber = 1;
else
tabNumber = atoi(argv[i+1]);
i++;
}
}
MainWindow w(0, defaultSettings, tabNumber);
w.show();
// check if exists
if (existingSessionOperation(QString("Active"))) {
if ((getuid() == getUidFromSession(0)) && (geteuid() == getUidFromSession(1))) {
// restore session
cout << QCoreApplication::translate("MainWindow", "Restore existing session.")
.toUtf8().data() << endl;
existingSessionOperation(QString("Restore"));
return 0;
} else if ((getuid() == getUidFromSession(0)) && (geteuid() != getUidFromSession(1))) {
cout << QCoreApplication::translate("MainWindow", "Close existing session.")
.toUtf8().data() << endl;
existingSessionOperation(QString("Close"));
}
}
MainWindow w(0, args, &qtTranslator, &translator);
return a.exec();
}

View File

@ -0,0 +1,436 @@
/***************************************************************************
* 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

@ -0,0 +1,79 @@
/***************************************************************************
* 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

@ -0,0 +1,208 @@
<?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,25 +20,18 @@
#include <QApplication>
#include <QMainWindow>
#include <QTableWidgetItem>
#include <QTreeWidgetItem>
#include <netctlgui/netctlgui.h>
class BridgeWidget;
class ErrorWindow;
class EthernetWidget;
class GeneralWidget;
class IpWidget;
class MobileWidget;
class Netctl;
class NetctlProfile;
class PasswdWidget;
class PppoeWidget;
class AboutWindow;
class MainWidget;
class NetctlAutoWindow;
class NewProfileWidget;
class SettingsWindow;
class TunnelWidget;
class TuntapWidget;
class VlanWidget;
class WirelessWidget;
class WpaSup;
class TrayIcon;
class WiFiMenuWidget;
namespace Ui {
class MainWindow;
@ -49,61 +42,81 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0,
const bool defaultSettings = false,
const int tabNum = 1);
explicit MainWindow(QWidget *parent = nullptr,
const QVariantMap args = QVariantMap(),
QTranslator *qtAppTranslator = nullptr,
QTranslator *appTranslator = nullptr);
~MainWindow();
Netctl *netctlCommand;
NetctlProfile *netctlProfile;
WpaSup *wpaCommand;
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);
public slots:
void updateTabs(const int tab);
// wifi tab slots
void connectToUnknownEssid(const QString passwd);
// 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();
private slots:
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);
void setTabByAction(QAction *action);
void reportABug();
private:
// ui
Ui::MainWindow *ui;
BridgeWidget *bridgeWid;
EthernetWidget *ethernetWid;
GeneralWidget *generalWid;
IpWidget *ipWid;
MobileWidget *mobileWid;
PppoeWidget *pppoeWid;
TunnelWidget *tunnelWid;
TuntapWidget *tuntapWid;
VlanWidget *vlanWid;
WirelessWidget *wirelessWid;
TrayIcon *trayIcon = nullptr;
Ui::MainWindow *ui = nullptr;
AboutWindow *aboutWin = nullptr;
MainWidget *mainWidget = nullptr;
NetctlAutoWindow *netctlAutoWin = nullptr;
NewProfileWidget *newProfileWidget = nullptr;
SettingsWindow *settingsWin = nullptr;
WiFiMenuWidget *wifiMenuWidget = nullptr;
// backend
ErrorWindow *errorWin;
PasswdWidget *passwdWid;
SettingsWindow *settingsWin;
bool checkExternalApps(const QString apps);
bool checkState(const QString state, const QString item);
bool checkHelperStatus();
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,357 +6,35 @@
<rect>
<x>0</x>
<y>0</y>
<width>491</width>
<height>519</height>
<width>600</width>
<height>497</height>
</rect>
</property>
<property name="windowTitle">
<string>Netctl GUI</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="centralLayout">
<item>
<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">
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="Preferred" 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>491</width>
<height>20</height>
<width>600</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuMenu">
@ -364,20 +42,94 @@
<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="QStatusBar" name="statusBar"/>
<action name="actionSettings">
<property name="text">
<string>Settings</string>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>Toolbar</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
<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>
@ -385,24 +137,70 @@
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionSettings">
<property name="icon">
<iconset theme="configure">
<normaloff/>
</iconset>
</property>
<property name="text">
<string>Settings</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="actionNetctl">
<property name="icon">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<property name="text">
<string>netctl control</string>
</property>
<property name="toolTip">
<string>netctl control</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>
</property>
</action>
</widget>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>tableWidget_main</tabstop>
<tabstop>pushButton_mainRefresh</tabstop>
<tabstop>pushButton_mainEnable</tabstop>
<tabstop>pushButton_mainRestart</tabstop>
<tabstop>pushButton_mainStart</tabstop>
<tabstop>lineEdit_profile</tabstop>
<tabstop>pushButton_profile</tabstop>
<tabstop>scrollArea</tabstop>
<tabstop>pushButton_profileClear</tabstop>
<tabstop>pushButton_profileLoad</tabstop>
<tabstop>pushButton_profileSave</tabstop>
<tabstop>tableWidget_wifi</tabstop>
<tabstop>pushButton_wifiRefresh</tabstop>
<tabstop>pushButton_wifiStart</tabstop>
</tabstops>
<resources/>
<resources>
<include location="../../resources/resources.qrc"/>
</resources>
<connections/>
</ui>

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