diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/bookmarksmanager.cpp | 34 | ||||
-rw-r--r-- | src/bookmarks/bookmarksmanager.h | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 4 | ||||
-rw-r--r-- | src/webview.cpp | 44 | ||||
-rw-r--r-- | src/webview.h | 6 |
5 files changed, 77 insertions, 13 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index d54abb3c..7e933599 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -35,6 +35,7 @@ #include "mainwindow.h" #include "webtab.h" #include "webview.h" +#include "mainview.h" #include "bookmarkcontextmenu.h" // KDE Includes @@ -53,7 +54,6 @@ #include <QtGui/QActionGroup> - BookmarkOwner::BookmarkOwner(QObject *parent) : QObject(parent) , KBookmarkOwner() @@ -112,6 +112,22 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bm) } +QList< QPair<QString, QString> > BookmarkOwner::currentBookmarkList() const +{ + QList< QPair<QString, QString> > bkList; + int tabNumber = Application::instance()->mainWindow()->mainView()->count(); + + for(int i = 0; i < tabNumber; i++) + { + QPair<QString, QString> item; + item.first = Application::instance()->mainWindow()->mainView()->webTab(i)->view()->title(); + item.second = Application::instance()->mainWindow()->mainView()->webTab(i)->url().url(); + bkList += item; + } + return bkList; +} + + // ------------------------------------------------------------------------------------------------------ @@ -405,9 +421,19 @@ void BookmarkActionMenu::addFolderActions() if(!m_group.first().isNull()) { - action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this); - connect(action, SIGNAL(triggered(bool)), this, SLOT(openActionInTabs())); - addAction(action); + KBookmark bookmark = m_group.first(); + + while(bookmark.isGroup() || bookmark.isSeparator()) + { + bookmark = m_group.next(bookmark); + } + + if(!bookmark.isNull()) + { + action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this); + connect(action, SIGNAL(triggered(bool)), this, SLOT(openActionInTabs())); + addAction(action); + } } action = new KAction(KIcon("bookmark-new"), i18n("Add Bookmark Here"), this); diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h index c8264633..7fb02970 100644 --- a/src/bookmarks/bookmarksmanager.h +++ b/src/bookmarks/bookmarksmanager.h @@ -115,6 +115,8 @@ public: */ virtual void openFolderinTabs(const KBookmarkGroup &bm); + virtual QList< QPair<QString, QString> > currentBookmarkList() const; + signals: /** * This signal is emitted when an url has to be loaded diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index abee13d5..898aa842 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -845,8 +845,8 @@ void MainWindow::highlightAll() if(m_findBar->highlightAllState() && !m_findBar->isHidden()) { - if (m_findBar->matchCase()) - options |= QWebPage::FindCaseSensitively; + if (m_findBar->matchCase()) + options |= QWebPage::FindCaseSensitively; currentTab()->view()->findText(m_lastSearch, options); } 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 |