summaryrefslogtreecommitdiff
path: root/uui
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-02-21 00:45:04 +0300
committerJan Holesovsky <kendy@collabora.com>2018-05-22 12:03:44 +0200
commit461e12839eb94bd893d08cc7c71552d6689121bb (patch)
treeb9a3fc56a36cbe315c350dbec6016d040030ae20 /uui
parent9de67f5139573c6406ee2f96aea5e1d5be0a205b (diff)
tdf#115742: allow ignoring stale lockfile on save
This change reuses TryLaterQueryBox, but only uses the new option to ignore the lock and save. Other options ("Try Again" and "Save As") are not used, because this functionality is not implemented currently (TODO/LATER). Change-Id: Idf825be23cf97d2b338c0cf5d532f8460843bf48 Reviewed-on: https://gerrit.libreoffice.org/50371 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/50409 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'uui')
-rw-r--r--uui/source/iahndl-locking.cxx3
-rw-r--r--uui/source/ids.hrc35
-rw-r--r--uui/source/trylater.cxx29
-rw-r--r--uui/source/trylater.hxx2
-rw-r--r--uui/source/trylater.src4
5 files changed, 47 insertions, 26 deletions
diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx
index d1c00706d769..f4a14ef9bc3f 100644
--- a/uui/source/iahndl-locking.cxx
+++ b/uui/source/iahndl-locking.cxx
@@ -111,7 +111,8 @@ handleLockedDocumentRequest_(
? aInfo
: ResId( STR_UNKNOWNUSER,
*xManager.get() ).toString() );
- aMessage = ResId(STR_TRYLATER_MSG, *xManager.get()).toString();
+ aMessage = ResId(xRetry.is() ? STR_OVERWRITE_IGNORELOCK_MSG : STR_TRYLATER_MSG,
+ *xManager.get()).toString();
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
diff --git a/uui/source/ids.hrc b/uui/source/ids.hrc
index d3f2a80f2d59..2d9f8128d683 100644
--- a/uui/source/ids.hrc
+++ b/uui/source/ids.hrc
@@ -54,24 +54,25 @@
#define STR_LOCKCORRUPT_OPENREADONLY_BTN (RID_UUI_START + 49)
#define STR_TRYLATER_TITLE (RID_UUI_START + 50)
#define STR_TRYLATER_MSG (RID_UUI_START + 51)
-#define STR_TRYLATER_RETRYSAVING_BTN (RID_UUI_START + 52)
-#define STR_TRYLATER_SAVEAS_BTN (RID_UUI_START + 53)
-#define STR_ALREADYOPEN_SAVE_MSG (RID_UUI_START + 54)
-#define STR_ALREADYOPEN_RETRY_SAVE_BTN (RID_UUI_START + 55)
-#define STR_ALREADYOPEN_SAVE_BTN (RID_UUI_START + 56)
+#define STR_OVERWRITE_IGNORELOCK_MSG (RID_UUI_START + 52)
+#define STR_TRYLATER_RETRYSAVING_BTN (RID_UUI_START + 53)
+#define STR_TRYLATER_SAVEAS_BTN (RID_UUI_START + 54)
+#define STR_ALREADYOPEN_SAVE_MSG (RID_UUI_START + 55)
+#define STR_ALREADYOPEN_RETRY_SAVE_BTN (RID_UUI_START + 56)
+#define STR_ALREADYOPEN_SAVE_BTN (RID_UUI_START + 57)
-#define STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE (RID_UUI_START + 57)
-#define STR_WARNING_BROKENSIGNATURE_TITLE (RID_UUI_START + 58)
-#define STR_ENTER_PASSWORD_TO_OPEN (RID_UUI_START + 59)
-#define STR_ENTER_PASSWORD_TO_MODIFY (RID_UUI_START + 60)
-#define STR_RENAME_OR_REPLACE (RID_UUI_START + 61)
-#define STR_NAME_CLASH_RENAME_ONLY (RID_UUI_START + 62)
-#define STR_SAME_NAME_USED (RID_UUI_START + 63)
-#define STR_ENTER_SIMPLE_PASSWORD (RID_UUI_START + 64)
-#define STR_CONFIRM_SIMPLE_PASSWORD (RID_UUI_START + 65)
-#define STR_TITLE_CREATE_PASSWORD (RID_UUI_START + 66)
-#define STR_TITLE_ENTER_PASSWORD (RID_UUI_START + 67)
-#define STR_PASSWORD_MISMATCH (RID_UUI_START + 68)
+#define STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE (RID_UUI_START + 58)
+#define STR_WARNING_BROKENSIGNATURE_TITLE (RID_UUI_START + 59)
+#define STR_ENTER_PASSWORD_TO_OPEN (RID_UUI_START + 60)
+#define STR_ENTER_PASSWORD_TO_MODIFY (RID_UUI_START + 61)
+#define STR_RENAME_OR_REPLACE (RID_UUI_START + 62)
+#define STR_NAME_CLASH_RENAME_ONLY (RID_UUI_START + 63)
+#define STR_SAME_NAME_USED (RID_UUI_START + 64)
+#define STR_ENTER_SIMPLE_PASSWORD (RID_UUI_START + 65)
+#define STR_CONFIRM_SIMPLE_PASSWORD (RID_UUI_START + 66)
+#define STR_TITLE_CREATE_PASSWORD (RID_UUI_START + 67)
+#define STR_TITLE_ENTER_PASSWORD (RID_UUI_START + 68)
+#define STR_PASSWORD_MISMATCH (RID_UUI_START + 69)
#define ERRCODE_UUI_IO_ABORT (ERRCODE_AREA_UUI + 0)
#define ERRCODE_UUI_IO_ACCESSDENIED (ERRCODE_AREA_UUI + 1)
diff --git a/uui/source/trylater.cxx b/uui/source/trylater.cxx
index 90688a95e2a3..52c9a9de2a90 100644
--- a/uui/source/trylater.cxx
+++ b/uui/source/trylater.cxx
@@ -20,20 +20,35 @@
#include "ids.hrc"
#include "trylater.hxx"
-TryLaterQueryBox::TryLaterQueryBox( vcl::Window* pParent, ResMgr* pResMgr, const OUString& aMessage ) :
+TryLaterQueryBox::TryLaterQueryBox( vcl::Window* pParent, ResMgr* pResMgr, const OUString& aMessage, bool bEnableOverride ) :
MessBox(pParent, 0,
ResId(STR_TRYLATER_TITLE, *pResMgr).toString(),
aMessage )
{
SetImage( QueryBox::GetStandardImage() );
- AddButton(ResId(STR_TRYLATER_RETRYSAVING_BTN, *pResMgr).toString(), RET_YES,
- ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus);
- AddButton(ResId(STR_TRYLATER_SAVEAS_BTN, *pResMgr).toString(), RET_NO);
- AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel );
+ // Currently we don't have the retry/save-as functionality implemented for cases when file is locked.
+ // So threat them mutually exclusive with overwrite here. TODO/LATER: just add the overwrite option
+ // as third option when retrying and saving with another name would be possible along with overwriting
+ if (bEnableOverride)
+ {
+ AddButton(ResId(STR_FILECHANGED_SAVEANYWAY_BTN, *pResMgr).toString(), RET_IGNORE,
+ ButtonDialogFlags::OK);
+ AddButton(StandardButtonType::Cancel, RET_CANCEL,
+ ButtonDialogFlags::Default | ButtonDialogFlags::Cancel | ButtonDialogFlags::Focus);
- SetButtonHelpText( RET_YES, OUString() );
- SetButtonHelpText( RET_NO, OUString() );
+ SetButtonHelpText(RET_IGNORE, OUString());
+ }
+ else
+ {
+ AddButton(ResId(STR_TRYLATER_RETRYSAVING_BTN, *pResMgr).toString(), RET_YES,
+ ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus);
+ AddButton(ResId(STR_TRYLATER_SAVEAS_BTN, *pResMgr).toString(), RET_NO);
+ AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel );
+
+ SetButtonHelpText( RET_YES, OUString() );
+ SetButtonHelpText( RET_NO, OUString() );
+ }
}
TryLaterQueryBox::~TryLaterQueryBox()
diff --git a/uui/source/trylater.hxx b/uui/source/trylater.hxx
index 961cbe5f3a14..053a6638d4a3 100644
--- a/uui/source/trylater.hxx
+++ b/uui/source/trylater.hxx
@@ -24,7 +24,7 @@
class TryLaterQueryBox : public MessBox
{
public:
- TryLaterQueryBox( vcl::Window* pParent, ResMgr* pResMgr, const OUString& aMessage );
+ TryLaterQueryBox( vcl::Window* pParent, ResMgr* pResMgr, const OUString& aMessage, bool bEnableOverride );
virtual ~TryLaterQueryBox() override;
};
diff --git a/uui/source/trylater.src b/uui/source/trylater.src
index 4459c1530c74..dc556e40e741 100644
--- a/uui/source/trylater.src
+++ b/uui/source/trylater.src
@@ -29,6 +29,10 @@ String STR_TRYLATER_MSG
{
Text [ en-US ] = "Document file '$(ARG1)' is locked for editing by:\n\n$(ARG2)\n\nTry again later to save document or save a copy of that document.\n\n";
};
+String STR_OVERWRITE_IGNORELOCK_MSG
+{
+ Text [ en-US ] = "Document file '$(ARG1)' is locked for editing by:\n\n$(ARG2)\n\nYou may try to ignore the file locking and overwrite the existing document.\n\n";
+};
String STR_TRYLATER_RETRYSAVING_BTN
{
Text [ en-US ] = "~Retry Saving";