diff options
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/divelistview.cpp | 3 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 12 |
2 files changed, 10 insertions, 5 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index ded3acbc7..bf4a5d8cf 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -986,9 +986,8 @@ void DiveListView::loadImageFromURL(QUrl url) return; } - // Since we already downloaded the image we can cache it as well. QCryptographicHash hash(QCryptographicHash::Sha1); - hash.addData(imageData); + hash.addData(url.toString().toUtf8()); QString path = QStandardPaths::standardLocations(QStandardPaths::CacheLocation).first(); QDir dir(path); if (!dir.exists()) diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index c0c79b00d..dcd7aff32 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -701,9 +701,9 @@ void MainWindow::on_actionCloudOnline_triggered() updateCloudOnlineStatus(); } -static void learnImageDirs(QStringList dirnames) +static void learnImageDirs(QStringList dirnames, QVector<QString> imageFilenames) { - learnImages(dirnames, 10); + learnImages(dirnames, 10, imageFilenames); DivePictureModel::instance()->updateDivePictures(); } @@ -720,7 +720,13 @@ void MainWindow::on_actionHash_images_triggered() dirnames = dialog.selectedFiles(); if (dirnames.isEmpty()) return; - future = QtConcurrent::run(learnImageDirs,dirnames); + QVector<QString> imageFilenames; + int i; + struct dive *dive; + for_each_dive (i, dive) + FOR_EACH_PICTURE(dive) + imageFilenames.append(QString(picture->filename)); + future = QtConcurrent::run(learnImageDirs, dirnames, imageFilenames); MainWindow::instance()->getNotificationWidget()->showNotification(tr("Scanning images...(this can take a while)"), KMessageWidget::Information); MainWindow::instance()->getNotificationWidget()->setFuture(future); |