Bugfix #0000263
Hi,
I probably fixed bug #0000263... this is the first time I changed the
Miranda source code, so I'm not sure if it matches the Miranda
development guidelines (I couldn't find such a document).
What I did:
- added an event
WM_FT_COMPLETED for completed file transfers in ftmanager.cpp
- added a variable counting the number of running file transfers
(dat->wnds->runningCount) in ftmanager.cpp
- redirected the PostMessage command for closing the file transfer
window from the file transfer's window handle to the file transfer
manager's window handle => WM_FT_COMPLETED in filexferdlg.cpp
After applying the
attached patch, Miranda should behave as it did without file transfer
manager.
The fix is tested superficially
with Miranda build 0.8.0 #25 - #28 Unicode. If something has to be modified to make the
fix usable for Miranda please tell me - as I said: this is my first fix.
Hendrik
diff -r -c miranda/src/modules/srfile/file.h miranda/src/modules/srfile/file.h
*** miranda/src/modules/srfile/file.h 2009-03-16 18:50:06.000000000 +0100
--- miranda/src/modules/srfile/file.h 2009-04-01 21:26:09.813722200 +0200
***************
*** 101,106 ****
--- 101,107 ----
#define WM_FT_REMOVE (WM_APP+3)
#define WM_FT_SELECTPAGE (WM_APP+4)
#define WM_FT_CLEANUP (WM_APP+5)
+ #define WM_FT_COMPLETED (WM_APP+6)
HWND FtMgr_Show(bool bForceActivate);
void FtMgr_Destroy();
diff -r -c miranda/src/modules/srfile/filexferdlg.cpp miranda/src/modules/srfile/filexferdlg.cpp
*** miranda/src/modules/srfile/filexferdlg.cpp 2009-04-01 22:25:45.706722200 +0200
--- miranda/src/modules/srfile/filexferdlg.cpp 2009-04-01 22:23:24.894722200 +0200
***************
*** 616,624 ****
if(ack->result==ACKRESULT_FAILED) {
SetFtStatus(hwndDlg, LPGENT("File transfer failed"), FTS_TEXT);
SkinPlaySound("FileFailed");
! } else
! if(DBGetContactSettingByte(NULL,"SRFile","AutoClose",0))
! PostMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDCANCEL,BN_CLICKED),(LPARAM)GetDlgItem(hwndDlg,IDCANCEL));
break;
case ACKRESULT_DENIED:
--- 616,623 ----
if(ack->result==ACKRESULT_FAILED) {
SetFtStatus(hwndDlg, LPGENT("File transfer failed"), FTS_TEXT);
SkinPlaySound("FileFailed");
! }
! PostMessage(GetParent(hwndDlg), WM_FT_COMPLETED,
(WPARAM)(ack->result==ACKRESULT_SUCCESS ? 0 : 1), (LPARAM)hwndDlg);
break;
case ACKRESULT_DENIED:
diff -r -c miranda/src/modules/srfile/ftmanager.cpp miranda/src/modules/srfile/ftmanager.cpp
*** miranda/src/modules/srfile/ftmanager.cpp 2009-03-21 13:17:56.000000000 +0100
--- miranda/src/modules/srfile/ftmanager.cpp 2009-04-01 22:19:07.579722200 +0200
***************
*** 43,49 ****
struct TLayoutWindowList
{
struct TLayoutWindowInfo **items;
! int realCount, limit, increment;
FSortFunc sortFunc;
};
--- 43,49 ----
struct TLayoutWindowList
{
struct TLayoutWindowInfo **items;
! int realCount, limit, increment, runningCount;
FSortFunc sortFunc;
};
***************
*** 109,114 ****
--- 109,115 ----
dat = (struct TFtPageData *)mir_alloc(sizeof(struct TFtPageData));
dat->wnds = (struct TLayoutWindowList *)List_Create(0, 1);
dat->scrollPos = 0;
+ dat->wnds->runningCount = 0;
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)dat);
break;
}
***************
*** 120,125 ****
--- 121,127 ----
GetWindowRect(wnd->hwnd, &wnd->rc);
List_Insert((SortedList *)dat->wnds, wnd, dat->wnds->realCount);
LayoutTransfers(hwnd, dat);
+ dat->wnds->runningCount++;
break;
}
***************
*** 150,155 ****
--- 152,165 ----
break;
}
+ case WM_FT_COMPLETED:
+ { //wParam: 0=completed, 1=failed
+ dat->wnds->runningCount--;
+ if(dat->wnds->runningCount == 0 && (int)wParam == 0 && DBGetContactSettingByte(NULL,"SRFile","AutoClose",0))
+ ShowWindow(hwndFtMgr, SW_HIDE);
+ break;
+ }
+
case WM_FT_CLEANUP:
{
int i;
------------------------------------------------------------------------------
_______________________________________________
Miranda-Develop mailing list
Miranda-Develop@...
https://lists.sourceforge.net/lists/listinfo/miranda-develop