-rw-r--r-- | kabc/resource.cpp | 4 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 14 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 15 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 5 |
8 files changed, 31 insertions, 16 deletions
diff --git a/kabc/resource.cpp b/kabc/resource.cpp index d39fd6a..7b91239 100644 --- a/kabc/resource.cpp +++ b/kabc/resource.cpp @@ -24,34 +24,34 @@ Copyright (c) 2004 Ulf Schenk $Id$ */ #include <kdebug.h> #include <ksyncprofile.h> #include "resource.h" using namespace KABC; Resource::Resource( const KConfig *config, bool syncable ) : KRES::Resource( config ), mAddressBook( 0 ), mSyncProfile( 0 ) { if(syncable == true) { - mSyncProfile = new KSyncProfile( identifier() ); - mSyncProfile->setName(resourceName()); + mSyncProfile = new KSyncProfile( ); + mSyncProfile->setName("pending" /*resourceName()*/); mSyncProfile->readConfig( (KConfig *)config ); } } Resource::~Resource() { if (mSyncProfile != 0) { delete mSyncProfile; } } void Resource::writeConfig( KConfig *config ) { KRES::Resource::writeConfig( config ); if(mSyncProfile != 0) diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index f859b90..689618d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1160,32 +1160,36 @@ bool CalendarView::syncCalendar(QString filename, int mode) getEventViewerDialog()->setSyncMode( false ); if ( syncOK ) { if ( KOPrefs::instance()->mWriteBackFile ) { storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); storage->save(); } } setModified( true ); } delete storage; delete calendar; if ( syncOK ) updateView(); return syncOK; } +void CalendarView::syncPhone() +{ + qDebug("CalendarView::syncPhone() "); +} void CalendarView::syncSharp() { #ifndef DESKTOP_VERSION mGlobalSyncMode = SYNC_MODE_EXTERNAL; //mCurrentSyncDevice = "sharp-DTM"; if ( KOPrefs::instance()->mAskForPreferences ) edit_sync_options(); qApp->processEvents(); CalendarLocal* calendar = new CalendarLocal(); calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); bool syncOK = false; SharpFormat sharpFormat; if ( sharpFormat.load( calendar, mCalendar ) ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); getEventViewerDialog()->setSyncMode( false ); diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index d564473..b2838db 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -412,32 +412,33 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void lookForOutgoingMessages(); void processMainViewSelection( Incidence * ); void processTodoListSelection( Incidence * ); void processIncidenceSelection( Incidence * ); void purgeCompleted(); bool removeCompletedSubTodos( Todo* ); void slotCalendarChanged(); bool importBday(); bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); bool importQtopia( const QString &categoriesFile, const QString &datebookFile, const QString &tasklistFile ); void syncSharp( ); + void syncPhone( ); void slotSelectPickerDate( QDate ) ; void showDatePicker( ) ; void moveIncidence(Incidence *) ; void beamIncidence(Incidence *) ; void beamCalendar() ; void beamFilteredCalendar() ; void beamIncidenceList(QPtrList<Incidence>) ; void manageCategories(); int addCategories(); void removeCategories(); void setSyncDevice( QString ); void setSyncName( QString ); protected slots: void timerAlarm(); void suspendAlarm(); void beamDone( Ir *ir ); diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 424fa98..446fe2e 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -197,32 +197,35 @@ class KOPrefs : public KPimPrefs bool mToolBarMiniIcons; bool mAskForQuit; bool mUsePassWd; bool mWriteBackFile; bool mAskForPreferences; bool mShowSyncSummary; bool mShowSyncEvents; bool mShowTodoInAgenda; bool mWriteBackExistingOnly; QString mRemoteIP; QString mRemoteUser; QString mRemotePassWd; QString mRemoteFile; QString mLocalTempFile; + QString mPhoneDevice; + QString mPhoneConnection; + QString mPhoneModel; int mLastSyncTime; int mSyncAlgoPrefs; int mRingSyncAlgoPrefs; QStringList mSyncProfileNames; QStringList mExternSyncProfiles; QString mLocalMachineName; void setCategoryColor(QString cat,const QColor & color); QColor *categoryColor(QString cat); QString mArchiveFile; QString mHtmlExportFile; bool mHtmlWithSave; QStringList mSelectedPlugins; diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index c3c4c26..062c95f 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -884,32 +884,38 @@ int MainWindow::ringSync() if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); ++syncedProfiles; // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); KOPrefs::instance()->mShowSyncSummary = false; mView->setSyncDevice(syncProfileNames[i] ); mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); if ( i == 0 ) { syncSharp(); } else { if ( temp->getIsLocalFileSync() ) { if ( syncWithFile( temp->getRemoteFileName( ), true ) ) KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); } else { + if ( temp->getIsPhoneSync() ) { + KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; + KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); + KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); + syncPhone(); + } else syncRemote( temp, false ); } } timer.start(); setCaption(i18n("Multiple sync in progress ... please wait!") ); while ( timer.elapsed () < 2000 ) { qApp->processEvents(); #ifndef _WIN32_ sleep (1); #endif } } } @@ -2024,26 +2030,34 @@ void MainWindow::syncSSH() qApp->processEvents(); save(); system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); #endif } void MainWindow::syncSharp() { if ( mCalendarModifiedFlag ) save(); mView->syncSharp(); slotModifiedChanged( true ); } +void MainWindow::syncPhone() +{ + if ( mCalendarModifiedFlag ) + save(); + mView->syncPhone(); + slotModifiedChanged( true ); + +} void MainWindow::printSel( ) { mView->viewManager()->agendaView()->agenda()->printSelection(); } void MainWindow::printCal() { mView->print();//mCp->showDialog(); } diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index fba8c52..1d87db0 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -62,32 +62,33 @@ class MainWindow : public QMainWindow void slotModifiedChanged( bool ); void save(); void configureToolBar( int ); void printSel(); void printCal(); void saveCalendar(); void loadCalendar(); void exportVCalendar(); void fillFilterMenu(); void selectFilter( int ); void slotSyncMenu( int ); void syncSSH(); void confSync(); void syncSharp(); + void syncPhone(); void syncLocalFile(); bool syncWithFile( QString, bool ); void quickSyncLocalFile(); protected: void displayText( QString, QString); void displayFile( QString, QString); void enableIncidenceActions( bool ); private: void saveOnClose(); int mCurrentSyncProfile; void syncRemote( KSyncProfile* , bool ask = true); void fillSyncMenu(); diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index 15dc152..e7c35fb 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp @@ -17,71 +17,66 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // $Id$ #include <qcolor.h> #include <kconfig.h> #include <kstandarddirs.h> #include <kglobal.h> #include <kdebug.h> #include "ksyncprofile.h" -KSyncProfile::KSyncProfile( const char * identifier): QObject (0, identifier ) +KSyncProfile::KSyncProfile(): QObject () { - setIdentifier( identifier ); - - if (getIdentifier().isEmpty()) - setIdentifier( "noID" ); - setDefault(); } KSyncProfile::~KSyncProfile() { } KSyncProfile* KSyncProfile::clone() { KSyncProfile* myClone = new KSyncProfile(); myClone->setPreSyncCommand( mPreSyncCommand ); myClone->setPostSyncCommand( mPostSyncCommand ); myClone->setLocalTempFile( mLocalTempFile); myClone->setRemoteFileName( mRemoteFileName ); myClone->setPreSyncCommandAB( mPreSyncCommandAB ); myClone->setPostSyncCommandAB( mPostSyncCommandAB ); myClone->setLocalTempFileAB( mLocalTempFileAB); myClone->setRemoteFileNameAB( mRemoteFileNameAB ); myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); myClone->setAskForPreferences( mAskForPreferences); myClone->setWriteBackExisting(mWriteBackExisting ); myClone->setWriteBackFile( mWriteBackFile); myClone->setWriteBackFuture( mWriteBackFuture ); myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); myClone->setIncludeInRingSync( mIncludeInRingSync ); myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); myClone->setSyncPrefs( mSyncPrefs); myClone->setIsLocalFileSync( mIsLocalFileSync ); myClone->setIsPhoneSync( mIsPhoneSync ); myClone->setName( "noName" ); - myClone->setIdentifier( "noID" ); + //myClone->setIdentifier( "noID" ); return myClone; } void KSyncProfile::setDefault() { mPreSyncCommand = i18n("command for downloading remote file to local device"); mPostSyncCommand = i18n("command for uploading local temp file to remote device"); mLocalTempFile = "/tmp/mycalendar.ics"; mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; mPreSyncCommandAB = i18n("command for downloading remote file to local device"); mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); mLocalTempFileAB = "/tmp/std.vcf"; mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; mShowSummaryAfterSync = true; mAskForPreferences = true; @@ -91,33 +86,33 @@ void KSyncProfile::setDefault() mWriteBackFile = true; mIncludeInRingSync = false; mIncludeInRingSyncAB = false; mSyncPrefs = SYNC_PREF_ASK; mIsLocalFileSync = true; mName = "noName"; mIsPhoneSync = false; mPhoneDevice = "/dev/ircomm"; mPhoneConnection = "irda"; mPhoneModel = "6310i"; } void KSyncProfile::readConfig(KConfig *config ) { if (config) { - config->setGroup("SyncProfile_" + mIdentifier); + config->setGroup( mName ); mName = config->readEntry( "Name", mName ); mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); @@ -127,38 +122,38 @@ void KSyncProfile::readConfig(KConfig *config ) mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); } else { setDefault(); } } void KSyncProfile::deleteConfig(KConfig *config ) { - config->deleteGroup( "SyncProfile_" + mIdentifier ); + config->deleteGroup( mName ); } void KSyncProfile::writeConfig( KConfig * config ) { - config->setGroup("SyncProfile_" + mIdentifier); + config->setGroup(mName); config->writeEntry( "Name", mName ); config->writeEntry( "PreSyncCommand",mPreSyncCommand ); config->writeEntry( "PostSyncCommand", mPostSyncCommand ); config->writeEntry( "LocalTempFile", mLocalTempFile ); config->writeEntry( "RemoteFileName", mRemoteFileName ); config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); config->writeEntry( "PhoneDevice", mPhoneDevice ); config->writeEntry( "PhoneConnection", mPhoneConnection ); config->writeEntry( "PhoneModel", mPhoneModel ); diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index 8995def..a0cfb71 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h @@ -33,43 +33,41 @@ class KConfig; /** @short Class for storing a preferences setting @author Cornelius Schumacher @see KPref This class represents one preferences setting as used by @ref KPrefs. Subclasses of KPrefsItem implement storage functions for a certain type of setting. Normally you don't have to use this class directly. Use the special addItem() functions of KPrefs instead. If you subclass this class you will have to register instances with the function KPrefs::addItem(). */ class KSyncProfile : public QObject { public: - KSyncProfile( const char * identifier = 0); + KSyncProfile(); ~KSyncProfile() ; KSyncProfile* clone(); void setDefault(); void readConfig(KConfig *); void writeConfig(KConfig *); void deleteConfig(KConfig *); - void setIdentifier( const QString& i ) {mIdentifier = i;} - QString getIdentifier( ) { return mIdentifier;} void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} QString getPreSyncCommand( ) { return mPreSyncCommand; } void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} QString getPostSyncCommand( ) { return mPostSyncCommand;} void setLocalTempFile( const QString& n ) { mLocalTempFile= n;} QString getLocalTempFile( ) { return mLocalTempFile;} void setRemoteFileName( const QString& n ) { mRemoteFileName = n;} QString getRemoteFileName( ) { return mRemoteFileName;} void setPreSyncCommandAB( const QString& n ) {mPreSyncCommandAB = n;} QString getPreSyncCommandAB( ) { return mPreSyncCommandAB; } void setPostSyncCommandAB( const QString& n ) {mPostSyncCommandAB = n;} QString getPostSyncCommandAB( ) { return mPostSyncCommandAB;} void setLocalTempFileAB( const QString& n ) { mLocalTempFileAB= n;} QString getLocalTempFileAB( ) { return mLocalTempFileAB;} void setRemoteFileNameAB( const QString& n ) { mRemoteFileNameAB = n;} @@ -99,33 +97,32 @@ class KSyncProfile : public QObject { void setWriteBackFile( bool b ) { mWriteBackFile= b;} bool getWriteBackFile( ) { return mWriteBackFile;} void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;} bool getIncludeInRingSync( ) { return mIncludeInRingSync;} void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;} bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;} void setSyncPrefs( int n ) { mSyncPrefs= n;} int getSyncPrefs( ) { return mSyncPrefs;} void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;} int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;} void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} bool getIsLocalFileSync( ) { return mIsLocalFileSync;} void setIsPhoneSync( bool b ) { mIsPhoneSync= b;} bool getIsPhoneSync( ) { return mIsPhoneSync;} private: QString mName; - QString mIdentifier; QString mPreSyncCommand; QString mPostSyncCommand; QString mLocalTempFile; QString mRemoteFileName; QString mPreSyncCommandAB; QString mPostSyncCommandAB; QString mLocalTempFileAB; QString mRemoteFileNameAB; QString mPhoneDevice; QString mPhoneConnection; QString mPhoneModel; bool mIncludeInRingSync; bool mIncludeInRingSyncAB; int mSyncPrefs; |