diff options
Diffstat (limited to 'common/store.cpp')
-rw-r--r-- | common/store.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/common/store.cpp b/common/store.cpp index 4c9ef4c..be2488a 100644 --- a/common/store.cpp +++ b/common/store.cpp | |||
@@ -332,7 +332,8 @@ static KAsync::Job<Store::UpgradeResult> upgrade(const QByteArray &resource) | |||
332 | } | 332 | } |
333 | SinkLog() << "Upgrading " << resource; | 333 | SinkLog() << "Upgrading " << resource; |
334 | 334 | ||
335 | auto resourceAccess = ResourceAccessFactory::instance().getAccess(resource, ResourceConfig::getResourceType(resource)); | 335 | //We're not using the factory to avoid getting a cached resourceaccess with the wrong resourceType |
336 | auto resourceAccess = Sink::ResourceAccess::Ptr{new Sink::ResourceAccess(resource, ResourceConfig::getResourceType(resource)), &QObject::deleteLater}; | ||
336 | return resourceAccess->sendCommand(Sink::Commands::UpgradeCommand) | 337 | return resourceAccess->sendCommand(Sink::Commands::UpgradeCommand) |
337 | .addToContext(resourceAccess) | 338 | .addToContext(resourceAccess) |
338 | .then([=](const KAsync::Error &error) { | 339 | .then([=](const KAsync::Error &error) { |
@@ -349,6 +350,15 @@ static KAsync::Job<Store::UpgradeResult> upgrade(const QByteArray &resource) | |||
349 | KAsync::Job<Store::UpgradeResult> Store::upgrade() | 350 | KAsync::Job<Store::UpgradeResult> Store::upgrade() |
350 | { | 351 | { |
351 | SinkLog() << "Upgrading..."; | 352 | SinkLog() << "Upgrading..."; |
353 | |||
354 | //Migrate from sink.dav to sink.carddav | ||
355 | const auto resources = ResourceConfig::getResources(); | ||
356 | for (auto it = resources.constBegin(); it != resources.constEnd(); it++) { | ||
357 | if (it.value() == "sink.dav") { | ||
358 | ResourceConfig::setResourceType(it.key(), "sink.carddav"); | ||
359 | } | ||
360 | } | ||
361 | |||
352 | auto ret = QSharedPointer<bool>::create(false); | 362 | auto ret = QSharedPointer<bool>::create(false); |
353 | return fetchAll<ApplicationDomain::SinkResource>({}) | 363 | return fetchAll<ApplicationDomain::SinkResource>({}) |
354 | .template each([ret](const ApplicationDomain::SinkResource::Ptr &resource) -> KAsync::Job<void> { | 364 | .template each([ret](const ApplicationDomain::SinkResource::Ptr &resource) -> KAsync::Job<void> { |