added access to gidden services

This commit is contained in:
Daniel Tartavel 2023-03-02 17:06:15 +01:00
parent 6bfbfe1c78
commit 04b46b1b86
6 changed files with 109 additions and 48 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.14.2, 2023-03-01T13:05:08. -->
<!-- Written by QtCreator 4.14.2, 2023-03-02T17:04:47. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -165,48 +165,55 @@
<translation>Barre d&apos;outils</translation>
</message>
<message>
<location filename="mainwindow.ui" line="448"/>
<location filename="mainwindow.ui" line="449"/>
<source>Download</source>
<translation>Télécharger</translation>
</message>
<message>
<location filename="mainwindow.ui" line="451"/>
<location filename="mainwindow.ui" line="452"/>
<source>Click on menu button to download the entire folder</source>
<translation>Cliquer sur le bouton droit de la souris pour télécharger le dossier entier</translation>
</message>
<message>
<location filename="mainwindow.ui" line="460"/>
<location filename="mainwindow.ui" line="461"/>
<source>Exit</source>
<translation>Quitter</translation>
</message>
<message>
<location filename="mainwindow.ui" line="463"/>
<location filename="mainwindow.ui" line="464"/>
<source>Terminate the program</source>
<translation>Terminer le programme</translation>
</message>
<message>
<location filename="mainwindow.ui" line="466"/>
<location filename="mainwindow.ui" line="467"/>
<source>Ctrl+Q</source>
<translation>Ctrl+Q</translation>
</message>
<message>
<location filename="mainwindow.ui" line="413"/>
<location filename="mainwindow.ui" line="416"/>
<location filename="mainwindow.ui" line="475"/>
<source>hidden service</source>
<translation>entre
Service caché</translation>
</message>
<message>
<location filename="mainwindow.ui" line="414"/>
<location filename="mainwindow.ui" line="417"/>
<source>Change save folder</source>
<translation>Changer le dossier de destination</translation>
</message>
<message>
<location filename="mainwindow.ui" line="425"/>
<location filename="mainwindow.ui" line="426"/>
<source>About</source>
<translation>À propos</translation>
</message>
<message>
<location filename="mainwindow.ui" line="434"/>
<location filename="mainwindow.ui" line="435"/>
<source>About Qt</source>
<translation>À propos de Qt</translation>
</message>
<message>
<location filename="mainwindow.ui" line="443"/>
<location filename="mainwindow.ui" line="444"/>
<source>Settings</source>
<translation>Paramètres</translation>
</message>
@ -317,69 +324,80 @@ Voulez-vous vraiment sortir ?</translation>
<translation>Le programme continue dans la boîte à miniatures. Pour quitter le programme cliquez sur l&apos;icône &lt;b&gt;Quitter&lt;/b&gt; ou dans les menu contextuel.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="492"/>
<location filename="mainwindow.cpp" line="501"/>
<source>The processus does&apos;nt respond: </source>
<translation>Le processus ne répond pas: </translation>
</message>
<message>
<location filename="mainwindow.cpp" line="578"/>
<location filename="mainwindow.cpp" line="587"/>
<source>server does not exists</source>
<translation>Le serveur n&apos;existe pas</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="606"/>
<location filename="mainwindow.cpp" line="626"/>
<location filename="mainwindow.cpp" line="615"/>
<location filename="mainwindow.cpp" line="635"/>
<source>Dir</source>
<translation>dossier</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="610"/>
<location filename="mainwindow.cpp" line="619"/>
<location filename="mainwindow.cpp" line="639"/>
<location filename="mainwindow.cpp" line="740"/>
<source>File</source>
<translation>Doc</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="751"/>
<location filename="mainwindow.cpp" line="768"/>
<source>File is partially downloaded. Do you want to resume download ? if no, the file will be deleted from destination directory</source>
<translation>Le document est déjà partiellement téléchargé. Voulez vous continuer le téléchargemnt ? Si non, il sera supprimer du dossier de destination</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="768"/>
<location filename="mainwindow.cpp" line="785"/>
<source>File is already downloaded. Do you want to reload it ? The old file will be deleted</source>
<translation>Le document est déjà téléchargé. Voulez-vous le télécharger à nouveau ? L&apos;ancien fichier sera effacé</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="805"/>
<location filename="mainwindow.cpp" line="822"/>
<source>File is already downloading</source>
<translation>Le document est déjà en téléchargement</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="830"/>
<location filename="mainwindow.cpp" line="847"/>
<source>Starting downloading
</source>
<translation>Démarrage du téléchargement
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="845"/>
<location filename="mainwindow.cpp" line="862"/>
<source>finished</source>
<translation>Terminé</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="853"/>
<location filename="mainwindow.cpp" line="870"/>
<source>Rsync process crashed</source>
<translation>Le processus rsync à planté</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="865"/>
<location filename="mainwindow.cpp" line="882"/>
<source>stopped by user</source>
<translation>stoppé par l&apos;utilisateur</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="871"/>
<location filename="mainwindow.cpp" line="888"/>
<source>Download </source>
<translation>Téléchargement </translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1237"/>
<source>RsyncUI Request</source>
<translation>Requête RsyncUI</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1238"/>
<source>Hidden service name</source>
<translation>Nom du servcice caché</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="56"/>
<source>Version</source>
@ -411,22 +429,22 @@ Voulez-vous vraiment sortir ?</translation>
<translation>Code source</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1036"/>
<location filename="mainwindow.cpp" line="1053"/>
<source>Since the save path is linked to service, you need to select a service before you can select a folder</source>
<translation>Vous devez sélectionnez un service pour pouvoir sélectionnez un dossier par défaut</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1041"/>
<location filename="mainwindow.cpp" line="1058"/>
<source>Choose folder where to save file</source>
<translation>Choisissez un dossier enregistrer le document</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="932"/>
<location filename="mainwindow.cpp" line="949"/>
<source>Do you want to stop downloading and delete this file from download queue ?</source>
<translation>Voulez-vous arrêter le téléchargement et enlever ce fichier de la file de téléchargement ?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="946"/>
<location filename="mainwindow.cpp" line="963"/>
<source>Do you want to delete this file from download queue ?</source>
<translation>Voulez-vous enlever ce fichier de la file de téléchargement ?</translation>
</message>

View File

@ -290,7 +290,7 @@ void MainWindow::populateTree(QTreeWidgetItem * parent)
if (validateServer(this->connexion.server))
{
// server is validated, scanning directory
path = ui->listWidget->currentItem()->text().section('\n', 0, 0) + "/";
path = this->connexion.service + "/";
scanDir(this->connexion.server, this->connexion.port, parent, path);
}
// Restoring cursor
@ -302,7 +302,9 @@ void MainWindow::populateTree(QTreeWidgetItem * parent)
void MainWindow::populateList()
{
QString server;
QStringList hidden;
int port;
int i;
server = ui->khistorycombobox->currentText();
port = ui->portEdit->text().toUInt();
@ -350,7 +352,14 @@ void MainWindow::populateList()
}
}
this->settings.endGroup();
this->settings.beginGroup("Hidden/");
hidden = this->settings.allKeys();
for (i = 0; i < hidden.size(); i++)
{
ui->listWidget->addItem(this->settings.value(hidden.at(i)).toString() + "\n\t");
}
QGuiApplication::restoreOverrideCursor(); //setting cursor to default
this->settings.endGroup();
}
}
@ -637,15 +646,21 @@ QTreeWidgetItem * MainWindow::addTreeChild(QTreeWidgetItem *parent, QString name
return treeItem;
}
// Slot acivated when a service in the list is clicked
// Slot activated when a service in the list is clicked
void MainWindow::on_listWidget_clicked()
{
this->connexion.service = ui->listWidget->currentItem()->text().section("\n", 0 ,0);
preparePopulateTree();
}
void MainWindow::preparePopulateTree()
{
QString str;
QStringList logins;
this->rescan = true;
this->connexion.user = nullptr;
this->connexion.password = nullptr; this->connexion.service = ui->listWidget->currentItem()->text().section("\n", 0 ,0);
this->connexion.password = nullptr;
str = "Folder/" + this->connexion.server + "/" + this->connexion.service;
// if service exists in settings for this server
if (this->settings.contains(str))
@ -714,6 +729,16 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
path = item->text(0);
sizeFromRsync = item->text(2).remove(',').toUInt();
while(itemR->parent() != NULL)
{
itemR = itemR->parent();
// concatening parent to path
path.prepend(itemR->text(0) + "/");
};
cout << item->text(1).toStdString() <<endl;
if (item->text(1) == tr("File") or downloadDir == true)
{
// exists saving path in settings ?
str = "Folder/" + this->connexion.server + "/" + this->connexion.service;
if(!this->settings.contains(str))
@ -729,21 +754,12 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
this->downloading.savePath = this->settings.value(str).toString();
}
while(itemR->parent() != NULL)
{
itemR = itemR->parent();
// concatening parent to path
path.prepend(itemR->text(0) + "/");
};
QFileInfo info(this->downloading.savePath + "/" + path);
cout << item->text(1).toStdString() <<endl;
if (item->text(1) == tr("File") or downloadDir == true)
{
// Item is a file
// searching if file exists in savepath
if (QFile::exists(this->downloading.savePath + "/" + path))
{
QFileInfo info(this->downloading.savePath + "/" + path);
if (info.size() < sizeFromRsync)
{
reply = QMessageBox::question(
@ -1213,3 +1229,18 @@ void MainWindow::setDlSpeed(QString speed)
speed.squeeze();
}
void MainWindow::on_actionHiddenService_triggered()
{
QInputDialog hiddenFolderDialog;
bool ok;
QString text = QInputDialog::getText(this, tr("RsyncUI Request"),
tr("Hidden service name"), QLineEdit::Normal,
"test", &ok);
if (ok && !text.isEmpty())
{
this->connexion.service = text;
this->settings.setValue("Hidden/" + this->connexion.server, text);
preparePopulateTree();
}
}

View File

@ -163,6 +163,7 @@ class MainWindow : public QMainWindow
void showWindow();
void init();
bool getUserPassword(bool);
void preparePopulateTree();
private slots:
@ -214,6 +215,8 @@ class MainWindow : public QMainWindow
void on_loginBox_accepted();
void on_actionHiddenService_triggered();
signals:
void stopDownloading(QProcess *);
void progressSignal(int);

View File

@ -399,6 +399,7 @@
<bool>false</bool>
</attribute>
<addaction name="DefaultSaveFolder"/>
<addaction name="actionHiddenService"/>
<addaction name="action_Settings"/>
<addaction name="actionAbout"/>
<addaction name="actionAbout_Qt"/>
@ -466,6 +467,14 @@
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionHiddenService">
<property name="icon">
<iconset theme="folder-open"/>
</property>
<property name="text">
<string>hidden service</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>