Kaydet (Commit) ba1ec85d authored tarafından Michael Meeks's avatar Michael Meeks

Simplify migration API, fix typos, and add trace output

üst 49d5bdcf
......@@ -37,11 +37,7 @@ namespace desktop {
class Migration
{
public:
// starts the migration process
static void doMigration();
static void cancelMigration();
static sal_Bool checkMigration();
static rtl::OUString getOldVersionName();
static void migrateSettingsIfNecessary();
};
}
#endif
......
......@@ -48,7 +48,7 @@
#include "userinstall.hxx"
#include "desktopcontext.hxx"
#include "exithelper.hxx"
#include "../migration/migration.hxx"
#include "migration.hxx"
#include <svtools/javacontext.hxx>
#include <com/sun/star/frame/XSessionManagerListener.hpp>
......@@ -1720,8 +1720,7 @@ void Desktop::Main()
if ( bAbort )
return;
if ( Migration::checkMigration() )
Migration::doMigration();
Migration::migrateSettingsIfNecessary();
// keep a language options instance...
pLanguageOptions.reset( new SvtLanguageOptions(sal_True));
......
......@@ -214,9 +214,23 @@ static void releaseImpl()
}
}
// static main entry point for the migration process
void Migration::doMigration()
sal_Bool MigrationImpl::needsMigration()
{
sal_Bool bRet = sal_False;
if (m_aInfo.userdata.getLength() > 0 && ! checkMigrationCompleted())
return sal_True;
OSL_TRACE( "Migration %s\n", bRet ? "needed" : "not required" );
return bRet;
}
void Migration::migrateSettingsIfNecessary()
{
if ( !getImpl()->needsMigration() )
return;
sal_Bool bResult = sal_False;
try {
bResult = getImpl()->doMigration();
......@@ -231,34 +245,6 @@ void Migration::doMigration()
releaseImpl();
}
void Migration::cancelMigration()
{
releaseImpl();
}
sal_Bool Migration::checkMigration()
{
return getImpl()->checkMigration();
}
OUString Migration::getOldVersionName()
{
return getImpl()->getOldVersionName();
}
OUString MigrationImpl::getOldVersionName()
{
return m_aInfo.productname;
}
sal_Bool MigrationImpl::checkMigration()
{
if (m_aInfo.userdata.getLength() > 0 && ! checkMigrationCompleted())
return sal_True;
else
return sal_False;
}
MigrationImpl::MigrationImpl(const uno::Reference< XMultiServiceFactory >& xFactory)
: m_vrVersions(new strings_v)
, m_xFactory(xFactory)
......@@ -708,7 +694,7 @@ strings_vr MigrationImpl::compileFileList()
{
vrInclude = applyPatterns(*vrFiles, i_migr->includeFiles);
vrExclude = applyPatterns(*vrFiles, i_migr->excludeFiles);
substract(*vrInclude, *vrExclude);
subtract(*vrInclude, *vrExclude);
vrResult->insert(vrResult->end(), vrInclude->begin(), vrInclude->end());
i_migr++;
}
......@@ -817,7 +803,7 @@ void MigrationImpl::copyConfig() {
}
// removes elements of vector 2 in vector 1
void MigrationImpl::substract(strings_v& va, const strings_v& vb_c) const
void MigrationImpl::subtract(strings_v& va, const strings_v& vb_c) const
{
strings_v vb(vb_c);
// ensure uniqueness of entries
......
......@@ -213,7 +213,7 @@ private:
strings_vr compileFileList();
// helpers
void substract(strings_v& va, const strings_v& vb_c) const;
void subtract(strings_v& va, const strings_v& vb_c) const;
strings_vr getAllFiles(const rtl::OUString& baseURL) const;
strings_vr applyPatterns(const strings_v& vSet, const strings_v& vPatterns) const;
NS_UNO::Reference< NS_CSS::container::XNameAccess > getConfigAccess(const sal_Char* path, sal_Bool rw=sal_False);
......@@ -241,10 +241,8 @@ public:
MigrationImpl(const NS_UNO::Reference< NS_CSS::lang::XMultiServiceFactory >&);
~MigrationImpl();
sal_Bool doMigration();
sal_Bool checkMigration();
sal_Bool needsMigration();
rtl::OUString getOldVersionName();
};
}
#undef NS_CSS
......
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