From ae502af2aca3fa3409f0b9833bbfc1719a296e04 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 14 Jun 2014 15:38:59 +0000 Subject: DBEditor: Even more proper capitalization :) git-svn-id: http://svn.miranda-ng.org/main/trunk@9468 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/DbEditorPP/src/deletemodule.cpp | 45 ++++++++++++++++----------------- plugins/DbEditorPP/src/exportimport.cpp | 40 +++++++++++++++++++---------- 2 files changed, 48 insertions(+), 37 deletions(-) (limited to 'plugins/DbEditorPP/src') diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index 394d4added..572502a4e2 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -3,41 +3,40 @@ static int working; static HWND hwnd2Delete = NULL; -int deleteModule(char* module, MCONTACT hContact, int fromMenu) +int deleteModule(char *module, MCONTACT hContact, int fromMenu) { - char msg[1024]; - ModuleSettingLL settinglist; - ModSetLinkLinkItem *setting; - - if (!module) return 0; + if (!module) + return 0; - if (!fromMenu) { + if (!fromMenu && db_get_b(NULL,modname, "WarnOnDelete",1)) { + char msg[1024]; mir_snprintf(msg, SIZEOF(msg), Translate("Are you sure you want to delete module \"%s\"?"), module); - if (db_get_b(NULL,modname, "WarnOnDelete",1)) - if (MessageBox(0,msg, Translate("Confirm Module Deletion"), MB_YESNO|MB_ICONEXCLAMATION) == IDNO) - return 0; + if (MessageBox(0,msg, Translate("Confirm module deletion"), MB_YESNO|MB_ICONEXCLAMATION) == IDNO) + return 0; } - if (!EnumSettings(hContact,module,&settinglist)) return 0; + ModuleSettingLL settinglist; + if (!EnumSettings(hContact,module,&settinglist)) + return 0; - setting = settinglist.first; - while (setting) - { + for (ModSetLinkLinkItem *setting = settinglist.first; setting; setting = setting->next) { db_unset(hContact, module, setting->name); - setting = setting->next; } + FreeModuleSettingLL(&settinglist); return 1; } -void __cdecl PopulateModuleDropListThreadFunc(LPVOID di) +void __cdecl PopulateModuleDropListThreadFunc(void *di) { HWND hwnd = (HWND)di; ModuleSettingLL msll; - ModSetLinkLinkItem *module; + if (!EnumModules(&msll)) { + DestroyWindow(hwnd); + return; + } int moduleEmpty; - if (!EnumModules(&msll)) DestroyWindow(hwnd); - module = msll.first; + ModSetLinkLinkItem *module = msll.first; while (module && working) { moduleEmpty = 1; // check the null @@ -60,7 +59,7 @@ void __cdecl PopulateModuleDropListThreadFunc(LPVOID di) } SendDlgItemMessage(hwnd,IDC_CONTACTS,CB_SETCURSEL,0,0); FreeModuleSettingLL(&msll); - SetWindowText(hwnd,Translate("Delete module from Database")); + SetWindowText(hwnd,Translate("Delete module from database")); EnableWindow(GetDlgItem(hwnd,IDC_CONTACTS),1); EnableWindow(GetDlgItem(hwnd,IDOK),1); EnableWindow(GetDlgItem(hwnd,IDCANCEL),1); @@ -75,11 +74,11 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { switch(msg) { case WM_INITDIALOG: - SetWindowText(hwnd,Translate("Delete module from Database... Loading")); + SetWindowText(hwnd,Translate("Delete module from database... Loading")); EnableWindow(GetDlgItem(hwnd,IDC_CONTACTS),0); EnableWindow(GetDlgItem(hwnd,IDOK),0); - SetDlgItemText(hwnd,IDC_INFOTEXT, Translate("Delete module from Database")); - SetDlgItemText(hwnd,CHK_COPY2ALL, Translate("Delete module from all contacts (Includes Setting)")); + SetDlgItemText(hwnd,IDC_INFOTEXT, Translate("Delete module from database")); + SetDlgItemText(hwnd,CHK_COPY2ALL, Translate("Delete module from all contacts (including Setting)")); EnableWindow(GetDlgItem(hwnd,CHK_COPY2ALL),0); CheckDlgButton(hwnd,CHK_COPY2ALL,1); TranslateDialogDefault(hwnd); diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 4e967c6d70..42e4307b09 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -192,21 +192,28 @@ char *NickFromHContact(MCONTACT hContact) return nick; } - -void exportDB(MCONTACT hContact, char* module) // hContact == -1 export entire db. module == NULL export entire contact. -{ // hContact == -1, module == "" - all contacts - FILE* file = NULL; - char fileName[MAX_PATH]; +// hContact == -1 export entire db. module == NULL export entire contact. +// hContact == -1, module == "" - all contacts +void exportDB(MCONTACT hContact, char *module) +{ int nullcontactDone = 0; - ModuleSettingLL modlist; ModSetLinkLinkItem *mod; // enum all the modules - if (!EnumModules(&modlist)) { msg(Translate("Error Loading Module List"),modFullname); return;} + ModuleSettingLL modlist; + if (!EnumModules(&modlist)) { + msg(Translate("Error loading module list"),modFullname); + return; + } - if (Openfile(fileName, ((int)hContact==-1)?NULL:module)) + char fileName[MAX_PATH]; + if (Openfile(fileName, (hContact==INVALID_CONTACT_ID)?NULL:module)) { - if (!(file = fopen(fileName, "wt"))) { msg(Translate("Couldn't open file for writing"), modFullname); return; } + FILE *file = fopen(fileName, "wt"); + if (!file) { + msg(Translate("Couldn't open file for writing"), modFullname); + return; + } SetCursor(LoadCursor(NULL,IDC_WAIT)); @@ -473,7 +480,8 @@ void importSettings(MCONTACT hContact, char *importstring ) break; case 'g': case 'G': - { char *pstr; + { + char *pstr; for(pstr=end+2;*pstr;pstr++) { if (*pstr=='\\') { switch(pstr[1]) { @@ -483,7 +491,9 @@ void importSettings(MCONTACT hContact, char *importstring ) default: *pstr=pstr[1]; break; } MoveMemory(pstr+1,pstr+2,lstrlenA(pstr+2)+1); - } } } + } + } + } case 'u': case 'U': db_set_utf(hContact,module, setting, (end+2)); @@ -568,11 +578,13 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam { MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_TEXT)); - char *string; if (length) { - string = (char*)_alloca(length+1); - if (!string) {msg(Translate("Couldn't allocate enough memory!"), modFullname); DestroyWindow(hwnd); } + char *string = (char*)_alloca(length+1); + if (!string) { + msg(Translate("Couldn't allocate enough memory!"), modFullname); + DestroyWindow(hwnd); + } GetDlgItemText(hwnd, IDC_TEXT, string, length+1); importSettings(hContact, string); refreshTree(1); -- cgit v1.2.3