konsolekalendardelete.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 <kdebug.h>
00023 #include <klocale.h>
00024
00025 #include "konsolekalendardelete.h"
00026
00027 using namespace KCal;
00028 using namespace std;
00029
00030 KonsoleKalendarDelete::KonsoleKalendarDelete( KonsoleKalendarVariables *variables )
00031 {
00032 m_variables = variables;
00033 }
00034
00035 KonsoleKalendarDelete::~KonsoleKalendarDelete()
00036 {
00037 }
00038
00039 bool KonsoleKalendarDelete::deleteEvent()
00040 {
00041 bool status = false;
00042
00043
00044 Event *event = m_variables->getCalendar()->event( m_variables->getUID() );
00045
00046 if( event ) {
00047 if( m_variables->isDryRun() ) {
00048 cout << i18n("Delete Event <Dry Run>:").local8Bit() << endl;
00049 printSpecs( event );
00050 } else {
00051 kdDebug() << "konsolekalendardelete.cpp:deleteEvent() : " << m_variables->getUID().local8Bit() << endl;
00052
00053 if( m_variables->isVerbose() ) {
00054
00055
00056 printSpecs( event );
00057 }
00058
00059 m_variables->getCalendar()->deleteEvent( event );
00060
00061 if( !m_variables->isCalendarResources() ){
00062 m_variables->getCalendar()->save( m_variables->getCalendarFile() );
00063 } else {
00064 m_variables->getCalendar()->save();
00065 }
00066 }
00067 status = true;
00068 }
00069
00070 return( status );
00071 }
00072
00073 void KonsoleKalendarDelete::printSpecs( Event *event )
00074 {
00075 cout << i18n(" UID: ").local8Bit() << m_variables->getUID().local8Bit() << endl;
00076 cout << i18n(" What: ").local8Bit() << event->summary().local8Bit() << endl;;
00077 cout << i18n(" Begin: ").local8Bit() << event->dtStart().toString(Qt::TextDate).local8Bit() << endl;
00078 cout << i18n(" End: ").local8Bit() << event->dtEnd().toString(Qt::TextDate).local8Bit() << endl;
00079 cout << i18n(" Desc: ").local8Bit() << event->description().local8Bit() << endl;;
00080 }
This file is part of the documentation for konsolekalendar Library Version 3.2.2.