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

Change entries list return from adapter on error

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