Online account can now be created from the EditItemDialog. The response isn't processed properly yet.
This commit is contained in:
@ -26,6 +26,10 @@ void EditItemDialog::createContent() {
|
||||
innerLayout->addWidget(m_detailMapper);
|
||||
|
||||
m_outerLayout->insertWidget(0, m_contentContainer);
|
||||
|
||||
/// online user stuff
|
||||
connect(m_detailMapper, &ItemDetailMapper::createOnlineAccountTriggered, this,
|
||||
&EditItemDialog::createOnlineAccountTriggered);
|
||||
}
|
||||
|
||||
void EditItemDialog::accept() {
|
||||
|
||||
@ -19,6 +19,8 @@ class EditItemDialog : public AbstractDialog {
|
||||
/// AbstractDialog interface
|
||||
void createContent() override;
|
||||
|
||||
signals:
|
||||
void createOnlineAccountTriggered(const QString& mailAddress);
|
||||
public slots:
|
||||
void accept() override;
|
||||
void reject() override;
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include "genericcore.h"
|
||||
#include "model/generalsortfiltermodel.h"
|
||||
#include "model/metadata.h"
|
||||
#include "model/modelsummary.h"
|
||||
#include "model/tablemodel.h"
|
||||
#include "widgets/biddingroundcontrol.h"
|
||||
#include "widgets/comboboxdelegate.h"
|
||||
@ -75,6 +74,10 @@ MainWindow::MainWindow(QWidget* parent)
|
||||
onCurrentChanged(QModelIndex(), QModelIndex());
|
||||
|
||||
setupEventTab();
|
||||
|
||||
// #ifndef QT_DEBUG
|
||||
initServerConnection();
|
||||
// #endif
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() { delete ui; }
|
||||
@ -563,3 +566,8 @@ void MainWindow::setupEventTab() {
|
||||
|
||||
ui->tabWidget->insertTab(0, containerWidget, "Event (&1)");
|
||||
}
|
||||
|
||||
void MainWindow::initServerConnection() {
|
||||
connect(m_editItemDialog.get(), &EditItemDialog::createOnlineAccountTriggered, m_core.get(),
|
||||
&GenericCore::onCreateOnlineAccountTriggered);
|
||||
}
|
||||
|
||||
@ -120,5 +120,7 @@ class MainWindow : public QMainWindow {
|
||||
void createGuiDialogs();
|
||||
|
||||
void setupEventTab();
|
||||
|
||||
void initServerConnection();
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
@ -156,6 +156,15 @@ ItemDetailMapper::ItemDetailMapper(QWidget* parent)
|
||||
outerLayout->addLayout(leftLayout);
|
||||
outerLayout->addLayout(rightLayout);
|
||||
setLayout(outerLayout);
|
||||
|
||||
/// online user account
|
||||
connect(m_mailEdit, &QLineEdit::textChanged, this, &ItemDetailMapper::onMailEditChanged);
|
||||
connect(m_onlineIdDisplay, &QLineEdit::textChanged, this, &ItemDetailMapper::onOnlineIDChanged);
|
||||
connect(m_accessCodeDisplay, &QLineEdit::textChanged, this,
|
||||
&ItemDetailMapper::onAccessCodeChanged);
|
||||
|
||||
connect(m_createOnlineAccountButton, &QAbstractButton::clicked, this,
|
||||
&ItemDetailMapper::onCreateOnlineAccountTriggered);
|
||||
}
|
||||
|
||||
void ItemDetailMapper::setModelMappings(QTableView* tableView) {
|
||||
@ -265,3 +274,40 @@ void ItemDetailMapper::updateQRCode(const QString text) {
|
||||
m_qrCodeDisplay->setPixmap(QPixmap::fromImage(image));
|
||||
m_qrCodeDisplay->setToolTip(text);
|
||||
}
|
||||
|
||||
void ItemDetailMapper::onMailEditChanged(const QString& text) {
|
||||
if (text.isEmpty()) {
|
||||
m_createOnlineAccountButton->setEnabled(false);
|
||||
m_sendInviteMailButton->setEnabled(false);
|
||||
} else {
|
||||
onOnlineIDChanged(m_onlineIdDisplay->text());
|
||||
onAccessCodeChanged(m_accessCodeDisplay->text());
|
||||
}
|
||||
}
|
||||
|
||||
void ItemDetailMapper::onOnlineIDChanged(const QString& text) {
|
||||
if (text.isEmpty()) {
|
||||
m_createOnlineAccountButton->setEnabled(true);
|
||||
m_sendInviteMailButton->setEnabled(false);
|
||||
} else {
|
||||
m_createOnlineAccountButton->setEnabled(false);
|
||||
m_sendInviteMailButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemDetailMapper::onAccessCodeChanged(const QString& text) {
|
||||
if (text.isEmpty()) {
|
||||
m_sendInviteMailButton->setEnabled(false);
|
||||
m_accessUrlDisplay->setText("");
|
||||
updateQRCode("");
|
||||
} else {
|
||||
m_sendInviteMailButton->setEnabled(true);
|
||||
const QString accessUrl = "http://127.0.0.1:4000/api/users/" + text;
|
||||
m_accessUrlDisplay->setText(accessUrl);
|
||||
updateQRCode(accessUrl);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemDetailMapper::onCreateOnlineAccountTriggered() {
|
||||
emit createOnlineAccountTriggered(m_mailEdit->text());
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ class ItemDetailMapper : public QWidget {
|
||||
signals:
|
||||
void contentChanged(const QString text);
|
||||
|
||||
void createOnlineAccountTriggered(const QString& mailAddress);
|
||||
|
||||
private slots:
|
||||
void rowsInserted(const QModelIndex& parent, int start, int end);
|
||||
void rowsRemoved(const QModelIndex& parent, int start, int end);
|
||||
@ -38,7 +40,12 @@ class ItemDetailMapper : public QWidget {
|
||||
void updateButtons(int row);
|
||||
void emitContentChanged(const QModelIndex& currentIndex);
|
||||
void onCurrentIndexChanged(const QModelIndex& current, const QModelIndex& previous);
|
||||
|
||||
void updateQRCode(const QString text = "");
|
||||
void onMailEditChanged(const QString& text);
|
||||
void onOnlineIDChanged(const QString& text);
|
||||
void onAccessCodeChanged(const QString& text);
|
||||
void onCreateOnlineAccountTriggered();
|
||||
|
||||
private:
|
||||
/// *** members ***
|
||||
|
||||
Reference in New Issue
Block a user