20#include "ui_siteinfowidget.h"
35 this->setAttribute(Qt::WA_DeleteOnClose);
42 ui->titleLabel->setText(tr(
"<b>Site %1<b/>").arg(view->url().host()));
44 if (view->url().scheme() ==
QL1S(
"https")) {
45 ui->secureLabel->setText(tr(
"Your connection to this site is <b>secured</b>."));
46 ui->secureIcon->setPixmap(QPixmap(
QSL(
":/icons/locationbar/safe.png")));
49 ui->secureLabel->setText(tr(
"Your connection to this site is <b>unsecured</b>."));
50 ui->secureIcon->setPixmap(QPixmap(
QSL(
":/icons/locationbar/unsafe.png")));
53 QString scheme = view->url().scheme();
54 QString host = view->url().host();
57 query.prepare(
QSL(
"SELECT sum(count) FROM history WHERE url LIKE ?"));
58 query.addBindValue(
QSL(
"%1://%2%").arg(scheme, host));
62 int count = query.value(0).toInt();
64 ui->historyLabel->setText(tr(
"This is your <b>%1</b> visit of this site.").arg(QString::number(count) + QLatin1Char(
'.')));
65 ui->historyIcon->setPixmap(QPixmap(
QSL(
":/icons/locationbar/visit3.png")));
67 else if (count == 0) {
68 ui->historyLabel->setText(tr(
"You have <b>never</b> visited this site before."));
69 ui->historyIcon->setPixmap(QPixmap(
QSL(
":/icons/locationbar/visit1.png")));
72 ui->historyIcon->setPixmap(QPixmap(
QSL(
":/icons/locationbar/visit2.png")));
77 else if (count == 2) {
80 else if (count == 3) {
83 ui->historyLabel->setText(tr(
"This is your <b>%1</b> visit of this site.").arg(text));
87 updateProtocolHandler();
89 connect(ui->pushButton, &QAbstractButton::clicked, m_window->
action(
QSL(
"Tools/SiteInfo")), &QAction::trigger);
90 connect(ui->protocolHandlerButton, &QPushButton::clicked,
this, &SiteInfoWidget::protocolHandlerButtonClicked);
98void SiteInfoWidget::updateProtocolHandler()
103 const QUrl registeredUrl =
mApp->protocolHandlerManager()->protocolHandlers().value(scheme);
107 ui->protocolHandlerButton->setText(tr(
"Register"));
109 ui->protocolHandlerLabel->hide();
110 ui->protocolHandlerButton->hide();
111 ui->protocolHandlerLine->hide();
115void SiteInfoWidget::protocolHandlerButtonClicked()
QAction * action(const QString &name) const
TabbedWebView * weView() const
static SqlDatabase * instance()
QString registerProtocolHandlerRequestScheme() const
QUrl registerProtocolHandlerRequestUrl() const