From kde-commits Mon Oct 31 20:48:50 2016 From: David Jarvie Date: Mon, 31 Oct 2016 20:48:50 +0000 To: kde-commits Subject: [kdepim-runtime] resources/kalarm/kalarmdir: Bug 370627: ignore temporary files created in calendar Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=147794694324382 Git commit 77f30c7471ce4f79e106cc91e8789c8c621fd1b7 by David Jarvie. Committed on 31/10/2016 at 20:44. Pushed by djarvie into branch 'master'. Bug 370627: ignore temporary files created in calendar directory Temporary files created by QSaveFile (called from ICalFormat::save()) on some systems caused error messages to appear in .xsession-errors since they trigger KDirWatch but no longer exist when fileChanged() tries to load them. Copy of commit 4cd6df12ffc7cc7455f986e87c0d79d00d3123fa (16.08 branch). M +3 -4 resources/kalarm/kalarmdir/kalarmdirresource.cpp M +2 -1 resources/kalarm/kalarmdir/kalarmdirresource.h http://commits.kde.org/kdepim-runtime/77f30c7471ce4f79e106cc91e8789c8c621fd= 1b7 diff --git a/resources/kalarm/kalarmdir/kalarmdirresource.cpp b/resources/k= alarm/kalarmdir/kalarmdirresource.cpp index 80d6b19..293e677 100644 --- a/resources/kalarm/kalarmdir/kalarmdirresource.cpp +++ b/resources/kalarm/kalarmdir/kalarmdirresource.cpp @@ -58,8 +58,6 @@ using namespace KCalCore; using namespace Akonadi_KAlarm_Dir_Resource; using KAlarmResourceCommon::errorMessage; = -static bool isFileValid(const QString &file); - static const char warningFile[] =3D "WARNING_README.txt"; = #define DEBUG_DATA \ @@ -1164,11 +1162,12 @@ QString KAlarmDirResource::removeEventFile(const QS= tring &eventId, const QString * Check whether a file is to be ignored. * Reply =3D false if file is to be ignored. */ -bool isFileValid(const QString &file) +bool KAlarmDirResource::isFileValid(const QString &file) const { return !file.isEmpty() && !file.startsWith(QLatin1Char('.')) && !file.endsWith(QLatin1C= har('~')) - && file !=3D QLatin1String(warningFile); + && file !=3D QLatin1String(warningFile) + && QFile(filePath(file)).exists(); // a temporary file may no lo= nger exist } = AKONADI_RESOURCE_MAIN(KAlarmDirResource) diff --git a/resources/kalarm/kalarmdir/kalarmdirresource.h b/resources/kal= arm/kalarmdir/kalarmdirresource.h index 3458195..b274085 100644 --- a/resources/kalarm/kalarmdir/kalarmdirresource.h +++ b/resources/kalarm/kalarmdir/kalarmdirresource.h @@ -1,7 +1,7 @@ /* * kalarmdirresource.h - Akonadi directory resource for KAlarm * Program: kalarm - * Copyright =C2=A9 2011-2012 by David Jarvie + * Copyright =C2=A9 2011-2016 by David Jarvie * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as published= by @@ -90,6 +90,7 @@ private: bool createItem(const KAEvent &); bool modifyItem(const KAEvent &); void deleteItem(const KAEvent &); + bool isFileValid(const QString &file) const; = struct EventFile { // data to be indexed by event ID EventFile() {}