konsolekalendar
konsolekalendardelete.cppGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00033 #include <stdlib.h>
00034 #include <iostream>
00035
00036 #include <kdebug.h>
00037 #include <klocale.h>
00038
00039 #include "konsolekalendardelete.h"
00040
00041 using namespace KCal;
00042 using namespace std;
00043
00044 KonsoleKalendarDelete::KonsoleKalendarDelete( KonsoleKalendarVariables *vars )
00045 {
00046 m_variables = vars;
00047 }
00048
00049 KonsoleKalendarDelete::~KonsoleKalendarDelete()
00050 {
00051 }
00052
00053 bool KonsoleKalendarDelete::deleteEvent()
00054 {
00055 bool status = false;
00056
00057 kdDebug() << "konsolekalendardelete.cpp::deleteEvent()" << endl;
00058
00059
00060
00061
00062 Event *event = m_variables->getCalendar()->event( m_variables->getUID() );
00063 if ( event ) {
00064 if ( m_variables->isDryRun() ) {
00065 cout << i18n( "Delete Event <Dry Run>:" ).local8Bit()
00066 << endl;
00067 printSpecs( event );
00068 } else {
00069 kdDebug() << "konsolekalendardelete.cpp:deleteEvent() : "
00070 << m_variables->getUID().local8Bit()
00071 << endl;
00072
00073 if ( m_variables->isVerbose() ) {
00074 cout << i18n( "Delete Event <Verbose>:" ).local8Bit()
00075 << endl;
00076 printSpecs( event );
00077 }
00078
00079 m_variables->getCalendar()->deleteEvent( event );
00080 cout << i18n( "Success: \"%1\" deleted" )
00081 .arg( event->summary() ).local8Bit()
00082 << endl;
00083
00084 m_variables->getCalendar()->save();
00085 status = true;
00086 }
00087 }
00088
00089 kdDebug() << "konsolekalendardelete.cpp::deleteEvent() | Done " << endl;
00090 return status;
00091 }
00092
00093 void KonsoleKalendarDelete::printSpecs( Event *event )
00094 {
00095 cout << i18n( " UID: %1" ).
00096 arg( m_variables->getUID() ).local8Bit()
00097 << endl;
00098
00099 cout << i18n( " What: %1" ).
00100 arg( event->summary() ).local8Bit()
00101 << endl;
00102
00103 cout << i18n( " Begin: %1" ).
00104 arg( event->dtStart().toString( Qt::TextDate ) ).local8Bit()
00105 << endl;
00106
00107 cout << i18n( " End: %1" ).
00108 arg( event->dtEnd().toString( Qt::TextDate ) ).local8Bit()
00109 << endl;
00110
00111 cout << i18n( " Desc: %1" ).
00112 arg( event->description() ).local8Bit()
00113 << endl;
00114
00115 cout << i18n( " Location: %1" ).
00116 arg( event->location() ).local8Bit()
00117 << endl;
00118 }
|