KParts

browserarguments.h
1 /*
2  This file is part of the KDE project
3  SPDX-FileCopyrightText: 1999 Simon Hausmann <[email protected]>
4  SPDX-FileCopyrightText: 1999 David Faure <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef __kparts_browserarguments_h__
10 #define __kparts_browserarguments_h__
11 
12 #include <kparts/kparts_export.h>
13 
14 #include <QByteArray>
15 #include <QStringList>
16 
17 namespace KParts
18 {
19 struct BrowserArgumentsPrivate;
20 
21 /**
22  * @struct BrowserArguments browserarguments.h <KParts/BrowserArguments>
23  *
24  * @short BrowserArguments is a set of web-browsing-specific arguments,
25  * which allow specifying how a URL should be opened by openUrl()
26  * (as a complement to KParts::OpenUrlArguments which are the non-web-specific arguments)
27  *
28  * The arguments remain stored in the browser extension after that,
29  * and can be used for instance to jump to the xOffset/yOffset position
30  * once the url has finished loading.
31  *
32  * The parts (with a browser extension) who care about urlargs will
33  * use those arguments, others will ignore them.
34  *
35  * This can also be used the other way round, when a part asks
36  * for a URL to be opened (with openUrlRequest or createNewWindow).
37  */
38 // KF6 TODO: move variables to private class and add accessors instead,
39 // for consistency
40 // KF6 TODO: make class instead of struct
41 struct KPARTS_EXPORT BrowserArguments {
43  BrowserArguments(const BrowserArguments &args);
44  BrowserArguments &operator=(const BrowserArguments &args);
45 
46  virtual ~BrowserArguments();
47 
48  /**
49  * This buffer can be used by the part to save and restore its contents.
50  * See KHTMLPart for instance.
51  */
53 
54  /**
55  * @p softReload is set when user just hits reload button. It's used
56  * currently for two different frameset reload strategies. In case of
57  * soft reload individual frames are reloaded instead of reloading whole
58  * frameset.
59  */
60  bool softReload;
61 
62  /**
63  * KHTML-specific field, contents of the HTTP POST data.
64  */
66 
67  /**
68  * KHTML-specific field, header defining the type of the POST data.
69  */
70  void setContentType(const QString &contentType);
71  /**
72  * KHTML-specific field, header defining the type of the POST data.
73  */
74  QString contentType() const;
75  /**
76  * KHTML-specific field, whether to do a POST instead of a GET,
77  * for the next openURL.
78  */
79  void setDoPost(bool enable);
80 
81  /**
82  * KHTML-specific field, whether to do a POST instead of a GET,
83  * for the next openURL.
84  */
85  bool doPost() const;
86 
87  /**
88  * Whether to lock the history when opening the next URL.
89  * This is used during e.g. a redirection, to avoid a new entry
90  * in the history.
91  */
92  void setLockHistory(bool lock);
93  bool lockHistory() const;
94 
95  /**
96  * Whether the URL should be opened in a new tab instead in a new window.
97  */
98  void setNewTab(bool newTab);
99  bool newTab() const;
100 
101  /**
102  * The frame in which to open the URL. KHTML/Konqueror-specific.
103  */
105 
106  /**
107  * If true, the part who asks for a URL to be opened can be 'trusted'
108  * to execute applications. For instance, the directory views can be
109  * 'trusted' whereas HTML pages are not trusted in that respect.
110  */
112 
113  /**
114  * @return true if the request was a result of a META refresh/redirect request or
115  * HTTP redirect.
116  */
117  bool redirectedRequest() const;
118 
119  /**
120  * Set the redirect flag to indicate URL is a result of either a META redirect
121  * or HTTP redirect.
122  *
123  * @param redirected
124  */
125  void setRedirectedRequest(bool redirected);
126 
127  /**
128  * Set whether the URL specifies to be opened in a new window.
129  *
130  * When openUrlRequest is emitted:
131  * <ul>
132  * <li>normally the url would be opened in the current view.</li>
133  * <li>setForcesNewWindow(true) specifies that a new window or tab should be used:
134  * setNewTab(true) requests a tab specifically, otherwise the user-preference is followed.
135  * This is typically used for target="_blank" in web browsers.</li>
136  * </ul>
137  *
138  * When createNewWindow is emitted:
139  * <ul>
140  * <li>if setNewTab(true) was called, a tab is created.</li>
141  * <li>otherwise, if setForcesNewWindow(true) was called, a window is created.</li>
142  * <li>otherwise the user preference is followed.</li>
143  * </ul>
144  */
145  void setForcesNewWindow(bool forcesNewWindow);
146 
147  /**
148  * Whether the URL specifies to be opened in a new window
149  */
150  bool forcesNewWindow() const;
151 
152 private:
153  BrowserArgumentsPrivate *d;
154 };
155 
156 }
157 
158 #endif
BrowserArguments is a set of web-browsing-specific arguments, which allow specifying how a URL should...
bool trustedSource
If true, the part who asks for a URL to be opened can be &#39;trusted&#39; to execute applications.
QStringList docState
This buffer can be used by the part to save and restore its contents.
bool softReload
softReload is set when user just hits reload button.
QString frameName
The frame in which to open the URL.
The KParts namespace,.
QByteArray postData
KHTML-specific field, contents of the HTTP POST data.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Dec 6 2021 22:49:15 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.