blob: 98cdb6383f24b079d81d3453c96a8d037ed94caa (
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
31
32
33
34
35
36
37
|
#include <QMessageBox>
#include <QDebug>
#include "add_group_form.h"
#include "backend/db_sqlite.h"
AddGroupForm::AddGroupForm() {
// load uic
ui.setupUi(this);
// set titles
this->setWindowTitle("Add Group");
ui.title->setText("Add Group");
}
void AddGroupForm::accept() {
QString name_text = ui.group_name->text();
QString column_text = ui.group_column->currentText();
QString link_text = ui.group_link->text();
QMessageBox error_message;
BackendDB database;
int new_id;
if(name_text.isEmpty()) {
qDebug() << "Gets here";
error_message.setIcon(QMessageBox::Warning);
error_message.setWindowTitle("Error Message");
error_message.setText("Name cannot be blank");
error_message.exec();
return;
}
new_id = database.insertGroup(Group(0, name_text, column_text, link_text));
QDialog::accept();
}
|