netctlgui  1.2.0
Qt library which interacts with netctl
 All Classes Files Functions
netctlinteract.h
Go to the documentation of this file.
1 /***************************************************************************
2  * This file is part of netctl-gui *
3  * *
4  * netctl-gui is free software: you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation, either version 3 of the *
7  * License, or (at your option) any later version. *
8  * *
9  * netctl-gui is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
16  ***************************************************************************/
26 #ifndef NETCTLINTERACT_H
27 #define NETCTLINTERACT_H
28 
29 #include <QDir>
30 #include <QMap>
31 #include <QObject>
32 
33 
34 class NetctlProfile;
35 
39 class Netctl : public QObject
40 {
41  Q_OBJECT
42 
43 public:
57  explicit Netctl(const bool debugCmd = false,
58  const QMap<QString, QString> settings = QMap<QString, QString>());
62  ~Netctl();
63  // general information
68  QStringList getInterfaceList();
76  QList<QStringList> getProfileList();
84  QList<QStringList> getProfileListFromNetctlAuto();
90  QString getProfileDescription(const QString profile);
96  QStringList getProfileDescriptions(const QStringList profileList);
103  QString getProfileStatus(const QString profile);
110  QStringList getProfileStatuses(const QStringList profileList);
117  bool isProfileActive(const QString profile);
124  bool isProfileEnabled(const QString profile);
131  bool autoIsProfileActive(const QString profile);
138  bool autoIsProfileEnabled(const QString profile);
144  bool isNetctlAutoEnabled();
150  bool isNetctlAutoRunning();
151 
152 public slots:
153  // functions
154  // netctl
161  bool enableProfile(const QString profile);
168  bool restartProfile(const QString profile);
175  bool startProfile(const QString profile);
176  // netctl-auto
182  bool autoDisableAllProfiles();
189  bool autoEnableProfile(const QString profile);
195  bool autoEnableAllProfiles();
202  bool autoStartProfile(const QString profile);
203  // netctl-auto service
209  bool autoEnableService();
215  bool autoRestartService();
221  bool autoStartService();
222 
223 private:
227  NetctlProfile *netctlProfile;
231  bool debug;
235  QDir *ifaceDirectory;
239  QString mainInterface;
243  QString netctlCommand;
247  QString netctlAutoCommand;
251  QString netctlAutoService;
255  QDir *profileDirectory;
259  QString sudoCommand;
263  QString systemctlCommand;
264  // functions
272  QString getNetctlOutput(const bool sudo, const QString commandLine, const QString profile = 0);
281  bool netctlCall(const bool sudo, const QString commandLine, const QString profile = 0);
290  bool netctlAutoCall(const bool sudo, const QString commandLine, const QString profile = 0);
298  bool systemctlCall(const bool sudo, const QString commandLine);
299 };
300 
301 
302 #endif /* NETCTLINTERACT_H */
QString getProfileStatus(const QString profile)
method which gets profile status
bool autoIsProfileActive(const QString profile)
method which checks if profile is active (netctl-auto)
QStringList getProfileStatuses(const QStringList profileList)
method which gets statuses of profile list
bool autoEnableProfile(const QString profile)
method which sets profile disabled or enabled (netctl-auto)
bool restartProfile(const QString profile)
method which restarts profile
QList< QStringList > getProfileListFromNetctlAuto()
method which returns profile informations from netctl-auto
bool autoEnableAllProfiles()
method which sets all profiles enabled (netctl-auto)
bool autoStartProfile(const QString profile)
method which switchs to profile (netctl-auto)
~Netctl()
Netctl class destructor.
bool enableProfile(const QString profile)
method which sets profile disabled or enabled
The NetctlProfile class interacts with netctl profiles.
Definition: netctlprofile.h:37
bool isProfileActive(const QString profile)
method which checks if profile is active
bool isProfileEnabled(const QString profile)
method which checks if profile is enabled
The Netctl class interacts with netctl.
Definition: netctlinteract.h:39
bool autoEnableService()
method which sets netctl-auto service enabled or disabled
QString getProfileDescription(const QString profile)
method which gets description from profile
bool isNetctlAutoEnabled()
method which checks netctl-auto autoload status
bool startProfile(const QString profile)
method which starts or stops profile
QStringList getInterfaceList()
method which gets interface list from PREFERED_IFACE and IFACE_DIR
bool isNetctlAutoRunning()
method which checks netctl-auto status
bool autoRestartService()
method which restarted netctl-auto service
Netctl(const bool debugCmd=false, const QMap< QString, QString > settings=QMap< QString, QString >())
Netctl class constructor.
QList< QStringList > getProfileList()
method which returns profile informations from netctl
QStringList getProfileDescriptions(const QStringList profileList)
method which gets descriptions from profile list
bool autoStartService()
method which starts or stops netctl-auto service
bool autoIsProfileEnabled(const QString profile)
method which checks if profile is enabled (netctl-auto)
bool autoDisableAllProfiles()
method which sets all profiles disabled (netctl-auto)