diff --git a/src/aboutdialog/libattica-ocsclient/CMakeLists.txt b/src/aboutdialog/libattica-ocsclient/CMakeLists.txt deleted file mode 100644 index 4ee0f755d5..0000000000 --- a/src/aboutdialog/libattica-ocsclient/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -set(ocsclient_SRCS - providerinitjob.cpp - eventjob.cpp - eventlistjob.cpp - eventparser.cpp - event.cpp - activity.cpp - activityparser.cpp - activitylistjob.cpp - person.cpp - personparser.cpp - personjob.cpp - personlistjob.cpp - provider.cpp - postjob.cpp - folder.cpp - folderlistjob.cpp - folderparser.cpp - message.cpp - messagelistjob.cpp - messageparser.cpp - category.cpp - categorylistjob.cpp - categoryparser.cpp - content.cpp - contentjob.cpp - contentlistjob.cpp - contentparser.cpp - knowledgebase.cpp - knowledgebasejob.cpp - knowledgebaselistjob.cpp - knowledgebaseparser.cpp - ) - - - -add_library(amarokocsclient SHARED ${ocsclient_SRCS}) -set_target_properties(amarokocsclient PROPERTIES VERSION 1.0.0 SOVERSION 1) - -target_link_libraries(amarokocsclient Qt5::Core Qt5::Gui KF5::KIOCore KF5::I18n) - -install(TARGETS amarokocsclient ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/src/aboutdialog/libattica-ocsclient/TODO b/src/aboutdialog/libattica-ocsclient/TODO deleted file mode 100644 index cca6e2eaac..0000000000 --- a/src/aboutdialog/libattica-ocsclient/TODO +++ /dev/null @@ -1,2 +0,0 @@ -- Combine List job with single item job? - diff --git a/src/aboutdialog/libattica-ocsclient/activity.cpp b/src/aboutdialog/libattica-ocsclient/activity.cpp deleted file mode 100644 index 5d8a331497..0000000000 --- a/src/aboutdialog/libattica-ocsclient/activity.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "activity.h" - -#include - - -using namespace AmarokAttica; - -class Activity::Private : public QSharedData { - public: - QString m_id; - QString m_user; - QDateTime m_timestamp; - QString m_message; - QString m_link; -}; - -Activity::Activity() : d(new Private) -{ -} - -Activity::Activity(const AmarokAttica::Activity& other) - : d(other.d) -{ -} - -Activity& Activity::operator=(const AmarokAttica::Activity & other) -{ - d = other.d; - return *this; -} - -Activity::~Activity() -{ -} - - -void Activity::setId( const QString &id ) -{ - d->m_id = id; -} - -QString Activity::id() const -{ - return d->m_id; -} - -void Activity::setUser( const QString &u ) -{ - d->m_user = u; -} - -QString Activity::user() const -{ - return d->m_user; -} - -void Activity::setTimestamp( const QDateTime &date ) -{ - d->m_timestamp = date; -} - -QDateTime Activity::timestamp() const -{ - return d->m_timestamp; -} - -void Activity::setMessage( const QString &c ) -{ - d->m_message = c; -} - -QString Activity::message() const -{ - return d->m_message; -} - -void Activity::setLink( const QString &v ) -{ - d->m_link = v; -} - -QString Activity::link() const -{ - return d->m_link; -} diff --git a/src/aboutdialog/libattica-ocsclient/activity.h b/src/aboutdialog/libattica-ocsclient/activity.h deleted file mode 100644 index 7b917bd7fc..0000000000 --- a/src/aboutdialog/libattica-ocsclient/activity.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_ACTIVITY_H -#define ATTICA_ACTIVITY_H - -#include -#include - -#include "atticaclient_export.h" - - -class QDateTime; - -namespace AmarokAttica { - - -class ATTICA_EXPORT Activity -{ - public: - typedef QList List; - - Activity(); - Activity(const Activity& other); - Activity& operator=(const Activity& other); - ~Activity(); - - void setId( const QString & ); - QString id() const; - - void setUser( const QString & ); - QString user() const; - - void setTimestamp( const QDateTime & ); - QDateTime timestamp() const; - - void setMessage( const QString & ); - QString message() const; - - void setLink( const QString & ); - QString link() const; - - private: - class Private; - QSharedDataPointer d; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/activitylistjob.cpp b/src/aboutdialog/libattica-ocsclient/activitylistjob.cpp deleted file mode 100644 index 85f9957312..0000000000 --- a/src/aboutdialog/libattica-ocsclient/activitylistjob.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "activitylistjob.h" - -#include "activityparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -ActivityListJob::ActivityListJob() - : m_job( ) -{ -} - -void ActivityListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void ActivityListJob::start() -{ - QTimer::singleShot( 0, this, &ActivityListJob::doWork ); -} - -Activity::List ActivityListJob::ActivityList() const -{ - return m_activityList; -} - -void ActivityListJob::doWork() -{ - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &ActivityListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &ActivityListJob::slotJobData ); - - m_job = job; -} - -void ActivityListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - // qDebug() << m_data; - m_activityList = ActivityParser().parseList( - QString::fromUtf8( m_data.data() ) ); - - emitResult(); - } -} - -void ActivityListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/activitylistjob.h b/src/aboutdialog/libattica-ocsclient/activitylistjob.h deleted file mode 100644 index e215967e3c..0000000000 --- a/src/aboutdialog/libattica-ocsclient/activitylistjob.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_ACTIVITYLISTJOB_H -#define ATTICA_ACTIVITYLISTJOB_H - -#include -#include - -#include "activity.h" - - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT ActivityListJob : public KJob -{ - Q_OBJECT - public: - ActivityListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Activity::List ActivityList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Activity::List m_activityList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/activityparser.cpp b/src/aboutdialog/libattica-ocsclient/activityparser.cpp deleted file mode 100644 index f6f6f0081c..0000000000 --- a/src/aboutdialog/libattica-ocsclient/activityparser.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "activityparser.h" - -#include -#include -#include - - -using namespace AmarokAttica; - -ActivityParser::ActivityParser() -{ -} - -Activity::List ActivityParser::parseList( const QString &xmlString ) -{ - Activity::List activityList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "activity" ) { - Activity activity; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - activity.setId( xml.readElementText() ); - } else if ( xml.name() == "personid" ) { - activity.setUser( xml.readElementText() ); - } else if ( xml.name() == "timestamp" ) { - QString timestampString = xml.readElementText(); - timestampString.remove( QRegExp("\\+.*$") ); - QDateTime timestamp = QDateTime::fromString( timestampString, - Qt::ISODate ); - activity.setTimestamp( timestamp ); - } else if ( xml.name() == "message" ) { - activity.setMessage( xml.readElementText() ); - } else if ( xml.name() == "link" ) { - activity.setLink( xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "activity" ) break; - } - - activityList.append( activity ); - } - } - - return activityList; -} diff --git a/src/aboutdialog/libattica-ocsclient/activityparser.h b/src/aboutdialog/libattica-ocsclient/activityparser.h deleted file mode 100644 index e2a2c61a46..0000000000 --- a/src/aboutdialog/libattica-ocsclient/activityparser.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_ACTIVITYPARSER_H -#define ATTICA_ACTIVITYPARSER_H - -#include "activity.h" - - -namespace AmarokAttica { - -class ActivityParser -{ - public: - ActivityParser(); - - Activity::List parseList( const QString &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/atticaclient_export.h b/src/aboutdialog/libattica-ocsclient/atticaclient_export.h deleted file mode 100644 index 381f6b6698..0000000000 --- a/src/aboutdialog/libattica-ocsclient/atticaclient_export.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (c) 2008 Dirk Mueller - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_EXPORT_H -#define ATTICA_EXPORT_H - -/* needed for Q_DECL_EXPORT and Q_DECL_IMPORT macros */ -#include - -#ifndef ATTICA_EXPORT -# if defined(MAKE_AMAROKOCSCLIENT_LIB) - /* We are building this library */ -# define ATTICA_EXPORT Q_DECL_EXPORT -# else - /* We are using this library */ -# define ATTICA_EXPORT Q_DECL_IMPORT -# endif -#endif - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/category.cpp b/src/aboutdialog/libattica-ocsclient/category.cpp deleted file mode 100644 index 9440e22a14..0000000000 --- a/src/aboutdialog/libattica-ocsclient/category.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "category.h" - -#include - - -using namespace AmarokAttica; - -class Category::Private : public QSharedData { - public: - QString m_id; - QString m_name; -}; - - -Category::Category() : d(new Private) -{ -} - -Category::Category(const AmarokAttica::Category& other) - : d(other.d) -{ -} - -Category& Category::operator=(const AmarokAttica::Category & other) -{ - d = other.d; - return *this; -} - -Category::~Category() -{ -} - - -void Category::setId( const QString &u ) -{ - d->m_id = u; -} - -QString Category::id() const -{ - return d->m_id; -} - -void Category::setName( const QString &name ) -{ - d->m_name = name; -} - -QString Category::name() const -{ - return d->m_name; -} diff --git a/src/aboutdialog/libattica-ocsclient/category.h b/src/aboutdialog/libattica-ocsclient/category.h deleted file mode 100644 index 8a5677da82..0000000000 --- a/src/aboutdialog/libattica-ocsclient/category.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_CATEGORY_H -#define ATTICA_CATEGORY_H - -#include -#include - -#include "atticaclient_export.h" - - -namespace AmarokAttica { - - -class ATTICA_EXPORT Category -{ - public: - typedef QList List; - - Category(); - Category(const Category& other); - Category& operator=(const Category& other); - ~Category(); - - void setId( const QString & ); - QString id() const; - - void setName( const QString & ); - QString name() const; - - private: - class Private; - QSharedDataPointer d; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/categorylistjob.cpp b/src/aboutdialog/libattica-ocsclient/categorylistjob.cpp deleted file mode 100644 index 99cbe1d5e9..0000000000 --- a/src/aboutdialog/libattica-ocsclient/categorylistjob.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "categorylistjob.h" - -#include "categoryparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -CategoryListJob::CategoryListJob() - : m_job( ) -{ -} - -void CategoryListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void CategoryListJob::start() -{ - QTimer::singleShot( 0, this, &CategoryListJob::doWork ); -} - -Category::List CategoryListJob::categoryList() const -{ - return m_categoryList; -} - -void CategoryListJob::doWork() -{ - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &CategoryListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &CategoryListJob::slotJobData ); - - m_job = job; -} - -void CategoryListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - m_categoryList = CategoryParser().parseList( - QString::fromUtf8( m_data.data() ) ); - - emitResult(); - } -} - -void CategoryListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/categorylistjob.h b/src/aboutdialog/libattica-ocsclient/categorylistjob.h deleted file mode 100644 index bf713aae47..0000000000 --- a/src/aboutdialog/libattica-ocsclient/categorylistjob.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_CATEGORYLISTJOB_H -#define ATTICA_CATEGORYLISTJOB_H - -#include "category.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT CategoryListJob : public KJob -{ - Q_OBJECT - public: - CategoryListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Category::List categoryList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Category::List m_categoryList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/categoryparser.cpp b/src/aboutdialog/libattica-ocsclient/categoryparser.cpp deleted file mode 100644 index 7f763aef17..0000000000 --- a/src/aboutdialog/libattica-ocsclient/categoryparser.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "categoryparser.h" - -#include - -using namespace AmarokAttica; - -CategoryParser::CategoryParser() -{ -} - -Category::List CategoryParser::parseList( const QString &xmlString ) -{ - Category::List categoryList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "category" ) { - Category category; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - category.setId( xml.readElementText() ); - } else if ( xml.name() == "name" ) { - category.setName( xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "category" ) break; - } - - categoryList.append( category ); - } - } - - return categoryList; -} diff --git a/src/aboutdialog/libattica-ocsclient/categoryparser.h b/src/aboutdialog/libattica-ocsclient/categoryparser.h deleted file mode 100644 index c3fce94380..0000000000 --- a/src/aboutdialog/libattica-ocsclient/categoryparser.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_CATEGORYPARSER_H -#define ATTICA_CATEGORYPARSER_H - -#include "category.h" - - -namespace AmarokAttica { - -class CategoryParser -{ - public: - CategoryParser(); - - Category::List parseList( const QString &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/content.cpp b/src/aboutdialog/libattica-ocsclient/content.cpp deleted file mode 100644 index 6a39dee49d..0000000000 --- a/src/aboutdialog/libattica-ocsclient/content.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "content.h" - -#include - - -using namespace AmarokAttica; - -class Content::Private : public QSharedData { - public: - QDateTime m_created; - int m_downloads; - QString m_id; - QString m_name; - int m_rating; - QDateTime m_updated; - - QMap m_extendedAttributes; - - Private() - : m_downloads(0), - m_rating(0) - { - } -}; - - -Content::Content() - : d(new Private) -{ -} - -Content::Content(const AmarokAttica::Content& other) - : d(other.d) -{ -} - -Content& Content::operator=(const AmarokAttica::Content & other) -{ - d = other.d; - return *this; -} - -Content::~Content() -{ -} - - -void Content::setId( const QString &u ) -{ - d->m_id = u; -} - -QString Content::id() const -{ - return d->m_id; -} - -void Content::setName( const QString &name ) -{ - d->m_name = name; -} - -QString Content::name() const -{ - return d->m_name; -} - -void Content::setRating( int v ) -{ - d->m_rating = v; -} - -int Content::rating() const -{ - return d->m_rating; -} - -void Content::setDownloads( int v ) -{ - d->m_downloads = v; -} - -int Content::downloads() const -{ - return d->m_downloads; -} - -void Content::setCreated( const QDateTime &date ) -{ - d->m_created = date; -} - -QDateTime Content::created() const -{ - return d->m_created; -} - -void Content::setUpdated( const QDateTime &date ) -{ - d->m_updated = date; -} - -QDateTime Content::updated() const -{ - return d->m_updated; -} - -void Content::addExtendedAttribute( const QString &key, const QString &value ) -{ - d->m_extendedAttributes.insert( key, value ); -} - -QString Content::extendedAttribute( const QString &key ) const -{ - return d->m_extendedAttributes.value( key ); -} - -QMap Content::extendedAttributes() const -{ - return d->m_extendedAttributes; -} diff --git a/src/aboutdialog/libattica-ocsclient/content.h b/src/aboutdialog/libattica-ocsclient/content.h deleted file mode 100644 index 737632f470..0000000000 --- a/src/aboutdialog/libattica-ocsclient/content.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_CONTENT_H -#define ATTICA_CONTENT_H - -#include -#include -#include - -#include "atticaclient_export.h" - - -class QDateTime; - -namespace AmarokAttica { - -class ATTICA_EXPORT Content -{ - public: - typedef QList List; - - Content(); - Content(const Content& other); - Content& operator=(const Content& other); - ~Content(); - - void setId( const QString & ); - QString id() const; - - void setName( const QString & ); - QString name() const; - - void setRating( int ); - int rating() const; - - void setDownloads( int ); - int downloads() const; - - void setCreated( const QDateTime & ); - QDateTime created() const; - - void setUpdated( const QDateTime & ); - QDateTime updated() const; - - void addExtendedAttribute( const QString &key, const QString &value ); - QString extendedAttribute( const QString &key ) const; - - QMap extendedAttributes() const; - - private: - class Private; - QSharedDataPointer d; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/contentjob.cpp b/src/aboutdialog/libattica-ocsclient/contentjob.cpp deleted file mode 100644 index 864ff79ef0..0000000000 --- a/src/aboutdialog/libattica-ocsclient/contentjob.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "contentjob.h" - -#include "contentparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -ContentJob::ContentJob() - : m_job( ) -{ -} - -void ContentJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void ContentJob::start() -{ - QTimer::singleShot( 0, this, &ContentJob::doWork ); -} - -Content ContentJob::content() const -{ - return m_content; -} - -void ContentJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &ContentJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &ContentJob::slotJobData ); - - m_job = job; -} - -void ContentJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - } else { - qDebug() << m_data; - m_content = ContentParser().parse( QString::fromUtf8( m_data.data() ) ); - } - - emitResult(); -} - -void ContentJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/contentjob.h b/src/aboutdialog/libattica-ocsclient/contentjob.h deleted file mode 100644 index 0fee9034d1..0000000000 --- a/src/aboutdialog/libattica-ocsclient/contentjob.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_CONTENTJOB_H -#define ATTICA_CONTENTJOB_H - -#include "content.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT ContentJob : public KJob -{ - Q_OBJECT - public: - ContentJob(); - - void setUrl( const QUrl & ); - - void start(); - - Content content() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Content m_content; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/contentlistjob.cpp b/src/aboutdialog/libattica-ocsclient/contentlistjob.cpp deleted file mode 100644 index b77eb3f3f4..0000000000 --- a/src/aboutdialog/libattica-ocsclient/contentlistjob.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "contentlistjob.h" - -#include "contentparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -ContentListJob::ContentListJob() - : m_job( ) -{ -} - -void ContentListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void ContentListJob::start() -{ - QTimer::singleShot( 0, this, &ContentListJob::doWork ); -} - -Content::List ContentListJob::contentList() const -{ - return m_contentList; -} - -void ContentListJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &ContentListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &ContentListJob::slotJobData ); - - m_job = job; -} - -void ContentListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - qDebug() << m_data; - m_contentList = ContentParser().parseList( - QString::fromUtf8( m_data.data() ) ); - - emitResult(); - } -} - -void ContentListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/contentlistjob.h b/src/aboutdialog/libattica-ocsclient/contentlistjob.h deleted file mode 100644 index 4bba032f19..0000000000 --- a/src/aboutdialog/libattica-ocsclient/contentlistjob.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_CONTENTLISTJOB_H -#define ATTICA_CONTENTLISTJOB_H - -#include "content.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT ContentListJob : public KJob -{ - Q_OBJECT - public: - ContentListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Content::List contentList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Content::List m_contentList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/contentparser.cpp b/src/aboutdialog/libattica-ocsclient/contentparser.cpp deleted file mode 100644 index f876a9fe1e..0000000000 --- a/src/aboutdialog/libattica-ocsclient/contentparser.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "contentparser.h" - -#include - -using namespace AmarokAttica; - -ContentParser::ContentParser() -{ -} - -Content::List ContentParser::parseList( const QString &xmlString ) -{ - Content::List contentList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "content" ) { - Content content = parseContent( xml ); - contentList.append( content ); - } - } - - return contentList; -} - -Content ContentParser::parse( const QString &xmlString ) -{ - Content content; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "content" ) { - content = parseContent( xml ); - } - } - - return content; -} - -Content ContentParser::parseContent( QXmlStreamReader &xml ) -{ - Content content; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - content.setId( xml.readElementText() ); - } else if ( xml.name() == "name" ) { - content.setName( xml.readElementText() ); - } else if ( xml.name() == "score" ) { - content.setRating( xml.readElementText().toInt() ); - } else if ( xml.name() == "downloads" ) { - content.setDownloads( xml.readElementText().toInt() ); - } else if ( xml.name() == "created" ) { - content.setCreated( QDateTime::fromString( xml.readElementText(), - Qt::ISODate ) ); - } else if ( xml.name() == "updated" ) { - content.setUpdated( QDateTime::fromString( xml.readElementText(), - Qt::ISODate ) ); - } else { - content.addExtendedAttribute( xml.name().toString(), - xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "content" ) break; - } - - return content; -} diff --git a/src/aboutdialog/libattica-ocsclient/contentparser.h b/src/aboutdialog/libattica-ocsclient/contentparser.h deleted file mode 100644 index 68e3445eb0..0000000000 --- a/src/aboutdialog/libattica-ocsclient/contentparser.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_CONTENTPARSER_H -#define ATTICA_CONTENTPARSER_H - -#include "content.h" - -#include - -namespace AmarokAttica { - -class ContentParser -{ - public: - ContentParser(); - - Content parse( const QString &xml ); - Content::List parseList( const QString &xml ); - - protected: - Content parseContent( QXmlStreamReader &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/event.cpp b/src/aboutdialog/libattica-ocsclient/event.cpp deleted file mode 100644 index c1de98d878..0000000000 --- a/src/aboutdialog/libattica-ocsclient/event.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "event.h" - - -using namespace AmarokAttica; - - -Event::Event() - : m_latitude(0), m_longitude(0) -{ -} - - -void Event::setId(const QString& id) -{ - m_id = id; -} - -QString Event::id() const -{ - return m_id; -} - - -void Event::setName(const QString& name) -{ - m_name = name; -} - -QString Event::name() const -{ - return m_name; -} - - -void Event::setDescription(const QString& text) -{ - m_description = text; -} - -QString Event::description() const -{ - return m_description; -} - - -void Event::setUser(const QString& id) -{ - m_user = id; -} - -QString Event::user() const -{ - return m_user; -} - - -void Event::setStartDate(const QDate& date) -{ - m_startDate = date; -} - -QDate Event::startDate() const -{ - return m_startDate; -} - - -void Event::setEndDate(const QDate& date) -{ - m_endDate = date; -} - -QDate Event::endDate() const -{ - return m_endDate; -} - - -void Event::setLatitude(qreal lat) -{ - m_latitude = lat; -} - -qreal Event::latitude() const -{ - return m_latitude; -} - - -void Event::setLongitude(qreal lon) -{ - m_longitude = lon; -} - -qreal Event::longitude() const -{ - return m_longitude; -} - - -void Event::setHomepage(const QString& url) -{ - m_homepage = url; -} - -QString Event::homepage() const -{ - return m_homepage; -} - - -void Event::setCountry(const QString& country) -{ - m_country = country; -} - -QString Event::country() const -{ - return m_country; -} - - -void Event::setCity(const QString& city) -{ - m_city = city; -} - -QString Event::city() const -{ - return m_city; -} - - -void Event::addExtendedAttribute(const QString& key, const QString& value) -{ - m_extendedAttributes.insert(key, value); -} - -QString Event::extendedAttribute(const QString& key) const -{ - return m_extendedAttributes.value(key); -} - -QMap Event::extendedAttributes() const -{ - return m_extendedAttributes; -} diff --git a/src/aboutdialog/libattica-ocsclient/event.h b/src/aboutdialog/libattica-ocsclient/event.h deleted file mode 100644 index 214e97fba3..0000000000 --- a/src/aboutdialog/libattica-ocsclient/event.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef ATTICA_EVENT_H -#define ATTICA_EVENT_H - -#include "atticaclient_export.h" - -#include -#include -#include - - -namespace AmarokAttica { - -class ATTICA_EXPORT Event -{ - public: - typedef QList List; - - Event(); - - void setId(const QString& id); - QString id() const; - - void setName(const QString& name); - QString name() const; - - void setDescription(const QString& text); - QString description() const; - - void setUser(const QString& id); - QString user() const; - - void setStartDate(const QDate& date); - QDate startDate() const; - - void setEndDate(const QDate& date); - QDate endDate() const; - - void setLatitude(qreal lat); - qreal latitude() const; - - void setLongitude(qreal lon); - qreal longitude() const; - - void setHomepage(const QString& url); - QString homepage() const; - - void setCountry(const QString& country); - QString country() const; - - void setCity(const QString& city); - QString city() const; - - void addExtendedAttribute(const QString& key, const QString& value); - QString extendedAttribute(const QString& key) const; - QMap extendedAttributes() const; - - private: - QString m_id; - QString m_name; - QString m_description; - QString m_user; - QDate m_startDate; - QDate m_endDate; - qreal m_latitude; - qreal m_longitude; - QString m_homepage; - QString m_country; - QString m_city; - QMap m_extendedAttributes; -}; - -} - - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/eventjob.cpp b/src/aboutdialog/libattica-ocsclient/eventjob.cpp deleted file mode 100644 index e75e338b73..0000000000 --- a/src/aboutdialog/libattica-ocsclient/eventjob.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "eventjob.h" - -#include - -#include - -#include "eventparser.h" - - -using namespace AmarokAttica; - - -EventJob::EventJob() - : m_job(0) -{ -} - - -void EventJob::setUrl(const QUrl &url) -{ - m_url = url; -} - - -void EventJob::start() -{ - QTimer::singleShot(0, this, &EventJob::doWork); -} - - -Event EventJob::event() const -{ - return m_event; -} - - -void EventJob::doWork() -{ - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &EventJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &EventJob::slotJobData ); - - m_job = job; -} - - -void EventJob::slotJobResult(KJob* job) -{ - m_job = 0; - - if (job->error()) { - setError(job->error()); - setErrorText(job->errorText()); - - emitResult(); - } else { - m_event = EventParser().parse(QString::fromUtf8(m_data.data())); - - emitResult(); - } -} - - -void EventJob::slotJobData(KIO::Job* job, const QByteArray& data) -{ - Q_UNUSED(job); - - m_data.append(data); -} - - diff --git a/src/aboutdialog/libattica-ocsclient/eventjob.h b/src/aboutdialog/libattica-ocsclient/eventjob.h deleted file mode 100644 index cf92b84ebc..0000000000 --- a/src/aboutdialog/libattica-ocsclient/eventjob.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef ATTICA_EVENTJOB_H -#define ATTICA_EVENTJOB_H - -#include -#include - -#include "atticaclient_export.h" -#include "event.h" - - -namespace KIO { - class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT EventJob : public KJob -{ - Q_OBJECT - - public: - EventJob(); - - void setUrl(const QUrl &url); - - void start(); - - Event event() const; - using QObject::event; // Unhide QObject's event() - - protected Q_SLOTS: - void doWork(); - - void slotJobResult(KJob* job); - void slotJobData(KIO::Job* job, const QByteArray& data); - - private: - QUrl m_url; - KIO::Job* m_job; - QByteArray m_data; - - Event m_event; -}; - -} - - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/eventlistjob.cpp b/src/aboutdialog/libattica-ocsclient/eventlistjob.cpp deleted file mode 100644 index 704babd990..0000000000 --- a/src/aboutdialog/libattica-ocsclient/eventlistjob.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "eventlistjob.h" - -#include - -#include - -#include "eventparser.h" - - -using namespace AmarokAttica; - - -EventListJob::EventListJob() - : m_job(0) -{ -} - - -void EventListJob::setUrl(const QUrl &url) -{ - m_url = url; -} - - -void EventListJob::start() -{ - QTimer::singleShot(0, this, &EventListJob::doWork); -} - - -Event::List EventListJob::eventList() const -{ - return m_eventList; -} - - -void EventListJob::doWork() -{ - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &EventListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &EventListJob::slotJobData ); - - m_job = job; -} - - -void EventListJob::slotJobResult(KJob* job) -{ - m_job = 0; - - if (job->error()) { - setError(job->error()); - setErrorText(job->errorText()); - - emitResult(); - } else { - m_eventList = EventParser().parseList(QString::fromUtf8(m_data.data())); - - emitResult(); - } -} - - -void EventListJob::slotJobData(KIO::Job* job, const QByteArray& data) -{ - Q_UNUSED(job); - - m_data.append(data); -} - - diff --git a/src/aboutdialog/libattica-ocsclient/eventlistjob.h b/src/aboutdialog/libattica-ocsclient/eventlistjob.h deleted file mode 100644 index 534970bf0b..0000000000 --- a/src/aboutdialog/libattica-ocsclient/eventlistjob.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef ATTICA_EVENTLISTJOB_H -#define ATTICA_EVENTLISTJOB_H - -#include -#include - -#include "atticaclient_export.h" -#include "event.h" - - -namespace KIO { - class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT EventListJob : public KJob -{ - Q_OBJECT - - public: - EventListJob(); - - void setUrl(const QUrl &url); - - void start(); - - Event::List eventList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult(KJob* job); - void slotJobData(KIO::Job* job, const QByteArray& data); - - private: - QUrl m_url; - KIO::Job* m_job; - QByteArray m_data; - - Event::List m_eventList; -}; - -} - - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/eventparser.cpp b/src/aboutdialog/libattica-ocsclient/eventparser.cpp deleted file mode 100644 index 9e70ce47e4..0000000000 --- a/src/aboutdialog/libattica-ocsclient/eventparser.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "eventparser.h" - -#include - -using namespace AmarokAttica; - -EventParser::EventParser() -{ -} - - -Event EventParser::parse(const QString& xmlString) -{ - Event event; - - QXmlStreamReader xml(xmlString); - - while (!xml.atEnd()) { - xml.readNext(); - - if (xml.isStartElement() && xml.name() == "event") { - event = parseEvent(xml); - } - } - - return event; -} - - -Event::List AmarokAttica::EventParser::parseList(const QString& xmlString) -{ - Event::List eventList; - - QXmlStreamReader xml(xmlString); - - while (!xml.atEnd()) { - xml.readNext(); - - if (xml.isStartElement() && xml.name() == "event") { - eventList.append(parseEvent(xml)); - } - } - - return eventList; -} - - -Event EventParser::parseEvent(QXmlStreamReader& xml) -{ - Event event; - - while (!xml.atEnd()) { - xml.readNext(); - - if (xml.isStartElement()) { - if (xml.name() == "id") { - event.setId(xml.readElementText()); - } else if (xml.name() == "name") { - event.setName(xml.readElementText()); - } else if (xml.name() == "description") { - event.setDescription(xml.readElementText()); - } else if (xml.name() == "user") { - event.setUser(xml.readElementText()); - } else if (xml.name() == "startdate") { - QString date = xml.readElementText().remove(QRegExp("\\+.*$")); - event.setStartDate(QDate::fromString(date, Qt::ISODate)); - } else if (xml.name() == "enddate") { - QString date = xml.readElementText().remove(QRegExp("\\+.*$")); - event.setEndDate(QDate::fromString(date, Qt::ISODate)); - } else if (xml.name() == "latitude") { - event.setLatitude(xml.readElementText().toFloat()); - } else if (xml.name() == "longitude") { - event.setLongitude(xml.readElementText().toFloat()); - } else if (xml.name() == "homepage") { - event.setHomepage(xml.readElementText()); - } else if (xml.name() == "country") { - event.setCountry(xml.readElementText()); - } else if (xml.name() == "city") { - event.setCity(xml.readElementText()); - } else { - event.addExtendedAttribute(xml.name().toString(), xml.readElementText()); - } - } - else if (xml.isEndElement() && xml.name() == "event") { - break; - } - } - return event; -} diff --git a/src/aboutdialog/libattica-ocsclient/eventparser.h b/src/aboutdialog/libattica-ocsclient/eventparser.h deleted file mode 100644 index 84247d3122..0000000000 --- a/src/aboutdialog/libattica-ocsclient/eventparser.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef ATTICA_EVENTPARSER_H -#define ATTICA_EVENTPARSER_H - -#include "event.h" - -#include - -namespace AmarokAttica { - -class EventParser -{ - public: - EventParser(); - - Event parse(const QString& xml); - Event::List parseList(const QString& xml); - - private: - Event parseEvent(QXmlStreamReader& xml); -}; - -} - - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/folder.cpp b/src/aboutdialog/libattica-ocsclient/folder.cpp deleted file mode 100644 index 259589739a..0000000000 --- a/src/aboutdialog/libattica-ocsclient/folder.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "folder.h" - -using namespace AmarokAttica; - -Folder::Folder() - : m_messageCount( 0 ) -{ -} - -void Folder::setId( const QString &u ) -{ - m_id = u; -} - -QString Folder::id() const -{ - return m_id; -} - -void Folder::setName( const QString &d ) -{ - m_name = d; -} - -QString Folder::name() const -{ - return m_name; -} - -void Folder::setMessageCount( int c ) -{ - m_messageCount = c; -} - -int Folder::messageCount() const -{ - return m_messageCount; -} - -void Folder::setType( const QString &v ) -{ - m_type = v; -} - -QString Folder::type() const -{ - return m_type; -} diff --git a/src/aboutdialog/libattica-ocsclient/folder.h b/src/aboutdialog/libattica-ocsclient/folder.h deleted file mode 100644 index bf4b621ada..0000000000 --- a/src/aboutdialog/libattica-ocsclient/folder.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_FOLDER_H -#define ATTICA_FOLDER_H - -#include "atticaclient_export.h" -#include -#include -namespace AmarokAttica { - -class ATTICA_EXPORT Folder -{ - public: - typedef QList List; - - Folder(); - - void setId( const QString & ); - QString id() const; - - void setName( const QString & ); - QString name() const; - - void setMessageCount( int ); - int messageCount() const; - - void setType( const QString & ); - QString type() const; - - private: - QString m_id; - QString m_name; - int m_messageCount; - QString m_type; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/folderlistjob.cpp b/src/aboutdialog/libattica-ocsclient/folderlistjob.cpp deleted file mode 100644 index c7fab0ccdf..0000000000 --- a/src/aboutdialog/libattica-ocsclient/folderlistjob.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "folderlistjob.h" - -#include "folderparser.h" - -#include - -#include -#include - -using namespace AmarokAttica; - -FolderListJob::FolderListJob() - : m_job( ) -{ -} - -void FolderListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void FolderListJob::start() -{ - QTimer::singleShot( 0, this, &FolderListJob::doWork ); -} - -Folder::List FolderListJob::folderList() const -{ - return m_folderList; -} - -void FolderListJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &FolderListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &FolderListJob::slotJobData ); - - m_job = job; -} - -void FolderListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - qDebug() << m_data; - m_folderList = FolderParser().parseList( - QString::fromUtf8( m_data.data() ) ); - - emitResult(); - } -} - -void FolderListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/folderlistjob.h b/src/aboutdialog/libattica-ocsclient/folderlistjob.h deleted file mode 100644 index 0d18352627..0000000000 --- a/src/aboutdialog/libattica-ocsclient/folderlistjob.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_FOLDERLISTJOB_H -#define ATTICA_FOLDERLISTJOB_H - -#include "folder.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT FolderListJob : public KJob -{ - Q_OBJECT - public: - FolderListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Folder::List folderList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Folder::List m_folderList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/folderparser.cpp b/src/aboutdialog/libattica-ocsclient/folderparser.cpp deleted file mode 100644 index 843c981287..0000000000 --- a/src/aboutdialog/libattica-ocsclient/folderparser.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "folderparser.h" - -#include - -using namespace AmarokAttica; - -FolderParser::FolderParser() -{ -} - -Folder::List FolderParser::parseList( const QString &xmlString ) -{ - Folder::List folderList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "folder" ) { - Folder folder; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - folder.setId( xml.readElementText() ); - } else if ( xml.name() == "name" ) { - folder.setName( xml.readElementText() ); - } else if ( xml.name() == "messagecount" ) { - folder.setMessageCount( xml.readElementText().toInt() ); - } else if ( xml.name() == "type" ) { - folder.setType( xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "folder" ) break; - } - - folderList.append( folder ); - } - } - - return folderList; -} diff --git a/src/aboutdialog/libattica-ocsclient/folderparser.h b/src/aboutdialog/libattica-ocsclient/folderparser.h deleted file mode 100644 index e6e4be401c..0000000000 --- a/src/aboutdialog/libattica-ocsclient/folderparser.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_FOLDERPARSER_H -#define ATTICA_FOLDERPARSER_H - -#include "folder.h" - - -namespace AmarokAttica { - -class FolderParser -{ - public: - FolderParser(); - - Folder::List parseList( const QString &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebase.cpp b/src/aboutdialog/libattica-ocsclient/knowledgebase.cpp deleted file mode 100644 index ac4e7c3f81..0000000000 --- a/src/aboutdialog/libattica-ocsclient/knowledgebase.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/*************************************************************************** - * This file is part of KDE. * - * Copyright (C) 2009 Marco Martin * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - - - -#include "knowledgebase.h" - -using namespace AmarokAttica; - -KnowledgeBase::KnowledgeBase() - : m_contentId(0), - m_comments(0) -{ -} - - -void KnowledgeBase::setId(QString id) -{ - m_id = id; -} - -QString KnowledgeBase::id() const -{ - return m_id; -} - - -void KnowledgeBase::setContentId(int id) -{ - m_contentId = id; -} - -int KnowledgeBase::contentId() const -{ - return m_contentId; -} - - -void KnowledgeBase::setUser(const QString &user) -{ - m_user = user; -} - -QString KnowledgeBase::user() const -{ - return m_user; -} - - -void KnowledgeBase::setStatus(const QString status) -{ - m_status = status; -} - -QString KnowledgeBase::status() const -{ - return m_status; -} - - -void KnowledgeBase::setChanged(const QDateTime &changed) -{ - m_changed = changed; -} - -QDateTime KnowledgeBase::changed() const -{ - return m_changed; -} - - -void KnowledgeBase::setName(const QString &name) -{ - m_name = name; -} - -QString KnowledgeBase::name() const -{ - return m_name; -} - - -void KnowledgeBase::setDescription(const QString &description) -{ - m_description = description; -} - -QString KnowledgeBase::description() const -{ - return m_description; -} - - -void KnowledgeBase::setAnswer(const QString &answer) -{ - m_answer = answer; -} - -QString KnowledgeBase::answer() const -{ - return m_answer; -} - - -void KnowledgeBase::setComments(int comments) -{ - m_comments = comments; -} - -int KnowledgeBase::comments() const -{ - return m_comments; -} - - -void KnowledgeBase::setDetailPage(const QUrl &detailPage) -{ - m_detailPage = detailPage; -} - -QUrl KnowledgeBase::detailPage() const -{ - return m_detailPage; -} - -void KnowledgeBase::addExtendedAttribute( const QString &key, const QString &value ) -{ - m_extendedAttributes.insert( key, value ); -} - -QString KnowledgeBase::extendedAttribute( const QString &key ) const -{ - return m_extendedAttributes.value( key ); -} - -QMap KnowledgeBase::extendedAttributes() const -{ - return m_extendedAttributes; -} diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebase.h b/src/aboutdialog/libattica-ocsclient/knowledgebase.h deleted file mode 100644 index 12185b1c4c..0000000000 --- a/src/aboutdialog/libattica-ocsclient/knowledgebase.h +++ /dev/null @@ -1,100 +0,0 @@ -/*************************************************************************** - * This file is part of KDE. * - * Copyright (C) 2009 Marco Martin * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#ifndef ATTICA_KNOWLEDGEBASE_H -#define ATTICA_KNOWLEDGEBASE_H - -#include "atticaclient_export.h" - -#include -#include -#include - -namespace AmarokAttica -{ - -class ATTICA_EXPORT KnowledgeBase -{ - public: - typedef QList List; - struct Metadata - { - QString status; - QString message; - int totalItems; - int itemsPerPage; - }; - - KnowledgeBase(); - - void setId(QString id); - QString id() const; - - void setContentId(int id); - int contentId() const; - - void setUser(const QString &user); - QString user() const; - - void setStatus(const QString status); - QString status() const; - - void setChanged(const QDateTime &changed); - QDateTime changed() const; - - void setName(const QString &name); - QString name() const; - - void setDescription(const QString &description); - QString description() const; - - void setAnswer(const QString &answer); - QString answer() const; - - void setComments(int comments); - int comments() const; - - void setDetailPage(const QUrl &detailPage); - QUrl detailPage() const; - - void addExtendedAttribute( const QString &key, const QString &value ); - QString extendedAttribute( const QString &key ) const; - - QMap extendedAttributes() const; - - private: - QString m_id; - int m_contentId; - QString m_user; - QString m_status; - QDateTime m_changed; - QString m_name; - QString m_description; - QString m_answer; - int m_comments; - QUrl m_detailPage; - - QMap m_extendedAttributes; -}; - -} - -#endif - diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebasejob.cpp b/src/aboutdialog/libattica-ocsclient/knowledgebasejob.cpp deleted file mode 100644 index f816f54a6c..0000000000 --- a/src/aboutdialog/libattica-ocsclient/knowledgebasejob.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "knowledgebasejob.h" - -#include "knowledgebaseparser.h" - -#include - -#include -#include - -using namespace AmarokAttica; - -KnowledgeBaseJob::KnowledgeBaseJob() - : m_job( ) -{ -} - -void KnowledgeBaseJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void KnowledgeBaseJob::start() -{ - QTimer::singleShot( 0, this, &KnowledgeBaseJob::doWork ); -} - -KnowledgeBase KnowledgeBaseJob::knowledgeBase() const -{ - return m_knowledgeBase; -} - -KnowledgeBase::Metadata KnowledgeBaseJob::metadata() const -{ - return m_metadata; -} - -void KnowledgeBaseJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &KnowledgeBaseJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &KnowledgeBaseJob::slotJobData ); - - m_job = job; -} - -void KnowledgeBaseJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - } else { - qDebug() << m_data; - KnowledgeBaseParser parser; - m_knowledgeBase = parser.parse( QString::fromUtf8( m_data.data() ) ); - m_metadata = parser.lastMetadata(); - } - - emitResult(); -} - -void KnowledgeBaseJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} - diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebasejob.h b/src/aboutdialog/libattica-ocsclient/knowledgebasejob.h deleted file mode 100644 index d4df3c071c..0000000000 --- a/src/aboutdialog/libattica-ocsclient/knowledgebasejob.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_KNOWLEDGEBASEJOB_H -#define ATTICA_KNOWLEDGEBASEJOB_H - -#include "knowledgebase.h" - -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT KnowledgeBaseJob : public KJob -{ - Q_OBJECT - public: - KnowledgeBaseJob(); - - void setUrl( const QUrl & ); - - void start(); - - KnowledgeBase knowledgeBase() const; - KnowledgeBase::Metadata metadata() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - KnowledgeBase m_knowledgeBase; - KnowledgeBase::Metadata m_metadata; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.cpp b/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.cpp deleted file mode 100644 index 4ebb06c6e3..0000000000 --- a/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "knowledgebaselistjob.h" - -#include "knowledgebaseparser.h" - -#include - -#include -#include - -using namespace AmarokAttica; - -KnowledgeBaseListJob::KnowledgeBaseListJob() - : m_job( ) -{ -} - -void KnowledgeBaseListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void KnowledgeBaseListJob::start() -{ - QTimer::singleShot( 0, this, &KnowledgeBaseListJob::doWork ); -} - -KnowledgeBase::List KnowledgeBaseListJob::knowledgeBaseList() const -{ - return m_knowledgeBaseList; -} - -KnowledgeBase::Metadata KnowledgeBaseListJob::metadata() const -{ - return m_metadata; -} - -void KnowledgeBaseListJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &KnowledgeBaseListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &KnowledgeBaseListJob::slotJobData ); - - m_job = job; -} - -void KnowledgeBaseListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - qDebug() << m_data; - KnowledgeBaseParser parser; - m_knowledgeBaseList = parser.parseList( - QString::fromUtf8( m_data.data() ) ); - m_metadata = parser.lastMetadata(); - - emitResult(); - } -} - -void KnowledgeBaseListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.h b/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.h deleted file mode 100644 index 747fa5ba71..0000000000 --- a/src/aboutdialog/libattica-ocsclient/knowledgebaselistjob.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_KNOWLEDGEBASELISTJOB_H -#define ATTICA_KNOWLEDGEBASELISTJOB_H - -#include "knowledgebase.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT KnowledgeBaseListJob : public KJob -{ - Q_OBJECT - public: - KnowledgeBaseListJob(); - - void setUrl( const QUrl & ); - - void start(); - - KnowledgeBase::List knowledgeBaseList() const; - KnowledgeBase::Metadata metadata() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - KnowledgeBase::List m_knowledgeBaseList; - KnowledgeBase::Metadata m_metadata; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.cpp b/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.cpp deleted file mode 100644 index 860a31a5fe..0000000000 --- a/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "knowledgebaseparser.h" - -using namespace AmarokAttica; - -KnowledgeBaseParser::KnowledgeBaseParser() -{ -} - -KnowledgeBase::List KnowledgeBaseParser::parseList( const QString &xmlString ) -{ - KnowledgeBase::List KnowledgeBaseList; - - QXmlStreamReader xml( xmlString ); - - m_lastMetadata = parseMetadata(xml); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "content" ) { - KnowledgeBase KnowledgeBase = parseKnowledgeBase( xml ); - KnowledgeBaseList.append( KnowledgeBase ); - } - } - - return KnowledgeBaseList; -} - -KnowledgeBase KnowledgeBaseParser::parse( const QString &xmlString ) -{ - KnowledgeBase knowledgeBase; - - QXmlStreamReader xml( xmlString ); - - m_lastMetadata = parseMetadata(xml); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "knowledgebase" ) { - knowledgeBase = parseKnowledgeBase( xml ); - } - } - - return knowledgeBase; -} - -KnowledgeBase::Metadata KnowledgeBaseParser::lastMetadata() -{ - return m_lastMetadata; -} - -KnowledgeBase::Metadata KnowledgeBaseParser::parseMetadata( QXmlStreamReader &xml ) -{ - KnowledgeBase::Metadata meta; - meta.status.clear(); - meta.message.clear(); - meta.totalItems = 0; - meta.itemsPerPage = 0; - - while ( !xml.atEnd() ) { - xml.readNext(); - if (xml.isStartElement() && xml.name() == "meta") { - while ( !xml.atEnd() ) { - xml.readNext(); - if (xml.isEndElement() && xml.name() == "meta") { - break; - } else if (xml.isStartElement()) { - if (xml.name() == "status") { - meta.status = xml.readElementText(); - } else if (xml.name() == "message") { - meta.message = xml.readElementText(); - } else if (xml.name() == "totalitems") { - meta.totalItems = xml.readElementText().toInt(); - } else if (xml.name() == "itemsperpage") { - meta.itemsPerPage = xml.readElementText().toInt(); - } - } - } - break; - } - } - - return meta; -} - -KnowledgeBase KnowledgeBaseParser::parseKnowledgeBase( QXmlStreamReader &xml ) -{ - KnowledgeBase knowledgeBase; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - knowledgeBase.setId( xml.readElementText() ); - } else if ( xml.name() == "status" ) { - knowledgeBase.setStatus( xml.readElementText() ); - } else if ( xml.name() == "contentId" ) { - knowledgeBase.setContentId( xml.readElementText().toInt() ); - } else if ( xml.name() == "user" ) { - knowledgeBase.setUser( xml.readElementText() ); - } else if ( xml.name() == "changed" ) { - knowledgeBase.setChanged( QDateTime::fromString( xml.readElementText(), - Qt::ISODate ) ); - } else if ( xml.name() == "description" ) { - knowledgeBase.setDescription( xml.readElementText() ); - } else if ( xml.name() == "answer" ) { - knowledgeBase.setAnswer( xml.readElementText() ); - } else if ( xml.name() == "comments" ) { - knowledgeBase.setComments( xml.readElementText().toInt() ); - } else if ( xml.name() == "detailpage" ) { - knowledgeBase.setDetailPage( QUrl(xml.readElementText()) ); - } else if ( xml.name() == "contentid" ) { - knowledgeBase.setContentId( xml.readElementText().toInt() ); - } else if ( xml.name() == "name" ) { - knowledgeBase.setName( xml.readElementText() ); - } else { - knowledgeBase.addExtendedAttribute( xml.name().toString(), - xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "content" ) break; - } - - return knowledgeBase; -} diff --git a/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.h b/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.h deleted file mode 100644 index 642266eb90..0000000000 --- a/src/aboutdialog/libattica-ocsclient/knowledgebaseparser.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - Copyright (c) 2009 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_KNOWLEDGEBASEPARSER_H -#define ATTICA_KNOWLEDGEBASEPARSER_H - -#include "knowledgebase.h" - -#include - -namespace AmarokAttica { - -class KnowledgeBaseParser -{ - public: - KnowledgeBaseParser(); - - KnowledgeBase parse( const QString &xml ); - KnowledgeBase::List parseList( const QString &xml ); - KnowledgeBase::Metadata lastMetadata(); - - protected: - KnowledgeBase parseKnowledgeBase( QXmlStreamReader &xml ); - KnowledgeBase::Metadata parseMetadata( QXmlStreamReader &xml ); - - private: - KnowledgeBase::Metadata m_lastMetadata; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/message.cpp b/src/aboutdialog/libattica-ocsclient/message.cpp deleted file mode 100644 index f747b45b77..0000000000 --- a/src/aboutdialog/libattica-ocsclient/message.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "message.h" - -using namespace AmarokAttica; - -Message::Message() - : m_status( Unread ) -{ -} - -void Message::setId( const QString &u ) -{ - m_id = u; -} - -QString Message::id() const -{ - return m_id; -} - -void Message::setFrom( const QString &n ) -{ - m_from = n; -} - -QString Message::from() const -{ - return m_from; -} - -void Message::setTo( const QString &n ) -{ - m_to = n; -} - -QString Message::to() const -{ - return m_to; -} - -void Message::setSent( const QDateTime &d ) -{ - m_sent = d; -} - -QDateTime Message::sent() const -{ - return m_sent; -} - -void Message::setStatus( Message::Status s ) -{ - m_status = s; -} - -Message::Status Message::status() const -{ - return m_status; -} - -void Message::setStatusText( const QString &c ) -{ - m_statusText = c; -} - -QString Message::statusText() const -{ - return m_statusText; -} - -void Message::setSubject( const QString &subject ) -{ - m_subject = subject; -} - -QString Message::subject() const -{ - return m_subject; -} - -void Message::setBody( const QString &body ) -{ - m_body = body; -} - -QString Message::body() const -{ - return m_body; -} diff --git a/src/aboutdialog/libattica-ocsclient/message.h b/src/aboutdialog/libattica-ocsclient/message.h deleted file mode 100644 index d185bfdaff..0000000000 --- a/src/aboutdialog/libattica-ocsclient/message.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_MESSAGE_H -#define ATTICA_MESSAGE_H - -#include -#include - -#include "atticaclient_export.h" - - -namespace AmarokAttica { - -class ATTICA_EXPORT Message -{ - public: - typedef QList List; - - enum Status { Unread = 0, Read = 1 }; - - Message(); - - void setId( const QString & ); - QString id() const; - - void setFrom( const QString & ); - QString from() const; - - void setTo( const QString & ); - QString to() const; - - void setSent( const QDateTime & ); - QDateTime sent() const; - - void setStatus( Status ); - Status status() const; - - void setStatusText( const QString & ); - QString statusText() const; - - void setSubject( const QString & ); - QString subject() const; - - void setBody( const QString & ); - QString body() const; - - private: - QString m_id; - QString m_from; - QString m_to; - QDateTime m_sent; - Status m_status; - QString m_statusText; - QString m_subject; - QString m_body; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/messagelistjob.cpp b/src/aboutdialog/libattica-ocsclient/messagelistjob.cpp deleted file mode 100644 index ff2f694961..0000000000 --- a/src/aboutdialog/libattica-ocsclient/messagelistjob.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "messagelistjob.h" - -#include "messageparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -MessageListJob::MessageListJob() - : m_job( ) -{ -} - -void MessageListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void MessageListJob::start() -{ - QTimer::singleShot( 0, this, &MessageListJob::doWork ); -} - -Message::List MessageListJob::messageList() const -{ - return m_messageList; -} - -void MessageListJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &MessageListJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &MessageListJob::slotJobData ); - - m_job = job; -} - -void MessageListJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - qDebug() << m_data; - m_messageList = MessageParser().parseList( - QString::fromUtf8( m_data.data() ) ); - - emitResult(); - } -} - -void MessageListJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_data.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/messagelistjob.h b/src/aboutdialog/libattica-ocsclient/messagelistjob.h deleted file mode 100644 index 3c5c19dd79..0000000000 --- a/src/aboutdialog/libattica-ocsclient/messagelistjob.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_MESSAGELISTJOB_H -#define ATTICA_MESSAGELISTJOB_H - -#include "message.h" - -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT MessageListJob : public KJob -{ - Q_OBJECT - public: - MessageListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Message::List messageList() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QByteArray m_data; - - Message::List m_messageList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/messageparser.cpp b/src/aboutdialog/libattica-ocsclient/messageparser.cpp deleted file mode 100644 index 454c4d6e54..0000000000 --- a/src/aboutdialog/libattica-ocsclient/messageparser.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "messageparser.h" - -#include - -using namespace AmarokAttica; - -MessageParser::MessageParser() -{ -} - -Message::List MessageParser::parseList( const QString &xmlString ) -{ - Message::List messageList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "data" ) { - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isEndElement() && xml.name() == "data" ) break; - - if ( xml.isStartElement() && xml.name() == "message" ) { - Message message; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "id" ) { - message.setId( xml.readElementText() ); - } else if ( xml.name() == "messagefrom" ) { - message.setFrom( xml.readElementText() ); - } else if ( xml.name() == "messageto" ) { - message.setTo( xml.readElementText() ); - } else if ( xml.name() == "senddate" ) { - message.setSent( QDateTime::fromString( xml.readElementText(), - Qt::ISODate ) ); - } else if ( xml.name() == "status" ) { - message.setStatus( - Message::Status( xml.readElementText().toInt() ) ); - } else if ( xml.name() == "statustext" ) { - message.setStatusText( xml.readElementText() ); - } else if ( xml.name() == "subject" ) { - message.setSubject( xml.readElementText() ); - } else if ( xml.name() == "body" ) { - message.setBody( xml.readElementText() ); - } - } - - if ( xml.isEndElement() && xml.name() == "message" ) break; - } - - messageList.append( message ); - } - } - } - } - - return messageList; -} diff --git a/src/aboutdialog/libattica-ocsclient/messageparser.h b/src/aboutdialog/libattica-ocsclient/messageparser.h deleted file mode 100644 index 848d283672..0000000000 --- a/src/aboutdialog/libattica-ocsclient/messageparser.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_MESSAGEPARSER_H -#define ATTICA_MESSAGEPARSER_H - -#include "message.h" - - -namespace AmarokAttica { - -class MessageParser -{ - public: - MessageParser(); - - Message::List parseList( const QString &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/person.cpp b/src/aboutdialog/libattica-ocsclient/person.cpp deleted file mode 100644 index ae1388ce34..0000000000 --- a/src/aboutdialog/libattica-ocsclient/person.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "person.h" - -using namespace AmarokAttica; - -Person::Person() - : m_latitude( 0 ), m_longitude( 0 ) -{ -} - -void Person::setId( const QString &u ) -{ - m_id = u; -} - -QString Person::id() const -{ - return m_id; -} - -void Person::setFirstName( const QString &name ) -{ - m_firstName = name; -} - -QString Person::firstName() const -{ - return m_firstName; -} - -void Person::setLastName( const QString &name ) -{ - m_lastName = name; -} - -QString Person::lastName() const -{ - return m_lastName; -} - -void Person::setBirthday( const QDate &d ) -{ - m_birthday = d; -} - -QDate Person::birthday() const -{ - return m_birthday; -} - -void Person::setCountry( const QString &c ) -{ - m_country = c; -} - -QString Person::country() const -{ - return m_country; -} - -void Person::setLatitude( qreal l ) -{ - m_latitude = l; -} - -qreal Person::latitude() const -{ - return m_latitude; -} - -void Person::setLongitude( qreal l ) -{ - m_longitude = l; -} - -qreal Person::longitude() const -{ - return m_longitude; -} - -void Person::setAvatarUrl( const QUrl &url ) -{ - m_avatarUrl = url; -} - -QUrl Person::avatarUrl() const -{ - return m_avatarUrl; -} - -void Person::setAvatar( const QPixmap &p ) -{ - m_avatar = p; -} - -QPixmap Person::avatar() const -{ - return m_avatar; -} - -void Person::setHomepage( const QString &h ) -{ - m_homepage = h; -} - -QString Person::homepage() const -{ - return m_homepage; -} - -void Person::setCity( const QString &h ) -{ - m_city = h; -} - -QString Person::city() const -{ - return m_city; -} - -void Person::addExtendedAttribute( const QString &key, const QString &value ) -{ - m_extendedAttributes.insert( key, value ); -} - -QString Person::extendedAttribute( const QString &key ) const -{ - return m_extendedAttributes.value( key ); -} - -QMap Person::extendedAttributes() const -{ - return m_extendedAttributes; -} diff --git a/src/aboutdialog/libattica-ocsclient/person.h b/src/aboutdialog/libattica-ocsclient/person.h deleted file mode 100644 index 342100ae79..0000000000 --- a/src/aboutdialog/libattica-ocsclient/person.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_PERSON_H -#define ATTICA_PERSON_H - -#include -#include -#include - -#include -#include - -#include "atticaclient_export.h" - - -namespace AmarokAttica { - -class ATTICA_EXPORT Person -{ - public: - typedef QList List; - - Person(); - - void setId( const QString & ); - QString id() const; - - void setFirstName( const QString & ); - QString firstName() const; - - void setLastName( const QString & ); - QString lastName() const; - - void setBirthday( const QDate & ); - QDate birthday() const; - - void setCountry( const QString & ); - QString country() const; - - void setLatitude( qreal ); - qreal latitude() const; - - void setLongitude( qreal ); - qreal longitude() const; - - void setAvatarUrl( const QUrl & ); - QUrl avatarUrl() const; - - void setAvatar( const QPixmap & ); - QPixmap avatar() const; - - void setHomepage( const QString & ); - QString homepage() const; - - void setCity( const QString & ); - QString city() const; - - void addExtendedAttribute( const QString &key, const QString &value ); - QString extendedAttribute( const QString &key ) const; - - QMap extendedAttributes() const; - - private: - QString m_id; - QString m_firstName; - QString m_lastName; - QDate m_birthday; - QString m_country; - qreal m_latitude; - qreal m_longitude; - QUrl m_avatarUrl; - QPixmap m_avatar; - QString m_homepage; - QString m_city; - - QMap m_extendedAttributes; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/personjob.cpp b/src/aboutdialog/libattica-ocsclient/personjob.cpp deleted file mode 100644 index 8401a7c019..0000000000 --- a/src/aboutdialog/libattica-ocsclient/personjob.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "personjob.h" - -#include "personparser.h" - -#include -#include - -#include - - -using namespace AmarokAttica; - -PersonJob::PersonJob() - : m_job( ) -{ -} - -void PersonJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void PersonJob::start() -{ - QTimer::singleShot( 0, this, &PersonJob::doWork ); -} - -Person PersonJob::person() const -{ - return m_person; -} - -void PersonJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &PersonJob::slotUserJobResult ); - connect( job, &KIO::TransferJob::data, - this, &PersonJob::slotUserJobData ); - - m_job = job; -} - -void PersonJob::slotUserJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - // qDebug() << m_userData; - m_person = PersonParser().parse( m_userData ); - - if (!m_person.avatarUrl().isEmpty()) { - qDebug() << "Getting avatar from" << m_person.avatarUrl(); - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &PersonJob::slotAvatarJobResult ); - connect( job, &KIO::TransferJob::data, - this, &PersonJob::slotAvatarJobData ); - - m_job = job; - } else { - emitResult(); - } - } -} - -void PersonJob::slotUserJobData( KIO::Job *, const QByteArray &data ) -{ - m_userData.append( QString::fromUtf8( data.data(), data.size() + 1 ) ); -} - -void PersonJob::slotAvatarJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - qWarning() << "Error retrieving Avatar:" << job->errorText(); - } else { - QPixmap pic; - if ( pic.loadFromData( m_avatarData ) ) { - m_person.setAvatar( pic ); - } - } - - emitResult(); -} - -void PersonJob::slotAvatarJobData( KIO::Job *, const QByteArray &data ) -{ - m_avatarData.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/personjob.h b/src/aboutdialog/libattica-ocsclient/personjob.h deleted file mode 100644 index 744af3a09b..0000000000 --- a/src/aboutdialog/libattica-ocsclient/personjob.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_PERSONJOB_H -#define ATTICA_PERSONJOB_H - -#include "person.h" - -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT PersonJob : public KJob -{ - Q_OBJECT - public: - PersonJob(); - - void setUrl( const QUrl & ); - - void start(); - - Person person() const; - - protected Q_SLOTS: - void doWork(); - - void slotUserJobResult( KJob *job ); - void slotUserJobData( KIO::Job *job, const QByteArray &data ); - - void slotAvatarJobResult( KJob *job ); - void slotAvatarJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QString m_userData; - QByteArray m_avatarData; - - Person m_person; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/personlistjob.cpp b/src/aboutdialog/libattica-ocsclient/personlistjob.cpp deleted file mode 100644 index 8b38572aae..0000000000 --- a/src/aboutdialog/libattica-ocsclient/personlistjob.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "personlistjob.h" - -#include "personparser.h" - -#include -#include - -#include -#include - - -using namespace AmarokAttica; - -PersonListJob::PersonListJob() - : m_job( ) -{ -} - -void PersonListJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void PersonListJob::start() -{ - QTimer::singleShot( 0, this, &PersonListJob::doWork ); -} - -Person::List PersonListJob::personList() const -{ - return m_personList; -} - -void PersonListJob::doWork() -{ - qDebug() << m_url; - - auto job = KIO::get( m_url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &PersonListJob::slotUserJobResult ); - connect( job, &KIO::TransferJob::data, - this, &PersonListJob::slotUserJobData ); - - m_job = job; -} - -void PersonListJob::slotUserJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - - emitResult(); - } else { - // qDebug() << m_userData; - m_personList = PersonParser().parseList( m_userData ); - -#if 0 - m_job = KIO::get( m_person.avatarUrl(), KIO::NoReload, - KIO::HideProgressInfo ); - connect( m_job, &KIO::Job::result, - this, &PersonListJob::slotAvatarJobResult ); - connect( m_job, &KIO::Job::data, - this, &PersonListJob::slotAvatarJobData ); -#else - emitResult(); -#endif - } -} - -void PersonListJob::slotUserJobData( KIO::Job *, const QByteArray &data ) -{ - m_userData.append( QString::fromUtf8( data.data(), data.size() + 1 ) ); -} - -void PersonListJob::slotAvatarJobResult( KJob *job ) -{ - m_job = 0; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - } else { - QPixmap pic; - if ( !pic.loadFromData( m_avatarData ) ) { - setError( UserDefinedError ); - setErrorText( i18n("Unable to parse avatar image data.") ); - } else { -// m_person.setAvatar( pic ); - } - } - - emitResult(); -} - -void PersonListJob::slotAvatarJobData( KIO::Job *, const QByteArray &data ) -{ - m_avatarData.append( data ); -} diff --git a/src/aboutdialog/libattica-ocsclient/personlistjob.h b/src/aboutdialog/libattica-ocsclient/personlistjob.h deleted file mode 100644 index 15b90d4ce0..0000000000 --- a/src/aboutdialog/libattica-ocsclient/personlistjob.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_PERSONLISTJOB_H -#define ATTICA_PERSONLISTJOB_H - -#include "person.h" - -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT PersonListJob : public KJob -{ - Q_OBJECT - public: - PersonListJob(); - - void setUrl( const QUrl & ); - - void start(); - - Person::List personList() const; - - protected Q_SLOTS: - void doWork(); - - void slotUserJobResult( KJob *job ); - void slotUserJobData( KIO::Job *job, const QByteArray &data ); - - void slotAvatarJobResult( KJob *job ); - void slotAvatarJobData( KIO::Job *job, const QByteArray &data ); - - private: - QUrl m_url; - KIO::Job *m_job; - QString m_userData; - QByteArray m_avatarData; - - Person::List m_personList; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/personparser.cpp b/src/aboutdialog/libattica-ocsclient/personparser.cpp deleted file mode 100644 index 3e009632cf..0000000000 --- a/src/aboutdialog/libattica-ocsclient/personparser.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "personparser.h" - -using namespace AmarokAttica; - -PersonParser::PersonParser() -{ -} - -Person::List PersonParser::parseList( const QString &xmlString ) -{ - Person::List personList; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && - ( xml.name() == "person" || xml.name() == "user" ) ) { - Person person = parsePerson( xml ); - personList.append( person ); - } - } - - return personList; -} - -Person PersonParser::parse( const QString &xmlString ) -{ - Person person; - - QXmlStreamReader xml( xmlString ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "person" ) { - person = parsePerson( xml ); - } - } - - return person; -} - -Person PersonParser::parsePerson( QXmlStreamReader &xml ) -{ - Person person; - bool hasAvatarPic = false; - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "personid" ) { - person.setId( xml.readElementText() ); - } else if ( xml.name() == "firstname" ) { - person.setFirstName( xml.readElementText() ); - } else if ( xml.name() == "lastname" ) { - person.setLastName( xml.readElementText() ); - } else if ( xml.name() == "homepage" ) { - person.setHomepage( xml.readElementText() ); - } else if ( xml.name() == "avatarpic" ) { - person.setAvatarUrl( QUrl::fromUserInput(xml.readElementText()) ); - } else if ( xml.name() == "avatarpicfound" ) { - QString value = xml.readElementText(); - if (value.toInt()) { - hasAvatarPic = true; - } - } else if ( xml.name() == "birthday" ) { - person.setBirthday( QDate::fromString( xml.readElementText(), - Qt::ISODate ) ); - } else if ( xml.name() == "city" ) { - person.setCity( xml.readElementText() ); - } else if ( xml.name() == "country" ) { - person.setCountry( xml.readElementText() ); - } else if ( xml.name() == "latitude" ) { - person.setLatitude( xml.readElementText().toFloat() ); - } else if ( xml.name() == "longitude" ) { - person.setLongitude( xml.readElementText().toFloat() ); - } else { - person.addExtendedAttribute( xml.name().toString(), - xml.readElementText() ); - } - } - - if ( xml.isEndElement() && - ( xml.name() == "person" || xml.name() == "user" ) ) break; - } - - if (!hasAvatarPic) { - person.setAvatarUrl( QUrl::fromUserInput(QString()) ); - } - - return person; -} diff --git a/src/aboutdialog/libattica-ocsclient/personparser.h b/src/aboutdialog/libattica-ocsclient/personparser.h deleted file mode 100644 index cd10f1607a..0000000000 --- a/src/aboutdialog/libattica-ocsclient/personparser.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ -#ifndef ATTICA_PERSONPARSER_H -#define ATTICA_PERSONPARSER_H - -#include "person.h" - -#include - -namespace AmarokAttica { - -class PersonParser -{ - public: - PersonParser(); - - Person parse( const QString &xml ); - Person::List parseList( const QString &xml ); - - protected: - Person parsePerson( QXmlStreamReader &xml ); -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/postjob.cpp b/src/aboutdialog/libattica-ocsclient/postjob.cpp deleted file mode 100644 index a4607db671..0000000000 --- a/src/aboutdialog/libattica-ocsclient/postjob.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "postjob.h" - -#include - -#include -#include -#include -#include - -using namespace AmarokAttica; - -PostJob::PostJob() - : m_job( ) -{ -} - -void PostJob::setUrl( const QUrl &url ) -{ - m_url = url; -} - -void PostJob::setData( const QString &name, const QString &value ) -{ - m_data.insert( name, value ); -} - -void PostJob::start() -{ - QTimer::singleShot( 0, this, &PostJob::doWork ); -} - -QString PostJob::status() const -{ - return m_status; -} - -QString PostJob::statusMessage() const -{ - return m_statusMessage; -} - -void PostJob::doWork() -{ - QString postData; - - const QStringList dataKeys = m_data.keys(); - QUrlQuery query; - foreach( const QString &name, dataKeys ) { - query.addQueryItem( name, m_data.value( name ) ); - } - m_url.setQuery( query ); - - qDebug() << m_url; - - auto job = KIO::http_post( m_url, postData.toUtf8(), KIO::HideProgressInfo ); - connect( job, &KIO::TransferJob::result, - this, &PostJob::slotJobResult ); - connect( job, &KIO::TransferJob::data, - this, &PostJob::slotJobData ); - - m_job = job; -} - -void PostJob::slotJobResult( KJob *job ) -{ - m_job = 0; - - qDebug() << "RESPONSE" << m_responseData; - - if ( job->error() ) { - setError( job->error() ); - setErrorText( job->errorText() ); - } else { - qDebug() << "No error "; - - QXmlStreamReader xml( m_responseData ); - - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() && xml.name() == "meta" ) { - while ( !xml.atEnd() ) { - xml.readNext(); - - if ( xml.isStartElement() ) { - if ( xml.name() == "status" ) { - m_status = xml.readElementText(); - } else if ( xml.name() == "message" ) { - m_statusMessage = xml.readElementText(); - } - } - - if ( xml.isEndElement() && xml.name() == "meta" ) break; - } - } - } - - qDebug() << "STATUS:" << m_status; - - if ( m_status != "ok" ) { - setError( KJob::UserDefinedError ); - setErrorText( m_status + ": " + m_statusMessage ); - } - } - - emitResult(); -} - -void PostJob::slotJobData( KIO::Job *, const QByteArray &data ) -{ - m_responseData.append( QString::fromUtf8( data.data(), data.size() + 1 ) ); -} diff --git a/src/aboutdialog/libattica-ocsclient/postjob.h b/src/aboutdialog/libattica-ocsclient/postjob.h deleted file mode 100644 index 7000940912..0000000000 --- a/src/aboutdialog/libattica-ocsclient/postjob.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. - */ -#ifndef ATTICA_POSTJOB_H -#define ATTICA_POSTJOB_H - -#include "atticaclient_export.h" - -#include -#include -#include - -namespace KIO { -class Job; -} - -namespace AmarokAttica { - -class ATTICA_EXPORT PostJob : public KJob -{ - Q_OBJECT - public: - PostJob(); - - void setUrl( const QUrl & ); - void setData( const QString &name, const QString &value ); - - void start(); - - QString status() const; - QString statusMessage() const; - - protected Q_SLOTS: - void doWork(); - - void slotJobResult( KJob *job ); - void slotJobData( KIO::Job *, const QByteArray & ); - - private: - QUrl m_url; - QMap m_data; - KIO::Job *m_job; - QString m_responseData; - - QString m_status; - QString m_statusMessage; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/provider.cpp b/src/aboutdialog/libattica-ocsclient/provider.cpp deleted file mode 100644 index 29f150da9b..0000000000 --- a/src/aboutdialog/libattica-ocsclient/provider.cpp +++ /dev/null @@ -1,456 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "provider.h" - -#include -#include -#include -#include - -#include "activitylistjob.h" -#include "categorylistjob.h" -#include "contentjob.h" -#include "contentlistjob.h" -#include "eventjob.h" -#include "eventlistjob.h" -#include "folderlistjob.h" -#include "knowledgebasejob.h" -#include "knowledgebaselistjob.h" -#include "messagelistjob.h" -#include "personjob.h" -#include "personlistjob.h" -#include "postjob.h" -#include "providerinitjob.h" - - -using namespace AmarokAttica; - - -class Provider::Private : public QSharedData { - public: - QUrl m_baseUrl; - QString m_id; - QString m_name; - Private(const Private& other) - : QSharedData(other), m_baseUrl(other.m_baseUrl), m_id(other.m_id), m_name(other.m_name) - { - } - Private(const QString& id, const QUrl &baseUrl, const QString name) - : m_baseUrl(baseUrl), m_id(id), m_name(name) - { - } -}; - - -ProviderInitJob* Provider::byId(const QString& id) -{ - ProviderInitJob* job = new ProviderInitJob(id); - job->start(); - return job; -} - - -Provider::Provider() - : d(new Private(QString(), QUrl(), QString())) -{ -} - -Provider::Provider(const Provider& other) - : d(other.d) -{ -} - -Provider::Provider(const QString& id, const QUrl &baseUrl, const QString& name) - : d(new Private(id, baseUrl, name)) -{ -} - -Provider& Provider::operator=(const AmarokAttica::Provider & other) -{ - d = other.d; - return *this; -} - -Provider::~Provider() -{ -} - - -QString Provider::id() const -{ - return d->m_id; -} - - -QString Provider::name() const -{ - return d->m_name; -} - - -PersonJob* Provider::requestPerson(const QString& id) const -{ - QUrl url = createUrl( "person/data/" + id ); - return doRequestPerson( url ); -} - -PersonJob* Provider::requestPersonSelf() -{ - QUrl url = createUrl( "person/self" ); - return doRequestPerson( url ); -} - -PersonListJob* Provider::requestPersonSearchByName(const QString& name) -{ - QUrl url = createUrl( "person/data"); - QUrlQuery query; - query.addQueryItem("name", name); - url.setQuery(query); - return doRequestPersonList( url ); -} - -PersonListJob* Provider::requestPersonSearchByLocation(qreal latitude, qreal longitude, qreal distance, int page, int pageSize) -{ - QUrl url = createUrl( "person/data" ); - QUrlQuery query; - query.addQueryItem("latitude", QString::number(latitude)); - query.addQueryItem("longitude", QString::number(longitude)); - query.addQueryItem("distance", QString::number(distance)); - query.addQueryItem("page", QString::number(page)); - query.addQueryItem("pagesize", QString::number(pageSize)); - url.setQuery(query); - - qDebug() << "Location-based search:" << latitude << longitude << distance; - qDebug() << "URL:" << url; - return doRequestPersonList( url ); -} - -PersonListJob* Provider::requestFriend(const QString& id, int page, int pageSize) -{ - QUrl url = createUrl( "friend/data/" + id ); - QUrlQuery query; - query.addQueryItem("page", QString::number(page)); - query.addQueryItem("pagesize", QString::number(pageSize)); - url.setQuery(query); - - qDebug() << "URL:" << url; - return doRequestPersonList( url ); -} - -ActivityListJob* Provider::requestActivity() -{ - QUrl url = createUrl( "activity" ); - return doRequestActivityList( url ); -} - -PostJob* Provider::postActivity(const QString& message) -{ - PostJob *job = new PostJob(); - - QUrl url = createUrl( "activity" ); - job->setUrl( url ); - job->setData( "message", message ); - - job->start(); - return job; -} - -PostJob* Provider::postInvitation(const QString& to, const QString& message) -{ - PostJob *job = new PostJob(); - - QUrl url = createUrl( "friend/outbox/" + to ); - job->setUrl( url ); - job->setData( "message", message ); - - job->start(); - return job; -} - -PostJob* Provider::postLocation(qreal latitude, qreal longitude, const QString& city, const QString& country) -{ - PostJob *job = new PostJob(); - - QUrl url = createUrl( "person/self" ); - - job->setUrl( url ); - - job->setData( "latitude", QString("%1").arg(latitude) ); - job->setData( "longitude", QString("%1").arg(longitude) ); - job->setData( "city", city ); - job->setData( "country", country ); - - job->start(); - return job; -} - - -FolderListJob* Provider::requestFolders() -{ - return doRequestFolderList( createUrl( "message" ) ); -} - -MessageListJob* Provider::requestMessages(const QString& folderId) -{ - return doRequestMessageList( createUrl( "message/" + folderId ) ); -} - -PostJob* Provider::postMessage( const Message &message ) -{ - PostJob *job = new PostJob(); - - QUrl url = createUrl( "message/2" ); - job->setUrl( url ); - job->setData( "message", message.body() ); - job->setData( "subject", message.subject() ); - job->setData( "to", message.to() ); - - job->start(); - return job; -} - -CategoryListJob* Provider::requestCategories() -{ - CategoryListJob *job = new CategoryListJob(); - - QUrl url = createUrl( "content/categories" ); - job->setUrl( url ); - - job->start(); - return job; -} - -ContentListJob* Provider::requestContent(const Category::List& categories, const QString& search, SortMode sortMode) -{ - ContentListJob *job = new ContentListJob(); - - QUrl url = createUrl( "content/data" ); - QUrlQuery query; - - QStringList categoryIds; - foreach( const Category &category, categories ) { - categoryIds.append( category.id() ); - } - query.addQueryItem( "categories", categoryIds.join( "x" ) ); - - query.addQueryItem( "search", search ); - QString sortModeString; - switch ( sortMode ) { - case Newest: - sortModeString = "new"; - break; - case Alphabetical: - sortModeString = "alpha"; - break; - case Rating: - sortModeString = "high"; - break; - case Downloads: - sortModeString = "down"; - break; - } - if ( !sortModeString.isEmpty() ) { - query.addQueryItem( "sortmode", sortModeString ); - } - - url.setQuery(query); - - job->setUrl( url ); - - job->start(); - return job; -} - -ContentJob* Provider::requestContent(const QString& id) -{ - ContentJob *job = new ContentJob(); - - QUrl url = createUrl( "content/data/" + id ); - job->setUrl( url ); - - job->start(); - return job; -} - -KnowledgeBaseJob* Provider::requestKnowledgeBase(const QString& id) -{ - KnowledgeBaseJob *job = new KnowledgeBaseJob(); - - QUrl url = createUrl( "knowledgebase/data/" + id ); - job->setUrl( url ); - - job->start(); - return job; -} - -KnowledgeBaseListJob* Provider::requestKnowledgeBase(int content, const QString& search, Provider::SortMode sortMode, int page, int pageSize) -{ - KnowledgeBaseListJob *job = new KnowledgeBaseListJob(); - - QUrl url = createUrl( "knowledgebase/data" ); - QUrlQuery query; - - if (content) { - query.addQueryItem("content", QString::number(content)); - } - - query.addQueryItem( "search", search ); - QString sortModeString; - switch ( sortMode ) { - case Newest: - sortModeString = "new"; - break; - case Alphabetical: - sortModeString = "alpha"; - break; - case Rating: - sortModeString = "high"; - break; - //FIXME: knowledge base doesn't have downloads - case Downloads: - sortModeString = "new"; - break; - } - if ( !sortModeString.isEmpty() ) { - query.addQueryItem( "sortmode", sortModeString ); - } - - query.addQueryItem( "page", QString::number(page) ); - query.addQueryItem( "pagesize", QString::number(pageSize) ); - - url.setQuery(query); - - job->setUrl( url ); - - job->start(); - return job; -} - -EventJob* Provider::requestEvent(const QString& id) -{ - EventJob* job = new EventJob(); - - job->setUrl(createUrl("event/data/" + id)); - - job->start(); - return job; -} - -EventListJob* Provider::requestEvent(const QString& country, const QString& search, const QDate& startAt, Provider::SortMode mode, int page, int pageSize) -{ - EventListJob* job = new EventListJob(); - - QUrl url = createUrl("event/data"); - QUrlQuery query; - - if (!search.isEmpty()) { - query.addQueryItem("search", search); - } - - QString sortModeString; - switch (mode) { - case Newest: - sortModeString = "new"; - break; - case Alphabetical: - sortModeString = "alpha"; - break; - default: - break; - } - if (!sortModeString.isEmpty()) { - query.addQueryItem("sortmode", sortModeString); - } - - if (!country.isEmpty()) { - query.addQueryItem("country", country); - } - - query.addQueryItem("startat", startAt.toString(Qt::ISODate)); - - query.addQueryItem("page", QString::number(page)); - query.addQueryItem("pagesize", QString::number(pageSize)); - - url.setQuery(query); - - job->setUrl(url); - - job->start(); - return job; - -} - -QUrl Provider::createUrl(const QString& path) const -{ - QUrl url(d->m_baseUrl); - url = url.adjusted(QUrl::StripTrailingSlash); - url.setPath(url.path() + '/' + ( path )); - return url; -} - -PersonJob* Provider::doRequestPerson(const QUrl &url) const -{ - PersonJob *job = new PersonJob(); - - job->setUrl( url ); - - job->start(); - return job; -} - -PersonListJob* Provider::doRequestPersonList(const QUrl &url) -{ - PersonListJob *job = new PersonListJob(); - - job->setUrl( url ); - - job->start(); - return job; -} - -ActivityListJob* Provider::doRequestActivityList(const QUrl &url) -{ - ActivityListJob *job = new ActivityListJob(); - - job->setUrl( url ); - - job->start(); - return job; -} - -FolderListJob* Provider::doRequestFolderList(const QUrl &url) -{ - FolderListJob *job = new FolderListJob(); - - job->setUrl( url ); - job->start(); - return job; -} - -MessageListJob* Provider::doRequestMessageList(const QUrl &url) -{ - MessageListJob *job = new MessageListJob(); - - job->setUrl( url ); - job->start(); - return job; -} diff --git a/src/aboutdialog/libattica-ocsclient/provider.h b/src/aboutdialog/libattica-ocsclient/provider.h deleted file mode 100644 index 44db1c5534..0000000000 --- a/src/aboutdialog/libattica-ocsclient/provider.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2008 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef ATTICA_PROVIDER_H -#define ATTICA_PROVIDER_H - -#include -#include - -#include "atticaclient_export.h" -#include "category.h" - -class QUrl; -class QDate; - -namespace AmarokAttica { - -class ActivityListJob; -class CategoryListJob; -class ContentJob; -class ContentListJob; -class EventJob; -class EventListJob; -class FolderListJob; -class KnowledgeBaseJob; -class KnowledgeBaseListJob; -class Message; -class MessageListJob; -class PersonJob; -class PersonListJob; -class PostJob; -class ProviderInitJob; - -/** - Open Collaboration Services API. -*/ -class ATTICA_EXPORT Provider -{ - public: - Provider(); - Provider(const Provider& other); - Provider(const QString& id, const QUrl &baseUrl, const QString& name); - Provider& operator=(const Provider& other); - ~Provider(); - - QString name() const; - QString id() const; - - enum SortMode { - Newest, - Alphabetical, - Rating, - Downloads - }; - - static ProviderInitJob* byId(const QString& id); - - // Person part of OCS - - PersonJob* requestPerson(const QString& id) const; - PersonJob* requestPersonSelf(); - PersonListJob* requestPersonSearchByName(const QString& name); - PersonListJob* requestPersonSearchByLocation(qreal latitude, qreal longitude, qreal distance, int page = 0, int pageSize = 100); - PostJob* postLocation(qreal latitude, qreal longitude, const QString& city = QString(), const QString& country = QString()); - - // Friend part of OCS - - PersonListJob* requestFriend(const QString& id, int page = 0, int pageSize = 100); - PostJob* postInvitation(const QString& to, const QString& message); - - // Message part of OCS - - FolderListJob* requestFolders(); - MessageListJob* requestMessages(const QString& folderId); - PostJob* postMessage(const Message& message); - - // Activity part of OCS - - ActivityListJob* requestActivity(); - PostJob* postActivity(const QString& message); - - // Content part of OCS - - CategoryListJob* requestCategories(); - ContentListJob* requestContent(const Category::List& categories, const QString& search, SortMode mode); - ContentJob* requestContent(const QString& id); - - // KnowledgeBase part of OCS - - KnowledgeBaseJob* requestKnowledgeBase(const QString& id); - KnowledgeBaseListJob* requestKnowledgeBase(int content, const QString& search, SortMode, int page, int pageSize); - - // Event part of OCS - - EventJob* requestEvent(const QString& id); - EventListJob* requestEvent(const QString& country, const QString& search, const QDate& startAt, SortMode mode, int page, int pageSize); - - protected: - QUrl createUrl(const QString& path) const; - - PersonJob* doRequestPerson(const QUrl &url) const; - PersonListJob* doRequestPersonList(const QUrl &url); - ActivityListJob* doRequestActivityList(const QUrl &url); - FolderListJob* doRequestFolderList(const QUrl &url); - MessageListJob* doRequestMessageList(const QUrl &url); - - private: - class Private; - QExplicitlySharedDataPointer d; -}; - -} - -#endif diff --git a/src/aboutdialog/libattica-ocsclient/providerinitjob.cpp b/src/aboutdialog/libattica-ocsclient/providerinitjob.cpp deleted file mode 100644 index 29627df40f..0000000000 --- a/src/aboutdialog/libattica-ocsclient/providerinitjob.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include "providerinitjob.h" - -#include - -#include - - -using namespace AmarokAttica; - - -ProviderInitJob::ProviderInitJob(const QString& id, QObject* parent) - : KJob(parent), m_id(id) -{ -} - - -void ProviderInitJob::start() -{ - QTimer::singleShot(0, this, &ProviderInitJob::doWork); -} - - -void ProviderInitJob::doWork() -{ - if (m_id == "opendesktop") { - m_provider = Provider(m_id, QUrl("https://api.opendesktop.org/v1/"), "OpenDesktop.org"); - } - emitResult(); -} - - -Provider ProviderInitJob::provider() const -{ - return m_provider; -} - - diff --git a/src/aboutdialog/libattica-ocsclient/providerinitjob.h b/src/aboutdialog/libattica-ocsclient/providerinitjob.h deleted file mode 100644 index ecd6116e74..0000000000 --- a/src/aboutdialog/libattica-ocsclient/providerinitjob.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2009 Eckhart Wörner - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef PROVIDERINITJOB_H -#define PROVIDERINITJOB_H - -#include - -#include "atticaclient_export.h" -#include "provider.h" - -namespace AmarokAttica { - -class ATTICA_EXPORT ProviderInitJob : public KJob -{ - Q_OBJECT - - public: - explicit ProviderInitJob(const QString& id, QObject* parent = 0); - - void start(); - - Provider provider() const; - - private Q_SLOTS: - void doWork(); - - private: - const QString m_id; - Provider m_provider; -}; - -} - - -#endif