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

Speed dial background picture backend

This commit is contained in:
Mladen Pejaković 2012-01-09 14:12:21 +01:00
parent f108a82d55
commit 7781e1a1c7
3 changed files with 26 additions and 1 deletions

View File

@ -2,7 +2,7 @@
<title>%SITE-TITLE%</title>
<link rel="icon" href="%FAVICON%" type="image/x-icon" />
<style type="text/css" media="screen">
html {background: #eeeeee;font: 13px/22px "Helvetica Neue", Helvetica, Arial, sans-serif;color: #525c66;}
html {background: #eeeeee url(%IMG_BACKGROUND%) no-repeat center center;background-size: %B_SIZE%;font: 13px/22px "Helvetica Neue", Helvetica, Arial, sans-serif;color: #525c66;}
html * {-webkit-user-select: none;font-size: 100%;line-height: 1.6;margin: 0px;}
.add {position: absolute;right:10px;top:10px;width: 24px;height: 24px;background: url(%IMG_PLUS%); cursor: pointer;}

View File

@ -47,6 +47,7 @@ QNetworkReply* QupZillaSchemeHandler::createRequest(QNetworkAccessManager::Opera
QupZillaSchemeReply::QupZillaSchemeReply(const QNetworkRequest &req, QObject* parent)
: QNetworkReply(parent)
, m_loaded(false)
{
setOperation(QNetworkAccessManager::GetOperation);
setRequest(req);
@ -113,6 +114,18 @@ qint64 QupZillaSchemeReply::readData(char* data, qint64 maxSize)
return m_buffer.read(data, maxSize);
}
void QupZillaSchemeReply::loadSpeedDialBack()
{
m_loaded = true;
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
settings.beginGroup("SpeedDial");
m_backImg = settings.value("background", "").toString();
m_backImgSize = settings.value("backsize", "").toString();
m_backImgSize = (m_backImgSize == "" ? "auto" : m_backImgSize);
settings.endGroup();
}
QString QupZillaSchemeReply::reportbugPage()
{
static QString bPage;
@ -230,6 +243,10 @@ QString QupZillaSchemeReply::speeddialPage()
{
static QString dPage;
if (!m_loaded) {
loadSpeedDialBack();
}
if (dPage.isEmpty()) {
dPage.append(qz_readAllFileContents(":html/speeddial.html"));
dPage.replace("%FAVICON%", "qrc:icons/qupzilla.png");
@ -252,6 +269,8 @@ QString QupZillaSchemeReply::speeddialPage()
dPage.replace("%TITLE%", tr("Title"));
dPage.replace("%EDIT%", tr("Apply"));
dPage.replace("%NEW-PAGE%", tr("New Page"));
dPage.replace("%IMG_BACKGROUND%", m_backImg);
dPage.replace("%B_SIZE%", m_backImgSize);
}
QString page = dPage;

View File

@ -47,6 +47,8 @@ public:
virtual qint64 bytesAvailable() const;
void loadSpeedDialBack();
protected:
virtual qint64 readData(char* data, qint64 maxSize);
virtual void abort() { }
@ -60,10 +62,14 @@ private:
QString reportbugPage();
QString startPage();
QString speeddialPage();
QString m_backImg;
QString m_backImgSize;
QBuffer m_buffer;
QString m_pageName;
bool m_loaded;
};
#endif // QUPZILLASCHEMEHANDLER_H