[Libreoffice-commits] .: 6 commits - desktop/source

David Tardon dtardon at kemper.freedesktop.org
Sat Nov 20 07:59:54 PST 2010


 desktop/source/deployment/manager/dp_commandenvironments.cxx |   28 ------
 desktop/source/deployment/manager/dp_commandenvironments.hxx |   16 ---
 desktop/source/deployment/manager/dp_extensionmanager.cxx    |   49 ++++-------
 desktop/source/deployment/registry/dp_backend.cxx            |    4 
 desktop/source/deployment/registry/dp_backenddb.cxx          |   12 --
 desktop/source/deployment/registry/help/dp_helpbackenddb.cxx |   33 -------
 desktop/source/deployment/registry/inc/dp_backenddb.hxx      |    3 
 7 files changed, 25 insertions(+), 120 deletions(-)

New commits:
commit e00336dcecafbf8f604f93eff43972ed33048f2b
Author: David Tardon <dtardon at redhat.com>
Date:   Sat Nov 20 16:29:14 2010 +0100

    use RTL_CONSTASCII_STRINGPARAM

diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 95b950b..4ed6794 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -275,7 +275,7 @@ void PackageRegistryBackend::deleteUnusedFolders(
         // get all temp directories:
         ::std::vector<OUString> tempEntries;
 
-        char tmp[] = ".tmp";
+        const char tmp[] = ".tmp";
 
         while (xResultSet->next())
         {
@@ -284,7 +284,7 @@ void PackageRegistryBackend::deleteUnusedFolders(
                     xResultSet, UNO_QUERY_THROW )->getString(
                         1 /* Title */ ) );
 
-            if (title.endsWithAsciiL(tmp, sizeof(tmp) - 1))
+            if (title.endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM(tmp)))
                 tempEntries.push_back(
                     makeURLAppendSysPathSegment(sDataFolder, title));
         }
commit cc0c6525d79c4a794bc5220b5cd77b8d785dc0fd
Author: David Tardon <dtardon at redhat.com>
Date:   Sat Nov 20 14:02:00 2010 +0100

    remove redundant code

diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx
index 92ce961..b18243b 100644
--- a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx
+++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx
@@ -136,40 +136,9 @@ HelpBackendDb::getEntry(::rtl::OUString const & url)
 
 ::std::list<OUString> HelpBackendDb::getAllDataUrls()
 {
-    try
-    {
-        ::std::list<OUString> listRet;
-        Reference<css::xml::dom::XDocument> doc = getDocument();
-        Reference<css::xml::dom::XNode> root = doc->getFirstChild();
-
-        Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
-        const OUString sPrefix = getNSPrefix();
-        OUString sExpression(
-            sPrefix + OUSTR(":help/") + sPrefix + OUSTR(":data-url/text()"));
-        Reference<css::xml::dom::XNodeList> nodes =
-            xpathApi->selectNodeList(root, sExpression);
-        if (nodes.is())
-        {
-            sal_Int32 length = nodes->getLength();
-            for (sal_Int32 i = 0; i < length; i++)
-                listRet.push_back(nodes->item(i)->getNodeValue());
-        }
-        return listRet;
-    }
-    catch (css::deployment::DeploymentException& )
-    {
-        throw;
-    }
-    catch(css::uno::Exception &)
-    {
-        Any exc( ::cppu::getCaughtException() );
-        throw css::deployment::DeploymentException(
-            OUSTR("Extension Manager: failed to read data entry in help backend db: ") +
-            m_urlDb, 0, exc);
-    }
+    return getOneChildFromAllEntries(OUString(RTL_CONSTASCII_USTRINGPARAM("data-url")));
 }
 
-
 } // namespace help
 } // namespace backend
 } // namespace dp_registry
commit 1ad20b57cd20972a4bb3a3b92f591075ecdef329
Author: David Tardon <dtardon at redhat.com>
Date:   Sat Nov 20 13:38:48 2010 +0100

    simplify bool expression

diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx
index b22e017..dabb414 100644
--- a/desktop/source/deployment/registry/dp_backenddb.cxx
+++ b/desktop/source/deployment/registry/dp_backenddb.cxx
@@ -625,11 +625,8 @@ bool RegisteredDb::getEntry(::rtl::OUString const & url)
         Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
         Reference<css::xml::dom::XNode> aNode =
             xpathApi->selectSingleNode(root, sExpression);
