Messagelib

viewer.cpp
1 /*
2  This file is part of KMail, the KDE mail client.
3  SPDX-FileCopyrightText: 1997 Markus Wuebben <[email protected]>
4  SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected]
5  SPDX-FileCopyrightText: 2009 Andras Mantia <[email protected]>
6  SPDX-FileCopyrightText: 2013-2022 Laurent Montel <[email protected]>
7 
8  SPDX-License-Identifier: GPL-2.0-or-later
9 */
10 
11 // define this to copy all html that is written to the readerwindow to
12 // filehtmlwriter.out in the current working directory
13 //#define KMAIL_READER_HTML_DEBUG 1
14 
15 #include "viewer.h"
16 #include "csshelper.h"
17 #include "dkim-verify/dkimwidgetinfo.h"
18 #include "settings/messageviewersettings.h"
19 #include "viewer/mimeparttree/mimeparttreeview.h"
20 #include "viewer/mimeparttree/mimetreemodel.h"
21 #include "viewer/webengine/mailwebengineview.h"
22 #include "viewer_p.h"
23 #include "widgets/configurewidget.h"
24 #include "widgets/zoomactionmenu.h"
25 #include <Akonadi/ItemFetchJob>
26 #include <Akonadi/ItemFetchScope>
27 #include <Akonadi/MessageParts>
28 #include <QUrl>
29 #include <WebEngineViewer/WebEngineManageScript>
30 #include <WebEngineViewer/WebHitTestResult>
31 
32 #include <MailTransportAkonadi/ErrorAttribute>
33 
34 #include <KLocalizedString>
35 
36 #include <QAction>
37 
38 namespace MessageViewer
39 {
40 class AbstractMessageLoadedHandler::AbstractMessageLoadedHandlerPrivate
41 {
42 public:
43  Akonadi::Session *mSession = nullptr;
44 };
45 
46 AbstractMessageLoadedHandler::AbstractMessageLoadedHandler()
47  : d(new AbstractMessageLoadedHandlerPrivate)
48 {
49 }
50 
51 AbstractMessageLoadedHandler::~AbstractMessageLoadedHandler() = default;
52 
53 void AbstractMessageLoadedHandler::setSession(Akonadi::Session *session)
54 {
55  d->mSession = session;
56 }
57 
58 Akonadi::Session *AbstractMessageLoadedHandler::session() const
59 {
60  return d->mSession;
61 }
62 
63 Viewer::Viewer(QWidget *aParent, QWidget *mainWindow, KActionCollection *actionCollection)
64  : QWidget(aParent)
65  , d_ptr(new ViewerPrivate(this, mainWindow, actionCollection))
66 {
67  initialize();
68 }
69 
70 // the d_ptr is automatically deleted
71 Viewer::~Viewer() = default;
72 
73 void Viewer::initialize()
74 {
75  connect(d_ptr, &ViewerPrivate::displayPopupMenu, this, &Viewer::displayPopupMenu);
76  connect(d_ptr, &ViewerPrivate::popupMenu, this, &Viewer::popupMenu);
77  connect(d_ptr, SIGNAL(urlClicked(Akonadi::Item, QUrl)), SIGNAL(urlClicked(Akonadi::Item, QUrl)));
78  connect(d_ptr, &ViewerPrivate::requestConfigSync, this, &Viewer::requestConfigSync);
79  connect(d_ptr, &ViewerPrivate::makeResourceOnline, this, &Viewer::makeResourceOnline);
80  connect(d_ptr, &ViewerPrivate::showReader, this, &Viewer::showReader);
81  connect(d_ptr, &ViewerPrivate::showMessage, this, &Viewer::showMessage);
82  connect(d_ptr, &ViewerPrivate::replyMessageTo, this, &Viewer::replyMessageTo);
83  connect(d_ptr, &ViewerPrivate::showStatusBarMessage, this, &Viewer::showStatusBarMessage);
84  connect(d_ptr, &ViewerPrivate::itemRemoved, this, &Viewer::itemRemoved);
85  connect(d_ptr, &ViewerPrivate::changeDisplayMail, this, &Viewer::slotChangeDisplayMail);
86  connect(d_ptr, &ViewerPrivate::moveMessageToTrash, this, &Viewer::moveMessageToTrash);
87  connect(d_ptr, &ViewerPrivate::pageIsScrolledToBottom, this, &Viewer::pageIsScrolledToBottom);
88  connect(d_ptr, &ViewerPrivate::printingFinished, this, &Viewer::printingFinished);
89  connect(d_ptr, &ViewerPrivate::zoomChanged, this, &Viewer::zoomChanged);
90 
91  connect(d_ptr, &ViewerPrivate::showNextMessage, this, &Viewer::showNextMessage);
92  connect(d_ptr, &ViewerPrivate::showPreviousMessage, this, &Viewer::showPreviousMessage);
93 
94  setMessage(KMime::Message::Ptr(), MimeTreeParser::Delayed);
95 
96 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
97  connect(qApp, &QApplication::paletteChanged, this, &Viewer::slotGeneralPaletteChanged);
98 #endif
99 }
100 
101 void Viewer::slotGeneralPaletteChanged()
102 {
103  Q_D(Viewer);
104  d->updatePalette();
105 }
106 
107 void Viewer::changeEvent(QEvent *event)
108 {
109  Q_D(Viewer);
110  if (event->type() == QEvent::FontChange) {
111  d->slotGeneralFontChanged();
112  }
114 }
115 
116 void Viewer::setMessage(const KMime::Message::Ptr &message, MimeTreeParser::UpdateMode updateMode)
117 {
118  Q_D(Viewer);
119  if (message == d->message()) {
120  return;
121  }
122  d->setMessage(message, updateMode);
123 }
124 
125 void Viewer::setMessageItem(const Akonadi::Item &item, MimeTreeParser::UpdateMode updateMode)
126 {
127  Q_D(Viewer);
128  if (d->messageItem() == item) {
129  return;
130  }
131  if (!item.isValid() || item.loadedPayloadParts().contains(Akonadi::MessagePart::Body)) {
132  d->setMessageItem(item, updateMode);
133  } else {
135  connect(job, &Akonadi::ItemFetchJob::result, [d](KJob *job) {
136  d->itemFetchResult(job);
137  });
138  d->displaySplashPage(i18n("Loading message..."));
139  }
140 }
141 
143 {
144  Q_D(const Viewer);
145  return d->mMessagePath;
146 }
147 
149 {
150  Q_D(Viewer);
151  d->mMessagePath = path;
152 }
153 
154 void Viewer::displaySplashPage(const QString &templateName, const QVariantHash &data, const QByteArray &domain)
155 {
156  Q_D(Viewer);
157  d->displaySplashPage(templateName, data, domain);
158 }
159 
161 {
162  Q_D(Viewer);
163  d->enableMessageDisplay();
164 }
165 
167 {
168  Q_D(Viewer);
169  d->printMessage(msg);
170 }
171 
172 void Viewer::printPreviewMessage(const Akonadi::Item &message)
173 {
174  Q_D(Viewer);
175  d->printPreviewMessage(message);
176 }
177 
178 void Viewer::printPreview()
179 {
180  Q_D(Viewer);
181  d->slotPrintPreview();
182 }
183 
185 {
186  Q_D(Viewer);
187  d->slotPrintMessage();
188 }
189 
190 void Viewer::resizeEvent(QResizeEvent *)
191 {
192  Q_D(Viewer);
193  if (!d->mResizeTimer.isActive()) {
194  //
195  // Combine all resize operations that are requested as long a
196  // the timer runs.
197  //
198  d->mResizeTimer.start(100);
199  }
200 }
201 
203 {
204  Q_D(Viewer);
206  d->writeConfig();
207 }
208 
209 void Viewer::slotAttachmentSaveAs()
210 {
211  Q_D(Viewer);
212  d->slotAttachmentSaveAs();
213 }
214 
215 void Viewer::slotAttachmentSaveAll()
216 {
217  Q_D(Viewer);
218  d->slotAttachmentSaveAll();
219 }
220 
221 void Viewer::slotSaveMessage()
222 {
223  Q_D(Viewer);
224  d->slotSaveMessage();
225 }
226 
228 {
229  Q_D(Viewer);
230  d->mViewer->scrollUp(10);
231 }
232 
233 void Viewer::slotScrollDown()
234 {
235  Q_D(Viewer);
236  d->mViewer->scrollDown(10);
237 }
238 
240 {
241  Q_D(const Viewer);
242  d->mViewer->isScrolledToBottom();
243 }
244 
245 void Viewer::slotJumpDown()
246 {
247  Q_D(Viewer);
248  d->mViewer->scrollPageDown(100);
249 }
250 
251 void Viewer::slotScrollPrior()
252 {
253  Q_D(Viewer);
254  d->mViewer->scrollPageUp(80);
255 }
256 
257 void Viewer::slotScrollNext()
258 {
259  Q_D(Viewer);
260  d->mViewer->scrollPageDown(80);
261 }
262 
263 QString Viewer::selectedText() const
264 {
265  Q_D(const Viewer);
266  return d->mViewer->selectedText();
267 }
268 
269 Viewer::DisplayFormatMessage Viewer::displayFormatMessageOverwrite() const
270 {
271  Q_D(const Viewer);
272  return d->displayFormatMessageOverwrite();
273 }
274 
275 void Viewer::setDisplayFormatMessageOverwrite(Viewer::DisplayFormatMessage format)
276 {
277  Q_D(Viewer);
278  d->setDisplayFormatMessageOverwrite(format);
279 }
280 
281 void Viewer::setHtmlLoadExtDefault(bool loadExtDefault)
282 {
283  Q_D(Viewer);
284  d->setHtmlLoadExtDefault(loadExtDefault);
285 }
286 
287 void Viewer::setHtmlLoadExtOverride(bool loadExtOverride)
288 {
289  Q_D(Viewer);
290  d->setHtmlLoadExtOverride(loadExtOverride);
291 }
292 
294 {
295  Q_D(const Viewer);
296  return d->htmlLoadExtOverride();
297 }
298 
299 bool Viewer::htmlMail() const
300 {
301  Q_D(const Viewer);
302  return d->htmlMail();
303 }
304 
306 {
307  Q_D(const Viewer);
308  return d->htmlLoadExternal();
309 }
310 
311 bool Viewer::isFixedFont() const
312 {
313  Q_D(const Viewer);
314  return d->mUseFixedFont;
315 }
316 
317 void Viewer::setUseFixedFont(bool useFixedFont)
318 {
319  Q_D(Viewer);
320  d->setUseFixedFont(useFixedFont);
321 }
322 
323 QWidget *Viewer::mainWindow()
324 {
325  Q_D(Viewer);
326  return d->mMainWindow;
327 }
328 
330 {
331  Q_D(Viewer);
332  d->setDecryptMessageOverwrite(overwrite);
333 }
334 
336 {
337  Q_D(const Viewer);
338  return d->mMessage;
339 }
340 
342 {
343  Q_D(const Viewer);
344  return d->mMessageItem;
345 }
346 
348 {
349  Q_D(Viewer);
350  if (e->type() == QEvent::PaletteChange) {
351  d->recreateCssHelper();
352  d->update(MimeTreeParser::Force);
353  e->accept();
354  return true;
355  }
356 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
357  else if (e->type() == QEvent::ApplicationPaletteChange) {
358  slotGeneralPaletteChanged();
359  }
360 #endif
361 
362  return QWidget::event(e);
363 }
364 
365 void Viewer::slotFind()
366 {
367  Q_D(Viewer);
368  d->slotFind();
369 }
370 
371 const AttachmentStrategy *Viewer::attachmentStrategy() const
372 {
373  Q_D(const Viewer);
374  return d->attachmentStrategy();
375 }
376 
377 void Viewer::setAttachmentStrategy(const AttachmentStrategy *strategy)
378 {
379  Q_D(Viewer);
380  d->setAttachmentStrategy(strategy);
381 }
382 
383 QString Viewer::overrideEncoding() const
384 {
385  Q_D(const Viewer);
386  return d->overrideEncoding();
387 }
388 
389 void Viewer::setOverrideEncoding(const QString &encoding)
390 {
391  Q_D(Viewer);
392  d->setOverrideEncoding(encoding);
393 }
394 
395 CSSHelper *Viewer::cssHelper() const
396 {
397  Q_D(const Viewer);
398  return d->cssHelper();
399 }
400 
401 KToggleAction *Viewer::toggleFixFontAction() const
402 {
403  Q_D(const Viewer);
404  return d->mToggleFixFontAction;
405 }
406 
407 bool Viewer::mimePartTreeIsEmpty() const
408 {
409  Q_D(const Viewer);
410  return d->mimePartTreeIsEmpty();
411 }
412 
413 KToggleAction *Viewer::toggleMimePartTreeAction() const
414 {
415  Q_D(const Viewer);
416  return d->mToggleMimePartTreeAction;
417 }
418 
419 QAction *Viewer::selectAllAction() const
420 {
421  Q_D(const Viewer);
422  return d->mSelectAllAction;
423 }
424 
425 QAction *Viewer::viewSourceAction() const
426 {
427  Q_D(const Viewer);
428  return d->mViewSourceAction;
429 }
430 
431 QAction *Viewer::copyURLAction() const
432 {
433  Q_D(const Viewer);
434  return d->mCopyURLAction;
435 }
436 
437 QAction *Viewer::copyAction() const
438 {
439  Q_D(const Viewer);
440  return d->mCopyAction;
441 }
442 
443 QAction *Viewer::speakTextAction() const
444 {
445  Q_D(const Viewer);
446  return d->mSpeakTextAction;
447 }
448 
449 QAction *Viewer::copyImageLocation() const
450 {
451  Q_D(const Viewer);
452  return d->mCopyImageLocation;
453 }
454 
455 QAction *Viewer::saveAsAction() const
456 {
457  Q_D(const Viewer);
458  return d->mSaveMessageAction;
459 }
460 
461 QAction *Viewer::urlOpenAction() const
462 {
463  Q_D(const Viewer);
464  return d->mUrlOpenAction;
465 }
466 
467 bool Viewer::printingMode() const
468 {
469  Q_D(const Viewer);
470  return d->printingMode();
471 }
472 
473 void Viewer::setPrinting(bool enable)
474 {
475  Q_D(Viewer);
476  d->setPrinting(enable);
477 }
478 
479 void Viewer::writeConfig(bool force)
480 {
481  Q_D(Viewer);
482  d->writeConfig(force);
483 }
484 
485 QUrl Viewer::urlClicked() const
486 {
487  Q_D(const Viewer);
488  return d->mClickedUrl;
489 }
490 
491 QUrl Viewer::imageUrlClicked() const
492 {
493  Q_D(const Viewer);
494  return d->imageUrl();
495 }
496 
497 void Viewer::update(MimeTreeParser::UpdateMode updateMode)
498 {
499  Q_D(Viewer);
500  d->update(updateMode);
501 }
502 
504 {
505  Q_D(Viewer);
506  d->setMessagePart(aMsgPart);
507 }
508 
509 void Viewer::clear(MimeTreeParser::UpdateMode updateMode)
510 {
511  setMessage(KMime::Message::Ptr(), updateMode);
512 }
513 
514 void Viewer::slotShowMessageSource()
515 {
516  Q_D(Viewer);
517  d->slotShowMessageSource();
518 }
519 
520 void Viewer::readConfig()
521 {
522  Q_D(Viewer);
523  d->readConfig();
524 }
525 
527 {
528  return d_func()->mMimePartTree->mimePartModel();
529 }
530 
532 {
533  Q_D(Viewer);
534  auto job = new Akonadi::ItemFetchJob(item, d->mSession);
535  job->fetchScope().fetchAllAttributes();
536  job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
537  job->fetchScope().fetchFullPayload(true);
538  job->fetchScope().setFetchRelations(true); // needed to know if we have notes or not
539  job->fetchScope().fetchAttribute<MailTransport::ErrorAttribute>();
540  return job;
541 }
542 
544 {
545  Q_D(Viewer);
546 
547  if (!handler) {
548  return;
549  }
550 
551  handler->setSession(d->mSession);
552  d->mMessageLoadedHandlers.insert(handler);
553 }
554 
556 {
557  Q_D(Viewer);
558 
559  d->mMessageLoadedHandlers.remove(handler);
560 }
561 
563 {
564  Q_D(Viewer);
565  Q_EMIT deleteMessage(d->messageItem());
566 }
567 
568 void Viewer::selectAll()
569 {
570  Q_D(Viewer);
571  d->selectAll();
572 }
573 
574 void Viewer::copySelectionToClipboard()
575 {
576  Q_D(Viewer);
577  d->slotCopySelectedText();
578 }
579 
580 void Viewer::setZoomFactor(qreal zoomFactor)
581 {
582  Q_D(Viewer);
583  d->mZoomActionMenu->setZoomFactor(zoomFactor);
584 }
585 
586 void Viewer::slotZoomReset()
587 {
588  Q_D(Viewer);
589  d->mZoomActionMenu->slotZoomReset();
590 }
591 
592 void Viewer::slotZoomIn()
593 {
594  Q_D(Viewer);
595  d->mZoomActionMenu->slotZoomIn();
596 }
597 
598 void Viewer::slotZoomOut()
599 {
600  Q_D(Viewer);
601  d->mZoomActionMenu->slotZoomOut();
602 }
603 
604 QAction *Viewer::findInMessageAction() const
605 {
606  Q_D(const Viewer);
607  return d->mFindInMessageAction;
608 }
609 
610 QAction *Viewer::shareTextAction() const
611 {
612  Q_D(const Viewer);
613  return d->mShareTextAction;
614 }
615 
616 void Viewer::slotChangeDisplayMail(Viewer::DisplayFormatMessage mode, bool loadExternal)
617 {
618  if ((htmlLoadExtOverride() != loadExternal) || (displayFormatMessageOverwrite() != mode)) {
619  setHtmlLoadExtOverride(loadExternal);
621  update(MimeTreeParser::Force);
622  }
623 }
624 
625 QAction *Viewer::saveMessageDisplayFormatAction() const
626 {
627  Q_D(const Viewer);
628  return d->mSaveMessageDisplayFormat;
629 }
630 
631 QAction *Viewer::resetMessageDisplayFormatAction() const
632 {
633  Q_D(const Viewer);
634  return d->mResetMessageDisplayFormat;
635 }
636 
637 QAction *Viewer::developmentToolsAction() const
638 {
639  Q_D(const Viewer);
640  return d->mDevelopmentToolsAction;
641 }
642 
643 KToggleAction *Viewer::disableEmoticonAction() const
644 {
645  Q_D(const Viewer);
646  return d->mDisableEmoticonAction;
647 }
648 
649 void Viewer::saveMainFrameScreenshotInFile(const QString &filename)
650 {
651  Q_D(Viewer);
652  d->saveMainFrameScreenshotInFile(filename);
653 }
654 
655 KActionMenu *Viewer::shareServiceUrlMenu() const
656 {
657  Q_D(const Viewer);
658  return d->mShareServiceUrlMenu;
659 }
660 
661 HeaderStylePlugin *Viewer::headerStylePlugin() const
662 {
663  Q_D(const Viewer);
664  return d->mHeaderStylePlugin;
665 }
666 
667 DKIMViewerMenu *Viewer::dkimViewerMenu()
668 {
669  Q_D(Viewer);
670  return d->dkimViewerMenu();
671 }
672 
673 RemoteContentMenu *Viewer::remoteContentMenu() const
674 {
675  Q_D(const Viewer);
676  return d->remoteContentMenu();
677 }
678 
679 void Viewer::setPluginName(const QString &pluginName)
680 {
681  Q_D(Viewer);
682  d->setPluginName(pluginName);
683 }
684 
685 void Viewer::showOpenAttachmentFolderWidget(const QList<QUrl> &urls)
686 {
687  Q_D(Viewer);
688  d->showSavedFileFolderWidget(urls, MessageViewer::OpenSavedFileFolderWidget::FileType::Attachment);
689 }
690 
691 QList<QAction *> Viewer::viewerPluginActionList(ViewerPluginInterface::SpecificFeatureTypes features)
692 {
693  Q_D(Viewer);
694  return d->viewerPluginActionList(features);
695 }
696 
697 QList<QAction *> Viewer::interceptorUrlActions(const WebEngineViewer::WebHitTestResult &result) const
698 {
699  Q_D(const Viewer);
700  return d->interceptorUrlActions(result);
701 }
702 
703 void Viewer::runJavaScript(const QString &code)
704 {
705  Q_D(Viewer);
706  d->mViewer->page()->runJavaScript(code, WebEngineViewer::WebEngineManageScript::scriptWordId());
707 }
708 
709 void Viewer::setPrintElementBackground(bool printElementBackground)
710 {
711  Q_D(Viewer);
712  d->mViewer->setPrintElementBackground(printElementBackground);
713 }
714 
715 bool Viewer::showSignatureDetails() const
716 {
717  Q_D(const Viewer);
718  return d->showSignatureDetails();
719 }
720 
721 void Viewer::setShowSignatureDetails(bool showDetails)
722 {
723  Q_D(Viewer);
724  d->setShowSignatureDetails(showDetails);
725 }
726 
727 bool Viewer::showEncryptionDetails() const
728 {
729  Q_D(const Viewer);
730  return d->showEncryptionDetails();
731 }
732 
733 void Viewer::hasMultiMessages(bool messages)
734 {
735  Q_D(Viewer);
736  d->hasMultiMessages(messages);
737 }
738 
739 void Viewer::updateShowMultiMessagesButton(bool enablePreviousButton, bool enableNextButton)
740 {
741  Q_D(Viewer);
742  d->updateShowMultiMessagesButton(enablePreviousButton, enableNextButton);
743 }
744 
745 void Viewer::setShowEncryptionDetails(bool showDetails)
746 {
747  Q_D(Viewer);
748  d->setShowEncryptionDetails(showDetails);
749 }
750 
751 qreal Viewer::webViewZoomFactor() const
752 {
753  Q_D(const Viewer);
754  return d->webViewZoomFactor();
755 }
756 
757 void Viewer::setWebViewZoomFactor(qreal factor)
758 {
759  Q_D(Viewer);
760  d->setWebViewZoomFactor(factor);
761 }
762 
763 MessageViewer::DKIMWidgetInfo *Viewer::dkimWidgetInfo()
764 {
765  Q_D(Viewer);
766  return d->mDkimWidgetInfo;
767 }
768 
769 void Viewer::exportToPdf(const QString &fileName)
770 {
771  Q_D(Viewer);
772  d->exportToPdf(fileName);
773 }
774 
775 void Viewer::showDevelopmentTools()
776 {
777  Q_D(Viewer);
778  d->slotShowDevelopmentTools();
779 }
780 
781 void Viewer::setIdentityManager(KIdentityManagement::IdentityManager *ident)
782 {
783  Q_D(Viewer);
784  d->setIdentityManager(ident);
785 }
786 
787 void Viewer::setFolderIdentity(uint folderIdentity)
788 {
789  Q_D(Viewer);
790  d->setFolderIdentity(folderIdentity);
791 }
792 
793 }
bool isValid() const
void paletteChanged(const QPalette &palette)
void itemRemoved()
Emitted when the item, previously set with setMessageItem, has been removed.
void popupMenu(const Akonadi::Item &msg, const QUrl &url, const QUrl &imageUrl, const QPoint &mousePos)
The user presses the right mouse button.
void setHtmlLoadExtOverride(bool loadExtOverride)
Override default load external references setting.
Definition: viewer.cpp:287
Akonadi::ItemFetchJob * createFetchJob(const Akonadi::Item &item)
Create an item fetch job that is suitable for using to fetch the message item that will be displayed ...
Definition: viewer.cpp:531
The DKIMWidgetInfo class.
Q_EMITQ_EMIT
void result(KJob *job)
const AKONADI_MIME_EXPORT char Body[]
void removeMessageLoadedHandler(AbstractMessageLoadedHandler *handler)
Removes the handler for actions that will be executed when the message has been loaded into the view.
Definition: viewer.cpp:555
void atBottom()
Returns true if the message view is scrolled to the bottom.
Definition: viewer.cpp:239
void closeEvent(QCloseEvent *) override
Some necessary event handling.
Definition: viewer.cpp:202
void update()
Viewer::DisplayFormatMessage displayFormatMessageOverwrite() const
Get the html override setting.
Definition: viewer.cpp:269
virtual bool event(QEvent *event) override
void setHtmlLoadExtDefault(bool loadExtDefault)
Default behavior for loading external references.
Definition: viewer.cpp:281
This is the main widget for the viewer.
Definition: viewer.h:94
void clear(MimeTreeParser::UpdateMode updateMode=MimeTreeParser::Delayed)
Convenience method to clear the reader and discard the current message.
Definition: viewer.cpp:509
void showReader(KMime::Content *aMsgPart, bool aHTML, const QString &encoding)
Emitted when the content should be shown in a separate window.
The WebHitTestResult class.
void printMessage(const Akonadi::Item &msg)
Sets a message as the current one and print it immediately.
Definition: viewer.cpp:166
void print()
Print the currently displayed message.
Definition: viewer.cpp:184
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
virtual void changeEvent(QEvent *event)
void enableMessageDisplay()
Enable the displaying of messages again after an splash (or other) page was displayed.
Definition: viewer.cpp:160
QAbstractItemModel * messageTreeModel() const
A QAIM tree model of the message structure.
Definition: viewer.cpp:526
void setMessage(const KMime::Message::Ptr &message, MimeTreeParser::UpdateMode updateMode=MimeTreeParser::Delayed)
Set the message that shall be shown.
Definition: viewer.cpp:116
QString i18n(const char *text, const TYPE &arg...)
void deleteMessage()
Initiates a delete, by sending a signal to delete the message item.
Definition: viewer.cpp:562
void setMessagePath(const QString &path)
Set the path to the message in terms of Akonadi collection hierarchy.
Definition: viewer.cpp:148
void setMessageItem(const Akonadi::Item &item, MimeTreeParser::UpdateMode updateMode=MimeTreeParser::Delayed)
Set the Akonadi item that will be displayed.
Definition: viewer.cpp:125
bool htmlLoadExtOverride() const
Get the load external references override setting.
Definition: viewer.cpp:293
void setDecryptMessageOverwrite(bool overwrite=true)
Enforce message decryption.
Definition: viewer.cpp:329
void slotScrollUp()
HTML Widget scrollbar and layout handling.
Definition: viewer.cpp:227
bool htmlLoadExternal() const
Is loading ext.
Definition: viewer.cpp:305
An interface to plug in a handler that is called when an message item has been loaded into the view.
Definition: viewer.h:64
Akonadi::Item messageItem() const
Returns the current message item displayed in the viewer.
Definition: viewer.cpp:341
void setDisplayFormatMessageOverwrite(Viewer::DisplayFormatMessage format)
Override default html mail setting.
Definition: viewer.cpp:275
void showMessage(const KMime::Message::Ptr &message, const QString &encoding)
Emitted when the message should be shown in a separate window.
QString messagePath() const
The path to the message in terms of Akonadi collection hierarchy.
Definition: viewer.cpp:142
KMime::Message::Ptr message() const
Returns the current message displayed in the viewer.
Definition: viewer.cpp:335
void displaySplashPage(const QString &templateName, const QVariantHash &data, const QByteArray &domain=QByteArray())
Display a generic HTML splash page instead of a message.
Definition: viewer.cpp:154
QEvent::Type type() const const
void addMessageLoadedHandler(AbstractMessageLoadedHandler *handler)
Adds a handler for actions that will be executed when the message has been loaded into the view.
Definition: viewer.cpp:543
Viewer(QWidget *parent, QWidget *widget=nullptr, KActionCollection *actionCollection=nullptr)
Create a mail viewer widget.
Definition: viewer.cpp:63
virtual void closeEvent(QCloseEvent *event)
void showStatusBarMessage(const QString &message)
Emitted when a status bar message is shown.
bool htmlMail() const
Is html mail to be supported? Takes into account override.
Definition: viewer.cpp:299
QSet< QByteArray > loadedPayloadParts() const
bool event(QEvent *e) override
Watch for palette changes.
Definition: viewer.cpp:347
QString message
void setMessagePart(KMime::Content *aMsgPart)
Instead of settings a message to be shown sets a message part to be shown.
Definition: viewer.cpp:503
Q_D(Todo)
void accept()
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu May 19 2022 03:53:26 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.