MiniWeb::MiniWeb(QWidget *parent) : KWebView(parent) { load(QUrl("about:blank")); connect(page(), SIGNAL(linkHovered(QString, QString, QString)), this, SIGNAL(statusBarMessage(QString))); updateConfiguration(); m_vi_mode = true; m_loading = false; connect(this, SIGNAL(loadStarted()), this, SLOT(setLoading())); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setNotLoading(bool))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setStatusLoaded(bool))); connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(setPageChanged())); connect(this, SIGNAL(linkMiddleOrCtrlClicked(KUrl)), this, SLOT(openInNewWindow(KUrl))); connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(download(QNetworkRequest))); }
KWebKitPart::KWebKitPart(QWidget *parentWidget, QObject *parent, const QByteArray& cachedHistory, const QStringList& /*args*/) :KParts::ReadOnlyPart(parent), m_emitOpenUrlNotify(true), m_hasCachedFormData(false), m_doLoadFinishedActions(false), m_statusBarWalletLabel(0), m_searchBar(0), m_passwordBar(0), m_featurePermissionBar(0) { KAboutData about = KAboutData("kwebkitpart", i18nc("Program Name", "KWebKitPart"), /*version*/ "1.3.0", i18nc("Short Description", "QtWebKit Browser Engine Component"), KAboutLicense::LGPL, i18n("(C) 2009-2010 Dawit Alemayehu\n" "(C) 2008-2010 Urs Wolfer\n" "(C) 2007 Trolltech ASA")); about.addAuthor(i18n("Dawit Alemayehu"), i18n("Maintainer, Developer"), "*****@*****.**"); about.addAuthor(i18n("Urs Wolfer"), i18n("Maintainer, Developer"), "*****@*****.**"); about.addAuthor(i18n("Michael Howell"), i18n("Developer"), "*****@*****.**"); about.addAuthor(i18n("Laurent Montel"), i18n("Developer"), "*****@*****.**"); about.addAuthor(i18n("Dirk Mueller"), i18n("Developer"), "*****@*****.**"); about.setProductName("kwebkitpart/general"); // KComponentData componentData(&about); setComponentData(about, false /*don't load plugins yet*/); // NOTE: If the application does not set its version number, we automatically // set it to KDE's version number so that the default user-agent string contains // proper application version number information. See QWebPage::userAgentForUrl... if (QCoreApplication::applicationVersion().isEmpty()) QCoreApplication::setApplicationVersion(QString("%1.%2.%3") .arg(KDE::versionMajor()) .arg(KDE::versionMinor()) .arg(KDE::versionRelease())); setXMLFile(QL1S("kwebkitpart.rc")); // Create this KPart's widget QWidget *mainWidget = new QWidget (parentWidget); mainWidget->setObjectName("kwebkitpart"); // Create the WebView... m_webView = new WebView (this, parentWidget); // Create the browser extension. m_browserExtension = new WebKitBrowserExtension(this, cachedHistory); // Add status bar extension... m_statusBarExtension = new KParts::StatusBarExtension(this); // Add a web history interface for storing visited links. if (!QWebHistoryInterface::defaultInterface()) QWebHistoryInterface::setDefaultInterface(new WebHistoryInterface(this)); // Add text and html extensions... new KWebKitTextExtension(this); new KWebKitHtmlExtension(this); new KWebKitScriptableExtension(this); // Layout the GUI... QVBoxLayout* l = new QVBoxLayout(mainWidget); l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); l->addWidget(m_webView); mainWidget->setLayout(l); // Set the part's widget setWidget(mainWidget); // Set the web view as the the focus object mainWidget->setFocusProxy(m_webView); // Connect the signals from the webview connect(m_webView, SIGNAL(titleChanged(QString)), this, SIGNAL(setWindowCaption(QString))); connect(m_webView, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl))); connect(m_webView, SIGNAL(linkMiddleOrCtrlClicked(QUrl)), this, SLOT(slotLinkMiddleOrCtrlClicked(QUrl))); connect(m_webView, SIGNAL(selectionClipboardUrlPasted(QUrl,QString)), this, SLOT(slotSelectionClipboardUrlPasted(QUrl,QString))); connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool))); // Connect the signals from the page... connectWebPageSignals(page()); // Init the QAction we are going to use... initActions(); // Load plugins once we are fully ready loadPlugins(); }