2
Copyright (c) 2009 Andras Mantia <amantia@kde.org>
4
This library is free software; you can redistribute it and/or modify it
5
under the terms of the GNU Library General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or (at your
7
option) any later version.
9
This library is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12
License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to the
16
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
#include "kolabhandler.h"
20
#include "addressbookhandler.h"
21
#include "calendarhandler.h"
22
#include "taskshandler.h"
23
#include "journalhandler.h"
25
KolabHandler::KolabHandler()
29
KolabHandler *KolabHandler::createHandler(const QByteArray& type)
31
if (type == "contact.default" || type == "contact") {
32
return new AddressBookHandler();
33
} else if (type == "event.default" || type == "event") {
34
return new CalendarHandler();
35
} else if (type == "task.default" || type == "task") {
36
return new TasksHandler();
37
} else if (type == "journal.default" || type == "journal") {
38
return new JournalHandler();
39
} else if (type == "note.default" || type == "note") {
40
JournalHandler *handler = new JournalHandler();
41
handler->setMimeType("application/x-vnd.kolab.note");
49
KolabHandler::~KolabHandler()
53
QByteArray KolabHandler::mimeType() const
58
void KolabHandler::setMimeType(const QByteArray &type)
64
KMime::Content* KolabHandler::findContentByType(MessagePtr data, const QByteArray &type)
66
KMime::Content::List list = data->contents();
67
Q_FOREACH(KMime::Content *c, list)
69
if (c->contentType()->mimeType() == type)
76
KMime::Content* KolabHandler::findContentByName(MessagePtr data, const QString &name, QByteArray &type)
78
KMime::Content::List list = data->contents();
79
Q_FOREACH(KMime::Content *c, list)
81
if (c->contentType()->name() == name)
82
type = QByteArray(c->contentType()->type());