summaryrefslogtreecommitdiffabout
path: root/libkdepim
Side-by-side diff
Diffstat (limited to 'libkdepim') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/kpimprefs.h21
-rw-r--r--libkdepim/ksyncmanager.cpp274
-rw-r--r--libkdepim/ksyncmanager.h75
-rw-r--r--libkdepim/libkdepimE.pro2
4 files changed, 260 insertions, 112 deletions
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index 860665b..01c57a3 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -57,7 +57,28 @@ class KPimPrefs : public KPrefs
QStringList mCustomCategories;
+ // sync stuff
+ QString mLocalMachineName;
+ QStringList mExternSyncProfiles;
+ QStringList mSyncProfileNames;
+ bool mAskForPreferences;
+ bool mShowSyncSummary;
+ bool mShowSyncEvents;
+ bool mShowTodoInAgenda;
+ bool mWriteBackExistingOnly;
+ int mSyncAlgoPrefs;
+ int mRingSyncAlgoPrefs;
+ bool mWriteBackFile;
+ int mWriteBackInFuture;
+ QString mPhoneDevice;
+ QString mPhoneConnection;
+ QString mPhoneModel;
+ QString mLastSyncedLocalFile; // save!
+
protected:
virtual void setCategoryDefaults();
+
+
+
};
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 52e3bd9..87f200a 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -23,7 +23,34 @@
#include "ksyncmanager.h"
+#include <stdlib.h>
-KSyncManager::KSyncManager(TargetApp ta, QPopupMenu* syncmenu)
- : mSyncMenu(syncmenu), mTargetApp(ta)
+#ifndef _WIN32_
+#include <unistd.h>
+#endif
+
+
+#include "ksyncprofile.h"
+#include "ksyncprefsdialog.h"
+#include "kpimprefs.h"
+
+#include <qdir.h>
+#include <qpopupmenu.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <qtimer.h>
+#include <qmessagebox.h>
+#include <qapplication.h>
+#include <qlineedit.h>
+#include <qdialog.h>
+#include <qlayout.h>
+
+#include <klocale.h>
+#include <kglobal.h>
+#include <kconfig.h>
+#include <kfiledialog.h>
+
+KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
+ : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs), mSyncMenu(syncmenu)
{
@@ -36,8 +63,8 @@ KSyncManager::~KSyncManager()
-void KABCore::fillSyncMenu()
+void KSyncManager::fillSyncMenu()
{
if ( mSyncMenu->count() )
- msyncMenu->clear();
+ mSyncMenu->clear();
mSyncMenu->insertItem( i18n("Configure..."), 0 );
@@ -49,5 +76,5 @@ void KABCore::fillSyncMenu()
config.setGroup("General");
QStringList prof = config.readListEntry("SyncProfileNames");
- //US KABPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
+ mPrefs->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
if ( prof.count() < 3 ) {
prof.clear();
@@ -68,9 +95,7 @@ void KABCore::fillSyncMenu()
delete temp;
}
- /*US
- KABPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
- KABPrefs::instance()->mSyncProfileNames = prof;
- */
- int i;
+ mPrefs->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
+ mPrefs->mSyncProfileNames = prof;
+ unsigned int i;
for ( i = 0; i < prof.count(); ++i ) {
@@ -86,5 +111,6 @@ void KABCore::fillSyncMenu()
//mView->setupExternSyncProfiles();
}
-void KABCore::slotSyncMenu( int action )
+
+void KSyncManager::slotSyncMenu( int action )
{
//qDebug("syncaction %d ", action);
@@ -105,24 +131,24 @@ void KABCore::slotSyncMenu( int action )
}
- if (mBlockSaveFlag)
+ if (blockSave())
return;
- mBlockSaveFlag = true;
+
+ setBlockSave(true);
+
mCurrentSyncProfile = action - 1000 ;
- //US mCurrentSyncDevice = KABPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ;
- //US mCurrentSyncName = KABPrefs::instance()->mLocalMachineName ;
+ mCurrentSyncDevice = mPrefs->mSyncProfileNames[mCurrentSyncProfile] ;
+ mCurrentSyncName = mPrefs->mLocalMachineName ;
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
KSyncProfile* temp = new KSyncProfile ();
- //US temp->setName(KABPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
+ temp->setName(mPrefs->mSyncProfileNames[mCurrentSyncProfile]);
temp->readConfig(&config);
- /*US
- KABPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
- KABPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
- KABPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
- KABPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
- KABPrefs::instance()->mWriteBackInFuture = 0;
+ mPrefs->mAskForPreferences = temp->getAskForPreferences();
+ mPrefs->mSyncAlgoPrefs = temp->getSyncPrefs();
+ mPrefs->mWriteBackFile = temp->getWriteBackFile();
+ mPrefs->mWriteBackExistingOnly = temp->getWriteBackExisting();
+ mPrefs->mWriteBackInFuture = 0;
if ( temp->getWriteBackFuture() )
- KABPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
- KABPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
- */
+ mPrefs->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
+ mPrefs->mShowSyncSummary = temp->getShowSummaryAfterSync();
if ( action == 1000 ) {
syncSharp();
@@ -136,14 +162,12 @@ void KABCore::slotSyncMenu( int action )
} else if ( action >= 1003 ) {
if ( temp->getIsLocalFileSync() ) {
- /*US if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
- KABPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
- */
+ if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
+
} else {
if ( temp->getIsPhoneSync() ) {
- /*
- KABPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
- KABPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
- KABPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
- */
+ mPrefs->mPhoneDevice = temp->getPhoneDevice( ) ;
+ mPrefs->mPhoneConnection = temp->getPhoneConnection( );
+ mPrefs->mPhoneModel = temp->getPhoneModel( );
syncPhone();
} else
@@ -153,13 +177,13 @@ void KABCore::slotSyncMenu( int action )
}
delete temp;
- mBlockSaveFlag = false;
+ setBlockSave(false);
}
-void KABCore::syncLocalFile()
+void KSyncManager::syncLocalFile()
{
- QString fn =KABPrefs::instance()->mLastSyncedLocalFile;
+ QString fn =mPrefs->mLastSyncedLocalFile;
- fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
+ fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), mParent );
if ( fn == "" )
return;
@@ -169,5 +193,5 @@ void KABCore::syncLocalFile()
}
-bool KABCore::syncWithFile( QString fn , bool quick )
+bool KSyncManager::syncWithFile( QString fn , bool quick )
{
bool ret = false;
@@ -178,5 +202,5 @@ bool KABCore::syncWithFile( QString fn , bool quick )
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("Warning!"),
+ int result = QMessageBox::warning( mParent, i18n("Warning!"),
mess );
return ret;
@@ -185,5 +209,5 @@ bool KABCore::syncWithFile( QString fn , bool quick )
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("Warning!"),
+ result = QMessageBox::warning( mParent, i18n("Warning!"),
mess,
i18n("Sync"), i18n("Cancel"), 0,
@@ -192,69 +216,69 @@ bool KABCore::syncWithFile( QString fn , bool quick )
return false;
}
- if ( KABPrefs::instance()->mAskForPreferences )
+ if ( mPrefs->mAskForPreferences )
edit_sync_options();
if ( result == 0 ) {
//qDebug("Now sycing ... ");
- if ( ret = syncAB( fn, KABPrefs::instance()->mSyncAlgoPrefs ) )
- setCaption( i18n("Synchronization successful") );
+ if ( ret = mImplementation->sync( this, fn, mPrefs->mSyncAlgoPrefs ) )
+ mParent->setCaption( i18n("Synchronization successful") );
else
- setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
+ mParent->setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
if ( ! quick )
- KABPrefs::instance()->mLastSyncedLocalFile = fn;
- setModified();
+ mPrefs->mLastSyncedLocalFile = fn;
+ mImplementation->sync_setModified();
}
return ret;
}
-void KABCore::quickSyncLocalFile()
+void KSyncManager::quickSyncLocalFile()
{
- if ( syncWithFile( KABPrefs::instance()->mLastSyncedLocalFile, false ) ) {
+ if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) {
qDebug("quick syncLocalFile() successful ");
}
}
-void KABCore::multiSync( bool askforPrefs )
+void KSyncManager::multiSync( bool askforPrefs )
{
- if (mBlockSaveFlag)
+ if (blockSave())
return;
- mBlockSaveFlag = true;
+ setBlockSave(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"),
+ if ( QMessageBox::information( mParent, i18n("Sync"),
question,
i18n("Yes"), i18n("No"),
0, 0 ) != 0 ) {
- mBlockSaveFlag = false;
- setCaption(i18n("Aborted! Nothing synced!"));
+ setBlockSave(false);
+ mParent->setCaption(i18n("Aborted! Nothing synced!"));
return;
}
mCurrentSyncDevice = i18n("Multiple profiles") ;
- KABPrefs::instance()->mSyncAlgoPrefs = KABPrefs::instance()->mRingSyncAlgoPrefs;
+ mPrefs->mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
if ( askforPrefs ) {
edit_sync_options();
- KABPrefs::instance()->mRingSyncAlgoPrefs = KABPrefs::instance()->mSyncAlgoPrefs;
+ mPrefs->mRingSyncAlgoPrefs = mPrefs->mSyncAlgoPrefs;
}
- setCaption(i18n("Multiple sync started.") );
+ mParent->setCaption(i18n("Multiple sync started.") );
qApp->processEvents();
int num = ringSync() ;
if ( num > 1 )
ringSync();
- mBlockSaveFlag = false;
+ setBlockSave(false);
if ( num )
- save();
+ mImplementation->sync_save();
if ( num )
- setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
+ mParent->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
else
- setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
+ mParent->setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
return;
}
-int KABCore::ringSync()
+int KSyncManager::ringSync()
{
int syncedProfiles = 0;
- int i;
+ unsigned int i;
QTime timer;
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
- QStringList syncProfileNames = KABPrefs::instance()->mSyncProfileNames;
+ QStringList syncProfileNames = mPrefs->mSyncProfileNames;
KSyncProfile* temp = new KSyncProfile ();
- KABPrefs::instance()->mAskForPreferences = false;
+ mPrefs->mAskForPreferences = false;
for ( i = 0; i < syncProfileNames.count(); ++i ) {
mCurrentSyncProfile = i;
@@ -262,15 +286,15 @@ int KABCore::ringSync()
temp->readConfig(&config);
if ( temp->getIncludeInRingSyncAB() && ( i < 1 || i > 2 )) {
- setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
+ mParent->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
++syncedProfiles;
- // KABPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
- KABPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
- KABPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
- KABPrefs::instance()->mWriteBackInFuture = 0;
+ // mPrefs->mAskForPreferences = temp->getAskForPreferences();
+ mPrefs->mWriteBackFile = temp->getWriteBackFile();
+ mPrefs->mWriteBackExistingOnly = temp->getWriteBackExisting();
+ mPrefs->mWriteBackInFuture = 0;
if ( temp->getWriteBackFuture() )
- KABPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
- KABPrefs::instance()->mShowSyncSummary = false;
+ mPrefs->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
+ mPrefs->mShowSyncSummary = false;
mCurrentSyncDevice = syncProfileNames[i] ;
- mCurrentSyncName = KABPrefs::instance()->mLocalMachineName;
+ mCurrentSyncName = mPrefs->mLocalMachineName;
if ( i == 0 ) {
syncSharp();
@@ -278,10 +302,10 @@ int KABCore::ringSync()
if ( temp->getIsLocalFileSync() ) {
if ( syncWithFile( temp->getRemoteFileNameAB( ), true ) )
- KABPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
} else {
if ( temp->getIsPhoneSync() ) {
- KABPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
- KABPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
- KABPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
+ mPrefs->mPhoneDevice = temp->getPhoneDevice( ) ;
+ mPrefs->mPhoneConnection = temp->getPhoneConnection( );
+ mPrefs->mPhoneModel = temp->getPhoneModel( );
syncPhone();
} else
@@ -291,5 +315,5 @@ int KABCore::ringSync()
}
timer.start();
- setCaption(i18n("Multiple sync in progress ... please wait!") );
+ mParent->setCaption(i18n("Multiple sync in progress ... please wait!") );
while ( timer.elapsed () < 2000 ) {
qApp->processEvents();
@@ -306,10 +330,10 @@ int KABCore::ringSync()
}
-void KABCore::syncRemote( KSyncProfile* prof, bool ask)
+void KSyncManager::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"),
+ if ( QMessageBox::information( mParent, i18n("Sync"),
question,
i18n("Yes"), i18n("No"),
@@ -327,5 +351,5 @@ void KABCore::syncRemote( KSyncProfile* prof, bool ask)
if ( QApplication::desktop()->width() > 320 )
maxlen += 25;
- setCaption ( i18n( "Copy remote file to local machine..." ) );
+ mParent->setCaption ( i18n( "Copy remote file to local machine..." ) );
int fileSize = 0;
int result = system ( command );
@@ -335,5 +359,5 @@ void KABCore::syncRemote( KSyncProfile* prof, bool ask)
qDebug("KO: Remote copy result(0 = okay): %d ",result );
if ( result != 0 ) {
- int len = maxlen;
+ unsigned int len = maxlen;
while ( len < command.length() ) {
command.insert( len , "\n" );
@@ -341,11 +365,11 @@ void KABCore::syncRemote( KSyncProfile* prof, bool ask)
}
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"),
+ QMessageBox::information( mParent, i18n("Sync - ERROR"),
question,
i18n("Okay!")) ;
- setCaption ("KO/Pi");
+ mParent->setCaption ("");
return;
}
- setCaption ( i18n( "Copying succeed." ) );
+ mParent->setCaption ( i18n( "Copying succeed." ) );
//qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
if ( syncWithFile( prof->getLocalTempFileAB(), true ) ) {
@@ -354,5 +378,5 @@ void KABCore::syncRemote( KSyncProfile* prof, bool ask)
// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
// e->setReadOnly( true );
- if ( KABPrefs::instance()->mWriteBackFile ) {
+ if ( mPrefs->mWriteBackFile ) {
command = prof->getPostSyncCommandAB();
int fi;
@@ -362,12 +386,12 @@ void KABCore::syncRemote( KSyncProfile* prof, bool ask)
}
- setCaption ( i18n( "Writing back file ..." ) );
+ mParent->setCaption ( i18n( "Writing back file ..." ) );
result = system ( command );
- qDebug("KO: Writing back file result: %d ", result);
+ qDebug("Writing back file result: %d ", result);
if ( result != 0 ) {
- setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
+ mParent->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
return;
} else {
- setCaption ( i18n( "Syncronization sucessfully completed" ) );
+ mParent->setCaption ( i18n( "Syncronization sucessfully completed" ) );
}
}
@@ -375,12 +399,10 @@ void KABCore::syncRemote( KSyncProfile* prof, bool ask)
return;
}
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qbuttongroup.h>
-void KABCore::edit_sync_options()
+
+void KSyncManager::edit_sync_options()
{
//mDialogManager->showSyncOptions();
- //KABPrefs::instance()->mSyncAlgoPrefs
- QDialog dia( this, "dia", true );
+ //mPrefs->mSyncAlgoPrefs
+ QDialog dia( mParent, "dia", true );
dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
@@ -399,5 +421,5 @@ void KABCore::edit_sync_options()
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
- switch ( KABPrefs::instance()->mSyncAlgoPrefs ) {
+ switch ( mPrefs->mSyncAlgoPrefs ) {
case 0:
loc.setChecked( true);
@@ -425,13 +447,13 @@ void KABCore::edit_sync_options()
}
if ( dia.exec() ) {
- KABPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
+ mPrefs->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
}
}
-QString KABCore::getPassword( )
+QString KSyncManager::getPassword( )
{
QString retfile = "";
- QDialog dia ( this, "input-dialog", true );
+ QDialog dia ( mParent, "input-dialog", true );
QLineEdit lab ( &dia );
lab.setEchoMode( QLineEdit::Password );
@@ -454,2 +476,54 @@ QString KABCore::getPassword( )
}
+
+
+void KSyncManager::confSync()
+{
+ static KSyncPrefsDialog* sp = 0;
+ if ( ! sp ) {
+ sp = new KSyncPrefsDialog( mParent, "syncprefs", true );
+ }
+ sp->usrReadConfig();
+#ifndef DESKTOP_VERSION
+ sp->showMaximized();
+#else
+ sp->show();
+#endif
+ sp->exec();
+ mPrefs->mSyncProfileNames = sp->getSyncProfileNames();
+ mPrefs->mLocalMachineName = sp->getLocalMachineName ();
+ fillSyncMenu();
+}
+
+void KSyncManager::syncSharp()
+{
+ if ( ! syncExternalApplication("sharp") )
+ qDebug("ERROR sync sharp ");;
+}
+
+bool KSyncManager::syncExternalApplication(QString resource)
+{
+ if ( mImplementation->sync_isModified() )
+ mImplementation->sync_save();
+
+ if ( mPrefs->mAskForPreferences )
+ edit_sync_options();
+
+ qDebug("sync %s", resource.latin1());
+
+ bool syncOK = mImplementation->syncExternal(this, resource);
+
+ return syncOK;
+
+}
+
+void KSyncManager::syncPhone()
+{
+ if ( mImplementation->sync_isModified() )
+ mImplementation->sync_save();
+
+ qDebug("pending syncPhone(); ");
+ //mView->syncPhone();
+ mImplementation->sync_setModified();
+
+}
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index d7c2a02..389a005 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -23,18 +23,19 @@ $Id$
#define _KSYNCMANAGER_H
+#include <qobject.h>
#include <qstring.h>
class QPopupMenu;
class KSyncProfile;
+class KPimPrefs;
+class QWidget;
+class KSyncManager;
+class KSyncInterface;
-
-
-class KSyncManager
+class KSyncManager : public QObject
{
+ Q_OBJECT
public:
- KSyncManager(TargetApp ta, QPopupMenu* syncmenu);
- ~KSyncManager() ;
-
enum TargetApp {
KOPI = 0,
@@ -42,18 +43,51 @@ class KSyncManager
PWMPI = 2 };
- private:
+
+ KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu);
+ ~KSyncManager() ;
+
+ bool blockSave() { return mBlockSaveFlag; }
+ void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
+
void fillSyncMenu();
- void syncLocalFile();
- bool syncWithFile( QString fn , bool quick );
+
+ QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
+ QString getCurrentSyncName() { return mCurrentSyncName; }
+
+ public slots:
+ void slotSyncMenu( int );
+
+ private:
+ // LR *******************************
+ // sync stuff!
+ QString mCurrentSyncDevice;
+ QString mCurrentSyncName;
void quickSyncLocalFile();
+ bool syncWithFile( QString fn , bool quick );
+ void syncLocalFile();
+ void syncPhone();
+ void syncSharp();
+ bool syncExternalApplication(QString);
void multiSync( bool askforPrefs );
- int ringSync();
- void syncRemote( KSyncProfile* prof, bool ask);
+ int mCurrentSyncProfile ;
+ void syncRemote( KSyncProfile* prof, bool ask = true);
void edit_sync_options();
+ int ringSync();
QString getPassword();
+ private slots:
+ void confSync();
+ // *********************
+
private:
- QPopupMenu* mSyncMenu;
+ bool mBlockSaveFlag;
+
+
+ QWidget* mParent;
+ KSyncInterface* mImplementation;
TargetApp mTargetApp;
+ KPimPrefs* mPrefs;
+ QPopupMenu* mSyncMenu;
+
@@ -62,7 +96,24 @@ class KSyncManager
+};
+
+
+class KSyncInterface
+{
+ public:
+ virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0;
+ virtual bool syncExternal(KSyncManager* manager, QString resource) = 0;
+
+ //called by the syncmanager to indicate that the work has to be marked as dirty.
+ virtual void sync_setModified() = 0;
+ //called by the syncmanager to ask if the dirty flag is set.
+ virtual bool sync_isModified() = 0;
+
+ //called by the syncmanager to indicate that the work has to be saved.
+ virtual void sync_save() = 0;
};
+
#endif
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index 2a30ee8..156e247 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -26,4 +26,5 @@ HEADERS = \
kprefsdialog.h \
kprefswidget.h \
+ ksyncmanager.h \
ksyncprofile.h \
ksyncprefsdialog.h \
@@ -46,4 +47,5 @@ SOURCES = \
kprefsdialog.cpp \
kprefswidget.cpp \
+ ksyncmanager.cpp \
ksyncprofile.cpp \
ksyncprefsdialog.cpp \