1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

Various fixes regarding "Don't load tabs until selected" option

- fixed typo in Access Keys Navigation plugin
This commit is contained in:
nowrep 2012-03-12 18:22:01 +01:00
parent 36f90f0404
commit 9161945d97
21 changed files with 99 additions and 98 deletions

4
.gitignore vendored
View File

@ -21,5 +21,7 @@ libqupzilla.*
bin/core bin/core
qupzilla.sh qupzilla.sh
git_revision git_revision
bin/qupzilla.exe *.exe
*.dll
*.lib
Thumbs.db Thumbs.db

View File

@ -99,7 +99,7 @@ void CommandLineOptions::parseActions()
if (arg.startsWith("-p=") || arg.startsWith("--profile=")) { if (arg.startsWith("-p=") || arg.startsWith("--profile=")) {
arg.remove("-p="); arg.remove("-p=");
arg.remove("--profile="); arg.remove("--profile=");
cout << "starting with profile " << arg.toUtf8().data() << endl; cout << "QupZilla: Starting with profile " << arg.toUtf8().data() << endl;
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_StartWithProfile; pair.action = Qz::CL_StartWithProfile;
pair.text = arg; pair.text = arg;
@ -144,7 +144,7 @@ void CommandLineOptions::parseActions()
QString url(m_argv[m_argc - 1]); QString url(m_argv[m_argc - 1]);
if (m_argc > 1 && !url.isEmpty() && !url.startsWith("-") && url.contains(".")) { 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; ActionPair pair;
pair.action = Qz::CL_OpenUrl; pair.action = Qz::CL_OpenUrl;
pair.text = url; pair.text = url;

View File

@ -895,7 +895,7 @@ bool MainApplication::checkSettingsDir()
return true; return true;
} }
std::cout << "Creating new profile directory" << std::endl; std::cout << "QupZilla: Creating new profile directory" << std::endl;
QDir dir(PROFILEDIR); QDir dir(PROFILEDIR);

View File

@ -93,7 +93,7 @@ void ProfileUpdater::updateProfile(const QString &current, const QString &profil
return; 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(); copyDataToProfile();
} }
@ -110,7 +110,7 @@ void ProfileUpdater::copyDataToProfile()
void ProfileUpdater::update100b4() 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(); mApp->connectDatabase();
QSqlQuery query; QSqlQuery query;
@ -120,7 +120,7 @@ void ProfileUpdater::update100b4()
void ProfileUpdater::update100rc1() 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(); mApp->connectDatabase();
QSqlQuery query; QSqlQuery query;
@ -134,7 +134,7 @@ void ProfileUpdater::update100rc1()
void ProfileUpdater::update100() 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(); mApp->connectDatabase();
QSqlQuery query; QSqlQuery query;

View File

@ -6,10 +6,16 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>829</width> <width>800</width>
<height>496</height> <height>500</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>800</width>
<height>500</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Preferences</string> <string>Preferences</string>
</property> </property>
@ -292,24 +298,24 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="2"> <item row="8" column="0" colspan="2">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>&lt;b&gt;Profiles&lt;/b&gt;</string> <string>&lt;b&gt;Profiles&lt;/b&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="10" column="1">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Startup profile:</string> <string>Startup profile:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="2"> <item row="10" column="2">
<widget class="QComboBox" name="startProfile"/> <widget class="QComboBox" name="startProfile"/>
</item> </item>
<item row="10" column="1" colspan="3"> <item row="11" column="1" colspan="3">
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
@ -398,35 +404,35 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="9" column="1">
<widget class="QLabel" name="label_45"> <widget class="QLabel" name="label_45">
<property name="text"> <property name="text">
<string>Active profile:</string> <string>Active profile:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="2"> <item row="9" column="2">
<widget class="QLabel" name="activeProfile"> <widget class="QLabel" name="activeProfile">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="16" column="1" colspan="2"> <item row="17" column="1" colspan="2">
<widget class="QLabel" name="label_17"> <widget class="QLabel" name="label_17">
<property name="text"> <property name="text">
<string>In order to change language, you must restart browser.</string> <string>In order to change language, you must restart browser.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="0" colspan="3"> <item row="13" column="0" colspan="3">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="label_11">
<property name="text"> <property name="text">
<string>&lt;b&gt;Language&lt;/b&gt;</string> <string>&lt;b&gt;Language&lt;/b&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="1"> <item row="14" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_13"> <layout class="QHBoxLayout" name="horizontalLayout_13">
<item> <item>
<widget class="QLabel" name="label_16"> <widget class="QLabel" name="label_16">
@ -449,10 +455,17 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="13" column="2"> <item row="14" column="2">
<widget class="QComboBox" name="languages"/> <widget class="QComboBox" name="languages"/>
</item> </item>
<item row="11" column="1"> <item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="dontLoadTabsUntilSelected">
<property name="text">
<string>Don't load tabs until selected</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer_6"> <spacer name="verticalSpacer_6">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -465,13 +478,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="dontLoadTabsUntilSelected">
<property name="text">
<string>Don't load tabs until selected</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="stackedWidgetPage2"> <widget class="QWidget" name="stackedWidgetPage2">
@ -1697,9 +1703,6 @@
</widget> </widget>
<widget class="QWidget" name="stackedWidgetPage6"> <widget class="QWidget" name="stackedWidgetPage6">
<layout class="QGridLayout" name="gridLayout_12"> <layout class="QGridLayout" name="gridLayout_12">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="26" column="1" colspan="4"> <item row="26" column="1" colspan="4">
<widget class="QCheckBox" name="jscanAccessClipboard"> <widget class="QCheckBox" name="jscanAccessClipboard">
<property name="text"> <property name="text">

View File

@ -16,30 +16,30 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "closedtabsmanager.h" #include "closedtabsmanager.h"
#include "webview.h" #include "webtab.h"
#include "mainapplication.h" #include "mainapplication.h"
#include <QWebHistory> #include <QWebHistory>
#include <QWebSettings>
ClosedTabsManager::ClosedTabsManager() ClosedTabsManager::ClosedTabsManager()
{ {
} }
void ClosedTabsManager::saveView(WebView* view, int position) void ClosedTabsManager::saveView(WebTab* tab, int position)
{ {
if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) || if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) ||
(view->url().isEmpty() && view->history()->items().count() == 0)) { (tab->url().isEmpty() && tab->history()->items().count() == 0)) {
return; return;
} }
Tab tab; Tab closedTab;
tab.url = view->url(); closedTab.url = tab->url();
tab.title = view->title(); closedTab.title = tab->title();
tab.position = position; closedTab.position = position;
QDataStream tabHistoryStream(&tab.history, QIODevice::WriteOnly); closedTab.history = tab->historyData();
tabHistoryStream << *view->history();
m_closedTabs.prepend(tab); m_closedTabs.prepend(closedTab);
} }
ClosedTabsManager::Tab ClosedTabsManager::getFirstClosedTab() ClosedTabsManager::Tab ClosedTabsManager::getFirstClosedTab()

View File

