summaryrefslogtreecommitdiff
path: root/src/previewimage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/previewimage.cpp')
-rw-r--r--src/previewimage.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/previewimage.cpp b/src/previewimage.cpp
index fd007432..5430c80b 100644
--- a/src/previewimage.cpp
+++ b/src/previewimage.cpp
@@ -32,6 +32,8 @@
#include "application.h"
#include "history.h"
#include "rekonq.h"
+#include "mainwindow.h"
+#include "mainview.h"
// KDE Includes
#include <KUrl>
@@ -168,17 +170,26 @@ void PreviewImage::mouseMoveEvent(QMouseEvent *event)
void PreviewImage::mousePressEvent(QMouseEvent *event)
{
- switch(event->button())
+ if(event->button() == Qt::LeftButton)
{
- case Qt::LeftButton:
- Application::instance()->loadUrl(m_url);
- break;
- case Qt::RightButton:
- // TODO
- break;
- default:
- QLabel::mousePressEvent(event);
+ if(m_isFavorite)
+ {
+ Application::instance()->loadUrl(m_url);
+ }
+ else
+ {
+ MainView *mv = Application::instance()->mainWindow()->mainView();
+ int actualIndex = mv->currentIndex();
+
+ kDebug() << "Actual index: " << actualIndex;
+ kDebug() << "m_index: " << m_index;
+
+ mv->slotCloseTab(actualIndex);
+ mv->setCurrentIndex(m_index);
+ }
+ return;
};
+ QLabel::mousePressEvent(event);
}