summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2004-10-07 17:51:17 (UTC)
committer zautrix <zautrix>2004-10-07 17:51:17 (UTC)
commit1f1538e5707b59bfcff2014901f29a65589229e3 (patch) (side-by-side diff)
tree0d91a303524e6ac9f7c954f01a0e1d09d0e305e7 /libkdepim
parentbb8293c794d82a57bc93af85ccd89b601356d577 (diff)
downloadkdepimpi-1f1538e5707b59bfcff2014901f29a65589229e3.zip
kdepimpi-1f1538e5707b59bfcff2014901f29a65589229e3.tar.gz
kdepimpi-1f1538e5707b59bfcff2014901f29a65589229e3.tar.bz2
many cleanups
Diffstat (limited to 'libkdepim') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/kpimprefs.cpp9
-rw-r--r--libkdepim/kpimprefs.h3
-rw-r--r--libkdepim/ksyncmanager.cpp72
-rw-r--r--libkdepim/ksyncmanager.h3
4 files changed, 56 insertions, 31 deletions
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index 0a2f5f1..c21ebaa 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -39,7 +39,14 @@ KPimPrefs::KPimPrefs( const QString &name ) :
KPrefs( name )
{
- config()->setGroup("General");
+#ifdef _WIN32_
+ QString hdp= locateLocal("data","korganizer")+"\\\\";
+#else
+ QString hdp= locateLocal("data","korganizer")+"/";
+#endif
+ config()->setGroup("SyncOptions");
addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
+ addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
+ addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
}
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index fde8093..9346f7d 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -58,5 +58,6 @@ class KPimPrefs : public KPrefs
QString mPassiveSyncPort;
QString mPassiveSyncPw;
-
+ int mRingSyncAlgoPrefs;
+ QString mLastSyncedLocalFile;
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index fad9a76..568c2a9 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -77,5 +77,5 @@ KSyncManager::~KSyncManager()
}
-//LR ok
+
void KSyncManager::fillSyncMenu()
{
@@ -102,4 +102,5 @@ void KSyncManager::fillSyncMenu()
prof << i18n("Sharp_DTM");
prof << i18n("Local_file");
+ prof << i18n("Last_file");
KSyncProfile* temp = new KSyncProfile ();
temp->setName( prof[0] );
@@ -107,4 +108,6 @@ void KSyncManager::fillSyncMenu()
temp->setName( prof[1] );
temp->writeConfig(&config);
+ temp->setName( prof[2] );
+ temp->writeConfig(&config);
config.setGroup("General");
config.writeEntry("SyncProfileNames",prof);
@@ -127,6 +130,7 @@ void KSyncManager::fillSyncMenu()
}
else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
- mSyncMenu->setItemEnabled( 1000, false );
+ mSyncMenu->removeItem( 1000 );
}
+ mSyncMenu->removeItem( 1002 );
}
@@ -196,13 +200,13 @@ void KSyncManager::slotSyncMenu( int action )
case (KAPI):
if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileNameAB();
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
break;
case (KOPI):
if ( syncWithFile( temp->getRemoteFileName( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileName();
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
break;
case (PWMPI):
if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
break;
default:
@@ -240,4 +244,5 @@ void KSyncManager::slotSyncMenu( int action )
setBlockSave(false);
}
+
void KSyncManager::enableQuick()
{
@@ -286,5 +291,4 @@ void KSyncManager::enableQuick()
return;
}
- //connect( mServerSocket, SIGNAL ( saveFile() ),this, SIGNAL ( save() ) );
connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
@@ -294,5 +298,5 @@ void KSyncManager::syncLocalFile()
{
- QString fn =mLastSyncedLocalFile;
+ QString fn =mPrefs->mLastSyncedLocalFile;
QString ext;
@@ -322,4 +326,5 @@ void KSyncManager::syncLocalFile()
}
+
bool KSyncManager::syncWithFile( QString fn , bool quick )
{
@@ -354,16 +359,18 @@ bool KSyncManager::syncWithFile( QString fn , bool quick )
mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
if ( ! quick )
- mLastSyncedLocalFile = fn;
+ mPrefs->mLastSyncedLocalFile = fn;
}
return ret;
}
+
void KSyncManager::quickSyncLocalFile()
{
- if ( syncWithFile( mLastSyncedLocalFile, false ) ) {
+ if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) {
qDebug("quick syncLocalFile() successful ");
}
}
+
void KSyncManager::multiSync( bool askforPrefs )
{
@@ -372,5 +379,5 @@ void KSyncManager::multiSync( bool askforPrefs )
setBlockSave(true);
QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
- if ( QMessageBox::information( mParent, i18n("Sync"),
+ if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"),
question,
i18n("Yes"), i18n("No"),
@@ -381,5 +388,5 @@ void KSyncManager::multiSync( bool askforPrefs )
}
mCurrentSyncDevice = i18n("Multiple profiles") ;
- mSyncAlgoPrefs = mRingSyncAlgoPrefs;
+ mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
if ( askforPrefs ) {
edit_sync_options();
@@ -395,9 +402,10 @@ void KSyncManager::multiSync( bool askforPrefs )
emit save();
if ( num )
- mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
+ mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) );
else
mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
return;
}
+
int KSyncManager::ringSync()
{
@@ -453,13 +461,13 @@ int KSyncManager::ringSync()
case (KAPI):
if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileNameAB();
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
break;
case (KOPI):
if ( syncWithFile( temp->getRemoteFileName( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileName();
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
break;
case (PWMPI):
if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
- mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
+ mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
break;
default:
@@ -473,4 +481,19 @@ int KSyncManager::ringSync()
mPhoneModel = temp->getPhoneModel( );
syncPhone();
+ } else if ( temp->getIsPiSync() ) {
+ if ( mTargetApp == KAPI ) {
+ mPassWordPiSync = temp->getRemotePwAB();
+ mActiveSyncPort = temp->getRemotePortAB();
+ mActiveSyncIP = temp->getRemoteIPAB();
+ } else if ( mTargetApp == KOPI ) {
+ mPassWordPiSync = temp->getRemotePw();
+ mActiveSyncPort = temp->getRemotePort();
+ mActiveSyncIP = temp->getRemoteIP();
+ } else {
+ mPassWordPiSync = temp->getRemotePwPWM();
+ mActiveSyncPort = temp->getRemotePortPWM();
+ mActiveSyncIP = temp->getRemoteIPPWM();
+ }
+ syncPi();
} else
syncRemote( temp, false );
@@ -559,5 +582,5 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
question,
i18n("Okay!")) ;
- mParent->topLevelWidget()->setCaption ("");
+ mParent->topLevelWidget()->setCaption ("KDE-Pim");
return;
}
@@ -565,11 +588,6 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
//qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
-
-
if ( syncWithFile( localTempFile, true ) ) {
-// Event* e = mView->getLastSyncEvent();
-// e->setReadOnly( false );
-// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
-// e->setReadOnly( true );
+
if ( mWriteBackFile ) {
int fi;
@@ -645,4 +663,5 @@ void KSyncManager::edit_sync_options()
}
+
QString KSyncManager::getPassword( )
{
@@ -686,9 +705,10 @@ void KSyncManager::confSync()
mSyncProfileNames = sp->getSyncProfileNames();
mLocalMachineName = sp->getLocalMachineName ();
- fillSyncMenu();
+ QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
}
void KSyncManager::syncSharp()
{
+
if ( ! syncExternalApplication("sharp") )
qDebug("ERROR sync sharp ");;
@@ -713,8 +733,6 @@ bool KSyncManager::syncExternalApplication(QString resource)
void KSyncManager::syncPhone()
{
- emit save();
- qDebug("pending syncPhone(); ");
- //mView->syncPhone();
+ syncExternalApplication("phone");
}
@@ -768,4 +786,5 @@ QString KSyncManager::syncFileName()
}
+
void KSyncManager::syncPi()
{
@@ -1154,3 +1173,2 @@ void KCommandSocket::deleteSocket()
emit commandFinished( this, mRetVal );
}
-
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 25892d8..7027894 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -118,4 +118,5 @@ class KSyncManager : public QObject
~KSyncManager() ;
+ void multiSync( bool askforPrefs );
bool blockSave() { return mBlockSaveFlag; }
void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
@@ -148,5 +149,4 @@ class KSyncManager : public QObject
QString mPhoneConnection;
QString mPhoneModel;
- QString mLastSyncedLocalFile; // save!
QString mPassWordPiSync;
QString mActiveSyncPort;
@@ -179,5 +179,4 @@ class KSyncManager : public QObject
void syncSharp();
bool syncExternalApplication(QString);
- void multiSync( bool askforPrefs );
int mCurrentSyncProfile ;
void syncRemote( KSyncProfile* prof, bool ask = true);