update man pages

more correct behavior to --daemon option (renamed to --detached)
This commit is contained in:
arcan1s 2014-08-19 11:26:03 +04:00
parent 8b58f6d383
commit 47dc016da2
12 changed files with 140 additions and 35 deletions

View File

@ -64,8 +64,8 @@ Additional information
TODO (wish list) TODO (wish list)
---------------- ----------------
* add helper polkit-qt integration ? * remove suid bit from helper (polkit/logind/etc)
* test several profiles support * option descriptions to /etc/netctlgui-helper.conf
Links Links
----- -----

View File

@ -18,7 +18,7 @@
# variables # variables
_netctl_gui_arglist=( _netctl_gui_arglist=(
'--daemon' '--detached'
'--maximized' '--maximized'
'--minimized' '--minimized'
'--about' '--about'

View File

@ -1,4 +1,4 @@
.TH netctl-gui 1 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "USER COMMANDS" .TH netctl-gui 1 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "General Commands Manual"
.SH NAME .SH NAME
netctl-gui is a graphical interface for netctl netctl-gui is a graphical interface for netctl
.SH SYNOPSIS .SH SYNOPSIS
@ -10,8 +10,8 @@ is a project which provides graphical user interface for
.B netctl .B netctl
written on C++ using Qt toolkit. It provides shared library and DBus API (through helper daemon) and Plasmoid and DataEngine for KDE. written on C++ using Qt toolkit. It provides shared library and DBus API (through helper daemon) and Plasmoid and DataEngine for KDE.
.SH OPTIONS .SH OPTIONS
.IP "--daemon" .IP "--detached"
run as daemon run detached from console
.IP "--maximized" .IP "--maximized"
run maximized run maximized
.IP "--minimized" .IP "--minimized"
@ -64,6 +64,7 @@ Configuration file
.RE .RE
.SH SEE ALSO .SH SEE ALSO
.BR netctlgui-helper (1) .BR netctlgui-helper (1)
.BR netctlgui-helper.conf (5)
.SH STANDARDS .SH STANDARDS
See See
.B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-dbus-api.html .B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-dbus-api.html

View File

@ -63,15 +63,15 @@ int main(int argc, char *argv[])
QMap<QString, QVariant> args = getArgs(); QMap<QString, QVariant> args = getArgs();
// reading // reading
for (int i=1; i<argc; i++) { for (int i=1; i<argc; i++) {
if (QString(argv[i]) == QString("--daemon")) { if (QString(argv[i]) == QString("--detached")) {
// daemonized // detached
args[QString("minimized")] = (int) 1; args[QString("detached")] = true;
} else if (QString(argv[i]) == QString("--maximized")) { } else if (QString(argv[i]) == QString("--maximized")) {
// maximized // maximized
args[QString("minimized")] = (int) 2; args[QString("minimized")] = (int) 1;
} else if (QString(argv[i]) == QString("--minimized")) { } else if (QString(argv[i]) == QString("--minimized")) {
// minimized // minimized
args[QString("minimized")] = (int) 3; args[QString("minimized")] = (int) 2;
} else if (QString(argv[i]) == QString("--about")) { } else if (QString(argv[i]) == QString("--about")) {
// about // about
args[QString("about")] = true; args[QString("about")] = true;
@ -129,13 +129,12 @@ int main(int argc, char *argv[])
args[QString("error")] = true; args[QString("error")] = true;
} }
} }
if ((args[QString("debug")].toBool()) && (args[QString("minimized")].toInt() == 1)) if ((args[QString("debug")].toBool()) ||
args[QString("minimized")] = (int) 0; (args[QString("help")].toBool()) ||
else if ((args[QString("help")].toBool()) ||
(args[QString("info")].toBool()) || (args[QString("info")].toBool()) ||
(args[QString("version")].toBool()) || (args[QString("version")].toBool()) ||
(args[QString("error")].toBool())) (args[QString("error")].toBool()))
args[QString("minimized")] = (int) 0; args[QString("detached")] = false;
if (args[QString("essid")].toString() != QString("ESSID")) if (args[QString("essid")].toString() != QString("ESSID"))
args[QString("tab")] = (int) 3; args[QString("tab")] = (int) 3;
if (args[QString("open")].toString() != QString("PROFILE")) if (args[QString("open")].toString() != QString("PROFILE"))
@ -144,7 +143,7 @@ int main(int argc, char *argv[])
args[QString("tab")] = (int) 1; args[QString("tab")] = (int) 1;
// detach from console // detach from console
if (args[QString("minimized")].toInt() == 1) if (args[QString("detached")].toBool())
daemon(0, 0); daemon(0, 0);
QApplication a(argc, argv); QApplication a(argc, argv);
QApplication::setQuitOnLastWindowClosed(false); QApplication::setQuitOnLastWindowClosed(false);
@ -186,8 +185,7 @@ int main(int argc, char *argv[])
} else if ((getuid() == getUidFromSession(0)) && (geteuid() != getUidFromSession(1))) { } else if ((getuid() == getUidFromSession(0)) && (geteuid() != getUidFromSession(1))) {
cout << QCoreApplication::translate("MainWindow", "Close existing session.") cout << QCoreApplication::translate("MainWindow", "Close existing session.")
.toUtf8().data() << endl; .toUtf8().data() << endl;
existingSessionOperation(QString("Restore")); existingSessionOperation(QString("Close"));
return 0;
} }
} }
MainWindow w(0, args, &qtTranslator, &translator); MainWindow w(0, args, &qtTranslator, &translator);

