Commit 73bd7e57 authored by Laurent Montel's avatar Laurent Montel 😁

Make it compile

parent ebe6da2a
......@@ -41,10 +41,10 @@ if ("${CMAKE_SOURCE_DIR}" STREQUAL "${resources_SOURCE_DIR}")
endif()
find_package(KF5Imap ${KDEPIMLIBS_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiCalendar ${KDEPIMLIBS_LIB_VERSION} CONFIG REQUIRED)
# Extra package
find_package(KF5GAPI "4.98.0" CONFIG)
find_package(KF5GAPI "4.70.0" CONFIG)
# Xsltproc
find_package(Xsltproc)
......@@ -126,10 +126,10 @@ add_subdirectory( openxchange )
add_subdirectory( pop3 )
#NEED TO REMOVE QSJON SUPPORT
#if( KF5GAPI_FOUND )
# add_subdirectory( google )
# add_subdirectory( gmail )
#endif()
if( KF5GAPI_FOUND )
add_subdirectory( google )
add_subdirectory( gmail )
endif()
#if( LibKFbAPI_FOUND )
# add_subdirectory( facebook )
......
add_subdirectory(saslplugin)
# REACTIVATE IT
#add_subdirectory(saslplugin)
......@@ -8,11 +9,9 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../imap
${LibKGAPI2_INCLUDE_DIR}
${QT_QTDBUS_INCLUDE_DIR}
${QJSON_INCLUDE_DIR}
${qjson_INCLUDE_DIR}
)
kde_enable_exceptions()
########### next target ###############
......@@ -36,18 +35,13 @@ kconfig_add_kcfg_files(gmailresource_SRCS settingsbase.kcfgc)
add_executable(akonadi_gmail_resource ${gmailresource_SRCS})
target_link_libraries(akonadi_gmail_resource
KF5::AkonadiCore
KF5::Imap
KF5::MailTransport
KF5::KIOCore
KF5::Mime
KF5::AkonadiMime
KF5::PimIdentities
${LibKGAPI2_LIBRARY}
${QJSON_LIBRARIES}
KF5::GAPICore
imapresource
folderarchivesettings
)
......
......@@ -19,9 +19,9 @@
#include "gmailchangeitemslabelstask.h"
#include <KIMAP/Session>
#include <KIMAP/StoreJob>
#include <KIMAP/SelectJob>
#include <KImap/Session>
#include <KImap/StoreJob>
#include <KImap/SelectJob>
GmailChangeItemsLabelsTask::GmailChangeItemsLabelsTask(ResourceStateInterface::Ptr resource, QObject *parent)
......
......@@ -27,10 +27,10 @@
#include <kpimidentities/identitymanager.h>
#include <kpimidentities/identitycombo.h>
#include <akonadi/resourcesettings.h>
#include <AkonadiAgentBase/resourcesettings.h>
#include <libkgapi2/account.h>
#include <libkgapi2/authjob.h>
#include <kgapi/account.h>
#include <kgapi/authjob.h>
#include <imap/imapaccount.h>
#include <imap/subscriptiondialog.h>
......@@ -215,7 +215,7 @@ void GmailConfigDialog::slotManageSubscriptions()
QPointer<SubscriptionDialog> subscriptions = new SubscriptionDialog( this );
subscriptions->setCaption(i18n("Serverside Subscription"));
subscriptions->setWindowIcon(KIcon(QLatin1String("network-server")));
subscriptions->setWindowIcon(QIcon::fromTheme(QLatin1String("network-server")));
subscriptions->connectAccount(account, m_account->accessToken());
m_subscriptionsChanged = subscriptions->isSubscriptionChanged();
......
......@@ -22,7 +22,7 @@
#include <KDialog>
#include <LibKGAPI2/Account>
#include <KGAPI/Account>
namespace Ui
{
......
......@@ -20,7 +20,7 @@
#ifndef GMAILLABELATTRIBUTE_H
#define GMAILLABELATTRIBUTE_H
#include <Akonadi/Attribute>
#include <AkonadiCore/Attribute>
#include <QByteArray>
class GmailLabelAttribute : public Akonadi::Attribute
......
......@@ -21,13 +21,13 @@
#include "gmailretrieveitemstask.h"
#include "gmailsettings.h"
#include <akonadi/collectionpathresolver_p.h>
#include <Akonadi/AgentBase>
#include <Akonadi/ItemFetchJob>
#include <Akonadi/ItemFetchScope>
#include <Akonadi/CollectionFetchJob>
#include <Akonadi/LinkJob>
#include <Akonadi/UnlinkJob>
#include <AkonadiCore/collectionpathresolver.h>
#include <AkonadiAgentBase/AgentBase>
#include <AkonadiCore/ItemFetchJob>
#include <AkonadiCore/ItemFetchScope>
#include <AkonadiCore/CollectionFetchJob>
#include <AkonadiCore/LinkJob>
#include <AkonadiCore/UnlinkJob>
#include <KLocalizedString>
......@@ -122,7 +122,7 @@ void GmailLinkItemsTask::onLabelResolved(KJob *job)
const QString collectionName = resolver->property(COLLECTION_NAME_PROPERTY).toString();
const QByteArray label = resolver->property(LABEL_PROPERTY).toByteArray();
if (resolver->error() && resolver->collection() < 0) {
kWarning() << "Failed to resolve collection ID for path" << collectionName << ":" << resolver->errorString();
qWarning() << "Failed to resolve collection ID for path" << collectionName << ":" << resolver->errorString();
return;
}
const Akonadi::Collection collection(resolver->collection());
......
......@@ -23,7 +23,7 @@
#include <QObject>
#include <QMultiHash>
#include <Akonadi/Collection>
#include <AkonadiCore/Collection>
class GmailRetrieveItemsTask;
class KJob;
......
......@@ -39,7 +39,7 @@ Akonadi::Item GmailMessageHelper::createItemFromMessage(KMime::Message::Ptr mess
{
Akonadi::Item item = MessageHelper::createItemFromMessage(message, uid, size, attrs, flags, scope, ok);
if (!ok) {
kWarning() << "Failed to read imap message";
qWarning() << "Failed to read imap message";
return item;
}
......
......@@ -22,7 +22,7 @@
#include <imap/messagehelper.h>
#include <Akonadi/Collection>
#include <AkonadiCore/Collection>
class ResourceTask;
......
......@@ -20,10 +20,10 @@
#include "gmailpasswordrequester.h"
#include "gmailsettings.h"
#include <libkgapi2/account.h>
#include <libkgapi2/authjob.h>
#include <kgapi/account.h>
#include <kgapi/authjob.h>
#include <qjson/parser.h>
#include <QJsonDocument>
#include <KDebug>
......@@ -56,16 +56,16 @@ void GmailPasswordRequester::requestPassword(PasswordRequesterInterface::Request
bool GmailPasswordRequester::isTokenExpired(const QString &serverError)
{
QJson::Parser parser;
QString base64Error = serverError.mid(7, serverError.length() - 9);
const QByteArray decoded = QByteArray::fromBase64(base64Error.toLatin1());
bool ok = false;
const QVariant json = parser.parse(decoded, &ok);
if (!ok) {
QJsonDocument document = QJsonDocument::fromJson(decoded);
if (document.isNull()) {
return false;
}
const QVariant json = document.toVariant();
if (!json.isValid()) {
return false;
}
const QVariantMap map = json.toMap();
if (map[QLatin1String("status")].toString().toInt() == KGAPI2::Unauthorized) {
return true;
......
......@@ -22,7 +22,7 @@
#include <imap/passwordrequesterinterface.h>
#include <LibKGAPI2/Types>
#include <KGAPI/Types>
class GmailPasswordRequester : public PasswordRequesterInterface
{
......
......@@ -31,22 +31,23 @@
#include <KLocalizedString>
#include <KWindowSystem>
#include <Akonadi/LinkJob>
#include <Akonadi/CollectionFetchJob>
#include <akonadi/collectionpathresolver_p.h>
#include <Akonadi/ItemFetchJob>
#include <Akonadi/ItemFetchScope>
#include <Akonadi/AttributeFactory>
#include <AkonadiCore/LinkJob>
#include <AkonadiCore/CollectionFetchJob>
#include <AkonadiCore/collectionpathresolver.h>
#include <AkonadiCore/ItemFetchJob>
#include <AkonadiCore/ItemFetchScope>
#include <AkonadiCore/AttributeFactory>
#include <imap/sessionpool.h>
#include <imap/sessionuiproxy.h>
#include <KLocale>
#include <QIcon>
GmailResource::GmailResource(const QString &id):
ImapResourceBase(id)
{
KGlobal::locale()->insertCatalog("akonadi_imap_resource");
//QT5 KGlobal::locale()->insertCatalog("akonadi_imap_resource");
setSeparatorCharacter('/');
m_pool->setPasswordRequester(new GmailPasswordRequester(m_pool));
......@@ -68,7 +69,7 @@ KDialog *GmailResource::createConfigureDialog(WId windowId)
{
GmailConfigDialog *dlg = new GmailConfigDialog(this, windowId);
KWindowSystem::setMainWindow(dlg, windowId);
dlg->setWindowIcon(KIcon(QLatin1String("network-server")));
dlg->setWindowIcon(QIcon::fromTheme(QLatin1String("network-server")));
connect(dlg, SIGNAL(finished(int)), this, SLOT(onConfigurationDone(int)));;
return dlg;
}
......@@ -80,7 +81,7 @@ void GmailResource::onConfigurationDone(int result)
if ( dlg->shouldClearCache() ) {
clearCache();
}
GmailSettings::self()->writeConfig();
GmailSettings::self()->save();
}
dlg->deleteLater();
}
......@@ -103,7 +104,7 @@ void GmailResource::retrieveCollections()
void GmailResource::retrieveItems(const Akonadi::Collection &col)
{
kDebug() << col.id() << col.remoteId() << col.name();
qDebug() << col.id() << col.remoteId() << col.name();
// We can't sync the virtual collections - instead we get ID of "All Mail" and
// we schedule it's sync
//
......@@ -142,7 +143,7 @@ void GmailResource::onRetrieveItemsCollectionRetrieved(KJob *job)
Akonadi::CollectionFetchJob *fetch = qobject_cast<Akonadi::CollectionFetchJob*>(job);
if (fetch->collections().count() != 1) {
kWarning() << "Got" << fetch->collections().count() << "collections, expected only one!";
qWarning() << "Got" << fetch->collections().count() << "collections, expected only one!";
cancelTask();
return;
}
......@@ -155,7 +156,7 @@ void GmailResource::onRetrieveItemsCollectionRetrieved(KJob *job)
void GmailResource::itemsLinked(const Akonadi::Item::List &items, const Akonadi::Collection &collection)
{
if (!collection.hasAttribute<GmailLabelAttribute>()) {
kWarning() << "Collection is missing GmailLabelAttribute! IMPOSSIBRU!";
qWarning() << "Collection is missing GmailLabelAttribute! IMPOSSIBRU!";
cancelTask();
return;
}
......@@ -169,7 +170,7 @@ void GmailResource::itemsLinked(const Akonadi::Item::List &items, const Akonadi:
void GmailResource::itemsUnlinked(const Akonadi::Item::List &items, const Akonadi::Collection &collection)
{
if (!collection.hasAttribute<GmailLabelAttribute>()) {
kWarning() << "Collection is missing GmailLabelAttribute! IMPOSSIBRU!";
qWarning() << "Collection is missing GmailLabelAttribute! IMPOSSIBRU!";
cancelTask();
return;
}
......
......@@ -22,7 +22,7 @@
#include <imap/imapresourcebase.h>
#include <Akonadi/AgentBase>
#include <AkonadiAgentBase/AgentBase>
class GmailResource : public ImapResourceBase
{
......
......@@ -23,14 +23,14 @@
#include <imap/noselectattribute.h>
#include <imap/noinferiorsattribute.h>
#include <Akonadi/CachePolicy>
#include <Akonadi/EntityDisplayAttribute>
#include <AkonadiCore/CachePolicy>
#include <AkonadiCore/EntityDisplayAttribute>
#include <Akonadi/KMime/MessageParts>
#include <Akonadi/EntityHiddenAttribute>
#include <AkonadiCore/EntityHiddenAttribute>
#include <KMime/Message>
#include <KIMAP/ListJob>
#include <KImap/ListJob>
#include <KLocalizedString>
......@@ -56,7 +56,7 @@ void GmailRetrieveCollectionsTask::onMailBoxesReceived(const QList<KIMAP::MailBo
// skip phantom mailboxes contained in LSUB but not LIST
if (isSubscriptionEnabled() && !m_fullReportedCollections.contains(descriptor.name)) {
kDebug() << "Got phantom mailbox: " << descriptor.name;
qDebug() << "Got phantom mailbox: " << descriptor.name;
continue;
}
......@@ -76,7 +76,7 @@ void GmailRetrieveCollectionsTask::onMailBoxesReceived(const QList<KIMAP::MailBo
if (m_reportedCollections.contains(currentPath)) {
if (m_dummyCollections.contains(currentPath) && !isDummy) {
kDebug() << "Received the real collection for a dummy one : " << currentPath;
qDebug() << "Received the real collection for a dummy one : " << currentPath;
//set the correct attributes for the collection, eg. noselect needs to be removed
Akonadi::Collection c = m_reportedCollections.value(currentPath);
c.setContentMimeTypes(contentTypes);
......@@ -146,7 +146,7 @@ void GmailRetrieveCollectionsTask::onMailBoxesReceived(const QList<KIMAP::MailBo
// If this folder is a noselect folder, make some special settings.
if (currentFlags.contains("\\noselect")) {
kDebug() << "Dummy collection created: " << currentPath;
qDebug() << "Dummy collection created: " << currentPath;
c.addAttribute(new NoSelectAttribute(true));
c.setContentMimeTypes(QStringList() << Akonadi::Collection::mimeType());
c.setRights(Akonadi::Collection::ReadOnly);
......@@ -157,12 +157,12 @@ void GmailRetrieveCollectionsTask::onMailBoxesReceived(const QList<KIMAP::MailBo
// If this folder is a noinferiors folder, it is not allowed to create subfolders inside.
if (currentFlags.contains("\\noinferiors")) {
//kDebug() << "Noinferiors: " << currentPath;
//qDebug() << "Noinferiors: " << currentPath;
c.addAttribute(new NoInferiorsAttribute(true));
c.setRights(c.rights() & ~Akonadi::Collection::CanCreateCollection);
}
kDebug() << currentPath << currentFlags;
qDebug() << currentPath << currentFlags;
// Special treating of Gmail system collections (and INBOX)
if (currentPath == QLatin1String("/INBOX") ||
currentFlags.contains("\\drafts") ||
......
......@@ -22,15 +22,15 @@
#include <imap/batchfetcher.h>
#include <Akonadi/CollectionFetchJob>
#include <Akonadi/LinkJob>
#include <AkonadiCore/CollectionFetchJob>
#include <AkonadiCore/LinkJob>
#include <KIMAP/Session>
#include <KImap/Session>
GmailRetrieveItemsTask::GmailRetrieveItemsTask(ResourceStateInterface::Ptr resource, QObject *parent)
: RetrieveItemsTask(resource, parent)
{
kDebug();
qDebug();
dynamic_cast<GmailResourceState*>(resource.get())->setCurrentTask(this);
}
......@@ -45,7 +45,7 @@ BatchFetcher *GmailRetrieveItemsTask::createBatchFetcher(MessageHelper::Ptr mess
int batchSize,
KIMAP::Session *session)
{
kDebug();
qDebug();
KIMAP::FetchJob::FetchScope gmailScope = scope;
BatchFetcher *batchFetcher = new BatchFetcher(messageHelper, set, gmailScope, batchSize, session);
batchFetcher->setGmailExtensionsEnabled(true);
......
......@@ -22,8 +22,8 @@
#include <imap/retrieveitemstask.h>
#include <KIMAP/ImapSet>
#include <KIMAP/FetchJob>
#include <KImap/ImapSet>
#include <KImap/FetchJob>
class GmailRetrieveItemsTask : public RetrieveItemsTask
{
......
......@@ -32,12 +32,12 @@ using KWallet::Wallet;
#include <QDBusConnection>
#include <KDE/Akonadi/Collection>
#include <KDE/Akonadi/CollectionFetchJob>
#include <KDE/Akonadi/CollectionModifyJob>
#include <AkonadiCore/Collection>
#include <AkonadiCore/CollectionFetchJob>
#include <AkonadiCore/CollectionModifyJob>
#include <LibKGAPI2/Account>
#include <LibKGAPI2/AuthJob>
#include <KGAPI/Account>
#include <KGAPI/AuthJob>
class SettingsHelper
{
......@@ -237,7 +237,7 @@ void GmailSettings::saveAccountToKWallet()
map[QLatin1String("accessToken")] = mAccount->accessToken();
map[QLatin1String("refreshToken")] = mAccount->refreshToken();
wallet->writeMap(config()->name(), map);
kDebug() << "Wallet save: " << wallet->sync();
qDebug() << "Wallet save: " << wallet->sync();
}
delete wallet;
}
......@@ -303,7 +303,7 @@ void GmailSettings::setRefreshToken(const QString &refreshToken)
void GmailSettings::loadAccount(ImapAccount *account) const
{
kDebug() << userName();
qDebug() << userName();
account->setServer(QLatin1String("imap.gmail.com"));
account->setPort(993);
......
......@@ -22,7 +22,7 @@
#include "settingsbase.h"
#include <LibKGAPI2/Types>
#include <KGAPI/Types>
namespace KGAPI2 {
class Job;
......
......@@ -3,8 +3,8 @@ set_package_properties(Sasl2 PROPERTIES DESCRIPTION "cyrus-sasl" URL "http://asg
add_definitions(-D_POSIX_SOURCE)
include_directories(${SASL2_INCLUDE_DIR}
${SASL2_INCLUDE_DIR}/sasl)
include_directories(${Sasl2_INCLUDE_DIRS}
${Sasl2_INCLUDE_DIR}/sasl)
set(kdexoauth2sasl_SRCS
plugin_common.c
......@@ -12,7 +12,13 @@ set(kdexoauth2sasl_SRCS
xoauth2plugin_init.c
)
add_library(kdexoauth2 ${kdexoauth2sasl_SRCS})
if(Sasl2_FOUND)
set(kdexoauth2sasl_EXTRA_LIBS ${Sasl2_LIBRARIES})
endif()
add_library(kdexoauth2 ${kdexoauth2sasl_SRCS} ${kdexoauth2sasl_EXTRA_LIBS})
set_target_properties(kdexoauth2 PROPERTIES SOVERSION 3 VERSION 3.0.0)
install(TARGETS kdexoauth2 DESTINATION ${LIB_INSTALL_DIR}/sasl2)
\ No newline at end of file
install(TARGETS kdexoauth2 DESTINATION ${LIB_INSTALL_DIR}/sasl2)
kde_enable_exceptions()
set(calendarresource_SRCS
calendarresource.cpp
......@@ -44,10 +44,13 @@ endif()
target_link_libraries(akonadi_googlecalendar_resource
KF5::AkonadiCore
KF5::CalendarCore
KF5::AkonadiCalendar
KF5::Mime
KF5::GAPICalendar
KF5::GAPICore
KF5::GAPITasks
KF5::AkonadiAgentBase
KF5::Wallet
)
if(${AccountsQt_FOUND} AND ${SignOnQt_FOUND})
......
......@@ -18,9 +18,7 @@
#include "defaultreminderattribute.h"
#include <QVariant>
//#include <qjson/parser.h>
//#include <qjson/serializer.h>
#include <QJsonDocument>
#include <KGAPI/Calendar/Reminder>
......@@ -45,10 +43,14 @@ void DefaultReminderAttribute::setReminders( const RemindersList &reminders )
void DefaultReminderAttribute::deserialize( const QByteArray &data )
{
QJson::Parser parser;
QJsonDocument json = QJsonDocument::fromJson(data);
if (json.isNull())
return;
QVariant var = json.toVariant();
QVariantList list;
list = parser.parse( data ).toList();
list = var.toList();
Q_FOREACH( const QVariant & l, list ) {
QVariantMap reminder = l.toMap();
......@@ -84,9 +86,8 @@ QByteArray DefaultReminderAttribute::serialized() const
list << reminder;
}
QJson::Serializer serializer;
return serializer.serialize( list );
QJsonDocument serialized = QJsonDocument::fromVariant(list);
return serialized.toJson();
}
KCalCore::Alarm::List DefaultReminderAttribute::alarms( KCalCore::Incidence *incidence ) const
......
......@@ -26,8 +26,8 @@
#include <KDE/KLocale>
#include <KGAPI/Account>
#include <KGAPI/AccountInfo/AccountInfoFetchJob>
#include <KGAPI/AccountInfo/AccountInfo>
#include <KGAPI/AccountInfoFetchJob>
#include <KGAPI/AccountInfo>
#include <KGAPI/AuthJob>
#include <KLocale>
......@@ -242,7 +242,7 @@ void GoogleResource::slotKAccountsAccountInfoReceived( KGAPI2::Job *job )
const AccountPtr account = job->account();
if ( aiJob->items().count() != 1 ) {
kWarning() << "AccountInfoFetchJob returned unexpected amount of results";
qWarning() << "AccountInfoFetchJob returned unexpected amount of results";
emit error( i18n( "Invalid reply" ) );
cancelTask( i18n( "Failed to refresh tokens") );
return;
......@@ -289,7 +289,7 @@ void GoogleResource::slotAccountManagerReady( bool ready )
return;
}
kDebug() << ready;
qDebug() << ready;
if ( !ready ) {
emit status( Broken, i18n( "Can't access KWallet" ) );
return;
......@@ -344,7 +344,7 @@ bool GoogleResource::handleError( KGAPI2::Job *job )
}
if ( job->error() == KGAPI2::Unauthorized ) {
kDebug() << job << job->errorString();
qDebug() << job << job->errorString();
const QList<QUrl> resourceScopes = scopes();
Q_FOREACH(const QUrl &scope, resourceScopes) {
......@@ -375,7 +375,7 @@ bool GoogleResource::canPerformTask()
void GoogleResource::slotAuthJobFinished( KGAPI2::Job *job )
{
kDebug();
qDebug();
if ( job->error() != KGAPI2::NoError ) {
cancelTask( i18n( "Failed to refresh tokens" ) );
......@@ -385,7 +385,7 @@ void GoogleResource::slotAuthJobFinished( KGAPI2::Job *job )
AuthJob *authJob = qobject_cast<AuthJob*>( job );
m_account = authJob->account();
if ( !m_accountMgr->storeAccount( m_account ) ) {
kWarning() << "Failed to store account in KWallet";
qWarning() << "Failed to store account in KWallet";
}
KGAPI2::Job *otherJob = job->property( JOB_PROPERTY ).value<KGAPI2::Job *>();
......
kde_enable_exceptions()
set(contactsresource_SRCS