⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 browserextension.h

📁 将konqueror浏览器移植到ARM9 2410中
💻 H
📖 第 1 页 / 共 2 页
字号:
/* This file is part of the KDE project   Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>                      David Faure <faure@kde.org>   This library is free software; you can redistribute it and/or   modify it under the terms of the GNU Library General Public   License as published by the Free Software Foundation; either   version 2 of the License, or (at your option) any later version.   This library is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   Library General Public License for more details.   You should have received a copy of the GNU Library General Public License   along with this library; see the file COPYING.LIB.  If not, write to   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,   Boston, MA 02111-1307, USA.*/#ifndef __kparts_browserextension_h__#define __kparts_browserextension_h__#include <sys/types.h>#include <qpoint.h>#include <qlist.h>#include <qdatastream.h>#include <kparts/part.h>#include <kparts/event.h>class KFileItem;typedef QList<KFileItem> KFileItemList;class QString;namespace KParts {class BrowserInterface;struct URLArgsPrivate;/** * URLArgs is a set of arguments bundled into a structure, * to allow specifying how a URL should be opened by openURL(). * In other words, this is like arguments to openURL(), but without * have to change the signature of openURL() (since openURL is a * generic KParts method). * The parts (with a browser extension) who care about urlargs will * use those arguments, others will ignore them. * * This can also be used the other way round, when a part asks * for a URL to be opened (with openURLRequest or createNewWindow). */struct URLArgs{  URLArgs();  URLArgs( const URLArgs &args );  URLArgs &operator=( const URLArgs &args);  URLArgs( bool reload, int xOffset, int yOffset, const QString &serviceType = QString::null );  virtual ~URLArgs();  /**   * This buffer can be used by the part to save and restore its contents.   * See KHTMLPart for instance.   */  QStringList docState;  /**   * @p reload is set when the cache shouldn't be used (forced reload)   */  bool reload;  /**   * @p xOffset is the horizontal scrolling of the part's widget   * (in case it's a scrollview). This is saved into the history   * and restored when going back in the history.   */  int xOffset;  /**   * @p yOffset vertical scrolling position, @see xOffset   */  int yOffset;  /**   * The servicetype (usually mimetype) to use when opening the next URL.   */  QString serviceType;  /**   * KHTML-specific field, contents of the HTTP POST data   */  QByteArray postData;  /**   * KHTML-specific field, header defining the type of the POST data.   */  void setContentType( const QString & contentType );  /**   * KHTML-specific field, header defining the type of the POST data.   */  QString contentType() const;  /**   * KHTML-specific field, whether to do a POST instead of a GET,   * for the next openURL   */  void setDoPost( bool enable );  /**   * KHTML-specific field, whether to do a POST instead of a GET,   * for the next openURL   */  bool doPost() const;  /**   * Whether to lock the history when opening the next URL.   * This is used during e.g. a redirection, to avoid a new entry   * in the history   */  void setLockHistory( bool lock );  bool lockHistory() const;  /**   * Meta-data to associate with the next KIO operation   * (@see KIO::TransferJob etc.)   */  QMap<QString, QString> &metaData();  /**   * The frame in which to open the URL. KHTML/Konqueror-specific   */  QString frameName;  /**   * If true, the part who asks for a URL to be opened can be 'trusted'   * to execute applications. For instance, the directory views can be   * 'trusted' whereas HTML pages are not trusted in that respect.   */  bool trustedSource;  URLArgsPrivate *d;};struct WindowArgsPrivate;/** * The WindowArgs are used to specify arguments to the "create new window" * call (see the createNewWindow variant that uses WindowArgs). * The primary reason for this is the javascript window.open function. */struct WindowArgs{    WindowArgs();    WindowArgs( const WindowArgs &args );    WindowArgs &operator=( const WindowArgs &args );    WindowArgs( const QRect &_geometry, bool _fullscreen, bool _menuBarVisible,                bool _toolBarsVisible, bool _statusBarVisible, bool _resizable );    WindowArgs( int _x, int _y, int _width, int _height, bool _fullscreen,                bool _menuBarVisible, bool _toolBarsVisible,                bool _statusBarVisible, bool _resizable );    // Position    int x;    int y;    // Size    int width;    int height;    bool fullscreen; //defaults to false    bool menuBarVisible; //defaults to true    bool toolBarsVisible; //defaults to true    bool statusBarVisible; //defaults to true    bool resizable; //defaults to true    bool lowerWindow; //defaults to false    WindowArgsPrivate *d; // yes, I am paranoid :-)};class OpenURLEvent : public Event{public:  OpenURLEvent( ReadOnlyPart *part, const KURL &url, const URLArgs &args = URLArgs() );  virtual ~OpenURLEvent();  ReadOnlyPart *part() const { return m_part; }  KURL url() const { return m_url; }  URLArgs args() const { return m_args; }  static bool test( const QEvent *event ) { return Event::test( event, s_strOpenURLEvent ); }private:  static const char *s_strOpenURLEvent;  ReadOnlyPart *m_part;  KURL m_url;  URLArgs m_args;  class OpenURLEventPrivate;  OpenURLEventPrivate *d;};class BrowserExtensionPrivate; /**  * The Browser Extension is an extension (yes, no kidding) to  * KParts::ReadOnlyPart, which allows a better integration of parts  * with browsers (in particular Konqueror).  * Remember that ReadOnlyPart only has openURL(KURL), with no other settings.  * For full-fledged browsing, we need much more than that, including  * many arguments about how to open this URL (see URLArgs), allowing  * parts to save and restore their data into the back/forward history,  * allowing parts to control the location bar URL, to requests URLs  * to be opened by the hosting browser, etc.  *  * The part developer needs to define its own class derived from BrowserExtension,  * to implement the virtual methods [and the standard-actions slots, see below].  *  * The way to associate the BrowserExtension with the part is to simply  * create the BrowserExtension as a child of the part (in QObject's terms).  * The hosting application will look for it automatically.  *   * Another aspect of the browser integration is that a set of standard  * actions are provided by the browser, but implemented by the part  * (for the actions it supports).  *   * The following standard actions are defined by the host of the view :  *  * [selection-dependent actions]  * @li @p cut : Copy selected items to clipboard and store 'not cut' in clipboard.  * @li @p copy : Copy selected items to clipboard and store 'cut' in clipboard.  * @li @p paste : Paste clipboard into selected items.  * @li @p rename : Rename item in place.  * @li @p trash : Move selected items to trash.  * @li @p del : Delete selected items (couldn't call it delete!).  * @li @p shred : Shred selected items (secure deletion).  * @li @p properties : Show file/document properties.  * @li @p editMimeType : show file/document's mimetype properties.  *  * [normal actions]  * @li @p print : Print :-)  * @li @p reparseConfiguration : Re-read configuration and apply it.  * @li @p refreshMimeTypes : If the view uses mimetypes it should re-determine them.  *  *  * The view defines a slot with the name of the action in order to implement the action.  * The browser will detect the slot automatically and connect its action to it when  * appropriate (i.e. when the view is active).  *  *  * The selection-dependent actions are disabled by default and the view should  * enable them when the selection changes, emitting @ref enableAction().  *  * The normal actions do not depend on the selection.  * You need to enable 'print' when printing is possible - you can even do that  * in the constructor.  *  * A special case is the configuration slots, not connected to any action directly,  * and having parameters.  *  * [configuration slot]  * @li @p setSaveViewPropertiesLocally( bool ): If @p true, view properties are saved into .directory  *                                       otherwise, they are saved globally.  */class BrowserExtension : public QObject{  Q_OBJECT  Q_PROPERTY( bool urlDropHandling READ isURLDropHandlingEnabled WRITE setURLDropHandlingEnabled )public:  /**   * Constructor   *   * @param parent The KParts::ReadOnlyPart that this extension ... "extends" :)   * @param name An optional name for the extension.   */  BrowserExtension( KParts::ReadOnlyPart *parent,                    const char *name = 0L );  virtual ~BrowserExtension();  virtual void setURLArgs( const URLArgs &args );  virtual URLArgs urlArgs();  /**   * Returns the current x offset.   *   * For a scrollview, implement this using contentsX().   */  virtual int xOffset();  /**   * Returns the current y offset.   *   * For a scrollview, implement this using contentsY().   */  virtual int yOffset();  /**   * Used by the browser to save the current state of the view   * (in order to restore it if going back in navigation).   *   * If you want to save additionnal properties, reimplement it   * but don't forget to call the parent method (probably first).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -