KService

kautostart.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2006 Aaron Seigo <[email protected]>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library 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 GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef KDELIBS_KAUTOSTART_H
21 #define KDELIBS_KAUTOSTART_H
22 
23 #include <kservice_export.h>
24 
25 #include <QObject>
26 class KAutostartPrivate;
27 
28 class QStringList;
29 
52 class KSERVICE_EXPORT KAutostart : public QObject
53 {
54  Q_OBJECT
55 
56 public:
78  explicit KAutostart(const QString &entryName = QString(),
79  QObject *parent = nullptr);
80  ~KAutostart();
81 
87  enum Condition {
91  NoConditions = 0x0,
95  CheckCommand = 0x1,
100  CheckCondition = 0x2,
105  CheckAll = 0xff
106  };
110  Q_DECLARE_FLAGS(Conditions, Condition)
111 
112 
115  enum StartPhase {
119  BaseDesktop = 0,
126  DesktopServices = 1,
132  Applications = 2
133  };
134 
141  void setAutostarts(bool autostart);
142 
151  bool autostarts(const QString &environment = QString(),
152  Conditions check = NoConditions) const;
153 
158  QString command() const;
163  void setCommand(const QString &command);
164 
169  QString visibleName() const;
174  void setVisibleName(const QString &entryName);
175 
182  static bool isServiceRegistered(const QString &entryName);
183 
190  QString commandToCheck() const;
196  void setCommandToCheck(const QString &exec);
197 
206  StartPhase startPhase() const;
215  void setStartPhase(StartPhase phase);
216 
229  QStringList allowedEnvironments() const;
234  void setAllowedEnvironments(const QStringList &environments);
240  void addToAllowedEnvironments(const QString &environment);
246  void removeFromAllowedEnvironments(const QString &environment);
247 
258  QStringList excludedEnvironments() const;
263  void setExcludedEnvironments(const QStringList &environments);
269  void addToExcludedEnvironments(const QString &environment);
275  void removeFromExcludedEnvironments(const QString &environment);
276 
283  QString startAfter() const;
284 
290  bool checkAllowedEnvironment(const QString &environment) const;
291 
298  static bool isStartConditionMet(const QString &condition);
299 
300 private:
301  bool checkStartCondition() const;
302  KAutostartPrivate *const d;
303 };
304 
305 Q_DECLARE_OPERATORS_FOR_FLAGS(KAutostart::Conditions)
306 #endif
Condition
Flags for each of the conditions that may affect whether or not a service actually autostarted on log...
Definition: kautostart.h:87
KAutostart provides a programmatic means to control the state of autostart services on a per-user bas...
Definition: kautostart.h:52
StartPhase
Enumerates the various autostart phases that occur during start-up.
Definition: kautostart.h:115
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jul 6 2020 22:47:00 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.