summaryrefslogtreecommitdiff
path: root/src/add_entry_form.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/add_entry_form.cpp
parent10b83b465509d864d6946ef30f31ec0356fc78ff (diff)
Standardize source file names
Diffstat (limited to 'src/add_entry_form.cpp')
-rw-r--r--src/add_entry_form.cpp49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/add_entry_form.cpp b/src/add_entry_form.cpp
deleted file mode 100644
index 7c8e59d..0000000
--- a/src/add_entry_form.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#include <QDate>
-#include <QMessageBox>
-#include <QString>
-
-#include "add_entry_form.h"
-#include "backend/db_sqlite.h"
-
-AddEntryForm::AddEntryForm(const Group &g) :
- parent_group(g)
-{
- // load uic
- ui.setupUi(this);
-
- // set titles
- this->setWindowTitle("Add Entry");
- ui.title->setText("Add Entry");
-
- // widgets setup
- ui.entry_due->setDate(QDate::currentDate());
-}
-
-void AddEntryForm::accept() {
- QString desc_text = ui.entry_desc->text();
- QDateTime due_text = ui.entry_due->date().startOfDay();
- QString due_alt_text = ui.entry_due_alt->text();
- QString link_text = ui.entry_link->text();
- QString color_text = ui.entry_color->text();
- QString highlight_text = ui.entry_highlight->text();
- QMessageBox error_message;
- BackendDB database;
- int new_id;
-
- // Check that the new entry is not blank
- if(desc_text.isEmpty()) {
- error_message.setIcon(QMessageBox::Warning);
- error_message.setWindowTitle("Error Message");
- error_message.setText("Description cannot be blank");
- error_message.exec();
- return;
- }
-
- // replace due_text with null date if due_checkbox is unchecked
- if(!ui.entry_due_checkbox->isChecked())
- due_text = QDateTime();
-
- new_id = database.insertEntry(Entry(0, this->parent_group.id, desc_text, due_text, due_alt_text, link_text, color_text, highlight_text));
-
- QDialog::accept();
-}