Переглянути джерело

Bug 2067: Optionally do not flash taskbar button when WinSCP needs attention while in the background

https://winscp.net/tracker/2067

Source commit: 158316599bcdb4c2a07f53333e94bf3e0ed33b49
Martin Prikryl 3 роки тому
батько
коміт
7e83fd9207

+ 1 - 1
source/windows/UserInterface.cpp

@@ -109,7 +109,7 @@ void __fastcall SetOnForeground(bool OnForeground)
 void __fastcall FlashOnBackground()
 {
   DebugAssert(Application);
-  if (!ForcedOnForeground && !ForegroundTask())
+  if (WinConfiguration->FlashTaskbar && !ForcedOnForeground && !ForegroundTask())
   {
     FlashWindow(Application->MainFormHandle, true);
   }

+ 7 - 0
source/windows/WinConfiguration.cpp

@@ -604,6 +604,7 @@ void __fastcall TWinConfiguration::Default()
   FShowLoginWhenNoSession = true;
   FKeepOpenWhenNoSession = true;
   FLocalIconsByExt = false;
+  FFlashTaskbar = true;
   FMaxSessions = 100;
   FBidiModeOverride = lfoLanguageIfRecommended;
   FFlipChildrenOverride = lfoLanguageIfRecommended;
@@ -1050,6 +1051,7 @@ THierarchicalStorage * TWinConfiguration::CreateScpStorage(bool & SessionList)
     KEY(Bool,     ShowLoginWhenNoSession); \
     KEY(Bool,     KeepOpenWhenNoSession); \
     KEY(Bool,     LocalIconsByExt); \
+    KEY(Bool,     FlashTaskbar); \
     KEY(Integer,  MaxSessions); \
     KEY(Integer,  BidiModeOverride); \
     KEY(Integer,  FlipChildrenOverride); \
@@ -2335,6 +2337,11 @@ void __fastcall TWinConfiguration::SetLocalIconsByExt(bool value)
   SET_CONFIG_PROPERTY(LocalIconsByExt);
 }
 //---------------------------------------------------------------------------
+void __fastcall TWinConfiguration::SetFlashTaskbar(bool value)
+{
+  SET_CONFIG_PROPERTY(FlashTaskbar);
+}
+//---------------------------------------------------------------------------
 void __fastcall TWinConfiguration::SetBidiModeOverride(TLocaleFlagOverride value)
 {
   SET_CONFIG_PROPERTY(BidiModeOverride);

+ 3 - 0
source/windows/WinConfiguration.h

@@ -451,6 +451,7 @@ private:
   bool FShowLoginWhenNoSession;
   bool FKeepOpenWhenNoSession;
   bool FLocalIconsByExt;
+  bool FFlashTaskbar;
   int FMaxSessions;
   TLocaleFlagOverride FBidiModeOverride;
   TLocaleFlagOverride FFlipChildrenOverride;
@@ -556,6 +557,7 @@ private:
   void __fastcall SetShowLoginWhenNoSession(bool value);
   void __fastcall SetKeepOpenWhenNoSession(bool value);
   void __fastcall SetLocalIconsByExt(bool value);
+  void __fastcall SetFlashTaskbar(bool value);
   void __fastcall SetBidiModeOverride(TLocaleFlagOverride value);
   void __fastcall SetFlipChildrenOverride(TLocaleFlagOverride value);
   void __fastcall SetShowTips(bool value);
@@ -753,6 +755,7 @@ public:
   __property bool ShowLoginWhenNoSession = { read = FShowLoginWhenNoSession, write = SetShowLoginWhenNoSession };
   __property bool KeepOpenWhenNoSession = { read = FKeepOpenWhenNoSession, write = SetKeepOpenWhenNoSession };
   __property bool LocalIconsByExt = { read = FLocalIconsByExt, write = SetLocalIconsByExt };
+  __property bool FlashTaskbar = { read = FFlashTaskbar, write = SetFlashTaskbar };
   __property int MaxSessions = { read = FMaxSessions, write = FMaxSessions };
   __property TLocaleFlagOverride BidiModeOverride = { read = FBidiModeOverride, write = SetBidiModeOverride };
   __property TLocaleFlagOverride FlipChildrenOverride = { read = FFlipChildrenOverride, write = SetFlipChildrenOverride };