mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-03-13 06:01:45 +00:00
WIP: Able to see the content of the selected namespace.
This commit is contained in:
parent
448f25f159
commit
16bab4654a
@ -95,6 +95,12 @@ void KevaDialog::setModel(WalletModel *_model)
|
||||
}
|
||||
}
|
||||
|
||||
void KevaDialog::showNamespace(QString ns)
|
||||
{
|
||||
ui->nameSpace->setText(ns);
|
||||
on_showContent_clicked();
|
||||
}
|
||||
|
||||
KevaDialog::~KevaDialog()
|
||||
{
|
||||
delete ui;
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
~KevaDialog();
|
||||
|
||||
void setModel(WalletModel *model);
|
||||
void showNamespace(QString ns);
|
||||
|
||||
public Q_SLOTS:
|
||||
void clear();
|
||||
|
@ -6,7 +6,9 @@
|
||||
#include <qt/forms/ui_kevamynamespacesdialog.h>
|
||||
|
||||
#include <qt/kevanamespacemodel.h>
|
||||
#include <qt/kevadialog.h>
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QModelIndex>
|
||||
|
||||
KevaMyNamespacesDialog::KevaMyNamespacesDialog(QWidget *parent) :
|
||||
@ -14,6 +16,9 @@ KevaMyNamespacesDialog::KevaMyNamespacesDialog(QWidget *parent) :
|
||||
ui(new Ui::KevaMyNamespacesDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(reject()));
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
|
||||
}
|
||||
|
||||
void KevaMyNamespacesDialog::setModel(WalletModel *_model)
|
||||
@ -35,16 +40,37 @@ void KevaMyNamespacesDialog::setModel(WalletModel *_model)
|
||||
//tableView->setColumnWidth(KevaNamespaceModel::Name, NAME_COLUMN_WIDTH);
|
||||
tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
|
||||
connect(tableView->selectionModel(),
|
||||
SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
|
||||
SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
|
||||
connect(tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(namespaceView_selectionChanged()));
|
||||
}
|
||||
}
|
||||
|
||||
void KevaMyNamespacesDialog::accept()
|
||||
|
||||
void KevaMyNamespacesDialog::namespaceView_selectionChanged()
|
||||
{
|
||||
// Create the namespace here.
|
||||
QDialog::accept();
|
||||
bool enable = !ui->namespaceView->selectionModel()->selectedRows().isEmpty();
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(enable);
|
||||
|
||||
if (enable) {
|
||||
selectedIndex = ui->namespaceView->selectionModel()->currentIndex();
|
||||
} else {
|
||||
QModelIndex empty;
|
||||
selectedIndex = empty;
|
||||
}
|
||||
}
|
||||
|
||||
void KevaMyNamespacesDialog::apply()
|
||||
{
|
||||
QModelIndex idIdx = selectedIndex.sibling(selectedIndex.row(), KevaNamespaceModel::Id);
|
||||
QString idStr = idIdx.data(Qt::DisplayRole).toString();
|
||||
KevaDialog* dialog = (KevaDialog*)this->parentWidget();
|
||||
dialog->showNamespace(idStr);
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
void KevaMyNamespacesDialog::reject()
|
||||
{
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
KevaMyNamespacesDialog::~KevaMyNamespacesDialog()
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <QString>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QItemSelection>
|
||||
#include <QAbstractItemView>
|
||||
|
||||
class WalletModel;
|
||||
|
||||
@ -31,12 +33,19 @@ class KevaMyNamespacesDialog : public QDialog
|
||||
public:
|
||||
explicit KevaMyNamespacesDialog(QWidget *parent = 0);
|
||||
~KevaMyNamespacesDialog();
|
||||
void accept();
|
||||
void setModel(WalletModel *_model);
|
||||
|
||||
public Q_SLOTS:
|
||||
void apply();
|
||||
void reject();
|
||||
|
||||
private Q_SLOTS:
|
||||
void namespaceView_selectionChanged();
|
||||
|
||||
private:
|
||||
Ui::KevaMyNamespacesDialog *ui;
|
||||
WalletModel *model;
|
||||
QModelIndex selectedIndex;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_KEVAMYNMAESPACESDIALOG_H
|
||||
|
@ -23,6 +23,8 @@ class KevaNewNamespaceDialog : public QDialog
|
||||
public:
|
||||
explicit KevaNewNamespaceDialog(QWidget *parent = 0);
|
||||
~KevaNewNamespaceDialog();
|
||||
|
||||
public Q_SLOTS:
|
||||
void accept();
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user