testing password encryption

This commit is contained in:
Daniel Tartavel 2023-03-05 13:39:16 +01:00
parent 9d305b0b3b
commit 83ef43fab1
2 changed files with 60 additions and 15 deletions

View File

@ -1,22 +1,59 @@
#include "mainwindow.h"
#include "password.h"
#include <qt5keychain/keychain.h>
#include <qt5keychain/qkeychain_export.h>
/*password::password("RsyncUI")
{
using namespace std;
}*/
void password::store (QString account, QString password)
/*Password::Password()
{
this->passwdJob->setObjectName(this->appName);
this->passwdJob->setAutoDelete(false);
this->passwdJob->connect(this->passwdJob, SIGNAL(finished(QKeychain::Job*)), this, SLOT(finished(QKeychain::Job*)));
//this->readPass->connect(this->readPass, SIGNAL(finished()))
}
QString password::read(QString)
void Password::store (QString account, QString password)
{
this->passwdJob->setKey(account);
this->passwdJob->setTextData(password);
this->passwdJob->start();
}
QString Password::read(QString account)
{
this->readPass->setObjectName("");
this->readPass->setKey(account);
this->readPass->start();
}
bool Password::remove(QString)
{
}
bool password::remove(QString)
void Password::finished(QKeychain::Job * passwdJob)
{
if(passwdJob->error()) {
QMessageBox::warning(
NULL,
"RsyncUI",
QString(this->mw->tr("Error: Unable to save password!")) + QString(passwdJob->error()));
}
}
void Password::readReturn()
{
if(this->readPass->error())
{
QMessageBox::warning(
NULL,
"RsyncUI",
QString(this->mw->tr("Error: Unable to read password!")) + QString(readPass->error()));
}else
{
this->password = readPass->textData();
}
}
*/

View File

@ -5,17 +5,25 @@
#include <qt5keychain/keychain.h>
#include <qt5keychain/qkeychain_export.h>
class password
class Password : QObject
{
password(QString);
public:
QString appName;
QKeychain::WritePasswordJob * passwdJob;
QKeychain::ReadPasswordJob * readPass;
MainWindow * mw;
QString password;
~password();
Password();
~Password();
void store(QString, QString);
QString read(QString);
bool remove(QString);
private slots:
void finished(QKeychain::Job*);
void readReturn();
};
#endif // PASSWORD_H