ooo-build r11885 - in trunk: . patches/src680



Author: kyoshida
Date: Wed Mar 12 21:02:46 2008
New Revision: 11885
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11885&view=rev

Log:
2008-03-12  Kohei Yoshida  <kyoshida novell com>

	* patches/src680/desktop-keyconfig-migration.diff: changed it so that
	the key binding overwrite would get done only when the config version is
	older than 2.4.0.


Modified:
   trunk/ChangeLog
   trunk/patches/src680/desktop-keyconfig-migration.diff

Modified: trunk/patches/src680/desktop-keyconfig-migration.diff
==============================================================================
--- trunk/patches/src680/desktop-keyconfig-migration.diff	(original)
+++ trunk/patches/src680/desktop-keyconfig-migration.diff	Wed Mar 12 21:02:46 2008
@@ -1,6 +1,6 @@
 diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=desktop.vpj desktop.clean/source/migration/migration.cxx desktop/source/migration/migration.cxx
 --- desktop.clean/source/migration/migration.cxx	2008-03-07 09:57:38.000000000 -0500
-+++ desktop/source/migration/migration.cxx	2008-03-12 00:31:30.000000000 -0400
++++ desktop/source/migration/migration.cxx	2008-03-12 15:21:38.000000000 -0400
 @@ -58,6 +58,10 @@
  #include <com/sun/star/configuration/backend/XSingleLayerStratum.hpp>
  #include <com/sun/star/util/XRefreshable.hpp>
