[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim-runtime/Applications/16.08] resources/kalarm/kalarmdir: Bug 370627: ignore temporary files c
From:       David Jarvie <djarvie () kde ! org>
Date:       2016-10-31 20:43:33
Message-ID: E1c1JQb-0004dx-AO () code ! kde ! org
[Download RAW message or body]

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/4cd6df12ffc7cc7455f986e87c0d79d00d3123fa

diff --git a/resources/kalarm/kalarmdir/kalarmdirresource.cpp \
b/resources/kalarm/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[] = "WARNING_README.txt";
 
 #define DEBUG_DATA \
@@ -1164,11 +1162,12 @@ QString KAlarmDirResource::removeEventFile(const QString \
                &eventId, const QString
 * Check whether a file is to be ignored.
 * Reply = 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(QLatin1Char('~'))
-       &&  file != QLatin1String(warningFile);
+       &&  file != QLatin1String(warningFile)
+       &&  QFile(filePath(file)).exists();   // a temporary file may no longer exist
 }
 
 AKONADI_RESOURCE_MAIN(KAlarmDirResource)
diff --git a/resources/kalarm/kalarmdir/kalarmdirresource.h \
b/resources/kalarm/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  © 2011-2012 by David Jarvie <djarvie@kde.org>
+ *  Copyright  © 2011-2016 by David Jarvie <djarvie@kde.org>
  *
  *  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() {}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic