From 7e29576e6eb31c52fde9f3bfc3af08b6c0ed482c Mon Sep 17 00:00:00 2001 From: Louie S Date: Thu, 4 Apr 2024 19:14:04 -0400 Subject: Add entry cloning --- src/entryLayout.cpp | 11 +++++++++++ src/entryLayout.h | 1 + 2 files changed, 12 insertions(+) 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(); }; -- cgit