Skip to content

Commit

Permalink
Don't show system notifications for short tasks
Browse files Browse the repository at this point in the history
Too annoying!
  • Loading branch information
nyalldawson committed Aug 8, 2018
1 parent 790408f commit 8c6068a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions resources/qgis_global_settings.ini
Expand Up @@ -28,6 +28,12 @@ connections-xyz\OpenStreetMap\username=
connections-xyz\OpenStreetMap\zmax=19
connections-xyz\OpenStreetMap\zmin=0

[app]

# Minimum time (in seconds) for a background task to execute in order for a system
# notification to be shown when the task completes.
minTaskLengthForSystemNotification=10

[core]
# Whether or not to anonymize newly created projects
# If set to 1, then project metadata items like AUTHOR and CREATION DATE
Expand Down
6 changes: 4 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -12925,10 +12925,12 @@ void QgisApp::newProfile()

void QgisApp::onTaskCompleteShowNotify( long taskId, int status )
{
if ( status == QgsTask::Complete && !this->isActiveWindow() )
long long minTime = QgsSettings().value( QStringLiteral( "minTaskLengthForSystemNotification" ), 10, QgsSettings::App ).toLongLong() * 1000;

if ( status == QgsTask::Complete )
{
QgsTask *task = QgsApplication::taskManager()->task( taskId );
if ( task )
if ( task && task->elapsedTime() >= minTime )
{
showSystemNotification( tr( "Task complete" ), task->description() );
}
Expand Down

0 comments on commit 8c6068a

Please sign in to comment.