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

Support removing history with user in about window

This commit is contained in:
agilob 2015-12-05 12:14:31 +00:00
parent 734faa8a1f
commit e6504f2d46
No known key found for this signature in database
GPG Key ID: 296F0B764741106C
2 changed files with 14 additions and 0 deletions

View File

@ -1,9 +1,11 @@
#include "aboutuser.h"
#include "ui_aboutuser.h"
#include "src/persistence/settings.h"
#include "src/persistence/historykeeper.h"
#include <QDir>
#include <QFileDialog>
#include <QMessageBox>
AboutUser::AboutUser(ToxId &toxId, QWidget *parent) :
QDialog(parent),
@ -13,6 +15,7 @@ AboutUser::AboutUser(ToxId &toxId, QWidget *parent) :
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AboutUser::onAcceptedClicked);
connect(ui->autoaccept, &QCheckBox::clicked, this, &AboutUser::onAutoAcceptClicked);
connect(ui->selectSaveDir, &QPushButton::clicked, this, &AboutUser::onSelectDirClicked);
connect(ui->removeHistory, &QPushButton::clicked, this, &AboutUser::onRemoveHistoryClicked);
this->toxId = toxId;
QString dir = Settings::getInstance().getAutoAcceptDir(this->toxId);
@ -87,6 +90,16 @@ void AboutUser::onAcceptedClicked()
Settings::getInstance().saveGlobal();
}
void AboutUser::onRemoveHistoryClicked()
{
HistoryKeeper::getInstance()->removeFriendHistory(toxId.publicKey);
QMessageBox::StandardButton reply;
reply = QMessageBox::information(this,
tr("History removed"),
tr("Chat history with %1 removed!").arg(ui->userName->text().toHtmlEscaped()),
QMessageBox::Ok);
}
AboutUser::~AboutUser()
{
delete ui;

View File

@ -26,6 +26,7 @@ private slots:
void onAcceptedClicked();
void onAutoAcceptClicked();
void onSelectDirClicked();
void onRemoveHistoryClicked();
};
#endif // ABOUTUSER_H