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 OpenUrlArguments openurlarguments.h <KParts/OpenUrlArguments> |
24 | * |
25 | * @short OpenUrlArguments is the set of arguments that specify |
26 | * how a URL should be opened by KParts::ReadOnlyPart::openUrl(). |
27 | * |
28 | * For instance reload() indicates that the url should be loaded |
29 | * from the network even if it matches the current url of the part. |
30 | * |
31 | * All setter methods in this class are for the class that calls openUrl |
32 | * (usually the hosting application), all the getter methods are for the part. |
33 | */ |
34 | class KPARTS_EXPORT OpenUrlArguments |
35 | { |
36 | public: |
37 | OpenUrlArguments(); |
38 | OpenUrlArguments(const OpenUrlArguments &other); |
39 | OpenUrlArguments &operator=(const OpenUrlArguments &other); |
40 | ~OpenUrlArguments(); |
41 | |
42 | /** |
43 | * @return true to indicate that the part should reload the URL, |
44 | * i.e. the cache shouldn't be used (forced reload). |
45 | */ |
46 | bool reload() const; |
47 | /** |
48 | * Indicates that the url should be loaded |
49 | * from the network even if it matches the current url of the part. |
50 | */ |
51 | void setReload(bool b); |
52 | |
53 | /** |
54 | * xOffset is the horizontal scrolling of the part's widget |
55 | * (in case it's a scrollview). This is saved into the history |
56 | * and restored when going back in the history. |
57 | */ |
58 | int xOffset() const; |
59 | void setXOffset(int x); |
60 | |
61 | /** |
62 | * yOffset is the vertical scrolling of the part's widget |
63 | * (in case it's a scrollview). This is saved into the history |
64 | * and restored when going back in the history. |
65 | */ |
66 | int yOffset() const; |
67 | void setYOffset(int y); |
68 | |
69 | /** |
70 | * The mimetype to use when opening the url, when known by the calling application. |
71 | */ |
72 | QString mimeType() const; |
73 | void setMimeType(const QString &mime); |
74 | |
75 | /** |
76 | * True if the user requested that the URL be opened. |
77 | * False if the URL should be opened due to an external event, like javascript popups |
78 | * or automatic redirections. |
79 | * This is true by default |
80 | * @since 4.1 |
81 | */ |
82 | bool actionRequestedByUser() const; |
83 | void setActionRequestedByUser(bool userRequested); |
84 | |
85 | /** |
86 | * Meta-data to associate with the KIO operation that will be used to open the URL. |
87 | * This method can be used to add or retrieve metadata. |
88 | * @see KIO::TransferJob etc. |
89 | */ |
90 | QMap<QString, QString> &metaData(); |
91 | const QMap<QString, QString> &metaData() const; |
92 | |
93 | private: |
94 | QSharedDataPointer<OpenUrlArgumentsPrivate> d; |
95 | }; |
96 | |
97 | } // namespace |
98 | |
99 | #endif |
100 | |