KDeclarative

configmodule.h
1 /*
2  This file is part of the KDE libraries
3 
4  SPDX-FileCopyrightText: 1999 Matthias Hoelzer-Kluepfel <[email protected]>
5  SPDX-FileCopyrightText: 2001 Michael Goffioul <[email protected]>
6  SPDX-FileCopyrightText: 2004 Frans Englich <[email protected]>
7  SPDX-FileCopyrightText: 2009 Dario Freddi <[email protected]>
8  SPDX-FileCopyrightText: 2015 Marco Martin <[email protected]>
9 
10  SPDX-License-Identifier: LGPL-2.0-or-later
11 */
12 
13 #ifndef CONFIGMODULE_H
14 #define CONFIGMODULE_H
15 
16 #include "quickaddons_export.h"
17 
18 #include <QVariant>
19 #include <QObject>
20 #include <QtQml>
21 
22 #include <KPluginMetaData>
23 
24 class QStringList;
25 class KAboutData;
26 class QQuickItem;
27 class QQmlEngine;
28 
29 namespace KQuickAddons {
30 
31 class ConfigModulePrivate;
32 
114 class QUICKADDONS_EXPORT ConfigModule : public QObject
115 {
116  Q_OBJECT
117 
118  Q_PROPERTY(QQuickItem *mainUi READ mainUi CONSTANT)
119  Q_PROPERTY(KQuickAddons::ConfigModule::Buttons buttons READ buttons WRITE setButtons NOTIFY buttonsChanged)
120  Q_PROPERTY(bool needsSave READ needsSave WRITE setNeedsSave NOTIFY needsSaveChanged)
121  Q_PROPERTY(bool representsDefaults READ representsDefaults WRITE setRepresentsDefaults NOTIFY representsDefaultsChanged)
122  Q_PROPERTY(QString name READ name CONSTANT)
123  Q_PROPERTY(QString description READ description CONSTANT)
124  Q_PROPERTY(QString quickHelp READ quickHelp WRITE setQuickHelp NOTIFY quickHelpChanged)
125  Q_PROPERTY(QString rootOnlyMessage READ rootOnlyMessage WRITE setRootOnlyMessage NOTIFY rootOnlyMessageChanged)
126  Q_PROPERTY(bool useRootOnlyMessage READ useRootOnlyMessage WRITE setUseRootOnlyMessage NOTIFY useRootOnlyMessageChanged)
127  Q_PROPERTY(bool needsAuthorization READ needsAuthorization WRITE setNeedsAuthorization NOTIFY needsAuthorizationChanged)
128  Q_PROPERTY(int columnWidth READ columnWidth WRITE setColumnWidth NOTIFY columnWidthChanged)
129  Q_PROPERTY(int depth READ depth NOTIFY depthChanged)
130  Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
131  Q_PROPERTY(int defaultsIndicatorsVisible READ defaultsIndicatorsVisible WRITE setDefaultsIndicatorsVisible NOTIFY defaultsIndicatorsVisibleChanged)
132 
133 public:
134 
142  enum Button {
143  NoAdditionalButton = 0,
144  Help = 1,
145  Default = 2,
146  Apply = 4
147  };
148  Q_ENUM(Button)
149  Q_DECLARE_FLAGS(Buttons, Button)
150  Q_FLAG(Buttons)
151 
152 
159  explicit ConfigModule(const KAboutData *aboutData, QObject *parent = nullptr, const QVariantList &args = QVariantList());
160 
167  explicit ConfigModule(const KPluginMetaData &metaData, QObject *parent = nullptr, const QVariantList &args = QVariantList());
168 
175  explicit ConfigModule(QObject *parent = nullptr, const QVariantList &args = QVariantList());
176 
180  ~ConfigModule();
181 
189  const KAboutData *aboutData() const;
190 
195  void setAboutData(const KAboutData *about);
196 
207  void setAuthActionName(const QString &action);
208 
214  QString authActionName() const;
215 
216 
220  QQmlEngine *engine() const;
221 
226  QQmlComponent::Status status() const;
227 
232  QString errorString() const;
233 
234 //QML property accessors
235 
241  QQuickItem *mainUi();
242 
243  /*
244  * @return a subpage at a given depth
245  * @note This does not include the mainUi. i.e a depth of 2 is a mainUi and one subPage
246  * at index 0
247  */
248  QQuickItem *subPage(int index) const;
249 
253  void setQuickHelp(const QString &help);
254 
264  QString quickHelp() const;
265 
270  void setNeedsSave(bool needs);
271 
275  bool needsSave();
276 
281  void setRepresentsDefaults(bool defaults);
282 
286  bool representsDefaults();
287 
302  void setButtons(const Buttons btn);
303 
312  Buttons buttons() const;
313 
314 
323  void setRootOnlyMessage(const QString &message);
324 
337  QString rootOnlyMessage() const;
338 
339 
348  void setUseRootOnlyMessage(bool on);
349 
360  bool useRootOnlyMessage() const;
361 
362 
380  void setNeedsAuthorization(bool needsAuth);
381 
387  bool needsAuthorization() const;
388 
393  QString name() const;
394 
399  QString description() const;
400 
408  int columnWidth() const;
409 
414  void setColumnWidth(int width);
415 
420  int depth() const;
421 
426  void setCurrentIndex(int index);
427 
432  int currentIndex() const;
433 
434  static ConfigModule *qmlAttachedProperties(QObject *object);
435 
440  bool defaultsIndicatorsVisible() const;
441 
442 public Q_SLOTS:
456  virtual void load();
457 
472  virtual void save();
473 
480  virtual void defaults();
481 
486  void push(const QString &fileName, const QVariantMap &propertyMap = QVariantMap());
487 
491  void push(QQuickItem *item);
492 
497  void pop();
498 
507  void showPassiveNotification(const QString &message, const QVariant &timeout = QVariant(), const QString &actionText = QString(), const QJSValue &callBack = QJSValue());
508 
514  void setDefaultsIndicatorsVisible(bool visible);
515 
516 Q_SIGNALS:
517 
521  void authActionNameChanged();
522 
523  //QML NOTIFY signaling
527  void buttonsChanged();
528 
537  void quickHelpChanged();
538 
546  void needsSaveChanged();
547 
553  void representsDefaultsChanged();
554 
558  void needsAuthorizationChanged();
559 
566  void rootOnlyMessageChanged();
567 
571  void useRootOnlyMessageChanged();
572 
577  void pagePushed(QQuickItem *page);
578 
583  //RFC: page argument?
584  void pageRemoved();
585 
590  void columnWidthChanged(int width);
591 
596  void currentIndexChanged(int index);
597 
602  void depthChanged(int index);
603 
608  void passiveNotificationRequested(const QString &message, const QVariant &timeout, const QString &actionText, const QJSValue &callBack);
609 
614  void defaultsIndicatorsVisibleChanged();
615 
616 private:
617  ConfigModulePrivate *const d;
618 };
619 
620 }
621 
622 Q_DECLARE_OPERATORS_FOR_FLAGS(KQuickAddons::ConfigModule::Buttons)
623 QML_DECLARE_TYPEINFO(KQuickAddons::ConfigModule, QML_HAS_ATTACHED_PROPERTIES)
624 
625 #endif //ConfigModule_H
626 
Button
An enumeration type for the buttons used by this module.
Definition: configmodule.h:142
The base class for configuration modules.
Definition: configmodule.h:114
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 22:44:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.