Amazing,
GnuPG guy Damien Goutte-Gattat just patched pinentry-tqt :)
our dev team grows :)
regards
Damien Goutte-Gattat via Gnupg-devel
AttachmentsAug 4 (9 days ago)
to gnupg-devel Unsubscribe
* tqt/secqlineedit.h (backspacePressed): New signal.
* tqt/secqinternal.cpp (SecTQLineEdit::backspace): Emit new signal.
* tqt/pinentrydialog.h (_got_input): New member field.
(onBackspace): New slot.
* tqt/pinentrydialog.cpp (onBackspace): New slot.
(PinEntryDialog::updateQuality): Prevent echo disabling as soon as
the text has been edited.
GnuPG-bug-id: 3428
Signed-off-by: Damien Goutte-Gattat <dgouttegattat(a)incenp.org>
---
tqt/pinentrydialog.cpp | 14 +++++++++++++-
tqt/pinentrydialog.h | 2 ++
tqt/secqlineedit.cpp | 2 ++
tqt/secqlineedit.h | 1 +
4 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/tqt/pinentrydialog.cpp b/tqt/pinentrydialog.cpp
index 069eeaf..6a2ae12 100644
--- a/tqt/pinentrydialog.cpp
+++ b/tqt/pinentrydialog.cpp
@@ -32,7 +32,8 @@
PinEntryDialog::PinEntryDialog( TQWidget* parent, const char* name,
bool modal, bool enable_quality_bar )
- : TQDialog( parent, name, modal, TQt::WStyle_StaysOnTop ), _grabbed(
false )
+ : TQDialog( parent, name, modal, TQt::WStyle_StaysOnTop ), _grabbed(
false ),
+ _got_input( false )
{
TQBoxLayout* top = new TQVBoxLayout( this, 6 );
TQBoxLayout* upperLayout = new TQHBoxLayout( top );
@@ -89,6 +90,8 @@ PinEntryDialog::PinEntryDialog( TQWidget* parent, const
char* name,
this, SIGNAL( rejected() ) );
connect( _edit, SIGNAL( textModified(const SecTQString&) ),
this, SLOT( updateQuality(const SecTQString&) ) );
+ connect (_edit, SIGNAL (backspacePressed()),
+ this, SLOT (onBackspace ()));
connect (this, SIGNAL (accepted ()),
this, SLOT (accept ()));
connect (this, SIGNAL (rejected ()),
@@ -131,6 +134,8 @@ void PinEntryDialog::updateQuality( const SecTQString &
txt )
int percent;
TQPalette pal;
+ _got_input = true;
+
if (!_have_quality_bar || !_pinentry_info)
return;
pin = (char*)txt.utf8();
@@ -159,6 +164,13 @@ void PinEntryDialog::updateQuality( const SecTQString &
txt )
}
+void PinEntryDialog::onBackspace()
+{
+ if (!_got_input)
+ _edit->setEchoMode( SecTQLineEdit::NoEcho );
+}
+
+
void PinEntryDialog::setDescription( const TQString& txt )
{
_desc->setText( txt );
diff --git a/tqt/pinentrydialog.h b/tqt/pinentrydialog.h
index d6f20c6..eb4d332 100644
--- a/tqt/pinentrydialog.h
+++ b/tqt/pinentrydialog.h
@@ -63,6 +63,7 @@ public:
public slots:
void updateQuality(const SecTQString &);
+ void onBackspace();
signals:
void accepted();
@@ -86,6 +87,7 @@ private:
bool _grabbed;
bool _have_quality_bar;
pinentry_t _pinentry_info;
+ bool _got_input;
};
diff --git a/tqt/secqlineedit.cpp b/tqt/secqlineedit.cpp
index ee95c8d..da0637a 100644
--- a/tqt/secqlineedit.cpp
+++ b/tqt/secqlineedit.cpp
@@ -719,6 +719,8 @@ void SecTQLineEdit::backspace()
d->del( TRUE );
}
d->finishChange( priorState );
+
+ emit backspacePressed();
}
/*!
diff --git a/tqt/secqlineedit.h b/tqt/secqlineedit.h
index bd28cec..126f231 100644
--- a/tqt/secqlineedit.h
+++ b/tqt/secqlineedit.h
@@ -187,6 +187,7 @@ signals:
void returnPressed();
void lostFocus();
void selectionChanged();
+ void backspacePressed();
protected:
bool event( TQEvent * );