diff options
-rw-r--r-- | src/bookmarks/bookmarkcontextmenu.cpp | 1 | ||||
-rw-r--r-- | src/bookmarks/bookmarkcontextmenu.h | 1 | ||||
-rw-r--r-- | src/data/default.css | 2 | ||||
-rw-r--r-- | src/urlbar/listitem.cpp | 1 | ||||
-rw-r--r-- | src/urlbar/listitem.h | 7 | ||||
-rw-r--r-- | src/webview.cpp | 44 | ||||
-rw-r--r-- | src/webview.h | 6 |
7 files changed, 54 insertions, 8 deletions
diff --git a/src/bookmarks/bookmarkcontextmenu.cpp b/src/bookmarks/bookmarkcontextmenu.cpp index dedec097..aab6af90 100644 --- a/src/bookmarks/bookmarkcontextmenu.cpp +++ b/src/bookmarks/bookmarkcontextmenu.cpp @@ -26,6 +26,7 @@ // Self Includes #include "bookmarkcontextmenu.h" +#include "bookmarkcontextmenu.moc" // Local Includes #include "application.h" diff --git a/src/bookmarks/bookmarkcontextmenu.h b/src/bookmarks/bookmarkcontextmenu.h index 2028df39..c8c903d8 100644 --- a/src/bookmarks/bookmarkcontextmenu.h +++ b/src/bookmarks/bookmarkcontextmenu.h @@ -63,4 +63,3 @@ private: }; #endif // BOOKMARKCONTEXTMENU_H - diff --git a/src/data/default.css b/src/data/default.css index 47c8e93d..3ddd3026 100644 --- a/src/data/default.css +++ b/src/data/default.css @@ -5,4 +5,6 @@ setting a local stylesheet in rekonq config */ /* Set background color to white for sites forgetting this */ +body{ background-color:#FFFFFF; +}
\ No newline at end of file diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 61a739f8..18e8352d 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -26,6 +26,7 @@ // Self Includes #include "listitem.h" +#include "listitem.moc" // Local Includes #include "urlresolver.h" diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h index 1b594115..18ec8a33 100644 --- a/src/urlbar/listitem.h +++ b/src/urlbar/listitem.h @@ -24,6 +24,10 @@ * ============================================================ */ +#ifndef LISTITEM_H +#define LISTITEM_H + + // Qt Includes #include <QWidget> #include <QLayout> @@ -60,3 +64,6 @@ private: QStyleOptionViewItemV4 _option; }; + + +#endif // LISTITEM_H diff --git a/src/webview.cpp b/src/webview.cpp index e874411d..6f6ec128 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -66,7 +66,8 @@ WebView::WebView(QWidget* parent) , _scrollTimer( new QTimer(this) ) , _VScrollSpeed(0) , _HScrollSpeed(0) - , _disableAutoScroll(false) + , _canEnableAutoScroll(true) + , _isAutoScrollEnabled(false) { WebPage *page = new WebPage(this); setPage(page); @@ -321,27 +322,60 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) void WebView::mousePressEvent(QMouseEvent *event) { - QWebHitTestResult result = page()->mainFrame()->hitTestContent( event->pos() ); - _disableAutoScroll = result.isContentEditable(); + if(_isAutoScrollEnabled) + { + setCursor(Qt::ArrowCursor); + _VScrollSpeed = 0; + _HScrollSpeed = 0; + _scrollTimer->stop(); + _isAutoScrollEnabled = false; + return; + } + QWebHitTestResult result = page()->mainFrame()->hitTestContent( event->pos() ); + _canEnableAutoScroll = !result.isContentEditable() && result.linkUrl().isEmpty(); + switch(event->button()) { case Qt::XButton1: triggerPageAction(KWebPage::Back); break; + case Qt::XButton2: triggerPageAction(KWebPage::Forward); break; + + case Qt::MidButton: + if(_canEnableAutoScroll && !_isAutoScrollEnabled) + { + setCursor( KIcon("transform-move").pixmap(32) ); + _clickPos = event->pos(); + _isAutoScrollEnabled = true; + } + break; + default: - KWebView::mousePressEvent(event); break; }; + KWebView::mousePressEvent(event); } void WebView::mouseMoveEvent(QMouseEvent *event) { _mousePos = event->pos(); + + if(_isAutoScrollEnabled) + { + QPoint r = _mousePos - _clickPos; + _HScrollSpeed = r.x() / 2; // you are too fast.. + _VScrollSpeed = r.y() / 2; + if( !_scrollTimer->isActive() ) + _scrollTimer->start(); + + return; + } + if (Application::instance()->mainWindow()->isFullScreen()) { if (event->pos().y()>=0 && event->pos().y()<=4) @@ -430,7 +464,7 @@ void WebView::keyPressEvent(QKeyEvent *event) } } - if(_disableAutoScroll) + if(!_canEnableAutoScroll) { KWebView::keyPressEvent(event); return; diff --git a/src/webview.h b/src/webview.h index 0fe83ae4..c6ca2688 100644 --- a/src/webview.h +++ b/src/webview.h @@ -52,7 +52,7 @@ public: protected: void contextMenuEvent(QContextMenuEvent *event); - void mousePressEvent(QMouseEvent *event); // need to be ported + void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void keyPressEvent(QKeyEvent *event); @@ -75,11 +75,13 @@ signals: private: QPoint _mousePos; + QPoint _clickPos; QTimer *_scrollTimer; int _VScrollSpeed; int _HScrollSpeed; - bool _disableAutoScroll; + bool _canEnableAutoScroll; + bool _isAutoScrollEnabled; }; #endif |