mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-14 02:52:12 +01:00
Fixed showing of Click2Flash plugin
Added workaround for showing click2flash right after the plugin is created, no longer need to scroll / resize page Also fixed one crash in floating status bar message Also improved detection of object element on page
This commit is contained in:
parent
627fcd1d7b
commit
b2056321ef
18
BUILDING
18
BUILDING
|
@ -11,6 +11,12 @@ General
|
||||||
QupZilla by clicking from Help Menu to Informations about program, then in
|
QupZilla by clicking from Help Menu to Informations about program, then in
|
||||||
Path section.
|
Path section.
|
||||||
|
|
||||||
|
You may want to build QupZilla with debugging symbols (for generating
|
||||||
|
backtrace of crash) as easily as adding one line to QupZilla.pro:
|
||||||
|
|
||||||
|
CONFIG += debug
|
||||||
|
|
||||||
|
|
||||||
Microsoft Windows
|
Microsoft Windows
|
||||||
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -36,12 +42,10 @@ OS/2
|
||||||
machine with OS/2, but it is possible to get QupZilla working there.
|
machine with OS/2, but it is possible to get QupZilla working there.
|
||||||
There may be some more things to do, but as far as I know, you need to
|
There may be some more things to do, but as far as I know, you need to
|
||||||
add Q_WS_WIN define to qmake.
|
add Q_WS_WIN define to qmake.
|
||||||
You will do this by adding one line
|
You will do this by adding one line to QupZilla.pro:
|
||||||
|
|
||||||
DEFINES += Q_WS_WIN
|
DEFINES += Q_WS_WIN
|
||||||
|
|
||||||
to QupZilla.pro file.
|
|
||||||
|
|
||||||
|
|
||||||
Available Defines
|
Available Defines
|
||||||
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
||||||
|
@ -67,7 +71,8 @@ Available Defines
|
||||||
example:
|
example:
|
||||||
$ export USE_WEBGL="true"
|
$ export USE_WEBGL="true"
|
||||||
|
|
||||||
Windows specific defines
|
Windows specific defines:
|
||||||
|
|
||||||
W7API Enable Windows 7 API support
|
W7API Enable Windows 7 API support
|
||||||
Requires linking against libraries from Microsoft Visual C++
|
Requires linking against libraries from Microsoft Visual C++
|
||||||
Compiler 2010
|
Compiler 2010
|
||||||
|
@ -75,6 +80,7 @@ Available Defines
|
||||||
|
|
||||||
|
|
||||||
Linux / Unix specific defines:
|
Linux / Unix specific defines:
|
||||||
|
|
||||||
NO_SYSTEM_DATAPATH By default, QupZilla is using /usr/share/qupzilla/ path
|
NO_SYSTEM_DATAPATH By default, QupZilla is using /usr/share/qupzilla/ path
|
||||||
for storing themes, translations and plugins.
|
for storing themes, translations and plugins.
|
||||||
By setting this define, QupZilla will use path of execution.
|
By setting this define, QupZilla will use path of execution.
|
||||||
|
@ -85,7 +91,9 @@ Available Defines
|
||||||
|
|
||||||
QUPZILLA_PREFIX You can define different prefix. Prefix must contain ending slash.
|
QUPZILLA_PREFIX You can define different prefix. Prefix must contain ending slash.
|
||||||
(default prefix is "/usr/")
|
(default prefix is "/usr/")
|
||||||
value:
|
QupZilla binary will then be moved to PREFIX/bin/, use
|
||||||
|
PREFIX/share/qupzilla/ as datadir, PREFIX/share/applications for
|
||||||
|
desktop launcher and PREFIX/share/pixmaps for icon.
|
||||||
|
|
||||||
example:
|
example:
|
||||||
$ export QUPZILLA_PREFIX="/usr/"
|
$ export QUPZILLA_PREFIX="/usr/"
|
||||||
|
|
|
@ -59,6 +59,7 @@ StatusBarMessage::StatusBarMessage(QupZilla* mainClass)
|
||||||
, p_QupZilla(mainClass)
|
, p_QupZilla(mainClass)
|
||||||
, m_statusBarText(new TipLabel(mainClass))
|
, m_statusBarText(new TipLabel(mainClass))
|
||||||
{
|
{
|
||||||
|
m_statusBarText->setParent(p_QupZilla);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusBarMessage::showMessage(const QString &message)
|
void StatusBarMessage::showMessage(const QString &message)
|
||||||
|
@ -68,7 +69,6 @@ void StatusBarMessage::showMessage(const QString &message)
|
||||||
else {
|
else {
|
||||||
WebView* view = p_QupZilla->weView();
|
WebView* view = p_QupZilla->weView();
|
||||||
QWebFrame* mainFrame = view->page()->mainFrame();
|
QWebFrame* mainFrame = view->page()->mainFrame();
|
||||||
m_statusBarText->setParent(view);
|
|
||||||
|
|
||||||
int horizontalScrollSize = 0;
|
int horizontalScrollSize = 0;
|
||||||
int verticalScrollSize = 0;
|
int verticalScrollSize = 0;
|
||||||
|
@ -91,7 +91,7 @@ void StatusBarMessage::showMessage(const QString &message)
|
||||||
if (statusRect.contains(QCursor::pos()))
|
if (statusRect.contains(QCursor::pos()))
|
||||||
position.setY(position.y() - m_statusBarText->height());
|
position.setY(position.y() - m_statusBarText->height());
|
||||||
|
|
||||||
m_statusBarText->move(/*view->mapToGlobal(*/position/*)*/);
|
m_statusBarText->move(view->mapToGlobal(position));
|
||||||
m_statusBarText->show();
|
m_statusBarText->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,12 @@
|
||||||
#include "adblockmanager.h"
|
#include "adblockmanager.h"
|
||||||
#include "adblocksubscription.h"
|
#include "adblocksubscription.h"
|
||||||
#include "squeezelabelv2.h"
|
#include "squeezelabelv2.h"
|
||||||
|
#include "webpage.h"
|
||||||
|
#include "globalfunctions.h"
|
||||||
|
#include "qupzilla.h"
|
||||||
|
|
||||||
ClickToFlash::ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNames, const QStringList &argumentValues, QWidget* parent)
|
ClickToFlash::ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNames, const QStringList &argumentValues, WebPage* parentPage)
|
||||||
: QWidget(parent)
|
: QWidget()
|
||||||
, m_argumentNames(argumentNames)
|
, m_argumentNames(argumentNames)
|
||||||
, m_argumentValues(argumentValues)
|
, m_argumentValues(argumentValues)
|
||||||
, m_toolButton(0)
|
, m_toolButton(0)
|
||||||
|
@ -55,6 +58,7 @@ ClickToFlash::ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNam
|
||||||
, m_layout2(0)
|
, m_layout2(0)
|
||||||
, m_frame(0)
|
, m_frame(0)
|
||||||
, m_url(pluginUrl)
|
, m_url(pluginUrl)
|
||||||
|
, m_page(parentPage)
|
||||||
{
|
{
|
||||||
//AdBlock
|
//AdBlock
|
||||||
AdBlockManager* manager = AdBlockManager::instance();
|
AdBlockManager* manager = AdBlockManager::instance();
|
||||||
|
@ -87,8 +91,19 @@ ClickToFlash::ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNam
|
||||||
|
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint)));
|
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint)));
|
||||||
|
|
||||||
|
QTimer::singleShot(0, this, SLOT(ensurePluginVisible()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClickToFlash::ensurePluginVisible()
|
||||||
|
{
|
||||||
|
// Well, kind of a dirty workaround, but it works.
|
||||||
|
// I don't know any other method how to show our plugin
|
||||||
|
// and adjust it on the proper position in page
|
||||||
|
|
||||||
|
m_page->mainFrame()->setZoomFactor(m_page->mainFrame()->zoomFactor() + 1);
|
||||||
|
m_page->mainFrame()->setZoomFactor(m_page->mainFrame()->zoomFactor() - 1);
|
||||||
|
}
|
||||||
void ClickToFlash::customContextMenuRequested(const QPoint &pos)
|
void ClickToFlash::customContextMenuRequested(const QPoint &pos)
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
|
@ -175,15 +190,15 @@ void ClickToFlash::load()
|
||||||
|
|
||||||
bool ClickToFlash::checkUrlOnElement(QWebElement el)
|
bool ClickToFlash::checkUrlOnElement(QWebElement el)
|
||||||
{
|
{
|
||||||
QString checkString = QUrl(el.attribute("src")).toString(QUrl::RemoveQuery);
|
QString checkString = el.attribute("src");
|
||||||
if (checkString.isEmpty())
|
if (checkString.isEmpty())
|
||||||
checkString = QUrl(el.attribute("data")).toString(QUrl::RemoveQuery);
|
checkString = el.attribute("data");
|
||||||
if (checkString.isEmpty())
|
if (checkString.isEmpty())
|
||||||
checkString = QUrl(el.attribute("value")).toString(QUrl::RemoveQuery);
|
checkString = el.attribute("value");
|
||||||
|
|
||||||
if (m_url.toEncoded().contains(checkString.toAscii()))
|
checkString = m_page->getView()->url().resolved(QUrl(checkString)).toString(QUrl::RemoveQuery);
|
||||||
return true;
|
|
||||||
return false;
|
return m_url.toEncoded().contains(checkString.toAscii());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClickToFlash::checkElement(QWebElement el)
|
bool ClickToFlash::checkElement(QWebElement el)
|
||||||
|
@ -219,6 +234,7 @@ void ClickToFlash::showInfo()
|
||||||
lay->addRow(new QLabel(tr("No more informations available.")));
|
lay->addRow(new QLabel(tr("No more informations available.")));
|
||||||
|
|
||||||
widg->setMaximumHeight(500);
|
widg->setMaximumHeight(500);
|
||||||
|
qz_centerWidgetToParent(widg, m_page->qupzilla());
|
||||||
widg->show();
|
widg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,12 +57,13 @@
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
|
|
||||||
class QWebElement;
|
class QWebElement;
|
||||||
|
class WebPage;
|
||||||
class ClickToFlash : public QWidget
|
class ClickToFlash : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNames, const QStringList &argumentValues, QWidget* parent = 0);
|
explicit ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNames, const QStringList &argumentValues, WebPage* parentPage);
|
||||||
~ClickToFlash();
|
~ClickToFlash();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -74,6 +75,8 @@ private slots:
|
||||||
void hideAdBlocked();
|
void hideAdBlocked();
|
||||||
void showInfo();
|
void showInfo();
|
||||||
|
|
||||||
|
void ensurePluginVisible();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool checkElement(QWebElement el);
|
bool checkElement(QWebElement el);
|
||||||
bool checkUrlOnElement(QWebElement el);
|
bool checkUrlOnElement(QWebElement el);
|
||||||
|
@ -90,6 +93,8 @@ private:
|
||||||
used to find the right QWebElement between the ones of the different plugins
|
used to find the right QWebElement between the ones of the different plugins
|
||||||
*/
|
*/
|
||||||
const QUrl m_url;
|
const QUrl m_url;
|
||||||
|
|
||||||
|
WebPage* m_page;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLICKTOFLASH_H
|
#endif // CLICKTOFLASH_H
|
||||||
|
|
|
@ -19,20 +19,23 @@
|
||||||
#include "clicktoflash.h"
|
#include "clicktoflash.h"
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
#include "pluginproxy.h"
|
#include "pluginproxy.h"
|
||||||
|
#include "webpage.h"
|
||||||
|
|
||||||
WebPluginFactory::WebPluginFactory(QObject* parent)
|
WebPluginFactory::WebPluginFactory(QObject* parent)
|
||||||
: QWebPluginFactory(parent)
|
: QWebPluginFactory(parent)
|
||||||
|
, m_page(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, const QStringList &argumentNames, const QStringList &argumentValues) const
|
QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, const QStringList &argumentNames, const QStringList &argumentValues) const
|
||||||
{
|
{
|
||||||
if (mimeType.isEmpty())
|
QString mime = mimeType.trimmed(); //Fixing bad behaviour when mimeType contains spaces
|
||||||
|
if (mime.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (mimeType != "application/x-shockwave-flash") {
|
if (mime != "application/x-shockwave-flash") {
|
||||||
if (mimeType != "application/futuresplash")
|
if (mime != "application/futuresplash")
|
||||||
qDebug() << "missing mimeType handler for: " << mimeType;
|
qDebug() << "missing mimeType handler for: " << mime;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,10 +47,28 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons
|
||||||
if (whitelist.contains(url.host()) || whitelist.contains("www."+url.host()) || whitelist.contains(url.host().remove("www.")))
|
if (whitelist.contains(url.host()) || whitelist.contains("www."+url.host()) || whitelist.contains(url.host().remove("www.")))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ClickToFlash* ctf = new ClickToFlash(url, argumentNames, argumentValues);
|
WebPluginFactory* factory = const_cast<WebPluginFactory*>(this);
|
||||||
|
if (!factory)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
WebPage* page = factory->parentPage();
|
||||||
|
if (!page)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
ClickToFlash* ctf = new ClickToFlash(url, argumentNames, argumentValues, page);
|
||||||
return ctf;
|
return ctf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebPage* WebPluginFactory::parentPage()
|
||||||
|
{
|
||||||
|
if (m_page)
|
||||||
|
return m_page;
|
||||||
|
|
||||||
|
WebPage* page = qobject_cast<WebPage*> (parent());
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
QList<QWebPluginFactory::Plugin> WebPluginFactory::plugins() const
|
QList<QWebPluginFactory::Plugin> WebPluginFactory::plugins() const
|
||||||
{
|
{
|
||||||
QList<QWebPluginFactory::Plugin> plugins;
|
QList<QWebPluginFactory::Plugin> plugins;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <QWebPluginFactory>
|
#include <QWebPluginFactory>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
class WebPage;
|
||||||
class WebPluginFactory : public QWebPluginFactory
|
class WebPluginFactory : public QWebPluginFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -31,6 +32,9 @@ public:
|
||||||
QList<QWebPluginFactory::Plugin> plugins() const;
|
QList<QWebPluginFactory::Plugin> plugins() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
WebPage* parentPage();
|
||||||
|
|
||||||
|
WebPage* m_page;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // WEB_PLUGIN_FACTORY_H
|
#endif // WEB_PLUGIN_FACTORY_H
|
||||||
|
|
|
@ -64,6 +64,8 @@ public:
|
||||||
void addAdBlockRule(const QString &filter, const QUrl &url);
|
void addAdBlockRule(const QString &filter, const QUrl &url);
|
||||||
QList<AdBlockedEntry> adBlockedEntries() { return m_adBlockedEntries; }
|
QList<AdBlockedEntry> adBlockedEntries() { return m_adBlockedEntries; }
|
||||||
|
|
||||||
|
QupZilla* qupzilla() { return p_QupZilla; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void privacyChanged(bool status);
|
void privacyChanged(bool status);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user