Summary: | archive old events action not working | ||
---|---|---|---|
Product: | [Unmaintained] KOrganizer Mobile | Reporter: | Ludwig Reiter <ludwig.reiter> |
Component: | general | Assignee: | kdepim bugs <kdepim-bugs> |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | aheinecke, smartins, tokoe |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Windows CE | ||
OS: | Microsoft Windows CE | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Ludwig Reiter
2010-12-13 14:55:31 UTC
Opps, I have seen this action today. I need to test it. tested the archive function. version: 2010-12-15 svn-1206816 Archive dialog opens. But entering a file name and pressing on the archive button doesn't have an effect. Hej Ludwig, so the events that match the given date filter pattern are not archived to the file? Ciao, Tobias Clicking on the archive button doesn't have an effect. The dialog doesn't close and no archive is written. I need to press "Cancel" to close the dialog. (Entered a filename manually) One thing i noticed is that it can only be called if a subfolder is selected that might have lead to the initial "where is it" confusion. This means if you have a local Calendar ressources with no subfolders you can not select archive old entries from the menu. commit c5c727a06cd899ef9727e9a41b6529870524becd branch master Author: Andre Heinecke <aheinecke@intevation.de> Date: Wed Jan 12 12:02:23 2011 +0000 Don't call KSaveFile with an already open File On Windows Systems files can not be removed when there are open Handles to them. This breaks the way KTemporaryFile and KSaveFile interact in this case. When archivestore::save is called a KSaveFile is created by the Filename which was already opened by KTemporaryFile so the renaming fails. CCBUG: 259731 diff --git a/calendarsupport/eventarchiver.cpp b/calendarsupport/eventarchiver.cpp index 0a95f35..55d3280 100644 --- a/calendarsupport/eventarchiver.cpp +++ b/calendarsupport/eventarchiver.cpp @@ -176,10 +176,18 @@ void EventArchiver::archiveIncidences( CalendarSupport::Calendar *calendar, Cale CalendarSupport::CalendarAdaptor::Ptr cal( new CalendarSupport::CalendarAdaptor( calendar, widget ) ); FileStorage storage( cal ); + QString tmpFileName; + // KSaveFile can not be called with an open File Handle on Windows. + // So we use KTemporaryFile only to generate a unique filename + // and then close/delete the file again. This file must be deleted + // here. + { + KTemporaryFile tmpFile; + tmpFile.open(); + tmpFileName = tmpFile.fileName(); + } // Save current calendar to disk - KTemporaryFile tmpFile; - tmpFile.open(); - storage.setFileName( tmpFile.fileName() ); + storage.setFileName( tmpFileName ); if ( !storage.save() ) { kDebug() << "Can't save calendar to temp file"; return; @@ -190,11 +198,12 @@ void EventArchiver::archiveIncidences( CalendarSupport::Calendar *calendar, Cale new MemoryCalendar( CalendarSupport::KCalPrefs::instance()->timeSpec() ) ); FileStorage archiveStore( archiveCalendar ); - archiveStore.setFileName( tmpFile.fileName() ); + archiveStore.setFileName( tmpFileName ); ICalFormat *format = new ICalFormat(); archiveStore.setSaveFormat( format ); if ( !archiveStore.load() ) { kDebug() << "Can't load calendar from temp file"; + QFile::remove( tmpFileName ); return; } @@ -218,16 +227,18 @@ void EventArchiver::archiveIncidences( CalendarSupport::Calendar *calendar, Cale if ( KIO::NetAccess::exists( archiveURL, KIO::NetAccess::SourceSide, widget ) ) { if( !KIO::NetAccess::download( archiveURL, archiveFile, widget ) ) { kDebug() << "Can't download archive file"; + QFile::remove( tmpFileName ); return; } // Merge with events to be archived. archiveStore.setFileName( archiveFile ); if ( !archiveStore.load() ) { kDebug() << "Can't merge with archive file"; + QFile::remove( tmpFileName ); return; } } else { - archiveFile = tmpFile.fileName(); + archiveFile = tmpFileName; } // Save archive calendar @@ -240,6 +251,7 @@ void EventArchiver::archiveIncidences( CalendarSupport::Calendar *calendar, Cale } KMessageBox::error( widget, i18n( "Cannot write archive file %1. %2", archiveStore.fileName(), errmess ) ); + QFile::remove( tmpFileName ); return; } @@ -250,10 +262,12 @@ void EventArchiver::archiveIncidences( CalendarSupport::Calendar *calendar, Cale if ( !KIO::NetAccess::upload( archiveFile, archiveURL, widget ) ) { KMessageBox::error( widget, i18n( "Cannot write archive. %1", KIO::NetAccess::lastErrorString() ) ); + QFile::remove( tmpFileName ); return; } } + QFile::remove( tmpFileName ); KIO::NetAccess::removeTempFile( archiveFile ); // Delete archived events from calendar Tested on my development device i was able to archive old entries. test windows CE 2011-01-16 git-4d1bc61 archive many events with attendee doesn't work: The user is asked many times if he wants to send an update. The user should be asked once to send updates or not. Git commit 24891f2cbf64d11bf72ce7b14e2e3823d6c63773 by Sergio Martins Pushed by smartins into branch master Deleting a batch of incidences should be an atomic operation. Otherwise, When deleting 1000 events you'll be asked 1000 times if you want to send invitations. CCBUG: 259731 M +6 -1 calendarsupport/eventarchiver.cpp http://commits.kde.org/ee6cc38b/24891f2cbf64d11bf72ce7b14e2e3823d6c63773 Not working yet, need to fix another bug. Git commit 729312ee1310b9b910fbe6be7fd63cc468a86ba3 by Sergio Martins Pushed by smartins into branch master Only ask once to send invitations when batch removing them. BUG:259731 M +2 -0 calendarsupport/incidencechanger.cpp http://commits.kde.org/ee6cc38b/729312ee1310b9b910fbe6be7fd63cc468a86ba3 Both archiving in general and the update question work. |