mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Implement "Show Desktop Notifications" option (default: on)
Should make #314 subscriber happy :-)
This commit is contained in:
parent
c06410e726
commit
d870d6c326
@ -116,6 +116,8 @@ Application::Application(int &argc, char **argv) :
|
||||
connect( this, SIGNAL(messageReceived(QString)), SLOT(slotParseOptions(QString)));
|
||||
connect( Logger::instance(), SIGNAL(guiLog(QString,QString)),
|
||||
this, SLOT(slotShowTrayMessage(QString,QString)));
|
||||
connect( Logger::instance(), SIGNAL(optionalGuiLog(QString,QString)),
|
||||
this, SLOT(slotShowOptionalTrayMessage(QString,QString)));
|
||||
// create folder manager for sync folder management
|
||||
_folderMan = new FolderMan(this);
|
||||
connect( _folderMan, SIGNAL(folderSyncStateChange(QString)),
|
||||
@ -717,6 +719,13 @@ void Application::slotShowTrayMessage(const QString &title, const QString &msg)
|
||||
qDebug() << "Tray not ready: " << msg;
|
||||
}
|
||||
|
||||
void Application::slotShowOptionalTrayMessage(const QString &title, const QString &msg)
|
||||
{
|
||||
MirallConfigFile cfg;
|
||||
if (cfg.optionalDesktopNotifications())
|
||||
slotShowTrayMessage(title, msg);
|
||||
}
|
||||
|
||||
void Application::slotSyncStateChange( const QString& alias )
|
||||
{
|
||||
SyncResult result = _folderMan->syncResult( alias );
|
||||
|
||||
@ -85,6 +85,7 @@ protected slots:
|
||||
void slotSettings();
|
||||
void slotParseOptions( const QString& );
|
||||
void slotShowTrayMessage(const QString&, const QString&);
|
||||
void slotShowOptionalTrayMessage(const QString&, const QString&);
|
||||
|
||||
void slotSyncStateChange( const QString& );
|
||||
void slotTrayClicked( QSystemTrayIcon::ActivationReason );
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/application.h"
|
||||
#include "mirall/utility.h"
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
|
||||
#include <QNetworkProxy>
|
||||
|
||||
@ -38,8 +39,11 @@ GeneralSettings::GeneralSettings(QWidget *parent) :
|
||||
_ui->typeComboBox->addItem(tr("HTTP(S) proxy"), QNetworkProxy::HttpProxy);
|
||||
_ui->typeComboBox->addItem(tr("SOCKS5 proxy"), QNetworkProxy::Socks5Proxy);
|
||||
|
||||
// not implemented yet
|
||||
_ui->desktopNotificationsCheckBox->setEnabled(false);
|
||||
MirallConfigFile cfgFile;
|
||||
_ui->desktopNotificationsCheckBox->setChecked(cfgFile.optionalDesktopNotifications());
|
||||
connect(_ui->desktopNotificationsCheckBox, SIGNAL(toggled(bool)),
|
||||
SLOT(slotToggleOptionalDesktopNotifications(bool)));
|
||||
|
||||
_ui->autostartCheckBox->setChecked(Utility::hasLaunchOnStartup());
|
||||
connect(_ui->autostartCheckBox, SIGNAL(toggled(bool)), SLOT(slotToggleLaunchOnStartup(bool)));
|
||||
|
||||
@ -134,6 +138,12 @@ void GeneralSettings::slotToggleLaunchOnStartup(bool enable)
|
||||
Utility::setLaunchOnStartup(enable);
|
||||
}
|
||||
|
||||
void GeneralSettings::slotToggleOptionalDesktopNotifications(bool enable)
|
||||
{
|
||||
MirallConfigFile cfgFile;
|
||||
cfgFile.setOptionalDesktopNotifications(enable);
|
||||
}
|
||||
|
||||
void GeneralSettings::saveProxySettings()
|
||||
{
|
||||
MirallConfigFile cfgFile;
|
||||
|
||||
@ -38,6 +38,7 @@ private slots:
|
||||
void saveProxySettings();
|
||||
void saveMiscSettings();
|
||||
void slotToggleLaunchOnStartup(bool);
|
||||
void slotToggleOptionalDesktopNotifications(bool);
|
||||
|
||||
private:
|
||||
void loadProxySettings();
|
||||
|
||||
@ -49,6 +49,7 @@ public:
|
||||
signals:
|
||||
void newLog(const QString&);
|
||||
void guiLog(const QString&, const QString&);
|
||||
void optionalGuiLog(const QString&, const QString&);
|
||||
|
||||
protected:
|
||||
Logger(QObject* parent=0);
|
||||
|
||||
@ -49,6 +49,21 @@ void MirallConfigFile::setConfDir(const QString &value)
|
||||
}
|
||||
}
|
||||
|
||||
bool MirallConfigFile::optionalDesktopNotifications() const
|
||||
{
|
||||
QSettings settings( configFile(), QSettings::IniFormat );
|
||||
settings.setIniCodec( "UTF-8" );
|
||||
return settings.value(QLatin1String("optionalDesktopNotifications"), true).toBool();
|
||||
}
|
||||
|
||||
void MirallConfigFile::setOptionalDesktopNotifications(bool show)
|
||||
{
|
||||
QSettings settings( configFile(), QSettings::IniFormat );
|
||||
settings.setIniCodec( "UTF-8" );
|
||||
settings.setValue(QLatin1String("optionalDesktopNotifications"), show);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
QString MirallConfigFile::seenVersion() const
|
||||
{
|
||||
QSettings settings( configFile(), QSettings::IniFormat );
|
||||
|
||||
@ -103,6 +103,9 @@ public:
|
||||
|
||||
static void setConfDir(const QString &value);
|
||||
|
||||
bool optionalDesktopNotifications() const;
|
||||
void setOptionalDesktopNotifications(bool show);
|
||||
|
||||
QString seenVersion() const;
|
||||
void setSeenVersion(const QString &version);
|
||||
protected:
|
||||
|
||||
@ -72,7 +72,7 @@ ownCloudFolder::ownCloudFolder(const QString &alias,
|
||||
, _csync_ctx(0)
|
||||
{
|
||||
ServerActionNotifier *notifier = new ServerActionNotifier(this);
|
||||
connect(notifier, SIGNAL(guiLog(QString,QString)), Logger::instance(), SIGNAL(guiLog(QString,QString)));
|
||||
connect(notifier, SIGNAL(guiLog(QString,QString)), Logger::instance(), SIGNAL(optionalGuiLog(QString,QString)));
|
||||
connect(this, SIGNAL(syncFinished(SyncResult)), notifier, SLOT(slotSyncFinished(SyncResult)));
|
||||
qDebug() << "****** ownCloud folder using watcher *******";
|
||||
// The folder interval is set in the folder parent class.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user