| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/gui/reusable/baselineedit.cpp`/ |
| 2 | |
| 3 | #include "gui/reusable/baselineedit.h"cxx . . $ `<file>/src/librssguard/gui/reusable/baselineedit.h`/ |
| 4 | |
| 5 | #include "miscellaneous/application.h"cxx . . $ `<file>/src/librssguard/miscellaneous/application.h`/ |
| 6 | #include "miscellaneous/iconfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/iconfactory.h`/ |
| 7 | |
| 8 | #include <QAction> |
| 9 | #include <QKeyEvent> |
| 10 | |
| 11 | BaseLineEditcxx . . $ BaseLineEdit#::BaseLineEditcxx . . $ BaseLineEdit#BaseLineEdit(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) |
| 12 | : QLineEditcxx . . $ QLineEdit#(parent), m_actShowPasswordcxx . . $ BaseLineEdit#m_actShowPassword.(new QActioncxx . . $ QAction#(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("dialog-password")), |
| 13 | trcxx . . $ BaseLineEdit#tr(75d9f1c324b4579d).("Show/hide the password"), |
| 14 | this)) { |
| 15 | |
| 16 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_actShowPasswordcxx . . $ BaseLineEdit#m_actShowPassword., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, [this]() { |
| 17 | setEchoModecxx . . $ QLineEdit#setEchoMode(c3447ea4f1c9f77d).(echoModecxx . . $ QLineEdit#echoMode(5f13513645a0fc35).() == QLineEditcxx . . $ QLineEdit#::EchoModecxx . . $ QLineEdit#EchoMode#::Passwordcxx . . $ QLineEdit#Password. ? QLineEditcxx . . $ QLineEdit#::EchoModecxx . . $ QLineEdit#EchoMode#::Normalcxx . . $ QLineEdit#Normal. |
| 18 | : QLineEditcxx . . $ QLineEdit#::EchoModecxx . . $ QLineEdit#EchoMode#::Passwordcxx . . $ QLineEdit#Password.); |
| 19 | }); |
| 20 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(this, &QLineEditcxx . . $ QLineEdit#::textChangedcxx . . $ QLineEdit#textChanged(3520e46b33348bf6)., this, [this](const QStringcxx . . $ QString#& text) { |
| 21 | if (actionscxx . . $ QWidget#actions(6326ecb0baf05155).().containscxx . . $ QListSpecialMethodsBase#contains(7349e39e0b02d05c).(m_actShowPasswordcxx . . $ BaseLineEdit#m_actShowPassword.)) { |
| 22 | m_actShowPasswordcxx . . $ BaseLineEdit#m_actShowPassword.->setVisiblecxx . . $ QAction#setVisible(b45ddcbc8423892c).(!text.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()); |
| 23 | } |
| 24 | }); |
| 25 | |
| 26 | setClearButtonEnabledcxx . . $ QLineEdit#setClearButtonEnabled(b45ddcbc8423892c).(true); |
| 27 | } |
| 28 | |
| 29 | BaseLineEditcxx . . $ BaseLineEdit#::~cxx . . $ BaseLineEdit#`~BaseLineEdit`(ced63f7c635d850d).BaseLineEditcxx . . $ BaseLineEdit#() {} |
| 30 | |
| 31 | void BaseLineEditcxx . . $ BaseLineEdit#::setPasswordModecxx . . $ BaseLineEdit#setPasswordMode(b45ddcbc8423892c).(bool is_password) { |
| 32 | if (is_password) { |
| 33 | setEchoModecxx . . $ QLineEdit#setEchoMode(c3447ea4f1c9f77d).(QLineEditcxx . . $ QLineEdit#::EchoModecxx . . $ QLineEdit#EchoMode#::Passwordcxx . . $ QLineEdit#Password.); |
| 34 | addActioncxx . . $ QLineEdit#addAction(c14c7e466ba0b84a).(m_actShowPasswordcxx . . $ BaseLineEdit#m_actShowPassword., QLineEditcxx . . $ QLineEdit#::ActionPositioncxx . . $ QLineEdit#ActionPosition#::LeadingPositioncxx . . $ QLineEdit#LeadingPosition.); |
| 35 | } |
| 36 | else { |
| 37 | setEchoModecxx . . $ QLineEdit#setEchoMode(c3447ea4f1c9f77d).(QLineEditcxx . . $ QLineEdit#::EchoModecxx . . $ QLineEdit#EchoMode#::Normalcxx . . $ QLineEdit#Normal.); |
| 38 | removeActioncxx . . $ QWidget#removeAction(92b1e80c0a7f1406).(m_actShowPasswordcxx . . $ BaseLineEdit#m_actShowPassword.); |
| 39 | } |
| 40 | |
| 41 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! textChangedcxx . . $ QLineEdit#textChanged(3520e46b33348bf6).(textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).()); |
| 42 | } |
| 43 | |
| 44 | void BaseLineEditcxx . . $ BaseLineEdit#::submitcxx . . $ BaseLineEdit#submit(3520e46b33348bf6).(const QStringcxx . . $ QString#& text) { |
| 45 | setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(text); |
| 46 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! submittedcxx . . $ BaseLineEdit#submitted(3520e46b33348bf6).(text); |
| 47 | } |
| 48 | |
| 49 | void BaseLineEditcxx . . $ BaseLineEdit#::keyPressEventcxx . . $ BaseLineEdit#keyPressEvent(c92999c1b6b09cc0).(QKeyEventcxx . . $ QKeyEvent#* event) { |
| 50 | if (event->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Keycxx . . $ Qt/Key#::Key_Entercxx . . $ Qt/Key_Enter. || event->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Keycxx . . $ Qt/Key#::Key_Returncxx . . $ Qt/Key_Return.) { |
| 51 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! submittedcxx . . $ BaseLineEdit#submitted(3520e46b33348bf6).(textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).()); |
| 52 | event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 53 | } |
| 54 | |
| 55 | if (event->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Keycxx . . $ Qt/Key#::Key_Escapecxx . . $ Qt/Key_Escape.) { |
| 56 | submitcxx . . $ BaseLineEdit#submit(3520e46b33348bf6).(QStringcxx . . $ QString#QString(ced63f7c635d850d).()); |
| 57 | event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 58 | } |
| 59 | |
| 60 | QLineEditcxx . . $ QLineEdit#::keyPressEventcxx . . $ QLineEdit#keyPressEvent(c92999c1b6b09cc0).(event); |
| 61 | } |