-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskManager.h
More file actions
38 lines (28 loc) · 1.19 KB
/
TaskManager.h
File metadata and controls
38 lines (28 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef TASKMANAGER_H
#define TASKMANAGER_H
#include <QObject>
#include <QString>
#include <QList>
#include <sqlite3.h> // Include SQLite3 for database interaction
#include "Task.h"
class TaskManager : public QObject {
Q_OBJECT
public:
explicit TaskManager(QObject *parent = nullptr);
~TaskManager();
Q_INVOKABLE void insertToTable(int id, const QString &taskName, const QString &taskDescription, const QString &taskDeadline, const QString &taskPriority, int taskStateFinished);
Q_INVOKABLE bool removeTaskDB(int id);
Q_INVOKABLE void loadTasksDB();
Q_INVOKABLE bool updateTaskDB(int taskId, const QString &taskName, const QString &taskDescription, const QString &taskDeadline, const QString &taskPriority, int taskStateFinished);
void cleanupBeforeExit(); // Function to run on exit
signals:
void taskLoaded(int id, QString taskName, QString taskDescription, QString taskDeadline, QString taskImportance, int taskStateFinished);
private:
QList<Task*> m_tasks; // Store tasks
sqlite3* m_db; // Database connection
// Helper method to open database connection
bool openDatabase();
void closeDatabase();
void loadTasks();
};
#endif // TASKMANAGER_H