Commit 75853b85 authored by Shashwat Jolly's avatar Shashwat Jolly

Implement BaseHandler super class

ContactHandler and CalendarTaskBaseHandler now derive from BaseHandler
parent 48758ea2
......@@ -17,6 +17,7 @@ set(etesyncresource_SRCS
journalsfetchjob.cpp
entriesfetchjob.cpp
contacthandler.cpp
basehandler.cpp
calendartaskbasehandler.cpp
calendarhandler.cpp
taskhandler.cpp
......
#! /usr/bin/env bash
$EXTRACTRC *.ui *.kcfg >> rc.cpp
$XGETTEXT *.cpp -o $podir/akonadi_etesync_resource.pot
/*
* Copyright (C) 2020 by Shashwat Jolly <shashwat.jolly@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "basehandler.h"
#include <AkonadiCore/AttributeFactory>
#include <AkonadiCore/CollectionColorAttribute>
#include <AkonadiCore/CollectionModifyJob>
#include <KCalendarCore/ICalFormat>
#include <KCalendarCore/MemoryCalendar>
#include <QFile>
#include "entriesfetchjob.h"
#include "etesync_debug.h"
#include "etesyncresource.h"
using namespace Akonadi;
using namespace KCalendarCore;
BaseHandler::BaseHandler(EteSyncResource *resource)
: mResource(resource), mClientState(resource->mClientState)
{
}
void BaseHandler::initialiseBaseDirectory()
{
mResource->initialiseDirectory(baseDirectoryPath());
}
void BaseHandler::createEteSyncEntry(const EteSyncSyncEntry *syncEntry, const EteSyncCryptoManager *cryptoManager, const Collection &collection)
{
EteSyncEntryPtr entry(etesync_entry_from_sync_entry(cryptoManager, syncEntry, collection.remoteRevision()));
EteSyncEntryManagerPtr entryManager(etesync_entry_manager_new(mClientState->client(), collection.remoteId()));
EteSyncEntry *entries[] = {entry.get(), NULL};
etesync_entry_manager_create(entryManager.get(), entries, collection.remoteRevision());
updateCollectionRevision(entry.get(), collection);
}
void BaseHandler::updateCollectionRevision(const EteSyncEntry *entry, const Collection &collection)
{
const QString entryUid = QStringFromCharPtr(CharPtr(etesync_entry_get_uid(entry)));
Collection col = collection;
col.setRemoteRevision(entryUid);
new CollectionModifyJob(col, this);
}
\ No newline at end of file
/*
* Copyright (C) 2020 by Shashwat Jolly <shashwat.jolly@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef BASEHANDLER_H
#define BASEHANDLER_H
#include <AkonadiCore/Collection>
#include <AkonadiCore/Item>
#include <KCalendarCore/Incidence>
#include "etesyncadapter.h"
#include "etesyncclientstate.h"
using namespace Akonadi;
class EteSyncResource;
class BaseHandler : public QObject
{
Q_OBJECT
public:
explicit BaseHandler(EteSyncResource *resource);
virtual void setupItems(EteSyncEntry **entries, Akonadi::Collection &collection) = 0;
virtual void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection) = 0;
virtual void itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &parts) = 0;
virtual void itemRemoved(const Akonadi::Item &item) = 0;
virtual void collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent) = 0;
virtual void collectionChanged(const Akonadi::Collection &collection) = 0;
virtual void collectionRemoved(const Akonadi::Collection &collection) = 0;
protected:
void initialiseBaseDirectory();
void createEteSyncEntry(const EteSyncSyncEntry *syncEntry, const EteSyncCryptoManager *cryptoManager, const Collection &collection);
void updateCollectionRevision(const EteSyncEntry *entry, const Collection &collection);
virtual QString baseDirectoryPath() const = 0;
virtual const QString mimeType() = 0;
virtual const QString etesyncCollectionType() = 0;
EteSyncResource *mResource = nullptr;
EteSyncClientState *mClientState = nullptr;
};
#endif
......@@ -25,7 +25,7 @@ const QString CalendarHandler::mimeType()
{
return KCalendarCore::Event::eventMimeType();
}
const QString CalendarHandler::eteSyncCollectionType()
const QString CalendarHandler::etesyncCollectionType()
{
return QStringLiteral(ETESYNC_COLLECTION_TYPE_CALENDAR);
}
......@@ -31,11 +31,11 @@ class CalendarHandler : public CalendarTaskBaseHandler
Q_OBJECT
public:
typedef std::unique_ptr<CalendarHandler> Ptr;
CalendarHandler(EteSyncResource *resource);
explicit CalendarHandler(EteSyncResource *resource);
protected:
const QString mimeType();
const QString eteSyncCollectionType();
const QString etesyncCollectionType();
};
#endif
......@@ -31,18 +31,16 @@
using namespace Akonadi;
using namespace KCalendarCore;
CalendarTaskBaseHandler::CalendarTaskBaseHandler(EteSyncResource *resource)
: mResource(resource), mClientState(resource->mClientState)
CalendarTaskBaseHandler::CalendarTaskBaseHandler(EteSyncResource *resource) : BaseHandler(resource)
{
mResource->initialiseDirectory(baseDirectoryPath());
AttributeFactory::registerAttribute<CollectionColorAttribute>();
initialiseBaseDirectory();
}
void CalendarTaskBaseHandler::setupItems(EteSyncEntry **entries, Akonadi::Collection &collection)
{
qCDebug(ETESYNC_LOG) << "CalendarTaskBaseHandler: Setting up items";
QString prevUid = collection.remoteRevision();
QString journalUid = collection.remoteId();
const QString journalUid = collection.remoteId();
bool isIncremental = false;
......@@ -174,23 +172,11 @@ void CalendarTaskBaseHandler::itemAdded(const Akonadi::Item &item,
EteSyncCryptoManagerPtr cryptoManager(etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair()));
EteSyncSyncEntryPtr syncEntry(etesync_sync_entry_new(QStringLiteral(ETESYNC_SYNC_ENTRY_ACTION_ADD), format.toString(calendar)));
EteSyncEntryPtr entry(etesync_entry_from_sync_entry(cryptoManager.get(), syncEntry.get(), collection.remoteRevision()));
EteSyncEntryManagerPtr entryManager(etesync_entry_manager_new(mClientState->client(), collection.remoteId()));
EteSyncEntry *entries[] = {entry.get(), NULL};
etesync_entry_manager_create(entryManager.get(), entries, collection.remoteRevision());
createEteSyncEntry(syncEntry.get(), cryptoManager.get(), collection);
mResource->changeCommitted(item);
updateLocalCalendar(item.payload<Incidence::Ptr>());
// Update last UID in collection remoteRevision
const QString entryUid = QStringFromCharPtr(CharPtr(etesync_entry_get_uid(entry.get())));
Collection col = collection;
col.setRemoteRevision(entryUid);
new CollectionModifyJob(col, this);
}
void CalendarTaskBaseHandler::itemChanged(const Akonadi::Item &item,
......@@ -214,23 +200,11 @@ void CalendarTaskBaseHandler::itemChanged(const Akonadi::Item &item,
EteSyncCryptoManagerPtr cryptoManager(etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair()));
EteSyncSyncEntryPtr syncEntry(etesync_sync_entry_new(QStringLiteral(ETESYNC_SYNC_ENTRY_ACTION_CHANGE), format.toString(calendar)));
EteSyncEntryPtr entry(etesync_entry_from_sync_entry(cryptoManager.get(), syncEntry.get(), collection.remoteRevision()));
EteSyncEntryManagerPtr entryManager(etesync_entry_manager_new(mClientState->client(), collection.remoteId()));
EteSyncEntry *entries[] = {entry.get(), NULL};
etesync_entry_manager_create(entryManager.get(), entries, collection.remoteRevision());
createEteSyncEntry(syncEntry.get(), cryptoManager.get(), collection);
mResource->changeCommitted(item);
updateLocalCalendar(item.payload<Incidence::Ptr>());
// Update last UID in collection remoteRevision
const QString entryUid = QStringFromCharPtr(CharPtr(etesync_entry_get_uid(entry.get())));
Collection col = collection;
col.setRemoteRevision(entryUid);
new CollectionModifyJob(col, this);
}
void CalendarTaskBaseHandler::itemRemoved(const Akonadi::Item &item)
......@@ -251,20 +225,9 @@ void CalendarTaskBaseHandler::itemRemoved(const Akonadi::Item &item)
QString calendar = getLocalCalendar(item.remoteId());
EteSyncSyncEntryPtr syncEntry(etesync_sync_entry_new(ETESYNC_SYNC_ENTRY_ACTION_DELETE, charArrFromQString(calendar)));
EteSyncEntryPtr entry(etesync_entry_from_sync_entry(cryptoManager.get(), syncEntry.get(), collection.remoteRevision()));
EteSyncEntryManagerPtr entryManager(etesync_entry_manager_new(mClientState->client(), collection.remoteId()));
EteSyncEntry *entries[] = {entry.get(), NULL};
etesync_entry_manager_create(entryManager.get(), entries, collection.remoteRevision());
createEteSyncEntry(syncEntry.get(), cryptoManager.get(), collection);
mResource->changeCommitted(item);
// Update last UID in collection remoteRevision
const QString entryUid = QStringFromCharPtr(CharPtr(etesync_entry_get_uid(entry.get())));
collection.setRemoteRevision(entryUid);
new CollectionModifyJob(collection, this);
}
void CalendarTaskBaseHandler::collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent)
......@@ -273,7 +236,7 @@ void CalendarTaskBaseHandler::collectionAdded(const Akonadi::Collection &collect
EteSyncJournalPtr journal(etesync_journal_new(journalUid, ETESYNC_CURRENT_VERSION));
/// TODO: Description?
EteSyncCollectionInfoPtr info(etesync_collection_info_new(eteSyncCollectionType(), collection.displayName(), QString(), EteSyncDEFAULT_COLOR));
EteSyncCollectionInfoPtr info(etesync_collection_info_new(etesyncCollectionType(), collection.displayName(), QString(), EteSyncDEFAULT_COLOR));
EteSyncCryptoManagerPtr cryptoManager(etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair()));
......@@ -299,7 +262,7 @@ void CalendarTaskBaseHandler::collectionChanged(const Akonadi::Collection &colle
}
}
EteSyncCollectionInfoPtr info(etesync_collection_info_new(eteSyncCollectionType(), collection.displayName(), QString(), journalColor));
EteSyncCollectionInfoPtr info(etesync_collection_info_new(etesyncCollectionType(), collection.displayName(), QString(), journalColor));
EteSyncCryptoManagerPtr cryptoManager(etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair()));
......
......@@ -22,39 +22,34 @@
#include <AkonadiCore/Item>
#include <KCalendarCore/Incidence>
#include "basehandler.h"
#include "etesyncadapter.h"
#include "etesyncclientstate.h"
class EteSyncResource;
class CalendarTaskBaseHandler : public QObject
class CalendarTaskBaseHandler : public BaseHandler
{
Q_OBJECT
public:
CalendarTaskBaseHandler(EteSyncResource *resource);
explicit CalendarTaskBaseHandler(EteSyncResource *resource);
void setupItems(EteSyncEntry **entries, Akonadi::Collection &collection);
void setupItems(EteSyncEntry **entries, Akonadi::Collection &collection) override;
void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection);
void itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &parts);
void itemRemoved(const Akonadi::Item &item);
void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection) override;
void itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &parts) override;
void itemRemoved(const Akonadi::Item &item) override;
void collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent);
void collectionChanged(const Akonadi::Collection &collection);
void collectionRemoved(const Akonadi::Collection &collection);
void collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent) override;
void collectionChanged(const Akonadi::Collection &collection) override;
void collectionRemoved(const Akonadi::Collection &collection) override;
protected:
QString getLocalCalendar(const QString &incidenceUid) const;
bool updateLocalCalendar(const KCalendarCore::Incidence::Ptr &incidence);
void deleteLocalCalendar(const KCalendarCore::Incidence::Ptr &incidence);
QString baseDirectoryPath() const;
virtual const QString mimeType() = 0;
virtual const QString eteSyncCollectionType() = 0;
EteSyncResource *mResource = nullptr;
EteSyncClientState *mClientState = nullptr;
QString baseDirectoryPath() const override;
};
#endif
......@@ -28,10 +28,9 @@
using namespace Akonadi;
ContactHandler::ContactHandler(EteSyncResource *resource)
: mResource(resource), mClientState(resource->mClientState)
ContactHandler::ContactHandler(EteSyncResource *resource) : BaseHandler(resource)
{
mResource->initialiseDirectory(baseDirectoryPath());
initialiseBaseDirectory();
}
const QString ContactHandler::mimeType()
......@@ -39,7 +38,7 @@ const QString ContactHandler::mimeType()
return KContacts::Addressee::mimeType();
}
const QString ContactHandler::eteSyncCollectionType()
const QString ContactHandler::etesyncCollectionType()
{
return QStringLiteral(ETESYNC_COLLECTION_TYPE_ADDRESS_BOOK);
}
......@@ -176,23 +175,11 @@ void ContactHandler::itemAdded(const Akonadi::Item &item,
QByteArray content = converter.createVCard(item.payload<KContacts::Addressee>());
EteSyncSyncEntryPtr syncEntry(etesync_sync_entry_new(ETESYNC_SYNC_ENTRY_ACTION_ADD, content.constData()));
EteSyncEntryPtr entry(etesync_entry_from_sync_entry(cryptoManager.get(), syncEntry.get(), collection.remoteRevision()));
EteSyncEntryManagerPtr entryManager(etesync_entry_manager_new(mClientState->client(), collection.remoteId()));
EteSyncEntry *entries[] = {entry.get(), NULL};
etesync_entry_manager_create(entryManager.get(), entries, collection.remoteRevision());
createEteSyncEntry(syncEntry.get(), cryptoManager.get(), collection);
mResource->changeCommitted(item);
updateLocalContact(item.payload<KContacts::Addressee>());
// Update last UID in collection remoteRevision
const QString entryUid = QStringFromCharPtr(CharPtr(etesync_entry_get_uid(entry.get())));
Collection col = collection;
col.setRemoteRevision(entryUid);
new CollectionModifyJob(col, this);
}
void ContactHandler::itemChanged(const Akonadi::Item &item,
......@@ -215,22 +202,11 @@ void ContactHandler::itemChanged(const Akonadi::Item &item,
QByteArray content = converter.createVCard(item.payload<KContacts::Addressee>());
EteSyncSyncEntryPtr syncEntry(etesync_sync_entry_new(ETESYNC_SYNC_ENTRY_ACTION_CHANGE, content.constData()));
EteSyncEntryPtr entry(etesync_entry_from_sync_entry(cryptoManager.get(), syncEntry.get(), collection.remoteRevision()));
EteSyncEntryManagerPtr entryManager(etesync_entry_manager_new(mClientState->client(), collection.remoteId()));
EteSyncEntry *entries[] = {entry.get(), NULL};
etesync_entry_manager_create(entryManager.get(), entries, collection.remoteRevision());
createEteSyncEntry(syncEntry.get(), cryptoManager.get(), collection);
mResource->changeCommitted(item);
updateLocalContact(item.payload<KContacts::Addressee>());
// Update last UID in collection remoteRevision
const QString entryUid = QStringFromCharPtr(CharPtr(etesync_entry_get_uid(entry.get())));
collection.setRemoteRevision(entryUid);
new CollectionModifyJob(collection, this);
}
void ContactHandler::itemRemoved(const Akonadi::Item &item)
......@@ -251,20 +227,9 @@ void ContactHandler::itemRemoved(const Akonadi::Item &item)
QString contact = getLocalContact(item.remoteId());
EteSyncSyncEntryPtr syncEntry(etesync_sync_entry_new(ETESYNC_SYNC_ENTRY_ACTION_DELETE, charArrFromQString(contact)));
EteSyncEntryPtr entry(etesync_entry_from_sync_entry(cryptoManager.get(), syncEntry.get(), collection.remoteRevision()));
EteSyncEntryManagerPtr entryManager(etesync_entry_manager_new(mClientState->client(), collection.remoteId()));
EteSyncEntry *entries[] = {entry.get(), NULL};
etesync_entry_manager_create(entryManager.get(), entries, collection.remoteRevision());
createEteSyncEntry(syncEntry.get(), cryptoManager.get(), collection);
mResource->changeCommitted(item);
// Update last UID in collection remoteRevision
const QString entryUid = QStringFromCharPtr(CharPtr(etesync_entry_get_uid(entry.get())));
collection.setRemoteRevision(entryUid);
new CollectionModifyJob(collection, this);
}
void ContactHandler::collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent)
......@@ -272,7 +237,7 @@ void ContactHandler::collectionAdded(const Akonadi::Collection &collection, cons
QString journalUid = QStringFromCharPtr(CharPtr(etesync_gen_uid()));
EteSyncJournalPtr journal(etesync_journal_new(journalUid, ETESYNC_CURRENT_VERSION));
EteSyncCollectionInfoPtr info(etesync_collection_info_new(eteSyncCollectionType(), collection.displayName(), QString(), EteSyncDEFAULT_COLOR));
EteSyncCollectionInfoPtr info(etesync_collection_info_new(etesyncCollectionType(), collection.displayName(), QString(), EteSyncDEFAULT_COLOR));
EteSyncCryptoManagerPtr cryptoManager(etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair()));
......@@ -290,7 +255,7 @@ void ContactHandler::collectionChanged(const Akonadi::Collection &collection)
QString journalUid = collection.remoteId();
EteSyncJournalPtr journal(etesync_journal_manager_fetch(mClientState->journalManager(), journalUid));
EteSyncCollectionInfoPtr info(etesync_collection_info_new(eteSyncCollectionType(), collection.displayName(), QString(), EteSyncDEFAULT_COLOR));
EteSyncCollectionInfoPtr info(etesync_collection_info_new(etesyncCollectionType(), collection.displayName(), QString(), EteSyncDEFAULT_COLOR));
EteSyncCryptoManagerPtr cryptoManager(etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair()));
......
......@@ -23,41 +23,38 @@
#include <AkonadiCore/Collection>
#include <AkonadiCore/Item>
#include "basehandler.h"
#include "etesyncadapter.h"
#include "etesyncclientstate.h"
class EteSyncResource;
class ContactHandler : public QObject
class ContactHandler : public BaseHandler
{
Q_OBJECT
public:
typedef std::unique_ptr<ContactHandler> Ptr;
ContactHandler(EteSyncResource *resource);
explicit ContactHandler(EteSyncResource *resource);
void setupItems(EteSyncEntry **entries, Akonadi::Collection &collection);
void setupItems(EteSyncEntry **entries, Akonadi::Collection &collection) override;
void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection);
void itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &parts);
void itemRemoved(const Akonadi::Item &item);
void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection) override;
void itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &parts) override;
void itemRemoved(const Akonadi::Item &item) override;
void collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent);
void collectionChanged(const Akonadi::Collection &collection);
void collectionRemoved(const Akonadi::Collection &collection);
void collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent) override;
void collectionChanged(const Akonadi::Collection &collection) override;
void collectionRemoved(const Akonadi::Collection &collection) override;
protected:
QString getLocalContact(QString contactUid) const;
void updateLocalContact(const KContacts::Addressee &contact);
void deleteLocalContact(const KContacts::Addressee &contact);
QString baseDirectoryPath() const;
QString baseDirectoryPath() const override;
const QString mimeType();
const QString eteSyncCollectionType();
private:
EteSyncResource *mResource = nullptr;
EteSyncClientState *mClientState = nullptr;
const QString mimeType() override;
const QString etesyncCollectionType() override;
};
#endif
......@@ -37,8 +37,8 @@ void EntriesFetchJob::start()
void EntriesFetchJob::fetchEntries()
{
QString journalUid = mCollection.remoteId();
QString prevUid = mCollection.remoteRevision();
const QString journalUid = mCollection.remoteId();
const QString prevUid = mCollection.remoteRevision();
EteSyncEntryManagerPtr entryManager(etesync_entry_manager_new(mClient, journalUid));
mEntries = etesync_entry_manager_list(entryManager.get(), prevUid, 0);
......
......@@ -29,16 +29,16 @@ namespace EteSyncAPI {
Q_OBJECT
public:
EntriesFetchJob(const EteSync *client, const Akonadi::Collection &collection, QObject *parent = nullptr);
explicit EntriesFetchJob(const EteSync *client, const Akonadi::Collection &collection, QObject *parent = nullptr);
void start() override;
EteSyncEntry **entries()
EteSyncEntry **entries() const
{
return mEntries;
}
Akonadi::Collection collection()
Akonadi::Collection collection() const
{
return mCollection;
}
......
......@@ -74,7 +74,7 @@ void EteSyncClientState::init()
Q_EMIT clientInitialised(true);
}
bool EteSyncClientState::initToken(QString &serverUrl, QString &username, QString &password)
bool EteSyncClientState::initToken(const QString &serverUrl, const QString &username, const QString &password)
{
mServerUrl = serverUrl;
mUsername = username;
......
......@@ -29,7 +29,7 @@ public:
~EteSyncClientState();
void init();
bool initToken(QString &serverUrl, QString &username, QString &password);
bool initToken(const QString &serverUrl, const QString &username, const QString &password);
bool initUserInfo();
bool initKeypair(const QString &encryptionPassword);
void initAccount(const QString &encryptionPassword);
......
......@@ -90,6 +90,7 @@ private:
friend class ContactHandler;
friend class CalendarTaskBaseHandler;
friend class BaseHandler;
};
#endif
......@@ -28,7 +28,7 @@ namespace EteSyncAPI {
Q_OBJECT
public:
JournalsFetchJob(EteSync *client, QObject *parent = nullptr);
explicit JournalsFetchJob(EteSync *client, QObject *parent = nullptr);
void start() override;
......
......@@ -80,14 +80,14 @@ int LoginPage::nextId() const
bool LoginPage::validatePage()
{
QString username = field(QStringLiteral("credentialsUserName")).toString();
QString password = field(QStringLiteral("credentialsPassword")).toString();
QString advancedServerUrl = field(QStringLiteral("credentialsServerUrl")).toString();
const QString username = field(QStringLiteral("credentialsUserName")).toString();
const QString password = field(QStringLiteral("credentialsPassword")).toString();
const QString advancedServerUrl = field(QStringLiteral("credentialsServerUrl")).toString();
QString serverUrl = QStringLiteral("https://api.etesync.com");
if (!advancedServerUrl.isNull() && !advancedServerUrl.isEmpty()) {
serverUrl = advancedServerUrl;
}
bool loginResult = static_cast<SetupWizard *>(wizard())->mClientState->initToken(serverUrl, username, password);
const bool loginResult = static_cast<SetupWizard *>(wizard())->mClientState->initToken(serverUrl, username, password);
if (!loginResult) {
mLoginLabel->setText(i18n("Incorrect login credentials. Please try again."));
}
......
......@@ -25,7 +25,7 @@ const QString TaskHandler::mimeType()
{
return KCalendarCore::Todo::todoMimeType();
}
const QString TaskHandler::eteSyncCollectionType()
const QString TaskHandler::etesyncCollectionType()
{
return QStringLiteral(ETESYNC_COLLECTION_TYPE_TASKS);
}
......@@ -35,7 +35,7 @@ public:
protected:
const QString mimeType();
const QString eteSyncCollectionType();