File indexing completed on 2024-04-21 04:58:21

0001 /* This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2000 Simon Hausmann <hausmann@kde.org>
0003     SPDX-FileCopyrightText: 2000-2006 David Faure <faure@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KONQUERORADAPTOR_H
0009 #define KONQUERORADAPTOR_H
0010 
0011 #include <QStringList>
0012 #include <QDBusObjectPath>
0013 #include <QDBusMessage>
0014 
0015 #define KONQ_MAIN_PATH "/KonqMain"
0016 
0017 /**
0018  * DBus interface of a konqueror process
0019  */
0020 class KonquerorAdaptor : public QObject
0021 {
0022     Q_OBJECT
0023     Q_CLASSINFO("D-Bus Interface", "org.kde.Konqueror.Main")
0024 
0025 public:
0026 
0027     KonquerorAdaptor();
0028     ~KonquerorAdaptor() override;
0029 
0030 public slots:
0031 
0032     /**
0033      * Opens a new window for the given @p url (using createSimpleWindow, i.e. a single view)
0034      * @param url the url to open
0035      * @param startup_id sets the application startup notification (ASN) property on the window, if not empty.
0036      * @return the DBUS object path of the window
0037      */
0038     QDBusObjectPath openBrowserWindow(const QString &url, const QByteArray &startup_id);
0039 
0040     /**
0041      * Opens a new window for the given @p url (using createNewWindow)
0042      * @param url the url to open
0043      * @param mimetype pass the mimetype of the url, if known, to speed up the process.
0044      * @param startup_id sets the application startup notification (ASN) property on the window, if not empty.
0045      * @param tempFile whether to delete the file after use, usually this is false
0046      * @return the DBUS object path of the window
0047      */
0048     QDBusObjectPath createNewWindow(const QString &url, const QString &mimetype, const QByteArray &startup_id, bool tempFile);
0049 
0050     /**
0051      * Opens a new window like @ref createNewWindow, then selects the given @p filesToSelect
0052      * @param filesToSelect the files to select in the newly opened file-manager window
0053      * @param startup_id sets the application startup notification (ASN) property on the window, if not empty.
0054      * @return the DBUS object path of the window
0055      */
0056     QDBusObjectPath createNewWindowWithSelection(const QString &url, const QStringList &filesToSelect, const QByteArray &startup_id);
0057 
0058     /**
0059      * @return a list of references to all the windows
0060      */
0061     QList<QDBusObjectPath> getWindows();
0062 
0063     /**
0064      * @return a list of all URLs currently opened in this process
0065      * Convenience function to avoid iterating over windows by hand.
0066      */
0067     QStringList urls() const;
0068 
0069     /**
0070      * Find a window which can be used for a new tab. Called by kfmclient.
0071      */
0072     QDBusObjectPath windowForTab();
0073 
0074 Q_SIGNALS:
0075     /**
0076      * Emitted by kcontrol when the global configuration changes
0077      */
0078     void reparseConfiguration();
0079     /**
0080      * Used internally by Konqueror to notify all instances when a URL should be added to the combobox.
0081      */
0082     void addToCombo(const QString &url, const QDBusMessage &msg);
0083     /**
0084      * Used internally by Konqueror to notify all instances when a URL should be removed from the combobox.
0085      */
0086     void removeFromCombo(const QString &url, const QDBusMessage &msg);
0087     /**
0088      * Used internally by Konqueror to notify all instances when the combobox should be cleared.
0089      */
0090     void comboCleared(const QDBusMessage &msg);
0091 };
0092 
0093 #endif