[Korganizer-devel] [Bug 77223] When creating new calendar item, should auto-upload free/busy

Bruno Virlet bruno.virlet at gmail.com
Mon Jul 23 18:35:26 CEST 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=77223         
bruno.virlet gmail com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From bruno.virlet gmail com  2007-07-23 18:35 -------
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* );


More information about the Korganizer-devel mailing list