Commit 45bf8a14 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

apply patch #85919 from Shourya Singh Gupta to handle D&D operation with tags over preview canvas

BUGS: 281785
FIXED-IN: 4.0.0
parent b2e12532
......@@ -31,6 +31,9 @@
#include <QGraphicsSceneContextMenuEvent>
#include <QMouseEvent>
#include <QToolBar>
#include <QDragMoveEvent>
#include <QDropEvent>
#include <QDragEnterEvent>
// KDE includes
......@@ -55,6 +58,7 @@
#include "imagepreviewviewitem.h"
#include "albumsettings.h"
#include "contextmenuhelper.h"
#include "ddragobjects.h"
#include "digikamapp.h"
#include "dimg.h"
#include "dimgpreviewitem.h"
......@@ -513,4 +517,54 @@ void Digikam::ImagePreviewView::slotUpdateFaces()
d->rotationLock = false;
}
void ImagePreviewView::dragMoveEvent(QDragMoveEvent* e)
{
if (DTagListDrag::canDecode(e->mimeData()))
{
e->accept();
return;
}
e->ignore();
}
void ImagePreviewView::dragEnterEvent(QDragEnterEvent* e)
{
if (DTagListDrag::canDecode(e->mimeData()))
{
e->accept();
return;
}
e->ignore();
}
void ImagePreviewView::dropEvent(QDropEvent* e)
{
if (DTagListDrag::canDecode(e->mimeData()))
{
QList<int> tagIDs;
if (!DTagListDrag::decode(e->mimeData(), tagIDs))
{
return;
}
KMenu popMenu(this);
QAction* assignToThisAction = popMenu.addAction(SmallIcon("tag"), i18n("Assign Tags to &This Item"));
popMenu.addSeparator();
popMenu.addAction(SmallIcon("dialog-cancel"), i18n("&Cancel"));
popMenu.setMouseTracking(true);
QAction* const choice = popMenu.exec(this->mapToGlobal(e->pos()));
if(choice==assignToThisAction)
{
FileActionMngr::instance()->assignTags(d->item->imageInfo(),tagIDs);
}
}
e->accept();
return;
}
} // namespace Digikam
......@@ -32,6 +32,9 @@
#include "imageinfo.h"
class QPixmap;
class QDragMoveEvent;
class QDropEvent;
class QDragEnterEvent;
namespace Digikam
{
......@@ -84,12 +87,16 @@ Q_SIGNALS:
void signalGotoTagAndItem(int);
void signalPopupTagsView();
protected:
bool acceptsMouseClick(QMouseEvent* e);
void enterEvent(QEvent* e);
void leaveEvent(QEvent* e);
void showEvent(QShowEvent* e);
void dropEvent(QDropEvent* e);
void dragMoveEvent(QDragMoveEvent* e);
void dragEnterEvent(QDragEnterEvent* e);
private Q_SLOTS:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment