diff options
author | Ken Moore <ken@ixsystems.com> | 2016-12-05 09:31:56 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-12-05 09:31:56 -0500 |
commit | 546bba1faf69e1aac06aa13fd0ecd28d23c09a7f (patch) | |
tree | f8f0d604f12cbc790db4201290ac75f60e766be8 /src-qt5/desktop-utils | |
parent | Make the start menu open faster by only loading the favorites *when the file/... (diff) | |
download | lumina-546bba1faf69e1aac06aa13fd0ecd28d23c09a7f.tar.gz lumina-546bba1faf69e1aac06aa13fd0ecd28d23c09a7f.tar.bz2 lumina-546bba1faf69e1aac06aa13fd0ecd28d23c09a7f.zip |
Re-enable drag and drop within lumina-fm.
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp | 2 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h | 27 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp index 8db13718..0d9c33f8 100644 --- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp +++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp @@ -357,6 +357,8 @@ void BrowserWidget::itemDataAvailable(QIcon ico, LFileInfo info){ void BrowserWidget::itemsLoading(int total){ qDebug() << "Got number of items loading:" << total; + if(listWidget!=0){ listWidget->setWhatsThis( BROWSER->currentDirectory() ); } + if(treeWidget!=0){ treeWidget->setWhatsThis(BROWSER->currentDirectory() ); } numItems = total; //save this for later if(total<1){ emit updateDirectoryStatus( tr("No Directory Contents") ); diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h b/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h index 48127efa..f7373432 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h @@ -63,9 +63,10 @@ protected: if(items.length()<1){ return; } QList<QUrl> urilist; for(int i=0; i<items.length(); i++){ - urilist << QUrl::fromLocalFile(items[i]->whatsThis().section("::::",1,100)); + urilist << QUrl::fromLocalFile(items[i]->whatsThis()); } //Create the mime data + //qDebug() << "Start Drag:" << urilist; QMimeData *mime = new QMimeData; mime->setUrls(urilist); //Create the drag structure @@ -91,6 +92,7 @@ protected: if(ev->mimeData()->hasUrls() && !this->whatsThis().isEmpty() ){ //Change the drop type depending on the data/dir QString home = QDir::homePath(); + //qDebug() << "Drag Move:" << home << this->whatsThis(); if( this->whatsThis().startsWith(home) ){ ev->setDropAction(Qt::MoveAction); } else{ ev->setDropAction(Qt::CopyAction); } ev->acceptProposedAction(); //allow this to be dropped here @@ -107,7 +109,8 @@ protected: //See if the item under the drop point is a directory or not QListWidgetItem *it = this->itemAt( ev->pos()); if(it!=0){ - QFileInfo info(it->whatsThis().section("::::",1,100)); + //qDebug() << "Drop Item:" << it->whatsThis(); + QFileInfo info(it->whatsThis()); if(info.isDir() && info.isWritable()){ dirpath = info.absoluteFilePath(); } @@ -118,11 +121,12 @@ protected: foreach(const QUrl &url, ev->mimeData()->urls()){ const QString filepath = url.toLocalFile(); //If the target file is modifiable, assume a move - otherwise copy - if(QFileInfo(filepath).isWritable() && (filepath.startsWith(home) && dirpath.startsWith(home))){ files << "cut::::"+filepath; } - else{ files << "copy::::"+filepath; } + if(QFileInfo(filepath).isWritable() && (filepath.startsWith(home) && dirpath.startsWith(home))){ + if(filepath.section("/",0,-2)!=dirpath){ files << "cut::::"+filepath; } //don't "cut" a file into the same dir + }else{ files << "copy::::"+filepath; } } - //qDebug() << "Drop Event:" << dirpath; - emit DataDropped( dirpath, files ); + //qDebug() << "Drop Event:" << dirpath << files; + if(!files.isEmpty()){ emit DataDropped( dirpath, files ); } } void mouseReleaseEvent(QMouseEvent *ev){ @@ -175,7 +179,7 @@ protected: if(items.length()<1){ return; } QList<QUrl> urilist; for(int i=0; i<items.length(); i++){ - urilist << QUrl::fromLocalFile(items[i]->whatsThis(0).section("::::",1,100)); + urilist << QUrl::fromLocalFile(items[i]->whatsThis(0)); } //Create the mime data QMimeData *mime = new QMimeData; @@ -218,7 +222,7 @@ protected: //See if the item under the drop point is a directory or not QTreeWidgetItem *it = this->itemAt( ev->pos()); if(it!=0){ - QFileInfo info(it->whatsThis(0).section("::::",1,100)); + QFileInfo info(it->whatsThis(0)); if(info.isDir() && info.isWritable()){ dirpath = info.absoluteFilePath(); } @@ -229,9 +233,10 @@ protected: QString home = QDir::homePath(); foreach(const QUrl &url, ev->mimeData()->urls()){ const QString filepath = url.toLocalFile(); - //If the target file is modifiable, assume a move - otherwise copy - if(QFileInfo(filepath).isWritable() && (filepath.startsWith(home) && dirpath.startsWith(home)) ){ files << "cut::::"+filepath; } - else{ files << "copy::::"+filepath; } + //If the target file is modifiable, assume a move - otherwise copy + if(QFileInfo(filepath).isWritable() && (filepath.startsWith(home) && dirpath.startsWith(home))){ + if(filepath.section("/",0,-2)!=dirpath){ files << "cut::::"+filepath; } //don't "cut" a file into the same dir + }else{ files << "copy::::"+filepath; } } //qDebug() << "Drop Event:" << dirpath; emit DataDropped( dirpath, files ); |