Commit ffe8dff3 authored by Volker Krause's avatar Volker Krause
Browse files

Use Akonadi::CollectionUtils::fromIndex()

parent 5408804e
Pipeline #178890 passed with stage
in 4 minutes and 5 seconds
......@@ -43,7 +43,7 @@ set(KMIME_LIB_VERSION "5.20.40")
set(CALENDARUTILS_LIB_VERSION "5.20.40")
set(IDENTITYMANAGEMENT_LIB_VERSION "5.20.40")
set(AKONADICALENDAR_LIB_VERSION "5.20.43")
set(AKONADI_VERSION "5.20.40")
set(AKONADI_VERSION "5.20.41")
set(AKONADI_NOTES_VERSION "5.20.40")
find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED)
find_package(Qt${QT_MAJOR_VERSION} ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test PrintSupport)
......
......@@ -8,6 +8,8 @@
#include "collectionselection.h"
#include "utils.h"
#include <Akonadi/CollectionUtils>
#include <QItemSelectionModel>
using namespace CalendarSupport;
......@@ -58,7 +60,7 @@ Akonadi::Collection::List CollectionSelection::selectedCollections() const
const QModelIndexList selectedIndexes = d->model->selectedIndexes();
selected.reserve(selectedIndexes.count());
for (const QModelIndex &idx : selectedIndexes) {
selected.append(collectionFromIndex(idx));
selected.append(Akonadi::CollectionUtils::fromIndex(idx));
}
return selected;
}
......
......@@ -13,6 +13,7 @@
#include <Akonadi/AgentInstance>
#include <Akonadi/AgentManager>
#include <Akonadi/CalendarUtils>
#include <Akonadi/CollectionUtils>
#include <Akonadi/EntityDisplayAttribute>
#include <Akonadi/EntityTreeModel>
......@@ -360,7 +361,7 @@ Akonadi::Collection::List CalendarSupport::collectionsFromModel(const QAbstractI
int row = start;
QModelIndex i = model->index(row, 0, parentIndex);
while (row <= endRow) {
const Akonadi::Collection collection = collectionFromIndex(i);
const Akonadi::Collection collection = Akonadi::CollectionUtils::fromIndex(i);
if (collection.isValid()) {
collections << collection;
QModelIndex childIndex = model->index(0, 0, i);
......@@ -396,11 +397,6 @@ Akonadi::Item::List CalendarSupport::itemsFromModel(const QAbstractItemModel *mo
return items;
}
Akonadi::Collection CalendarSupport::collectionFromIndex(const QModelIndex &index)
{
return index.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
}
Akonadi::Collection::Id CalendarSupport::collectionIdFromIndex(const QModelIndex &index)
{
return index.data(Akonadi::EntityTreeModel::CollectionIdRole).value<Akonadi::Collection::Id>();
......@@ -411,7 +407,7 @@ Akonadi::Collection::List CalendarSupport::collectionsFromIndexes(const QModelIn
Akonadi::Collection::List l;
l.reserve(indexes.count());
for (const QModelIndex &idx : indexes) {
l.push_back(collectionFromIndex(idx));
l.push_back(Akonadi::CollectionUtils::fromIndex(idx));
}
return l;
}
......
......@@ -165,8 +165,6 @@ itemsFromModel(const QAbstractItemModel *model, const QModelIndex &parentIndex =
CALENDARSUPPORT_EXPORT Akonadi::Collection::List
collectionsFromModel(const QAbstractItemModel *model, const QModelIndex &parentIndex = QModelIndex(), int start = 0, int end = -1);
CALENDARSUPPORT_EXPORT Akonadi::Collection collectionFromIndex(const QModelIndex &index);
CALENDARSUPPORT_EXPORT Akonadi::Collection::Id collectionIdFromIndex(const QModelIndex &index);
CALENDARSUPPORT_EXPORT Akonadi::Collection::List collectionsFromIndexes(const QModelIndexList &indexes);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment