From b8fbcdbeb5aa17193a938daae022f5efc8736abc Mon Sep 17 00:00:00 2001 From: nowrep Date: Sat, 5 Nov 2011 18:36:53 +0100 Subject: [PATCH] Another little fixes (including showing unsorted bookmarks) Unsorted bookmarks are now properly showed at the bottom of tree in bookmarks manager. Removed unneeded code in siteinfowidget.cpp and tabwidget.cpp --- src/bookmarks/bookmarksmanager.cpp | 4 ++-- src/history/webhistoryinterface.h | 3 ++- src/network/networkmanager.cpp | 2 +- src/network/networkmanager.h | 1 + src/plugins/plugins.cpp | 3 ++- src/plugins/plugins.h | 2 +- src/tools/iconfetcher.cpp | 3 ++- src/webview/siteinfowidget.cpp | 3 --- src/webview/tabwidget.cpp | 22 ++++++++++------------ 9 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index 1a621136b..3e182d5e8 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -237,7 +237,7 @@ void BookmarksManager::refreshTable() int id = query.value(2).toInt(); QString folder = query.value(3).toString(); QIcon icon = IconProvider::iconFromBase64(query.value(4).toByteArray()); - QTreeWidgetItem* item; + QTreeWidgetItem* item = new QTreeWidgetItem(); if (folder == "bookmarksMenu") folder = tr("Bookmarks In Menu"); if (folder == "bookmarksToolbar") @@ -247,7 +247,7 @@ void BookmarksManager::refreshTable() QList findParent = ui->bookmarksTree->findItems(folder, 0); if (findParent.count() != 1) continue; - item = new QTreeWidgetItem(findParent.at(0)); + findParent.at(0)->addChild(item); } item->setText(0, title); diff --git a/src/history/webhistoryinterface.h b/src/history/webhistoryinterface.h index 728c815e9..bc1d857e2 100644 --- a/src/history/webhistoryinterface.h +++ b/src/history/webhistoryinterface.h @@ -19,6 +19,7 @@ #define WEBHISTORYINTERFACE_H #include +#include class WebHistoryInterface : public QWebHistoryInterface { @@ -34,7 +35,7 @@ signals: public slots: private: - QList m_clickedLinks; + QStringList m_clickedLinks; }; diff --git a/src/network/networkmanager.cpp b/src/network/networkmanager.cpp index 1dc558267..998fa0dbf 100644 --- a/src/network/networkmanager.cpp +++ b/src/network/networkmanager.cpp @@ -173,7 +173,7 @@ void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth) connect(box, SIGNAL(accepted()), dialog, SLOT(accept())); label->setText(tr("A username and password are being requested by %1. " - "The site says: \"%2\"").arg(reply->url().toEncoded(), auth->realm())); + "The site says: \"%2\"").arg(reply->url().toEncoded(), Qt::escape(auth->realm()))); formLa->addRow(label); formLa->addRow(userLab, user); diff --git a/src/network/networkmanager.h b/src/network/networkmanager.h index 8732ec31d..6e71fab85 100644 --- a/src/network/networkmanager.h +++ b/src/network/networkmanager.h @@ -30,6 +30,7 @@ #include #include #include +#include #include "networkmanagerproxy.h" diff --git a/src/plugins/plugins.cpp b/src/plugins/plugins.cpp index 004be1235..4aeb2b093 100644 --- a/src/plugins/plugins.cpp +++ b/src/plugins/plugins.cpp @@ -67,7 +67,8 @@ void Plugins::loadPlugins() m_loadedPluginFileNames.append(fileName); } } - qDebug() << loadedPlugins.count() << "plugins loaded"; + + std::cout << loadedPlugins.count() << "plugins loaded" << std::endl; } PluginInterface* Plugins::getPlugin(QString pluginFileName) diff --git a/src/plugins/plugins.h b/src/plugins/plugins.h index 1d3e9b904..af5003f5e 100644 --- a/src/plugins/plugins.h +++ b/src/plugins/plugins.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include class PluginInterface; class Plugins : public QObject diff --git a/src/tools/iconfetcher.cpp b/src/tools/iconfetcher.cpp index 6348d7098..37e729ca5 100644 --- a/src/tools/iconfetcher.cpp +++ b/src/tools/iconfetcher.cpp @@ -61,7 +61,8 @@ void IconFetcher::pageDownloaded() FollowRedirectReply* newReply; if (shortcutIconTag.isEmpty()) { // QUrl faviconUrl = replyUrl.resolved(QUrl("favicon.ico")); - // Rather getting favicon.ico from base directory than from subfolders +// +// Rather getting favicon.ico from base directory than from subfolders QUrl faviconUrl = QUrl(replyUrl.toString(QUrl::RemovePath | QUrl::RemoveQuery) + "/favicon.ico"); newReply = new FollowRedirectReply(faviconUrl, m_manager); } diff --git a/src/webview/siteinfowidget.cpp b/src/webview/siteinfowidget.cpp index a72ac4246..305ded60c 100644 --- a/src/webview/siteinfowidget.cpp +++ b/src/webview/siteinfowidget.cpp @@ -45,9 +45,6 @@ SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent) : QString scheme = url.scheme(); QSqlQuery query; QString host = url.host(); - QString host2 = host; - if (host.startsWith("www.")) - host2 = url.host().remove("www."); query.exec("SELECT sum(count) FROM history WHERE url LIKE '"+scheme+"://"+host+"%' "); if (query.next()) { diff --git a/src/webview/tabwidget.cpp b/src/webview/tabwidget.cpp index a594b409e..9410c3431 100644 --- a/src/webview/tabwidget.cpp +++ b/src/webview/tabwidget.cpp @@ -97,13 +97,13 @@ private: } }; -TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent) : - QTabWidget(parent) - , p_QupZilla(mainClass) - , m_lastTabIndex(0) - , m_isClosingToLastTabIndex(false) - , m_closedTabsManager(new ClosedTabsManager(this)) - , m_locationBars(new QStackedWidget()) +TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent) + : QTabWidget(parent) + , p_QupZilla(mainClass) + , m_lastTabIndex(0) + , m_isClosingToLastTabIndex(false) + , m_closedTabsManager(new ClosedTabsManager(this)) + , m_locationBars(new QStackedWidget()) { setObjectName("tabwidget"); m_tabBar = new TabBar(p_QupZilla, this); @@ -250,11 +250,9 @@ int TabWidget::addView(QUrl url, const QString &title, OpenUrlIn openIn, bool se webView->animationLoading(index, true)->movie()->stop(); webView->animationLoading(index, false)->setPixmap(_iconForUrl(url).pixmap(16,16)); - if (openIn == TabWidget::NewSelectedTab) { + if (openIn == TabWidget::NewSelectedTab) setCurrentIndex(index); - p_QupZilla->locationBar()->setText(url.toEncoded()); - p_QupZilla->locationBar()->setCursorPosition(0); - } + if (count() == 1 && m_hideTabBarWithOneTab) tabBar()->setVisible(false); else tabBar()->setVisible(true); @@ -284,7 +282,7 @@ int TabWidget::addView(QUrl url, const QString &title, OpenUrlIn openIn, bool se void TabWidget::setTabText(int index, const QString& text) { QString newtext = text; - newtext.remove("&"); // Avoid Alt+? shortcuts + newtext.remove("&"); // Avoid Alt+letter shortcuts if (WebTab* webTab = qobject_cast(p_QupZilla->tabWidget()->widget(index)) ) { if (webTab->isPinned())