File indexing completed on 2024-05-19 04:50:12

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Shane King <kde@dontletsstart.com>                                *
0003  * Copyright (c) 2009 Leo Franchi <lfranchi@kde.org>                                    *
0004  * Copyright (c) 2010 Stefan Derkits <stefan@derkits.at>                                *
0005  * Copyright (c) 2010 Christian Wagner <christian.wagner86@gmx.at>                      *
0006  * Copyright (c) 2010 Felix Winter <ixos01@gmail.com>                                   * 
0007  *                                                                                      *
0008  * This program is free software; you can redistribute it and/or modify it under        *
0009  * the terms of the GNU General Public License as published by the Free Software        *
0010  * Foundation; either version 2 of the License, or (at your option) any later           *
0011  * version.                                                                             *
0012  *                                                                                      *
0013  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0014  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0015  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0016  *                                                                                      *
0017  * You should have received a copy of the GNU General Public License along with         *
0018  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0019  ****************************************************************************************/
0020 
0021 #ifndef GPODDERSERVICECONFIG_H
0022 #define GPODDERSERVICECONFIG_H
0023 
0024 #include <QObject>
0025 #include <QString>
0026 
0027 namespace KWallet { class Wallet; }
0028 
0029 class QMessageBox;
0030 
0031 #ifdef MAKE_GPODDER_SERVICE_CONFIG_LIB
0032 #define GPODDER_CONFIG_EXPORT Q_DECL_EXPORT
0033 #else
0034 #define GPODDER_CONFIG_EXPORT Q_DECL_IMPORT
0035 #endif
0036 
0037 class GPODDER_CONFIG_EXPORT GpodderServiceConfig : public QObject
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     static const char *configSectionName() { return "Service_gpodder"; }
0043 
0044     GpodderServiceConfig();
0045     ~GpodderServiceConfig() override;
0046 
0047     void load();
0048     void save();
0049     void reset();
0050 
0051     const QString &username() { return m_username; }
0052     void setUsername( const QString &username ) { m_username = username; }
0053 
0054     const QString &password() { return m_password; }
0055     void setPassword( const QString &password ) { m_password = password; }
0056 
0057     bool enableProvider() { return m_enableProvider; }
0058     void setEnableProvider( bool enableProvider ) { m_enableProvider = enableProvider; }
0059 
0060     bool ignoreWallet() { return m_ignoreWallet; }
0061     void setIgnoreWallet( bool ignoreWallet ) { m_ignoreWallet = ignoreWallet; }
0062 
0063     bool isDataLoaded() { return m_isDataLoaded; }
0064 
0065 private Q_SLOTS:
0066     void textDialogYes();
0067     void textDialogNo();
0068 
0069 private:
0070     void askAboutMissingKWallet();
0071     void tryToOpenWallet();
0072 
0073     QString m_username;
0074     QString m_password;
0075     bool m_enableProvider; //Enables PodcastProvider if correct LoginData given
0076     bool m_ignoreWallet;
0077     bool m_isDataLoaded;
0078 
0079     QMessageBox *m_askDiag;
0080     KWallet::Wallet *m_wallet;
0081 };
0082 
0083 #endif // GPODDERSERVICECONFIG_H