1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

deleting a profile now cleans out all personal data

This commit is contained in:
Dubslow 2014-12-02 18:48:50 -06:00
parent aea9eea8a4
commit 3943d5213d
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA
3 changed files with 15 additions and 7 deletions

View File

@ -291,12 +291,13 @@ HistoryKeeper::ChatType HistoryKeeper::convertToChatType(int ct)
return static_cast<ChatType>(ct); return static_cast<ChatType>(ct);
} }
QString HistoryKeeper::getHistoryPath() QString HistoryKeeper::getHistoryPath(QString currentProfile, int encrypted)
{ {
QDir baseDir(Settings::getInstance().getSettingsDirPath()); QDir baseDir(Settings::getSettingsDirPath());
QString currentProfile = Settings::getInstance().getCurrentProfile(); if (currentProfile.isEmpty())
currentProfile = Settings::getInstance().getCurrentProfile();
if (Settings::getInstance().getEncryptLogs()) if (encrypted == 1 || (encrypted == -1 && Settings::getInstance().getEncryptLogs()))
return baseDir.filePath(currentProfile + ".qtox_history.encrypted"); return baseDir.filePath(currentProfile + ".qtox_history.encrypted");
else else
return baseDir.filePath(currentProfile + ".qtox_history"); return baseDir.filePath(currentProfile + ".qtox_history");

View File

@ -43,7 +43,7 @@ public:
static HistoryKeeper* getInstance(); static HistoryKeeper* getInstance();
static void resetInstance(); static void resetInstance();
static QString getHistoryPath(); static QString getHistoryPath(QString currentProfile = QString(), int encrypted = -1); // -1 defaults to checking settings, 0 or 1 to specify
static bool checkPassword(); static bool checkPassword();
static void renameHistory(QString from, QString to); static void renameHistory(QString from, QString to);

View File

@ -196,9 +196,16 @@ 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?","deletion confirmation text"))) tr("Are you sure you want to delete this profile?\nAssociated friend information and chat logs will be deleted as well.","deletion confirmation text")))
{ {
QFile::remove(QDir(Settings::getSettingsDirPath()).filePath(bodyUI->profiles->currentText()+Core::TOX_EXT)); QString profile = bodyUI->profiles->currentText();
QDir dir(Settings::getSettingsDirPath());
QFile::remove(dir.filePath(profile + Core::TOX_EXT));
QFile::remove(dir.filePath(profile + ".ini"));
QFile::remove(HistoryKeeper::getHistoryPath(profile, 0));
QFile::remove(HistoryKeeper::getHistoryPath(profile, 1));
bodyUI->profiles->removeItem(bodyUI->profiles->currentIndex()); bodyUI->profiles->removeItem(bodyUI->profiles->currentIndex());
bodyUI->profiles->setCurrentText(Settings::getInstance().getCurrentProfile()); bodyUI->profiles->setCurrentText(Settings::getInstance().getCurrentProfile());
} }