add drop to open file

Change-Id: Icf959366f347533bf31b23b41cd61982583d1670
This commit is contained in:
石博文 2016-06-23 15:30:06 +08:00 committed by Hualet Wang
parent 17ba0ae185
commit 96b46370f2
3 changed files with 21 additions and 1 deletions

View File

@ -89,6 +89,11 @@ public Q_SLOTS: // METHODS
return asyncCall(QStringLiteral("HandleMenuItem"), item);
}
inline QDBusPendingReply<> HandleDragDrop(const QStringList &uriList)
{
return asyncCall(QStringLiteral("HandleDragDrop"), QVariant::fromValue(uriList));
}
inline QDBusPendingReply<> RequestDock()
{
return asyncCall(QStringLiteral("RequestDock"));

View File

@ -185,7 +185,21 @@ void AppItem::resizeEvent(QResizeEvent *e)
void AppItem::dragEnterEvent(QDragEnterEvent *e)
{
qDebug() << e;
// ignore drag from panel
if (e->source())
return;
e->accept();
}
void AppItem::dropEvent(QDropEvent *e)
{
QStringList uriList;
for (auto uri : e->mimeData()->urls())
uriList << uri.toString();
// qDebug() << uriList;
m_itemEntry->HandleDragDrop(uriList);
}
void AppItem::invokedMenuItem(const QString &itemId, const bool checked)

View File

@ -25,6 +25,7 @@ private:
void mouseMoveEvent(QMouseEvent *e);
void resizeEvent(QResizeEvent *e);
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
void invokedMenuItem(const QString &itemId, const bool checked);
const QString contextMenu() const;