File indexing completed on 2024-11-10 04:41:10

0001 /*
0002     SPDX-FileCopyrightText: 2010 Tobias Koenig <tokoe@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "collectiondialog.h"
0008 
0009 #include <QDebug>
0010 
0011 #include <KAboutData>
0012 #include <KLocalizedString>
0013 #include <QApplication>
0014 #include <QCommandLineParser>
0015 
0016 using namespace Akonadi;
0017 
0018 int main(int argc, char **argv)
0019 {
0020     QApplication app(argc, argv);
0021     KAboutData aboutData(QStringLiteral("test"), i18n("Test Application"), QStringLiteral("1.0"));
0022 
0023     KAboutData::setApplicationData(aboutData);
0024 
0025     QCommandLineParser parser;
0026     aboutData.setupCommandLine(&parser);
0027 
0028     parser.process(app);
0029     aboutData.processCommandLine(&parser);
0030 
0031     CollectionDialog dlg;
0032     dlg.setMimeTypeFilter({QStringLiteral("text/directory")});
0033     dlg.setAccessRightsFilter(Collection::CanCreateItem);
0034     dlg.setDescription(i18n("Select an address book for saving:"));
0035     dlg.setSelectionMode(QAbstractItemView::ExtendedSelection);
0036     dlg.changeCollectionDialogOptions(CollectionDialog::AllowToCreateNewChildCollection);
0037     dlg.exec();
0038 
0039     const auto selectedCollections = dlg.selectedCollections();
0040     for (const Collection &collection : selectedCollections) {
0041         qDebug() << "Selected collection:" << collection.name();
0042     }
0043 
0044     return 0;
0045 }