summaryrefslogtreecommitdiff
path: root/src/addGroupForm.cpp
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2024-03-09 17:34:04 -0500
committerLouie S <louie@example.com>2024-03-09 17:34:04 -0500
commitfc00cab0368a6f76a2b1f276f3a3d8573b1fba82 (patch)
tree655bd8a5df5d41f864fff0dac995e48b2fe06856 /src/addGroupForm.cpp
parent10b83b465509d864d6946ef30f31ec0356fc78ff (diff)
Standardize source file names
Diffstat (limited to 'src/addGroupForm.cpp')
-rw-r--r--src/addGroupForm.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/addGroupForm.cpp b/src/addGroupForm.cpp
new file mode 100644
index 0000000..d3fa72f
--- /dev/null
+++ b/src/addGroupForm.cpp
@@ -0,0 +1,37 @@
+#include <QMessageBox>
+
+#include <QDebug>
+
+#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()) {
+ 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_value, link_text));
+
+ QDialog::accept();
+}