Fix akonadimodel.cpp:1: warning: unterminated character constant
[kdepim.git] / nepomuk_email_feeder / messageanalyzer.h
blob03b6c4027abf7277c7a166bf1ae64ecd9066ba93
1 /*
2 Copyright (c) 2006, 2009 Volker Krause <vkrause@kde.org>
3 Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
21 #ifndef MESSAGEANALYZER_H
22 #define MESSAGEANALYZER_H
24 #include "task.h"
26 #include <contact.h>
27 #include <email.h>
29 #include <messageviewer/objecttreeemptysource.h>
30 #include <messageviewer/viewer.h>
32 #include <akonadi/item.h>
34 #include <kmime/kmime_headers.h>
35 #include <kmime/kmime_message.h>
37 #include <KDE/KUrl>
40 namespace MessageViewer {
41 class NodeHelper;
42 class ObjectTreeParser;
45 class NepomukFeederAgentBase;
47 /**
48 Does the actual analysis of the email, split out from the feeder agent due to possibly asynchronous
49 operations in the OTP, so we need to isolate state in case multiple items are processed at the same time.
50 Also gives us the possibility to parallelizer this later on.
52 class MessageAnalyzer : public Task, public MessageViewer::EmptySource
54 Q_OBJECT
55 public:
56 MessageAnalyzer( const Akonadi::Item &item, const QUrl &graphUri, NepomukFeederAgentBase* parent = 0 );
57 ~MessageAnalyzer();
59 inline QUrl graphUri() const { return m_graphUri; }
61 /* reimpl from EmptySource */
62 virtual QObject* sourceObject() { return this; }
64 public slots:
65 // needed in EmptySource::sourceObject()
66 void update( MessageViewer::Viewer::UpdateMode mode );
68 private:
69 QList<NepomukFast::Contact> extractContactsFromMailboxes( const KMime::Types::Mailbox::List& mbs, const QUrl&graphUri );
70 void addTranslatedTag( const char* tagName, const QString &tagLabel, const QString &icon = QString() );
72 void processContent( const KMime::Message::Ptr &msg );
73 void processFlags( const Akonadi::Item::Flags &flags );
74 void processHeaders( const KMime::Message::Ptr &msg );
75 void processPart( KMime::Content *content );
77 private:
78 NepomukFeederAgentBase *m_parent;
79 Akonadi::Item m_item;
80 NepomukFast::Email m_email;
81 QUrl m_graphUri;
82 KMime::Content *m_mainBodyPart;
83 MessageViewer::NodeHelper *m_nodeHelper;
84 MessageViewer::ObjectTreeParser *m_otp;
87 #endif