40 #include <KCalCore/Event>
42 #include <QtCore/QDateTime>
47 using namespace KCalCore;
61 const Event::Ptr &event,
const QDate &date )
79 *ts << i18n(
"Date:" )
81 << KGlobal::locale()->formatDate( date )
85 if ( !event->allDay() ) {
87 << KGlobal::locale()->formatTime( event->dtStart().time() )
89 << KGlobal::locale()->formatTime( event->dtEnd().time() );
94 *ts << i18n(
"Summary:" )
96 if ( !event->summary().isEmpty() ) {
102 << i18n(
"(no summary available)" )
107 *ts << i18n(
"Location:" )
109 if ( !event->location().isEmpty() ) {
115 << i18n(
"(no location available)" )
120 *ts << i18n(
"Description:" )
122 if ( !event->description().isEmpty() ) {
124 <<
event->description()
128 << i18n(
"(no description available)" )
133 *ts << i18n(
"UID:" )
140 *ts <<
"--------------------------------------------------"
147 const Event::Ptr &event,
const QDate &date,
161 *ts << KGlobal::locale()->formatDate( date ) <<
":"
166 if ( !event->allDay() ) {
167 *ts << KGlobal::locale()->formatTime( event->dtStart().time() )
169 << KGlobal::locale()->formatTime( event->dtEnd().time() );
171 *ts << i18n(
"[all day]\t" );
176 *ts <<
event->summary().replace( QLatin1Char(
'\n' ), QLatin1Char(
' ' ) );
179 if ( !event->location().isEmpty() ) {
180 if ( !event->summary().isEmpty() ) {
183 *ts <<
event->location().replace( QLatin1Char(
'\n' ), QLatin1Char(
' ' ) );
188 if ( !event->description().isEmpty() ) {
190 <<
event->description().replace( QLatin1Char(
'\n' ), QLatin1Char(
' ' ) )
202 QString KonsoleKalendarExports::processField(
const QString &field,
203 const QString &dquote )
209 QString double_dquote = dquote + dquote;
210 QString retField = field;
211 retField = dquote + retField.replace( dquote, double_dquote ) + dquote;
216 #define pF( x ) processField( ( x ), dquote )
220 const Event::Ptr &event,
const QDate &date )
227 QString delim = i18n(
"," );
228 QString dquote = i18n(
"\"" );
230 if ( !event->allDay() ) {
231 *ts << pF( KGlobal::locale()->formatDate( date ) )
232 << delim << pF( KGlobal::locale()->formatTime( event->dtStart().time() ) )
233 << delim << pF( KGlobal::locale()->formatDate( date ) )
234 << delim << pF( KGlobal::locale()->formatTime( event->dtEnd().time() ) );
236 *ts << pF( KGlobal::locale()->formatDate( date ) )
237 << delim << pF( QLatin1String(
"") )
238 << delim << pF( KGlobal::locale()->formatDate( date ) )
239 << delim << pF( QLatin1String(
"") );
242 *ts << delim << pF( event->summary().replace( QLatin1Char(
'\n' ), QLatin1Char(
' ' ) ) )
243 << delim << pF( event->location().replace( QLatin1Char(
'\n' ), QLatin1Char(
' ' ) ) )
244 << delim << pF( event->description().replace( QLatin1Char(
'\n' ), QLatin1Char(
' ' ) ) )
245 << delim << pF( event->uid() )
bool exportAsTxtShort(QTextStream *ts, const KCalCore::Event::Ptr &event, const QDate &date, bool sameday)
Export the Event in Short Text Mode.
bool exportAsTxt(QTextStream *ts, const KCalCore::Event::Ptr &event, const QDate &date)
Export the Event in Text Mode.
This class provides all the variables for the program.
KonsoleKalendarExports(KonsoleKalendarVariables *vars=0)
Constructs a KonsoleKalendarChange object from command line arguments.
Provides the KonsoleKalendarExports class definition.
bool exportAsCSV(QTextStream *ts, const KCalCore::Event::Ptr &event, const QDate &date)
Export the Event in Comma-Separated Values (CSV) Mode.
~KonsoleKalendarExports()
Destructor.