From 999914926a76d68d03dc2df7b0110f3f6d890aff Mon Sep 17 00:00:00 2001 From: arcan1s Date: Sun, 24 Aug 2014 13:08:13 +0400 Subject: [PATCH] add force* slots --- .gitignore | 2 ++ CHANGELOG | 1 + sources/gui/docs/netctl-gui-dbus-api.html | 10 ++++++++ sources/helper/src/controladaptor.cpp | 12 ++++++++++ sources/helper/src/controladaptor.h | 2 ++ .../include/netctlgui/netctlinteract.h | 14 +++++++++++ sources/netctlgui/src/netctlinteract.cpp | 24 +++++++++++++++++++ 7 files changed, 65 insertions(+) diff --git a/.gitignore b/.gitignore index 77b98f7..a8e4dd9 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ usr/ # translations *.qm +# temporary bckps +*~ diff --git a/CHANGELOG b/CHANGELOG index d215bac..aa8d438 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -36,6 +36,7 @@ Ver.1.3.0 + add slot stopAllProfiles() + add slot reenableProfile() + add slots getRecommendedConfiguration() + + add slots forceStartProfile() and forceStopProfile() + add double quotes to profile names + add tests * rewrite to use [tasks](https://github.com/mhogomchungu/tasks) (see #7) diff --git a/sources/gui/docs/netctl-gui-dbus-api.html b/sources/gui/docs/netctl-gui-dbus-api.html index 39f8b0c..e4c2197 100644 --- a/sources/gui/docs/netctl-gui-dbus-api.html +++ b/sources/gui/docs/netctl-gui-dbus-api.html @@ -112,6 +112,16 @@ th.sub { enables or disables the profile. Returns true if action has been performed successfully yes + + bool forceStart(QString profile) + force starts the profile. Returns true if action has been performed successfully + yes + + + bool forceStop(QString profile) + force stops the profile. Returns true if action has been performed successfully + yes + bool Reenable(QString profile) reenables the profile. Returns true if action has been performed successfully diff --git a/sources/helper/src/controladaptor.cpp b/sources/helper/src/controladaptor.cpp index a5cf4af..8808180 100644 --- a/sources/helper/src/controladaptor.cpp +++ b/sources/helper/src/controladaptor.cpp @@ -186,6 +186,18 @@ bool ControlAdaptor::Enable(const QString profile) } +bool ControlAdaptor::forceStart(const QString profile) +{ + return netctlCommand->forceStartProfile(profile); +} + + +bool ControlAdaptor::forceStop(const QString profile) +{ + return netctlCommand->forceStopProfile(profile); +} + + bool ControlAdaptor::Reenable(const QString profile) { return netctlCommand->reenableProfile(profile); diff --git a/sources/helper/src/controladaptor.h b/sources/helper/src/controladaptor.h index 6e769c6..42ab13d 100644 --- a/sources/helper/src/controladaptor.h +++ b/sources/helper/src/controladaptor.h @@ -57,6 +57,8 @@ public slots: bool autoServiceRestart(); bool autoServiceStart(); bool Enable(const QString profile); + bool forceStart(const QString profile); + bool forceStop(const QString profile); bool Reenable(const QString profile); bool Restart(const QString profile); bool Start(const QString profile); diff --git a/sources/netctlgui/include/netctlgui/netctlinteract.h b/sources/netctlgui/include/netctlgui/netctlinteract.h index 52c3b9a..14607f9 100644 --- a/sources/netctlgui/include/netctlgui/netctlinteract.h +++ b/sources/netctlgui/include/netctlgui/netctlinteract.h @@ -176,6 +176,20 @@ public slots: * @return true if the method was completed without errors */ bool enableProfile(const QString profile); + /** + * @brief method which force starts profile + * @param profile profile name + * @return false if components are not found or command exit code is not equal to 0 + * @return true if the method was completed without errors + */ + bool forceStartProfile(const QString profile); + /** + * @brief method which force stops profile + * @param profile profile name + * @return false if components are not found or command exit code is not equal to 0 + * @return true if the method was completed without errors + */ + bool forceStopProfile(const QString profile); /** * @brief method which reenables profile * @param profile profile name diff --git a/sources/netctlgui/src/netctlinteract.cpp b/sources/netctlgui/src/netctlinteract.cpp index f55b10b..80f3725 100644 --- a/sources/netctlgui/src/netctlinteract.cpp +++ b/sources/netctlgui/src/netctlinteract.cpp @@ -542,6 +542,30 @@ bool Netctl::enableProfile(const QString profile) } +/** + * @fn forceStartProfile + */ +bool Netctl::forceStartProfile(const QString profile) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile; + + return cmdCall(true, netctlCommand, QString("start"), profile); +} + + +/** + * @fn forceStopProfile + */ +bool Netctl::forceStopProfile(const QString profile) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile; + + return cmdCall(true, netctlCommand, QString("stop"), profile); +} + + /** * @fn reenableProfile */