summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp42
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/mainwindow.cpp8
3 files changed, 41 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 689618d..a7f7010 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -80,12 +80,13 @@
#include <libkcal/qtopiaformat.h>
#include "../kalarmd/alarmdialog.h"
#ifndef DESKTOP_VERSION
#include <libkcal/sharpformat.h>
#endif
+#include <libkcal/phoneformat.h>
#ifndef KORG_NOMAIL
#include "komailclient.h"
#endif
#ifndef KORG_NOPRINTER
#include "calprinter.h"
#endif
@@ -1172,27 +1173,41 @@ bool CalendarView::syncCalendar(QString filename, int mode)
if ( syncOK )
updateView();
return syncOK;
}
void CalendarView::syncPhone()
{
- qDebug("CalendarView::syncPhone() ");
+ syncExternal( 1 );
}
-void CalendarView::syncSharp()
+void CalendarView::syncExternal( int mode )
{
-#ifndef DESKTOP_VERSION
- mGlobalSyncMode = SYNC_MODE_EXTERNAL;
+ mGlobalSyncMode = SYNC_MODE_EXTERNAL;
//mCurrentSyncDevice = "sharp-DTM";
if ( KOPrefs::instance()->mAskForPreferences )
edit_sync_options();
qApp->processEvents();
CalendarLocal* calendar = new CalendarLocal();
calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
bool syncOK = false;
- SharpFormat sharpFormat;
- if ( sharpFormat.load( calendar, mCalendar ) ) {
+ boo loadSuccess = false;
+ PhoneFormat* phoneFormat = 0;
+#ifndef DESKTOP_VERSION
+ SharpFormat* sharpFormat = 0;
+ if ( mode == 0 ) { // sharp
+ sharpFormat = new SharpFormat () ;
+ loadSuccess = sharpFormat->load( calendar, mCalendar );
+
+ } else
+#endif
+ if ( mode == 1 ) { // phone
+ phoneFormat = new PhoneFormat ();
+ loadSuccess = phoneFormat->load( calendar, mCalendar );
+
+ } else
+ return;
+ if ( loadSuccess ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
qApp->processEvents();
if ( syncOK ) {
if ( KOPrefs::instance()->mWriteBackFile )
@@ -1202,14 +1217,18 @@ void CalendarView::syncSharp()
/* obsolete
while ( inc ) {
inc->setZaurusStat( inc->revision () );
inc = iL.next();
}
*/
- // pending: clean last sync event description
- sharpFormat.save(calendar);
+#ifndef DESKTOP_VERSION
+ if ( sharpFormat )
+ sharpFormat->save(calendar);
+#endif
+ if ( phoneFormat )
+ phoneFormat->save(calendar);
iL = calendar->rawIncidences();
inc = iL.first();
Incidence* loc;
while ( inc ) {
if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
loc = mCalendar->incidence(inc->uid() );
@@ -1235,13 +1254,18 @@ void CalendarView::syncSharp()
question, i18n("Ok")) ;
}
delete calendar;
updateView();
return ;//syncOK;
-#endif
+
+}
+void CalendarView::syncSharp()
+{
+ syncExternal( 0 );
+
}
#include <kabc/stdaddressbook.h>
bool CalendarView::importBday()
{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index b2838db..a3315ad 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -423,12 +423,13 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
bool importQtopia( const QString &categoriesFile,
const QString &datebookFile,
const QString &tasklistFile );
void syncSharp( );
void syncPhone( );
+ void syncExternal( int mode );
void slotSelectPickerDate( QDate ) ;
void showDatePicker( ) ;
void moveIncidence(Incidence *) ;
void beamIncidence(Incidence *) ;
void beamCalendar() ;
void beamFilteredCalendar() ;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 062c95f..cce182a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -997,13 +997,19 @@ void MainWindow::slotSyncMenu( int action )
} else if ( action >= 1003 ) {
if ( temp->getIsLocalFileSync() ) {
if ( syncWithFile( temp->getRemoteFileName( ), false ) )
KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
} else {
- syncRemote( temp );
+ if ( temp->getIsPhoneSync() ) {
+ KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
+ KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
+ KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
+ syncPhone();
+ } else
+ syncRemote( temp );
}
}
delete temp;
mBlockSaveFlag = false;
}