summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-02-08 18:06:06 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-02-09 05:48:58 +0100
commit2a7057250c8f73fdfb4c65a7525d17e9770459df (patch)
tree2fb8b54e2e00f731818041449362ec2163f908ad /include
parent7d56128654457bfc859217c23a957d1712fd6e1c (diff)
tdf#108210: Allow to ignore a lock file if there's no filesystem lock
Two cases are handled: when a file is being opened, and when it was opened read-only already, and one tries to reopen it in edit mode. The option to ignore locking and open the file anyway is only offered when there is no filesystem lock present on the file. Change-Id: I377d3cae4c949ae64d449634acea8fb3f68a5700 Reviewed-on: https://gerrit.libreoffice.org/49448 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/sfx2/docfile.hxx19
-rw-r--r--include/sfx2/strings.hrc3
2 files changed, 17 insertions, 5 deletions
diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx
index 822c69b1da4f..06a7f9623764 100644
--- a/include/sfx2/docfile.hxx
+++ b/include/sfx2/docfile.hxx
@@ -162,11 +162,13 @@ public:
bool Commit();
bool IsStorage();
- enum class ShowLockResult { NoLock, Succeeded,Try };
- ShowLockResult ShowLockedDocumentDialog( const LockFileEntry& aData, bool bIsLoading, bool bOwnLock, bool bHandleSysLocked);
- void LockOrigFileOnDemand( bool bLoading, bool bNoUI );
- enum class MessageDlg { LockFileIgnore, LockFileCorrupt };
- bool ShowLockFileProblemDialog(MessageDlg nWhichDlg);
+ enum class LockFileResult
+ {
+ Failed,
+ FailedLockFile, // there was only lock file that prevented success - no syslock or IO error
+ Succeeded,
+ };
+ LockFileResult LockOrigFileOnDemand( bool bLoading, bool bNoUI, bool bTryIgnoreLockFile = false );
void DisableUnlockWebDAV( bool bDisableUnlockWebDAV = true );
void UnlockFile( bool bReleaseLockStream );
/// Lets Transfer_Impl() not fsync the output file.
@@ -275,6 +277,13 @@ public:
static bool SetWritableForUserOnly( const OUString& aURL );
static sal_uInt32 CreatePasswordToModifyHash( const OUString& aPasswd, bool bWriter );
+
+private:
+ enum class ShowLockResult { NoLock, Succeeded, Try };
+ ShowLockResult ShowLockedDocumentDialog(const LockFileEntry& aData, bool bIsLoading, bool bOwnLock, bool bHandleSysLocked);
+ enum class MessageDlg { LockFileIgnore, LockFileCorrupt };
+ bool ShowLockFileProblemDialog(MessageDlg nWhichDlg);
+
};
#endif
diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc
index 889ccf8ab22b..c36a37b4893a 100644
--- a/include/sfx2/strings.hrc
+++ b/include/sfx2/strings.hrc
@@ -235,6 +235,9 @@
#define STR_CANT_CLOSE NC_("STR_CANT_CLOSE", "The document cannot be closed because a\n print job is being carried out.")
#define STR_ERROR_SEND_MAIL NC_("STR_ERROR_SEND_MAIL", "An error occurred in sending the message. Possible errors could be a missing user account or a defective setup.\nPlease check the %PRODUCTNAME settings or your e-mail program settings.")
#define STR_QUERY_OPENASTEMPLATE NC_("STR_QUERY_OPENASTEMPLATE", "This document cannot be edited, possibly due to missing access rights. Do you want to edit a copy of the document?")
+#define STR_QUERY_OPENASTEMPLATE_ALLOW_IGNORE NC_("STR_QUERY_OPENASTEMPLATE_ALLOW_IGNORE", "This document cannot be edited, because it is locked in another session. Do you want to edit a copy of the document?\n\nYou can also try to ignore the lock and open the file for editing.")
+#define STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN NC_("STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN", "Open ~Copy")
+#define STR_QUERY_OPENASTEMPLATE_OPEN_BTN NC_("STR_QUERY_OPENASTEMPLATE_OPEN_BTN", "~Open")
#define STR_REPAIREDDOCUMENT NC_("STR_REPAIREDDOCUMENT", " (repaired document)")
#define STR_NONCHECKEDOUT_DOCUMENT NC_("STR_NONCHECKEDOUT_DOCUMENT", "This document is not checked out on the server.")
#define STR_READONLY_DOCUMENT NC_("STR_READONLY_DOCUMENT", "This document is open in read-only mode.")