KParts

browserarguments.cpp
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 #include "browserarguments.h"
10 
11 using namespace KParts;
12 
13 namespace KParts
14 {
15 struct BrowserArgumentsPrivate {
16  QString contentType; // for POST
17  bool doPost = false;
18  bool redirectedRequest = false;
19  bool lockHistory = false;
20  bool newTab = false;
21  bool forcesNewWindow = false;
22 };
23 
24 }
25 
26 BrowserArguments::BrowserArguments()
27 {
28  softReload = false;
29  trustedSource = false;
30  d = nullptr; // Let's build it on demand for now
31 }
32 
33 BrowserArguments::BrowserArguments(const BrowserArguments &args)
34 {
35  d = nullptr;
36  (*this) = args;
37 }
38 
39 BrowserArguments &BrowserArguments::operator=(const BrowserArguments &args)
40 {
41  if (this == &args) {
42  return *this;
43  }
44 
45  delete d;
46  d = nullptr;
47 
48  softReload = args.softReload;
49  postData = args.postData;
50  frameName = args.frameName;
51  docState = args.docState;
53 
54  if (args.d) {
55  d = new BrowserArgumentsPrivate(*args.d);
56  }
57 
58  return *this;
59 }
60 
61 BrowserArguments::~BrowserArguments()
62 {
63  delete d;
64  d = nullptr;
65 }
66 
67 void BrowserArguments::setContentType(const QString &contentType)
68 {
69  if (!d) {
70  d = new BrowserArgumentsPrivate;
71  }
72  d->contentType = contentType;
73 }
74 
76 {
77  if (!d) {
78  d = new BrowserArgumentsPrivate;
79  }
80  d->redirectedRequest = redirected;
81 }
82 
84 {
85  return d ? d->redirectedRequest : false;
86 }
87 
89 {
90  return d ? d->contentType : QString();
91 }
92 
93 void BrowserArguments::setDoPost(bool enable)
94 {
95  if (!d) {
96  d = new BrowserArgumentsPrivate;
97  }
98  d->doPost = enable;
99 }
100 
102 {
103  return d ? d->doPost : false;
104 }
105 
107 {
108  if (!d) {
109  d = new BrowserArgumentsPrivate;
110  }
111  d->lockHistory = lock;
112 }
113 
114 bool BrowserArguments::lockHistory() const
115 {
116  return d ? d->lockHistory : false;
117 }
118 
120 {
121  if (!d) {
122  d = new BrowserArgumentsPrivate;
123  }
124  d->newTab = newTab;
125 }
126 
127 bool BrowserArguments::newTab() const
128 {
129  return d ? d->newTab : false;
130 }
131 
132 void BrowserArguments::setForcesNewWindow(bool forcesNewWindow)
133 {
134  if (!d) {
135  d = new BrowserArgumentsPrivate;
136  }
137  d->forcesNewWindow = forcesNewWindow;
138 }
139 
141 {
142  return d ? d->forcesNewWindow : false;
143 }
QByteArray postData
KHTML-specific field, contents of the HTTP POST data.
void setRedirectedRequest(bool redirected)
Set the redirect flag to indicate URL is a result of either a META redirect or HTTP redirect.
void setNewTab(bool newTab)
Whether the URL should be opened in a new tab instead in a new window.
bool softReload
softReload is set when user just hits reload button.
QStringList docState
This buffer can be used by the part to save and restore its contents.
void setDoPost(bool enable)
KHTML-specific field, whether to do a POST instead of a GET, for the next openURL.
BrowserArguments is a set of web-browsing-specific arguments, which allow specifying how a URL should...
QString contentType() const
KHTML-specific field, header defining the type of the POST data.
QString frameName
The frame in which to open the URL.
void setLockHistory(bool lock)
Whether to lock the history when opening the next URL.
bool doPost() const
KHTML-specific field, whether to do a POST instead of a GET, for the next openURL.
void setContentType(const QString &contentType)
KHTML-specific field, header defining the type of the POST data.
bool trustedSource
If true, the part who asks for a URL to be opened can be 'trusted' to execute applications.
bool forcesNewWindow() const
Whether the URL specifies to be opened in a new window.
void setForcesNewWindow(bool forcesNewWindow)
Set whether the URL specifies to be opened in a new window.
The KParts namespace,.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Sep 23 2023 03:49:40 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.