Hey all,

Stefan Knorr notified me of the following whiteboard item from the
design team [1], and I have created the following patch that should
implement the desired behavior. I haven't done any of the cleanup for
this because I'd like to dig a little deeper but there are definitely
src and hrc entries that can be removed, as well as simplying the
logic a little bit in the select handler in
cui/source/options/treeopt.cxx. Ideally I'd like to clean things up to
the point where I can remove the switch statement and glean the
default page to display from information in treeopt.[src|hrc].

[1] http://wiki.documentfoundation.org/Whiteboards/KillOptions#Filler_Pages
        


August Sodora
aug...@gmail.com
(201) 280-8138
From d00daca6dec8f9cbef08bc095e8d92394816caaa Mon Sep 17 00:00:00 2001
From: August Sodora <aug...@gmail.com>
Date: Fri, 16 Dec 2011 00:14:03 -0500
Subject: [PATCH 2/2] Automatically select an option page if a user clicks on
 a category

---
 cui/source/options/treeopt.cxx |   56 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 66210b7..5fdb53a 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -1028,6 +1028,62 @@ IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG )
         return 0;
     //#111938# lock the SelectHdl_Impl to prevent multiple executes
     FlagSet_Impl aFlag(bInSelectHdl_Impl);
+
+    // If the user has selected a category, automatically switch to a suitable
+    // default sub-page instead.
+    if (!pParent)
+    {
+        OptionsGroupInfo* pGroupInfo = static_cast<OptionsGroupInfo*>(pEntry->GetUserData());
+
+        if(!pGroupInfo)
+            return 0;
+
+        switch(pGroupInfo->m_nDialogId)
+        {
+        case SID_GENERAL_OPTIONS:
+            ActivatePage(RID_SFXPAGE_GENERAL);
+            break;
+        case SID_LANGUAGE_OPTIONS:
+            ActivatePage(OFA_TP_LANGUAGES);
+            break;
+        case SID_INET_DLG:
+            ActivatePage(RID_SVXPAGE_INET_PROXY);
+            break;
+        case SID_SW_EDITOPTIONS:
+            ActivatePage(RID_SW_TP_OPTLOAD_PAGE);
+            break;
+        case SID_SW_ONLINEOPTIONS:
+            ActivatePage(RID_SW_TP_HTML_CONTENT_OPT);
+            break;
+        case SID_SC_EDITOPTIONS:
+            ActivatePage(SID_SC_TP_LAYOUT);
+            break;
+        case SID_SD_EDITOPTIONS:
+            ActivatePage(SID_SI_TP_MISC);
+            break;
+        case SID_SD_GRAPHIC_OPTIONS:
+            ActivatePage(SID_SD_TP_MISC);
+            break;
+        case SID_SM_EDITOPTIONS:
+            ActivatePage(SID_SM_TP_PRINTOPTIONS);
+            break;
+        case SID_SCH_EDITOPTIONS:
+            ActivatePage(RID_OPTPAGE_CHART_DEFCOLORS);
+            break;
+        case SID_SB_STARBASEOPTIONS:
+            ActivatePage(SID_SB_CONNECTIONPOOLING);
+            break;
+        case SID_FILTER_DLG:
+            ActivatePage(RID_SFXPAGE_SAVE);
+            break;
+        default:
+            SAL_WARN("cui", "Unrecognized options category " << pGroupInfo->m_nDialogId);
+            break;
+        }
+
+        return 0;
+    }
+
     TabPage* pOldPage = NULL;
     TabPage* pNewPage = NULL;
     OptionsPageInfo* pOptPageInfo = ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) )
-- 
1.7.5.4

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to