summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-09-04 00:48:41 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-09-04 00:48:41 +0200
commit1e32755e0c8caa5be6c12dd6675a477e5dae9155 (patch)
tree561740ef6654371d458d8a6140e6975b11d521c6
parentImproving Multi Windows implementation (diff)
downloadrekonq-1e32755e0c8caa5be6c12dd6675a477e5dae9155.tar.xz
Open in new Window Action
-rw-r--r--src/application.cpp12
-rw-r--r--src/application.h3
-rw-r--r--src/webview.cpp16
-rw-r--r--src/webview.h2
4 files changed, 30 insertions, 3 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 44b0142e..3a0b1606 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -310,7 +310,16 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
}
WebView *webView = 0;
- MainWindow *w = mainWindow();
+ MainWindow *w = 0;
+
+ if(type == Rekonq::NewWindow)
+ {
+ w = newMainWindow();
+ }
+ else
+ {
+ w = mainWindow();
+ }
switch(type)
{
@@ -328,6 +337,7 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
case Rekonq::NewBackTab:
webView = w->mainView()->newWebView(false);
break;
+ case Rekonq::NewWindow:
case Rekonq::CurrentTab:
webView = w->mainView()->currentWebView();
w->mainView()->urlBar()->setUrl(loadingUrl.prettyUrl());
diff --git a/src/application.h b/src/application.h
index 14e4c1f6..60aec259 100644
--- a/src/application.h
+++ b/src/application.h
@@ -78,7 +78,8 @@ namespace Rekonq
CurrentTab, ///< open url in current tab
SettingOpenTab, ///< open url according to users settings
NewCurrentTab, ///< open url in new tab and make it current
- NewBackTab ///< open url in new tab in background
+ NewBackTab, ///< open url in new tab in background
+ NewWindow ///< open url in new window
};
}
diff --git a/src/webview.cpp b/src/webview.cpp
index 85e0e996..19c5e421 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -116,7 +116,12 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
// link actions
a = pageAction(QWebPage::OpenLinkInNewWindow);
a->setText(i18n("Open Link in New &Tab"));
- a->setIcon(KIcon("window-new"));
+ a->setIcon(KIcon("tab-new"));
+ menu.addAction(a);
+
+ a = new KAction(KIcon("window-new"), i18n("Open Link in New &Window"), this);
+ a->setData( result.linkUrl() );
+ connect(a, SIGNAL( triggered(bool) ), this, SLOT( openLinkInNewWindow() ) );
menu.addAction(a);
a = pageAction(QWebPage::DownloadLinkToDisk);
@@ -211,6 +216,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
{
// page action
menu.addAction(mainwindow->actionByName("new_tab"));
+ menu.addAction(mainwindow->actionByName("new_window"));
menu.addSeparator();
}
@@ -349,3 +355,11 @@ void WebView::printFrame()
{
Application::instance()->mainWindow()->printRequested(page()->currentFrame());
}
+
+
+void WebView::openLinkInNewWindow()
+{
+ KAction *a = qobject_cast<KAction*>(sender());
+ KUrl url(a->data().toUrl());
+ Application::instance()->loadUrl(url, Rekonq::NewWindow);
+}
diff --git a/src/webview.h b/src/webview.h
index 259c1d83..49bdccfb 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -73,6 +73,8 @@ private slots:
void slotLoadFinished(bool);
void printFrame();
+
+ void openLinkInNewWindow();
private:
WebPage *m_page;