Skip to content

Commit 8c6068a

Browse files
committed
Don't show system notifications for short tasks
Too annoying!
1 parent 790408f commit 8c6068a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

resources/qgis_global_settings.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ connections-xyz\OpenStreetMap\username=
2828
connections-xyz\OpenStreetMap\zmax=19
2929
connections-xyz\OpenStreetMap\zmin=0
3030

31+
[app]
32+
33+
# Minimum time (in seconds) for a background task to execute in order for a system
34+
# notification to be shown when the task completes.
35+
minTaskLengthForSystemNotification=10
36+
3137
[core]
3238
# Whether or not to anonymize newly created projects
3339
# If set to 1, then project metadata items like AUTHOR and CREATION DATE

src/app/qgisapp.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12925,10 +12925,12 @@ void QgisApp::newProfile()
1292512925

1292612926
void QgisApp::onTaskCompleteShowNotify( long taskId, int status )
1292712927
{
12928-
if ( status == QgsTask::Complete && !this->isActiveWindow() )
12928+
long long minTime = QgsSettings().value( QStringLiteral( "minTaskLengthForSystemNotification" ), 10, QgsSettings::App ).toLongLong() * 1000;
12929+
12930+
if ( status == QgsTask::Complete )
1292912931
{
1293012932
QgsTask *task = QgsApplication::taskManager()->task( taskId );
12931-
if ( task )
12933+
if ( task && task->elapsedTime() >= minTime )
1293212934
{
1293312935
showSystemNotification( tr( "Task complete" ), task->description() );
1293412936
}

0 commit comments

Comments
 (0)