diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-03-29 12:02:59 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-03-29 12:20:41 +0100 |
commit | 9404908713453ed1604d66b974536523a253b72f (patch) | |
tree | eb73a153f57d8c535f171130466a03c75e64f622 /desktop | |
parent | 3a68ecc47ffcbfa0db2516b717809d824cf60eb6 (diff) |
desktop: unwind hideous StrTitle mess a little
Diffstat (limited to 'desktop')
11 files changed, 52 insertions, 57 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index 6c090845e3c7..fd6154e9d64f 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -90,9 +90,9 @@ class Window; namespace cssu = ::com::sun::star::uno; namespace css = ::com::sun::star; +using dp_misc::StrTitle; using ::rtl::OUString; - namespace dp_gui { class UpdateInstallDialog::Thread: public salhelper::Thread { @@ -619,8 +619,7 @@ void UpdateInstallDialog::Thread::download(OUString const & sDownloadURL, Update ::ucbhelper::Content sourceContent; dp_misc::create_ucb_content( &sourceContent, sDownloadURL, m_updateCmdEnv.get() ); - const OUString sTitle(sourceContent.getPropertyValue( - dp_misc::StrTitle::get() ).get<OUString>() ); + const OUString sTitle( StrTitle::getTitle( sourceContent ) ); if (destFolderContent.transferContent( sourceContent, ::ucbhelper::InsertOperation_COPY, diff --git a/desktop/source/deployment/inc/dp_ucb.h b/desktop/source/deployment/inc/dp_ucb.h index 52ac31369ac0..befd53906818 100644 --- a/desktop/source/deployment/inc/dp_ucb.h +++ b/desktop/source/deployment/inc/dp_ucb.h @@ -32,8 +32,10 @@ #include <list> #include "rtl/byteseq.hxx" #include "rtl/instance.hxx" +#include "com/sun/star/sdbc/XResultSet.hpp" #include "com/sun/star/ucb/XCommandEnvironment.hpp" #include "dp_misc_api.hxx" +#include "ucbhelper/content.hxx" namespace ucbhelper { @@ -44,10 +46,27 @@ namespace css = ::com::sun::star; namespace dp_misc { -struct DESKTOP_DEPLOYMENTMISC_DLLPUBLIC StrTitle : - public rtl::StaticWithInit<rtl::OUString, StrTitle> +struct DESKTOP_DEPLOYMENTMISC_DLLPUBLIC StrTitle { - const rtl::OUString operator () (); + static css::uno::Sequence< rtl::OUString > getTitleSequence() + { + css::uno::Sequence< rtl::OUString > aSeq( 1 ); + aSeq[ 0 ] = "Title"; + return aSeq; + } + static rtl::OUString getTitle( ::ucbhelper::Content &rContent ) + { + return rtl::OUString( rContent.getPropertyValue( + rtl::OUString::createFromAscii( "Title" ) ).get<rtl::OUString>() ); + } + // just return titles - the ucbhelper should have a simpler API for this [!] + static css::uno::Reference< css::sdbc::XResultSet > + createCursor( ::ucbhelper::Content &rContent, + ucbhelper::ResultSetInclude eInclude ) + { + return css::uno::Reference< css::sdbc::XResultSet >( + rContent.createCursor( StrTitle::getTitleSequence(), eInclude ) ); + } }; //============================================================================== diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 80a9522211a8..0ed519b414d1 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -104,12 +104,9 @@ namespace { OUString getExtensionFolder(OUString const & parentFolder, Reference<ucb::XCommandEnvironment> const & xCmdEnv) { - ::ucbhelper::Content tempFolder( - parentFolder, xCmdEnv ); + ::ucbhelper::Content tempFolder( parentFolder, xCmdEnv ); Reference<sdbc::XResultSet> xResultSet( - tempFolder.createCursor( - Sequence<OUString>( &StrTitle::get(), 1 ), - ::ucbhelper::INCLUDE_FOLDERS_ONLY ) ); + StrTitle::createCursor (tempFolder, ::ucbhelper::INCLUDE_FOLDERS_ONLY ) ); OUString title; while (xResultSet->next()) @@ -136,9 +133,8 @@ void PackageManagerImpl::initActivationLayer( { // scan for all entries in m_packagesDir: Reference<sdbc::XResultSet> xResultSet( - ucbContent.createCursor( - Sequence<OUString>( &StrTitle::get(), 1 ), - ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS ) ); + StrTitle::createCursor (ucbContent, ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS ) ); + while (xResultSet->next()) { Reference<sdbc::XRow> xRow( xResultSet, UNO_QUERY_THROW ); @@ -203,12 +199,11 @@ void PackageManagerImpl::initActivationLayer( // clean up activation layer, scan for zombie temp dirs: ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() ); - ::ucbhelper::Content tempFolder( - m_activePackages_expanded, xCmdEnv ); + ::ucbhelper::Content tempFolder( m_activePackages_expanded, xCmdEnv ); Reference<sdbc::XResultSet> xResultSet( - tempFolder.createCursor( - Sequence<OUString>( &StrTitle::get(), 1 ), - ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) ); + StrTitle::createCursor (tempFolder, + ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) ); + // get all temp directories: ::std::vector<OUString> tempEntries; ::std::vector<OUString> removedEntries; @@ -774,8 +769,7 @@ Reference<deployment::XPackage> PackageManagerImpl::addPackage( try { ::ucbhelper::Content sourceContent; create_ucb_content( &sourceContent, url, xCmdEnv ); // throws exc - const OUString title(sourceContent.getPropertyValue( - StrTitle::get() ).get<OUString>() ); + const OUString title( StrTitle::getTitle( sourceContent ) ); const OUString title_enc( ::rtl::Uri::encode( title, rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, @@ -1362,13 +1356,11 @@ bool PackageManagerImpl::synchronizeAddedExtensions( if (!create_ucb_content( NULL, m_activePackages_expanded, Reference<css::ucb::XCommandEnvironment>(), false)) return bModified; - ::ucbhelper::Content tempFolder( - m_activePackages_expanded, xCmdEnv ); + ::ucbhelper::Content tempFolder( m_activePackages_expanded, xCmdEnv ); Reference<sdbc::XResultSet> xResultSet( - tempFolder.createCursor( - Sequence<OUString>( &StrTitle::get(), 1 ), - ::ucbhelper::INCLUDE_FOLDERS_ONLY ) ); + StrTitle::createCursor( tempFolder, + ::ucbhelper::INCLUDE_FOLDERS_ONLY ) ); while (xResultSet->next()) { diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx index da07a772979c..37957e560233 100644 --- a/desktop/source/deployment/misc/dp_ucb.cxx +++ b/desktop/source/deployment/misc/dp_ucb.cxx @@ -48,11 +48,6 @@ using ::rtl::OUString; namespace dp_misc { -const OUString StrTitle::operator () () -{ - return OUSTR("Title"); -} - //============================================================================== bool create_ucb_content( ::ucbhelper::Content * ret_ucbContent, OUString const & url, @@ -146,7 +141,7 @@ bool create_folder( try { if (parentContent.insertNewContent( info.Type, - Sequence<OUString>( &StrTitle::get(), 1 ), + StrTitle::getTitleSequence(), Sequence<Any>( &title, 1 ), ucb_content )) { if (ret_ucb_content != 0) diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 32ad377a64e4..b28d0a0b5a5d 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -740,8 +740,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( // detect exact media-type: ::ucbhelper::Content ucbContent; if (create_ucb_content( &ucbContent, url, xCmdEnv )) { - const OUString title( ucbContent.getPropertyValue( - StrTitle::get() ).get<OUString>() ); + const OUString title( StrTitle::getTitle( ucbContent ) ); if (title.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM(SAL_DLLEXTENSION) )) { @@ -785,8 +784,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( if (!bRemoved) { ::ucbhelper::Content ucbContent( url, xCmdEnv ); - name = ucbContent.getPropertyValue( - StrTitle::get() ).get<OUString>(); + name = StrTitle::getTitle( ucbContent ); } if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.uno-component")) diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index dd1b00b989fa..d28e3e9c62b2 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -322,8 +322,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( ::ucbhelper::Content ucbContent; if (create_ucb_content( &ucbContent, url, xCmdEnv )) { - const OUString title( ucbContent.getPropertyValue( - StrTitle::get() ).get<OUString>() ); + const OUString title( StrTitle::getTitle( ucbContent ) ); if (title.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM(".xcu") )) { mediaType = OUSTR("application/" @@ -351,8 +350,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( if (!bRemoved) { ::ucbhelper::Content ucbContent( url, xCmdEnv ); - name = ucbContent.getPropertyValue( - StrTitle::get() ).get<OUString>(); + name = StrTitle::getTitle( ucbContent ); } ::ucbhelper::Content ucbContent( url, xCmdEnv ); diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index f25c8a8f0bec..8b84ec5d565c 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -274,10 +274,10 @@ void PackageRegistryBackend::deleteUnusedFolders( const OUString sDataFolder = makeURL(getCachePath(), relUrl); ::ucbhelper::Content tempFolder( sDataFolder, Reference<ucb::XCommandEnvironment>()); + Reference<sdbc::XResultSet> xResultSet( - tempFolder.createCursor( - Sequence<OUString>( &StrTitle::get(), 1 ), - ::ucbhelper::INCLUDE_FOLDERS_ONLY ) ); + StrTitle::createCursor( tempFolder, ::ucbhelper::INCLUDE_FOLDERS_ONLY ) ); + // get all temp directories: ::std::vector<OUString> tempEntries; diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index 5f18e41a4a05..528c413806db 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -493,8 +493,7 @@ Reference<deployment::XPackage> PackageRegistryImpl::bindPackage( &ucbContent, url, xCmdEnv, false /* no throw */ ) && !ucbContent.isFolder()) { - OUString title( ucbContent.getPropertyValue( - StrTitle::get() ).get<OUString>() ); + OUString title( StrTitle::getTitle( ucbContent ) ); for (;;) { const t_string2string::const_iterator iFind( diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx index 15a9b09cd4f1..a64193293011 100644 --- a/desktop/source/deployment/registry/executable/dp_executable.cxx +++ b/desktop/source/deployment/registry/executable/dp_executable.cxx @@ -188,8 +188,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( if (!bRemoved) { ::ucbhelper::Content ucbContent( url, xCmdEnv ); - name = ucbContent.getPropertyValue( - dp_misc::StrTitle::get() ).get<OUString>(); + name = StrTitle::getTitle( ucbContent ); } if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.executable")) { diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 0a5083929bad..cf7deae91635 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -203,8 +203,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( if (!bRemoved) { ::ucbhelper::Content ucbContent( url, xCmdEnv ); - name = ucbContent.getPropertyValue( - StrTitle::get() ).get<OUString>(); + name = StrTitle::getTitle( ucbContent ); } if (subType.EqualsIgnoreCaseAscii( diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index dac1ff661e26..997fef46d2ad 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -405,8 +405,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( } else { - const OUString title( ucbContent.getPropertyValue( - StrTitle::get() ).get<OUString>() ); + const OUString title( StrTitle::getTitle( ucbContent ) ); if (title.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM(".oxt") ) || title.endsWithIgnoreAsciiCaseAsciiL( @@ -437,8 +436,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( if (!bRemoved) { ::ucbhelper::Content ucbContent( url, xCmdEnv ); - name = ucbContent.getPropertyValue( - StrTitle::get() ).get<OUString>(); + name = StrTitle::getTitle( ucbContent ); } if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.package-bundle")) { return new PackageImpl( @@ -1054,7 +1052,7 @@ void BackendImpl::PackageImpl::exportTo( ::ucbhelper::Content sourceContent( m_url_expanded, xCmdEnv ); OUString title(newTitle); if (title.isEmpty()) - sourceContent.getPropertyValue( StrTitle::get() ) >>= title; + sourceContent.getPropertyValue( OUSTR( "Title" ) ) >>= title; OUString destURL( makeURL( destFolderURL, ::rtl::Uri::encode( title, rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, @@ -1566,8 +1564,7 @@ void BackendImpl::PackageImpl::scanLegacyBundle( ::ucbhelper::Content ucbContent( url, xCmdEnv ); // check for platform paths: - const OUString title( ucbContent.getPropertyValue( - StrTitle::get() ).get<OUString>() ); + const OUString title( StrTitle::getTitle( ucbContent ) ); if (title.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM(".plt") ) && !platform_fits( title.copy( 0, title.getLength() - 4 ) )) { @@ -1577,7 +1574,7 @@ void BackendImpl::PackageImpl::scanLegacyBundle( RTL_CONSTASCII_STRINGPARAM("skip_registration") )) skip_registration = true; - OUString ar [] = { StrTitle::get(), OUSTR("IsFolder") }; + OUString ar [] = { OUSTR("Title"), OUSTR("IsFolder") }; Reference<sdbc::XResultSet> xResultSet( ucbContent.createCursor( Sequence<OUString>( ar, ARLEN(ar) ), |