author | zautrix <zautrix> | 2005-11-25 20:49:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 20:49:16 (UTC) |
commit | 2468bddcb380d8621d5bb49b69b3492d90562d93 (patch) (unidiff) | |
tree | c310f4fff5e476087e8406614e57a7f258f1b14f /libkdepim | |
parent | 7a439999b9fa2bd7ad76e195cdf95bf5211952cb (diff) | |
download | kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.zip kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.tar.gz kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.tar.bz2 |
sync
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 795cd30..d2cb71b 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -1015,275 +1015,274 @@ void KSyncManager::syncKDE() | |||
1015 | if ( syncWithFile( fileName,true ) ) { | 1015 | if ( syncWithFile( fileName,true ) ) { |
1016 | if ( mWriteBackFile ) { | 1016 | if ( mWriteBackFile ) { |
1017 | command += " --read"; | 1017 | command += " --read"; |
1018 | system ( command.latin1()); | 1018 | system ( command.latin1()); |
1019 | } | 1019 | } |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | } | 1022 | } |
1023 | break; | 1023 | break; |
1024 | case (PWMPI): | 1024 | case (PWMPI): |
1025 | 1025 | ||
1026 | break; | 1026 | break; |
1027 | default: | 1027 | default: |
1028 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); | 1028 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); |
1029 | break; | 1029 | break; |
1030 | 1030 | ||
1031 | } | 1031 | } |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | void KSyncManager::syncSharp() | 1034 | void KSyncManager::syncSharp() |
1035 | { | 1035 | { |
1036 | 1036 | ||
1037 | if ( ! syncExternalApplication("sharp") ) | 1037 | if ( ! syncExternalApplication("sharp") ) |
1038 | qDebug("KSM::ERROR sync sharp "); | 1038 | qDebug("KSM::ERROR sync sharp "); |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | bool KSyncManager::syncExternalApplication(QString resource) | 1041 | bool KSyncManager::syncExternalApplication(QString resource) |
1042 | { | 1042 | { |
1043 | 1043 | ||
1044 | emit save(); | 1044 | emit save(); |
1045 | 1045 | ||
1046 | if ( mAskForPreferences ) | 1046 | if ( mAskForPreferences ) |
1047 | if ( !edit_sync_options()) { | 1047 | if ( !edit_sync_options()) { |
1048 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 1048 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
1049 | return false; | 1049 | return false; |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | qDebug("KSM::Sync extern %s", resource.latin1()); | 1052 | qDebug("KSM::Sync extern %s", resource.latin1()); |
1053 | 1053 | ||
1054 | bool syncOK = mImplementation->syncExternal(this, resource); | 1054 | bool syncOK = mImplementation->syncExternal(this, resource); |
1055 | 1055 | ||
1056 | return syncOK; | 1056 | return syncOK; |
1057 | 1057 | ||
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | void KSyncManager::syncPhone() | 1060 | void KSyncManager::syncPhone() |
1061 | { | 1061 | { |
1062 | 1062 | ||
1063 | syncExternalApplication("phone"); | 1063 | syncExternalApplication("phone"); |
1064 | 1064 | ||
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) | 1067 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) |
1068 | { | 1068 | { |
1069 | if (!bar->isVisible()) | 1069 | if (!bar->isVisible()) |
1070 | { | 1070 | { |
1071 | int w = 300; | 1071 | int w = 300; |
1072 | if ( QApplication::desktop()->width() < 320 ) | 1072 | if ( QApplication::desktop()->width() < 320 ) |
1073 | w = 220; | 1073 | w = 220; |
1074 | int h = bar->sizeHint().height() ; | 1074 | int h = bar->sizeHint().height() ; |
1075 | int dw = QApplication::desktop()->width(); | 1075 | int dw = QApplication::desktop()->width(); |
1076 | int dh = QApplication::desktop()->height(); | 1076 | int dh = QApplication::desktop()->height(); |
1077 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1077 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1078 | bar->setCaption (caption); | 1078 | bar->setCaption (caption); |
1079 | bar->setTotalSteps ( total ) ; | 1079 | bar->setTotalSteps ( total ) ; |
1080 | bar->show(); | 1080 | bar->show(); |
1081 | } | 1081 | } |
1082 | bar->raise(); | 1082 | bar->raise(); |
1083 | bar->setProgress( percentage ); | 1083 | bar->setProgress( percentage ); |
1084 | qApp->processEvents(); | 1084 | qApp->processEvents(); |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | void KSyncManager::hideProgressBar() | 1087 | void KSyncManager::hideProgressBar() |
1088 | { | 1088 | { |
1089 | bar->hide(); | 1089 | bar->hide(); |
1090 | qApp->processEvents(); | 1090 | qApp->processEvents(); |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | bool KSyncManager::isProgressBarCanceled() | 1093 | bool KSyncManager::isProgressBarCanceled() |
1094 | { | 1094 | { |
1095 | return !bar->isVisible(); | 1095 | return !bar->isVisible(); |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | QString KSyncManager::syncFileName() | 1098 | QString KSyncManager::syncFileName() |
1099 | { | 1099 | { |
1100 | 1100 | ||
1101 | QString fn = "tempfile"; | 1101 | QString fn = "tempfile"; |
1102 | switch(mTargetApp) | 1102 | switch(mTargetApp) |
1103 | { | 1103 | { |
1104 | case (KAPI): | 1104 | case (KAPI): |
1105 | fn = "tempsyncab.vcf"; | 1105 | fn = "tempsyncab.vcf"; |
1106 | break; | 1106 | break; |
1107 | case (KOPI): | 1107 | case (KOPI): |
1108 | fn = "tempsynccal.ics"; | 1108 | fn = "tempsynccal.ics"; |
1109 | break; | 1109 | break; |
1110 | case (PWMPI): | 1110 | case (PWMPI): |
1111 | fn = "tempsyncpw.pwm"; | 1111 | fn = "tempsyncpw.pwm"; |
1112 | break; | 1112 | break; |
1113 | default: | 1113 | default: |
1114 | break; | 1114 | break; |
1115 | } | 1115 | } |
1116 | #ifdef DESKTOP_VERSION | 1116 | #ifdef DESKTOP_VERSION |
1117 | return locateLocal( "tmp", fn ); | 1117 | return locateLocal( "tmp", fn ); |
1118 | #else | 1118 | #else |
1119 | return (QString( "/tmp/" )+ fn ); | 1119 | return (QString( "/tmp/" )+ fn ); |
1120 | #endif | 1120 | #endif |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | void KSyncManager::syncPi() | 1123 | void KSyncManager::syncPi() |
1124 | { | 1124 | { |
1125 | mIsKapiFile = true; | 1125 | mIsKapiFile = true; |
1126 | mPisyncFinished = false; | 1126 | mPisyncFinished = false; |
1127 | qApp->processEvents(); | 1127 | qApp->processEvents(); |
1128 | if ( mAskForPreferences ) | 1128 | if ( mAskForPreferences ) |
1129 | if ( !edit_pisync_options()) { | 1129 | if ( !edit_pisync_options()) { |
1130 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 1130 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
1131 | mPisyncFinished = true; | 1131 | mPisyncFinished = true; |
1132 | return; | 1132 | return; |
1133 | } | 1133 | } |
1134 | bool ok; | 1134 | bool ok; |
1135 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 1135 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
1136 | if ( ! ok ) { | 1136 | if ( ! ok ) { |
1137 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 1137 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
1138 | mPisyncFinished = true; | 1138 | mPisyncFinished = true; |
1139 | return; | 1139 | return; |
1140 | } | 1140 | } |
1141 | mCurrentResourceLocal = ""; | 1141 | mCurrentResourceLocal = ""; |
1142 | mCurrentResourceRemote = ""; | 1142 | mCurrentResourceRemote = ""; |
1143 | qDebug ( "KSM: sync pi %d",mSpecificResources.count() ); | ||
1144 | if ( mSpecificResources.count() ) { | 1143 | if ( mSpecificResources.count() ) { |
1145 | int lastSyncRes = mSpecificResources.count()/2; | 1144 | int lastSyncRes = mSpecificResources.count()/2; |
1146 | int ccc = mSpecificResources.count()-1; | 1145 | int ccc = mSpecificResources.count()-1; |
1147 | while ( lastSyncRes > 0 && ccc > 0 && mSpecificResources[ ccc ].isEmpty() ) { | 1146 | while ( lastSyncRes > 0 && ccc > 0 && mSpecificResources[ ccc ].isEmpty() ) { |
1148 | --ccc; | 1147 | --ccc; |
1149 | --lastSyncRes; | 1148 | --lastSyncRes; |
1150 | qDebug ( "KSM: sync pi %d",ccc ); | 1149 | //qDebug ( "KSM: sync pi %d",ccc ); |
1151 | } | 1150 | } |
1152 | int startLocal = 0; | 1151 | int startLocal = 0; |
1153 | int startRemote = mSpecificResources.count()/2; | 1152 | int startRemote = mSpecificResources.count()/2; |
1154 | emit multiResourceSyncStart( true ); | 1153 | emit multiResourceSyncStart( true ); |
1155 | while ( startLocal < mSpecificResources.count()/2 ) { | 1154 | while ( startLocal < mSpecificResources.count()/2 ) { |
1156 | if ( startLocal+1 >= lastSyncRes ) | 1155 | if ( startLocal+1 >= lastSyncRes ) |
1157 | emit multiResourceSyncStart( false ); | 1156 | emit multiResourceSyncStart( false ); |
1158 | mPisyncFinished = false; | 1157 | mPisyncFinished = false; |
1159 | mCurrentResourceLocal = mSpecificResources[ startLocal ]; | 1158 | mCurrentResourceLocal = mSpecificResources[ startLocal ]; |
1160 | mCurrentResourceRemote = mSpecificResources[ startRemote ]; | 1159 | mCurrentResourceRemote = mSpecificResources[ startRemote ]; |
1161 | qDebug ( "KSM: AAASyncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); | 1160 | //qDebug ( "KSM: AAASyncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); |
1162 | if ( !mCurrentResourceRemote.isEmpty() ) { | 1161 | if ( !mCurrentResourceRemote.isEmpty() ) { |
1163 | qDebug ( "KSM: Syncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); | 1162 | qDebug ( "KSM: Syncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); |
1164 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | 1163 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); |
1165 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1164 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
1166 | commandSocket->readFile( syncFileName() ); | 1165 | commandSocket->readFile( syncFileName() ); |
1167 | while ( !mPisyncFinished ) { | 1166 | while ( !mPisyncFinished ) { |
1168 | //qDebug("waiting "); | 1167 | //qDebug("waiting "); |
1169 | qApp->processEvents(); | 1168 | qApp->processEvents(); |
1170 | } | 1169 | } |
1171 | } | 1170 | } |
1172 | ++startRemote; | 1171 | ++startRemote; |
1173 | ++startLocal; | 1172 | ++startLocal; |
1174 | } | 1173 | } |
1175 | mPisyncFinished = true; | 1174 | mPisyncFinished = true; |
1176 | } else { | 1175 | } else { |
1177 | KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | 1176 | KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); |
1178 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1177 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
1179 | commandSocket->readFile( syncFileName() ); | 1178 | commandSocket->readFile( syncFileName() ); |
1180 | } | 1179 | } |
1181 | } | 1180 | } |
1182 | 1181 | ||
1183 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | 1182 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) |
1184 | { | 1183 | { |
1185 | //enum { success, errorW, errorR, quiet }; | 1184 | //enum { success, errorW, errorR, quiet }; |
1186 | 1185 | ||
1187 | 1186 | ||
1188 | 1187 | ||
1189 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ||state == KCommandSocket::errorPW || | 1188 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ||state == KCommandSocket::errorPW || |
1190 | state == KCommandSocket::errorCA ||state == KCommandSocket::errorFI ||state == KCommandSocket::errorUN||state == KCommandSocket::errorED ) { | 1189 | state == KCommandSocket::errorCA ||state == KCommandSocket::errorFI ||state == KCommandSocket::errorUN||state == KCommandSocket::errorED ) { |
1191 | if ( state == KCommandSocket::errorPW ) | 1190 | if ( state == KCommandSocket::errorPW ) |
1192 | mParent->topLevelWidget()->setCaption( i18n("Wrong password: Receiving remote file failed.") ); | 1191 | mParent->topLevelWidget()->setCaption( i18n("Wrong password: Receiving remote file failed.") ); |
1193 | else if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) | 1192 | else if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) |
1194 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); | 1193 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); |
1195 | else if ( state == KCommandSocket::errorCA ) | 1194 | else if ( state == KCommandSocket::errorCA ) |
1196 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled from remote.") ); | 1195 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled from remote.") ); |
1197 | else if ( state == KCommandSocket::errorFI ) | 1196 | else if ( state == KCommandSocket::errorFI ) |
1198 | mParent->topLevelWidget()->setCaption( i18n("File error on remote.") ); | 1197 | mParent->topLevelWidget()->setCaption( i18n("File error on remote.") ); |
1199 | else if ( state == KCommandSocket::errorED ) | 1198 | else if ( state == KCommandSocket::errorED ) |
1200 | mParent->topLevelWidget()->setCaption( i18n("Please close error dialog on remote.") ); | 1199 | mParent->topLevelWidget()->setCaption( i18n("Please close error dialog on remote.") ); |
1201 | else if ( state == KCommandSocket::errorUN ) | 1200 | else if ( state == KCommandSocket::errorUN ) |
1202 | mParent->topLevelWidget()->setCaption( i18n("Unknown error on remote.") ); | 1201 | mParent->topLevelWidget()->setCaption( i18n("Unknown error on remote.") ); |
1203 | delete s; | 1202 | delete s; |
1204 | if ( state == KCommandSocket::errorR ) { | 1203 | if ( state == KCommandSocket::errorR ) { |
1205 | KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); | 1204 | KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); |
1206 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1205 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1207 | commandSocket->sendStop(); | 1206 | commandSocket->sendStop(); |
1208 | } | 1207 | } |
1209 | mPisyncFinished = true; | 1208 | mPisyncFinished = true; |
1210 | return; | 1209 | return; |
1211 | 1210 | ||
1212 | } else if ( state == KCommandSocket::errorW ) { | 1211 | } else if ( state == KCommandSocket::errorW ) { |
1213 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); | 1212 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); |
1214 | mPisyncFinished = true; | 1213 | mPisyncFinished = true; |
1215 | 1214 | ||
1216 | } else if ( state == KCommandSocket::successR ) { | 1215 | } else if ( state == KCommandSocket::successR ) { |
1217 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 1216 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
1218 | 1217 | ||
1219 | } else if ( state == KCommandSocket::successW ) { | 1218 | } else if ( state == KCommandSocket::successW ) { |
1220 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); | 1219 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); |
1221 | mPisyncFinished = true; | 1220 | mPisyncFinished = true; |
1222 | } else if ( state == KCommandSocket::quiet ){ | 1221 | } else if ( state == KCommandSocket::quiet ){ |
1223 | qDebug("KSS: quiet "); | 1222 | qDebug("KSS: quiet "); |
1224 | mPisyncFinished = true; | 1223 | mPisyncFinished = true; |
1225 | } else { | 1224 | } else { |
1226 | qDebug("KSS: Error: unknown state: %d ", state); | 1225 | qDebug("KSS: Error: unknown state: %d ", state); |
1227 | mPisyncFinished = true; | 1226 | mPisyncFinished = true; |
1228 | } | 1227 | } |
1229 | 1228 | ||
1230 | delete s; | 1229 | delete s; |
1231 | } | 1230 | } |
1232 | 1231 | ||
1233 | void KSyncManager::readFileFromSocket() | 1232 | void KSyncManager::readFileFromSocket() |
1234 | { | 1233 | { |
1235 | QString fileName = syncFileName(); | 1234 | QString fileName = syncFileName(); |
1236 | bool syncOK = true; | 1235 | bool syncOK = true; |
1237 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); | 1236 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); |
1238 | if ( ! syncWithFile( fileName , true ) ) { | 1237 | if ( ! syncWithFile( fileName , true ) ) { |
1239 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); | 1238 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); |
1240 | syncOK = false; | 1239 | syncOK = false; |
1241 | } | 1240 | } |
1242 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote,mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); | 1241 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote,mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); |
1243 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1242 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1244 | if ( mWriteBackFile && syncOK ) { | 1243 | if ( mWriteBackFile && syncOK ) { |
1245 | mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") ); | 1244 | mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") ); |
1246 | commandSocket->writeFile( fileName ); | 1245 | commandSocket->writeFile( fileName ); |
1247 | } | 1246 | } |
1248 | else { | 1247 | else { |
1249 | commandSocket->sendStop(); | 1248 | commandSocket->sendStop(); |
1250 | if ( syncOK ) | 1249 | if ( syncOK ) |
1251 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 1250 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
1252 | mPisyncFinished = true; | 1251 | mPisyncFinished = true; |
1253 | } | 1252 | } |
1254 | } | 1253 | } |
1255 | 1254 | ||
1256 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 1255 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |
1257 | { | 1256 | { |
1258 | mPassWord = pw; | 1257 | mPassWord = pw; |
1259 | mSocket = 0; | 1258 | mSocket = 0; |
1260 | mSyncActionDialog = 0; | 1259 | mSyncActionDialog = 0; |
1261 | blockRC = false; | 1260 | blockRC = false; |
1262 | mErrorMessage = 0; | 1261 | mErrorMessage = 0; |
1263 | } | 1262 | } |
1264 | 1263 | ||
1265 | void KServerSocket::newConnection ( int socket ) | 1264 | void KServerSocket::newConnection ( int socket ) |
1266 | { | 1265 | { |
1267 | // qDebug("KServerSocket:New connection %d ", socket); | 1266 | // qDebug("KServerSocket:New connection %d ", socket); |
1268 | if ( mSocket ) { | 1267 | if ( mSocket ) { |
1269 | qDebug("KSS::newConnection Socket deleted! "); | 1268 | qDebug("KSS::newConnection Socket deleted! "); |
1270 | delete mSocket; | 1269 | delete mSocket; |
1271 | mSocket = 0; | 1270 | mSocket = 0; |
1272 | } | 1271 | } |
1273 | mSocket = new QSocket( this ); | 1272 | mSocket = new QSocket( this ); |
1274 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 1273 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
1275 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 1274 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
1276 | mSocket->setSocket( socket ); | 1275 | mSocket->setSocket( socket ); |
1277 | } | 1276 | } |
1278 | 1277 | ||
1279 | void KServerSocket::discardClient() | 1278 | void KServerSocket::discardClient() |
1280 | { | 1279 | { |
1281 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1280 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1282 | } | 1281 | } |
1283 | void KServerSocket::deleteSocket() | 1282 | void KServerSocket::deleteSocket() |
1284 | { | 1283 | { |
1285 | qDebug("KSS::deleteSocket"); | 1284 | qDebug("KSS::deleteSocket"); |
1286 | if ( mSocket ) { | 1285 | if ( mSocket ) { |
1287 | delete mSocket; | 1286 | delete mSocket; |
1288 | mSocket = 0; | 1287 | mSocket = 0; |
1289 | } | 1288 | } |