00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #define WANT_DEPRECATED_KCAL_API
00023
00024 #include "incidencemimetypevisitor.h"
00025
00026 static QLatin1String sEventType( "application/x-vnd.akonadi.calendar.event" );
00027 static QLatin1String sTodoType( "application/x-vnd.akonadi.calendar.todo" );
00028 static QLatin1String sJournalType( "application/x-vnd.akonadi.calendar.journal" );
00029 static QLatin1String sFreeBusyType( "application/x-vnd.akonadi.calendar.freebusy" );
00030
00031 using namespace Akonadi;
00032
00033 class IncidenceMimeTypeVisitor::Private
00034 {
00035 public:
00036 QString mType;
00037 };
00038
00039 IncidenceMimeTypeVisitor::IncidenceMimeTypeVisitor() : d( new Private() )
00040 {
00041 }
00042
00043 IncidenceMimeTypeVisitor::~IncidenceMimeTypeVisitor()
00044 {
00045 delete d;
00046 }
00047
00048 bool IncidenceMimeTypeVisitor::visit( KCal::Event *event )
00049 {
00050 Q_UNUSED( event );
00051 d->mType = sEventType;
00052 return true;
00053 }
00054
00055 bool IncidenceMimeTypeVisitor::visit( KCal::Todo *todo )
00056 {
00057 Q_UNUSED( todo );
00058 d->mType = sTodoType;
00059 return true;
00060 }
00061
00062 bool IncidenceMimeTypeVisitor::visit( KCal::Journal *journal )
00063 {
00064 Q_UNUSED( journal );
00065 d->mType = sJournalType;
00066 return true;
00067 }
00068
00069 bool IncidenceMimeTypeVisitor::visit( KCal::FreeBusy *freebusy )
00070 {
00071 Q_UNUSED( freebusy );
00072 d->mType = sFreeBusyType;
00073 return true;
00074 }
00075
00076 QString IncidenceMimeTypeVisitor::mimeType() const
00077 {
00078 return d->mType;
00079 }
00080
00081 QStringList IncidenceMimeTypeVisitor::allMimeTypes() const
00082 {
00083 return QStringList() << sEventType << sTodoType << sJournalType << sFreeBusyType;
00084 }
00085
00086 QString IncidenceMimeTypeVisitor::mimeType( KCal::IncidenceBase *incidence )
00087 {
00088 Q_ASSERT( incidence != 0 );
00089
00090 incidence->accept( *this );
00091 return mimeType();
00092 }
00093
00094 QString IncidenceMimeTypeVisitor::eventMimeType()
00095 {
00096 return sEventType;
00097 }
00098
00099 QString IncidenceMimeTypeVisitor::todoMimeType()
00100 {
00101 return sTodoType;
00102 }
00103
00104 QString IncidenceMimeTypeVisitor::journalMimeType()
00105 {
00106 return sJournalType;
00107 }
00108
00109 QString IncidenceMimeTypeVisitor::freeBusyMimeType()
00110 {
00111 return sFreeBusyType;
00112 }
00113
00114