Commit 4a648396 authored by Shashwat Jolly's avatar Shashwat Jolly

Fix bug where mtime of a deleted item was not set

Switched to current time everywhere instead of Akonadi supplied item modification time, as it was not available on item deletion.
parent 9aeb9d3e
...@@ -371,7 +371,7 @@ void EteSyncResource::itemAdded(const Akonadi::Item &item, const Akonadi::Collec ...@@ -371,7 +371,7 @@ void EteSyncResource::itemAdded(const Akonadi::Item &item, const Akonadi::Collec
const QString type = QString::fromUtf8(etebase_collection_metadata_get_collection_type(collectionMetadata.get())); const QString type = QString::fromUtf8(etebase_collection_metadata_get_collection_type(collectionMetadata.get()));
// Create metadata // Create metadata
int64_t modificationTimeSinceEpoch = item.modificationTime().toMSecsSinceEpoch(); int64_t modificationTimeSinceEpoch = QDateTime::currentMSecsSinceEpoch();
EtebaseItemMetadataPtr itemMetaData(etebase_item_metadata_new()); EtebaseItemMetadataPtr itemMetaData(etebase_item_metadata_new());
etebase_item_metadata_set_item_type(itemMetaData.get(), "file"); etebase_item_metadata_set_item_type(itemMetaData.get(), "file");
QString uid; QString uid;
...@@ -451,8 +451,7 @@ void EteSyncResource::itemChanged(const Akonadi::Item &item, const QSet<QByteArr ...@@ -451,8 +451,7 @@ void EteSyncResource::itemChanged(const Akonadi::Item &item, const QSet<QByteArr
} }
// Update metadata (only mtime in this case) // Update metadata (only mtime in this case)
int64_t modificationTimeSinceEpoch = item.modificationTime().toMSecsSinceEpoch(); int64_t modificationTimeSinceEpoch = QDateTime::currentMSecsSinceEpoch();
EtebaseItemMetadataPtr itemMetadata(etebase_item_get_meta(etesyncItem.get())); EtebaseItemMetadataPtr itemMetadata(etebase_item_get_meta(etesyncItem.get()));
etebase_item_metadata_set_mtime(itemMetadata.get(), &modificationTimeSinceEpoch); etebase_item_metadata_set_mtime(itemMetadata.get(), &modificationTimeSinceEpoch);
etebase_item_set_meta(etesyncItem.get(), itemMetadata.get()); etebase_item_set_meta(etesyncItem.get(), itemMetadata.get());
...@@ -510,8 +509,7 @@ void EteSyncResource::itemRemoved(const Akonadi::Item &item) ...@@ -510,8 +509,7 @@ void EteSyncResource::itemRemoved(const Akonadi::Item &item)
} }
// Update metadata (only mtime in this case) // Update metadata (only mtime in this case)
int64_t modificationTimeSinceEpoch = item.modificationTime().toMSecsSinceEpoch(); int64_t modificationTimeSinceEpoch = QDateTime::currentMSecsSinceEpoch();
EtebaseItemMetadataPtr itemMetadata(etebase_item_get_meta(etesyncItem.get())); EtebaseItemMetadataPtr itemMetadata(etebase_item_get_meta(etesyncItem.get()));
etebase_item_metadata_set_mtime(itemMetadata.get(), &modificationTimeSinceEpoch); etebase_item_metadata_set_mtime(itemMetadata.get(), &modificationTimeSinceEpoch);
etebase_item_set_meta(etesyncItem.get(), itemMetadata.get()); etebase_item_set_meta(etesyncItem.get(), itemMetadata.get());
......
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