Bug 85630

Summary: Korganizer is unable to get freebusy information from an eGroupware server
Product: [Applications] korganizer Reporter: dpavlotzky
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: bvirlet, tuju, wstephenson
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description dpavlotzky 2004-07-21 16:42:31 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.3.3 
OS:                Linux

Hi,

When I try to schedule a meeting and want to view the freebusy information of the attendees (last tab) the information in not retreived from the eGroupware server.

When I press the reload button the debug output in my konsole reads:

...
kontact: KOEditorFreeBusy::reload()
kontact: FreeBusyManager::retrieveFreeBusy(): dpavlotzky@cleverinsert.com
kabc: StdAddressBook::self()
kontact: FreeBusyManager::loadFreeBusy(): dpavlotzky@cleverinsert.com
kontact: FreeBusyManager::loadFreeBusy() /home/kdetest/.kdecvs/share/apps/korganizer/freebusy/dpavlotzky@cleverinsert.com.ifb doesn't exist.

This is correct since I want to load the freebusy information from the eGroupware server.

Double clicking the name of the attendee pops up the "Edit Free/Busy Location" dialog and the debug output on the konsole reads:

...
kontact: FreeBusyUrlWidget::loadConfig()

I enter the location of the free/busy information again and press ok. The dialog doesn't go away. I have to hit ok another time to get rid of it.

Debug output of the first ok:

...
kontact: FreeBusyUrlWidget::saveConfig()
kontact: FreeBusyUrlWidget::loadConfig()

And the second ok:

kontact: FreeBusyUrlWidget::saveConfig()

The information I put into the dialog is saved indeed. I can change it and the widget will remember it, but hitting reload show me the same message about the not existing calendar file:

kontact: KOEditorFreeBusy::reload()
kontact: FreeBusyManager::retrieveFreeBusy(): dpavlotzky@cleverinsert.com
kabc: StdAddressBook::self()
kontact: FreeBusyManager::loadFreeBusy(): dpavlotzky@cleverinsert.com
kontact: FreeBusyManager::loadFreeBusy() /home/kdetest/.kdecvs/share/apps/korganizer/freebusy/dpavlotzky@cleverinsert.com.ifb doesn't exist.


So it's not picked up by the FreeBusyManager...

kind regards,

David Pavlotzky
Comment 1 Vincent Barberet 2004-09-03 11:22:35 UTC
I've quite the same problem:

I can retrieve my free/busy information
I cannot retrive free/busy information from other attendees

Regards,
Vincent
Comment 2 Reinhold Kainhofer 2006-11-02 18:56:12 UTC
Reassigning all KOrganizer bug reports and wishes to the newly created 
korganizer-devel mailing list.
Comment 3 Bruno Virlet 2007-07-19 16:39:30 UTC
In the config, Free/Busy, retrieve tab, is the checkbox 'Retrieve other peoples' free/busy information automatically' checked ?

If not and if you check it, does it change anything ?
Comment 4 Bruno Virlet 2007-07-23 18:35:25 UTC
SVN commit 691427 by bvirlet:

Fix various free/busy upload and download bugs, fixes a crash.

Fixes novell bugs : 274438 and 274476

BUG: 77223
BUG: 85630
BUG: 111419


 M  +8 -2      freebusymanager.cpp  
 M  +1 -1      freebusymanager.h  
 M  +24 -9     koeditorfreebusy.cpp  
 M  +7 -2      koeditorfreebusy.h  
 M  +20 -3     kogroupware.cpp  
 M  +8 -0      kogroupware.h  


--- branches/KDE/3.5/kdepim/korganizer/freebusymanager.cpp #691426:691427
@@ -225,6 +225,12 @@
             "</qt>" ), i18n("No Free/Busy Upload URL") );
     return;
   }
+  if ( !targetURL.isValid() ) {
+     KMessageBox::sorry( 0,
+      i18n( "<qt>The target URL '%1' provided is invalid."
+            "</qt>" ).arg( targetURL.prettyURL() ), i18n("Invalid URL") );
+    return;
+  }
   targetURL.setUser( KOPrefs::instance()->mFreeBusyPublishUser );
   targetURL.setPass( KOPrefs::instance()->mFreeBusyPublishPassword );
 
