1 /* Copyright (C) 2006 - 2014 Jan Kundrát <jkt@flaska.net>
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 TROJITA_UIUTILS_PASSWORDWATCHER_H
24 #define TROJITA_UIUTILS_PASSWORDWATCHER_H
27 #include "Plugins/PasswordPlugin.h"
35 /** @short Process password requests from plugins */
36 class PasswordWatcher
: public QObject
40 Q_PROPERTY(bool isStorageEncrypted READ isStorageEncrypted NOTIFY backendMaybeChanged
)
41 Q_PROPERTY(bool isWaitingForPlugin READ isWaitingForPlugin NOTIFY stateChanged
)
42 Q_PROPERTY(bool isPluginAvailable READ isPluginAvailable NOTIFY stateChanged
)
43 Q_PROPERTY(QString progressMessage READ progressMessage NOTIFY stateChanged
)
44 Q_PROPERTY(QString password READ password NOTIFY stateChanged
)
45 Q_PROPERTY(bool didReadOk READ didReadOk NOTIFY stateChanged
)
46 Q_PROPERTY(bool didWriteOk READ didWriteOk NOTIFY stateChanged
)
49 PasswordWatcher(QObject
*parent
, Plugins::PluginManager
*manager
, const QString
&accountName
, const QString
&accountType
);
51 bool isStorageEncrypted() const;
52 bool isWaitingForPlugin() const;
53 bool isPluginAvailable() const;
54 bool didReadOk() const;
55 bool didWriteOk() const;
56 QString
progressMessage() const;
57 QString
password() const;
60 void reloadPassword();
61 void setPassword(const QString
&password
);
64 void passwordRetrieved(const QString
&password
);
65 void passwordReadingFailed(const Plugins::PasswordJob::Error errorCode
, const QString
&errorMessage
);
66 void passwordWritten();
67 void passwordWritingFailed(const Plugins::PasswordJob::Error errorCode
, const QString
&errorMessage
);
70 void backendMaybeChanged();
72 void readingFailed(const QString
&message
);
73 void savingFailed(const QString
&message
);
78 Plugins::PluginManager
*m_manager
;
79 bool m_isStorageEncrypted
;
85 QString m_accountName
;
86 QString m_accountType
;
87 QString m_progressMessage
;
94 #endif // TROJITA_UIUTILS_PASSWORDWATCHER_H