diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/application.cpp | 31 | ||||
-rw-r--r-- | src/cookiejar.cpp | 16 | ||||
-rw-r--r-- | src/cookiejar.h | 2 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/mainview.cpp | 1 | ||||
-rw-r--r-- | src/mainview.h | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 31 | ||||
-rw-r--r-- | src/mainwindow.h | 3 | ||||
-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 |
14 files changed, 88 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e062b91e..f205c674 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ PROJECT( rekonq ) # rekonq info SET(REKONQ_MAJOR_VERSION "0") SET(REKONQ_MINOR_VERSION "2") -SET(REKONQ_PATCH_VERSION "54") +SET(REKONQ_PATCH_VERSION "55") SET(REKONQ_VERSION_STR "${REKONQ_MAJOR_VERSION}.${REKONQ_MINOR_VERSION}.${REKONQ_PATCH_VERSION}" 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/cookiejar.cpp b/src/cookiejar.cpp index 5160d6ed..cd7b97fa 100644 --- a/src/cookiejar.cpp +++ b/src/cookiejar.cpp @@ -32,6 +32,10 @@ // Auto Includes #include "rekonq.h" +// Local Includes +#include "application.h" +#include "mainwindow.h" + // KDE Includes #include <KConfig> #include <KStandardDirs> @@ -48,7 +52,6 @@ CookieJar::CookieJar(QObject* parent) : QNetworkCookieJar(parent) - , m_windowId(-1) , m_kcookiejar(new QDBusInterface("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer")) { } @@ -63,7 +66,7 @@ CookieJar::~CookieJar() QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl & url) const { QList<QNetworkCookie> cookieList; - QDBusReply<QString> reply = m_kcookiejar->call("findCookies", url.toString() , m_windowId); + QDBusReply<QString> reply = m_kcookiejar->call("listCookies", url.toString() ); if (reply.isValid()) { @@ -85,20 +88,13 @@ bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> & cookieList, cons { cookieHeader = "Set-Cookie: "; cookieHeader += cookie.toRawForm(); - m_kcookiejar->call("addCookies", url.toString(), cookieHeader, m_windowId); + m_kcookiejar->call("addCookies", url.toString(), cookieHeader, 0 ); } return !m_kcookiejar->lastError().isValid(); } -void CookieJar::setWindowId(qlonglong id) -{ - kDebug() << id; - m_windowId = id; -} - - void CookieJar::clear() { QDBusReply<void> reply = m_kcookiejar->call( "deleteAllCookies" ); diff --git a/src/cookiejar.h b/src/cookiejar.h index f78a9662..4dea1e60 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -44,7 +44,6 @@ class CookieJar : public QNetworkCookieJar public: CookieJar(QObject* parent = 0); virtual ~CookieJar(); - void setWindowId(qlonglong id); virtual QList<QNetworkCookie> cookiesForUrl(const QUrl & url) const; virtual bool setCookiesFromUrl(const QList<QNetworkCookie> & cookieList, const QUrl & url); @@ -52,7 +51,6 @@ public: void clear(); private: - qlonglong m_windowId; QDBusInterface *m_kcookiejar; }; diff --git a/src/main.cpp b/src/main.cpp index fba844f6..1adb77c4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,7 @@ static const char description[] = I18N_NOOP("A lightweight Web Browser for KDE based on Webkit"); -static const char version[] = "0.2.54"; +static const char version[] = "0.2.55"; int main(int argc, char **argv) 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 07d0e763..7a3d165f 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())); @@ -208,11 +208,6 @@ void MainWindow::postLaunch() // accept d'n'd setAcceptDrops(true); - - // set CookieJar window Id - const qlonglong winId = window()->winId(); - Application::cookieJar()->setWindowId(winId); - Application::networkAccessManager()->metaData().insert("window-id", QString::number(winId)); } @@ -239,7 +234,6 @@ void MainWindow::setupActions() // location bar a = new KAction(i18n("Location Bar"), this); - a->setShortcut(KShortcut(Qt::Key_F6)); a->setDefaultWidget(m_view->urlBar()); actionCollection()->addAction(QLatin1String("url_bar"), a); @@ -281,6 +275,12 @@ void MainWindow::setupActions() connect(m_view, SIGNAL(browserTabLoading(bool)), this, SLOT(slotBrowserLoading(bool))); slotBrowserLoading(false); //first init for blank start page + a = new KAction(this); + a->setShortcut(Qt::CTRL + Qt::Key_L); + actionCollection()->addAction(QLatin1String("open_location"), a); + connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation())); + + // ============== Zoom Actions a = new KAction(KIcon("zoom-in"), i18n("&Enlarge Font"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Plus)); @@ -486,6 +486,13 @@ void MainWindow::slotUpdateBrowser() } +void MainWindow::slotOpenLocation() +{ + m_view->urlBar()->selectAll(); + m_view->urlBar()->setFocus(); +} + + void MainWindow::slotFileSaveAs() { KUrl srcUrl = currentTab()->url(); @@ -821,16 +828,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 b97e8d25..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(); @@ -120,8 +119,8 @@ private slots: void slotViewTextNormal(); void slotViewTextSmaller(); - // File Menu slots + void slotOpenLocation(); void slotFileOpen(); void slotFileSaveAs(); 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; |