@@ -325,7 +331,7 @@
     mUploadingFreeBusy = false;
 }
 
-bool FreeBusyManager::retrieveFreeBusy( const QString &email )
+bool FreeBusyManager::retrieveFreeBusy( const QString &email, bool forceDownload )
 {
   kdDebug(5850) << "FreeBusyManager::retrieveFreeBusy(): " << email << endl;
   if ( email.isEmpty() ) return false;
@@ -344,7 +350,7 @@
   }
 
   // Don't download free/busy if the user does not want it.
-  if( !KOPrefs::instance()->mFreeBusyRetrieveAuto )
+  if( !KOPrefs::instance()->mFreeBusyRetrieveAuto && !forceDownload)
     return false;
 
   mRetrieveQueue.append( email );
--- branches/KDE/3.5/kdepim/korganizer/freebusymanager.h #691426:691427
@@ -94,7 +94,7 @@
 
       Return true if a download is initiated, and false otherwise
     */
-    bool retrieveFreeBusy( const QString &email );
+    bool retrieveFreeBusy( const QString &email, bool forceDownload );
 
     void cancelRetrieval();
 
--- branches/KDE/3.5/kdepim/korganizer/koeditorfreebusy.cpp #691426:691427
@@ -91,10 +91,10 @@
     void setUpdateTimerID( int id ) { mTimerID = id; }
     int updateTimerID() const { return mTimerID; }
 
-    void startDownload() {
+    void startDownload( bool forceDownload ) {
       mIsDownloading = true;
       FreeBusyManager *m = KOGroupware::instance()->freeBusyManager();
-      if ( !m->retrieveFreeBusy( attendee()->email() ) )
+      if ( !m->retrieveFreeBusy( attendee()->email(), forceDownload ) )
         mIsDownloading = false;
     }
     void setIsDownloading( bool d ) { mIsDownloading = d; }
@@ -199,7 +199,7 @@
   QWhatsThis::add( label, whatsThis );
   controlLayout->addWidget( label );
 
-  scaleCombo = new QComboBox( this ); 
+  scaleCombo = new QComboBox( this );
   QWhatsThis::add( scaleCombo, whatsThis );
   scaleCombo->insertItem( i18n( "Hour" ) );
   scaleCombo->insertItem( i18n( "Day" ) );
@@ -241,7 +241,7 @@
 		   i18n("Reloads Free/Busy data for all attendees from "
 		   	"the corresponding servers.") );
   controlLayout->addWidget( button );
-  connect( button, SIGNAL( clicked() ), SLOT( reload() ) );
+  connect( button, SIGNAL( clicked() ), SLOT( manualReload() ) );
 
   mGanttView = new KDGanttView( this, "mGanttView" );
   QWhatsThis::add( mGanttView,
@@ -290,7 +290,7 @@
   connect( m, SIGNAL( freeBusyRetrieved( KCal::FreeBusy *, const QString & ) ),
            SLOT( slotInsertFreeBusy( KCal::FreeBusy *, const QString & ) ) );
 
-  connect( &mReloadTimer, SIGNAL( timeout() ), SLOT( reload() ) );
+  connect( &mReloadTimer, SIGNAL( timeout() ), SLOT( autoReload() ) );
 }
 
 KOEditorFreeBusy::~KOEditorFreeBusy()
