libquentier  0.5.0
The library for rich desktop clients of Evernote service
IKeychainService.h
1 /*
2  * Copyright 2018-2019 Dmitry Ivanov
3  *
4  * This file is part of libquentier
5  *
6  * libquentier is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, version 3 of the License.
9  *
10  * libquentier is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef LIB_QUENTIER_PRIVATE_UTILITY_I_KEYCHAIN_SERVICE_H
20 #define LIB_QUENTIER_PRIVATE_UTILITY_I_KEYCHAIN_SERVICE_H
21 
22 #include <quentier/utility/Linkage.h>
23 #include <quentier/utility/Macros.h>
24 #include <quentier/types/ErrorString.h>
25 
26 #include <QObject>
27 #include <QUuid>
28 
29 namespace quentier {
30 
31 class QUENTIER_EXPORT IKeychainService: public QObject
32 {
33  Q_OBJECT
34 protected:
35  explicit IKeychainService(QObject * parent = nullptr) : QObject(parent) {}
36 
37 public:
38  virtual ~IKeychainService() {}
39 
43  struct ErrorCode
44  {
45  enum type {
49  NoError = 0,
77  OtherError
78  };
79  };
80 
81  friend QTextStream & operator<<(QTextStream & strm,
82  const ErrorCode::type errorCode);
83 
84 public:
85  virtual QUuid startWritePasswordJob(const QString & service,
86  const QString & key,
87  const QString & password) = 0;
88  virtual QUuid startReadPasswordJob(const QString & service,
89  const QString & key) = 0;
90  virtual QUuid startDeletePasswordJob(const QString & service,
91  const QString & key) = 0;
92 
93 Q_SIGNALS:
94  void writePasswordJobFinished(QUuid requestId, ErrorCode::type errorCode,
95  ErrorString errorDescription);
96  void readPasswordJobFinished(QUuid requestId, ErrorCode::type errorCode,
97  ErrorString errorDescription, QString password);
98  void deletePasswordJobFinished(QUuid requestId, ErrorCode::type errorCode,
99  ErrorString errorDescription);
100 
101 private:
102  Q_DISABLE_COPY(IKeychainService);
103 };
104 
105 } // namespace quentier
106 
107 #endif // LIB_QUENTIER_PRIVATE_UTILITY_I_KEYCHAIN_SERVICE_H
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:44
Definition: IKeychainService.h:32
Definition: IKeychainService.h:44
type
Definition: IKeychainService.h:45
@ CouldNotDeleteEntry
Definition: IKeychainService.h:57
@ AccessDenied
Definition: IKeychainService.h:65
@ NoBackendAvailable
Definition: IKeychainService.h:69
@ EntryNotFound
Definition: IKeychainService.h:53
@ NotImplemented
Definition: IKeychainService.h:73
@ AccessDeniedByUser
Definition: IKeychainService.h:61