| 111 | } |
| 112 | |
| 113 | void 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 | |
| 142 | void ScreenshotManager::removeHistory(const QString &fileName, qint64 time) |
| 143 | { |