shermp / NickelDBus

Monitor and control kobo Nickel via dbus
MIT License
27 stars 2 forks source link

Confirmation Dialog refactor and line input #10

Closed shermp closed 3 years ago

shermp commented 3 years ago

In order to support text input, I decided to refactor the Confirmation Dialog code into its own class.

I've then added support for adding a line input dialog to get input from the user. The line input can be normal or a password field, complete with Show Password checkbox. It is also possible to add placeholder text when creating the input box.

Two new methods dlgConfirmLineEdit and dlgConfirmLineEditPlaceholder have been created. A new signal, dlgConfirmTextInput has also been created.

When the user taps the accept button, the dlgConfirmTextInput signal is emitted with the contents of the input box, otherwise dlgConfirmResult is emitted.

During my experiments, I had a multi-line text edit dialog working, but decided to drop it in favor of the current implementation which is far simpler and hopefully a lot less fragile, but only supports single line input.

See also #9 for my experiment musings and results.

Tested on FW 4.6 and 4.25. One hopes it will work on the firmware versions between those tested...

shermp commented 3 years ago

As another note, I never did end up figuring out how to hook up the keyboard's Go button, so tapping that does nothing.

shermp commented 3 years ago

As another note, I never did end up figuring out how to hook up the keyboard's Go button, so tapping that does nothing.

Well, that was easy. Turns out that N3ConfirmationTextEditField::commitRequested() is the signal that is emitted when the Go button is tapped.

Let me implement that properly. Just need connect it to the accepted signal of the dialog and should be good to go.

EDIT: And done. Seems to work well.

EDIT2: I've implemented it in a nice to have manner. If the connection fails, I just log it and carry on.

shermp commented 3 years ago

Apologies for the late changes. Think I'm done now.

shermp commented 3 years ago

Any chance of testing/reviewing this in the near future @pgaskin and @NiLuJe ?

pgaskin commented 3 years ago

I want to look at this closely, but I might not be able to get around to it until Sunday (I'll be making the NM release around the same time).

shermp commented 3 years ago

That's fine, thanks for the update.

I'm quite happy for you to have a close look. Don't want to be releasing something with any major issues after all.

shermp commented 3 years ago

Closing this for now in favor of #11