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