diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-31 14:23:56 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-31 14:23:56 +0000 |
commit | f33088d0a28acb14673c1acf6d8c42ead45e4007 (patch) | |
tree | ad6e6e5e974a25758f5373ad5af01d38dda89e1c /plugins | |
parent | 1d6ff12f50670d7240e9bf823100fc0fb53498fa (diff) |
- fix for icolib handles;
- fixes for runglish;
- code cleaning;
- version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@6715 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Db_autobackups/src/backup.cpp | 18 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/main.cpp | 23 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/options.cpp | 123 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/version.h | 2 |
4 files changed, 83 insertions, 83 deletions
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index 4e8f82f6af..3050b4d050 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -31,7 +31,7 @@ INT_PTR DBSaveAs(WPARAM wParam, LPARAM lParam) OPENFILENAME ofn = {0};
CallService(MS_DB_GETPROFILENAMET,MAX_PATH,(LPARAM)fname_buff);
- int i = mir_sntprintf(szFilter, 64, _T("%s (*.dat)"), TranslateT("Miranda Databases")) + 1;
+ int i = mir_sntprintf(szFilter, 64, _T("%s (*.dat)"), TranslateT("Miranda databases")) + 1;
_tcscpy(szFilter + i, _T("*.dat"));
i += 6;
i += mir_sntprintf(szFilter + i, 48, _T("%s (*.*)"), TranslateT("All Files")) + 1;
@@ -137,7 +137,7 @@ int Backup(TCHAR* backup_filename) TCHAR *backupfolder = Utils_ReplaceVarsT(options.folder);
// ensure the backup folder exists (either create it or return non-zero signifying error)
int err = CreateDirectoryTreeT(backupfolder);
- if(err != ERROR_ALREADY_EXISTS && err != 0) {
+ if (err != ERROR_ALREADY_EXISTS && err != 0) {
return 1;
}
@@ -150,7 +150,7 @@ int Backup(TCHAR* backup_filename) lstrcpyn(dest_file, backup_filename, MAX_PATH);
if (!options.disable_popups)
- ShowPopup(dbname, TranslateT("Backup in Progress"));
+ ShowPopup(dbname, TranslateT("Backup in progress"));
if (!options.disable_progress) {
progress_dialog = CreateDialog(hInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcProgress);
@@ -174,7 +174,7 @@ int Backup(TCHAR* backup_filename) {
size_t dest_file_len = lstrlen(dest_file);
TCHAR *puText;
- if(dest_file_len > 50)
+ if (dest_file_len > 50)
{
int i;
puText = (TCHAR*)mir_alloc(sizeof(TCHAR) * (dest_file_len + 2));
@@ -187,7 +187,7 @@ int Backup(TCHAR* backup_filename) else
puText = mir_tstrdup(dest_file);
- ShowPopup(puText, TranslateT("Database backuped"));
+ ShowPopup(puText, TranslateT("Database backed up"));
mir_free(puText);
}
}
@@ -203,18 +203,18 @@ VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) {
time_t t = time(NULL);
time_t diff = t - (time_t)db_get_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)t);
- if(diff > (time_t)(options.period * (options.period_type == PT_MINUTES ? 60 : (options.period_type == PT_HOURS ? 60 * 60 : 60 * 60 * 24 ))))
+ if (diff > (time_t)(options.period * (options.period_type == PT_MINUTES ? 60 : (options.period_type == PT_HOURS ? 60 * 60 : 60 * 60 * 24 ))))
mir_forkthread(BackupThread, NULL);
}
int SetBackupTimer(void)
{
- if(options.backup_types & BT_PERIODIC)
+ if (options.backup_types & BT_PERIODIC)
{
- if(timer_id == 0)
+ if (timer_id == 0)
timer_id = SetTimer(0, timer_id, 1000 * 60, TimerProc);
}
- else if(timer_id != 0)
+ else if (timer_id != 0)
{
KillTimer(0, timer_id);
timer_id = 0;
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 47ca9457cb..4bb81becc5 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -22,8 +22,8 @@ PLUGININFOEX pluginInfo={ };
static IconItem iconList[] = {
- {LPGEN("Backup Profile"), "backup", IDI_ICON1 },
- {LPGEN("Save Profile As..."), "saveas", IDI_ICON1 }
+ { LPGEN("Backup profile"), "backup", IDI_ICON1 },
+ { LPGEN("Save profile as..."), "saveas", IDI_ICON1 }
};
static int FoldersGetBackupPath(WPARAM, LPARAM)
@@ -34,7 +34,7 @@ static int FoldersGetBackupPath(WPARAM, LPARAM) static void FoldersInit(void)
{
- if (hFolder = FoldersRegisterCustomPathT(LPGEN("Database Backups"), LPGEN("Backup Folder"), DIR SUB_DIR)) {
+ if (hFolder = FoldersRegisterCustomPathT(LPGEN("Database backups"), LPGEN("Backup folder"), DIR SUB_DIR)) {
HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath);
FoldersGetBackupPath(0, 0);
}
@@ -43,17 +43,17 @@ static void FoldersInit(void) static void MenuInit(void)
{
CLISTMENUITEM mi = { sizeof(mi) };
- mi.hIcon = Skin_GetIcon("backup");
mi.pszPopupName = LPGEN("Database");
mi.pszName = LPGEN("Backup Profile");
mi.pszService = MS_AB_BACKUP;
+ mi.icolibItem = iconList[0].hIcolib;
mi.position = 500100000;
Menu_AddMainMenuItem(&mi);
- mi.hIcon = Skin_GetIcon("saveas");
mi.pszName = LPGEN("Save Profile As...");
mi.pszService = MS_AB_SAVEAS;
+ mi.icolibItem = iconList[1].hIcolib;
mi.position = 500100001;
Menu_AddMainMenuItem(&mi);
}
@@ -62,12 +62,12 @@ static int ModulesLoad(WPARAM, LPARAM) {
profilePath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
- Icon_Register(hInst, LPGEN("Database")"/"LPGEN("Database Backups"), iconList, SIZEOF(iconList));
+ Icon_Register(hInst, LPGEN("Database")"/"LPGEN("Database backups"), iconList, SIZEOF(iconList));
FoldersInit();
LoadOptions();
- if(options.backup_types & BT_START)
+ if (options.backup_types & BT_START)
mir_forkthread(BackupThread, NULL);
return 0;
}
@@ -76,8 +76,7 @@ static int ModulesLoad(WPARAM, LPARAM) // for setting changed event not cleared. the backup on exit function will write to the db, calling those hooks.
int PreShutdown(WPARAM, LPARAM)
{
- if(options.backup_types & BT_EXIT)
- {
+ if (options.backup_types & BT_EXIT) {
options.disable_popups = 1; // Don't try to show popups on exit
mir_forkthread(BackupThread, NULL);
}
@@ -92,7 +91,7 @@ void SysInit() CreateServiceFunction(MS_AB_BACKUP, ABService);
CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);
MenuInit();
-
+
HookEvent(ME_OPT_INITIALISE, OptionsInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoad);
@@ -127,7 +126,7 @@ void ShowPopup(TCHAR* text, TCHAR* header) lstrcpy(ppd.lptzText, text);
lstrcpy(ppd.lptzContactName, header);
- ppd.lchIcon = Skin_GetIcon("backup");
+ ppd.lchIcon = Skin_GetIconByHandle(iconList[0].hIcolib);
PUAddPopupT(&ppd);
}
@@ -156,4 +155,4 @@ HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle) SendMessage(hwndTT, TTM_SETTITLE, 1, (LPARAM)ptszTitle);
SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, (LPARAM)650);
return hwndTT;
-}
\ No newline at end of file +}
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index 0f63dc96de..01ae471a76 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -15,7 +15,7 @@ int LoadOptions(void) if (!db_get_ts(0, "AutoBackups", "Folder", &dbv)) {
TCHAR *tmp = Utils_ReplaceVarsT(dbv.ptszVal);
- if(_tcslen(tmp) >= 2 && tmp[1] == ':')
+ if (_tcslen(tmp) >= 2 && tmp[1] == ':')
_tcsncpy(options.folder, dbv.ptszVal, MAX_PATH-1);
else
mir_sntprintf(options.folder, MAX_PATH, _T("%s\\%s"), profilePath, dbv.ptszVal);
@@ -47,13 +47,13 @@ int SaveOptions(void) size_t prof_len = _tcslen(prof_dir);
size_t opt_len = _tcslen(options.folder);
- if(opt_len > prof_len && _tcsncmp(options.folder, prof_dir, prof_len) == 0) {
+ if (opt_len > prof_len && _tcsncmp(options.folder, prof_dir, prof_len) == 0) {
db_set_ts(0, "AutoBackups", "Folder", (options.folder + prof_len));
} else
db_set_ts(0, "AutoBackups", "Folder", options.folder);
TCHAR *tmp = Utils_ReplaceVarsT(options.folder);
- if(_tcslen(tmp) < 2 || tmp[1] != ':')
+ if (_tcslen(tmp) < 2 || tmp[1] != ':')
{
TCHAR *buf = mir_tstrdup(options.folder);
mir_sntprintf(options.folder, MAX_PATH, _T("%s\\%s"), profilePath, buf);
@@ -74,7 +74,7 @@ int SetDlgState(HWND hwndDlg) {
TCHAR buff[10];
- if(new_options.backup_types == BT_DISABLED) {
+ if (new_options.backup_types == BT_DISABLED) {
CheckDlgButton(hwndDlg, IDC_RAD_DISABLED, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_DISABLED), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_NUMBACKUPS), FALSE);
@@ -144,17 +144,15 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TranslateDialogDefault(hwndDlg);
memcpy(&new_options, &options, sizeof(Options));
- if (ServiceExists(MS_FOLDERS_GET_PATH))
- {
+ if ( ServiceExists(MS_FOLDERS_GET_PATH)) {
ShowWindow(GetDlgItem(hwndDlg, IDC_ED_FOLDER), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_BUT_BROWSE), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_LNK_FOLDERS), SW_SHOW);
}
- else
- {
+ else {
TCHAR tszTooltipText[1024];
mir_sntprintf(tszTooltipText, SIZEOF(tszTooltipText), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
- _T("%miranda_path%"), TranslateT("path to root miranda folder"),
+ _T("%miranda_path%"), TranslateT("path to Miranda root folder"),
_T("%miranda_profile%"), TranslateT("path to current miranda profile"),
_T("%miranda_profilename%"), TranslateT("name of current miranda profile (filename, without extension)"),
_T("%miranda_userdata%"), TranslateT("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%"),
@@ -177,9 +175,11 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case PT_HOURS: SendDlgItemMessage(hwndDlg, IDC_PT, CB_SETCURSEL, 1, 0); break;
case PT_MINUTES: SendDlgItemMessage(hwndDlg, IDC_PT, CB_SETCURSEL, 2, 0); break;
}
+
if (hPathTip)
SetTimer(hwndDlg, 0, 3000, NULL);
return TRUE;
+
case WM_COMMAND:
if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
switch( LOWORD( wParam )) {
@@ -189,36 +189,39 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
- if ( HIWORD( wParam ) == CBN_SELCHANGE) {
+ if ( HIWORD( wParam ) == CBN_SELCHANGE)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
+
if ( HIWORD( wParam ) == BN_CLICKED ) {
switch( LOWORD( wParam )) {
case IDC_RAD_DISABLED:
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_DISABLED)) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_DISABLED))
new_options.backup_types = BT_DISABLED;
- }
+
SetDlgState(hwndDlg);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+
case IDC_RAD_START:
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_START))
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_START))
new_options.backup_types |= BT_START;
else
new_options.backup_types &= ~BT_START;
SetDlgState(hwndDlg);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+
case IDC_RAD_EXIT:
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_EXIT))
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_EXIT))
new_options.backup_types |= BT_EXIT;
else
new_options.backup_types &= ~BT_EXIT;
SetDlgState(hwndDlg);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+
case IDC_RAD_PERIODIC:
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_PERIODIC))
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_PERIODIC))
new_options.backup_types |= BT_PERIODIC;
else
new_options.backup_types &= ~BT_PERIODIC;
@@ -227,30 +230,29 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case IDC_BUT_BROWSE:
- {
- BROWSEINFO bi;
- LPCITEMIDLIST pidl;
-
- bi.hwndOwner = hwndDlg;
- bi.pidlRoot = 0;
- bi.pszDisplayName = folder_buff;
- bi.lpszTitle = TranslateT("Select Backup Folder");
- bi.ulFlags = BIF_NEWDIALOGSTYLE;
- bi.lpfn = BrowseProc;
- bi.lParam = 0;
- bi.iImage = 0;
-
- if ((pidl = SHBrowseForFolder(&bi)) != 0) {
- SHGetPathFromIDList(pidl, folder_buff);
-
- SetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff);
-
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
-
- CoTaskMemFree((void *)pidl);
+ {
+ BROWSEINFO bi;
+ bi.hwndOwner = hwndDlg;
+ bi.pidlRoot = 0;
+ bi.pszDisplayName = folder_buff;
+ bi.lpszTitle = TranslateT("Select Backup Folder");
+ bi.ulFlags = BIF_NEWDIALOGSTYLE;
+ bi.lpfn = BrowseProc;
+ bi.lParam = 0;
+ bi.iImage = 0;
+
+ LPCITEMIDLIST pidl = SHBrowseForFolder(&bi);
+ if (pidl != 0) {
+ SHGetPathFromIDList(pidl, folder_buff);
+
+ SetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff);
+
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+
+ CoTaskMemFree((void *)pidl);
+ }
+ break;
}
- break;
- }
case IDC_BUT_NOW:
mir_forkthread(BackupThread, NULL);
break;
@@ -263,21 +265,20 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_LNK_FOLDERS:
- {
- OPENOPTIONSDIALOG ood = {0};
- ood.cbSize = sizeof(ood);
- ood.pszGroup = "Customize";
- ood.pszPage = "Folders";
- Options_Open(&ood);
- break;
- }
+ {
+ OPENOPTIONSDIALOG ood = {0};
+ ood.cbSize = sizeof(ood);
+ ood.pszGroup = "Customize";
+ ood.pszPage = "Folders";
+ Options_Open(&ood);
+ break;
+ }
}
}
-
break;
case WM_TIMER:
- if(IsWindow(hPathTip))
+ if (IsWindow(hPathTip))
KillTimer(hPathTip, 4); // It will prevent tooltip autoclosing
break;
@@ -301,25 +302,26 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP BOOL folder_ok = TRUE;
TCHAR *tmp = Utils_ReplaceVarsT(folder_buff);
- if(_tcslen(tmp) >= 2 && tmp[1] == ':')
+ if (_tcslen(tmp) >= 2 && tmp[1] == ':')
_tcsncpy(backupfolder, tmp, MAX_PATH-1);
else
mir_sntprintf(backupfolder, MAX_PATH, _T("%s\\%s"), profilePath, tmp);
mir_free(tmp);
int err = CreateDirectoryTreeT(backupfolder);
- if(err != ERROR_ALREADY_EXISTS && err != 0) {
+ if (err != ERROR_ALREADY_EXISTS && err != 0) {
TCHAR msg_buff[512];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, err, 0, msg_buff, 512, 0);
MessageBox(0, msg_buff, TranslateT("Error creating backup folder"), MB_OK | MB_ICONERROR);
folder_ok = FALSE;
}
- if(folder_ok) {
+ if (folder_ok) {
_tcsncpy(new_options.folder, folder_buff, MAX_PATH-1);
memcpy(&options, &new_options, sizeof(Options));
SaveOptions();
- } else {
+ }
+ else {
memcpy(&new_options, &options, sizeof(Options));
SetDlgState(hwndDlg);
}
@@ -329,14 +331,13 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
break;
- case WM_DESTROY:
- if (hPathTip)
- {
- KillTimer(hwndDlg, 0);
- DestroyWindow(hPathTip);
- hPathTip = 0;
- }
- return FALSE;
+ case WM_DESTROY:
+ if (hPathTip) {
+ KillTimer(hwndDlg, 0);
+ DestroyWindow(hPathTip);
+ hPathTip = 0;
+ }
+ return FALSE;
}
return FALSE;
diff --git a/plugins/Db_autobackups/src/version.h b/plugins/Db_autobackups/src/version.h index 734b574a7d..e0a5f3290c 100644 --- a/plugins/Db_autobackups/src/version.h +++ b/plugins/Db_autobackups/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
#define __RELEASE_NUM 0
-#define __BUILD_NUM 8
+#define __BUILD_NUM 9
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
|