summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-11-25 18:35:16 (UTC)
committer zautrix <zautrix>2005-11-25 18:35:16 (UTC)
commit231e6f8215bbc4f7e301965f8f3c650e44586ec9 (patch) (side-by-side diff)
tree4c221ec7ac9909b5f0d192c68558739b4dcc1f48
parent279e183c0325cd9565605f60af0215bb9bfdc825 (diff)
downloadkdepimpi-231e6f8215bbc4f7e301965f8f3c650e44586ec9.zip
kdepimpi-231e6f8215bbc4f7e301965f8f3c650e44586ec9.tar.gz
kdepimpi-231e6f8215bbc4f7e301965f8f3c650e44586ec9.tar.bz2
sync
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp27
-rw-r--r--libkdepim/ksyncprefsdialog.cpp16
-rw-r--r--libkdepim/ksyncprofile.cpp2
3 files changed, 29 insertions, 16 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 719d80b..61a9899 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -302,49 +302,49 @@ void KSyncManager::slotSyncMenu( int action )
break;
case (PWMPI):
if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
break;
default:
qDebug("KSM::slotSyncMenu: invalid apptype selected");
break;
}
} else {
if ( temp->getIsPhoneSync() ) {
mPhoneDevice = temp->getPhoneDevice( ) ;
mPhoneConnection = temp->getPhoneConnection( );
mPhoneModel = temp->getPhoneModel( );
syncPhone();
} else if ( temp->getIsPiSync()|| temp->getIsPiSyncSpec()) {
mSpecificResources.clear();
if ( mTargetApp == KAPI ) {
mPassWordPiSync = temp->getRemotePwAB();
mActiveSyncPort = temp->getRemotePortAB();
mActiveSyncIP = temp->getRemoteIPAB();
} else if ( mTargetApp == KOPI ) {
if ( temp->getIsPiSyncSpec() )
- mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() );
+ mSpecificResources = QStringList::split( ":", temp->getResSpecKopi(),true );
mPassWordPiSync = temp->getRemotePw();
mActiveSyncPort = temp->getRemotePort();
mActiveSyncIP = temp->getRemoteIP();
} else {
mPassWordPiSync = temp->getRemotePwPWM();
mActiveSyncPort = temp->getRemotePortPWM();
mActiveSyncIP = temp->getRemoteIPPWM();
}
syncPi();
while ( !mPisyncFinished ) {
//qDebug("waiting ");
qApp->processEvents();
}
} else
syncRemote( temp );
}
}
delete temp;
setBlockSave(false);
}
void KSyncManager::enableQuick( bool ask )
{
@@ -644,49 +644,49 @@ int KSyncManager::ringSync()
if ( syncWithFile( temp->getRemoteFileName( ), false ) )
mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
break;
case (PWMPI):
if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
break;
default:
qDebug("KSM: invalid apptype selected");
break;
}
} else {
if ( temp->getIsPhoneSync() ) {
mPhoneDevice = temp->getPhoneDevice( ) ;
mPhoneConnection = temp->getPhoneConnection( );
mPhoneModel = temp->getPhoneModel( );
syncPhone();
} else if ( temp->getIsPiSync() || temp->getIsPiSyncSpec()) {
mSpecificResources.clear();
if ( mTargetApp == KAPI ) {
mPassWordPiSync = temp->getRemotePwAB();
mActiveSyncPort = temp->getRemotePortAB();
mActiveSyncIP = temp->getRemoteIPAB();
} else if ( mTargetApp == KOPI ) {
- mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() );
+ mSpecificResources = QStringList::split( ":", temp->getResSpecKopi(),true );
mPassWordPiSync = temp->getRemotePw();
mActiveSyncPort = temp->getRemotePort();
mActiveSyncIP = temp->getRemoteIP();
} else {
mPassWordPiSync = temp->getRemotePwPWM();
mActiveSyncPort = temp->getRemotePortPWM();
mActiveSyncIP = temp->getRemoteIPPWM();
}
syncPi();
while ( !mPisyncFinished ) {
//qDebug("waiting ");
qApp->processEvents();
}
timer.start();
while ( timer.elapsed () < 2000 ) {
qApp->processEvents();
}
} else
syncRemote( temp, false );
}
}
timer.start();
mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") );
@@ -1120,63 +1120,72 @@ QString KSyncManager::syncFileName()
#endif
}
void KSyncManager::syncPi()
{
mIsKapiFile = true;
mPisyncFinished = false;
qApp->processEvents();
if ( mAskForPreferences )
if ( !edit_pisync_options()) {
mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
mPisyncFinished = true;
return;
}
bool ok;
Q_UINT16 port = mActiveSyncPort.toUInt(&ok);
if ( ! ok ) {
mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
mPisyncFinished = true;
return;
}
mCurrentResourceLocal = "";
mCurrentResourceRemote = "";
if ( mSpecificResources.count() ) {
+ int lastSyncRes = mSpecificResources.count()/2;
+ int ccc = mSpecificResources.count()-1;
+ while ( lastSyncRes > 0 && ccc > 0 && mSpecificResources[ ccc ].isEmpty() ) {
+ --ccc;
+ --lastSyncRes;
+ }
int startLocal = 0;
int startRemote = mSpecificResources.count()/2;
emit multiResourceSyncStart( true );
while ( startLocal < mSpecificResources.count()/2 ) {
- if ( startLocal+1 >= mSpecificResources.count()/2 )
+ if ( startLocal+1 >= lastSyncRes )
emit multiResourceSyncStart( false );
mPisyncFinished = false;
mCurrentResourceLocal = mSpecificResources[ startLocal ];
mCurrentResourceRemote = mSpecificResources[ startRemote ];
- KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() );
- connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
- commandSocket->readFile( syncFileName() );
- while ( !mPisyncFinished ) {
- //qDebug("waiting ");
- qApp->processEvents();
+ if ( !mCurrentResourceRemote.isEmpty() ) {
+ qDebug ( "KSM: Syncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() );
+ KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() );
+ connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
+ commandSocket->readFile( syncFileName() );
+ while ( !mPisyncFinished ) {
+ //qDebug("waiting ");
+ qApp->processEvents();
+ }
}
++startLocal;
}
} else {
KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() );
connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
commandSocket->readFile( syncFileName() );
}
}
void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
{
//enum { success, errorW, errorR, quiet };
if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ||state == KCommandSocket::errorPW ||
state == KCommandSocket::errorCA ||state == KCommandSocket::errorFI ||state == KCommandSocket::errorUN||state == KCommandSocket::errorED ) {
if ( state == KCommandSocket::errorPW )
mParent->topLevelWidget()->setCaption( i18n("Wrong password: Receiving remote file failed.") );
else if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO )
mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") );
else if ( state == KCommandSocket::errorCA )
mParent->topLevelWidget()->setCaption( i18n("Sync cancelled from remote.") );
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 27f7932..744a914 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -570,56 +570,58 @@ void KSyncPrefsDialog::profileChanged( int item )
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;
}
mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
mIsPhone->setChecked(prof->getIsPhoneSync()) ;
mIsPi->setChecked(prof->getIsPiSync()) ;
mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ;
mIsKapiFileL->setChecked(prof->getIsKapiFile()) ;
mIsKapiFileR->setChecked(prof->getIsKapiFile()) ;
- QStringList res = QStringList::split( ":",prof->getResSpecKopi());
- int i= res.count()/2;
- for ( ;i < res.count(); ++i ) {
- mResTableKopi->setText( i, 0, res[i] );
+ QStringList res = QStringList::split( ":",prof->getResSpecKopi(), true );
+ int add = res.count()/2;
+ int i;
+ for ( i = 0;i < add ; ++i ) {
+ mResTableKopi->setText( i, 0, res[i+add] );
}
- res = QStringList::split( ":",prof->getResSpecKapi());
- for ( i = 0;i < res.count(); ++i ) {
- mResTableKapi->setText( i, 0, res[i] );
+ res = QStringList::split( ":",prof->getResSpecKapi(), true);
+ add = res.count()/2;
+ for ( i = 0;i < add; ++i ) {
+ mResTableKapi->setText( i, 0, res[i+add] );
}
mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec());
proGr->setEnabled( item > 2 );
if ( item < 3 ) {
localFileWidget->hide();
remoteFileWidget->hide();
phoneWidget->hide();
piWidget->hide();
} else
kindChanged( prof->getIsLocalFileSync() );
}
void KSyncPrefsDialog::fillSSH()
{
mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
mLocalTempFile->setText("/tmp/mycalendar.ics" );
mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
mLocalTempFileAB->setText("/tmp/std.vcf" );
mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" );
mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" );
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
index d6620c8..b0d3efc 100644
--- a/libkdepim/ksyncprofile.cpp
+++ b/libkdepim/ksyncprofile.cpp
@@ -121,48 +121,50 @@ void KSyncProfile::setDefault()
mAskForPreferences = true;
mWriteBackExisting = false;
mWriteBackFuture = false;
mWriteBackFutureWeeks = 12;
mWriteBackPastWeeks = 2;
mWriteBackFile = true;
mIncludeInRingSync = false;
mIncludeInRingSyncAB = false;
mIncludeInRingSyncPWM = false;
mSyncPrefs = SYNC_PREF_ASK;
mIsLocalFileSync = true;
mName = "noName";
mIsPhoneSync = false;
mIsPiSync = false;
mIsPiSyncSpec = false;
mIsKapiFile = false;
mWriteContactToSIM = false;
mPhoneDevice = "/dev/ircomm";
mPhoneConnection = "irda";
mPhoneModel = "6310i";
mFilterInCal = "no filter";
mFilterOutCal = "no filter";
mFilterInAB = "no filter";
mFilterOutAB = "no filter";
+ mResSpecKopi = "";
+ mResSpecKapi = "";
}
void KSyncProfile::readConfig(KConfig *config )
{
if (config)
{
config->setGroup( mName );
mName = config->readEntry( "Name", mName );
mRemotePw = config->readEntry( "RemotePw",mRemotePw );
mRemoteIP = config->readEntry( "RemoteIP",mRemoteIP );
mRemotePort = config->readEntry( "RemotePort", mRemotePort );
mRemotePwAB = config->readEntry( "RemotePwAB", mRemotePwAB );
mRemoteIPAB = config->readEntry( "RemoteIPAB", mRemoteIPAB );
mRemotePortAB = config->readEntry( "RemotePortAB", mRemotePortAB );
mRemotePwPWM = config->readEntry( "RemotePwPWM", mRemotePwPWM );
mRemoteIPPWM = config->readEntry( "RemoteIPPWM", mRemoteIPPWM );
mRemotePortPWM = config->readEntry( "RemotePortPWM", mRemotePortPWM );
mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand );
mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand );
mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile );
mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName );