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

Method updateHistory

tools/screenshotmanager.cpp:113–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void ScreenshotManager::updateHistory(const QString &fileName, const QString &url, const QString &deleteHash)
114{
115 if (!mSettings->value("/options/history", true).toBool() || url.isEmpty()) {
116 return;
117 }
118
119 if (!mHistoryInitialized) {
120 initHistory();
121 }
122
123 QSqlQuery query;
124 query.prepare("SELECT fileName FROM history WHERE URL IS NOT EMPTY AND fileName = ?");
125 query.addBindValue(fileName);
126 query.exec();
127
128 if (query.record().count() > 0) {
129 QSqlQuery updateQuery;
130 updateQuery.prepare("UPDATE history SET URL = ?, deleteURL = ?, time = ? WHERE fileName = ?");
131 updateQuery.addBindValue(url);
132 updateQuery.addBindValue("https://imgur.com/delete/" + deleteHash);
133 updateQuery.addBindValue(QDateTime::currentMSecsSinceEpoch());
134 updateQuery.addBindValue(fileName);
135
136 updateQuery.exec();
137 } else {
138 saveHistory(fileName, url, deleteHash);
139 }
140}
141
142void ScreenshotManager::removeHistory(const QString &fileName, qint64 time)
143{

Callers

nothing calls this directly

Calls 1

countMethod · 0.80

Tested by

no test coverage detected