Skip to content

Commit

Permalink
Document revision within the wallet
Browse files Browse the repository at this point in the history
New page "Documents" in the main window. This allows adding files to the wallet and confirming that the documents are unchanged since being added.
  • Loading branch information
Krekeler committed Apr 11, 2019
1 parent f2c2951 commit ade6c06
Show file tree
Hide file tree
Showing 17 changed files with 1,001 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Copyright (c) 2014-2018 The Dash Core developers
# Copyright (c) 2018 The Documentchain developers
# Copyright (c) 2018-2019 The Documentchain developers

# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
Expand Down Expand Up @@ -34,6 +34,7 @@ QT_FORMS_UI = \
qt/forms/askpassphrasedialog.ui \
qt/forms/coincontroldialog.ui \
qt/forms/darksendconfig.ui \
qt/forms/documentlist.ui \
qt/forms/editaddressdialog.ui \
qt/forms/helpmessagedialog.ui \
qt/forms/intro.ui \
Expand Down Expand Up @@ -65,6 +66,7 @@ QT_MOC_CPP = \
qt/moc_coincontroltreewidget.cpp \
qt/moc_csvmodelwriter.cpp \
qt/moc_darksendconfig.cpp \
qt/moc_documentlist.cpp \
qt/moc_editaddressdialog.cpp \
qt/moc_guiutil.cpp \
qt/moc_intro.cpp \
Expand Down Expand Up @@ -135,6 +137,7 @@ BITCOIN_QT_H = \
qt/coincontroltreewidget.h \
qt/csvmodelwriter.h \
qt/darksendconfig.h \
qt/documentlist.h \
qt/editaddressdialog.h \
qt/guiconstants.h \
qt/guiutil.h \
Expand Down Expand Up @@ -200,6 +203,7 @@ RES_ICONS = \
qt/res/icons/light/connect3_16.png \
qt/res/icons/light/connect4_16.png \
qt/res/icons/light/debugwindow.png \
qt/res/icons/light/document.png \
qt/res/icons/light/drkblue_editpaste.png \
qt/res/icons/light/drkblue_address-book.png \
qt/res/icons/light/drkblue_editcopy.png \
Expand Down Expand Up @@ -277,6 +281,7 @@ BITCOIN_QT_WALLET_CPP = \
qt/coincontroldialog.cpp \
qt/coincontroltreewidget.cpp \
qt/darksendconfig.cpp \
qt/documentlist.cpp \
qt/editaddressdialog.cpp \
qt/masternodelist.cpp \
qt/openuridialog.cpp \
Expand Down
37 changes: 33 additions & 4 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "init.h"
#include "ui_interface.h"
#include "util.h"
#include "documentlist.h"
#include "masternode-sync.h"
#include "masternodelist.h"

Expand Down Expand Up @@ -104,6 +105,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
appMenuBar(0),
overviewAction(0),
historyAction(0),
documentAction(0),
masternodeAction(0),
quitAction(0),
sendCoinsAction(0),
Expand Down Expand Up @@ -364,6 +366,17 @@ void BitcoinGUI::createActions()
#endif
tabGroup->addAction(historyAction);

documentAction = new QAction(QIcon(":/icons/" + theme + "/document"), tr("&Documents"), this);
documentAction->setStatusTip(tr("Document Revision"));
documentAction->setToolTip(documentAction->statusTip());
documentAction->setCheckable(true);
#ifdef Q_OS_MAC
documentAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_5));
#else
documentAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
#endif
tabGroup->addAction(documentAction);

