Messagelib

urlhandlermanager.h
1 /* -*- c++ -*-
2  urlhandlermanager.h
3 
4  This file is part of KMail, the KDE mail client.
5  SPDX-FileCopyrightText: 2003 Marc Mutz <[email protected]>
6  SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected]
7  SPDX-FileCopyrightText: 2009 Andras Mantia <[email protected]>
8 
9  SPDX-License-Identifier: GPL-2.0-or-later
10 */
11 
12 #pragma once
13 
14 #include "messageviewer_private_export.h"
15 
16 #include <QList>
17 
18 class QUrl;
19 class QString;
20 class QPoint;
21 
22 namespace MimeTreeParser
23 {
24 class URLHandler;
25 }
26 
27 namespace MessageViewer
28 {
29 namespace Interface
30 {
31 class BodyPartURLHandler;
32 }
33 class ViewerPrivate;
34 class BodyPartURLHandlerManager;
35 /**
36  * @short Singleton to manage the list of URLHandlers
37  * @author Marc Mutz <[email protected]>
38  */
39 class MESSAGEVIEWER_TESTS_EXPORT URLHandlerManager
40 {
41  static URLHandlerManager *self;
42 
44 
45 public:
47 
48  static URLHandlerManager *instance();
49 
50  void registerHandler(const MimeTreeParser::URLHandler *handler);
51  void unregisterHandler(const MimeTreeParser::URLHandler *handler);
52 
53  void registerHandler(const Interface::BodyPartURLHandler *handler, const QString &mimeType);
54  void unregisterHandler(const Interface::BodyPartURLHandler *handler);
55 
56  [[nodiscard]] bool handleClick(const QUrl &url, ViewerPrivate *w = nullptr) const;
57  [[nodiscard]] bool handleShiftClick(const QUrl &url, ViewerPrivate *window = nullptr) const;
58  [[nodiscard]] bool handleContextMenuRequest(const QUrl &url, const QPoint &p, ViewerPrivate *w = nullptr) const;
59  [[nodiscard]] bool willHandleDrag(const QUrl &url, ViewerPrivate *window = nullptr) const;
60  [[nodiscard]] bool handleDrag(const QUrl &url, ViewerPrivate *window = nullptr) const;
61  [[nodiscard]] QString statusBarMessage(const QUrl &url, ViewerPrivate *w = nullptr) const;
62 
63 private:
65  HandlerList mHandlers;
66  BodyPartURLHandlerManager *mBodyPartURLHandlerManager = nullptr;
67 };
68 }
An interface to reader link handlers.
Definition: urlhandler.h:29
Singleton to manage the list of URLHandlers.
An interface to body part reader link handlers.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Nov 30 2023 03:56:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.