KNewStuff

question.h
1 /*
2  This file is part of KNewStuffCore.
3  SPDX-FileCopyrightText: 2016 Dan Leinir Turthra Jensen <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7 
8 #ifndef KNS3_QUESTION_H
9 #define KNS3_QUESTION_H
10 
11 #include <QObject>
12 
13 #include "knewstuffcore_export.h"
14 
15 namespace KNSCore
16 {
41 class KNEWSTUFFCORE_EXPORT Question : public QObject
42 {
43  Q_OBJECT
44 public:
45  enum Response {
46  InvalidResponse = 0,
47  YesResponse = 1,
48  NoResponse = 2,
49  ContinueResponse = 3,
50  CancelResponse = 4,
51  OKResponse = YesResponse
52  };
53  Q_ENUM(Response)
54 
55  enum QuestionType {
56  YesNoQuestion = 0,
57  ContinueCancelQuestion = 1,
58  InputTextQuestion = 2,
59  SelectFromListQuestion = 3,
60  PasswordQuestion = 4
61  };
62  Q_ENUM(QuestionType)
63 
64  explicit Question(QuestionType = YesNoQuestion, QObject *parent = nullptr);
65  virtual ~Question();
66 
67  Response ask();
68 
69  void setQuestionType(QuestionType newType = YesNoQuestion);
70  QuestionType questionType() const;
71 
72  void setQuestion(const QString &newQuestion);
73  QString question() const;
74  void setTitle(const QString &newTitle);
75  QString title() const;
76  void setList(const QStringList &newList);
77  QStringList list() const;
78 
83  void setResponse(Response response);
90  void setResponse(const QString &response);
91  QString response() const;
92 private:
93  class Private;
94  Private* d;
95 };
96 }
97 
98 #endif//KNS3_QUESTION_H
A way to ask a user a question from inside a GUI-less library (like KNewStuffCore) ...
Definition: question.h:41
Contains the core functionality for handling interaction with NewStuff providers. ...
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 22:43:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.