[PATCH] fdo#47011 autosave feature

Krisztian Pinter (via Code Review) gerrit at gerrit.libreoffice.org
Mon Mar 11 05:03:38 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2663

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/63/2663/1

fdo#47011 autosave feature

removed unnecessary prop. name "Document/UserAutoSave" from saveopt.cxx
fixed autosave feature setting "losing its value"
set autosave feature default value to False

Change-Id: I473154b21bab53bf595a5a59e87dc16e472dcbf9
---
M cui/source/options/optsave.src
M framework/source/services/autorecovery.cxx
M officecfg/registry/schema/org/openoffice/Office/Recovery.xcs
M unotools/source/config/saveopt.cxx
4 files changed, 17 insertions(+), 20 deletions(-)



diff --git a/cui/source/options/optsave.src b/cui/source/options/optsave.src
index 3d3d8f4..45bcd07 100644
--- a/cui/source/options/optsave.src
+++ b/cui/source/options/optsave.src
@@ -112,7 +112,7 @@
     };
     CheckBox BTN_USERAUTOSAVE
     {
-        HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_USERAUTOSAVE"; //? FIX ME
+        HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_USERAUTOSAVE";
         Pos = MAP_APPFONT ( 21 , 74 ) ;
         Size = MAP_APPFONT ( 163 , 10 ) ;
         Text [ en-US ] = "Automatically save the document too" ;
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index d0f1fab..431b5a4 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -21,8 +21,6 @@
 #include "services/autorecovery.hxx"
 #include <loadenv/loadenv.hxx>
 
-#include <sfx2/sfxbasemodel.hxx> //?
-
 #include <loadenv/targethelper.hxx>
 #include <pattern/frame.hxx>
 #include <threadhelp/readguard.hxx>
@@ -89,6 +87,8 @@
 #include <tools/urlobj.hxx>
 
 #include <fwkdllapi.h>
+
+#include <sfx2/objsh.hxx>
 
 //_______________________________________________
 // namespaces
@@ -583,6 +583,8 @@
     // in case a new dispatch overwrites a may ba active AutoSave session
     // we must restore this session later. see below ...
     sal_Bool bWasAutoSaveActive = ((eJob & AutoRecovery::E_AUTO_SAVE) == AutoRecovery::E_AUTO_SAVE);
+    sal_Bool bWasUserAutoSaveActive =
+        ((eJob & AutoRecovery::E_USER_AUTO_SAVE) == AutoRecovery::E_USER_AUTO_SAVE);
 
     // On the other side it make no sense to reactivate the AutoSave operation
     // if the new dispatch indicates a final decision ...
@@ -691,6 +693,11 @@
        )
     {
         m_eJob |= AutoRecovery::E_AUTO_SAVE;
+
+        if (bWasUserAutoSaveActive)
+        {
+            m_eJob |= AutoRecovery::E_USER_AUTO_SAVE;
+        }
     }
 
     aWriteLock.unlock();
@@ -993,9 +1000,13 @@
         m_eTimerType  = AutoRecovery::E_NORMAL_AUTOSAVE_INTERVALL;
 
         if (bUserEnabled)
+        {
             m_eJob |= AutoRecovery::E_USER_AUTO_SAVE;
+        }
         else
+        {
             m_eJob &= ~AutoRecovery::E_USER_AUTO_SAVE;
+        }
     }
     else
     {
@@ -2341,7 +2352,6 @@
     // Mark AutoSave state as "INCOMPLETE" if it failed.
     // Because the last temp file is to old and does not include all changes.
     Reference< XDocumentRecovery > xDocRecover(rInfo.Document, css::uno::UNO_QUERY_THROW);
-    Reference< XStorable > xDocSave(rInfo.Document, css::uno::UNO_QUERY_THROW);
 
     // safe the state about "trying to save"
     // ... we need it for recovery if e.g. a crash occures inside next line!
@@ -2359,6 +2369,7 @@
             // if userautosave is enabled, also save to the original file
             if((m_eJob & AutoRecovery::E_USER_AUTO_SAVE) == AutoRecovery::E_USER_AUTO_SAVE)
             {
+                Reference< XStorable > xDocSave(rInfo.Document, css::uno::UNO_QUERY_THROW);
                 xDocSave->store();
             }
 
diff --git a/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs b/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs
index a44e611..c775d08 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs
@@ -135,7 +135,7 @@
                 <info>
                     <desc> </desc>
                 </info>
-                <value>true</value>
+                <value>false</value>
             </prop>
             <prop oor:name="TimeIntervall" oor:type="xs:int" oor:nillable="false">
                 <info>
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index 452fcca..513f2a3 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -357,7 +357,6 @@
 #define ODFDEFAULTVERSION   15
 #define USESHA1INODF12      16
 #define USEBLOWFISHINODF12  17
-#define USERAUTOSAVE        18
 
 Sequence< OUString > GetPropertyNames()
 {
@@ -380,8 +379,7 @@
         "WorkingSet",
         "ODF/DefaultVersion",
         "ODF/UseSHA1InODF12",
-        "ODF/UseBlowfishInODF12",
-        "Document/UserAutoSave"
+        "ODF/UseBlowfishInODF12"
     };
 
     const int nCount = sizeof( aPropNames ) / sizeof( const char* );
@@ -499,10 +497,6 @@
                                 case AUTOSAVE :
                                     bAutoSave = bTemp;
                                     bROAutoSave = pROStates[nProp];
-                                    break;
-                                case USERAUTOSAVE :
-                                    bUserAutoSave = bTemp;
-                                    bROUserAutoSave = pROStates[nProp];
                                     break;
                                 case PROMPT :
                                     bAutoSavePrompt = bTemp;
@@ -656,14 +650,6 @@
                 if (!bROAutoSavePrompt)
                 {
                     pValues[nRealCount] <<= bAutoSavePrompt;
-                    pNames[nRealCount] = pOrgNames[i];
-                    ++nRealCount;
-                }
-                break;
-            case USERAUTOSAVE :
-                if (!bROUserAutoSave)
-                {
-                    pValues[nRealCount] <<= bUserAutoSave;
                     pNames[nRealCount] = pOrgNames[i];
                     ++nRealCount;
                 }

-- 
To view, visit https://gerrit.libreoffice.org/2663
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I473154b21bab53bf595a5a59e87dc16e472dcbf9
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Krisztian Pinter <pin.terminator at gmail.com>



More information about the LibreOffice mailing list