• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

messageviewer

  • sources
  • kde-4.12
  • kdepim
  • messageviewer
  • viewer
viewer.h
Go to the documentation of this file.
1 /* -*- mode: C++; c-file-style: "gnu" -*-
2  This file is part of KMail, the KDE mail client.
3  Copyright (c) 1997 Markus Wuebben <markus.wuebben@kde.org>
4  Copyright (C) 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net
5  Copyright (c) 2009 Andras Mantia <andras@kdab.net>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License along
18  with this program; if not, write to the Free Software Foundation, Inc.,
19  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef MESSAGEVIEWER_H
23 #define MESSAGEVIEWER_H
24 
25 #include "messageviewer_export.h"
26 
27 #include <kmime/kmime_message.h>
28 
29 #include <QWidget>
30 
31 namespace Akonadi {
32 class Item;
33 class ItemFetchJob;
34 }
35 
36 class KActionCollection;
37 class KAction;
38 class KToggleAction;
39 class KUrl;
40 
41 class QAbstractItemModel;
42 class QCloseEvent;
43 class QEvent;
44 class QResizeEvent;
45 
46 namespace MessageViewer {
47 
48 class AttachmentStrategy;
49 class CSSHelper;
50 class HeaderStrategy;
51 class HeaderStyle;
52 class ViewerPrivate;
53 
58 class AbstractMessageLoadedHandler
59 {
60  public:
61 
62  virtual ~AbstractMessageLoadedHandler() {}
63 
70  virtual void setItem( const Akonadi::Item &item ) = 0;
71 };
72 
73 //TODO(Andras) once only those methods are public that really need to be public, probably export the whole class instead of just some methods
74 
80 class MESSAGEVIEWER_EXPORT Viewer: public QWidget
81 {
82  Q_OBJECT
83 
84  Q_DECLARE_PRIVATE( Viewer )
85 
86  public:
94  explicit Viewer( QWidget *parent, QWidget *mainWindow = 0, KActionCollection *actionCollection = 0,
95  Qt::WindowFlags f = 0 );
96  virtual ~Viewer();
97 
101  KMime::Message::Ptr message() const;
102 
106  Akonadi::Item messageItem() const;
107 
108  enum ForceDisplayTo {
109  Unknown = 0,
110  Text = 1,
111  Html = 2
112  };
113 
114  enum AttachmentAction
115  {
116  Open = 1,
117  OpenWith = 2,
118  View = 3,
119  Save = 4,
120  Properties = 5,
121  ChiasmusEncrypt = 6,
122  Delete = 7,
123  Edit = 8,
124  Copy = 9,
125  ScrollTo = 10
126  };
127 
132  enum UpdateMode {
133  Force = 0,
134  Delayed
135  };
136 
137  enum ResourceOnlineMode {
138  AllResources = 0,
139  SelectedResource = 1
140  };
141 
147  void setMessage( KMime::Message::Ptr message, UpdateMode updateMode = Delayed );
148 
155  void setMessageItem( const Akonadi::Item& item, UpdateMode updateMode = Delayed );
156 
160  QString messagePath() const;
161 
165  void setMessagePath( const QString &path );
166 
171  void setMessagePart( KMime::Content* aMsgPart );
172 
178  void clear( UpdateMode updateMode = Delayed ) { setMessage( KMime::Message::Ptr(), updateMode ); }
179 
180  void update( UpdateMode updateMode = Delayed );
181 
186  void printMessage( const Akonadi::Item &msg );
187 
188  void printPreviewMessage( const Akonadi::Item &message );
189 
191  void print();
192  void printPreview();
193 
195  bool htmlOverride() const;
196 
198  void setHtmlOverride( bool override );
199 
201  bool htmlLoadExtOverride() const;
202 
204  void setHtmlLoadExtOverride( bool override );
205 
207  bool htmlMail() const;
208 
210  bool htmlLoadExternal() const;
211 
216  void setAppName( const QString &appName );
217 
222  void displaySplashPage( const QString& info );
223 
225  void enableMessageDisplay();
226 
228  bool atBottom() const;
229 
230  bool isFixedFont() const;
231  void setUseFixedFont( bool useFixedFont );
232 
233  QWidget* mainWindow();
234 
236  void setDecryptMessageOverwrite( bool overwrite = true );
237 
242  QWidget* configWidget();
243 
246  void deleteMessage();
247 
248  const AttachmentStrategy * attachmentStrategy() const;
249  void setAttachmentStrategy( const AttachmentStrategy * strategy );
250 
251  QString overrideEncoding() const;
252  void setOverrideEncoding( const QString &encoding );
253  CSSHelper* cssHelper() const;
254  void setPrinting(bool enable);
255 
256  void selectAll();
257  void clearSelection();
258  void copySelectionToClipboard();
259 
260  void setZoomFactor( qreal zoomFactor );
261 
262 
263  void setZoomTextOnly( bool textOnly );
264  bool zoomTextOnly() const;
265 
266 
267  KToggleAction *toggleFixFontAction();
268 
269  KToggleAction *toggleMimePartTreeAction();
270 
271  KAction *selectAllAction();
272  KAction *copyURLAction();
273  KAction *copyAction();
274  KAction *urlOpenAction();
275  KAction *speakTextAction();
276  KAction *copyImageLocation();
277  KAction *translateAction();
278  KAction *viewSourceAction();
279  KAction *findInMessageAction();
280  KAction *saveAsAction();
281  KAction *saveMessageDisplayFormatAction();
282  KAction *resetMessageDisplayFormatAction();
283  KAction *blockImage();
284  KAction *openBlockableItems();
285  KAction *expandShortUrlAction();
286 
287  HeaderStrategy * headerStrategy() const;
288 
289  HeaderStyle * headerStyle() const;
290 
291  void setHeaderStyleAndStrategy( HeaderStyle * style,
292  HeaderStrategy * strategy );
293  void writeConfig( bool withSync=true );
294 
295  KUrl urlClicked() const;
296  KUrl imageUrlClicked() const;
297 
298  void readConfig();
299 
301  QAbstractItemModel* messageTreeModel() const;
302 
309  static Akonadi::ItemFetchJob* createFetchJob( const Akonadi::Item &item );
310 
315  void setScrollBarPolicy( Qt::Orientation orientation, Qt::ScrollBarPolicy policy );
316 
321  Qt::ScrollBarPolicy scrollBarPolicy( Qt::Orientation orientation ) const;
322 
327  void addMessageLoadedHandler( AbstractMessageLoadedHandler *handler );
328 
333  void removeMessageLoadedHandler( AbstractMessageLoadedHandler *handler );
334 
335 
336  QString selectedText() const;
337 
338  void setExternalWindow( bool b );
339 
340 
341  void saveMainFrameScreenshotInFile(const QString &filename);
342  bool adblockEnabled() const;
343  bool isAShortUrl(const KUrl &url) const;
344 
345 
346 signals:
347  void moveMessageToTrash();
348 
353  void showStatusBarMessage( const QString &message );
354 
359  void replaceMsgByUnencryptedVersion();
360 
362  void popupMenu(const Akonadi::Item &msg, const KUrl &url, const KUrl &imageUrl, const QPoint& mousePos);
363 
368  void urlClicked( const Akonadi::Item &, const KUrl& );
369 
370  void requestConfigSync();
371 
373  void showReader( KMime::Content* aMsgPart, bool aHTML, const QString & encoding );
374 
376  void showMessage( KMime::Message::Ptr message, const QString& encoding );
377 
378  void deleteMessage( const Akonadi::Item & );
379 
381  void itemRemoved();
382 
383  void makeResourceOnline(MessageViewer::Viewer::ResourceOnlineMode mode);
384 
385 private:
386  void initialize();
387 
388 public slots:
389 
396  void slotScrollUp( int pixels = 10 );
397  void slotScrollDown( int pixels = 10 );
398  void slotScrollPrior();
399  void slotScrollNext();
400  void slotJumpDown();
401  void slotFind();
402  void slotTranslate();
403  void slotSaveMessage();
404  void slotAttachmentSaveAs();
405  void slotAttachmentSaveAll();
406  void slotShowMessageSource();
407  void slotZoomIn();
408  void slotZoomOut();
409  void slotZoomReset();
410  void slotChangeDisplayMail(Viewer::ForceDisplayTo,bool);
411 protected:
413  virtual void closeEvent(QCloseEvent *);
414  virtual void resizeEvent(QResizeEvent *);
416  virtual bool event(QEvent *e);
417 
418 #ifdef KDEPIM_MOBILE_UI
419  friend class MessageViewItem;
420 #endif
421  ViewerPrivate* const d_ptr;
422 };
423 
424 }
425 
426 #endif
427 
MessageViewer::HeaderStyle
This class encapsulates the visual appearance of message headers.
Definition: headerstyle.h:60
QWidget
MessageViewer::Viewer::UpdateMode
UpdateMode
The display update mode: Force updates the display immediately, Delayed updates after some time (150m...
Definition: viewer.h:132
MessageViewer::HeaderStrategy
Definition: headerstrategy.h:42
MessageViewer::Viewer
This is the main widget for the viewer.
Definition: viewer.h:80
MessageViewer::ViewerPrivate
Private class for the Viewer, the main widget in the messageviewer library.
Definition: viewer_p.h:182
MessageViewer::Viewer::ForceDisplayTo
ForceDisplayTo
Definition: viewer.h:108
MessageViewer::Viewer::d_ptr
ViewerPrivate *const d_ptr
Definition: viewer.h:421
MessageViewer::Viewer::ResourceOnlineMode
ResourceOnlineMode
Definition: viewer.h:137
MessageViewer::AbstractMessageLoadedHandler::setItem
virtual void setItem(const Akonadi::Item &item)=0
This method is called whenever a message item has been loaded into the view.
MessageViewer::CSSHelper
Definition: csshelper.h:41
MessageViewer::Util::Html
A HTML message, non-multipart.
Definition: util.h:75
QAbstractItemModel
MESSAGEVIEWER_EXPORT
#define MESSAGEVIEWER_EXPORT
Definition: messageviewer_export.h:37
MessageViewer::AbstractMessageLoadedHandler::~AbstractMessageLoadedHandler
virtual ~AbstractMessageLoadedHandler()
Definition: viewer.h:62
MessageViewer::AttachmentStrategy
Definition: attachmentstrategy.h:46
MessageViewer::Viewer::clear
void clear(UpdateMode updateMode=Delayed)
Convenience method to clear the reader and discard the current message.
Definition: viewer.h:178
MessageViewer::Viewer::AttachmentAction
AttachmentAction
Definition: viewer.h:114
MessageViewer::AbstractMessageLoadedHandler
An interface to plug in a handler that is called when an message item has been loaded into the view...
Definition: viewer.h:58
messageviewer_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messageviewer

Skip menu "messageviewer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal