MCPcopy Create free account
hub / github.com/ckaiser/Lightscreen / initHistory

Method initHistory

tools/screenshotmanager.cpp:49–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void ScreenshotManager::initHistory()
50{
51 if (mHistoryInitialized) {
52 return;
53 }
54
55 // Creating the SQLite database.
56 QSqlDatabase history = QSqlDatabase::addDatabase("QSQLITE");
57
58 QDir historyPath(mHistoryPath);
59
60 if (!historyPath.exists()) {
61 historyPath.mkpath(mHistoryPath);
62 }
63
64 history.setHostName("localhost");
65 history.setDatabaseName(mHistoryPath + "history.sqlite");
66
67 if (history.open()) {
68 QSqlQuery tableQuery;
69 mHistoryInitialized = tableQuery.exec("CREATE TABLE IF NOT EXISTS history (fileName text, URL text, deleteURL text, time integer)");
70
71 history.exec("CREATE INDEX IF NOT EXISTS fileName_index ON history(fileName)");
72 } else {
73 qCritical() << "Could not open SQLite DB.";
74 mHistoryInitialized = false;
75 }
76}
77
78int ScreenshotManager::activeCount() const
79{

Callers 1

initMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected