diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-09-06 11:04:03 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-09-06 11:04:03 +0200 |
commit | 42e6065c5519a0cc78e9d66345d6786d5ad15874 (patch) | |
tree | b412a328f341c93bd07ccfc833b9befb5838e0af /src | |
parent | Simplified CookieJar management (diff) | |
download | rekonq-42e6065c5519a0cc78e9d66345d6786d5ad15874.tar.xz |
Fixing rekonq Multi Windows behaviour and
Added options about tabbed (or not) browsing..
Diffstat (limited to 'src')
-rw-r--r-- | src/application.cpp | 31 | ||||
-rw-r--r-- | src/mainview.cpp | 1 | ||||
-rw-r--r-- | src/mainview.h | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 12 | ||||
-rw-r--r-- | src/mainwindow.h | 1 | ||||
-rw-r--r-- | src/rekonq.kcfg | 6 | ||||
-rw-r--r-- | src/settings_general.ui | 14 | ||||
-rw-r--r-- | src/webpage.cpp | 12 | ||||
-rw-r--r-- | src/webview.cpp | 14 | ||||
-rw-r--r-- | src/webview.h | 1 |
10 files changed, 66 insertions, 28 deletions
diff --git a/src/application.cpp b/src/application.cpp index ee38c899..8324d212 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -85,21 +85,36 @@ int Application::newInstance() KCmdLineArgs::setCwd(QDir::currentPath().toUtf8()); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); - // creating new window - MainWindow *w = newMainWindow(); - if (args->count() > 0) { - loadUrl(args->arg(0)); - - for (int i = 1; i < args->count(); ++i) + // opening links in new tabs in ONE window + if(ReKonfig::externalUrlNewTab()) + { + // creating 1st new window + newMainWindow(); + loadUrl(args->arg(0)); + + for (int i = 1; i < args->count(); ++i) + { + loadUrl(args->arg(i), Rekonq::NewCurrentTab); + } + args->clear(); + + } + else { - loadUrl(args->arg(i), Rekonq::NewCurrentTab); + // opening ONE window for each URL + for (int i = 0; i < args->count(); ++i) + { + loadUrl(args->arg(i), Rekonq::NewWindow); + } + args->clear(); } - args->clear(); } else { + // creating new window + MainWindow *w = newMainWindow(); w->slotHome(); } diff --git a/src/mainview.cpp b/src/mainview.cpp index ec26c359..a12ec8f9 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -568,4 +568,3 @@ void MainView::resizeEvent(QResizeEvent *event) { KTabWidget::resizeEvent(event); } - diff --git a/src/mainview.h b/src/mainview.h index 035b4695..c59cca1a 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -133,7 +133,7 @@ private slots: void webViewUrlChanged(const QUrl &url); void windowCloseRequested(); - + protected: virtual void mouseDoubleClickEvent(QMouseEvent *event); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 04db6f6f..c2e86014 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -191,7 +191,7 @@ void MainWindow::postLaunch() // --------- connect signals and slots connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); - + // update toolbar actions signals connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); @@ -829,16 +829,6 @@ void MainWindow::slotOpenNext() } -// WARNING: this change will be there until rekonq'll have ONE mainwindow -// (probably forever..) -void MainWindow::geometryChangeRequested(const QRect &geometry) -{ - Q_UNUSED(geometry) -// setGeometry(geometry); - kDebug() << "No geometry change allowed"; -} - - bool MainWindow::queryClose() { if (m_view->count() > 1) diff --git a/src/mainwindow.h b/src/mainwindow.h index f42ee02d..21cf1a4f 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -104,7 +104,6 @@ private slots: void slotBrowserLoading(bool); void slotUpdateActions(); void slotUpdateWindowTitle(const QString &title = QString()); - void geometryChangeRequested(const QRect &geometry); // history related void slotOpenPrevious(); diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index b27c4fd5..86b1a5df 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -14,6 +14,12 @@ <entry name="homePage" type="String"> <default>http://www.kde.org/</default> </entry> + <entry name="openTabNoWindow" type="Bool"> + <default>true</default> + </entry> + <entry name="externalUrlNewTab" type="Bool"> + <default>true</default> + </entry> <entry name="alwaysShowTabBar" type="Bool"> <default>true</default> </entry> diff --git a/src/settings_general.ui b/src/settings_general.ui index 23904354..3adf615b 100644 --- a/src/settings_general.ui +++ b/src/settings_general.ui @@ -81,6 +81,20 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> + <widget class="QCheckBox" name="kcfg_openTabNoWindow"> + <property name="text"> + <string>Open links in new tab instead of new window</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="kcfg_externalUrlNewTab"> + <property name="text"> + <string>Open external URLs as new tab in existing window</string> + </property> + </widget> + </item> + <item> <widget class="QCheckBox" name="kcfg_alwaysShowTabBar"> <property name="text"> <string>Always show tab bar</string> diff --git a/src/webpage.cpp b/src/webpage.cpp index 7ef9ec1d..ede503a5 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -126,9 +126,15 @@ WebPage *WebPage::newWindow(WebWindowType type) kDebug() << "Modal Dialog ---------------------------------------"; } - // FIXME: regression introduced. No more following rekonq setting about tab focus - // the FIX should be moving loadUrl code from Application to acceptNavigationRequest - WebView *w = Application::instance()->mainWindow()->mainView()->newWebView(!ReKonfig::openTabsBack()); + WebView *w = 0; + if(ReKonfig::openTabNoWindow()) + { + w = Application::instance()->mainWindow()->mainView()->newWebView(!ReKonfig::openTabsBack()); + } + else + { + w = Application::instance()->newMainWindow()->mainView()->currentWebView(); + } return w->page(); } diff --git a/src/webview.cpp b/src/webview.cpp index 13eeead5..292fd307 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -114,9 +114,9 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) if (!result.linkUrl().isEmpty()) { // link actions - a = pageAction(QWebPage::OpenLinkInNewWindow); - a->setText(i18n("Open in New &Tab")); - a->setIcon(KIcon("tab-new")); + a = new KAction(KIcon("tab-new"), i18n("Open in New &Tab"), this); + a->setData(result.linkUrl()); + connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewTab())); menu.addAction(a); a = new KAction(KIcon("window-new"), i18n("Open in New &Window"), this); @@ -364,3 +364,11 @@ void WebView::openLinkInNewWindow() KUrl url(a->data().toUrl()); Application::instance()->loadUrl(url, Rekonq::NewWindow); } + + +void WebView::openLinkInNewTab() +{ + KAction *a = qobject_cast<KAction*>(sender()); + KUrl url(a->data().toUrl()); + Application::instance()->loadUrl(url, Rekonq::SettingOpenTab); +} diff --git a/src/webview.h b/src/webview.h index 49bdccfb..f1e5272c 100644 --- a/src/webview.h +++ b/src/webview.h @@ -75,6 +75,7 @@ private slots: void printFrame(); void openLinkInNewWindow(); + void openLinkInNewTab(); private: WebPage *m_page; |