diff options
author | Ken Moore <ken@ixsystems.com> | 2018-03-08 15:20:09 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-03-08 15:20:09 -0500 |
commit | 316223cb4a00af03a0989e0449fcac121213fda2 (patch) | |
tree | 4ad252b60b3773dbd09446ccf54a72696686f82b /src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp | |
parent | Add drag-n-drop to the desktop icons. (diff) | |
download | lumina-316223cb4a00af03a0989e0449fcac121213fda2.tar.gz lumina-316223cb4a00af03a0989e0449fcac121213fda2.tar.bz2 lumina-316223cb4a00af03a0989e0449fcac121213fda2.zip |
Add drop support for directories on the desktop.
Diffstat (limited to 'src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp')
-rw-r--r-- | src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp | 16 |
1 files changed, 16 insertions, 0 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 0bf087c1..837e3268 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp +++ b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp @@ -47,6 +47,7 @@ void AppLauncherPlugin::loadButton(){ bool ok = info.canonicalPath().startsWith("/net/"); if(!ok){ ok = QFile::exists(path); } //do it this way to ensure the file existance check never runs for /net/ files if(!ok){ emit RemovePlugin(this->ID()); return;} + this->setAcceptDrops( info.isDir() ); icosize = this->height()-4 - 2.2*button->fontMetrics().height(); button->setFixedSize( this->width()-4, this->height()-4); button->setIconSize( QSize(icosize,icosize) ); @@ -316,3 +317,18 @@ void AppLauncherPlugin::renameFinished(int result){ qDebug() << " - SUCCESS"; } } + +void AppLauncherPlugin::fileDrop(bool copy, QList<QUrl> urls){ + for(int i=0; i<urls.length(); i++){ + QString oldpath = urls[i].toLocalFile(); + if(!QFile::exists(oldpath)){ continue; } //not a local file? + QString filename = oldpath.section("/",-1); + if(copy){ + qDebug() << "Copying File:" << oldpath << "->" << button->whatsThis()+"/"+filename; + QFile::copy(oldpath, button->whatsThis()+"/"+filename); + }else{ + qDebug() << "Moving File:" << oldpath << "->" << button->whatsThis()+"/"+filename; + QFile::rename(oldpath, button->whatsThis()+"/"+filename); + } + } +} |