From 9161945d97eb37f23239c15a607d18a360e423fb Mon Sep 17 00:00:00 2001 From: nowrep Date: Mon, 12 Mar 2012 18:22:01 +0100 Subject: [PATCH] Various fixes regarding "Don't load tabs until selected" option - fixed typo in Access Keys Navigation plugin --- .gitignore | 4 +- src/lib/app/commandlineoptions.cpp | 4 +- src/lib/app/mainapplication.cpp | 2 +- src/lib/app/profileupdater.cpp | 8 +-- src/lib/preferences/preferences.ui | 49 ++++++++++--------- src/lib/tools/closedtabsmanager.cpp | 20 ++++---- src/lib/tools/closedtabsmanager.h | 4 +- src/lib/webview/siteinfo.cpp | 2 +- src/lib/webview/tabwidget.cpp | 42 +++++----------- src/lib/webview/tabwidget.h | 2 - src/lib/webview/webtab.cpp | 37 +++++++++----- src/lib/webview/webtab.h | 5 +- src/main/main.cpp | 2 +- .../AccessKeysNavigation/akn_plugin.cpp | 2 +- .../AccessKeysNavigation/akn_settings.ui | 2 +- .../translations/cs_CZ.ts | 2 +- .../translations/de_DE.ts | 2 +- .../translations/nl_NL.ts | 2 +- .../translations/sr_BA.ts | 2 +- .../translations/sr_RS.ts | 2 +- .../translations/zh_TW.ts | 2 +- 21 files changed, 99 insertions(+), 98 deletions(-) diff --git a/.gitignore b/.gitignore index cfd478ffb..c0cb7226c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,5 +21,7 @@ libqupzilla.* bin/core qupzilla.sh git_revision -bin/qupzilla.exe +*.exe +*.dll +*.lib Thumbs.db diff --git a/src/lib/app/commandlineoptions.cpp b/src/lib/app/commandlineoptions.cpp index a745de5e3..235911e6d 100644 --- a/src/lib/app/commandlineoptions.cpp +++ b/src/lib/app/commandlineoptions.cpp @@ -99,7 +99,7 @@ void CommandLineOptions::parseActions() if (arg.startsWith("-p=") || arg.startsWith("--profile=")) { arg.remove("-p="); arg.remove("--profile="); - cout << "starting with profile " << arg.toUtf8().data() << endl; + cout << "QupZilla: Starting with profile " << arg.toUtf8().data() << endl; ActionPair pair; pair.action = Qz::CL_StartWithProfile; pair.text = arg; @@ -144,7 +144,7 @@ void CommandLineOptions::parseActions() QString url(m_argv[m_argc - 1]); if (m_argc > 1 && !url.isEmpty() && !url.startsWith("-") && url.contains(".")) { - cout << "starting with url " << url.toUtf8().data() << endl; + cout << "QupZilla: Starting with url " << url.toUtf8().data() << endl; ActionPair pair; pair.action = Qz::CL_OpenUrl; pair.text = url; diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 4f5015e1e..975069c75 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -895,7 +895,7 @@ bool MainApplication::checkSettingsDir() return true; } - std::cout << "Creating new profile directory" << std::endl; + std::cout << "QupZilla: Creating new profile directory" << std::endl; QDir dir(PROFILEDIR); diff --git a/src/lib/app/profileupdater.cpp b/src/lib/app/profileupdater.cpp index 887e4763c..2fa9c6bfb 100644 --- a/src/lib/app/profileupdater.cpp +++ b/src/lib/app/profileupdater.cpp @@ -93,7 +93,7 @@ void ProfileUpdater::updateProfile(const QString ¤t, const QString &profil return; } - std::cout << "incompatible profile version detected, overwriting profile data..." << std::endl; + std::cout << "QupZilla: Incompatible profile version detected, overwriting profile data..." << std::endl; copyDataToProfile(); } @@ -110,7 +110,7 @@ void ProfileUpdater::copyDataToProfile() void ProfileUpdater::update100b4() { - std::cout << "upgrading profile version from 1.0.0-b4..." << std::endl; + std::cout << "QupZilla: Upgrading profile version from 1.0.0-b4..." << std::endl; mApp->connectDatabase(); QSqlQuery query; @@ -120,7 +120,7 @@ void ProfileUpdater::update100b4() void ProfileUpdater::update100rc1() { - std::cout << "upgrading profile version from 1.0.0-rc1..." << std::endl; + std::cout << "QupZilla: Upgrading profile version from 1.0.0-rc1..." << std::endl; mApp->connectDatabase(); QSqlQuery query; @@ -134,7 +134,7 @@ void ProfileUpdater::update100rc1() void ProfileUpdater::update100() { - std::cout << "upgrading profile version from 1.0.0..." << std::endl; + std::cout << "QupZilla: Upgrading profile version from 1.0.0..." << std::endl; mApp->connectDatabase(); QSqlQuery query; diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui index 2ec66d3a4..a252e1609 100644 --- a/src/lib/preferences/preferences.ui +++ b/src/lib/preferences/preferences.ui @@ -6,10 +6,16 @@ 0 0 - 829 - 496 + 800 + 500 + + + 800 + 500 + + Preferences @@ -292,24 +298,24 @@ - + <b>Profiles</b> - + Startup profile: - + - + QFrame::NoFrame @@ -398,35 +404,35 @@ - + Active profile: - + - + In order to change language, you must restart browser. - + <b>Language</b> - + @@ -449,10 +455,17 @@ - + - + + + + Don't load tabs until selected + + + + Qt::Vertical @@ -465,13 +478,6 @@ - - - - Don't load tabs until selected - - - @@ -1697,9 +1703,6 @@ - - QLayout::SetFixedSize - diff --git a/src/lib/tools/closedtabsmanager.cpp b/src/lib/tools/closedtabsmanager.cpp index 99d720dad..7a17bc6f9 100644 --- a/src/lib/tools/closedtabsmanager.cpp +++ b/src/lib/tools/closedtabsmanager.cpp @@ -16,30 +16,30 @@ * along with this program. If not, see . * ============================================================ */ #include "closedtabsmanager.h" -#include "webview.h" +#include "webtab.h" #include "mainapplication.h" #include +#include ClosedTabsManager::ClosedTabsManager() { } -void ClosedTabsManager::saveView(WebView* view, int position) +void ClosedTabsManager::saveView(WebTab* tab, int position) { if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) || - (view->url().isEmpty() && view->history()->items().count() == 0)) { + (tab->url().isEmpty() && tab->history()->items().count() == 0)) { return; } - Tab tab; - tab.url = view->url(); - tab.title = view->title(); - tab.position = position; - QDataStream tabHistoryStream(&tab.history, QIODevice::WriteOnly); - tabHistoryStream << *view->history(); + Tab closedTab; + closedTab.url = tab->url(); + closedTab.title = tab->title(); + closedTab.position = position; + closedTab.history = tab->historyData(); - m_closedTabs.prepend(tab); + m_closedTabs.prepend(closedTab); } ClosedTabsManager::Tab ClosedTabsManager::getFirstClosedTab() diff --git a/src/lib/tools/closedtabsmanager.h b/src/lib/tools/closedtabsmanager.h index 6307d94ce..56ce5ac29 100644 --- a/src/lib/tools/closedtabsmanager.h +++ b/src/lib/tools/closedtabsmanager.h @@ -22,7 +22,7 @@ #include "qz_namespace.h" -class WebView; +class WebTab; class QT_QUPZILLA_EXPORT ClosedTabsManager { @@ -42,7 +42,7 @@ public: explicit ClosedTabsManager(); - void saveView(WebView* view, int position); + void saveView(WebTab *tab, int position); ClosedTabsManager::Tab getFirstClosedTab(); ClosedTabsManager::Tab getTabAt(int index); diff --git a/src/lib/webview/siteinfo.cpp b/src/lib/webview/siteinfo.cpp index cb9ec5556..4cffc8b9b 100644 --- a/src/lib/webview/siteinfo.cpp +++ b/src/lib/webview/siteinfo.cpp @@ -59,7 +59,7 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent) QWebFrame* frame = view->page()->mainFrame(); QString title = view->title(); QSslCertificate cert = webPage->sslCertificate(); - m_baseUrl = view->url(); + m_baseUrl = frame->baseUrl(); //GENERAL ui->heading->setText(QString("%1:").arg(title)); diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp index 9c34f97c9..21df75dda 100644 --- a/src/lib/webview/tabwidget.cpp +++ b/src/lib/webview/tabwidget.cpp @@ -93,8 +93,6 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent) connect(this, SIGNAL(currentChanged(int)), p_QupZilla, SLOT(refreshHistory())); connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); - connect(m_tabBar, SIGNAL(backTab(int)), this, SLOT(backTab(int))); - connect(m_tabBar, SIGNAL(forwardTab(int)), this, SLOT(forwardTab(int))); connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int))); connect(m_tabBar, SIGNAL(stopTab(int)), this, SLOT(stopTab(int))); connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int))); @@ -358,7 +356,7 @@ void TabWidget::closeTab(int index) disconnect(webView, SIGNAL(changed()), mApp, SLOT(setStateChanged())); disconnect(webView, SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString))); //Save last tab url and history - m_closedTabsManager->saveView(webView, index); + m_closedTabsManager->saveView(webTab, index); if (m_isClosingToLastTabIndex && m_lastTabIndex < count() && index == currentIndex()) { setCurrentIndex(m_lastTabIndex); @@ -463,19 +461,16 @@ void TabWidget::closeAllButCurrent(int index) int TabWidget::duplicateTab(int index) { - WebView* view = weTab(index)->view(); - const QUrl &url = view->url(); + WebTab* webTab = weTab(index); - QByteArray history; - QDataStream tabHistoryStream(&history, QIODevice::WriteOnly); - tabHistoryStream << *view->history(); + const QUrl &url = webTab->url(); + const QByteArray &history = webTab->historyData(); QNetworkRequest req(url); req.setRawHeader("Referer", url.toEncoded()); int id = addView(req, tabText(index), Qz::NT_CleanNotSelectedTab); - QDataStream historyStream(history); - historyStream >> *weTab(id)->history(); + weTab(id)->setHistoryData(history); return id; } @@ -579,29 +574,18 @@ void TabWidget::savePinnedTabs() QStringList tabs; QList tabsHistory; for (int i = 0; i < count(); ++i) { - if (WebTab* tab = weTab(i)) { - if (!tab->isPinned()) { - continue; - } + WebTab* tab = weTab(i); + if (!tab || !tab->isPinned()) { + continue; + } - tabs.append(tab->url().toEncoded()); - if (tab->history()->count() != 0) { - QByteArray tabHistory; - QDataStream tabHistoryStream(&tabHistory, QIODevice::WriteOnly); - tabHistoryStream << *tab->history(); - tabsHistory.append(tabHistory); - } - else { - tabsHistory << QByteArray(); - } - } - else { - tabs.append(QString::null); - tabsHistory.append(QByteArray()); - } + tabs.append(tab->url().toEncoded()); + tabsHistory.append(tab->historyData()); } + stream << tabs; stream << tabsHistory; + QFile file(mApp->getActiveProfilPath() + "pinnedtabs.dat"); file.open(QIODevice::WriteOnly); file.write(data); diff --git a/src/lib/webview/tabwidget.h b/src/lib/webview/tabwidget.h index 65f4ce022..dd4a7c635 100644 --- a/src/lib/webview/tabwidget.h +++ b/src/lib/webview/tabwidget.h @@ -93,8 +93,6 @@ public slots: void reloadTab(int index); void reloadAllTabs(); void stopTab(int index); - void backTab(int index); - void forwardTab(int index); void closeAllButCurrent(int index); void restoreClosedTab(); void restoreAllClosedTabs(); diff --git a/src/lib/webview/webtab.cpp b/src/lib/webview/webtab.cpp index d6c60605c..8639b027b 100644 --- a/src/lib/webview/webtab.cpp +++ b/src/lib/webview/webtab.cpp @@ -31,19 +31,10 @@ WebTab::SavedTab::SavedTab(WebTab* webTab) { - if (webTab->isRestored()) { - WebView* view = webTab->view(); - - title = view->title(); - url = view->url(); - icon = view->icon(); - - QDataStream historyStream(&history, QIODevice::WriteOnly); - historyStream << *view->history(); - } - else { - *this = webTab->savedTab(); - } + title = webTab->title(); + url = webTab->url(); + icon = webTab->icon(); + history = webTab->historyData(); } void WebTab::SavedTab::clear() @@ -152,6 +143,26 @@ QWebHistory* WebTab::history() const return m_view->history(); } +void WebTab::setHistoryData(const QByteArray &data) +{ + QDataStream historyStream(data); + historyStream >> *m_view->history(); +} + +QByteArray WebTab::historyData() const +{ + if (isRestored()) { + QByteArray historyArray; + QDataStream historyStream(&historyArray, QIODevice::WriteOnly); + historyStream << *m_view->history(); + + return historyArray; + } + else { + return m_savedTab.history; + } +} + void WebTab::reload() { m_view->reload(); diff --git a/src/lib/webview/webtab.h b/src/lib/webview/webtab.h index a2a11dea5..876cd3fde 100644 --- a/src/lib/webview/webtab.h +++ b/src/lib/webview/webtab.h @@ -62,7 +62,10 @@ public: QUrl url() const; QString title() const; QIcon icon() const; - QWebHistory* history() const; + QWebHistory *history() const; + + void setHistoryData(const QByteArray &data); + QByteArray historyData() const; void reload(); void stop(); diff --git a/src/main/main.cpp b/src/main/main.cpp index a3fa1dfd0..fe0652b96 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -32,7 +32,7 @@ void sigpipe_handler(int s) // this signal and ignoring it to prevent unneeded crash because of it. Q_UNUSED(s) - std::cout << "QupZilla::Caught SIGPIPE!" << std::endl; + std::cout << "QupZilla: Caught SIGPIPE!" << std::endl; } #endif diff --git a/src/plugins/AccessKeysNavigation/akn_plugin.cpp b/src/plugins/AccessKeysNavigation/akn_plugin.cpp index 04336d3fe..b7deddd70 100644 --- a/src/plugins/AccessKeysNavigation/akn_plugin.cpp +++ b/src/plugins/AccessKeysNavigation/akn_plugin.cpp @@ -35,7 +35,7 @@ PluginSpec AKN_Plugin::pluginSpec() spec.name = "Access Keys Navigation"; spec.info = "Access keys navigation for QupZilla"; spec.description = "Provides support for navigating in webpages by keyboard shortcuts"; - spec.version = "0.2.0"; + spec.version = "0.2.1"; spec.author = "David Rosca "; spec.icon = QPixmap(":/accesskeysnavigation/data/icon.png"); spec.hasSettings = true; diff --git a/src/plugins/AccessKeysNavigation/akn_settings.ui b/src/plugins/AccessKeysNavigation/akn_settings.ui index 41b8d66d3..76795b846 100644 --- a/src/plugins/AccessKeysNavigation/akn_settings.ui +++ b/src/plugins/AccessKeysNavigation/akn_settings.ui @@ -100,7 +100,7 @@ - Licence + License diff --git a/src/plugins/AccessKeysNavigation/translations/cs_CZ.ts b/src/plugins/AccessKeysNavigation/translations/cs_CZ.ts index 7a91f375e..80a4b9504 100644 --- a/src/plugins/AccessKeysNavigation/translations/cs_CZ.ts +++ b/src/plugins/AccessKeysNavigation/translations/cs_CZ.ts @@ -40,7 +40,7 @@ - Licence + License Licence diff --git a/src/plugins/AccessKeysNavigation/translations/de_DE.ts b/src/plugins/AccessKeysNavigation/translations/de_DE.ts index aa235fddf..8d6ab9f68 100644 --- a/src/plugins/AccessKeysNavigation/translations/de_DE.ts +++ b/src/plugins/AccessKeysNavigation/translations/de_DE.ts @@ -40,7 +40,7 @@ - Licence + License Lizenz diff --git a/src/plugins/AccessKeysNavigation/translations/nl_NL.ts b/src/plugins/AccessKeysNavigation/translations/nl_NL.ts index 4c76e3297..aa0b9b10d 100644 --- a/src/plugins/AccessKeysNavigation/translations/nl_NL.ts +++ b/src/plugins/AccessKeysNavigation/translations/nl_NL.ts @@ -40,7 +40,7 @@ - Licence + License Licentie diff --git a/src/plugins/AccessKeysNavigation/translations/sr_BA.ts b/src/plugins/AccessKeysNavigation/translations/sr_BA.ts index 78c0a7376..c5da8014c 100644 --- a/src/plugins/AccessKeysNavigation/translations/sr_BA.ts +++ b/src/plugins/AccessKeysNavigation/translations/sr_BA.ts @@ -40,7 +40,7 @@ - Licence + License Лиценца diff --git a/src/plugins/AccessKeysNavigation/translations/sr_RS.ts b/src/plugins/AccessKeysNavigation/translations/sr_RS.ts index de2752d95..9d57d86d6 100644 --- a/src/plugins/AccessKeysNavigation/translations/sr_RS.ts +++ b/src/plugins/AccessKeysNavigation/translations/sr_RS.ts @@ -40,7 +40,7 @@ - Licence + License Лиценца diff --git a/src/plugins/AccessKeysNavigation/translations/zh_TW.ts b/src/plugins/AccessKeysNavigation/translations/zh_TW.ts index 07aaf0042..6d8cf7acb 100644 --- a/src/plugins/AccessKeysNavigation/translations/zh_TW.ts +++ b/src/plugins/AccessKeysNavigation/translations/zh_TW.ts @@ -40,7 +40,7 @@ - Licence + License 憑證