summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2024-04-04 19:14:04 -0400
committerLouie S <louie@example.com>2024-04-04 19:14:04 -0400
commit7e29576e6eb31c52fde9f3bfc3af08b6c0ed482c (patch)
treecd5216a4d697100f57151063b0114fda0f07452d /src
parent972431f210a73993880d6728199c22e5008ab56b (diff)
Add entry cloning
Diffstat (limited to 'src')
-rw-r--r--src/entryLayout.cpp11
-rw-r--r--src/entryLayout.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/entryLayout.cpp b/src/entryLayout.cpp
index f569829..ac31f4b 100644
--- a/src/entryLayout.cpp
+++ b/src/entryLayout.cpp
@@ -131,6 +131,10 @@ void EntryLayout::showContextMenu() {
QObject::connect(toggle_done_act, &QAction::triggered, this, &EntryLayout::toggleDone);
menu.addAction(toggle_done_act);
+ QAction *clone_entry_act = new QAction("Clone Entry");
+ QObject::connect(clone_entry_act, &QAction::triggered, this, &EntryLayout::cloneEntry);
+ menu.addAction(clone_entry_act);
+
QAction *del_entry_act = new QAction("Remove Entry");
QObject::connect(del_entry_act, &QAction::triggered, this, &EntryLayout::removeEntry);
menu.addAction(del_entry_act);
@@ -158,6 +162,13 @@ void EntryLayout::toggleDone() {
getMainWindow()->displayWidgets();
}
+void EntryLayout::cloneEntry() {
+ BackendDB database;
+
+ database.insertEntry(this->entry);
+ getMainWindow()->displayWidgets();
+}
+
void EntryLayout::removeEntry() {
BackendDB database;
diff --git a/src/entryLayout.h b/src/entryLayout.h
index c38a51b..54e523f 100644
--- a/src/entryLayout.h
+++ b/src/entryLayout.h
@@ -25,6 +25,7 @@ class EntryLayout : public QHBoxLayout {
void editEntry();
void setRules();
void toggleDone();
+ void cloneEntry();
void removeEntry();
};