View File

@ -362,8 +362,6 @@ void MainWindow::updateConfiguration(const QMap<QString, QVariant> args)
createActions(); createActions();
// tray // tray
if (isDaemon)
return;
if ((QSystemTrayIcon::isSystemTrayAvailable()) && if ((QSystemTrayIcon::isSystemTrayAvailable()) &&
(configuration[QString("SYSTRAY")] == QString("true"))) (configuration[QString("SYSTRAY")] == QString("true")))
trayIcon->setVisible(true); trayIcon->setVisible(true);
@ -374,9 +372,9 @@ void MainWindow::updateConfiguration(const QMap<QString, QVariant> args)
hide(); hide();
else else
show(); show();
if (args[QString("minimized")].toInt() == 2) if (args[QString("minimized")].toInt() == 1)
show(); show();
else if (args[QString("minimized")].toInt() == 3) else if (args[QString("minimized")].toInt() == 2)
hide(); hide();
} }
else else

View File

@ -70,10 +70,6 @@ MainWindow::MainWindow(QWidget *parent,
if (debug) qDebug() << PDEBUG << ":" << "settings" << args[QString("settings")].toBool(); if (debug) qDebug() << PDEBUG << ":" << "settings" << args[QString("settings")].toBool();
if (debug) qDebug() << PDEBUG << ":" << "tab" << args[QString("tab")].toInt(); if (debug) qDebug() << PDEBUG << ":" << "tab" << args[QString("tab")].toInt();
if (args[QString("minimized")].toInt() == 1)
isDaemon = true;
else
isDaemon = false;
updateConfiguration(args); updateConfiguration(args);
// main actions // main actions

View File

@ -165,7 +165,6 @@ private:
QString configPath; QString configPath;
bool debug = false; bool debug = false;
bool hiddenNetwork; bool hiddenNetwork;
bool isDaemon = false;
bool useHelper = true; bool useHelper = true;
QTranslator *qtTranslator = nullptr; QTranslator *qtTranslator = nullptr;
QTranslator *translator = nullptr; QTranslator *translator = nullptr;

View File

@ -35,6 +35,7 @@ QMap<QString, QVariant> getArgs()
{ {
QMap<QString, QVariant> args; QMap<QString, QVariant> args;
// windows // windows
args[QString("detached")] = false;
args[QString("minimized")] = (int) 0; args[QString("minimized")] = (int) 0;
args[QString("about")] = false; args[QString("about")] = false;
args[QString("auto")] = false; args[QString("auto")] = false;
@ -67,8 +68,8 @@ QString helpMessage()
helpMessage += QString("%1\n").arg(QApplication::translate("MainWindow", "Options:")); helpMessage += QString("%1\n").arg(QApplication::translate("MainWindow", "Options:"));
// windows // windows
helpMessage += QString(" %1\n").arg(QApplication::translate("MainWindow", "Open window:")); helpMessage += QString(" %1\n").arg(QApplication::translate("MainWindow", "Open window:"));
helpMessage += QString(" --daemon - %1\n") helpMessage += QString(" --detached - %1\n")
.arg(QApplication::translate("MainWindow", "start as daemon")); .arg(QApplication::translate("MainWindow", "start detached from console"));
helpMessage += QString(" --maximized - %1\n") helpMessage += QString(" --maximized - %1\n")
.arg(QApplication::translate("MainWindow", "start maximized")); .arg(QApplication::translate("MainWindow", "start maximized"));
helpMessage += QString(" --minimized - %1\n") helpMessage += QString(" --minimized - %1\n")

View File

@ -19,7 +19,7 @@
# variables # variables
_netctl_gui_arglist=( _netctl_gui_arglist=(
{'--daemon','--daemon'}'[start as daemon]' {'--detached','--detached'}'[start detached from console]'
{'--maximized','--maximized'}'[start maximized]' {'--maximized','--maximized'}'[start maximized]'
{'--minimized','--minimized'}'[start minimized to tray]' {'--minimized','--minimized'}'[start minimized to tray]'
{'--about','--about'}'[show about window]' {'--about','--about'}'[show about window]'

View File

@ -17,12 +17,16 @@ set (HEADERS "")
add_subdirectory (${SUBPROJECT_SOURCE_DIR}) add_subdirectory (${SUBPROJECT_SOURCE_DIR})
# build man # build man
file (GLOB SUBPROJECT_MAN_IN *.1) file (GLOB SUBPROJECT_MAN_IN *.1)
file (GLOB SUBPROJECT_MAN5_IN *.5)
file (RELATIVE_PATH SUBPROJECT_MAN ${CMAKE_SOURCE_DIR} ${SUBPROJECT_MAN_IN}) file (RELATIVE_PATH SUBPROJECT_MAN ${CMAKE_SOURCE_DIR} ${SUBPROJECT_MAN_IN})
file (RELATIVE_PATH SUBPROJECT_MAN5 ${CMAKE_SOURCE_DIR} ${SUBPROJECT_MAN5_IN})
configure_file (${SUBPROJECT_MAN_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN}) configure_file (${SUBPROJECT_MAN_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN})
configure_file (${SUBPROJECT_MAN5_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN5})
install (FILES org.netctlgui.helper.conf DESTINATION ${DBUS_SYSTEMCONF_PATH}) install (FILES org.netctlgui.helper.conf DESTINATION ${DBUS_SYSTEMCONF_PATH})
install (FILES netctlgui-helper.conf DESTINATION /etc) install (FILES netctlgui-helper.conf DESTINATION /etc)
install (FILES netctlgui-helper.service DESTINATION ${SYSTEMD_SERVICE_PATH}) install (FILES netctlgui-helper.service DESTINATION ${SYSTEMD_SERVICE_PATH})
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN} DESTINATION share/man/man1/) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN} DESTINATION share/man/man1/)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN5} DESTINATION share/man/man5/)
install (FILES bash-completions DESTINATION share/bash-completion/completions/ RENAME ${SUBPROJECT}) install (FILES bash-completions DESTINATION share/bash-completion/completions/ RENAME ${SUBPROJECT})
install (FILES zsh-completions DESTINATION share/zsh/site-functions/ RENAME _${SUBPROJECT}) install (FILES zsh-completions DESTINATION share/zsh/site-functions/ RENAME _${SUBPROJECT})

View File

@ -1,4 +1,4 @@
.TH netctlgui-helper 1 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "USER COMMANDS" .TH netctlgui-helper 1 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "General Commands Manual"
.SH NAME .SH NAME
netctlgui-helper is a helper daemon for netctl-gui netctlgui-helper is a helper daemon for netctl-gui
.SH SYNOPSIS .SH SYNOPSIS
@ -14,6 +14,7 @@ without any additional permissions. To have access to DBus interface user should
.IP "-c, --config FILE" .IP "-c, --config FILE"
read configuration from file read configuration from file
.I FILE .I FILE
instead of default user configuration
.IP "-d, --debug" .IP "-d, --debug"
print debug information print debug information
.IP "--nodaemon" .IP "--nodaemon"
@ -32,8 +33,10 @@ show build information and exit
show this help and exit show this help and exit
.SH FILES .SH FILES
.I $HOME/.config/netctl-gui.conf .I $HOME/.config/netctl-gui.conf
,
.I /etc/netctlgui-helper.conf
.RS .RS
Configuration file Configuration files
.RE .RE
.I /usr/lib/systemd/system/netctlgui-helper.service .I /usr/lib/systemd/system/netctlgui-helper.service
.RS .RS
@ -61,6 +64,7 @@ By the way it is highly recommended to copy source service file before to
and edit copied file to avoid upgrade problems. and edit copied file to avoid upgrade problems.
.SH SEE ALSO .SH SEE ALSO
.BR netctl-gui (1) .BR netctl-gui (1)
.BR netctlgui-helper.conf (5)
.SH STANDARDS .SH STANDARDS
See See
.B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-dbus-api.html .B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-dbus-api.html

