File indexing completed on 2024-06-23 05:21:19
0001 /* Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com> 0002 0003 This file is part of the Trojita Qt IMAP e-mail client, 0004 http://trojita.flaska.net/ 0005 0006 This program is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU General Public License as 0008 published by the Free Software Foundation; either version 2 of 0009 the License or (at your option) version 3 or any later version 0010 accepted by the membership of KDE e.V. (or its successor approved 0011 by the membership of KDE e.V.), which shall act as a proxy 0012 defined in Section 14 of version 3 of the license. 0013 0014 This program is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 GNU General Public License for more details. 0018 0019 You should have received a copy of the GNU General Public License 0020 along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 */ 0022 0023 #ifndef CLEAR_TEXT_PASSWORD_H 0024 #define CLEAR_TEXT_PASSWORD_H 0025 0026 #include <QString> 0027 0028 #include "Plugins/PasswordPlugin.h" 0029 #include "Plugins/PluginInterface.h" 0030 0031 class QSettings; 0032 0033 using namespace Plugins; 0034 0035 class ClearTextPasswordJob : public PasswordJob 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 enum Type { 0041 Request, 0042 Store, 0043 Delete 0044 }; 0045 0046 ClearTextPasswordJob(const QString &accountId, const QString &accountType, const QString &password, enum Type type, QObject *parent, QSettings *settings); 0047 0048 public slots: 0049 virtual void doStart(); 0050 virtual void doStop(); 0051 0052 private: 0053 QString m_accountId, m_accountType, m_password; 0054 enum Type m_type; 0055 QSettings *m_settings; 0056 }; 0057 0058 class ClearTextPassword : public PasswordPlugin 0059 { 0060 Q_OBJECT 0061 0062 public: 0063 ClearTextPassword(QObject *parent, QSettings *settings); 0064 virtual Features features() const; 0065 0066 public slots: 0067 virtual PasswordJob *requestPassword(const QString &accountId, const QString &accountType); 0068 virtual PasswordJob *storePassword(const QString &accountId, const QString &accountType, const QString &password); 0069 virtual PasswordJob *deletePassword(const QString &accountId, const QString &accountType); 0070 0071 private: 0072 QSettings *m_settings; 0073 }; 0074 0075 class trojita_plugin_ClearTextPasswordPlugin : public QObject, public PasswordPluginInterface 0076 { 0077 Q_OBJECT 0078 Q_INTERFACES(Plugins::PasswordPluginInterface) 0079 Q_PLUGIN_METADATA(IID "net.flaska.trojita.plugins.password.cleartext") 0080 0081 public: 0082 QString name() const override; 0083 QString description() const override; 0084 PasswordPlugin *create(QObject *parent, QSettings *settings) override; 0085 private: 0086 }; 0087 0088 #endif //CLEAR_TEXT_PASSWORD_H 0089 0090 // vim: set et ts=4 sts=4 sw=4