Messagelib

urlhandlermanager.h
1 /* -*- c++ -*-
2  urlhandlermanager.h
3 
4  This file is part of KMail, the KDE mail client.
5  Copyright (c) 2003 Marc Mutz <[email protected]>
6  Copyright (C) 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected]
7  Copyright (c) 2009 Andras Mantia <[email protected]>
8 
9  KMail is free software; you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  KMail is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 
23  In addition, as a special exception, the copyright holders give
24  permission to link the code of this program with any edition of
25  the Qt library by Trolltech AS, Norway (or with modified versions
26  of Qt that use the same license as Qt), and distribute linked
27  combinations including the two. You must obey the GNU General
28  Public License in all respects for all of the code used other than
29  Qt. If you modify this file, you may extend this exception to
30  your version of the file, but you are not obligated to do so. If
31  you do not wish to do so, delete this exception statement from
32  your version.
33 */
34 
35 #ifndef MESSAGEVIEWER_URLHANDLERMANAGER_H
36 #define MESSAGEVIEWER_URLHANDLERMANAGER_H
37 
38 #include "messageviewer_private_export.h"
39 
40 #include <QVector>
41 
42 class QUrl;
43 class QString;
44 class QPoint;
45 
46 namespace MimeTreeParser {
47 class URLHandler;
48 }
49 
50 namespace MessageViewer {
51 namespace Interface {
52 class BodyPartURLHandler;
53 }
54 class ViewerPrivate;
55 class BodyPartURLHandlerManager;
60 class MESSAGEVIEWER_TESTS_EXPORT URLHandlerManager
61 {
62  static URLHandlerManager *self;
63 
64  URLHandlerManager();
65 public:
66  ~URLHandlerManager();
67 
68  static URLHandlerManager *instance();
69 
70  void registerHandler(const MimeTreeParser::URLHandler *handler);
71  void unregisterHandler(const MimeTreeParser::URLHandler *handler);
72 
73  void registerHandler(const Interface::BodyPartURLHandler *handler, const QString &mimeType);
74  void unregisterHandler(const Interface::BodyPartURLHandler *handler);
75 
76  Q_REQUIRED_RESULT bool handleClick(const QUrl &url, ViewerPrivate *w = nullptr) const;
77  Q_REQUIRED_RESULT bool handleShiftClick(const QUrl &url, ViewerPrivate *window = nullptr) const;
78  Q_REQUIRED_RESULT bool handleContextMenuRequest(const QUrl &url, const QPoint &p, ViewerPrivate *w = nullptr) const;
79  Q_REQUIRED_RESULT bool willHandleDrag(const QUrl &url, ViewerPrivate *window = nullptr) const;
80  Q_REQUIRED_RESULT bool handleDrag(const QUrl &url, ViewerPrivate *window = nullptr) const;
81  Q_REQUIRED_RESULT QString statusBarMessage(const QUrl &url, ViewerPrivate *w = nullptr) const;
82 
83 private:
85  HandlerList mHandlers;
86  BodyPartURLHandlerManager *mBodyPartURLHandlerManager = nullptr;
87 };
88 }
89 
90 #endif // MESSAGEVIEWER_URLHANDLERMANAGER_H
An interface to body part reader link handlers.
Singleton to manage the list of URLHandlers.
An interface to reader link handlers.
Definition: urlhandler.h:51
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jun 4 2020 23:07:03 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.