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

messageviewer

  • sources
  • kde-4.14
  • 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 DisplayFormatMessage {
109  UseGlobalSetting = 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  Viewer::DisplayFormatMessage displayFormatMessageOverwrite() const;
196 
198  void setDisplayFormatMessageOverwrite(Viewer::DisplayFormatMessage format);
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  KAction *createTodoAction();
287  KAction *createEventAction();
288 
289  HeaderStrategy * headerStrategy() const;
290 
291  HeaderStyle * headerStyle() const;
292 
293  void setHeaderStyleAndStrategy( HeaderStyle * style,
294  HeaderStrategy * strategy );
295  void writeConfig( bool withSync=true );
296 
297  KUrl urlClicked() const;
298  KUrl imageUrlClicked() const;
299 
300  void readConfig();
301 
303  QAbstractItemModel* messageTreeModel() const;
304 
311  static Akonadi::ItemFetchJob* createFetchJob( const Akonadi::Item &item );
312 
317  void setScrollBarPolicy( Qt::Orientation orientation, Qt::ScrollBarPolicy policy );
318 
323  Qt::ScrollBarPolicy scrollBarPolicy( Qt::Orientation orientation ) const;
324 
329  void addMessageLoadedHandler( AbstractMessageLoadedHandler *handler );
330 
335  void removeMessageLoadedHandler( AbstractMessageLoadedHandler *handler );
336 
337 
338  QString selectedText() const;
339 
340  void setExternalWindow( bool b );
341 
342 
343  void saveMainFrameScreenshotInFile(const QString &filename);
344  bool adblockEnabled() const;
345  bool isAShortUrl(const KUrl &url) const;
346 
347  void showOpenAttachmentFolderWidget(const KUrl &url);
348  bool mimePartTreeIsEmpty() const;
349 signals:
350  void moveMessageToTrash();
351 
356  void showStatusBarMessage( const QString &message );
357 
362  void replaceMsgByUnencryptedVersion();
363 
365  void popupMenu(const Akonadi::Item &msg, const KUrl &url, const KUrl &imageUrl, const QPoint& mousePos);
366 
371  void urlClicked( const Akonadi::Item &, const KUrl& );
372 
373  void requestConfigSync();
374 
376  void showReader( KMime::Content* aMsgPart, bool aHTML, const QString & encoding );
377 
379  void showMessage( KMime::Message::Ptr message, const QString& encoding );
380 
381  void deleteMessage( const Akonadi::Item & );
382 
384  void itemRemoved();
385 
386  void makeResourceOnline(MessageViewer::Viewer::ResourceOnlineMode mode);
387 
388 private:
389  void initialize();
390 
391 public slots:
392 
399  void slotScrollUp( int pixels = 10 );
400  void slotScrollDown( int pixels = 10 );
401  void slotScrollPrior();
402  void slotScrollNext();
403  void slotJumpDown();
404  void slotFind();
405  void slotTranslate();
406  void slotSaveMessage();
407  void slotAttachmentSaveAs();
408  void slotAttachmentSaveAll();
409  void slotShowMessageSource();
410  void slotZoomIn();
411  void slotZoomOut();
412  void slotZoomReset();
413  void slotChangeDisplayMail(Viewer::DisplayFormatMessage,bool);
414 protected:
416  virtual void closeEvent(QCloseEvent *);
417  virtual void resizeEvent(QResizeEvent *);
419  virtual bool event(QEvent *e);
420 
421 #ifdef KDEPIM_MOBILE_UI
422  friend class MessageViewItem;
423 #endif
424  ViewerPrivate* const d_ptr;
425 };
426 
427 }
428 
429 #endif
430 
MessageViewer::Viewer::DisplayFormatMessage
DisplayFormatMessage
Definition: viewer.h:108
QEvent
QResizeEvent
QWidget
MessageViewer::HeaderStyle
This class encapsulates the visual appearance of message headers.
Definition: headerstyle.h:60
MessageViewer::Viewer::UpdateMode
UpdateMode
The display update mode: Force updates the display immediately, Delayed updates after some time (150m...
Definition: viewer.h:132
QPoint
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:180
QCloseEvent
MessageViewer::Viewer::d_ptr
ViewerPrivate *const d_ptr
Definition: viewer.h:424
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.
QString
MessageViewer::CSSHelper
Definition: csshelper.h:41
MessageViewer::Util::Html
A HTML message, non-multipart.
Definition: util.h:75
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
QAbstractItemModel
Qt::WindowFlags
typedef WindowFlags
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-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:45 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
  • pimprint

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