mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Added option "Don't load tabs until selected" when restoring session.
This commit is contained in:
parent
4dc7095d6e
commit
efab78ae5e
@ -627,12 +627,11 @@ void BookmarksManager::insertAllTabs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach(WebTab * tab, getQupZilla()->tabWidget()->allTabs(false)) {
|
foreach(WebTab * tab, getQupZilla()->tabWidget()->allTabs(false)) {
|
||||||
TabbedWebView* view = tab->view();
|
if (tab->url().isEmpty()) {
|
||||||
if (view->url().isEmpty()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bookmarksModel->saveBookmark(view->url(), view->title(), view->icon(), BookmarksModel::fromTranslatedFolder(combo->currentText()));
|
m_bookmarksModel->saveBookmark(tab->url(), tab->title(), tab->icon(), BookmarksModel::fromTranslatedFolder(combo->currentText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete dialog;
|
delete dialog;
|
||||||
|
@ -101,6 +101,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
ui->afterLaunch->setCurrentIndex(afterLaunch);
|
ui->afterLaunch->setCurrentIndex(afterLaunch);
|
||||||
ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", DEFAULT_CHECK_UPDATES).toBool());
|
ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", DEFAULT_CHECK_UPDATES).toBool());
|
||||||
|
ui->dontLoadTabsUntilSelected->setChecked(settings.value("Web-Browser-Settings/LoadTabsOnActivation", false).toBool());
|
||||||
|
|
||||||
ui->newTabFrame->setVisible(false);
|
ui->newTabFrame->setVisible(false);
|
||||||
if (m_newTabUrl.isEmpty()) {
|
if (m_newTabUrl.isEmpty()) {
|
||||||
@ -788,6 +789,7 @@ void Preferences::saveSettings()
|
|||||||
settings.setValue("wheelScrollLines", ui->wheelScroll->value());
|
settings.setValue("wheelScrollLines", ui->wheelScroll->value());
|
||||||
settings.setValue("DoNotTrack", ui->doNotTrack->isChecked());
|
settings.setValue("DoNotTrack", ui->doNotTrack->isChecked());
|
||||||
settings.setValue("CheckUpdates", ui->checkUpdates->isChecked());
|
settings.setValue("CheckUpdates", ui->checkUpdates->isChecked());
|
||||||
|
settings.setValue("LoadTabsOnActivation", ui->dontLoadTabsUntilSelected->isChecked());
|
||||||
settings.setValue("DefaultZoom", ui->defaultZoom->value());
|
settings.setValue("DefaultZoom", ui->defaultZoom->value());
|
||||||
settings.setValue("XSSAuditing", ui->xssAuditing->isChecked());
|
settings.setValue("XSSAuditing", ui->xssAuditing->isChecked());
|
||||||
settings.setValue("UserAgent", ui->changeUserAgent->isChecked() ? ui->userAgentCombo->currentText() : "");
|
settings.setValue("UserAgent", ui->changeUserAgent->isChecked() ? ui->userAgentCombo->currentText() : "");
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>829</width>
|
<width>829</width>
|
||||||
<height>484</height>
|
<height>496</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -292,24 +292,24 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="2">
|
<item row="7" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><b>Profiles</b></string>
|
<string><b>Profiles</b></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="9" 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="8" column="2">
|
<item row="9" column="2">
|
||||||
<widget class="QComboBox" name="startProfile"/>
|
<widget class="QComboBox" name="startProfile"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1" colspan="3">
|
<item row="10" 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>
|
||||||
@ -391,42 +391,42 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1" colspan="2">
|
<item row="6" column="1" colspan="2">
|
||||||
<widget class="QCheckBox" name="checkUpdates">
|
<widget class="QCheckBox" name="checkUpdates">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Check for updates on start</string>
|
<string>Check for updates on start</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="8" 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="7" column="2">
|
<item row="8" 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="15" column="1" colspan="2">
|
<item row="16" 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="11" column="0" colspan="3">
|
<item row="12" column="0" colspan="3">
|
||||||
<widget class="QLabel" name="label_11">
|
<widget class="QLabel" name="label_11">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><b>Language</b></string>
|
<string><b>Language</b></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="1">
|
<item row="13" 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 +449,10 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="2">
|
<item row="13" column="2">
|
||||||
<widget class="QComboBox" name="languages"/>
|
<widget class="QComboBox" name="languages"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<item row="11" column="1">
|
||||||
<spacer name="verticalSpacer_6">
|
<spacer name="verticalSpacer_6">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -465,6 +465,13 @@
|
|||||||
</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">
|
||||||
@ -1690,57 +1697,52 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="stackedWidgetPage6">
|
<widget class="QWidget" name="stackedWidgetPage6">
|
||||||
<layout class="QGridLayout" name="gridLayout_12">
|
<layout class="QGridLayout" name="gridLayout_12">
|
||||||
<item row="5" column="0">
|
<property name="sizeConstraint">
|
||||||
<spacer name="verticalSpacer_3">
|
<enum>QLayout::SetFixedSize</enum>
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<item row="26" column="1" colspan="4">
|
||||||
<size>
|
<widget class="QCheckBox" name="jscanAccessClipboard">
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0" colspan="4">
|
|
||||||
<widget class="QLabel" name="label_12">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><b>Cookies</b></string>
|
<string>JavaScript can access clipboard</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1" colspan="2">
|
<item row="25" column="1" colspan="4">
|
||||||
|
<widget class="QCheckBox" name="blockPopup">
|
||||||
|
<property name="text">
|
||||||
|
<string>Block popup windows</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="20" column="1" colspan="4">
|
||||||
|
<widget class="QCheckBox" name="sendReferer">
|
||||||
|
<property name="text">
|
||||||
|
<string>Send Referer header to servers</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="13" column="1" colspan="3">
|
||||||
<widget class="QCheckBox" name="filterTracking">
|
<widget class="QCheckBox" name="filterTracking">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Filter tracking cookies</string>
|
<string>Filter tracking cookies</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" colspan="3">
|
<item row="8" column="0" colspan="5">
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>Cookies</b></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="1" colspan="4">
|
||||||
<widget class="QCheckBox" name="saveCookies">
|
<widget class="QCheckBox" name="saveCookies">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Allow storing of cookies</string>
|
<string>Allow storing of cookies</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="13" column="0">
|
||||||
<widget class="QCheckBox" name="deleteCookiesOnClose">
|
|
||||||
<property name="text">
|
|
||||||
<string>Delete cookies on close</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="matchExactly">
|
|
||||||
<property name="text">
|
|
||||||
<string>Match domain exactly</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer_20">
|
<spacer name="horizontalSpacer_20">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -1756,17 +1758,64 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="4">
|
<item row="12" column="1" colspan="4">
|
||||||
<widget class="QLabel" name="label_19">
|
<widget class="QCheckBox" name="matchExactly">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><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!</string>
|
<string>Match domain exactly</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="21" column="1" colspan="4">
|
||||||
|
<widget class="QCheckBox" name="doNotTrack">
|
||||||
|
<property name="text">
|
||||||
|
<string>Send Do Not Track header to servers</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="18" column="0" colspan="5">
|
||||||
|
<widget class="QLabel" name="label_50">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>Other</b></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="17" column="0" colspan="4">
|
||||||
|
<widget class="QLabel" name="label_49">
|
||||||
|
<property name="text">
|
||||||
|
<string>Edit CA certificates in SSL Manager</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="3">
|
<item row="10" column="4">
|
||||||
|
<spacer name="horizontalSpacer_22">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="28" column="0" colspan="5">
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="13" column="4">
|
||||||
<widget class="QPushButton" name="cookieManagerBut">
|
<widget class="QPushButton" name="cookieManagerBut">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@ -1779,8 +1828,28 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="17" column="4">
|
||||||
<spacer name="horizontalSpacer_5">
|
<widget class="QPushButton" name="sslManagerButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>SSL Manager</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="2" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="deleteCookiesOnClose">
|
||||||
|
<property name="text">
|
||||||
|
<string>Delete cookies on close</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="1">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -1795,86 +1864,23 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="4">
|
<item row="15" column="0" colspan="5">
|
||||||
<widget class="QLabel" name="label_48">
|
<widget class="QLabel" name="label_48">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><b>SSL Certificates</b></string>
|
<string><b>SSL Certificates</b></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="3">
|
<item row="14" column="0" colspan="5">
|
||||||
<widget class="QPushButton" name="sslManagerButton">
|
<widget class="QLabel" name="label_19">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>SSL Manager</string>
|
<string><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!</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0" colspan="3">
|
|
||||||
<widget class="QLabel" name="label_49">
|
|
||||||
<property name="text">
|
|
||||||
<string>Edit CA certificates in SSL Manager</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="3">
|
|
||||||
<spacer name="horizontalSpacer_22">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="1" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="jscanAccessClipboard">
|
|
||||||
<property name="text">
|
|
||||||
<string>JavaScript can access clipboard</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0" colspan="4">
|
|
||||||
<widget class="QLabel" name="label_50">
|
|
||||||
<property name="text">
|
|
||||||
<string><b>Other</b></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="11" column="1" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="doNotTrack">
|
|
||||||
<property name="text">
|
|
||||||
<string>Send Do Not Track header to servers</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="12" column="1" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="sendReferer">
|
|
||||||
<property name="text">
|
|
||||||
<string>Send Referer header to servers</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="10" column="1" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="blockPopup">
|
|
||||||
<property name="text">
|
|
||||||
<string>Block popup windows</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_3">
|
<widget class="QWidget" name="page_3">
|
||||||
@ -2184,11 +2190,6 @@
|
|||||||
<tabstop>closeDownManOnFinish</tabstop>
|
<tabstop>closeDownManOnFinish</tabstop>
|
||||||
<tabstop>downlaodNativeSystemDialog</tabstop>
|
<tabstop>downlaodNativeSystemDialog</tabstop>
|
||||||
<tabstop>allowPassManager</tabstop>
|
<tabstop>allowPassManager</tabstop>
|
||||||
<tabstop>saveCookies</tabstop>
|
|
||||||
<tabstop>deleteCookiesOnClose</tabstop>
|
|
||||||
<tabstop>matchExactly</tabstop>
|
|
||||||
<tabstop>filterTracking</tabstop>
|
|
||||||
<tabstop>cookieManagerBut</tabstop>
|
|
||||||
<tabstop>useOSDNotifications</tabstop>
|
<tabstop>useOSDNotifications</tabstop>
|
||||||
<tabstop>useNativeSystemNotifications</tabstop>
|
<tabstop>useNativeSystemNotifications</tabstop>
|
||||||
<tabstop>doNotUseNotifications</tabstop>
|
<tabstop>doNotUseNotifications</tabstop>
|
||||||
|
@ -289,7 +289,9 @@ void TabBar::bookmarkTab()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_QupZilla->addBookmark(view->url(), view->title(), view->icon());
|
WebTab* tab = view->webTab();
|
||||||
|
|
||||||
|
p_QupZilla->addBookmark(tab->url(), tab->title(), tab->icon());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabBar::pinTab()
|
void TabBar::pinTab()
|
||||||
@ -434,7 +436,10 @@ void TabBar::dropEvent(QDropEvent* event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p_QupZilla->weView(index)->load(mime->urls().first());
|
WebTab* tab = p_QupZilla->weView(index)->webTab();
|
||||||
|
if (tab->isRestored()) {
|
||||||
|
tab->view()->load(mime->urls().first());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,20 +150,14 @@ void TabWidget::resizeEvent(QResizeEvent* e)
|
|||||||
QTabWidget::resizeEvent(e);
|
QTabWidget::resizeEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
TabbedWebView* TabWidget::weView()
|
WebTab* TabWidget::weTab()
|
||||||
{
|
{
|
||||||
return weView(currentIndex());
|
return weTab(currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
TabbedWebView* TabWidget::weView(int index)
|
WebTab* TabWidget::weTab(int index)
|
||||||
{
|
{
|
||||||
WebTab* webTab = qobject_cast<WebTab*>(widget(index));
|
return qobject_cast<WebTab*>(widget(index));
|
||||||
|
|
||||||
if (!webTab) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return webTab->view();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::createKeyPressEvent(QKeyEvent* event)
|
void TabWidget::createKeyPressEvent(QKeyEvent* event)
|
||||||
@ -192,24 +186,24 @@ void TabWidget::moveAddTabButton(int posX)
|
|||||||
void TabWidget::aboutToShowTabsMenu()
|
void TabWidget::aboutToShowTabsMenu()
|
||||||
{
|
{
|
||||||
m_menuTabs->clear();
|
m_menuTabs->clear();
|
||||||
TabbedWebView* actView = weView();
|
WebTab* actTab = weTab();
|
||||||
if (!actView) {
|
if (!actTab) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < count(); i++) {
|
for (int i = 0; i < count(); i++) {
|
||||||
TabbedWebView* view = weView(i);
|
WebTab* tab = weTab(i);
|
||||||
if (!view) {
|
if (!tab) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QAction* action = new QAction(this);
|
QAction* action = new QAction(this);
|
||||||
if (view == actView) {
|
if (tab == actTab) {
|
||||||
action->setIcon(QIcon(":/icons/menu/dot.png"));
|
action->setIcon(QIcon(":/icons/menu/dot.png"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
action->setIcon(view->icon());
|
action->setIcon(tab->icon());
|
||||||
}
|
}
|
||||||
if (view->title().isEmpty()) {
|
if (tab->title().isEmpty()) {
|
||||||
if (view->isLoading()) {
|
if (tab->isLoading()) {
|
||||||
action->setText(tr("Loading..."));
|
action->setText(tr("Loading..."));
|
||||||
action->setIcon(QIcon(":/icons/other/progress.gif"));
|
action->setIcon(QIcon(":/icons/other/progress.gif"));
|
||||||
}
|
}
|
||||||
@ -218,7 +212,7 @@ void TabWidget::aboutToShowTabsMenu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QString title = view->title();
|
QString title = tab->title();
|
||||||
title.replace("&", "&&");
|
title.replace("&", "&&");
|
||||||
if (title.length() > 40) {
|
if (title.length() > 40) {
|
||||||
title.truncate(40);
|
title.truncate(40);
|
||||||
@ -288,7 +282,7 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
|
|||||||
index = insertTab(position, new WebTab(p_QupZilla, locBar), "");
|
index = insertTab(position, new WebTab(p_QupZilla, locBar), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
TabbedWebView* webView = weView(index);
|
TabbedWebView* webView = weTab(index)->view();
|
||||||
locBar->setWebView(webView);
|
locBar->setWebView(webView);
|
||||||
|
|
||||||
setTabText(index, title);
|
setTabText(index, title);
|
||||||
@ -335,14 +329,15 @@ void TabWidget::closeTab(int index)
|
|||||||
index = currentIndex();
|
index = currentIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
TabbedWebView* webView = weView(index);
|
|
||||||
WebPage* webPage = webView->webPage();
|
|
||||||
WebTab* webTab = webView->webTab();
|
|
||||||
|
|
||||||
if (!webView || !webPage || !webTab) {
|
WebTab* webTab = weTab(index);
|
||||||
|
if (!webTab) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TabbedWebView* webView = webTab->view();
|
||||||
|
WebPage* webPage = webView->webPage();
|
||||||
|
|
||||||
if (count() == 1) {
|
if (count() == 1) {
|
||||||
if (m_dontQuitWithOneTab) {
|
if (m_dontQuitWithOneTab) {
|
||||||
webView->load(m_urlOnNewTab);
|
webView->load(m_urlOnNewTab);
|
||||||
@ -391,13 +386,14 @@ void TabWidget::currentTabChanged(int index)
|
|||||||
m_isClosingToLastTabIndex = false;
|
m_isClosingToLastTabIndex = false;
|
||||||
m_lastBackgroundTabIndex = -1;
|
m_lastBackgroundTabIndex = -1;
|
||||||
|
|
||||||
TabbedWebView* webView = weView();
|
WebTab* webTab = weTab(index);
|
||||||
LocationBar* locBar = webView->webTab()->locationBar();
|
LocationBar* locBar = webTab->locationBar();
|
||||||
|
|
||||||
if (m_locationBars->indexOf(locBar) != -1) {
|
if (m_locationBars->indexOf(locBar) != -1) {
|
||||||
m_locationBars->setCurrentWidget(locBar);
|
m_locationBars->setCurrentWidget(locBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
webTab->setCurrentTab();
|
||||||
p_QupZilla->currentTabChanged();
|
p_QupZilla->currentTabChanged();
|
||||||
m_tabBar->updateCloseButton(index);
|
m_tabBar->updateCloseButton(index);
|
||||||
}
|
}
|
||||||
@ -416,7 +412,7 @@ void TabWidget::setTabText(int index, const QString &text)
|
|||||||
QString newtext = text;
|
QString newtext = text;
|
||||||
newtext.replace("&", "&&"); // Avoid Alt+letter shortcuts
|
newtext.replace("&", "&&"); // Avoid Alt+letter shortcuts
|
||||||
|
|
||||||
if (WebTab* webTab = qobject_cast<WebTab*>(p_QupZilla->tabWidget()->widget(index))) {
|
if (WebTab* webTab = weTab(index)) {
|
||||||
if (webTab->isPinned()) {
|
if (webTab->isPinned()) {
|
||||||
newtext = "";
|
newtext = "";
|
||||||
}
|
}
|
||||||
@ -427,7 +423,7 @@ void TabWidget::setTabText(int index, const QString &text)
|
|||||||
|
|
||||||
void TabWidget::reloadTab(int index)
|
void TabWidget::reloadTab(int index)
|
||||||
{
|
{
|
||||||
weView(index)->reload();
|
weTab(index)->reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::showTabBar()
|
void TabWidget::showTabBar()
|
||||||
@ -449,44 +445,37 @@ void TabWidget::reloadAllTabs()
|
|||||||
|
|
||||||
void TabWidget::stopTab(int index)
|
void TabWidget::stopTab(int index)
|
||||||
{
|
{
|
||||||
weView(index)->stop();
|
weTab(index)->stop();
|
||||||
}
|
|
||||||
|
|
||||||
void TabWidget::backTab(int index)
|
|
||||||
{
|
|
||||||
weView(index)->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TabWidget::forwardTab(int index)
|
|
||||||
{
|
|
||||||
weView(index)->forward();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::closeAllButCurrent(int index)
|
void TabWidget::closeAllButCurrent(int index)
|
||||||
{
|
{
|
||||||
WebTab* akt = qobject_cast<WebTab*>(widget(index));
|
WebTab* akt = weTab(index);
|
||||||
|
|
||||||
foreach(WebTab * tab, allTabs(false)) {
|
foreach(WebTab * tab, allTabs(false)) {
|
||||||
if (akt == widget(tab->view()->tabIndex())) {
|
int tabIndex = tab->tabIndex();
|
||||||
|
if (akt == widget(tabIndex)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
closeTab(tab->view()->tabIndex());
|
closeTab(tabIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int TabWidget::duplicateTab(int index)
|
int TabWidget::duplicateTab(int index)
|
||||||
{
|
{
|
||||||
const QUrl &url = weView(index)->url();
|
WebView* view = weTab(index)->view();
|
||||||
|
const QUrl &url = view->url();
|
||||||
|
|
||||||
QByteArray history;
|
QByteArray history;
|
||||||
QDataStream tabHistoryStream(&history, QIODevice::WriteOnly);
|
QDataStream tabHistoryStream(&history, QIODevice::WriteOnly);
|
||||||
tabHistoryStream << *weView(index)->history();
|
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);
|
QDataStream historyStream(history);
|
||||||
historyStream >> *weView(id)->history();
|
historyStream >> *view->history();
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -508,10 +497,8 @@ void TabWidget::restoreClosedTab()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab, false, tab.position);
|
int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab, false, tab.position);
|
||||||
QDataStream historyStream(tab.history);
|
WebTab* webTab = weTab(index);
|
||||||
historyStream >> *weView(index)->history();
|
webTab->p_restoreTab(tab.url, tab.history);
|
||||||
|
|
||||||
weView(index)->load(tab.url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::restoreAllClosedTabs()
|
void TabWidget::restoreAllClosedTabs()
|
||||||
@ -524,10 +511,8 @@ void TabWidget::restoreAllClosedTabs()
|
|||||||
|
|
||||||
foreach(const ClosedTabsManager::Tab & tab, closedTabs) {
|
foreach(const ClosedTabsManager::Tab & tab, closedTabs) {
|
||||||
int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab);
|
int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab);
|
||||||
QDataStream historyStream(tab.history);
|
WebTab* webTab = weTab(index);
|
||||||
historyStream >> *weView(index)->history();
|
webTab->p_restoreTab(tab.url, tab.history);
|
||||||
|
|
||||||
weView(index)->load(tab.url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_closedTabsManager->clearList();
|
m_closedTabsManager->clearList();
|
||||||
@ -576,15 +561,18 @@ QList<WebTab*> TabWidget::allTabs(bool withPinned)
|
|||||||
QList<WebTab*> allTabs;
|
QList<WebTab*> allTabs;
|
||||||
|
|
||||||
for (int i = 0; i < count(); i++) {
|
for (int i = 0; i < count(); i++) {
|
||||||
WebTab* tab = qobject_cast<WebTab*>(widget(i));
|
WebTab* tab = weTab(i);
|
||||||
if (!tab || (!withPinned && tab->isPinned())) {
|
if (!tab || (!withPinned && tab->isPinned())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
allTabs.append(tab);
|
allTabs.append(tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
return allTabs;
|
return allTabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const qint32 TabWidgetFileVersion = 0xaaf;
|
||||||
|
|
||||||
void TabWidget::savePinnedTabs()
|
void TabWidget::savePinnedTabs()
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
@ -593,9 +581,8 @@ 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 (TabbedWebView* tab = weView(i)) {
|
if (WebTab* tab = weTab(i)) {
|
||||||
WebTab* webTab = qobject_cast<WebTab*>(widget(i));
|
if (!tab->isPinned()) {
|
||||||
if (!webTab || !webTab->isPinned()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,16 +632,18 @@ void TabWidget::restorePinnedTabs()
|
|||||||
|
|
||||||
QByteArray historyState = tabHistory.value(i);
|
QByteArray historyState = tabHistory.value(i);
|
||||||
int addedIndex;
|
int addedIndex;
|
||||||
|
|
||||||
if (!historyState.isEmpty()) {
|
if (!historyState.isEmpty()) {
|
||||||
addedIndex = addView(QUrl(), Qz::NT_CleanSelectedTab);
|
addedIndex = addView(QUrl(), Qz::NT_CleanSelectedTab);
|
||||||
QDataStream historyStream(historyState);
|
|
||||||
historyStream >> *weView(addedIndex)->history();
|
weTab(i)->p_restoreTab(url, historyState);
|
||||||
weView(addedIndex)->load(url);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
addedIndex = addView(url);
|
addedIndex = addView(url);
|
||||||
}
|
}
|
||||||
WebTab* webTab = qobject_cast<WebTab*>(widget(addedIndex));
|
|
||||||
|
WebTab* webTab = weTab(addedIndex);
|
||||||
|
|
||||||
if (webTab) {
|
if (webTab) {
|
||||||
webTab->setPinned(true);
|
webTab->setPinned(true);
|
||||||
emit pinnedTabAdded();
|
emit pinnedTabAdded();
|
||||||
@ -667,72 +656,64 @@ void TabWidget::restorePinnedTabs()
|
|||||||
|
|
||||||
QByteArray TabWidget::saveState()
|
QByteArray TabWidget::saveState()
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QList<WebTab::SavedTab> tabList;
|
||||||
QDataStream stream(&data, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
QStringList tabs;
|
|
||||||
QList<QByteArray> tabsHistory;
|
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (int i = 0; i < count(); ++i) {
|
||||||
if (TabbedWebView* tab = weView(i)) {
|
WebTab* webTab = weTab(i);
|
||||||
WebTab* webTab = qobject_cast<WebTab*>(widget(i));
|
if (!webTab || webTab->isPinned()) {
|
||||||
if (webTab && webTab->isPinned()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
tabs.append(tab->url().toEncoded());
|
WebTab::SavedTab tab(webTab);
|
||||||
if (tab->history()->count() != 0) {
|
tabList.append(tab);
|
||||||
QByteArray tabHistory;
|
|
||||||
QDataStream tabHistoryStream(&tabHistory, QIODevice::WriteOnly);
|
|
||||||
tabHistoryStream << *tab->history();
|
|
||||||
tabsHistory.append(tabHistory);
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
tabsHistory << QByteArray();
|
QByteArray data;
|
||||||
|
QDataStream stream(&data, QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
stream << TabWidgetFileVersion;
|
||||||
|
stream << tabList.count();
|
||||||
|
|
||||||
|
foreach(const WebTab::SavedTab & tab, tabList) {
|
||||||
|
stream << tab;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
tabs.append(QString::null);
|
|
||||||
tabsHistory.append(QByteArray());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stream << tabs;
|
|
||||||
stream << currentIndex();
|
stream << currentIndex();
|
||||||
stream << tabsHistory;
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabWidget::restoreState(const QByteArray &state)
|
bool TabWidget::restoreState(QByteArray &state)
|
||||||
{
|
{
|
||||||
QByteArray sd = state;
|
QDataStream stream(&state, QIODevice::ReadOnly);
|
||||||
QDataStream stream(&sd, QIODevice::ReadOnly);
|
|
||||||
if (stream.atEnd()) {
|
if (stream.atEnd()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList openTabs;
|
qint32 fileVersion = 0;
|
||||||
int currentTab;
|
int tabListCount = 0;
|
||||||
QList<QByteArray> tabHistory;
|
int currentTab = 0;
|
||||||
stream >> openTabs;
|
|
||||||
stream >> currentTab;
|
|
||||||
stream >> tabHistory;
|
|
||||||
|
|
||||||
for (int i = 0; i < openTabs.count(); ++i) {
|
stream >> fileVersion;
|
||||||
QUrl url = QUrl::fromEncoded(openTabs.at(i).toUtf8());
|
stream >> tabListCount;
|
||||||
|
|
||||||
|
if (fileVersion != TabWidgetFileVersion) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < tabListCount; ++i) {
|
||||||
|
WebTab::SavedTab tab;
|
||||||
|
stream >> tab;
|
||||||
|
|
||||||
QByteArray historyState = tabHistory.value(i);
|
|
||||||
if (!historyState.isEmpty()) {
|
|
||||||
int index = addView(QUrl(), Qz::NT_CleanSelectedTab);
|
int index = addView(QUrl(), Qz::NT_CleanSelectedTab);
|
||||||
QDataStream historyStream(historyState);
|
weTab(index)->restoreTab(tab);
|
||||||
historyStream >> *weView(index)->history();
|
|
||||||
weView(index)->load(url);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
addView(url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stream >> currentTab;
|
||||||
|
|
||||||
setCurrentIndex(currentTab);
|
setCurrentIndex(currentTab);
|
||||||
|
currentTabChanged(currentTab);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
~TabWidget();
|
~TabWidget();
|
||||||
|
|
||||||
QByteArray saveState();
|
QByteArray saveState();
|
||||||
bool restoreState(const QByteArray &state);
|
bool restoreState(QByteArray &state);
|
||||||
void savePinnedTabs();
|
void savePinnedTabs();
|
||||||
void restorePinnedTabs();
|
void restorePinnedTabs();
|
||||||
|
|
||||||
@ -113,8 +113,9 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void resizeEvent(QResizeEvent* e);
|
void resizeEvent(QResizeEvent* e);
|
||||||
inline TabbedWebView* weView();
|
|
||||||
inline TabbedWebView* weView(int index);
|
WebTab* weTab();
|
||||||
|
WebTab* weTab(int index);
|
||||||
|
|
||||||
bool m_hideTabBarWithOneTab;
|
bool m_hideTabBarWithOneTab;
|
||||||
bool m_dontQuitWithOneTab;
|
bool m_dontQuitWithOneTab;
|
||||||
|
@ -22,8 +22,57 @@
|
|||||||
#include "tabbar.h"
|
#include "tabbar.h"
|
||||||
#include "tabwidget.h"
|
#include "tabwidget.h"
|
||||||
#include "locationbar.h"
|
#include "locationbar.h"
|
||||||
|
#include "globalfunctions.h"
|
||||||
|
#include "webviewsettings.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QWebHistory>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebTab::SavedTab::clear()
|
||||||
|
{
|
||||||
|
title.clear();
|
||||||
|
url.clear();
|
||||||
|
icon = QIcon();
|
||||||
|
history.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream &operator <<(QDataStream &stream, const WebTab::SavedTab &tab)
|
||||||
|
{
|
||||||
|
stream << tab.title;
|
||||||
|
stream << tab.url;
|
||||||
|
stream << tab.icon;
|
||||||
|
stream << tab.history;
|
||||||
|
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream &operator >>(QDataStream &stream, WebTab::SavedTab &tab)
|
||||||
|
{
|
||||||
|
stream >> tab.title;
|
||||||
|
stream >> tab.url;
|
||||||
|
stream >> tab.icon;
|
||||||
|
stream >> tab.history;
|
||||||
|
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar)
|
WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar)
|
||||||
: QWidget()
|
: QWidget()
|
||||||
@ -54,12 +103,71 @@ WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar)
|
|||||||
connect(m_locationBar.data(), SIGNAL(loadUrl(QUrl)), m_view, SLOT(load(QUrl)));
|
connect(m_locationBar.data(), SIGNAL(loadUrl(QUrl)), m_view, SLOT(load(QUrl)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TabbedWebView* WebTab::view()
|
TabbedWebView* WebTab::view() const
|
||||||
{
|
{
|
||||||
return m_view;
|
return m_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebTab::isPinned()
|
void WebTab::setCurrentTab()
|
||||||
|
{
|
||||||
|
if (!isRestored()) {
|
||||||
|
p_restoreTab(m_savedTab);
|
||||||
|
|
||||||
|
m_savedTab.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl WebTab::url() const
|
||||||
|
{
|
||||||
|
if (isRestored()) {
|
||||||
|
return m_view->url();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return m_savedTab.url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString WebTab::title() const
|
||||||
|
{
|
||||||
|
if (isRestored()) {
|
||||||
|
return m_view->title();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return m_savedTab.title;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon WebTab::icon() const
|
||||||
|
{
|
||||||
|
if (isRestored()) {
|
||||||
|
return m_view->icon();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return m_savedTab.icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QWebHistory* WebTab::history() const
|
||||||
|
{
|
||||||
|
return m_view->history();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebTab::reload()
|
||||||
|
{
|
||||||
|
m_view->reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebTab::stop()
|
||||||
|
{
|
||||||
|
m_view->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WebTab::isLoading() const
|
||||||
|
{
|
||||||
|
return m_view->isLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WebTab::isPinned() const
|
||||||
{
|
{
|
||||||
return m_pinned;
|
return m_pinned;
|
||||||
}
|
}
|
||||||
@ -74,12 +182,12 @@ void WebTab::setLocationBar(LocationBar* bar)
|
|||||||
m_locationBar = bar;
|
m_locationBar = bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocationBar* WebTab::locationBar()
|
LocationBar* WebTab::locationBar() const
|
||||||
{
|
{
|
||||||
return m_locationBar.data();
|
return m_locationBar.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebTab::inspectorVisible()
|
bool WebTab::inspectorVisible() const
|
||||||
{
|
{
|
||||||
return m_inspectorVisible;
|
return m_inspectorVisible;
|
||||||
}
|
}
|
||||||
@ -89,6 +197,45 @@ void WebTab::setInspectorVisible(bool v)
|
|||||||
m_inspectorVisible = v;
|
m_inspectorVisible = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebTab::SavedTab WebTab::savedTab() const
|
||||||
|
{
|
||||||
|
return m_savedTab;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WebTab::isRestored() const
|
||||||
|
{
|
||||||
|
return m_savedTab.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebTab::restoreTab(const WebTab::SavedTab &tab)
|
||||||
|
{
|
||||||
|
if (WebViewSettings::loadTabsOnActivation) {
|
||||||
|
m_savedTab = tab;
|
||||||
|
int index = tabIndex();
|
||||||
|
|
||||||
|
m_view->animationLoading(index, false)->setPixmap(tab.icon.pixmap(16, 16));
|
||||||
|
m_view->tabWidget()->setTabText(index, tab.title);
|
||||||
|
m_locationBar.data()->showUrl(tab.url);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p_restoreTab(tab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebTab::p_restoreTab(const QUrl &url, const QByteArray &history)
|
||||||
|
{
|
||||||
|
QDataStream historyStream(history);
|
||||||
|
historyStream >> *m_view->history();
|
||||||
|
|
||||||
|
m_view->load(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebTab::p_restoreTab(const WebTab::SavedTab &tab)
|
||||||
|
{
|
||||||
|
p_restoreTab(tab.url, tab.history);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void WebTab::showNotification(QWidget* notif)
|
void WebTab::showNotification(QWidget* notif)
|
||||||
{
|
{
|
||||||
if (m_layout->count() > 1) {
|
if (m_layout->count() > 1) {
|
||||||
@ -99,7 +246,7 @@ void WebTab::showNotification(QWidget* notif)
|
|||||||
notif->show();
|
notif->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
int WebTab::tabIndex()
|
int WebTab::tabIndex() const
|
||||||
{
|
{
|
||||||
return m_view->tabIndex();
|
return m_view->tabIndex();
|
||||||
}
|
}
|
||||||
|
@ -20,45 +20,87 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
|
#include <QIcon>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#include "qz_namespace.h"
|
#include "qz_namespace.h"
|
||||||
|
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
|
class QWebHistory;
|
||||||
|
|
||||||
class QupZilla;
|
class QupZilla;
|
||||||
class LocationBar;
|
class LocationBar;
|
||||||
|
class WebView;
|
||||||
class TabbedWebView;
|
class TabbedWebView;
|
||||||
|
|
||||||
class QT_QUPZILLA_EXPORT WebTab : public QWidget
|
class QT_QUPZILLA_EXPORT WebTab : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
struct SavedTab {
|
||||||
|
QString title;
|
||||||
|
QUrl url;
|
||||||
|
QIcon icon;
|
||||||
|
QByteArray history;
|
||||||
|
|
||||||
|
SavedTab() { }
|
||||||
|
SavedTab(WebTab* webTab);
|
||||||
|
|
||||||
|
bool isEmpty() const { return url.isEmpty(); }
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
friend QT_QUPZILLA_EXPORT QDataStream &operator<<(QDataStream &stream, const SavedTab &tab);
|
||||||
|
friend QT_QUPZILLA_EXPORT QDataStream &operator>>(QDataStream &stream, SavedTab &tab);
|
||||||
|
};
|
||||||
|
|
||||||
explicit WebTab(QupZilla* mainClass, LocationBar* locationBar);
|
explicit WebTab(QupZilla* mainClass, LocationBar* locationBar);
|
||||||
~WebTab();
|
~WebTab();
|
||||||
TabbedWebView* view();
|
|
||||||
bool isPinned();
|
TabbedWebView* view() const;
|
||||||
|
void setCurrentTab();
|
||||||
|
|
||||||
|
QUrl url() const;
|
||||||
|
QString title() const;
|
||||||
|
QIcon icon() const;
|
||||||
|
QWebHistory* history() const;
|
||||||
|
|
||||||
|
void reload();
|
||||||
|
void stop();
|
||||||
|
bool isLoading() const;
|
||||||
|
|
||||||
|
bool isPinned() const;
|
||||||
void pinTab(int index);
|
void pinTab(int index);
|
||||||
void setPinned(bool state);
|
void setPinned(bool state);
|
||||||
|
|
||||||
void setLocationBar(LocationBar* bar);
|
int tabIndex() const;
|
||||||
LocationBar* locationBar();
|
|
||||||
|
|
||||||
bool inspectorVisible();
|
void setLocationBar(LocationBar* bar);
|
||||||
|
LocationBar* locationBar() const;
|
||||||
|
|
||||||
|
bool inspectorVisible() const;
|
||||||
void setInspectorVisible(bool v);
|
void setInspectorVisible(bool v);
|
||||||
|
|
||||||
|
SavedTab savedTab() const;
|
||||||
|
bool isRestored() const;
|
||||||
|
|
||||||
|
void restoreTab(const SavedTab &tab);
|
||||||
|
|
||||||
|
void p_restoreTab(const SavedTab &tab);
|
||||||
|
void p_restoreTab(const QUrl &url, const QByteArray &history);
|
||||||
|
|
||||||
void disconnectObjects();
|
void disconnectObjects();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showNotification(QWidget* notif);
|
void showNotification(QWidget* notif);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int tabIndex();
|
|
||||||
|
|
||||||
QupZilla* p_QupZilla;
|
QupZilla* p_QupZilla;
|
||||||
TabbedWebView* m_view;
|
TabbedWebView* m_view;
|
||||||
QVBoxLayout* m_layout;
|
QVBoxLayout* m_layout;
|
||||||
QWeakPointer<LocationBar> m_locationBar;
|
QWeakPointer<LocationBar> m_locationBar;
|
||||||
|
|
||||||
|
SavedTab m_savedTab;
|
||||||
|
|
||||||
bool m_pinned;
|
bool m_pinned;
|
||||||
bool m_inspectorVisible;
|
bool m_inspectorVisible;
|
||||||
};
|
};
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
int WebViewSettings::defaultZoom = 100;
|
int WebViewSettings::defaultZoom = 100;
|
||||||
|
bool WebViewSettings::loadTabsOnActivation = false;
|
||||||
|
|
||||||
WebViewSettings::WebViewSettings()
|
WebViewSettings::WebViewSettings()
|
||||||
{
|
{
|
||||||
@ -11,7 +12,10 @@ void WebViewSettings::loadSettings()
|
|||||||
{
|
{
|
||||||
Settings settings;
|
Settings settings;
|
||||||
settings.beginGroup("Web-Browser-Settings");
|
settings.beginGroup("Web-Browser-Settings");
|
||||||
|
|
||||||
defaultZoom = settings.value("DefaultZoom", 100).toInt();
|
defaultZoom = settings.value("DefaultZoom", 100).toInt();
|
||||||
|
loadTabsOnActivation = settings.value("LoadTabsOnActivation", false).toBool();
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ public:
|
|||||||
static void loadSettings();
|
static void loadSettings();
|
||||||
|
|
||||||
static int defaultZoom;
|
static int defaultZoom;
|
||||||
|
static bool loadTabsOnActivation;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WEBVIEWSETTINGS_H
|
#endif // WEBVIEWSETTINGS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user