Bug 56117 - prompt when syncing with empty calendar file path
Summary: prompt when syncing with empty calendar file path
Status: RESOLVED FIXED
Alias: None
Product: kpilot
Classification: Applications
Component: Calendar Conduit (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Reinhold Kainhofer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-18 23:02 UTC by Will Stephenson
Modified: 2003-07-30 01:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Will Stephenson 2003-03-18 23:02:06 UTC
Version:           4.3.9 (BRANCH) (using KDE KDE 3.1)
Installed from:    Compiled From Sources
OS:          Linux

While getting started with my new visor, it took me a while to realise that I had to manually enter the path to my calendar file for the Todo and Calendar conduits before they would work correctly.  It would be nice if they either 

i) assumed that the calendar that Korganizer uses is the one you want to sync by default (problematic for people with big shared calendars I expect)

ii) prompted the user to enter these upon first sync if left empty.

iii) as a last resort, the conduits could just say this is why they were unable to run in the output window.

regards

Will
Comment 1 Reinhold Kainhofer 2003-07-27 13:48:08 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. 
Comment 2 Reinhold Kainhofer 2003-07-30 01:27:08 UTC
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;
                         }