[Kde-pim] Reload collection from server?
David Faure
faure at kde.org
Sat May 30 09:02:53 BST 2015
Is there some API in kdepimlibs/akonadi for telling a resource to discard all of a collection's content and fetch it all again (e.g. from the remote server)?
This would be useful for the SugarCRM resource I'm working on: I realized that the resource didn't save all of the attributes, so now users have incomplete objects. The only way to fix that is to force a redownload.
akonadiconsole has a "Clear Akonadi Cache" (in the browser tab, RMB on collection), but it's not properly implemented:
void BrowserWidget::clearCache()
{
const Collection coll = currentCollection();
if ( !coll.isValid() )
return;
QString str = QString("DELETE FROM PimItemTable WHERE collectionId=%1").arg(coll.id());
qDebug() << str;
QSqlQuery query( str, DbAccess::database() );
if (query.exec() ) {
if (query.lastError().isValid()) {
qDebug() << query.lastError();
KMessageBox::error( this, query.lastError().text() );
}
}
}
Surely this is incomplete, it leaves the additional files lying around, right?
(So this is why I had a huge amount of cruft in file_db_data....)
Or maybe I'm looking at this the wrong way, and simply doing a full listing in retrieveItems()
(instead of just listing the modified stuff since last sync) and then doing
itemsRetrievedIncremental(full_list_of_new_items, Item::List());
should be enough?
This replaces items with the same ID, and doesn't accumulate files in file_db_data, right?
Sounds logical, but I'd just like to make sure, I'm playing with stuff I don't really understand here :-)
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list