summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp1
-rw-r--r--korganizer/calendarview.cpp136
-rw-r--r--korganizer/calendarview.h11
-rw-r--r--korganizer/koprefs.cpp3
-rw-r--r--korganizer/koprefs.h20
-rw-r--r--korganizer/mainwindow.cpp556
-rw-r--r--korganizer/mainwindow.h24
-rw-r--r--libkdepim/kpimprefs.cpp9
-rw-r--r--libkdepim/kpimprefs.h3
-rw-r--r--libkdepim/ksyncmanager.cpp166
-rw-r--r--libkdepim/ksyncmanager.h3
11 files changed, 186 insertions, 746 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 12502b0..c5406bf 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2886,2 +2886 @@ void KABCore::setCaptionBack()
}
-
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index ea9607d..b56f1f9 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -702,15 +702,3 @@ void CalendarView::confSync()
{
- static KSyncPrefsDialog* sp = 0;
- if ( ! sp ) {
- sp = new KSyncPrefsDialog( this, "syncprefs", true );
- }
- sp->usrReadConfig();
-#ifndef DESKTOP_VERSION
- sp->showMaximized();
-#else
- sp->show();
-#endif
- sp->exec();
- KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames();
- KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName ();
+ //DELETE
}
@@ -879,3 +867,3 @@ Event* CalendarView::getLastSyncEvent()
QString sum = "";
- if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
+ if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
sum = "E: ";
@@ -1121,3 +1109,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
} else {
- if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
+ if ( ! mSyncManager->mWriteBackExistingOnly ) {
inL->removeID(mCurrentSyncDevice );
@@ -1137,3 +1125,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
} else {
- if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
+ if ( ! mSyncManager->mWriteBackExistingOnly ) {
++addedEventR;
@@ -1149,3 +1137,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
int delFut = 0;
- if ( KOPrefs::instance()->mWriteBackInFuture ) {
+ if ( mSyncManager->mWriteBackInFuture ) {
er = remote->rawIncidences();
@@ -1154,3 +1142,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
- QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 );
+ QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
while ( inR ) {
@@ -1194,6 +1182,6 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
if ( delFut ) {
- delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture );
+ delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, mSyncManager->mWriteBackInFuture );
mes += delmess;
}
- if ( KOPrefs::instance()->mShowSyncSummary ) {
+ if ( mSyncManager->mShowSyncSummary ) {
KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
@@ -1227,3 +1215,3 @@ bool CalendarView::syncCalendar(QString filename, int mode)
if ( syncOK ) {
- if ( KOPrefs::instance()->mWriteBackFile )
+ if ( mSyncManager->mWriteBackFile )
{
@@ -1243,3 +1231,3 @@ void CalendarView::syncPhone()
{
- syncExternal( 1 );
+ //DELETE
}
@@ -1248,5 +1236,3 @@ void CalendarView::syncExternal( int mode )
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
- //mCurrentSyncDevice = "sharp-DTM";
- if ( KOPrefs::instance()->mAskForPreferences )
- edit_sync_options();
+
qApp->processEvents();
@@ -1267,5 +1253,5 @@ void CalendarView::syncExternal( int mode )
phoneFormat = new PhoneFormat (mCurrentSyncDevice,
- KOPrefs::instance()->mPhoneDevice,
- KOPrefs::instance()->mPhoneConnection,
- KOPrefs::instance()->mPhoneModel);
+ mSyncManager->mPhoneDevice,
+ mSyncManager->mPhoneConnection,
+ mSyncManager->mPhoneModel);
loadSuccess = phoneFormat->load( calendar,mCalendar);
@@ -1276,3 +1262,3 @@ void CalendarView::syncExternal( int mode )
getEventViewerDialog()->setSyncMode( true );
- syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
+ syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
@@ -1280,3 +1266,3 @@ void CalendarView::syncExternal( int mode )
if ( syncOK ) {
- if ( KOPrefs::instance()->mWriteBackFile )
+ if ( mSyncManager->mWriteBackFile )
{
@@ -1331,3 +1317,3 @@ void CalendarView::syncSharp()
{
- syncExternal( 0 );
+ //DELETE
@@ -1519,3 +1505,3 @@ bool CalendarView::importQtopia( const QString &categories,
mCurrentSyncDevice = "qtopia-XML";
- if ( KOPrefs::instance()->mAskForPreferences )
+ if ( mSyncManager->mAskForPreferences )
edit_sync_options();
@@ -1537,3 +1523,3 @@ bool CalendarView::importQtopia( const QString &categories,
getEventViewerDialog()->setSyncMode( true );
- syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
+ syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
@@ -1541,3 +1527,3 @@ bool CalendarView::importQtopia( const QString &categories,
if ( syncOK ) {
- if ( KOPrefs::instance()->mWriteBackFile )
+ if ( mSyncManager->mWriteBackFile )
{
@@ -1685,7 +1671,7 @@ bool CalendarView::checkFileVersion(QString fn)
setSyncDevice("deleteaftersync" );
- KOPrefs::instance()->mAskForPreferences = true;
- KOPrefs::instance()->mSyncAlgoPrefs = 3;
- KOPrefs::instance()->mWriteBackFile = false;
- KOPrefs::instance()->mWriteBackExistingOnly = false;
- KOPrefs::instance()->mShowSyncSummary = false;
+ mSyncManager->mAskForPreferences = true;
+ mSyncManager->mSyncAlgoPrefs = 3;
+ mSyncManager->mWriteBackFile = false;
+ mSyncManager->mWriteBackExistingOnly = false;
+ mSyncManager->mShowSyncSummary = false;
syncCalendar( fn, 3 );
@@ -2200,49 +2186,3 @@ void CalendarView::edit_sync_options()
{
- //mDialogManager->showSyncOptions();
- //KOPrefs::instance()->mSyncAlgoPrefs
- QDialog dia( this, "dia", true );
- dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
- QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
- QVBoxLayout lay ( &dia );
- lay.setSpacing( 2 );
- lay.setMargin( 3 );
- lay.addWidget(&gr);
- QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
- QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
- QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
- QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
- QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
- QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
- //QRadioButton both( i18n("Take both on conflict"), &gr );
- QPushButton pb ( "OK", &dia);
- lay.addWidget( &pb );
- connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
- switch ( KOPrefs::instance()->mSyncAlgoPrefs ) {
- case 0:
- loc.setChecked( true);
- break;
- case 1:
- rem.setChecked( true );
- break;
- case 2:
- newest.setChecked( true);
- break;
- case 3:
- ask.setChecked( true);
- break;
- case 4:
- f_loc.setChecked( true);
- break;
- case 5:
- f_rem.setChecked( true);
- break;
- case 6:
- // both.setChecked( true);
- break;
- default:
- break;
- }
- if ( dia.exec() ) {
- KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
- }
+ // DELETE
@@ -3770,4 +3710,24 @@ void CalendarView::keyPressEvent ( QKeyEvent *e)
-//#include "calendarview.moc"
-//#include "calendarviewbase.moc"
+bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
+{
+ // mSyncManager = manager;
+ mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
+ mCurrentSyncName = mSyncManager->getCurrentSyncName();
+ return syncCalendar( filename, mode );
+}
+bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
+{
+ //mSyncManager = manager;
+ mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
+ mCurrentSyncName = mSyncManager->getCurrentSyncName();
+ if ( resource == "sharp" )
+ syncExternal( 0 );
+ if ( resource == "phone" )
+ syncExternal( 1 );
+ // pending setmodified
+}
+void CalendarView::setSyncManager(KSyncManager* manager)
+{
+ mSyncManager = manager;
+}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 8d329a9..751b8d9 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -44,2 +44,4 @@
+#include <ksyncmanager.h>
+
class QWidgetStack;
@@ -79,3 +81,3 @@ using namespace KCal;
*/
-class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer
+class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
{
@@ -462,4 +464,8 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
// returns KMsgBox::yesNoCancel()
- int msgCalModified();
+ int msgCalModified();
+ virtual bool sync(KSyncManager* manager, QString filename, int mode);
+
+ virtual bool syncExternal(KSyncManager* manager, QString resource);
void confSync();
+ void setSyncManager(KSyncManager* manager);
void setLoadedFileVersion(QDateTime);
@@ -486,2 +492,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
private:
+ KSyncManager* mSyncManager;
AlarmDialog * mAlarmDialog;
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 1210094..13035e0 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -198,4 +198,2 @@ KOPrefs::KOPrefs() :
addItemInt("LastSyncTime",&mLastSyncTime,0);
- addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3);
- addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
@@ -219,3 +217,2 @@ KOPrefs::KOPrefs() :
addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
- addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index ff09e19..03df59b 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -196,25 +196,6 @@ class KOPrefs : public KPimPrefs
bool mUsePassWd;
- bool mWriteBackFile;
- int mWriteBackInFuture;
- bool mAskForPreferences;
- bool mShowSyncSummary;
bool mShowSyncEvents;
bool mShowTodoInAgenda;
- bool mWriteBackExistingOnly;
-
- QString mRemoteIP;
- QString mRemoteUser;
- QString mRemotePassWd;
- QString mRemoteFile;
- QString mLocalTempFile;
- QString mPhoneDevice;
- QString mPhoneConnection;
- QString mPhoneModel;
int mLastSyncTime;
- int mSyncAlgoPrefs;
- int mRingSyncAlgoPrefs;
- QStringList mSyncProfileNames;
- QStringList mExternSyncProfiles;
- QString mLocalMachineName;
void setCategoryColor(QString cat,const QColor & color);
@@ -232,3 +213,2 @@ class KOPrefs : public KPimPrefs
QString mLastLoadFile;
- QString mLastSyncedLocalFile;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index e3324ee..f7766f8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -128,3 +128,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
{
- mPassWordPiSync = "abc";
+
#ifdef DESKTOP_VERSION
@@ -144,6 +144,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
KPimGlobalPrefs::instance()->setGlobalConfig();
- // if ( QApplication::desktop()->height() > 480 ) {
-// if ( p->mHourSize == 4 )
-// p->mHourSize = 6;
-// }
if ( p->mHourSize > 18 )
@@ -168,3 +164,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
addToolBar (iconToolBar , tbd );
- mBlockSaveFlag = false;
mCalendarModifiedFlag = false;
@@ -183,3 +178,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
//mView->resize(splash->size() );
- initActions();
+ initActions();
+ mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
+ mSyncManager->setBlockSave(false);
+ mView->setSyncManager(mSyncManager);
#ifndef DESKTOP_VERSION
@@ -254,3 +252,13 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
//qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
- fillSyncMenu();
+ //fillSyncMenu();
+
+
+ connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
+ connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
+ connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
+ mSyncManager->setDefaultFileName( defaultFileName());
+ mSyncManager->fillSyncMenu();
+
+
+
mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
@@ -397,3 +405,3 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
else if ( msg == "-ringSync" ) {
- multiSync( false );
+ mSyncManager->multiSync( false );
}
@@ -942,230 +950,3 @@ void MainWindow::initActions()
}
-void MainWindow::fillSyncMenu()
-{
- if ( syncMenu->count() )
- syncMenu->clear();
- syncMenu->insertItem( i18n("Configure..."), 0 );
- syncMenu->insertSeparator();
- if ( mServerSocket == 0 ) {
- syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
- } else {
- syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
- }
- syncMenu->insertSeparator();
- syncMenu->insertItem( i18n("Multiple sync"), 1 );
- syncMenu->insertSeparator();
- KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
- config.setGroup("General");
- QStringList prof = config.readListEntry("SyncProfileNames");
- KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
- if ( prof.count() < 3 ) {
- prof.clear();
- prof << i18n("Sharp_DTM");
- prof << i18n("Local_file");
- prof << i18n("Last_file");
- KSyncProfile* temp = new KSyncProfile ();
- temp->setName( prof[0] );
- temp->writeConfig(&config);
- temp->setName( prof[1] );
- temp->writeConfig(&config);
- temp->setName( prof[2] );
- temp->writeConfig(&config);
- config.setGroup("General");
- config.writeEntry("SyncProfileNames",prof);
- config.writeEntry("ExternSyncProfiles","Sharp_DTM");
- config.sync();
- delete temp;
- }
- KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
- KOPrefs::instance()->mSyncProfileNames = prof;
- int i;
- for ( i = 0; i < prof.count(); ++i ) {
-
- syncMenu->insertItem( prof[i], 1000+i );
- if ( i == 2 )
- syncMenu->insertSeparator();
- }
- QDir app_dir;
- if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
- syncMenu->setItemEnabled( false , 1000 );
- }
-}
-
-int MainWindow::ringSync()
-{
- int syncedProfiles = 0;
- int i;
- QTime timer;
- KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
- QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
- KSyncProfile* temp = new KSyncProfile ();
- KOPrefs::instance()->mAskForPreferences = false;
- for ( i = 0; i < syncProfileNames.count(); ++i ) {
- mCurrentSyncProfile = i;
- temp->setName(syncProfileNames[mCurrentSyncProfile]);
- temp->readConfig(&config);
- if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
- setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
- ++syncedProfiles;
- // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
- KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
- KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
- KOPrefs::instance()->mWriteBackInFuture = 0;
- if ( temp->getWriteBackFuture() )
- KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
- KOPrefs::instance()->mShowSyncSummary = false;
- mView->setSyncDevice(syncProfileNames[i] );
- mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
- if ( i == 0 ) {
- syncSharp();
- } else {
- if ( temp->getIsLocalFileSync() ) {
- if ( syncWithFile( temp->getRemoteFileName( ), true ) )
- KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
- } else {
- if ( temp->getIsPhoneSync() ) {
- KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
- KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
- KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
- syncPhone();
- } else if ( temp->getIsPiSync() ) {
- mPassWordPiSync = temp->getRemotePw();
- KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
- KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
- syncPi();
- } else
- syncRemote( temp, false );
-
- }
- }
- timer.start();
- setCaption(i18n("Multiple sync in progress ... please wait!") );
- while ( timer.elapsed () < 2000 ) {
- qApp->processEvents();
-#ifndef _WIN32_
- sleep (1);
-#endif
- }
-
- }
-
- }
- delete temp;
- return syncedProfiles;
-}
-
-void MainWindow::multiSync( bool askforPrefs )
-{
- if (mBlockSaveFlag)
- return;
- mBlockSaveFlag = true;
- QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
- if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
- question,
- i18n("Yes"), i18n("No"),
- 0, 0 ) != 0 ) {
- mBlockSaveFlag = false;
- setCaption(i18n("Aborted! Nothing synced!"));
- return;
- }
- mView->setSyncDevice(i18n("Multiple profiles") );
- KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
- if ( askforPrefs ) {
- mView->edit_sync_options();
- KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
- }
- setCaption(i18n("Multiple sync started.") );
- qApp->processEvents();
- int num = ringSync() ;
- if ( num > 1 )
- ringSync();
- mBlockSaveFlag = false;
- if ( num )
- save();
- if ( num )
- setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
- else
- setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
- return;
-}
-void MainWindow::slotSyncMenu( int action )
-{
- qDebug("syncaction %d ", action);
- if ( action == 0 ) {
-
- // seems to be a Qt2 event handling bug
- // syncmenu.clear causes a segfault at first time
- // when we call it after the main event loop, it is ok
- // same behaviour when calling OM/Pi via QCOP for the first time
- QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
- //confSync();
- return;
- }
- if ( action == 1 ) {
- multiSync( true );
- return;
- }
- if ( action == 2 ) {
- enableQuick();
- QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
- return;
- }
- if ( action == 3 ) {
- delete mServerSocket;
- mServerSocket = 0;
- QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
- return;
- }
-
- if (mBlockSaveFlag)
- return;
- mBlockSaveFlag = true;
- mCurrentSyncProfile = action - 1000 ;
- mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
- mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
- KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
- KSyncProfile* temp = new KSyncProfile ();
- temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
- temp->readConfig(&config);
- KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
- KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
- KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
- KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
- KOPrefs::instance()->mWriteBackInFuture = 0;
- if ( temp->getWriteBackFuture() )
- KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
- KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
- if ( action == 1000 ) {
- syncSharp();
-
- } else if ( action == 1001 ) {
- syncLocalFile();
-
- } else if ( action == 1002 ) {
- quickSyncLocalFile();
-
- } else if ( action >= 1003 ) {
- if ( temp->getIsLocalFileSync() ) {
- if ( syncWithFile( temp->getRemoteFileName( ), false ) )
- KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
- } else {
- if ( temp->getIsPhoneSync() ) {
- KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
- KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
- KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
- syncPhone();
- } else if ( temp->getIsPiSync() ) {
- mPassWordPiSync = temp->getRemotePw();
- KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
- KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
- syncPi();
- } else
- syncRemote( temp );
-
- }
- }
- delete temp;
- mBlockSaveFlag = false;
-}
void MainWindow::exportToPhone( int mode )
@@ -1586,3 +1367,3 @@ void MainWindow::slotModifiedChanged( bool changed )
// and for safety reasons after 10 minutes again
- if ( !mBlockSaveFlag )
+ if ( !mSyncManager->blockSave() )
msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
@@ -1596,6 +1377,5 @@ void MainWindow::save()
{
- if ( mBlockSaveFlag )
+ if ( mSyncManager->blockSave() )
return;
- bool store = mBlockSaveFlag;
- mBlockSaveFlag = true;
+ mSyncManager->setBlockSave(true);
if ( mView->checkFileVersion( defaultFileName()) ) {
@@ -1617,3 +1397,3 @@ void MainWindow::save()
mCalendarModifiedFlag = false;
- mBlockSaveFlag = store;
+ mSyncManager->setBlockSave( false );
}
@@ -2031,76 +1811,7 @@ void MainWindow::exportVCalendar()
}
-QString MainWindow::getPassword( )
-{
- QString retfile = "";
- QDialog dia ( this, "input-dialog", true );
- QLineEdit lab ( &dia );
- lab.setEchoMode( QLineEdit::Password );
- QVBoxLayout lay( &dia );
- lay.setMargin(7);
- lay.setSpacing(7);
- lay.addWidget( &lab);
- dia.setFixedSize( 230,50 );
- dia.setCaption( i18n("Enter password") );
- QPushButton pb ( "OK", &dia);
- lay.addWidget( &pb );
- connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
- dia.show();
- int res = dia.exec();
- if ( res )
- retfile = lab.text();
- dia.hide();
- qApp->processEvents();
- return retfile;
-
-}
-void MainWindow::enableQuick()
+void MainWindow::syncFileRequest()
{
- QDialog dia ( this, "input-dialog", true );
- QLineEdit lab ( &dia );
- QVBoxLayout lay( &dia );
- lab.setText( KOPrefs::instance()->mPassiveSyncPort );
- lay.setMargin(7);
- lay.setSpacing(7);
- QLabel label ( i18n("Port number (Default: 9197)"), &dia );
- lay.addWidget( &label);
- lay.addWidget( &lab);
-
- QLineEdit lepw ( &dia );
- lepw.setText( KOPrefs::instance()->mPassiveSyncPw );
- QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
- lay.addWidget( &label2);
- lay.addWidget( &lepw);
- dia.setFixedSize( 230,80 );
- dia.setCaption( i18n("Enter port for Pi-Sync") );
- QPushButton pb ( "OK", &dia);
- lay.addWidget( &pb );
- connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
- dia.show();
- if ( ! dia.exec() )
- return;
- dia.hide();
- qApp->processEvents();
- KOPrefs::instance()->mPassiveSyncPw = lepw.text();
- KOPrefs::instance()->mPassiveSyncPort = lab.text();
- bool ok;
- Q_UINT16 port = KOPrefs::instance()->mPassiveSyncPort.toUInt(&ok);
- if ( ! ok ) {
- KMessageBox::information( this, i18n("No valid port"));
- return;
- }
- //qDebug("port %d ", port);
- mServerSocket = new KServerSocket ( KOPrefs::instance()->mPassiveSyncPw, port ,1 );
- mServerSocket->setFileName( defaultFileName() );
- //qDebug("connected ");
- if ( !mServerSocket->ok() ) {
- KMessageBox::information( this, i18n("Failed to bind or\nlisten to the port!"));
- delete mServerSocket;
- mServerSocket = 0;
- return;
- }
- connect( mServerSocket, SIGNAL ( saveFile() ), this, SLOT ( save() ) );
- connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SLOT ( getFile( bool ) ) );
+ save();
}
-
void MainWindow::getFile( bool success )
@@ -2117,223 +1828,2 @@ void MainWindow::getFile( bool success )
-
-void MainWindow::syncPi()
-{
- qApp->processEvents();
- bool ok;
- Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok);
- if ( ! ok ) {
- setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
- return;
- }
- KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this );
- connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
- setCaption( i18n("Sending request for remote file ...") );
- commandSocket->readFile( syncFileName() );
-}
-
-void MainWindow::deleteCommandSocket(KCommandSocket*s, int state)
-{
- qDebug("MainWindow::deleteCommandSocket %d", state);
-
- //enum { success, errorW, errorR, quiet };
- if ( state == KCommandSocket::errorR ) {
- setCaption( i18n("ERROR: Receiving remote file failed.") );
- delete s;
- KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this );
- connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
- commandSocket->sendStop();
- return;
-
- } else if ( state == KCommandSocket::errorW ) {
- setCaption( i18n("ERROR:Writing back file failed.") );
-
- } else if ( state == KCommandSocket::successR ) {
- QTimer::singleShot( 1, this , SLOT ( readFileFromSocket()));
-
- } else if ( state == KCommandSocket::successW ) {
- setCaption( i18n("Pi-Sync succesful!") );
- }
-
- delete s;
-}
-
-void MainWindow::readFileFromSocket()
-{
- QString fileName = syncFileName();
- setCaption( i18n("Remote file saved to temp file.") );
- if ( ! syncWithFile( fileName , true ) ) {
- setCaption( i18n("Syncing failed.") );
- qDebug("Syncing failed ");
- return;
- }
- KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this );
- connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
- if ( KOPrefs::instance()->mWriteBackFile )
- commandSocket->writeFile( fileName );
- else {
- commandSocket->sendStop();
- setCaption( i18n("Pi-Sync succesful!") );
- }
-}
-
-void MainWindow::syncLocalFile()
-{
-
- QString fn =KOPrefs::instance()->mLastSyncedLocalFile;
-
- fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
- if ( fn == "" )
- return;
- //mView->setSyncDevice("local-file" );
- if ( syncWithFile( fn, false ) ) {
- // Event* e = mView->getLastSyncEvent();
-// e->setReadOnly( false );
-// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
-// e->setReadOnly( true );
- }
-
-}
-
-bool MainWindow::syncWithFile( QString fn , bool quick )
-{
- bool ret = false;
- QFileInfo info;
- info.setFile( fn );
- QString mess;
- bool loadbup = true;
- if ( !info. exists() ) {
- mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
- int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
- mess );
- return ret;
- }
- int result = 0;
- if ( !quick ) {
- mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
- result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
- mess,
- i18n("Sync"), i18n("Cancel"), 0,
- 0, 1 );
- if ( result )
- return false;
- }
- if ( KOPrefs::instance()->mAskForPreferences )
- mView->edit_sync_options();
- if ( result == 0 ) {
- //qDebug("Now sycing ... ");
- if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) )
- setCaption( i18n("Synchronization successful") );
- else
- setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
- if ( ! quick )
- KOPrefs::instance()->mLastSyncedLocalFile = fn;
- slotModifiedChanged( true );
- }
- return ret;
-}
-void MainWindow::quickSyncLocalFile()
-{
- //mView->setSyncDevice("local-file" );
- //qDebug("quickSyncLocalFile() ");
- if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) {
- // Event* e = mView->getLastSyncEvent();
-// e->setReadOnly( false );
-// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
-// e->setReadOnly( true );
-
- }
-}
-
-void MainWindow::confSync()
-{
- mView->confSync();
- fillSyncMenu();
-}
-void MainWindow::syncRemote( KSyncProfile* prof, bool ask)
-{
- QString question;
- if ( ask ) {
- question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
- if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
- question,
- i18n("Yes"), i18n("No"),
- 0, 0 ) != 0 )
- return;
- }
- QString command = prof->getPreSyncCommand();
- int fi;
- if ( (fi = command.find("$PWD$")) > 0 ) {
- QString pwd = getPassword();
- command = command.left( fi )+ pwd + command.mid( fi+5 );
-
- }
- int maxlen = 30;
- if ( QApplication::desktop()->width() > 320 )
- maxlen += 25;
- setCaption ( i18n( "Copy remote file to local machine..." ) );
- int fileSize = 0;
- int result = system ( command );
- // 0 : okay
- // 256: no such file or dir
- //
- qDebug("KO: Remote copy result(0 = okay): %d ",result );
- if ( result != 0 ) {
- int len = maxlen;
- while ( len < command.length() ) {
- command.insert( len , "\n" );
- len += maxlen +2;
- }
- question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
- QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
- question,
- i18n("Okay!")) ;
- setCaption ("KO/Pi");
- return;
- }
- setCaption ( i18n( "Copying succeed." ) );
- //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
- if ( syncWithFile( prof->getLocalTempFile(), true ) ) {
-// Event* e = mView->getLastSyncEvent();
-// e->setReadOnly( false );
-// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
-// e->setReadOnly( true );
- if ( KOPrefs::instance()->mWriteBackFile ) {
- command = prof->getPostSyncCommand();
- int fi;
- if ( (fi = command.find("$PWD$")) > 0 ) {
- QString pwd = getPassword();
- command = command.left( fi )+ pwd + command.mid( fi+5 );
-
- }
- setCaption ( i18n( "Writing back file ..." ) );
- result = system ( command );
- qDebug("KO: Writing back file result: %d ", result);
- if ( result != 0 ) {
- setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
- return;
- } else {
- setCaption ( i18n( "Syncronization sucessfully completed" ) );
- }
- }
- }
- return;
-}
-
-void MainWindow::syncSharp()
-{
- if ( mCalendarModifiedFlag )
- save();
- mView->syncSharp();
- slotModifiedChanged( true );
-
-}
-void MainWindow::syncPhone()
-{
- if ( mCalendarModifiedFlag )
- save();
- mView->syncPhone();
- slotModifiedChanged( true );
-
-}
-
void MainWindow::printSel( )
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 0da0be0..ee7bd87 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -46,4 +46,2 @@ class MainWindow : public QMainWindow
void setCaptionToDates();
- int ringSync();
- void multiSync( bool askforPrefs = false );
void about();
@@ -81,11 +79,2 @@ class MainWindow : public QMainWindow
- void slotSyncMenu( int );
- void confSync();
- void syncSharp();
- void syncPhone();
- void syncPi();
- void syncLocalFile();
- bool syncWithFile( QString, bool );
- void quickSyncLocalFile();
-
@@ -101,9 +90,7 @@ class MainWindow : public QMainWindow
QTime piTime;
- void deleteCommandSocket(KCommandSocket* s, int state );
- void fillSyncMenu();
void getFile( bool );
- void readFileFromSocket();
+ void syncFileRequest();
private:
+ KSyncManager* mSyncManager;
//QTimer* mTimerCommandSocket;
- QString mPassWordPiSync;
KServerSocket * mServerSocket;
@@ -111,5 +98,2 @@ class MainWindow : public QMainWindow
void saveOnClose();
- int mCurrentSyncProfile;
- void enableQuick();
- void syncRemote( KSyncProfile* , bool ask = true);
bool mFlagKeyPressed;
@@ -126,3 +110,2 @@ class MainWindow : public QMainWindow
CalendarView *mView;
- QString getPassword();
QAction *mNewSubTodoAction;
@@ -137,3 +120,2 @@ class MainWindow : public QMainWindow
-
void closeEvent( QCloseEvent* ce );
@@ -141,3 +123,3 @@ class MainWindow : public QMainWindow
QTimer mSaveTimer;
- bool mBlockSaveFlag;
+ //bool mBlockSaveFlag;
bool mCalendarModifiedFlag;
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index 0a2f5f1..c21ebaa 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -40,5 +40,12 @@ KPimPrefs::KPimPrefs( const QString &name ) :
{
- config()->setGroup("General");
+#ifdef _WIN32_
+ QString hdp= locateLocal("data","korganizer")+"\\\\";
+#else
+ QString hdp= locateLocal("data","korganizer")+"/";
+#endif
+ config()->setGroup("SyncOptions");
addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
+ addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
+ addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
}
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index fde8093..9346f7d 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -59,3 +59,4 @@ class KPimPrefs : public KPrefs
QString mPassiveSyncPw;
-
+ int mRingSyncAlgoPrefs;
+ QString mLastSyncedLocalFile;
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index fad9a76..568c2a9 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -78,3 +78,3 @@ KSyncManager::~KSyncManager()
-//LR ok
+
void KSyncManager::fillSyncMenu()
@@ -103,2 +103,3 @@ void KSyncManager::fillSyncMenu()
prof << i18n("Local_file");
+ prof << i18n("Last_file");
KSyncProfile* temp = new KSyncProfile ();
@@ -108,2 +109,4 @@ void KSyncManager::fillSyncMenu()
temp->writeConfig(&config);
+ temp->setName( prof[2] );
+ temp->writeConfig(&config);
config.setGroup("General");
@@ -128,4 +131,5 @@ void KSyncManager::fillSyncMenu()
else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
- mSyncMenu->setItemEnabled( 1000, false );
+ mSyncMenu->removeItem( 1000 );
}
+ mSyncMenu->removeItem( 1002 );
}
@@ -193,21 +197,21 @@ void KSyncManager::slotSyncMenu( int action )
if ( temp->getIsLocalFileSync() ) {
- switch(mTargetApp)
- {
- case (KAPI):
- if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileNameAB();
- break;
- case (KOPI):
- if ( syncWithFile( temp->getRemoteFileName( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileName();
- break;
- case (PWMPI):
- if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
- break;
- default:
- qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
- break;
+ switch(mTargetApp)
+ {
+ case (KAPI):
+ if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
+ break;
+ case (KOPI):
+ if ( syncWithFile( temp->getRemoteFileName( ), false ) )
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
+ break;
+ case (PWMPI):
+ if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
+ break;
+ default:
+ qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
+ break;
- }
+ }
} else {
@@ -241,2 +245,3 @@ void KSyncManager::slotSyncMenu( int action )
}
+
void KSyncManager::enableQuick()
@@ -287,3 +292,2 @@ void KSyncManager::enableQuick()
}
- //connect( mServerSocket, SIGNAL ( saveFile() ),this, SIGNAL ( save() ) );
connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
@@ -295,3 +299,3 @@ void KSyncManager::syncLocalFile()
- QString fn =mLastSyncedLocalFile;
+ QString fn =mPrefs->mLastSyncedLocalFile;
QString ext;
@@ -323,2 +327,3 @@ void KSyncManager::syncLocalFile()
}
+
bool KSyncManager::syncWithFile( QString fn , bool quick )
@@ -355,3 +360,3 @@ bool KSyncManager::syncWithFile( QString fn , bool quick )
if ( ! quick )
- mLastSyncedLocalFile = fn;
+ mPrefs->mLastSyncedLocalFile = fn;
}
@@ -359,2 +364,3 @@ bool KSyncManager::syncWithFile( QString fn , bool quick )
}
+
void KSyncManager::quickSyncLocalFile()
@@ -362,3 +368,3 @@ void KSyncManager::quickSyncLocalFile()
- if ( syncWithFile( mLastSyncedLocalFile, false ) ) {
+ if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) {
qDebug("quick syncLocalFile() successful ");
@@ -367,2 +373,3 @@ void KSyncManager::quickSyncLocalFile()
}
+
void KSyncManager::multiSync( bool askforPrefs )
@@ -373,3 +380,3 @@ void KSyncManager::multiSync( bool askforPrefs )
QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
- if ( QMessageBox::information( mParent, i18n("Sync"),
+ if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"),
question,
@@ -382,3 +389,3 @@ void KSyncManager::multiSync( bool askforPrefs )
mCurrentSyncDevice = i18n("Multiple profiles") ;
- mSyncAlgoPrefs = mRingSyncAlgoPrefs;
+ mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
if ( askforPrefs ) {
@@ -396,3 +403,3 @@ void KSyncManager::multiSync( bool askforPrefs )
if ( num )
- mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
+ mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) );
else
@@ -401,2 +408,3 @@ void KSyncManager::multiSync( bool askforPrefs )
}
+
int KSyncManager::ringSync()
@@ -415,22 +423,22 @@ int KSyncManager::ringSync()
- QString includeInRingSync;
- switch(mTargetApp)
- {
- case (KAPI):
- includeInRingSync = temp->getIncludeInRingSyncAB();
- break;
- case (KOPI):
- includeInRingSync = temp->getIncludeInRingSync();
- break;
- case (PWMPI):
- includeInRingSync = temp->getIncludeInRingSyncPWM();
- break;
- default:
- qDebug("KSyncManager::ringSync: invalid apptype selected");
- break;
+ QString includeInRingSync;
+ switch(mTargetApp)
+ {
+ case (KAPI):
+ includeInRingSync = temp->getIncludeInRingSyncAB();
+ break;
+ case (KOPI):
+ includeInRingSync = temp->getIncludeInRingSync();
+ break;
+ case (PWMPI):
+ includeInRingSync = temp->getIncludeInRingSyncPWM();
+ break;
+ default:
+ qDebug("KSyncManager::ringSync: invalid apptype selected");
+ break;
- }
+ }
- if ( includeInRingSync && ( i < 1 || i > 2 )) {
+ if ( includeInRingSync && ( i < 1 || i > 2 )) {
mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
@@ -450,20 +458,20 @@ int KSyncManager::ringSync()
if ( temp->getIsLocalFileSync() ) {
- switch(mTargetApp)
- {
- case (KAPI):
- if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileNameAB();
- break;
- case (KOPI):
- if ( syncWithFile( temp->getRemoteFileName( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileName();
- break;
- case (PWMPI):
- if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
- break;
- default:
- qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
- break;
- }
+ switch(mTargetApp)
+ {
+ case (KAPI):
+ if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
+ break;
+ case (KOPI):
+ if ( syncWithFile( temp->getRemoteFileName( ), false ) )
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
+ break;
+ case (PWMPI):
+ if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
+ break;
+ default:
+ qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
+ break;
+ }
} else {
@@ -474,2 +482,17 @@ int KSyncManager::ringSync()
syncPhone();
+ } else if ( temp->getIsPiSync() ) {
+ if ( mTargetApp == KAPI ) {
+ mPassWordPiSync = temp->getRemotePwAB();
+ mActiveSyncPort = temp->getRemotePortAB();
+ mActiveSyncIP = temp->getRemoteIPAB();
+ } else if ( mTargetApp == KOPI ) {
+ mPassWordPiSync = temp->getRemotePw();
+ mActiveSyncPort = temp->getRemotePort();
+ mActiveSyncIP = temp->getRemoteIP();
+ } else {
+ mPassWordPiSync = temp->getRemotePwPWM();
+ mActiveSyncPort = temp->getRemotePortPWM();
+ mActiveSyncIP = temp->getRemoteIPPWM();
+ }
+ syncPi();
} else
@@ -560,3 +583,3 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
i18n("Okay!")) ;
- mParent->topLevelWidget()->setCaption ("");
+ mParent->topLevelWidget()->setCaption ("KDE-Pim");
return;
@@ -566,9 +589,4 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
-
-
if ( syncWithFile( localTempFile, true ) ) {
-// Event* e = mView->getLastSyncEvent();
-// e->setReadOnly( false );
-// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
-// e->setReadOnly( true );
+
if ( mWriteBackFile ) {
@@ -646,2 +664,3 @@ void KSyncManager::edit_sync_options()
}
+
QString KSyncManager::getPassword( )
@@ -687,3 +706,3 @@ void KSyncManager::confSync()
mLocalMachineName = sp->getLocalMachineName ();
- fillSyncMenu();
+ QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
}
@@ -692,2 +711,3 @@ void KSyncManager::syncSharp()
{
+
if ( ! syncExternalApplication("sharp") )
@@ -714,6 +734,4 @@ void KSyncManager::syncPhone()
{
- emit save();
- qDebug("pending syncPhone(); ");
- //mView->syncPhone();
+ syncExternalApplication("phone");
@@ -769,2 +787,3 @@ QString KSyncManager::syncFileName()
+
void KSyncManager::syncPi()
@@ -1155,2 +1174 @@ void KCommandSocket::deleteSocket()
}
-
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 25892d8..7027894 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -119,2 +119,3 @@ class KSyncManager : public QObject
+ void multiSync( bool askforPrefs );
bool blockSave() { return mBlockSaveFlag; }
@@ -149,3 +150,2 @@ class KSyncManager : public QObject
QString mPhoneModel;
- QString mLastSyncedLocalFile; // save!
QString mPassWordPiSync;
@@ -180,3 +180,2 @@ class KSyncManager : public QObject
bool syncExternalApplication(QString);
- void multiSync( bool askforPrefs );
int mCurrentSyncProfile ;