[Libreoffice-commits] core.git: sw/inc sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 11 16:32:38 UTC 2021


 sw/inc/strings.hrc                |    1 
 sw/source/ui/index/swuiidxmrk.cxx |   43 +++++---------------------------------
 2 files changed, 6 insertions(+), 38 deletions(-)

New commits:
commit a73e8f1111f4baa8073c998ad84783dd5fc6b7bb
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Jun 11 15:11:42 2021 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jun 11 18:31:55 2021 +0200

    sw define bibliography entry dialog: unconditionally allow the browse button
    
    This eliminates the "Local file" type, arguing that regardless of the
    type of the bibliography entry, it may make sense to associate a local
    URL with that.
    
    Additionally, this allows using the file picker with non-HTTP URLs, like
    webdav.
    
    Change-Id: I315facdcf292f439765c420e5368a99267fe1a98
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117059
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 9bcd76aad2b8..b2baef074e2a 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -766,7 +766,6 @@
 #define STR_AUTH_TYPE_CUSTOM3                   NC_("STR_AUTH_TYPE_CUSTOM3", "User-defined3")
 #define STR_AUTH_TYPE_CUSTOM4                   NC_("STR_AUTH_TYPE_CUSTOM4", "User-defined4")
 #define STR_AUTH_TYPE_CUSTOM5                   NC_("STR_AUTH_TYPE_CUSTOM5", "User-defined5")
-#define STR_AUTH_TYPE_LOCAL_FILE                NC_("STR_AUTH_TYPE_LOCAL_FILE", "Local file")
 #define STR_AUTH_FIELD_IDENTIFIER               NC_("STR_AUTH_FIELD_IDENTIFIER", "Short name")
 #define STR_AUTH_FIELD_AUTHORITY_TYPE           NC_("STR_AUTH_FIELD_AUTHORITY_TYPE", "Type")
 #define STR_AUTH_FIELD_ADDRESS                  NC_("STR_AUTH_FIELD_ADDRESS", "Address")
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 40e62f9b7d7b..8b4548647af5 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1598,28 +1598,14 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
             else
                 m_aOrigContainers.back()->move(m_xTypeListBox.get(), m_xRight.get());
 
-            for (int j = 0; j <= AUTH_TYPE_END; j++)
+            for (int j = 0; j < AUTH_TYPE_END; j++)
             {
-                if (j < AUTH_TYPE_END)
-                {
-                    m_xTypeListBox->append_text(
-                        SwAuthorityFieldType::GetAuthTypeName(static_cast<ToxAuthorityType>(j)));
-                }
-                else
-                {
-                    // UI-only type: local file.
-                    m_xTypeListBox->append_text(SwResId(STR_AUTH_TYPE_LOCAL_FILE));
-                }
+                m_xTypeListBox->append_text(
+                    SwAuthorityFieldType::GetAuthTypeName(static_cast<ToxAuthorityType>(j)));
             }
             if(!pFields[aCurInfo.nToxField].isEmpty())
             {
-                int nPos = pFields[aCurInfo.nToxField].toInt32();
-                if (nPos == AUTH_TYPE_WWW && comphelper::isFileUrl(pFields[AUTH_FIELD_URL]))
-                {
-                    // Map file URL to local file.
-                    nPos = AUTH_TYPE_END;
-                }
-                m_xTypeListBox->set_active(nPos);
+                m_xTypeListBox->set_active(pFields[aCurInfo.nToxField].toInt32());
             }
             m_xTypeListBox->set_grid_left_attach(1);
             m_xTypeListBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
@@ -1741,13 +1727,7 @@ OUString  SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) cons
     if( AUTH_FIELD_AUTHORITY_TYPE == eField )
     {
         OSL_ENSURE(m_xTypeListBox, "No ListBox");
-        int nActive = m_xTypeListBox->get_active();
-        if (nActive == AUTH_TYPE_END)
-        {
-            // Map local file to file URL.
-            nActive = AUTH_TYPE_WWW;
-        }
-        return OUString::number(nActive);
+        return OUString::number(m_xTypeListBox->get_active());
     }
 
     if( AUTH_FIELD_IDENTIFIER == eField && !m_bNewEntryMode)
@@ -1814,18 +1794,7 @@ IMPL_LINK(SwCreateAuthEntryDlg_Impl, ShortNameHdl, weld::Entry&, rEdit, void)
 IMPL_LINK(SwCreateAuthEntryDlg_Impl, EnableHdl, weld::ComboBox&, rBox, void)
 {
     m_xOKBT->set_sensitive(m_bNameAllowed && rBox.get_active() != -1);
-
-    int nType = m_xTypeListBox->get_active();
-    if (nType == AUTH_TYPE_END && !m_xBrowseButton->is_visible())
-    {
-        // File URL -> show the browse button.
-        m_xBrowseButton->show();
-    }
-    else if (nType != AUTH_TYPE_END && m_xBrowseButton->is_visible())
-    {
-        // Not a file URL -> hide the browse button.
-        m_xBrowseButton->hide();
-    }
+    m_xBrowseButton->show();
 };
 
 IMPL_LINK_NOARG(SwCreateAuthEntryDlg_Impl, BrowseHdl, weld::Button&, void)


More information about the Libreoffice-commits mailing list