@@ -401,12 +401,11 @@
 
 void KOEditorFreeBusy::timerEvent( QTimerEvent* event )
 {
-  killTimer( event->timerId() );
   FreeBusyItem *item = static_cast<FreeBusyItem *>( mGanttView->firstChild() );
   while( item ) {
     if( item->updateTimerID() == event->timerId() ) {
       item->setUpdateTimerID( 0 );
-      item->startDownload();
+      item->startDownload( mForceDownload );
       return;
     }
     item = static_cast<FreeBusyItem *>( item->nextSibling() );
@@ -466,7 +465,7 @@
   if( success ) {
     if ( start == mDtStart && end == mDtEnd ) {
       KMessageBox::information( this,
-          i18n( "The meeting already has suitable start/end times." ), QString::null, 
+          i18n( "The meeting already has suitable start/end times." ), QString::null,
           "MeetingTimeOKFreeBusy" );
     } else {
       emit dateTimesChanged( start, end );
@@ -631,13 +630,29 @@
   mReloadTimer.stop();
 }
 
+void KOEditorFreeBusy::manualReload()
+{
+  mForceDownload = true;
+  reload();
+}
+
+void KOEditorFreeBusy::autoReload()
+{
+  mForceDownload = false;
+  reload();
+}
+
 void KOEditorFreeBusy::reload()
 {
   kdDebug(5850) << "KOEditorFreeBusy::reload()" << endl;
 
   FreeBusyItem *item = static_cast<FreeBusyItem *>( mGanttView->firstChild() );
   while( item ) {
-    updateFreeBusyData( item );
+    if (  mForceDownload )
+      item->startDownload( mForceDownload );
+    else
+      updateFreeBusyData( item );
+
     item = static_cast<FreeBusyItem *>( item->nextSibling() );
   }
 }
--- branches/KDE/3.5/kdepim/korganizer/koeditorfreebusy.h #691426:691427
@@ -77,7 +77,10 @@
     void slotZoomToTime();
     void slotPickDate();
 
-    void reload();
+    // Force the download of FB informations
+    void manualReload();
+    // Only download FB if the auto-download option is set in config
+    void autoReload();
 
   protected:
     void timerEvent( QTimerEvent* );
@@ -90,7 +93,7 @@
     bool tryDate( FreeBusyItem *attendee,
                   QDateTime &tryFrom, QDateTime &tryTo );
     void updateStatusSummary();
-
+    void reload();
     KDGanttView *mGanttView;
     QLabel *mStatusSummaryLabel;
     bool mIsOrganizer;
@@ -99,6 +102,8 @@
     QDateTime mDtStart, mDtEnd;
 
     QTimer mReloadTimer;
+
+    bool mForceDownload;
 };
 
 #endif
--- branches/KDE/3.5/kdepim/korganizer/kogroupware.cpp #691426:691427
@@ -87,17 +87,34 @@
   incomingDirChanged( locateLocal( "data", "korganizer/income.tentative/" ) );
   incomingDirChanged( locateLocal( "data", "korganizer/income.cancel/" ) );
   incomingDirChanged( locateLocal( "data", "korganizer/income.reply/" ) );
-}
 
-FreeBusyManager *KOGroupware::freeBusyManager()
-{
   if ( !mFreeBusyManager ) {
     mFreeBusyManager = new FreeBusyManager( this, "freebusymanager" );
     mFreeBusyManager->setCalendar( mCalendar );
     connect( mCalendar, SIGNAL( calendarChanged() ),
              mFreeBusyManager, SLOT( slotPerhapsUploadFB() ) );
+    connect( mView, SIGNAL( newIncidenceChanger( IncidenceChangerBase* ) ),
+             this, SLOT( slotViewNewIncidenceChanger( IncidenceChangerBase* ) ) );
+    slotViewNewIncidenceChanger( mView->incidenceChanger() );
   }
 
+}
+
+void KOGroupware::slotViewNewIncidenceChanger( IncidenceChangerBase* changer )
+{
+    // Call slot perhapsUploadFB if an incidence was added, changed or removed
+    connect( changer, SIGNAL( incidenceAdded( Incidence* ) ),
+             mFreeBusyManager, SLOT( slotPerhapsUploadFB() ) );
+    connect( changer, SIGNAL( incidenceChanged( Incidence*, Incidence*, int ) ),
+             mFreeBusyManager, SLOT( slotPerhapsUploadFB() ) );
+    connect( changer, SIGNAL( incidenceChanged( Incidence*, Incidence* ) ),
+             mFreeBusyManager, SLOT( slotPerhapsUploadFB() ) ) ;
+    connect( changer, SIGNAL( incidenceDeleted( Incidence * ) ),
+             mFreeBusyManager, SLOT( slotPerhapsUploadFB() ) );
+}
+
+FreeBusyManager *KOGroupware::freeBusyManager()
+{
   return mFreeBusyManager;
 }
 
--- branches/KDE/3.5/kdepim/korganizer/kogroupware.h #691426:691427
@@ -53,6 +53,12 @@
 class CalendarView;
 class FreeBusyManager;
 
+namespace KOrg {
+class IncidenceChangerBase;
+}
+
+using namespace KOrg;
+
 class KOGroupware : public QObject
 {
     Q_OBJECT
@@ -80,6 +86,8 @@
     /** Handle iCals given by KMail. */
     void incomingDirChanged( const QString& path );
 
+    /** Updates some slot connections when the view incidence changer changes */
+    void slotViewNewIncidenceChanger( IncidenceChangerBase* changer );
   protected:
     KOGroupware( CalendarView*, KCal::CalendarResources* );
 
Comment 5 Will Stephenson 2007-08-14 19:12:00 UTC
SVN commit 700059 by wstephens:

Port dependent commits 691427 and 691750 by bruno.virlet@gmail.com to enterprise
branch.  
Fixes Novell bugs 274438 and 274476.
CCBUG:77223
CCBUG:85630
CCBUG:111419


 M  +3 -0      actionmanager.cpp  
 M  +18 -3     freebusymanager.cpp  
 M  +9 -1      freebusymanager.h  
 M  +22 -7     koeditorfreebusy.cpp  
 M  +7 -2      koeditorfreebusy.h  
 M  +16 -0     kogroupware.cpp  
 M  +8 -0      kogroupware.h  


--- branches/kdepim/enterprise/kdepim/korganizer/actionmanager.cpp #700058:700059
@@ -43,6 +43,7 @@
 #include "importdialog.h"
 #include "eventarchiver.h"
 #include "stdcalendar.h"
+#include "freebusymanager.h"
 
 #include <libkcal/calendarlocal.h>
 #include <libkcal/calendarresources.h>
@@ -1264,6 +1265,8 @@
 
   if ( mResourceView )
     mResourceView->updateView();
+
+  KOGroupware::instance()->freeBusyManager()->setBrokenUrl( false );
 }
 
 void ActionManager::setDestinationPolicy()
--- branches/kdepim/enterprise/kdepim/korganizer/freebusymanager.cpp #700058:700059
@@ -117,7 +117,8 @@
 
 FreeBusyManager::FreeBusyManager( QObject *parent, const char *name )
   : QObject( parent, name ),
-    mCalendar( 0 ), mTimerID( 0 ), mUploadingFreeBusy( false )
+    mCalendar( 0 ), mTimerID( 0 ), mUploadingFreeBusy( false ),
+    mBrokenUrl( false )
 {
 }
 
@@ -207,6 +208,11 @@
   publishFreeBusy();
 }
 
