diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainview.cpp | 3 | ||||
-rw-r--r-- | src/mainwindow.cpp | 16 | ||||
-rw-r--r-- | src/mainwindow.h | 12 | ||||
-rw-r--r-- | src/webview.cpp | 18 | ||||
-rw-r--r-- | src/webview.h | 10 |
5 files changed, 28 insertions, 31 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 4fa40b6d..9b7978bc 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -274,9 +274,6 @@ WebView *MainView::newWebView(bool focused, bool nearParent) connect(webView, SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &))); connect(webView, SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &))); - connect(webView, SIGNAL(ctrlTabPressed()), this, SLOT(nextTab())); - connect(webView, SIGNAL(shiftCtrlTabPressed()), this, SLOT(previousTab())); - // connecting webPage signals with mainview connect(webView->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *))); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b7996a3a..60c4a05e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -193,6 +193,10 @@ void MainWindow::postLaunch() connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); + // (shift +) ctrl + tab switching + connect(this, SIGNAL(ctrlTabPressed()), m_view, SLOT(nextTab())); + connect(this, SIGNAL(shiftCtrlTabPressed()), m_view, SLOT(previousTab())); + // update toolbar actions signals connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); @@ -872,6 +876,18 @@ void MainWindow::keyPressEvent(QKeyEvent *event) return; } + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_Tab)) + { + emit ctrlTabPressed(); + return; + } + + if ((event->modifiers() == Qt::ControlModifier + Qt::ShiftModifier) && (event->key() == Qt::Key_Backtab)) + { + emit shiftCtrlTabPressed(); + return; + } + KMainWindow::keyPressEvent(event); } diff --git a/src/mainwindow.h b/src/mainwindow.h index b8352b4c..c680cc60 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -94,8 +94,20 @@ public slots: void printRequested(QWebFrame *frame = 0); + +signals: + // switching tabs + void ctrlTabPressed(); + void shiftCtrlTabPressed(); + protected: bool queryClose(); + + /** + * Filters (SHIFT + ) CTRL + TAB events and emit (shift)ctrlTabPressed() + * to make switch tab + * Filters out ESC key to show/hide the search bar + */ void keyPressEvent(QKeyEvent *event); private slots: diff --git a/src/webview.cpp b/src/webview.cpp index 88c0e664..f4e41301 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -314,24 +314,6 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) } -void WebView::keyPressEvent(QKeyEvent *event) -{ - if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_Tab)) - { - emit ctrlTabPressed(); - return; - } - - if ((event->modifiers() == Qt::ControlModifier + Qt::ShiftModifier) && (event->key() == Qt::Key_Backtab)) - { - emit shiftCtrlTabPressed(); - return; - } - - QWebView::keyPressEvent(event); -} - - void WebView::mousePressEvent(QMouseEvent *event) { m_page->m_pressedButtons = event->buttons(); diff --git a/src/webview.h b/src/webview.h index 101d2558..55de3ad2 100644 --- a/src/webview.h +++ b/src/webview.h @@ -51,19 +51,9 @@ public: QString lastStatusBarText() const; int progress(); -signals: - // switching tabs - void ctrlTabPressed(); - void shiftCtrlTabPressed(); - protected: void contextMenuEvent(QContextMenuEvent *event); void mousePressEvent(QMouseEvent *event); - /** - * Filters (SHIFT + ) CTRL + TAB events and emit (shift)ctrlTabPressed() - * to make switch tab - */ - void keyPressEvent(QKeyEvent *event); void wheelEvent(QWheelEvent *event); private slots: |