summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-11-25 17:41:25 (UTC)
committer zautrix <zautrix>2005-11-25 17:41:25 (UTC)
commit279e183c0325cd9565605f60af0215bb9bfdc825 (patch) (side-by-side diff)
tree43ab776cd108874819e7c6e73070a7d989a9078f /korganizer
parent794a5204686ad9bfc16172b01db35f1f3b7683e5 (diff)
downloadkdepimpi-279e183c0325cd9565605f60af0215bb9bfdc825.zip
kdepimpi-279e183c0325cd9565605f60af0215bb9bfdc825.tar.gz
kdepimpi-279e183c0325cd9565605f60af0215bb9bfdc825.tar.bz2
sync
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp73
-rw-r--r--korganizer/calendarview.h4
-rw-r--r--korganizer/mainwindow.cpp14
-rw-r--r--korganizer/mainwindow.h4
4 files changed, 78 insertions, 17 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8965d3b..307027a 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -368,2 +368,3 @@ void CalendarView::init()
{
+ mMultiResourceSync = false;
flag_blockConflict = false;
@@ -1554,2 +1555,3 @@ Event* CalendarView::getLastSyncEvent()
lse->setReadOnly( true );
+ lse->setCalID( 1 );
mCalendar->addEvent( lse );
@@ -1904,12 +1906,17 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
- eventLSync->setReadOnly( false );
- eventLSync->setDtStart( mLastCalendarSync );
- eventRSync->setDtStart( mLastCalendarSync );
- eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
- eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
- eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
- eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
- eventLSync->setReadOnly( true );
+ if ( mMultiResourceSync ) {
+ remote->removeSyncInfo( "" ); //all
+
+ } else {
+ eventLSync->setReadOnly( false );
+ eventLSync->setDtStart( mLastCalendarSync );
+ eventRSync->setDtStart( mLastCalendarSync );
+ eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
+ eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
+ eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
+ eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
+ eventLSync->setReadOnly( true );
+ }
qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL );
- if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
+ if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop() && !mMultiResourceSync ) // kde is abnormal...
remote->addEvent( eventRSync );
@@ -2437,2 +2444,28 @@ void CalendarView::mergeFile( QString fn )
}
+void CalendarView::mergeFileResource( QString fn ,QString resource )
+{
+
+ if ( resource == "ALL" ) {
+ mergeFile( fn );
+ return;
+ }
+
+ int exclusiveResource = KOPrefs::instance()->getFuzzyCalendarID( resource );
+ if ( !exclusiveResource ) {
+ qDebug("KO: CalendarView::mergeFileResource: resource not found %s", resource.latin1() );
+ return;
+ }
+ clearAllViews();
+ mCalendar->setCalendarRemove( exclusiveResource );
+ int def = mCalendar->defaultCalendar();
+ mCalendar->setDefaultCalendar(exclusiveResource);
+ if ( !mCalendar->addCalendarFile( fn, exclusiveResource )) {
+ qDebug("KO: CalendarView::mergeFileResource: error adding file %s", fn.latin1() );
+ }
+ mCalendar->setDefaultCalendar( def );
+ mCalendar->reInitAlarmSettings();
+ setSyncEventsReadOnly();
+ updateUnmanagedViews();
+ updateView();
+}
void CalendarView::showOpenError()
@@ -2524,2 +2557,3 @@ bool CalendarView::checkFileVersion(QString fn)
mSyncManager->mShowSyncSummary = false;
+ mMultiResourceSync = false;
syncCalendar( fn, 3 );
@@ -2560,2 +2594,19 @@ bool CalendarView::saveCalendars()
}
+bool CalendarView::saveCalendarResource(QString filename, QString resource)
+{
+ if ( resource == "ALL" )
+ return saveCalendar( filename );
+ int exclusiveResource = KOPrefs::instance()->getFuzzyCalendarID( resource );
+ if ( !exclusiveResource ) {
+ qDebug("KO: CalendarView::saveCalendarResource: resource not found %s", resource.latin1() );
+ return false;
+ }
+ mCalendar->setDefaultCalendar( exclusiveResource );
+ mCalendar->setDefaultCalendarEnabledOnly();
+ mCalendar->setSyncEventsEnabled();
+ bool res = saveCalendar( filename );
+ restoreCalendarSettings();
+ return res;
+
+}
bool CalendarView::saveCalendar( QString filename )
@@ -5034,3 +5085,7 @@ void CalendarView::keyPressEvent ( QKeyEvent *e)
+void CalendarView::multiResourceSyncStart( bool start )
+{
+ mMultiResourceSync = start;
+}
bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource)
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index f85b6a3..60b1276 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -141,2 +141,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void mergeFile( QString fn );
+ void mergeFileResource( QString fn ,QString res);
@@ -203,2 +204,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
public slots:
+ void multiResourceSyncStart( bool );
void displayCalendarInfo( int id );
@@ -248,2 +250,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
bool saveCalendar(QString filename);
+ bool saveCalendarResource(QString filename, QString resource);
@@ -541,2 +544,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
protected:
+ bool mMultiResourceSync;
Event *mConflictingEvent;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 66bb19b..69ccde1 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -376,4 +376,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
- connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
- connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
+ connect(mSyncManager , SIGNAL( request_file(const QString &) ), this, SLOT( syncFileRequest(const QString &) ) );
+ connect(mSyncManager , SIGNAL( getFile( bool, const QString &)), this, SLOT(getFile( bool,const QString & ) ) );
+ connect(mSyncManager , SIGNAL( multiResourceSyncStart( bool )), mView, SLOT( multiResourceSyncStart( bool ) ) );
+
mSyncManager->setDefaultFileName( sentSyncFile());
@@ -2706,3 +2708,3 @@ QString MainWindow::sentSyncFile()
-void MainWindow::syncFileRequest()
+void MainWindow::syncFileRequest(const QString& resource)
{
@@ -2718,3 +2720,3 @@ void MainWindow::syncFileRequest()
setCaption(i18n("Saving Data to temp file ..." ));
- mView->saveCalendar( sentSyncFile() );
+ mView->saveCalendarResource( sentSyncFile(), resource );
setCaption(i18n("Data saved to temp file!" ));
@@ -2723,3 +2725,3 @@ void MainWindow::syncFileRequest()
}
-void MainWindow::getFile( bool success )
+void MainWindow::getFile( bool success ,const QString& resource)
{
@@ -2729,3 +2731,3 @@ void MainWindow::getFile( bool success )
}
- mView->mergeFile( sentSyncFile() );
+ mView->mergeFileResource( sentSyncFile(), resource);
if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index d8018b6..a533d8b 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -112,4 +112,4 @@ class MainWindow : public QMainWindow
void showConfigureAgenda();
- void getFile( bool );
- void syncFileRequest();
+ void getFile( bool ,const QString &);
+ void syncFileRequest(const QString &);