[Libreoffice-commits] core.git: extensions/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 3 20:39:55 UTC 2020


 extensions/source/bibliography/datman.cxx           |    6 +---
 extensions/source/config/ldap/ldapuserprofilebe.cxx |   30 ++++++--------------
 extensions/source/dbpilots/controlwizard.cxx        |    3 --
 extensions/source/propctrlr/eventhandler.cxx        |    6 +---
 4 files changed, 15 insertions(+), 30 deletions(-)

New commits:
commit 3d3cb4328ece843b3e31b8411f9d16bbedb57a7b
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Jun 3 11:46:51 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Jun 3 22:39:11 2020 +0200

    Upcoming loplugin:elidestringvar: extensions
    
    Change-Id: I318eebbdc79c503b10570061a298eb76d6555540
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95402
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index 0b16d3fa05c0..99aeabe4de7d 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -589,11 +589,10 @@ void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid)
             xFields->getByName( rField ) >>= xField;
 
             OUString sCurrentModelType;
-            const OUString sType("Type");
             sal_Int32 nType = 0;
             bool bIsFormatted           = false;
             bool bFormattedIsNumeric    = true;
-            xField->getPropertyValue(sType) >>= nType;
+            xField->getPropertyValue("Type") >>= nType;
             switch(nType)
             {
                 case DataType::BIT:
@@ -1189,9 +1188,8 @@ Reference< awt::XControlModel > BibDataManager::loadControlModel(
             aElement = xFields->getByName(rName);
             aElement >>= xField;
 
-            const OUString sType("Type");
             sal_Int32 nFormatKey = 0;
-            xField->getPropertyValue(sType) >>= nFormatKey;
+            xField->getPropertyValue("Type") >>= nFormatKey;
 
             OUString aInstanceName("com.sun.star.form.component.");
 
diff --git a/extensions/source/config/ldap/ldapuserprofilebe.cxx b/extensions/source/config/ldap/ldapuserprofilebe.cxx
index 897965ab64a9..fdb6ccba9b77 100644
--- a/extensions/source/config/ldap/ldapuserprofilebe.cxx
+++ b/extensions/source/config/ldap/ldapuserprofilebe.cxx
@@ -87,16 +87,6 @@ bool LdapUserProfileBe::readLdapConfiguration(
     LdapDefinition * definition, OUString * loggedOnUser)
 {
     OSL_ASSERT(context.is() && definition != nullptr && loggedOnUser != nullptr);
-    const OUString kReadOnlyViewService("com.sun.star.configuration.ConfigurationAccess") ;
-    const OUString kComponent("org.openoffice.LDAP/UserDirectory");
-    const OUString kServerDefinition("ServerDefinition");
-    const OUString kServer("Server");
-    const OUString kPort("Port");
-    const OUString kBaseDN("BaseDN");
-    const OUString kUser("SearchUser");
-    const OUString kPassword("SearchPassword");
-    const OUString kUserObjectClass("UserObjectClass");
-    const OUString kUserUniqueAttr("UserUniqueAttribute");
 
     uno::Reference< XInterface > xIface;
     try
@@ -104,35 +94,35 @@ bool LdapUserProfileBe::readLdapConfiguration(
         uno::Reference< lang::XMultiServiceFactory > xCfgProvider(
             css::configuration::theDefaultProvider::get(context));
 
-        css::beans::NamedValue aPath("nodepath", uno::makeAny(kComponent) );
+        css::beans::NamedValue aPath("nodepath", uno::makeAny(OUString("org.openoffice.LDAP/UserDirectory")) );
 
         uno::Sequence< uno::Any > aArgs(1);
         aArgs[0] <<=  aPath;
 
-        xIface = xCfgProvider->createInstanceWithArguments(kReadOnlyViewService, aArgs);
+        xIface = xCfgProvider->createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aArgs);
 
         uno::Reference<container::XNameAccess > xAccess(xIface, uno::UNO_QUERY_THROW);
-        xAccess->getByName(kServerDefinition) >>= xIface;
+        xAccess->getByName("ServerDefinition") >>= xIface;
 
         uno::Reference<container::XNameAccess > xChildAccess(xIface, uno::UNO_QUERY_THROW);
 
-        if (!getLdapStringParam(xChildAccess, kServer, definition->mServer))
+        if (!getLdapStringParam(xChildAccess, "Server", definition->mServer))
             return false;
-        if (!getLdapStringParam(xChildAccess, kBaseDN, definition->mBaseDN))
+        if (!getLdapStringParam(xChildAccess, "BaseDN", definition->mBaseDN))
             return false;
 
         definition->mPort=0;
-        xChildAccess->getByName(kPort) >>= definition->mPort ;
+        xChildAccess->getByName("Port") >>= definition->mPort ;
         if (definition->mPort == 0)
             return false;
 
-        if (!getLdapStringParam(xAccess, kUserObjectClass, definition->mUserObjectClass))
+        if (!getLdapStringParam(xAccess, "UserObjectClass", definition->mUserObjectClass))
             return false;
-        if (!getLdapStringParam(xAccess, kUserUniqueAttr, definition->mUserUniqueAttr))
+        if (!getLdapStringParam(xAccess, "UserUniqueAttribute", definition->mUserUniqueAttr))
             return false;
 
-        getLdapStringParam(xAccess, kUser, definition->mAnonUser);
-        getLdapStringParam(xAccess, kPassword, definition->mAnonCredentials);
+        getLdapStringParam(xAccess, "SearchUser", definition->mAnonUser);
+        getLdapStringParam(xAccess, "SearchPassword", definition->mAnonCredentials);
     }
     catch (const uno::Exception&)
     {
diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx
index 18b3c9489f99..f7d189ddee38 100644
--- a/extensions/source/dbpilots/controlwizard.cxx
+++ b/extensions/source/dbpilots/controlwizard.cxx
@@ -437,8 +437,7 @@ namespace dbp
         catch(const Exception&) { }
         if (!xHandler.is())
         {
-            const OUString sInteractionHandlerServiceName("com.sun.star.task.InteractionHandler");
-            ShowServiceNotAvailableError(_pWindow, sInteractionHandlerServiceName, true);
+            ShowServiceNotAvailableError(_pWindow, "com.sun.star.task.InteractionHandler", true);
         }
         return xHandler;
     }
diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx
index 638ff02a77e8..32d9894dace4 100644
--- a/extensions/source/propctrlr/eventhandler.cxx
+++ b/extensions/source/propctrlr/eventhandler.cxx
@@ -619,10 +619,8 @@ namespace pcr
                 aComposeBuffer.append( xScriptUri->getName() );
 
                 // location
-                const OUString sLocationParamName(  "location"  );
-                const OUString sLocation = xScriptUri->getParameter( sLocationParamName );
-                const OUString sLangParamName(  "language"  );
-                const OUString sLanguage = xScriptUri->getParameter( sLangParamName );
+                const OUString sLocation = xScriptUri->getParameter( "location" );
+                const OUString sLanguage = xScriptUri->getParameter( "language" );
 
                 if ( !(sLocation.isEmpty() && sLanguage.isEmpty()) )
                 {


More information about the Libreoffice-commits mailing list