Browse Source

feat(offlinemsg): Force offline messages to always be enabled

reviewable/pr5688/r2
Mick Sayson 6 years ago
parent
commit
d934cf372b
  1. 4
      src/persistence/offlinemsgengine.cpp
  2. 18
      src/persistence/settings.cpp
  3. 5
      src/persistence/settings.h
  4. 2
      src/widget/form/chatform.cpp
  5. 6
      src/widget/form/settings/generalform.cpp
  6. 2
      src/widget/form/settings/generalform.h
  7. 8
      src/widget/form/settings/generalsettings.ui

4
src/persistence/offlinemsgengine.cpp

@ -98,10 +98,6 @@ void OfflineMsgEngine::deliverOfflineMsgs()
{ {
QMutexLocker ml(&mutex); QMutexLocker ml(&mutex);
if (!Settings::getInstance().getFauxOfflineMessaging()) {
return;
}
if (!f->isOnline()) { if (!f->isOnline()) {
return; return;
} }

18
src/persistence/settings.cpp

@ -155,7 +155,6 @@ void Settings::loadGlobal()
checkUpdates = s.value("checkUpdates", true).toBool(); checkUpdates = s.value("checkUpdates", true).toBool();
notifySound = s.value("notifySound", true).toBool(); // note: notifySound and busySound UI elements are now under UI settings notifySound = s.value("notifySound", true).toBool(); // note: notifySound and busySound UI elements are now under UI settings
busySound = s.value("busySound", false).toBool(); // page, but kept under General in settings file to be backwards compatible busySound = s.value("busySound", false).toBool(); // page, but kept under General in settings file to be backwards compatible
fauxOfflineMessaging = s.value("fauxOfflineMessaging", true).toBool();
autoSaveEnabled = s.value("autoSaveEnabled", false).toBool(); autoSaveEnabled = s.value("autoSaveEnabled", false).toBool();
globalAutoAcceptDir = s.value("globalAutoAcceptDir", globalAutoAcceptDir = s.value("globalAutoAcceptDir",
QStandardPaths::locate(QStandardPaths::HomeLocation, QString(), QStandardPaths::locate(QStandardPaths::HomeLocation, QString(),
@ -436,7 +435,6 @@ void Settings::saveGlobal()
s.setValue("checkUpdates", checkUpdates); s.setValue("checkUpdates", checkUpdates);
s.setValue("notifySound", notifySound); s.setValue("notifySound", notifySound);
s.setValue("busySound", busySound); s.setValue("busySound", busySound);
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
s.setValue("autoSaveEnabled", autoSaveEnabled); s.setValue("autoSaveEnabled", autoSaveEnabled);
s.setValue("autoAcceptMaxSize", static_cast<qlonglong>(autoAcceptMaxSize)); s.setValue("autoAcceptMaxSize", static_cast<qlonglong>(autoAcceptMaxSize));
s.setValue("globalAutoAcceptDir", globalAutoAcceptDir); s.setValue("globalAutoAcceptDir", globalAutoAcceptDir);
@ -2062,22 +2060,6 @@ void Settings::removeFriendSettings(const ToxPk& id)
friendLst.remove(id.getByteArray()); friendLst.remove(id.getByteArray());
} }
bool Settings::getFauxOfflineMessaging() const
{
QMutexLocker locker{&bigLock};
return fauxOfflineMessaging;
}
void Settings::setFauxOfflineMessaging(bool value)
{
QMutexLocker locker{&bigLock};
if (value != fauxOfflineMessaging) {
fauxOfflineMessaging = value;
emit fauxOfflineMessagingChanged(fauxOfflineMessaging);
}
}
bool Settings::getCompactLayout() const bool Settings::getCompactLayout() const
{ {
QMutexLocker locker{&bigLock}; QMutexLocker locker{&bigLock};

5
src/persistence/settings.h

@ -225,7 +225,6 @@ signals:
void dateFormatChanged(const QString& format); void dateFormatChanged(const QString& format);
void statusChangeNotificationEnabledChanged(bool enabled); void statusChangeNotificationEnabledChanged(bool enabled);
void spellCheckingEnabledChanged(bool enabled); void spellCheckingEnabledChanged(bool enabled);
void fauxOfflineMessagingChanged(bool enabled);
// Privacy // Privacy
void typingNotificationChanged(bool enabled); void typingNotificationChanged(bool enabled);
@ -516,9 +515,6 @@ public:
SIGNAL_IMPL(Settings, autoAcceptDirChanged, const ToxPk& id, const QString& dir) SIGNAL_IMPL(Settings, autoAcceptDirChanged, const ToxPk& id, const QString& dir)
SIGNAL_IMPL(Settings, contactNoteChanged, const ToxPk& id, const QString& note) SIGNAL_IMPL(Settings, contactNoteChanged, const ToxPk& id, const QString& note)
bool getFauxOfflineMessaging() const;
void setFauxOfflineMessaging(bool value);
bool getCompactLayout() const; bool getCompactLayout() const;
void setCompactLayout(bool compact); void setCompactLayout(bool compact);
@ -600,7 +596,6 @@ private:
bool dontShowDhtDialog; bool dontShowDhtDialog;
bool autoLogin; bool autoLogin;
bool fauxOfflineMessaging;
bool compactLayout; bool compactLayout;
FriendListSortingMode sortingMode; FriendListSortingMode sortingMode;
bool groupchatPosition; bool groupchatPosition;

2
src/widget/form/chatform.cpp

@ -1141,7 +1141,7 @@ void ChatForm::SendMessageStr(QString msg)
QString selfPk = Core::getInstance()->getSelfId().toString(); QString selfPk = Core::getInstance()->getSelfId().toString();
QString pk = f->getPublicKey().toString(); QString pk = f->getPublicKey().toString();
QString name = Core::getInstance()->getUsername(); QString name = Core::getInstance()->getUsername();
bool isSent = !Settings::getInstance().getFauxOfflineMessaging(); bool const isSent = false; // This forces history to add it to the offline messages table
history->addNewMessage(pk, historyPart, selfPk, timestamp, isSent, name, history->addNewMessage(pk, historyPart, selfPk, timestamp, isSent, name,
[messageSent, offMsgEngine, receipt, ma](RowId id) { [messageSent, offMsgEngine, receipt, ma](RowId id) {
if (messageSent) { if (messageSent) {

6
src/widget/form/settings/generalform.cpp

@ -144,7 +144,6 @@ GeneralForm::GeneralForm(SettingsWidget* myParent)
bodyUI->closeToTray->setEnabled(showSystemTray); bodyUI->closeToTray->setEnabled(showSystemTray);
bodyUI->statusChanges->setChecked(s.getStatusChangeNotificationEnabled()); bodyUI->statusChanges->setChecked(s.getStatusChangeNotificationEnabled());
bodyUI->cbFauxOfflineMessaging->setChecked(s.getFauxOfflineMessaging());
bodyUI->autoAwaySpinBox->setValue(s.getAutoAwayTime()); bodyUI->autoAwaySpinBox->setValue(s.getAutoAwayTime());
bodyUI->autoSaveFilesDir->setText(s.getGlobalAutoAcceptDir()); bodyUI->autoSaveFilesDir->setText(s.getGlobalAutoAcceptDir());
@ -217,11 +216,6 @@ void GeneralForm::on_statusChanges_stateChanged()
Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChanges->isChecked()); Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChanges->isChecked());
} }
void GeneralForm::on_cbFauxOfflineMessaging_stateChanged()
{
Settings::getInstance().setFauxOfflineMessaging(bodyUI->cbFauxOfflineMessaging->isChecked());
}
void GeneralForm::on_autoAwaySpinBox_editingFinished() void GeneralForm::on_autoAwaySpinBox_editingFinished()
{ {
int minutes = bodyUI->autoAwaySpinBox->value(); int minutes = bodyUI->autoAwaySpinBox->value();

2
src/widget/form/settings/generalform.h

@ -50,8 +50,6 @@ private slots:
void on_autoAwaySpinBox_editingFinished(); void on_autoAwaySpinBox_editingFinished();
void on_minimizeToTray_stateChanged(); void on_minimizeToTray_stateChanged();
void on_statusChanges_stateChanged(); void on_statusChanges_stateChanged();
void on_cbFauxOfflineMessaging_stateChanged();
void on_autoacceptFiles_stateChanged(); void on_autoacceptFiles_stateChanged();
void on_maxAutoAcceptSizeMB_editingFinished(); void on_maxAutoAcceptSizeMB_editingFinished();
void on_autoSaveFilesDir_clicked(); void on_autoSaveFilesDir_clicked();

8
src/widget/form/settings/generalsettings.ui

@ -222,13 +222,6 @@ instead of closing itself.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="cbFauxOfflineMessaging">
<property name="text">
<string>Faux offline messaging</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -371,7 +364,6 @@ instead of closing itself.</string>
<tabstop>minimizeToTray</tabstop> <tabstop>minimizeToTray</tabstop>
<tabstop>closeToTray</tabstop> <tabstop>closeToTray</tabstop>
<tabstop>statusChanges</tabstop> <tabstop>statusChanges</tabstop>
<tabstop>cbFauxOfflineMessaging</tabstop>
<tabstop>autoAwaySpinBox</tabstop> <tabstop>autoAwaySpinBox</tabstop>
<tabstop>autoSaveFilesDir</tabstop> <tabstop>autoSaveFilesDir</tabstop>
<tabstop>autoacceptFiles</tabstop> <tabstop>autoacceptFiles</tabstop>

Loading…
Cancel
Save