View File

@ -0,0 +1,104 @@
.TH netctlgui-helper.conf 5 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "File Formats Manual"
.SH NAME
netctlgui-helper.conf is a configuration file of Netctl GUI project
.SH SYNOPSIS
.B /etc/netctlgui-helper.conf
for system-wide configuration or
.B $HOME/.config/netctl-gui.conf
for user one
.SH DESCRIPTION
.B netctlgui-helper.conf
is a file which contains parameters for
.BR netctlgui-helper (1)
and may be used as template for
.BR netctl-gui (1)
configuration also.
.SH OPTIONS
.IP "CLOSE_HELPER=false"
close helper after GUI application quit. This option is not recognized by
.BR netctlgui-helper (1)
.IP "CLOSETOTRAY=true"
hide application to tray on exit if tray is available. This option is not recognized by
.BR netctlgui-helper (1)
.IP "CTRL_DIR=/run/wpa_supplicant_netctl-gui"
path to control directory which is required by
.BR wpa_supplicant (8)
.IP "CTRL_GROUP=users"
group which is owner of
.B CTRL_DIR
.IP "FORCE_SUDO=false"
force use
.B SUDO_PATH
for helper instead of using
.BR setuid (3)
to child processes
.IP "HELPER_PATH=/usr/bin/netctlgui-helper"
path to
.BR netctlgui-helper (1)
This option is not recognized by
.BR netctlgui-helper (1)
.IP "HELPER_SERVICE=netctlgui-helper.service"
.BR netctlgui-helper (1)
service name. This option is not recognized by
.BR netctlgui-helper (1)
.IP "IFACE_DIR=/sys/class/net/"
path to directory which contains interface information
.IP "LANGUAGE=en"
application language
.IP "NETCTL_PATH=/usr/bin/netctl"
path to
.BR netctl (1)
.IP "NETCTLAUTO_PATH=/usr/bin/netctl-auto"
path to
.BR netctl-auto (1)
.IP "NETCTLAUTO_SERVICE=netctl-auto"
.BR netctl-auto (1)
service name without
.I .service
suffix
.IP "PID_FILE=/run/wpa_supplicant_netctl-gui.pid"
.BR wpa_supplicant (8)
PID file
.IP "PREFERED_IFACE="
prefered wireless interface
.IP "PROFILE_DIR=/etc/netctl/"
path to
.BR netctl (1)
profile directory
.IP "RFKILL_DIR=/sys/class/rfkill/"
path to directory with
.BR rfkill (8)
devices. This option is not recognized by
.BR netctlgui-helper (1)
.IP "STARTTOTRAY=false"
start
.BR netctl-gui (1)
minimized to tray if it is available. This option is not recognized by
.BR netctlgui-helper (1)
.IP "SUDO_PATH=/usr/bin/kdesu"
path to
.BR sudo (8)
frontend
.IP "SYSTEMCTL_PATH=/usr/bin/systemctl"
path to
.BR systemctl (1)
.IP "SYSTRAY=true"
create system tray icon. This option is not recognized by
.BR netctlgui-helper (1)
.IP "USE_HELPER=true"
use
.BR netctlgui-helper (1)
if it is available. This option is not recognized by
.BR netctlgui-helper (1)
.IP "WPACLI_PATH=/usr/bin/wpa_cli"
path to
.BR wpa_cli (8)
.IP "WPASUP_PATH=/usr/bin/wpa_supplicant"
path to
.BR wpa_supplicant (8)
.IP "WPA_DRIVERS=nl80211,wext"
.BR wpa_supplicant (8)
drivers for wireless interface comma separated
.SH SEE ALSO
.BR netctl-gui (1)
.BR netctlgui-helper (1)