diff options
author | Ken Moore <ken@ixsystems.com> | 2017-11-02 12:26:43 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-11-02 12:26:43 -0400 |
commit | 29b171bce4dee4c9737f590079e18e83d49b7136 (patch) | |
tree | dbb7add95843f08ca0c7ddc99e444b581977eb58 /src-qt5 | |
parent | A bit more cleanup on the external device reporting/usage. (diff) | |
download | lumina-29b171bce4dee4c9737f590079e18e83d49b7136.tar.gz lumina-29b171bce4dee4c9737f590079e18e83d49b7136.tar.bz2 lumina-29b171bce4dee4c9737f590079e18e83d49b7136.zip |
Fix up the drag and drop in lumina-fm.
Also fix the showing of thumbnails within the right-column widget.
Diffstat (limited to 'src-qt5')
5 files changed, 29 insertions, 16 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp index ab25d5e7..87a3a6d7 100644 --- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp +++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp @@ -95,6 +95,8 @@ void BrowserWidget::showDetails(bool show){ connect(listWidget, SIGNAL(GotFocus()), this, SLOT(selectionChanged()) ); if(!BROWSER->currentDirectory().isEmpty()){ emit dirChange("",true); } } + if(listWidget!=0){ listWidget->setWhatsThis( BROWSER->currentDirectory() ); } + if(treeWidget!=0){ treeWidget->setWhatsThis(BROWSER->currentDirectory() ); } //qDebug() << " Done making widget"; } @@ -291,6 +293,8 @@ void BrowserWidget::itemRemoved(QString item){ } void BrowserWidget::itemDataAvailable(QIcon ico, LFileInfo *info){ + if(listWidget!=0){ listWidget->setWhatsThis( BROWSER->currentDirectory() ); } + if(treeWidget!=0){ treeWidget->setWhatsThis(BROWSER->currentDirectory() ); } //qDebug() << "Item Data Available:" << info->fileName(); int num = 0; if(listWidget!=0){ @@ -346,7 +350,7 @@ void BrowserWidget::itemDataAvailable(QIcon ico, LFileInfo *info){ treeWidget->addTopLevelItem(it); } }else{ - if( ! treeWidget->findItems(info->fileName(), Qt::MatchExactly, 0).isEmpty() ) { + if( ! treeWidget->findItems(info->fileName(), Qt::MatchExactly, 0).isEmpty() ) { it = treeWidget->findItems(info->fileName(), Qt::MatchExactly, 0).first(); }else if(info->isVideo() && videoMap.find(info->absoluteFilePath()) == videoMap.end()) { it = new CQTreeWidgetItem(treeWidget); diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h index f041280c..b17ad588 100644 --- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h +++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h @@ -89,7 +89,7 @@ signals: void contextMenuRequested(); void DataDropped(QString, QStringList); void hasFocus(QString); //ID output - void stopLoop(); + void stopLoop(); //Internal signal void dirChange(QString, bool); //current dir path, force diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h b/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h index da4131e0..2ca0829d 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h @@ -23,6 +23,7 @@ #include <QMouseEvent> #include <QUrl> #include <QDir> +#include <QApplication> #include <LUtils.h> @@ -144,7 +145,7 @@ protected: } /*void mouseMoveEvent(QMouseEvent *ev){ if(ev->button() != Qt::RightButton && ev->button() != Qt::LeftButton){ ev->ignore(); } - else{ QListWidget::mouseMoveEvent(ev); } //pass it along to the widget + else{ QListWidget::mouseMoveEvent(ev); } //pass it along to the widget }*/ }; @@ -158,6 +159,7 @@ public: //Drag and Drop Properties this->setDragDropMode(QAbstractItemView::DragDrop); this->setDefaultDropAction(Qt::MoveAction); //prevent any built-in Qt actions - the class handles it + this->setDropIndicatorShown(true); //Other custom properties necessary for the FM this->setFocusPolicy(Qt::StrongFocus); this->setContextMenuPolicy(Qt::CustomContextMenu); @@ -192,15 +194,14 @@ protected: //Create the drag structure QDrag *drag = new QDrag(this); drag->setMimeData(mime); - /*if(info.first().section("::::",0,0)=="cut"){ - drag->exec(act | Qt::MoveAction); - }else{*/ + //qDebug() << "Start Drag:" << urilist; drag->exec(act | Qt::CopyAction| Qt::MoveAction); - //} + //qDebug() << " - Drag Finished"; } void dragEnterEvent(QDragEnterEvent *ev){ - //qDebug() << "Drag Enter Event:" << ev->mimeData()->hasFormat(MIME); + //qDebug() << "Drag Enter Event:" << ev->mimeData()->hasUrls() << this->whatsThis(); + QTreeWidget::dragEnterEvent(ev); if(ev->mimeData()->hasUrls() && !this->whatsThis().isEmpty() ){ ev->acceptProposedAction(); //allow this to be dropped here }else{ @@ -209,18 +210,25 @@ protected: } void dragMoveEvent(QDragMoveEvent *ev){ + //qDebug() << "Drag Move Event:" << ev->mimeData()->hasUrls() << this->whatsThis(); + //QTreeWidget::dragMoveEvent(ev); if(ev->mimeData()->hasUrls() && !this->whatsThis().isEmpty() ){ //Change the drop type depending on the data/dir QString home = QDir::homePath(); - if( this->whatsThis().startsWith(home) ){ ev->setDropAction(Qt::MoveAction); } - else{ ev->setDropAction(Qt::CopyAction); } - ev->accept(); //allow this to be dropped here + if( this->whatsThis().startsWith(home) ){ ev->setDropAction(Qt::MoveAction); this->setCursor(Qt::DragMoveCursor); } + else{ ev->setDropAction(Qt::CopyAction); this->setCursor(Qt::DragCopyCursor);} + ev->acceptProposedAction(); //allow this to be dropped here + //this->setCursor(Qt::CrossCursor); }else{ + this->setCursor(Qt::ForbiddenCursor); ev->ignore(); } + this->update(); + //QTreeWidget::dragMoveEvent(ev); } void dropEvent(QDropEvent *ev){ + //qDebug() << "Drop Event:" << ev->mimeData()->hasUrls() << this->whatsThis(); if(this->whatsThis().isEmpty() || !ev->mimeData()->hasUrls() ){ ev->ignore(); return; } //not supported ev->accept(); //handled here QString dirpath = this->whatsThis(); diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp index 83040108..5c6f9ef5 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp @@ -477,7 +477,7 @@ void DirWidget::on_actionDualColumn_triggered(bool checked){ if(RCBW!=0){ return; } //nothing to do RCBW = new BrowserWidget("rc", this); ui->browser_layout->addWidget(RCBW); - connect(RCBW, SIGNAL(dirChange(QString)), this, SLOT(currentDirectoryChanged()) ); + connect(RCBW, SIGNAL(dirChange(QString, bool)), this, SLOT(currentDirectoryChanged()) ); connect(RCBW, SIGNAL(itemsActivated()), this, SLOT(runFiles()) ); connect(RCBW, SIGNAL(DataDropped(QString, QStringList)), this, SIGNAL(PasteFiles(QString, QStringList)) ); connect(RCBW, SIGNAL(contextMenuRequested()), this, SLOT(OpenContextMenu()) ); @@ -488,6 +488,7 @@ void DirWidget::on_actionDualColumn_triggered(bool checked){ RCBW->showDetails(BW->hasDetails()); RCBW->showHiddenFiles( BW->hasHiddenFiles()); RCBW->setThumbnailSize( BW->thumbnailSize()); + RCBW->showThumbnails( BW->hasThumbnails()); RCBW->changeDirectory( BW->currentDirectory()); } diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h index 04af46fc..4377f92d 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h @@ -73,9 +73,9 @@ private: Ui::DirWidget *ui; BrowserWidget *BW, *RCBW; //Main BrowserWidget and right-column browser widget QString ID, cBID; //unique ID assigned by the parent, and currently active browser widget - QString normalbasedir, snapbasedir, snaprelpath, rootfmdir; //for maintaining directory context while moving between snapshots + QString normalbasedir, snapbasedir, snaprelpath, rootfmdir; //for maintaining directory context while moving between snapshots QStringList snapshots, needThumbs, tmpSel; - QSettings *settings; + QSettings *settings; bool canmodify; //The Toolbar and associated items @@ -83,10 +83,10 @@ private: QLineEdit *line_dir; //The context menu and associated items - QMenu *contextMenu, *cNewMenu, *cOpenMenu, *cFModMenu, *cFViewMenu, *cOpenWithMenu; + QMenu *contextMenu, *cNewMenu, *cOpenMenu, *cFModMenu, *cFViewMenu, *cOpenWithMenu; //The keyboard shortcuts for context menu items - QShortcut *kZoomIn, *kZoomOut, *kNewFile, *kNewDir, *kNewXDG, *kCut, *kCopy, *kPaste, *kRename, \ + QShortcut *kZoomIn, *kZoomOut, *kNewFile, *kNewDir, *kNewXDG, *kCut, *kCopy, *kPaste, *kRename, \ *kFav, *kDel, *kOpSS, *kOpMM, *kOpTerm, *kExtract; //, *kArchive; //Functions for internal use |