22 #include "calendarlocal.h" 23 #include "icalformat.h" 24 #include "qtopiaformat.h" 26 #include <tdeaboutdata.h> 27 #include <tdeapplication.h> 29 #include <tdelocale.h> 30 #include <tdecmdlineargs.h> 31 #include <tdeglobal.h> 32 #include <tdeconfig.h> 33 #include <kstandarddirs.h> 39 static const TDECmdLineOptions options[] = 42 { "qtopia2icalendar", I18N_NOOP( "Convert TQtopia calendar file to iCalendar"), 0 }, 44 { "icalendar2qtopia", I18N_NOOP( "Convert iCalendar to iCalendar"), 0 }, 46 { "output <file>", I18N_NOOP( "Output file"), 0 }, 47 { "+input", I18N_NOOP( "Input file"), 0 }, 51 int main( int argc, char **argv) 53 TDEAboutData aboutData( "convertqtopia",I18N_NOOP( "TQtopia calendar file converter"), "0.1"); 54 aboutData.addAuthor( "Cornelius Schumacher", 0, "schumacher@kde.org"); 56 TDECmdLineArgs::init(argc,argv,&aboutData); 57 TDECmdLineArgs::addCmdLineOptions( options ); 61 TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); 63 bool sourceTQtopia = false; 64 bool sourceIcalendar = false; 66 if ( args->isSet( "qtopia2icalendar" ) ) { 70 if ( args->isSet( "icalendar2qtopia" ) ) { 71 sourceIcalendar = true; 74 if ( sourceTQtopia && sourceIcalendar ) { 75 TDECmdLineArgs::usage( 76 i18n( "Please specify only one of the conversion options.") ); 78 if ( !sourceTQtopia && !sourceIcalendar ) { 79 TDECmdLineArgs::usage( 80 i18n( "You have to specify one conversion option.") ); 83 if ( args->count() != 1 ) { 84 TDECmdLineArgs::usage( i18n( "Error: No input file.") ); 87 TQString inputFile = args->arg( 0 ); 90 if ( args->isSet( "output") ) outputFile = args->getOption( "output" ); 92 kdDebug(5800) << "Input File: '" << inputFile << "'" << endl; 93 kdDebug(5800) << "Output File: '" << outputFile << "'" << endl; 95 if ( sourceTQtopia ) { 99 qtopiaFormat. load( &cal, inputFile ); 102 if ( outputFile.isEmpty() ) { 103 TQString out = icalendarFormat. toString( &cal ); 104 std::cout << out.local8Bit() << std::endl; 106 bool success = icalendarFormat. save( &cal, outputFile ); 108 std::cerr << i18n( "Error saving to '%1'." ).arg( outputFile ).local8Bit() 115 if ( sourceIcalendar ) { 116 std::cerr << "Not implemented yet." << std::endl;
This class provides a calendar stored as a local file.
Namespace KCal is for global classes, objects and/or functions in libkcal.
|