From 22aba1ec9156baf52d1ab262513ad481c9352794 Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Sun, 27 Mar 2016 23:40:56 +0200 Subject: [PATCH] I've added ssl capability to download and upload (and a little change I don't quickly understand) --- mainwindow.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 31b34dd..70f88f0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -36,7 +36,7 @@ #include #include #include - +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { @@ -751,7 +751,7 @@ void MainWindow::addDB(const QString & tmp){ qDebug()<<"addDB"; if(deb)QMessageBox::information(this, trUtf8("addDB", "box title to debug addDB"), "type : "+tmp); bool ok=0; - QString cur=beforekey; + QString cur=label->text(); QString a, b, c=QInputDialog::getText(this, trUtf8("label", "Title of box where ask for new label"), trUtf8("Enter his label", "his/her/?they? I've forget my school lesson"), QLineEdit::Normal, QString(""), &ok); if ((c=="")||(ok==0))return; b=QInputDialog::getText(this, trUtf8("keyword", "Title of box where ask for new keyword"), trUtf8("Enter they keyword (no limit !)"), QLineEdit::Normal, cur, &ok); @@ -785,8 +785,9 @@ void MainWindow::chooseDB(){ QString b; bool ok=1; if(conf->value("askkeyword").toBool())b=QInputDialog::getText(this, trUtf8("chooseDB"), trUtf8("Enter the keyword : "), QLineEdit::Normal, label->text(), &ok); - else b=beforekey; + else b=label->text(); if(ok)chooseDB(conf->value(QString("currenttype")).toString(), b); + } void MainWindow::chooseDB(const QString & b){ flush(); @@ -946,6 +947,9 @@ FileDownloader::FileDownloader(QUrl url, QObject *parent) : QObject(parent) connect(&m_WebCtrl, SIGNAL(finished(QNetworkReply*)),SLOT(fileDownloaded(QNetworkReply*))); QNetworkRequest request(url); + QSslConfiguration ssl; + ssl.setProtocol(QSsl::TlsV1SslV3); + request.setSslConfiguration(ssl); m_WebCtrl.get(request); } @@ -1047,6 +1051,9 @@ void MainWindow::sav(const QString & a){ net=new QNetworkAccessManager(this); b.open(QIODevice::ReadOnly); QNetworkRequest * rq= new QNetworkRequest(upload); + QSslConfiguration ssl; + ssl.setProtocol(QSsl::TlsV1SslV3); + rq->setSslConfiguration(ssl); //rq->setSslConfiguration(QSslConfiguration::defaultConfiguration()); rep=net->put(*rq, b.readAll()); b.close(); -- 2.45.1