kasts/src/database.h

39 lines
759 B
C
Raw Normal View History

2020-03-16 22:37:04 +01:00
/**
2020-08-14 20:56:04 +02:00
* SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
2020-03-16 22:37:04 +01:00
*
2020-08-14 20:56:04 +02:00
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
2020-03-16 22:37:04 +01:00
*/
#pragma once
#include <QSqlQuery>
2020-05-26 16:32:07 +02:00
class Database : public QObject
2020-03-16 22:37:04 +01:00
{
2020-05-26 16:32:07 +02:00
Q_OBJECT
2020-03-16 22:37:04 +01:00
public:
static Database &instance()
{
static Database _instance;
return _instance;
}
bool execute(QSqlQuery &query);
bool execute(QString query);
2020-05-26 16:32:07 +02:00
Q_INVOKABLE void addFeed(QString url);
2020-09-04 16:52:32 +02:00
Q_INVOKABLE void importFeeds(QString path);
Q_INVOKABLE void exportFeeds(QString path);
2020-05-26 16:32:07 +02:00
Q_SIGNALS:
void feedAdded(QString url);
2020-03-16 22:37:04 +01:00
private:
Database();
int version();
bool migrate();
bool migrateTo1();
void cleanup();
2020-05-11 21:13:27 +02:00
bool feedExists(QString url);
2020-03-16 22:37:04 +01:00
};