• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • sources
  • kde-4.12
  • kdepimlibs
  • akonadi
  • xml
akonadi2xml.cpp
1 /*
2  Copyright (c) 2009 Volker Krause <vkrause@kde.org>
3 
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.
8 
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.
13 
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
17  02110-1301, USA.
18 */
19 
20 #include "xmlwritejob.h"
21 
22 #include <akonadi/collection.h>
23 #include <akonadi/collectionpathresolver_p.h>
24 
25 #include <KAboutData>
26 #include <KApplication>
27 #include <KCmdLineArgs>
28 #include <KDebug>
29 
30 using namespace Akonadi;
31 
32 int main( int argc, char *argv[] )
33 {
34  KAboutData aboutdata( "akonadi2xml", 0,
35  ki18n( "Akonadi To XML converter" ),
36  "1.0",
37  ki18n( "Converts an Akonadi collection subtree into a XML file." ),
38  KAboutData::License_GPL,
39  ki18n( "(c) 2009 Volker Krause <vkrause@kde.org>" ) );
40 
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 );
46 
47  KApplication app;
48  const KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
49 
50  Collection root;
51  if ( args->isSet( "collection" ) ) {
52  const QString path = args->getOption( "collection" );
53  CollectionPathResolver resolver( path );
54  if ( !resolver.exec() ) {
55  kError() << resolver.errorString();
56  return -1;
57  }
58  root = Collection( resolver.collection() );
59  } else
60  return -1;
61 
62  XmlWriteJob writer( root, args->getOption( "output" ) );
63  if ( !writer.exec() ) {
64  kError() << writer.exec();
65  return -1;
66  }
67 }
Akonadi::XmlWriteJob
Serializes a given Akonadi collection into a XML file.
Definition: xmlwritejob.h:35
Akonadi::Collection
Represents a collection of PIM items.
Definition: collection.h:75
Akonadi::CollectionPathResolver
Definition: collectionpathresolver_p.h:42
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal