|
1 | 1 | #include "keychain_gui_win.h"
|
2 | 2 |
|
3 |
| -#include <fc_light/io/json.hpp> |
4 |
| -#include "cmd.hpp" |
5 |
| - |
6 |
| -#include <fc_light/reflect/reflect.hpp> |
7 |
| -#include <fc_light/variant.hpp> |
8 |
| - |
9 |
| -Q_DECLARE_METATYPE(std::string) |
10 |
| -int id1 = qRegisterMetaType<std::string>(); |
11 |
| - |
12 | 3 | keychain_gui_win::keychain_gui_win(Transaction &transaction, QWidget *parent)
|
13 | 4 | : QDialog(parent)
|
14 | 5 | {
|
@@ -171,20 +162,6 @@ keychain_gui_win::keychain_gui_win(Transaction &transaction, QWidget *parent)
|
171 | 162 | connect(password, &PasswordEnterElement::finishEnterPassword, this, &keychain_gui_win::transaction_sign);
|
172 | 163 | if (transaction.isCreatePassword())
|
173 | 164 | connect(password, &PasswordEnterElement::changePassword, this, &keychain_gui_win::_disableSignButton);
|
174 |
| - |
175 |
| - Polling *polling = new Polling; |
176 |
| - polling->moveToThread(&pollingThread); |
177 |
| - connect(&pollingThread, &QThread::finished, polling, &QObject::deleteLater); |
178 |
| - |
179 |
| - connect(this, &keychain_gui_win::poll, polling, &Polling::Select, Qt::QueuedConnection); |
180 |
| - connect(polling, &Polling::poll, polling, &Polling::Select, Qt::QueuedConnection); |
181 |
| - connect(polling, &Polling::rx, this, &keychain_gui_win::parse); |
182 |
| - connect(polling, &Polling::err, this, &keychain_gui_win::close); |
183 |
| - |
184 |
| - pollingThread.start(); |
185 |
| - passClearOnExit = true; |
186 |
| - emit keychain_gui_win::poll(); |
187 |
| - |
188 | 165 | }
|
189 | 166 |
|
190 | 167 | void keychain_gui_win::transaction_sign() {
|
@@ -268,45 +245,11 @@ void keychain_gui_win::keyPressEvent(QKeyEvent *event)
|
268 | 245 | }
|
269 | 246 | }
|
270 | 247 |
|
271 |
| -void keychain_gui_win::parse(const std::string s) |
272 |
| -{ |
273 |
| - auto a = fc_light::json::from_string(s); |
274 |
| - using namespace slave; |
275 |
| - try { |
276 |
| - auto cmd = a.as<slave::cmd_common>(); |
277 |
| - auto cmd_map = slave::cmd_list_singletone::instance(); |
278 |
| - auto p_func = cmd_map[cmd.cmd]; |
279 |
| - (*p_func)(this, cmd.params); |
280 |
| - } |
281 |
| - catch (const std::exception &e) {throw std::runtime_error(e.what());} |
282 |
| - catch (const fc_light::exception &e) {throw std::runtime_error(e.what());} |
283 |
| -} |
284 |
| - |
285 | 248 |
|
286 | 249 | void keychain_gui_win::closeEvent(QCloseEvent * event)
|
287 | 250 | {
|
288 |
| -// passClearOnExit ? |
289 |
| -// send(fc_light::json::to_string(fc_light::variant( master::cmd<( master::cmds::cancel)>().base))) : |
290 |
| -// send(fc_light::json::to_string(fc_light::variant( master::cmd<( master::cmds::ok)>().base))); |
291 |
| -// event->accept(); |
292 | 251 | serviceExchange->EncodeCancel();
|
293 | 252 | this->close();
|
294 | 253 | }
|
295 | 254 |
|
296 |
| -void keychain_gui_win::found_pass() |
297 |
| -{ |
298 |
| - passClearOnExit = false; |
299 |
| -} |
300 |
| - |
301 |
| -void keychain_gui_win::send(std::string a) |
302 |
| -{ |
303 |
| - if ( write(STDIN_FILENO, a.c_str(), a.length() ) != a.length() ) |
304 |
| - close(); |
305 |
| -} |
306 |
| - |
307 |
| -keychain_gui_win::~keychain_gui_win() |
308 |
| -{ |
309 |
| - pollingThread.quit(); |
310 |
| - pollingThread.wait(); |
311 |
| -} |
312 | 255 |
|
0 commit comments