summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2023-03-08 17:03:35 +0100
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2023-03-17 14:22:44 +0000
commit928957ee04c57a20bab42223b81f55a714b62d9c (patch)
tree0f19ceb13293264574c979acdf9da92d0bd9e0ec /basic
parentf18b76cad2e27fe5167cd683916d592088c5bf99 (diff)
tdf#151741 - BASIC Organizer: fill various URLs for libraries
Otherwise, libraries cannot be renamed in the BASIC organizer. Change-Id: I6c78cdee12f8d6128acf68e889fca463ed782477 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148483 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/uno/namecont.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 7716649ee5fa..ca8beee5e74e 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -2146,6 +2146,9 @@ Reference< XNameContainer > SAL_CALL SfxLibraryContainer::createLibrary( const O
pNewLib->maLibElementFileExtension = maLibElementFileExtension;
createVariableURL( pNewLib->maUnexpandedStorageURL, Name, maInfoFileName, true );
+ // tdf#151741 - fill various storage URLs for the newly created library
+ checkStorageURL(pNewLib->maUnexpandedStorageURL, pNewLib->maLibInfoFileURL,
+ pNewLib->maStorageURL, pNewLib->maUnexpandedStorageURL);
Reference< XNameAccess > xNameAccess( pNewLib );
Any aElement;
@@ -2491,10 +2494,6 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
}
loadLibrary( Name );
- // Remove from container
- maNameContainer->removeByName( Name );
- maModifiable.setModified( true );
-
// Rename library folder, but not for linked libraries
bool bMovedSuccessful = true;
@@ -2505,6 +2504,14 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
bMovedSuccessful = false;
OUString aLibDirPath = pImplLib->maStorageURL;
+ // tdf#151741 - fill various storage URLs for the library
+ // These URLs should not be empty for newly created libraries after
+ // the change in SfxLibraryContainer::createLibrary.
+ if (aLibDirPath.isEmpty())
+ {
+ checkStorageURL(pImplLib->maUnexpandedStorageURL, pImplLib->maLibInfoFileURL,
+ pImplLib->maStorageURL, pImplLib->maUnexpandedStorageURL);
+ }
INetURLObject aDestInetObj( o3tl::getToken(maLibraryPath, 1, ';'));
aDestInetObj.insertName( NewName, true, INetURLObject::LAST_SEGMENT,
@@ -2581,12 +2588,13 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
bMovedSuccessful = true;
pImplLib->implSetModified( true );
+ // Remove old library from container
+ maNameContainer->removeByName( Name );
+ maModifiable.setModified( true );
}
}
catch(const Exception& )
{
- // Restore old library
- maNameContainer->insertByName( Name, aLibAny ) ;
}
}