Commit 7be1bb69 authored by Sandro Knauß's avatar Sandro Knauß
Browse files

get the correct collection for collection/Person node

* use the collection that is assosated with the currect index for quickview
* we need the correct collection also for enable the correcdt collection
  for the saarch of personal calendars.

KOLAB: #3934
(cherry picked from commit a237a655677af9dfcb6be07d80a5f767a78a3ef7)
parent 7654abc2
......@@ -1076,12 +1076,12 @@ void AkonadiCollectionView::onAction(const QModelIndex &index, int a)
person = i.data(PersonRole);
}
if (person.isValid()) {
Quickview *quickview = new Quickview(person.value<Person>(), Akonadi::Collection(person.value<Person>().rootCollection));
Quickview *quickview = new Quickview(person.value<Person>(), CalendarSupport::collectionFromIndex(index));
quickview->setAttribute(Qt::WA_DeleteOnClose, true);
quickview->show();
} else {
kWarning() << "No valid person found for" << index;
Quickview *quickview = new Quickview(Person(), index.data(CollectionRole).value<Akonadi::Collection>());
Quickview *quickview = new Quickview(Person(), CalendarSupport::collectionFromIndex(index));
quickview->setAttribute(Qt::WA_DeleteOnClose, true);
quickview->show();
}
......
......@@ -88,7 +88,7 @@ QVariant CollectionNode::data(int role) const
if (role == IsSearchResultRole) {
return isSearchNode;
}
if (role == CollectionRole) {
if (role == CollectionRole || role == Akonadi::EntityTreeModel::CollectionRole) {
return QVariant::fromValue(mCollection);
}
if (role == NodeTypeRole) {
......@@ -181,6 +181,10 @@ QVariant PersonNode::data(int role) const
if (role == NodeTypeRole) {
return PersonNodeRole;
}
if (role == CollectionRole || role == Akonadi::EntityTreeModel::CollectionRole) {
return QVariant::fromValue(Akonadi::Collection(mPerson.rootCollection));
}
return QVariant();
}
......
Markdown is supported
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