Switched ConnectionConfig to QString from std::string to fit better into Qt framework
This commit is contained in:
parent
bcfd82c27d
commit
082293e58a
20 changed files with 1077 additions and 211 deletions
|
|
@ -12,7 +12,6 @@
|
|||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
ConnectionController::ConnectionController(MasterController *parent)
|
||||
: QObject(parent)
|
||||
, m_masterController(parent)
|
||||
|
|
@ -146,11 +145,12 @@ void ConnectionController::openServerWindowForConnection(QModelIndex index)
|
|||
bool ConnectionController::retrieveConnectionPassword(ConnectionConfig &cc)
|
||||
{
|
||||
auto enc_pwd = cc.encodedPassword();
|
||||
if (!enc_pwd.empty()) {
|
||||
if (!enc_pwd.isEmpty()) {
|
||||
std::string pw;
|
||||
bool result = decodePassword(getPskId(cc), cc.encodedPassword(), pw);// getPasswordFromPskdb(getPskId(cc), pw);
|
||||
bool result = decodePassword(getPskId(cc),
|
||||
std::string_view(enc_pwd.data(), enc_pwd.size()) , pw);// getPasswordFromPskdb(getPskId(cc), pw);
|
||||
if (result) {
|
||||
cc.setPassword(pw);
|
||||
cc.setPassword(QString::fromUtf8(pw.data(), pw.size()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -163,12 +163,14 @@ bool ConnectionController::retrieveConnectionPassword(ConnectionConfig &cc)
|
|||
int exec_result = dlg->exec();
|
||||
|
||||
if (exec_result == QDialog::Accepted) {
|
||||
std::string password = dlg->password().toUtf8().data();
|
||||
auto password = dlg->password();
|
||||
cc.setPassword(password);
|
||||
if (dlg->saveChecked()) {
|
||||
auto ba = password.toUtf8();
|
||||
std::string pw(ba.data(), static_cast<size_t>(ba.size()));
|
||||
std::string encoded_pw;
|
||||
if (encodePassword(getPskId(cc), password, encoded_pw)) {
|
||||
cc.setEncodedPassword(encoded_pw);
|
||||
if (encodePassword(getPskId(cc), pw, encoded_pw)) {
|
||||
cc.setEncodedPassword({ encoded_pw.data(), static_cast<int>(encoded_pw.size()) });
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -176,7 +178,7 @@ bool ConnectionController::retrieveConnectionPassword(ConnectionConfig &cc)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ConnectionController::decodePassword(const std::string &password_id, const std::string &enc_password, std::string &password)
|
||||
bool ConnectionController::decodePassword(const std::string &password_id, const std::string_view &enc_password, std::string &password)
|
||||
{
|
||||
if (!UnlockPasswordManagerIfNeeded())
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue