aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-fm/MainUI.cpp11
-rw-r--r--lumina-fm/MainUI.h2
-rw-r--r--lumina-fm/lumina-fm.pro1
-rw-r--r--lumina-fm/widgets/DDListWidgets.h188
-rw-r--r--lumina-fm/widgets/DirWidget.cpp102
-rw-r--r--lumina-fm/widgets/DirWidget.h7
-rw-r--r--lumina-fm/widgets/DirWidget.ui63
7 files changed, 262 insertions, 112 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp
index 1a73966e..deaac818 100644
--- a/lumina-fm/MainUI.cpp
+++ b/lumina-fm/MainUI.cpp
@@ -139,7 +139,7 @@ void MainUI::OpenDirs(QStringList dirs){
connect(DW, SIGNAL(FavoriteFiles(QStringList)), this, SLOT(FavoriteFiles(QStringList)) );
connect(DW, SIGNAL(RenameFiles(QStringList)), this, SLOT(RenameFiles(QStringList)) );
connect(DW, SIGNAL(RemoveFiles(QStringList)), this, SLOT(RemoveFiles(QStringList)) );
- connect(DW, SIGNAL(PasteFiles(QString)), this, SLOT(PasteFiles(QString)) );
+ connect(DW, SIGNAL(PasteFiles(QString,QStringList)), this, SLOT(PasteFiles(QString, QStringList)) );
connect(DW, SIGNAL(CloseBrowser(QString)), this, SLOT(CloseBrowser(QString)) );
//Now create the tab for this
if(radio_view_tabs->isChecked()){
@@ -668,11 +668,14 @@ void MainUI::CopyFiles(QStringList list){
for(int i=0; i<DWLIST.length(); i++){ DWLIST[i]->refreshButtons(); }
}
-void MainUI::PasteFiles(QString dir){
+void MainUI::PasteFiles(QString dir, QStringList raw){
qDebug() << "Paste Files:" << dir;
QStringList cut, copy, newcut, newcopy;
- const QMimeData *dat = QApplication::clipboard()->mimeData();
- QStringList raw = QString(dat->data("x-special/lumina-copied-files")).split("\n");
+ if(raw.isEmpty()){
+ //Pull info from the clipboard
+ const QMimeData *dat = QApplication::clipboard()->mimeData();
+ raw = QString(dat->data("x-special/lumina-copied-files")).split("\n");
+ }
if(!dir.endsWith("/")){ dir.append("/"); }
for(int i=0; i<raw.length(); i++){
if(raw[i].startsWith("cut::::")){
diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h
index 80582af6..3c082de2 100644
--- a/lumina-fm/MainUI.h
+++ b/lumina-fm/MainUI.h
@@ -137,7 +137,7 @@ private slots:
void OpenTerminal(QString dirpath);
void CutFiles(QStringList); //file selection
void CopyFiles(QStringList); //file selection
- void PasteFiles(QString); //current dir
+ void PasteFiles(QString, QStringList raw = QStringList() ); //current dir, optional list of commands
void FavoriteFiles(QStringList); //file selection
void RenameFiles(QStringList); //file selection
void RemoveFiles(QStringList); //file selection
diff --git a/lumina-fm/lumina-fm.pro b/lumina-fm/lumina-fm.pro
index 8dddd1d1..de3b84f2 100644
--- a/lumina-fm/lumina-fm.pro
+++ b/lumina-fm/lumina-fm.pro
@@ -26,6 +26,7 @@ HEADERS += MainUI.h \
FODialog.h \
BMMDialog.h \
DirData.h \
+ widgets/DDListWidgets.h \
widgets/MultimediaWidget.h \
widgets/SlideshowWidget.h \
widgets/DirWidget.h
diff --git a/lumina-fm/widgets/DDListWidgets.h b/lumina-fm/widgets/DDListWidgets.h
new file mode 100644
index 00000000..d62a0a5d
--- /dev/null
+++ b/lumina-fm/widgets/DDListWidgets.h
@@ -0,0 +1,188 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This is a couple simple widget subclasses to enable drag and drop functionality
+// NOTE: The "whatsThis()" item information needs to correspond to the "[cut/copy]::::<file path>" syntax
+//NOTE2: The "whatsThis()" information on the widget itself should be the current dir path *if* it can accept drops
+//===========================================
+#ifndef _LUMINA_FM_DRAG_DROP_WIDGETS_H
+#define _LUMINA_FM_DRAG_DROP_WIDGETS_H
+
+#define MIME QString("x-special/lumina-copied-files")
+
+#include <QListWidget>
+#include <QTreeWidget>
+#include <QDropEvent>
+#include <QMimeData>
+#include <QDrag>
+#include <QFileInfo>
+#include <QDebug>
+
+//==============
+// LIST WIDGET
+//==============
+class DDListWidget : public QListWidget{
+ Q_OBJECT
+public:
+ DDListWidget(QWidget *parent=0) : QListWidget(parent){
+ //Drag and Drop Properties
+ this->setDragDropMode(QAbstractItemView::DragDrop);
+ this->setDefaultDropAction(Qt::MoveAction); //prevent any built-in Qt actions - the class handles it
+ //Other custom properties necessary for the FM
+ this->setFocusPolicy(Qt::StrongFocus);
+ this->setContextMenuPolicy(Qt::CustomContextMenu);
+ this->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ this->setSelectionBehavior(QAbstractItemView::SelectRows);
+ this->setFlow(QListView::TopToBottom);
+ this->setWrapping(true);
+ this->setMouseTracking(true);
+ }
+ ~DDListWidget(){}
+
+signals:
+ void DataDropped(QString, QStringList); //Dir path, List of commands
+
+protected:
+ void startDrag(Qt::DropActions act){
+ QList<QListWidgetItem*> items = this->selectedItems();
+ if(items.length()<1){ return; }
+ QStringList info;
+ for(int i=0; i<items.length(); i++){ info << items[i]->whatsThis(); }
+ //Create the mime data
+ QMimeData *mime = new QMimeData;
+ mime->setData(MIME,info.join("\n").toLocal8Bit());
+ //Create the drag structure
+ QDrag *drag = new QDrag(this);
+ drag->setMimeData(mime);
+ drag->exec(act | Qt::MoveAction | Qt::CopyAction);
+ }
+
+ void dragEnterEvent(QDragEnterEvent *ev){
+ //qDebug() << "Drag Enter Event:" << ev->mimeData()->hasFormat(MIME);
+ if(ev->mimeData()->hasFormat(MIME) && !this->whatsThis().isEmpty() ){
+ //qDebug() << "Accepted:" << ev->mimeData()->data(MIME);
+ if(QString(ev->mimeData()->data(MIME)).section("::::",0,0)=="cut"){
+ ev->setDropAction(Qt::MoveAction);
+ }else{
+ ev->setDropAction(Qt::CopyAction);
+ }
+ ev->accept(); //allow this to be dropped here
+ }
+ }
+
+ void dragMoveEvent(QDragMoveEvent *ev){
+ //qDebug() << "Drag Move Event:" << ev->mimeData()->hasFormat(MIME);
+ if(ev->mimeData()->hasFormat(MIME) && !this->whatsThis().isEmpty()){
+ //qDebug() << "Accepted:" << ev->mimeData()->data(MIME);
+ if(QString(ev->mimeData()->data(MIME)).section("::::",0,0)=="cut"){
+ ev->setDropAction(Qt::MoveAction);
+ }else{
+ ev->setDropAction(Qt::CopyAction);
+ }
+ ev->accept(); //allow this to be dropped here
+ }
+ }
+
+ void dropEvent(QDropEvent *ev){
+ if(this->whatsThis().isEmpty()){ return; } //not supported
+ ev->accept(); //handled here
+ QString dirpath = this->whatsThis();
+ //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));
+ if(info.isDir() && info.isWritable()){
+ dirpath = info.absoluteFilePath();
+ }
+ }
+ //qDebug() << "Drop Event:" << dirpath;
+ emit DataDropped( dirpath, QString(ev->mimeData()->data(MIME)).split("\n") );
+ }
+};
+
+//================
+// TreeWidget
+//================
+class DDTreeWidget : public QTreeWidget{
+ Q_OBJECT
+public:
+ DDTreeWidget(QWidget *parent=0) : QTreeWidget(parent){
+ //Drag and Drop Properties
+ this->setDragDropMode(QAbstractItemView::DragDrop);
+ this->setDefaultDropAction(Qt::MoveAction); //prevent any built-in Qt actions - the class handles it
+ //Other custom properties necessary for the FM
+ this->setFocusPolicy(Qt::StrongFocus);
+ this->setContextMenuPolicy(Qt::CustomContextMenu);
+ this->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ this->setSelectionBehavior(QAbstractItemView::SelectRows);
+ this->setMouseTracking(true);
+ this->setSortingEnabled(true);
+ this->setIndentation(0);
+ this->setItemsExpandable(false);
+ }
+ ~DDTreeWidget(){}
+
+signals:
+ void DataDropped(QString, QStringList); //Dir path, List of commands
+
+protected:
+ void startDrag(Qt::DropActions act){
+ QList<QTreeWidgetItem*> items = this->selectedItems();
+ if(items.length()<1){ return; }
+ QStringList info;
+ for(int i=0; i<items.length(); i++){ info << items[i]->whatsThis(0); }
+ //Create the mime data
+ QMimeData *mime = new QMimeData;
+ mime->setData(MIME,info.join("\n").toLocal8Bit());
+ //Create the drag structure
+ QDrag *drag = new QDrag(this);
+ drag->setMimeData(mime);
+ drag->exec(act | Qt::MoveAction | Qt::CopyAction);
+ }
+
+ void dragEnterEvent(QDragEnterEvent *ev){
+ //qDebug() << "Drag Enter Event:" << ev->mimeData()->hasFormat(MIME);
+ if(ev->mimeData()->hasFormat(MIME) && !this->whatsThis().isEmpty() ){
+ //qDebug() << "Accepted:" << ev->mimeData()->data(MIME);
+ if(QString(ev->mimeData()->data(MIME)).section("::::",0,0)=="cut"){
+ ev->setDropAction(Qt::MoveAction);
+ }else{
+ ev->setDropAction(Qt::CopyAction);
+ }
+ ev->accept(); //allow this to be dropped here
+ }
+ }
+
+ void dragMoveEvent(QDragMoveEvent *ev){
+ //qDebug() << "Drag Move Event:" << ev->mimeData()->hasFormat(MIME);
+ if(ev->mimeData()->hasFormat(MIME) && !this->whatsThis().isEmpty()){
+ //qDebug() << "Accepted:" << ev->mimeData()->data(MIME);
+ if(QString(ev->mimeData()->data(MIME)).section("::::",0,0)=="cut"){
+ ev->setDropAction(Qt::MoveAction);
+ }else{
+ ev->setDropAction(Qt::CopyAction);
+ }
+ ev->accept(); //allow this to be dropped here
+ }
+ }
+
+ void dropEvent(QDropEvent *ev){
+ if(this->whatsThis().isEmpty()){ return; } //not supported
+ ev->accept(); //handled here
+ QString dirpath = this->whatsThis();
+ //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));
+ if(info.isDir() && info.isWritable()){
+ dirpath = info.absoluteFilePath();
+ }
+ }
+ //qDebug() << "Drop Event:" << dirpath;
+ emit DataDropped( dirpath, QString(ev->mimeData()->data(MIME)).split("\n") );
+ }
+};
+#endif \ No newline at end of file
diff --git a/lumina-fm/widgets/DirWidget.cpp b/lumina-fm/widgets/DirWidget.cpp
index f1135694..1c8df0bd 100644
--- a/lumina-fm/widgets/DirWidget.cpp
+++ b/lumina-fm/widgets/DirWidget.cpp
@@ -38,6 +38,11 @@ DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new U
toolbar->addWidget(line_dir);
toolbar->addAction(ui->actionStopLoad);
toolbar->addAction(ui->actionClose_Browser);
+ //Add the browser widgets
+ listWidget = new DDListWidget(this);
+ treeWidget = new DDTreeWidget(this);
+ ui->browser_layout->addWidget(listWidget);
+ ui->browser_layout->addWidget(treeWidget);
//Create the keyboard shortcuts
copyFilesShort = new QShortcut( QKeySequence(tr("Ctrl+C")), this);
pasteFilesShort = new QShortcut( QKeySequence(tr("Ctrl+V")), this);
@@ -79,8 +84,8 @@ QString DirWidget::currentDir(){
void DirWidget::setShowDetails(bool show){
showDetails = show;
- ui->listWidget->setVisible(!showDetails);
- ui->treeWidget->setVisible(showDetails);
+ listWidget->setVisible(!showDetails);
+ treeWidget->setVisible(showDetails);
this->refresh();
}
@@ -119,19 +124,19 @@ void DirWidget::setDetails(QList<DETAILTYPES> list){
break;
}
}
- ui->treeWidget->setHeaderItem(it);
+ treeWidget->setHeaderItem(it);
//Now reset the sorting (alphabetically, dirs first)
- if(nmcol>=0){ ui->treeWidget->sortItems(nmcol, Qt::AscendingOrder); } // sort by name
- if(typecol>=0){ ui->treeWidget->sortItems(typecol, Qt::AscendingOrder); } //sort by type first
+ if(nmcol>=0){ treeWidget->sortItems(nmcol, Qt::AscendingOrder); } // sort by name
+ if(typecol>=0){ treeWidget->sortItems(typecol, Qt::AscendingOrder); } //sort by type first
if(CDIR.isEmpty() || !showDetails){ return; } //don't need to reload dir if details are not visible
this->refresh();
}
void DirWidget::setThumbnailSize(int px){
- bool larger = ui->listWidget->iconSize().height() < px;
- ui->listWidget->setIconSize(QSize(px,px));
- ui->treeWidget->setIconSize(QSize(px,px));
+ bool larger = listWidget->iconSize().height() < px;
+ listWidget->setIconSize(QSize(px,px));
+ treeWidget->setIconSize(QSize(px,px));
if(CDIR.isEmpty() || !larger ){ return; } //don't need to reload icons unless the new size is larger
this->refresh();
}
@@ -160,6 +165,14 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
ui->tool_goToImages->setVisible(false);
ui->tool_new_dir->setVisible(canmodify);
ui->tool_new_file->setVisible(canmodify);
+ //Set the drab/drop info as appripriate
+ if(canmodify){
+ listWidget->setWhatsThis(CDIR);
+ treeWidget->setWhatsThis(CDIR);
+ }else{
+ listWidget->setWhatsThis("");
+ treeWidget->setWhatsThis("");
+ }
//Determine if this is an internal ZFS snapshot
bool loadsnaps = false;
if( dir.contains(ZSNAPDIR) ){
@@ -204,8 +217,8 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
ui->actionStopLoad->setVisible(true);
stopload = false;
//Clear the display widget
- if(showDetails){ ui->treeWidget->clear(); }
- else{ ui->listWidget->clear(); }
+ if(showDetails){ treeWidget->clear(); }
+ else{ listWidget->clear(); }
//Now fill the display widget
bool hasimages, hasmultimedia;
hasimages = hasmultimedia = false;
@@ -222,14 +235,14 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
if(showDetails){
//Now create all the individual items for the details tree
QTreeWidgetItem *it = new QTreeWidgetItem();
- it->setWhatsThis(0, list[i].fileName());
+ it->setWhatsThis(0, QString(canmodify ? "cut": "copy")+"::::"+list[i].absoluteFilePath());
for(int t=0; t<listDetails.length(); t++){
switch(listDetails[t]){
case NAME:
it->setText(t,list[i].fileName());
it->setStatusTip(t, list[i].fileName());
if(list[i].isImage()){
- if(showThumbs){ it->setIcon(t, QIcon( QPixmap(list[i].absoluteFilePath()).scaled(ui->treeWidget->iconSize(),Qt::IgnoreAspectRatio, Qt::FastTransformation) ) ); }
+ if(showThumbs){ it->setIcon(t, QIcon( QPixmap(list[i].absoluteFilePath()).scaled(treeWidget->iconSize(),Qt::IgnoreAspectRatio, Qt::FastTransformation) ) ); }
else{ it->setIcon(t, LXDG::findIcon(list[i].iconfile(),"image-x-generic") ); }
}else{
it->setIcon(t, LXDG::findIcon(list[i].iconfile(),"unknown") );
@@ -251,27 +264,27 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
break;
}
}
- ui->treeWidget->addTopLevelItem(it);
- if(lastdir == CDIR+"/"+it->whatsThis(0)){
- ui->treeWidget->setCurrentItem(it);
- ui->treeWidget->scrollToItem(it);
+ treeWidget->addTopLevelItem(it);
+ if(lastdir == CDIR+"/"+list[i].fileName()){
+ treeWidget->setCurrentItem(it);
+ treeWidget->scrollToItem(it);
}
}else{
//Create all the individual items for the basic list
QListWidgetItem *it = new QListWidgetItem();
- it->setWhatsThis(list[i].fileName());
+ it->setWhatsThis( QString(canmodify ? "cut": "copy")+"::::"+list[i].absoluteFilePath()); //used for drag and drop
it->setText(list[i].fileName());
it->setStatusTip(list[i].fileName());
if(list[i].isImage()){
- if(showThumbs){ it->setIcon(QIcon( QPixmap(list[i].absoluteFilePath()).scaled(ui->listWidget->iconSize(),Qt::IgnoreAspectRatio, Qt::FastTransformation) ) ); }
+ if(showThumbs){ it->setIcon(QIcon( QPixmap(list[i].absoluteFilePath()).scaled(listWidget->iconSize(),Qt::IgnoreAspectRatio, Qt::FastTransformation) ) ); }
else{ it->setIcon(LXDG::findIcon(list[i].iconfile(),"image-x-generic") ); }
}else{
it->setIcon(LXDG::findIcon(list[i].iconfile(),"unknown") );
}
- ui->listWidget->addItem(it);
+ listWidget->addItem(it);
if(lastdir == CDIR+"/"+it->whatsThis()){
- ui->listWidget->setCurrentItem(it);
- ui->listWidget->scrollToItem(it);
+ listWidget->setCurrentItem(it);
+ listWidget->scrollToItem(it);
}
}
QApplication::processEvents(); //keep the UI snappy while loading a directory
@@ -279,10 +292,10 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
ui->actionStopLoad->setVisible(false);
//Another check to ensure the current item is visible
if(showDetails){
- if(ui->treeWidget->currentItem()!=0){ ui->treeWidget->scrollToItem(ui->treeWidget->currentItem()); }
- for(int t=0; t<ui->treeWidget->columnCount(); t++){ui->treeWidget->resizeColumnToContents(t); }
+ if(treeWidget->currentItem()!=0){ treeWidget->scrollToItem(treeWidget->currentItem()); }
+ for(int t=0; t<treeWidget->columnCount(); t++){treeWidget->resizeColumnToContents(t); }
}else{
- if(ui->listWidget->currentItem()!=0){ ui->listWidget->scrollToItem(ui->listWidget->currentItem()); }
+ if(listWidget->currentItem()!=0){ listWidget->scrollToItem(listWidget->currentItem()); }
}
//Now Re-enable buttons as necessary
ui->tool_goToPlayer->setVisible(hasmultimedia);
@@ -383,14 +396,16 @@ void DirWidget::UpdateButtons(){
// =================
void DirWidget::setupConnections(){
//Info routines
- connect(ui->treeWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu()) );
- connect(ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu()) );
- connect(ui->treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) );
- connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) );
-
+ connect(treeWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu()) );
+ connect(listWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu()) );
+ connect(treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) );
+ connect(listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) );
+
//Activation routines
- connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(on_tool_act_run_clicked()) );
- connect(ui->listWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(on_tool_act_run_clicked()) );
+ connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(on_tool_act_run_clicked()) );
+ connect(treeWidget, SIGNAL(DataDropped(QString, QStringList)), this, SIGNAL(PasteFiles(QString, QStringList)) );
+ connect(listWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(on_tool_act_run_clicked()) );
+ connect(listWidget, SIGNAL(DataDropped(QString, QStringList)), this, SIGNAL(PasteFiles(QString, QStringList)) );
connect(line_dir, SIGNAL(returnPressed()), this, SLOT(dir_changed()) );
//Keyboard Shortcuts
@@ -407,14 +422,14 @@ void DirWidget::setupConnections(){
QStringList DirWidget::currentSelection(){
QStringList out;
if(showDetails){
- QList<QTreeWidgetItem*> sel = ui->treeWidget->selectedItems();
+ QList<QTreeWidgetItem*> sel = treeWidget->selectedItems();
for(int i=0; i<sel.length(); i++){
- out << sel[i]->whatsThis(0);
+ out << sel[i]->whatsThis(0).section("::::",1,100); //absolute file path
}
}else{
- QList<QListWidgetItem*> sel = ui->listWidget->selectedItems();
+ QList<QListWidgetItem*> sel = listWidget->selectedItems();
for(int i=0; i<sel.length(); i++){
- out << sel[i]->whatsThis();
+ out << sel[i]->whatsThis().section("::::",1,100); //absolute file path
}
}
out.removeDuplicates();
@@ -429,39 +444,34 @@ QStringList DirWidget::currentSelection(){
void DirWidget::on_tool_act_cut_clicked(){
QStringList sel = currentSelection();
if(sel.isEmpty()){ return; }
- for(int i=0; i<sel.length(); i++){ sel[i] = CDIR+"/"+sel[i]; } //use absolute paths
emit CutFiles(sel);
}
void DirWidget::on_tool_act_copy_clicked(){
QStringList sel = currentSelection();
if(sel.isEmpty()){ return; }
- for(int i=0; i<sel.length(); i++){ sel[i] = CDIR+"/"+sel[i]; } //use absolute paths
emit CopyFiles(sel);
}
void DirWidget::on_tool_act_fav_clicked(){
QStringList sel = currentSelection();
if(sel.isEmpty()){ return; }
- for(int i=0; i<sel.length(); i++){ sel[i] = CDIR+"/"+sel[i]; } //use absolute paths
emit FavoriteFiles(sel);
}
void DirWidget::on_tool_act_paste_clicked(){
- emit PasteFiles(CDIR);
+ emit PasteFiles(CDIR, QStringList()); //use the clipboard for pasting
}
void DirWidget::on_tool_act_rename_clicked(){
QStringList sel = currentSelection();
if(sel.isEmpty()){ return; }
- for(int i=0; i<sel.length(); i++){ sel[i] = CDIR+"/"+sel[i]; } //use absolute paths
emit RenameFiles(sel);
}
void DirWidget::on_tool_act_rm_clicked(){
QStringList sel = currentSelection();
if(sel.isEmpty()){ return; }
- for(int i=0; i<sel.length(); i++){ sel[i] = CDIR+"/"+sel[i]; } //use absolute paths
emit RemoveFiles(sel);
}
@@ -470,7 +480,6 @@ void DirWidget::on_tool_act_run_clicked(){
if(sel.isEmpty()){ return; }
QStringList dirs;
for(int i=0; i<sel.length(); i++){
- sel[i] = CDIR+"/"+sel[i]; //use absolute paths
if(QFileInfo(sel[i]).isDir()){
dirs << sel[i];
}else{
@@ -490,7 +499,7 @@ void DirWidget::on_tool_act_runwith_clicked(){
QStringList sel = currentSelection();
if(sel.isEmpty()){ return; }
for(int i=0; i<sel.length(); i++){
- QProcess::startDetached("lumina-open -select \""+CDIR+"/"+sel[i]+"\""); //use absolute paths
+ QProcess::startDetached("lumina-open -select \""+sel[i]+"\""); //use absolute paths
}
}
@@ -502,7 +511,7 @@ void DirWidget::on_tool_goToImages_clicked(){
//Just use the files from the current selection
LFileInfoList list;
for(int i=0; i<CLIST.length(); i++){
- if(CLIST[i].isImage() && sel.contains(CLIST[i].fileName()) ){
+ if(CLIST[i].isImage() && sel.contains(CLIST[i].absoluteFilePath()) ){
list << CLIST[i]; //add to the list
}
}
@@ -517,7 +526,7 @@ void DirWidget::on_tool_goToPlayer_clicked(){
//Just use the files from the current selection
LFileInfoList list;
for(int i=0; i<CLIST.length(); i++){
- if(CLIST[i].isAVFile() && sel.contains(CLIST[i].fileName()) ){
+ if(CLIST[i].isAVFile() && sel.contains(CLIST[i].absoluteFilePath()) ){
list << CLIST[i]; //add to the list
}
}
@@ -665,7 +674,6 @@ void DirWidget::on_actionClose_Browser_triggered(){
void DirWidget::fileCheckSums(){
QStringList files = currentSelection();
if(files.isEmpty()){ return; }
- for(int i=0; i<files.length(); i++){ files[i] = CDIR+"/"+files[i]; } //use absolute paths
qDebug() << "Run Checksums:" << files;
QStringList info = LOS::Checksums(files);
qDebug() << " - Info:" << info;
@@ -690,7 +698,7 @@ void DirWidget::fileProperties(){
return;
}
for(int i=0; i<sel.length(); i++){
- QProcess::startDetached("lumina-fileinfo \""+CDIR+"/"+sel[i]+"\""); //use absolute paths
+ QProcess::startDetached("lumina-fileinfo \""+sel[i]+"\""); //use absolute paths
}
}
diff --git a/lumina-fm/widgets/DirWidget.h b/lumina-fm/widgets/DirWidget.h
index c5dab371..3e653ab9 100644
--- a/lumina-fm/widgets/DirWidget.h
+++ b/lumina-fm/widgets/DirWidget.h
@@ -18,6 +18,7 @@
#include "../DirData.h"
+#include "DDListWidgets.h"
#define ZSNAPDIR QString("/.zfs/snapshot/")
@@ -76,6 +77,10 @@ private:
QToolBar *toolbar;
QLineEdit *line_dir;
QStringList history;
+ //The drag and drop brower widgets
+ DDListWidget *listWidget;
+ DDTreeWidget *treeWidget;
+
//Keyboard Shortcuts
QShortcut *copyFilesShort, *cutFilesShort, *pasteFilesShort, *deleteFilesShort, *refreshShort;
//Watcher to determine when the dir changes
@@ -139,7 +144,7 @@ signals:
//System Interactions
void CutFiles(QStringList); //file selection
void CopyFiles(QStringList); //file selection
- void PasteFiles(QString); //current dir
+ void PasteFiles(QString, QStringList); //current dir
void FavoriteFiles(QStringList); //file selection
void RenameFiles(QStringList); //file selection
void RemoveFiles(QStringList); //file selection
diff --git a/lumina-fm/widgets/DirWidget.ui b/lumina-fm/widgets/DirWidget.ui
index 8c26e261..68eb3274 100644
--- a/lumina-fm/widgets/DirWidget.ui
+++ b/lumina-fm/widgets/DirWidget.ui
@@ -42,6 +42,9 @@
<property name="text">
<string notr="true">Status</string>
</property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item>
@@ -111,7 +114,7 @@
</layout>
</item>
<item row="2" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QVBoxLayout" name="browser_layout">
<property name="spacing">
<number>1</number>
</property>
@@ -176,64 +179,6 @@
</layout>
</widget>
</item>
- <item>
- <widget class="QTreeWidget" name="treeWidget">
- <property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
- </property>
- <property name="dragDropMode">
- <enum>QAbstractItemView::DragDrop</enum>
- </property>
- <property name="defaultDropAction">
- <enum>Qt::MoveAction</enum>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <property name="indentation">
- <number>0</number>
- </property>
- <property name="sortingEnabled">
- <bool>true</bool>
- </property>
- <property name="allColumnsShowFocus">
- <bool>true</bool>
- </property>
- <attribute name="headerMinimumSectionSize">
- <number>30</number>
- </attribute>
- <column>
- <property name="text">
- <string notr="true">1</string>
- </property>
- </column>
- </widget>
- </item>
- <item>
- <widget class="QListWidget" name="listWidget">
- <property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
- </property>
- <property name="dragDropMode">
- <enum>QAbstractItemView::DragDrop</enum>
- </property>
- <property name="defaultDropAction">
- <enum>Qt::MoveAction</enum>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectItems</enum>
- </property>
- <property name="flow">
- <enum>QListView::TopToBottom</enum>
- </property>
- <property name="isWrapping" stdset="0">
- <bool>true</bool>
- </property>
- </widget>
- </item>
</layout>
</item>
<item row="2" column="0">
bgstack15