konsolekalendar Library API Documentation

konsolekalendarchange.cpp

00001 /***************************************************************************
00002         konsolekalendarchange.cpp  -  description
00003            -------------------
00004     begin                : Sun May 25 2003
00005     copyright            : (C) 2003 by Tuukka Pasanen
00006     copyright            : (C) 2003 by Allen Winter
00007     email                : illuusio@mailcity.com
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
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   /* Retrieve event on the basis of the unique string ID */
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 // TODO: put back after string freeze
00050 //      cout << i18n("To Event <Dry Run>:").local8Bit() << endl;
00051       printSpecs();
00052     } else {
00053        kdDebug() << "konsolekalendarchange.cpp:changeEvent() : " << m_variables->getUID().local8Bit() << endl;
00054 
00055 // TODO: put back after string freeze
00056        if( m_variables->isVerbose() ) {
00057 //   cout << i18n("Change Event <Verbose>:").local8Bit() << endl;
00058 //   printSpecs( event );
00059 //   cout << i18n("To Event <Dry Run>:").local8Bit() << endl;
00060 //   printSpecs();
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 }
KDE Logo
This file is part of the documentation for konsolekalendar Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:15 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003