summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/application.cpp6
-rw-r--r--src/application.h2
-rw-r--r--src/mainview.cpp34
-rw-r--r--src/mainview.h2
-rw-r--r--src/mainwindow.cpp5
-rw-r--r--src/rekonq.kcfg5
-rw-r--r--src/settings/settings_webkit.ui85
-rw-r--r--src/settings/settingsdialog.cpp3
-rw-r--r--src/tabbar.cpp4
-rw-r--r--src/webtab.cpp22
10 files changed, 112 insertions, 56 deletions
diff --git a/src/application.cpp b/src/application.cpp
index db6d3c32..45d115ae 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -329,10 +329,12 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
}
-MainWindow *Application::newMainWindow()
+MainWindow *Application::newMainWindow(bool withTab)
{
MainWindow *w = new MainWindow();
- w->mainView()->newWebTab(); // remember using newWebTab and NOT newTab here!!
+
+ if(withTab)
+ w->mainView()->newWebTab(); // remember using newWebTab and NOT newTab here!!
m_mainWindows.prepend(w);
w->show();
diff --git a/src/application.h b/src/application.h
index c268d586..fe3c50c1 100644
--- a/src/application.h
+++ b/src/application.h
@@ -102,7 +102,7 @@ public:
static Application *instance();
MainWindow *mainWindow();
- MainWindow *newMainWindow();
+ MainWindow *newMainWindow(bool withTab = true);
MainWindowList mainWindowList();
static KIcon icon(const KUrl &url);
diff --git a/src/mainview.cpp b/src/mainview.cpp
index cb2e3b11..63c10683 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -456,7 +456,7 @@ void MainView::cloneTab(int index)
// When index is -1 index chooses the current tab
-void MainView::closeTab(int index)
+void MainView::closeTab(int index, bool del)
{
// open default homePage if just one tab is opened
if (count() == 1)
@@ -510,11 +510,15 @@ void MainView::closeTab(int index)
removeTab(index);
updateTabBar(); // UI operation: do it ASAP!!
- tab->deleteLater(); // tab is scheduled for deletion.
QWidget *urlbar = _bars->widget(index);
_bars->removeWidget(urlbar);
- urlbar->deleteLater();
+
+ if(del)
+ {
+ tab->deleteLater(); // tab is scheduled for deletion.
+ urlbar->deleteLater();
+ }
emit tabsChanged();
}
@@ -682,10 +686,26 @@ void MainView::detachTab(int index)
if (index < 0 || index >= count())
return;
- KUrl url = webTab(index)->view()->url();
- closeTab(index);
-
- Application::instance()->loadUrl(url, Rekonq::NewWindow);
+ WebTab *tab = webTab(index);
+ KUrl u = tab->url();
+ kDebug() << u;
+ if( u.scheme() == QL1S("about") )
+ {
+ closeTab(index);
+ Application::instance()->loadUrl(u, Rekonq::NewWindow);
+ }
+ else
+ {
+ QString label = tab->view()->title();
+ QWidget *bar = _bars->widget(index);
+ closeTab(index, false);
+
+ MainWindow *w = Application::instance()->newMainWindow(false);
+ w->mainView()->addTab(tab, Application::icon( u ), label);
+ QStackedWidget *stack = qobject_cast<QStackedWidget *>(w->mainView()->urlBarWidget());
+ stack->insertWidget(0, bar);
+ w->mainView()->updateTabBar();
+ }
}
diff --git a/src/mainview.h b/src/mainview.h
index 272cf82e..367fcb13 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -123,7 +123,7 @@ public slots:
void newTab();
void cloneTab(int index = -1);
- void closeTab(int index = -1);
+ void closeTab(int index = -1, bool del = true);
void closeOtherTabs(int index);
void reloadTab(int index = -1);
void reloadAllTabs();
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index cb90f818..fe00ee7e 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -572,6 +572,7 @@ void MainWindow::updateConfiguration()
// ================ WebKit ============================
defaultSettings->setAttribute(QWebSettings::AutoLoadImages, ReKonfig::autoLoadImages());
+ defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, ReKonfig::dnsPrefetch());
defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, ReKonfig::javascriptEnabled());
defaultSettings->setAttribute(QWebSettings::JavaEnabled, ReKonfig::javaEnabled());
defaultSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, ReKonfig::javascriptCanOpenWindows());
@@ -588,8 +589,8 @@ void MainWindow::updateConfiguration()
// ===== HTML 5 features WebKit support ======
defaultSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, ReKonfig::offlineStorageDatabaseEnabled());
defaultSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, ReKonfig::offlineWebApplicationCacheEnabled());
- defaultSettings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, ReKonfig::localStorageDatabaseEnabled());
- if(ReKonfig::localStorageDatabaseEnabled())
+ defaultSettings->setAttribute(QWebSettings::LocalStorageEnabled, ReKonfig::localStorageEnabled());
+ if(ReKonfig::localStorageEnabled())
{
QString path = KStandardDirs::locateLocal("cache", QString("WebkitLocalStorage/rekonq"), true);
path.remove("rekonq");
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index 860809cd..dd46624f 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -117,6 +117,9 @@
<entry name="autoLoadImages" type="Bool">
<default>true</default>
</entry>
+ <entry name="dnsPrefetch" type="Bool">
+ <default>true</default>
+ </entry>
<entry name="javascriptEnabled" type="Bool">
<default>true</default>
</entry>
@@ -147,7 +150,7 @@
<entry name="offlineWebApplicationCacheEnabled" type="Bool">
<default>true</default>
</entry>
- <entry name="localStorageDatabaseEnabled" type="Bool">
+ <entry name="localStorageEnabled" type="Bool">
<default>true</default>
</entry>
<entry name="userCSS" type="Url">
diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui
index e424fd9c..f2e616c8 100644
--- a/src/settings/settings_webkit.ui
+++ b/src/settings/settings_webkit.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>437</width>
- <height>346</height>
+ <width>643</width>
+ <height>560</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -17,99 +17,106 @@
<string>WebKit Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="2">
+ <item row="0" column="0">
<widget class="QCheckBox" name="kcfg_autoLoadImages">
<property name="text">
<string>Autoload images</string>
</property>
</widget>
</item>
- <item row="0" column="3">
+ <item row="0" column="1" rowspan="7">
+ <widget class="Line" name="line">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
<widget class="QCheckBox" name="kcfg_linksIncludedInFocusChain">
<property name="text">
<string>Links included in focus chain</string>
</property>
</widget>
</item>
- <item row="1" column="0" colspan="2">
- <widget class="QCheckBox" name="kcfg_javascriptEnabled">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="kcfg_dnsPrefetch">
<property name="text">
- <string>JavaScript support</string>
+ <string>prefetch DNS entries</string>
</property>
</widget>
</item>
- <item row="1" column="3">
+ <item row="1" column="2">
<widget class="QCheckBox" name="kcfg_zoomTextOnly">
<property name="text">
<string>Zoom text only</string>
</property>
</widget>
</item>
- <item row="2" column="0" colspan="2">
- <widget class="QCheckBox" name="kcfg_javaEnabled">
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="kcfg_javascriptEnabled">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="text">
- <string>Java support</string>
+ <string>JavaScript support</string>
</property>
</widget>
</item>
- <item row="2" column="3">
+ <item row="2" column="2">
<widget class="QCheckBox" name="kcfg_printElementBackgrounds">
<property name="text">
<string>Print element backgrounds</string>
</property>
</widget>
</item>
- <item row="3" column="3">
+ <item row="4" column="2">
<widget class="QCheckBox" name="kcfg_offlineStorageDatabaseEnabled">
<property name="text">
<string>Offline storage database</string>
</property>
</widget>
</item>
- <item row="4" column="3">
- <widget class="QCheckBox" name="kcfg_offlineWebApplicationCacheEnabled">
+ <item row="3" column="0" rowspan="2">
+ <widget class="QCheckBox" name="kcfg_javaEnabled">
<property name="text">
- <string>Offline web application cache</string>
+ <string>Java support</string>
</property>
</widget>
</item>
- <item row="5" column="3">
- <widget class="QCheckBox" name="kcfg_localStorageDatabaseEnabled">
+ <item row="5" column="0">
+ <widget class="QCheckBox" name="kcfg_javascriptCanOpenWindows">
<property name="text">
- <string>Local storage database</string>
+ <string>JavaScript can open windows</string>
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QCheckBox" name="kcfg_javascriptCanOpenWindows">
+ <item row="5" column="2">
+ <widget class="QCheckBox" name="kcfg_offlineWebApplicationCacheEnabled">
<property name="text">
- <string>JavaScript can open windows</string>
+ <string>Offline web application cache</string>
</property>
</widget>
</item>
- <item row="4" column="0">
+ <item row="6" column="0">
<widget class="QCheckBox" name="kcfg_javascriptCanAccessClipboard">
<property name="text">
<string>JavaScript can access clipboard</string>
</property>
</widget>
</item>
- <item row="0" column="2" rowspan="6">
- <widget class="Line" name="line">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
+ <item row="6" column="2">
+ <widget class="QCheckBox" name="kcfg_localStorageEnabled">
+ <property name="text">
+ <string>Local Storage</string>
</property>
</widget>
</item>
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp
index b5add779..2f52a8c2 100644
--- a/src/settings/settingsdialog.cpp
+++ b/src/settings/settingsdialog.cpp
@@ -175,6 +175,7 @@ SettingsDialog::~SettingsDialog()
void SettingsDialog::setWebSettingsToolTips()
{
d->webkitUi.kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages."));
+ d->webkitUi.kcfg_dnsPrefetch->setToolTip( i18n("Specifies whether WebKit will try to pre-fetch DNS entries to speed up browsing.") );
d->webkitUi.kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs."));
d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets."));
d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages."));
@@ -185,7 +186,7 @@ void SettingsDialog::setWebSettingsToolTips()
d->webkitUi.kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed."));
d->webkitUi.kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 offline storage feature."));
d->webkitUi.kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Enables support for the HTML 5 web application cache feature."));
- d->webkitUi.kcfg_localStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature."));
+ d->webkitUi.kcfg_localStorageEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature."));
}
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index fca3c6b1..a2f269c4 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -273,7 +273,9 @@ void TabBar::contextMenu(int tab, const QPoint &pos)
menu.addAction(mainWindow->actionByName(QLatin1String("new_tab")));
menu.addAction( mainWindow->actionByName("clone_tab") );
- menu.addAction( mainWindow->actionByName("detach_tab") );
+
+ if(count() > 1)
+ menu.addAction( mainWindow->actionByName("detach_tab") );
menu.addSeparator();
menu.addAction( mainWindow->actionByName("close_tab") );
menu.addAction( mainWindow->actionByName("close_other_tabs") );
diff --git a/src/webtab.cpp b/src/webtab.cpp
index 62de6299..bc051e27 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -118,9 +118,29 @@ WebPage *WebTab::page()
}
+// TODO:
+// Import the "about" check and the one in protocolhandler
+// in some (static?) methods in NewTabPage
KUrl WebTab::url()
{
- return KUrl( view()->url() );
+ KUrl u = KUrl( view()->url() );
+ if( u.scheme() == QL1S("about") )
+ {
+ QWebElement rootElement = page()->mainFrame()->documentElement();
+ if( rootElement.document().findAll("#rekonq-newtabpage").count() == 0 )
+ return u;
+ if( rootElement.findAll(".favorites").count() > 0 )
+ return KUrl("about:favorites");
+ if( rootElement.findAll(".closedTabs").count() > 0 )
+ return KUrl("about:closedTabs");
+ if( rootElement.findAll(".history").count() > 0 )
+ return KUrl("about:history");
+ if( rootElement.findAll(".bookmarks").count() > 0 )
+ return KUrl("about:bookmarks");
+ if( rootElement.findAll(".downloads").count() > 0 )
+ return KUrl("about:downloads");
+ }
+ return u;
}