Settings option to shush success KeeShare notifications (#3236)

This commit is contained in:
David Lareau 2019-06-07 08:43:25 -04:00 committed by Jonathan White
parent 16a11c3a7f
commit 54eafc8ebe
3 changed files with 23 additions and 6 deletions

View File

@ -100,6 +100,10 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
m_generalUi->checkUpdatesSpacer->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
#endif
#ifndef WITH_XC_KEESHARE
m_generalUi->quietKeeShareSuccess->setVisible(false);
#endif
#ifndef WITH_XC_NETWORKING
m_secUi->privacy->setVisible(false);
#endif
@ -182,6 +186,7 @@ void ApplicationSettingsWidget::loadSettings()
m_generalUi->systrayDarkIconCheckBox->setChecked(config()->get("GUI/DarkTrayIcon").toBool());
m_generalUi->systrayMinimizeToTrayCheckBox->setChecked(config()->get("GUI/MinimizeToTray").toBool());
m_generalUi->minimizeOnCloseCheckBox->setChecked(config()->get("GUI/MinimizeOnClose").toBool());
m_generalUi->quietKeeShareSuccess->setChecked(config()->get("GUI/QuietKeeShareSuccess").toBool());
m_generalUi->systrayMinimizeOnStartup->setChecked(config()->get("GUI/MinimizeOnStartup").toBool());
m_generalUi->checkForUpdatesOnStartupCheckBox->setChecked(config()->get("GUI/CheckForUpdates").toBool());
m_generalUi->checkForUpdatesIncludeBetasCheckBox->setChecked(
@ -267,6 +272,7 @@ void ApplicationSettingsWidget::saveSettings()
config()->set("GUI/DarkTrayIcon", m_generalUi->systrayDarkIconCheckBox->isChecked());
config()->set("GUI/MinimizeToTray", m_generalUi->systrayMinimizeToTrayCheckBox->isChecked());
config()->set("GUI/MinimizeOnClose", m_generalUi->minimizeOnCloseCheckBox->isChecked());
config()->set("GUI/QuietKeeShareSuccess", m_generalUi->quietKeeShareSuccess->isChecked());
config()->set("GUI/MinimizeOnStartup", m_generalUi->systrayMinimizeOnStartup->isChecked());
config()->set("GUI/CheckForUpdates", m_generalUi->checkForUpdatesOnStartupCheckBox->isChecked());
config()->set("GUI/CheckForUpdatesIncludeBetas", m_generalUi->checkForUpdatesIncludeBetasCheckBox->isChecked());

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>684</width>
<height>881</height>
<height>1030</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -382,6 +382,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="quietKeeShareSuccess">
<property name="text">
<string>Do not show success notifications for KeeShare, only warnings and errors</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="systrayShowCheckBox">
<property name="text">

View File

@ -261,18 +261,22 @@ void ShareObserver::reinitialize()
void ShareObserver::notifyAbout(const QStringList& success, const QStringList& warning, const QStringList& error)
{
if (error.isEmpty() && warning.isEmpty() && success.isEmpty()) {
return;
}
QStringList messages;
MessageWidget::MessageType type = MessageWidget::Positive;
if (!(success.isEmpty() || config()->get("GUI/QuietKeeShareSuccess").toBool())) {
messages += success;
}
if (!warning.isEmpty()) {
type = MessageWidget::Warning;
messages += warning;
}
if (!error.isEmpty()) {
type = MessageWidget::Error;
messages += error;
}
if (!messages.isEmpty()) {
emit sharingMessage(messages.join("\n"), type);
}
emit sharingMessage((success + warning + error).join("\n"), type);
}
void ShareObserver::handleDatabaseChanged()