@@ -21,17 +21,31 @@
  
  namespace desktop {
  
-@@ -133,12 +139,107 @@ OUString MigrationImpl::getOldVersionNam
+@@ -128,17 +134,148 @@ 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, sal_uInt8& rMajor, sal_uInt8& rMinor, sal_uInt8& rMicro)
- {
--    if (m_aInfo.userdata.getLength() > 0 && ! checkMigrationCompleted())
-+    rMajor = 0;
-+    rMinor = 0;
-+    rMicro = 0;
++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();
@@ -55,9 +69,9 @@
 +
 +            switch (nPos)
 +            {
-+                case 0: rMajor = static_cast<sal_uInt8>(nTmp); break;
-+                case 1: rMinor = static_cast<sal_uInt8>(nTmp); break;
-+                case 2: rMicro = static_cast<sal_uInt8>(nTmp); break;
++                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;
@@ -71,34 +85,55 @@
 +    return true;
 +}
 +
-+static sal_Bool isMigrationNeeded(const OUString& rConfigVer, const OUString& rAppVer)
++/** 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)
 +{
-+    sal_uInt8 nConfMajor, nConfMinor, nConfMicro;
-+    sal_uInt8 nAppMajor,  nAppMinor,  nAppMicro;
-+    if (!splitVersionString(rConfigVer, nConfMajor, nConfMinor, nConfMicro))
++    if (!splitVersionString(rConfVerStr, rConfVerNum))
 +        return sal_False;
 +
-+    if (!splitVersionString(rAppVer, nAppMajor, nAppMinor, nAppMicro))
++    if (!splitVersionString(rAppVerStr, rAppVerNum))
 +        return sal_False;
 +
-+#if 0    
++#if 0
 +    fprintf(stdout, "desktop::isMigrationNeeded: config ver = %d.%d.%d\n", 
-+            nConfMajor,nConfMinor,nConfMicro);
++            rConfVerNum.mnMajor,rConfVerNum.mnMinor,rConfVerNum.mnMicro);
 +
 +    fprintf(stdout, "desktop::isMigrationNeeded: app ver = %d.%d.%d\n", 
-+            nAppMajor,nAppMinor,nAppMicro);
++            rAppVerNum.mnMajor,rAppVerNum.mnMinor,rAppVerNum.mnMicro);
 +#endif    
 +
-+    if (nConfMajor < nAppMajor)
++    if (compareVersion(rConfVerNum, rAppVerNum) < 0)
          return sal_True;
 -    else
 +
-+    if (nConfMinor < nAppMinor)
-+        return sal_True;
-+
-+    if (nConfMicro < nAppMicro)
-+        return sal_True;
-+
 +    return sal_False;
 +}
 +
@@ -112,7 +147,7 @@
 +    {
 +        Reference< XPropertySet > aPropSet(getConfigAccess("org.openoffice.Setup/Product"), UNO_QUERY_THROW);
 +        Any any = aPropSet->getPropertyValue(ascii("ooSetupVersionAboutBox"));
-+        if (!(any >>= m_aAppVersion))
++        if (!(any >>= m_aAppVerStr))
 +            // Current version unknown.  Don't do migration (this should not happen).
 +            return sal_False;
 +
@@ -120,10 +155,16 @@
 +        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_aAppVersion);
++        return isMigrationNeeded(aLastVersion, m_aAppVerStr, m_aConfigVerNum, m_aAppVerNum);
 +    }
 +    catch (const Exception&)
 +    {
@@ -132,7 +173,7 @@
  }
  
  MigrationImpl::MigrationImpl(const Reference< XMultiServiceFactory >& xFactory)
-@@ -148,6 +249,7 @@ MigrationImpl::MigrationImpl(const Refer
+@@ -148,6 +285,7 @@ MigrationImpl::MigrationImpl(const Refer
      , m_aInfo(findInstallation())    
      , m_vrFileList(compileFileList())
      , m_vrServiceList(compileServiceList())
@@ -140,7 +181,7 @@
  {
  }
  
-@@ -158,28 +260,13 @@ MigrationImpl::~MigrationImpl()
+@@ -158,28 +296,12 @@ MigrationImpl::~MigrationImpl()
  
  sal_Bool MigrationImpl::doMigration()
  {
@@ -169,14 +210,13 @@
 +    try
 +    {
 +        transKeyConfig();
-+    
 +    }
 +    catch (const Exception&)
 +    {
      }
  
  	// prevent running the migration multiple times
-@@ -187,43 +274,60 @@ sal_Bool MigrationImpl::doMigration()
+@@ -187,43 +309,73 @@ sal_Bool MigrationImpl::doMigration()
      return sal_False;
  }
  
@@ -193,34 +233,47 @@
 +    using namespace ::com::sun::star;
 +    using namespace ::com::sun::star::ui;
 +
-+    Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(
-+        m_xFactory->createInstance(
-+            ascii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")), UNO_QUERY_THROW);
-+
-+    // Grab the Calc configuration.
-+    Reference< XUIConfigurationManager > xConfigMgr = 
-+        xModuleCfgSupplier->getUIConfigurationManager(
-+            ascii("com.sun.star.sheet.SpreadsheetDocument"));
-+
-+    if (!xConfigMgr.is())
-+        return;
-+
-+    Reference< XAcceleratorConfiguration > xScAccel(
-+        xConfigMgr->getShortCutManager(), 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"));
++#if 0
++    fprintf(stdout, "MigrationImpl::transKeyConfig:   config ver = %ld.%ld.%ld\n",
++            m_aConfigVerNum.mnMajor, m_aConfigVerNum.mnMinor, m_aConfigVerNum.mnMicro);
++
++    fprintf(stdout, "MigrationImpl::transKeyConfig:   app ver = %ld.%ld.%ld\n",
++            m_aAppVerNum.mnMajor, m_aAppVerNum.mnMinor, m_aAppVerNum.mnMicro);
++#endif
++
++    if (compareVersion(m_aConfigVerNum, VersionNumber(2,4,0)) < 0)
++    {
++        // For config versions older than 2.4.0 only.
 +
-+    xScAccel->store();
++        Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(
++            m_xFactory->createInstance(
++                ascii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")), UNO_QUERY_THROW);
++    
++        // Grab the Calc configuration.
++        Reference< XUIConfigurationManager > xConfigMgr = 
++            xModuleCfgSupplier->getUIConfigurationManager(
++                ascii("com.sun.star.sheet.SpreadsheetDocument"));
++    
++        if (xConfigMgr.is())
++        {
++            Reference< XAcceleratorConfiguration > xScAccel(
++                xConfigMgr->getShortCutManager(), 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();
++        }
++    }
  }
  
  void MigrationImpl::setMigrationCompleted() 
@@ -236,10 +289,10 @@
 +	try
 +    {
 +        Reference< XPropertySet > aPropSet;
-+        if (m_aAppVersion.getLength() > 0)
++        if (m_aAppVerStr.getLength() > 0)
 +        {
 +            aPropSet.set(getConfigAccess("org.openoffice.Setup/Configuration", true), UNO_QUERY_THROW);
-+            aPropSet->setPropertyValue(ascii("ooLastVersionTouched"), makeAny(m_aAppVersion));
++            aPropSet->setPropertyValue(ascii("ooLastVersionTouched"), makeAny(m_aAppVerStr));
 +            Reference< XChangesBatch >(aPropSet, UNO_QUERY_THROW)->commitChanges();
 +        }
  
@@ -266,7 +319,7 @@
  migrations_vr MigrationImpl::readMigrationSteps()
  {
  
-@@ -442,82 +546,6 @@ strings_vr MigrationImpl::compileFileLis
+@@ -442,82 +594,6 @@ strings_vr MigrationImpl::compileFileLis
      return vrResult;
  }
  
@@ -349,7 +402,7 @@
  // removes elements of vector 2 in vector 1
  void MigrationImpl::substract(strings_v& va, const strings_v& vb_c) const
  {
-@@ -597,123 +625,6 @@ static FileBase::RC _checkAndCreateDirec
+@@ -597,123 +673,6 @@ static FileBase::RC _checkAndCreateDirec
          return result;
  }       
  
@@ -475,17 +528,36 @@
      strings_vr vrResult(new strings_v);
 diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=desktop.vpj desktop.clean/source/migration/migration_impl.hxx desktop/source/migration/migration_impl.hxx
 --- desktop.clean/source/migration/migration_impl.hxx	2008-03-07 09:57:38.000000000 -0500
-+++ desktop/source/migration/migration_impl.hxx	2008-03-12 00:30:29.000000000 -0400
-@@ -90,6 +90,8 @@ private:
++++ desktop/source/migration/migration_impl.hxx	2008-03-12 15:17:53.000000000 -0400
+@@ -81,6 +81,16 @@ typedef std::auto_ptr< migrations_v > mi
+ 
+ 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;
+@@ -90,6 +100,10 @@ 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_aAppVersion;
++    ::rtl::OUString m_aAppVerStr;
 +    bool m_bMigrationCompleted;
++    VersionNumber m_aAppVerNum;
++    VersionNumber m_aConfigVerNum;
  
      // initializer functions...
      migrations_vr readMigrationSteps();
-@@ -104,14 +106,9 @@ private:
+@@ -104,14 +118,9 @@ private:
      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);
  
@@ -501,3 +573,21 @@
      
  public:
      MigrationImpl(const NS_UNO::Reference< NS_CSS::lang::XMultiServiceFactory >&);
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=officecfg.vpj officecfg.clean/registry/schema/org/openoffice/Setup.xcs officecfg/registry/schema/org/openoffice/Setup.xcs
+--- officecfg.clean/registry/schema/org/openoffice/Setup.xcs	2008-03-03 11:28:58.000000000 -0500
++++ officecfg/registry/schema/org/openoffice/Setup.xcs	2008-03-07 17:12:18.000000000 -0500
+@@ -422,6 +422,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>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]