Merge "persistent color scheme selection"
[trojita.git] / src / Plugins / PasswordPlugin.h
blobb8d458316a3b67834d4214612af21c54a5f128e6
1 /* Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com>
3 This file is part of the Trojita Qt IMAP e-mail client,
4 http://trojita.flaska.net/
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of
9 the License or (at your option) version 3 or any later version
10 accepted by the membership of KDE e.V. (or its successor approved
11 by the membership of KDE e.V.), which shall act as a proxy
12 defined in Section 14 of version 3 of the license.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef PASSWORD_INTERFACE
24 #define PASSWORD_INTERFACE
26 #include <QObject>
27 #include <QString>
29 #include "PluginJob.h"
31 namespace Plugins
34 class PLUGINMANAGER_EXPORT PasswordJob : public PluginJob
36 Q_OBJECT
38 public:
39 /** @short Error emitted by error signal */
40 enum Error {
41 UnknownError, /**< Unknown error */
42 Stopped, /**< Emitted when job stopped */
43 NoSuchPassword /**< Emitted when password is not available */
46 signals:
47 /** @short Emitted when password is available */
48 void passwordAvailable(const QString &password);
50 /** @short Emitted when job finish storing password */
51 void passwordStored();
53 /** @short Emitted when job finish deleting password */
54 void passwordDeleted();
56 /** @short Emitted when job finish unsuccessful with error */
57 void error(const Plugins::PasswordJob::Error error, const QString &errorMessage);
59 protected:
60 PasswordJob(QObject *parent);
63 class PLUGINMANAGER_EXPORT PasswordPlugin : public QObject
65 Q_OBJECT
67 public:
68 /** @short Features returned by method features */
69 enum Feature {
70 FeatureEncryptedStorage = 1 << 0 /**< Plugin using encrypted storage */
73 Q_DECLARE_FLAGS(Features, Feature)
75 /** @short Return implementation features */
76 virtual Features features() const = 0;
78 public slots:
79 /** @short Request password associated with accountId and accountType and return PasswordJob */
80 virtual PasswordJob *requestPassword(const QString &accountId, const QString &accountType) = 0;
82 /** @short Save password for accountId and accountType and return PasswordJob */
83 virtual PasswordJob *storePassword(const QString &accountId, const QString &accountType, const QString &password) = 0;
85 /** @short Delete password for accountId and accountType and return PasswordJob */
86 virtual PasswordJob *deletePassword(const QString &accountId, const QString &accountType) = 0;
88 protected:
89 PasswordPlugin(QObject *parent);
92 Q_DECLARE_OPERATORS_FOR_FLAGS(PasswordPlugin::Features)
96 #endif //PASSWORD_INTERFACE
98 // vim: set et ts=4 sts=4 sw=4