debugging

This commit is contained in:
2023-03-11 13:30:17 +01:00
parent 1739b0adf3
commit d82c8c942d
3 changed files with 32 additions and 17 deletions
+27 -13
View File
@@ -288,7 +288,10 @@ void MainWindow::populateTree()
{
// server is validated, scanning directory
path = this->connexion.service + "/";
scanDir(this->connexion.server, this->connexion.port, nullptr, path);
while (this->rescan)
{
scanDir(this->connexion.server, this->connexion.port, nullptr, path);
}
}
// Restoring cursor
QGuiApplication::restoreOverrideCursor();
@@ -352,16 +355,19 @@ void MainWindow::populateList(int item)
this->settings.endGroup();
this->settings.beginGroup("Hidden/" + server);
hidden = this->settings.allKeys();
this->settings.endGroup();
for (i = 0; i < hidden.size(); i++)
if (hidden.count() > 0)
{
service = hidden.at(i);
//TODO detect if service is already present
if (testServicePresence(service, false))
for (i = 0; i < hidden.size(); i++)
{
ui->listWidget->addItem(service + "\n\t");
service = hidden[i];
//TODO detect if service is already present
if (testServicePresence(service, false))
{
ui->listWidget->addItem(service + "\n\t");
}
}
}
this->settings.endGroup();
QGuiApplication::restoreOverrideCursor(); //setting cursor to default
}
}
@@ -559,10 +565,11 @@ bool MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt
addTreeItem(filename, size, fullsize, fileType, date, isDir, parent);
if (passwdOk == false and !this->connexion.password.isEmpty())
{
this->settings.setValue("Passwords/" + this->connexion.server + "/" + this->connexion.service + "/", this->connexion.user);
this->settings.setValue("Passwords/" + this->connexion.server + "/" + this->connexion.service + "/" + this->connexion.user, true);
setPassword(this->connexion.user, this->connexion.password);
this->settings.sync();
}
this->rescan = false;
}
}
flag = false;
@@ -740,7 +747,7 @@ void MainWindow::preparePopulateTree()
this->downloading.savePath = this->settings.value(str).toString();
}
getUserPassword(&this->connexion);
//getUserPassword(&this->connexion);
populateTree();
}
@@ -755,6 +762,7 @@ bool MainWindow::getUserPassword(Connexion * object)
QString password;
QString server;
QString service;
int c;
bool returnValue = false;
bool ok = false;
@@ -767,7 +775,8 @@ bool MainWindow::getUserPassword(Connexion * object)
this->settings.beginGroup("Passwords/" + server + "/" + service);
logins = this->settings.allKeys();
if (logins.count() != 1)
c = logins.count();
if ( c != 1)
{
//choose login in case of multiples logins
login = QInputDialog::getItem(this,
@@ -923,9 +932,13 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
}else
{
//Item is a Directory
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);
}
}
if (config.autosaveCheckbox->checkState() == Qt::Checked)
{
saveDownloadList();
@@ -1336,7 +1349,8 @@ void MainWindow::on_actionHiddenService_triggered()
if (ok && !text.isEmpty())
{
this->connexion.service = text;
this->settings.setValue("Hidden/" + this->connexion.server + "/" + text, true);
this->settings.setValue("Hidden/" + this->connexion.server + '/' + text, true);
ui->listWidget->addItem(text + "\n\t");
preparePopulateTree();
}
}