@ -22,7 +22,7 @@
#include "qz_namespace.h" #include "qz_namespace.h"
class WebView; class WebTab;
class QT_QUPZILLA_EXPORT ClosedTabsManager class QT_QUPZILLA_EXPORT ClosedTabsManager
{ {
@ -42,7 +42,7 @@ public:
explicit ClosedTabsManager(); explicit ClosedTabsManager();
void saveView(WebView* view, int position); void saveView(WebTab *tab, int position);
ClosedTabsManager::Tab getFirstClosedTab(); ClosedTabsManager::Tab getFirstClosedTab();
ClosedTabsManager::Tab getTabAt(int index); ClosedTabsManager::Tab getTabAt(int index);

View File

@ -59,7 +59,7 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
QWebFrame* frame = view->page()->mainFrame(); QWebFrame* frame = view->page()->mainFrame();
QString title = view->title(); QString title = view->title();
QSslCertificate cert = webPage->sslCertificate(); QSslCertificate cert = webPage->sslCertificate();
m_baseUrl = view->url(); m_baseUrl = frame->baseUrl();
//GENERAL //GENERAL
ui->heading->setText(QString("<b>%1</b>:").arg(title)); ui->heading->setText(QString("<b>%1</b>:").arg(title));

View File

@ -93,8 +93,6 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent)
connect(this, SIGNAL(currentChanged(int)), p_QupZilla, SLOT(refreshHistory())); connect(this, SIGNAL(currentChanged(int)), p_QupZilla, SLOT(refreshHistory()));
connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); 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(reloadTab(int)), this, SLOT(reloadTab(int)));
connect(m_tabBar, SIGNAL(stopTab(int)), this, SLOT(stopTab(int))); connect(m_tabBar, SIGNAL(stopTab(int)), this, SLOT(stopTab(int)));
connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(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(changed()), mApp, SLOT(setStateChanged()));
disconnect(webView, SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString))); disconnect(webView, SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString)));
//Save last tab url and history //Save last tab url and history
m_closedTabsManager->saveView(webView, index); m_closedTabsManager->saveView(webTab, index);
if (m_isClosingToLastTabIndex && m_lastTabIndex < count() && index == currentIndex()) { if (m_isClosingToLastTabIndex && m_lastTabIndex < count() && index == currentIndex()) {
setCurrentIndex(m_lastTabIndex); setCurrentIndex(m_lastTabIndex);
@ -463,19 +461,16 @@ void TabWidget::closeAllButCurrent(int index)
int TabWidget::duplicateTab(int index) int TabWidget::duplicateTab(int index)
{ {
WebView* view = weTab(index)->view(); WebTab* webTab = weTab(index);
const QUrl &url = view->url();
QByteArray history; const QUrl &url = webTab->url();
QDataStream tabHistoryStream(&history, QIODevice::WriteOnly); const QByteArray &history = webTab->historyData();
tabHistoryStream << *view->history();
QNetworkRequest req(url); QNetworkRequest req(url);
req.setRawHeader("Referer", url.toEncoded()); req.setRawHeader("Referer", url.toEncoded());
int id = addView(req, tabText(index), Qz::NT_CleanNotSelectedTab); int id = addView(req, tabText(index), Qz::NT_CleanNotSelectedTab);
QDataStream historyStream(history); weTab(id)->setHistoryData(history);
historyStream >> *weTab(id)->history();
return id; return id;
} }
@ -579,29 +574,18 @@ void TabWidget::savePinnedTabs()
QStringList tabs; QStringList tabs;
QList<QByteArray> tabsHistory; QList<QByteArray> tabsHistory;
for (int i = 0; i < count(); ++i) { for (int i = 0; i < count(); ++i) {
if (WebTab* tab = weTab(i)) { WebTab* tab = weTab(i);
if (!tab->isPinned()) { if (!tab || !tab->isPinned()) {
continue; continue;
} }
tabs.append(tab->url().toEncoded()); tabs.append(tab->url().toEncoded());
if (tab->history()->count() != 0) { tabsHistory.append(tab->historyData());
QByteArray tabHistory;
QDataStream tabHistoryStream(&tabHistory, QIODevice::WriteOnly);
tabHistoryStream << *tab->history();
tabsHistory.append(tabHistory);
}
else {
tabsHistory << QByteArray();
}
}
else {
tabs.append(QString::null);
tabsHistory.append(QByteArray());
}
} }
stream << tabs; stream << tabs;
stream << tabsHistory; stream << tabsHistory;
QFile file(mApp->getActiveProfilPath() + "pinnedtabs.dat"); QFile file(mApp->getActiveProfilPath() + "pinnedtabs.dat");
file.open(QIODevice::WriteOnly); file.open(QIODevice::WriteOnly);
file.write(data); file.write(data);

View File

@ -93,8 +93,6 @@ public slots:
void reloadTab(int index); void reloadTab(int index);
void reloadAllTabs(); void reloadAllTabs();
void stopTab(int index); void stopTab(int index);
void backTab(int index);
void forwardTab(int index);
void closeAllButCurrent(int index); void closeAllButCurrent(int index);
void restoreClosedTab(); void restoreClosedTab();
void restoreAllClosedTabs(); void restoreAllClosedTabs();

View File

@ -31,19 +31,10 @@
WebTab::SavedTab::SavedTab(WebTab* webTab) WebTab::SavedTab::SavedTab(WebTab* webTab)
{ {
if (webTab->isRestored()) { title = webTab->title();
WebView* view = webTab->view(); url = webTab->url();
icon = webTab->icon();
title = view->title(); history = webTab->historyData();
url = view->url();
icon = view->icon();
QDataStream historyStream(&history, QIODevice::WriteOnly);
historyStream << *view->history();
}
else {
*this = webTab->savedTab();
}
} }
void WebTab::SavedTab::clear() void WebTab::SavedTab::clear()
@ -152,6 +143,26 @@ QWebHistory* WebTab::history() const
return m_view->history(); 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() void WebTab::reload()
{ {
m_view->reload(); m_view->reload();

View File

@ -62,7 +62,10 @@ public:
QUrl url() const; QUrl url() const;
QString title() const; QString title() const;
QIcon icon() const; QIcon icon() const;
QWebHistory* history() const; QWebHistory *history() const;
void setHistoryData(const QByteArray &data);
QByteArray historyData() const;
void reload(); void reload();
void stop(); void stop();

View File

@ -32,7 +32,7 @@ void sigpipe_handler(int s)
// this signal and ignoring it to prevent unneeded crash because of it. // this signal and ignoring it to prevent unneeded crash because of it.
Q_UNUSED(s) Q_UNUSED(s)
std::cout << "QupZilla::Caught SIGPIPE!" << std::endl; std::cout << "QupZilla: Caught SIGPIPE!" << std::endl;
} }
#endif #endif

View File

@ -35,7 +35,7 @@ PluginSpec AKN_Plugin::pluginSpec()
spec.name = "Access Keys Navigation"; spec.name = "Access Keys Navigation";
spec.info = "Access keys navigation for QupZilla"; spec.info = "Access keys navigation for QupZilla";
spec.description = "Provides support for navigating in webpages by keyboard shortcuts"; 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 <nowrep@gmail.com>"; spec.author = "David Rosca <nowrep@gmail.com>";
spec.icon = QPixmap(":/accesskeysnavigation/data/icon.png"); spec.icon = QPixmap(":/accesskeysnavigation/data/icon.png");
spec.hasSettings = true; spec.hasSettings = true;

View File

@ -100,7 +100,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QPushButton" name="licence"> <widget class="QPushButton" name="licence">
<property name="text"> <property name="text">
<string>Licence</string> <string>License</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -40,7 +40,7 @@
</message> </message>
<message> <message>
<location filename="../akn_settings.ui" line="103"/> <location filename="../akn_settings.ui" line="103"/>
<source>Licence</source> <source>License</source>
<translation>Licence</translation> <translation>Licence</translation>
</message> </message>
</context> </context>

View File

@ -40,7 +40,7 @@
</message> </message>
<message> <message>
<location filename="../akn_settings.ui" line="103"/> <location filename="../akn_settings.ui" line="103"/>
<source>Licence</source> <source>License</source>
<translation>Lizenz</translation> <translation>Lizenz</translation>
</message> </message>
</context> </context>

View File

@ -40,7 +40,7 @@
</message> </message>
<message> <message>
<location filename="../akn_settings.ui" line="103"/> <location filename="../akn_settings.ui" line="103"/>
<source>Licence</source> <source>License</source>
<translation>Licentie</translation> <translation>Licentie</translation>
</message> </message>
</context> </context>

View File

@ -40,7 +40,7 @@
</message> </message>
<message> <message>
<location filename="../akn_settings.ui" line="103"/> <location filename="../akn_settings.ui" line="103"/>
<source>Licence</source> <source>License</source>
<translation>Лиценца</translation> <translation>Лиценца</translation>
</message> </message>
</context> </context>

View File

@ -40,7 +40,7 @@
</message> </message>
<message> <message>
<location filename="../akn_settings.ui" line="103"/> <location filename="../akn_settings.ui" line="103"/>
<source>Licence</source> <source>License</source>
<translation>Лиценца</translation> <translation>Лиценца</translation>
</message> </message>
</context> </context>

View File

@ -40,7 +40,7 @@
</message> </message>
<message> <message>
<location filename="../akn_settings.ui" line="103"/> <location filename="../akn_settings.ui" line="103"/>
<source>Licence</source> <source>License</source>
<translation></translation> <translation></translation>
</message> </message>
</context> </context>