summaryrefslogtreecommitdiffabout
path: root/libkdepim
Side-by-side diff
Diffstat (limited to 'libkdepim') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/categoryeditdialog.h4
-rw-r--r--libkdepim/categoryselectdialog.cpp1
-rw-r--r--libkdepim/ksyncmanager.cpp9
-rw-r--r--libkdepim/ksyncmanager.h2
4 files changed, 8 insertions, 8 deletions
diff --git a/libkdepim/categoryeditdialog.h b/libkdepim/categoryeditdialog.h
index 3e8ab45..9bb3201 100644
--- a/libkdepim/categoryeditdialog.h
+++ b/libkdepim/categoryeditdialog.h
@@ -1,86 +1,86 @@
/*
This file is part of libkdepim.
Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KPIM_CATEGORYEDITDIALOG_H
#define KPIM_CATEGORYEDITDIALOG_H
#include <categoryeditdialog_base.h>
#include <qlistview.h>
class KPimPrefs;
namespace KPIM {
class CategorySelectItem :public QObject, public QCheckListItem
{
Q_OBJECT
public:
- CategorySelectItem(QListView * parent, const QString & text, Type tt) :
- QCheckListItem (parent, text, tt ) , QObject( parent )
+ CategorySelectItem(QListView * parent, const QString & text, Type tt) : QObject( parent ),
+ QCheckListItem (parent, text, tt )
{;}
signals:
void stateChanged( QListViewItem*);
protected:
virtual void stateChange(bool b)
{
QCheckListItem::stateChange(b);
emit stateChanged( this );
}
};
class CategoryEditDialog : public CategoryEditDialog_base
{
Q_OBJECT
public:
CategoryEditDialog( KPimPrefs *prefs, QWidget* parent = 0,
const char* name = 0,
bool modal = FALSE, WFlags fl = 0 );
~CategoryEditDialog();
public slots:
void add();
void remove();
void modify();
void accept();
void slotOk();
void slotApply();
signals:
void categoryConfigChanged();
private slots:
void editItem(QListViewItem *item);
void slotTextChanged(const QString &text);
KPimPrefs *mPrefs;
};
}
#endif
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp
index a4e0024..2a9b43e 100644
--- a/libkdepim/categoryselectdialog.cpp
+++ b/libkdepim/categoryselectdialog.cpp
@@ -1,140 +1,141 @@
/*
This file is part of libkdepim.
Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlistview.h>
#include <qpushbutton.h>
#include <qheader.h>
#include <qapp.h>
#include <qmessagebox.h>
#include <kmessagebox.h>
#include "categoryeditdialog.h"
#include "categoryselectdialog.h"
#include "kpimprefs.h"
using namespace KPIM;
CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent,
const char* name,
bool modal, WFlags fl )
: CategorySelectDialog_base( parent, name, true, fl ),
mPrefs( prefs )
{
+ Q_UNUSED( modal );
mColorItem = 0;
mColorEnabled = false;
mCategories->header()->hide();
setCategories();
connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog()));
if ( QApplication::desktop()->width() > 460 )
resize( 300, 360 );
else
showMaximized();
connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) );
// connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) );
#ifndef DESKTOP_VERSION
mButtonOk->hide();
mButtonCancel->hide();
#endif
}
void CategorySelectDialog::editCategoriesDialog()
{
KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this );
ced->exec();
delete ced;
slotApply();
QStringList temp = mCategoryList;
setCategories();
setSelected( temp );
}
void CategorySelectDialog::setCategories()
{
mColorItem = 0;
mCategories->clear();
mCategoryList.clear();
QStringList::Iterator it;
for (it = mPrefs->mCustomCategories.begin();
it != mPrefs->mCustomCategories.end(); ++it ) {
CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox);
QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) );
}
}
CategorySelectDialog::~CategorySelectDialog()
{
}
void CategorySelectDialog::setSelected(const QStringList &selList)
{
clear();
QStringList::ConstIterator it;
QStringList notFound;
bool found = false;
for (it=selList.begin();it!=selList.end();++it) {
//qDebug(" CategorySelectDialog::setSelected(");
QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
while (item) {
if (item->text() == *it) {
item->setOn(true);
if ( ! found )
setColorItem( item );
found = true;
break;
}
item = (QCheckListItem *)item->nextSibling();
}
// if ( ! found ) {
//emit updateCategoriesGlobal();
// QMessageBox::information( this, "KO/E: Information!",
// "Categories found, which were not\n"
// "in list of categories!\n"
// "message",
// "OK", "", 0,
// 0, 1 );
// setSelected(selList);
// return;
// }
}
}
QStringList CategorySelectDialog::selectedCategories() const
{
return mCategoryList;
}
void CategorySelectDialog::setColorEnabled()
{
mColorEnabled = true;
mSetColorCat->show();
}
void CategorySelectDialog::setColorCat()
{
QCheckListItem * newColorItem = (QCheckListItem * )mCategories->currentItem ();
if ( !newColorItem ) {
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 0109c02..28c48fe 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -660,364 +660,363 @@ int KSyncManager::ringSync()
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(),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!") );
while ( timer.elapsed () < 2000 ) {
qApp->processEvents();
#ifndef _WIN32_
sleep (1);
#endif
}
}
}
delete temp;
return syncedProfiles;
}
void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
{
QString question;
if ( ask ) {
question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
if ( QMessageBox::information( mParent, i18n("Sync"),
question,
i18n("Yes"), i18n("No"),
0, 0 ) != 0 )
return;
}
QString preCommand;
QString localTempFile;
QString postCommand;
switch(mTargetApp)
{
case (KAPI):
preCommand = prof->getPreSyncCommandAB();
postCommand = prof->getPostSyncCommandAB();
localTempFile = prof->getLocalTempFileAB();
break;
case (KOPI):
preCommand = prof->getPreSyncCommand();
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 ) {
int fi;
if ( (fi = postCommand.find("$PWD$")) > 0 ) {
QString pwd = getPassword();
postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 );
}
mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) );
result = system ( postCommand );
qDebug("KSM::Sync:Writing back file result: %d ", result);
if ( result != 0 ) {
mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
return;
} else {
mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) );
}
}
}
return;
}
bool KSyncManager::edit_pisync_options()
{
QDialog dia( mParent, "dia", true );
dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice );
QVBoxLayout lay ( &dia );
lay.setSpacing( 5 );
lay.setMargin( 3 );
QLabel lab1 ( i18n("Password for remote access:"), &dia);
lay.addWidget( &lab1 );
QLineEdit le1 (&dia );
lay.addWidget( &le1 );
QLabel lab2 ( i18n("Remote IP address:"), &dia);
lay.addWidget( &lab2 );
QLineEdit le2 (&dia );
lay.addWidget( &le2 );
QLabel lab3 ( i18n("Remote port number:\n(May be: 1 - 65535)"), &dia);
lay.addWidget( &lab3 );
QLineEdit le3 (&dia );
lay.addWidget( &le3 );
QPushButton pb ( "OK", &dia);
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
le1.setText( mPassWordPiSync );
le2.setText( mActiveSyncIP );
le3.setText( mActiveSyncPort );
if ( dia.exec() ) {
mPassWordPiSync = le1.text();
mActiveSyncPort = le3.text();
mActiveSyncIP = le2.text();
return true;
}
return false;
}
bool KSyncManager::edit_sync_options()
{
QDialog dia( mParent, "dia", true );
dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
QVBoxLayout lay ( &dia );
lay.setSpacing( 2 );
lay.setMargin( 3 );
lay.addWidget(&gr);
QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
//QRadioButton both( i18n("Take both on conflict"), &gr );
QPushButton pb ( "OK", &dia);
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
switch ( mSyncAlgoPrefs ) {
case 0:
loc.setChecked( true);
break;
case 1:
rem.setChecked( true );
break;
case 2:
newest.setChecked( true);
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;
}
if ( dia.exec() ) {
mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
return true;
}
return false;
}
QString KSyncManager::getPassword( )
{
QString retfile = "";
QDialog dia ( mParent, "input-dialog", true );
QLineEdit lab ( &dia );
lab.setEchoMode( QLineEdit::Password );
QVBoxLayout lay( &dia );
lay.setMargin(7);
lay.setSpacing(7);
lay.addWidget( &lab);
dia.setFixedSize( 230,50 );
dia.setCaption( i18n("Enter password") );
QPushButton pb ( "OK", &dia);
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
dia.show();
int res = dia.exec();
if ( res )
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 ) )
command = commandfile;
else
command = commandpath+commandfile;
QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf";
int result = system ( command.latin1());
qDebug("AB dump 33 command call result: %d ", result);
if ( result != 0 ) {
qDebug("Calling AB dump version 33 failed. Trying 34... ");
commandfile = "kdeabdump34";
if ( ! QFile::exists ( commandpath+commandfile ) )
command = commandfile;
else
command = commandpath+commandfile;
result = system ( command.latin1());
qDebug("AB dump 34 command call result: %d ", result);
if ( result != 0 ) {
KMessageBox::error( 0, i18n("Error accessing KDE addressbook data.\nMake sure the file\n%1kdeabdump3x\nexists ( x = 3 or 4 ).\nSupported KDE versions are 3.3 and 3.4.\nUsed version should be auto detected.\n").arg( commandpath ));
return;
}
}
if ( syncWithFile( fileName,true ) ) {
if ( mWriteBackFile ) {
command += " --read";
system ( command.latin1());
}
}
}
break;
case (KOPI):
{
#ifdef DESKTOP_VERSION
QString command = "kdecaldump33";
QString commandfile = "kdecaldump33";
QString commandpath = qApp->applicationDirPath () + "/";
#else
QString command = "kdecaldump33";
QString commandfile = "kdecaldump33";
QString commandpath = QDir::homeDirPath ()+"/";
#endif
if ( ! QFile::exists ( commandpath+commandfile ) )
command = commandfile;
else
command = commandpath+commandfile;
QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics";
int result = system ( command.latin1());
qDebug("Cal dump 33 command call result result: %d ", result);
if ( result != 0 ) {
qDebug("Calling CAL dump version 33 failed. Trying 34... ");
commandfile = "kdecaldump34";
if ( ! QFile::exists ( commandpath+commandfile ) )
command = commandfile;
else
command = commandpath+commandfile;
result = system ( command.latin1());
qDebug("Cal dump 34 command call result result: %d ", result);
if ( result != 0 ) {
KMessageBox::error( 0, i18n("Error accessing KDE calendar data.\nMake sure the file\n%1kdecaldump3x\nexists ( x = 3 or 4 ).\nSupported KDE versions are 3.3 and 3.4.\nUsed version should be auto detected.\n").arg( commandpath ));
return;
}
}
if ( syncWithFile( fileName,true ) ) {
if ( mWriteBackFile ) {
command += " --read";
system ( command.latin1());
}
}
}
break;
@@ -1048,201 +1047,201 @@ bool KSyncManager::syncExternalApplication(QString resource)
mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
return false;
}
qDebug("KSM::Sync extern %s", resource.latin1());
bool syncOK = mImplementation->syncExternal(this, resource);
return syncOK;
}
void KSyncManager::syncPhone()
{
syncExternalApplication("phone");
}
void KSyncManager::showProgressBar(int percentage, QString caption, int total)
{
if (!bar->isVisible())
{
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar->setCaption (caption);
bar->setTotalSteps ( total ) ;
bar->show();
}
bar->raise();
bar->setProgress( percentage );
qApp->processEvents();
}
void KSyncManager::hideProgressBar()
{
bar->hide();
qApp->processEvents();
}
bool KSyncManager::isProgressBarCanceled()
{
return !bar->isVisible();
}
QString KSyncManager::syncFileName()
{
QString fn = "tempfile";
switch(mTargetApp)
{
case (KAPI):
fn = "tempsyncab.vcf";
break;
case (KOPI):
fn = "tempsynccal.ics";
break;
case (PWMPI):
fn = "tempsyncpw.pwm";
break;
default:
break;
}
#ifdef DESKTOP_VERSION
return locateLocal( "tmp", fn );
#else
return (QString( "/tmp/" )+ fn );
#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 ) {
qApp->processEvents();
}
}
}
++startRemote;
++startLocal;
mAskForPreferences = false;
}
mPisyncFinished = true;
} 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.") );
else if ( state == KCommandSocket::errorFI )
mParent->topLevelWidget()->setCaption( i18n("File error on remote.") );
else if ( state == KCommandSocket::errorED )
mParent->topLevelWidget()->setCaption( i18n("Please close error dialog on remote.") );
else if ( state == KCommandSocket::errorUN )
mParent->topLevelWidget()->setCaption( i18n("Unknown error on remote.") );
delete s;
if ( state == KCommandSocket::errorR ) {
KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget());
connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
commandSocket->sendStop();
}
mPisyncFinished = true;
return;
} else if ( state == KCommandSocket::errorW ) {
mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") );
mPisyncFinished = true;
} else if ( state == KCommandSocket::successR ) {
QTimer::singleShot( 1, this , SLOT ( readFileFromSocket()));
} else if ( state == KCommandSocket::successW ) {
mParent->topLevelWidget()->setCaption( i18n("Pi-Sync successful!") );
mPisyncFinished = true;
} else if ( state == KCommandSocket::quiet ){
qDebug("KSS: quiet ");
mPisyncFinished = true;
} else {
qDebug("KSS: Error: unknown state: %d ", state);
mPisyncFinished = true;
}
delete s;
}
void KSyncManager::readFileFromSocket()
{
QString fileName = syncFileName();
bool syncOK = true;
mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") );
if ( ! syncWithFile( fileName , true ) ) {
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 604adb8..04cdade 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -142,108 +142,108 @@ class KSyncManager : public QObject
QString defaultFileName() { return mDefFileName ;}
QString syncFileName();
void enableQuick( bool ask = true);
bool syncWithDesktop () { return mSyncWithDesktop;}
QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
QString getCurrentSyncName() { return mCurrentSyncName; }
void showProgressBar(int percentage, QString caption = QString::null, int total=100);
void hideProgressBar();
bool isProgressBarCanceled();
// sync stuff
QString mLocalMachineName;
QStringList mExternSyncProfiles;
QStringList mSyncProfileNames;
bool mAskForPreferences;
bool mShowSyncSummary;
bool mIsKapiFile;
bool mWriteBackExistingOnly;
int mSyncAlgoPrefs;
bool mWriteBackFile;
int mWriteBackInFuture;
int mWriteBackInPast;
QString mPhoneDevice;
QString mPhoneConnection;
QString mPhoneModel;
QString mPassWordPiSync;
QString mActiveSyncPort;
QString mActiveSyncIP ;
QString mFilterInCal;
QString mFilterOutCal;
QString mFilterInAB;
QString mFilterOutAB;
static QDateTime mRequestedSyncEvent;
signals:
void save();
void request_file();
void getFile( bool );
void getFile( bool, const QString &);
void request_file(const QString &);
void multiResourceSyncStart( bool );
public slots:
void slotSyncMenu( int );
void slotClearMenu( int action );
void deleteCommandSocket(KCommandSocket*s, int state);
void readFileFromSocket();
void fillSyncMenu();
private:
void syncPi();
KServerSocket * mServerSocket;
KPimPrefs* mPrefs;
QString mDefFileName;
QString mCurrentSyncDevice;
QString mCurrentSyncName;
void quickSyncLocalFile();
bool syncWithFile( QString fn , bool quick );
void syncLocalFile();
void syncPhone();
void syncSharp();
void syncKDE();
bool syncExternalApplication(QString);
int mCurrentSyncProfile ;
void syncRemote( KSyncProfile* prof, bool ask = true);
bool edit_sync_options();
bool edit_pisync_options();
int ringSync();
QString getPassword( );
bool mPisyncFinished;
QStringList mSpecificResources;
QString mCurrentResourceLocal;
QString mCurrentResourceRemote;
bool mBlockSaveFlag;
QWidget* mParent;
KSyncInterface* mImplementation;
TargetApp mTargetApp;
QPopupMenu* mSyncMenu;
QProgressBar* bar;
bool mSyncWithDesktop;
private slots:
void displayErrorPort();
void confSync();
};
class KSyncInterface
{
public :
virtual void removeSyncInfo( QString syncProfile) = 0;
virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource) = 0;
- virtual bool syncExternal(KSyncManager* manager, QString resource)
+ virtual bool syncExternal(KSyncManager* /*manager*/, QString /*resource*/)
{
// empty implementation, because some syncable applications do not
// have an external(sharpdtm) syncmode, like pwmanager.
return false;
}
};
#endif