~ubuntu-branches/ubuntu/trusty/baloo/trusty-proposed

« back to all changes in this revision

Viewing changes to debian/patches/upstream_git/0020-Cleaner-Always-remove-it-from-both-the-databases.patch

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-04-10 21:32:59 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20140410213259-b3hkzveqwe4hd3ax
Tags: 4:4.13.0-0ubuntu1
New upstream KDE Software Compilation release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 632abbd8a255bf01e334565e18c8b5d3c6ad0ebf Mon Sep 17 00:00:00 2001
2
 
From: Vishesh Handa <me@vhanda.in>
3
 
Date: Sat, 29 Mar 2014 17:23:52 +0100
4
 
Subject: [PATCH 20/56] Cleaner: Always remove it from both the databases
5
 
 
6
 
---
7
 
 src/file/cleaner/cleaner.cpp | 22 +++++++++++++---------
8
 
 1 file changed, 13 insertions(+), 9 deletions(-)
9
 
 
10
 
diff --git a/src/file/cleaner/cleaner.cpp b/src/file/cleaner/cleaner.cpp
11
 
index 880dcf4..1cfec6f 100644
12
 
--- a/src/file/cleaner/cleaner.cpp
13
 
+++ b/src/file/cleaner/cleaner.cpp
14
 
@@ -29,6 +29,7 @@
15
 
 #include <QUrl>
16
 
 #include <QCoreApplication>
17
 
 #include <QSqlQuery>
18
 
+#include <QDebug>
19
 
 
20
 
 using namespace Baloo;
21
 
 
22
 
@@ -53,24 +54,27 @@ void Cleaner::start()
23
 
         int id = query.value(0).toInt();
24
 
         QString url = query.value(1).toString();
25
 
 
26
 
+        bool removeIt = false;
27
 
         if (!QFile::exists(url)) {
28
 
-            QSqlQuery q(sqlDb);
29
 
-            q.prepare("delete from files where id = ?");
30
 
-            q.addBindValue(id);
31
 
-            q.exec();
32
 
-            m_commitQueue->remove(id);
33
 
-            continue;
34
 
+            removeIt = true;
35
 
         }
36
 
 
37
 
         if (!config.shouldBeIndexed(url)) {
38
 
-            m_commitQueue->remove(id);
39
 
-            continue;
40
 
+            removeIt = true;
41
 
         }
42
 
 
43
 
         QString mimetype = KMimeType::findByUrl(QUrl::fromLocalFile(url))->name();
44
 
         if (!config.shouldMimeTypeBeIndexed(mimetype)) {
45
 
+            removeIt = true;
46
 
+        }
47
 
+
48
 
+        if (removeIt) {
49
 
+            qDebug() << id << url;
50
 
+            QSqlQuery q(sqlDb);
51
 
+            q.prepare("delete from files where id = ?");
52
 
+            q.addBindValue(id);
53
 
+            q.exec();
54
 
             m_commitQueue->remove(id);
55
 
-            continue;
56
 
         }
57
 
     }
58
 
 
59
 
1.9.1
60