File indexing completed on 2024-04-14 04:52:46

0001 /* This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2017 David Faure <faure@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KONQ_CLIENT_REQUEST_H
0008 #define KONQ_CLIENT_REQUEST_H
0009 
0010 #include <QScopedPointer>
0011 
0012 class KonqClientRequestPrivate;
0013 class QUrl;
0014 
0015 /**
0016  * KonqClientRequest talks to a running Konqueror process, or starts a new one,
0017  * in order to create a new window or tab for a URL.
0018  *
0019  * Usage: each instance of KonqClientRequest is a separate request.
0020  */
0021 class KonqClientRequest
0022 {
0023 public:
0024     /**
0025      * Creates a KonqClientRequest instance
0026      */
0027     KonqClientRequest();
0028     /**
0029      * Destroys this KonqClientRequest instance
0030      */
0031     ~KonqClientRequest();
0032 
0033     /**
0034      * Sets the URL to open (mandatory)
0035      */
0036     void setUrl(const QUrl& url);
0037     /**
0038      * Sets whether to open the URL in a new tab (optional, defaults to false)
0039      */
0040     void setNewTab(bool newTab);
0041     /**
0042      * Sets whether the URL is a temp file that should be deleted after usage (optional, defaults to false)
0043      */
0044     void setTempFile(bool tempFile);
0045     /**
0046      * Sets the MIME type of the URL (optional)
0047      */
0048     void setMimeType(const QString &mimeType);
0049 
0050     /**
0051      * This is the main method, call it to trigger the opening of the URL,
0052      * once you have called all the relevant setters.
0053      */
0054     bool openUrl();
0055 
0056 private:
0057     Q_DISABLE_COPY(KonqClientRequest)
0058 
0059     QScopedPointer<KonqClientRequestPrivate> d;
0060 };
0061 
0062 #endif