-rw-r--r-- | libkdepim/externalapphandler.cpp | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 71 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 3 | ||||
-rw-r--r-- | libkdepim/libkdepim.pro | 15 |
4 files changed, 87 insertions, 4 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 59be506..f376e6c 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp @@ -826,48 +826,50 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e #ifndef DESKTOP_VERSION QCopEnvelope e(channel.latin1(), message.latin1()); //US we need no names in the To field. The emailadresses are enough passParameters(&e, parameters, name, emailadress); #else // DESKTOP_VERSION //KMessageBox::sorry( 0,channel ); QProcess * proc = new QProcess( this ); proc->addArgument( channel ); if ( message.find (" " ) > 0 ) { QStringList list = QStringList::split( " ", message ); int i = 0; while ( i < list.count ( ) ) { //qDebug("add%sdd ",list[i].latin1() ); proc->addArgument( list[i] ); //KMessageBox::sorry( 0,list[i]); ++i; } } else { proc->addArgument(message ); } parameters = translateMessage(parameters, name, emailadress); + + //KMessageBox::information(0,parameters); proc->addArgument( parameters ); proc->launch(""); #endif return true; } /************************************************************************** * **************************************************************************/ //calls the emailapplication and creates a mail with parameter as recipients // parameters format is // NAME <EMAIL>:SUBJECT bool ExternalAppHandler::mailToOneContact( const QString& adressline ) { QString line = adressline; int first = line.find( "<"); int last = line.find( ">"); QString name = line.left(first); QString emailadress = line.mid(first+1, last-first-1); //Subject can not be handled right now. diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index b7929ec..5708dfc 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -91,80 +91,80 @@ void KSyncManager::fillSyncMenu() mSyncMenu->insertSeparator(); QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); clearMenu->insertItem( i18n("For all profiles"), 1 ); clearMenu->insertSeparator(); connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); mSyncMenu->insertSeparator(); if ( mServerSocket == 0 ) { mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); } else { mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); } mSyncMenu->insertSeparator(); mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); mSyncMenu->insertSeparator(); KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); config.setGroup("General"); QStringList prof = config.readListEntry("SyncProfileNames"); mLocalMachineName = config.readEntry("LocalMachineName","undefined"); if ( prof.count() < 2 ) { prof.clear(); QString externalName; #ifdef DESKTOP_VERSION #ifdef _WIN32_ - externalName = "OutLook(not_implemented)"; + externalName = "OutLook"; #else externalName = "KDE_Desktop"; #endif #else externalName = "Sharp_DTM"; #endif prof << externalName; prof << i18n("Local_file"); prof << i18n("Last_file"); KSyncProfile* temp = new KSyncProfile (); temp->setName( prof[0] ); temp->writeConfig(&config); temp->setName( prof[1] ); temp->writeConfig(&config); temp->setName( prof[2] ); temp->writeConfig(&config); config.setGroup("General"); config.writeEntry("SyncProfileNames",prof); config.writeEntry("ExternSyncProfiles",externalName); config.sync(); delete temp; } mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); mSyncProfileNames = prof; unsigned int i; for ( i = 0; i < prof.count(); ++i ) { QString insertText = prof[i]; if ( i == 0 ) { #ifdef DESKTOP_VERSION #ifdef _WIN32_ - insertText = "OutLook(not_implemented)"; + insertText = "OutLook"; #else insertText = "KDE_Desktop"; #endif #else insertText = "Sharp_DTM"; #endif } mSyncMenu->insertItem( insertText, 1000+i ); clearMenu->insertItem( insertText, 1000+i ); if ( i == 2 ) mSyncMenu->insertSeparator(); } QDir app_dir; //US do not display SharpDTM if app is pwmpi, or no sharpfiles available if ( mTargetApp == PWMPI) { mSyncMenu->removeItem( 1000 ); clearMenu->removeItem( 1000 ); } #ifndef DESKTOP_VERSION else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { mSyncMenu->removeItem( 1000 ); clearMenu->removeItem( 1000 ); } #endif @@ -913,50 +913,116 @@ QString KSyncManager::getPassword( ) 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 (); 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::syncOL() +{ + mSyncWithDesktop = true; + emit save(); + switch(mTargetApp) + { + case (KAPI): + { + syncExternalApplication("ol"); + } + 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; + case (PWMPI): + + break; + default: + qDebug("KSM::slotSyncMenu: invalid apptype selected"); + break; + + } +} void KSyncManager::syncKDE() { +#ifdef _WIN32_ + syncOL(); +#else + 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 ) { @@ -1011,48 +1077,49 @@ void KSyncManager::syncKDE() 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; case (PWMPI): break; default: qDebug("KSM::slotSyncMenu: invalid apptype selected"); break; } +#endif } void KSyncManager::syncSharp() { if ( ! syncExternalApplication("sharp") ) qDebug("KSM::ERROR sync sharp "); } bool KSyncManager::syncExternalApplication(QString resource) { emit save(); if ( mAskForPreferences ) if ( !edit_sync_options()) { mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); return false; } qDebug("KSM::Sync extern %s", resource.latin1()); bool syncOK = mImplementation->syncExternal(this, resource); diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 04cdade..71d17e9 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -182,68 +182,67 @@ class KSyncManager : public QObject 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(); + void syncOL(); 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*/) { // empty implementation, because some syncable applications do not // have an external(sharpdtm) syncmode, like pwmanager. return false; } - - }; #endif diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro index 84af7ad..7160d0e 100644 --- a/libkdepim/libkdepim.pro +++ b/libkdepim/libkdepim.pro @@ -37,25 +37,40 @@ HEADERS = \ kcmconfigs/kcmkdepimconfig.h \ kcmconfigs/kdepimconfigwidget.h \ phoneaccess.h SOURCES = \ categoryeditdialog.cpp \ categoryeditdialog_base.cpp \ categoryselectdialog.cpp \ categoryselectdialog_base.cpp \ externalapphandler.cpp \ kdateedit.cpp \ kdatepicker.cpp \ kinputdialog.cpp \ kpimprefs.cpp \ kpimglobalprefs.cpp \ kprefsdialog.cpp \ kprefswidget.cpp \ ksyncmanager.cpp \ ksyncprofile.cpp \ ksyncprefsdialog.cpp \ kcmconfigs/kcmkdepimconfig.cpp \ kcmconfigs/kdepimconfigwidget.cpp \ phoneaccess.cpp +win32: { +#olimport section +importol { +debug: { +LIBS += mfc71ud.lib +} +release: { +LIBS += mfc71u.lib +} +DEFINES += _OL_IMPORT_ +HEADERS += ol_access.h +SOURCES += ol_access.cpp +#olimport section end +} +} |