-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPMaildCoreSQLite.cpp
More file actions
46 lines (38 loc) · 1.25 KB
/
PMaildCoreSQLite.cpp
File metadata and controls
46 lines (38 loc) · 1.25 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
39
40
41
42
43
44
45
#include "PMaildCoreSQLite.hpp"
#include "PMaildDomain.hpp"
#include "PMaildUser.hpp"
#include "PMaildMail.hpp"
#include <QSqlDatabase>
#include <QSettings>
#include <QSqlError>
PMaildCoreSQLite::PMaildCoreSQLite(QSettings &settings): PMaildCore(settings) {
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(settings.value("sqlite/file", "pmaild.db").toString());
if (!db.open()) {
qDebug("Fatal error while initializing database backend, giving up!");
qDebug("Error: %s", qPrintable(db.lastError().text()));
exit(1); // ensure we exit *now*, since we are before app.exec(), calling QCoreApplication::exit() won't work
}
}
PMaildUser PMaildCoreSQLite::getUser(const PMaildDomain &, QString) {
return PMaildUser();
}
bool PMaildCoreSQLite::check() {
if (!QSqlDatabase::isDriverAvailable("QSQLITE")) {
qDebug("QSQLITE driver not available, giving up");
return false;
}
return true;
}
PMaildDomain PMaildCoreSQLite::getDomain(QString) {
return PMaildDomain();
}
QList<PMaildMail> PMaildCoreSQLite::listEmailsByUserFolder(const PMaildUser&, int) {
return QList<PMaildMail>();
}
PMaildMail PMaildCoreSQLite::getEmailByUserId(const PMaildUser&, int) {
return PMaildMail();
}
bool PMaildCoreSQLite::eraseMail(const PMaildMail&) {
return false;
}