From 30fcf9ef16d99490b936791ca58997920e0ea98f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 1 Aug 2012 21:15:42 +0000 Subject: UpdateURL setting removed from the interface git-svn-id: http://svn.miranda-ng.org/main/trunk@1317 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PackUpdater/res/Resource.rc | 17 +++++++---------- plugins/PackUpdater/src/Common.h | 4 ++-- plugins/PackUpdater/src/Options.cpp | 18 ------------------ plugins/PackUpdater/src/PackUpdater.cpp | 1 + plugins/PackUpdater/src/Utils.cpp | 26 +++++++++----------------- plugins/PackUpdater/src/resource.h | 2 -- 6 files changed, 19 insertions(+), 49 deletions(-) diff --git a/plugins/PackUpdater/res/Resource.rc b/plugins/PackUpdater/res/Resource.rc index 338245b451..157ef25aa7 100644 --- a/plugins/PackUpdater/res/Resource.rc +++ b/plugins/PackUpdater/res/Resource.rc @@ -63,30 +63,28 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN END -IDD_OPT_UPDATENOTIFY DIALOGEX 0, 0, 262, 181 +IDD_OPT_UPDATENOTIFY DIALOGEX 0, 0, 262, 162 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Pack update options",IDC_STATIC,2,27,253,86 + GROUPBOX "Pack update options",IDC_STATIC,1,27,253,60 CONTROL "On startup",IDC_UPDATEONSTARTUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,44,52,10 CONTROL "Remind about not installed pack update",IDC_REMINDER, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,72,198,10 GROUPBOX "Hotkey",IDC_STATIC,2,0,253,26 CONTROL "Go to Customize -> Hotkeys to change the hotkey",IDC_LINK_HOTKEY, "Hyperlink",WS_TABSTOP,9,11,199,10 - CONTROL "Message boxes",IDC_MSG_BOXES2,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,8,126,79,10 - CONTROL "Errors",IDC_ERRORS2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,136,57,10 - CONTROL "Info messages",IDC_INFO_MESSAGES2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,146,80,10 - CONTROL "Progress dialogs",IDC_PROGR_DLG2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,157,80,10 + CONTROL "Message boxes",IDC_MSG_BOXES2,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,8,101,79,10 + CONTROL "Errors",IDC_ERRORS2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,114,57,10 + CONTROL "Info messages",IDC_INFO_MESSAGES2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,127,80,10 + CONTROL "Progress dialogs",IDC_PROGR_DLG2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,140,80,10 CONTROL "Every",IDC_UPDATEONPERIOD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,58,52,10 EDITTEXT IDC_PERIOD,65,56,28,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED 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 "(but only once a day)",IDC_ONLYONCEADAY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,92,44,161,10 - GROUPBOX "Notifications",IDC_NOTIFY2,1,115,253,58 - RTEXT "Update File URL:",IDC_STATIC,7,86,59,8 - EDITTEXT IDC_UPDATE_URL,69,84,177,14,ES_AUTOHSCROLL + GROUPBOX "Notifications",IDC_NOTIFY2,3,90,253,67 END IDD_POPUP DIALOGEX 0, 0, 316, 182 @@ -185,7 +183,6 @@ BEGIN IDD_OPT_UPDATENOTIFY, DIALOG BEGIN - BOTTOMMARGIN, 95 END IDD_POPUP, DIALOG diff --git a/plugins/PackUpdater/src/Common.h b/plugins/PackUpdater/src/Common.h index a72e52ce6c..f41ef35d66 100644 --- a/plugins/PackUpdater/src/Common.h +++ b/plugins/PackUpdater/src/Common.h @@ -93,9 +93,9 @@ struct PopupDataText #define DEFAULT_PERIODMEASURE 1 #ifdef WIN32 - #define DEFAULT_UPDATE_URL "http://nightly.miranda.im/x32/" + #define DEFAULT_UPDATE_URL "http://nightly.miranda.im/x32" #else - #define DEFAULT_UPDATE_URL "http://nightly.miranda.im/x64/" + #define DEFAULT_UPDATE_URL "http://nightly.miranda.im/x64" #endif #define IDINFO 3 diff --git a/plugins/PackUpdater/src/Options.cpp b/plugins/PackUpdater/src/Options.cpp index 9e09732ee6..1966aceb49 100644 --- a/plugins/PackUpdater/src/Options.cpp +++ b/plugins/PackUpdater/src/Options.cpp @@ -70,19 +70,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA CheckDlgButton(hwndDlg, (i+1029), (DBGetContactSettingByte(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED); } } - - { - DBVARIANT dbVar; - if ( !DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar)) { - SetDlgItemText(hwndDlg, IDC_UPDATE_URL, dbVar.ptszVal); - DBFreeVariant(&dbVar); - } - else { - std::tstring url = _T(DEFAULT_UPDATE_URL); url.append( _T("hashes.txt")); - SetDlgItemText(hwndDlg, IDC_UPDATE_URL, url.c_str()); - DBWriteContactSettingTString(NULL, MODNAME, "UpdateURL", _T(DEFAULT_UPDATE_URL)); - } - } return TRUE; case WM_COMMAND: @@ -129,7 +116,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case IDC_ERRORS2: case IDC_INFO_MESSAGES2: case IDC_PROGR_DLG2: - case IDC_UPDATE_URL: if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus()) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; @@ -169,10 +155,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA DBWriteContactSettingByte(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i+1029)))); } } - - TCHAR buf[MAX_PATH]; - GetDlgItemText(hwndDlg, IDC_UPDATE_URL, buf, SIZEOF(buf)); - DBWriteContactSettingTString(NULL, MODNAME, "UpdateURL", buf); } break; } diff --git a/plugins/PackUpdater/src/PackUpdater.cpp b/plugins/PackUpdater/src/PackUpdater.cpp index 7886c1b86f..5d1af1b1cc 100644 --- a/plugins/PackUpdater/src/PackUpdater.cpp +++ b/plugins/PackUpdater/src/PackUpdater.cpp @@ -73,6 +73,7 @@ extern "C" __declspec(dllexport) int Load(void) CLISTMENUITEM mi = { 0 }; mi.cbSize = sizeof(mi); mi.position = -0x7FFFFFFF; + mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = Skin_GetIconHandle("check_update"); mi.pszName = LPGEN("Check for pack updates"); mi.pszService = MODNAME"/CheckUpdates"; diff --git a/plugins/PackUpdater/src/Utils.cpp b/plugins/PackUpdater/src/Utils.cpp index 2ed3362b62..b3a177b41c 100644 --- a/plugins/PackUpdater/src/Utils.cpp +++ b/plugins/PackUpdater/src/Utils.cpp @@ -194,7 +194,7 @@ BOOL IsPluginDisabled(const char *filename) ///////////////////////////////////////////////////////////////////////////////////////// -static void ScanFolder(const TCHAR* tszFolder, hashMap& hashes, vector& UpdateFiles) +static void ScanFolder(const TCHAR* tszFolder, const TCHAR* tszBaseUrl, hashMap& hashes, vector& UpdateFiles) { TCHAR tszMask[MAX_PATH], tszFileBack[MAX_PATH]; mir_sntprintf(tszMask, SIZEOF(tszMask), _T("%s\\*"), tszFolder); @@ -211,7 +211,7 @@ static void ScanFolder(const TCHAR* tszFolder, hashMap& hashes, vector if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { mir_sntprintf(tszMask, SIZEOF(tszMask), _T("%s\\%s"), tszFolder, ffd.cFileName); - ScanFolder(tszMask, hashes, UpdateFiles); + ScanFolder(tszMask, tszBaseUrl, hashes, UpdateFiles); continue; } @@ -252,7 +252,7 @@ static void ScanFolder(const TCHAR* tszFolder, hashMap& hashes, vector _tcscpy(FileInfo.tszDescr, ffd.cFileName); *p = 0; - mir_sntprintf(FileInfo.File.tszDownloadURL, SIZEOF(FileInfo.File.tszDownloadURL), _T("%s%s.zip"), _T(DEFAULT_UPDATE_URL), ffd.cFileName); + mir_sntprintf(FileInfo.File.tszDownloadURL, SIZEOF(FileInfo.File.tszDownloadURL), _T("%s/%s.zip"), tszBaseUrl, ffd.cFileName); _tcslwr(FileInfo.File.tszDownloadURL); mir_sntprintf(FileInfo.File.tszDiskPath, SIZEOF(FileInfo.File.tszDiskPath), _T("%s\\%s.zip"), tszFileBack, ffd.cFileName); @@ -281,23 +281,15 @@ static void CheckUpdates(void *) // Load files info if (DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar)) { // URL is not set - LPCTSTR Title=TranslateT("Pack Updater"); - LPCTSTR Text = TranslateT("URL for checking updates not found."); - if (ServiceExists(MS_POPUP_ADDPOPUPEX) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) { - Number = 1; - show_popup(0, Title, Text, Number, 0); - } - else if (DBGetContactSettingByte(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED)) - MessageBox(NULL, Text, Title, MB_ICONSTOP); - DBFreeVariant(&dbVar); - CheckThread = NULL; - return; + DBWriteContactSettingString(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL); + DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar); } + TCHAR* tszBaseUrl = NEWTSTR_ALLOCA(dbVar.ptszVal); + DBFreeVariant(&dbVar); // Download version info FILEURL *pFileUrl = (FILEURL *)mir_alloc(sizeof(*pFileUrl)); - lstrcpyn(pFileUrl->tszDownloadURL, dbVar.ptszVal, SIZEOF(pFileUrl->tszDownloadURL)); - DBFreeVariant(&dbVar); + mir_sntprintf(pFileUrl->tszDownloadURL, SIZEOF(pFileUrl->tszDownloadURL), _T("%s/hashes.txt"), tszBaseUrl); mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\tmp.ini"), tszRoot); lstrcpyn(pFileUrl->tszDiskPath, tszBuff, SIZEOF(pFileUrl->tszDiskPath)); lstrcpyn(tszTmpIni, tszBuff, SIZEOF(tszTmpIni)); @@ -331,7 +323,7 @@ static void CheckUpdates(void *) DeleteFile(tszTmpIni); TCHAR *dirname = Utils_ReplaceVarsT(_T("%miranda_path%")); - ScanFolder(dirname, hashes, UpdateFiles); + ScanFolder(dirname, tszBaseUrl, hashes, UpdateFiles); mir_free(dirname); // Show dialog diff --git a/plugins/PackUpdater/src/resource.h b/plugins/PackUpdater/src/resource.h index 2f9b44cd8c..001732cbf9 100644 --- a/plugins/PackUpdater/src/resource.h +++ b/plugins/PackUpdater/src/resource.h @@ -54,8 +54,6 @@ #define IDC_PERIOD 1038 #define IDC_PERIODSPIN 1039 #define IDC_PERIODMEASURE 1040 -#define IDC_EDIT1 1041 -#define IDC_UPDATE_URL 1041 #define IDC_MSG_BOXES 40071 #define IDC_ERRORS 40072 #define IDC_INFO_MESSAGES 40073 -- cgit v1.2.3