Messagelib

bodyparturlhandler.h
1 /* -*- c++ -*-
2  interfaces/bodyparturlhandler.h
3 
4  This file is part of KMail's plugin interface.
5  SPDX-FileCopyrightText: 2003, 2004 Marc Mutz <[email protected]>
6 
7  SPDX-License-Identifier: GPL-2.0-or-later
8 */
9 
10 #pragma once
11 
12 class QString;
13 class QPoint;
14 
15 namespace MimeTreeParser
16 {
17 namespace Interface
18 {
19 class BodyPart;
20 }
21 }
22 
23 namespace MessageViewer
24 {
25 class Viewer;
26 }
27 
28 namespace MessageViewer
29 {
30 namespace Interface
31 {
32 /**
33  * @short An interface to body part reader link handlers
34  * @author Marc Mutz <[email protected]>
35  *
36  * This interface is a condensed of variant of the more general
37  * @see URLHandler interface, designed to make bodypart-dependent
38  * link operations possible without exposing KMail-internal
39  * classes.
40  *
41  * Implementation-wise, these handlers are called as a nested
42  * Chain Of Responsibility by an internal implementation of
43  * URLHandler.
44  *
45  * You can create a link whose handling is passed to this handler
46  * by using BodyPart::makeLink( const QString & path ). \a path is
47  * what * is passed back to the methods of this interface.
48  *
49  * Note that the BodyPart interface does not provide a means of
50  * learning the content type of the body part passed. This is
51  * intentional. It is expected that either separate
52  * BodyPartURLHandlers are created for these purposes or else the
53  * information encoded into the path parameter by the
54  * BodyPartFormatter.
55  */
57 {
58 public:
59  virtual ~BodyPartURLHandler() = default;
60 
61  virtual QString name() const = 0;
62  /** Called when LMB-clicking on a link in the reader. Should
63  start processing equivalent to "opening" the link.
64 
65  @return true if the click was handled by this handler, false
66  otherwise.
67  */
68  virtual bool handleClick(MessageViewer::Viewer *viewerInstance, MimeTreeParser::Interface::BodyPart *part, const QString &path) const = 0;
69 
70  /** Called when RMB-clicking on a link in the reader. Should
71  show a context menu at the specified point with the
72  specified widget as parent.
73 
74  @return true if the right-click was handled by this handler,
75  false otherwise.
76  */
77  virtual bool handleContextMenuRequest(MimeTreeParser::Interface::BodyPart *part, const QString &path, const QPoint &p) const = 0;
78 
79  /** Called when hovering over a link.
80 
81  @return a string to be shown in the status bar while
82  hovering over this link or QString() if the link was not
83  handled by this handler.
84  */
85  virtual QString statusBarMessage(MimeTreeParser::Interface::BodyPart *part, const QString &path) const = 0;
86 };
87 } // namespace Interface
88 }
89 
const QLatin1String name
This is the main widget for the viewer.
Definition: viewer.h:94
An interface to body part reader link handlers.
interface of message body parts.
Definition: bodypart.h:44
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Dec 4 2021 23:12:52 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.