Skip to content

Commit af361f5

Browse files
import gui progress
1 parent caaf240 commit af361f5

File tree

10 files changed

+207
-174
lines changed

10 files changed

+207
-174
lines changed

Diff for: keychain_linux/passentry_cmd/pass_entry_term.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ std::wstring pass_entry_term::input_password(const KeySym * map, int socket)
216216
char name[256] = "Unknown";
217217
bool first_key = true;
218218
auto gui = polling(socket);
219-
ChangeKbProperty(dev_info, kbd_atom, device_enabled_prop, dev_cnt, 0);
219+
// ChangeKbProperty(dev_info, kbd_atom, device_enabled_prop, dev_cnt, 0);
220220

221221
capslock = keyState(XK_Caps_Lock);
222222
numlock = keyState(XK_Num_Lock);
@@ -257,7 +257,7 @@ std::wstring pass_entry_term::input_password(const KeySym * map, int socket)
257257
if ( ev[1].code <= 255)
258258
{
259259
kbd_id = fd_list[id];
260-
if (ioctl(kbd_id, EVIOCGRAB, 1) != 0) throw std::runtime_error("cannot get exclusive access to keyboard");
260+
//if (ioctl(kbd_id, EVIOCGRAB, 1) != 0) throw std::runtime_error("cannot get exclusive access to keyboard");
261261
break;
262262
}
263263
}

Diff for: keychain_linux/passentry_gui/include/PasswordEnterElement.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ class PasswordEnterElement : public QWidget
2626
void checkFinishedEnterance();
2727
void setFocusOnConfirm();
2828
bool validConfirm();
29+
PasswordLineEdit *value = Q_NULLPTR;
2930

3031
signals:
3132
void finishEnterPassword();
3233
void changePassword();
3334

35+
3436
private:
3537
//Ui::SecureWindowElement ui;
3638
QLabel *label = Q_NULLPTR;
37-
PasswordLineEdit *value = Q_NULLPTR;
39+
3840
QLabel *description;
3941
QLabel *labelConfirm = Q_NULLPTR;
4042
QLabel *confirmDescription;

