Hello community,
here is the log from the commit of package attica for openSUSE:Factory
checked in at Fri May 7 15:39:00 CEST 2010.
--------
--- KDE/attica/attica.changes 2010-04-26 12:29:46.000000000 +0200
+++ attica/attica.changes 2010-05-07 11:23:06.000000000 +0200
@@ -1,0 +2,11 @@
+Fri May 7 11:20:46 CEST 2010 - dmueller@suse.de
+
+- update to 0.1.3:
+ - Add possibility to get Licenses from server
+ - Add search for contents by username
+ - Add convenience function to get list of download links and fix some related strings
+ - Fix qt-only hasCredentials
+ - Win and Mac compile/link fixes
+ - Fix crash when multiple apps would use attica simultaneously: do not delete root component of qtplugins
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
attica-0.1.2.tar.bz2
New:
----
attica-0.1.3.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ attica.spec ++++++
--- /var/tmp/diff_new_pack.3b4OlA/_old 2010-05-07 15:38:34.000000000 +0200
+++ /var/tmp/diff_new_pack.3b4OlA/_new 2010-05-07 15:38:34.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package attica (Version 0.1.2)
+# spec file for package attica (Version 0.1.3)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -20,8 +20,8 @@
Name: attica
BuildRequires: cmake kde4-filesystem libqt4-devel
Url: http://websvn.kde.org/trunk/kdesupport/attica
-Version: 0.1.2
-Release: 2
+Version: 0.1.3
+Release: 1
License: LGPLv2.1+
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Group: System/GUI/KDE
++++++ attica-0.1.2.tar.bz2 -> attica-0.1.3.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/CMakeLists.txt new/attica-0.1.3/CMakeLists.txt
--- old/attica-0.1.2/CMakeLists.txt 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/CMakeLists.txt 2010-04-06 18:55:37.000000000 +0200
@@ -2,10 +2,12 @@
set(CMAKE_LIBATTICA_VERSION_MAJOR 0 CACHE INT "Major Attica version number" FORCE)
set(CMAKE_LIBATTICA_VERSION_MINOR 1 CACHE INT "Minor Attica version number" FORCE)
-set(CMAKE_LIBATTICA_VERSION_PATCH 2 CACHE INT "Release Attica version number" FORCE)
+set(CMAKE_LIBATTICA_VERSION_PATCH 3 CACHE INT "Release Attica version number" FORCE)
set(CMAKE_LIBATTICA_VERSION_STRING "${CMAKE_LIBATTICA_VERSION_MAJOR}.${CMAKE_LIBATTICA_VERSION_MINOR}.${CMAKE_LIBATTICA_VERSION_PATCH}" CACHE STRING "Attica version string" FORCE)
cmake_minimum_required(VERSION 2.6)
+set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
+
add_subdirectory(lib)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/ChangeLog new/attica-0.1.3/ChangeLog
--- old/attica-0.1.2/ChangeLog 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/ChangeLog 2010-04-06 18:55:37.000000000 +0200
@@ -6,3 +6,11 @@
- don't link qtgui without reason
- make hasCredentials const (new function)
+0.1.3
+ - Add possibility to get Licenses from server
+ - Add search for contents by username
+ - Add convenience function to get list of download links and fix some related strings
+ - Fix qt-only hasCredentials
+ - Win and Mac compile/link fixes
+ - Fix crash when multiple apps would use attica simultaneously: do not delete root component of qtplugins
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/CMakeLists.txt new/attica-0.1.3/lib/CMakeLists.txt
--- old/attica-0.1.2/lib/CMakeLists.txt 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/CMakeLists.txt 2010-04-06 18:55:37.000000000 +0200
@@ -10,6 +10,11 @@
find_package(Qt4 REQUIRED)
include_directories( ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} )
+# mingw can't handle exported explicit template instantiations in a DLL
+if (MINGW)
+ set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols ${CMAKE_SHARED_LINKER_FLAGS}")
+endif (MINGW)
+
configure_file(version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h)
set(ocsclient_SRCS
@@ -26,6 +31,8 @@
accountbalanceparser.cpp
activity.cpp
activityparser.cpp
+ license.cpp
+ licenseparser.cpp
person.cpp
personparser.cpp
provider.cpp
@@ -55,7 +62,7 @@
VERSION ${CMAKE_LIBATTICA_VERSION_STRING}
SOVERSION ${CMAKE_LIBATTICA_VERSION_MAJOR}
LINK_INTERFACE_LIBRARIES ""
- DEFINE_SYMBOL MAKE_ATTICA_LIB
+ DEFINE_SYMBOL ATTICA_LIB_MAKEDLL
)
target_link_libraries(attica ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY})
@@ -80,6 +87,7 @@
itemjob.h
knowledgebaseentry.h
listjob.h
+ license.h
message.h
metadata.h
person.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/atticabasejob.cpp new/attica-0.1.3/lib/atticabasejob.cpp
--- old/attica-0.1.2/lib/atticabasejob.cpp 2010-01-14 14:00:17.000000000 +0100
+++ new/attica-0.1.3/lib/atticabasejob.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -36,16 +36,16 @@
{
public:
Metadata m_metadata;
- QSharedPointer<PlatformDependent> m_internals;
+ PlatformDependent* m_internals;
QNetworkReply* m_reply;
- Private(QSharedPointer<PlatformDependent> internals)
+ Private(PlatformDependent* internals)
: m_internals(internals), m_reply(0)
{
}
};
-BaseJob::BaseJob(const QSharedPointer<PlatformDependent>& internals)
+BaseJob::BaseJob(PlatformDependent* internals)
: d(new Private(internals))
{
}
@@ -88,6 +88,7 @@
{
d->m_reply = executeRequest();
connect(d->m_reply, SIGNAL(finished()), SLOT(dataFinished()));
+ //qDebug() << d->m_reply->url().toString();
}
void BaseJob::abort()
@@ -101,7 +102,7 @@
PlatformDependent* BaseJob::internals()
{
- return d->m_internals.data();
+ return d->m_internals;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/atticabasejob.h new/attica-0.1.3/lib/atticabasejob.h
--- old/attica-0.1.2/lib/atticabasejob.h 2010-01-14 14:00:17.000000000 +0100
+++ new/attica-0.1.3/lib/atticabasejob.h 2010-04-06 18:55:37.000000000 +0200
@@ -56,6 +56,8 @@
protected:
BaseJob(const QSharedPointer<PlatformDependent>& internals);
+ BaseJob(PlatformDependent* internals);
+
void setMetadata(const Metadata& data) const;
virtual QNetworkReply* executeRequest() = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/atticaclient_export.h new/attica-0.1.3/lib/atticaclient_export.h
--- old/attica-0.1.2/lib/atticaclient_export.h 2010-01-14 14:00:17.000000000 +0100
+++ new/attica-0.1.3/lib/atticaclient_export.h 2010-04-06 18:55:37.000000000 +0200
@@ -25,7 +25,7 @@
#include
#ifndef ATTICA_EXPORT
-# if defined(MAKE_ATTICA_LIB)
+# if defined(ATTICA_LIB_MAKEDLL)
/* We are building this library */
# define ATTICA_EXPORT Q_DECL_EXPORT
# else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/content.cpp new/attica-0.1.3/lib/content.cpp
--- old/attica-0.1.2/lib/content.cpp 2010-01-14 14:00:17.000000000 +0100
+++ new/attica-0.1.3/lib/content.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -25,7 +25,6 @@
#include
-
using namespace Attica;
class Content::Private : public QSharedData {
@@ -169,6 +168,28 @@
return attribute("depend");
}
+QListAttica::DownloadDescription Attica::Content::downloadUrlDescriptions() const
+{
+ QListAttica::DownloadDescription descriptions;
+ QMap::const_iterator iter = d->m_extendedAttributes.constBegin();
+ while (iter != d->m_extendedAttributes.constEnd()) {
+ QString key = iter.key();
+ if (key.startsWith(QLatin1String("downloadname"))) {
+ bool ok;
+ // remove "downloadlink", get the rest as number
+ int num = key.right(key.size() - 12).toInt(&ok);
+ if (ok) {
+ // check if the download actually has a name
+ if (!iter.value().isEmpty()) {
+ descriptions.append(downloadUrlDescription(num));
+ }
+ }
+ }
+ ++iter;
+ }
+ return descriptions;
+}
+
Attica::DownloadDescription Attica::Content::downloadUrlDescription(int number) const
{
QString num(QString::number(number));
@@ -178,14 +199,13 @@
if (number == 1 && attribute("downloadtyp1") == "0") {
desc.setDownloadtypLink(false);
}
-
- desc.setDistributionType(attribute("downloaddistributiontype" + num));
- desc.setName(name());
+ desc.setId(number);
+ desc.setName(attribute("downloadname" + num));
+ desc.setDistributionType(attribute("downloadtype" + num));
desc.setHasPrice(attribute("downloadbuy" + num) == "1");
desc.setLink(attribute("downloadlink" + num));
- desc.setPriceReason(attribute("downloadbuyreason"));
- desc.setPriceAmount(attribute("downloadbuyprice"));
-
+ // desc.setPriceReason(attribute("downloadreason" + num));
+ desc.setPriceAmount(attribute("downloadprice" + num));
return desc;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/content.h new/attica-0.1.3/lib/content.h
--- old/attica-0.1.2/lib/content.h 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/content.h 2010-04-06 18:55:37.000000000 +0200
@@ -27,10 +27,10 @@
#include
#include
#include
+#include
#include "atticaclient_export.h"
#include "downloaddescription.h"
-#include
class QDateTime;
@@ -113,7 +113,7 @@
void setDownloads(int downloads);
/**
- * Gets the number of downloads for the Content.
+ * Gets the number of downloads for the Content (how often this has been downloaded from the server).
* @return the number of downloads
*/
int downloads() const;
@@ -155,8 +155,19 @@
QString changelog() const;
QString version() const;
QString depend() const;
+
+ /**
+ Get the details about a download (a content can have multiple links, eg for different distros).
+ This is not very helpful if we don't know the allowed numbers.
+ */
DownloadDescription downloadUrlDescription(int number) const;
+ /**
+ Get all possible downloads.
+ This is slow searching through lots of strings, so beware and don't call it too often.
+ */
+ QList<DownloadDescription> downloadUrlDescriptions() const;
+
QString previewPicture(const QString& number = QLatin1String("1")) const;
QString smallPreviewPicture(const QString& number = QLatin1String("1")) const;
QString license() const;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/downloaddescription.cpp new/attica-0.1.3/lib/downloaddescription.cpp
--- old/attica-0.1.2/lib/downloaddescription.cpp 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/downloaddescription.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -29,6 +29,7 @@
class DownloadDescription::Private :public QSharedData
{
public:
+ int id;
bool isDownloadtypLink;
bool hasPrice;
QString category;
@@ -68,6 +69,16 @@
return d->category;
}
+int DownloadDescription::id()
+{
+ return d->id;
+}
+
+void DownloadDescription::setId(int id)
+{
+ d->id = id;
+}
+
void DownloadDescription::setCategory(const QString& category)
{
d->category = category;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/downloaddescription.h new/attica-0.1.3/lib/downloaddescription.h
--- old/attica-0.1.2/lib/downloaddescription.h 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/downloaddescription.h 2010-04-06 18:55:37.000000000 +0200
@@ -41,7 +41,12 @@
DownloadDescription& operator=(const DownloadDescription& other);
~DownloadDescription();
-
+
+ /**
+ The id of the description - as one Content can have multiple download descriptions associated.
+ This will simply be 1, 2, ...
+ */
+ int id();
bool isDownloadtypLink();
bool hasPrice();
QString category();
@@ -51,6 +56,7 @@
QString priceReason();
QString priceAmount();
+ void setId(int id);
void setDownloadtypLink(bool isLink);
void setHasPrice(bool hasPrice);
void setCategory(const QString& category);
@@ -59,7 +65,7 @@
void setDistributionType(const QString& distributionType);
void setPriceReason(const QString& priceReason);
void setPriceAmount(const QString& priceAmount);
-
+
private:
class Private;
QSharedDataPointer<Private> d;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/getjob.cpp new/attica-0.1.3/lib/getjob.cpp
--- old/attica-0.1.2/lib/getjob.cpp 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/getjob.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -31,7 +31,7 @@
using namespace Attica;
-GetJob::GetJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request)
+GetJob::GetJob(PlatformDependent* internals, const QNetworkRequest& request)
: BaseJob(internals), m_request(request)
{
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/getjob.h new/attica-0.1.3/lib/getjob.h
--- old/attica-0.1.2/lib/getjob.h 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/getjob.h 2010-04-06 18:55:37.000000000 +0200
@@ -38,6 +38,7 @@
protected:
GetJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request);
+ GetJob(PlatformDependent* internals, const QNetworkRequest& request);
private:
virtual QNetworkReply* executeRequest();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/itemjob.cpp new/attica-0.1.3/lib/itemjob.cpp
--- old/attica-0.1.2/lib/itemjob.cpp 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/itemjob.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -27,7 +27,7 @@
using namespace Attica;
template <class T>
-ItemJob<T>::ItemJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request)
+ItemJob<T>::ItemJob(PlatformDependent* internals, const QNetworkRequest& request)
: GetJob(internals, request)
{
}
@@ -48,13 +48,13 @@
template <class T>
-ItemPostJob<T>::ItemPostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, QIODevice* data)
+ItemPostJob<T>::ItemPostJob(PlatformDependent* internals, const QNetworkRequest& request, QIODevice* data)
: PostJob(internals, request, data)
{
}
template <class T>
-ItemPostJob<T>::ItemPostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, const StringMap& parameters)
+ItemPostJob<T>::ItemPostJob(PlatformDependent* internals, const QNetworkRequest& request, const StringMap& parameters)
: PostJob(internals, request, parameters)
{
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/itemjob.h new/attica-0.1.3/lib/itemjob.h
--- old/attica-0.1.2/lib/itemjob.h 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/itemjob.h 2010-04-06 18:55:37.000000000 +0200
@@ -38,6 +38,7 @@
private:
ItemJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request);
+ ItemJob(PlatformDependent*, const QNetworkRequest& request);
virtual void parse(const QString& xml);
T m_item;
friend class Attica::Provider;
@@ -53,6 +54,8 @@
private:
ItemPostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, QIODevice * data);
ItemPostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, const StringMap& parameters = StringMap());
+ ItemPostJob(PlatformDependent* internals, const QNetworkRequest& request, QIODevice * data);
+ ItemPostJob(PlatformDependent* internals, const QNetworkRequest& request, const StringMap& parameters = StringMap());
virtual void parse(const QString& xml);
T m_item;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/knowledgebaseentry.h new/attica-0.1.3/lib/knowledgebaseentry.h
--- old/attica-0.1.2/lib/knowledgebaseentry.h 2010-01-14 14:00:17.000000000 +0100
+++ new/attica-0.1.3/lib/knowledgebaseentry.h 2010-04-06 18:55:37.000000000 +0200
@@ -28,7 +28,7 @@
#include
#include
-#include <QUrl>
+#include
namespace Attica
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/license.cpp new/attica-0.1.3/lib/license.cpp
--- old/attica-0.1.2/lib/license.cpp 1970-01-01 01:00:00.000000000 +0100
+++ new/attica-0.1.3/lib/license.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -0,0 +1,85 @@
+/*
+ Copyright (c) 2010 Frederik Gladhorn
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see http://www.gnu.org/licenses/.
+
+*/
+
+
+#include "license.h"
+
+using namespace Attica;
+
+class License::Private :public QSharedData
+{
+public:
+ int id;
+ QString name;
+ QUrl url;
+
+ Private() :id(-1)
+ {}
+};
+
+License::License()
+ :d(new Private)
+{
+}
+
+License::License(const Attica::License& other)
+ :d(other.d)
+{
+}
+
+License& License::operator=(const Attica::License& other)
+{
+ d = other.d;
+ return *this;
+}
+
+License::~License()
+{}
+
+uint License::id() const
+{
+ return d->id;
+}
+
+void License::setId(uint id)
+{
+ d->id = id;
+}
+
+QString License::name() const
+{
+ return d->name;
+}
+
+void License::setName(const QString& name)
+{
+ d->name = name;
+}
+
+void License::setUrl(const QUrl& url)
+{
+ d->url = url;
+}
+
+QUrl License::url() const
+{
+ return d->url;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/license.h new/attica-0.1.3/lib/license.h
--- old/attica-0.1.2/lib/license.h 1970-01-01 01:00:00.000000000 +0100
+++ new/attica-0.1.3/lib/license.h 2010-04-06 18:55:37.000000000 +0200
@@ -0,0 +1,87 @@
+/*
+ Copyright (c) 2010 Frederik Gladhorn
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see http://www.gnu.org/licenses/.
+
+*/
+
+
+#ifndef ATTICA_LICENSE_H
+#define ATTICA_LICENSE_H
+
+#include
+#include
+
+#include "atticaclient_export.h"
+
+namespace Attica {
+/**
+ The License class contains information about one license that the server offers.
+ It consists of an integer id, a name and a link to a webpage describing the license.
+ */
+class ATTICA_EXPORT License
+{
+public:
+ typedef QList<License> List;
+ class Parser;
+
+ /**
+ * Creates an empty License
+ */
+ License();
+
+ /**
+ * Copy constructor.
+ * @param other the License to copy from
+ */
+ License(const License& other);
+
+ /**
+ * Assignment operator.
+ * @param other the License to assign from
+ * @return pointer to this License
+ */
+ License& operator=(const License& other);
+
+ /**
+ * Destructor.
+ */
+ ~License();
+
+ /*
+ <id>3</id>
+ <name>Artistic 2.0</name>
+ <link>http://dev.perl.org/perl6/rfc/346.html</link>
+ */
+
+ uint id() const;
+ void setId(uint id);
+
+ QString name() const;
+ void setName(const QString& name);
+
+ QUrl url() const;
+ void setUrl(const QUrl& url);
+
+private:
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+}
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/licenseparser.cpp new/attica-0.1.3/lib/licenseparser.cpp
--- old/attica-0.1.2/lib/licenseparser.cpp 1970-01-01 01:00:00.000000000 +0100
+++ new/attica-0.1.3/lib/licenseparser.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -0,0 +1,52 @@
+/*
+ Copyright (c) 2010 Frederik Gladhorn
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see http://www.gnu.org/licenses/.
+
+*/
+
+
+#include "licenseparser.h"
+
+using namespace Attica;
+
+QStringList License::Parser::xmlElement() const
+{
+ return QStringList("license");
+}
+
+License License::Parser::parseXml(QXmlStreamReader& xml)
+{
+ License item;
+
+ while ( !xml.atEnd() ) {
+ xml.readNext();
+ if ( xml.isStartElement() ) {
+ if ( xml.name() == "id" ) {
+ item.setId( xml.readElementText().toInt() );
+ } else if ( xml.name() == "name" ) {
+ item.setName( xml.readElementText() );
+ } else if ( xml.name() == "link" ) {
+ item.setUrl( xml.readElementText() );
+ }
+ }
+ if (xml.isEndElement() && xml.name() == "license") {
+ break;
+ }
+ }
+ return item;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/licenseparser.h new/attica-0.1.3/lib/licenseparser.h
--- old/attica-0.1.2/lib/licenseparser.h 1970-01-01 01:00:00.000000000 +0100
+++ new/attica-0.1.3/lib/licenseparser.h 2010-04-06 18:55:37.000000000 +0200
@@ -0,0 +1,40 @@
+/*
+ Copyright (c) 2010 Frederik Gladhorn
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see http://www.gnu.org/licenses/.
+
+*/
+
+
+#ifndef ATTICA_LICENSE_PARSER_H
+#define ATTICA_LICENSE_PARSER_H
+
+#include "license.h"
+#include "parser.h"
+
+namespace Attica {
+
+class License::Parser : public Attica::Parser<License>
+{
+private:
+ License parseXml(QXmlStreamReader& xml);
+ QStringList xmlElement() const;
+};
+
+}
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/listjob.cpp new/attica-0.1.3/lib/listjob.cpp
--- old/attica-0.1.2/lib/listjob.cpp 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/listjob.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -30,7 +30,7 @@
template <class T>
-ListJob<T>::ListJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request)
+ListJob<T>::ListJob(PlatformDependent* internals, const QNetworkRequest& request)
: GetJob(internals, request)
{
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/listjob.h new/attica-0.1.3/lib/listjob.h
--- old/attica-0.1.2/lib/listjob.h 2010-01-14 14:00:17.000000000 +0100
+++ new/attica-0.1.3/lib/listjob.h 2010-04-06 18:55:37.000000000 +0200
@@ -44,6 +44,7 @@
private:
ListJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request);
+ ListJob(PlatformDependent* internals, const QNetworkRequest& request);
typename T::List m_itemList;
friend class Attica::Provider;
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/listjob_inst.cpp new/attica-0.1.3/lib/listjob_inst.cpp
--- old/attica-0.1.2/lib/listjob_inst.cpp 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/listjob_inst.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -38,6 +38,8 @@
#include "eventparser.h"
#include "folder.h"
#include "folderparser.h"
+#include "license.h"
+#include "licenseparser.h"
#include "message.h"
#include "messageparser.h"
#include "person.h"
@@ -52,6 +54,7 @@
template class ListJob<Content>;
template class ListJob<Event>;
template class ListJob<Folder>;
+template class ListJob<License>;
template class ListJob<Message>;
template class ListJob<Person>;
template class ListJob<KnowledgeBaseEntry>;
@@ -72,6 +75,7 @@
template class Parser<Event>;
template class Parser<Folder>;
template class Parser<KnowledgeBaseEntry>;
+template class Parser<License>;
template class Parser<Message>;
template class Parser<Person>;
template class Parser<DownloadItem>;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/metadata.cpp new/attica-0.1.3/lib/metadata.cpp
--- old/attica-0.1.2/lib/metadata.cpp 2010-01-14 14:00:17.000000000 +0100
+++ new/attica-0.1.3/lib/metadata.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -49,9 +49,9 @@
Private()
// values that make sense for single item jobs
:error(NoError)
+ ,statusCode(0)
,totalItems(1)
,itemsPerPage(1)
- ,statusCode(0)
{
}
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/metadata.h new/attica-0.1.3/lib/metadata.h
--- old/attica-0.1.2/lib/metadata.h 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/metadata.h 2010-04-06 18:55:37.000000000 +0200
@@ -25,7 +25,7 @@
#include
-#include <QSharedDataPointer>
+#include
#include "atticaclient_export.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/parser.cpp new/attica-0.1.3/lib/parser.cpp
--- old/attica-0.1.2/lib/parser.cpp 2010-01-14 14:00:17.000000000 +0100
+++ new/attica-0.1.3/lib/parser.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -23,7 +23,7 @@
#include "parser.h"
#include <QStringList>
-
+#include <QDebug>
using namespace Attica;
@@ -53,6 +53,10 @@
}
}
}
+ if (xml.hasError()) {
+ // TODO: error handling in metadata?
+ qWarning() << "XML Error: " << xml.errorString() << "\nIn XML:\n" << xmlString;
+ }
return item;
}
@@ -87,6 +91,11 @@
}
}
}
+ if (xml.hasError()) {
+ // TODO: error handling in metadata?
+ qWarning() << "XML Error: " << xml.errorString() << "\nIn XML:\n" << xmlString;
+ }
+
return items;
}
@@ -113,6 +122,11 @@
}
}
}
+ if (xml.hasError()) {
+ // TODO: error handling in metadata?
+ qWarning() << "XML Error: " << xml.errorString();
+ }
+
}
template <class T>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/postjob.cpp new/attica-0.1.3/lib/postjob.cpp
--- old/attica-0.1.2/lib/postjob.cpp 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/postjob.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -34,17 +34,17 @@
using namespace Attica;
-PostJob::PostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, QIODevice* iodevice)
+PostJob::PostJob(PlatformDependent* internals, const QNetworkRequest& request, QIODevice* iodevice)
: BaseJob(internals), m_ioDevice(iodevice), m_request(request)
{
}
-Attica::PostJob::PostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, const QByteArray& byteArray)
+Attica::PostJob::PostJob(PlatformDependent* internals, const QNetworkRequest& request, const QByteArray& byteArray)
: BaseJob(internals), m_ioDevice(0) , m_byteArray(byteArray), m_request(request)
{
}
-PostJob::PostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, const StringMap& parameters)
+PostJob::PostJob(PlatformDependent* internals, const QNetworkRequest& request, const StringMap& parameters)
: BaseJob(internals), m_ioDevice(0), m_request(request)
{
// Create post data
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/postjob.h new/attica-0.1.3/lib/postjob.h
--- old/attica-0.1.2/lib/postjob.h 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/postjob.h 2010-04-06 18:55:37.000000000 +0200
@@ -44,6 +44,10 @@
PostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, const StringMap& parameters = StringMap());
PostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, const QByteArray& byteArray);
+ PostJob(PlatformDependent* internals, const QNetworkRequest& request, QIODevice* data);
+ PostJob(PlatformDependent* internals, const QNetworkRequest& request, const StringMap& parameters = StringMap());
+ PostJob(PlatformDependent* internals, const QNetworkRequest& request, const QByteArray& byteArray);
+
private:
virtual QNetworkReply* executeRequest();
virtual void parse(const QString&);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/provider.cpp new/attica-0.1.3/lib/provider.cpp
--- old/attica-0.1.2/lib/provider.cpp 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/provider.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -39,6 +39,8 @@
#include "folderparser.h"
#include "knowledgebaseentry.h"
#include "knowledgebaseentryparser.h"
+#include "license.h"
+#include "licenseparser.h"
#include "message.h"
#include "messageparser.h"
#include "person.h"
@@ -59,24 +61,25 @@
using namespace Attica;
-class Provider::Private : public QSharedData {
- public:
+class Provider::Private : public QSharedData
+{
+public:
QUrl m_baseUrl;
QUrl m_icon;
QString m_name;
- QSharedPointer<PlatformDependent> m_internals;
+ PlatformDependent* m_internals;
QString m_credentialsUserName;
QString m_credentialsPassword;
Private(const Private& other)
- : QSharedData(other), m_baseUrl(other.m_baseUrl), m_name(other.m_name)
- , m_internals(other.m_internals), m_credentialsUserName(other.m_credentialsUserName)
- , m_credentialsPassword(other.m_credentialsPassword)
+ : QSharedData(other), m_baseUrl(other.m_baseUrl), m_name(other.m_name)
+ , m_internals(other.m_internals), m_credentialsUserName(other.m_credentialsUserName)
+ , m_credentialsPassword(other.m_credentialsPassword)
{
}
- Private(const QSharedPointer<PlatformDependent>& internals, const QUrl& baseUrl, const QString& name, const QUrl& icon)
- : m_baseUrl(baseUrl), m_icon(icon), m_name(name), m_internals(internals)
+ Private(PlatformDependent* internals, const QUrl& baseUrl, const QString& name, const QUrl& icon)
+ : m_baseUrl(baseUrl), m_icon(icon), m_name(name), m_internals(internals)
{
if (m_baseUrl.isEmpty()) {
return;
@@ -96,22 +99,22 @@
Provider::Provider()
- : d(new Private(QSharedPointer<PlatformDependent>(0), QUrl(), QString(), QUrl()))
+ : d(new Private(0, QUrl(), QString(), QUrl()))
{
}
Provider::Provider(const Provider& other)
- : d(other.d)
+ : d(other.d)
{
}
-Provider::Provider(const QSharedPointer<PlatformDependent>& internals, const QUrl& baseUrl, const QString& name, const QUrl& icon)
- : d(new Private(internals, baseUrl, name, icon))
+Provider::Provider(PlatformDependent* internals, const QUrl& baseUrl, const QString& name, const QUrl& icon)
+ : d(new Private(internals, baseUrl, name, icon))
{
}
Provider& Provider::operator=(const Attica::Provider & other)
-{
+ {
d = other.d;
return *this;
}
@@ -183,68 +186,68 @@
ItemJob<Person>* Provider::requestPerson(const QString& id)
{
- QUrl url = createUrl( "person/data/" + id );
- return doRequestPerson( url );
+ QUrl url = createUrl( "person/data/" + id );
+ return doRequestPerson( url );
}
ItemJob<Person>* Provider::requestPersonSelf()
{
- QUrl url = createUrl( "person/self" );
- return doRequestPerson( url );
+ QUrl url = createUrl( "person/self" );
+ return doRequestPerson( url );
}
ItemJob<AccountBalance>* Provider::requestAccountBalance()
{
- QUrl url = createUrl( "person/balance" );
- return doRequestAccountBalance( url );
+ QUrl url = createUrl( "person/balance" );
+ return doRequestAccountBalance( url );
}
ListJob<Person>* Provider::requestPersonSearchByName(const QString& name)
{
- QUrl url = createUrl( "person/data");
- url.addQueryItem("name", name);
- return doRequestPersonList( url );
+ QUrl url = createUrl( "person/data");
+ url.addQueryItem("name", name);
+ return doRequestPersonList( url );
}
ListJob<Person>* Provider::requestPersonSearchByLocation(qreal latitude, qreal longitude, qreal distance, int page, int pageSize)
{
- QUrl url = createUrl( "person/data" );
- url.addQueryItem("latitude", QString::number(latitude));
- url.addQueryItem("longitude", QString::number(longitude));
- if (distance > 0.0) {
- url.addQueryItem("distance", QString::number(distance));
- }
- url.addQueryItem("page", QString::number(page));
- url.addQueryItem("pagesize", QString::number(pageSize));
-
- return doRequestPersonList( url );
+ QUrl url = createUrl( "person/data" );
+ url.addQueryItem("latitude", QString::number(latitude));
+ url.addQueryItem("longitude", QString::number(longitude));
+ if (distance > 0.0) {
+ url.addQueryItem("distance", QString::number(distance));
+ }
+ url.addQueryItem("page", QString::number(page));
+ url.addQueryItem("pagesize", QString::number(pageSize));
+
+ return doRequestPersonList( url );
}
ListJob<Person>* Provider::requestFriends(const QString& id, int page, int pageSize)
{
- QUrl url = createUrl( "friend/data/" + id );
- url.addQueryItem("page", QString::number(page));
- url.addQueryItem("pagesize", QString::number(pageSize));
+ QUrl url = createUrl( "friend/data/" + id );
+ url.addQueryItem("page", QString::number(page));
+ url.addQueryItem("pagesize", QString::number(pageSize));
- return doRequestPersonList( url );
+ return doRequestPersonList( url );
}
ListJob<Person>* Provider::requestSentInvitations(int page, int pageSize)
{
- QUrl url = createUrl("friend/sentinvitations");
- url.addQueryItem("page", QString::number(page));
- url.addQueryItem("pagesize", QString::number(pageSize));
+ QUrl url = createUrl("friend/sentinvitations");
+ url.addQueryItem("page", QString::number(page));
+ url.addQueryItem("pagesize", QString::number(pageSize));
- return doRequestPersonList(url);
+ return doRequestPersonList(url);
}
ListJob<Person>* Provider::requestReceivedInvitations(int page, int pageSize)
{
- QUrl url = createUrl("friend/receivedinvitations");
- url.addQueryItem("page", QString::number(page));
- url.addQueryItem("pagesize", QString::number(pageSize));
+ QUrl url = createUrl("friend/receivedinvitations");
+ url.addQueryItem("page", QString::number(page));
+ url.addQueryItem("pagesize", QString::number(pageSize));
- return doRequestPersonList(url);
+ return doRequestPersonList(url);
}
ListJob<Activity>* Provider::requestActivities()
@@ -301,12 +304,12 @@
ListJob<Folder>* Provider::requestFolders()
{
- return doRequestFolderList( createUrl( "message" ) );
+ return doRequestFolderList( createUrl( "message" ) );
}
ListJob<Message>* Provider::requestMessages(const Folder& folder)
{
- return doRequestMessageList( createUrl( "message/" + folder.id() ) );
+ return doRequestMessageList( createUrl( "message/" + folder.id() ) );
}
@@ -335,54 +338,70 @@
ListJob<Category>* Provider::requestCategories()
{
- QUrl url = createUrl( "content/categories" );
- ListJob<Category> *job = new ListJob<Category>(d->m_internals, createRequest(url));
- return job;
+ QUrl url = createUrl( "content/categories" );
+ ListJob<Category> *job = new ListJob<Category>(d->m_internals, createRequest(url));
+ return job;
+}
+
+ListJob< License >* Provider::requestLicenses()
+{
+ QUrl url = createUrl( "content/licenses" );
+ ListJob<License> *job = new ListJob<License>(d->m_internals, createRequest(url));
+ return job;
}
ListJob<Content>* Provider::searchContents(const Category::List& categories, const QString& search, SortMode sortMode, uint page, uint pageSize)
{
+ return searchContentsByPerson(categories, QString(), search, sortMode, page, pageSize);
+}
+
+ListJob<Content>* Provider::searchContentsByPerson(const Category::List& categories, const QString& person, const QString& search, SortMode sortMode, uint page, uint pageSize)
+{
+ QUrl url = createUrl( "content/data" );
- QUrl url = createUrl( "content/data" );
+ QStringList categoryIds;
+ foreach( const Category &category, categories ) {
+ categoryIds.append( category.id() );
+ }
+ url.addQueryItem( "categories", categoryIds.join( "x" ) );
- QStringList categoryIds;
- foreach( const Category &category, categories ) {
- categoryIds.append( category.id() );
- }
- url.addQueryItem( "categories", categoryIds.join( "x" ) );
-
- url.addQueryItem( "search", search );
- QString sortModeString;
- switch ( sortMode ) {
+ if (!person.isEmpty()) {
+ url.addQueryItem( "user", person );
+ }
+
+ url.addQueryItem( "search", search );
+ QString sortModeString;
+ switch ( sortMode ) {
case Newest:
- sortModeString = "new";
- break;
+ sortModeString = "new";
+ break;
case Alphabetical:
- sortModeString = "alpha";
- break;
+ sortModeString = "alpha";
+ break;
case Rating:
- sortModeString = "high";
- break;
+ sortModeString = "high";
+ break;
case Downloads:
- sortModeString = "down";
- break;
- }
- if ( !sortModeString.isEmpty() ) {
- url.addQueryItem( "sortmode", sortModeString );
- }
- url.addQueryItem( "page", QString::number(page) );
- url.addQueryItem( "pagesize", QString::number(pageSize) );
-
- ListJob<Content> *job = new ListJob<Content>(d->m_internals, createRequest(url));
+ sortModeString = "down";
+ break;
+ }
+
+ if ( !sortModeString.isEmpty() ) {
+ url.addQueryItem( "sortmode", sortModeString );
+ }
+
+ url.addQueryItem( "page", QString::number(page) );
+ url.addQueryItem( "pagesize", QString::number(pageSize) );
- return job;
+ ListJob<Content> *job = new ListJob<Content>(d->m_internals, createRequest(url));
+ return job;
}
ItemJob<Content>* Provider::requestContent(const QString& id)
{
- QUrl url = createUrl( "content/data/" + id );
- ItemJob<Content> *job = new ItemJob<Content>(d->m_internals, createRequest(url));
- return job;
+ QUrl url = createUrl( "content/data/" + id );
+ ItemJob<Content> *job = new ItemJob<Content>(d->m_internals, createRequest(url));
+ return job;
}
ItemPostJob<Content>* Provider::addNewContent(const Category& category, const Content& cont)
@@ -491,6 +510,16 @@
return new PostJob(d->m_internals, postRequest.request(), postRequest.data());
}
+ListJob<Person>* Provider::requestFans(const QString& contentId, uint page, uint pageSize)
+{
+ QUrl url = createUrl( "fan/data/" + contentId );
+ url.addQueryItem( "contentid", contentId );
+ url.addQueryItem( "page", QString::number(page) );
+ url.addQueryItem( "pagesize", QString::number(pageSize) );
+ ListJob<Person> *job = new ListJob<Person>(d->m_internals, createRequest(url));
+ return job;
+}
+
ItemJob<DownloadItem>* Provider::downloadLink(const QString& contentId, const QString& itemId)
{
QUrl url = createUrl( "content/download/" + contentId + '/' + itemId );
@@ -507,37 +536,37 @@
ListJob<KnowledgeBaseEntry>* Provider::searchKnowledgeBase(const Content& content, const QString& search, Provider::SortMode sortMode, int page, int pageSize)
{
- QUrl url = createUrl( "knowledgebase/data" );
- if (content.isValid()) {
- url.addQueryItem("content", content.id());
- }
-
- url.addQueryItem( "search", search );
- QString sortModeString;
- switch ( sortMode ) {
+ QUrl url = createUrl( "knowledgebase/data" );
+ if (content.isValid()) {
+ url.addQueryItem("content", content.id());
+ }
+
+ url.addQueryItem( "search", search );
+ QString sortModeString;
+ switch ( sortMode ) {
case Newest:
- sortModeString = "new";
- break;
+ sortModeString = "new";
+ break;
case Alphabetical:
- sortModeString = "alpha";
- break;
+ sortModeString = "alpha";
+ break;
case Rating:
- sortModeString = "high";
- break;
- //FIXME: knowledge base doesn't have downloads
+ sortModeString = "high";
+ break;
+ //FIXME: knowledge base doesn't have downloads
case Downloads:
- sortModeString = "new";
- break;
- }
- if ( !sortModeString.isEmpty() ) {
- url.addQueryItem( "sortmode", sortModeString );
- }
+ sortModeString = "new";
+ break;
+ }
+ if ( !sortModeString.isEmpty() ) {
+ url.addQueryItem( "sortmode", sortModeString );
+ }
- url.addQueryItem( "page", QString::number(page) );
- url.addQueryItem( "pagesize", QString::number(pageSize) );
+ url.addQueryItem( "page", QString::number(page) );
+ url.addQueryItem( "pagesize", QString::number(pageSize) );
- ListJob<KnowledgeBaseEntry> *job = new ListJob<KnowledgeBaseEntry>(d->m_internals, createRequest(url));
- return job;
+ ListJob<KnowledgeBaseEntry> *job = new ListJob<KnowledgeBaseEntry>(d->m_internals, createRequest(url));
+ return job;
}
ItemJob<Event>* Provider::requestEvent(const QString& id)
@@ -548,38 +577,38 @@
ListJob<Event>* Provider::requestEvent(const QString& country, const QString& search, const QDate& startAt, Provider::SortMode mode, int page, int pageSize)
{
- QUrl url = createUrl("event/data");
+ QUrl url = createUrl("event/data");
- if (!search.isEmpty()) {
- url.addQueryItem("search", search);
- }
+ if (!search.isEmpty()) {
+ url.addQueryItem("search", search);
+ }
- QString sortModeString;
- switch (mode) {
+ QString sortModeString;
+ switch (mode) {
case Newest:
- sortModeString = "new";
- break;
+ sortModeString = "new";
+ break;
case Alphabetical:
- sortModeString = "alpha";
- break;
+ sortModeString = "alpha";
+ break;
default:
break;
- }
- if (!sortModeString.isEmpty()) {
- url.addQueryItem("sortmode", sortModeString);
- }
-
- if (!country.isEmpty()) {
- url.addQueryItem("country", country);
- }
-
- url.addQueryItem("startat", startAt.toString(Qt::ISODate));
+ }
+ if (!sortModeString.isEmpty()) {
+ url.addQueryItem("sortmode", sortModeString);
+ }
+
+ if (!country.isEmpty()) {
+ url.addQueryItem("country", country);
+ }
+
+ url.addQueryItem("startat", startAt.toString(Qt::ISODate));
- url.addQueryItem("page", QString::number(page));
- url.addQueryItem("pagesize", QString::number(pageSize));
+ url.addQueryItem("page", QString::number(page));
+ url.addQueryItem("pagesize", QString::number(pageSize));
- ListJob<Event>* job = new ListJob<Event>(d->m_internals, createRequest(url));
- return job;
+ ListJob<Event>* job = new ListJob<Event>(d->m_internals, createRequest(url));
+ return job;
}
QUrl Provider::createUrl(const QString& path)
@@ -597,7 +626,7 @@
QNetworkRequest request(url);
if (!d->m_credentialsUserName.isEmpty()) {
- QString concatenated = d->m_credentialsUserName + ":" + d->m_credentialsPassword;
+ QString concatenated = d->m_credentialsUserName + ':' + d->m_credentialsPassword;
QByteArray data = concatenated.toLocal8Bit().toBase64();
QString headerData = "Basic " + data;
request.setRawHeader("Authorization", headerData.toLocal8Bit());
@@ -615,12 +644,12 @@
ItemJob<Person>* Provider::doRequestPerson(const QUrl& url)
{
- return new ItemJob<Person>(d->m_internals, createRequest(url));
+ return new ItemJob<Person>(d->m_internals, createRequest(url));
}
ItemJob<AccountBalance>* Provider::doRequestAccountBalance(const QUrl& url)
{
- return new ItemJob<AccountBalance>(d->m_internals, createRequest(url));
+ return new ItemJob<AccountBalance>(d->m_internals, createRequest(url));
}
ListJob<Person>* Provider::doRequestPersonList(const QUrl& url)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/provider.h new/attica-0.1.3/lib/provider.h
--- old/attica-0.1.2/lib/provider.h 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/provider.h 2010-04-06 18:55:37.000000000 +0200
@@ -28,14 +28,14 @@
#include
#include
-#include <QUrl>
+#include
#include "atticaclient_export.h"
#include "category.h"
#include "itemjob.h"
#include "listjob.h"
#include "message.h"
-
+
class QDate;
class QUrl;
@@ -51,6 +51,7 @@
class Event;
class Folder;
class KnowledgeBaseEntry;
+class License;
class Person;
class PostJob;
class Provider;
@@ -61,7 +62,7 @@
* The Provider class represents one Open Collaboration Service provider.
* Use the ProviderManager to instanciate a Provider.
*
- * Accessing funtions of the Provider returns a Job class that
+ * Accessing functions of the Provider returns a Job class that
* takes care of accessing the server and parsing the result.
*/
class ATTICA_EXPORT Provider
@@ -131,7 +132,38 @@
* @return the categories of the server
*/
ListJob<Category>* requestCategories();
- ListJob<Content>* searchContents(const Category::List& categories, const QString& search = QString(), SortMode mode = Rating, uint page = 1, uint pageSize = 10);
+
+ /**
+ * Get a list of licenses (such as GPL)
+ * @return the licenses available from the server
+ */
+ ListJob<License>* requestLicenses();
+
+ /**
+ Request a list of Contents.
+ Note that @p categories is not optional. If left empty, no results will be returned.
+ An empty search string @p search returns the top n items.
+ @param categories categories to search in
+ @param search optional search string (in name/description of the content)
+ @param mode sorting mode
+ @param page request nth page in the list of results
+ @param pageSize requested size of pages when calculating the list of results
+ @return list job for the search results
+ */
+ ListJob<Content>* searchContents(const Category::List& categories, const QString& search = QString(), SortMode mode = Rating, uint page = 0, uint pageSize = 10);
+
+ /**
+ Request a list of Contents.
+ Like @see searchContents, but only contents created by one person.
+ @param person the person-id that created the contents.
+ */
+ ListJob<Content>* searchContentsByPerson(const Category::List& categories, const QString& person, const QString& search = QString(), SortMode mode = Rating, uint page = 0, uint pageSize = 10);
+
+ /**
+ Retrieve a single content.
+ @param contentId the id of the content
+ @return job that retrieves the content object
+ */
ItemJob<Content>* requestContent(const QString& contentId);
ItemJob<DownloadItem>* downloadLink(const QString& contentId, const QString& itemId = QLatin1String("1"));
@@ -168,6 +200,7 @@
// Fan part of OCS
PostJob* becomeFan(const QString& contentId);
+ ListJob<Person>* requestFans(const QString& contentId, uint page = 0, uint pageSize = 10);
protected:
QUrl createUrl(const QString& path);
@@ -186,8 +219,11 @@
class Private;
QExplicitlySharedDataPointer<Private> d;
- // FIXME use baseUrl as id
+ // old constructor: used to pass internals as QSharedPointer, but changed to pointer
+ // deleting the root objects of plugins is evil (see QPluginLoaded docs)
Provider(const QSharedPointer<PlatformDependent>& internals, const QUrl& baseUrl, const QString& name, const QUrl& icon = QUrl());
+ // FIXME use baseUrl as id
+ Provider(PlatformDependent* internals, const QUrl& baseUrl, const QString& name, const QUrl& icon = QUrl());
// TODO remove
friend class ProviderManager;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/providermanager.cpp new/attica-0.1.3/lib/providermanager.cpp
--- old/attica-0.1.2/lib/providermanager.cpp 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/providermanager.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -50,11 +50,12 @@
class ProviderManager::Private {
public:
- QSharedPointer<PlatformDependent> m_internals;
+ PlatformDependent* m_internals;
QHash m_providers;
QHash m_providerFiles;
QSignalMapper m_downloadMapping;
QHash m_downloads;
+ QPluginLoader m_pluginLoader;
bool m_authenticationSuppressed;
Private()
@@ -64,6 +65,7 @@
}
~Private()
{
+ // do not delete m_internals: it is the root component of a plugin!
}
};
@@ -87,10 +89,10 @@
foreach(const QString& path, paths) {
QString libraryPath(path + '/' + pluginName);
- qDebug() << "trying to load " << libraryPath;
+ qDebug() << "Trying to load " << libraryPath;
if (QFile::exists(libraryPath)) {
- QPluginLoader loader(libraryPath);
- QObject* plugin = loader.instance();
+ d->m_pluginLoader.setFileName(libraryPath);
+ QObject* plugin = d->m_pluginLoader.instance();
if (plugin) {
PlatformDependent* platformDependent = qobject_cast(plugin);
if (platformDependent) {
@@ -108,14 +110,14 @@
ProviderManager::ProviderManager()
: d(new Private)
{
- d->m_internals = QSharedPointer<PlatformDependent>(loadPlatformDependent());
+ d->m_internals = loadPlatformDependent();
connect(d->m_internals->nam(), SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), SLOT(authenticate(QNetworkReply*,QAuthenticator*)));
connect(&d->m_downloadMapping, SIGNAL(mapped(QString)), SLOT(fileFinished(QString)));
}
void ProviderManager::loadDefaultProviders()
{
- QTimer::singleShot(0, this, SLOT(init()));
+ QTimer::singleShot(0, this, SLOT(slotLoadDefaultProvidersInternal()));
}
void ProviderManager::setAuthenticationSuppressed(bool suppressed)
@@ -128,8 +130,8 @@
d->m_providers.clear();
}
-
-void ProviderManager::init() {
+void ProviderManager::slotLoadDefaultProvidersInternal()
+{
foreach (const QUrl& url, d->m_internals->getDefaultProviderFiles()) {
addProviderFile(url);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/providermanager.h new/attica-0.1.3/lib/providermanager.h
--- old/attica-0.1.2/lib/providermanager.h 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/providermanager.h 2010-04-06 18:55:37.000000000 +0200
@@ -93,7 +93,7 @@
void fileFinished(const QString& url);
void authenticate(QNetworkReply*, QAuthenticator*);
void proxyAuthenticationRequired(const QNetworkProxy& proxy, QAuthenticator* authenticator);
- void init();
+ void slotLoadDefaultProvidersInternal();
private:
ProviderManager(const ProviderManager& other);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attica-0.1.2/lib/qtplatformdependent.cpp new/attica-0.1.3/lib/qtplatformdependent.cpp
--- old/attica-0.1.2/lib/qtplatformdependent.cpp 2010-01-14 14:00:18.000000000 +0100
+++ new/attica-0.1.3/lib/qtplatformdependent.cpp 2010-04-06 18:55:37.000000000 +0200
@@ -48,7 +48,7 @@
bool QtPlatformDependent::hasCredentials(const QUrl& baseUrl) const
{
- return !m_passwords.contains(baseUrl.toString());
+ return m_passwords.contains(baseUrl.toString());
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org