mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Improved SiteInfo dialog - now it is showing previews of images on the
page
This commit is contained in:
parent
09c4747ab6
commit
8e7df2e766
@ -48,6 +48,7 @@ MainApplication::MainApplication(int &argc, char **argv)
|
||||
,m_bookmarksModel(0)
|
||||
,m_downloadManager(0)
|
||||
,m_autofill(0)
|
||||
,m_networkCache(new QNetworkDiskCache)
|
||||
,m_isClosing(false)
|
||||
,m_isChanged(false)
|
||||
,m_isExited(false)
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QWebSettings>
|
||||
#include <QUrl>
|
||||
#include <QPointer>
|
||||
#include <QNetworkDiskCache>
|
||||
#include <iostream>
|
||||
|
||||
#include "qtsingleapplication.h"
|
||||
@ -79,6 +80,7 @@ public:
|
||||
BookmarksModel* bookmarks();
|
||||
DownloadManager* downManager();
|
||||
AutoFillModel* autoFill();
|
||||
QNetworkDiskCache* networkCache() { return m_networkCache; }
|
||||
|
||||
public slots:
|
||||
bool saveStateSlot();
|
||||
@ -108,6 +110,7 @@ private:
|
||||
BookmarksModel* m_bookmarksModel;
|
||||
DownloadManager* m_downloadManager;
|
||||
AutoFillModel* m_autofill;
|
||||
QNetworkDiskCache* m_networkCache;
|
||||
|
||||
QList<QPointer<QupZilla> > m_mainWindows;
|
||||
|
||||
|
@ -40,7 +40,7 @@ void NetworkManager::loadSettings()
|
||||
settings.beginGroup("Web-Browser-Settings");
|
||||
|
||||
if (settings.value("AllowLocalCache", true).toBool()) {
|
||||
m_diskCache = new QNetworkDiskCache(this);
|
||||
m_diskCache = mApp->networkCache();
|
||||
m_diskCache->setCacheDirectory(mApp->getActiveProfil()+"/networkcache");
|
||||
m_diskCache->setMaximumCacheSize(settings.value("MaximumCacheSize",50).toInt() * 1024*1024); //MegaBytes
|
||||
setCache(m_diskCache);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "qupzilla.h"
|
||||
#include "webview.h"
|
||||
#include "webpage.h"
|
||||
#include "downloaditem.h"
|
||||
|
||||
SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
|
||||
QDialog(parent)
|
||||
@ -35,7 +36,8 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
|
||||
//GENERAL
|
||||
ui->heading->setText(QString("<b>%1</b>:").arg(title));
|
||||
ui->siteAddress->setText(frame->baseUrl().toString());
|
||||
|
||||
ui->sizeLabel->setText( DownloadItem::fileSizeToString(view->webPage()->totalBytes()) );
|
||||
QString encoding;
|
||||
|
||||
//Meta
|
||||
QWebElementCollection meta = frame->findAllElements("meta");
|
||||
@ -46,6 +48,10 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
|
||||
QString name = element.attribute("name");
|
||||
if (name.isEmpty())
|
||||
name = element.attribute("http-equiv");
|
||||
if (!element.attribute("charset").isEmpty())
|
||||
encoding = element.attribute("charset");
|
||||
if (content.contains("charset="))
|
||||
encoding = content.mid(content.indexOf("charset=")+8);
|
||||
|
||||
if (content.isEmpty() || name.isEmpty())
|
||||
continue;
|
||||
@ -54,6 +60,9 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
|
||||
item->setText(1, content);
|
||||
ui->treeTags->addTopLevelItem(item);
|
||||
}
|
||||
if (encoding.isEmpty())
|
||||
encoding = mApp->webSettings()->defaultTextEncoding();
|
||||
ui->encodingLabel->setText(encoding.toUpper());
|
||||
|
||||
//MEDIA
|
||||
QWebElementCollection img = frame->findAllElements("img");
|
||||
@ -81,7 +90,8 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
|
||||
|
||||
//SECURITY
|
||||
if (cert.isValid()) {
|
||||
ui->certLabel->setText(tr("<b>Your connection to this page is secured: </b>"));
|
||||
ui->securityLabel->setText(tr("<b>Connection is Encrypted.</b>"));
|
||||
ui->certLabel->setText(tr("<b>Your connection to this page is secured with this certificate: </b>"));
|
||||
//Issued to
|
||||
ui->issuedToCN->setText( cert.subjectInfo(QSslCertificate::CommonName) );
|
||||
ui->issuedToO->setText( cert.subjectInfo(QSslCertificate::Organization) );
|
||||
@ -95,11 +105,37 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
|
||||
ui->validityIssuedOn->setText( cert.effectiveDate().toString("dddd d. MMMM yyyy") );
|
||||
ui->validityExpiresOn->setText( cert.expiryDate().toString("dddd d. MMMM yyyy") );
|
||||
} else {
|
||||
ui->securityLabel->setText(tr("<b>Connection Not Encrypted.</b>"));
|
||||
ui->certFrame->setVisible(false);
|
||||
ui->certLabel->setText(tr("<b>Your connection to this page is not secured!</b>"));
|
||||
}
|
||||
|
||||
connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
||||
connect(ui->secDetailsButton, SIGNAL(clicked()), this, SLOT(securityDetailsClicked()));
|
||||
connect(ui->treeImages, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(showImagePreview(QTreeWidgetItem*)));
|
||||
}
|
||||
|
||||
void SiteInfo::showImagePreview(QTreeWidgetItem *item)
|
||||
{
|
||||
if (!item)
|
||||
return;
|
||||
QUrl imageUrl = item->text(1);
|
||||
QIODevice* cacheData = mApp->networkCache()->data(imageUrl);
|
||||
QPixmap pixmap;
|
||||
|
||||
if (!cacheData)
|
||||
pixmap.load(":/icons/qupzilla.png");
|
||||
else
|
||||
pixmap.loadFromData(cacheData->readAll());
|
||||
|
||||
QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview);
|
||||
scene->addPixmap(pixmap);
|
||||
ui->mediaPreview->setScene(scene);
|
||||
}
|
||||
|
||||
void SiteInfo::securityDetailsClicked()
|
||||
{
|
||||
ui->listWidget->setCurrentRow(2);
|
||||
}
|
||||
|
||||
void SiteInfo::itemChanged(QListWidgetItem *item)
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include <QListWidgetItem>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
namespace Ui {
|
||||
class SiteInfo;
|
||||
@ -36,6 +37,8 @@ public:
|
||||
|
||||
private slots:
|
||||
void itemChanged(QListWidgetItem* item);
|
||||
void showImagePreview(QTreeWidgetItem* item);
|
||||
void securityDetailsClicked();
|
||||
|
||||
private:
|
||||
Ui::SiteInfo* ui;
|
||||
|
@ -18,7 +18,7 @@
|
||||
<normaloff>:/icons/qupzilla.png</normaloff>:/icons/qupzilla.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="7" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -127,7 +127,7 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<item row="0" column="0" colspan="4">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
@ -188,14 +188,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<item row="1" column="0" colspan="4">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Meta tags of site:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<item row="3" column="0" colspan="4">
|
||||
<widget class="QTreeWidget" name="treeTags">
|
||||
<attribute name="headerDefaultSectionSize">
|
||||
<number>200</number>
|
||||
@ -232,7 +232,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<item row="5" column="3">
|
||||
<widget class="QPushButton" name="secDetailsButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -261,13 +261,20 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>label_9</zorder>
|
||||
<zorder>treeTags</zorder>
|
||||
<zorder>label_2</zorder>
|
||||
<zorder>securityLabel</zorder>
|
||||
<zorder>secDetailsButton</zorder>
|
||||
<zorder>horizontalSpacer</zorder>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_3">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
@ -323,7 +330,14 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="certLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="certFrame">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
@ -479,14 +493,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="certLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
Loading…
Reference in New Issue
Block a user