From kde-commits Mon Oct 31 20:43:33 2016 From: David Jarvie Date: Mon, 31 Oct 2016 20:43:33 +0000 To: kde-commits Subject: [kdepim-runtime/Applications/16.08] resources/kalarm/kalarmdir: Bug 370627: ignore temporary files c Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=147794662124271 Git commit 4cd6df12ffc7cc7455f986e87c0d79d00d3123fa by David Jarvie. Committed on 31/10/2016 at 20:39. Pushed by djarvie into branch 'Applications/16.08'. 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. M +3 -4 resources/kalarm/kalarmdir/kalarmdirresource.cpp M +2 -1 resources/kalarm/kalarmdir/kalarmdirresource.h http://commits.kde.org/kdepim-runtime/4cd6df12ffc7cc7455f986e87c0d79d00d312= 3fa 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 33aba01..344eac4 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 @@ -87,6 +87,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() {}