rsyncui/password.cpp

60 lines
1.4 KiB
C++
Raw Normal View History

2023-03-05 13:39:16 +01:00
#include "mainwindow.h"
#include "password.h"
#include <qt5keychain/keychain.h>
#include <qt5keychain/qkeychain_export.h>
2023-03-05 13:39:16 +01:00
using namespace std;
/*Password::Password()
{
2023-03-05 13:39:16 +01:00
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()))
}
2023-03-05 13:39:16 +01:00
void Password::store (QString account, QString password)
{
this->passwdJob->setKey(account);
this->passwdJob->setTextData(password);
this->passwdJob->start();
}
2023-03-05 13:39:16 +01:00
QString Password::read(QString account)
{
2023-03-05 13:39:16 +01:00
this->readPass->setObjectName("");
this->readPass->setKey(account);
this->readPass->start();
}
2023-03-05 13:39:16 +01:00
bool Password::remove(QString)
{
2023-03-05 13:39:16 +01:00
}
2023-03-05 13:39:16 +01:00
void Password::finished(QKeychain::Job * passwdJob)
{
2023-03-05 13:39:16 +01:00
if(passwdJob->error()) {
QMessageBox::warning(
NULL,
"RsyncUI",
QString(this->mw->tr("Error: Unable to save password!")) + QString(passwdJob->error()));
}
}
2023-03-05 13:39:16 +01:00
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();
}
}
2023-03-05 13:39:16 +01:00
*/