summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@suse.com>2012-05-08 15:42:54 +0200
committerAndras Timar <atimar@suse.com>2013-04-02 14:15:09 -0700
commit22d2ec9cd84292e06496470906694f693f9ebe1a (patch)
treec442ae6128775cde1e5d1dade11cc9dba707909e /fpicker
parenta31baac0ea97d369e71503c2e92c374f9f589a76 (diff)
novell-win32-xp-fpicker-detail.diff, bnc#620924
make it possible to set file open dialog default to "details" on XP
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/win32/filepicker/FileOpenDlg.cxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/fpicker/source/win32/filepicker/FileOpenDlg.cxx b/fpicker/source/win32/filepicker/FileOpenDlg.cxx
index 6397a2561274..eef2d1649760 100644
--- a/fpicker/source/win32/filepicker/FileOpenDlg.cxx
+++ b/fpicker/source/win32/filepicker/FileOpenDlg.cxx
@@ -536,6 +536,13 @@ void SAL_CALL CFileOpenDialog::handleInitDialog(HWND hwndDlg, HWND hwndChild)
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
+#ifndef ODM_VIEW_DETAIL
+
+// Reverse-engineered command codes for SHELLDLL_DefView
+// See http://msdn.microsoft.com/en-us/magazine/cc164009.aspx
+#define ODM_VIEW_DETAIL 0x702c
+
+#endif
UINT_PTR CALLBACK CFileOpenDialog::ofnHookProc(
HWND hChildDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
@@ -543,6 +550,10 @@ UINT_PTR CALLBACK CFileOpenDialog::ofnHookProc(
HWND hwndDlg = GetParent(hChildDlg);
CFileOpenDialog* pImpl = NULL;
+ static bool set_view_details = false;
+ static bool view_was_set = false;
+
+
switch( uiMsg )
{
case WM_INITDIALOG:
@@ -561,11 +572,39 @@ UINT_PTR CALLBACK CFileOpenDialog::ofnHookProc(
// connect the instance handle to the window
SetProp(hwndDlg, CURRENT_INSTANCE, pImpl);
pImpl->handleInitDialog(hwndDlg, hChildDlg);
+
+ static bool beenhere = false;
+
+ if (!beenhere)
+ {
+ HKEY hkey;
+ beenhere = true;
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ L"Software\\Novell\\OpenOffice.org",
+ 0, KEY_READ, &hkey) == ERROR_SUCCESS)
+ {
+ if (RegQueryValueEx(hkey, L"FileOpenUseDetailsViewByDefault",
+ NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
+ set_view_details = true;
+ RegCloseKey(hkey);
+ }
+ }
+ view_was_set = false;
}
return 0;
case WM_NOTIFY:
{
+ if (set_view_details && !view_was_set)
+ {
+ // See http://msdn.microsoft.com/en-us/magazine/cc164009.aspx
+ HWND shell = GetDlgItem(hwndDlg, lst2);
+ if (shell != NULL)
+ {
+ SendMessage (shell, WM_COMMAND, ODM_VIEW_DETAIL, 0);
+ view_was_set = true;
+ }
+ }
pImpl = getCurrentInstance(hwndDlg);
return pImpl->onWMNotify(
hChildDlg, reinterpret_cast<LPOFNOTIFY>(lParam));