Changeset 3216 for trunk/src/comdlg32/filedlgbrowser.c
- Timestamp:
- Mar 24, 2000, 6:16:27 PM (26 years ago)
- File:
-
- 1 edited
-
trunk/src/comdlg32/filedlgbrowser.c (modified) (40 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/filedlgbrowser.c
r2607 r3216 1 1 /* 2 2 * Implementation of IShellBrowser for the File Open common dialog 3 *4 3 * 5 4 */ … … 90 89 * External Prototypes 91 90 */ 92 extern const char *FileOpenDlgInfosStr; 91 extern const char *FileOpenDlgInfosStr; 93 92 94 93 extern HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName); … … 149 148 */ 150 149 HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, 151 REFIID riid, 150 REFIID riid, 152 151 LPVOID *ppvObj) 153 152 { … … 159 158 160 159 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 161 { *ppvObj = This; 160 { *ppvObj = This; 162 161 } 163 162 else if(IsEqualIID(riid, &IID_IOleWindow)) /*IOleWindow*/ … … 201 200 TRACE("(%p)\n", This); 202 201 203 if (!--(This->ref)) 204 { 202 if (!--(This->ref)) 203 { 205 204 COMDLG32_SHFree(This); 206 205 return 0; … … 221 220 * 222 221 * Note : We will never be window less in the File Open dialog 223 * 224 */ 225 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 222 * 223 */ 224 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 226 225 HWND * phwnd) 227 226 { … … 235 234 *phwnd = This->hwndOwner; 236 235 237 return (*phwnd) ? S_OK : E_UNEXPECTED; 236 return (*phwnd) ? S_OK : E_UNEXPECTED; 238 237 239 238 } … … 262 261 * See Windows documentation on IShellBrowser::BrowseObject for more details 263 262 * 264 * This function will override user specified flags and will always 265 * use SBSP_DEFBROWSER and SBSP_DEFMODE. 266 */ 267 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 268 LPCITEMIDLIST pidl, 263 * This function will override user specified flags and will always 264 * use SBSP_DEFBROWSER and SBSP_DEFMODE. 265 */ 266 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 267 LPCITEMIDLIST pidl, 269 268 UINT wFlags) 270 269 { … … 284 283 if(wFlags & SBSP_RELATIVE) 285 284 { 286 285 287 286 /* SBSP_RELATIVE A relative pidl (relative from the current folder) */ 288 287 hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder, … … 298 297 pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent, 299 298 (LPITEMIDLIST)pidl); 300 299 301 300 } 302 301 else if(wFlags & SBSP_PARENT) 303 302 { 304 303 /* Browse the parent folder (ignores the pidl) */ 305 304 306 305 pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent); 307 306 psfTmp = GetShellFolderFromPidl(pidlTmp); … … 315 314 } 316 315 317 316 318 317 /* Retrieve the IShellFolder interface of the pidl specified folder */ 319 318 if(!psfTmp) 320 319 return E_FAIL; 321 320 322 /* If the pidl to browse to is equal to the actual pidl ... 321 /* If the pidl to browse to is equal to the actual pidl ... 323 322 do nothing and pretend you did it*/ 324 323 if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent)) 325 324 { 326 325 IShellFolder_Release(psfTmp); 327 COMDLG32_SHFree(pidlTmp);326 COMDLG32_SHFree(pidlTmp); 328 327 return NOERROR; 329 328 } … … 342 341 /* Get the foldersettings from the old view */ 343 342 if(fodInfos->Shell.FOIShellView) 344 { 345 IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView, 343 { 344 IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView, 346 345 &fodInfos->ShellInfos.folderSettings); 347 346 } … … 364 363 365 364 /* Select the new folder in the Look In combo box of the Open file dialog */ 366 365 367 366 FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,pidlTmp); 368 367 … … 383 382 384 383 fodInfos->ShellInfos.hwndView = hwndView; 385 384 386 385 return NOERROR; 387 386 } … … 389 388 390 389 FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent); 391 return hRes; 390 return hRes; 392 391 } 393 392 … … 395 394 * IShellBrowserImpl_EnableModelessSB 396 395 */ 397 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface, 396 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface, 398 397 BOOL fEnable) 399 398 400 399 { 401 400 ICOM_THIS(IShellBrowserImpl, iface); … … 410 409 * IShellBrowserImpl_GetControlWindow 411 410 */ 412 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface, 413 UINT id, 411 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface, 412 UINT id, 414 413 HWND *lphwnd) 415 414 416 415 { 417 416 ICOM_THIS(IShellBrowserImpl, iface); … … 426 425 */ 427 426 HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface, 428 DWORD grfMode, 427 DWORD grfMode, 429 428 LPSTREAM *ppStrm) 430 431 { 432 ICOM_THIS(IShellBrowserImpl, iface); 433 434 TRACE("(%p)\n", This); 435 436 /* Feature not implemented */ 437 return E_NOTIMPL; 438 } 429 430 { 431 ICOM_THIS(IShellBrowserImpl, iface); 432 433 TRACE("(%p)\n", This); 434 435 /* Feature not implemented */ 436 return E_NOTIMPL; 437 } 439 438 /************************************************************************** 440 439 * IShellBrowserImpl_InsertMenusSB … … 443 442 HMENU hmenuShared, 444 443 LPOLEMENUGROUPWIDTHS lpMenuWidths) 445 444 446 445 { 447 446 ICOM_THIS(IShellBrowserImpl, iface); … … 457 456 HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface, 458 457 IShellView *ppshv) 459 460 { 461 ICOM_THIS(IShellBrowserImpl, iface); 462 463 TRACE("(%p)\n", This); 464 465 /* Feature not implemented */ 466 return E_NOTIMPL; 467 } 458 459 { 460 ICOM_THIS(IShellBrowserImpl, iface); 461 462 TRACE("(%p)\n", This); 463 464 /* Feature not implemented */ 465 return E_NOTIMPL; 466 } 468 467 /************************************************************************** 469 468 * IShellBrowserImpl_QueryActiveShellView … … 471 470 HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface, 472 471 IShellView **ppshv) 473 472 474 473 { 475 474 ICOM_THIS(IShellBrowserImpl, iface); … … 487 486 IShellView_AddRef(fodInfos->Shell.FOIShellView); 488 487 return NOERROR; 489 } 488 } 490 489 /************************************************************************** 491 490 * IShellBrowserImpl_RemoveMenusSB … … 493 492 HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface, 494 493 HMENU hmenuShared) 495 496 { 497 ICOM_THIS(IShellBrowserImpl, iface); 498 499 TRACE("(%p)\n", This); 500 501 /* Feature not implemented */ 502 return E_NOTIMPL; 503 } 494 495 { 496 ICOM_THIS(IShellBrowserImpl, iface); 497 498 TRACE("(%p)\n", This); 499 500 /* Feature not implemented */ 501 return E_NOTIMPL; 502 } 504 503 /************************************************************************** 505 504 * IShellBrowserImpl_SendControlMsg 506 505 */ 507 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface, 508 UINT id, 509 UINT uMsg, 510 WPARAM wParam, 506 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface, 507 UINT id, 508 UINT uMsg, 509 WPARAM wParam, 511 510 LPARAM lParam, 512 511 LRESULT *pret) 513 512 514 513 { 515 514 ICOM_THIS(IShellBrowserImpl, iface); 516 515 LRESULT lres; 517 516 518 517 TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret); 519 518 … … 522 521 case FCW_TOOLBAR: 523 522 lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam); 524 break;523 break; 525 524 default: 526 525 FIXME("ctrl id: %x\n", id); … … 534 533 */ 535 534 HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface, 536 HMENU hmenuShared, 535 HMENU hmenuShared, 537 536 HOLEMENU holemenuReserved, 538 537 HWND hwndActiveObject) 539 540 { 541 ICOM_THIS(IShellBrowserImpl, iface); 542 543 TRACE("(%p)\n", This); 544 545 /* Feature not implemented */ 546 return E_NOTIMPL; 547 } 538 539 { 540 ICOM_THIS(IShellBrowserImpl, iface); 541 542 TRACE("(%p)\n", This); 543 544 /* Feature not implemented */ 545 return E_NOTIMPL; 546 } 548 547 /************************************************************************** 549 548 * IShellBrowserImpl_SetStatusTextSB … … 551 550 HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface, 552 551 LPCOLESTR lpszStatusText) 553 554 { 555 ICOM_THIS(IShellBrowserImpl, iface); 556 557 TRACE("(%p)\n", This); 558 559 /* Feature not implemented */ 560 return E_NOTIMPL; 561 } 552 553 { 554 ICOM_THIS(IShellBrowserImpl, iface); 555 556 TRACE("(%p)\n", This); 557 558 /* Feature not implemented */ 559 return E_NOTIMPL; 560 } 562 561 /************************************************************************** 563 562 * IShellBrowserImpl_SetToolbarItems 564 563 */ 565 564 HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface, 566 LPTBBUTTON lpButtons, 567 UINT nButtons, 565 LPTBBUTTON lpButtons, 566 UINT nButtons, 568 567 UINT uFlags) 569 570 { 571 ICOM_THIS(IShellBrowserImpl, iface); 572 573 TRACE("(%p)\n", This); 574 575 /* Feature not implemented */ 576 return E_NOTIMPL; 577 } 568 569 { 570 ICOM_THIS(IShellBrowserImpl, iface); 571 572 TRACE("(%p)\n", This); 573 574 /* Feature not implemented */ 575 return E_NOTIMPL; 576 } 578 577 /************************************************************************** 579 578 * IShellBrowserImpl_TranslateAcceleratorSB 580 579 */ 581 580 HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface, 582 LPMSG lpmsg, 581 LPMSG lpmsg, 583 582 WORD wID) 584 583 585 584 { 586 585 ICOM_THIS(IShellBrowserImpl, iface); … … 600 599 */ 601 600 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser *iface, 602 REFIID riid, 601 REFIID riid, 603 602 LPVOID *ppvObj) 604 603 { … … 648 647 TRACE("(%p)\n", This); 649 648 650 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 651 649 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 650 652 651 /* If the selected object is not a folder, send a IDOK command to parent window */ 653 if((pidl = GetSelectedPidl(ppshv))) 652 pidl = GetSelectedPidl(ppshv); 653 if (pidl) 654 654 { 655 655 HRESULT hRes; … … 657 657 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 658 658 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); 659 if (ulAttr)659 if (ulAttr) 660 660 hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE); 661 661 /* Tell the dialog that the user selected a file */ 662 662 else 663 {663 { 664 664 hRes = FILEDLG95_OnOpen(This->hwndOwner); 665 }665 } 666 666 667 667 /* Free memory used by pidl */ … … 690 690 case CDBOSC_SETFOCUS: 691 691 break; 692 case CDBOSC_KILLFOCUS: 693 {694 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);695 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)696 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");692 case CDBOSC_KILLFOCUS: 693 { 694 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 695 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 696 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); 697 697 } 698 698 break; … … 703 703 } 704 704 705 return NOERROR; 705 return NOERROR; 706 706 } 707 707 /************************************************************************** 708 708 * IShellBrowserImpl_ICommDlgBrowser_IncludeObject 709 709 */ 710 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 710 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 711 711 IShellView * ppshv, 712 712 LPCITEMIDLIST pidl) … … 725 725 ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK; 726 726 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); 727 728 729 if( (ulAttr & SFGAO_HIDDEN) /* hidden */730 | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */727 728 729 if( (ulAttr & SFGAO_HIDDEN) /* hidden */ 730 | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */ 731 731 return S_FALSE; 732 732 /* always include directorys and links */ 733 if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) 733 if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) 734 734 return S_OK; 735 735 /* Check if there is a mask to apply if not */ … … 741 741 { if (SUCCEEDED(StrRetToBufW(&str, pidl,szPathW, MAX_PATH))) 742 742 { 743 if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))743 if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter)) 744 744 return S_OK; 745 745 } … … 751 751 /************************************************************************** 752 752 * IShellBrowserImpl_ICommDlgBrowser_OnSelChange 753 */ 753 */ 754 754 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv) 755 755 { … … 761 761 TRACE("(%p)\n", This); 762 762 763 if((pidl = GetSelectedPidl(ppshv))) 763 pidl = GetSelectedPidl(ppshv); 764 if (pidl) 764 765 { 765 766 HRESULT hRes = E_FAIL; 766 767 char lpstrFileName[MAX_PATH]; 767 768 768 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 769 769 770 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); 770 771 if (!ulAttr) … … 772 773 if(SUCCEEDED(hRes = GetName(fodInfos->Shell.FOIShellFolder,pidl,SHGDN_NORMAL,lpstrFileName))) 773 774 SetWindowTextA(fodInfos->DlgInfos.hwndFileName,lpstrFileName); 774 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)775 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");775 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 776 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); 776 777 } 777 else778 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open");779 780 fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW;778 else 779 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open"); 780 781 fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW; 781 782 782 783 COMDLG32_SHFree((LPVOID)pidl); … … 785 786 } 786 787 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 787 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");788 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); 788 789 789 790 fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW; … … 812 813 STGMEDIUM medium; 813 814 FORMATETC formatetc; 814 815 815 816 /* Set the FORMATETC structure*/ 816 817 SETDefFormatEtc(formatetc, … … 822 823 { 823 824 LPIDA cida = GlobalLock(medium.u.hGlobal); 824 TRACE("cida=%p\n", cida);825 TRACE("cida=%p\n", cida); 825 826 pidlSelected = COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[1]])); 826 827 … … 828 829 IUnknown_Release(medium.pUnkForRelease); 829 830 else 830 {831 GlobalUnlock(medium.u.hGlobal);832 GlobalFree(medium.u.hGlobal);833 }831 { 832 GlobalUnlock(medium.u.hGlobal); 833 GlobalFree(medium.u.hGlobal); 834 } 834 835 } 835 836 IDataObject_Release(doSelected);
Note:
See TracChangeset
for help on using the changeset viewer.
