From c82fc7d772cf2acf8e5f3e317b8a6d9b3630641e Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Mon, 10 Jul 2017 11:44:04 +0200 Subject: [PATCH] allow to export when working offline --- .../KP2ASoftkeyboard_AS/.idea/workspace.xml | 121 +++++++++++------- src/keepass2android/ExportDatabaseActivity.cs | 12 +- 2 files changed, 88 insertions(+), 45 deletions(-) diff --git a/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml b/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml index c899bebb..b96d65e4 100644 --- a/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml +++ b/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml @@ -40,11 +40,20 @@ - + - - + + + + + + + + + + + @@ -53,7 +62,7 @@ - + @@ -116,8 +125,8 @@ - - + + @@ -1442,6 +1451,7 @@ + @@ -1463,9 +1473,8 @@ - - + @@ -1815,24 +1824,23 @@ - + - + - + - @@ -1850,6 +1858,7 @@ + @@ -1920,8 +1929,17 @@ - - + + + + + + + + + + + @@ -1946,7 +1964,6 @@ - @@ -2001,8 +2018,17 @@ - - + + + + + + + + + + + @@ -2027,7 +2053,6 @@ - @@ -2179,7 +2204,6 @@ - @@ -2215,17 +2239,6 @@ - - - - - - - - - - - @@ -2279,12 +2292,43 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2293,21 +2337,10 @@ - - - - - - - - - - - - - + + diff --git a/src/keepass2android/ExportDatabaseActivity.cs b/src/keepass2android/ExportDatabaseActivity.cs index 251ca171..196e9782 100644 --- a/src/keepass2android/ExportDatabaseActivity.cs +++ b/src/keepass2android/ExportDatabaseActivity.cs @@ -211,7 +211,12 @@ namespace keepass2android try { - using (var writeTransaction =_app.GetFileStorage(_targetIoc).OpenWriteTransaction(_targetIoc, _app.GetDb().KpDatabase.UseFileTransactions)) + var fileStorage = _app.GetFileStorage(_targetIoc); + if (fileStorage is IOfflineSwitchable) + { + ((IOfflineSwitchable) fileStorage).IsOffline = false; + } + using (var writeTransaction = fileStorage.OpenWriteTransaction(_targetIoc, _app.GetDb().KpDatabase.UseFileTransactions)) { Stream sOut = writeTransaction.OpenFile(); _fileFormat.Export(pwInfo, sOut, new NullStatusLogger()); @@ -221,6 +226,11 @@ namespace keepass2android writeTransaction.CommitWrite(); } + if (fileStorage is IOfflineSwitchable) + { + ((IOfflineSwitchable)fileStorage).IsOffline = App.Kp2a.OfflineMode; + } + Finish(true);