diff options
-rw-r--r-- | lumina-fm/FODialog.cpp | 20 | ||||
-rw-r--r-- | lumina-fm/FODialog.h | 8 | ||||
-rw-r--r-- | lumina-fm/MainUI.cpp | 4 | ||||
-rw-r--r-- | lumina-fm/widgets/DDListWidgets.h | 16 |
4 files changed, 36 insertions, 12 deletions
diff --git a/lumina-fm/FODialog.cpp b/lumina-fm/FODialog.cpp index b039166a..4f4ca838 100644 --- a/lumina-fm/FODialog.cpp +++ b/lumina-fm/FODialog.cpp @@ -46,17 +46,19 @@ void FODialog::setOverwrite(bool ovw){ } //Public "start" functions -void FODialog::RemoveFiles(QStringList paths){ +bool FODialog::RemoveFiles(QStringList paths){ Worker->ofiles = paths; Worker->isRM = true; if(CheckOverwrite()){ QTimer::singleShot(10,Worker, SLOT(slotStartOperations())); + return true; }else{ this->close(); + return false; } } -void FODialog::CopyFiles(QStringList oldPaths, QStringList newPaths){ +bool FODialog::CopyFiles(QStringList oldPaths, QStringList newPaths){ //same permissions as old files if(oldPaths.length() == newPaths.length()){ Worker->ofiles = oldPaths; @@ -65,12 +67,14 @@ void FODialog::CopyFiles(QStringList oldPaths, QStringList newPaths){ Worker->isCP=true; if(CheckOverwrite()){ QTimer::singleShot(10,Worker, SLOT(slotStartOperations())); + return true; }else{ this->close(); + return false; } } -void FODialog::RestoreFiles(QStringList oldPaths, QStringList newPaths){ +bool FODialog::RestoreFiles(QStringList oldPaths, QStringList newPaths){ //user/group rw permissions if(oldPaths.length() == newPaths.length()){ Worker->ofiles = oldPaths; @@ -79,22 +83,26 @@ void FODialog::RestoreFiles(QStringList oldPaths, QStringList newPaths){ Worker->isRESTORE = true; if(CheckOverwrite()){ QTimer::singleShot(10,Worker, SLOT(slotStartOperations())); + return true; }else{ this->close(); + return false; } } -void FODialog::MoveFiles(QStringList oldPaths, QStringList newPaths){ +bool FODialog::MoveFiles(QStringList oldPaths, QStringList newPaths){ //no change in permissions if(oldPaths.length() == newPaths.length()){ - Worker->ofiles = oldPaths; \ + Worker->ofiles = oldPaths; Worker->nfiles = newPaths; } Worker->isMV=true; if(CheckOverwrite()){ QTimer::singleShot(10,Worker, SLOT(slotStartOperations())); + return true; }else{ this->close(); + return false; } } @@ -111,7 +119,7 @@ bool FODialog::CheckOverwrite(){ QMessageBox::StandardButton ans = QMessageBox::question(this, tr("Overwrite Files?"), tr("Do you want to overwrite the existing files?")+"\n"+tr("Note: It will just add a number to the filename otherwise.")+"\n\n"+existing.join(", "), QMessageBox::YesToAll | QMessageBox::NoToAll | QMessageBox::Cancel, QMessageBox::NoToAll); if(ans==QMessageBox::NoToAll){ Worker->overwrite = 0; } //don't overwrite else if(ans==QMessageBox::YesToAll){ Worker->overwrite = 1; } //overwrite - else{ qDebug() << " - Cancelled"; ok = false; } //cancel operations + else{ qDebug() << " - Cancelled"; Worker->overwrite = -1; ok = false; } //cancel operations if(DEBUG){ qDebug() << " - Overwrite:" << Worker->overwrite; } } } diff --git a/lumina-fm/FODialog.h b/lumina-fm/FODialog.h index d80d4a39..ef3ff57d 100644 --- a/lumina-fm/FODialog.h +++ b/lumina-fm/FODialog.h @@ -66,10 +66,10 @@ public: bool noerrors; void setOverwrite(bool); - void RemoveFiles(QStringList paths); - void CopyFiles(QStringList oldPaths, QStringList newPaths); //same permissions as old files - void RestoreFiles(QStringList oldPaths, QStringList newPaths); //user/group rw permissions - void MoveFiles(QStringList oldPaths, QStringList newPaths); //no change in permissions + bool RemoveFiles(QStringList paths); + bool CopyFiles(QStringList oldPaths, QStringList newPaths); //same permissions as old files + bool RestoreFiles(QStringList oldPaths, QStringList newPaths); //user/group rw permissions + bool MoveFiles(QStringList oldPaths, QStringList newPaths); //no change in permissions private: Ui::FODialog *ui; diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 49712b74..36c756d9 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -694,7 +694,7 @@ void MainUI::PasteFiles(QString dir, QStringList raw){ if(!copy.isEmpty()){ qDebug() << "Paste Copy:" << copy << "->" << newcopy; FODialog dlg(this); - dlg.CopyFiles(copy, newcopy); + if( !dlg.CopyFiles(copy, newcopy) ){ return; } //cancelled dlg.show(); dlg.exec(); errs = errs || !dlg.noerrors; @@ -702,7 +702,7 @@ void MainUI::PasteFiles(QString dir, QStringList raw){ if(!cut.isEmpty()){ qDebug() << "Paste Cut:" << cut << "->" << newcut; FODialog dlg(this); - dlg.MoveFiles(cut, newcut); + if(!dlg.MoveFiles(cut, newcut) ){ return; } //cancelled dlg.show(); dlg.exec(); errs = errs || !dlg.noerrors; diff --git a/lumina-fm/widgets/DDListWidgets.h b/lumina-fm/widgets/DDListWidgets.h index d47c7ee4..2d885192 100644 --- a/lumina-fm/widgets/DDListWidgets.h +++ b/lumina-fm/widgets/DDListWidgets.h @@ -111,6 +111,14 @@ protected: if(ev->button() != Qt::RightButton && ev->button() != Qt::LeftButton){ ev->ignore(); } else{ QListWidget::mouseReleaseEvent(ev); } //pass it along to the widget } + void mousePressEvent(QMouseEvent *ev){ + if(ev->button() != Qt::RightButton && ev->button() != Qt::LeftButton){ ev->ignore(); } + else{ QListWidget::mousePressEvent(ev); } //pass it along to the widget + } + /*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 + }*/ }; //================ @@ -199,5 +207,13 @@ protected: if(ev->button() != Qt::RightButton && ev->button() != Qt::LeftButton){ ev->ignore(); } else{ QTreeWidget::mouseReleaseEvent(ev); } //pass it along to the widget } + void mousePressEvent(QMouseEvent *ev){ + if(ev->button() != Qt::RightButton && ev->button() != Qt::LeftButton){ ev->ignore(); } + else{ QTreeWidget::mousePressEvent(ev); } //pass it along to the widget + } + /*void mouseMoveEvent(QMouseEvent *ev){ + if(ev->button() != Qt::RightButton && ev->button() != Qt::LeftButton){ ev->ignore(); } + else{ QTreeWidget::mouseMoveEvent(ev); } //pass it along to the widget + }*/ }; #endif
\ No newline at end of file |