konsolekalendar Library API Documentation

konsolekalendardelete.cpp

00001 /******************************************************************************* 00002 * konsolekalendardelete.cpp * 00003 * * 00004 * KonsoleKalendar is a command line interface to KDE calendars * 00005 * Copyright (C) 2002-2004 Tuukka Pasanen <illuusio@mailcity.com> * 00006 * Copyright (C) 2003-2004 Allen Winter <awinterz@users.sourceforge.net> * 00007 * * 00008 * This program is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU General Public License as published by * 00010 * the Free Software Foundation; either version 2 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 * * 00022 * As a special exception, permission is given to link this program * 00023 * with any edition of Qt, and distribute the resulting executable, * 00024 * without including the source code for Qt in the source distribution. * 00025 * * 00026 ******************************************************************************/ 00027 00028 #include <stdlib.h> 00029 #include <iostream> 00030 00031 #include <kdebug.h> 00032 #include <klocale.h> 00033 00034 #include "konsolekalendardelete.h" 00035 00036 using namespace KCal; 00037 using namespace std; 00038 00039 KonsoleKalendarDelete::KonsoleKalendarDelete( KonsoleKalendarVariables *vars ) 00040 { 00041 m_variables = vars; 00042 } 00043 00044 KonsoleKalendarDelete::~KonsoleKalendarDelete() 00045 { 00046 } 00047 00048 bool KonsoleKalendarDelete::deleteEvent() 00049 { 00050 bool status = false; 00051 00052 kdDebug() << "konsolekalendardelete.cpp::deleteEvent()" << endl; 00053 00054 /* Retrieve event on the basis of the unique string ID */ 00055 Event *event = m_variables->getCalendar()->event( m_variables->getUID() ); 00056 if ( event ) { 00057 if ( m_variables->isDryRun() ) { 00058 cout << i18n("Delete Event <Dry Run>:").local8Bit() 00059 << endl; 00060 printSpecs( event ); 00061 } else { 00062 kdDebug() << "konsolekalendardelete.cpp:deleteEvent() : " 00063 << m_variables->getUID().local8Bit() 00064 << endl; 00065 00066 if ( m_variables->isVerbose() ) { 00067 cout << i18n("Delete Event <Verbose>:").local8Bit() 00068 << endl; 00069 printSpecs( event ); 00070 } 00071 00072 m_variables->getCalendar()->deleteEvent( event ); 00073 cout << i18n("Success: \"%1\" deleted") 00074 .arg( event->summary() ).local8Bit() 00075 << endl; 00076 00077 /*if ( !m_variables->isCalendarResources() ) { 00078 status = 00079 m_variables->getCalendar()->save( m_variables->getCalendarFile() ); 00080 } else { 00081 // m_variables->getCalendar()->save(); 00082 status = true; 00083 }*/ 00084 } 00085 } 00086 00087 kdDebug() << "konsolekalendardelete.cpp::deleteEvent() | Done " << endl; 00088 return status; 00089 } 00090 00091 void KonsoleKalendarDelete::printSpecs( Event *event ) 00092 { 00093 cout << i18n(" UID: %1"). 00094 arg( m_variables->getUID() ).local8Bit() 00095 << endl; 00096 00097 cout << i18n(" What: %1"). 00098 arg( event->summary() ).local8Bit() 00099 << endl; 00100 00101 cout << i18n(" Begin: %1"). 00102 arg( event->dtStart().toString(Qt::TextDate) ).local8Bit() 00103 << endl; 00104 00105 cout << i18n(" End: %1"). 00106 arg( event->dtEnd().toString(Qt::TextDate) ).local8Bit() 00107 << endl; 00108 00109 cout << i18n(" Desc: %1"). 00110 arg( event->description() ).local8Bit() 00111 << endl; 00112 00113 cout << i18n(" Location: %1"). 00114 arg( event->location() ).local8Bit() 00115 << endl; 00116 }
KDE Logo
This file is part of the documentation for konsolekalendar Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:53:40 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003