-        if (!aNode.is())
-        {
-            return false;
-        }
-        return true;
+
+        return aNode.is();
     }
     catch(css::uno::Exception &)
     {
commit 30a8ea75e7f96bc5320c3051475c982f72be080c
Author: David Tardon <dtardon at redhat.com>
Date:   Sat Nov 20 13:36:27 2010 +0100

    fix comments

diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index dc737dd..4584862 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -78,8 +78,6 @@ namespace beans = com::sun::star::beans;
 namespace util = com::sun::star::util;
 namespace css = com::sun::star;
 
-//#define OUSTR(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
-
 using ::com::sun::star::uno::Reference;
 using ::rtl::OUString;
 
@@ -90,7 +88,6 @@ struct CompIdentifiers
     bool operator() (::std::vector<Reference<deploy::XPackage> > const & a,
                      ::std::vector<Reference<deploy::XPackage> > const & b)
         {
-
             if (getName(a).compareTo(getName(b)) < 0)
                 return true;
             return false;
@@ -170,7 +167,7 @@ ExtensionRemoveGuard::~ExtensionRemoveGuard()
     }
 }
 
-} //end namespace
+}
 
 namespace dp_manager {
 
@@ -227,7 +224,7 @@ ExtensionManager::getPackageManager(::rtl::OUString const & repository)
   Enters the XPackage objects into a map. They must be all from the
   same repository. The value type of the map is a vector, where each vector
   represents an extension with a particular identifier. The first member
-  is represents the user extension, the second the shared extension and the
+  represents the user extension, the second the shared extension and the
   third the bundled extension.
  */
 void ExtensionManager::addExtensionsToMap(
@@ -266,8 +263,8 @@ void ExtensionManager::addExtensionsToMap(
 
 /*
    returns a list containing extensions with the same identifier from
-   all repositories (user, shared, bundled) If one repository does not
-   have this extension, then the list contains an empty Referenc. The list
+   all repositories (user, shared, bundled). If one repository does not
+   have this extension, then the list contains an empty Reference. The list
    is ordered according to the priority of the repostories:
    1. user
    2. shared
@@ -712,7 +709,7 @@ Reference<deploy::XPackage> ExtensionManager::addExtension(
                 }
                 //check again dependencies but prevent user interaction,
                 //We can disregard the license, because the user must have already
-                //accepted it, whe we called checkPrerequisites the first time
+                //accepted it, when we called checkPrerequisites the first time
                 SilentCheckPrerequisitesCommandEnv * pSilentCommandEnv =
                     new SilentCheckPrerequisitesCommandEnv();
                 Reference<ucb::XCommandEnvironment> silentCommandEnv(pSilentCommandEnv);
diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx
index 905ff6e..b22e017 100644
--- a/desktop/source/deployment/registry/dp_backenddb.cxx
+++ b/desktop/source/deployment/registry/dp_backenddb.cxx
@@ -566,13 +566,10 @@ OUString BackendDb::readSimpleElement(
 }
 
 
-
-//================================================================================
 RegisteredDb::RegisteredDb(
     Reference<XComponentContext> const &  xContext,
     ::rtl::OUString const & url):BackendDb(xContext, url)
 {
-
 }
 
 void RegisteredDb::addEntry(::rtl::OUString const & url)
@@ -626,7 +623,6 @@ bool RegisteredDb::getEntry(::rtl::OUString const & url)
         Reference<css::xml::dom::XNode> root = doc->getFirstChild();
 
         Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
-        //find the extension element that is to be removed
         Reference<css::xml::dom::XNode> aNode =
             xpathApi->selectSingleNode(root, sExpression);
         if (!aNode.is())
@@ -644,7 +640,6 @@ bool RegisteredDb::getEntry(::rtl::OUString const & url)
     }
 }
 
-
 } // namespace backend
 } // namespace dp_registry
 
diff --git a/desktop/source/deployment/registry/inc/dp_backenddb.hxx b/desktop/source/deployment/registry/inc/dp_backenddb.hxx
index 11dff5a..12a9d14 100644
--- a/desktop/source/deployment/registry/inc/dp_backenddb.hxx
+++ b/desktop/source/deployment/registry/inc/dp_backenddb.hxx
@@ -140,8 +140,6 @@ protected:
      */
     virtual ::rtl::OUString getKeyElementName()=0;
 
-
-
 public:
     BackendDb(css::uno::Reference<css::uno::XComponentContext> const &  xContext,
               ::rtl::OUString const & url);
@@ -164,7 +162,6 @@ public:
 
 };
 
-
 }
 }
 #endif
