summaryrefslogtreecommitdiff
path: root/src/add_group_form.cpp
blob: 56622081cb7d29c7945788b376d639c5ac282a22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <QMessageBox>

#include "add_group_form.h"

AddGroupForm::AddGroupForm() {
	// load uic
	ui.setupUi(this);

	// setup dialog button connections
	QObject::connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
	QObject::connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &AddGroupForm::handleSubmit);
}

void AddGroupForm::handleSubmit() {
	QString name_text = ui.new_group_name->text();
	QString column_text = ui.new_group_column->currentText();
	QString link_text = ui.new_group_link->text();
	QMessageBox error_message;

	if(name_text.isEmpty()) {
		error_message.setIcon(QMessageBox::Warning);
		error_message.setWindowTitle("Error Message");
		error_message.setText("Name cannot be blank");
		error_message.setParent(this);
		error_message.show();
	}

	// TODO insert into database
	this->close();
}