summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/ksyncmanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 0109c02..28c48fe 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -732,49 +732,48 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
postCommand = prof->getPostSyncCommand();
localTempFile = prof->getLocalTempFile();
break;
case (PWMPI):
preCommand = prof->getPreSyncCommandPWM();
postCommand = prof->getPostSyncCommandPWM();
localTempFile = prof->getLocalTempFilePWM();
break;
default:
qDebug("KSM::syncRemote: invalid apptype selected");
break;
}
int fi;
if ( (fi = preCommand.find("$PWD$")) > 0 ) {
QString pwd = getPassword();
preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 );
}
int maxlen = 30;
if ( QApplication::desktop()->width() > 320 )
maxlen += 25;
mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) );
- int fileSize = 0;
int result = system ( preCommand );
// 0 : okay
// 256: no such file or dir
//
qDebug("KSM::Sync: Remote copy result(0 = okay): %d ",result );
if ( result != 0 ) {
unsigned int len = maxlen;
while ( len < preCommand.length() ) {
preCommand.insert( len , "\n" );
len += maxlen +2;
}
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 (preCommand) ;
QMessageBox::information( mParent, i18n("Sync - ERROR"),
question,
i18n("Okay!")) ;
mParent->topLevelWidget()->setCaption ("KDE-Pim");
return;
}
mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) );
//qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
if ( syncWithFile( localTempFile, true ) ) {
if ( mWriteBackFile ) {
@@ -903,49 +902,49 @@ QString KSyncManager::getPassword( )
retfile = lab.text();
dia.hide();
qApp->processEvents();
return retfile;
}
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();
QStringList oldSyncProfileNames = mSyncProfileNames;
mSyncProfileNames = sp->getSyncProfileNames();
mLocalMachineName = sp->getLocalMachineName ();
- int ii;
+ uint ii;
for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) {
if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) )
mImplementation->removeSyncInfo( oldSyncProfileNames[ii] );
}
QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
}
void KSyncManager::syncKDE()
{
mSyncWithDesktop = true;
emit save();
switch(mTargetApp)
{
case (KAPI):
{
#ifdef DESKTOP_VERSION
QString command = "kdeabdump33";
QString commandfile = "kdeabdump33";
QString commandpath = qApp->applicationDirPath () + "/";
#else
QString command = "kdeabdump33";
QString commandfile = "kdeabdump33";
QString commandpath = QDir::homeDirPath ()+"/";
#endif
if ( ! QFile::exists ( commandpath+commandfile ) )
@@ -1120,57 +1119,57 @@ 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;
+ uint lastSyncRes = mSpecificResources.count()/2;
int ccc = mSpecificResources.count()-1;
while ( lastSyncRes > 0 && ccc > 0 && mSpecificResources[ ccc ].isEmpty() ) {
--ccc;
--lastSyncRes;
//qDebug ( "KSM: sync pi %d",ccc );
}
- int startLocal = 0;
- int startRemote = mSpecificResources.count()/2;
+ uint startLocal = 0;
+ uint startRemote = mSpecificResources.count()/2;
emit multiResourceSyncStart( true );
while ( startLocal < mSpecificResources.count()/2 ) {
if ( startLocal+1 >= lastSyncRes )
emit multiResourceSyncStart( false );
mPisyncFinished = false;
mCurrentResourceLocal = mSpecificResources[ startLocal ];
mCurrentResourceRemote = mSpecificResources[ startRemote ];
//qDebug ( "KSM: AAASyncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() );
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() );
mParent->topLevelWidget()->setCaption( i18n("Syncing %1 <-> %2").arg( mCurrentResourceLocal ).arg( mCurrentResourceRemote ) );
while ( !mPisyncFinished ) {
//qDebug("waiting ");
qApp->processEvents();
}
if ( startLocal+1 < mSpecificResources.count()/2 ) {
mParent->topLevelWidget()->setCaption( i18n("Waiting 2 secs before syncing next resource...") );
QTime timer;
timer.start();
while ( timer.elapsed () < 2000 ) {