+void FreeBusyManager::setBrokenUrl( bool isBroken )
+{
+  mBrokenUrl = isBroken;
+}
+
 /*!
   This method is called when the user has selected to publish its
   free/busy list or when the delay have passed.
@@ -226,6 +232,15 @@
             "</qt>" ), i18n("No Free/Busy Upload URL") );
     return;
   }
+  if ( mBrokenUrl ) // Url is invalid, don't try again
+    return;
+  if ( !targetURL.isValid() ) {
+     KMessageBox::sorry( 0,
+      i18n( "<qt>The target URL '%1' provided is invalid."
+            "</qt>" ).arg( targetURL.prettyURL() ), i18n("Invalid URL") );
+    mBrokenUrl = true;
+    return;
+  }
   targetURL.setUser( KOPrefs::instance()->mFreeBusyPublishUser );
   targetURL.setPass( KOPrefs::instance()->mFreeBusyPublishPassword );
 
@@ -326,7 +341,7 @@
     mUploadingFreeBusy = false;
 }
 
-bool FreeBusyManager::retrieveFreeBusy( const QString &email )
+bool FreeBusyManager::retrieveFreeBusy( const QString &email, bool forceDownload )
 {
   kdDebug(5850) << "FreeBusyManager::retrieveFreeBusy(): " << email << endl;
   if ( email.isEmpty() ) return false;
@@ -338,7 +353,7 @@
   }
 
   // Don't download free/busy if the user does not want it.
-  if( !KOPrefs::instance()->mFreeBusyRetrieveAuto ) {
+  if( !KOPrefs::instance()->mFreeBusyRetrieveAuto && !forceDownload) {
     slotFreeBusyDownloadError( email ); // fblist
     return false;
   }
--- branches/kdepim/enterprise/kdepim/korganizer/freebusymanager.h #700058:700059
@@ -95,7 +95,7 @@
 
       Return true if a download is initiated, and false otherwise
     */
