summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2010-10-29 15:17:55 +0100
committerMichael Meeks <michael.meeks@novell.com>2010-11-01 10:57:43 +0000
commitba1ec85d69d9b4d39c0b89b4b6711b93965d95f1 (patch)
tree81d20722efc93025763f2490b1abd905457e802a /desktop
parent49d5bdcf4d516b21721f1ed6d313ea4a170d39eb (diff)
Simplify migration API, fix typos, and add trace output
Diffstat (limited to 'desktop')
-rw-r--r--desktop/inc/migration.hxx (renamed from desktop/source/migration/migration.hxx)6
-rw-r--r--desktop/source/app/app.cxx5
-rw-r--r--desktop/source/migration/migration.cxx50
-rw-r--r--desktop/source/migration/migration_impl.hxx6
4 files changed, 23 insertions, 44 deletions
diff --git a/desktop/source/migration/migration.hxx b/desktop/inc/migration.hxx
index e942f56fc87e..3319d8d7716f 100644
--- a/desktop/source/migration/migration.hxx
+++ b/desktop/inc/migration.hxx
@@ -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
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index bf390dc14cb1..e34720d43d39 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -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));
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 2ceb467bde50..a7a0ba69cf25 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -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
diff --git a/desktop/source/migration/migration_impl.hxx b/desktop/source/migration/migration_impl.hxx
index b0636efbe442..cb4f9f62e3e1 100644
--- a/desktop/source/migration/migration_impl.hxx
+++ b/desktop/source/migration/migration_impl.hxx
@@ -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