From 7cb55bb2b78cd11da097c7ed1da8452c4467c124 Mon Sep 17 00:00:00 2001 From: Edric Milaret <edric.ladent-milaret@savoirfairelinux.com> Date: Mon, 10 Aug 2015 11:24:13 -0400 Subject: [PATCH] contact: fix 2x add of contact - We'll use the filewatcher as if it was a native API callback, thus we do not add the new Person directly but wait for the filewatcher to kick in and add it himself. Issue: #78873 Change-Id: I5b4d173d7c2d96daf83b393f47858d16fda88544 --- windowscontactbackend.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/windowscontactbackend.cpp b/windowscontactbackend.cpp index a3572ef..ea6b3c2 100644 --- a/windowscontactbackend.cpp +++ b/windowscontactbackend.cpp @@ -183,9 +183,6 @@ WindowsContactEditor::addNew(Person *item) file.write(doc.toByteArray()); file.close(); - //Add it to the collection - addExisting(item); - return true; } @@ -222,11 +219,11 @@ WindowsContactBackend::load() QtConcurrent::run(this, &WindowsContactBackend::loadRun); watcher_->addPath(QStandardPaths::writableLocation (QStandardPaths::HomeLocation) + "/Contacts"); -//FIXME: Temporary disabling watch on the dir because of double add -// QObject::connect(watcher_, &QFileSystemWatcher::directoryChanged, [=](QString path) { -// Q_UNUSED(path) -// QtConcurrent::run(this, &WindowsContactBackend::loadRun); -// }); + + QObject::connect(watcher_, &QFileSystemWatcher::directoryChanged, [=](QString path) { + Q_UNUSED(path) + QtConcurrent::run(this, &WindowsContactBackend::loadRun); + }); return true; } -- GitLab