summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2008-12-11 14:34:42 +0100
committerAndrea Diamantini <adjam7@gmail.com>2008-12-11 14:34:42 +0100
commit72cf5c1727345cca277b36702a59c58b9be5ef58 (patch)
treeef49ebc865482c6ef7ecf507d8d740cd41e96fa4 /src
parentctrl + click open new tab AND select (diff)
downloadrekonq-72cf5c1727345cca277b36702a59c58b9be5ef58.tar.xz
( SHIFT + ) CTRL + TAB switching. Finally!!
Diffstat (limited to 'src')
-rw-r--r--src/browsermainwindow.cpp2
-rw-r--r--src/browsermainwindow.h3
-rw-r--r--src/tabwidget.cpp4
-rw-r--r--src/tabwidget.h1
-rw-r--r--src/webview.cpp20
-rw-r--r--src/webview.h11
6 files changed, 37 insertions, 4 deletions
diff --git a/src/browsermainwindow.cpp b/src/browsermainwindow.cpp
index 3375aa89..ac05a249 100644
--- a/src/browsermainwindow.cpp
+++ b/src/browsermainwindow.cpp
@@ -620,7 +620,7 @@ void BrowserMainWindow::closeEvent(QCloseEvent *event)
{
int ret = KMessageBox::warningYesNo(this,
i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_tabWidget->count() ) ,
- QString() );
+ i18n("Closing") );
if (ret == KMessageBox::No)
{
event->ignore();
diff --git a/src/browsermainwindow.h b/src/browsermainwindow.h
index 19ab51c9..9cb9fe18 100644
--- a/src/browsermainwindow.h
+++ b/src/browsermainwindow.h
@@ -53,9 +53,8 @@ class BrowserMainWindow : public KMainWindow
public:
BrowserMainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
~BrowserMainWindow();
- QSize sizeHint() const;
-public:
+ QSize sizeHint() const;
static KUrl guessUrlFromString(const QString &url);
TabWidget *tabWidget() const;
WebView *currentTab() const;
diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp
index 0b815b6e..54db660a 100644
--- a/src/tabwidget.cpp
+++ b/src/tabwidget.cpp
@@ -511,6 +511,10 @@ WebView *TabWidget::newTab(bool makeCurrent)
connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SIGNAL(toolBarVisibilityChangeRequested(bool)));
+
+ connect(webView, SIGNAL( ctrlTabPressed() ), this, SLOT( nextTab() ) );
+ connect(webView, SIGNAL( shiftCtrlTabPressed() ), this, SLOT( previousTab() ) );
+
addTab(webView, i18n("(Untitled)") );
if (makeCurrent)
setCurrentWidget(webView);
diff --git a/src/tabwidget.h b/src/tabwidget.h
index 27cc4611..72fbc0a7 100644
--- a/src/tabwidget.h
+++ b/src/tabwidget.h
@@ -176,6 +176,7 @@ protected:
void contextMenuEvent(QContextMenuEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
+
public slots:
void loadUrlInCurrentTab(const KUrl &url);
WebView *newTab(bool makeCurrent = true);
diff --git a/src/webview.cpp b/src/webview.cpp
index b03c9291..19bf60ee 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -177,7 +177,6 @@ WebView::WebView(QWidget* parent)
connect(page(), SIGNAL(loadingUrl(const QUrl&)), this, SIGNAL(urlChanged(const QUrl &)));
connect(page(), SIGNAL(downloadRequested(const QNetworkRequest &)), this, SLOT(downloadRequested(const QNetworkRequest &)));
page()->setForwardUnsupportedContent(true);
-
}
@@ -297,3 +296,22 @@ void WebView::downloadRequested(const QNetworkRequest &request)
{
BrowserApplication::downloadManager()->download(request);
}
+
+
+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 );
+}
+
diff --git a/src/webview.h b/src/webview.h
index 62d4f3a5..ae5230ce 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -82,12 +82,23 @@ public:
QString lastStatusBarText() const;
inline int progress() const { return m_progress; }
+signals:
+ // switching tabs
+ void ctrlTabPressed();
+ void shiftCtrlTabPressed();
+
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
void wheelEvent(QWheelEvent *event);
+ /**
+ * FIlters (SHIFT + ) CTRL + TAB events and emit (shift)ctrlTabPressed()
+ * to make switch tab
+ */
+ void keyPressEvent(QKeyEvent *event);
+
private slots:
void setProgress(int progress);
void loadFinished();