Attica
provider.cpp
128 Private(PlatformDependent *internals, const QUrl &baseUrl, const QString &name, const QUrl &icon,
129 const QString &person, const QString &friendV, const QString &message, const QString &achievement,
131 const QString &knowledgebase, const QString &event, const QString &comment, const QString ®isterUrl,
154 if (m_internals->hasCredentials(m_baseUrl) && m_internals->loadCredentials(m_baseUrl, user, pass)) {
175 Provider::Provider(PlatformDependent *internals, const QUrl &baseUrl, const QString &name, const QUrl &icon,
176 const QString &person, const QString &friendV, const QString &message, const QString &achievement,
179 : d(new Private(internals, baseUrl, name, icon, person, friendV, message, achievement, activity, content,
184 Provider::Provider(PlatformDependent *internals, const QUrl &baseUrl, const QString &name, const QUrl &icon,
185 const QString &person, const QString &friendV, const QString &message, const QString &achievement,
187 const QString &knowledgebase, const QString &event, const QString &comment, const QString ®isterUrl)
188 : d(new Private(internals, baseUrl, name, icon, person, friendV, message, achievement, activity, content,
193 Provider::Provider(PlatformDependent *internals, const QUrl &baseUrl, const QString &name, const QUrl &icon,
194 const QString &person, const QString &friendV, const QString &message, const QString &achievement,
196 const QString &knowledgebase, const QString &event, const QString &comment, const QString ®isterUrl,
198 : d(new Private(internals, baseUrl, name, icon, person, friendV, message, achievement, activity, content,
308 return new PostJob(d->m_internals, createRequest(QLatin1String("person/check")), postParameters);
321 PostJob *Provider::registerAccount(const QString &id, const QString &password, const QString &mail, const QString &firstName, const QString &lastName)
386 ListJob<Person> *Provider::requestPersonSearchByLocation(qreal latitude, qreal longitude, qreal distance, int page, int pageSize)
451 ListJob<Achievement> *Provider::requestAchievements(const QString &contentId, const QString &achievementId, const QString &userId)
464 ItemPostJob<Achievement> *Provider::addNewAchievement(const QString &contentId, const Achievement &newAchievement)
480 postParameters.insert(QString::fromLatin1("dependencies[%1]").arg(QString::number(i++)), dependency);
483 postParameters.insert(QLatin1String("type"), Achievement::achievementTypeToString(newAchievement.type()));
490 postParameters.insert(QLatin1String("visibility"), Achievement::achievementVisibilityToString(newAchievement.visibility()));
492 return new ItemPostJob<Achievement>(d->m_internals, createRequest(QLatin1String("achievements/content/") + contentId), postParameters);
495 PutJob *Provider::editAchievement(const QString &contentId, const QString &achievementId, const Achievement &achievement)
515 postParameters.insert(QString::fromLatin1("dependencies[%1]").arg(QString::number(i++)), dependency);
518 postParameters.insert(QLatin1String("type"), Achievement::achievementTypeToString(achievement.type()));
525 postParameters.insert(QLatin1String("visibility"), Achievement::achievementVisibilityToString(achievement.visibility()));
527 return new ItemPutJob<Achievement>(d->m_internals, createRequest(QLatin1String("achievement/content/") + contentId + achievementId), postParameters);
540 return new ItemDeleteJob<Achievement>(d->m_internals, createRequest(QLatin1String("achievements/progress/") + contentId + achievementId));
543 PostJob *Provider::setAchievementProgress(const QString &id, const QVariant &progress, const QDateTime ×tamp)
554 return new ItemPostJob<Achievement>(d->m_internals, createRequest(QLatin1String("achievements/progress/") + id), postParameters);
567 return new ItemDeleteJob<Achievement>(d->m_internals, createRequest(QLatin1String("achievements/progress/") + id));
620 postParameters.insert(QLatin1String("developers"), project.developers().join(QLatin1Char('\n')));
631 // The specfile generator expects an empty string parameter if it is supposed to regenerate the spec file
854 postParameters.insert(QLatin1String("typeid"), account.remoteServiceId()); // FIXME: remoteserviceid?
856 //qCDebug(ATTICA) << "Creating new Remoteaccount" << account.id() << account.login() << account.password();
857 return new PostJob(d->m_internals, createRequest(QLatin1String("buildservice/remoteaccounts/add")),
874 postParameters.insert(QLatin1String("typeid"), account.remoteServiceId()); // FIXME: remoteserviceid?
876 //qCDebug(ATTICA) << "Creating new Remoteaccount" << account.id() << account.login() << account.password();
877 return new PostJob(d->m_internals, createRequest(QLatin1String("buildservice/remoteaccounts/edit/") + account.id()),
904 PostJob *Provider::uploadTarballToBuildService(const QString &projectId, const QString &fileName, const QByteArray &payload)
913 postRequest.addFile(fileName, payload, QLatin1String("application/octet-stream"), QLatin1String("source"));
938 return new PostJob(d->m_internals, createRequest(QLatin1String("friend/invite/") + to), postParameters);
968 PostJob *Provider::postLocation(qreal latitude, qreal longitude, const QString &city, const QString &country)
979 return new PostJob(d->m_internals, createRequest(QLatin1String("person/self")), postParameters);
1019 return new ItemJob<Message>(d->m_internals, createRequest(QLatin1String("message/") + folder.id() + QLatin1Char('/') + id));
1079 ListJob<Content> *Provider::searchContents(const Category::List &categories, const QString &search, SortMode sortMode, uint page, uint pageSize)
1081 return searchContents(categories, QString(), Distribution::List(), License::List(), search, sortMode, page, pageSize);
1084 ListJob<Content> *Provider::searchContentsByPerson(const Category::List &categories, const QString &person, const QString &search, SortMode sortMode, uint page, uint pageSize)
1086 return searchContents(categories, person, Distribution::List(), License::List(), search, sortMode, page, pageSize);
1089 ListJob<Content> *Provider::searchContents(const Category::List &categories, const QString &person, const Distribution::List &distributions, const License::List &licenses, const QString &search, SortMode sortMode, uint page, uint pageSize)
1177 ItemPostJob<Content> *Provider::editContent(const Category &updatedCategory, const QString &contentId, const Content &updatedContent)
1219 PostJob *Provider::setDownloadFile(const QString &contentId, const QString &fileName, const QByteArray &payload)
1245 PostJob *Provider::setPreviewImage(const QString &contentId, const QString &previewId, const QString &fileName, const QByteArray &image)
1251 QUrl url = createUrl(QLatin1String("content/uploadpreview/") + contentId + QLatin1Char('/') + previewId);
1268 QUrl url = createUrl(QLatin1String("content/deletepreview/") + contentId + QLatin1Char('/') + previewId);
1283 postParameters.insert(QLatin1String("vote"), positiveVote ? QLatin1String("good") : QLatin1String("bad"));
1285 return new PostJob(d->m_internals, createRequest(QLatin1String("content/vote/") + contentId), postParameters);
1304 return new PostJob(d->m_internals, createRequest(QLatin1String("content/vote/") + contentId), postParameters);
1350 ListJob<Topic> *Provider::requestTopics(const QString &forum, const QString &search, const QString &description, Provider::SortMode mode, int page, int pageSize)
1382 PostJob *Provider::postTopic(const QString &forumId, const QString &subject, const QString &content)
1392 return new PostJob(d->m_internals, createRequest(QLatin1String("forum/topic/add")), postParameters);
1401 QUrl url = createUrl(QLatin1String("content/download/") + contentId + QLatin1Char('/') + itemId);
1413 ItemJob<KnowledgeBaseEntry> *job = new ItemJob<KnowledgeBaseEntry>(d->m_internals, createRequest(url));
1417 ListJob<KnowledgeBaseEntry> *Provider::searchKnowledgeBase(const Content &content, const QString &search, Provider::SortMode sortMode, int page, int pageSize)
1454 ListJob<KnowledgeBaseEntry> *job = new ListJob<KnowledgeBaseEntry>(d->m_internals, createRequest(url));
1464 ItemJob<Event> *job = new ItemJob<Event>(d->m_internals, createRequest(QLatin1String("event/data/") + id));
1468 ListJob<Event> *Provider::requestEvent(const QString &country, const QString &search, const QDate &startAt, Provider::SortMode mode, int page, int pageSize)
1510 ListJob<Comment> *Provider::requestComments(const Comment::Type commentType, const QString &id, const QString &id2, int page, int pageSize)
1522 QUrl url = createUrl(QLatin1String("comments/data/") + commentTypeString + QLatin1Char('/') + id + QLatin1Char('/') + id2);
1533 ItemPostJob<Comment> *Provider::addNewComment(const Comment::Type commentType, const QString &id, const QString &id2, const QString &parentId, const QString &subject, const QString &message)
1554 return new ItemPostJob<Comment>(d->m_internals, createRequest(QLatin1String("comments/add")), postParameters);
1570 PostJob *Provider::setPrivateData(const QString &app, const QString &key, const QString &value)
1576 QUrl url = createUrl(QLatin1String("privatedata/setattribute/") + app + QLatin1Char('/') + key);
1590 ItemJob<PrivateData> *job = new ItemJob<PrivateData>(d->m_internals, createRequest(QLatin1String("privatedata/getattribute/") + app + QLatin1Char('/') + key));
1603 request.setHeader(QNetworkRequest::ContentTypeHeader,QStringLiteral("application/x-www-form-urlencoded"));
1607 agentHeader = QString::fromLocal8Bit("%1/%2").arg(QCoreApplication::instance()->applicationName(), QCoreApplication::instance()->applicationVersion());
1609 agentHeader = QString::fromLocal8Bit("Attica/%1").arg(QLatin1String(LIBATTICA_VERSION_STRING));
1612 agentHeader = QString::fromLocal8Bit("%1 (+%2)").arg(agentHeader, d->m_additionalAgentInformation);
1617 request.setAttribute((QNetworkRequest::Attribute) BaseJob::UserAttribute, QVariant(d->m_credentialsUserName));
1618 request.setAttribute((QNetworkRequest::Attribute) BaseJob::PasswordAttribute, QVariant(d->m_credentialsPassword));
PostJob * setPreviewImage(const QString &contentId, const QString &previewId, const QString &fileName, const QByteArray &image)
Upload an image file as preview for the content.
Definition: provider.cpp:1245
QString toString(Qt::DateFormat format) const const
The Distribution class contains information about one distribution that the server offers...
Definition: distribution.h:24
bool isEnabled() const
Test if the provider is enabled by the settings.
Definition: provider.cpp:223
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.
Definition: provider.cpp:1079
DeleteJob * deleteAchievement(const QString &contentId, const QString &achievementId)
Deletes an achievement on the server.
Definition: provider.cpp:530
QString name() const
A name for the provider that can be displayed to the user.
Definition: provider.cpp:249
ItemJob< RemoteAccount > * requestRemoteAccount(const QString &id)
Get a remote account by its ID.
Definition: provider.cpp:881
Attribute
QString toString(Qt::DateFormat format) const const
Rating
PostJob * createBuildServiceJob(const BuildServiceJob &job)
Create a new job for a given project on a given buildservice for a given target.
Definition: provider.cpp:779
void reserve(int alloc)
ISODate
QString forumServiceVersion() const
Version of the forum part of the API.
Definition: provider.cpp:1699
bool hasContentService() const
Test if the server supports the content part of the API.
Definition: provider.cpp:1733
PostJob * deleteRemoteAccount(const QString &id)
Deletes a remote account stored on the OCS server.
Definition: provider.cpp:892
QDebug & nospace()
ListJob< Project > * requestProjects()
Get a list of build service projects.
Definition: provider.cpp:581
QString join(const QString &separator) const const
PostJob * publishBuildJob(const BuildServiceJob &buildjob, const Publisher &publisher)
Publish the result of a completed build job to a publisher.
Definition: provider.cpp:708
QString contentServiceVersion() const
Version of the content part of the API.
Definition: provider.cpp:1691
bool isEmpty() const const
QString personServiceVersion() const
Version of the person part of the API.
Definition: provider.cpp:1715
bool hasKnowledgebaseService() const
Test if the server supports the knowledgebase part of the API.
Definition: provider.cpp:1749
bool hasForumService() const
Test if the server supports the forum part of the API.
Definition: provider.cpp:1741
PostJob * editRemoteAccount(const RemoteAccount &account)
Edit an existing remote account.
Definition: provider.cpp:861
bool saveCredentials(const QString &user, const QString &password)
Sets (and remembers) user name and password for this provider.
Definition: provider.cpp:286
void addQueryItem(const QString &key, const QString &value)
PostJob * cancelBuildServiceJob(const BuildServiceJob &job)
Cancel a job.
Definition: provider.cpp:766
QString number(int n, int base)
int count(const T &value) const const
QString fromLocal8Bit(const char *str, int size)
ItemJob< BuildServiceJobOutput > * requestBuildServiceJobOutput(const QString &id)
Get the build output for a specific build service job.
Definition: provider.cpp:724
void append(const T &value)
ItemJob< Publisher > * requestPublisher(const QString &id)
Get the information for a specific publisher.
Definition: provider.cpp:681
bool hasCommentService() const
Test if the server supports the comments part of the API.
Definition: provider.cpp:1729
bool hasFriendService() const
Test if the server supports the friend part of the API.
Definition: provider.cpp:1745
void setAdditionalAgentInformation(const QString &additionalInformation)
Set a custom identifier for your application (sent along with the requests as the http agent header i...
Definition: provider.cpp:241
ContentTypeHeader
bool isEmpty() const const
bool isValid() const
Returns true if the provider has been set up and can be used.
Definition: provider.cpp:218
bool loadCredentials(QString &user, QString &password)
Load user name and password from the store.
Definition: provider.cpp:272
QCoreApplication * instance()
PostJob * setPrivateData(const QString &app, const QString &key, const QString &value)
Sets the value of an attribute.
Definition: provider.cpp:1570
bool hasAchievementService() const
Test if the server supports the achievement part of the API.
Definition: provider.cpp:1720
ListJob< License > * requestLicenses()
Get a list of licenses (such as GPL)
Definition: provider.cpp:1046
PutJob * editAchievement(const QString &contentId, const QString &achievementId, const Achievement &achievement)
Post modifications to an Achievement on the server.
Definition: provider.cpp:495
QString commentServiceVersion() const
Version of the comments part of the API.
Definition: provider.cpp:1687
bool hasPersonService() const
Test if the server supports the person part of the API.
Definition: provider.cpp:1757
QDebug & space()
bool hasMessageService() const
Test if the server supports the message part of the API.
Definition: provider.cpp:1753
void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)
QString achievementServiceVersion() const
Version of the achievement part of the API.
Definition: provider.cpp:1678
QString knowledgebaseServiceVersion() const
Version of the knowledgebase part of the API.
Definition: provider.cpp:1707
QString friendServiceVersion() const
Version of the friend part of the API.
Definition: provider.cpp:1703
PostJob * createProject(const Project &project)
Post modifications to a Project on the server.
Definition: provider.cpp:639
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
const char * data() const const
ListJob< BuildServiceJob > * requestBuildServiceJobs(const Project &project)
Get a list of build service projects.
Definition: provider.cpp:819
ListJob< Distribution > * requestDistributions()
Get a list of distributions (such as Ark, Debian)
Definition: provider.cpp:1057
PostJob * voteForComment(const QString &id, uint rating)
Vote a comment item.
Definition: provider.cpp:1557
The Provider class represents one Open Collaboration Service provider.
Definition: provider.h:95
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
Attica::PostJob * uploadTarballToBuildService(const QString &projectId, const QString &fileName, const QByteArray &payload)
Upload a tarball to the buildservice.
Definition: provider.cpp:904
The License class contains information about one license that the server offers.
Definition: license.h:21
void setAttribute(QNetworkRequest::Attribute code, const QVariant &value)
PostJob * savePublisherField(const Project &project, const PublisherField &field)
Save the value of a single publishing field.
Definition: provider.cpp:692
void setQuery(const QString &query, QUrl::ParsingMode mode)
ItemPostJob< Comment > * addNewComment(const Comment::Type commentType, const QString &id, const QString &id2, const QString &parentId, const QString &subject, const QString &message)
Add a new comment.
Definition: provider.cpp:1533
bool hasFanService() const
Test if the server supports the fan part of the API.
Definition: provider.cpp:1737
PostJob * createRemoteAccount(const RemoteAccount &account)
Create a new remote account, an account for a build service instance which is stored in the OCS servi...
Definition: provider.cpp:841
QString fromLatin1(const char *str, int size)
ListJob< Category > * requestCategories()
Get a list of categories (such as wallpaper)
Definition: provider.cpp:1035
ItemJob< BuildServiceJob > * requestBuildServiceJob(const QString &id)
Get the information for a specific build service job, such as status and progress.
Definition: provider.cpp:735
QMap::iterator insert(const Key &key, const T &value)
QMap< QString, QString > attributes() const
Get all attributes that are not included in the basis set of attributes exposed by the Content class...
Definition: content.cpp:139
bool hasCredentials() const
Test if the provider has user name/password available.
Definition: provider.cpp:263
QString messageServiceVersion() const
Version of the message part of the API.
Definition: provider.cpp:1711
ItemJob< Content > * requestContent(const QString &contentId)
Retrieve a single content.
Definition: provider.cpp:1149
PostJob * deleteProject(const Project &project)
Deletes a project on the server.
Definition: provider.cpp:660
PostJob * voteForContent(const QString &contentId, bool positiveVote)
Vote for a content item This version is for the old OCS API < 1.6.
Definition: provider.cpp:1276
PostJob * editProject(const Project &project)
Post modifications to a Project on the server.
Definition: provider.cpp:649
ItemJob< PrivateData > * requestPrivateData()
Fetches all stored private data.
Definition: provider.h:318
ListJob< Content > * searchContentsByPerson(const Category::List &categories, const QString &person, const QString &search=QString(), SortMode mode=Rating, uint page=0, uint pageSize=10)
Request a list of Contents.
Definition: provider.cpp:1084
QString toString() const const
Definition: accountbalance.h:15
ListJob< BuildService > * requestBuildServices()
Get a list of build service build services.
Definition: provider.cpp:797
ListJob< Achievement > * requestAchievements(const QString &contentId, const QString &achievementId, const QString &userId)
Get a list of achievements.
Definition: provider.cpp:451
ItemPostJob< Achievement > * addNewAchievement(const QString &id, const Achievement &newAchievement)
Add a new achievement.
Definition: provider.cpp:464
ListJob< RemoteAccount > * requestRemoteAccounts()
Get a list of remote accounts, account for a build service instance which is stored in the OCS servic...
Definition: provider.cpp:830
ListJob< HomePageType > * requestHomePageTypes()
Get a list of home page types (such as blog, Facebook)
Definition: provider.cpp:1068
bool hasActivityService() const
Test if the server supports the activity part of the API.
Definition: provider.cpp:1725
QString activityServiceVersion() const
Version of the activity part of the API.
Definition: provider.cpp:1683
ItemJob< Project > * requestProject(const QString &id)
Get a Project's data.
Definition: provider.cpp:592
ItemJob< BuildService > * requestBuildService(const QString &id)
Get the information for a specific build service instance.
Definition: provider.cpp:671
QString additionalAgentInformation() const
The custom identifier sent along with requests.
Definition: provider.cpp:245
PostJob * checkLogin(const QString &user, const QString &password)
Test if the server accepts the login/password.
Definition: provider.cpp:297
ListJob< Comment > * requestComments(const Comment::Type commentType, const QString &id, const QString &id2, int page, int pageSize)
Request a list of comments for a content / forum / knowledgebase / event.
Definition: provider.cpp:1510
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 18 2021 23:03:37 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 18 2021 23:03:37 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.