mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
better submodules integration (hope =))
add --session support to the helper
This commit is contained in:
parent
0c7868536a
commit
b909222db9
12
.gitmodules
vendored
12
.gitmodules
vendored
@ -1,12 +1,12 @@
|
|||||||
[submodule "sources/3rdparty/task"]
|
|
||||||
path = sources/3rdparty/task
|
|
||||||
url = https://github.com/arcan1s/qtadds-task.git
|
|
||||||
[submodule "sources/3rdparty/tasks"]
|
[submodule "sources/3rdparty/tasks"]
|
||||||
path = sources/3rdparty/tasks
|
path = sources/3rdparty/tasks
|
||||||
url = https://github.com/mhogomchungu/tasks.git
|
url = https://github.com/mhogomchungu/tasks.git
|
||||||
[submodule "sources/3rdparty/language"]
|
|
||||||
path = sources/3rdparty/language
|
|
||||||
url = https://github.com/arcan1s/qtadds-language.git
|
|
||||||
[submodule "sources/3rdparty/pdebug"]
|
[submodule "sources/3rdparty/pdebug"]
|
||||||
path = sources/3rdparty/pdebug
|
path = sources/3rdparty/pdebug
|
||||||
url = https://github.com/arcan1s/qtadds-pdebug.git
|
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
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>680</width>
|
<width>678</width>
|
||||||
<height>397</height>
|
<height>395</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -73,7 +73,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../resources/resources.qrc">
|
<iconset resource="../../resources/resources.qrc">
|
||||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
<normaloff>:/icon-helper.png</normaloff>:/icon-helper.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -136,8 +136,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>464</width>
|
<width>462</width>
|
||||||
<height>336</height>
|
<height>330</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
@ -218,8 +218,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>397</width>
|
<width>462</width>
|
||||||
<height>256</height>
|
<height>330</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||||
@ -389,7 +389,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>436</width>
|
<width>436</width>
|
||||||
<height>165</height>
|
<height>173</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
@ -576,7 +576,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>436</width>
|
<width>436</width>
|
||||||
<height>43</height>
|
<height>45</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
@ -646,7 +646,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>277</width>
|
<width>277</width>
|
||||||
<height>190</height>
|
<height>194</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||||
@ -843,7 +843,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>436</width>
|
<width>436</width>
|
||||||
<height>103</height>
|
<height>107</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||||
|
@ -25,6 +25,7 @@ _netctlgui_helper_arglist=(
|
|||||||
'--nodaemon'
|
'--nodaemon'
|
||||||
'--replace'
|
'--replace'
|
||||||
'--restore'
|
'--restore'
|
||||||
|
'--session'
|
||||||
'--system'
|
'--system'
|
||||||
'-v'
|
'-v'
|
||||||
'--version'
|
'--version'
|
||||||
|
@ -23,6 +23,8 @@ do not run as daemon
|
|||||||
force replace the existing session
|
force replace the existing session
|
||||||
.IP "--restore"
|
.IP "--restore"
|
||||||
force restore the existing session
|
force restore the existing session
|
||||||
|
.IP "--session"
|
||||||
|
force create user DBus session
|
||||||
.IP "--system"
|
.IP "--system"
|
||||||
do not read user configuration
|
do not read user configuration
|
||||||
.IP "-v, --version"
|
.IP "-v, --version"
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=netctlgui-helper daemon
|
Description=netctlgui-helper daemon
|
||||||
|
Documentation=man:netctlgui-helper(1) man:netctl-gui.conf(5)
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=dbus
|
||||||
ExecStart=/usr/bin/netctlgui-helper --system
|
BusName=org.netctlgui.helper
|
||||||
|
ExecStart=/usr/bin/netctlgui-helper --nodaemon --system
|
||||||
|
Capabilities=CAP_SETUID
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
@ -47,14 +47,14 @@ else ()
|
|||||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||||
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||||
endforeach ()
|
endforeach ()
|
||||||
add_custom_target (translations-header COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} -ts ${TRANSLATIONS})
|
add_custom_target (translations-helper COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} -ts ${TRANSLATIONS})
|
||||||
add_custom_command (TARGET translations-header COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
add_custom_command (TARGET translations-helper COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable (${SUBPROJECT} ${SOURCES} ${HEADERS} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
add_executable (${SUBPROJECT} ${SOURCES} ${HEADERS} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
||||||
target_link_libraries (${SUBPROJECT} ${PROJECT_LIBRARY} ${QT_NEEDED_LIBS})
|
target_link_libraries (${SUBPROJECT} ${PROJECT_LIBRARY} ${QT_NEEDED_LIBS})
|
||||||
# install properties
|
# install properties
|
||||||
install (TARGETS ${SUBPROJECT} DESTINATION bin)
|
install (TARGETS ${SUBPROJECT} DESTINATION bin)
|
||||||
if (USE_CAPABILITIES)
|
# if (USE_CAPABILITIES)
|
||||||
install (CODE "exec_program (setcap ARGS \"cap_setuid=ep\" \"$ENV{DESTDIR}/bin/${SUBPROJECT}\")")
|
# install (CODE "exec_program (setcap ARGS \"cap_setuid=ep\" \"$ENV{DESTDIR}/bin/${SUBPROJECT}\")")
|
||||||
endif ()
|
# endif ()
|
||||||
|
@ -68,6 +68,9 @@ int main(int argc, char *argv[])
|
|||||||
} else if (QString(argv[i]) == QString("--restore")) {
|
} else if (QString(argv[i]) == QString("--restore")) {
|
||||||
// restore
|
// restore
|
||||||
args[QString("state")] = (int) 2;
|
args[QString("state")] = (int) 2;
|
||||||
|
} else if (QString(argv[i]) == QString("--session")) {
|
||||||
|
// session
|
||||||
|
args[QString("session")] = true;
|
||||||
} else if (QString(argv[i]) == QString("--system")) {
|
} else if (QString(argv[i]) == QString("--system")) {
|
||||||
// system
|
// system
|
||||||
args[QString("system")] = true;
|
args[QString("system")] = true;
|
||||||
@ -96,6 +99,7 @@ int main(int argc, char *argv[])
|
|||||||
.arg(QString::number(geteuid())).toUtf8().data() << endl;
|
.arg(QString::number(geteuid())).toUtf8().data() << endl;
|
||||||
cout << QCoreApplication::translate("NetctlHelper", "See security notes for more details.")
|
cout << QCoreApplication::translate("NetctlHelper", "See security notes for more details.")
|
||||||
.toUtf8().data() << endl;
|
.toUtf8().data() << endl;
|
||||||
|
args[QString("session")] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
|
@ -37,6 +37,7 @@ QMap<QString, QVariant> getArgs()
|
|||||||
args[QString("config")] = QString(QDir::homePath() + QString("/.config/netctl-gui.conf"));
|
args[QString("config")] = QString(QDir::homePath() + QString("/.config/netctl-gui.conf"));
|
||||||
args[QString("debug")] = false;
|
args[QString("debug")] = false;
|
||||||
args[QString("nodaemon")] = false;
|
args[QString("nodaemon")] = false;
|
||||||
|
args[QString("session")] = false;
|
||||||
args[QString("state")] = (int) 0;
|
args[QString("state")] = (int) 0;
|
||||||
args[QString("system")] = false;
|
args[QString("system")] = false;
|
||||||
args[QString("help")] = false;
|
args[QString("help")] = false;
|
||||||
@ -65,6 +66,8 @@ QString helpMessage()
|
|||||||
.arg(QCoreApplication::translate("NetctlHelper", "force replace the existing session"));
|
.arg(QCoreApplication::translate("NetctlHelper", "force replace the existing session"));
|
||||||
helpMessage += QString(" --restore - %1\n")
|
helpMessage += QString(" --restore - %1\n")
|
||||||
.arg(QCoreApplication::translate("NetctlHelper", "force restore the existing session"));
|
.arg(QCoreApplication::translate("NetctlHelper", "force restore the existing session"));
|
||||||
|
helpMessage += QString(" --session - %1\n")
|
||||||
|
.arg(QCoreApplication::translate("NetctlHelper", "force create user DBus session"));
|
||||||
helpMessage += QString(" --system - %1\n")
|
helpMessage += QString(" --system - %1\n")
|
||||||
.arg(QCoreApplication::translate("NetctlHelper", "do not read user configuration, system-wide only"));
|
.arg(QCoreApplication::translate("NetctlHelper", "do not read user configuration, system-wide only"));
|
||||||
helpMessage += QString(" %1\n").arg(QCoreApplication::translate("NetctlHelper", "Show messages:"));
|
helpMessage += QString(" %1\n").arg(QCoreApplication::translate("NetctlHelper", "Show messages:"));
|
||||||
|
@ -35,6 +35,7 @@ NetctlHelper::NetctlHelper(QObject *parent, QMap<QString, QVariant> args)
|
|||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
configPath(args[QString("config")].toString()),
|
configPath(args[QString("config")].toString()),
|
||||||
debug(args[QString("debug")].toBool()),
|
debug(args[QString("debug")].toBool()),
|
||||||
|
session(args[QString("session")].toBool()),
|
||||||
system(args[QString("system")].toBool())
|
system(args[QString("system")].toBool())
|
||||||
{
|
{
|
||||||
updateConfiguration();
|
updateConfiguration();
|
||||||
@ -88,6 +89,28 @@ void NetctlHelper::createInterface()
|
|||||||
if (debug) qDebug() << PDEBUG << ":" << bus.lastError().message();
|
if (debug) qDebug() << PDEBUG << ":" << bus.lastError().message();
|
||||||
return quitHelper();
|
return quitHelper();
|
||||||
}
|
}
|
||||||
|
// session bus
|
||||||
|
if (!session) return;
|
||||||
|
QDBusConnection sessionBus = QDBusConnection::sessionBus();
|
||||||
|
if (!sessionBus.registerService(DBUS_HELPER_SERVICE)) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Could not register session service";
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << sessionBus.lastError().message();
|
||||||
|
return quitHelper();
|
||||||
|
}
|
||||||
|
if (!sessionBus.registerObject(DBUS_LIB_PATH,
|
||||||
|
new NetctlAdaptor(this, debug, configuration),
|
||||||
|
QDBusConnection::ExportAllContents)) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Could not register session library object";
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << sessionBus.lastError().message();
|
||||||
|
return quitHelper();
|
||||||
|
}
|
||||||
|
if (!sessionBus.registerObject(DBUS_CTRL_PATH,
|
||||||
|
new ControlAdaptor(this, debug, configuration),
|
||||||
|
QDBusConnection::ExportAllContents)) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Could not register session control object";
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << sessionBus.lastError().message();
|
||||||
|
return quitHelper();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -98,6 +121,11 @@ void NetctlHelper::deleteInterface()
|
|||||||
QDBusConnection::systemBus().unregisterObject(DBUS_LIB_PATH);
|
QDBusConnection::systemBus().unregisterObject(DBUS_LIB_PATH);
|
||||||
QDBusConnection::systemBus().unregisterObject(DBUS_CTRL_PATH);
|
QDBusConnection::systemBus().unregisterObject(DBUS_CTRL_PATH);
|
||||||
QDBusConnection::systemBus().unregisterService(DBUS_HELPER_SERVICE);
|
QDBusConnection::systemBus().unregisterService(DBUS_HELPER_SERVICE);
|
||||||
|
// session bus
|
||||||
|
if (!session) return;
|
||||||
|
QDBusConnection::sessionBus().unregisterObject(DBUS_LIB_PATH);
|
||||||
|
QDBusConnection::sessionBus().unregisterObject(DBUS_CTRL_PATH);
|
||||||
|
QDBusConnection::sessionBus().unregisterService(DBUS_HELPER_SERVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ private:
|
|||||||
QString configPath;
|
QString configPath;
|
||||||
QMap<QString, QString> configuration;
|
QMap<QString, QString> configuration;
|
||||||
bool debug;
|
bool debug;
|
||||||
|
bool session;
|
||||||
bool system;
|
bool system;
|
||||||
void createInterface();
|
void createInterface();
|
||||||
void deleteInterface();
|
void deleteInterface();
|
||||||
|
@ -24,6 +24,7 @@ _netctlgui_helper_arglist=(
|
|||||||
{'--nodaemon','--nodaemon'}'[do not start as daemon]'
|
{'--nodaemon','--nodaemon'}'[do not start as daemon]'
|
||||||
{'--replace','--replace'}'[force replace the existing session]'
|
{'--replace','--replace'}'[force replace the existing session]'
|
||||||
{'--restore','--restore'}'[force restore the existing session]'
|
{'--restore','--restore'}'[force restore the existing session]'
|
||||||
|
{'--session','--session'}'[force create user DBus session]'
|
||||||
{'--system','--system'}'[do not read user configuration]'
|
{'--system','--system'}'[do not read user configuration]'
|
||||||
{'(--version)-v','(-v)--version'}'[show version and exit]'
|
{'(--version)-v','(-v)--version'}'[show version and exit]'
|
||||||
{'(--info)-i','(-i)--info'}'[show build information and exit]'
|
{'(--info)-i','(-i)--info'}'[show build information and exit]'
|
||||||
|
BIN
sources/resources/icon-helper.png
Normal file
BIN
sources/resources/icon-helper.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -5,6 +5,7 @@
|
|||||||
<file>translations/ru.qm</file>
|
<file>translations/ru.qm</file>
|
||||||
<!-- icons -->
|
<!-- icons -->
|
||||||
<file>icon.png</file>
|
<file>icon.png</file>
|
||||||
|
<file>icon-helper.png</file>
|
||||||
<file>wifi.png</file>
|
<file>wifi.png</file>
|
||||||
<file>network-idle-64x64.png</file>
|
<file>network-idle-64x64.png</file>
|
||||||
<file>network-offline-64x64.png</file>
|
<file>network-offline-64x64.png</file>
|
||||||
|
Loading…
Reference in New Issue
Block a user