konsolekalendarexports.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <stdlib.h>
00020 #include <iostream>
00021
00022 #include <qdatetime.h>
00023
00024 #include <kdebug.h>
00025 #include <klocale.h>
00026
00027 #include <libkcal/calendarlocal.h>
00028 #include <libkcal/calendar.h>
00029 #include <libkcal/event.h>
00030 #include <libkcal/htmlexport.h>
00031
00032
00033 #include "konsolekalendarexports.h"
00034
00035 using namespace KCal;
00036 using namespace std;
00037
00038 KonsoleKalendarExports::KonsoleKalendarExports( KonsoleKalendarVariables *variables )
00039 {
00040 m_variables = variables;
00041 m_firstEntry = true;
00042 }
00043
00044
00045 KonsoleKalendarExports::~KonsoleKalendarExports()
00046 {
00047 }
00048
00049 bool KonsoleKalendarExports::exportAsTxt( QTextStream *ts, Event *event ){
00050
00051 if( m_firstEntry == true ||
00052 m_lastDate.day() != event->dtStart().date().day() ||
00053 m_lastDate.month() != event->dtStart().date().month() ||
00054 m_lastDate.year() != event->dtStart().date().year() ){
00055
00056
00057 m_firstEntry=false;
00058 int len = event->dtStartStr().length();
00059 QString date = event->dtStartStr();
00060 date.truncate( len - 5 );
00061 *ts << I18N_NOOP("Date:") << "\t" << date.local8Bit() << endl;
00062 m_lastDate = event->dtStart().date();
00063
00064 }
00065
00066 if ( !event->doesFloat() ) {
00067 *ts << "\t";
00068 *ts << event->dtStartStr().remove(0, (event->dtStartStr().find(' ', 0, false) + 1) ).local8Bit();
00069 *ts << " - ";
00070 *ts << event->dtEndStr().remove(0, (event->dtEndStr().find(' ', 0, false) + 1) ).local8Bit();
00071 }
00072
00073
00074 *ts << endl << I18N_NOOP("Summary:") << endl;
00075 *ts << "\t" << event->summary().local8Bit() << endl;
00076 *ts << I18N_NOOP("Description:") << endl;
00077 if( !event->description().isEmpty() ) {
00078 *ts << "\t" << event->description().local8Bit() << endl;
00079 } else {
00080 *ts << "\t" << I18N_NOOP("(no description available)") << endl;
00081 }
00082 *ts << I18N_NOOP("UID:") << endl;
00083 *ts << "\t" << event->uid().local8Bit() << endl;
00084 *ts << "----------------------------------" << endl;
00085
00086 return true;
00087 }
00088
00089 bool KonsoleKalendarExports::exportAsCSV( QTextStream *ts, Event *event ){
00090
00091
00092
00093 QString delim = ",";
00094
00095 if ( !event->doesFloat() ) {
00096 *ts << event->dtStart().date().toString("yyyy-M-d");
00097 *ts << delim << event->dtStart().time().toString("hh:mm");
00098 *ts << delim << event->dtEnd().date().toString("yyyy-M-d");
00099 *ts << delim << event->dtEnd().time().toString("hh:mm");
00100 } else {
00101 *ts << ",,,";
00102 }
00103
00104 *ts << delim << event->summary().local8Bit();
00105 *ts << delim << event->description().local8Bit();
00106 *ts << delim << event->uid().local8Bit();
00107 *ts << endl;
00108
00109 return true;
00110 }
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
This file is part of the documentation for konsolekalendar Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Mar 6 17:18:34 2004 by
doxygen 1.3.6-20040222 written by
Dimitri van Heesch, © 1997-2003