Commit 3f3241ae authored by Laurent Montel's avatar Laurent Montel 😁

Remove facebook resource

parent 6e6c49d3
......@@ -31,10 +31,6 @@ set_package_properties(Libkolab PROPERTIES DESCRIPTION "libkolab" URL "http://mi
find_package(Libkolabxml 1.0 QUIET CONFIG)
set_package_properties(Libkolabxml PROPERTIES DESCRIPTION "Kolabxml" URL "http://mirror.kolabsys.com/pub/releases" TYPE OPTIONAL PURPOSE "The Kolab XML Format Schema Definitions Library is required to build the Kolab Groupware Resource")
# Libkfbapi
find_package(KF5FbAPI 1.0 QUIET CONFIG)
set_package_properties(LibKFbAPI PROPERTIES DESCRIPTION "A library to access Facebook services" URL "http://projects.kde.org/libkfbapi" TYPE OPTIONAL PURPOSE "LibKFbAPI is required to build Akonadi resources to access Facebook's contacts, events, notes and posts" )
# KAccouunts bits
find_package(KAccounts CONFIG)
find_package(AccountsQt5 1.13 CONFIG)
......@@ -94,10 +90,6 @@ if( KF5GAPI_FOUND )
#add_subdirectory( gmail )
endif()
if (KF5FbAPI_FOUND AND KAccounts_FOUND AND AccountsQt5_FOUND)
add_subdirectory(facebook)
endif()
add_subdirectory( shared )
add_subdirectory( birthdays )
add_subdirectory( mixedmaildir )
......
project(facebookresource)
add_definitions(-DTRANSLATION_DOMAIN=\"akonadi_facebook_resource\")
include_directories(${ACCOUNTSQT_INCLUDE_DIRS} ${SIGNONQT_INCLUDE_DIRS})
set(facebookresource_SRCS
facebookresource.cpp
facebookresource_events.cpp
facebookresource_notes.cpp
facebookresource_posts.cpp
facebookresource_notifications.cpp
settings.cpp
# settingsdialog.cpp
timestampattribute.cpp
${facebookresource_SRCS}
)
ki18n_wrap_ui(facebookresource_SRCS settingsdialog.ui)
kconfig_add_kcfg_files(facebookresource_SRCS settingsbase.kcfgc)
kcfg_generate_dbus_interface(
${CMAKE_CURRENT_SOURCE_DIR}/settingsbase.kcfg
org.kde.Akonadi.Facebook.Settings
)
qt5_add_dbus_adaptor(facebookresource_SRCS
${CMAKE_CURRENT_BINARY_DIR}/org.kde.Akonadi.Facebook.Settings.xml
settings.h
Settings
)
add_executable(akonadi_facebook_resource ${facebookresource_SRCS})
if( APPLE )
set_target_properties(
akonadi_facebook_resource PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.template
)
set_target_properties(
akonadi_facebook_resource PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER "org.kde.Akonadi.Facebook"
)
set_target_properties(
akonadi_facebook_resource PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "KDE Akonadi Facebook Resource"
)
endif()
include_directories(${Boost_INCLUDE_DIR})
target_link_libraries(akonadi_facebook_resource
Qt5::Core
Qt5::Gui
KF5::I18n
KF5::Notifications
KF5::Syndication
KF5::AkonadiCore
KF5::AkonadiAgentBase
KF5::Contacts
KF5::CalendarCore
KF5::AkonadiNotes
KF5::Mime
KF5::FbAPI
KF5::AkonadiSocialUtils
KAccounts
${ACCOUNTSQT_LIBRARIES}
${SIGNONQT_LIBRARIES}
)
add_subdirectory(icons)
add_subdirectory(serializer)
install(TARGETS akonadi_facebook_resource ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES facebookresource.desktop DESTINATION "${CMAKE_INSTALL_PREFIX}/share/akonadi/agents")
install(FILES akonadi_facebook_resource.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR})
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleGetInfoString</key>
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>LSUIElement</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
</dict>
</plist>
#! /usr/bin/env bash
$EXTRACTRC `find . -name '*.ui' -o -name '*.kcfg'` >> rc.cpp || exit 11
$XGETTEXT *.cpp -o $podir/akonadi_facebook_resource.pot
rm -f rc.cpp
[Global]
Comment=Akonadi's Facebook integration
Comment[bs]=Akonadi Facebook integracija
Comment[ca]=Integració de Facebook amb Akonadi
Comment[ca@valencia]=Integració de Facebook amb Akonadi
Comment[cs]=Integrace Facebooku do Akonadi
Comment[da]=Akonadis Facebook-integration
Comment[de]=Facebook-Integration für Akonadi
Comment[el]=Ενσωμάτωση του Facebook στο Akonadi
Comment[en_GB]=Akonadi's Facebook integration
Comment[es]=Integración de Facebook con Akonadi
Comment[et]=Akonadi Facebooki lõimimine
Comment[fi]=Akonadin Facebook-integraatio
Comment[fr]=Intégration de Facebook avec Akonadi
Comment[gl]=Integración do Akonadi no Facebook
Comment[hu]=Az Akonadi Facebook integrációja
Comment[ia]=Indegration de Facebook de Akonadi
Comment[it]=Integrazione con Facebook di Akonadi
Comment[kk]=Akonadi-дің Facebook-пен бірігуі
Comment[ko]=Akonadi Facebook 통합
Comment[lt]=Akonadi Facebook integracija
Comment[mr]=आकोनाडीचे फेसबूकशी एकीकरण
Comment[nb]=Akonadi Facebook-integrering
Comment[nds]=Akonadi sien Facebook-Koppelsteed
Comment[nl]=Facebook-integratie van Akonadi
Comment[pl]=Integracja Facebooka z Akonadi
Comment[pt]=Integração do Facebook com o Akonadi
Comment[pt_BR]=Integração com o Facebook do Akonadi
Comment[ru]=Интеграция Akonadi с Facebook
Comment[sk]=Akonadi Facebook integrácia
Comment[sr]=Уклапање Фејсбука у Аконади
Comment[sr@ijekavian]=Уклапање Фејсбука у Аконади
Comment[sr@ijekavianlatin]=Uklapanje Facebooka u Akonadi
Comment[sr@latin]=Uklapanje Facebooka u Akonadi
Comment[sv]=Akonadi integrering med Facebook
Comment[tr]=Akonadi Facebook bütünleştirmesi
Comment[uk]=Інтеграція Akonadi з Facebook
Comment[x-test]=xxAkonadi's Facebook integrationxx
Comment[zh_CN]=Akonadi Facebook 整合
Comment[zh_TW]=Akonadi Facebook 整合
Name=Facebook Resource
Name[bs]=Facebook resurs
Name[ca]=Recurs de Facebook
Name[ca@valencia]=Recurs de Facebook
Name[cs]=Zdroj Facebooku
Name[da]=Facebook-ressource
Name[de]=Facebook-Ressource
Name[el]=Πόρος Facebook
Name[en_GB]=Facebook Resource
Name[es]=Recurso de Facebook
Name[et]=Facebooki ressurss
Name[fi]=Facebook-resurssi
Name[fr]=Ressource Facebook
Name[gl]=Recurso do Facebook
Name[hu]=Facebook erőforrás
Name[ia]=Ressource de Facebook
Name[it]=Risorsa Facebook
Name[kk]=Facebook ресурсы
Name[ko]=Facebook 자원
Name[lt]=Facebook resursas
Name[nb]=Facebook-ressurs
Name[nds]=Facebook-Ressource
Name[nl]=Facebook-hulpmiddel
Name[pl]=Zasób Facebooka
Name[pt]=Recurso do Facebook
Name[pt_BR]=Recurso do Facebook
Name[ru]=Источник данных Facebook
Name[sk]=Facebook zdroj
Name[sr]=Ресурс Фејсбука
Name[sr@ijekavian]=Ресурс Фејсбука
Name[sr@ijekavianlatin]=Resurs Facebooka
Name[sr@latin]=Resurs Facebooka
Name[sv]=Facebook-resurs
Name[tr]=Facebook Kaynağı
Name[uk]=Ресурс Facebook
Name[x-test]=xxFacebook Resourcexx
Name[zh_CN]=Facebook 资源
Name[zh_TW]=Facebook 資源
IconName=kde
[Context/Application]
Name=Facebook
Name[bs]=Facebook
Name[ca]=Facebook
Name[ca@valencia]=Facebook
Name[cs]=Facebook
Name[da]=Facebook
Name[de]=Facebook
Name[el]=Facebook
Name[en_GB]=Facebook
Name[es]=Facebook
Name[et]=Facebook
Name[fi]=Facebook
Name[fr]=Facebook
Name[gl]=Facebook
Name[hu]=Facebook
Name[ia]=Facebook
Name[it]=Facebook
Name[kk]=Facebook
Name[ko]=Facebook
Name[lt]=Facebook
Name[nb]=Facebook
Name[nds]=Facebook
Name[nl]=Facebook
Name[nn]=Facebook
Name[pl]=Facebook
Name[pt]=Facebook
Name[pt_BR]=Facebook
Name[ru]=Facebook
Name[sk]=Facebook
Name[sr]=Фејсбук
Name[sr@ijekavian]=Фејсбук
Name[sr@ijekavianlatin]=Facebook
Name[sr@latin]=Facebook
Name[sv]=Facebook
Name[tr]=Facebook
Name[ug]=فېيىسبۇك(Facebook)
Name[uk]=Facebook
Name[x-test]=xxFacebookxx
Name[zh_CN]=Facebook
Name[zh_TW]=Facebook
Comment=Notification coming from Facebook
Comment[bs]=Poruka koju je poslao Facebook
Comment[ca]=Notificació provinent de Facebook
Comment[ca@valencia]=Notificació provinent de Facebook
Comment[da]=Notifikation fra Facebook
Comment[de]=Benachrichtigungen von Facebook
Comment[el]=Η ειδοποίηση προέρχεαι από το Facebook
Comment[en_GB]=Notification coming from Facebook
Comment[es]=Notificación originada desde Facebook
Comment[et]=Facebooki märguanne
Comment[fi]=Facebookista saapuva ilmoitus
Comment[fr]=Notification provenant de Facebook
Comment[gl]=Notificación entrante desde o Facebook
Comment[hu]=Értesítés érkezik a Facebookról
Comment[ia]=Notification in arrivata ex Facebook
Comment[it]=Notifica proveniente da Facebook
Comment[kk]=Facebook-тан келетін құлақтандырулар
Comment[ko]=Facebook에서 보낸 알림
Comment[lt]=Pranešimas iš Facebook
Comment[nb]=Varsling som kommer fra Facebook
Comment[nds]=Bescheed vun Facebook
Comment[nl]=Melding uit Facebook
Comment[pl]=Powiadomienia przychodzące z Facebooka
Comment[pt]=Notificação proveniente do Facebook
Comment[pt_BR]=Notificação originada do Facebook
Comment[ru]=Поступило уведомление из Facebook
Comment[sk]=Upozornenie prichádzajúce z Facebooku
Comment[sr]=Обавештење са Фејсбука
Comment[sr@ijekavian]=Обавештење са Фејсбука
Comment[sr@ijekavianlatin]=Obaveštenje sa Facebooka
Comment[sr@latin]=Obaveštenje sa Facebooka
Comment[sv]=Underrättelse som kommer från Facebook
Comment[tr]=Facebook'tan gelen bilgilendirme
Comment[uk]="Сповіщення, що надходять з Facebook"
Comment[x-test]=xxNotification coming from Facebookxx
Comment[zh_CN]=来自 Facebook 的通知
Comment[zh_TW]=從 Facebook 來的通知
[Event/facebookNotification]
Name=New Facebook notification
Name[bs]=Nova Facebook poruka
Name[ca]=Notificació nova de Facebook
Name[ca@valencia]=Notificació nova de Facebook
Name[da]=Ny Facebook-notifikation
Name[de]=Neue Facebook-Benachrichtigung
Name[el]=Νέα ειδοποίηση Facebook
Name[en_GB]=New Facebook notification
Name[es]=Nueva notificación de Facebook
Name[et]=Uus Facebooki märguanne
Name[fi]=Uusi Facebook-ilmoitus
Name[fr]=Nouvelle notification Facebook
Name[gl]=Nova notificación do Facebook
Name[hu]=Új Facebook értesítés
Name[ia]=Nove notification de Facebook
Name[it]=Nuova notifica Facebook
Name[kk]=Жаңа Facebook құлақтандыруы
Name[ko]=새 Facebook 알림
Name[lt]=Naujas Facebook pranešimas
Name[nb]=Ny Facebook-varsling
Name[nds]=Nieg Facebook-Bescheed
Name[nl]=Nieuwe Facebook-melding
Name[pl]=Nowe powiadomienie na Facebooku
Name[pt]=Nova notificação do Facebook
Name[pt_BR]=Nova notificação do Facebook
Name[ru]=Новое уведомление из Facebook
Name[sk]=Nové upozornenie Facebooku
Name[sr]=Ново обавештење са Фејсбука
Name[sr@ijekavian]=Ново обавештење са Фејсбука
Name[sr@ijekavianlatin]=Novo obaveštenje sa Facebooka
Name[sr@latin]=Novo obaveštenje sa Facebooka
Name[sv]=Ny underrättelse från Facebook
Name[tr]=Yeni Facebook bildirimi
Name[uk]=Нове сповіщення з Facebook
Name[x-test]=xxNew Facebook notificationxx
Name[zh_CN]=新 Facebook 通知
Name[zh_TW]=新的 Facebook 通知器
Comment=You have new Facebook notification
Comment[bs]=Imate novu Facebook poruku
Comment[ca]=Teniu una notificació nova al Facebook
Comment[ca@valencia]=Teniu una notificació nova al Facebook
Comment[da]=Du har en ny Facebook-notifikation
Comment[de]=Sie haben eine Facebook-Benachrichtigungen
Comment[el]=Έχετε νέα ειδοποίηση στο Facebook
Comment[en_GB]=You have new Facebook notification
Comment[es]=Usted tiene una nueva notificación de Facebook
Comment[et]=Sul on uus Facebooki märguanne
Comment[fi]=Sinulle on uusi Facebook-ilmoitus
Comment[fr]=Vous avez une nouvelle notification Facebook
Comment[gl]=Ten unha nova notificación do Facebook
Comment[hu]=Új Facebook értesítése van
Comment[ia]=Tu ha nove notificationes de Facebook
Comment[it]=Hai una nuova notifica da Facebook
Comment[kk]=Жаңа Facebook құлақтандыруы келді
Comment[ko]=새 Facebook 알림이 있음
Comment[lt]=Turite naują Facebook pranešimą
Comment[nb]=Du har ny Facebook-varsling
Comment[nds]=Du hest en nieg Facebook-Bescheed
Comment[nl]=Er is een nieuwe Facebook-melding
Comment[pl]=Masz nowe powiadomienie na Facebooku
Comment[pt]=Tem uma notificação nova do Facebook
Comment[pt_BR]=Você tem uma nova notificação do Facebook
Comment[ru]=Вы получили уведомление из Facebook
Comment[sk]=Máte nové upozornenie Facebooku
Comment[sr]=Имате ново обавештење са Фејсбука
Comment[sr@ijekavian]=Имате ново обавештење са Фејсбука
Comment[sr@ijekavianlatin]=Imate novo obaveštenje sa Facebooka
Comment[sr@latin]=Imate novo obaveštenje sa Facebooka
Comment[sv]=Det finns en ny underrättelse från Facebook
Comment[tr]=Yeni Facebook bildiriminiz var
Comment[uk]=Вам надійшло сповіщення з Facebook
Comment[x-test]=xxYou have new Facebook notificationxx
Comment[zh_CN]=您有新的 Facebook 通知
Comment[zh_TW]=您有新的 Facebook 通知
Contexts=Application
Action=Popup
/*
Copyright 2010, 2011 Thomas McGuire <mcguire@kde.org>
Copyright 2011 Roeland Jago Douma <unix@rullzer.com>
Copyright 2012 Martin Klapetek <martin.klapetek@gmail.com>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2 of the License or
( at your option ) version 3 or, at the discretion of KDE e.V.
( which shall act as a proxy as in section 14 of the GPLv3 ), any later version.
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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "facebookresource.h"
#include "settings.h"
// #include "settingsdialog.h"
#include "timestampattribute.h"
#include <KAccounts/getcredentialsjob.h>
#include <KFbAPI/alleventslistjob.h>
#include <KFbAPI/allnoteslistjob.h>
#include <KFbAPI/allpostslistjob.h>
#include <KFbAPI/eventjob.h>
#include <KFbAPI/facebookjobs.h>
// #include <KFbAPI/noteaddjob.h>
#include <KFbAPI/notejob.h>
#include <KFbAPI/notificationslistjob.h>
// #include <KFbAPI/postaddjob.h>
#include <KFbAPI/postjob.h>
#include <KFbAPI/postslistjob.h>
#include <KLocalizedString>
#include <AkonadiCore/AttributeFactory>
#include <AkonadiCore/EntityDisplayAttribute>
#include <AkonadiCore/ItemFetchJob>
#include <AkonadiCore/ItemFetchScope>
#include <AkonadiCore/ChangeRecorder>
#include <akonadi/notes/noteutils.h> //krazy:exclude=camelcase wait for kdepimlibs 4.11
#include <Akonadi/SocialUtils/SocialNetworkAttributes>
using namespace Akonadi;
FacebookResource::FacebookResource(const QString &id)
: ResourceBase(id)
{
AttributeFactory::registerAttribute<TimeStampAttribute>();
setNeedsNetwork(true);
setObjectName(QLatin1String("FacebookResource"));
resetState();
Settings::self()->setResourceId(identifier());
connect(this, &FacebookResource::abortRequested, this, &FacebookResource::slotAbortRequested);
connect(this, &FacebookResource::reloadConfiguration, this, &FacebookResource::configurationChanged);
changeRecorder()->fetchCollection(true);
changeRecorder()->itemFetchScope().fetchFullPayload(true);
AttributeFactory::registerAttribute<SocialNetworkAttributes>();
}
FacebookResource::~FacebookResource()
{
Settings::self()->save();
}
void FacebookResource::configurationChanged()
{
if (Settings::self()->accountId()) {
configureByAccount(Settings::self()->accountId());
}
Settings::self()->save();
synchronize();
}
void FacebookResource::configureByAccount(int accountId)
{
qDebug() << "Starting credentials job";
GetCredentialsJob *gc = new GetCredentialsJob(accountId, this);
connect(gc, &GetCredentialsJob::finished, this, &FacebookResource::slotGetCredentials);
gc->start();
}
void FacebookResource::slotGetCredentials(KJob *job)
{
if (job->error()) {
return;// We will get kDebug from within the job if it fails
}
GetCredentialsJob *gJob = qobject_cast<GetCredentialsJob *>(job);
const QVariantMap data = gJob->credentialsData();
const QString accessToken = data.value(QLatin1String("AccessToken")).toString();
Settings::self()->setAccessToken(accessToken);
synchronize();
}
void FacebookResource::aboutToQuit()
{
slotAbortRequested();
}
void FacebookResource::abort()
{
resetState();
cancelTask();
}
void FacebookResource::abortWithError(const QString &errorMessage, bool authFailure)
{
resetState();
cancelTask(errorMessage);
// This doesn't work, why?
if (authFailure) {
emit status(Broken, i18n("Unable to login to Facebook, authentication failure."));
}
}
void FacebookResource::resetState()
{
mIdle = true;
mCurrentJobs.clear();
}
void FacebookResource::slotAbortRequested()
{
if (!mIdle) {
foreach (const QPointer<KJob> &job, mCurrentJobs) {
qDebug() << "Killing current job:" << job;
job->kill(KJob::Quietly);
}
abort();
}
}
void FacebookResource::configure(WId windowId)
{
// const QPointer<SettingsDialog> settingsDialog( new SettingsDialog( this, windowId ) );
// if ( settingsDialog->exec() == QDialog::Accepted ) {
// emit configurationDialogAccepted();
// } else {
// emit configurationDialogRejected();
// }
//
// delete settingsDialog;
}
void FacebookResource::retrieveItems(const Akonadi::Collection &collection)
{
Q_ASSERT(mIdle);
if (collection.remoteId() == eventsRID) {
mIdle = false;
emit status(Running, i18n("Preparing sync of events list."));
emit percent(0);
KFbAPI::AllEventsListJob *const listJob =
new KFbAPI::AllEventsListJob(Settings::self()->accessToken(), this);
listJob->setLowerLimit(QDateTime::fromString(Settings::self()->lowerLimit(), QLatin1String("yyyy-MM-dd")));
mCurrentJobs << listJob;
connect(listJob, SIGNAL(result(KJob*)), this, SLOT(eventListFetched(KJob*)));
listJob->start();
} else if (collection.remoteId() == notesRID) {
mIdle = false;
emit status(Running, i18n("Preparing sync of notes list."));
emit percent(0);
KFbAPI::AllNotesListJob *const notesJob =
new KFbAPI::AllNotesListJob(Settings::self()->accessToken(), this);
notesJob->setLowerLimit(QDateTime::fromString(Settings::self()->lowerLimit(), QLatin1String("yyyy-MM-dd")));
mCurrentJobs << notesJob;
connect(notesJob, SIGNAL(result(KJob*)), this, SLOT(noteListFetched(KJob*)));
notesJob->start();
} else if (collection.remoteId() == postsRID) {
mIdle = false;
emit status(Running, i18n("Preparing sync of posts."));
emit percent(0);
KFbAPI::AllPostsListJob *const postsJob =
new KFbAPI::AllPostsListJob(KFbAPI::PostInfo::FetchCountsOnly, Settings::self()->accessToken(), this);
postsJob->setLowerLimit(QDateTime::currentDateTime().addDays(-3));
mCurrentJobs << postsJob;
connect(postsJob, SIGNAL(result(KJob*)), this, SLOT(postsListFetched(KJob*)));
postsJob->start();
} else if (collection.remoteId() == notificationsRID) {
mIdle = false;
emit status(Running, i18n("Preparing sync of notifications."));
emit percent(0);
KFbAPI::NotificationsListJob *const notificationsJob =
new KFbAPI::NotificationsListJob(Settings::self()->accessToken(), this);
mCurrentJobs << notificationsJob;
connect(notificationsJob, SIGNAL(result(KJob*)), this, SLOT(notificationsListFetched(KJob*)));
notificationsJob->start();
} else {
// This can not happen
Q_ASSERT(!"Unknown Collection");
cancelTask();
}
}
bool FacebookResource::retrieveItem(const Akonadi::Item &item, const QSet<QByteArray> &parts)
{
Q_UNUSED(parts);
qDebug() << item.mimeType();
if (item.mimeType() == Akonadi::NoteUtils::noteMimeType()) {
mIdle = false;
KFbAPI::NoteJob *const noteJob =
new KFbAPI::NoteJob(item.remoteId(), Settings::self()->accessToken(), this);
mCurrentJobs << noteJob;
noteJob->setProperty("Item", QVariant::fromValue(item));
connect(noteJob, SIGNAL(result(KJob*)), this, SLOT(noteJobFinished(KJob*)));
noteJob->start();
} else if (item.mimeType() == QLatin1String("text/x-vnd.akonadi.socialfeeditem")) {
mIdle = false;
KFbAPI::PostJob *const postJob =
new KFbAPI::PostJob(item.remoteId(), Settings::self()->accessToken(), this);
mCurrentJobs << postJob;