#ifdef ENABLE_WALLET
QSettings settings;
if (!fLiteMode && settings.value("fShowMasternodesTab").toBool()) {
Expand All @@ -372,9 +385,9 @@ void BitcoinGUI::createActions()
masternodeAction->setToolTip(masternodeAction->statusTip());
masternodeAction->setCheckable(true);
#ifdef Q_OS_MAC
masternodeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_5));
masternodeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_6));
#else
masternodeAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
masternodeAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6));
#endif
tabGroup->addAction(masternodeAction);
connect(masternodeAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
Expand All @@ -395,6 +408,8 @@ void BitcoinGUI::createActions()
connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(documentAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(documentAction, SIGNAL(triggered()), this, SLOT(gotoDocumentPage()));
#endif // ENABLE_WALLET

quitAction = new QAction(QIcon(":/icons/" + theme + "/quit"), tr("E&xit"), this);
Expand Down Expand Up @@ -576,6 +591,7 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(sendCoinsAction);
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->addAction(documentAction);
QSettings settings;
if (!fLiteMode && settings.value("fShowMasternodesTab").toBool() && masternodeAction)
{
Expand Down Expand Up @@ -725,6 +741,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
receiveCoinsAction->setEnabled(enabled);
receiveCoinsMenuAction->setEnabled(enabled);
historyAction->setEnabled(enabled);
documentAction->setEnabled(enabled);
QSettings settings;
if (!fLiteMode && settings.value("fShowMasternodesTab").toBool() && masternodeAction) {
masternodeAction->setEnabled(enabled);
Expand Down Expand Up @@ -899,6 +916,14 @@ void BitcoinGUI::gotoHistoryPage()
if (walletFrame) walletFrame->gotoHistoryPage();
}

void BitcoinGUI::gotoDocumentPage(const QStringList newFiles)
{
if (!documentAction->isChecked())
documentAction->setChecked(true);
if (walletFrame)
walletFrame->gotoDocumentPage(newFiles);
}

void BitcoinGUI::gotoMasternodePage()
{
QSettings settings;
Expand Down Expand Up @@ -1280,10 +1305,14 @@ void BitcoinGUI::dropEvent(QDropEvent *event)
{
if(event->mimeData()->hasUrls())
{
Q_FOREACH(const QUrl &uri, event->mimeData()->urls())
QStringList files;
Q_FOREACH(const QUrl &uri, event->mimeData()->urls())
{
Q_EMIT receivedURI(uri.toString());
files.append(uri.toLocalFile());
}
/** we are using a Qt::QueuedConnection so that the sending
app is not blocked while the files are being processed */
Q_EMIT receivedFile(files);
}
event->acceptProposedAction();
}
Expand Down
8 changes: 7 additions & 1 deletion src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class WalletFrame;
class WalletModel;
class HelpMessageDialog;
class ModalOverlay;
class DocumentList;
class MasternodeList;

class CWallet;
Expand Down Expand Up @@ -99,6 +100,7 @@ class BitcoinGUI : public QMainWindow
QMenuBar *appMenuBar;
QAction *overviewAction;
QAction *historyAction;
QAction *documentAction;
QAction *masternodeAction;
QAction *quitAction;
QAction *sendCoinsAction;
Expand Down Expand Up @@ -167,8 +169,10 @@ class BitcoinGUI : public QMainWindow
void updateHeadersSyncProgressLabel();

Q_SIGNALS:
/** Signal raised when a URI was entered or dragged to the GUI */
/** Signal raised when a URI was entered */
void receivedURI(const QString &uri);
/** Signal raised when a file was dragged to the GUI */
void receivedFile(const QStringList &files);
/** Restart handling */
void requestedRestart(QStringList args);

Expand Down Expand Up @@ -221,6 +225,8 @@ private Q_SLOTS:
void gotoOverviewPage();
/** Switch to history (transactions) page */
void gotoHistoryPage();
/** Switch to document page */
void gotoDocumentPage(const QStringList newFiles = QStringList());
/** Switch to masternode page */
void gotoMasternodePage();
/** Switch to receive coins page */
Expand Down
4 changes: 3 additions & 1 deletion src/qt/dms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,15 @@ void BitcoinApplication::initializeResult(int retval)

#ifdef ENABLE_WALLET
// Now that initialization/startup is done, process any command-line
// dms: URIs or payment requests:
// dms: document import and URIs or payment requests:
connect(paymentServer, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)),
window, SLOT(handlePaymentRequest(SendCoinsRecipient)));
connect(window, SIGNAL(receivedURI(QString)),
paymentServer, SLOT(handleURIOrFile(QString)));
connect(paymentServer, SIGNAL(message(QString,QString,unsigned int)),
window, SLOT(message(QString,QString,unsigned int)));
connect(window, SIGNAL(receivedFile(QStringList)), window,
SLOT(gotoDocumentPage(QStringList)), Qt::QueuedConnection);
QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
#endif
} else {
Expand Down
1 change: 1 addition & 0 deletions src/qt/dms.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<file alias="connect_2">res/icons/light/connect2_16.png</file>
<file alias="connect_3">res/icons/light/connect3_16.png</file>
<file alias="connect_4">res/icons/light/connect4_16.png</file>
<file alias="document">res/icons/light/document.png</file>
<file alias="transaction_0">res/icons/light/transaction0.png</file>
<file alias="transaction_confirmed">res/icons/light/transaction2.png</file>
<file alias="transaction_conflicted">res/icons/light/transaction_conflicted.png</file>
Expand Down
Loading

0 comments on commit ade6c06

Please sign in to comment.