Skip to content

Add unlock dialog on Autotype and show default Autotype sequence#89

Merged
droidmonkey merged 8 commits intodevelopfrom
feature/autotype-unlock-#10
Nov 11, 2016
Merged

Add unlock dialog on Autotype and show default Autotype sequence#89
droidmonkey merged 8 commits intodevelopfrom
feature/autotype-unlock-#10

Conversation

@TheZ3ro
Copy link
Copy Markdown
Contributor

@TheZ3ro TheZ3ro commented Nov 8, 2016

There is a small issue with this PR. @droidmonkey
If multiple databases are loaded: first check if there is an unlocked one, if not ask the password for the first locked database.
Do we want a Dialog for select witch DB to unlock? (This needs 4 new file, 2 for the dialog, 2 for the view)

Description

  • Add unlock dialog on Autotype when using a Locked Database
  • Add dialog to select witch database unlock
  • Show defualt Autotype sequence

Motivation and Context

Fixes #10
Based on keepassx/keepassx#160 by @andrewcchen
Based on keepassx/keepassx#103 by @cbrunet

How Has This Been Tested?

Manually, with make test (all test are passed), and with TravisCI

Screenshots (if appropriate):

Sorry for the italian language in the first screenshot
istantanea_2016-11-08_14-56-07
istantanea_2016-11-08_15-30-19

Types of changes

  • ❎ Bug fix (non-breaking change which fixes an issue)
  • ✅ New feature (non-breaking change which adds functionality)
  • ❎ Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • ✅ I have read the CONTRIBUTING document. [REQUIRED]
  • ✅ My code follows the code style of this project. [REQUIRED]
  • ✅ All new and existing tests passed. [REQUIRED]
  • ❎ My change requires a change to the documentation.
  • ❎ I have updated the documentation accordingly.
  • ❎ I have added tests to cover my changes.

@TheZ3ro TheZ3ro self-assigned this Nov 8, 2016
@TheZ3ro TheZ3ro added this to the v2.1.0 milestone Nov 8, 2016
@TheZ3ro TheZ3ro changed the title Add unlock dialog on Autotype and save Autotype Shortcut in configuration Add unlock dialog on Autotype and show default Autotype sequence Nov 8, 2016
@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Nov 8, 2016

Seems that Travis don't like the second commit.

I need to fix that

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Nov 9, 2016

There is a small issue with this PR. @droidmonkey
If multiple databases are loaded: first check if there is an unlocked one, if not ask the password for the first locked database.
Do we want a Dialog for select witch DB to unlock? (This needs 4 new file, 2 for the dialog, 2 for the view)

What can we do?


const Group* group = this;
// check if group exist (if the entry has a group)
if(group) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check doesn't make sense, "this" cannot be null unless you are calling a null pointer to begin with. This check needs to go in the function that calls into the group class.

if (!m_data.defaultAutoTypeSequence.isEmpty()) {
return m_data.defaultAutoTypeSequence;
}
QString sequence = group()->effectiveAutoTypeSequence();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks is where the group null check should go.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, not thanks

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Nov 9, 2016

Fixed. What about the multiple database behavior ?

if(grp) {
sequence = grp->effectiveAutoTypeSequence();
} else {
sequence = QString();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this is unnecessary, but not wrong.


const Group* group = this;
do {
if (!enableSet) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll be honest the way this is coded is very confusing. The while conditions seem like they should be satisfied upfront instead of lumbering through the loop with a return statement embedded in there. Recommend cleaning that up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the code that directly come from src/autotype/Autotype.cpp -> AutoType::autoTypeSequence
I will do a cleanup (maybe also in the autoTypeSequence function?)

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Nov 11, 2016

Ping @droidmonkey

@droidmonkey
Copy link
Copy Markdown
Member

Everything seems to work fine, except for when you create a NEW group/entry it does not populate with the default auto-type sequence. This is obviously related to the null check. I think we need to open a separate issue for that particular bug.

@droidmonkey droidmonkey merged commit 6927158 into develop Nov 11, 2016
@droidmonkey droidmonkey deleted the feature/autotype-unlock-#10 branch November 11, 2016 21:26
@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Nov 11, 2016

Yeah, the issue is in the EditGroupWidget::loadGroup function because it load group->effectiveAutotypeSequence but the group sequence never return the default sequence (scan parent group to rootGroup and then return empty string)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show unlock dialog when using autotype with a locked database

2 participants