-rw-r--r-- | libkdepim/ksyncmanager.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 61a9899..795cd30 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -1140,12 +1140,14 @@ void KSyncManager::syncPi() | |||
1140 | } | 1140 | } |
1141 | mCurrentResourceLocal = ""; | 1141 | mCurrentResourceLocal = ""; |
1142 | mCurrentResourceRemote = ""; | 1142 | mCurrentResourceRemote = ""; |
1143 | qDebug ( "KSM: sync pi %d",mSpecificResources.count() ); | ||
1143 | if ( mSpecificResources.count() ) { | 1144 | if ( mSpecificResources.count() ) { |
1144 | int lastSyncRes = mSpecificResources.count()/2; | 1145 | int lastSyncRes = mSpecificResources.count()/2; |
1145 | int ccc = mSpecificResources.count()-1; | 1146 | int ccc = mSpecificResources.count()-1; |
1146 | while ( lastSyncRes > 0 && ccc > 0 && mSpecificResources[ ccc ].isEmpty() ) { | 1147 | while ( lastSyncRes > 0 && ccc > 0 && mSpecificResources[ ccc ].isEmpty() ) { |
1147 | --ccc; | 1148 | --ccc; |
1148 | --lastSyncRes; | 1149 | --lastSyncRes; |
1150 | qDebug ( "KSM: sync pi %d",ccc ); | ||
1149 | } | 1151 | } |
1150 | int startLocal = 0; | 1152 | int startLocal = 0; |
1151 | int startRemote = mSpecificResources.count()/2; | 1153 | int startRemote = mSpecificResources.count()/2; |
@@ -1155,7 +1157,8 @@ void KSyncManager::syncPi() | |||
1155 | emit multiResourceSyncStart( false ); | 1157 | emit multiResourceSyncStart( false ); |
1156 | mPisyncFinished = false; | 1158 | mPisyncFinished = false; |
1157 | mCurrentResourceLocal = mSpecificResources[ startLocal ]; | 1159 | mCurrentResourceLocal = mSpecificResources[ startLocal ]; |
1158 | mCurrentResourceRemote = mSpecificResources[ startRemote ]; | 1160 | mCurrentResourceRemote = mSpecificResources[ startRemote ]; |
1161 | qDebug ( "KSM: AAASyncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); | ||
1159 | if ( !mCurrentResourceRemote.isEmpty() ) { | 1162 | if ( !mCurrentResourceRemote.isEmpty() ) { |
1160 | qDebug ( "KSM: Syncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); | 1163 | qDebug ( "KSM: Syncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); |
1161 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | 1164 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); |
@@ -1166,8 +1169,10 @@ void KSyncManager::syncPi() | |||
1166 | qApp->processEvents(); | 1169 | qApp->processEvents(); |
1167 | } | 1170 | } |
1168 | } | 1171 | } |
1172 | ++startRemote; | ||
1169 | ++startLocal; | 1173 | ++startLocal; |
1170 | } | 1174 | } |
1175 | mPisyncFinished = true; | ||
1171 | } else { | 1176 | } else { |
1172 | KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | 1177 | KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); |
1173 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1178 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
@@ -1516,6 +1521,8 @@ KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port | |||
1516 | mRemoteResource = remres; | 1521 | mRemoteResource = remres; |
1517 | if ( mRemoteResource.isEmpty() ) | 1522 | if ( mRemoteResource.isEmpty() ) |
1518 | mRemoteResource = "ALL"; | 1523 | mRemoteResource = "ALL"; |
1524 | else | ||
1525 | mRemoteResource.replace (QRegExp (" "),"_" ); | ||
1519 | mPassWord = password; | 1526 | mPassWord = password; |
1520 | mSocket = 0; | 1527 | mSocket = 0; |
1521 | mFirst = false; | 1528 | mFirst = false; |
@@ -1542,7 +1549,7 @@ void KCommandSocket::sendFileRequest() | |||
1542 | os.setEncoding( QTextStream::Latin1 ); | 1549 | os.setEncoding( QTextStream::Latin1 ); |
1543 | 1550 | ||
1544 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); | 1551 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); |
1545 | os << "GET " << mPassWord << curDt << mRemoteResource << "\r\n\r\n"; | 1552 | os << "GET " << mPassWord << curDt << " " << mRemoteResource << "\r\n\r\n"; |
1546 | } | 1553 | } |
1547 | 1554 | ||
1548 | void KCommandSocket::readFile( QString fn ) | 1555 | void KCommandSocket::readFile( QString fn ) |
@@ -1617,7 +1624,7 @@ void KCommandSocket::writeFileToSocket() | |||
1617 | ts2.setEncoding( QTextStream::Latin1 ); | 1624 | ts2.setEncoding( QTextStream::Latin1 ); |
1618 | QTextStream os2( mSocket ); | 1625 | QTextStream os2( mSocket ); |
1619 | os2.setEncoding( QTextStream::Latin1 ); | 1626 | os2.setEncoding( QTextStream::Latin1 ); |
1620 | os2 << "PUT " << mPassWord << mRemoteResource << "\r\n\r\n";; | 1627 | os2 << "PUT " << mPassWord << " " << mRemoteResource << "\r\n\r\n";; |
1621 | int byteCount = 0; | 1628 | int byteCount = 0; |
1622 | int byteMax = file2.size()/53; | 1629 | int byteMax = file2.size()/53; |
1623 | while ( ! ts2.atEnd() ) { | 1630 | while ( ! ts2.atEnd() ) { |