doc fixes found while translating
[kdepim.git] / mobile / mail / mainview.h
blobf1379448f2088f313176a1441ffa476efbd8706d
1 /*
2 Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>
3 Copyright (c) 2010 Volker Krause <vkrause@kde.org>
4 Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
5 Copyright (c) 2010 Andras Mantia <andras@kdab.com>
7 This library is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Library General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
12 This library is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15 License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to the
19 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301, USA.
23 #ifndef MAINVIEW_H
24 #define MAINVIEW_H
26 #include "kdeclarativemainview.h"
28 #include <akonadi/entitytreemodel.h>
29 #include <akonadi/kmime/specialmailcollections.h>
30 #include <akonadi/selectionproxymodel.h>
31 #include <messagecomposer/messagefactory.h>
32 #include <kpimutils/networkaccesshelper.h>
34 namespace Akonadi {
35 class EntityMimeTypeFilterModel;
36 class QuotaColorProxyModel;
37 class StandardMailActionManager;
40 namespace MessageViewer {
41 class MessageViewItem;
44 class AclEditor;
45 class AkonadiSender;
46 class ComposerView;
47 class ConfigWidget;
48 class FilterModel;
49 class KJob;
50 class KSelectionProxyModel;
51 class MailThreadGrouperComparator;
52 class MessageListSettings;
53 class MessageListSettingsController;
54 class QStandardItemModel;
55 class TemplateEmailModel;
56 class ThreadGrouperModel;
57 class ThreadModel;
59 class MainView : public KDeclarativeMainView
61 Q_OBJECT
62 Q_CLASSINFO( "D-Bus Interface", "org.kde.kmailmobile.Composer" )
63 Q_CLASSINFO( "D-Bus Introspection", ""
64 " <interface name=\"org.kde.kmailmobile.Composer\">\n"
65 " <method name=\"openComposer\">\n"
66 " <arg direction=\"out\" type=\"i\"/>\n"
67 " <arg direction=\"in\" type=\"s\" name=\"to\"/>\n"
68 " <arg direction=\"in\" type=\"s\" name=\"cc\"/>\n"
69 " <arg direction=\"in\" type=\"s\" name=\"bcc\"/>\n"
70 " <arg direction=\"in\" type=\"s\" name=\"subject\"/>\n"
71 " <arg direction=\"in\" type=\"s\" name=\"body\"/>\n"
72 " </method>\n"
73 " </interface>\n"
74 "")
76 Q_PROPERTY( bool collectionIsSentMail READ collectionIsSentMail NOTIFY currentCollectionChanged )
78 public:
79 explicit MainView(QWidget* parent = 0);
81 ~MainView();
83 enum ForwardMode {
84 InLine = 0,
85 AsAttachment,
86 Redirect
89 void setConfigWidget( ConfigWidget *configWidget );
91 bool collectionIsSentMail() const;
93 public Q_SLOTS:
94 void startComposer();
95 void restoreDraft( quint64 id );
96 void restoreTemplate( quint64 id );
98 void markImportant( bool checked );
99 void markMailTask( bool checked );
100 void modifyDone( KJob *job );
101 void dataChanged();
103 bool isDraftThreadContent( int row );
104 bool isDraftThreadRoot( int row );
105 bool isSingleMessage( int row );
106 bool folderIsDrafts( const Akonadi::Collection &collection );
107 bool isTemplateThreadContent( int row );
108 bool isTemplateThreadRoot( int row );
109 bool folderIsTemplates( const Akonadi::Collection &collection );
111 void configureIdentity();
113 int emailTemplateCount();
114 void newMessageFromTemplate( int index );
116 void selectNextUnreadMessage();
118 Q_SCRIPTABLE int openComposer( const QString & to,
119 const QString & cc,
120 const QString & bcc,
121 const QString & subject,
122 const QString & body );
123 void mailActionStateUpdated();
125 Q_SIGNALS:
126 void currentCollectionChanged();
128 protected slots:
129 void forwardMessage();
130 void forwardAsAttachment();
131 void redirect();
132 void replyToAll();
133 void replyToAuthor();
134 void replyToMailingList();
135 void replyToMessage();
136 void replyWithoutQuoting();
137 void sendAgain();
138 void sendQueued();
139 void sendQueuedVia();
140 void sendQueuedVia( const QString &transport );
141 void saveMessage();
142 void findInMessage();
143 void preferHTML( bool useHtml );
144 void preferHtmlViewer( bool useHtml );
145 void loadExternalReferences( bool load );
146 void folderChanged();
147 void moveToOrEmptyTrash();
148 void createToDo();
149 void createEvent();
150 void useFixedFont();
151 void applyFilters();
152 void applyFiltersBulkAction();
154 void itemSelectionChanged();
155 void slotCollectionSelectionChanged();
157 protected:
158 void doDelayedInit();
159 virtual void setupStandardActionManager( QItemSelectionModel *collectionSelectionModel,
160 QItemSelectionModel *itemSelectionModel );
162 virtual void setupAgentActionManager( QItemSelectionModel *selectionModel );
164 virtual QAbstractProxyModel* createMainProxyModel() const;
165 virtual QAbstractProxyModel* createItemFilterModel() const;
167 virtual ImportHandlerBase* importHandler() const;
168 virtual ExportHandlerBase* exportHandler() const;
169 virtual GuiStateManager* createGuiStateManager() const;
171 virtual QAbstractItemModel* createItemModelContext(QDeclarativeContext* context, QAbstractItemModel* model);
173 virtual bool doNotUseFilterLineEditInCurrentState() const;
175 private slots:
176 void qmlInitialized( QDeclarativeView::Status status );
177 void sendAgainFetchResult( KJob *job );
178 void replyFetchResult( KJob *job );
179 void forwardFetchResult( KJob *job );
180 void composeFetchResult( KJob *job );
181 void initDefaultFolders();
182 void createDefaultCollectionDone( KJob *job);
183 void deleteItemResult( KJob *job );
184 void showExpireProperties();
185 void templateFetchResult( KJob *job );
186 void updateConfig();
187 bool askToGoOnline();
188 void showMessageSource();
189 void selectOverrideEncoding();
190 void toggleShowExtendedHeaders( bool );
191 void messageListSettingsChanged( const MessageListSettings& );
192 bool selectNextUnreadMessageInCurrentFolder();
193 void showTemplatesHelp();
194 void slotDeleteMessage( const Akonadi::Item &item );
196 private:
197 void reply( quint64 id, MessageComposer::ReplyStrategy replyStrategy, bool quoteOriginal = true );
198 void forward( quint64 id, ForwardMode mode );
199 void findCreateDefaultCollection( Akonadi::SpecialMailCollections::Type type );
200 void recoverAutoSavedMessages();
201 Akonadi::Item currentItem() const;
202 MessageViewer::MessageViewItem *messageViewerItem();
203 uint currentFolderIdentity() const;
204 QString itemStorageCollectionAsPath( const Akonadi::Item& ) const;
206 bool mAskingToGoOnline;
207 QWidget *mTransportDialog;
208 Akonadi::StandardMailActionManager *mMailActionManager;
209 Akonadi::EntityMimeTypeFilterModel *mCollectionModel;
210 TemplateEmailModel *mEmailTemplateModel;
211 QItemSelectionModel *mTemplateSelectionModel;
212 KSelectionProxyModel *m_threadContentsModel;
213 MailThreadGrouperComparator *m_grouperComparator;
214 ThreadGrouperModel *m_threadGrouperModel;
215 ThreadModel *m_threadsModel;
216 FilterModel *mFilterModel;
217 Akonadi::QuotaColorProxyModel *mQuotaColorProxyModel;
218 AclEditor *mAclEditor;
219 MessageListSettingsController *mMessageListSettingsController;
220 Akonadi::Collection mCurrentCollection;
221 KPIMUtils::NetworkAccessHelper *mNetworkAccessHelper;
224 Q_DECLARE_METATYPE( MainView::ForwardMode )
226 #endif