diff --git a/src/app/qupzilla.cpp b/src/app/qupzilla.cpp index 9bf2f8af8..01b9a08e6 100644 --- a/src/app/qupzilla.cpp +++ b/src/app/qupzilla.cpp @@ -1142,7 +1142,9 @@ void QupZilla::showCookieManager() { CookieManager* m = mApp->cookieManager(); m->refreshTable(); + m->show(); + m->raise(); } void QupZilla::showHistoryManager() diff --git a/src/autofill/autofillmodel.cpp b/src/autofill/autofillmodel.cpp index 6f72632ae..6252195e5 100644 --- a/src/autofill/autofillmodel.cpp +++ b/src/autofill/autofillmodel.cpp @@ -218,6 +218,7 @@ void AutoFillModel::completePage(WebPage* page) if (element.attribute("type") != "text" && element.attribute("type") != "password" && element.attribute("type") != "") { continue; } + if (key == element.attribute("name")) { element.setAttribute("value", value); } diff --git a/src/cookies/cookiejar.cpp b/src/cookies/cookiejar.cpp index 0b8f38796..3190e10d7 100644 --- a/src/cookies/cookiejar.cpp +++ b/src/cookies/cookiejar.cpp @@ -21,7 +21,27 @@ #include "settings.h" //#define COOKIE_DEBUG -//TODO: black/white listing +bool containsDomain(QString string, QString domain) +{ + string.prepend("."); + if (domain.startsWith("www.")) { + domain = domain.mid(4); + } + + return string.contains(domain); +} + +bool listContainsDomain(const QStringList &list, const QString &domain) +{ + foreach(const QString & d, list) { + if (containsDomain(d, domain)) { + return true; + } + } + + return false; +} + CookieJar::CookieJar(QupZilla* mainClass, QObject* parent) : QNetworkCookieJar(parent) , p_QupZilla(mainClass) @@ -33,11 +53,14 @@ CookieJar::CookieJar(QupZilla* mainClass, QObject* parent) void CookieJar::loadSettings() { Settings settings; - settings.beginGroup("Web-Browser-Settings"); + settings.beginGroup("Cookie-Settings"); m_allowCookies = settings.value("allowCookies", true).toBool(); m_allowCookiesFromDomain = settings.value("allowCookiesFromVisitedDomainOnly", false).toBool(); m_filterTrackingCookie = settings.value("filterTrackingCookie", false).toBool(); m_deleteOnClose = settings.value("deleteCookiesOnClose", false).toBool(); + m_whitelist = settings.value("whitelist", QStringList()).toStringList(); + m_blacklist = settings.value("blacklist", QStringList()).toStringList(); + settings.endGroup(); } void CookieJar::setAllowCookies(bool allow) @@ -47,29 +70,42 @@ void CookieJar::setAllowCookies(bool allow) bool CookieJar::setCookiesFromUrl(const QList &cookieList, const QUrl &url) { - if (!m_allowCookies) { - return QNetworkCookieJar::setCookiesFromUrl(QList(), url); - } - QList newList = cookieList; - foreach(const QNetworkCookie & cok, newList) { - if (m_allowCookiesFromDomain && !QString("." + url.host()).contains(cok.domain().remove("www."))) { + foreach(const QNetworkCookie & cookie, newList) { + if (!m_allowCookies && !listContainsDomain(m_whitelist, cookie.domain())) { #ifdef COOKIE_DEBUG - qDebug() << "purged for domain mismatch" << cok; + qDebug() << "not in whitelist" << cookie; #endif - newList.removeOne(cok); + newList.removeOne(cookie); continue; } - if (m_filterTrackingCookie && cok.name().startsWith("__utm")) { + if (m_allowCookies && listContainsDomain(m_blacklist, cookie.domain())) { #ifdef COOKIE_DEBUG - qDebug() << "purged as tracking " << cok; + qDebug() << "found in blacklist" << cookie; #endif - newList.removeOne(cok); + newList.removeOne(cookie); + continue; + } + + if (m_allowCookiesFromDomain && !containsDomain(cookie.domain(), url.host())) { +#ifdef COOKIE_DEBUG + qDebug() << "purged for domain mismatch" << cookie; +#endif + newList.removeOne(cookie); + continue; + } + + if (m_filterTrackingCookie && cookie.name().startsWith("__utm")) { +#ifdef COOKIE_DEBUG + qDebug() << "purged as tracking " << cookie; +#endif + newList.removeOne(cookie); continue; } } + return QNetworkCookieJar::setCookiesFromUrl(newList, url); } @@ -94,7 +130,12 @@ void CookieJar::saveCookies() stream << count; for (int i = 0; i < count; i++) { - stream << allCookies.at(i).toRawForm(); + const QNetworkCookie &cookie = allCookies.at(i); + + if (cookie.isSessionCookie()) { + continue; + } + stream << cookie.toRawForm(); } file.close(); @@ -117,14 +158,17 @@ void CookieJar::restoreCookies() for (int i = 0; i < count; i++) { QByteArray rawForm; stream >> rawForm; - QNetworkCookie cok = QNetworkCookie::parseCookies(rawForm).at(0); - if (cok.expirationDate() < now) { + const QList &cookieList = QNetworkCookie::parseCookies(rawForm); + if (cookieList.isEmpty()) { continue; } - if (cok.isSessionCookie()) { + + const QNetworkCookie &cookie = cookieList.at(0); + + if (cookie.expirationDate() < now) { continue; } - restoredCookies.append(cok); + restoredCookies.append(cookie); } file.close(); diff --git a/src/cookies/cookiejar.h b/src/cookies/cookiejar.h index b96f3122d..05eb321d2 100644 --- a/src/cookies/cookiejar.h +++ b/src/cookies/cookiejar.h @@ -21,6 +21,7 @@ #include #include #include +#include class QupZilla; class CookieJar : public QNetworkCookieJar @@ -47,6 +48,9 @@ private: bool m_allowCookiesFromDomain; bool m_deleteOnClose; + QStringList m_whitelist; + QStringList m_blacklist; + QString m_activeProfil; QList m_tempList; }; diff --git a/src/cookies/cookiemanager.cpp b/src/cookies/cookiemanager.cpp index cbd12b083..4369d6a04 100644 --- a/src/cookies/cookiemanager.cpp +++ b/src/cookies/cookiemanager.cpp @@ -21,30 +21,37 @@ #include "cookiejar.h" #include "mainapplication.h" #include "globalfunctions.h" +#include "settings.h" CookieManager::CookieManager(QWidget* parent) : QWidget(parent) , ui(new Ui::CookieManager) , m_refreshCookieJar(true) { - setWindowModality(Qt::WindowModal); - ui->setupUi(this); qz_centerWidgetOnScreen(this); + // Stored Cookies connect(ui->cookieTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*))); connect(ui->removeAll, SIGNAL(clicked()), this, SLOT(removeAll())); connect(ui->removeOne, SIGNAL(clicked()), this, SLOT(removeCookie())); - connect(ui->close, SIGNAL(clicked(QAbstractButton*)), this, SLOT(hide())); - connect(ui->search, SIGNAL(returnPressed()), this, SLOT(search())); + 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())); ui->search->setInactiveText(tr("Search")); ui->cookieTree->setDefaultItemShowMode(TreeWidget::ItemsCollapsed); ui->cookieTree->sortItems(0, Qt::AscendingOrder); + ui->cookieTree->header()->setDefaultSectionSize(220); + ui->cookieTree->setFocus(); QShortcut* removeShortcut = new QShortcut(QKeySequence("Del"), this); - connect(removeShortcut, SIGNAL(activated()), this, SLOT(removeCookie())); + connect(removeShortcut, SIGNAL(activated()), this, SLOT(deletePressed())); } void CookieManager::removeAll() @@ -69,8 +76,6 @@ void CookieManager::removeCookie() QList allCookies = mApp->cookieJar()->getAllCookies(); - int indexToNavigate = -1; - if (current->text(1).isEmpty()) { //Remove whole cookie group QString domain = current->whatsThis(0); foreach(const QNetworkCookie & cookie, allCookies) { @@ -79,30 +84,21 @@ void CookieManager::removeCookie() } } - indexToNavigate = ui->cookieTree->indexOfTopLevelItem(current) - 1; ui->cookieTree->deleteItem(current); } else { const QNetworkCookie &cookie = qvariant_cast(current->data(0, Qt::UserRole + 10)); allCookies.removeOne(cookie); - indexToNavigate = ui->cookieTree->indexOfTopLevelItem(current->parent()); + QTreeWidgetItem* parentItem = current->parent(); ui->cookieTree->deleteItem(current); - } - mApp->cookieJar()->setAllCookies(allCookies); - - if (indexToNavigate > 0 && ui->cookieTree->topLevelItemCount() >= indexToNavigate) { - QTreeWidgetItem* scrollItem = ui->cookieTree->topLevelItem(indexToNavigate); - if (scrollItem) { - ui->cookieTree->setCurrentItem(scrollItem); - ui->cookieTree->scrollToItem(scrollItem); + if (parentItem->childCount() == 0) { + ui->cookieTree->deleteItem(parentItem); } } - if (!ui->search->text().isEmpty()) { - search(); - } + mApp->cookieJar()->setAllCookies(allCookies); } void CookieManager::currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* parent) @@ -139,6 +135,7 @@ void CookieManager::currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem void CookieManager::refreshTable() { QTimer::singleShot(0, this, SLOT(slotRefreshTable())); + QTimer::singleShot(0, this, SLOT(slotRefreshFilters())); } void CookieManager::slotRefreshTable() @@ -189,34 +186,93 @@ void CookieManager::slotRefreshTable() QApplication::restoreOverrideCursor(); } -void CookieManager::search() +void CookieManager::slotRefreshFilters() { - ui->cookieTree->filterString(ui->search->text()); -// QString searchText = ui->search->text(); -// if (searchText.isEmpty()) { -// refreshTable(false); -// return; -// } + Settings settings; + settings.beginGroup("Cookie-Settings"); + QStringList whiteList = settings.value("whitelist", QStringList()).toStringList(); + QStringList blackList = settings.value("blacklist", QStringList()).toStringList(); + settings.endGroup(); -// refreshTable(false); -// ui->cookieTree->setUpdatesEnabled(false); + ui->whiteList->addItems(whiteList); + ui->blackList->addItems(blackList); +} -// QList items = ui->cookieTree->findItems(".*"+searchText+"*", Qt::MatchRecursive | Qt::MatchWildcard); +void CookieManager::addWhitelist() +{ + const QString &server = QInputDialog::getText(this, tr("Add to whitelist"), tr("Server:")); + if (server.isEmpty()) { + return; + } -// QList foundItems; -// foreach(QTreeWidgetItem* fitem, items) { -// if (!fitem->text(0).startsWith(".")) -// continue; -// QTreeWidgetItem* item = new QTreeWidgetItem(); -// item->setText(0, fitem->text(0)); -// item->setText(1, fitem->text(1)); -// item->setWhatsThis(1, fitem->whatsThis(1)); -// foundItems.append(item); -// } + ui->whiteList->addItem(server); +} -// ui->cookieTree->clear(); -// ui->cookieTree->addTopLevelItems(foundItems); -// ui->cookieTree->setUpdatesEnabled(true); +void CookieManager::removeWhitelist() +{ + QListWidgetItem* current = ui->whiteList->currentItem(); + if (!current) { + return; + } + + delete current; +} + +void CookieManager::addBlacklist() +{ + const QString &server = QInputDialog::getText(this, tr("Add to blacklist"), tr("Server:")); + if (server.isEmpty()) { + return; + } + + ui->blackList->addItem(server); +} + +void CookieManager::removeBlacklist() +{ + QListWidgetItem* current = ui->blackList->currentItem(); + if (!current) { + return; + } + + delete current; +} + +void CookieManager::deletePressed() +{ + if (ui->cookieTree->hasFocus()) { + removeCookie(); + } + else if (ui->whiteList->hasFocus()) { + removeWhitelist(); + } + else if (ui->blackList->hasFocus()) { + removeBlacklist(); + } +} + +void CookieManager::closeEvent(QCloseEvent* e) +{ + QStringList whitelist; + QStringList blacklist; + + for (int i = 0; i < ui->whiteList->count(); ++i) { + whitelist.append(ui->whiteList->item(i)->text()); + } + + for (int i = 0; i < ui->blackList->count(); ++i) { + blacklist.append(ui->blackList->item(i)->text()); + } + + Settings settings; + settings.beginGroup("Cookie-Settings"); + settings.setValue("whitelist", whitelist); + settings.setValue("blacklist", blacklist); + settings.endGroup(); + + mApp->cookieJar()->loadSettings(); + + e->accept(); } CookieManager::~CookieManager() diff --git a/src/cookies/cookiemanager.h b/src/cookies/cookiemanager.h index 05b6e6c9a..de5dcfd5f 100644 --- a/src/cookies/cookiemanager.h +++ b/src/cookies/cookiemanager.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace Ui { @@ -45,11 +46,20 @@ private slots: void currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* parent); void removeCookie(); void removeAll(); - void search(); void slotRefreshTable(); + void slotRefreshFilters(); + + void addWhitelist(); + void removeWhitelist(); + void addBlacklist(); + void removeBlacklist(); + + void deletePressed(); private: + void closeEvent(QCloseEvent* e); + Ui::CookieManager* ui; bool m_refreshCookieJar; diff --git a/src/cookies/cookiemanager.ui b/src/cookies/cookiemanager.ui index 560ed1e3b..2e3c4eb79 100644 --- a/src/cookies/cookiemanager.ui +++ b/src/cookies/cookiemanager.ui @@ -13,228 +13,352 @@ Cookies - - - - - Find: + + + 4 + + + + + 0 - - - - - - - - - These cookies are stored on your computer: - - - - - - - true - - - true - - - 200 - - - 22 - - - - Server - - - - - Cookie name - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 6 - - - 3 - - - - - - 0 - 0 - - - - Name: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Value: - - - - - - - Server: - - - - - - - Path: - - - - - - - Secure: - - - - - - - Expiration: - - - - - - - <cookie not selected> - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - <cookie not selected> - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - <cookie not selected> - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - <cookie not selected> - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - <cookie not selected> - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - <cookie not selected> - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - - - Remove all cookies - - - - - - - Remove cookie - - - - - - - - 0 - 0 - - - - QDialogButtonBox::Close - - - - + + + Stored Cookies + + + + + + Find: + + + + + + + + + + These cookies are stored on your computer: + + + + + + + true + + + + Server + + + + + Cookie name + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 6 + + + 3 + + + + + + 0 + 0 + + + + Name: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Value: + + + + + + + Server: + + + + + + + Path: + + + + + + + Secure: + + + + + + + Expiration: + + + + + + + <cookie not selected> + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + <cookie not selected> + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + <cookie not selected> + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + <cookie not selected> + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + <cookie not selected> + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + <cookie not selected> + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + + + Remove all cookies + + + + + + + Remove cookies + + + + + + + + 0 + 0 + + + + QDialogButtonBox::Close + + + + + + + + + + + Cookie Filtering + + + + + + <b>Cookie whitelist</b> + + + + + + + Cookies from these servers will ALWAYS be accepted (even if you have disabled saving cookies) + + + true + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Add + + + + + + + Remove + + + + + + + + + + + + <b>Cookie blacklist</b> + + + + + + + Cookies from these servers will NEVER be accepted + + + true + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Add + + + + + + + Remove + + + + + + + + + QDialogButtonBox::Close + + + + + diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index e66041d3b..b2d5e55b4 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -242,6 +242,7 @@ void HistoryManager::slotRefreshTable() query.exec("SELECT title, url, id, date FROM history ORDER BY date DESC"); int counter = 0; + QHash hash; while (query.next()) { const QString &title = query.value(0).toString(); const QUrl &url = query.value(1).toUrl(); @@ -262,16 +263,18 @@ void HistoryManager::slotRefreshTable() localDate = QString("%1 %2").arg(HistoryModel::titleCaseLocalizedMonth(date.month()), QString::number(date.year())); } - QTreeWidgetItem* item = new QTreeWidgetItem(); - const QList& findParent = ui->historyTree->findItems(localDate, 0); - if (findParent.count() == 1) { - item = new QTreeWidgetItem(findParent.at(0)); + QTreeWidgetItem* item; + QTreeWidgetItem* findParent = hash[localDate]; + if (findParent) { + item = new QTreeWidgetItem(findParent); } else { QTreeWidgetItem* newParent = new QTreeWidgetItem(ui->historyTree); newParent->setText(0, localDate); newParent->setIcon(0, QIcon(":/icons/menu/history_entry.png")); ui->historyTree->addTopLevelItem(newParent); + hash[localDate] = newParent; + item = new QTreeWidgetItem(newParent); } diff --git a/src/history/historymanager.h b/src/history/historymanager.h index ccf09f3cc..cceb074d5 100644 --- a/src/history/historymanager.h +++ b/src/history/historymanager.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "historymodel.h" diff --git a/src/network/qupzillaschemehandler.cpp b/src/network/qupzillaschemehandler.cpp index 2e4f1523e..72acbd21a 100644 --- a/src/network/qupzillaschemehandler.cpp +++ b/src/network/qupzillaschemehandler.cpp @@ -185,10 +185,10 @@ QString QupZillaSchemeReply::aboutPage() aPage.replace("%VERSION-INFO%", QString("
%1
%2
").arg(tr("Version"), QupZilla::VERSION - #ifdef GIT_REVISION - + " (" + GIT_REVISION + ")" - #endif - ) + +#ifdef GIT_REVISION + + " (" + GIT_REVISION + ")" +#endif + ) + QString("
%1
%2
").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")); @@ -199,7 +199,7 @@ QString QupZillaSchemeReply::aboutPage() authorString("Mariusz Fik", "fisiu@opensuse.org") + "
" + authorString("Jan Rajnoha", "honza.rajny@hotmail.com") + "
" + authorString("Daniele Cocca", "jmc@chakra-project.org") - ); + ); aPage.replace("%TRANSLATORS%", tr("Translators")); aPage.replace("%TRANSLATORS-TEXT%", authorString("Heimen Stoffels", "vistausss@gmail.com") + " (Dutch)
" + @@ -220,7 +220,7 @@ QString QupZillaSchemeReply::aboutPage() authorString("Mladen Pejaković", "pejakm@gmail.com") + " (Serbian)
" + authorString("Unink-Lio", "unink4451@163.com") + " (Chinese)
" + authorString("Wu Cheng-Hong", "stu2731652@gmail.com") + " (Traditional Chinese)" - ); + ); } return aPage; @@ -318,10 +318,10 @@ QString QupZillaSchemeReply::configPage() cPage.replace("%VERSION-INFO%", QString("
%1
%2
").arg(tr("Application version"), QupZilla::VERSION - #ifdef GIT_REVISION - + " (" + GIT_REVISION + ")" - #endif - ) + +#ifdef GIT_REVISION + + " (" + GIT_REVISION + ")" +#endif + ) + QString("
%1
%2
").arg(tr("Qt version"), QT_VERSION_STR) + QString("
%1
%2
").arg(tr("WebKit version"), QupZilla::WEBKITVERSION) + QString("
%1
%2
").arg(tr("Build time"), QupZilla::BUILDTIME) + @@ -372,7 +372,7 @@ QString QupZillaSchemeReply::configPage() break; default: - keyString = keyValue.toString(); + keyString = keyValue.toString(); } if (keyString.isEmpty()) { diff --git a/src/preferences/preferences.cpp b/src/preferences/preferences.cpp index 08af115fc..1aa3e8fd3 100644 --- a/src/preferences/preferences.cpp +++ b/src/preferences/preferences.cpp @@ -253,7 +253,13 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) connect(ui->changeUserAgent, SIGNAL(toggled(bool)), this, SLOT(changeUserAgentChanged(bool))); changeUserAgentChanged(ui->changeUserAgent->isChecked()); + //CSS Style + ui->userStyleSheet->setText(settings.value("userStyleSheet", "").toString()); + 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); @@ -262,10 +268,6 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) ui->deleteCookiesOnClose->setChecked(settings.value("deleteCookiesOnClose", false).toBool()); ui->matchExactly->setChecked(settings.value("allowCookiesFromVisitedDomainOnly", false).toBool()); ui->filterTracking->setChecked(settings.value("filterTrackingCookie", false).toBool()); - - //CSS Style - ui->userStyleSheet->setText(settings.value("userStyleSheet", "").toString()); - connect(ui->chooseUserStylesheet, SIGNAL(clicked()), this, SLOT(chooseUserStyleClicked())); settings.endGroup(); //DOWNLOADS @@ -549,9 +551,11 @@ void Preferences::allowHtml5storageChanged(bool stat) void Preferences::showCookieManager() { - CookieManager* m = new CookieManager(); + CookieManager* m = mApp->cookieManager(); m->refreshTable(); + m->show(); + m->raise(); } void Preferences::openSslManager() @@ -800,8 +804,10 @@ void Preferences::saveSettings() settings.setValue("HTML5StorageEnabled", ui->html5storage->isChecked()); settings.setValue("deleteHTML5StorageOnClose", ui->deleteHtml5storageOnClose->isChecked()); 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()); diff --git a/src/preferences/sslmanager.cpp b/src/preferences/sslmanager.cpp index f83111be6..c78fb349b 100644 --- a/src/preferences/sslmanager.cpp +++ b/src/preferences/sslmanager.cpp @@ -26,7 +26,6 @@ SSLManager::SSLManager(QWidget* parent) : QDialog(parent) , ui(new Ui::SSLManager) { -// setWindowModality(Qt::WindowModal); setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(this); diff --git a/src/sidebar/bookmarkssidebar.cpp b/src/sidebar/bookmarkssidebar.cpp index 3b7cd0d67..567370674 100644 --- a/src/sidebar/bookmarkssidebar.cpp +++ b/src/sidebar/bookmarkssidebar.cpp @@ -264,7 +264,6 @@ void BookmarksSideBar::refreshTable() item->setText(0, title); item->setText(1, url.toEncoded()); item->setToolTip(0, url.toEncoded()); -// item->setToolTip(1, url.toEncoded()); item->setWhatsThis(0, QString::number(id)); item->setIcon(0, icon); diff --git a/src/sidebar/historysidebar.cpp b/src/sidebar/historysidebar.cpp index bbd01453c..849e2fc4e 100644 --- a/src/sidebar/historysidebar.cpp +++ b/src/sidebar/historysidebar.cpp @@ -177,6 +177,7 @@ void HistorySideBar::slotRefreshTable() query.exec("SELECT title, url, id, date FROM history ORDER BY date DESC"); int counter = 0; + QHash hash; while (query.next()) { const QString &title = query.value(0).toString(); const QUrl &url = query.value(1).toUrl(); @@ -198,15 +199,17 @@ void HistorySideBar::slotRefreshTable() } QTreeWidgetItem* item; - const QList& findParent = ui->historyTree->findItems(localDate, 0); - if (findParent.count() == 1) { - item = new QTreeWidgetItem(findParent.at(0)); + QTreeWidgetItem* findParent = hash[localDate]; + if (findParent) { + item = new QTreeWidgetItem(findParent); } else { QTreeWidgetItem* newParent = new QTreeWidgetItem(ui->historyTree); newParent->setText(0, localDate); newParent->setIcon(0, QIcon(":/icons/menu/history_entry.png")); ui->historyTree->addTopLevelItem(newParent); + hash[localDate] = newParent; + item = new QTreeWidgetItem(newParent); } diff --git a/src/sidebar/historysidebar.h b/src/sidebar/historysidebar.h index 467284e94..fe5d8634e 100644 --- a/src/sidebar/historysidebar.h +++ b/src/sidebar/historysidebar.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "historymodel.h" diff --git a/src/webview/webpage.cpp b/src/webview/webpage.cpp index c26ca5243..09babd05f 100644 --- a/src/webview/webpage.cpp +++ b/src/webview/webpage.cpp @@ -221,18 +221,18 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply) return; } - case QNetworkReply::ProtocolUnknownError: + case QNetworkReply::ProtocolUnknownError: { qDebug() << "WebPage::UnsupportedContent" << url << "ProtocolUnknowError"; - // We are not going to end in endless new tab opening loop in case - // user has QupZilla as default provider for http / https urls - if (!url.scheme().startsWith("http")) { + // We will open only known url schemes that we cannot handle + const QString &urlScheme = url.scheme(); + if (urlScheme == "ftp" || urlScheme == "mailto") { QDesktopServices::openUrl(url); } reply->deleteLater(); return; - + } default: break; } @@ -250,7 +250,7 @@ void WebPage::downloadRequested(const QNetworkRequest &request) void WebPage::setSSLCertificate(const QSslCertificate &cert) { -// if (cert != m_SslCert) + // if (cert != m_SslCert) m_SslCert = cert; }