mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Only show the password on explicit user request
This commit is contained in:
parent
e47cbc9af3
commit
d7dc185ecf
@ -18,6 +18,7 @@ greaterThan(QT_MAJOR_VERSION, 5) {QT += openglwidgets}
|
||||
CONFIG += object_parallel_to_source
|
||||
INCLUDEPATH += ./src
|
||||
HEADERS += src/common/config.h \
|
||||
src/GUI/passwordedit.h \
|
||||
src/common/garmin.h \
|
||||
src/common/coordinates.h \
|
||||
src/common/range.h \
|
||||
@ -234,6 +235,7 @@ HEADERS += src/common/config.h \
|
||||
src/data/geojsonparser.h
|
||||
|
||||
SOURCES += src/main.cpp \
|
||||
src/GUI/passwordedit.cpp \
|
||||
src/common/coordinates.cpp \
|
||||
src/common/rectc.cpp \
|
||||
src/common/range.cpp \
|
||||
|
@ -45,8 +45,12 @@
|
||||
<file alias="applications-internet_32@2x.png">icons/GUI/applications-internet_32@2x.png</file>
|
||||
<file alias="view-grid.png">icons/GUI/view-grid.png</file>
|
||||
<file alias="view-grid@2x.png">icons/GUI/view-grid@2x.png</file>
|
||||
<file alias="document-decrypt.png">icons/GUI/document-decrypt.png</file>
|
||||
<file alias="document-decrypt@2x.png">icons/GUI/document-decrypt.png</file>
|
||||
<file alias="document-encrypt.png">icons/GUI/document-encrypt.png</file>
|
||||
<file alias="document-encrypt@2x.png">icons/GUI/document-encrypt.png</file>
|
||||
</qresource>
|
||||
|
||||
|
||||
<!-- POI icons for default IMG map style -->
|
||||
<qresource prefix="/POI">
|
||||
<file alias="airfield-11.png">icons/POI/airfield-11.png</file>
|
||||
|
BIN
icons/GUI/document-decrypt.png
Normal file
BIN
icons/GUI/document-decrypt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 541 B |
BIN
icons/GUI/document-decrypt@2x.png
Normal file
BIN
icons/GUI/document-decrypt@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
BIN
icons/GUI/document-encrypt.png
Normal file
BIN
icons/GUI/document-encrypt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 561 B |
BIN
icons/GUI/document-encrypt@2x.png
Normal file
BIN
icons/GUI/document-encrypt@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
@ -4,7 +4,7 @@
|
||||
AuthenticationWidget::AuthenticationWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
_username = new QLineEdit();
|
||||
_password = new QLineEdit();
|
||||
_password = new PasswordEdit();
|
||||
|
||||
QFormLayout *layout = new QFormLayout();
|
||||
layout->addRow(tr("Username:"), _username);
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
#include "passwordedit.h"
|
||||
|
||||
class AuthenticationWidget : public QWidget
|
||||
{
|
||||
@ -18,7 +19,8 @@ public:
|
||||
void setPassword(const QString &password) {_password->setText(password);}
|
||||
|
||||
private:
|
||||
QLineEdit *_username, *_password;
|
||||
QLineEdit *_username;
|
||||
PasswordEdit *_password;
|
||||
};
|
||||
|
||||
#endif // AUTHENTICATIONWIDGET_H
|
||||
|
@ -28,4 +28,7 @@
|
||||
#define MAPS_ICON ":/applications-internet_32.png"
|
||||
#define DEM_ICON ":/view-grid.png"
|
||||
|
||||
#define SHOW_PWD_ICON ":/document-encrypt.png"
|
||||
#define HIDE_PWD_ICON ":/document-decrypt.png"
|
||||
|
||||
#endif /* ICONS_H */
|
||||
|
24
src/GUI/passwordedit.cpp
Normal file
24
src/GUI/passwordedit.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <QAction>
|
||||
#include "icons.h"
|
||||
#include "passwordedit.h"
|
||||
|
||||
PasswordEdit::PasswordEdit(QWidget *parent) : QLineEdit(parent)
|
||||
{
|
||||
_show = false;
|
||||
_action = addAction(QIcon(SHOW_PWD_ICON), QLineEdit::TrailingPosition);
|
||||
connect(_action, &QAction::triggered, this, &PasswordEdit::showPassword);
|
||||
setEchoMode(QLineEdit::Password);
|
||||
}
|
||||
|
||||
void PasswordEdit::showPassword()
|
||||
{
|
||||
if (_show) {
|
||||
_action->setIcon(QIcon(SHOW_PWD_ICON));
|
||||
setEchoMode(QLineEdit::Password);
|
||||
_show = false;
|
||||
} else {
|
||||
_action->setIcon(QIcon(HIDE_PWD_ICON));
|
||||
setEchoMode(QLineEdit::Normal);
|
||||
_show = true;
|
||||
}
|
||||
}
|
21
src/GUI/passwordedit.h
Normal file
21
src/GUI/passwordedit.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef PASSWORDEDIT_H
|
||||
#define PASSWORDEDIT_H
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
class PasswordEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PasswordEdit(QWidget *parent = 0);
|
||||
|
||||
private slots:
|
||||
void showPassword();
|
||||
|
||||
private:
|
||||
QAction *_action;
|
||||
bool _show;
|
||||
};
|
||||
|
||||
#endif // PASSWORDEDIT_H
|
Loading…
Reference in New Issue
Block a user