From cf0216e02aaedd0580b1eff1d2741d9450d933d8 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Tue, 10 Oct 2023 23:14:31 +0200 Subject: [PATCH] bugs resolution --- downloadfile.cpp | 3 +-- mainwindow.cpp | 35 ++++++++++++++++++++++++++++------- mainwindow.h | 3 +++ version.h | 2 +- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/downloadfile.cpp b/downloadfile.cpp index f38b08a..f0b84ad 100644 --- a/downloadfile.cpp +++ b/downloadfile.cpp @@ -61,13 +61,12 @@ void MainWindow::download() param << "-aXP"; param << this->downloading.server + "::" + this->downloading.service + "/" + this->downloading.path << this->downloading.savePath + "/"; - + this->downloading.process->start(cmd, param); connect(this->downloading.process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(downloadFinished(int, QProcess::ExitStatus))); //connect(this->downloading.process, SIGNAL(errorOccurred(QProcess::ProcessError error)), this, SLOT(downloadProcessError(QProcess::ProcessError error))); //connect(this->downloading.process, SIGNAL(readyReadStandardError()), this, SLOT(downloadProcessStderr())); connect(this->downloading.process, SIGNAL(readyReadStandardOutput()), this, SLOT(readRsyncOutput())); - this->downloading.process->start(cmd, param); } void MainWindow::readRsyncOutput() diff --git a/mainwindow.cpp b/mainwindow.cpp index 92fffba..cdde908 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -311,7 +311,13 @@ void MainWindow::populateList(int item) int port; int i; - server = ui->khistorycombobox->itemText(item); + if (item == -1) + { + server = ui->khistorycombobox->currentText(); + }else + { + server = ui->khistorycombobox->itemText(item); + } port = ui->portEdit->text().toUInt(); if ((server != this->connexion.server) or (port != this->connexion.port)) { @@ -493,7 +499,6 @@ bool MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt bool readOk = false; bool passwdOk = false; int nChild = 0; - bool r; static uint looping; QStringList dirs; @@ -541,7 +546,7 @@ bool MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt if (line.contains("auth failed")) { myProcess->readAllStandardOutput(); - r = getUserPassword(&this->connexion); + getUserPassword(&this->connexion); if (looping <= 1) { this->rescan = true; @@ -882,6 +887,12 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD QMessageBox::StandardButton reply; int sizeFromRsync; + if (treeviewClicked == true) + { + return; + } + + treeviewClicked = true; itemR = item; this->rescan = true; @@ -906,7 +917,7 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD // saving path do not exists, asking for it if(!on_DefaultSaveFolder_triggered()) { - cout << "no directory selectioned, ignoring download request"; + cout << "no directory selectioned, ignoring download request" << endl; return; } }else @@ -985,11 +996,14 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD }else { //Item is a Directory - while (this->rescan) + if (item->isExpanded() == false) { - scanDir(this->connexion.server, this->connexion.port, item, this->connexion.service + "/" + path +"/"); - item->setExpanded(true); + while (this->rescan) + { + scanDir(this->connexion.server, this->connexion.port, item, this->connexion.service + "/" + path +"/"); + item->setExpanded(true); + } } } @@ -997,6 +1011,7 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD { saveDownloadList(); } + treeviewClicked = false; } // Launch the thread which download the file @@ -1414,3 +1429,9 @@ void MainWindow::on_actionHiddenService_triggered() } } + +void MainWindow::on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column) +{ + cout << "double-clicked" << endl; +} + diff --git a/mainwindow.h b/mainwindow.h index 9d460d0..e918107 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -119,6 +119,7 @@ class MainWindow : public QMainWindow QString icon = "/usr/share/icons/RsyncUI.png"; bool rescan = false; bool stopDlAsked; + bool treeviewClicked; QList UnitText { @@ -217,6 +218,8 @@ class MainWindow : public QMainWindow void on_actionHiddenService_triggered(); + void on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column); + signals: void stopDownloading(QProcess *); void progressSignal(int); diff --git a/version.h b/version.h index c4a469f..0db8109 100644 --- a/version.h +++ b/version.h @@ -3,6 +3,6 @@ #include -QString version = "2.11.5"; +QString version = "2.11.8"; #endif // VERSION_H