Bugfix with auto-open db

This commit is contained in:
Philipp Crocoll 2013-10-03 04:15:40 +02:00
parent 56ca74a3d9
commit fcae4fcbb6
2 changed files with 5 additions and 1 deletions

View File

@ -562,6 +562,7 @@ namespace keepass2android
private void GoToFileSelectActivity() private void GoToFileSelectActivity()
{ {
Intent intent = new Intent(this, typeof (FileSelectActivity)); Intent intent = new Intent(this, typeof (FileSelectActivity));
intent.PutExtra(FileSelectActivity.NoForwardToPasswordActivity, true);
AppTask.ToIntent(intent); AppTask.ToIntent(intent);
StartActivityForResult(intent, 0); StartActivityForResult(intent, 0);
Finish(); Finish();

View File

@ -65,6 +65,8 @@ namespace keepass2android
internal AppTask AppTask; internal AppTask AppTask;
private IOConnectionInfo _iocToLaunch; private IOConnectionInfo _iocToLaunch;
public const string NoForwardToPasswordActivity = "NoForwardToPasswordActivity";
void ShowFilenameDialog(bool showOpenButton, bool showCreateButton, bool showBrowseButton, string defaultFilename, string detailsText, int requestCodeBrowse) void ShowFilenameDialog(bool showOpenButton, bool showCreateButton, bool showBrowseButton, string defaultFilename, string detailsText, int requestCodeBrowse)
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
@ -583,10 +585,11 @@ namespace keepass2android
else else
{ {
//if no database is loaded: load the most recent database //if no database is loaded: load the most recent database
if (_DbHelper.HasRecentFiles()) if ( (Intent.GetBooleanExtra(NoForwardToPasswordActivity, false)==false) && _DbHelper.HasRecentFiles())
{ {
Android.Database.ICursor filesCursor = _DbHelper.FetchAllFiles(); Android.Database.ICursor filesCursor = _DbHelper.FetchAllFiles();
StartManagingCursor(filesCursor); StartManagingCursor(filesCursor);
filesCursor.MoveToFirst();
IOConnectionInfo ioc = _DbHelper.CursorToIoc(filesCursor); IOConnectionInfo ioc = _DbHelper.CursorToIoc(filesCursor);
if (App.Kp2a.GetFileStorage(ioc).RequiredSetup == null) if (App.Kp2a.GetFileStorage(ioc).RequiredSetup == null)
{ {