From 04b46b1b861f2f34c6a30606ae3f3acd17271ca4 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Thu, 2 Mar 2023 17:06:15 +0100 Subject: [PATCH] added access to gidden services --- RsyncUI.pro.user | 2 +- RsyncUI_fr_FR.ts | 72 ++++++++++++------- languages/fr_FR/LC_MESSAGES/RsyncUI_fr_FR.qm | Bin 19610 -> 20445 bytes mainwindow.cpp | 71 ++++++++++++------ mainwindow.h | 3 + mainwindow.ui | 9 +++ 6 files changed, 109 insertions(+), 48 deletions(-) diff --git a/RsyncUI.pro.user b/RsyncUI.pro.user index 0b6d4e2..0b24d62 100644 --- a/RsyncUI.pro.user +++ b/RsyncUI.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/RsyncUI_fr_FR.ts b/RsyncUI_fr_FR.ts index bd9db74..b73e946 100644 --- a/RsyncUI_fr_FR.ts +++ b/RsyncUI_fr_FR.ts @@ -165,48 +165,55 @@ Barre d'outils - + Download Télécharger - + Click on menu button to download the entire folder Cliquer sur le bouton droit de la souris pour télécharger le dossier entier - + Exit Quitter - + Terminate the program Terminer le programme - + Ctrl+Q Ctrl+Q - - + + hidden service + entre + +Service caché + + + + Change save folder Changer le dossier de destination - + About À propos - + About Qt À propos de Qt - + Settings Paramètres @@ -317,69 +324,80 @@ Voulez-vous vraiment sortir ? Le programme continue dans la boîte à miniatures. Pour quitter le programme cliquez sur l'icône <b>Quitter</b> ou dans les menu contextuel. - + The processus does'nt respond: Le processus ne répond pas: - + server does not exists Le serveur n'existe pas - - + + Dir dossier - + + File Doc - + File is partially downloaded. Do you want to resume download ? if no, the file will be deleted from destination directory 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 - + File is already downloaded. Do you want to reload it ? The old file will be deleted Le document est déjà téléchargé. Voulez-vous le télécharger à nouveau ? L'ancien fichier sera effacé - + File is already downloading Le document est déjà en téléchargement - + Starting downloading Démarrage du téléchargement - + finished Terminé - + Rsync process crashed Le processus rsync à planté - + stopped by user stoppé par l'utilisateur - + Download Téléchargement + + + RsyncUI Request + Requête RsyncUI + + + + Hidden service name + Nom du servcice caché + Version @@ -411,22 +429,22 @@ Voulez-vous vraiment sortir ? Code source - + Since the save path is linked to service, you need to select a service before you can select a folder Vous devez sélectionnez un service pour pouvoir sélectionnez un dossier par défaut - + Choose folder where to save file Choisissez un dossier où enregistrer le document - + Do you want to stop downloading and delete this file from download queue ? Voulez-vous arrêter le téléchargement et enlever ce fichier de la file de téléchargement ? - + Do you want to delete this file from download queue ? Voulez-vous enlever ce fichier de la file de téléchargement ? diff --git a/languages/fr_FR/LC_MESSAGES/RsyncUI_fr_FR.qm b/languages/fr_FR/LC_MESSAGES/RsyncUI_fr_FR.qm index 406a6730c0f3077fd7eda7118617f14da10a557a..e9af2ed3d480026adb407762ae03c32493082576 100644 GIT binary patch delta 1478 zcmaJXc;VVmwOM~YjW=8o(rLF zoMQC{i$NPj+GLoe>%-;}otX@cY#D^8jX$E*AC+6QtB&SIIb%KdN^F&~v$N-YpZ9%! zAJ6l?eMs{|ujch6Rl6KuPXUP&6n_U6?g6-Y6u+QY03@xZ*b1Z`2bQJ-{0(3;1H@H= zRmNza0CtoG;`Ly!(s@D!IPd#ZR|T%=4T^2x-r)do7~Dk($P6R4`BlQV!0uQJ6@~rC zZYKa;8j89v0s0J-I_?3sDQrFH0dfOq$e#ipIitC?PX_XCGdTkRApHzeeXbfPKEhn7 zdyneJnX#l465?e3y!0gzbZS$DwPflW?RVG9fklsMzgOxg|0}yrM|o}+`~1-s6)^R( z?I&vh^9Srlof>kM#h%zfLJ|(J0|pB)?w}2ZI{iyERX*yq=C$LLesFOWHet|^7wg~c1G%6eyUTP^MffE!xG`fSrhw9J2(Be5^ zGF%R32nkU?hZ0j}~JUpqu_lh)58Z{M-YI#fWk>@w>g&(ighX&+&?_L;OUPF;?TkP$)<681wx6Z|tf z5k7b*8#(o%mVQ@cEkyM5^cy$IAt@;C_1F1iU1VPtSrz(Rl+kD@kuwK$eUwIo8etF- zAZ&#`X%^jbA3fkwlo$O$&jShUD4A2CA*x7}UG>rf>l3i0bVkR+WC&a55|E4vlHY(v z{Dx3hWm%$Vtx)#K?q^EGpw!SPDWU)J_IZV6w&EoyC*FE8?x9*SVw?uh1UEI=9c_r4 z8sdf*6SED8EB1Ljk}N7xu*v6^qOQ7Pjr04ulT^n1KP54C=c^JcGQh6Df(C zP1Q3y11H2;%9I^mNel%2Zb?xZ7186DluS89)|7x>_Bh49moqwIHe?aj aKQG7t1GdkYdAJpe_g_|`F078%Y<~kXwP3se delta 810 zcmWksX-HI26#nMTyKml`?YWJH%M5BFmKNr?Bq^rZ(881!LQ;m}o*FtJmf$04A#w>S z%SO`{E3gQhKq_%Vv8F{G@kd4lLC}xMumlstI{y0JyZ3y{Irn_-QQhuTT@6#X9{@i9 z1Q!ziCcFqRKf`vh=+1AJ$}PxFB39QYYJ4|Ic-Kc@P6u=?wS zePDMPV0MCymH<(E5ty6~>>k6`7UD4{Y#kF&pt*zn$!kEsX&k;)3?#Two3;XMic>9~ zsR0s~xq=r3Kz1MZq3i)5NWbPsaXU!CSZvsBQ>r4GMK=^JugVGZ3DoDSBxH(ma~-B*LUY%}}M6It|v$ zKBxN#QRKHY0isDv%cPO&C&ij?^8g--OI|y$%Ob8HB)vVwQsisGjBF`RqJU<%WQ`|7 zDNm{@Tn02AskwsqQGL?15>`zkb7~tM&D4=Y7u23W9gOOddh+R9t1A_0C#<77?<@%> z&*?+D3jpconnexion.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,36 +729,37 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD path = item->text(0); sizeFromRsync = item->text(2).remove(',').toUInt(); - // exists saving path in settings ? - str = "Folder/" + this->connexion.server + "/" + this->connexion.service; - if(!this->settings.contains(str)) - { - // saving path do not exists, asking for it - if(!on_DefaultSaveFolder_triggered()) - { - cout << "no directory selectioned, ignoring download request"; - return; - } - }else - { - 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() <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)) + { + // saving path do not exists, asking for it + if(!on_DefaultSaveFolder_triggered()) + { + cout << "no directory selectioned, ignoring download request"; + return; + } + }else + { + this->downloading.savePath = this->settings.value(str).toString(); + } + // 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(); + } +} diff --git a/mainwindow.h b/mainwindow.h index a86c086..eda2f3e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -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); diff --git a/mainwindow.ui b/mainwindow.ui index cdfd5a2..dbeed37 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -399,6 +399,7 @@ false + @@ -466,6 +467,14 @@ Ctrl+Q + + + + + + hidden service + +