summaryrefslogtreecommitdiff
path: root/src/core/stdfile
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-18 19:19:15 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-18 19:19:15 +0000
commit61292897c70a2b038cb6678fa9aba93190445a4d (patch)
treeb59ba5bea32ea3075311418148741fff7e83318b /src/core/stdfile
parentbd65e1210281eb54352c2ab7efbe666b01586436 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@6131 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdfile')
-rw-r--r--src/core/stdfile/fileexistsdlg.cpp29
-rw-r--r--src/core/stdfile/filexferdlg.cpp26
2 files changed, 26 insertions, 29 deletions
diff --git a/src/core/stdfile/fileexistsdlg.cpp b/src/core/stdfile/fileexistsdlg.cpp
index 8729229462..8484c8395c 100644
--- a/src/core/stdfile/fileexistsdlg.cpp
+++ b/src/core/stdfile/fileexistsdlg.cpp
@@ -82,11 +82,10 @@ static void DoAnnoyingShellCommand(HWND hwnd, const TCHAR *szFilename, int cmd,
break;
}
case C_CONTEXTMENU:
- { HMENU hMenu;
- hMenu = CreatePopupMenu();
+ {
+ HMENU hMenu = CreatePopupMenu();
if (SUCCEEDED(pContextMenu->QueryContextMenu(hMenu, 0, 1000, 65535, (GetKeyState(VK_SHIFT)&0x8000?CMF_EXTENDEDVERBS:0)|CMF_NORMAL))) {
- int cmd;
- cmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, ptCursor->x, ptCursor->y, 0, hwnd, NULL);
+ int cmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, ptCursor->x, ptCursor->y, 0, hwnd, NULL);
if (cmd) {
CMINVOKECOMMANDINFO ici = {0};
ici.cbSize = sizeof(ici);
@@ -121,12 +120,11 @@ static LRESULT CALLBACK IconCtrlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
ShellExecute(hwnd, NULL, pft->tszCurrentFile, NULL, NULL, SW_SHOW);
break;
case WM_RBUTTONUP:
- { POINT pt;
+ POINT pt;
pt.x = (short)LOWORD(lParam); pt.y = (short)HIWORD(lParam);
ClientToScreen(hwnd, &pt);
DoAnnoyingShellCommand(hwnd, pft->tszCurrentFile, C_CONTEXTMENU, &pt);
return 0;
- }
}
return mir_callNextSubclass(hwnd, IconCtrlSubclassProc, msg, wParam, lParam);
}
@@ -142,15 +140,13 @@ void __cdecl LoadIconsAndTypesThread(void* param)
SHFILEINFO fileInfo;
if (SHGetFileInfo(info->szFilename, 0, &fileInfo, sizeof(fileInfo), SHGFI_TYPENAME|SHGFI_ICON|SHGFI_LARGEICON)) {
- TCHAR *pszExtension, *pszFilename;
- TCHAR szExtension[64];
- TCHAR szIconFile[MAX_PATH];
+ TCHAR szExtension[64], szIconFile[MAX_PATH];
- pszFilename = _tcsrchr(info->szFilename, '\\');
+ TCHAR *pszFilename = _tcsrchr(info->szFilename, '\\');
if (pszFilename == NULL)
pszFilename = info->szFilename;
- pszExtension = _tcsrchr(pszFilename, '.');
+ TCHAR *pszExtension = _tcsrchr(pszFilename, '.');
if (pszExtension)
lstrcpyn(szExtension, pszExtension+1, SIZEOF(szExtension));
else {
@@ -191,15 +187,12 @@ void __cdecl LoadIconsAndTypesThread(void* param)
INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- PROTOFILETRANSFERSTATUS *fts;
-
- fts = (PROTOFILETRANSFERSTATUS*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ PROTOFILETRANSFERSTATUS *fts = (PROTOFILETRANSFERSTATUS*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch(msg) {
case WM_INITDIALOG:
{
TCHAR szSize[64];
struct _stati64 statbuf;
- HWND hwndFocus;
struct TDlgProcFileExistsParam *dat = (struct TDlgProcFileExistsParam *)lParam;
SetPropA(hwndDlg, "Miranda.Preshutdown", HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, M_PRESHUTDOWN));
@@ -216,7 +209,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
mir_subclassWindow( GetDlgItem(hwndDlg, IDC_EXISTINGICON), IconCtrlSubclassProc);
- hwndFocus = GetDlgItem(hwndDlg, IDC_RESUME);
+ HWND hwndFocus = GetDlgItem(hwndDlg, IDC_RESUME);
if (_tstati64(fts->tszCurrentFile, &statbuf) == 0) {
SetControlToUnixTime(hwndDlg, IDC_EXISTINGDATE, statbuf.st_mtime);
GetSensiblyFormattedSize(statbuf.st_size, szSize, SIZEOF(szSize), 0, 1, NULL);
@@ -309,8 +302,8 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
default:
return FALSE;
}
- { PROTOFILERESUME *pfrCopy;
- pfrCopy = (PROTOFILERESUME*)mir_alloc(sizeof(pfr));
+ {
+ PROTOFILERESUME *pfrCopy = (PROTOFILERESUME*)mir_alloc(sizeof(pfr));
CopyMemory(pfrCopy, &pfr, sizeof(pfr));
PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_tstrdup(fts->tszCurrentFile), (LPARAM)pfrCopy);
DestroyWindow(hwndDlg);
diff --git a/src/core/stdfile/filexferdlg.cpp b/src/core/stdfile/filexferdlg.cpp
index bb69fdd495..e53c832563 100644
--- a/src/core/stdfile/filexferdlg.cpp
+++ b/src/core/stdfile/filexferdlg.cpp
@@ -99,17 +99,16 @@ void FillSendData(FileDlgData* dat, DBEVENTINFO& dbei)
static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info)
{
PROCESS_INFORMATION pi;
- STARTUPINFO si = {0};
DBVARIANT dbv;
- TCHAR szCmdLine[768];
if ( !db_get_ts(NULL, "SRFile", "ScanCmdLine", &dbv))
{
if (dbv.ptszVal[0])
{
- TCHAR *pszReplace;
+ STARTUPINFO si = {0};
si.cb = sizeof(si);
- pszReplace = _tcsstr(dbv.ptszVal, _T("%f"));
+ TCHAR *pszReplace = _tcsstr(dbv.ptszVal, _T("%f"));
+ TCHAR szCmdLine[768];
if (pszReplace)
{
if (info->szFile[_tcslen(info->szFile) - 1] == '\\')
@@ -266,24 +265,28 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
dat->waitingForAcceptance = 0;
}
}
- { LOGFONT lf;
- HFONT hFont;
- hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_CONTACTNAME, WM_GETFONT, 0, 0);
+ {
+ LOGFONT lf;
+ HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_CONTACTNAME, WM_GETFONT, 0, 0);
GetObject(hFont, sizeof(lf), &lf);
lf.lfWeight = FW_BOLD;
hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hwndDlg, IDC_CONTACTNAME, WM_SETFONT, (WPARAM)hFont, 0);
}
- { SHFILEINFO shfi = {0};
+ {
+ SHFILEINFO shfi = {0};
SHGetFileInfo(_T(""), FILE_ATTRIBUTE_DIRECTORY, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES|SHGFI_ICON|SHGFI_SMALLICON);
dat->hIconFolder = shfi.hIcon;
}
dat->hIcon = NULL;
+ {
+ char *szProto=GetContactProto(dat->hContact);
+ WORD status = db_get_w(dat->hContact,szProto,"Status",ID_STATUS_ONLINE);
+ SendDlgItemMessage(hwndDlg, IDC_CONTACT, BM_SETIMAGE, IMAGE_ICON,(LPARAM)LoadSkinnedProtoIcon(szProto, status));
+ }
- SendDlgItemMessage(hwndDlg, IDC_CONTACT, BM_SETIMAGE, IMAGE_ICON,
- (LPARAM)LoadSkinnedProtoIcon(GetContactProto(dat->hContact), ID_STATUS_ONLINE));
SendDlgItemMessage(hwndDlg, IDC_CONTACT, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Contact menu"), 0);
SendDlgItemMessage(hwndDlg, IDC_CONTACT, BUTTONSETASFLATBTN, TRUE, 0);
@@ -306,7 +309,8 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (dat->bytesRecvedHistorySize < SIZEOF(dat->bytesRecvedHistory))
dat->bytesRecvedHistorySize++;
- { TCHAR szSpeed[32], szTime[32], szDisplay[96];
+ {
+ TCHAR szSpeed[32], szTime[32], szDisplay[96];
SYSTEMTIME st;
ULARGE_INTEGER li;
FILETIME ft;