Commit 506264be authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shell32: Add ::GetDefaultColumnState() and partial ::GetDetailsOf() for printers folder.

parent a9ac4a11
......@@ -674,6 +674,13 @@ static struct regsvr_coclass const coclass_list[] = {
SHELLFOLDER_WANTSFORDISPLAY|SHELLFOLDER_ATTRIBUTES|SHELLFOLDER_HIDEASDELETE,
SFGAO_FOLDER|SFGAO_HASSUBFOLDER,
},
{ &CLSID_Printers,
"Printers and Faxes",
0,
NULL,
"shell32.dll",
"Apartment"
},
{ NULL } /* list terminator */
};
......
......@@ -205,6 +205,10 @@ STRINGTABLE
IDS_SHV_COLUMN11 "Group"
IDS_SHV_COLUMN_DELFROM "Original location"
IDS_SHV_COLUMN_DELDATE "Date deleted"
IDS_SHV_COL_DOCS "Documents"
IDS_SHV_COL_STATUS "Status"
IDS_SHV_COL_LOCATION "Location"
IDS_SHV_COL_MODEL "Model"
/* special folders */
IDS_DESKTOP "Desktop"
......
......@@ -19,6 +19,7 @@
*/
#include <stdarg.h>
#include <stdio.h>
#define COBJMACROS
#define NONAMELESSUNION
......@@ -32,6 +33,9 @@
#include "wine/debug.h"
#include "debughlp.h"
#include "shresdef.h"
#include "shfldr.h"
WINE_DEFAULT_DEBUG_CHANNEL (shell);
typedef struct {
......@@ -45,6 +49,17 @@ static inline IPrintersFolderImpl *impl_from_IPersistFolder2(IPersistFolder2 *if
return (IPrintersFolderImpl *)((char*)iface - FIELD_OFFSET(IPrintersFolderImpl, lpvtblPersistFolder2));
}
static const shvheader printers_header[] = {
{ IDS_SHV_COLUMN8, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 20 },
{ IDS_SHV_COL_DOCS, SHCOLSTATE_TYPE_INT | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 12 },
{ IDS_SHV_COL_STATUS, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 12 },
{ IDS_SHV_COLUMN9, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 30 },
{ IDS_SHV_COL_LOCATION, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 20 },
{ IDS_SHV_COL_MODEL, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 20 }
};
#define PRINTERS_FOLDER_COL_NUM sizeof(printers_header)/sizeof(shvheader)
static HRESULT WINAPI IShellFolder_Printers_fnQueryInterface(IShellFolder2 *iface,
REFIID riid, LPVOID *ppvObj)
{
......@@ -255,11 +270,18 @@ static HRESULT WINAPI IShellFolder_Printers_fnGetDefaultColumn (
}
static HRESULT WINAPI IShellFolder_Printers_fnGetDefaultColumnState (
IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
IShellFolder2 *iface, UINT iColumn, DWORD *pcsFlags)
{
IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
FIXME("(%p) stub\n", This);
return E_NOTIMPL;
TRACE("(%p)->(%d %p)\n", This, iColumn, pcsFlags);
if (iColumn >= PRINTERS_FOLDER_COL_NUM)
return E_INVALIDARG;
*pcsFlags = printers_header[iColumn].pcsFlags;
return S_OK;
}
static HRESULT WINAPI IShellFolder_Printers_fnGetDetailsEx (IShellFolder2 * iface,
......@@ -270,11 +292,28 @@ static HRESULT WINAPI IShellFolder_Printers_fnGetDetailsEx (IShellFolder2 * ifac
return E_NOTIMPL;
}
static HRESULT WINAPI IShellFolder_Printers_fnGetDetailsOf (IShellFolder2 * iface,
LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
static HRESULT WINAPI IShellFolder_Printers_fnGetDetailsOf (IShellFolder2 *iface,
LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd)
{
IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
FIXME("(%p)->(%p %i %p) stub\n", This, pidl, iColumn, psd);
TRACE("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
if (iColumn >= PRINTERS_FOLDER_COL_NUM)
return E_NOTIMPL;
if (!pidl)
{
psd->fmt = printers_header[iColumn].fmt;
psd->cxChar = printers_header[iColumn].cxChar;
psd->str.uType = STRRET_CSTR;
LoadStringA (shell32_hInstance, printers_header[iColumn].colnameid,
psd->str.u.cStr, MAX_PATH);
return S_OK;
}
FIXME("unimplemented for supplied pidl\n");
return E_NOTIMPL;
}
......
......@@ -42,6 +42,10 @@
#define IDS_SHV_COLUMN11 17
#define IDS_SHV_COLUMN_DELFROM 18
#define IDS_SHV_COLUMN_DELDATE 19
#define IDS_SHV_COL_DOCS 80
#define IDS_SHV_COL_STATUS 81
#define IDS_SHV_COL_LOCATION 82
#define IDS_SHV_COL_MODEL 83
#define IDS_DESKTOP 20
#define IDS_MYCOMPUTER 21
......
......@@ -23,6 +23,9 @@
#include <stdio.h>
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "shellapi.h"
......@@ -119,9 +122,65 @@ static void test_parse_for_control_panel(void)
ILFree(pidl);
}
static void test_printers_folder(void)
{
IShellFolder2 *folder;
SHELLDETAILS details;
SHCOLSTATEF state;
INT i;
HRESULT hr;
CoInitialize( NULL );
hr = CoCreateInstance(&CLSID_Printers, NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder2, (void**)&folder);
if (hr != S_OK)
{
win_skip("Failed to created IShellFolder2 for Printers folder\n");
CoUninitialize();
return;
}
if (0)
{
/* crashes on XP */
hr = IShellFolder2_GetDetailsOf(folder, NULL, 0, NULL);
hr = IShellFolder2_GetDefaultColumnState(folder, 0, NULL);
}
/* 5 columns defined */
hr = IShellFolder2_GetDetailsOf(folder, NULL, 6, &details);
ok(hr == E_NOTIMPL, "got 0x%08x\n", hr);
hr = IShellFolder2_GetDefaultColumnState(folder, 6, &state);
ok(broken(hr == E_NOTIMPL) || hr == E_INVALIDARG /* Win7 */, "got 0x%08x\n", hr);
for(i = 0; i < 6; i++)
{
hr = IShellFolder2_GetDetailsOf(folder, NULL, i, &details);
/* doesn't work on W2K */
if (hr == E_NOTIMPL) break;
ok(hr == S_OK, "got 0x%08x\n", hr);
/* all columns are left-aligned */
ok(details.fmt == LVCFMT_LEFT, "got 0x%x\n", details.fmt);
hr = IShellFolder2_GetDefaultColumnState(folder, i, &state);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* all columns are string except document count */
if (i == 1)
ok(state == (SHCOLSTATE_TYPE_INT | SHCOLSTATE_ONBYDEFAULT), "got 0x%x\n", state);
else
ok(state == (SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT), "got 0x%x\n", state);
}
IShellFolder2_Release(folder);
CoUninitialize();
}
START_TEST(shfldr_special)
{
test_parse_for_entire_network();
test_parse_for_control_panel();
test_printers_folder();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment