summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/previewimage.cpp14
-rw-r--r--src/webpage.cpp6
-rw-r--r--src/webpage.h5
-rw-r--r--src/webview.cpp26
4 files changed, 23 insertions, 28 deletions
diff --git a/src/previewimage.cpp b/src/previewimage.cpp
index 94f5061f..60207fb3 100644
--- a/src/previewimage.cpp
+++ b/src/previewimage.cpp
@@ -30,7 +30,6 @@
#include <QFile>
#include <QMovie>
-#include <QMouseEvent>
#include <KUrl>
#include <KStandardDirs>
@@ -84,17 +83,8 @@ void PreviewImage::setSiteImage()
void PreviewImage::mousePressEvent(QMouseEvent *event)
{
- switch(event->button())
- {
- case Qt::LeftButton:
- Application::instance()->loadUrl(m_url);
- break;
- case Qt::RightButton:
- // TODO
- break;
- default:
- QLabel::mousePressEvent(event);
- };
+ Q_UNUSED(event)
+ Application::instance()->loadUrl(m_url);
}
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 0a94be58..59c777d6 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -70,6 +70,8 @@
WebPage::WebPage(QObject *parent)
: QWebPage(parent)
+ , m_keyboardModifiers(Qt::NoModifier)
+ , m_pressedButtons(Qt::NoButton)
, m_requestedUrl()
{
setPluginFactory(new WebPluginFactory(this));
@@ -91,9 +93,11 @@ WebPage::~WebPage()
bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
{
- if (Application::keyboardModifiers() & Qt::ControlModifier || Application::mouseButtons() == Qt::MidButton)
+ if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
{
Application::instance()->loadUrl(request.url(), Rekonq::SettingOpenTab);
+ m_keyboardModifiers = Qt::NoModifier;
+ m_pressedButtons = Qt::NoButton;
return false;
}
diff --git a/src/webpage.h b/src/webpage.h
index 7d55afee..86024a9d 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -81,8 +81,13 @@ protected Q_SLOTS:
virtual void slotDownloadRequested(const QNetworkRequest &request);
private:
+ friend class WebView;
QString errorPage(QNetworkReply *);
+ // keyboard/mouse modifiers
+ Qt::KeyboardModifiers m_keyboardModifiers;
+ Qt::MouseButtons m_pressedButtons;
+
QUrl m_requestedUrl;
};
diff --git a/src/webview.cpp b/src/webview.cpp
index e5cc62bb..ac6f4566 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -128,8 +128,6 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow()));
menu.addAction(a);
- menu.addSeparator();
-
a = pageAction(QWebPage::DownloadLinkToDisk);
a->setIcon(KIcon("document-save"));
menu.addAction(a);
@@ -137,8 +135,6 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
a = pageAction(QWebPage::CopyLinkToClipboard);
a->setIcon(KIcon("edit-copy"));
menu.addAction(a);
-
- menu.addSeparator();
}
// is content editable && selected? Add CUT
@@ -188,16 +184,13 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
if(!engine.isEmpty())
{
service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(engine));
- if(service)
- {
- const QString searchProviderPrefix = *(service->property("Keys").toStringList().begin()) + keywordDelimiter; // FIXME crashed
- data.setData(searchProviderPrefix + "some keyword");
- a = new KAction(service->name(), this);
- a->setIcon(Application::icon(KUrl(data.uri())));
- a->setData(searchProviderPrefix);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(slotSearch()));
- searchMenu->addAction(a);
- }
+ const QString searchProviderPrefix = *(service->property("Keys").toStringList().begin()) + keywordDelimiter; // FIXME crashed
+ data.setData(searchProviderPrefix + "some keyword");
+ a = new KAction(service->name(), this);
+ a->setIcon(Application::icon(KUrl(data.uri())));
+ a->setData(searchProviderPrefix);
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(slotSearch()));
+ searchMenu->addAction(a);
}
}
@@ -328,6 +321,9 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
void WebView::mousePressEvent(QMouseEvent *event)
{
+ m_page->m_pressedButtons = event->buttons();
+ m_page->m_keyboardModifiers = event->modifiers();
+
switch(event->button())
{
case Qt::XButton1:
@@ -344,7 +340,7 @@ void WebView::mousePressEvent(QMouseEvent *event)
void WebView::wheelEvent(QWheelEvent *event)
{
- if (Application::keyboardModifiers() & Qt::ControlModifier)
+ if (QApplication::keyboardModifiers() & Qt::ControlModifier)
{
int numDegrees = event->delta() / 8;
int numSteps = numDegrees / 15;