Commit a0cb7ea2 authored by Krzysztof Nowicki's avatar Krzysztof Nowicki Committed by Laurent Montel
Browse files

Remove global folder item sync state

This completes the migration to per-collection sync state storage.
parent 5f5a95e2
......@@ -171,7 +171,6 @@ EwsConfigDialog::EwsConfigDialog(EwsResource *parentResource, EwsClient &client,
connect(mUi->tryConnectButton, &QPushButton::clicked, this, &EwsConfigDialog::tryConnect);
connect(mUi->userAgentCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EwsConfigDialog::userAgentChanged);
connect(mUi->clearFolderTreeSyncStateButton, &QPushButton::clicked, mParentResource, &EwsResource::clearFolderTreeSyncState);
connect(mUi->clearFolderItemSyncStateButton, &QPushButton::clicked, mParentResource, QOverload<>::of(&EwsResource::clearFolderSyncState));
}
EwsConfigDialog::~EwsConfigDialog()
......
......@@ -109,15 +109,7 @@ EwsResource::EwsResource(const QString &id)
setScheduleAttributeSyncBeforeItemSync(true);
// Load the sync state
QByteArray data = QByteArray::fromBase64(mSettings->syncState().toLatin1());
if (!data.isEmpty()) {
data = qUncompress(data);
if (!data.isEmpty()) {
QDataStream stream(data);
stream >> mSyncState;
}
}
data = QByteArray::fromBase64(mSettings->folderSyncState().toLatin1());
QByteArray data = QByteArray::fromBase64(mSettings->folderSyncState().toLatin1());
if (!data.isEmpty()) {
data = qUncompress(data);
if (!data.isEmpty()) {
......@@ -1044,12 +1036,6 @@ void EwsResource::fullSyncRequestedEvent()
synchronize();
}
void EwsResource::clearFolderSyncState()
{
mSyncState.clear();
saveState();
}
void EwsResource::clearCollectionSyncState(int collectionId)
{
Collection col(collectionId);
......@@ -1146,8 +1132,6 @@ void EwsResource::saveState()
{
QByteArray str;
QDataStream dataStream(&str, QIODevice::WriteOnly);
dataStream << mSyncState;
mSettings->setSyncState(QString::fromLatin1(qCompress(str, 9).toBase64()));
mSettings->setFolderSyncState(QString::fromLatin1(qCompress(mFolderSyncState.toLatin1(), 9).toBase64()));
mSettings->save();
}
......@@ -1398,8 +1382,6 @@ QString EwsResource::getCollectionSyncState(const Akonadi::Collection &col) cons
void EwsResource::saveCollectionSyncState(Akonadi::Collection &col, const QString &state)
{
mSyncState[col.remoteId()] = state;
col.addAttribute(new EwsSyncStateAttribute(state));
CollectionModifyJob *job = new CollectionModifyJob(col);
job->start();
......
......@@ -73,7 +73,6 @@ protected:
public Q_SLOTS:
void configure(WId windowId) override;
Q_SCRIPTABLE void clearCollectionSyncState(int collectionId);
Q_SCRIPTABLE void clearFolderSyncState();
Q_SCRIPTABLE void clearFolderTreeSyncState();
Q_SCRIPTABLE void setInitialReconnectTimeout(int timeout);
protected Q_SLOTS:
......@@ -150,7 +149,6 @@ private:
EwsClient mEwsClient;
Akonadi::Collection mRootCollection;
QScopedPointer<EwsSubscriptionManager> mSubManager;
QHash<QString, QString> mSyncState;
QString mFolderSyncState;
QHash<QString, EwsId::List> mItemsToCheck;
QHash<QString, EwsFetchItemsJob::QueuedUpdateList> mQueuedUpdates;
......
......@@ -74,7 +74,6 @@
<entry name="PKeyKey" type="String">
<label>Path to PKey authentication PEM private key</label>
</entry>
<entry name="SyncState" type="String" />
<entry name="FolderSyncState" type="String" />
<entry name="EventSubscriptionId" type="String" />
<entry name="EventSubscriptionWatermark" type="String" />
......
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