mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Incremental work, starting to take shape
This commit is contained in:
parent
dde410bb9c
commit
bafca96554
8
qtox.pro
8
qtox.pro
@ -83,7 +83,7 @@ win32 {
|
|||||||
target.path = /usr/bin
|
target.path = /usr/bin
|
||||||
INSTALLS += target
|
INSTALLS += target
|
||||||
LIBS += -L$$PWD/libs/lib/ -lopus -lvpx -lopenal -Wl,-Bstatic -ltoxcore -ltoxav -ltoxencryptsave -ltoxdns -lsodium -lopencv_highgui -lopencv_imgproc -lopencv_core -lz -Wl,-Bdynamic
|
LIBS += -L$$PWD/libs/lib/ -lopus -lvpx -lopenal -Wl,-Bstatic -ltoxcore -ltoxav -ltoxencryptsave -ltoxdns -lsodium -lopencv_highgui -lopencv_imgproc -lopencv_core -lz -Wl,-Bdynamic
|
||||||
LIBS += -Wl,-Bstatic -ljpeg -ltiff -lpng -ljasper -lIlmImf -lIlmThread -lIex -ldc1394 -lraw1394 -lHalf -lz -llzma -ljbig
|
LIBS += -Wl,-Bstatic -ljpeg -ltiff -lpng -ljasper -lIlmImf -lIlmThread -lIex -ldc1394 -lraw1394 -lHalf -lz -llzma -ljbig
|
||||||
LIBS += -Wl,-Bdynamic -lv4l1 -lv4l2 -lavformat -lavcodec -lavutil -lswscale -lusb-1.0
|
LIBS += -Wl,-Bdynamic -lv4l1 -lv4l2 -lavformat -lavcodec -lavutil -lswscale -lusb-1.0
|
||||||
} else {
|
} else {
|
||||||
LIBS += -L$$PWD/libs/lib/ -ltoxcore -ltoxav -ltoxencryptsave -ltoxdns -lvpx -lsodium -lopenal -lopencv_core -lopencv_highgui -lopencv_imgproc
|
LIBS += -L$$PWD/libs/lib/ -ltoxcore -ltoxav -ltoxencryptsave -ltoxdns -lvpx -lsodium -lopenal -lopencv_core -lopencv_highgui -lopencv_imgproc
|
||||||
@ -163,7 +163,8 @@ HEADERS += src/widget/form/addfriendform.h \
|
|||||||
src/autoupdate.h \
|
src/autoupdate.h \
|
||||||
src/misc/serialize.h \
|
src/misc/serialize.h \
|
||||||
src/widget/form/settings/advancedform.h \
|
src/widget/form/settings/advancedform.h \
|
||||||
src/audio.h
|
src/audio.h \
|
||||||
|
src/widget/form/checkcontinue.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
src/widget/form/addfriendform.cpp \
|
src/widget/form/addfriendform.cpp \
|
||||||
@ -230,7 +231,8 @@ SOURCES += \
|
|||||||
src/autoupdate.cpp \
|
src/autoupdate.cpp \
|
||||||
src/misc/serialize.cpp \
|
src/misc/serialize.cpp \
|
||||||
src/widget/form/settings/advancedform.cpp \
|
src/widget/form/settings/advancedform.cpp \
|
||||||
src/audio.cpp
|
src/audio.cpp \
|
||||||
|
src/widget/form/checkcontinue.cpp
|
||||||
|
|
||||||
contains(DEFINES, QTOX_PLATFORM_EXT) {
|
contains(DEFINES, QTOX_PLATFORM_EXT) {
|
||||||
HEADERS += src/platform/timer.h
|
HEADERS += src/platform/timer.h
|
||||||
|
@ -135,6 +135,7 @@ public slots:
|
|||||||
static bool isGroupCallVolEnabled(int groupId);
|
static bool isGroupCallVolEnabled(int groupId);
|
||||||
|
|
||||||
void setPassword(QString& password, PasswordType passtype, uint8_t* salt = nullptr);
|
void setPassword(QString& password, PasswordType passtype, uint8_t* salt = nullptr);
|
||||||
|
void useOtherPassword(PasswordType type);
|
||||||
void clearPassword(PasswordType passtype);
|
void clearPassword(PasswordType passtype);
|
||||||
QByteArray encryptData(const QByteArray& data, PasswordType passtype);
|
QByteArray encryptData(const QByteArray& data, PasswordType passtype);
|
||||||
QByteArray decryptData(const QByteArray& data, PasswordType passtype);
|
QByteArray decryptData(const QByteArray& data, PasswordType passtype);
|
||||||
|
@ -50,6 +50,15 @@ void Core::setPassword(QString& password, PasswordType passtype, uint8_t* salt)
|
|||||||
password.clear();
|
password.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Core::useOtherPassword(PasswordType type)
|
||||||
|
{
|
||||||
|
clearPassword(type);
|
||||||
|
if (type == ptHistory)
|
||||||
|
pwsaltedkeys[ptHistory] = pwsaltedkeys[ptMain];
|
||||||
|
else if (type == ptMain)
|
||||||
|
pwsaltedkeys[ptMain] = pwsaltedkeys[ptHistory];
|
||||||
|
}
|
||||||
|
|
||||||
void Core::clearPassword(PasswordType passtype)
|
void Core::clearPassword(PasswordType passtype)
|
||||||
{
|
{
|
||||||
if (pwsaltedkeys[passtype])
|
if (pwsaltedkeys[passtype])
|
||||||
|
@ -71,17 +71,9 @@ HistoryKeeper *HistoryKeeper::getInstance()
|
|||||||
bool HistoryKeeper::checkPassword()
|
bool HistoryKeeper::checkPassword()
|
||||||
{
|
{
|
||||||
if (Settings::getInstance().getEnableLogging())
|
if (Settings::getInstance().getEnableLogging())
|
||||||
{
|
|
||||||
if (Settings::getInstance().getEncryptLogs())
|
if (Settings::getInstance().getEncryptLogs())
|
||||||
{
|
return EncryptedDb::check(getHistoryPath());
|
||||||
QString dbpath = getHistoryPath();
|
return true;
|
||||||
return EncryptedDb::check(dbpath);
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryKeeper::HistoryKeeper(GenericDdInterface *db_) :
|
HistoryKeeper::HistoryKeeper(GenericDdInterface *db_) :
|
||||||
@ -143,6 +135,12 @@ HistoryKeeper::~HistoryKeeper()
|
|||||||
delete db;
|
delete db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryKeeper::reencrypt(QString newpw)
|
||||||
|
{
|
||||||
|
// this needs to appropriately set the core password as well
|
||||||
|
// if newpw.isEmpty(), then use the other core password
|
||||||
|
}
|
||||||
|
|
||||||
int HistoryKeeper::addChatEntry(const QString& chat, const QString& message, const QString& sender, const QDateTime &dt, bool isSent)
|
int HistoryKeeper::addChatEntry(const QString& chat, const QString& message, const QString& sender, const QDateTime &dt, bool isSent)
|
||||||
{
|
{
|
||||||
int chat_id = getChatID(chat, ctSingle).first;
|
int chat_id = getChatID(chat, ctSingle).first;
|
||||||
|
@ -52,6 +52,7 @@ public:
|
|||||||
int addGroupChatEntry(const QString& chat, const QString& message, const QString& sender, const QDateTime &dt);
|
int addGroupChatEntry(const QString& chat, const QString& message, const QString& sender, const QDateTime &dt);
|
||||||
QList<HistMessage> getChatHistory(ChatType ct, const QString &chat, const QDateTime &time_from, const QDateTime &time_to);
|
QList<HistMessage> getChatHistory(ChatType ct, const QString &chat, const QDateTime &time_from, const QDateTime &time_to);
|
||||||
void markAsSent(int m_id);
|
void markAsSent(int m_id);
|
||||||
|
void reencrypt(QString newpw);
|
||||||
|
|
||||||
void setSyncType(Db::syncType sType);
|
void setSyncType(Db::syncType sType);
|
||||||
|
|
||||||
|
23
src/widget/form/checkcontinue.cpp
Normal file
23
src/widget/form/checkcontinue.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2014 by Project Tox <https://tox.im>
|
||||||
|
|
||||||
|
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||||
|
|
||||||
|
This program is libre software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the COPYING file for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
bool checkContinue(const QString& title, const QString& msg, QWidget* parent = nullptr)
|
||||||
|
{
|
||||||
|
QMessageBox::StandardButton resp = QMessageBox::question(parent, title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||||
|
return resp == QMessageBox::Yes;
|
||||||
|
}
|
22
src/widget/form/checkcontinue.h
Normal file
22
src/widget/form/checkcontinue.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2014 by Project Tox <https://tox.im>
|
||||||
|
|
||||||
|
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||||
|
|
||||||
|
This program is libre software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the COPYING file for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CHECKCONTINUE_H
|
||||||
|
#define CHECKCONTINUE_H
|
||||||
|
|
||||||
|
bool checkContinue(const QString& title, const QString& msg, QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
#endif
|
@ -18,14 +18,23 @@
|
|||||||
#include "ui_setpassworddialog.h"
|
#include "ui_setpassworddialog.h"
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
SetPasswordDialog::SetPasswordDialog(QWidget *parent) :
|
SetPasswordDialog::SetPasswordDialog(QString body, QString extraButton, QWidget* parent)
|
||||||
QDialog(parent),
|
: QDialog(parent)
|
||||||
ui(new Ui::SetPasswordDialog)
|
, ui(new Ui::SetPasswordDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
connect(ui->passwordlineEdit, SIGNAL(textChanged(QString)), this, SLOT(onPasswordEdit()));
|
connect(ui->passwordlineEdit, SIGNAL(textChanged(QString)), this, SLOT(onPasswordEdit()));
|
||||||
connect(ui->repasswordlineEdit, SIGNAL(textChanged(QString)), this, SLOT(onPasswordEdit()));
|
connect(ui->repasswordlineEdit, SIGNAL(textChanged(QString)), this, SLOT(onPasswordEdit()));
|
||||||
|
|
||||||
|
ui->body->setText(body);
|
||||||
|
|
||||||
|
if (!extraButton.isEmpty())
|
||||||
|
{
|
||||||
|
QPushButton* third = new QPushButton(extraButton);
|
||||||
|
ui->buttonBox->addButton(third, QDialogButtonBox::YesRole);
|
||||||
|
connect(third, &QPushButton::clicked, this, [=](){this->done(2);});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetPasswordDialog::~SetPasswordDialog()
|
SetPasswordDialog::~SetPasswordDialog()
|
||||||
|
@ -28,7 +28,7 @@ class SetPasswordDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SetPasswordDialog(QWidget *parent = 0);
|
explicit SetPasswordDialog(QString body, QString extraButton, QWidget* parent = 0);
|
||||||
~SetPasswordDialog();
|
~SetPasswordDialog();
|
||||||
QString getPassword();
|
QString getPassword();
|
||||||
|
|
||||||
|
@ -11,39 +11,50 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string notr="true">Dialog</string>
|
<string>Set your password</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="modal">
|
<property name="modal">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="body" />
|
||||||
<property name="text">
|
|
||||||
<string>Type Password</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="passwordlineEdit">
|
<layout class="QHBoxLayout" name="hLayout1">
|
||||||
<property name="echoMode">
|
<item>
|
||||||
<enum>QLineEdit::Password</enum>
|
<widget class="QLabel" name="label">
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>Type password:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="passwordlineEdit">
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<layout class="QHBoxLayout" name="hLayout2">
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Repeat Password</string>
|
<widget class="QLabel" name="label_2">
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>Repeat Password</string>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<widget class="QLineEdit" name="repasswordlineEdit">
|
</item>
|
||||||
<property name="echoMode">
|
<item>
|
||||||
<enum>QLineEdit::Password</enum>
|
<widget class="QLineEdit" name="repasswordlineEdit">
|
||||||
</property>
|
<property name="echoMode">
|
||||||
</widget>
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "src/widget/form/settingswidget.h"
|
#include "src/widget/form/settingswidget.h"
|
||||||
#include "src/misc/settings.h"
|
#include "src/misc/settings.h"
|
||||||
#include "src/widget/croppinglabel.h"
|
#include "src/widget/croppinglabel.h"
|
||||||
|
#include "src/widget/form/checkcontinue.h"
|
||||||
#include "src/widget/widget.h"
|
#include "src/widget/widget.h"
|
||||||
#include "src/historykeeper.h"
|
#include "src/historykeeper.h"
|
||||||
#include "src/misc/style.h"
|
#include "src/misc/style.h"
|
||||||
@ -29,7 +30,6 @@
|
|||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
|
||||||
|
|
||||||
IdentityForm::IdentityForm() :
|
IdentityForm::IdentityForm() :
|
||||||
GenericForm(tr("Identity"), QPixmap(":/img/settings/identity.png"))
|
GenericForm(tr("Identity"), QPixmap(":/img/settings/identity.png"))
|
||||||
@ -149,7 +149,7 @@ void IdentityForm::onRenameClicked()
|
|||||||
QDir dir(Settings::getSettingsDirPath());
|
QDir dir(Settings::getSettingsDirPath());
|
||||||
QString file = dir.filePath(name+Core::TOX_EXT);
|
QString file = dir.filePath(name+Core::TOX_EXT);
|
||||||
if (!QFile::exists(file) || checkContinue(tr("Profile already exists", "rename confirm title"),
|
if (!QFile::exists(file) || checkContinue(tr("Profile already exists", "rename confirm title"),
|
||||||
tr("A profile named \"%1\" already exists. Do you want to erase it?", "rename confirm text").arg(cur)))
|
tr("A profile named \"%1\" already exists. Do you want to erase it?", "rename confirm text").arg(cur)), this)
|
||||||
{
|
{
|
||||||
QFile::rename(dir.filePath(cur+Core::TOX_EXT), file);
|
QFile::rename(dir.filePath(cur+Core::TOX_EXT), file);
|
||||||
bodyUI->profiles->setItemText(bodyUI->profiles->currentIndex(), name);
|
bodyUI->profiles->setItemText(bodyUI->profiles->currentIndex(), name);
|
||||||
@ -172,7 +172,7 @@ void IdentityForm::onExportClicked()
|
|||||||
if (QFile::exists(path))
|
if (QFile::exists(path))
|
||||||
{
|
{
|
||||||
// should we popup a warning?
|
// should we popup a warning?
|
||||||
// if (!checkContinue(tr("Overwriting a file"), tr("Are you sure you want to overwrite %1?").arg(path)))
|
// if (!checkContinue(tr("Overwriting a file"), tr("Are you sure you want to overwrite %1?").arg(path)), this)
|
||||||
// return;
|
// return;
|
||||||
success = QFile::remove(path);
|
success = QFile::remove(path);
|
||||||
if (!success)
|
if (!success)
|
||||||
@ -196,7 +196,7 @@ void IdentityForm::onDeleteClicked()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (checkContinue(tr("Deletion imminent!","deletion confirmation title"),
|
if (checkContinue(tr("Deletion imminent!","deletion confirmation title"),
|
||||||
tr("Are you sure you want to delete this profile?\nAssociated friend information and chat logs will be deleted as well.","deletion confirmation text")))
|
tr("Are you sure you want to delete this profile?","deletion confirmation text"), this))
|
||||||
{
|
{
|
||||||
QString profile = bodyUI->profiles->currentText();
|
QString profile = bodyUI->profiles->currentText();
|
||||||
QDir dir(Settings::getSettingsDirPath());
|
QDir dir(Settings::getSettingsDirPath());
|
||||||
@ -235,7 +235,7 @@ void IdentityForm::onImportClicked()
|
|||||||
QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT);
|
QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT);
|
||||||
|
|
||||||
if (QFileInfo(profilePath).exists() && !checkContinue(tr("Profile already exists", "import confirm title"),
|
if (QFileInfo(profilePath).exists() && !checkContinue(tr("Profile already exists", "import confirm title"),
|
||||||
tr("A profile named \"%1\" already exists. Do you want to erase it?", "import confirm text").arg(profile)))
|
tr("A profile named \"%1\" already exists. Do you want to erase it?", "import confirm text").arg(profile), this))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QFile::copy(path, profilePath);
|
QFile::copy(path, profilePath);
|
||||||
@ -247,12 +247,6 @@ void IdentityForm::onNewClicked()
|
|||||||
emit Widget::getInstance()->changeProfile(QString());
|
emit Widget::getInstance()->changeProfile(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IdentityForm::checkContinue(const QString& title, const QString& msg)
|
|
||||||
{
|
|
||||||
QMessageBox::StandardButton resp = QMessageBox::question(this, title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
|
||||||
return resp == QMessageBox::Yes;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IdentityForm::disableSwitching()
|
void IdentityForm::disableSwitching()
|
||||||
{
|
{
|
||||||
bodyUI->loadButton->setEnabled(false);
|
bodyUI->loadButton->setEnabled(false);
|
||||||
|
@ -66,7 +66,6 @@ private slots:
|
|||||||
void onDeleteClicked();
|
void onDeleteClicked();
|
||||||
void onImportClicked();
|
void onImportClicked();
|
||||||
void onNewClicked();
|
void onNewClicked();
|
||||||
bool checkContinue(const QString& title, const QString& msg);
|
|
||||||
void disableSwitching();
|
void disableSwitching();
|
||||||
void enableSwitching();
|
void enableSwitching();
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "src/core.h"
|
#include "src/core.h"
|
||||||
#include "src/widget/widget.h"
|
#include "src/widget/widget.h"
|
||||||
#include "src/widget/form/setpassworddialog.h"
|
#include "src/widget/form/setpassworddialog.h"
|
||||||
|
#include "src/widget/form/checkcontinue.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
@ -60,16 +61,65 @@ void PrivacyForm::onTypingNotificationEnabledUpdated()
|
|||||||
|
|
||||||
void PrivacyForm::onEncryptLogsUpdated()
|
void PrivacyForm::onEncryptLogsUpdated()
|
||||||
{
|
{
|
||||||
bool encryption = bodyUI->cbEncryptHistory->isChecked();
|
Core* core = Core::getInstance();
|
||||||
|
|
||||||
if (encryption)
|
if (bodyUI->cbEncryptHistory->isChecked())
|
||||||
{
|
{
|
||||||
|
if (!core->isPasswordSet(Core::ptHistory))
|
||||||
|
{
|
||||||
|
SetPasswordDialog* dialog;
|
||||||
|
QString body = tr("Please set your new chat log password:");
|
||||||
|
if (core->isPasswordSet(Core::ptMain))
|
||||||
|
dialog = new SetPasswordDialog(body, tr("Use datafile password", "pushbutton text"));
|
||||||
|
else
|
||||||
|
dialog = new SetPasswordDialog(body, QString());
|
||||||
|
|
||||||
|
if (int r = dialog->exec())
|
||||||
|
{
|
||||||
|
QString newpw;
|
||||||
|
if (r != 2)
|
||||||
|
newpw = dialog->getPassword();
|
||||||
|
delete dialog;
|
||||||
|
if (r != 2 && newpw.isEmpty())
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
Settings::getInstance().setEncryptLogs(true);
|
||||||
|
bodyUI->cbEncryptHistory->setChecked(true);
|
||||||
|
// not logically necessary, but more consistent (esp. if the logic changes)
|
||||||
|
if (!HistoryKeeper::checkPassword())
|
||||||
|
if (checkContinue(tr("Old encrypted chat logs", "title"),
|
||||||
|
tr("Would you like to re-encrypt your old chat logs?\nOtherwise they will be deleted.", "body")))
|
||||||
|
{
|
||||||
|
HistoryKeeper::getInstance()->reencrypt(newpw);
|
||||||
|
// will set core and reset itself
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// @apprb you resetInstance() in the old code but wouldn't that wipe out the current unencrypted history?
|
||||||
|
// that should of course just become encrypted
|
||||||
|
if (newpw.isEmpty())
|
||||||
|
core->useOtherPassword(Core::ptHistory);
|
||||||
|
else
|
||||||
|
core->setPassword(newpw, Core::ptHistory);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
delete dialog;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (checkContinue(tr("Old encrypted chat logs", "title"), tr("Would you like to un-encrypt your chat logs?\nOtherwise they will be deleted.")))
|
||||||
|
{
|
||||||
|
// TODO: how to unencrypt current encrypted logs
|
||||||
|
}
|
||||||
|
else
|
||||||
|
HistoryKeeper::resetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
|
core->clearPassword(Core::ptHistory);
|
||||||
|
Settings::getInstance().setEncryptLogs(false);
|
||||||
|
bodyUI->cbEncryptHistory->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrivacyForm::onEncryptToxUpdated()
|
void PrivacyForm::onEncryptToxUpdated()
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "src/core.h"
|
#include "src/core.h"
|
||||||
#include "src/misc/settings.h"
|
#include "src/misc/settings.h"
|
||||||
|
#include "src/widget/form/checkcontinue.h"
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@ -30,12 +31,6 @@ void toxSaveEventHandler(const QByteArray& eventData)
|
|||||||
handleToxSave(eventData);
|
handleToxSave(eventData);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool checkContinue(const QString& title, const QString& msg)
|
|
||||||
{
|
|
||||||
QMessageBox::StandardButton resp = QMessageBox::question(Widget::getInstance(), title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
|
||||||
return resp == QMessageBox::Yes;
|
|
||||||
}
|
|
||||||
|
|
||||||
void handleToxSave(const QString& path)
|
void handleToxSave(const QString& path)
|
||||||
{
|
{
|
||||||
Core* core = Core::getInstance();
|
Core* core = Core::getInstance();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user