summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2006-04-07 13:51:19 +0000
committerVladimir Glazounov <vg@openoffice.org>2006-04-07 13:51:19 +0000
commit0b31d017d53c5fff1323123d9e5b7d1614b90278 (patch)
tree140d47f8a93e39e123d46ef0aaeb82de9ceac4f9 /framework
parent4f8084eecec64898130047c41feab61332d8af4d (diff)
INTEGRATION: CWS onlineupdate1 (1.30.62); FILE MERGED
2006/04/05 06:39:10 cd 1.30.62.3: #134045# Show/Hide online update menu item according to URL 2006/04/03 16:05:18 cd 1.30.62.2: #134045# New help menu entry for all 2006/03/31 13:24:43 cd 1.30.62.1: #134045# Added new callback for help menu item
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uielement/menubarmanager.cxx48
1 files changed, 41 insertions, 7 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 71b7298092b7..658fd126ce3a 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: menubarmanager.cxx,v $
*
- * $Revision: 1.30 $
+ * $Revision: 1.31 $
*
- * last change: $Author: kz $ $Date: 2006-01-05 18:11:17 $
+ * last change: $Author: vg $ $Date: 2006-04-07 14:51:19 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -191,6 +191,8 @@
#ifndef _RTL_LOGFILE_HXX_
#include <rtl/logfile.hxx>
#endif
+#include <vos/process.hxx>
+#include <rtl/bootstrap.hxx>
#ifndef INCLUDED_SVTOOLS_MISCOPT_HXX
#include "svtools/miscopt.hxx"
@@ -218,6 +220,8 @@ static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
static const char ITEM_DESCRIPTOR_TYPE[] = "Type";
static const char ITEM_DESCRIPTOR_MODULEIDENTIFIER[] = "ModuleIdentifier";
+static const char REFERENCECOMMAND_ONLINEUPDATE[] = ".uno:OnlineUpdate";
+
struct SystemMenuData
{
unsigned long nSize; // size in bytes of this structure
@@ -768,7 +772,7 @@ throw ( RuntimeException )
// Visibility
m_pVCLMenu->ShowItem( pMenuItemHandler->nItemId, aVisibilityStatus.bVisible );
}
- else
+ else if ( !aFeatureURL.equalsAscii( REFERENCECOMMAND_ONLINEUPDATE ))
m_pVCLMenu->ShowItem( pMenuItemHandler->nItemId, TRUE );
}
@@ -1012,8 +1016,8 @@ void MenuBarManager::UpdateSpecialWindowMenu( Menu* pMenu )
void MenuBarManager::CheckAndAddMenuExtension( Menu* pMenu )
{
- static const char REFERENCECOMMAND_AFTER[] = ".uno:OnlineRegistrationDlg";
- static const char REFERENCECOMMAND_BEFORE[] = ".uno:About";
+ static const char REFERENCECOMMAND_AFTER[] = ".uno:OnlineRegistrationDlg";
+ static const char REFERENCECOMMAND_BEFORE[] = ".uno:About";
// retrieve menu extension item
MenuExtensionItem aMenuItem( GetMenuExtension() );
@@ -1046,6 +1050,38 @@ void MenuBarManager::CheckAndAddMenuExtension( Menu* pMenu )
pMenu->InsertItem( nNewItemId, aMenuItem.aLabel, 0, nInsertPos );
pMenu->SetItemCommand( nNewItemId, aMenuItem.aURL );
}
+
+ ::vos::OStartupInfo aInfo;
+ ::rtl::OUString aIniName;
+
+ aInfo.getExecutableFile( aIniName );
+ sal_uInt32 lastIndex = aIniName.lastIndexOf('/');
+ if ( lastIndex > 0 )
+ {
+ aIniName = aIniName.copy( 0, lastIndex+1 );
+ aIniName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "version" ));
+#ifdef WNT
+ aIniName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".ini" ));
+#else
+ aIniName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "rc" ));
+#endif
+ }
+
+ ::rtl::OUString aUpdateURL;
+ ::rtl::Bootstrap aVersionIni( aIniName );
+
+ // check update URL, if empty set user interface element to hidden state
+ aVersionIni.getFrom( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UpdateURL" )), aUpdateURL );
+ if ( aUpdateURL.getLength() == 0 )
+ {
+ String aUpdateCmd( String::CreateFromAscii( REFERENCECOMMAND_ONLINEUPDATE ));
+ for ( sal_uInt16 n = 0; n < pMenu->GetItemCount(); n++ )
+ {
+ sal_uInt16 nItemId = pMenu->GetItemId( n );
+ if ( pMenu->GetItemCommand( nItemId ) == aUpdateCmd )
+ pMenu->HideItem( nItemId );
+ }
+ }
}
//_________________________________________________________________________________________________________________
@@ -1218,8 +1254,6 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aTargetURL.Path ))
pMenu->HideItem( pMenuItemHandler->nItemId );
}
- else
- pMenu->ShowItem( pMenuItemHandler->nItemId );
if ( m_bIsBookmarkMenu )
xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, pMenuItemHandler->aTargetFrame, 0 );