Commit 3150cca0 authored by Allen Winter's avatar Allen Winter
Browse files

General Cleanups:

 - no longer put KonsoleKalendar classes in the KCal namespace
 - kdepim styling
 - full doxyfication
 - other small cleanups


svn path=/trunk/KDE/kdepim/console/konsolekalendar/; revision=577961
parent 754b21f0
/** \mainpage %KonsoleKalendar API Overview
\section intro Introduction
%KonsoleKalendar is a command line interface to KDE calendars.
It lets you view, insert, remove, or modify calendar events by way of
the command line or from a scripting language.
Additionally, %KonsoleKalendar can create a new KDE calendar,
export a KDE calendar to a variety of other formats, and
import another KDE calendar.
\section map Road Map to the Classes
KCal::KonsoleKalendar is the base class.
KCal::KonsoleKalendarVariables holds all the command line arguments plus some.
KCal::KonsoleKalendarEpoch is for timestamps expressed as epochs.
KCal::KonsoleKalendarExports manages the export functionality.
KCal::KonsoleKalendarAdd manages the event insert capability.
KCal::KonsoleKalendarDelete manages the event removal capability.
KCal::KonsoleKalendarChange manages the event modification capability.
*/
/*!
* @mainpage KonsoleKalendar API Overview
*
* @section intro Introduction
*
* KonsoleKalendar is a command line interface to KDE calendars.
* It lets you view, insert, remove, or modify calendar events by way of
* the command line or from a scripting language.
*
* Additionally, KonsoleKalendar can create a new KDE calendar,
* export a KDE calendar to a variety of other formats, and
* import another KDE calendar.
*
* @authors
* Tuukka Pasanen \<illuusio@mailcity.com\>,
* Allen Winter \<winter@kde.org\>,
* Cornelius Schumacher \<schumacher@kde.org\>
*
* @maintainer Allen Winter \<winter@kde.org\>
*
* @licenses
* @gpl
*
* For questions and discussions about KonsoleKalendar either contact the author
* or the <a href="mailto:kde-pim@kde.org">kde-pim@kde.org</a> mailing list.
*/
// DOXYGEN_PROJECTNAME=KonsoleKalendar
// DOXYGEN_REFERENCES = kcal
......@@ -159,14 +159,13 @@ bool KonsoleKalendar::showInstance()
Event::List sortedList =
m_variables->getCalendar()->events( EventSortStartDate );
if( sortedList.count() > 0 )
{
if ( sortedList.count() > 0 ) {
QDate dt, firstdate, lastdate;
firstdate = sortedList.first()->dtStart().date();
lastdate = sortedList.last()->dtStart().date();
for ( dt = firstdate;
dt <= lastdate && status != false;
dt = dt.addDays(1) ) {
dt = dt.addDays( 1 ) ) {
Event::List events =
m_variables->getCalendar()->events( dt,
EventSortStartDate,
......@@ -196,7 +195,7 @@ bool KonsoleKalendar::showInstance()
QDate dt;
for ( dt = m_variables->getStartDateTime().date();
dt <= datetime.date();
dt = dt.addDays(1) ) {
dt = dt.addDays( 1 ) ) {
Event::List events =
m_variables->getCalendar()->events( dt,
EventSortStartDate,
......@@ -218,7 +217,7 @@ bool KonsoleKalendar::showInstance()
QDate dt;
for ( dt = m_variables->getStartDateTime().date();
dt <= m_variables->getEndDateTime().date() && status != false;
dt = dt.addDays(1) ) {
dt = dt.addDays( 1 ) ) {
Event::List events =
m_variables->getCalendar()->events( dt,
EventSortStartDate,
......@@ -259,7 +258,8 @@ bool KonsoleKalendar::showInstance()
//TODO: get progname and url from the values set in main
htmlSettings.setCreditName( "KonsoleKalendar" );
htmlSettings.setCreditURL( "http://pim.kde.org/components/konsolekalendar.php" );
htmlSettings.setCreditURL(
"http://pim.kde.org/components/konsolekalendar.php" );
htmlSettings.setExcludePrivate( true );
htmlSettings.setExcludeConfidential( true );
......
......@@ -45,19 +45,22 @@ class QTextStream;
* Provides the KonsoleKalendar class definition.
*/
namespace KCal
{
/**
* @brief
* The base class of the project.
* @author Tuukka Pasanen
*/
class KonsoleKalendar
{
class KonsoleKalendar
{
public:
/**
* Constructs a KonsoleKalendar object from command line arguments.
*
* @param variables is a pointer to a #KonsoleKalendarVariables object
* containing all the command line arguments.
*/
KonsoleKalendar( KonsoleKalendarVariables *variables );
/**
* Destructor
*/
......@@ -103,7 +106,6 @@ namespace KCal
bool createCalendar();
private:
/**
* Print event specs for dryrun and verbose options
*/
......@@ -112,7 +114,8 @@ namespace KCal
/**
* Prints event list in many formats
*
* @param eventlist which event we should print
* @param ts is the #QTextStream to be printed
* @param eventList which event we should print
* @param dt is the date to use when printing the event for recurring events
*/
bool printEventList( QTextStream *ts, Event::List *eventList, QDate dt );
......@@ -120,6 +123,7 @@ namespace KCal
/**
* Prints a single event in many formats
*
* @param ts is the #QTextStream to be printed
* @param event which we should print
* @param dt is the date to use when printing the event for recurring events
*/
......@@ -139,8 +143,6 @@ namespace KCal
* This is useful if we like to have same day events to same system
*/
QDate m_saveDate;
};
};
}
#endif
......@@ -116,10 +116,11 @@ bool KonsoleKalendarAdd::addImportedCalendar()
// else, import into the standard calendar
QString fileName;
if ( m_variables->getCalendarFile().isEmpty() )
if ( m_variables->getCalendarFile().isEmpty() ) {
fileName = KStandardDirs::locateLocal( "data", "korganizer/std.ics" );
else
} else {
fileName = m_variables->getCalendarFile();
}
CalendarLocal *cal = new CalendarLocal( KPimPrefs::timezone() );
if ( !cal->load( fileName ) ||
......
......@@ -35,15 +35,14 @@
* Provides the KonsoleKalendarAdd class definition.
*/
namespace KCal
/**
* @brief
* Class to manage the Event insertion capability.
* @author Tuukka Pasanen
* @author Allen Winter
*/
class KonsoleKalendarAdd
{
/**
* Class to manage the Event insertion capability.
* @author Tuukka Pasanen
* @author Allen Winter
*/
class KonsoleKalendarAdd
{
public:
/**
* Constructs a KonsoleKalendarAdd object from command line arguments.
......@@ -66,7 +65,6 @@ namespace KCal
bool addImportedCalendar();
private:
/**
* Print event specs for dryrun and verbose options
*/
......@@ -77,7 +75,5 @@ namespace KCal
*/
KonsoleKalendarVariables *m_variables;
};
}
};
#endif
......@@ -127,54 +127,54 @@ bool KonsoleKalendarChange::changeEvent()
void KonsoleKalendarChange::printSpecs( Event *event )
{
cout << i18n( " UID: %1" ,
cout << i18n( " UID: %1",
event->uid() ).toLocal8Bit().data()
<< endl;
cout << i18n( " What: %1" ,
cout << i18n( " What: %1",
event->summary() ).toLocal8Bit().data()
<< endl;
cout << i18n( " Begin: %1" ,
cout << i18n( " Begin: %1",
event->dtStart().toString( Qt::TextDate ) ).toLocal8Bit().data()
<< endl;
cout << i18n( " End: %1" ,
cout << i18n( " End: %1",
event->dtEnd().toString( Qt::TextDate ) ).toLocal8Bit().data()
<< endl;
cout << i18n( " Desc: %1" ,
cout << i18n( " Desc: %1",
event->description() ).toLocal8Bit().data()
<< endl;
cout << i18n( " Location: %1" ,
cout << i18n( " Location: %1",
event->location() ).toLocal8Bit().data()
<< endl;
}
void KonsoleKalendarChange::printSpecs()
{
cout << i18n( " UID: %1" ,
cout << i18n( " UID: %1" ,
m_variables->getUID() ).toLocal8Bit().data()
<< endl;
cout << i18n( " What: %1" ,
cout << i18n( " What: %1" ,
m_variables->getSummary() ).toLocal8Bit().data()
<< endl;
cout << i18n( " Begin: %1" ,
cout << i18n( " Begin: %1" ,
m_variables->getStartDateTime().toString( Qt::TextDate ) ).toLocal8Bit().data()
<< endl;
cout << i18n( " End: %1" ,
cout << i18n( " End: %1" ,
m_variables->getEndDateTime().toString( Qt::TextDate ) ).toLocal8Bit().data()
<< endl;
cout << i18n( " Desc: %1" ,
cout << i18n( " Desc: %1" ,
m_variables->getDescription() ).toLocal8Bit().data()
<< endl;
cout << i18n( " Location: %1" ,
cout << i18n( " Location: %1" ,
m_variables->getLocation() ).toLocal8Bit().data()
<< endl;
}
......@@ -35,15 +35,14 @@
* Provides the KonsoleKalendarChange class definition.
*/
namespace KCal
/**
* @brief
* Class to manage the Event modification capability.
* @author Tuukka Pasanen
* @author Allen Winter
*/
class KonsoleKalendarChange
{
/**
* Class to manage the Event modification capability.
* @author Tuukka Pasanen
* @author Allen Winter
*/
class KonsoleKalendarChange
{
public:
/**
......@@ -51,7 +50,8 @@ namespace KCal
* @param vars is a KonsoleKalendarVariable object with Event information.
*/
KonsoleKalendarChange( KonsoleKalendarVariables *vars );
/**
/**
* Destructor
*/
~KonsoleKalendarChange();
......@@ -62,22 +62,21 @@ namespace KCal
bool changeEvent();
private:
/**
* Print Event specs for dryrun and verbose options.
* @param event is the Event to print.
*
* @param event is a pointer to an #Event to print.
*/
void printSpecs( Event *event );
/*
/**
* Print Event specs as provided from the command line arguments.
*/
void printSpecs();
/**
* Variables are here
*/
//@cond PRIVATE
KonsoleKalendarVariables *m_variables;
};
//@endcond
};
}
#endif
......@@ -38,7 +38,6 @@
#include "konsolekalendardelete.h"
using namespace KCal;
using namespace std;
KonsoleKalendarDelete::KonsoleKalendarDelete( KonsoleKalendarVariables *vars )
......@@ -92,27 +91,27 @@ bool KonsoleKalendarDelete::deleteEvent()
void KonsoleKalendarDelete::printSpecs( Event *event )
{
cout << i18n( " UID: %1" ,
cout << i18n( " UID: %1" ,
m_variables->getUID() ).data()
<< endl;
cout << i18n( " What: %1" ,
cout << i18n( " What: %1",
event->summary() ).data()
<< endl;
cout << i18n( " Begin: %1" ,
cout << i18n( " Begin: %1",
event->dtStart().toString( Qt::TextDate ) ).data()
<< endl;
cout << i18n( " End: %1" ,
cout << i18n( " End: %1",
event->dtEnd().toString( Qt::TextDate ) ).data()
<< endl;
cout << i18n( " Desc: %1" ,
cout << i18n( " Desc: %1",
event->description() ).data()
<< endl;
cout << i18n( " Location: %1" ,
cout << i18n( " Location: %1",
event->location() ).data()
<< endl;
}
......@@ -35,21 +35,24 @@
* Provides the KonsoleKalendarDelete class definition.
*/
namespace KCal
/**
* @brief
* Class to manage the Event removal capability.
* @author Tuukka Pasanen
* @author Allen Winter
*/
class KonsoleKalendarDelete
{
/**
* Class to manage the Event removal capability.
* @author Tuukka Pasanen
* @author Allen Winter
*/
class KonsoleKalendarDelete
{
public:
/**
* Constructs a KonsoleKalendarDelete object from command line arguments.
*
* @param vars is a pointer to the #KonsoleKalendarVariables object
* which contains all the command line arguments.
*/
KonsoleKalendarDelete( KonsoleKalendarVariables *vars );
/**
* Destructor
*/
......@@ -64,14 +67,14 @@ namespace KCal
/**
* Print event specs for dryrun and verbose options.
*
* @param event is a pointer to an #Event that is to be printed.
*/
void printSpecs( Event *event );
/**
* What we need to delete
*/
//@cond PRIVATE
KonsoleKalendarVariables *m_variables;
};
//@endcond
};
}
#endif
......@@ -36,7 +36,6 @@
#include <QDateTime>
#include "konsolekalendarepoch.h"
using namespace KCal;
using namespace std;
KonsoleKalendarEpoch::KonsoleKalendarEpoch()
......
......@@ -35,19 +35,19 @@
* Provides the KonsoleKalendarEpoch class definition.
*/
namespace KCal
/**
* @brief
* Class for timestamps expressed as epochs.
* @author Allen Winter
*/
class KonsoleKalendarEpoch
{
/**
* Class for timestamps expressed as epochs.
* @author Allen Winter
*/
class KonsoleKalendarEpoch
{
public:
/**
* Constructor.
*/
KonsoleKalendarEpoch();
/**
* Destructor
*/
......@@ -65,8 +65,6 @@ namespace KCal
*/
static uint QDateTime2epoch( const QDateTime &dt );
};
}
};
#endif
......@@ -210,7 +210,9 @@ QString KonsoleKalendarExports::processField( const QString &field,
return retField;
}
//@cond IGNORE
#define pF( x ) processField( ( x ), dquote )
//@endcond
bool KonsoleKalendarExports::exportAsCSV( QTextStream *ts,
Event *event, const QDate &date )
......
......@@ -37,15 +37,14 @@
* Provides the KonsoleKalendarExports class definition.
*/
namespace KCal
/**
* @brief
* Class to manage the Export functionality.
* @author Tuukka Pasanen
* @author Allen Winter
*/
class KonsoleKalendarExports
{
/**
* Class to manage the Export functionality.
* @author Tuukka Pasanen
* @author Allen Winter
*/
class KonsoleKalendarExports
{
public:
/**
......@@ -53,6 +52,7 @@ namespace KCal
* @param vars is a KonsoleKalendarVariable object with Event information.
*/
KonsoleKalendarExports( KonsoleKalendarVariables *vars = 0 );
/**
* Destructor
*/
......@@ -65,6 +65,7 @@ namespace KCal
* @param date is the QDate to be exported for.
*/
bool exportAsTxt( QTextStream *ts, Event *event, const QDate &date );
/**
* Export the Event in Short Text Mode.
* @param ts pointer to the output QTextStream.
......@@ -75,6 +76,7 @@ namespace KCal
*/
bool exportAsTxtShort( QTextStream *ts, Event *event, const QDate &date,
bool sameday );
/**
* Export the Event in Comma-Separated Values (CSV) Mode.
* @param ts pointer to the output QTextStream.
......@@ -84,8 +86,11 @@ namespace KCal
bool exportAsCSV( QTextStream *ts, Event *event, const QDate &date );
private:
//@cond PRIVATE
KonsoleKalendarVariables *m_variables;
bool m_firstEntry;
//@endcond
/**
* Processes a field for Comma-Separated Value (CSV) compliance:
* 1. Replaces double quotes by a pair of consecutive double quotes
......@@ -95,7 +100,6 @@ namespace KCal
*/
QString processField( const QString &field, const QString &dquote );
};
};
}
#endif
......@@ -37,45 +37,46 @@
#include <QString>
#include <QDateTime>
using namespace KCal;
/**
* @file konsolekalendarvariables.h
* Provides the KonsoleKalendarVariables class definition.
*/
namespace KCal
/**
* ExportType is the type of Export output
*/
enum ExportType
{
/** Export none */
ExportTypeNone,
/** Export as text (default) */
ExportTypeText,
/** Export as compact text */
ExportTypeTextShort,
/** Export HTML for the specified time span */
ExportTypeHTML,
/** Export HTML for the time span on month boundaries */
ExportTypeMonthHTML,
/** Export XHTML (NOT AVAILABLE YET) */
ExportTypeXHTML,
/** Export XML (NOT AVAILABLE YET) */
ExportTypeXML,
/** Export Comma-Separated Values */
ExportTypeCSV,
/** Export VCard (NOT AVAILABLE YET) */
ExportTypeVCard
};
/**
* @brief
* This class provides all the variables for the program.
* @author Tuukka Pasanen
* @author Allen Winter
*/
class KonsoleKalendarVariables
{
/**
* ExportType is the type of Export output
*/
enum ExportType
{
/** Export none */
ExportTypeNone,
/** Export as text (default) */
ExportTypeText,
/** Export as compact text */
ExportTypeTextShort,
/** Export HTML for the specified time span */
ExportTypeHTML,
/** Export HTML for the time span on month boundaries */
ExportTypeMonthHTML,
/** Export XHTML (NOT AVAILABLE YET) */
ExportTypeXHTML,
/** Export XML (NOT AVAILABLE YET) */