forked from cryptonotefoundation/cryptonotewallet
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2d28be
commit fb52b54
Showing
14 changed files
with
610 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule cryptonote
updated
21 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright (c) 2011-2016 The Cryptonote developers | ||
// Copyright (c) 2015-2016 XDN developers | ||
// Distributed under the MIT/X11 software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#include <QApplication> | ||
#include <QClipboard> | ||
|
||
#include "MessageAddressFrame.h" | ||
#include "AddressBookDialog.h" | ||
#include "AliasProvider.h" | ||
#include "MainWindow.h" | ||
#include "ui_messageaddressframe.h" | ||
|
||
namespace WalletGui { | ||
|
||
namespace { | ||
Q_DECL_CONSTEXPR quint32 MESSAGE_ADDRESS_INPUT_INTERVAL = 1500; | ||
} | ||
|
||
MessageAddressFrame::MessageAddressFrame(QWidget* _parent) : QFrame(_parent), | ||
m_ui(new Ui::MessageAddressFrame), m_aliasProvider(new AliasProvider(this)), m_addressInputTimerId(-1) { | ||
m_ui->setupUi(this); | ||
|
||
connect(m_aliasProvider, &AliasProvider::aliasFoundSignal, this, &MessageAddressFrame::onAliasFound); | ||
} | ||
|
||
MessageAddressFrame::~MessageAddressFrame() { | ||
|
||
} | ||
|
||
QString MessageAddressFrame::getAddress() const { | ||
return m_ui->m_addressEdit->text(); | ||
} | ||
|
||
void MessageAddressFrame::disableRemoveButton(bool _disable) { | ||
m_ui->m_removeButton->setDisabled(_disable); | ||
} | ||
|
||
void MessageAddressFrame::timerEvent(QTimerEvent* _event) { | ||
if (_event->timerId() == m_addressInputTimerId) { | ||
m_aliasProvider->getAddresses(m_ui->m_addressEdit->text().trimmed()); | ||
killTimer(m_addressInputTimerId); | ||
m_addressInputTimerId = -1; | ||
return; | ||
} | ||
|
||
QFrame::timerEvent(_event); | ||
} | ||
|
||
void MessageAddressFrame::onAliasFound(const QString& _name, const QString& _address) { | ||
m_ui->m_addressEdit->setText(QString("%1 <%2>").arg(_name).arg(_address)); | ||
} | ||
|
||
void MessageAddressFrame::addressBookClicked() { | ||
AddressBookDialog dlg(&MainWindow::instance()); | ||
if(dlg.exec() == QDialog::Accepted) { | ||
m_ui->m_addressEdit->setText(dlg.getAddress()); | ||
} | ||
} | ||
|
||
void MessageAddressFrame::addressEdited(const QString& _text) { | ||
if (m_addressInputTimerId != -1) { | ||
killTimer(m_addressInputTimerId); | ||
} | ||
|
||
m_addressInputTimerId = startTimer(MESSAGE_ADDRESS_INPUT_INTERVAL); | ||
} | ||
|
||
void MessageAddressFrame::pasteClicked() { | ||
m_ui->m_addressEdit->setText(QApplication::clipboard()->text()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) 2011-2016 The Cryptonote developers | ||
// Copyright (c) 2015-2016 XDN developers | ||
// Distributed under the MIT/X11 software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#pragma once | ||
|
||
#include <QFrame> | ||
|
||
namespace Ui { | ||
class MessageAddressFrame; | ||
} | ||
|
||
namespace WalletGui { | ||
|
||
class AliasProvider; | ||
|
||
class MessageAddressFrame : public QFrame { | ||
Q_OBJECT | ||
Q_DISABLE_COPY(MessageAddressFrame) | ||
|
||
public: | ||
MessageAddressFrame(QWidget* _parent); | ||
~MessageAddressFrame(); | ||
|
||
QString getAddress() const; | ||
void disableRemoveButton(bool _disable); | ||
|
||
protected: | ||
void timerEvent(QTimerEvent* _event) Q_DECL_OVERRIDE; | ||
|
||
private: | ||
QScopedPointer<Ui::MessageAddressFrame> m_ui; | ||
AliasProvider* m_aliasProvider; | ||
int m_addressInputTimerId; | ||
|
||
void onAliasFound(const QString& _name, const QString& _address); | ||
|
||
Q_SLOT void addressBookClicked(); | ||
Q_SLOT void addressEdited(const QString& _text); | ||
Q_SLOT void pasteClicked(); | ||
}; | ||
|
||
} |
Oops, something went wrong.