Akonadi Calendar

selectcollection.cpp
1/*
2 * SPDX-FileCopyrightText: 2010-2012 Sérgio Martins <iamsergio@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#include "selectcollection.h"
8#include "akonadicalendar_debug.h"
9
10#include <Akonadi/CollectionDialog>
11
12#include <QPointer>
13
15Akonadi::CalendarUtils::selectCollection(QWidget *parent, int &dialogCode, const QStringList &mimeTypes, const Akonadi::Collection &defaultCollection)
16{
18
19 qCDebug(AKONADICALENDAR_LOG) << "selecting collections with mimeType in " << mimeTypes;
20
21 dlg->changeCollectionDialogOptions(Akonadi::CollectionDialog::KeepTreeExpanded);
22 dlg->setMimeTypeFilter(mimeTypes);
23 dlg->setAccessRightsFilter(Akonadi::Collection::CanCreateItem);
24 if (defaultCollection.isValid()) {
25 dlg->setDefaultCollection(defaultCollection);
26 }
27 Akonadi::Collection collection;
28
29 // FIXME: don't use exec.
30 dialogCode = dlg->exec();
31 if (dialogCode == QDialog::Accepted) {
32 collection = dlg->selectedCollection();
33
34 if (!collection.isValid()) {
35 qCWarning(AKONADICALENDAR_LOG) << "An invalid collection was selected!";
36 }
37 }
38 delete dlg;
39
40 return collection;
41}
bool isValid() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 4 2025 11:57:35 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.