1 | /* |
2 | This file is part of the KDE project |
3 | SPDX-FileCopyrightText: 1999 Simon Hausmann <hausmann@kde.org> |
4 | SPDX-FileCopyrightText: 1999 David Faure <faure@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef _KPARTS_OPENURLARGUMENTS_H |
10 | #define _KPARTS_OPENURLARGUMENTS_H |
11 | |
12 | #include <kparts/kparts_export.h> |
13 | |
14 | #include <QMap> |
15 | #include <QSharedDataPointer> |
16 | #include <QString> |
17 | |
18 | namespace KParts |
19 | { |
20 | class OpenUrlArgumentsPrivate; |
21 | |
22 | /*! |
23 | * \class KParts::OpenUrlArguments |
24 | * \inheaderfile KParts/OpenUrlArguments |
25 | * \inmodule KParts |
26 | * |
27 | * \brief OpenUrlArguments is the set of arguments that specify |
28 | * how a URL should be opened by KParts::ReadOnlyPart::openUrl(). |
29 | * |
30 | * For instance reload() indicates that the url should be loaded |
31 | * from the network even if it matches the current url of the part. |
32 | * |
33 | * All setter methods in this class are for the class that calls openUrl |
34 | * (usually the hosting application), all the getter methods are for the part. |
35 | */ |
36 | class KPARTS_EXPORT OpenUrlArguments |
37 | { |
38 | public: |
39 | /*! |
40 | * |
41 | */ |
42 | OpenUrlArguments(); |
43 | OpenUrlArguments(const OpenUrlArguments &other); |
44 | OpenUrlArguments &operator=(const OpenUrlArguments &other); |
45 | ~OpenUrlArguments(); |
46 | |
47 | /*! |
48 | * Returns true to indicate that the part should reload the URL, |
49 | * i.e. the cache shouldn't be used (forced reload). |
50 | */ |
51 | bool reload() const; |
52 | /*! |
53 | * Indicates that the url should be loaded |
54 | * from the network even if it matches the current url of the part. |
55 | */ |
56 | void setReload(bool b); |
57 | |
58 | /*! |
59 | * xOffset is the horizontal scrolling of the part's widget |
60 | * (in case it's a scrollview). This is saved into the history |
61 | * and restored when going back in the history. |
62 | */ |
63 | int xOffset() const; |
64 | |
65 | /*! |
66 | * |
67 | */ |
68 | void setXOffset(int x); |
69 | |
70 | /*! |
71 | * yOffset is the vertical scrolling of the part's widget |
72 | * (in case it's a scrollview). This is saved into the history |
73 | * and restored when going back in the history. |
74 | */ |
75 | int yOffset() const; |
76 | |
77 | /*! |
78 | * |
79 | */ |
80 | void setYOffset(int y); |
81 | |
82 | /*! |
83 | * The mimetype to use when opening the url, when known by the calling application. |
84 | */ |
85 | QString mimeType() const; |
86 | |
87 | /*! |
88 | * |
89 | */ |
90 | void setMimeType(const QString &mime); |
91 | |
92 | /*! |
93 | * True if the user requested that the URL be opened. |
94 | * False if the URL should be opened due to an external event, like javascript popups |
95 | * or automatic redirections. |
96 | * This is true by default |
97 | * \since 4.1 |
98 | */ |
99 | bool actionRequestedByUser() const; |
100 | |
101 | /*! |
102 | * |
103 | */ |
104 | void setActionRequestedByUser(bool userRequested); |
105 | |
106 | /*! |
107 | * Meta-data to associate with the KIO operation that will be used to open the URL. |
108 | * |
109 | * This method can be used to add or retrieve metadata. |
110 | * \sa KIO::TransferJob |
111 | */ |
112 | QMap<QString, QString> &metaData(); |
113 | |
114 | /*! |
115 | * |
116 | */ |
117 | const QMap<QString, QString> &metaData() const; |
118 | |
119 | private: |
120 | QSharedDataPointer<OpenUrlArgumentsPrivate> d; |
121 | }; |
122 | |
123 | } // namespace |
124 | |
125 | #endif |
126 | |