diff options
author | Ken Moore <ken@ixsystems.com> | 2018-06-07 21:55:13 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-06-07 21:55:13 -0400 |
commit | 47d4b080f9e4dbb94b71ef748d8eb8e7c042e5b7 (patch) | |
tree | ce09cff3eee79a2284bc7a0ce0e7fe5324b41b0a /src-qt5/core/lumina-desktop/desktop-plugins/applauncher | |
parent | Remove the xscreensaver return code check, apparently it is now erratic regar... (diff) | |
download | lumina-47d4b080f9e4dbb94b71ef748d8eb8e7c042e5b7.tar.gz lumina-47d4b080f9e4dbb94b71ef748d8eb8e7c042e5b7.tar.bz2 lumina-47d4b080f9e4dbb94b71ef748d8eb8e7c042e5b7.zip |
Rip out the initialization of drag and drop on applauncher desktop plugins.
Have it move the plugin on the desktop instead, but it can also be "dropped" into applications and get used as a drag-n-drop operation.
Diffstat (limited to 'src-qt5/core/lumina-desktop/desktop-plugins/applauncher')
-rw-r--r-- | src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp | 17 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h | 16 |
2 files changed, 21 insertions, 12 deletions
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp index 218bc098..88f535de 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp +++ b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp @@ -153,6 +153,8 @@ void AppLauncherPlugin::loadButton(){ tmp = this->contextMenu()->addAction( tr("Delete"), this, SLOT(fileDelete()) ); ICONS->loadIcon(tmp, "document-close"); } + tmp = this->contextMenu()->addAction( tr("Drag to Application"), this, SLOT(startDragNDrop()) ); + ICONS->loadIcon(tmp, "edit-redo"); iconLoaded(iconID); //make sure the emblem is layered on top //If the file is a symlink, put the overlay on the icon /*if(info.isSymLink()){ @@ -240,6 +242,21 @@ void AppLauncherPlugin::iconLoaded(QString ico){ } } +void AppLauncherPlugin::startDragNDrop(){ + //Start the drag event for this file + QDrag *drag = new QDrag(this); + QMimeData *md = new QMimeData; + md->setUrls( QList<QUrl>() << QUrl::fromLocalFile(button->whatsThis()) ); + drag->setMimeData(md); + //Now perform the drag and react appropriately + Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction); + if(dropAction == Qt::MoveAction){ + // File Moved, remove it from here + //qDebug() << "File Moved:" << button->whatsThis(); + //DO NOT DELETE FILES - return code often is wrong (browser drops for instance) + } +} + void AppLauncherPlugin::actionTriggered(QAction *act){ if(act->whatsThis().isEmpty()){ return; } QString path = button->whatsThis(); diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h index 6cff4bf7..553fe1c5 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h +++ b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h @@ -53,6 +53,7 @@ private slots: //void increaseIconSize(); //void decreaseIconSize(); //void deleteFile(); + void startDragNDrop(); void actionTriggered(QAction *act); void openWith(); @@ -90,18 +91,9 @@ protected: void mouseMoveEvent(QMouseEvent *ev){ if( (ev->buttons() & Qt::LeftButton) ){ if((ev->pos() - dragstartpos).manhattanLength() > (this->width()/4) ){ - //Start the drag event for this file - QDrag *drag = new QDrag(this); - QMimeData *md = new QMimeData; - md->setUrls( QList<QUrl>() << QUrl::fromLocalFile(button->whatsThis()) ); - drag->setMimeData(md); - //Now perform the drag and react appropriately - Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction); - if(dropAction == Qt::MoveAction){ - // File Moved, remove it from here - //qDebug() << "File Moved:" << button->whatsThis(); - //DO NOT DELETE FILES - return code often is wrong (browser drops for instance) - } + emit StartMoving(this->ID()); + }else if(false){ // + startDragNDrop(); } }else{ LDPlugin::mouseMoveEvent(ev); |