konsolekalendarchange.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 "konsolekalendarchange.h"
00026
00027 using namespace KCal;
00028 using namespace std;
00029
00030 KonsoleKalendarChange::KonsoleKalendarChange( KonsoleKalendarVariables *variables )
00031 {
00032 m_variables = variables;
00033 }
00034
00035 KonsoleKalendarChange::~KonsoleKalendarChange()
00036 {
00037 }
00038
00039 bool KonsoleKalendarChange::changeEvent()
00040 {
00041 bool status = false;
00042
00043
00044 Event *event = m_variables->getCalendar()->event( m_variables->getUID() );
00045 if( event ) {
00046 if( m_variables->isDryRun() ) {
00047 cout << i18n("Change Event <Dry Run>:").local8Bit() << endl;
00048 printSpecs( event );
00049
00050
00051 printSpecs();
00052 } else {
00053 kdDebug() << "konsolekalendarchange.cpp:changeEvent() : " << m_variables->getUID().local8Bit() << endl;
00054
00055
00056 if( m_variables->isVerbose() ) {
00057
00058
00059
00060
00061 }
00062
00063 if( m_variables->isStartDateTime() )
00064 event->setDtStart( m_variables->getStartDateTime() );
00065 if( m_variables->isEndDateTime() )
00066 event->setDtEnd( m_variables->getEndDateTime() );
00067 if( m_variables->isSummary() )
00068 event->setSummary( m_variables->getSummary() );
00069 if( m_variables->isDescription() )
00070 event->setDescription( m_variables->getDescription() );
00071 m_variables->getCalendar()->addEvent( event );
00072
00073 if( !m_variables->isCalendarResources() ){
00074 m_variables->getCalendar()->save( m_variables->getCalendarFile() );
00075 } else {
00076 m_variables->getCalendar()->save();
00077 }
00078 }
00079 status = true;
00080 }
00081
00082 return( status );
00083 }
00084
00085 void KonsoleKalendarChange::printSpecs( Event *event )
00086 {
00087 cout << i18n(" UID: ").local8Bit() << event->uid().local8Bit() << endl;
00088 cout << i18n(" What: ").local8Bit() << event->summary().local8Bit() << endl;;
00089 cout << i18n(" Begin: ").local8Bit() << event->dtStart().toString(Qt::TextDate).local8Bit() << endl;
00090 cout << i18n(" End: ").local8Bit() << event->dtEnd().toString(Qt::TextDate).local8Bit() << endl;
00091 cout << i18n(" Desc: ").local8Bit() << event->description().local8Bit() << endl;;
00092 }
00093
00094 void KonsoleKalendarChange::printSpecs( )
00095 {
00096 cout << i18n(" UID: ").local8Bit() << m_variables->getUID().local8Bit() << endl;
00097 cout << i18n(" What: ").local8Bit() << m_variables->getSummary().local8Bit() << endl;;
00098 cout << i18n(" Begin: ").local8Bit() << m_variables->getStartDateTime().toString(Qt::TextDate).local8Bit() << endl;
00099 cout << i18n(" End: ").local8Bit() << m_variables->getEndDateTime().toString(Qt::TextDate).local8Bit() << endl;
00100 cout << i18n(" Desc: ").local8Bit() << m_variables->getDescription().local8Bit() << endl;;
00101 }
This file is part of the documentation for konsolekalendar Library Version 3.2.2.