diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-08-21 20:06:53 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-08-21 20:06:53 +0000 |
commit | f8847c2493e899ad2e7527803354bc47ba6ac736 (patch) | |
tree | e82d023e33f19bd64e9e8b75dfaa3a1f0b5bff11 | |
parent | d131ea1bc4bce30516a2f9cbb7579f1174f46389 (diff) |
PluginUpdater:
- Implemented "Backup profile after update" option
- minor fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@15007 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/PluginUpdater/PluginUpdater.vcxproj | 7 | ||||
-rw-r--r-- | plugins/PluginUpdater/PluginUpdater.vcxproj.filters | 178 | ||||
-rw-r--r-- | plugins/PluginUpdater/res/Resource.rc | 22 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgListNew.cpp | 50 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgUpdate.cpp | 11 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Events.cpp | 3 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Options.cpp | 27 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/PluginUpdater.cpp | 6 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 1 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/resource.h | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/stdafx.h | 20 |
11 files changed, 263 insertions, 64 deletions
diff --git a/plugins/PluginUpdater/PluginUpdater.vcxproj b/plugins/PluginUpdater/PluginUpdater.vcxproj index 2e54b3f401..4722fed6f1 100644 --- a/plugins/PluginUpdater/PluginUpdater.vcxproj +++ b/plugins/PluginUpdater/PluginUpdater.vcxproj @@ -30,4 +30,11 @@ <Project>{e2a369cd-eda3-414f-8ad0-e732cd7ee68c}</Project>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Image Include="res\btnClose.ico" />
+ <Image Include="res\btnOk.ico" />
+ <Image Include="res\info.ico" />
+ <Image Include="res\menu.ico" />
+ <Image Include="res\PlgList.ico" />
+ </ItemGroup>
</Project>
\ No newline at end of file diff --git a/plugins/PluginUpdater/PluginUpdater.vcxproj.filters b/plugins/PluginUpdater/PluginUpdater.vcxproj.filters index de5ad9f66c..bac4f912ab 100644 --- a/plugins/PluginUpdater/PluginUpdater.vcxproj.filters +++ b/plugins/PluginUpdater/PluginUpdater.vcxproj.filters @@ -1,4 +1,182 @@ <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(ProjectDir)..\..\build\vc.common\common.filters" />
+ <ItemGroup>
+ <ClCompile Include="src\stdafx.cxx">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\checksum.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\DlgListNew.cpp" />
+ <ClCompile Include="src\DlgUpdate.cpp" />
+ <ClCompile Include="src\Events.cpp" />
+ <ClCompile Include="src\Notifications.cpp" />
+ <ClCompile Include="src\Options.cpp" />
+ <ClCompile Include="src\PluginUpdater.cpp" />
+ <ClCompile Include="src\Services.cpp" />
+ <ClCompile Include="src\unzipfile.cpp" />
+ <ClCompile Include="src\Utils.cpp" />
+ <ClCompile Include="src\checksum.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\DlgListNew.cpp" />
+ <ClCompile Include="src\DlgUpdate.cpp" />
+ <ClCompile Include="src\Events.cpp" />
+ <ClCompile Include="src\Notifications.cpp" />
+ <ClCompile Include="src\Options.cpp" />
+ <ClCompile Include="src\PluginUpdater.cpp" />
+ <ClCompile Include="src\Services.cpp" />
+ <ClCompile Include="src\unzipfile.cpp" />
+ <ClCompile Include="src\Utils.cpp" />
+ <ClCompile Include="src\checksum.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\DlgListNew.cpp" />
+ <ClCompile Include="src\DlgUpdate.cpp" />
+ <ClCompile Include="src\Events.cpp" />
+ <ClCompile Include="src\Notifications.cpp" />
+ <ClCompile Include="src\Options.cpp" />
+ <ClCompile Include="src\PluginUpdater.cpp" />
+ <ClCompile Include="src\Services.cpp" />
+ <ClCompile Include="src\unzipfile.cpp" />
+ <ClCompile Include="src\Utils.cpp" />
+ <ClCompile Include="src\checksum.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\DlgListNew.cpp" />
+ <ClCompile Include="src\DlgUpdate.cpp" />
+ <ClCompile Include="src\Events.cpp" />
+ <ClCompile Include="src\Notifications.cpp" />
+ <ClCompile Include="src\Options.cpp" />
+ <ClCompile Include="src\PluginUpdater.cpp" />
+ <ClCompile Include="src\Services.cpp" />
+ <ClCompile Include="src\unzipfile.cpp" />
+ <ClCompile Include="src\Utils.cpp" />
+ <ClCompile Include="src\checksum.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\DlgListNew.cpp" />
+ <ClCompile Include="src\DlgUpdate.cpp" />
+ <ClCompile Include="src\Events.cpp" />
+ <ClCompile Include="src\Notifications.cpp" />
+ <ClCompile Include="src\Options.cpp" />
+ <ClCompile Include="src\PluginUpdater.cpp" />
+ <ClCompile Include="src\Services.cpp" />
+ <ClCompile Include="src\unzipfile.cpp" />
+ <ClCompile Include="src\Utils.cpp" />
+ <ClCompile Include="src\checksum.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\DlgListNew.cpp" />
+ <ClCompile Include="src\DlgUpdate.cpp" />
+ <ClCompile Include="src\Events.cpp" />
+ <ClCompile Include="src\Notifications.cpp" />
+ <ClCompile Include="src\Options.cpp" />
+ <ClCompile Include="src\PluginUpdater.cpp" />
+ <ClCompile Include="src\Services.cpp" />
+ <ClCompile Include="src\unzipfile.cpp" />
+ <ClCompile Include="src\Utils.cpp" />
+ <ClCompile Include="src\checksum.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\DlgListNew.cpp" />
+ <ClCompile Include="src\DlgUpdate.cpp" />
+ <ClCompile Include="src\Events.cpp" />
+ <ClCompile Include="src\Notifications.cpp" />
+ <ClCompile Include="src\Options.cpp" />
+ <ClCompile Include="src\PluginUpdater.cpp" />
+ <ClCompile Include="src\Services.cpp" />
+ <ClCompile Include="src\unzipfile.cpp" />
+ <ClCompile Include="src\Utils.cpp" />
+ <ClCompile Include="src\checksum.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\DlgListNew.cpp" />
+ <ClCompile Include="src\DlgUpdate.cpp" />
+ <ClCompile Include="src\Events.cpp" />
+ <ClCompile Include="src\Notifications.cpp" />
+ <ClCompile Include="src\Options.cpp" />
+ <ClCompile Include="src\PluginUpdater.cpp" />
+ <ClCompile Include="src\Services.cpp" />
+ <ClCompile Include="src\unzipfile.cpp" />
+ <ClCompile Include="src\Utils.cpp" />
+ <ClCompile Include="src\checksum.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\DlgListNew.cpp" />
+ <ClCompile Include="src\DlgUpdate.cpp" />
+ <ClCompile Include="src\Events.cpp" />
+ <ClCompile Include="src\Notifications.cpp" />
+ <ClCompile Include="src\Options.cpp" />
+ <ClCompile Include="src\PluginUpdater.cpp" />
+ <ClCompile Include="src\Services.cpp" />
+ <ClCompile Include="src\unzipfile.cpp" />
+ <ClCompile Include="src\Utils.cpp" />
+ <ClCompile Include="src\checksum.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\DlgListNew.cpp" />
+ <ClCompile Include="src\DlgUpdate.cpp" />
+ <ClCompile Include="src\Events.cpp" />
+ <ClCompile Include="src\Notifications.cpp" />
+ <ClCompile Include="src\Options.cpp" />
+ <ClCompile Include="src\PluginUpdater.cpp" />
+ <ClCompile Include="src\Services.cpp" />
+ <ClCompile Include="src\unzipfile.cpp" />
+ <ClCompile Include="src\Utils.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="src\Notifications.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\resource.h" />
+ <ClInclude Include="src\stdafx.h" />
+ <ClInclude Include="src\Version.h" />
+ <ClInclude Include="src\Notifications.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\resource.h" />
+ <ClInclude Include="src\stdafx.h" />
+ <ClInclude Include="src\Version.h" />
+ <ClInclude Include="src\Notifications.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\resource.h" />
+ <ClInclude Include="src\stdafx.h" />
+ <ClInclude Include="src\Version.h" />
+ <ClInclude Include="src\Notifications.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\resource.h" />
+ <ClInclude Include="src\stdafx.h" />
+ <ClInclude Include="src\Version.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="res\Resource.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ <ResourceCompile Include="res\Version.rc" />
+ <ResourceCompile Include="res\Resource.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ <ResourceCompile Include="res\Version.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="res\menu.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\btnOk.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\btnClose.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\info.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ <Image Include="res\PlgList.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ </ItemGroup>
</Project>
\ No newline at end of file diff --git a/plugins/PluginUpdater/res/Resource.rc b/plugins/PluginUpdater/res/Resource.rc index a4ae5a9748..40ecea8aed 100644 --- a/plugins/PluginUpdater/res/Resource.rc +++ b/plugins/PluginUpdater/res/Resource.rc @@ -52,7 +52,7 @@ BEGIN PUSHBUTTON "Select &none",IDC_SELNONE,175,218,60,14,NOT WS_TABSTOP
END
-IDD_OPT_UPDATENOTIFY DIALOGEX 0, 0, 301, 222
+IDD_OPT_UPDATENOTIFY DIALOGEX 0, 0, 301, 236
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
@@ -60,7 +60,7 @@ BEGIN GROUPBOX "Hotkey",IDC_STATIC,2,0,284,26
CONTROL "Go to Customize -> Hotkeys to change the hotkey",IDC_LINK_HOTKEY,
"Hyperlink",WS_TABSTOP,29,11,249,10
- GROUPBOX "Plugin updates options",IDC_STATIC,1,29,285,60
+ GROUPBOX "Update options",IDC_STATIC,1,29,285,73
CONTROL "On startup",IDC_UPDATEONSTARTUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,44,73,10
CONTROL "(but only once a day)",IDC_ONLYONCEADAY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,92,44,186,10
CONTROL "Every",IDC_UPDATEONPERIOD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,58,52,10
@@ -68,14 +68,16 @@ BEGIN CONTROL "",IDC_PERIODSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,92,56,10,15
COMBOBOX IDC_PERIODMEASURE,114,56,58,30,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
CONTROL "Silent mode",IDC_SILENTMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,72,267,10
- GROUPBOX "Files source",IDC_STATIC,1,92,285,96
- CONTROL "Stable version",IDC_STABLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,11,105,267,10
- CONTROL "Development version (less stable)",IDC_TRUNK,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,11,120,267,10
+ CONTROL "Backup database after update (requires db_autobackups)",IDC_BACKUP,
+ "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,86,267,10
+ GROUPBOX "Files source",IDC_STATIC,2,115,285,96
+ CONTROL "Stable version",IDC_STABLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,128,267,10
+ CONTROL "Development version (less stable)",IDC_TRUNK,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,143,267,10
CONTROL "Development version with debug symbols",IDC_TRUNK_SYMBOLS,
- "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,11,135,267,10
- CONTROL "Custom version",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,11,150,267,10
- EDITTEXT IDC_CUSTOMURL,11,164,267,16,ES_AUTOHSCROLL | WS_DISABLED
- CTEXT "Some component(s) was updated.\nYou need to restart your Miranda to apply installed updates.",IDC_NEEDRESTARTLABEL,11,194,267,15,NOT WS_VISIBLE
+ "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,158,267,10
+ CONTROL "Custom version",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,173,267,10
+ EDITTEXT IDC_CUSTOMURL,12,187,267,16,ES_AUTOHSCROLL | WS_DISABLED
+ CTEXT "Some component(s) was updated.\nYou need to restart your Miranda to apply installed updates.",IDC_NEEDRESTARTLABEL,11,213,267,15,NOT WS_VISIBLE
END
IDD_POPUP DIALOGEX 0, 0, 316, 174
@@ -176,7 +178,7 @@ BEGIN VERTGUIDE, 11
VERTGUIDE, 278
VERTGUIDE, 286
- BOTTOMMARGIN, 214
+ BOTTOMMARGIN, 228
END
IDD_POPUP, DIALOG
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 6dc0558cc8..d144b5cd35 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -423,24 +423,19 @@ void UninitListNew() DestroyWindow(hwndDialog);
}
-INT_PTR ShowListCommand(WPARAM,LPARAM)
+static INT_PTR ShowListCommand(WPARAM,LPARAM)
{
DoGetList();
return 0;
}
-void InitListNew()
-{
- CreateServiceFunction(MS_PU_SHOWLIST, ShowListCommand);
-}
-
void UnloadListNew()
{
if (hListThread)
hListThread = NULL;
}
-INT_PTR ParseUriService(WPARAM wParam, LPARAM lParam)
+static INT_PTR ParseUriService(WPARAM, LPARAM lParam)
{
TCHAR *arg = (TCHAR *)lParam;
if (arg == NULL)
@@ -458,6 +453,9 @@ INT_PTR ParseUriService(WPARAM wParam, LPARAM lParam) p = _tcschr(pluginPath, _T('/'));
if (p) *p = _T('\\');
+ if (GetFileAttributes(pluginPath) != INVALID_FILE_ATTRIBUTES)
+ return 0;
+
ptrT updateUrl(GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
if (!ParseHashes(updateUrl, baseUrl, hashes)) {
@@ -465,30 +463,24 @@ INT_PTR ParseUriService(WPARAM wParam, LPARAM lParam) return 1;
}
- FILELIST *fileList = new FILELIST(1);
+ ServListEntry *hash = hashes.find((ServListEntry*)&pluginPath);
+ if (hash == NULL)
+ return 0;
VARST dirName(_T("%miranda_path%"));
- for (int i = 0; i < hashes.getCount(); i++)
- {
- ServListEntry &hash = hashes[i];
-
- if (mir_tstrcmpi(hash.m_name, pluginPath) == 0)
- {
- TCHAR tszPath[MAX_PATH];
- mir_sntprintf(tszPath, _countof(tszPath), _T("%s\\%s"), dirName, hash.m_name);
-
- FILEINFO *fileInfo = ServerEntryToFileInfo(hash, baseUrl, tszPath);
- fileList->insert(fileInfo);
+ TCHAR tszPath[MAX_PATH];
+ mir_sntprintf(tszPath, _countof(tszPath), _T("%s\\%s"), dirName, hash->m_name);
+ FILEINFO *fileInfo = ServerEntryToFileInfo(*hash, baseUrl, tszPath);
- break;
- }
- }
-
- if (fileList->getCount() == 0) {
- ShowPopup(TranslateT("Plugin Updater"), TranslateT("List is empty."), POPUP_TYPE_INFO);
- delete fileList;
- }
- else CallFunctionAsync(LaunchListDialog, fileList);
+ FILELIST *fileList = new FILELIST(1);
+ fileList->insert(fileInfo);
+ CallFunctionAsync(LaunchListDialog, fileList);
return 0;
-}
\ No newline at end of file +}
+
+void InitListNew()
+{
+ CreateServiceFunction(MODNAME "/ParseUri", ParseUriService);
+ CreateServiceFunction(MS_PU_SHOWLIST, ShowListCommand);
+}
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index b5238f131c..6030a73d4c 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -133,6 +133,9 @@ static void ApplyUpdates(void *param) db_set_b(NULL, MODNAME, DB_SETTING_RESTART_COUNT, 5);
+ if (opts.bBackup)
+ CallService(MS_AB_BACKUP);
+
// 5) Prepare Restart
int rc = MessageBox(hDlg, TranslateT("Update complete. Press Yes to restart Miranda now or No to postpone a restart until the exit."), TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION);
PostMessage(hDlg, WM_CLOSE, 0, 0);
@@ -356,9 +359,9 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM return FALSE;
}
-static void DlgUpdateSilent(void *lParam)
+static void DlgUpdateSilent(void *param)
{
- OBJLIST<FILEINFO> &UpdateFiles = *(OBJLIST<FILEINFO> *)lParam;
+ OBJLIST<FILEINFO> &UpdateFiles = *(OBJLIST<FILEINFO> *)param;
if (UpdateFiles.getCount() == 0) {
delete &UpdateFiles;
return;
@@ -652,6 +655,7 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const strdel(tszNewName + iPos, 1);
}
+#if MIRANDA_VER >= 0x0A00
// No need to hash a file if we are forcing a redownload anyway
if (!opts.bForceRedownload) {
// try to hash the file
@@ -673,6 +677,7 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const }
else
Netlib_LogfT(hNetlibUser, _T("File %s: Forcing redownload"), ffd.cFileName);
+#endif
ptszUrl = item->m_name;
MyCRC = item->m_crc;
@@ -851,7 +856,7 @@ void InitTimer(void *type) LONGLONG interval;
- switch ((int)type) {
+ switch ((INT_PTR)type) {
case 0: // default, plan next check relative to last check
{
time_t now = time(NULL);
diff --git a/plugins/PluginUpdater/src/Events.cpp b/plugins/PluginUpdater/src/Events.cpp index 6781bc4a88..ee9d124113 100644 --- a/plugins/PluginUpdater/src/Events.cpp +++ b/plugins/PluginUpdater/src/Events.cpp @@ -55,10 +55,7 @@ int ModulesLoaded(WPARAM, LPARAM) #if MIRANDA_VER >= 0x0A00
if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
- {
- CreateServiceFunction(MODNAME "/ParseUri", ParseUriService);
AssocMgr_AddNewUrlTypeT("mirpu:", TranslateT("Plugin updater URI scheme"), hInst, IDI_PLGLIST, MODNAME "/ParseUri", 0);
- }
#endif
int iRestartCount = db_get_b(NULL, MODNAME, DB_SETTING_RESTART_COUNT, 2);
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 235b214244..04f563cae2 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -60,11 +60,10 @@ TCHAR* GetDefaultUrl() }
}
-INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
if (opts.bUpdateOnStartup) {
CheckDlgButton(hwndDlg, IDC_UPDATEONSTARTUP, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), TRUE);
@@ -83,11 +82,14 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETRANGE, 0, MAKELONG(99, 1));
SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETPOS, 0, (LPARAM)opts.Period);
- Edit_LimitText(GetDlgItem(hwndDlg, IDC_PERIOD), 2);
+ if (ServiceExists(MS_AB_BACKUP)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BACKUP), TRUE);
+ SetDlgItemText(hwndDlg, IDC_BACKUP, LPGENT("Backup profile after update"));
+ if(opts.bBackup)
+ CheckDlgButton(hwndDlg, IDC_BACKUP, BST_CHECKED);
+ }
- ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 0, TranslateT("hours"));
- ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 1, TranslateT("days"));
- ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), opts.bPeriodMeasure);
+ Edit_LimitText(GetDlgItem(hwndDlg, IDC_PERIOD), 2);
if (db_get_b(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_STABLE), FALSE);
@@ -95,8 +97,13 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
if (UpdateMode == UPDATE_MODE_STABLE)
db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
- SetDlgItemText(hwndDlg,IDC_STABLE,TranslateT("Stable version (incompatible with current development version)"));
+ SetDlgItemText(hwndDlg,IDC_STABLE,LPGENT("Stable version (incompatible with current development version)"));
}
+ TranslateDialogDefault(hwndDlg);
+
+ ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 0, TranslateT("hours"));
+ ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 1, TranslateT("days"));
+ ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), opts.bPeriodMeasure);
switch (GetUpdateMode()) {
case UPDATE_MODE_STABLE:
@@ -129,6 +136,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA // fall through
case IDC_SILENTMODE:
case IDC_ONLYONCEADAY:
+ case IDC_BACKUP:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -203,6 +211,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA db_set_b(NULL, MODNAME, "UpdateOnPeriod", opts.bUpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD));
db_set_b(NULL, MODNAME, "PeriodMeasure", opts.bPeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE)));
db_set_b(NULL, MODNAME, "SilentMode", opts.bSilentMode = IsDlgButtonChecked(hwndDlg, IDC_SILENTMODE));
+ db_set_b(NULL, MODNAME, "Backup", opts.bBackup = IsDlgButtonChecked(hwndDlg, IDC_BACKUP));
TCHAR buffer[3] = {0};
Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), buffer, _countof(buffer));
db_set_dw(NULL, MODNAME, "Period", opts.Period = _ttoi(buffer));
@@ -241,7 +250,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA return FALSE;
}
-INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
@@ -434,7 +443,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) return FALSE;
}
-int OptInit(WPARAM wParam, LPARAM)
+static int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100000000;
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index c030a6376d..a360721322 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -132,15 +132,15 @@ extern "C" __declspec(dllexport) int Load(void) if (-1 == db_get_b(0, MODNAME, DB_SETTING_UPDATE_MODE, -1)) {
ptrT dbvUpdateURL(db_get_tsa(0, MODNAME, DB_SETTING_UPDATE_URL));
if (dbvUpdateURL) {
- if (!_tcscmp(dbvUpdateURL, _T(DEFAULT_UPDATE_URL))) {
+ if (!_tcscmp(dbvUpdateURL, _T(DEFAULT_UPDATE_URL_OLD))) {
db_set_b(0, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
db_unset(0, MODNAME, DB_SETTING_UPDATE_URL);
}
- else if (!_tcscmp(dbvUpdateURL, _T(DEFAULT_UPDATE_URL_TRUNK))) {
+ else if (!_tcscmp(dbvUpdateURL, _T(DEFAULT_UPDATE_URL_TRUNK_OLD))) {
db_set_b(0, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
db_unset(0, MODNAME, DB_SETTING_UPDATE_URL);
}
- else if (!_tcscmp(dbvUpdateURL, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS)_T("/"))) {
+ else if (!_tcscmp(dbvUpdateURL, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS_OLD)_T("/"))) {
db_set_b(0, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
db_unset(0, MODNAME, DB_SETTING_UPDATE_URL);
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index b8bf392a5f..33db2655d8 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -36,6 +36,7 @@ void LoadOptions() opts.bPeriodMeasure = db_get_b(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
opts.bForceRedownload = db_get_b(NULL, MODNAME, DB_SETTING_REDOWNLOAD, 0);
opts.bSilentMode = db_get_b(NULL, MODNAME, "SilentMode", 0);
+ opts.bBackup = db_get_b(NULL, MODNAME, "Backup", 0);
}
#if MIRANDA_VER >= 0x0A00
diff --git a/plugins/PluginUpdater/src/resource.h b/plugins/PluginUpdater/src/resource.h index d4461bd62a..d735fc5065 100644 --- a/plugins/PluginUpdater/src/resource.h +++ b/plugins/PluginUpdater/src/resource.h @@ -49,7 +49,7 @@ #define IDC_CUSTOM 1046
#define IDC_SILENTMODE 1047
#define IDC_NEEDRESTARTLABEL 1048
-#define IDC_DONTSWITCHTOSTABLE 1049
+#define IDC_BACKUP 1049
#define IDC_MSG_BOXES 40071
#define IDC_ERRORS 40072
#define IDC_INFO_MESSAGES 40073
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index eda11fe2b8..a4376d5101 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -39,6 +39,7 @@ Boston, MA 02111-1307, USA. #include <m_assocmgr.h>
#include <win2k.h>
#include <m_pluginupdater.h>
+#include <m_autobackups.h>
#include <m_folders.h>
@@ -85,7 +86,7 @@ typedef OBJLIST<FILEINFO> FILELIST; extern struct PlugOptions
{
- BYTE bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bForceRedownload, bSilentMode;
+ BYTE bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bForceRedownload, bSilentMode, bBackup;
BOOL bSilent;
BYTE bPeriodMeasure;
@@ -102,12 +103,21 @@ extern struct PlugOptions #else
#define DEFAULT_ONLYONCEADAY 1
#endif
+#ifdef _WIN64
+#define PLATFORM "64"
+#else
+#define PLATFORM "32"
+#endif
-#define DEFAULT_UPDATE_URL "http://miranda-ng.org/distr/stable/x%platform%"
-#define DEFAULT_UPDATE_URL_TRUNK "http://miranda-ng.org/distr/x%platform%"
-#define DEFAULT_UPDATE_URL_TRUNK_SYMBOLS "http://miranda-ng.org/distr/pdb_x%platform%"
+#define DEFAULT_UPDATE_URL "http://miranda-ng.org/distr/stable/x" PLATFORM
+#define DEFAULT_UPDATE_URL_TRUNK "http://miranda-ng.org/distr/x" PLATFORM
+#define DEFAULT_UPDATE_URL_TRUNK_SYMBOLS "http://miranda-ng.org/distr/pdb_x" PLATFORM
#define PLUGIN_INFO_URL _T("http://miranda-ng.org/p/%s")
+#define DEFAULT_UPDATE_URL_OLD "http://miranda-ng.org/distr/stable/x%platform%"
+#define DEFAULT_UPDATE_URL_TRUNK_OLD "http://miranda-ng.org/distr/x%platform%"
+#define DEFAULT_UPDATE_URL_TRUNK_SYMBOLS_OLD "http://miranda-ng.org/distr/pdb_x%platform%"
+
#define UPDATE_MODE_CUSTOM 0
#define UPDATE_MODE_STABLE 1
#define UPDATE_MODE_TRUNK 2
@@ -216,8 +226,6 @@ void InitTimer(void *type); bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath,bool ch);
void strdel(TCHAR *parBuffer, int len);
-INT_PTR ParseUriService(WPARAM wParam, LPARAM lParam);
-
///////////////////////////////////////////////////////////////////////////////
int CalculateModuleHash(const TCHAR *tszFileName, char *dest);
|