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 <mutz@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9
10#pragma once
11
12class QString;
13class QPoint;
14
15namespace MimeTreeParser
16{
17namespace Interface
18{
19class BodyPart;
20}
21}
22
23namespace MessageViewer
24{
25class Viewer;
26}
27
28namespace MessageViewer
29{
30namespace Interface
31{
32/**
33 * @short An interface to body part reader link handlers
34 * @author Marc Mutz <mutz@kde.org>
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{
58public:
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 */
86};
87} // namespace Interface
88}
An interface to body part reader link handlers.
virtual bool handleClick(MessageViewer::Viewer *viewerInstance, MimeTreeParser::Interface::BodyPart *part, const QString &path) const =0
Called when LMB-clicking on a link in the reader.
virtual QString statusBarMessage(MimeTreeParser::Interface::BodyPart *part, const QString &path) const =0
Called when hovering over a link.
virtual bool handleContextMenuRequest(MimeTreeParser::Interface::BodyPart *part, const QString &path, const QPoint &p) const =0
Called when RMB-clicking on a link in the reader.
This is the main widget for the viewer.
Definition viewer.h:97
interface of message body parts.
Definition bodypart.h:45
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.