Commit bd813cdb authored by Shashwat Jolly's avatar Shashwat Jolly
Browse files

Clean up comments

parent b5076539
......@@ -68,8 +68,6 @@ void CalendarTaskBaseHandler::setupItems(EteSyncEntry **entries, Akonadi::Collec
KCalendarCore::Incidence::Ptr incidence = format.fromString(QStringFromCharPtr(contentStr));
const QString action = QStringFromCharPtr(CharPtr(etesync_sync_entry_get_action(syncEntry.get())));
qCDebug(ETESYNC_LOG) << action;
qCDebug(ETESYNC_LOG) << incidence->created();
if (action == QStringLiteral(ETESYNC_SYNC_ENTRY_ACTION_ADD) || action == QStringLiteral(ETESYNC_SYNC_ENTRY_ACTION_CHANGE)) {
incidences[incidence->uid()] = incidence;
} else if (action == QStringLiteral(ETESYNC_SYNC_ENTRY_ACTION_DELETE)) {
......@@ -160,18 +158,19 @@ void CalendarTaskBaseHandler::deleteLocalCalendar(const KCalendarCore::Incidence
void CalendarTaskBaseHandler::itemAdded(const Akonadi::Item &item,
const Akonadi::Collection &collection)
{
qCDebug(ETESYNC_LOG) << "Mime: " << collection.contentMimeTypes();
KCalendarCore::Calendar::Ptr calendar(new MemoryCalendar(QTimeZone::utc()));
calendar->addIncidence(item.payload<Incidence::Ptr>());
KCalendarCore::ICalFormat format;
// qCDebug(ETESYNC_LOG) << "Calendar item added " << format.toString(calendar);
EteSyncJournalPtr journal(etesync_journal_manager_fetch(mClientState->journalManager(), collection.remoteId()));
// Handle EteSync conflict error: If stored UID is old, sync and retry
QString lastJournalUid = QStringFromCharPtr(CharPtr(etesync_journal_get_last_uid(journal.get())));
if (lastJournalUid != collection.remoteRevision()) {
mResource->deferTask();
mResource->retrieveItems(collection);
}
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)));
......@@ -202,14 +201,16 @@ void CalendarTaskBaseHandler::itemChanged(const Akonadi::Item &item,
KCalendarCore::Calendar::Ptr calendar(new MemoryCalendar(QTimeZone::utc()));
calendar->addIncidence(item.payload<Incidence::Ptr>());
KCalendarCore::ICalFormat format;
// qCDebug(ETESYNC_LOG) << "Calendar item changed " << format.toString(calendar);
EteSyncJournalPtr journal(etesync_journal_manager_fetch(mClientState->journalManager(), collection.remoteId()));
// Handle EteSync conflict error: If stored UID is old, sync and retry
QString lastJournalUid = QStringFromCharPtr(CharPtr(etesync_journal_get_last_uid(journal.get())));
if (lastJournalUid != collection.remoteRevision()) {
mResource->deferTask();
mResource->retrieveItems(collection);
}
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)));
......@@ -237,11 +238,14 @@ void CalendarTaskBaseHandler::itemRemoved(const Akonadi::Item &item)
Collection collection = item.parentCollection();
EteSyncJournalPtr journal(etesync_journal_manager_fetch(mClientState->journalManager(), collection.remoteId()));
// Handle EteSync conflict error: If stored UID is old, sync and retry
QString lastJournalUid = QStringFromCharPtr(CharPtr(etesync_journal_get_last_uid(journal.get())));
if (lastJournalUid != collection.remoteRevision()) {
mResource->deferTask();
mResource->retrieveItems(collection);
}
EteSyncCryptoManagerPtr cryptoManager(etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair()));
QString calendar = getLocalCalendar(item.remoteId());
......
......@@ -162,11 +162,14 @@ void ContactHandler::itemAdded(const Akonadi::Item &item,
const Akonadi::Collection &collection)
{
EteSyncJournalPtr journal(etesync_journal_manager_fetch(mClientState->journalManager(), collection.remoteId()));
// Handle EteSync conflict error: If stored UID is old, sync and retry
QString lastJournalUid = QStringFromCharPtr(CharPtr(etesync_journal_get_last_uid(journal.get())));
if (lastJournalUid != collection.remoteRevision()) {
mResource->deferTask();
mResource->retrieveItems(collection);
}
EteSyncCryptoManagerPtr cryptoManager(etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair()));
KContacts::VCardConverter converter;
......@@ -198,11 +201,14 @@ void ContactHandler::itemChanged(const Akonadi::Item &item,
Collection collection = item.parentCollection();
EteSyncJournalPtr journal(etesync_journal_manager_fetch(mClientState->journalManager(), collection.remoteId()));
// Handle EteSync conflict error: If stored UID is old, sync and retry
QString lastJournalUid = QStringFromCharPtr(CharPtr(etesync_journal_get_last_uid(journal.get())));
if (lastJournalUid != collection.remoteRevision()) {
mResource->deferTask();
mResource->retrieveItems(collection);
}
EteSyncCryptoManagerPtr cryptoManager(etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair()));
KContacts::VCardConverter converter;
......@@ -232,11 +238,14 @@ void ContactHandler::itemRemoved(const Akonadi::Item &item)
Collection collection = item.parentCollection();
EteSyncJournalPtr journal(etesync_journal_manager_fetch(mClientState->journalManager(), collection.remoteId()));
// Handle EteSync conflict error: If stored UID is old, sync and retry
QString lastJournalUid = QStringFromCharPtr(CharPtr(etesync_journal_get_last_uid(journal.get())));
if (lastJournalUid != collection.remoteRevision()) {
mResource->deferTask();
mResource->retrieveItems(collection);
}
EteSyncCryptoManagerPtr cryptoManager(etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair()));
QString contact = getLocalContact(item.remoteId());
......
......@@ -80,7 +80,6 @@ int LoginPage::nextId() const
bool LoginPage::validatePage()
{
qCDebug(ETESYNC_LOG) << "validate login page";
QString username = field(QStringLiteral("credentialsUserName")).toString();
QString password = field(QStringLiteral("credentialsPassword")).toString();
QString advancedServerUrl = field(QStringLiteral("credentialsServerUrl")).toString();
......@@ -88,7 +87,6 @@ bool LoginPage::validatePage()
if (!advancedServerUrl.isNull() && !advancedServerUrl.isEmpty()) {
serverUrl = advancedServerUrl;
}
// return true;
bool loginResult = static_cast<SetupWizard *>(wizard())->mClientState->initToken(serverUrl, username, password);
if (!loginResult) {
mLoginLabel->setText(i18n("Incorrect login credentials. Please try again."));
......@@ -115,7 +113,6 @@ EncryptionPasswordPage::EncryptionPasswordPage(QWidget *parent)
int EncryptionPasswordPage::nextId() const
{
// Implement keypair job
return -1;
}
......@@ -130,13 +127,11 @@ void EncryptionPasswordPage::initializePage()
bool EncryptionPasswordPage::validatePage()
{
qCDebug(ETESYNC_LOG) << "validate encryptionpassword page";
QString encryptionPassword = field(QStringLiteral("credentialsEncryptionPassword")).toString();
if (mInitAccount) {
static_cast<SetupWizard *>(wizard())->mClientState->initAccount(encryptionPassword);
return true;
}
// return true;
bool keypairResult = static_cast<SetupWizard *>(wizard())->mClientState->initKeypair(encryptionPassword);
if (!keypairResult) {
mEncryptionPasswordLabel->setText(i18n("Incorrect encryption password. Please try again."));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment