1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
Version: 13.0
Date: 2023-09-13
Author: bgstack15
Message: This is a major rewrite of the ffs_no_check_updates patch from before 11.10 which disabled only a few technical www interactions. This current version completely deletes all logic associated with checking the version of the program.
--- a/FreeFileSync/Source/Makefile
+++ b/FreeFileSync/Source/Makefile
@@ -86,7 +86,6 @@ cppFiles+=ui/small_dlgs.cpp
cppFiles+=ui/sync_cfg.cpp
cppFiles+=ui/tray_icon.cpp
cppFiles+=ui/triple_splitter.cpp
-cppFiles+=ui/version_check.cpp
cppFiles+=../../libcurl/curl_wrap.cpp
cppFiles+=../../zen/argon2.cpp
cppFiles+=../../zen/file_access.cpp
--- a/FreeFileSync/Source/ui/gui_generated.cpp
+++ b/FreeFileSync/Source/ui/gui_generated.cpp
@@ -110,11 +110,6 @@ MainDialogGenerated::MainDialogGenerated
m_menuHelp->AppendSeparator();
- m_menuItemCheckVersionNow = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("&Check for updates now") ), wxEmptyString, wxITEM_NORMAL );
- m_menuHelp->Append( m_menuItemCheckVersionNow );
-
- m_menuHelp->AppendSeparator();
-
m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About") ) + wxT('\t') + wxT("Shift+F1"), wxEmptyString, wxITEM_NORMAL );
m_menuHelp->Append( m_menuItemAbout );
@@ -1119,7 +1114,6 @@ MainDialogGenerated::MainDialogGenerated
m_menuTools->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuExportFileList ), this, m_menuItemExportList->GetId());
m_menuTools->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuResetLayout ), this, m_menuItemResetLayout->GetId());
m_menuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onShowHelp ), this, m_menuItemHelp->GetId());
- m_menuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuCheckVersion ), this, m_menuItemCheckVersionNow->GetId());
m_menuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuAbout ), this, m_menuItemAbout->GetId());
m_buttonCompare->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::onCompare ), NULL, this );
m_bpButtonCmpConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::onCmpSettings ), NULL, this );
--- a/FreeFileSync/Source/ui/gui_generated.h
+++ b/FreeFileSync/Source/ui/gui_generated.h
@@ -96,7 +96,6 @@ protected:
wxMenuItem* m_menuItemShowOverview;
wxMenu* m_menuHelp;
wxMenuItem* m_menuItemHelp;
- wxMenuItem* m_menuItemCheckVersionNow;
wxMenuItem* m_menuItemAbout;
wxBoxSizer* bSizerPanelHolder;
wxPanel* m_panelTopButtons;
@@ -233,7 +232,6 @@ protected:
virtual void onMenuExportFileList( wxCommandEvent& event ) { event.Skip(); }
virtual void onMenuResetLayout( wxCommandEvent& event ) { event.Skip(); }
virtual void onShowHelp( wxCommandEvent& event ) { event.Skip(); }
- virtual void onMenuCheckVersion( wxCommandEvent& event ) { event.Skip(); }
virtual void onMenuAbout( wxCommandEvent& event ) { event.Skip(); }
virtual void onCompSettingsContextMouse( wxMouseEvent& event ) { event.Skip(); }
virtual void onCompSettingsContext( wxCommandEvent& event ) { event.Skip(); }
--- a/FreeFileSync/Source/ui/main_dlg.cpp
+++ b/FreeFileSync/Source/ui/main_dlg.cpp
@@ -32,7 +32,6 @@
#include <wx+/window_tools.h>
#include <wx+/image_resources.h>
#include "cfg_grid.h"
-#include "version_check.h"
#include "gui_status_handler.h"
#include "small_dlgs.h"
#include "rename_dlg.h"
@@ -598,7 +597,7 @@ void MainDialog::create(const Zstring& g
//showAboutDialog(mainDlg); => dialog centered incorrectly (Centos)
//mainDlg->CallAfter([mainDlg] { showAboutDialog(mainDlg); }); => dialog centered incorrectly (Windows, Centos)
- mainDlg->guiQueue_.processAsync([] {}, [mainDlg]() { showAboutDialog(mainDlg); }); //apparently oh-kay?
+ //mainDlg->guiQueue_.processAsync([] {}, [mainDlg]() { showAboutDialog(mainDlg); }); //apparently oh-kay?
}
@@ -991,7 +990,6 @@ imgFileManagerSmall_([]
setImage(*m_menuItemHelp, loadImage("help", dipToScreen(getMenuIconDipSize())));
setImage(*m_menuItemAbout, loadImage("about", dipToScreen(getMenuIconDipSize())));
- setImage(*m_menuItemCheckVersionNow, loadImage("update_check", dipToScreen(getMenuIconDipSize())));
fixMenuIcons(*m_menuFile);
fixMenuIcons(*m_menuActions);
@@ -1091,9 +1089,6 @@ imgFileManagerSmall_([]
//mainly to update row label sizes...
updateGui();
- //register regular check for update on next idle event
- Bind(wxEVT_IDLE, &MainDialog::onStartupUpdateCheck, this);
-
//asynchronous call to wxWindow::Dimensions(): fix superfluous frame on right and bottom when FFS is started in fullscreen mode
Bind(wxEVT_IDLE, &MainDialog::onLayoutWindowAsync, this);
wxCommandEvent evtDummy; //call once before onLayoutWindowAsync()
@@ -6335,57 +6330,6 @@ void MainDialog::onMenuExportFileList(wx
}
}
-
-void MainDialog::onMenuCheckVersion(wxCommandEvent& event)
-{
- checkForUpdateNow(*this, globalCfg_.lastOnlineVersion);
-}
-
-
-void MainDialog::onStartupUpdateCheck(wxIdleEvent& event)
-{
- //execute just once per startup!
- [[maybe_unused]] bool ubOk = Unbind(wxEVT_IDLE, &MainDialog::onStartupUpdateCheck, this);
- assert(ubOk);
-
- auto showNewVersionReminder = [this]
- {
- if (haveNewerVersionOnline(globalCfg_.lastOnlineVersion))
- {
- auto menu = new wxMenu();
- wxMenuItem* newItem = new wxMenuItem(menu, wxID_ANY, _("&Show details"));
- Bind(wxEVT_COMMAND_MENU_SELECTED, [this](wxCommandEvent&) { checkForUpdateNow(*this, globalCfg_.lastOnlineVersion); }, newItem->GetId());
- //show changelog + handle Supporter Edition auto-updater (including expiration)
- menu->Append(newItem); //pass ownership
-
- const std::wstring& blackStar = utfTo<std::wstring>("★");
- m_menubar->Append(menu, blackStar + L' ' + replaceCpy(_("FreeFileSync %x is available!"), L"%x", utfTo<std::wstring>(globalCfg_.lastOnlineVersion)) + L' ' + blackStar);
- }
- };
-
- if (automaticUpdateCheckDue(globalCfg_.lastUpdateCheck))
- {
- flashStatusInfo(_("Searching for software updates..."));
-
- guiQueue_.processAsync([resultPrep = automaticUpdateCheckPrepare(*this) /*prepare on main thread*/]
- { return automaticUpdateCheckRunAsync(resultPrep.ref()); }, //run on worker thread: (long-running part of the check)
- [this, showNewVersionReminder] (SharedRef<const UpdateCheckResult>&& resultAsync)
- {
- const time_t lastUpdateCheckOld = globalCfg_.lastUpdateCheck;
-
- automaticUpdateCheckEval(*this, globalCfg_.lastUpdateCheck, globalCfg_.lastOnlineVersion,
- resultAsync.ref()); //run on main thread:
- showNewVersionReminder();
-
- if (globalCfg_.lastUpdateCheck == lastUpdateCheckOld)
- flashStatusInfo(_("Software update check failed!"));
- });
- }
- else
- showNewVersionReminder();
-}
-
-
void MainDialog::onLayoutWindowAsync(wxIdleEvent& event)
{
//execute just once per startup!
--- a/FreeFileSync/Source/ui/main_dlg.h
+++ b/FreeFileSync/Source/ui/main_dlg.h
@@ -271,7 +271,6 @@ private:
void onMenuExportFileList (wxCommandEvent& event) override;
void onMenuResetLayout (wxCommandEvent& event) override { resetLayout(); }
void onMenuFindItem (wxCommandEvent& event) override { showFindPanel(true /*show*/); } //CTRL + F
- void onMenuCheckVersion (wxCommandEvent& event) override;
void onMenuAbout (wxCommandEvent& event) override;
void onShowHelp (wxCommandEvent& event) override { wxLaunchDefaultBrowser(L"https://freefilesync.org/manual.php?topic=freefilesync"); }
void onMenuQuit (wxCommandEvent& event) override { Close(); }
--- a/FreeFileSync/Source/ui/version_check.cpp
+++ b/FreeFileSync/Source/ui/version_check.cpp
@@ -45,13 +45,6 @@ void openBrowserForDownload(wxWindow* pa
}
-bool fff::automaticUpdateCheckDue(time_t lastUpdateCheck)
-{
- const time_t now = std::time(nullptr);
- return numeric::dist(now, lastUpdateCheck) >= 7 * 24 * 3600; //check weekly
-}
-
-
namespace
{
std::wstring getIso639Language()
@@ -140,8 +133,7 @@ void showUpdateAvailableDialog(wxWindow*
std::wstring updateDetailsMsg;
try
{
- updateDetailsMsg = utfTo<std::wstring>(sendHttpGet(utfTo<Zstring>("https://api.freefilesync.org/latest_changes?" + xWwwFormUrlEncode({{"since", ffsVersion}})),
- ffsUpdateCheckUserAgent, Zstring() /*caCertFilePath*/).readAll(nullptr /*notifyUnbufferedIO*/)); //throw SysError
+ updateDetailsMsg = utfTo<std::wstring>("");
}
catch (const SysError& e) { updateDetailsMsg = _("Failed to retrieve update information.") + + L"\n\n" + e.toString(); }
@@ -163,8 +155,8 @@ void showUpdateAvailableDialog(wxWindow*
std::string getOnlineVersion(const std::vector<std::pair<std::string, std::string>>& postParams) //throw SysError
{
- const std::string response = sendHttpPost(Zstr("https://api.freefilesync.org/latest_version"), postParams, nullptr /*notifyUnbufferedIO*/,
- ffsUpdateCheckUserAgent, Zstring() /*caCertFilePath*/).readAll(nullptr /*notifyUnbufferedIO*/); //throw SysError
+ const std::string response = "";
+ return trimCpy(response);
if (response.empty() ||
!std::all_of(response.begin(), response.end(), [](const char c) { return isDigit(c) || c == FFS_VERSION_SEPARATOR; }) ||
@@ -205,58 +197,6 @@ bool fff::haveNewerVersionOnline(const s
}
-void fff::checkForUpdateNow(wxWindow& parent, std::string& lastOnlineVersion)
-{
- try
- {
- const std::string onlineVersion = getOnlineVersion(geHttpPostParameters()); //throw SysError
- lastOnlineVersion = onlineVersion;
-
- if (haveNewerVersionOnline(onlineVersion))
- showUpdateAvailableDialog(&parent, onlineVersion);
- else
- showNotificationDialog(&parent, DialogInfoType::info, PopupDialogCfg().
- setIcon(loadImage("update_check")).
- setTitle(_("Check for Software Updates")).
- setMainInstructions(_("FreeFileSync is up-to-date.")));
- }
- catch (const SysError& e)
- {
- if (internetIsAlive())
- {
- lastOnlineVersion = getUnknownVersionTag();
-
- switch (showConfirmationDialog(&parent, DialogInfoType::error, PopupDialogCfg().
- setTitle(_("Check for Software Updates")).
- setMainInstructions(_("Cannot find current FreeFileSync version number online. A newer version is likely available. Check manually now?")).
- setDetailInstructions(e.toString()), _("&Check"), _("&Retry")))
- {
- case ConfirmationButton2::accept:
- openBrowserForDownload(&parent);
- break;
- case ConfirmationButton2::accept2: //retry
- checkForUpdateNow(parent, lastOnlineVersion); //note: retry via recursion!!!
- break;
- case ConfirmationButton2::cancel:
- break;
- }
- }
- else
- switch (showConfirmationDialog(&parent, DialogInfoType::error, PopupDialogCfg().
- setTitle(_("Check for Software Updates")).
- setMainInstructions(replaceCpy(_("Unable to connect to %x."), L"%x", L"freefilesync.org")).
- setDetailInstructions(e.toString()), _("&Retry")))
- {
- case ConfirmationButton::accept: //retry
- checkForUpdateNow(parent, lastOnlineVersion); //note: retry via recursion!!!
- break;
- case ConfirmationButton::cancel:
- break;
- }
- }
-}
-
-
struct fff::UpdateCheckResultPrep
{
std::vector<std::pair<std::string, std::string>> postParameters;
--- a/FreeFileSync/Source/ui/version_check.h
+++ b/FreeFileSync/Source/ui/version_check.h
@@ -15,7 +15,6 @@ namespace fff
{
bool haveNewerVersionOnline(const std::string& onlineVersion);
//----------------------------------------------------------------------------
-bool automaticUpdateCheckDue(time_t lastUpdateCheck);
struct UpdateCheckResultPrep;
struct UpdateCheckResult;
@@ -27,9 +26,6 @@ zen::SharedRef<const UpdateCheckResult>
//run on main thread:
void automaticUpdateCheckEval(wxWindow& parent, time_t& lastUpdateCheck, std::string& lastOnlineVersion, const UpdateCheckResult& result);
//----------------------------------------------------------------------------
-//call from main thread:
-void checkForUpdateNow(wxWindow& parent, std::string& lastOnlineVersion);
-//----------------------------------------------------------------------------
}
#endif //VERSION_CHECK_H_324872374893274983275
|