- migrate to qt6/plasma6\n- bugs corrected

This commit is contained in:
DTux committed 2026-11-26 20:17:28 +01:00
1 parent 1a7376bfbe
commit d76d9407a6
6 files changed
+65 -41

No files matched your search

+6 -4
View File
@@ -18,15 +18,15 @@ SOURCES += \
downloadfile.cpp \
main.cpp \
mainwindow.cpp \
password.cpp \
tools.cpp
password.cpp \
tools.cpp
HEADERS += \
version.h\
downloadfile.h \
mainwindow.h \
password.h \
tools.h
password.h \
tools.h
FORMS += \
about.ui \
@@ -37,6 +37,8 @@ TRANSLATIONS += \
RsyncUI_fr_FR.ts
INCLUDEPATH += \
/usr/include/KF6/KItemViews \
/usr/include/KF6/KCompletion \
/usr/include/KF6 \
/usr/include/qt6keychain \
+1 -1
View File
@@ -2,7 +2,7 @@
Name: rsyncui
Summary: Client for rsync server
Version: 2.13.3
Version: 2.14
Release: %mkrel 1
License: GPLv3
Group: Networking/Remote access
+5 -3
View File
@@ -58,13 +58,15 @@ void MainWindow::download()
}
// Populating array with command and parameters for rsync
cmd = "rsync";
param << "--contimeout=40";
if (this->connexion.bandwidthLimit != 0)
{
info(DEBUGMACRO, "Adding download speed limit");
param << "--bwlimit=" + QString::number(this->connexion.bandwidthLimit) + bwUnitChar[this->connexion.bandwidthLimitUnit];
}
ipversion = validateServer(&server);
ipversion = validateServer(&this->downloading.server);
if (downloading.ipversion == 4 || downloading.ipversion == 6)
{
@@ -74,7 +76,7 @@ void MainWindow::download()
param << "--port" << QString::number(this->downloading.port).trimmed();
param << "-aXP";
param << "[" + server + "]::" + this->downloading.service.trimmed() + "/" + preparePath(this->downloading.path) << preparePath(this->downloading.savePath) + "/";
param << "[" + server + "]::" + this->downloading.service.trimmed() + "/" + preparePath(this->downloading.path) << preparePath(this->downloading.savePath + "/");
info(DEBUGMACRO, cmd + " " + param.join(" "));
@@ -102,12 +104,12 @@ void MainWindow::readRsyncOutput()
{
list.clear();
line = QString::fromUtf8(this->downloading.process->readLine());
info(DEBUGMACRO, "downloading progress : " + line);
if (line.isEmpty())
{
break;
}else
{
info(DEBUGMACRO, "downloading progress : " + line);
pos = line.indexOf("%");
if (pos != -1)
{
+50 -30
View File
@@ -2,11 +2,13 @@
#include <QtGlobal>
//#include <QComboBox>
#include <QTextBlock>
#include "qregularexpression.h"
#include "ui_configuration.h"
#include "version.h"
#include "tools.h"
#include "password.h"
#include <kcombobox.h>
#include <qt6/QtCore/qvariant.h>
#include <signal.h>
#include <QTextStream>
#include <QHostInfo>
@@ -324,7 +326,7 @@ void MainWindow::populateTree()
if (this->connexion.ipversion != 0)
{
// server is validated, scanning directory
path = this->connexion.service + "/";
path = this->connexion.service.trimmed() + "/";
while (this->rescan)
{
scanDir(&this->connexion, nullptr, path);
@@ -383,6 +385,21 @@ void MainWindow::populateList(QString server, uint port)
ui->portEdit->setText(QString::number(port));
this->connexion.port = port;
ok = true;
//display list of services
//listServices(); // TODO clear in listServices
this->settings.endGroup();
}else
{
this->settings.beginGroup(server);
info(DEBUGMACRO, "Server configuration does not exists in settings");
// server is in history => setting port value
this->settings.setValue("port", port);
this->settings.setValue("ipversion", this->connexion.ipversion);
ui->portEdit->setText(QString::number(port));
this->connexion.port = port;
ok = true;
//display list of services
//listServices(); // TODO clear in listServices
@@ -487,7 +504,7 @@ bool MainWindow::testServerPresence(QString service, bool askPassword)
{
param << "-" + QString::number(this->connexion.ipversion);
}
param << "--contimeout=10" << "-nq" << "--port=" + QString::number(this->connexion.port) << + "[" + this->connexion.server + "]::" + preparePath(service);
param << "--contimeout=30" << "-nq" << "--port=" + QString::number(this->connexion.port) << + "[" + this->connexion.server + "]::" + service.trimmed();
myProcess = new QProcess(this);
myProcess->setProcessChannelMode(QProcess::MergedChannels);
myProcess->start(cmd, param);
@@ -559,15 +576,15 @@ void MainWindow::listServices()
return;
}
param << "--contimeout=20" << "--port=" + QString::number(this->connexion.port) << server + "::";
param << "--contimeout=40" << "--port=" + QString::number(this->connexion.port) << server + "::";
myProcess = new QProcess(this);
info(DEBUGMACRO, cmd + " " + param.join(" "));
myProcess->start(cmd, param);
// waiting for response of the server with a timeout of 10 seconds
while(myProcess->waitForReadyRead(10000))
// waiting for response of the server with a timeout of 30 seconds
while(myProcess->waitForReadyRead(30000))
{
info(DEBUGMACRO, "Reading");
while(!flag)
@@ -658,7 +675,7 @@ bool MainWindow::scanDir(Connexion * connexion, QTreeWidgetItem *parent, QString
user = "anonymous@";
env.insert("RSYNC_PASSWORD", "anonymous"); // Add an environment variable
}
param << "--contimeout=20" << "--port=" + QString::number(connexion->port) << user + "[" + server + "]::" + preparePath(path) ;
param << "--contimeout=40" << "--port=" + QString::number(connexion->port) << user + "[" + server + "]::" + path ;
info(DEBUGMACRO, cmd + " " + param.join(" "));
@@ -666,10 +683,10 @@ bool MainWindow::scanDir(Connexion * connexion, QTreeWidgetItem *parent, QString
this->rescan = true;
info(DEBUGMACRO, "Waiting server response");
// waiting for response of the server with a timeout of 10 seconds
// waiting for response of the server with a timeout of 30 seconds
do
{
readOk = myProcess->waitForReadyRead(10000);
readOk = myProcess->waitForReadyRead(30000);
if (readOk)
{
while (!flag)
@@ -777,12 +794,13 @@ uint MainWindow::validateServer(QString *server)
QStringList responseList;
QFile fileHandle("/etc/hosts");
bool result = false;
uint ipversion = 0;
int answerFound = 0;
int queryPos = 0;
QHostAddress serverAddress;
info(DEBUGMACRO, "ValidateServer() => Validating server address");
info(DEBUGMACRO, "ValidateServer() => Validating server address : " + *server );
//if (ipversion == 0) // not an Ip address, perhaps a server name
//{
@@ -795,17 +813,17 @@ uint MainWindow::validateServer(QString *server)
info(DEBUGMACRO, "Server address : " + *server);
}else
{
if (!serverAddress.setAddress(*server))
result = serverAddress.setAddress(*server);
info(DEBUGMACRO, QStringLiteral("result = serverAddress.setAddress(*server) :") + (result ? "true" : "false"));
if (result == false)
{
info(DEBUGMACRO, "Digging server name");
cmd = "dig";
param << server->trimmed() ;
if (ipversion == IPV4)
if (ipversion == QAbstractSocket::IPv4Protocol)
{
param << "A"; // IP V4 query
}else if (ipversion == IPV6)
}else if (ipversion == QAbstractSocket::IPv6Protocol)
{
param << "AAAA"; // IP V6 query
}else
@@ -843,7 +861,7 @@ uint MainWindow::validateServer(QString *server)
{
line = line.mid(answerFound, queryPos - answerFound);
info(DEBUGMACRO, "line is:\n" + line);
responseList = line.split(QRegExp("\\s+"));
responseList = line.split(QRegularExpression("\\s+"));
info(DEBUGMACRO, "ip Address is => " + responseList.at(4));
if (serverAddress.setAddress(responseList.at(4)))
{
@@ -859,13 +877,11 @@ uint MainWindow::validateServer(QString *server)
myProcess->close();
}
}
//ipversion = serverAddress.protocol();
ipversion = (serverAddress.protocol() == QAbstractSocket::IPv4Protocol ? 4 : 6);
info(DEBUGMACRO, "Returning ip version: " + QString::number(ipversion));
//ipversion = whatIpVersion(*server);
ipversion = serverAddress.protocol();
return (ipversion==IPV4?4:6);
return (ipversion);
}
@@ -1161,12 +1177,13 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
startDownloading();
// wait 1 second to process start
//sleep(1);
}
}else
{
info(DEBUGMACRO, "Downloading process exist, adding download to download list");
// Adding download to download list
}
str = path + " => " + this->connexion.server + "/" + this->connexion.service;
ui->listDownload->addItem(str);
}else
ui->listDownload->addItem(str); }else
{
warning(tr("File is already downloading" ));
}
@@ -1179,7 +1196,7 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
info(DEBUGMACRO, "Item is not expanded");
//if (this->rescan)
//{
info(DEBUGMACRO, "Re-scanning path: " + this->connexion.service + "/" + path +"/");
info(DEBUGMACRO, "Re-scanning path: " + this->connexion.service + "/'" + path +"'/");
ret = scanDir(&this->connexion, item, this->connexion.service + "/" + path +"/");
if(!ret)
{
@@ -1296,16 +1313,19 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus)
// initializing download
path = ui->listDownload->item(0)->text();
pos = path.lastIndexOf("/");
this->downloading.service = path.midRef(pos+1).toString();
this->downloading.service = path.mid(pos+1);
info(DEBUGMACRO, "service : " + this->downloading.service);
path.resize(pos);
pos = path.lastIndexOf(" => ");
this->downloading.server = path.midRef(pos+4).toString();
this->downloading.server = path.mid(pos+4).trimmed();
path.resize(pos);
info(DEBUGMACRO, "port: " + this->settings.value("connexion/Servers/" + this->downloading.server + "/port").toString());
this->downloading.port = this->settings.value("connexion/Servers/" + this->downloading.server + "/port").toInt();
info(DEBUGMACRO, "server : " + this->downloading.server + " port: " + QByteArray::number(this->downloading.port));
this->downloading.path = path;
info(DEBUGMACRO, "path : " + this->downloading.path);
//getUserPassword(true);
testServerPresence(this->downloading.service, true);
//testServerPresence(this->downloading.service, true);
// savepath exists in settings ?
str = "Folder/" + this->downloading.server + "/" + this->downloading.service;
@@ -1558,10 +1578,10 @@ void MainWindow::loadDownloadList()
path = ui->listDownload->item(0)->text();
pos = path.lastIndexOf("/");
this->downloading.service = path.midRef(pos+1).toString();
this->downloading.service = path.mid(pos+1);
path.resize(pos);
pos = path.lastIndexOf(" => ");
this->downloading.server = path.midRef(pos+4).toString();
this->downloading.server = path.mid(pos+4);
this->downloading.port = this->settings.value("connexion/Servers/" + this->downloading.server+ "/port").toInt();
path.resize(pos);
this->downloading.path = path;
+2 -2
View File
@@ -1,7 +1,7 @@
//#include "mainwindow.h"
#include "password.h"
#include <qt5keychain/keychain.h>
#include <qt5keychain/qkeychain_export.h>
#include <qt6keychain/keychain.h>
#include <qt6keychain/qkeychain_export.h>
#include <QSettings>
#include "tools.h"
+1 -1
View File
@@ -57,7 +57,7 @@ QString getFileType(QString filename)
QString preparePath(QString path)
{
return path.trimmed().replace(' ', "\ ");
return path ; //.trimmed().replace(' ', "\\ ");
}
int whatIpVersion(QString ipAddress)