Browse Source

Disabling tips controls until some tips are actually available

Source commit: 659f478eb34dc01c62ac5a90d9d48a97af08fce2
Martin Prikryl 5 years ago
parent
commit
fa253f5df5
4 changed files with 9 additions and 2 deletions
  1. 1 1
      source/forms/NonVisual.cpp
  2. 1 0
      source/forms/Preferences.cpp
  3. 6 1
      source/windows/Setup.cpp
  4. 1 0
      source/windows/Setup.h

+ 1 - 1
source/forms/NonVisual.cpp

@@ -303,7 +303,7 @@ void __fastcall TNonVisualDataModule::ExplorerActionsUpdate(
   UPD(UpdatesPreferencesAction, true)
   UPD(DonatePageAction, true)
   UPD(DownloadPageAction, true)
-  UPD(TipsAction, true)
+  UPDEX1(TipsAction, true, TipsAction->Visible = AnyTips())
 
   // VIEW
   UPDCOMP(SessionsTabs)

+ 1 - 0
source/forms/Preferences.cpp

@@ -1401,6 +1401,7 @@ void __fastcall TPreferencesDialog::UpdateControls()
     EnableControl(AutoSaveWorkspacePasswordsCheck,
       !Configuration->DisablePasswordStoring &&
       AutoWorkspaceCombo->Enabled);
+    EnableControl(ShowTipsCheck, AnyTips());
 
     // integration
     EnableControl(ShellIconsGroup, !IsUWP());

+ 6 - 1
source/windows/Setup.cpp

@@ -2135,6 +2135,11 @@ void __fastcall AutoShowNewTip()
   ShowTip(true);
 }
 //---------------------------------------------------------------------------
+bool __fastcall AnyTips()
+{
+  return !WinConfiguration->Updates.Results.Tips.IsEmpty();
+}
+//---------------------------------------------------------------------------
 void __fastcall ShowTips()
 {
   {
@@ -2142,7 +2147,7 @@ void __fastcall ShowTips()
     DoQueryUpdates(false);
   }
 
-  if (WinConfiguration->Updates.Results.Tips.IsEmpty())
+  if (!AnyTips())
   {
     throw Exception(MainInstructions(LoadStr(TIPS_NONE)));
   }

+ 1 - 0
source/windows/Setup.h

@@ -28,6 +28,7 @@ bool __fastcall AnyOtherInstanceOfSelf();
 bool __fastcall IsInstalled();
 UnicodeString __fastcall ProgramUrl(UnicodeString URL);
 void __fastcall AutoShowNewTip();
+bool __fastcall AnyTips();
 void __fastcall ShowTips();
 UnicodeString __fastcall FirstUnshownTip();
 void __fastcall TipsUpdateStaticUsage();