KNewStuff
atticahelper.h
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2010 Frederik Gladhorn <gladhorn@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public 00015 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef KNEWSTUFF3_ATTICAHELPER_H 00019 #define KNEWSTUFF3_ATTICAHELPER_H 00020 00021 #include <QtCore/QStringList> 00022 00023 #include <attica/providermanager.h> 00024 #include <attica/provider.h> 00025 00026 #include <attica/category.h> 00027 #include <attica/content.h> 00028 #include <attica/license.h> 00029 00030 class KJob; 00031 namespace KIO { 00032 class Job; 00033 class TransferJob; 00034 } 00035 00036 namespace KNS3 00037 { 00038 00039 class AtticaHelper : public QObject 00040 { 00041 Q_OBJECT 00042 public: 00043 explicit AtticaHelper(QObject *parent = 0); 00044 void init(); 00045 00046 void setCurrentProvider(const QString& provider); 00047 00048 Attica::Provider provider(); 00049 00050 void checkLogin(const QString& name, const QString& password); 00051 bool loadCredentials(QString& name, QString& password); 00052 bool saveCredentials(const QString& name, const QString& password); 00053 void loadCategories(const QStringList& configuredCategories); 00054 void loadContentByCurrentUser(); 00055 void loadLicenses(); 00056 void loadDetailsLink(const QString& contentId); 00057 void loadContent(const QString& contentId); 00058 void loadCurrency(); 00059 void loadPreviews(const QString& contentId); 00060 00061 Q_SIGNALS: 00062 void loginChecked(bool); 00063 void providersLoaded(const QStringList&); 00064 void categoriesLoaded(Attica::Category::List); 00065 void contentByCurrentUserLoaded(const Attica::Content::List&); 00066 void licensesLoaded(const Attica::License::List&); 00067 void detailsLinkLoaded(const QUrl&); 00068 void contentLoaded(const Attica::Content&); 00069 void currencyLoaded(const QString&); 00070 void previewLoaded(int index, const QImage& image); 00071 00072 private Q_SLOTS: 00073 void checkLoginFinished(Attica::BaseJob* baseJob); 00074 void defaultProvidersLoaded(); 00075 void categoriesLoaded(Attica::BaseJob* baseJob); 00076 void contentByCurrentUserLoaded(Attica::BaseJob* baseJob); 00077 void licensesLoaded(Attica::BaseJob* baseJob); 00078 void detailsLinkLoaded(Attica::BaseJob* baseJob); 00079 void contentLoaded(Attica::BaseJob* baseJob); 00080 void currencyLoaded(Attica::BaseJob* baseJob); 00081 00082 void slotPreviewData(KIO::Job* job, const QByteArray& buf); 00083 void slotPreviewDownload(KJob *job); 00084 00085 00086 private: 00087 Attica::ProviderManager providerManager; 00088 Attica::Provider currentProvider; 00089 Attica::Category::List m_validCategories; 00090 00091 QString m_username; 00092 QStringList m_configuredCategories; 00093 Attica::Content::List m_userCreatedContent; 00094 00095 QByteArray m_previewBuffer[3]; 00096 KIO::TransferJob* m_previewJob[3]; 00097 00098 Q_DISABLE_COPY(AtticaHelper) 00099 }; 00100 } 00101 00102 #endif
KDE 4.6 API Reference