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

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 __KonqViewAdaptor_h__
0009 #define __KonqViewAdaptor_h__
0010 
0011 #include <QStringList>
0012 #include <QDBusObjectPath>
0013 
0014 class KonqView;
0015 
0016 /**
0017  * DBus interface for a konqueror view
0018  */
0019 class KonqViewAdaptor : public QObject
0020 {
0021     Q_OBJECT
0022     Q_CLASSINFO("D-Bus Interface", "org.kde.Konqueror.View")
0023 
0024 public:
0025 
0026     explicit KonqViewAdaptor(KonqView *view);
0027     ~KonqViewAdaptor() override;
0028 
0029 public slots:
0030 
0031     /**
0032      * Displays another URL, but without changing the view mode
0033      * (Make sure the part can display this URL)
0034      */
0035     void openUrl(const QString &url,
0036                  const QString &locationBarURL,
0037                  const QString &nameFilter);
0038 
0039     /**
0040      * Reload
0041      */
0042     void reload();
0043 
0044     /**
0045      * Change the type of view (i.e. loads a new konqueror view)
0046      * @param mimeType the mime type we want to show
0047      * @param serviceName allows to enforce a particular service to be chosen,
0048      *        @see KonqFactory.
0049      */
0050     bool changeViewMode(const QString &mimeType,
0051                         const QString &serviceName);
0052 
0053     /**
0054      * Call this to prevent next openUrl() call from changing history lists
0055      * Used when the same URL is reloaded (for instance with another view mode)
0056      */
0057     void lockHistory();
0058 
0059     /**
0060      * Stop loading
0061      */
0062     void stop();
0063 
0064     /**
0065      * Retrieve view's URL
0066      */
0067     QString url();
0068 
0069     /**
0070      * Get view's location bar URL, i.e. the one that the view signals
0071      * It can be different from url(), for instance if we display a index.html
0072      */
0073     QString locationBarURL();
0074 
0075     /**
0076      * @return the servicetype this view is currently displaying
0077      */
0078     QString serviceType();
0079 
0080     /**
0081      * @return the servicetypes this view is capable to display
0082      */
0083     QStringList serviceTypes();
0084 
0085     /**
0086      * @return the part embedded into this view
0087      */
0088     QDBusObjectPath part();
0089 
0090     /**
0091      * Enable/Disable the context popup menu for this view.
0092      */
0093     void enablePopupMenu(bool b);
0094 
0095     bool isPopupMenuEnabled() const;
0096 
0097     /*
0098      * Return length of history
0099      */
0100     uint historyLength()const;
0101 
0102     /*
0103      * Move forward in history "-1"
0104      */
0105     void goForward();
0106     /*
0107      * Move back in history "+1"
0108      */
0109     void goBack();
0110 
0111     bool canGoBack()const;
0112     bool canGoForward()const;
0113 
0114 private:
0115 
0116     KonqView *m_pView;
0117 
0118 };
0119 
0120 #endif
0121