From a34a72cdb86bbc44234e4ae78698efc22f01d117 Mon Sep 17 00:00:00 2001 From: nowrep Date: Wed, 23 Jan 2013 01:34:15 +0100 Subject: [PATCH] Moved all cookies settings into Cookies Manager. --- CHANGELOG | 22 +++ src/lib/cookies/cookiemanager.cpp | 26 ++- src/lib/cookies/cookiemanager.h | 3 +- src/lib/cookies/cookiemanager.ui | 117 ++++++++++++ src/lib/navigation/locationbar.cpp | 8 +- src/lib/preferences/preferences.cpp | 27 +-- src/lib/preferences/preferences.h | 3 +- src/lib/preferences/preferences.ui | 267 ++++++++++++---------------- src/lib/tools/qztools.h | 63 +++---- 9 files changed, 314 insertions(+), 222 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 53725dec0..294213f9f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,25 @@ +Version 1.4.0 + * not yet released + * highlighting host in address in locationbar + * can now be compiled using Qt 5 + * QtWebKit 2.3 new features - caret browsing, animated scrolling + * asking user whether to allow site to use notifications/geolocation + * option to set JavaScript privacy permissions + * option to specify default search engine used in locationbar + * option to disable search suggestions in websearchbar + * option to search only whole words in source viewer + * option to hide reload/stop buttons in navigationbar + * option to disable alt/ctrl + numbers shortcuts + * option to switch to tab from locationbar popup completer + * use .qupzilla/tmp instead of /tmp for temporary data + * fixed cookie domain handling according to RFC 6265 + * fixed qvalue format in Accept-Language HTTP header + * fixed sorting files case insensitively in file scheme handler + * fixed possible crash in saving page screen of a really long page + * X11: fixed Ctrl+Q shortcut for DEs other than KDE and Gnome + * windows: improved installer allows registering as default web browser + * windows: check and set as default browser from preferences + Version 1.3.5 * released 16 September 2012 * new Persian translation diff --git a/src/lib/cookies/cookiemanager.cpp b/src/lib/cookies/cookiemanager.cpp index 82cdab912..cc45237f1 100644 --- a/src/lib/cookies/cookiemanager.cpp +++ b/src/lib/cookies/cookiemanager.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,12 +46,27 @@ CookieManager::CookieManager(QWidget* parent) connect(ui->close, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->close2, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->search, SIGNAL(textChanged(QString)), ui->cookieTree, SLOT(filterString(QString))); + // Cookie Filtering connect(ui->whiteAdd, SIGNAL(clicked()), this, SLOT(addWhitelist())); connect(ui->whiteRemove, SIGNAL(clicked()), this, SLOT(removeWhitelist())); connect(ui->blackAdd, SIGNAL(clicked()), this, SLOT(addBlacklist())); connect(ui->blackRemove, SIGNAL(clicked()), this, SLOT(removeBlacklist())); + // Cookie Settings + Settings settings; + settings.beginGroup("Cookie-Settings"); + ui->saveCookies->setChecked(settings.value("allowCookies", true).toBool()); + if (!ui->saveCookies->isChecked()) { + ui->deleteCookiesOnClose->setEnabled(false); + } + ui->deleteCookiesOnClose->setChecked(settings.value("deleteCookiesOnClose", false).toBool()); + ui->matchExactly->setChecked(settings.value("allowCookiesFromVisitedDomainOnly", false).toBool()); + ui->filterTracking->setChecked(settings.value("filterTrackingCookie", false).toBool()); + settings.endGroup(); + + connect(ui->saveCookies, SIGNAL(toggled(bool)), this, SLOT(saveCookiesChanged(bool))); + ui->search->setPlaceholderText(tr("Search")); ui->cookieTree->setDefaultItemShowMode(TreeWidget::ItemsCollapsed); ui->cookieTree->sortItems(0, Qt::AscendingOrder); @@ -257,6 +272,11 @@ void CookieManager::deletePressed() } } +void CookieManager::saveCookiesChanged(bool state) +{ + ui->deleteCookiesOnClose->setEnabled(state); +} + void CookieManager::closeEvent(QCloseEvent* e) { QStringList whitelist; @@ -272,6 +292,10 @@ void CookieManager::closeEvent(QCloseEvent* e) Settings settings; settings.beginGroup("Cookie-Settings"); + settings.setValue("allowCookies", ui->saveCookies->isChecked()); + settings.setValue("deleteCookiesOnClose", ui->deleteCookiesOnClose->isChecked()); + settings.setValue("allowCookiesFromVisitedDomainOnly", ui->matchExactly->isChecked()); + settings.setValue("filterTrackingCookie", ui->filterTracking->isChecked()); settings.setValue("whitelist", whitelist); settings.setValue("blacklist", blacklist); settings.endGroup(); diff --git a/src/lib/cookies/cookiemanager.h b/src/lib/cookies/cookiemanager.h index 8a9f8c444..68a1623b5 100644 --- a/src/lib/cookies/cookiemanager.h +++ b/src/lib/cookies/cookiemanager.h @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,6 +55,7 @@ private slots: void removeBlacklist(); void deletePressed(); + void saveCookiesChanged(bool state); private: void closeEvent(QCloseEvent* e); diff --git a/src/lib/cookies/cookiemanager.ui b/src/lib/cookies/cookiemanager.ui index 2e3c4eb79..84b478c51 100644 --- a/src/lib/cookies/cookiemanager.ui +++ b/src/lib/cookies/cookiemanager.ui @@ -359,6 +359,123 @@ + + + Settings + + + + + + <b>Cookie Settings</b> + + + + + + + Allow storing of cookies + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Delete cookies on close + + + + + + + Qt::Horizontal + + + + 344 + 20 + + + + + + + + Match domain exactly + + + + + + + Filter tracking cookies + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + <b>Warning:</b> Match domain exactly and filter tracking cookies options can lead to deny some cookies from sites. If you have problems with cookies, try to disable this options first! + + + true + + + + + + + QDialogButtonBox::Close + + + + + diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index c50eb40f3..f09bf3793 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -637,7 +637,7 @@ void LocationBar::paintEvent(QPaintEvent* event) switch (m_progressStyle) { case ProgressFilled: { QRect bar = contentsRect.adjusted(0, 1, 0, -1); - bar.setWidth(bar.width()*m_loadProgress / 100); + bar.setWidth(bar.width() * m_loadProgress / 100); const int roundness = bar.height() / 4.0; p.drawRoundedRect(bar, roundness, roundness); break; @@ -647,7 +647,7 @@ void LocationBar::paintEvent(QPaintEvent* event) outlinePen.setColor(outlinePen.color().darker(130)); p.setPen(outlinePen); QRect bar(contentsRect.x(), contentsRect.bottom() - 3, - contentsRect.width()*m_loadProgress / 100.0, 3); + contentsRect.width() * m_loadProgress / 100.0, 3); p.drawRoundedRect(bar, 1, 1); break; } @@ -656,7 +656,7 @@ void LocationBar::paintEvent(QPaintEvent* event) outlinePen.setColor(outlinePen.color().darker(130)); p.setPen(outlinePen); QRect bar(contentsRect.x(), contentsRect.top() + 1, - contentsRect.width()*m_loadProgress / 100.0, 3); + contentsRect.width() * m_loadProgress / 100.0, 3); p.drawRoundedRect(bar, 1, 1); break; } diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index 332f229e6..0016032a0 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -294,18 +294,6 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) connect(ui->chooseUserStylesheet, SIGNAL(clicked()), this, SLOT(chooseUserStyleClicked())); settings.endGroup(); - //Cookies - settings.beginGroup("Cookie-Settings"); - ui->saveCookies->setChecked(settings.value("allowCookies", true).toBool()); - if (!ui->saveCookies->isChecked()) { - ui->deleteCookiesOnClose->setEnabled(false); - } - connect(ui->saveCookies, SIGNAL(toggled(bool)), this, SLOT(saveCookiesChanged(bool))); - ui->deleteCookiesOnClose->setChecked(settings.value("deleteCookiesOnClose", false).toBool()); - ui->matchExactly->setChecked(settings.value("allowCookiesFromVisitedDomainOnly", false).toBool()); - ui->filterTracking->setChecked(settings.value("filterTrackingCookie", false).toBool()); - settings.endGroup(); - //DOWNLOADS settings.beginGroup("DownloadManager"); ui->downLoc->setText(settings.value("defaultDownloadPath", "").toString()); @@ -608,11 +596,6 @@ void Preferences::saveHistoryChanged(bool stat) ui->deleteHistoryOnClose->setEnabled(stat); } -void Preferences::saveCookiesChanged(bool state) -{ - ui->deleteCookiesOnClose->setEnabled(state); -} - void Preferences::allowHtml5storageChanged(bool stat) { ui->deleteHtml5storageOnClose->setEnabled(stat); @@ -923,14 +906,6 @@ void Preferences::saveSettings() settings.setValue("SendReferer", ui->sendReferer->isChecked()); settings.endGroup(); - //Cookies - settings.beginGroup("Cookie-Settings"); - settings.setValue("allowCookies", ui->saveCookies->isChecked()); - settings.setValue("deleteCookiesOnClose", ui->deleteCookiesOnClose->isChecked()); - settings.setValue("allowCookiesFromVisitedDomainOnly", ui->matchExactly->isChecked()); - settings.setValue("filterTrackingCookie", ui->filterTracking->isChecked()); - settings.endGroup(); - //NOTIFICATIONS settings.beginGroup("Notifications"); settings.setValue("Timeout", ui->notificationTimeout->value() * 1000); diff --git a/src/lib/preferences/preferences.h b/src/lib/preferences/preferences.h index 9449fa98b..677c15b07 100644 --- a/src/lib/preferences/preferences.h +++ b/src/lib/preferences/preferences.h @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,7 +64,6 @@ private slots: void openJsOptions(); void saveHistoryChanged(bool state); - void saveCookiesChanged(bool state); void allowHtml5storageChanged(bool state); void downLocChanged(bool state); void allowCacheChanged(bool state); diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui index 0cb6756cd..f7e9055f6 100644 --- a/src/lib/preferences/preferences.ui +++ b/src/lib/preferences/preferences.ui @@ -2029,51 +2029,124 @@ - - - - Allow storing of cookies - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - + Send Referer header to servers - - - - Filter tracking cookies - - - - + <b>Cookies</b> - + + + + Send Do Not Track header to servers + + + + + + + <b>Other</b> + + + + + + + Manage CA certificates + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + Certificate Manager + + + + + + + <b>SSL Certificates</b> + + + + + + + true + + + <b>JavaScript</b> + + + + + + + false + + + Manage JavaScript privacy options + + + + + + + + 0 + 0 + + + + JavaScript options + + + + + + + + 0 + 0 + + + + Cookies Manager + + + + Qt::Horizontal @@ -2089,38 +2162,14 @@ - - + + - Match domain exactly + Manage Cookies - - - - Send Do Not Track header to servers - - - - - - - <b>Other</b> - - - - - - - Manage CA certificates - - - true - - - - + Qt::Horizontal @@ -2133,102 +2182,6 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - Cookies Manager - - - - - - - - 0 - 0 - - - - Certificate Manager - - - - - - - <b>SSL Certificates</b> - - - - - - - <b>Warning:</b> Match domain exactly and filter tracking cookies options can lead to deny some cookies from sites. If you have problems with cookies, try to disable this options first! - - - true - - - - - - - Delete cookies on close - - - - - - - true - - - <b>JavaScript</b> - - - - - - - false - - - Manage JavaScript privacy options - - - - - - - - 0 - 0 - - - - JavaScript options - - - diff --git a/src/lib/tools/qztools.h b/src/lib/tools/qztools.h index c43f0b7dc..b52325f02 100644 --- a/src/lib/tools/qztools.h +++ b/src/lib/tools/qztools.h @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,47 +30,48 @@ class QIcon; class QWidget; class QUrl; -namespace QzTools { - QByteArray QT_QUPZILLA_EXPORT pixmapToByteArray(const QPixmap &pix); - QPixmap QT_QUPZILLA_EXPORT pixmapFromByteArray(const QByteArray &data); +namespace QzTools +{ +QByteArray QT_QUPZILLA_EXPORT pixmapToByteArray(const QPixmap &pix); +QPixmap QT_QUPZILLA_EXPORT pixmapFromByteArray(const QByteArray &data); - QString QT_QUPZILLA_EXPORT readAllFileContents(const QString &filename); +QString QT_QUPZILLA_EXPORT readAllFileContents(const QString &filename); - void QT_QUPZILLA_EXPORT centerWidgetOnScreen(QWidget* w); - void QT_QUPZILLA_EXPORT centerWidgetToParent(QWidget* w, QWidget* parent); +void QT_QUPZILLA_EXPORT centerWidgetOnScreen(QWidget* w); +void QT_QUPZILLA_EXPORT centerWidgetToParent(QWidget* w, QWidget* parent); - bool QT_QUPZILLA_EXPORT removeFile(const QString &fullFileName); - void QT_QUPZILLA_EXPORT removeDir(const QString &d); +bool QT_QUPZILLA_EXPORT removeFile(const QString &fullFileName); +void QT_QUPZILLA_EXPORT removeDir(const QString &d); - QString QT_QUPZILLA_EXPORT samePartOfStrings(const QString &one, const QString &other); - QUrl QT_QUPZILLA_EXPORT makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl); - QString QT_QUPZILLA_EXPORT urlEncodeQueryString(const QUrl &url); +QString QT_QUPZILLA_EXPORT samePartOfStrings(const QString &one, const QString &other); +QUrl QT_QUPZILLA_EXPORT makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl); +QString QT_QUPZILLA_EXPORT urlEncodeQueryString(const QUrl &url); - QString QT_QUPZILLA_EXPORT ensureUniqueFilename(const QString &name, const QString &appendFormat = QString("(%1)")); - QString QT_QUPZILLA_EXPORT getFileNameFromUrl(const QUrl &url); - QString QT_QUPZILLA_EXPORT filterCharsFromFilename(const QString &name); +QString QT_QUPZILLA_EXPORT ensureUniqueFilename(const QString &name, const QString &appendFormat = QString("(%1)")); +QString QT_QUPZILLA_EXPORT getFileNameFromUrl(const QUrl &url); +QString QT_QUPZILLA_EXPORT filterCharsFromFilename(const QString &name); - QString QT_QUPZILLA_EXPORT alignTextToWidth(const QString &string, const QString &text, const QFontMetrics &metrics, int width); - QString QT_QUPZILLA_EXPORT fileSizeToString(qint64 size); +QString QT_QUPZILLA_EXPORT alignTextToWidth(const QString &string, const QString &text, const QFontMetrics &metrics, int width); +QString QT_QUPZILLA_EXPORT fileSizeToString(qint64 size); - QPixmap QT_QUPZILLA_EXPORT createPixmapForSite(const QIcon &icon, const QString &title, const QString &url); - QString QT_QUPZILLA_EXPORT applyDirectionToPage(QString &pageContents); +QPixmap QT_QUPZILLA_EXPORT createPixmapForSite(const QIcon &icon, const QString &title, const QString &url); +QString QT_QUPZILLA_EXPORT applyDirectionToPage(QString &pageContents); - QString QT_QUPZILLA_EXPORT buildSystem(); +QString QT_QUPZILLA_EXPORT buildSystem(); - // Qt5 migration help functions - bool QT_QUPZILLA_EXPORT isCertificateValid(const QSslCertificate &cert); - QString QT_QUPZILLA_EXPORT escape(const QString &string); +// Qt5 migration help functions +bool QT_QUPZILLA_EXPORT isCertificateValid(const QSslCertificate &cert); +QString QT_QUPZILLA_EXPORT escape(const QString &string); - #ifdef QZ_WS_X11 - void QT_QUPZILLA_EXPORT* X11Display(const QWidget* widget); - #endif +#ifdef QZ_WS_X11 +void QT_QUPZILLA_EXPORT* X11Display(const QWidget* widget); +#endif - template - bool listContainsIndex(const QList &list, int index) - { - return (index >= 0 && list.count() > index); - } +template +bool listContainsIndex(const QList &list, int index) +{ + return (index >= 0 && list.count() > index); +} } // namespace