Changeset View
Changeset View
Standalone View
Standalone View
src/core/models/entitytreemodel_p.cpp
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | Copyright (c) 2008 Stephen Kelly <steveire@gmail.com> | 2 | Copyright (c) 2008 Stephen Kelly <steveire@gmail.com> | ||
3 | 3 | | |||
4 | This library is free software; you can redistribute it and/or modify it | 4 | This library is free software; you can redistribute it and/or modify it | ||
dvratil: This won't work - just exclude the Akonadi::Collection parameter here and Qt will correctly use… | |||||
5 | under the terms of the GNU Library General Public License as published by | 5 | under the terms of the GNU Library General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or (at your | 6 | the Free Software Foundation; either version 2 of the License, or (at your | ||
7 | option) any later version. | 7 | option) any later version. | ||
8 | 8 | | |||
9 | This library is distributed in the hope that it will be useful, but WITHOUT | 9 | This library is distributed in the hope that it will be useful, but WITHOUT | ||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||
12 | License for more details. | 12 | License for more details. | ||
13 | 13 | | |||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to the | 15 | along with this library; see the file COPYING.LIB. If not, write to the | ||
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
17 | 02110-1301, USA. | 17 | 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "entitytreemodel_p.h" | 20 | #include "entitytreemodel_p.h" | ||
21 | #include "entitytreemodel.h" | 21 | #include "entitytreemodel.h" | ||
22 | 22 | | |||
23 | #include "agentmanagerinterface.h" | 23 | #include "agentmanagerinterface.h" | ||
Not sure if it's Phabricator, but the patch looks incomplete or broken - there seems to be missing chunk here. dvratil: Not sure if it's Phabricator, but the patch looks incomplete or broken - there seems to be… | |||||
24 | #include "monitor_p.h" // For friend ref/deref | 24 | #include "monitor_p.h" // For friend ref/deref | ||
25 | #include "servermanager.h" | 25 | #include "servermanager.h" | ||
26 | #include "vectorhelper.h" | 26 | #include "vectorhelper.h" | ||
27 | 27 | | |||
28 | #include <KLocalizedString> | 28 | #include <KLocalizedString> | ||
29 | 29 | | |||
30 | #include "agentmanager.h" | 30 | #include "agentmanager.h" | ||
31 | #include "agenttype.h" | 31 | #include "agenttype.h" | ||
▲ Show 20 Lines • Show All 1067 Lines • ▼ Show 20 Line(s) | 1055 | { | |||
1099 | if (m_collectionFetchStrategy != EntityTreeModel::InvisibleCollectionFetch) { | 1099 | if (m_collectionFetchStrategy != EntityTreeModel::InvisibleCollectionFetch) { | ||
1100 | m_childEntities[collection.id()].append(node); | 1100 | m_childEntities[collection.id()].append(node); | ||
1101 | } else { | 1101 | } else { | ||
1102 | m_childEntities[m_rootCollection.id()].append(node); | 1102 | m_childEntities[m_rootCollection.id()].append(node); | ||
1103 | } | 1103 | } | ||
1104 | q->endInsertRows(); | 1104 | q->endInsertRows(); | ||
1105 | } | 1105 | } | ||
1106 | 1106 | | |||
1107 | void EntityTreeModelPrivate::monitoredItemRemoved(const Akonadi::Item &item) | 1107 | void EntityTreeModelPrivate::monitoredItemRemoved(const Akonadi::Item &item, const Akonadi::Collection &parentCollection) | ||
1108 | { | 1108 | { | ||
1109 | Q_Q(EntityTreeModel); | 1109 | Q_Q(EntityTreeModel); | ||
1110 | 1110 | | |||
1111 | if (isHidden(item)) { | 1111 | if (isHidden(item)) { | ||
1112 | return; | 1112 | return; | ||
1113 | } | 1113 | } | ||
1114 | 1114 | | |||
1115 | if ((m_itemPopulation == EntityTreeModel::LazyPopulation) && !m_populatedCols.contains(item.parentCollection().id())) { | 1115 | if ((m_itemPopulation == EntityTreeModel::LazyPopulation) && | ||
1116 | !m_populatedCols.contains(parentCollection.isValid() ? parentCollection.id() : item.parentCollection().id())) { | ||||
1116 | return; | 1117 | return; | ||
1117 | } | 1118 | } | ||
1118 | 1119 | | |||
1119 | const Collection::List parents = getParentCollections(item); | 1120 | const Collection::List parents = getParentCollections(item); | ||
1120 | if (parents.isEmpty()) { | 1121 | if (parents.isEmpty()) { | ||
1121 | return; | 1122 | return; | ||
1122 | } | 1123 | } | ||
1123 | 1124 | | |||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 1187 | { | |||
1192 | if (isHidden(sourceCollection)) { | 1193 | if (isHidden(sourceCollection)) { | ||
1193 | if (isHidden(destCollection)) { | 1194 | if (isHidden(destCollection)) { | ||
1194 | return; | 1195 | return; | ||
1195 | } | 1196 | } | ||
1196 | 1197 | | |||
1197 | monitoredItemAdded(item, destCollection); | 1198 | monitoredItemAdded(item, destCollection); | ||
1198 | return; | 1199 | return; | ||
1199 | } else if (isHidden(destCollection)) { | 1200 | } else if (isHidden(destCollection)) { | ||
1200 | monitoredItemRemoved(item); | 1201 | monitoredItemRemoved(item, sourceCollection); | ||
1201 | return; | 1202 | return; | ||
1202 | } else { | 1203 | } else { | ||
1203 | monitoredItemRemoved(item); | 1204 | monitoredItemRemoved(item, sourceCollection); | ||
1204 | monitoredItemAdded(item, destCollection); | 1205 | monitoredItemAdded(item, destCollection); | ||
1205 | return; | 1206 | return; | ||
1206 | } | 1207 | } | ||
1207 | // "Temporarily" commented out as it's likely the best course to | 1208 | // "Temporarily" commented out as it's likely the best course to | ||
1208 | // avoid the dreaded "reset storm" (or layoutChanged storm). The | 1209 | // avoid the dreaded "reset storm" (or layoutChanged storm). The | ||
1209 | // whole itemMoved idea is great but not practical until all the | 1210 | // whole itemMoved idea is great but not practical until all the | ||
1210 | // other proxy models play nicely with it, right now they just | 1211 | // other proxy models play nicely with it, right now they just | ||
1211 | // transform moved signals in layout changed, which explodes into | 1212 | // transform moved signals in layout changed, which explodes into | ||
▲ Show 20 Lines • Show All 762 Lines • Show Last 20 Lines |
This won't work - just exclude the Akonadi::Collection parameter here and Qt will correctly use the default parameter value for the collection.