File indexing completed on 2024-04-28 15:29:21
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 1999 Simon Hausmann <hausmann@kde.org> 0004 SPDX-FileCopyrightText: 1999 David Faure <faure@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef _KPARTS_OPENURLARGUMENTS_H 0010 #define _KPARTS_OPENURLARGUMENTS_H 0011 0012 #include <kparts/kparts_export.h> 0013 0014 #include <QMap> 0015 #include <QSharedDataPointer> 0016 #include <QString> 0017 0018 namespace KParts 0019 { 0020 class OpenUrlArgumentsPrivate; 0021 0022 /** 0023 * @class OpenUrlArguments openurlarguments.h <KParts/OpenUrlArguments> 0024 * 0025 * @short OpenUrlArguments is the set of arguments that specify 0026 * how a URL should be opened by KParts::ReadOnlyPart::openUrl(). 0027 * 0028 * For instance reload() indicates that the url should be loaded 0029 * from the network even if it matches the current url of the part. 0030 * 0031 * All setter methods in this class are for the class that calls openUrl 0032 * (usually the hosting application), all the getter methods are for the part. 0033 */ 0034 class KPARTS_EXPORT OpenUrlArguments 0035 { 0036 public: 0037 OpenUrlArguments(); 0038 OpenUrlArguments(const OpenUrlArguments &other); 0039 OpenUrlArguments &operator=(const OpenUrlArguments &other); 0040 ~OpenUrlArguments(); 0041 0042 /** 0043 * @return true to indicate that the part should reload the URL, 0044 * i.e. the cache shouldn't be used (forced reload). 0045 */ 0046 bool reload() const; 0047 /** 0048 * Indicates that the url should be loaded 0049 * from the network even if it matches the current url of the part. 0050 */ 0051 void setReload(bool b); 0052 0053 /** 0054 * xOffset is the horizontal scrolling of the part's widget 0055 * (in case it's a scrollview). This is saved into the history 0056 * and restored when going back in the history. 0057 */ 0058 int xOffset() const; 0059 void setXOffset(int x); 0060 0061 /** 0062 * yOffset is the vertical scrolling of the part's widget 0063 * (in case it's a scrollview). This is saved into the history 0064 * and restored when going back in the history. 0065 */ 0066 int yOffset() const; 0067 void setYOffset(int y); 0068 0069 /** 0070 * The mimetype to use when opening the url, when known by the calling application. 0071 */ 0072 QString mimeType() const; 0073 void setMimeType(const QString &mime); 0074 0075 /** 0076 * True if the user requested that the URL be opened. 0077 * False if the URL should be opened due to an external event, like javascript popups 0078 * or automatic redirections. 0079 * This is true by default 0080 * @since 4.1 0081 */ 0082 bool actionRequestedByUser() const; 0083 void setActionRequestedByUser(bool userRequested); 0084 0085 /** 0086 * Meta-data to associate with the KIO operation that will be used to open the URL. 0087 * This method can be used to add or retrieve metadata. 0088 * @see KIO::TransferJob etc. 0089 */ 0090 QMap<QString, QString> &metaData(); 0091 const QMap<QString, QString> &metaData() const; 0092 0093 private: 0094 QSharedDataPointer<OpenUrlArgumentsPrivate> d; 0095 }; 0096 0097 } // namespace 0098 0099 #endif