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

History: keep unencrypted history

This commit is contained in:
apprb 2014-10-09 23:36:24 +09:00
parent 5c1e3360fe
commit 7069e2cd74
No known key found for this signature in database
GPG Key ID: B001911B5B22FB9B
6 changed files with 26 additions and 7 deletions

View File

@ -36,11 +36,9 @@ HistoryKeeper *HistoryKeeper::getInstance()
if (Settings::getInstance().getEnableLogging())
{
path = QDir(Settings::getInstance().getSettingsDirPath()).filePath("qtox_history.sqlite");
// path = "/tmp/qtox_history.sqlite"; // just for testing purpose
}
path = "/tmp/qtox_history.sqlite"; // just for testing purpose
encrypted = false;
historyInstance = new HistoryKeeper(path, encrypted);
}

View File

@ -144,6 +144,8 @@ void Settings::load()
s.beginGroup("Privacy");
typingNotification = s.value("typingNotification", false).toBool();
enableLogging = s.value("enableLogging", false).toBool();
encryptLogs = s.value("encryptLogs", false).toBool();
s.endGroup();
// try to set a smiley pack if none is selected
@ -247,6 +249,8 @@ void Settings::save(QString path)
s.beginGroup("Privacy");
s.setValue("typingNotification", typingNotification);
s.setValue("enableLogging", enableLogging);
s.setValue("encryptLogs", encryptLogs);
s.endGroup();
}

View File

@ -123,6 +123,8 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
fileButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
emoteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
menu.addAction(tr("Save chat log"), this, SLOT(onSaveLogClicked()));
connect(emoteButton, SIGNAL(clicked()), this, SLOT(onEmoteButtonClicked()));
connect(chatWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint)));
}
@ -145,8 +147,6 @@ void GenericChatForm::onChatContextMenuRequested(QPoint pos)
{
QWidget* sender = (QWidget*)QObject::sender();
pos = sender->mapToGlobal(pos);
QMenu menu;
menu.addAction(tr("Save chat log"), this, SLOT(onSaveLogClicked()));
menu.exec(pos);
}

View File

@ -20,6 +20,7 @@
#include <QWidget>
#include <QPoint>
#include <QDateTime>
#include <QMenu>
// Spacing in px inserted when the author of the last message changes
#define AUTHOR_CHANGE_SPACING 5
@ -63,6 +64,7 @@ protected slots:
protected:
QString getElidedName(const QString& name);
QMenu menu;
CroppingLabel *nameLabel;
MaskablePixmapWidget *avatar;
QWidget *headWidget;

View File

@ -18,12 +18,23 @@
#include "ui_privacysettings.h"
#include "widget/form/settingswidget.h"
#include "misc/settings.h"
#include "historykeeper.h"
PrivacyForm::PrivacyForm() :
GenericForm(tr("Privacy settings"), QPixmap(":/img/settings/privacy.png"))
{
bodyUI = new Ui::PrivacySettings;
bodyUI->setupUi(this);
bodyUI->cbTypingNotification->setChecked(Settings::getInstance().isTypingNotificationEnabled());
bodyUI->cbKeepHistory->setChecked(Settings::getInstance().getEnableLogging());
bodyUI->cbEncryptHistory->setChecked(Settings::getInstance().getEncryptLogs());
connect(bodyUI->cbTypingNotification, SIGNAL(stateChanged(int)), this, SLOT(onTypingNotificationEnabledUpdated()));
connect(bodyUI->cbKeepHistory, SIGNAL(stateChanged(int)), this, SLOT(onEnableLoggingUpdated()));
connect(bodyUI->cbEncryptHistory, SIGNAL(stateChanged(int)), this, SLOT(onEncryptLogsUpdated()));
connect(bodyUI->cbEnctyptTox, SIGNAL(stateChanged(int)), this, SLOT(onEncryptToxUpdated()));
connect(bodyUI->pswdBtn, SIGNAL(clicked()), this, SLOT(onPasswordSet()));
}
PrivacyForm::~PrivacyForm()
@ -35,6 +46,7 @@ void PrivacyForm::onEnableLoggingUpdated()
{
Settings::getInstance().setEnableLogging(bodyUI->cbKeepHistory->isChecked());
bodyUI->cbEncryptHistory->setEnabled(bodyUI->cbKeepHistory->isChecked());
HistoryKeeper::getInstance()->resetInstance();
}
void PrivacyForm::onTypingNotificationEnabledUpdated()

View File

@ -26,8 +26,11 @@
</item>
<item>
<widget class="QCheckBox" name="cbKeepHistory">
<property name="toolTip">
<string extracomment="History keeping still under developing. Log format changin is possible."/>
</property>
<property name="text">
<string>Keep History</string>
<string>Keep History (unstable)</string>
</property>
</widget>
</item>
@ -72,7 +75,7 @@
<item>
<widget class="QPushButton" name="pswdBtn">
<property name="text">
<string>Set master password</string>
<string>Set profile password</string>
</property>
</widget>
</item>