6 #include "qt/settings/forms/ui_exportcsv.h"
22 this->setStyleSheet(parent->styleSheet());
25 ui->left->setProperty(
"cssClass",
"container");
26 ui->left->setContentsMargins(10,10,10,10);
29 ui->labelTitle->setProperty(
"cssClass",
"text-title-screen");
30 ui->labelSubtitle1->setProperty(
"cssClass",
"text-subtitle");
33 ui->labelSubtitleLocation->setProperty(
"cssClass",
"text-title");
34 ui->labelSubtitleLocationAddress->setProperty(
"cssClass",
"text-title");
36 setCssProperty({
ui->pushButtonDocuments,
ui->pushButtonAddressDocuments},
"btn-edit-primary-folder");
40 ui->labelDivider->setProperty(
"cssClass",
"container-divider");
49 ui->comboBoxSortType->setCurrentIndex(0);
54 ui->comboBoxSortAddressType->setCurrentIndex(0);
56 connect(
ui->pushButtonDocuments, &QPushButton::clicked, [
this](){selectFileOutput(true);});
57 connect(
ui->pushButtonAddressDocuments, &QPushButton::clicked, [
this](){selectFileOutput(false);});
63 isTxExport ? tr(
"Export Transaction History") : tr(
"Export Address Book"), QString(),
64 tr(
"Comma separated file (*.csv)"),
nullptr);
67 if (!filename.isEmpty()) {
68 ui->pushButtonDocuments->setText(filename);
71 ui->pushButtonDocuments->setText(tr(
"Select folder..."));
74 if (!filename.isEmpty()) {
75 ui->pushButtonAddressDocuments->setText(filename);
78 ui->pushButtonAddressDocuments->setText(tr(
"Select folder..."));
85 if (filename.isNull()) {
86 inform(tr(
"Please select a folder to export the csv file first."));
98 txFilter->setDynamicSortFilter(
true);
99 txFilter->setSortCaseSensitivity(Qt::CaseInsensitive);
100 txFilter->setFilterCaseSensitivity(Qt::CaseInsensitive);
101 txFilter->setSortRole(Qt::EditRole);
110 Qt::SortOrder order = Qt::DescendingOrder;
111 switch (
ui->comboBoxSort->itemData(
ui->comboBoxSort->currentIndex()).toInt()) {
114 order = Qt::AscendingOrder;
123 order = Qt::AscendingOrder;
145 fExport = writer.
write();
149 inform(tr(
"Exporting Successful\nThe transaction history was successfully saved to %1.").arg(filename));
151 inform(tr(
"Exporting Failed\nThere was an error trying to save the transaction history to %1.").arg(filename));
157 if (filename.isNull()) {
158 inform(tr(
"Please select a folder to export the csv file first."));
162 bool fExport =
false;
173 QString filterBy =
ui->comboBoxSortAddressType->itemData(
ui->comboBoxSortAddressType->currentIndex()).toString();
177 inform(tr(
"No available addresses to export under the selected filter"));
187 fExport = writer.
write();
191 inform(tr(
"Exporting Successful\nThe address book was successfully saved to %1.").arg(filename));
193 inform(tr(
"Exporting Failed\nThere was an error trying to save the address list to %1. Please try again.").arg(filename));
@ TypeRole
Type of address (Send, Receive, ColdStaking, ColdStakingSend, Delegator, Delegable)
@ Address
Bitcoin address.
@ Label
User specified label.
static QString getAmountColumnTitle(int unit)
Gets title for amount column including current display unit if optionsModel reference available */.
Export a Qt table model to a CSV file.
bool write()
Perform export of the model to CSV.
void setModel(const QAbstractItemModel *model)
void addColumn(const QString &title, int column, int role=Qt::EditRole)
QSortFilterProxyModel * addressFilter
void exportTxes(const QString &filename)
void selectFileOutput(const bool isTxExport)
void exportAddrs(const QString &filename)
SettingsExportCSV(PIVXGUI *_window, QWidget *parent=nullptr)
Ui::SettingsExportCSV * ui
TransactionFilterProxy * txFilter
Filter the transaction list according to pre-specified rules.
void setTypeFilter(quint32 modes)
@ LabelRole
Label of address related to transaction.
@ DateRole
Date and time this transaction was created.
@ TxHashRole
Transaction hash.
@ AddressRole
Address of transaction.
@ ConfirmedRole
Is transaction confirmed?
@ FormattedAmountRole
Formatted amount, without brackets when unconfirmed.
AddressTableModel * getAddressTableModel()
OptionsModel * getOptionsModel()
bool haveWatchOnly() const
TransactionTableModel * getTransactionTableModel()
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when ...
void setFilterAddressBook(QComboBox *filter, SortEdit *lineEdit)
void setSortTxTypeFilter(QComboBox *filter, SortEdit *lineEditType)
void setShadow(QWidget *edit)
void setCssProperty(std::initializer_list< QWidget * > args, const QString &value)
void setSortTx(QComboBox *filter, SortEdit *lineEdit)