1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Merge branch 'pejakm-master'

This commit is contained in:
nowrep 2012-02-16 20:18:01 +01:00
commit b6d17e391d
10 changed files with 246 additions and 122 deletions

View File

@ -468,6 +468,7 @@ void QupZilla::setupMenu()
infoAction->setShortcut(QKeySequence(QKeySequence::HelpContents));
connect(infoAction, SIGNAL(triggered()), this, SLOT(loadActionUrlInNewTab()));
m_menuHelp->addAction(infoAction);
m_menuHelp->addAction(tr("Configuration Information"), this, SLOT(loadActionUrlInNewTab()))->setData(QUrl("qupzilla:config"));
m_menuHelp->addAction(tr("Report &Issue"), this, SLOT(loadActionUrlInNewTab()))->setData(QUrl("qupzilla:reportbug"));
/************

View File

@ -36,6 +36,11 @@ void Settings::endGroup()
m_settings->endGroup();
}
QSettings* Settings::globalSettings()
{
return m_settings;
}
Settings::~Settings()
{
if (!m_settings->group().isEmpty()) {

View File

@ -13,6 +13,8 @@ public:
static void createSettings(const QString &fileName);
static void syncSettings();
static QSettings* globalSettings();
void setValue(const QString &key, const QVariant &defaultValue = QVariant());
QVariant value(const QString &key, const QVariant &defaultValue = QVariant());

View File

@ -42,7 +42,6 @@ BookmarksWidget::BookmarksWidget(WebView* view, QWidget* parent)
if (m_bookmarksModel->isBookmarked(m_url)) {
ui->bookmarksButton->setText(tr("Edit Bookmark"));
ui->mainLabel->setText(tr("<b>Edit Bookmark</b>"));
}
const SpeedDial::Page &page = m_speedDial->pageForUrl(m_url);
@ -54,7 +53,6 @@ BookmarksWidget::BookmarksWidget(WebView* view, QWidget* parent)
pal.setColor(QPalette::WindowText, QToolTip::palette().color(QPalette::ToolTipText));
ui->label_2->setPalette(pal);
ui->label_3->setPalette(pal);
ui->label_4->setPalette(pal);
#endif
}

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>290</width>
<height>160</height>
<width>275</width>
<height>98</height>
</rect>
</property>
<property name="sizePolicy">
@ -42,11 +42,44 @@
<property name="margin">
<number>0</number>
</property>
<item row="4" column="1">
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Folder:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="folder"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="name"/>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QPushButton" name="removeBookmark">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -88,56 +121,6 @@
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Folder:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="removeBookmark">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Remove Bookmark</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="folder"/>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../data/icons.qrc">:/icons/other/bigstar.png</pixmap>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="name"/>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Edit This Bookmark</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
@ -154,52 +137,20 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="2" column="0">
<item row="0" column="0">
<widget class="QPushButton" name="bookmarksButton">
<property name="text">
<string>Add into Bookmarks</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="1" column="0">
<widget class="QPushButton" name="speeddialButton">
<property name="text">
<string>Add into Speed Dial</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="pixmap">
<pixmap resource="../data/icons.qrc">:/icons/other/bigstar.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mainLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;b&gt;Add Bookmark&lt;/b&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -21,5 +21,6 @@
<file>html/qupzilla.ico</file>
<file>html/broken-page.png</file>
<file>html/setting.png</file>
<file>html/config.html</file>
</qresource>
</RCC>

View File

@ -24,13 +24,6 @@ p {margin-left: 1%;}
%VERSION-INFO%
</dl>
<h2>%BROWSER-IDENTIFICATION%</h2>
<p>%USER-AGENT%</p>
<h2>%PATHS%</h2>
<dl>
%PATHS-TEXT%
</dl>
<h3>%MAIN-DEVELOPER%</h3>
<p>%MAIN-DEVELOPER-TEXT%</p>
<h3>%CONTRIBUTORS%</h3>

69
src/data/html/config.html Normal file
View File

@ -0,0 +1,69 @@
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>%TITLE%</title>
<link rel="icon" href="%FAVICON%" type="image/x-icon" />
<style>
html {background: #eeeeee;font: 13px/22px "Helvetica Neue", Helvetica, Arial, sans-serif;color: #525c66;}
html * {font-size: 100%;line-height: 1.6;}
#box {max-width: 650px;overflow:auto;margin: 25px auto 10px auto;padding: 10px 40px;border-width: 20px;-webkit-border-image: url(%BOX-BORDER%) 25;text-align: left;}
h1 {color: #1a4ba4;font-size: 160%;margin-bottom: 0px;}
h2 {margin: 5px 0px;font-size: 100%;color: #525c66;font-weight: bold;}
dl {margin-top: 0px;}
dt {display: block;float: left;min-width: 24%;margin: 0 0 0.3em 1%}
dd {color: black;margin: 0 0 0.3em 28%;}
p {margin-left: 1%;}
.about-img {float: right;margin-top: 15px;margin-right: -25px;}
table.tbl {width: 100%;margin: 15px 0;border-radius: 4px;padding: 0px;border: 2px solid #aaa;border-collapse: separate;}
.tbl th{border-radius: 2px;border: 1px solid #aaa;padding: 1px 3px;background: #eee;font-style:italic;}
.tbl th[colspan="2"] {text-align: center;background: #ddd;font-style:normal;}
.tbl td{border-radius: 2px;border: 1px solid #aaa;text-align: center;padding:1px 3px;}
.tbl td:first-child{background: #eee;text-align: left;padding:1px 3px 1px 5px;}
.no-available-plugins{background: white !important; text-align: center !important;}
.tbl td:nth-of-type(2){color: black;max-width: 400px;max-height: 50px;overflow:auto;}
</style>
</head>
<body>
<div id="box">
<img src="%ABOUT-IMG%" class="about-img">
<h1>%CONFIG%</h1>
<h2>%INFORMATIONS-ABOUT-VERSION%</h2>
<dl>
%VERSION-INFO%
</dl>
<h2>%BROWSER-IDENTIFICATION%</h2>
<p>%USER-AGENT%</p>
<h2>%PATHS%</h2>
<dl>
%PATHS-TEXT%
</dl>
<h2>%PLUGINS%</h2>
<table class="tbl">
<thead>
<tr><th>%PL-NAME%</th><th>%PL-VER%</th><th>%PL-AUTH%</th><th>%PL-DESC%</th></tr>
</thead>
<tbody>
%PLUGINS-INFO%
</tbody>
</table>
<h2>%PREFS%</h2>
<table class="tbl">
<thead>
<tr><th>%OPTION%</th><th>%VALUE%</th></tr>
</thead>
<tbody>
%PREFS-INFO%
</tbody>
</table>
<small style="text-align:justify">
%CONFIG-ABOUT%
</small>
</div>
</body></html>

View File

@ -23,6 +23,8 @@
#include "webpage.h"
#include "speeddial.h"
#include "pluginproxy.h"
#include "plugininterface.h"
#include "settings.h"
QString authorString(const char* name, const QString &mail)
{
@ -53,7 +55,7 @@ QupZillaSchemeReply::QupZillaSchemeReply(const QNetworkRequest &req, QObject* pa
setUrl(req.url());
m_pageName = req.url().path();
if (m_pageName == "about" || m_pageName == "reportbug" || m_pageName == "start" || m_pageName == "speeddial") {
if (m_pageName == "about" || m_pageName == "reportbug" || m_pageName == "start" || m_pageName == "speeddial" || m_pageName == "config") {
m_buffer.open(QIODevice::ReadWrite);
setError(QNetworkReply::NoError, tr("No Error"));
@ -83,6 +85,9 @@ void QupZillaSchemeReply::loadPage()
else if (m_pageName == "speeddial") {
stream << speeddialPage();
}
else if (m_pageName == "config") {
stream << configPage();
}
stream.flush();
m_buffer.reset();
@ -176,28 +181,15 @@ QString QupZillaSchemeReply::aboutPage()
aPage.replace("%TITLE%", tr("About QupZilla"));
aPage.replace("%ABOUT-QUPZILLA%", tr("About QupZilla"));
aPage.replace("%INFORMATIONS-ABOUT-VERSION%", tr("Information about version"));
aPage.replace("%BROWSER-IDENTIFICATION%", tr("Browser Identification"));
aPage.replace("%PATHS%", tr("Paths"));
aPage.replace("%COPYRIGHT%", tr("Copyright"));
aPage.replace("%VERSION-INFO%",
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"), QupZilla::VERSION
#ifdef GIT_REVISION
+ " (" + GIT_REVISION + ")"
#endif
) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), QupZilla::WEBKITVERSION) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Build time"), QupZilla::BUILDTIME) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Platform"), qz_buildSystem()));
aPage.replace("%PATHS-TEXT%",
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Profile"), mApp->getActiveProfilPath()) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Settings"), mApp->getActiveProfilPath() + "settings.ini") +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Saved session"), mApp->getActiveProfilPath() + "session.dat") +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Pinned tabs"), mApp->getActiveProfilPath() + "pinnedtabs.dat") +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Data"), mApp->DATADIR) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Themes"), mApp->THEMESDIR) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Plugins"), mApp->PLUGINSDIR) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Translations"), mApp->TRANSLATIONSDIR));
#ifdef GIT_REVISION
+ " (" + GIT_REVISION + ")"
#endif
) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), QupZilla::WEBKITVERSION));
aPage.replace("%MAIN-DEVELOPER%", tr("Main developer"));
aPage.replace("%MAIN-DEVELOPER-TEXT%", authorString(QupZilla::AUTHOR.toUtf8(), "nowrep@gmail.com"));
aPage.replace("%CONTRIBUTORS%", tr("Contributors"));
@ -207,7 +199,7 @@ QString QupZillaSchemeReply::aboutPage()
authorString("Mariusz Fik", "fisiu@opensuse.org") + "<br/>" +
authorString("Jan Rajnoha", "honza.rajny@hotmail.com") + "<br/>" +
authorString("Daniele Cocca", "jmc@chakra-project.org")
);
);
aPage.replace("%TRANSLATORS%", tr("Translators"));
aPage.replace("%TRANSLATORS-TEXT%",
authorString("Heimen Stoffels", "vistausss@gmail.com") + " (Dutch)<br/>" +
@ -228,13 +220,10 @@ QString QupZillaSchemeReply::aboutPage()
authorString("Mladen Pejaković", "pejakm@gmail.com") + " (Serbian)<br/>" +
authorString("Unink-Lio", "unink4451@163.com") + " (Chinese)<br/>" +
authorString("Wu Cheng-Hong", "stu2731652@gmail.com") + " (Traditional Chinese)"
);
);
}
QString page = aPage;
page.replace("%USER-AGENT%", mApp->getWindow()->weView()->webPage()->userAgentForUrl(QUrl()));
return page;
return aPage;
}
QString QupZillaSchemeReply::speeddialPage()
@ -287,3 +276,117 @@ QString QupZillaSchemeReply::speeddialPage()
page.replace("%SD-SIZE%", QString::number(dial->sdSize()));
return page;
}
QString QupZillaSchemeReply::configPage()
{
static QString cPage;
if (cPage.isEmpty()) {
cPage.append(qz_readAllFileContents(":html/config.html"));
cPage.replace("%FAVICON%", "qrc:icons/qupzilla.png");
cPage.replace("%BOX-BORDER%", "qrc:html/box-border.png");
cPage.replace("%ABOUT-IMG%", "qrc:icons/other/about.png");
cPage.replace("%TITLE%", tr("Configuration Information"));
cPage.replace("%CONFIG%", tr("Configuration Information"));
cPage.replace("%INFORMATIONS-ABOUT-VERSION%", tr("Information about version"));
cPage.replace("%CONFIG-ABOUT%", tr("This page contains information about Qupzilla's current configuration, plugins, etc, all relevant information for troubleshooting. Please include these information when sending bug reports."));
cPage.replace("%BROWSER-IDENTIFICATION%", tr("Browser Identification"));
cPage.replace("%PATHS%", tr("Paths"));
cPage.replace("%PREFS%", tr("Preferences"));
cPage.replace("%OPTION%", tr("Option"));
cPage.replace("%VALUE%", tr("Value"));
cPage.replace("%PLUGINS%", tr("Plugins"));
cPage.replace("%PL-NAME%", tr("Name"));
cPage.replace("%PL-VER%", tr("Version"));
cPage.replace("%PL-AUTH%", tr("Author"));
cPage.replace("%PL-DESC%", tr("Description"));
cPage.replace("%PATHS-TEXT%",
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Profile"), mApp->getActiveProfilPath()) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Settings"), mApp->getActiveProfilPath() + "settings.ini") +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Saved session"), mApp->getActiveProfilPath() + "session.dat") +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Pinned tabs"), mApp->getActiveProfilPath() + "pinnedtabs.dat") +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Data"), mApp->DATADIR) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Themes"), mApp->THEMESDIR) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Plugins"), mApp->PLUGINSDIR) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Translations"), mApp->TRANSLATIONSDIR));
cPage.replace("%USER-AGENT%", mApp->getWindow()->weView()->webPage()->userAgentForUrl(QUrl()));
cPage.replace("%VERSION-INFO%",
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Application version"), QupZilla::VERSION
#ifdef GIT_REVISION
+ " (" + GIT_REVISION + ")"
#endif
) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Qt version"), QT_VERSION_STR) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), QupZilla::WEBKITVERSION) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Build time"), QupZilla::BUILDTIME) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Platform"), qz_buildSystem()));
QString pluginsString;
QStringList availablePlugins = mApp->plugins()->getAvailablePlugins();
foreach(const QString & fileName, availablePlugins) {
PluginInterface* plugin = mApp->plugins()->getPlugin(fileName);
if (!plugin) {
continue;
}
pluginsString.append(QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td></tr>").arg(
plugin->pluginName(), plugin->pluginVersion(),
Qt::escape(plugin->pluginAuthor()), plugin->pluginDescription()));
}
if (pluginsString.isEmpty()) {
pluginsString = QString("<tr><td colspan=4 class=\"no-available-plugins\">%1</td></tr>").arg(tr("No available plugins."));
}
cPage.replace("%PLUGINS-INFO%", pluginsString);
QString allGroupsString;
QSettings* settings = Settings::globalSettings();
foreach(const QString & group, settings->childGroups()) {
QString groupString = QString("<tr><th colspan=\"2\">%1</th></tr>").arg(group);
settings->beginGroup(group);
foreach(const QString & key, settings->childKeys()) {
const QVariant &keyValue = settings->value(key);
QString keyString;
switch (keyValue.type()) {
case QVariant::ByteArray:
keyString = "QByteArray";
break;
case QVariant::Point: {
const QPoint point = keyValue.toPoint();
keyString = QString("QPoint(%1, %2)").arg(QString::number(point.x()), QString::number(point.y()));
break;
}
case QVariant::StringList:
keyString = keyValue.toStringList().join(",");
break;
default:
keyString = keyValue.toString();
}
if (keyString.isEmpty()) {
keyString = "\"empty\"";
}
groupString.append(QString("<tr><td>%1</td><td>%2</td></tr>").arg(key, Qt::escape(keyString)));
}
settings->endGroup();
allGroupsString.append(groupString);
}
cPage.replace("%PREFS-INFO%", allGroupsString);
}
return cPage;
}

View File

@ -55,6 +55,7 @@ private:
QString reportbugPage();
QString startPage();
QString speeddialPage();
QString configPage();
QBuffer m_buffer;
QString m_pageName;