commit 18b1db954a750da212cfbfbf56a19e6caef1f700
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Nov 19 13:37:49 2010 +0100

    replace code repetition by a loop

diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index c6529ec..dc737dd 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -283,29 +283,21 @@ void ExtensionManager::addExtensionsToMap(
 
 {
     ::std::list<Reference<deploy::XPackage> > extensionList;
-    try
-    {   //will throw an exception if the extension does not exist
-        extensionList.push_back(m_userRepository->getDeployedPackage(
-            identifier, fileName, Reference<ucb::XCommandEnvironment>()));
-    } catch(lang::IllegalArgumentException &)
-    {
-        extensionList.push_back(Reference<deploy::XPackage>());
-    }
-    try
-    {
-        extensionList.push_back(m_sharedRepository->getDeployedPackage(
-            identifier, fileName, Reference<ucb::XCommandEnvironment>()));
-    } catch (lang::IllegalArgumentException &)
-    {
-        extensionList.push_back(Reference<deploy::XPackage>());
-    }
-    try
-    {
-       extensionList.push_back(m_bundledRepository->getDeployedPackage(
-           identifier, fileName, Reference<ucb::XCommandEnvironment>()));
-    } catch (lang::IllegalArgumentException &)
+    Reference<deploy::XPackageManager> lRepos[] = {
+        m_userRepository, m_sharedRepository, m_bundledRepository };
+    for (int i(0); i != SAL_N_ELEMENTS(lRepos); ++i)
     {
-        extensionList.push_back(Reference<deploy::XPackage>());
+        Reference<deploy::XPackage> xPackage;
+        try
+        {
+            xPackage = lRepos[i]->getDeployedPackage(
+                identifier, fileName, Reference<ucb::XCommandEnvironment>());
+        }
+        catch(lang::IllegalArgumentException &)
+        {
+            // thrown if the extension does not exist in this repository
+        }
+        extensionList.push_back(xPackage);
     }
     OSL_ASSERT(extensionList.size() == 3);
     return extensionList;
commit 14634379e947305fffa938ab58a2d61247c66731
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Nov 18 09:36:38 2010 +0100

    remove unused code

diff --git a/desktop/source/deployment/manager/dp_commandenvironments.cxx b/desktop/source/deployment/manager/dp_commandenvironments.cxx
index ba32b30..e159382 100644
--- a/desktop/source/deployment/manager/dp_commandenvironments.cxx
+++ b/desktop/source/deployment/manager/dp_commandenvironments.cxx
@@ -287,33 +287,7 @@ void SilentCheckPrerequisitesCommandEnv::handle(
         m_UnknownException = request;
     }
 }
-// NoExceptionCommandEnv::NoExceptionCommandEnv(
-//     css::uno::Reference< css::task::XInteractionHandler> const & handler,
-//     css::uno::Type const & type):
-//     BaseCommandEnv(handler),
-//     m_type(type)
-// {
-// }
-// // XInteractionHandler
-// void NoExceptionCommandEnv::handle(
-//     Reference< task::XInteractionRequest> const & xRequest )
-//     throw (uno::RuntimeException)
-// {
-//     uno::Any request( xRequest->getRequest() );
-//     OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION );
-
-// 	deployment::LicenseException licExc;
 
-//     bool approve = false;
-//     bool abort = false;
-
-//     if (request.getValueType() == m_type)
-//     {
-//         approve = true;
-//     }
-//     handle_(approve, abort, xRequest);
-// }
-
-} // namespace dp_manager
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/deployment/manager/dp_commandenvironments.hxx b/desktop/source/deployment/manager/dp_commandenvironments.hxx
index da64628..642822c 100644
--- a/desktop/source/deployment/manager/dp_commandenvironments.hxx
+++ b/desktop/source/deployment/manager/dp_commandenvironments.hxx
@@ -154,22 +154,6 @@ public:
     css::uno::Any m_UnknownException;
 };
 
-// class NoExceptionCommandEnv : public BaseCommandEnv
-// {
-//     css::uno::Type m_type;
-// public:
-//     NoExceptionCommandEnv::NoExceptionCommandEnv(){};
-//     NoExceptionCommandEnv::NoExceptionCommandEnv(
-//         css::uno::Reference< css::task::XInteractionHandler> const & handler,
-//         css::uno::Type const & type);
-
-// // XInteractionHandler
-//     virtual void SAL_CALL handle(
-//         css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
-//         throw (css::uno::RuntimeException);
-
-// };
-
 }
 
 #endif


More information about the Libreoffice-commits mailing list