Kaydet (Commit) fc9171c1 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

Merge commit 'ooo/OOO330_m12'

Conflicts:
	desktop/source/app/app.cxx
......@@ -30,6 +30,7 @@
#include "sal/config.h"
#include <algorithm>
#include <cstddef>
#include <list>
#include "com/sun/star/beans/Optional.hpp"
......@@ -44,8 +45,11 @@
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp"
#include "osl/conditn.hxx"
#include "osl/diagnose.h"
#include "osl/file.hxx"
#include "osl/mutex.hxx"
#include "osl/thread.hxx"
#include "rtl/bootstrap.hxx"
#include "rtl/logfile.h"
#include "rtl/ref.hxx"
......@@ -54,10 +58,12 @@
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include "sal/types.h"
#include "salhelper/simplereferenceobject.hxx"
#include "additions.hxx"
#include "components.hxx"
#include "data.hxx"
#include "lock.hxx"
#include "modifications.hxx"
#include "node.hxx"
#include "nodemap.hxx"
......@@ -149,6 +155,66 @@ static Components * singleton = 0;
}
class Components::WriteThread:
public osl::Thread, public salhelper::SimpleReferenceObject
{
public:
static void * operator new(std::size_t size)
{ return Thread::operator new(size); }
static void operator delete(void * pointer)
{ Thread::operator delete(pointer); }
WriteThread(
rtl::Reference< WriteThread > * reference, Components & components,
rtl::OUString const & url, Data const & data);
void flush() { delay_.set(); }
private:
virtual ~WriteThread() {}
virtual void SAL_CALL run();
virtual void SAL_CALL onTerminated() { release(); }
rtl::Reference< WriteThread > * reference_;
Components & components_;
rtl::OUString url_;
Data const & data_;
osl::Condition delay_;
};
Components::WriteThread::WriteThread(
rtl::Reference< WriteThread > * reference, Components & components,
rtl::OUString const & url, Data const & data):
reference_(reference), components_(components), url_(url), data_(data)
{
OSL_ASSERT(reference != 0);
acquire();
}
void Components::WriteThread::run() {
TimeValue t = { 1, 0 }; // 1 sec
delay_.wait(&t); // must not throw; result_error is harmless and ignored
osl::MutexGuard g(lock); // must not throw
try {
try {
writeModFile(components_, url_, data_);
} catch (css::uno::RuntimeException & e) {
// Silently ignore write errors, instead of aborting:
OSL_TRACE(
"configmgr error writing modifications: %s",
rtl::OUStringToOString(
e.Message, RTL_TEXTENCODING_UTF8).getStr());
}
} catch (...) {
reference_->clear();
throw;
}
reference_->clear();
}
void Components::initSingleton(
css::uno::Reference< css::uno::XComponentContext > const & context)
{
......@@ -239,7 +305,23 @@ void Components::addModification(Path const & path) {
}
void Components::writeModifications() {
writeModFile(*this, getModificationFileUrl(), data_);
if (!writeThread_.is()) {
writeThread_ = new WriteThread(
&writeThread_, *this, getModificationFileUrl(), data_);
writeThread_->create();
}
}
void Components::flushModifications() {
rtl::Reference< WriteThread > thread;
{
osl::MutexGuard g(lock);
thread = writeThread_;
}
if (thread.is()) {
thread->flush();
thread->join();
}
}
void Components::insertExtensionXcsFile(
......
......@@ -94,6 +94,11 @@ public:
void writeModifications();
void flushModifications();
// must be called with configmgr::lock unaquired; must be called before
// shutdown if writeModifications has ever been called (probably
// indirectly, via removeExtensionXcuFile)
void insertExtensionXcsFile(bool shared, rtl::OUString const & fileUri);
void insertExtensionXcuFile(
......@@ -160,11 +165,14 @@ private:
com::sun::star::beans::XPropertySet > >
ExternalServices;
class WriteThread;
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
context_;
Data data_;
WeakRootSet roots_;
ExternalServices externalServices_;
rtl::Reference< WriteThread > writeThread_;
};
}
......
......@@ -115,6 +115,8 @@ public:
private:
virtual ~Service() {}
virtual void SAL_CALL disposing() { flushModifications(); }
virtual rtl::OUString SAL_CALL getImplementationName()
throw (css::uno::RuntimeException)
{ return configuration_provider::getImplementationName(); }
......@@ -167,6 +169,8 @@ private:
virtual css::lang::Locale SAL_CALL getLocale()
throw (css::uno::RuntimeException);
void flushModifications() const;
css::uno::Reference< css::uno::XComponentContext > context_;
rtl::OUString locale_;
};
......@@ -327,7 +331,7 @@ void Service::removeRefreshListener(
}
void Service::flush() throw (css::uno::RuntimeException) {
//TODO
flushModifications();
cppu::OInterfaceContainerHelper * cont = rBHelper.getContainer(
cppu::UnoType< css::util::XFlushListener >::get());
if (cont != 0) {
......@@ -381,6 +385,16 @@ css::lang::Locale Service::getLocale() throw (css::uno::RuntimeException) {
return loc;
}
void Service::flushModifications() const {
Components * components;
{
osl::MutexGuard guard(lock);
Components::initSingleton(context_);
components = &Components::getSingleton();
}
components->flushModifications();
}
class Factory:
public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >,
private boost::noncopyable
......
......@@ -154,6 +154,7 @@ class Desktop : public Application
sal_Bool InitializeInstallation( const rtl::OUString& rAppFilename );
sal_Bool InitializeConfiguration();
void FlushConfiguration();
sal_Bool InitializeQuickstartMode( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr );
void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const ::rtl::OUString& aMsg );
......
......@@ -756,6 +756,7 @@ void Desktop::DeInit()
// instead of removing of the configManager just let it commit all the changes
RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" );
utl::ConfigManager::GetConfigManager().StoreConfigItems();
FlushConfiguration();
RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" );
// close splashscreen if it's still open
......@@ -817,6 +818,7 @@ BOOL Desktop::QueryExit()
}
else
{
FlushConfiguration();
try
{
// it is no problem to call DisableOfficeIPCThread() more than once
......@@ -1438,18 +1440,7 @@ USHORT Desktop::Exception(USHORT nError)
if ( bAllowRecoveryAndSessionManagement )
bRestart = SaveTasks();
// because there is no method to flush the condiguration data, we must dispose the ConfigManager
Reference < XFlushable > xCFGFlush( ::utl::ConfigManager::GetConfigManager().GetConfigurationProvider(), UNO_QUERY );
if (xCFGFlush.is())
{
xCFGFlush->flush();
}
else
{
Reference < XComponent > xCFGDispose( ::utl::ConfigManager::GetConfigManager().GetConfigurationProvider(), UNO_QUERY );
if (xCFGDispose.is())
xCFGDispose->dispose();
}
FlushConfiguration();
switch( nError & EXC_MAJORTYPE )
{
......@@ -1963,6 +1954,7 @@ void Desktop::Main()
// remove temp directory
RemoveTemporaryDirectory();
FlushConfiguration();
// The acceptors in the AcceptorMap must be released (in DeregisterServices)
// with the solar mutex unlocked, to avoid deadlock:
nAcquireCount = Application::ReleaseSolarMutex();
......@@ -2060,6 +2052,22 @@ sal_Bool Desktop::InitializeConfiguration()
return bOk;
}
void Desktop::FlushConfiguration()
{
Reference < XFlushable > xCFGFlush( ::utl::ConfigManager::GetConfigManager().GetConfigurationProvider(), UNO_QUERY );
if (xCFGFlush.is())
{
xCFGFlush->flush();
}
else
{
// because there is no method to flush the condiguration data, we must dispose the ConfigManager
Reference < XComponent > xCFGDispose( ::utl::ConfigManager::GetConfigManager().GetConfigurationProvider(), UNO_QUERY );
if (xCFGDispose.is())
xCFGDispose->dispose();
}
}
sal_Bool Desktop::InitializeQuickstartMode( Reference< XMultiServiceFactory >& rSMgr )
{
try
......
......@@ -32,6 +32,8 @@
#include "com/sun/star/deployment/VersionException.hpp"
#include "com/sun/star/deployment/LicenseException.hpp"
#include "com/sun/star/deployment/InstallException.hpp"
#include "com/sun/star/deployment/DependencyException.hpp"
#include "com/sun/star/deployment/PlatformException.hpp"
#include "com/sun/star/task/XInteractionApprove.hpp"
#include "com/sun/star/task/XInteractionAbort.hpp"
#include "com/sun/star/task/XInteractionHandler.hpp"
......@@ -137,7 +139,6 @@ throw (uno::RuntimeException)
{
}
void BaseCommandEnv::update( uno::Any const & /*Status */)
throw (uno::RuntimeException)
{
......@@ -199,7 +200,6 @@ void LicenseCommandEnv::handle(
uno::Any request( xRequest->getRequest() );
OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION );
deployment::LicenseException licExc;
bool approve = false;
......@@ -238,7 +238,6 @@ void NoLicenseCommandEnv::handle(
uno::Any request( xRequest->getRequest() );
OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION );
deployment::LicenseException licExc;
bool approve = false;
......@@ -251,7 +250,43 @@ void NoLicenseCommandEnv::handle(
handle_(approve, abort, xRequest);
}
// SilentCheckPrerequisitesCommandEnv::SilentCheckPrerequisitesCommandEnv(
// css::uno::Reference< css::task::XInteractionHandler> const & handler):
// BaseCommandEnv(handler)
// {
// }
SilentCheckPrerequisitesCommandEnv::SilentCheckPrerequisitesCommandEnv()
{
}
void SilentCheckPrerequisitesCommandEnv::handle(
Reference< task::XInteractionRequest> const & xRequest )
throw (uno::RuntimeException)
{
uno::Any request( xRequest->getRequest() );
OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION );
deployment::LicenseException licExc;
deployment::PlatformException platformExc;
deployment::DependencyException depExc;
bool approve = false;
bool abort = false;
if (request >>= licExc)
{
approve = true;
handle_(approve, abort, xRequest);
}
else if ((request >>= platformExc)
|| (request >>= depExc))
{
m_Exception = request;
}
else
{
m_UnknownException = request;
}
}
// NoExceptionCommandEnv::NoExceptionCommandEnv(
// css::uno::Reference< css::task::XInteractionHandler> const & handler,
// css::uno::Type const & type):
......@@ -267,7 +302,6 @@ void NoLicenseCommandEnv::handle(
// uno::Any request( xRequest->getRequest() );
// OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION );
// deployment::LicenseException licExc;
// bool approve = false;
......@@ -280,9 +314,6 @@ void NoLicenseCommandEnv::handle(
// handle_(approve, abort, xRequest);
// }
} // namespace dp_manager
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -28,18 +28,14 @@
#if ! defined INCLUDED_DP_COMMANDENVIRONMENTS_HXX
#define INCLUDED_DP_COMMANDENVIRONMENTS_HXX
#include "cppuhelper/compbase3.hxx"
#include "ucbhelper/content.hxx"
#include "com/sun/star/uno/Type.hxx"
namespace css = ::com::sun::star;
namespace dp_manager {
/**
This command environment is to be used when an extension is temporarily
stored in the "tmp" repository. It prevents all kind of user interaction.
......@@ -134,6 +130,29 @@ public:
};
/* For use in XExtensionManager::addExtension in the call to
XPackage::checkPrerequisites
It prevents all user interactions. The license is always accepted.
It remembers if there was a platform or a dependency exception in
the member m_bException. if there was any other exception then m_bUnknownException
is set.
*/
class SilentCheckPrerequisitesCommandEnv : public BaseCommandEnv
{
public:
SilentCheckPrerequisitesCommandEnv();
// XInteractionHandler
virtual void SAL_CALL handle(
css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
throw (css::uno::RuntimeException);
// Set to true if a PlatformException or a DependencyException were handled.
css::uno::Any m_Exception;
// Set to true if an unknown exception was handled.
css::uno::Any m_UnknownException;
};
// class NoExceptionCommandEnv : public BaseCommandEnv
// {
// css::uno::Type m_type;
......@@ -152,8 +171,4 @@ public:
}
#endif
......@@ -25,7 +25,6 @@
*
************************************************************************/
#if ! defined INCLUDED_DP_EXTENSIONMANAGER_H
#define INCLUDED_DP_EXTENSIONMANAGER_H
......@@ -41,7 +40,6 @@
#include "osl/mutex.hxx"
#include <list>
namespace css = ::com::sun::star;
namespace dp_manager {
......@@ -51,7 +49,6 @@ typedef ::std::hash_map<
::std::vector<css::uno::Reference<css::deployment::XPackage> >,
::rtl::OUStringHash > id2extensions;
class ExtensionManager : private ::dp_misc::MutexHolder,
public ::cppu::WeakComponentImplHelper1< css::deployment::XExtensionManager >
{
......@@ -128,7 +125,6 @@ public:
css::lang::IllegalArgumentException,
css::uno::RuntimeException);
virtual sal_Int32 SAL_CALL checkPrerequisitesAndEnable(
css::uno::Reference<css::deployment::XPackage> const & extension,
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
......@@ -139,7 +135,6 @@ public:
css::lang::IllegalArgumentException,
css::uno::RuntimeException);
virtual css::uno::Sequence< css::uno::Reference<css::deployment::XPackage> >
SAL_CALL getDeployedExtensions(
::rtl::OUString const & repository,
......@@ -184,7 +179,6 @@ public:
css::lang::IllegalArgumentException,
css::uno::RuntimeException);
virtual void SAL_CALL reinstallDeployedExtensions(
::rtl::OUString const & repository,
css::uno::Reference< css::task::XAbortChannel> const & xAbortChannel,
......@@ -235,6 +229,8 @@ private:
css::uno::Reference<css::deployment::XPackageManager> m_bundledRepository;
css::uno::Reference<css::deployment::XPackageManager> m_tmpRepository;
//only to be used within addExtension
::osl::Mutex m_addMutex;
/* contains the names of all repositories (except tmp) in order of there
priority. That is, the first element is "user" follod by "shared" and
then "bundled"
......@@ -260,7 +256,6 @@ private:
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv );
::std::list<css::uno::Reference<css::deployment::XPackage> >
getExtensionsWithSameId(::rtl::OUString const & identifier,
::rtl::OUString const & fileName,
......@@ -287,7 +282,6 @@ private:
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
void addExtensionsToMap(
id2extensions & mapExt,
css::uno::Sequence<css::uno::Reference<css::deployment::XPackage> > const & seqExt,
......@@ -296,12 +290,22 @@ private:
css::uno::Reference<css::deployment::XPackageManager>
getPackageManager(::rtl::OUString const & repository)
throw (css::lang::IllegalArgumentException);
};
}
bool doChecksForAddExtension(
css::uno::Reference<css::deployment::XPackageManager> const & xPackageMgr,
css::uno::Sequence<css::beans::NamedValue> const & properties,
css::uno::Reference<css::deployment::XPackage> const & xTmpExtension,
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
css::uno::Reference<css::deployment::XPackage> & out_existingExtension )
throw (css::deployment::DeploymentException,
css::ucb::CommandFailedException,
css::ucb::CommandAbortedException,
css::lang::IllegalArgumentException,
css::uno::RuntimeException);
};
}
#endif
......@@ -35,9 +35,9 @@
#define RID_GROUPS_OFFSET 32000
#define RID_GROUPS_END 32767
#define RID_FWK_DIALOG_START (RID_FWK_START + 2048)
#define RID_FWK_DIALOG_START_CORRECT (RID_FWK_START + 2048)
#define DLG_FILTER_SELECT (RID_FWK_DIALOG_START + 0)
#define DLG_FILTER_SELECT (RID_FWK_DIALOG_START_CORRECT + 0)
#define STR_FILTER_DOWNLOAD (RID_FWK_START+0)
#define STR_FILTER_CHOOSER (RID_FWK_START+1)
......@@ -45,7 +45,7 @@
#define STR_FILTER_ZIPPED (RID_FWK_START+3)
// ResIds for BackingWindow
#define DLG_BACKING (RID_FWK_DIALOG_START+100)
#define DLG_BACKING (RID_FWK_DIALOG_START_CORRECT+100)
#define STR_BACKING_WELCOME 1
#define STR_BACKING_WELCOMEPRODUCT 2
#define STR_BACKING_CREATE 3
......@@ -78,7 +78,7 @@
#define BMP_BACKING_OPENTEMPLATE 17
// Ids of TabWindow
#define WIN_TABWINDOW (RID_FWK_DIALOG_START+101)
#define WIN_TABWINDOW (RID_FWK_DIALOG_START_CORRECT+101)
#define TC_TABCONTROL 1
#endif
......
......@@ -30,6 +30,7 @@
#include "precompiled_framework.hxx"
#include "backingwindow.hxx"
#include "classes/resource.hrc"
#include "framework.hrc"
#include "classes/fwkresid.hxx"
#include <services.h>
......@@ -385,8 +386,13 @@ void BackingWindow::prepareRecentFileMenu()
aBuf.append( aMenuTitle );
mpRecentMenu->InsertItem( static_cast<USHORT>(i+1), aBuf.makeStringAndClear() );
}
maOpenButton.SetPopupMenu( mpRecentMenu );
}
else
{
String aNoDoc( FwkResId( STR_NODOCUMENT ) );
mpRecentMenu->InsertItem( 0xffff, aNoDoc );
}
maOpenButton.SetPopupMenu( mpRecentMenu );
}
void BackingWindow::initBackground()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment