2
Copyright (c) 2009 Volker Krause <vkrause@kde.org>
4
This library is free software; you can redistribute it and/or modify it
5
under the terms of the GNU Library General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or (at your
7
option) any later version.
9
This library is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12
License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to the
16
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20
#include "xmlwritejob.h"
22
#include <akonadi/collection.h>
23
#include <akonadi/private/collectionpathresolver_p.h>
26
#include <KApplication>
27
#include <KCmdLineArgs>
30
using namespace Akonadi;
32
int main( int argc, char *argv[] )
34
KAboutData aboutdata( "akonadi2xml", 0,
35
ki18n( "Akonadi To XML converter" ),
37
ki18n( "Converts a Akonadi collection subtree into a XML file." ),
38
KAboutData::License_GPL,
39
ki18n( "(c) 2009 Volker Krause <vkrause@kde.org>" ) );
41
KCmdLineArgs::init( argc, argv, &aboutdata );
42
KCmdLineOptions options;
43
options.add( "c" ).add( "collection <root>", ki18n( "Root collection id or path" ) );
44
options.add( "o" ).add( "output <file>", ki18n( "Output file" ) );
45
KCmdLineArgs::addCmdLineOptions( options );
48
const KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
51
if ( args->isSet( "collection" ) ) {
52
const QString path = args->getOption( "collection" );
53
CollectionPathResolver resolver( path );
54
if ( !resolver.exec() ) {
55
kError() << resolver.errorString();
58
root = Collection( resolver.collection() );
62
XmlWriteJob writer( root, args->getOption( "output" ) );
63
if ( !writer.exec() ) {
64
kError() << writer.exec();