Commit 55293651 authored by Shashwat Jolly's avatar Shashwat Jolly

Change entries list return from adapter on error

parent fe4c096c
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <AkonadiCore/AttributeFactory> #include <AkonadiCore/AttributeFactory>
#include <AkonadiCore/CollectionColorAttribute> #include <AkonadiCore/CollectionColorAttribute>
#include <AkonadiCore/CollectionModifyJob> #include <AkonadiCore/CollectionModifyJob>
#include <AkonadiCore/ItemFetchJob>
#include <AkonadiCore/ItemModifyJob> #include <AkonadiCore/ItemModifyJob>
#include <KCalendarCore/ICalFormat> #include <KCalendarCore/ICalFormat>
#include <KCalendarCore/MemoryCalendar> #include <KCalendarCore/MemoryCalendar>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <kcontacts/vcardconverter.h> #include <kcontacts/vcardconverter.h>
#include <AkonadiCore/CollectionModifyJob> #include <AkonadiCore/CollectionModifyJob>
#include <AkonadiCore/ItemModifyJob>
#include <KLocalizedString> #include <KLocalizedString>
#include <QFile> #include <QFile>
......
...@@ -42,12 +42,13 @@ void EntriesFetchJob::fetchEntries() ...@@ -42,12 +42,13 @@ void EntriesFetchJob::fetchEntries()
mPrevUid = mLastUid = mCollection.remoteRevision(); mPrevUid = mLastUid = mCollection.remoteRevision();
mEntryManager = etesync_entry_manager_new(mClient, journalUid); mEntryManager = etesync_entry_manager_new(mClient, journalUid);
EntriesFetchJob::Status status; EntriesFetchJob::Status status = FETCH_OK;
do { while (status != ERROR && status != ALL_ENTRIES_FETCHED) {
status = fetchNextBatch(); status = fetchNextBatch();
} while (status != ERROR && status != ALL_ENTRIES_FETCHED); }
if (status == ERROR) { if (status == ERROR) {
qCDebug(ETESYNC_LOG) << "Returning error from entries fetch job";
setError(UserDefinedError); setError(UserDefinedError);
CharPtr err(etesync_get_error_message()); CharPtr err(etesync_get_error_message());
setErrorText(QStringFromCharPtr(err)); setErrorText(QStringFromCharPtr(err));
......
...@@ -80,12 +80,13 @@ qint32 etesync_entry_manager_create(const EteSyncEntryManager *entry_manager, ...@@ -80,12 +80,13 @@ qint32 etesync_entry_manager_create(const EteSyncEntryManager *entry_manager,
std::pair<std::vector<EteSyncEntryPtr>, bool> etesync_entry_manager_list(const EteSyncEntryManager *entry_manager, std::pair<std::vector<EteSyncEntryPtr>, bool> etesync_entry_manager_list(const EteSyncEntryManager *entry_manager,
const QString &prev_uid, uintptr_t limit) const QString &prev_uid, uintptr_t limit)
{ {
std::vector<EteSyncEntryPtr> rv;
bool err = false; bool err = false;
auto entries = etesync_entry_manager_list(entry_manager, charArrFromQString(prev_uid), limit); auto entries = etesync_entry_manager_list(entry_manager, charArrFromQString(prev_uid), limit);
if (!entries) { if (!entries) {
err = true; err = true;
return make_pair(std::move(rv), err);
} }
std::vector<EteSyncEntryPtr> rv;
while (*entries) { while (*entries) {
rv.emplace_back(EteSyncEntryPtr{*entries}); rv.emplace_back(EteSyncEntryPtr{*entries});
++entries; ++entries;
......
...@@ -114,6 +114,7 @@ void EteSyncResource::configure(WId windowId) ...@@ -114,6 +114,7 @@ void EteSyncResource::configure(WId windowId)
void EteSyncResource::retrieveCollections() void EteSyncResource::retrieveCollections()
{ {
qCDebug(ETESYNC_LOG) << "Retrieving collections";
setCollectionStreamingEnabled(true); setCollectionStreamingEnabled(true);
mJournalsCache.clear(); mJournalsCache.clear();
...@@ -154,7 +155,6 @@ void EteSyncResource::slotCollectionsRetrieved(KJob *job) ...@@ -154,7 +155,6 @@ void EteSyncResource::slotCollectionsRetrieved(KJob *job)
handleTokenError(); handleTokenError();
return; return;
} }
qCDebug(ETESYNC_LOG) << "Retrieving collections";
EteSyncJournal **journals = qobject_cast<JournalsFetchJob *>(job)->journals(); EteSyncJournal **journals = qobject_cast<JournalsFetchJob *>(job)->journals();
Collection::List list; Collection::List list;
const Collection &rootCollection = createRootCollection(); const Collection &rootCollection = createRootCollection();
......
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