Akonadi

akonadi2xml.cpp
1/*
2 SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "xmlwritejob.h"
8
9#include "collection.h"
10#include "collectionpathresolver.h"
11
12#include <KAboutData>
13#include <KLocalizedString>
14#include <QApplication>
15#include <QCommandLineParser>
16#include <QDebug>
17
18using namespace Akonadi;
19
20int main(int argc, char *argv[])
21{
22 QApplication app(argc, argv);
23
24 KAboutData aboutData(QStringLiteral("akonadi2xml"),
25 i18n("Akonadi To XML converter"),
26 QStringLiteral("1.0"),
27 i18n("Converts an Akonadi collection subtree into a XML file."),
29 i18n("(c) 2009 Volker Krause <vkrause@kde.org>"));
30
31 QCommandLineParser parser;
33
34 aboutData.setupCommandLine(&parser);
35 parser.process(app);
36 aboutData.processCommandLine(&parser);
37
38 Collection root;
39 if (parser.isSet(QStringLiteral("collection"))) {
40 const QString path = parser.value(QStringLiteral("collection"));
41 CollectionPathResolver resolver(path);
42 if (!resolver.exec()) {
43 qCritical() << resolver.errorString();
44 return -1;
45 }
46 root = Collection(resolver.collection());
47 } else {
48 return -1;
49 }
50
51 XmlWriteJob writer(root, parser.value(QStringLiteral("output")));
52 if (!writer.exec()) {
53 qCritical() << writer.exec();
54 return -1;
55 }
56}
Represents a collection of PIM items.
Definition collection.h:62
Serializes a given Akonadi collection into a XML file.
Definition xmlwritejob.h:25
static void setApplicationData(const KAboutData &aboutData)
QString i18n(const char *text, const TYPE &arg...)
Helper integration between Akonadi and Qt.
QString path(const QString &relativePath)
bool isSet(const QCommandLineOption &option) const const
void process(const QCoreApplication &app)
QString value(const QCommandLineOption &option) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:49:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.