-    bool retrieveFreeBusy( const QString &email );
+    bool retrieveFreeBusy( const QString &email, bool forceDownload );
 
     void cancelRetrieval();
 
@@ -121,6 +121,12 @@
     */
     QString freeBusyDir();
 
+    /**
+      Change the broken Url status
+      mBrokenUrl is used to show the 'broken url popup' only once
+     */
+    void setBrokenUrl( bool isBroken );
+
   public slots:
     // When something changed in the calendar, we get this called
     void slotPerhapsUploadFB();
@@ -166,6 +172,8 @@
     QDateTime mNextUploadTime;
     int mTimerID;
     bool mUploadingFreeBusy;
+    bool mBrokenUrl;
+
 };
 
 #endif
--- branches/kdepim/enterprise/kdepim/korganizer/koeditorfreebusy.cpp #700058:700059
@@ -94,10 +94,10 @@
     void setUpdateTimerID( int id ) { mTimerID = id; }
     int updateTimerID() const { return mTimerID; }
 
-    void startDownload() {
+    void startDownload( bool forceDownload ) {
       mIsDownloading = true;
       FreeBusyManager *m = KOGroupware::instance()->freeBusyManager();
-      if ( !m->retrieveFreeBusy( attendee()->email() ) )
+      if ( !m->retrieveFreeBusy( attendee()->email(), forceDownload ) )
         mIsDownloading = false;
     }
     void setIsDownloading( bool d ) { mIsDownloading = d; }
@@ -245,7 +245,7 @@
 		   i18n("Reloads Free/Busy data for all attendees from "
 		   	"the corresponding servers.") );
   controlLayout->addWidget( button );
-  connect( button, SIGNAL( clicked() ), SLOT( reload() ) );
+  connect( button, SIGNAL( clicked() ), SLOT( manualReload() ) );
 
   mGanttView = new KDGanttView( this, "mGanttView" );
   QWhatsThis::add( mGanttView,
@@ -302,7 +302,7 @@
   connect( m, SIGNAL( freeBusyRetrieved( KCal::FreeBusy *, const QString & ) ),
            SLOT( slotInsertFreeBusy( KCal::FreeBusy *, const QString & ) ) );
 
-  connect( &mReloadTimer, SIGNAL( timeout() ), SLOT( reload() ) );
+  connect( &mReloadTimer, SIGNAL( timeout() ), SLOT( autoReload() ) );
 }
 
 KOEditorFreeBusy::~KOEditorFreeBusy()
@@ -420,12 +420,11 @@
 
 void KOEditorFreeBusy::timerEvent( QTimerEvent* event )
 {
-  killTimer( event->timerId() );
   FreeBusyItem *item = static_cast<FreeBusyItem *>( mGanttView->firstChild() );
   while( item ) {
     if( item->updateTimerID() == event->timerId() ) {
       item->setUpdateTimerID( 0 );
-      item->startDownload();
+      item->startDownload( mForceDownload );
       return;
     }
     item = static_cast<FreeBusyItem *>( item->nextSibling() );
@@ -649,13 +648,29 @@
   mReloadTimer.stop();
 }
 
+void KOEditorFreeBusy::manualReload()
+{
+  mForceDownload = true;
+  reload();
+}
+
+void KOEditorFreeBusy::autoReload()
+{
+  mForceDownload = false;
+  reload();
+}
+
 void KOEditorFreeBusy::reload()
 {
   kdDebug(5850) << "KOEditorFreeBusy::reload()" << endl;
 
   FreeBusyItem *item = static_cast<FreeBusyItem *>( mGanttView->firstChild() );
   while( item ) {
-    updateFreeBusyData( item );
+    if (  mForceDownload )
+      item->startDownload( mForceDownload );
+    else
+      updateFreeBusyData( item );
+
     item = static_cast<FreeBusyItem *>( item->nextSibling() );
   }
 }
--- branches/kdepim/enterprise/kdepim/korganizer/koeditorfreebusy.h #700058:700059
@@ -78,7 +78,10 @@
     void slotZoomToTime();
     void slotPickDate();
 
-    void reload();
+    // Force the download of FB informations
+    void manualReload();
+    // Only download FB if the auto-download option is set in config
+    void autoReload();
     void slotIntervalColorRectangleMoved( const QDateTime& start, const QDateTime& end );
 
   protected:
@@ -92,7 +95,7 @@
     bool tryDate( FreeBusyItem *attendee,
                   QDateTime &tryFrom, QDateTime &tryTo );
     void updateStatusSummary();
-
+    void reload();
     KDGanttView *mGanttView;
     KDIntervalColorRectangle* mEventRectangle;
     QLabel *mStatusSummaryLabel;
@@ -102,6 +105,8 @@
     QDateTime mDtStart, mDtEnd;
 
     QTimer mReloadTimer;
+
+    bool mForceDownload;
 };
 
 #endif
--- branches/kdepim/enterprise/kdepim/korganizer/kogroupware.cpp #700058:700059
@@ -91,6 +91,19 @@
   incomingDirChanged( locateLocal( "data", "korganizer/income.delegated/" ) );
 }
 
+void KOGroupware::slotViewNewIncidenceChanger( IncidenceChangerBase* changer )
+{
+    // Call slot perhapsUploadFB if an incidence was added, changed or removed
+    connect( changer, SIGNAL( incidenceAdded( Incidence* ) ),
+             mFreeBusyManager, SLOT( slotPerhapsUploadFB() ) );
+    connect( changer, SIGNAL( incidenceChanged( Incidence*, Incidence*, int ) ),
+             mFreeBusyManager, SLOT( slotPerhapsUploadFB() ) );
+    connect( changer, SIGNAL( incidenceChanged( Incidence*, Incidence* ) ),
+             mFreeBusyManager, SLOT( slotPerhapsUploadFB() ) ) ;
+    connect( changer, SIGNAL( incidenceDeleted( Incidence * ) ),
+             mFreeBusyManager, SLOT( slotPerhapsUploadFB() ) );
+}
+
 FreeBusyManager *KOGroupware::freeBusyManager()
 {
   if ( !mFreeBusyManager ) {
@@ -98,6 +111,9 @@
     mFreeBusyManager->setCalendar( mCalendar );
     connect( mCalendar, SIGNAL( calendarChanged() ),
              mFreeBusyManager, SLOT( slotPerhapsUploadFB() ) );
+    connect( mView, SIGNAL( newIncidenceChanger( IncidenceChangerBase* ) ),
+             this, SLOT( slotViewNewIncidenceChanger( IncidenceChangerBase* ) ) );
+    slotViewNewIncidenceChanger( mView->incidenceChanger() );
   }
 
   return mFreeBusyManager;
--- branches/kdepim/enterprise/kdepim/korganizer/kogroupware.h #700058:700059
@@ -53,6 +53,12 @@
 class CalendarView;
 class FreeBusyManager;
 
+namespace KOrg {
+class IncidenceChangerBase;
+}
+
+using namespace KOrg;
+
 class KOGroupware : public QObject
 {
     Q_OBJECT
@@ -80,6 +86,8 @@
     /** Handle iCals given by KMail. */
     void incomingDirChanged( const QString& path );
 
+    /** Updates some slot connections when the view incidence changer changes */
+    void slotViewNewIncidenceChanger( IncidenceChangerBase* changer );
   protected:
     KOGroupware( CalendarView*, KCal::CalendarResources* );
 
Comment 6 Juha Tuomala 2007-08-14 19:15:21 UTC
What you mean by 'enterprise branch'?
Comment 7 Will Stephenson 2007-08-14 21:45:34 UTC
The so-called 'enterprise branch' is a branch of KDEPIM (KDE 3 based) which has a more restrictive commit policy, additional enterprise (mostly Kolab) features and extra QA.

It's used by some KDE resellers and openSUSE as their KDEPIM sources.

Having said that I'm not sure that this commit will help egroupware free-busy problems.

Bruno, are you sure this is the same bug?
Comment 8 Bruno Virlet 2007-08-15 09:49:39 UTC
Log and symptoms are exactly the same (it won't download the file automatically and so can't find the local file if you don't check the checkbox in the config), so yes, it's most probably the same bug.