[Libreoffice-commits] .: Branch 'libreoffice-3-4' - patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Apr 6 20:23:47 PDT 2011


 patches/dev300/apply                         |   11 
 patches/dev300/desktop-config-migration.diff |  489 ---------------------------
 2 files changed, 500 deletions(-)

New commits:
commit beb26c296f10c8a7b3d7dd0475a5f1c2340dc289
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Apr 6 23:23:40 2011 -0400

    Removed stale, unused patch.

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 01abae6..b1ea91a 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -300,17 +300,6 @@ go-oo-team.diff, michael
 # Some Novell colors ...
 novell-palette.diff, michael
 
-[ CustomUserConfig ]
-
-# This section includes patches that deal with custom user configuration items
-# that are not present upstream.
-
-SectionOwner => kohei
-
-# migrate keyboard shortcuts & reset character set for CSV import dialog.
-# FIXME dev300-m83 desktop-config-migration.diff n#367160, n#376473, n#421070, n#466064, kohei/jholesov
-
-
 [ DebianBaseOnly ]
 SectionOwner => rengelha
 
diff --git a/patches/dev300/desktop-config-migration.diff b/patches/dev300/desktop-config-migration.diff
deleted file mode 100644
index dc48636..0000000
--- a/patches/dev300/desktop-config-migration.diff
+++ /dev/null
@@ -1,489 +0,0 @@
-From 1c30fecf102eb791de368863fe45911dd10215cf Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy at suse.cz>
-Date: Fri, 14 May 2010 16:57:31 +0200
-Subject: [PATCH 237/768] desktop-config-migration.diff
-
----
- desktop/source/app/app.cxx                         |    3 +
- desktop/source/migration/migration.cxx             |  347 +++++++++++++++++---
- desktop/source/migration/migration_impl.hxx        |   20 +-
- officecfg/registry/schema/org/openoffice/Setup.xcs |    8 +
- 4 files changed, 328 insertions(+), 50 deletions(-)
-
-diff --git desktop/source/migration/migration.cxx desktop/source/migration/migration.cxx
-index ede233e..c4163ee 100644
---- desktop/source/migration/migration.cxx
-+++ desktop/source/migration/migration.cxx
-@@ -55,6 +55,10 @@
- #include <com/sun/star/util/XRefreshable.hpp>
- #include <com/sun/star/util/XChangesBatch.hpp>
- #include <com/sun/star/util/XStringSubstitution.hpp>
-+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
-+#include <com/sun/star/awt/Key.hpp>
-+#include <com/sun/star/awt/KeyEvent.hpp>
- 
- using namespace rtl;
- using namespace osl;
-@@ -69,6 +73,9 @@ using namespace com::sun::star::configuration::backend;
- using com::sun::star::uno::Exception;
- using namespace com::sun::star;
- 
-+#define ascii( asc ) \
-+    ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( asc ) )
-+
- namespace desktop {
- 
- 
-@@ -124,27 +131,155 @@ OUString Migration::getOldVersionName()
-     return getImpl()->getOldVersionName();
- }
- 
-+MigrationImpl::VersionNumber::VersionNumber() :
-+    mnMajor(0), mnMinor(0), mnMicro(0)
-+{
-+}
-+
-+MigrationImpl::VersionNumber::VersionNumber(sal_Int32 nMajor, sal_Int32 nMinor, sal_Int32 nMicro) :
-+    mnMajor(nMajor), mnMinor(nMinor), mnMicro(nMicro)
-+{
-+}
-+
- OUString MigrationImpl::getOldVersionName()
- {
-     return m_aInfo.productname;
- }
- 
--sal_Bool MigrationImpl::checkMigration()
-+static bool splitVersionString(const OUString& rVer, MigrationImpl::VersionNumber& rVerNum)
-+{
-+    rVerNum.mnMajor = 0;
-+    rVerNum.mnMinor = 0;
-+    rVerNum.mnMicro = 0;
-+
-+    sal_Int32 nLen = rVer.getLength();
-+    const sal_Unicode* pStr = rVer.getStr();
-+    OUStringBuffer buf;
-+    sal_uInt8 nPos = 0; // 0 = major; 1 = minor; 2 = micro
-+    for (sal_Int32 i = 0; i < nLen; ++i)
-+    {
-+        const sal_Unicode c = pStr[i];
-+        if (c >= sal_Unicode('0') && c <= sal_Unicode('9'))
-+            buf.append(c);
-+        else if (c == sal_Unicode('.'))
-+        {
-+            if (buf.getLength() == 0)
-+                // no numbers.
-+                return false;
-+
-+            sal_Int32 nTmp = buf.makeStringAndClear().toInt32();
-+            if (nTmp < 0 || nTmp > 255)
-+                // only 0 - 255 allowed in a version number.
-+                return false;
-+
-+            switch (nPos)
-+            {
-+                case 0: rVerNum.mnMajor = static_cast<sal_uInt8>(nTmp); break;
-+                case 1: rVerNum.mnMinor = static_cast<sal_uInt8>(nTmp); break;
-+                case 2: rVerNum.mnMicro = static_cast<sal_uInt8>(nTmp); break;
-+            }
-+
-+            nPos += 1;
-+            if (nPos > 2)
-+                return true;
-+        }
-+        else
-+            return false;
-+    }
-+
-+    return true;
-+}
-+
-+/** returns -1 if rVer1 < rVer2, 0 if rVer1 == rVer2, or 1 if rVer1 >
-+    rVer2. */
-+static short compareVersion(const MigrationImpl::VersionNumber& rVer1,
-+                            const MigrationImpl::VersionNumber& rVer2)
- {
--    if (m_aInfo.userdata.getLength() > 0 && ! checkMigrationCompleted())
-+    // major version
-+    if (rVer1.mnMajor < rVer2.mnMajor)
-+        return -1;
-+    if (rVer1.mnMajor > rVer2.mnMajor)
-+        return 1;
-+
-+    // minor version
-+    if (rVer1.mnMinor < rVer2.mnMinor)
-+        return -1;
-+    if (rVer1.mnMinor > rVer2.mnMinor)
-+        return 1;
-+
-+    // micro version
-+    if (rVer1.mnMicro < rVer2.mnMicro)
-+        return -1;
-+    if (rVer1.mnMicro > rVer2.mnMicro)
-+        return 1;
-+
-+    return 0;
-+}
-+
-+static sal_Bool isMigrationNeeded(const OUString& rConfVerStr, const OUString& rAppVerStr,
-+                                  MigrationImpl::VersionNumber& rConfVerNum,
-+                                  MigrationImpl::VersionNumber& rAppVerNum)
-+{
-+    if (!splitVersionString(rConfVerStr, rConfVerNum))
-+        return sal_False;
-+
-+    if (!splitVersionString(rAppVerStr, rAppVerNum))
-+        return sal_False;
-+
-+#if OSL_DEBUG_LEVEL > 0
-+    fprintf(stdout, "desktop::isMigrationNeeded: config ver = %d.%d.%d\n",
-+            rConfVerNum.mnMajor,rConfVerNum.mnMinor,rConfVerNum.mnMicro);
-+
-+    fprintf(stdout, "desktop::isMigrationNeeded: app ver = %d.%d.%d\n",
-+            rAppVerNum.mnMajor,rAppVerNum.mnMinor,rAppVerNum.mnMicro);
-+#endif
-+
-+    if (compareVersion(rConfVerNum, rAppVerNum) < 0)
-         return sal_True;
--    else
-+
-+    return sal_False;
-+}
-+
-+sal_Bool MigrationImpl::checkMigration()
-+{
-+    if (m_bMigrationCompleted)
-+        // migration is already complete.
-         return sal_False;
-+
-+    try
-+    {
-+        uno::Reference< XPropertySet > aPropSet(getConfigAccess("org.openoffice.Setup/Product"), uno::UNO_QUERY_THROW);
-+        uno::Any any = aPropSet->getPropertyValue(ascii("ooSetupVersionAboutBox"));
-+        if (!(any >>= m_aAppVerStr))
-+            // Current version unknown.  Don't do migration (this should not happen).
-+            return sal_False;
-+
-+        aPropSet.set(getConfigAccess("org.openoffice.Setup/Configuration"), uno::UNO_QUERY_THROW);
-+        any = aPropSet->getPropertyValue(ascii("ooLastVersionTouched"));
-+        OUString aLastVersion;
-+        if (!(any >>= aLastVersion))
-+        {
-+            // last touched version unknown.  Do the migration.
-+            splitVersionString(m_aAppVerStr, m_aAppVerNum);
-+            m_aConfigVerNum.mnMajor = 0;
-+            m_aConfigVerNum.mnMinor = 0;
-+            m_aConfigVerNum.mnMicro = 0;
-+            return sal_True;
-+        }
-+
-+        return isMigrationNeeded(aLastVersion, m_aAppVerStr, m_aConfigVerNum, m_aAppVerNum);
-+    }
-+    catch (const Exception&)
-+    {
-+    }
-+    return sal_True;
- }
- 
- MigrationImpl::MigrationImpl(const uno::Reference< XMultiServiceFactory >& xFactory)
--    : m_vrVersions(new strings_v)
-+    : m_vrVersions(NULL)
-     , m_xFactory(xFactory)
-+    , m_bMigrationCompleted(false)
- {
--    readAvailableMigrations(m_vMigrationsAvailable);
--    sal_Int32 nIndex = findPreferedMigrationProcess(m_vMigrationsAvailable);
--    if ( nIndex >= 0 )
--        m_vrMigrations = readMigrationSteps(m_vMigrationsAvailable[nIndex].name);
- }
- 
- MigrationImpl::~MigrationImpl()
-@@ -154,33 +289,52 @@ MigrationImpl::~MigrationImpl()
- 
- sal_Bool MigrationImpl::doMigration()
- {
--    // compile file and service list for migration
--    m_vrFileList    = compileFileList();
--    m_vrServiceList = compileServiceList();
--    
--    sal_Bool result = sal_False;
--    try{
--        copyFiles();
--
--        // execute the migration items from Setup.xcu
--        // and refresh the cache
--        copyConfig();
--        refresh();
-+#if OSL_DEBUG_LEVEL > 0
-+    fprintf( stderr, "Migrating user configuration to newer OOo version.\n" );
-+#endif
- 
--        // execute custom migration services from Setup.xcu
--        // and refresh the cache
--        runServices();
--        refresh();
-+    sal_Bool result = sal_True;
- 
--        result = sal_True;
--    } catch (...)
-+    if (compareVersion(m_aConfigVerNum, VersionNumber(3,0,0)) < 0)
-     {
--        OString aMsg("An unexpected exception was thrown during migration");
--        aMsg += "\nOldVersion: " + OUStringToOString(m_aInfo.productname, RTL_TEXTENCODING_ASCII_US);
--        aMsg += "\nDataPath  : " + OUStringToOString(m_aInfo.userdata, RTL_TEXTENCODING_ASCII_US);
--        OSL_ENSURE(sal_False, aMsg.getStr());
-+        try
-+        {
-+            if (initDirectoryMigration())
-+            {
-+                copyFiles();
-+    
-+                // execute the migration items from Setup.xcu
-+                // and refresh the cache
-+                copyConfig();
-+                refresh();
-+
-+                // execute custom migration services from Setup.xcu
-+                // and refresh the cache
-+                runServices();
-+                refresh();
-+            }
-+        }
-+        catch (...)
-+        {
-+            OString aMsg("An unexpected exception was thrown during migration");
-+            aMsg += "\nOldVersion: " + OUStringToOString(m_aInfo.productname, RTL_TEXTENCODING_ASCII_US);
-+            aMsg += "\nDataPath  : " + OUStringToOString(m_aInfo.userdata, RTL_TEXTENCODING_ASCII_US);
-+            OSL_ENSURE(sal_False, aMsg.getStr());
-+            result = sal_False;
-+        }
-     }
- 
-+    try
-+    {
-+        // migrate the configuration values.
-+        transCalcFormulaConfig();
-+        transKeyConfig();
-+        cleanCSVImportCharSet();
-+    }
-+    catch (...)
-+    {
-+        result = sal_False;
-+    }
-     // prevent running the migration multiple times
-     setMigrationCompleted();
-     return result;
-@@ -197,31 +351,126 @@ void MigrationImpl::refresh()
- 
- }
- 
--void MigrationImpl::setMigrationCompleted()
-+void MigrationImpl::transKeyConfig()
- {
--    try {
--        uno::Reference< XPropertySet > aPropertySet(getConfigAccess("org.openoffice.Setup/Office", true), uno::UNO_QUERY_THROW);
--        aPropertySet->setPropertyValue(OUString::createFromAscii("MigrationCompleted"), uno::makeAny(sal_True));
--        uno::Reference< XChangesBatch >(aPropertySet, uno::UNO_QUERY_THROW)->commitChanges();
--    } catch (...) {
--        // fail silently
-+    using namespace ::com::sun::star;
-+    using namespace ::com::sun::star::ui;
-+
-+#if OSL_DEBUG_LEVEL > 0
-+    fprintf(stdout, "MigrationImpl::transKeyConfig:   config ver = %ld.%ld.%ld\n",
-+            long(m_aConfigVerNum.mnMajor), long(m_aConfigVerNum.mnMinor), long(m_aConfigVerNum.mnMicro));
-+
-+    fprintf(stdout, "MigrationImpl::transKeyConfig:   app ver = %ld.%ld.%ld\n",
-+            long(m_aAppVerNum.mnMajor), long(m_aAppVerNum.mnMinor), long(m_aAppVerNum.mnMicro));
-+#endif
-+
-+    if (compareVersion(m_aConfigVerNum, VersionNumber(2,4,0)) < 0)
-+    {
-+        // For config versions older than 2.4.0 only.
-+
-+        uno::Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(
-+            m_xFactory->createInstance(
-+                ascii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")), uno::UNO_QUERY_THROW);
-+
-+        // Grab the Calc configuration.
-+        uno::Reference< XUIConfigurationManager > xConfigMgr =
-+            xModuleCfgSupplier->getUIConfigurationManager(
-+                ascii("com.sun.star.sheet.SpreadsheetDocument"));
-+
-+        if (xConfigMgr.is())
-+        {
-+            uno::Reference< XAcceleratorConfiguration > xScAccel(
-+                xConfigMgr->getShortCutManager(), uno::UNO_QUERY_THROW);
-+
-+            // Backsapce key
-+            awt::KeyEvent aBackEv;
-+            aBackEv.KeyCode = awt::Key::BACKSPACE;
-+            aBackEv.Modifiers = 0;
-+            xScAccel->setKeyEvent(aBackEv, ascii(".uno:Delete"));
-+
-+            // Delete key
-+            awt::KeyEvent aDeleteEv;
-+            aDeleteEv.KeyCode = awt::Key::DELETE;
-+            aDeleteEv.Modifiers = 0;
-+            xScAccel->setKeyEvent(aDeleteEv, ascii(".uno:ClearContents"));
-+
-+            xScAccel->store();
-+        }
-     }
- }
- 
--sal_Bool MigrationImpl::checkMigrationCompleted()
-+void MigrationImpl::cleanCSVImportCharSet()
- {
--    sal_Bool bMigrationCompleted = sal_False;
--    try {
--        uno::Reference< XPropertySet > aPropertySet(
--            getConfigAccess("org.openoffice.Setup/Office"), uno::UNO_QUERY_THROW);
--        aPropertySet->getPropertyValue(
--            OUString::createFromAscii("MigrationCompleted")) >>= bMigrationCompleted;
--    } catch (Exception&) {
--        // just return false...
-+    // Overwrite the character set value for CSV import to -1 (unset) on every
-+    // upgrade, to prevent it from being incorrectly set to Unicode. (n#376473)
-+
-+    uno::Reference< XPropertySet > aPropSet;
-+    aPropSet.set(getConfigAccess("org.openoffice.Office.Calc/Dialogs/CSVImport", true), uno::UNO_QUERY_THROW);
-+    aPropSet->setPropertyValue(ascii("CharSet"), uno::makeAny(static_cast<sal_Int32>(-1)));
-+    uno::Reference< XChangesBatch >(aPropSet, uno::UNO_QUERY_THROW)->commitChanges();
-+}
-+
-+void MigrationImpl::transCalcFormulaConfig()
-+{
-+    // Prior to 3.1.0, formula settings were stored in
-+    // Calc/Calculate/FormulaSyntax.  Migrate that to
-+    // Calc/Formula/Syntax/Grammar.
-+
-+    if (compareVersion(m_aConfigVerNum, VersionNumber(3,1,0)) >= 0)
-+        return;
-+
-+    try
-+    {
-+        uno::Reference<XPropertySet> xPropSet1(
-+            getConfigAccess("org.openoffice.Office.Calc/Calculate/Other", true), uno::UNO_QUERY_THROW);
-+
-+        sal_Int32 nFormulaSyntax = 0;
-+        xPropSet1->getPropertyValue(ascii("FormulaSyntax")) >>= nFormulaSyntax;
-+
-+        uno::Reference<XPropertySet> xPropSet2(
-+            getConfigAccess("org.openoffice.Office.Calc/Formula/Syntax", true), uno::UNO_QUERY_THROW);
-+        xPropSet2->setPropertyValue(ascii("Grammar"), uno::makeAny(nFormulaSyntax));
-+        uno::Reference<XChangesBatch>(xPropSet2, uno::UNO_QUERY_THROW)->commitChanges();
-+    }
-+    catch (const Exception&)
-+    {
-     }
--    return bMigrationCompleted;
- }
- 
-+void MigrationImpl::setMigrationCompleted()
-+{
-+    try
-+    {
-+        uno::Reference< XPropertySet > aPropSet;
-+        if (m_aAppVerStr.getLength() > 0)
-+        {
-+            aPropSet.set(getConfigAccess("org.openoffice.Setup/Configuration", true), uno::UNO_QUERY_THROW);
-+            aPropSet->setPropertyValue(ascii("ooLastVersionTouched"), uno::makeAny(m_aAppVerStr));
-+            uno::Reference< XChangesBatch >(aPropSet, uno::UNO_QUERY_THROW)->commitChanges();
-+        }
-+
-+        m_bMigrationCompleted = true;
-+    }
-+    catch (const Exception&)
-+    {
-+    }
-+}
-+
-+bool MigrationImpl::initDirectoryMigration()
-+{
-+    m_vrVersions.reset(new strings_v);
-+    readAvailableMigrations(m_vMigrationsAvailable);
-+    sal_Int32 nIndex = findPreferedMigrationProcess(m_vMigrationsAvailable);
-+    if ( nIndex >= 0 )
-+    {
-+        m_vrMigrations = readMigrationSteps(m_vMigrationsAvailable[nIndex].name);
-+        // compile file and service list for migration
-+        m_vrFileList = compileFileList();
-+        m_vrServiceList = compileServiceList();
-+        return true;
-+    }
-+    return false;
-+}
- static void insertSorted(migrations_available& rAvailableMigrations, supported_migration& aSupportedMigration)
- {
-     bool                           bInserted( false );
-diff --git desktop/source/migration/migration_impl.hxx desktop/source/migration/migration_impl.hxx
-index a153321..e950742 100644
---- desktop/source/migration/migration_impl.hxx
-+++ desktop/source/migration/migration_impl.hxx
-@@ -83,6 +83,16 @@ typedef std::vector< supported_migration > migrations_available;
- 
- class MigrationImpl
- {
-+public:
-+    struct VersionNumber
-+    {
-+        sal_Int32 mnMajor;
-+        sal_Int32 mnMinor;
-+        sal_Int32 mnMicro;
-+
-+        explicit VersionNumber();
-+        explicit VersionNumber(sal_Int32 nMajor, sal_Int32 nMinor, sal_Int32 nMicro);
-+    };
- 
- private:
-     strings_vr m_vrVersions;
-@@ -94,6 +104,12 @@ private:
-     strings_vr           m_vrFileList;           // final list of files to be copied
-     strings_vr           m_vrConfigList;         // final list of nodes to be copied
-     strings_vr           m_vrServiceList;        // final list of services to be called
-+    ::rtl::OUString m_aAppVerStr;
-+    bool m_bMigrationCompleted;
-+    VersionNumber m_aAppVerNum;
-+    VersionNumber m_aConfigVerNum;
-+
-+    bool initDirectoryMigration();
- 
-     // functions to control the migration process
-     bool          readAvailableMigrations(migrations_available&);
-@@ -115,9 +131,11 @@ private:
-     void copyConfig();
-     void runServices();
-     void refresh();
-+    void transKeyConfig();
-+    void cleanCSVImportCharSet();
-+    void transCalcFormulaConfig();
- 
-     void setMigrationCompleted();
--    sal_Bool checkMigrationCompleted();
-     
- public:
-     MigrationImpl(const NS_UNO::Reference< NS_CSS::lang::XMultiServiceFactory >&);
-diff --git officecfg/registry/schema/org/openoffice/Setup.xcs officecfg/registry/schema/org/openoffice/Setup.xcs
-index de8a64e..f19feef 100644
---- officecfg/registry/schema/org/openoffice/Setup.xcs
-+++ officecfg/registry/schema/org/openoffice/Setup.xcs
-@@ -446,6 +446,14 @@
-           <desc>Deprecated</desc>
- 				</info>
- 			</prop>
-+            <prop oor:name="ooLastVersionTouched" oor:type="xs:string">
-+                <info>
-+                    <author>Kohei Yoshida</author>
-+                    <desc>Specifies the version of OOo that touched the configration for the last time.  The format must
-+                    be in the form of major.minor.micro (e.g. 2.3.1).  Note that this value may not always be present if the
-+                    last touched version is very old.</desc>
-+                </info>
-+            </prop>
- 		</group>
-     <group oor:name="Migration">
-       <info>
--- 
-1.7.0.1
-


More information about the Libreoffice-commits mailing list