author | zautrix <zautrix> | 2004-10-07 10:37:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 10:37:59 (UTC) |
commit | f0e8b8f36bccda952fa662e4faf2d58fcee67262 (patch) (unidiff) | |
tree | f1d26c6d9e8bdba9b15464682b8a64b1d3e04d8b /libkdepim | |
parent | 95508093d45aaf062813b7824884f964ee2d4d9a (diff) | |
download | kdepimpi-f0e8b8f36bccda952fa662e4faf2d58fcee67262.zip kdepimpi-f0e8b8f36bccda952fa662e4faf2d58fcee67262.tar.gz kdepimpi-f0e8b8f36bccda952fa662e4faf2d58fcee67262.tar.bz2 |
fix for different targets
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index ea543dd..b360644 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -156,131 +156,141 @@ void KSyncManager::slotSyncMenu( int action ) | |||
156 | if ( action == 3 ) { | 156 | if ( action == 3 ) { |
157 | delete mServerSocket; | 157 | delete mServerSocket; |
158 | mServerSocket = 0; | 158 | mServerSocket = 0; |
159 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 159 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
160 | return; | 160 | return; |
161 | } | 161 | } |
162 | 162 | ||
163 | if (blockSave()) | 163 | if (blockSave()) |
164 | return; | 164 | return; |
165 | 165 | ||
166 | setBlockSave(true); | 166 | setBlockSave(true); |
167 | 167 | ||
168 | mCurrentSyncProfile = action - 1000 ; | 168 | mCurrentSyncProfile = action - 1000 ; |
169 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; | 169 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; |
170 | mCurrentSyncName = mLocalMachineName ; | 170 | mCurrentSyncName = mLocalMachineName ; |
171 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 171 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
172 | KSyncProfile* temp = new KSyncProfile (); | 172 | KSyncProfile* temp = new KSyncProfile (); |
173 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); | 173 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); |
174 | temp->readConfig(&config); | 174 | temp->readConfig(&config); |
175 | mAskForPreferences = temp->getAskForPreferences(); | 175 | mAskForPreferences = temp->getAskForPreferences(); |
176 | mSyncAlgoPrefs = temp->getSyncPrefs(); | 176 | mSyncAlgoPrefs = temp->getSyncPrefs(); |
177 | mWriteBackFile = temp->getWriteBackFile(); | 177 | mWriteBackFile = temp->getWriteBackFile(); |
178 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 178 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
179 | mWriteBackInFuture = 0; | 179 | mWriteBackInFuture = 0; |
180 | if ( temp->getWriteBackFuture() ) | 180 | if ( temp->getWriteBackFuture() ) |
181 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 181 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
182 | mShowSyncSummary = temp->getShowSummaryAfterSync(); | 182 | mShowSyncSummary = temp->getShowSummaryAfterSync(); |
183 | if ( action == 1000 ) { | 183 | if ( action == 1000 ) { |
184 | syncSharp(); | 184 | syncSharp(); |
185 | 185 | ||
186 | } else if ( action == 1001 ) { | 186 | } else if ( action == 1001 ) { |
187 | syncLocalFile(); | 187 | syncLocalFile(); |
188 | 188 | ||
189 | } else if ( action == 1002 ) { | 189 | } else if ( action == 1002 ) { |
190 | quickSyncLocalFile(); | 190 | quickSyncLocalFile(); |
191 | 191 | ||
192 | } else if ( action >= 1003 ) { | 192 | } else if ( action >= 1003 ) { |
193 | if ( temp->getIsLocalFileSync() ) { | 193 | if ( temp->getIsLocalFileSync() ) { |
194 | switch(mTargetApp) | 194 | switch(mTargetApp) |
195 | { | 195 | { |
196 | case (KAPI): | 196 | case (KAPI): |
197 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 197 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
198 | mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 198 | mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
199 | break; | 199 | break; |
200 | case (KOPI): | 200 | case (KOPI): |
201 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 201 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
202 | mLastSyncedLocalFile = temp->getRemoteFileName(); | 202 | mLastSyncedLocalFile = temp->getRemoteFileName(); |
203 | break; | 203 | break; |
204 | case (PWMPI): | 204 | case (PWMPI): |
205 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 205 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
206 | mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 206 | mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
207 | break; | 207 | break; |
208 | default: | 208 | default: |
209 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 209 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
210 | break; | 210 | break; |
211 | 211 | ||
212 | } | 212 | } |
213 | } else { | 213 | } else { |
214 | if ( temp->getIsPhoneSync() ) { | 214 | if ( temp->getIsPhoneSync() ) { |
215 | mPhoneDevice = temp->getPhoneDevice( ) ; | 215 | mPhoneDevice = temp->getPhoneDevice( ) ; |
216 | mPhoneConnection = temp->getPhoneConnection( ); | 216 | mPhoneConnection = temp->getPhoneConnection( ); |
217 | mPhoneModel = temp->getPhoneModel( ); | 217 | mPhoneModel = temp->getPhoneModel( ); |
218 | syncPhone(); | 218 | syncPhone(); |
219 | } else if ( temp->getIsPiSync() ) { | 219 | } else if ( temp->getIsPiSync() ) { |
220 | mPassWordPiSync = temp->getRemotePw(); | 220 | if ( mTargetApp == KAPI ) { |
221 | mActiveSyncPort = temp->getRemotePort(); | 221 | mPassWordPiSync = temp->getRemotePwAB(); |
222 | mActiveSyncIP = temp->getRemoteIP(); | 222 | mActiveSyncPort = temp->getRemotePortAB(); |
223 | mActiveSyncIP = temp->getRemoteIPAB(); | ||
224 | } else if ( mTargetApp == KOPI ) { | ||
225 | mPassWordPiSync = temp->getRemotePw(); | ||
226 | mActiveSyncPort = temp->getRemotePort(); | ||
227 | mActiveSyncIP = temp->getRemoteIP(); | ||
228 | } else { | ||
229 | mPassWordPiSync = temp->getRemotePwPWM(); | ||
230 | mActiveSyncPort = temp->getRemotePortPWM(); | ||
231 | mActiveSyncIP = temp->getRemoteIPPWM(); | ||
232 | } | ||
223 | syncPi(); | 233 | syncPi(); |
224 | } | 234 | } |
225 | syncRemote( temp ); | 235 | syncRemote( temp ); |
226 | 236 | ||
227 | } | 237 | } |
228 | } | 238 | } |
229 | delete temp; | 239 | delete temp; |
230 | setBlockSave(false); | 240 | setBlockSave(false); |
231 | } | 241 | } |
232 | void KSyncManager::enableQuick() | 242 | void KSyncManager::enableQuick() |
233 | { | 243 | { |
234 | QDialog dia ( 0, "input-dialog", true ); | 244 | QDialog dia ( 0, "input-dialog", true ); |
235 | QLineEdit lab ( &dia ); | 245 | QLineEdit lab ( &dia ); |
236 | QVBoxLayout lay( &dia ); | 246 | QVBoxLayout lay( &dia ); |
237 | lab.setText( mPrefs->mPassiveSyncPort ); | 247 | lab.setText( mPrefs->mPassiveSyncPort ); |
238 | lay.setMargin(7); | 248 | lay.setMargin(7); |
239 | lay.setSpacing(7); | 249 | lay.setSpacing(7); |
240 | int po = 9197+mTargetApp; | 250 | int po = 9197+mTargetApp; |
241 | QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); | 251 | QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); |
242 | lay.addWidget( &label); | 252 | lay.addWidget( &label); |
243 | lay.addWidget( &lab); | 253 | lay.addWidget( &lab); |
244 | 254 | ||
245 | QLineEdit lepw ( &dia ); | 255 | QLineEdit lepw ( &dia ); |
246 | lepw.setText( mPrefs->mPassiveSyncPw ); | 256 | lepw.setText( mPrefs->mPassiveSyncPw ); |
247 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); | 257 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); |
248 | lay.addWidget( &label2); | 258 | lay.addWidget( &label2); |
249 | lay.addWidget( &lepw); | 259 | lay.addWidget( &lepw); |
250 | dia.setFixedSize( 230,80 ); | 260 | dia.setFixedSize( 230,80 ); |
251 | dia.setCaption( i18n("Enter port for Pi-Sync") ); | 261 | dia.setCaption( i18n("Enter port for Pi-Sync") ); |
252 | QPushButton pb ( "OK", &dia); | 262 | QPushButton pb ( "OK", &dia); |
253 | lay.addWidget( &pb ); | 263 | lay.addWidget( &pb ); |
254 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 264 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
255 | dia.show(); | 265 | dia.show(); |
256 | if ( ! dia.exec() ) | 266 | if ( ! dia.exec() ) |
257 | return; | 267 | return; |
258 | dia.hide(); | 268 | dia.hide(); |
259 | qApp->processEvents(); | 269 | qApp->processEvents(); |
260 | mPrefs->mPassiveSyncPw = lepw.text(); | 270 | mPrefs->mPassiveSyncPw = lepw.text(); |
261 | mPrefs->mPassiveSyncPort = lab.text(); | 271 | mPrefs->mPassiveSyncPort = lab.text(); |
262 | bool ok; | 272 | bool ok; |
263 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); | 273 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); |
264 | if ( ! ok ) { | 274 | if ( ! ok ) { |
265 | KMessageBox::information( 0, i18n("No valid port")); | 275 | KMessageBox::information( 0, i18n("No valid port")); |
266 | return; | 276 | return; |
267 | } | 277 | } |
268 | //qDebug("port %d ", port); | 278 | //qDebug("port %d ", port); |
269 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); | 279 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); |
270 | mServerSocket->setFileName( defaultFileName() ); | 280 | mServerSocket->setFileName( defaultFileName() ); |
271 | //qDebug("connected "); | 281 | //qDebug("connected "); |
272 | if ( !mServerSocket->ok() ) { | 282 | if ( !mServerSocket->ok() ) { |
273 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); | 283 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); |
274 | delete mServerSocket; | 284 | delete mServerSocket; |
275 | mServerSocket = 0; | 285 | mServerSocket = 0; |
276 | return; | 286 | return; |
277 | } | 287 | } |
278 | //connect( mServerSocket, SIGNAL ( saveFile() ),this, SIGNAL ( save() ) ); | 288 | //connect( mServerSocket, SIGNAL ( saveFile() ),this, SIGNAL ( save() ) ); |
279 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); | 289 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); |
280 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 290 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
281 | } | 291 | } |
282 | 292 | ||
283 | void KSyncManager::syncLocalFile() | 293 | void KSyncManager::syncLocalFile() |
284 | { | 294 | { |
285 | 295 | ||
286 | QString fn =mLastSyncedLocalFile; | 296 | QString fn =mLastSyncedLocalFile; |