summaryrefslogtreecommitdiff
path: root/src/frontend/qtwidgets/addGroupForm.cpp
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2024-07-23 20:37:48 -0400
committerLouie S <louie@example.com>2024-07-23 20:37:48 -0400
commitc34930425fadfc4083067b9306159cd8e8ecf6c6 (patch)
treed9c09709f1b9cf7e9bcf098d48c7036044098a7d /src/frontend/qtwidgets/addGroupForm.cpp
parentf820f439910ef0243e6b9aded293190341b058ac (diff)
Rearrange source file locations
Diffstat (limited to 'src/frontend/qtwidgets/addGroupForm.cpp')
-rw-r--r--src/frontend/qtwidgets/addGroupForm.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/frontend/qtwidgets/addGroupForm.cpp b/src/frontend/qtwidgets/addGroupForm.cpp
new file mode 100644
index 0000000..c7d5faa
--- /dev/null
+++ b/src/frontend/qtwidgets/addGroupForm.cpp
@@ -0,0 +1,34 @@
+#include <QMessageBox>
+
+#include "addGroupForm.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();
+ Group::Column column_value = Group::Column(ui.group_column->currentIndex());
+ QString link_text = ui.group_link->text();
+ QMessageBox error_message;
+ BackendDB database;
+ int new_id;
+
+ if(name_text.isEmpty()) {
+ 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_value, link_text));
+
+ QDialog::accept();
+}