mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
[Fix] Fixed issue when attempting to download flash content.
- it occurred only when you don't have Flash plugin installed
This commit is contained in:
parent
99609d109d
commit
14c7c08c44
|
@ -56,44 +56,24 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons
|
|||
return 0;
|
||||
}
|
||||
|
||||
// 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, m_page);
|
||||
return ctf;
|
||||
}
|
||||
|
||||
QList<QWebPluginFactory::Plugin> WebPluginFactory::plugins() const
|
||||
{
|
||||
// QList<QWebPluginFactory::Plugin> plugins;
|
||||
// return plugins;
|
||||
|
||||
// QWebPluginFactory::Plugin plugin;
|
||||
// plugin.name = QLatin1String("ClickToFlashPlugin"); // Mmmm, it should return this,
|
||||
// QWebPluginFactory::MimeType mimeType; // but with WebKit 533.3, click2flash
|
||||
// mimeType.fileExtensions << QLatin1String("swf"); // fails on some pages, like youtube.com
|
||||
// mimeType.name = QLatin1String("application/x-shockwave-flash"); // so we will return empty QList
|
||||
// plugin.mimeTypes.append(mimeType); // On some pages it also force to load non-flash
|
||||
// plugins.append(plugin); // content -> in most cases advertisements.
|
||||
// return plugins; // Not bad to have it hidden :-)
|
||||
|
||||
QList<QWebPluginFactory::Plugin> plugins;
|
||||
QWebPluginFactory::Plugin plugin;
|
||||
QWebPluginFactory::MimeType mimeType;
|
||||
|
||||
mimeType.fileExtensions << "swf";
|
||||
mimeType.name = "application/x-shockwave-flash";
|
||||
|
||||
plugin.name = "ClickToFlashPlugin";
|
||||
plugin.mimeTypes.append(mimeType);
|
||||
plugins.append(plugin);
|
||||
QList<Plugin> plugins;
|
||||
return plugins;
|
||||
|
||||
// QList<QWebPluginFactory::Plugin> plugins;
|
||||
// QWebPluginFactory::Plugin plugin;
|
||||
// QWebPluginFactory::MimeType mimeType;
|
||||
|
||||
// mimeType.fileExtensions << "swf";
|
||||
// mimeType.name = "application/x-shockwave-flash";
|
||||
|
||||
// plugin.name = "ClickToFlashPlugin";
|
||||
// plugin.mimeTypes.append(mimeType);
|
||||
// plugins.append(plugin);
|
||||
// return plugins;
|
||||
}
|
||||
|
|
|
@ -26,11 +26,11 @@ class WebPluginFactory : public QWebPluginFactory
|
|||
{
|
||||
public:
|
||||
WebPluginFactory(WebPage* page);
|
||||
|
||||
virtual QObject* create(const QString &mimeType, const QUrl &url, const QStringList &argumentNames, const QStringList &argumentValues) const;
|
||||
QList<QWebPluginFactory::Plugin> plugins() const;
|
||||
|
||||
private:
|
||||
WebPage* m_page;
|
||||
|
||||
};
|
||||
#endif // WEB_PLUGIN_FACTORY_H
|
||||
|
|
|
@ -203,22 +203,29 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
|
|||
|
||||
switch (reply->error()) {
|
||||
case QNetworkReply::NoError:
|
||||
if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) {
|
||||
if (!reply->rawHeader("Content-Disposition").isEmpty()) {
|
||||
DownloadManager* dManager = mApp->downManager();
|
||||
dManager->handleUnsupportedContent(reply, this);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
else {
|
||||
qDebug() << "WebPage::UnsupportedContent" << url << "Attempt to download request without Content-Disposition header!";
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
case QNetworkReply::ProtocolUnknownError:
|
||||
qDebug() << url << "ProtocolUnknowError";
|
||||
qDebug() << "WebPage::UnsupportedContent" << url << "ProtocolUnknowError";
|
||||
QDesktopServices::openUrl(url);
|
||||
reply->deleteLater();
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
qDebug() << "WebPage::UnsupportedContent error" << reply->errorString();
|
||||
qDebug() << "WebPage::UnsupportedContent error" << url << reply->errorString();
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
void WebPage::downloadRequested(const QNetworkRequest &request)
|
||||
|
|
Loading…
Reference in New Issue
Block a user