summaryrefslogtreecommitdiff
path: root/svtools/source/contnr
diff options
context:
space:
mode:
authorKai Sommerfeld <kso@openoffice.org>2010-06-08 16:26:01 +0200
committerKai Sommerfeld <kso@openoffice.org>2010-06-08 16:26:01 +0200
commita080fcbc00bbbb14e92f1850ef9c79d2c833b646 (patch)
tree87045c524249f5f43405c996b4bd3561d3215249 /svtools/source/contnr
parentac433a52867211e4c8c8a1a306ed38ba575645e1 (diff)
#i112173# - Handle keyinput for delete according to actual content properties.
Diffstat (limited to 'svtools/source/contnr')
-rw-r--r--svtools/source/contnr/fileview.cxx67
1 files changed, 54 insertions, 13 deletions
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 73a0aac06f3f..fa4af2896994 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1006,12 +1006,31 @@ void ViewTabListBox_Impl::DeleteEntries()
aURL = ( (SvtContentEntry*)pCurEntry->GetUserData() )->maURL;
if ( !aURL.Len() )
- return;
+ continue;
+
+ bool canDelete = true;
+ try
+ {
+ ::ucbhelper::Content aCnt( aURL, mxCmdEnv );
+ Reference< XCommandInfo > aCommands = aCnt.getCommands();
+ if ( aCommands.is() )
+ canDelete
+ = aCommands->hasCommandByName(
+ OUString::createFromAscii( "delete" ) );
+ else
+ canDelete = false;
+ }
+ catch( Exception const & )
+ {
+ canDelete = false;
+ }
- INetURLObject aObj( aURL );
+ if (!canDelete)
+ continue; // process next entry
if ( eResult != svtools::QUERYDELETE_ALL )
{
+ INetURLObject aObj( aURL );
svtools::QueryDeleteDlg_Impl aDlg( NULL, aObj.GetName( INetURLObject::DECODE_WITH_CHARSET ) );
if ( sDialogPosition.Len() )
aDlg.SetWindowState( sDialogPosition );
@@ -1057,22 +1076,44 @@ BOOL ViewTabListBox_Impl::EditedEntry( SvLBoxEntry* pEntry,
try
{
+ OUString aPropName = OUString::createFromAscii( "Title" );
+ bool canRename = true;
::ucbhelper::Content aContent( aURL, mxCmdEnv );
- OUString aPropName = OUString::createFromAscii( "Title" );
- Any aValue;
- aValue <<= OUString( rNewText );
- aContent.setPropertyValue( aPropName, aValue );
- mpParent->EntryRenamed( aURL, rNewText );
+ try
+ {
+ Reference< XPropertySetInfo > aProps = aContent.getProperties();
+ if ( aProps.is() )
+ {
+ Property aProp = aProps->getPropertyByName( aPropName );
+ canRename = !( aProp.Attributes & PropertyAttribute::READONLY );
+ }
+ else
+ {
+ canRename = false;
+ }
+ }
+ catch ( Exception const & )
+ {
+ canRename = false;
+ }
+
+ if ( canRename )
+ {
+ Any aValue;
+ aValue <<= OUString( rNewText );
+ aContent.setPropertyValue( aPropName, aValue );
+ mpParent->EntryRenamed( aURL, rNewText );
- pData->maURL = aURL;
- pEntry->SetUserData( pData );
+ pData->maURL = aURL;
+ pEntry->SetUserData( pData );
- bRet = TRUE;
+ bRet = TRUE;
+ }
+ }
+ catch( Exception const & )
+ {
}
- //catch( ::com::sun::star::ucb::ContentCreationException const & ) {}
- //catch( ::com::sun::star::ucb::CommandAbortedException const & ) {}
- catch( Exception const & ) {}
return bRet;
}