akonadi/kcal
kcalmimetypevisitor.cpp
Go to the documentation of this file.00001 /* 00002 Copyright (c) 2008 Kevin Krammer <kevin.krammer@gmx.at> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 00018 */ 00019 00020 #include "kcalmimetypevisitor.h" 00021 00022 static QLatin1String sEventType( "application/x-vnd.akonadi.calendar.event" ); 00023 static QLatin1String sTodoType( "application/x-vnd.akonadi.calendar.todo" ); 00024 static QLatin1String sJournalType( "application/x-vnd.akonadi.calendar.journal" ); 00025 static QLatin1String sFreeBusyType( "application/x-vnd.akonadi.calendar.freebusy" ); 00026 00027 using namespace Akonadi; 00028 using namespace KCal; 00029 00030 class KCalMimeTypeVisitor::Private 00031 { 00032 public: 00033 QString mType; 00034 }; 00035 00036 KCalMimeTypeVisitor::KCalMimeTypeVisitor() : d( new Private() ) 00037 { 00038 } 00039 00040 KCalMimeTypeVisitor::~KCalMimeTypeVisitor() 00041 { 00042 delete d; 00043 } 00044 00045 bool KCalMimeTypeVisitor::visit( Event *event ) 00046 { 00047 Q_UNUSED( event ); 00048 d->mType = sEventType; 00049 return true; 00050 } 00051 00052 bool KCalMimeTypeVisitor::visit( Todo *todo ) 00053 { 00054 Q_UNUSED( todo ); 00055 d->mType = sTodoType; 00056 return true; 00057 } 00058 00059 bool KCalMimeTypeVisitor::visit( Journal *journal ) 00060 { 00061 Q_UNUSED( journal ); 00062 d->mType = sJournalType; 00063 return true; 00064 } 00065 00066 bool KCalMimeTypeVisitor::visit( FreeBusy *freebusy ) 00067 { 00068 Q_UNUSED( freebusy ); 00069 d->mType = sFreeBusyType; 00070 return true; 00071 } 00072 00073 QString KCalMimeTypeVisitor::mimeType() const 00074 { 00075 return d->mType; 00076 } 00077 00078 QStringList KCalMimeTypeVisitor::allMimeTypes() const 00079 { 00080 return QStringList() << sEventType << sTodoType << sJournalType << sFreeBusyType; 00081 } 00082 00083 QString KCalMimeTypeVisitor::mimeType( IncidenceBase *incidence ) 00084 { 00085 Q_ASSERT( incidence != 0 ); 00086 00087 incidence->accept( *this ); 00088 return mimeType(); 00089 }
KDE 4.2 API Reference