1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Image previeweing in Site Informations now supports file and qrc scheme

- also updated slovakia translation
- fixed image showing on adblocked page(regression from previous commit)
- SpeedDial: when adding new page and then editing, http:// will be
  shown instead of empty url
This commit is contained in:
nowrep 2011-12-03 14:43:13 +01:00
parent 61d6b3a37a
commit b422e22afd
7 changed files with 28 additions and 31 deletions

Binary file not shown.

View File

@ -54,6 +54,8 @@ function onEditClick(box) {
editingId = $(box).index(); editingId = $(box).index();
var boxUrl = $(box).children('a').first().attr('href'); var boxUrl = $(box).children('a').first().attr('href');
var boxTitle = $(box).children('span').first().text(); var boxTitle = $(box).children('span').first().text();
if (boxUrl === '')
boxUrl = 'http://';
$('body').append('<div id="fadeOverlay" style="opacity:0.95;display:none;position:fixed;left:0;' + $('body').append('<div id="fadeOverlay" style="opacity:0.95;display:none;position:fixed;left:0;' +
'top:0;width:100%;height:100%;z-index:9999;background:grey;">' + 'top:0;width:100%;height:100%;z-index:9999;background:grey;">' +

View File

@ -46,11 +46,13 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent)
ui->listWidget->item(0)->setIcon(QIcon::fromTheme("document-properties", QIcon(":/icons/preferences/document-properties.png"))); ui->listWidget->item(0)->setIcon(QIcon::fromTheme("document-properties", QIcon(":/icons/preferences/document-properties.png")));
ui->listWidget->item(1)->setIcon(QIcon::fromTheme("applications-graphics", QIcon(":/icons/preferences/applications-graphics.png"))); ui->listWidget->item(1)->setIcon(QIcon::fromTheme("applications-graphics", QIcon(":/icons/preferences/applications-graphics.png")));
ui->listWidget->item(2)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png"))); ui->listWidget->item(2)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png")));
ui->listWidget->item(0)->setSelected(true);
WebView* view = p_QupZilla->weView(); WebView* view = p_QupZilla->weView();
QWebFrame* frame = view->page()->mainFrame(); QWebFrame* frame = view->page()->mainFrame();
QString title = view->title(); QString title = view->title();
QSslCertificate cert = view->webPage()->sslCertificate(); QSslCertificate cert = view->webPage()->sslCertificate();
m_baseUrl = view->url();
//GENERAL //GENERAL
ui->heading->setText(QString("<b>%1</b>:").arg(title)); ui->heading->setText(QString("<b>%1</b>:").arg(title));
@ -189,6 +191,9 @@ void SiteInfo::showImagePreview(QTreeWidgetItem* item)
return; return;
} }
QUrl imageUrl = item->text(1); QUrl imageUrl = item->text(1);
if (imageUrl.isRelative()) {
imageUrl = m_baseUrl.resolved(imageUrl);
}
QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview); QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview);
if (imageUrl.scheme() == "data") { if (imageUrl.scheme() == "data") {
@ -196,12 +201,13 @@ void SiteInfo::showImagePreview(QTreeWidgetItem* item)
QByteArray imageData = encodedUrl.mid(encodedUrl.indexOf(",") + 1); QByteArray imageData = encodedUrl.mid(encodedUrl.indexOf(",") + 1);
m_activePixmap = qz_pixmapFromByteArray(imageData); m_activePixmap = qz_pixmapFromByteArray(imageData);
} }
else { else if (imageUrl.scheme() == "file") {
if (imageUrl.host().isEmpty()) { m_activePixmap = QPixmap(imageUrl.toString(QUrl::RemoveScheme));
imageUrl.setHost(QUrl(ui->siteAddress->text()).host());
imageUrl.setScheme(QUrl(ui->siteAddress->text()).scheme());
} }
else if (imageUrl.scheme() == "qrc") {
m_activePixmap = QPixmap(imageUrl.toString().mid(3)); // Remove qrc from url
}
else {
QIODevice* cacheData = mApp->networkCache()->data(imageUrl); QIODevice* cacheData = mApp->networkCache()->data(imageUrl);
if (!cacheData) { if (!cacheData) {
m_activePixmap = QPixmap(); m_activePixmap = QPixmap();

View File

@ -22,6 +22,7 @@
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QUrl>
namespace Ui namespace Ui
{ {
@ -55,6 +56,7 @@ private:
CertificateInfoWidget* m_certWidget; CertificateInfoWidget* m_certWidget;
QPixmap m_activePixmap; QPixmap m_activePixmap;
QUrl m_baseUrl;
}; };
#endif // SITEINFO_H #endif // SITEINFO_H

View File

@ -51,7 +51,7 @@
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>55</height> <height>53</height>
</size> </size>
</property> </property>
<property name="focusPolicy"> <property name="focusPolicy">
@ -69,17 +69,11 @@
<property name="flow"> <property name="flow">
<enum>QListView::LeftToRight</enum> <enum>QListView::LeftToRight</enum>
</property> </property>
<property name="resizeMode">
<enum>QListView::Fixed</enum>
</property>
<property name="viewMode"> <property name="viewMode">
<enum>QListView::IconMode</enum> <enum>QListView::IconMode</enum>
</property> </property>
<property name="uniformItemSizes"> <property name="uniformItemSizes">
<bool>false</bool> <bool>true</bool>
</property>
<property name="currentRow">
<number>-1</number>
</property> </property>
<item> <item>
<property name="text"> <property name="text">

View File

@ -307,15 +307,8 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
file.open(QFile::ReadOnly); file.open(QFile::ReadOnly);
QString errString = file.readAll(); QString errString = file.readAll();
errString.replace("%TITLE%", tr("AdBlocked Content")); errString.replace("%TITLE%", tr("AdBlocked Content"));
errString.replace("%IMAGE%", "qrc:html/adblock_big.png");
QPixmap pixmap(":/html/adblock_big.png"); errString.replace("%FAVICON%", "qrc:html/adblock_big.png");
QByteArray bytes;
QBuffer buffer(&bytes);
buffer.open(QIODevice::WriteOnly);
if (pixmap.save(&buffer, "PNG")) {
errString.replace("%IMAGE%", buffer.buffer().toBase64());
errString.replace("%FAVICON%", buffer.buffer().toBase64());
}
errString.replace("%RULE%", tr("Blocked by rule <i>%1</i>").arg(rule)); errString.replace("%RULE%", tr("Blocked by rule <i>%1</i>").arg(rule));

View File

@ -2222,7 +2222,7 @@
<message> <message>
<location filename="../src/preferences/preferences.ui" line="284"/> <location filename="../src/preferences/preferences.ui" line="284"/>
<source>Open speed dial</source> <source>Open speed dial</source>
<translation type="unfinished"></translation> <translation>Otvoriť rýchlu voľbu</translation>
</message> </message>
<message> <message>
<location filename="../src/preferences/preferences.ui" line="438"/> <location filename="../src/preferences/preferences.ui" line="438"/>
@ -3245,43 +3245,43 @@
<message> <message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="220"/> <location filename="../src/network/qupzillaschemehandler.cpp" line="220"/>
<source>Speed Dial</source> <source>Speed Dial</source>
<translation type="unfinished"></translation> <translation>Rýchla voľba</translation>
</message> </message>
<message> <message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="221"/> <location filename="../src/network/qupzillaschemehandler.cpp" line="221"/>
<source>Add New Page</source> <source>Add New Page</source>
<translation type="unfinished"></translation> <translation>Pridať novú stránku</translation>
</message> </message>
<message> <message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="222"/> <location filename="../src/network/qupzillaschemehandler.cpp" line="222"/>
<location filename="../src/network/qupzillaschemehandler.cpp" line="230"/> <location filename="../src/network/qupzillaschemehandler.cpp" line="230"/>
<source>Edit</source> <source>Edit</source>
<translation type="unfinished"></translation> <translation>Upraviť</translation>
</message> </message>
<message> <message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="223"/> <location filename="../src/network/qupzillaschemehandler.cpp" line="223"/>
<source>Remove</source> <source>Remove</source>
<translation type="unfinished"></translation> <translation>Odstrániť</translation>
</message> </message>
<message> <message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="224"/> <location filename="../src/network/qupzillaschemehandler.cpp" line="224"/>
<source>Reload</source> <source>Reload</source>
<translation type="unfinished">Obnoviť</translation> <translation>Obnoviť</translation>
</message> </message>
<message> <message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="228"/> <location filename="../src/network/qupzillaschemehandler.cpp" line="228"/>
<source>Url</source> <source>Url</source>
<translation type="unfinished"></translation> <translation>Url</translation>
</message> </message>
<message> <message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="229"/> <location filename="../src/network/qupzillaschemehandler.cpp" line="229"/>
<source>Title</source> <source>Title</source>
<translation type="unfinished"></translation> <translation>Názov</translation>
</message> </message>
<message> <message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="231"/> <location filename="../src/network/qupzillaschemehandler.cpp" line="231"/>
<source>New Page</source> <source>New Page</source>
<translation type="unfinished"></translation> <translation>Nová stránka</translation>
</message> </message>
</context> </context>
<context> <context>