Changeset View
Changeset View
Standalone View
Standalone View
src/server/handlerhelper.cpp
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Line(s) | |||||
98 | { | 98 | { | ||
99 | QStringList mimeTypes; | 99 | QStringList mimeTypes; | ||
100 | mimeTypes.reserve(col.mimeTypes().size()); | 100 | mimeTypes.reserve(col.mimeTypes().size()); | ||
101 | Q_FOREACH (const MimeType &mt, col.mimeTypes()) { | 101 | Q_FOREACH (const MimeType &mt, col.mimeTypes()) { | ||
102 | mimeTypes << mt.name(); | 102 | mimeTypes << mt.name(); | ||
103 | } | 103 | } | ||
104 | 104 | | |||
105 | return fetchCollectionsResponse(col, col.attributes(), false, 0, QStack<Collection>(), | 105 | return fetchCollectionsResponse(col, col.attributes(), false, 0, QStack<Collection>(), | ||
106 | QStack<CollectionAttribute::List>(), false, mimeTypes); | 106 | QStack<CollectionAttribute::List>(), mimeTypes); | ||
107 | } | 107 | } | ||
108 | 108 | | |||
109 | Protocol::FetchCollectionsResponse HandlerHelper::fetchCollectionsResponse(const Collection &col, | 109 | Protocol::FetchCollectionsResponse HandlerHelper::fetchCollectionsResponse(const Collection &col, | ||
110 | const CollectionAttribute::List &attrs, | 110 | const CollectionAttribute::List &attrs, | ||
111 | bool includeStatistics, | 111 | bool includeStatistics, | ||
112 | int ancestorDepth, | 112 | int ancestorDepth, | ||
113 | const QStack<Collection> &ancestors, | 113 | const QStack<Collection> &ancestors, | ||
114 | const QStack<CollectionAttribute::List> &ancestorAttributes, | 114 | const QStack<CollectionAttribute::List> &ancestorAttributes, | ||
115 | bool isReferenced, | | |||
116 | const QStringList &mimeTypes) | 115 | const QStringList &mimeTypes) | ||
117 | { | 116 | { | ||
118 | Protocol::FetchCollectionsResponse response; | 117 | Protocol::FetchCollectionsResponse response; | ||
119 | response.setId(col.id()); | 118 | response.setId(col.id()); | ||
120 | response.setParentId(col.parentId()); | 119 | response.setParentId(col.parentId()); | ||
121 | response.setName(col.name()); | 120 | response.setName(col.name()); | ||
122 | response.setMimeTypes(mimeTypes); | 121 | response.setMimeTypes(mimeTypes); | ||
123 | response.setRemoteId(col.remoteId()); | 122 | response.setRemoteId(col.remoteId()); | ||
Show All 27 Lines | |||||
151 | response.setCachePolicy(cachePolicy); | 150 | response.setCachePolicy(cachePolicy); | ||
152 | 151 | | |||
153 | if (ancestorDepth) { | 152 | if (ancestorDepth) { | ||
154 | QVector<Protocol::Ancestor> ancestorList | 153 | QVector<Protocol::Ancestor> ancestorList | ||
155 | = HandlerHelper::ancestorsResponse(ancestorDepth, ancestors, ancestorAttributes); | 154 | = HandlerHelper::ancestorsResponse(ancestorDepth, ancestors, ancestorAttributes); | ||
156 | response.setAncestors(ancestorList); | 155 | response.setAncestors(ancestorList); | ||
157 | } | 156 | } | ||
158 | 157 | | |||
159 | response.setReferenced(isReferenced); | | |||
160 | response.setEnabled(col.enabled()); | 158 | response.setEnabled(col.enabled()); | ||
161 | response.setDisplayPref(static_cast<Tristate>(col.displayPref())); | 159 | response.setDisplayPref(static_cast<Tristate>(col.displayPref())); | ||
162 | response.setSyncPref(static_cast<Tristate>(col.syncPref())); | 160 | response.setSyncPref(static_cast<Tristate>(col.syncPref())); | ||
163 | response.setIndexPref(static_cast<Tristate>(col.indexPref())); | 161 | response.setIndexPref(static_cast<Tristate>(col.indexPref())); | ||
164 | 162 | | |||
165 | QMap<QByteArray, QByteArray> ra; | 163 | QMap<QByteArray, QByteArray> ra; | ||
166 | for (const CollectionAttribute &attr : attrs) { | 164 | for (const CollectionAttribute &attr : attrs) { | ||
167 | ra.insert(attr.type(), attr.value()); | 165 | ra.insert(attr.type(), attr.value()); | ||
▲ Show 20 Lines • Show All 275 Lines • Show Last 20 Lines |