Summary: | Korganizer tries to save read-only resources | ||
---|---|---|---|
Product: | [Applications] korganizer | Reporter: | Jarkko Suontausta <jarkko.suontausta> |
Component: | general | Assignee: | Cornelius Schumacher <schumacher> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Jarkko Suontausta
2004-08-13 13:08:01 UTC
Which resource shows the problem? It's a "Calendar in local file" type of resource. Was this the answer you were looking for? Yes, some resources (e.g. the remote resource) check for the read-only flag, some don't (e.g. the local resource). We should probably add a check in ResourceCalendar::save(). It really becomes a problem, if you set the auto-save-in-x-minutes to 10 minutes or so... Had to click through about a hundred of error dialogs when kontact was left running overnight :) Yeah, had to do the same this morning. CVS commit by kainhofe: Don't even try to save read-only resources by default. So far, you couldn't edit the incidences in these resources, but everything was still written out to disk anew on exit. That just didn't make sense and was a waste of resources... CCMAIL: 87116-done@bugs.kde.org M +11 -5 resourcecalendar.cpp 1.17 --- kdepim/libkcal/resourcecalendar.cpp #1.16:1.17 @@ -125,4 +125,5 @@ void ResourceCalendar::loadError( const bool ResourceCalendar::save() { + if ( !readOnly() ) { kdDebug(5800) << "Save resource " + resourceName() << endl; @@ -133,4 +134,9 @@ bool ResourceCalendar::save() return success; + } else { + // Read-only, just don't save... + kdDebug(5800) << "Don't save read-only resource " + resourceName() << endl; + return true; + } } Great, thank you! This makes it possible to uncheck a read-only resource from the list (previously KO would abort the unchecking because it couldn't save the resource). And obviously the fact that a read-only resource will not be modified unknowingly is a welcomed fix :) Could you please backport this? CVS commit by kainhofe: Backport of fixes for bugs 87327 (directory for local dir resource was never automatically created, and all data of that resource was just lost) and 87116 (read-only resources were also saved, causing error message boxes if the file wasn't writable). CCMAIL: 87327@bugs.kde.org, 87116@bugs.kde.org M +11 -5 resourcecalendar.cpp 1.15.2.1 M +31 -20 resourcelocaldir.cpp 1.21.2.1 --- kdepim/libkcal/resourcecalendar.cpp #1.15:1.15.2.1 @@ -114,4 +114,5 @@ void ResourceCalendar::loadError( const bool ResourceCalendar::save() { + if ( !readOnly() ) { kdDebug(5800) << "Save resource " + resourceName() << endl; @@ -122,4 +123,9 @@ bool ResourceCalendar::save() return success; + } else { + // Read-only, just don't save... + kdDebug(5800) << "Don't save read-only resource " + resourceName() << endl; + return true; + } } --- kdepim/libkcal/resourcelocaldir.cpp #1.21:1.21.2.1 @@ -30,4 +30,5 @@ #include <klocale.h> #include <kurl.h> +#include <kstandarddirs.h> #include "vcaldrag.h" @@ -126,6 +127,15 @@ bool ResourceLocalDir::doLoad() mCalendar.close(); + bool success = true; QString dirName = mURL.path(); + if ( !KStandardDirs::exists( dirName ) ) { + kdDebug(5800) << "ResourceLocalDir::load(): Directory doesn't exist yet. Creating it..." << endl; + + // Create the directory. Use 0775 to allow group-writable if the umask + // allows it (permissions will be 0775 & ~umask). This is desired e.g. for + // group-shared directories! + success = KStandardDirs::makeDir( dirName, 0775 ); + } else { kdDebug(5800) << "ResourceLocalDir::load(): '" << dirName << "'" << endl; @@ -148,6 +158,7 @@ bool ResourceLocalDir::doLoad() if ( i ) mCalendar.addIncidence( i->clone() ); } + } - return true; + return success; } |