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

📄 browserextension.cpp

📁 konqueror3 embedded版本, KDE环境下的当家浏览器的嵌入式版本源码包.
💻 CPP
📖 第 1 页 / 共 2 页
字号:
 /* This file is part of the KDE project   Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>             (C) 1999 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., 51 Franklin Street, Fifth Floor,   Boston, MA 02110-1301, USA.*/#include "browserextension.h"#include <qapplication.h>#include <qclipboard.h>#include <qtimer.h>#include <qobjectlist.h>#include <qmetaobject.h>#include <qregexp.h>#include <qstrlist.h>#include <qstylesheet.h>#include <kdebug.h>#include <klocale.h>#include <kmessagebox.h>#include <kstaticdeleter.h>#include <kurifilter.h>#include <assert.h>using namespace KParts;const char *OpenURLEvent::s_strOpenURLEvent = "KParts/BrowserExtension/OpenURLevent";class OpenURLEvent::OpenURLEventPrivate{public:  OpenURLEventPrivate()  {  }  ~OpenURLEventPrivate()  {  }};OpenURLEvent::OpenURLEvent( ReadOnlyPart *part, const KURL &url, const URLArgs &args ): Event( s_strOpenURLEvent ), m_part( part ), m_url( url ), m_args( args ){//  d = new OpenURLEventPrivate();}OpenURLEvent::~OpenURLEvent(){//  delete d;}namespace KParts{struct URLArgsPrivate{    URLArgsPrivate() {      doPost = false;      redirectedRequest = false;      lockHistory = false;      newTab = false;      forcesNewWindow = false;    }    QString contentType; // for POST    QMap<QString, QString> metaData;    bool doPost;    bool redirectedRequest;    bool lockHistory;    bool newTab;    bool forcesNewWindow;};}URLArgs::URLArgs(){  reload = false;  xOffset = 0;  yOffset = 0;  trustedSource = false;  d = 0L; // Let's build it on demand for now}URLArgs::URLArgs( bool _reload, int _xOffset, int _yOffset, const QString &_serviceType ){  reload = _reload;  xOffset = _xOffset;  yOffset = _yOffset;  serviceType = _serviceType;  d = 0L; // Let's build it on demand for now}URLArgs::URLArgs( const URLArgs &args ){  d = 0L;  (*this) = args;}URLArgs &URLArgs::operator=(const URLArgs &args){  if (this == &args) return *this;  delete d; d= 0;  reload = args.reload;  xOffset = args.xOffset;  yOffset = args.yOffset;  serviceType = args.serviceType;  postData = args.postData;  frameName = args.frameName;  docState = args.docState;  trustedSource = args.trustedSource;  if ( args.d )     d = new URLArgsPrivate( * args.d );  return *this;}URLArgs::~URLArgs(){  delete d;  d = 0;}void URLArgs::setContentType( const QString & contentType ){  if (!d)    d = new URLArgsPrivate;  d->contentType = contentType;}void URLArgs::setRedirectedRequest( bool redirected ){  if (!d)     d = new URLArgsPrivate;  d->redirectedRequest = redirected;}bool URLArgs::redirectedRequest () const{  return d ? d->redirectedRequest : false;}QString URLArgs::contentType() const{  return d ? d->contentType : QString::null;}QMap<QString, QString> &URLArgs::metaData(){  if (!d)     d = new URLArgsPrivate;  return d->metaData;}void URLArgs::setDoPost( bool enable ){    if ( !d )        d = new URLArgsPrivate;    d->doPost = enable;}bool URLArgs::doPost() const{    return d ? d->doPost : false;}void URLArgs::setLockHistory( bool lock ){  if (!d)     d = new URLArgsPrivate;  d->lockHistory = lock;}bool URLArgs::lockHistory() const{    return d ? d->lockHistory : false;}void URLArgs::setNewTab( bool newTab ){  if (!d)     d = new URLArgsPrivate;  d->newTab = newTab;}bool URLArgs::newTab() const{    return d ? d->newTab : false;}void URLArgs::setForcesNewWindow( bool forcesNewWindow ){  if (!d)     d = new URLArgsPrivate;  d->forcesNewWindow = forcesNewWindow;}bool URLArgs::forcesNewWindow() const{    return d ? d->forcesNewWindow : false;}namespace KParts{struct WindowArgsPrivate{};}WindowArgs::WindowArgs(){    x = y = width = height = -1;    fullscreen = false;    menuBarVisible = true;    toolBarsVisible = true;    statusBarVisible = true;    scrollBarsVisible = true;    resizable = true;    lowerWindow = false;    d = 0;}WindowArgs::WindowArgs( const WindowArgs &args ){    d = 0;    (*this) = args;}WindowArgs::~WindowArgs(){    delete d;}WindowArgs &WindowArgs::operator=( const WindowArgs &args ){    if ( this == &args ) return *this;    delete d; d = 0;    x = args.x;    y = args.y;    width = args.width;    height = args.height;    fullscreen = args.fullscreen;    menuBarVisible = args.menuBarVisible;    toolBarsVisible = args.toolBarsVisible;    statusBarVisible = args.statusBarVisible;    scrollBarsVisible = args.scrollBarsVisible;    resizable = args.resizable;    lowerWindow = args.lowerWindow;    /*    if ( args.d )    {      [ ... ]    }    */    return *this;}WindowArgs::WindowArgs( const QRect &_geometry, bool _fullscreen, bool _menuBarVisible,                        bool _toolBarsVisible, bool _statusBarVisible, bool _resizable ){    d = 0;    x = _geometry.x();    y = _geometry.y();    width = _geometry.width();    height = _geometry.height();    fullscreen = _fullscreen;    menuBarVisible = _menuBarVisible;    toolBarsVisible = _toolBarsVisible;    statusBarVisible = _statusBarVisible;    resizable = _resizable;    lowerWindow = false;}WindowArgs::WindowArgs( int _x, int _y, int _width, int _height, bool _fullscreen,                        bool _menuBarVisible, bool _toolBarsVisible,                        bool _statusBarVisible, bool _resizable ){    d = 0;    x = _x;    y = _y;    width = _width;    height = _height;    fullscreen = _fullscreen;    menuBarVisible = _menuBarVisible;    toolBarsVisible = _toolBarsVisible;    statusBarVisible = _statusBarVisible;    resizable = _resizable;    lowerWindow = false;}namespace KParts{// Internal class, use to store the status of the actionsclass KBitArray{public:    int val;    KBitArray() { val = 0; }    bool operator [](int index) { return (val & (1 << index)) ? true : false; }    void setBit(int index, bool value) {        if (value) val = val | (1 << index);        else val = val & ~(1 << index);    }};class BrowserExtensionPrivate{public:  BrowserExtensionPrivate()  {      m_browserInterface = 0;  }  ~BrowserExtensionPrivate()  {  }  struct DelayedRequest {    KURL m_delayedURL;    KParts::URLArgs m_delayedArgs;  };  QValueList<DelayedRequest> m_requests;  bool m_urlDropHandlingEnabled;  KBitArray m_actionStatus;  QMap<int, QString> m_actionText;  BrowserInterface *m_browserInterface;};}BrowserExtension::ActionSlotMap * BrowserExtension::s_actionSlotMap = 0L;static KStaticDeleter<BrowserExtension::ActionSlotMap> actionSlotMapsd;BrowserExtension::ActionNumberMap * BrowserExtension::s_actionNumberMap = 0L;static KStaticDeleter<BrowserExtension::ActionNumberMap> actionNumberMapsd;BrowserExtension::BrowserExtension( KParts::ReadOnlyPart *parent,                                    const char *name ): QObject( parent, name), m_part( parent ){  //kdDebug() << "BrowserExtension::BrowserExtension() " << this << endl;  d = new BrowserExtensionPrivate;  d->m_urlDropHandlingEnabled = false;  if ( !s_actionSlotMap )      // Create the action-slot map      createActionSlotMap();

⌨️ 快捷键说明

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