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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
From f37ef2c195b61a43a40e9cbb7f119fdc8e9d38f4 Mon Sep 17 00:00:00 2001
From: Maik Qualmann <metzpinguin@gmail.com>
Date: Sat, 10 Dec 2016 11:16:50 +0100
Subject: fix locked database with BQM
---
utilities/queuemanager/manager/actionthread.cpp | 27 ++++++++++++++++++++++---
utilities/queuemanager/manager/actionthread.h | 1 +
utilities/queuemanager/manager/task.cpp | 24 +++++-----------------
3 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/utilities/queuemanager/manager/actionthread.cpp b/utilities/queuemanager/manager/actionthread.cpp
index 48c3fa3..141bb3d 100644
--- a/utilities/queuemanager/manager/actionthread.cpp
+++ b/utilities/queuemanager/manager/actionthread.cpp
@@ -28,6 +28,7 @@
#include "digikam_debug.h"
#include "digikam_config.h"
+#include "collectionscanner.h"
#include "task.h"
namespace Digikam
@@ -82,7 +83,7 @@ void ActionThread::processQueueItems(const QList<AssignedBatchTools>& items)
{
ActionJobCollection collection;
- for(int i = 0 ; i < items.size() ; i++)
+ for (int i = 0 ; i < items.size() ; i++)
{
Task* const t = new Task();
t->setSettings(d->settings);
@@ -92,10 +93,12 @@ void ActionThread::processQueueItems(const QList<AssignedBatchTools>& items)
this, SIGNAL(signalStarting(Digikam::ActionData)));
connect(t, SIGNAL(signalFinished(Digikam::ActionData)),
- this, SIGNAL(signalFinished(Digikam::ActionData)));
+ this, SLOT(slotUpdateImageInfo(Digikam::ActionData)),
+ Qt::BlockingQueuedConnection);
connect(this, SIGNAL(signalCancelTask()),
- t, SLOT(slotCancel()), Qt::QueuedConnection);
+ t, SLOT(slotCancel()),
+ Qt::QueuedConnection);
collection.insert(t, 0);
}
@@ -111,6 +114,24 @@ void ActionThread::cancel()
ActionThreadBase::cancel();
}
+void ActionThread::slotUpdateImageInfo(const Digikam::ActionData& ad)
+{
+ if (ad.status == ActionData::BatchDone)
+ {
+ CollectionScanner scanner;
+ ImageInfo source = ImageInfo::fromUrl(ad.fileUrl);
+ qlonglong id = scanner.scanFile(ad.destUrl.toLocalFile(), CollectionScanner::NormalScan);
+ ImageInfo info(id);
+ QDateTime dateTime = info.dateTime();
+ // Copy the digiKam attributes from original file to the new file
+ CollectionScanner::copyFileProperties(source, info);
+ // Restore date time from new file
+ info.setDateTime(dateTime);
+ }
+
+ emit signalFinished(ad);
+}
+
void ActionThread::slotThreadFinished()
{
if (isEmpty())
diff --git a/utilities/queuemanager/manager/actionthread.h b/utilities/queuemanager/manager/actionthread.h
index 8cb848b..3375c2e 100644
--- a/utilities/queuemanager/manager/actionthread.h
+++ b/utilities/queuemanager/manager/actionthread.h
@@ -72,6 +72,7 @@ Q_SIGNALS:
private Q_SLOTS:
+ void slotUpdateImageInfo(const Digikam::ActionData& ad);
void slotThreadFinished();
private:
diff --git a/utilities/queuemanager/manager/task.cpp b/utilities/queuemanager/manager/task.cpp
index a94b4f9..4c6b710 100644
--- a/utilities/queuemanager/manager/task.cpp
+++ b/utilities/queuemanager/manager/task.cpp
@@ -46,10 +46,8 @@ extern "C"
#include "dimg.h"
#include "dmetadata.h"
#include "imageinfo.h"
-#include "fileactionmngr.h"
#include "batchtool.h"
#include "batchtoolsmanager.h"
-#include "collectionscanner.h"
#include "fileoperation.h"
namespace Digikam
@@ -245,27 +243,15 @@ void Task::run()
}
}
- if (!FileOperation::localFileRename(d->tools.m_itemUrl.toLocalFile(),
- outUrl.toLocalFile(),
- dest.toLocalFile()))
+ if (FileOperation::localFileRename(d->tools.m_itemUrl.toLocalFile(),
+ outUrl.toLocalFile(),
+ dest.toLocalFile()))
{
- emitActionData(ActionData::BatchFailed, i18n("Failed to create file..."), dest);
+ emitActionData(ActionData::BatchDone, i18n("Item processed successfully %1", renameMess), dest);
}
else
{
- // -- Now copy the digiKam attributes from original file to the new file ------------
-
- CollectionScanner scanner;
- qlonglong id = scanner.scanFile(dest.toLocalFile(), CollectionScanner::NormalScan);
-
- ImageInfo destInfo(id);
- CollectionScanner::copyFileProperties(source, destInfo);
-
- // -- Read again new file that the database is up to date ---------------------------
-
- scanner.scanFile(destInfo, CollectionScanner::Rescan);
-
- emitActionData(ActionData::BatchDone, i18n("Item processed successfully %1", renameMess), dest);
+ emitActionData(ActionData::BatchFailed, i18n("Failed to create file..."), dest);
}
}
else
--
cgit v0.11.2
|