Changeset View
Changeset View
Standalone View
Standalone View
src/server/storage/datastore.cpp
Show First 20 Lines • Show All 1211 Lines • ▼ Show 20 Line(s) | 1211 | try { | |||
---|---|---|---|---|---|
1212 | return PartHelper::remove(Part::partTypeIdFullColumnName(), | 1212 | return PartHelper::remove(Part::partTypeIdFullColumnName(), | ||
1213 | PartTypeHelper::fromFqName(QStringLiteral("ATR"), QStringLiteral("HIDDEN")).id()); | 1213 | PartTypeHelper::fromFqName(QStringLiteral("ATR"), QStringLiteral("HIDDEN")).id()); | ||
1214 | } catch (...) { | 1214 | } catch (...) { | ||
1215 | } // we can live with this failing | 1215 | } // we can live with this failing | ||
1216 | 1216 | | |||
1217 | return false; | 1217 | return false; | ||
1218 | } | 1218 | } | ||
1219 | 1219 | | |||
1220 | bool DataStore::cleanupPimItems(const PimItem::List &items) | 1220 | bool DataStore::cleanupPimItems(const PimItem::List &items, bool silent) | ||
1221 | { | 1221 | { | ||
1222 | // generate relation removed notifications | 1222 | // generate relation removed notifications | ||
1223 | if (!silent) { | ||||
1223 | for (const PimItem &item : items) { | 1224 | for (const PimItem &item : items) { | ||
1224 | SelectQueryBuilder<Relation> relationQuery; | 1225 | SelectQueryBuilder<Relation> relationQuery; | ||
1225 | relationQuery.addValueCondition(Relation::leftIdFullColumnName(), Query::Equals, item.id()); | 1226 | relationQuery.addValueCondition(Relation::leftIdFullColumnName(), Query::Equals, item.id()); | ||
1226 | relationQuery.addValueCondition(Relation::rightIdFullColumnName(), Query::Equals, item.id()); | 1227 | relationQuery.addValueCondition(Relation::rightIdFullColumnName(), Query::Equals, item.id()); | ||
1227 | relationQuery.setSubQueryMode(Query::Or); | 1228 | relationQuery.setSubQueryMode(Query::Or); | ||
1228 | 1229 | | |||
1229 | if (!relationQuery.exec()) { | 1230 | if (!relationQuery.exec()) { | ||
1230 | throw HandlerException("Failed to obtain relations"); | 1231 | throw HandlerException("Failed to obtain relations"); | ||
1231 | } | 1232 | } | ||
1232 | const Relation::List relations = relationQuery.result(); | 1233 | const Relation::List relations = relationQuery.result(); | ||
1233 | for (const Relation &relation : relations) { | 1234 | for (const Relation &relation : relations) { | ||
1234 | notificationCollector()->relationRemoved(relation); | 1235 | notificationCollector()->relationRemoved(relation); | ||
1235 | } | 1236 | } | ||
1236 | } | 1237 | } | ||
1237 | 1238 | | |||
1238 | // generate the notification before actually removing the data | 1239 | // generate the notification before actually removing the data | ||
1239 | notificationCollector()->itemsRemoved(items); | 1240 | notificationCollector()->itemsRemoved(items); | ||
dfaure: This makes me realize that I don't remember ever seeing the duplicates in the kmail message… | |||||
You would only notice if the duplicates were actually duplicates of a single message rather than two distinct messages with conflicting RIDs. Which makes me realize I should add some way of disabling the automatic recovery because otherwise debugging the source of the MMC error will be even more difficult if it will auto-correct itself immediately. dvratil: You would only notice if the duplicates were actually duplicates of a single message rather… | |||||
1241 | } | ||||
1240 | 1242 | | |||
1241 | // FIXME: Create a single query to do this | 1243 | // FIXME: Create a single query to do this | ||
1242 | Q_FOREACH (const PimItem &item, items) { | 1244 | for (const auto &item : items) { | ||
1243 | if (!item.clearFlags()) { | 1245 | if (!item.clearFlags()) { | ||
1244 | qCWarning(AKONADISERVER_LOG) << "Failed to clean up flags from PimItem" << item.id(); | 1246 | qCWarning(AKONADISERVER_LOG) << "Failed to clean up flags from PimItem" << item.id(); | ||
1245 | return false; | 1247 | return false; | ||
1246 | } | 1248 | } | ||
1247 | if (!PartHelper::remove(Part::pimItemIdColumn(), item.id())) { | 1249 | if (!PartHelper::remove(Part::pimItemIdColumn(), item.id())) { | ||
1248 | qCWarning(AKONADISERVER_LOG) << "Failed to clean up parts from PimItem" << item.id(); | 1250 | qCWarning(AKONADISERVER_LOG) << "Failed to clean up parts from PimItem" << item.id(); | ||
1249 | return false; | 1251 | return false; | ||
1250 | } | 1252 | } | ||
▲ Show 20 Lines • Show All 267 Lines • Show Last 20 Lines |
This makes me realize that I don't remember ever seeing the duplicates in the kmail message list.
So the duplicates must be created by itemsync itself, not by something that happens before...