mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
lint
This commit is contained in:
parent
b26a6bd9d2
commit
525b319a94
2 changed files with 20 additions and 17 deletions
|
@ -173,7 +173,8 @@ Cache::setup()
|
||||||
|
|
||||||
cacheDirectory_ = QString("%1/%2%3")
|
cacheDirectory_ = QString("%1/%2%3")
|
||||||
.arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation))
|
.arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation))
|
||||||
.arg(QString::fromUtf8(localUserId_.toUtf8().toHex())).arg(QString::fromUtf8(settings.profile().toUtf8().toHex()));
|
.arg(QString::fromUtf8(localUserId_.toUtf8().toHex()))
|
||||||
|
.arg(QString::fromUtf8(settings.profile().toUtf8().toHex()));
|
||||||
|
|
||||||
bool isInitial = !QFile::exists(cacheDirectory_);
|
bool isInitial = !QFile::exists(cacheDirectory_);
|
||||||
|
|
||||||
|
@ -186,7 +187,9 @@ Cache::setup()
|
||||||
|
|
||||||
if (!QDir().mkpath(cacheDirectory_)) {
|
if (!QDir().mkpath(cacheDirectory_)) {
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
("Unable to create state directory:" + cacheDirectory_).toStdString().c_str());
|
("Unable to create state directory:" + cacheDirectory_)
|
||||||
|
.toStdString()
|
||||||
|
.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,14 +578,14 @@ Cache::restoreOlmAccount()
|
||||||
void
|
void
|
||||||
Cache::storeSecret(const std::string &name, const std::string &secret)
|
Cache::storeSecret(const std::string &name, const std::string &secret)
|
||||||
{
|
{
|
||||||
UserSettings settings;
|
UserSettings settings;
|
||||||
QKeychain::WritePasswordJob job(QCoreApplication::applicationName());
|
QKeychain::WritePasswordJob job(QCoreApplication::applicationName());
|
||||||
job.setAutoDelete(false);
|
job.setAutoDelete(false);
|
||||||
job.setInsecureFallback(true);
|
job.setInsecureFallback(true);
|
||||||
job.setKey(
|
job.setKey("matrix." +
|
||||||
"matrix." +
|
QString(QCryptographicHash::hash(settings.profile().toUtf8(),
|
||||||
QString(QCryptographicHash::hash(settings.profile().toUtf8(), QCryptographicHash::Sha256)) +
|
QCryptographicHash::Sha256)) +
|
||||||
"." + name.c_str());
|
"." + name.c_str());
|
||||||
job.setTextData(QString::fromStdString(secret));
|
job.setTextData(QString::fromStdString(secret));
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
job.connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
|
job.connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
|
||||||
|
@ -604,10 +607,10 @@ Cache::deleteSecret(const std::string &name)
|
||||||
QKeychain::DeletePasswordJob job(QCoreApplication::applicationName());
|
QKeychain::DeletePasswordJob job(QCoreApplication::applicationName());
|
||||||
job.setAutoDelete(false);
|
job.setAutoDelete(false);
|
||||||
job.setInsecureFallback(true);
|
job.setInsecureFallback(true);
|
||||||
job.setKey(
|
job.setKey("matrix." +
|
||||||
"matrix." +
|
QString(QCryptographicHash::hash(settings.profile().toUtf8(),
|
||||||
QString(QCryptographicHash::hash(settings.profile().toUtf8(), QCryptographicHash::Sha256)) +
|
QCryptographicHash::Sha256)) +
|
||||||
"." + name.c_str());
|
"." + name.c_str());
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
job.connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
|
job.connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
|
||||||
job.start();
|
job.start();
|
||||||
|
@ -623,10 +626,10 @@ Cache::secret(const std::string &name)
|
||||||
QKeychain::ReadPasswordJob job(QCoreApplication::applicationName());
|
QKeychain::ReadPasswordJob job(QCoreApplication::applicationName());
|
||||||
job.setAutoDelete(false);
|
job.setAutoDelete(false);
|
||||||
job.setInsecureFallback(true);
|
job.setInsecureFallback(true);
|
||||||
job.setKey(
|
job.setKey("matrix." +
|
||||||
"matrix." +
|
QString(QCryptographicHash::hash(settings.profile().toUtf8(),
|
||||||
QString(QCryptographicHash::hash(settings.profile().toUtf8(), QCryptographicHash::Sha256)) +
|
QCryptographicHash::Sha256)) +
|
||||||
"." + name.c_str());
|
"." + name.c_str());
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
job.connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
|
job.connect(&job, &QKeychain::Job::finished, &loop, &QEventLoop::quit);
|
||||||
job.start();
|
job.start();
|
||||||
|
|
|
@ -56,8 +56,8 @@
|
||||||
MainWindow *MainWindow::instance_ = nullptr;
|
MainWindow *MainWindow::instance_ = nullptr;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent)
|
||||||
userSettings_{QSharedPointer<UserSettings>{new UserSettings}}
|
, userSettings_{QSharedPointer<UserSettings>{new UserSettings}}
|
||||||
{
|
{
|
||||||
setWindowTitle(0);
|
setWindowTitle(0);
|
||||||
setObjectName("MainWindow");
|
setObjectName("MainWindow");
|
||||||
|
|
Loading…
Reference in a new issue