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
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>
35 class EntityMimeTypeFilterModel
;
36 class QuotaColorProxyModel
;
37 class StandardMailActionManager
;
40 namespace MessageViewer
{
41 class MessageViewItem
;
50 class KSelectionProxyModel
;
51 class MailThreadGrouperComparator
;
52 class MessageListSettings
;
53 class MessageListSettingsController
;
54 class QStandardItemModel
;
55 class TemplateEmailModel
;
56 class ThreadGrouperModel
;
59 class MainView
: public KDeclarativeMainView
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"
76 Q_PROPERTY( bool collectionIsSentMail READ collectionIsSentMail NOTIFY currentCollectionChanged
)
79 explicit MainView(QWidget
* parent
= 0);
89 void setConfigWidget( ConfigWidget
*configWidget
);
91 bool collectionIsSentMail() const;
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
);
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
,
121 const QString
& subject
,
122 const QString
& body
);
123 void mailActionStateUpdated();
126 void currentCollectionChanged();
129 void forwardMessage();
130 void forwardAsAttachment();
133 void replyToAuthor();
134 void replyToMailingList();
135 void replyToMessage();
136 void replyWithoutQuoting();
139 void sendQueuedVia();
140 void sendQueuedVia( const QString
&transport
);
142 void findInMessage();
143 void preferHTML( bool useHtml
);
144 void preferHtmlViewer( bool useHtml
);
145 void loadExternalReferences( bool load
);
146 void folderChanged();
147 void moveToOrEmptyTrash();
152 void applyFiltersBulkAction();
154 void itemSelectionChanged();
155 void slotCollectionSelectionChanged();
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;
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
);
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
);
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
)