Summary: | prompt when syncing with empty calendar file path | ||
---|---|---|---|
Product: | [Applications] kpilot | Reporter: | Will Stephenson <wstephenson> |
Component: | Calendar Conduit | Assignee: | Reinhold Kainhofer <reinhold> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Will Stephenson
2003-03-18 23:02:06 UTC
In kde 3.2 by default it uses the system calendar, but you can also specify a file to sync with. This makes the bug less critical, but I will still add such a question when the user chooses to sync to a file, but doesn't provide a valid file name. Subject: kdepim/kpilot/conduits/vcalconduit CVS commit by kainhofe: If the user chose to sync to an iCalendar file instead of the standard (resource) calendar, and he gave an empty or invalid file name, an error message is now written out to inform him/her about the problem. I don't want to ask him for a file name, because one of the guidelines of conduit development is that a sync should be able to run without user intervention. This should probably also be backported, but it introduces two new i18n strings, so it is not possible. Thus the bug will remain in 3.1 branch. CCMAIL: 56117-done@bugs.kde.org M +22 -5 vcal-conduitbase.cc 1.44 --- kdepim/kpilot/conduits/vcalconduit/vcal-conduitbase.cc #1.43:1.44 @@ -38,4 +38,5 @@ static const char *vcalconduitbase_id = #include <qdatetime.h> #include <qtimer.h> +#include <qfile.h> #include <pilotUser.h> @@ -179,7 +180,6 @@ there are two special cases: a full and // TODO: Check Full sync and First sync - if (!openDatabases(dbname(), &fFirstSync) ) goto error; if (!openCalendar() ) goto error; - + if (!openDatabases(dbname(), &fFirstSync) ) goto error; preSync(); @@ -258,7 +258,13 @@ error: DEBUGCONDUIT<<"Using CalendarLocal!"<<endl; #endif + if (fCalendarFile.isEmpty() ) + { +#ifdef DEBUG + DEBUGCONDUIT<<"empty calendar file name, cannot open"<<endl; +#endif + emit logError(i18n("You selected to sync with the a iCalendar file, but did not give a filename. Please select a valid file name in the conduit's configuration dialog")); + return false; + } fCalendar = new KCal::CalendarLocal(tz); -/* fCalendar = new KCal::CalendarLocal(); - fCalendar->setLocalTime();*/ if ( !fCalendar) { @@ -279,4 +285,15 @@ error: DEBUGCONDUIT << "calendar file "<<fCalendarFile<<" could not be opened. Will create a new one"<<endl; #endif + // Try to create an empty file. if that fails, no vallid file name was given. + QFile fl(fCalendarFile); + if (!fl.open(IO_WriteOnly | IO_Append)) + { +#ifdef DEBUG + DEBUGCONDUIT<<"Invalid calendar file name "<<fCalendarFile<<endl; +#endif + emit logError(i18n("You chose to sync with the file \"%1\", which cannot be opened or created. Please make sure to supply a valid file name in the conduit's configuration dialog. Aborting the conduit.").arg(fCalendarFile)); + return false; + } + fl.close(); fFirstSync=true; } |