Bug 111419 - Publish free/busy list automatically doesn't work
Summary: Publish free/busy list automatically doesn't work
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: 3.3.2
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-24 14:16 UTC by Martin Koehn
Modified: 2007-08-14 19:12 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Koehn 2005-08-24 14:16:40 UTC
Version:           3.3.2 (using KDE KDE 3.3.2)
Installed from:    Compiled From Sources
Compiler:          gcc 3.2 
OS:                Linux

Hi,

the free/busy-lists are not published automatically even if i configure Korganizer to do. Using the menu "Upload Free Busy Infomation", the file is generated as it should be.

It seems to me that the FreeBusyManager doesn't start the relevant timer. Also, changes are not signaled to the FreeBusyManager.

Regards,
Martin Köhn
Comment 1 Martin Koehn 2005-08-31 09:09:24 UTC
Hi,

as extension: i also checked the latest version from the cvs (freebusymanager.cpp/.h). The problems should be the same as there are no changes in the relevant parts of the file.

Regards,
Martin Köhn
Comment 2 Reinhold Kainhofer 2006-11-02 19:24:40 UTC
Reassigning all KOrganizer bug reports and wishes to the newly created 
korganizer-devel mailing list.
Comment 3 Bruno Virlet 2007-07-23 18:35:23 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 4 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* );