Diff for: keychain_linux/passentry_gui/include/cmd.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace slave {
2626
struct cmd_base {
2727
cmd_base(cmds cmd_) : cmd(cmd_) {};
2828
cmds cmd;
29-
virtual void operator()(Widget* w, const fc_light::variant&) const = 0;
29+
virtual void operator()(keychain_gui_win&, const fc_light::variant&) const = 0;
3030
virtual ~cmd_base() {};
3131
};
3232
struct cmd_list_singletone

Diff for: keychain_linux/passentry_gui/include/keychain_gui_win.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class keychain_gui_win : public QDialog
4040

4141
keychain_gui_win(Transaction &transaction, QWidget *parent = Q_NULLPTR);
4242
PopupWindow * popupWindow;
43-
43+
void refresh(Transaction&);
44+
PasswordEnterElement * password;
4445
private:
4546
QString mExpertValue;
4647

@@ -55,7 +56,7 @@ class keychain_gui_win : public QDialog
5556
QLabel * descriptionLabel = Q_NULLPTR;
5657
LockIcon * lockIcon = Q_NULLPTR;
5758
KeychainWidget * element = Q_NULLPTR;
58-
PasswordEnterElement * password;
59+
5960
KeychainServiceExchange * serviceExchange =NULL;
6061

6162
private:

Diff for: keychain_linux/passentry_gui/include/widget.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@
77
#include <QLabel>
88
#include <QThread>
99
#include "polling.hpp"
10+
#include "keychain_gui_win.h"
1011

1112
class Widget : public QWidget
1213
{
1314
Q_OBJECT
1415
QThread pollingThread;
1516
public:
16-
Widget(QWidget *parent = 0);
17+
Widget(keychain_gui_win&, QWidget *parent = 0);
1718
~Widget();
1819
private:
1920
void closeEvent(QCloseEvent *);
2021
void parse(const std::string);
2122
bool passClearOnExit;
23+
keychain_gui_win& gui;
2224
public slots:
2325
void found_pass();
2426
void send(std::string);

Diff for: keychain_linux/passentry_gui/src/PasswordEnterElement.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ PasswordEnterElement::PasswordEnterElement(bool passwordCreate, QWidget * parent
1313

1414
value = new PasswordLineEdit(this);
1515
value->setText("");
16-
value->setStyleSheet(passPhraseStyle);
17-
value->setEchoMode(QLineEdit::Password);
18-
value->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
16+
//value->setStyleSheet(passPhraseStyle);
17+
//value->setEchoMode(QLineEdit::Password);
18+
//value->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
1919
value->setFocus();
2020
pCreatePassword = false;
2121
if (passwordCreate) {

Diff for: keychain_linux/passentry_gui/src/cmd.cpp

+14-13
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Created by user on 23.06.18.
33
//
44
#include "cmd.hpp"
5-
#include "Transaction.h"
6-
#include "keychain_gui_win.h"
75

86
Q_DECLARE_METATYPE(std::string)
97

@@ -14,7 +12,7 @@ namespace slave
1412
struct cmd : cmd_base {
1513
cmd() : cmd_base(cmd_) {};
1614
virtual ~cmd() {};
17-
virtual void operator()(Widget* w, const fc_light::variant& v) const override {
15+
virtual void operator()(keychain_gui_win& w, const fc_light::variant& v) const override {
1816
throw std::runtime_error("operation is not implemented");
1917
};
2018
using params_t = void;
@@ -27,13 +25,13 @@ namespace slave
2725
virtual ~cmd() {};
2826
struct params {std::string rawtrx;};
2927
using params_t = params;
30-
virtual void operator()(Widget * w, const fc_light::variant& v) const override {
28+
virtual void operator()(keychain_gui_win& w, const fc_light::variant& v) const override {
3129
try {
3230
auto a = v.as<params_t>();
33-
// w->pte->setText(QString(a.rawtrx.c_str()));
34-
QString value(a.rawtrx.c_str());
35-
Transaction trans(value);
36-
keychain_gui_win w(trans);
31+
QString trx(a.rawtrx.c_str());
32+
Transaction trans(trx);
33+
w.refresh(trans);
34+
w.show();
3735
}
3836
catch (const std::exception &e) {throw std::runtime_error(e.what());}
3937
catch (const fc_light::exception &e) {throw std::runtime_error(e.what());}
@@ -45,8 +43,11 @@ namespace slave
4543
cmd() : cmd_base(cmds::close) {};
4644
virtual ~cmd() {};
4745
using params_t = void;
48-
virtual void operator()(Widget* w, const fc_light::variant& v) const override {
49-
try { w->close(); }
46+
virtual void operator()(keychain_gui_win& w, const fc_light::variant& v) const override {
47+
try
48+
{
49+
// w->close();
50+
}
5051
catch (const std::exception &e) {throw std::runtime_error(e.what());}
5152
catch (const fc_light::exception &e) {throw std::runtime_error(e.what());}
5253
};
@@ -58,7 +59,7 @@ namespace slave
5859
virtual ~cmd() {};
5960
struct params { bool caps, num, shift; };
6061
using params_t = params;
61-
virtual void operator()(Widget* w, const fc_light::variant& v) const override {
62+
virtual void operator()(keychain_gui_win& w, const fc_light::variant& v) const override {
6263
try {
6364
auto a = v.as<params_t>();
6465
//a.caps ? w->caps->setText("caps: on") : w->caps->setText("caps: off");
@@ -76,10 +77,10 @@ namespace slave
7677
virtual ~cmd() {};
7778
struct params {int len;};
7879
using params_t = params;
79-
virtual void operator()(Widget* w, const fc_light::variant& v) const override {
80+
virtual void operator()(keychain_gui_win& w, const fc_light::variant& v) const override {
8081
try {
8182
auto a = v.as<params_t>();
82-
// w->ple->setText(QString (a.len, '*'));
83+
w.password->value->setText(QString (a.len, '*'));
8384
}
8485
catch (const std::exception &e) {throw std::runtime_error(e.what());}
8586
catch (const fc_light::exception &e) {throw std::runtime_error(e.what());}

0 commit comments

Comments
 (0)