summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-10-01 12:57:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-10-01 12:57:17 +0000
commit5e64645f8c037b482c5f75d48300ccdac92ebb02 (patch)
treedb898e588007ee12614f0b42d5c6761f596624cf /plugins/PluginUpdater/src
parent4d52c4f9c25fd47d1ab49a5f9606395c78e7d962 (diff)
- update URL moved to the options dialog;
git-svn-id: http://svn.miranda-ng.org/main/trunk@1742 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src')
-rw-r--r--plugins/PluginUpdater/src/Common.h3
-rw-r--r--plugins/PluginUpdater/src/Options.cpp37
-rw-r--r--plugins/PluginUpdater/src/resource.h11
3 files changed, 46 insertions, 5 deletions
diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h
index 110e32234d..adb92c447f 100644
--- a/plugins/PluginUpdater/src/Common.h
+++ b/plugins/PluginUpdater/src/Common.h
@@ -97,7 +97,8 @@ struct PlugOptions
#define DEFAULT_PERIOD 1
#define DEFAULT_PERIODMEASURE 1
-#define DEFAULT_UPDATE_URL "http://miranda-ng.org/distr/stable/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 IDINFO 3
#define IDDOWNLOAD 4
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index d710de7124..422502cbaf 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -34,6 +34,8 @@ LRESULT CALLBACK MyEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara
INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ DBVARIANT dbv;
+
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -56,6 +58,24 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), opts.bPeriodMeasure);
CheckDlgButton(hwndDlg, IDC_UPDATEICONS, opts.bUpdateIcons);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
+ if ( DBGetContactSettingString(NULL, MODNAME, "UpdateURL", &dbv)) {
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL));
+ CheckDlgButton(hwndDlg, IDC_STABLE, TRUE);
+ }
+ else {
+ SetDlgItemTextA(hwndDlg, IDC_CUSTOMURL, dbv.pszVal);
+ if ( !strcmp(dbv.pszVal, DEFAULT_UPDATE_URL))
+ CheckDlgButton(hwndDlg, IDC_STABLE, TRUE);
+ else if ( !strcmp(dbv.pszVal, DEFAULT_UPDATE_URL_TRUNK))
+ CheckDlgButton(hwndDlg, IDC_TRUNK, TRUE);
+ else {
+ CheckDlgButton(hwndDlg, IDC_CUSTOM, TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
+ }
+ db_free(&dbv);
+ }
return TRUE;
case WM_COMMAND:
@@ -79,6 +99,13 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
}
break;
+ case IDC_TRUNK:
+ case IDC_STABLE:
+ case IDC_CUSTOM:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), IsDlgButtonChecked(hwndDlg, IDC_CUSTOM));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
case IDC_PERIODMEASURE:
if (HIWORD(wParam) == CBN_SELCHANGE)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -127,6 +154,16 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
DBWriteContactSettingDword(NULL, MODNAME, "Period", opts.Period);
opts.bUpdateIcons = IsDlgButtonChecked(hwndDlg, IDC_UPDATEICONS);
DBWriteContactSettingByte(NULL, MODNAME, "UpdateIcons", opts.bUpdateIcons);
+
+ if ( IsDlgButtonChecked(hwndDlg, IDC_STABLE))
+ db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL);
+ else if ( IsDlgButtonChecked(hwndDlg, IDC_TRUNK))
+ db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL_TRUNK);
+ else {
+ char szUrl[100];
+ GetDlgItemTextA(hwndDlg, IDC_CUSTOMURL, szUrl, SIZEOF(szUrl));
+ db_set_s(NULL, MODNAME, "UpdateURL", szUrl);
+ }
}
break;
}
diff --git a/plugins/PluginUpdater/src/resource.h b/plugins/PluginUpdater/src/resource.h
index aa0c81abbf..2f940e3fee 100644
--- a/plugins/PluginUpdater/src/resource.h
+++ b/plugins/PluginUpdater/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by D:\Myranda\plugins\PluginUpdater\res\Resource.rc
+// Used by C:\Myranda\plugins\PluginUpdater\res\Resource.rc
//
#define IDI_MENU 101
#define IDD_UPDATE 102
@@ -48,7 +48,10 @@
#define IDC_PERIOD 1038
#define IDC_PERIODSPIN 1039
#define IDC_PERIODMEASURE 1040
-#define IDC_EDIT1 1042
+#define IDC_CUSTOMURL 1042
+#define IDC_STABLE 1043
+#define IDC_TRUNK 1044
+#define IDC_CUSTOM 1045
#define IDC_MSG_BOXES 40071
#define IDC_ERRORS 40072
#define IDC_INFO_MESSAGES 40073
@@ -63,12 +66,12 @@
#define IDC_PROGR_DLG_BG 42074
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 110
#define _APS_NEXT_COMMAND_VALUE 40075
-#define _APS_NEXT_CONTROL_VALUE 1043
+#define _APS_NEXT_CONTROL_VALUE 1044
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif