blob: 351fddd1caf6742e4a072819d26c96a4666056a3 (
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
38
39
40
|
#include <QMessageBox>
#include "backend/db_sqlite.h"
#include "editGroupForm.h"
EditGroupForm::EditGroupForm(const Group &g) :
group(g)
{
// load uic
ui.setupUi(this);
// set titles
this->setWindowTitle("Edit Group");
ui.title->setText("Edit Group");
// widgets setup
ui.group_name->setText(this->group.name);
ui.group_column->setCurrentIndex(this->group.column);
ui.group_link->setText(this->group.link);
}
void EditGroupForm::accept() {
group.name = ui.group_name->text();
group.column = Group::Column(ui.group_column->currentIndex());
group.link = ui.group_link->text();
QMessageBox error_message;
BackendDB database;
if(group.name.isEmpty()) {
error_message.setIcon(QMessageBox::Warning);
error_message.setWindowTitle("Error Message");
error_message.setText("Name cannot be blank");
error_message.exec();
return;
}
database.updateGroup(this->group);
QDialog::accept();
}
|