瀏覽代碼

Improving instructions for enabling automatic updates

Source commit: 64b5d31fabd55a36da7c46af858866be4f6114b1
Martin Prikryl 3 年之前
父節點
當前提交
ca1d3e5faa
共有 5 個文件被更改,包括 14 次插入6 次删除
  1. 1 1
      source/forms/Preferences.cpp
  2. 1 0
      source/resource/TextsWin.h
  3. 1 0
      source/resource/TextsWin1.rc
  4. 10 4
      source/windows/Setup.cpp
  5. 1 1
      source/windows/Setup.h

+ 1 - 1
source/forms/Preferences.cpp

@@ -2557,7 +2557,7 @@ void __fastcall TPreferencesDialog::UpdatesAuthenticationEmailEditExit(TObject *
         UnicodeString AuthenticationError = Updates.Results.AuthenticationError;
         if (!AuthenticationError.IsEmpty())
         {
-          AuthenticationError = FormatUpdatesMessage(AuthenticationError);
+          AuthenticationError = FormatUpdatesMessage(AuthenticationError, Updates);
           if (HasParagraphs(AuthenticationError))
           {
             AuthenticationError = MainInstructionsFirstParagraph(AuthenticationError);

+ 1 - 0
source/resource/TextsWin.h

@@ -91,6 +91,7 @@
 #define DD_TARGET_UNKNOWN       1209
 #define JUMPLIST_ERROR          1210
 #define TOO_MANY_PARAMS_ERROR   1211
+#define UPDATE_MISSING_ADDRESS3 1212
 
 #define WIN_CONFIRMATION_STRINGS 1300
 #define CONFIRM_OVERWRITE_SESSION 1301

+ 1 - 0
source/resource/TextsWin1.rc

@@ -84,6 +84,7 @@ BEGIN
         UPDATE_EXPIRED, "Your email address authorization to automatic updates has expired."
         UPDATE_TOO_MANY, "Your email address was blocked to automatic updates due to an excessive use."
         UPDATE_MISSING_ADDRESS2, "To enable automatic updates for your e-mail address, please fill in a donation form (including your postal address).\n\nYou will find a link to the form in a receipt, you have received after your donation."
+        UPDATE_MISSING_ADDRESS3, "Search the %s inbox for \"%s\" message."
         UPDATE_TOO_LOW, "Your donation is below the limit required to enable automatic updates."
         TIPS_NONE, "No tips."
         KEYGEN_PUBLIC, "Converting public keys is not supported."

+ 10 - 4
source/windows/Setup.cpp

@@ -1114,12 +1114,18 @@ static void __fastcall DoQueryUpdates(bool CollectUsage)
   }
 }
 //---------------------------------------------------------------------------
-UnicodeString __fastcall FormatUpdatesMessage(UnicodeString Message)
+UnicodeString __fastcall FormatUpdatesMessage(const UnicodeString & AMessage, const TUpdatesConfiguration & Updates)
 {
+  UnicodeString Message = AMessage;
   Message = ReplaceStr(Message, "%UPDATE_UNAUTHORIZED%", LoadStr(UPDATE_UNAUTHORIZED));
   Message = ReplaceStr(Message, "%UPDATE_EXPIRED%", LoadStr(UPDATE_EXPIRED));
   Message = ReplaceStr(Message, "%UPDATE_TOO_MANY%", LoadStr(UPDATE_TOO_MANY));
-  Message = ReplaceStr(Message, "%UPDATE_MISSING_ADDRESS%", LoadStr(UPDATE_MISSING_ADDRESS2));
+  UnicodeString Buf = LoadStr(UPDATE_MISSING_ADDRESS2);
+  if (!Updates.AuthenticationEmail.IsEmpty())
+  {
+    Buf += L"\n\n" + FMTLOAD(UPDATE_MISSING_ADDRESS3, (Updates.AuthenticationEmail, L"WinSCP donation receipt"));
+  }
+  Message = ReplaceStr(Message, "%UPDATE_MISSING_ADDRESS%", Buf);
   Message = ReplaceStr(Message, "%UPDATE_TOO_LOW%", LoadStr(UPDATE_TOO_LOW));
   Message = ReplaceStr(Message, L"|", L"\n");
   return Message;
@@ -1166,13 +1172,13 @@ void __fastcall GetUpdatesMessage(UnicodeString & Message, bool & New,
     if (!Updates.Results.Message.IsEmpty())
     {
       Message +=
-        FMTLOAD(UPDATE_MESSAGE, (FormatUpdatesMessage(Updates.Results.Message)));
+        FMTLOAD(UPDATE_MESSAGE, (FormatUpdatesMessage(Updates.Results.Message, Updates)));
     }
 
     if (!Updates.Results.AuthenticationError.IsEmpty())
     {
       Message +=
-        FMTLOAD(UPDATE_MESSAGE, (FormatUpdatesMessage(Updates.Results.AuthenticationError)));
+        FMTLOAD(UPDATE_MESSAGE, (FormatUpdatesMessage(Updates.Results.AuthenticationError, Updates)));
     }
     Type = (Updates.Results.Critical ? qtWarning : qtInformation);
   }

+ 1 - 1
source/windows/Setup.h

@@ -14,7 +14,7 @@ THttp * __fastcall CreateHttp();
 void __fastcall GetUpdatesMessage(UnicodeString & Message, bool & New, TQueryType & Type, bool Force);
 bool __fastcall CheckForUpdates(bool CachedResults);
 bool __fastcall QueryUpdates(TUpdatesConfiguration & Updates);
-UnicodeString __fastcall FormatUpdatesMessage(UnicodeString Message);
+UnicodeString __fastcall FormatUpdatesMessage(const UnicodeString & Message, const TUpdatesConfiguration & Updates);
 void __fastcall EnableAutomaticUpdates();
 void __fastcall RegisterForDefaultProtocols();
 void __fastcall UnregisterForProtocols();