1 /*
2  * Folder options.
3  *
4  * Copyright (C) 2016 Mark Jansen
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #include <precomp.h>
22 
23 
24 WINE_DEFAULT_DEBUG_CHANNEL(fprop);
25 
26 CFolderOptions::CFolderOptions()
27     :m_pSite(NULL)
28 {
29 }
30 
31 CFolderOptions::~CFolderOptions()
32 {
33 }
34 
35 /*************************************************************************
36  * FolderOptions IShellPropSheetExt interface
37  */
38 
39 INT_PTR CALLBACK FolderOptionsGeneralDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
40 INT_PTR CALLBACK FolderOptionsViewDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
41 INT_PTR CALLBACK FolderOptionsFileTypesDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
42 
43 HRESULT STDMETHODCALLTYPE CFolderOptions::AddPages(LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
44 {
45     HPROPSHEETPAGE hPage = SH_CreatePropertySheetPage(IDD_FOLDER_OPTIONS_GENERAL, FolderOptionsGeneralDlg, 0, NULL);
46 
47     if (hPage == NULL)
48     {
49         ERR("Failed to create property sheet page FolderOptionsGeneral\n");
50         return E_FAIL;
51     }
52     if (!pfnAddPage(hPage, lParam))
53         return E_FAIL;
54 
55     hPage = SH_CreatePropertySheetPage(IDD_FOLDER_OPTIONS_VIEW, FolderOptionsViewDlg, 0, NULL);
56     if (hPage == NULL)
57     {
58         ERR("Failed to create property sheet page FolderOptionsView\n");
59         return E_FAIL;
60     }
61     if (!pfnAddPage(hPage, lParam))
62         return E_FAIL;
63 
64     hPage = SH_CreatePropertySheetPage(IDD_FOLDER_OPTIONS_FILETYPES, FolderOptionsFileTypesDlg, 0, NULL);
65     if (hPage == NULL)
66     {
67         ERR("Failed to create property sheet page FolderOptionsFileTypes\n");
68         return E_FAIL;
69     }
70     if (!pfnAddPage(hPage, lParam))
71         return E_FAIL;
72 
73     return S_OK;
74 }
75 
76 HRESULT STDMETHODCALLTYPE CFolderOptions::ReplacePage(EXPPS uPageID, LPFNSVADDPROPSHEETPAGE pfnReplaceWith, LPARAM lParam)
77 {
78     TRACE("(%p) (uPageID %u, pfnReplaceWith %p lParam %p\n", this, uPageID, pfnReplaceWith, lParam);
79     return E_NOTIMPL;
80 }
81 
82 /*************************************************************************
83  * FolderOptions IShellExtInit interface
84  */
85 
86 HRESULT STDMETHODCALLTYPE CFolderOptions::Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
87 {
88     return S_OK;
89 }
90 
91 
92 /*************************************************************************
93  * FolderOptions IShellExtInit interface
94  */
95 HRESULT STDMETHODCALLTYPE CFolderOptions::SetSite(IUnknown *pUnkSite)
96 {
97     m_pSite = pUnkSite;
98     return S_OK;
99 }
100 
101 HRESULT STDMETHODCALLTYPE CFolderOptions::GetSite(REFIID riid, void **ppvSite)
102 {
103     return m_pSite->QueryInterface(riid, ppvSite);
104 }
105 
106