mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
add additional docs to helper
This commit is contained in:
parent
0b2cc3ba79
commit
2ff76e9c8e
@ -65,7 +65,6 @@ TODO (wish list)
|
||||
----------------
|
||||
|
||||
* plasmoid helper integration
|
||||
* helper shell completions
|
||||
* gui helper|systemd integration
|
||||
* helper uid/euid check to allow use /Ctrl interface
|
||||
* include security notes / project architecture to about window
|
||||
|
@ -3,16 +3,20 @@
|
||||
netctl-gui is a graphical interface for netctl
|
||||
.SH SYNOPSIS
|
||||
.B netctl-gui
|
||||
[ --about ] [ --netctl-auto ] [ --settings ]
|
||||
[ -e ESSID | --essid ESSID ] [ -o PROFILE | --open PROFILE ]
|
||||
[ -s PROFILE | --select PROFILE ]
|
||||
[ --config FILE ] [ -d | --debug ] [ --default ]
|
||||
[ --set-opts OPTIONS ] [ -t NUM | --tab NUM ]
|
||||
[ -v | --version ] [ -i | --info ] [ -h | --help]
|
||||
[ options ]
|
||||
.SH DESCRIPTION
|
||||
Graphical user interface for netctl written on C++ using Qt toolkit. Provides shared library for interaction with netctl and Plasmoid and DataEngine for KDE.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
--daemon
|
||||
run as daemon
|
||||
.TP
|
||||
--maximized
|
||||
run maximized
|
||||
.TP
|
||||
--minimized
|
||||
run to system tray if it is available
|
||||
.TP
|
||||
--about
|
||||
show about window
|
||||
.TP
|
||||
@ -31,7 +35,7 @@ open profile PROFILE. This option will set tab to 2 automatically
|
||||
-s, --select PROFILE
|
||||
select profile PROFILE. This option will set tab to 1 automatically
|
||||
.TP
|
||||
--config FILE
|
||||
-c, --config FILE
|
||||
read configuration from file FILE
|
||||
.TP
|
||||
-d, --debug
|
||||
|
@ -48,29 +48,7 @@ bool restoreExistSession()
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// detach from console
|
||||
bool debugFlag = false;
|
||||
bool daemonFlag = false;
|
||||
for (int i=0; i<argc; i++)
|
||||
if (QString(argv[i]) == QString("--daemon"))
|
||||
daemonFlag = true;
|
||||
else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug")))
|
||||
debugFlag = true;
|
||||
if ((daemonFlag) && (!debugFlag))
|
||||
daemon(0, 0);
|
||||
QApplication a(argc, argv);
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
// check if exists
|
||||
if (restoreExistSession())
|
||||
return 0;
|
||||
|
||||
QMap<QString, QVariant> args = getArgs();
|
||||
// translation
|
||||
QString language = Language::defineLanguage(args[QString("config")].toString());
|
||||
QTranslator translator;
|
||||
translator.load(QString(":/translations/") + language);
|
||||
a.installTranslator(&translator);
|
||||
|
||||
// reading
|
||||
for (int i=1; i<argc; i++) {
|
||||
// windows
|
||||
@ -162,6 +140,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if ((args[QString("debug")].toBool()) && (args[QString("minimized")].toInt() == 1))
|
||||
args[QString("minimized")] = (int) 0;
|
||||
else if ((args[QString("help")].toBool()) ||
|
||||
(args[QString("info")].toBool()) ||
|
||||
(args[QString("version")].toBool()) ||
|
||||
(args[QString("error")].toBool()))
|
||||
args[QString("minimized")] = (int) 0;
|
||||
if (args[QString("essid")].toString() != QString("ESSID"))
|
||||
args[QString("tab")] = (int) 3;
|
||||
if (args[QString("open")].toString() != QString("PROFILE"))
|
||||
@ -169,10 +152,18 @@ int main(int argc, char *argv[])
|
||||
if (args[QString("select")].toString() != QString("PROFILE"))
|
||||
args[QString("tab")] = (int) 1;
|
||||
|
||||
// detach from console
|
||||
if (args[QString("minimized")].toInt() == 1)
|
||||
daemon(0, 0);
|
||||
QApplication a(argc, argv);
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
// check if exists
|
||||
if (restoreExistSession())
|
||||
return 0;
|
||||
// reread translations according to flags
|
||||
a.removeTranslator(&translator);
|
||||
language = Language::defineLanguage(args[QString("config")].toString(),
|
||||
QString language = Language::defineLanguage(args[QString("config")].toString(),
|
||||
args[QString("options")].toString());
|
||||
QTranslator translator;
|
||||
translator.load(QString(":/translations/") + language);
|
||||
a.installTranslator(&translator);
|
||||
|
||||
|
@ -10,5 +10,13 @@ set (TARGETS "")
|
||||
set (HEADERS "")
|
||||
|
||||
add_subdirectory (${SUBPROJECT_SOURCE_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 org.netctlgui.helper.conf DESTINATION ${DBUS_SYSTEMCONF_PATH})
|
||||
install (FILES netctlgui-helper.service DESTINATION ${SYSTEMD_SERVICE_PATH})
|
||||
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})
|
||||
|
49
sources/helper/bash-completions
Normal file
49
sources/helper/bash-completions
Normal file
@ -0,0 +1,49 @@
|
||||
###########################################################################
|
||||
# This file is part of netctl-gui #
|
||||
# #
|
||||
# netctl-gui is free software: you can redistribute it and/or #
|
||||
# modify it under the terms of the GNU General Public License as #
|
||||
# published by the Free Software Foundation, either version 3 of the #
|
||||
# License, or (at your option) any later version. #
|
||||
# #
|
||||
# netctl-gui is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with netctl-gui. If not, see http://www.gnu.org/licenses/ #
|
||||
###########################################################################
|
||||
|
||||
|
||||
# variables
|
||||
_netctlgui_helper_arglist=(
|
||||
'--nodaemon'
|
||||
'-c'
|
||||
'--config'
|
||||
'-d'
|
||||
'--debug'
|
||||
'-v'
|
||||
'--version'
|
||||
'-i'
|
||||
'--info'
|
||||
'-h'
|
||||
'--help'
|
||||
)
|
||||
|
||||
# work block
|
||||
_netctlgui_helper() {
|
||||
COMPREPLY=()
|
||||
wantfiles='-@(c|-config)'
|
||||
_get_comp_words_by_ref cur prev words cword
|
||||
|
||||
if [[ $prev = $wantfiles ]]; then
|
||||
_filedir
|
||||
else
|
||||
COMPREPLY=($(compgen -W '${_netctlgui_helper[@]}' -- "$cur"))
|
||||
fi
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
complete -F _netctlgui_helper netctlgui-helper
|
41
sources/helper/netctlgui-helper.1
Normal file
41
sources/helper/netctlgui-helper.1
Normal file
@ -0,0 +1,41 @@
|
||||
.TH netctlgui-helper 1 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "USER COMMANDS"
|
||||
.SH NAME
|
||||
netctlgui-helper is a helper daemon for netctl-gui
|
||||
.SH SYNOPSIS
|
||||
.B netctlgui-helper
|
||||
[ options ]
|
||||
.SH DESCRIPTION
|
||||
Qt based helper daemon which provides a DBus interface for interaction with netctl without any additional permissions.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
--nodaemon
|
||||
do not run as daemon
|
||||
.TP
|
||||
-c, --config FILE
|
||||
read configuration from file FILE
|
||||
.TP
|
||||
-d, --debug
|
||||
print debug information
|
||||
.TP
|
||||
-v, --version
|
||||
show version and exit
|
||||
.TP
|
||||
-i, --info
|
||||
show build information and exit
|
||||
.TP
|
||||
-h, --help
|
||||
show this help and exit
|
||||
.SH FILES
|
||||
.TP
|
||||
$HOME/.config/netctl-gui.conf
|
||||
Configuration file
|
||||
.TP
|
||||
/usr/lib/systemd/system/netctlgui-helper.service
|
||||
Systemd service file
|
||||
.TP
|
||||
/etc/dbus-1/system.d/org.netctlgui.helper.conf
|
||||
DBus policy configuration file
|
||||
.SH AUTHOR
|
||||
@PROJECT_AUTHOR@ <\fI@PROJECT_CONTACT@\fR>
|
||||
.SH LICENSE
|
||||
This software is licensed under @PROJECT_LICENSE@
|
@ -3,12 +3,12 @@
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
|
||||
<!-- Only root or user avahi can own the service -->
|
||||
<!-- only root can own the service -->
|
||||
<policy user="root">
|
||||
<allow own="org.netctlgui.helper"/>
|
||||
</policy>
|
||||
|
||||
<!-- Allow everything, including access to SetHostName to users of the group "users" -->
|
||||
<!-- allow everything to users of the group "users" -->
|
||||
<policy group="users">
|
||||
<allow send_destination="org.netctlgui.helper"/>
|
||||
<allow receive_sender="org.netctlgui.helper"/>
|
||||
@ -17,4 +17,4 @@
|
||||
<allow send_destination="org.netctlgui.helper"/>
|
||||
<allow receive_sender="org.netctlgui.helper"/>
|
||||
</policy>
|
||||
</busconfig>
|
||||
</busconfig>
|
||||
|
@ -47,24 +47,6 @@ bool checkExistSession()
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// detach from console
|
||||
bool debugFlag = false;
|
||||
bool daemonFlag = true;
|
||||
for (int i=0; i<argc; i++)
|
||||
if (QString(argv[i]) == QString("--nodaemon"))
|
||||
daemonFlag = false;
|
||||
else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug")))
|
||||
debugFlag = true;
|
||||
if ((daemonFlag) && (!debugFlag))
|
||||
daemon(0, 0);
|
||||
#if QT_VERSION >= 0x050000
|
||||
QCoreApplication::setSetuidAllowed(true);
|
||||
#endif
|
||||
QCoreApplication a(argc, argv);
|
||||
// check if exists
|
||||
if (checkExistSession())
|
||||
return 0;
|
||||
|
||||
QMap<QString, QVariant> args = getArgs();
|
||||
// reading
|
||||
for (int i=1; i<argc; i++) {
|
||||
@ -98,7 +80,7 @@ int main(int argc, char *argv[])
|
||||
args[QString("error")] = true;
|
||||
}
|
||||
}
|
||||
if ((args[QString("debug")].toBool()) && (!args[QString("nodaemon")].toBool()))
|
||||
if (args[QString("debug")].toBool())
|
||||
args[QString("nodaemon")] = true;
|
||||
|
||||
// running
|
||||
@ -120,6 +102,18 @@ int main(int argc, char *argv[])
|
||||
cout << versionMessage().toUtf8().data();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// detach from console
|
||||
if (!args[QString("nodaemon")].toBool())
|
||||
daemon(0, 0);
|
||||
#if QT_VERSION >= 0x050000
|
||||
QCoreApplication::setSetuidAllowed(true);
|
||||
#endif
|
||||
QCoreApplication a(argc, argv);
|
||||
// check if exists
|
||||
if (checkExistSession())
|
||||
return 0;
|
||||
|
||||
NetctlHelper w(0, args);
|
||||
return a.exec();
|
||||
}
|
||||
|
44
sources/helper/zsh-completions
Normal file
44
sources/helper/zsh-completions
Normal file
@ -0,0 +1,44 @@
|
||||
#compdef netctlgui-helper
|
||||
###########################################################################
|
||||
# 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
|
||||
_netctlgui_helper_arglist=(
|
||||
{'--nodaemon','--nodaemon'}'[do not start as daemon]'
|
||||
{'(--config)-c','(-c)--config'}'[read configuration from this file]:select file:->files'
|
||||
{'(--debug)-d','(-d)--debug'}'[print debug information]'
|
||||
{'(--version)-v','(-v)--version'}'[show version and exit]'
|
||||
{'(--info)-i','(-i)--info'}'[show build information and exit]'
|
||||
{'(--help)-h','(-h)--help'}'[show help and exit]'
|
||||
)
|
||||
|
||||
# work block
|
||||
_netctlgui_helper() {
|
||||
_arguments $_netctlgui_helper_arglist
|
||||
case "$state" in
|
||||
files)
|
||||
_files
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "$service" in
|
||||
netctlgui-helper)
|
||||
_netctlgui_helper "$@" && return 0
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue
Block a user