summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2004-10-16 23:24:31 (UTC)
committer zautrix <zautrix>2004-10-16 23:24:31 (UTC)
commit6564856660d583425a5f5d51bf77bc52c01da444 (patch) (unidiff)
tree223ef7aab1d489113681e3f29d07ca499bb6d1c5 /libkdepim
parent4bab2cac8beb6103b982bd2b42eeb7061a18a0d1 (diff)
downloadkdepimpi-6564856660d583425a5f5d51bf77bc52c01da444.zip
kdepimpi-6564856660d583425a5f5d51bf77bc52c01da444.tar.gz
kdepimpi-6564856660d583425a5f5d51bf77bc52c01da444.tar.bz2
added KDE sync
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp44
-rw-r--r--libkdepim/ksyncmanager.h1
2 files changed, 45 insertions, 0 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 5175f94..7ee56e4 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -90,25 +90,33 @@ void KSyncManager::fillSyncMenu()
90 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); 90 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
91 } 91 }
92 mSyncMenu->insertSeparator(); 92 mSyncMenu->insertSeparator();
93 mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); 93 mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
94 mSyncMenu->insertSeparator(); 94 mSyncMenu->insertSeparator();
95 95
96 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 96 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
97 config.setGroup("General"); 97 config.setGroup("General");
98 QStringList prof = config.readListEntry("SyncProfileNames"); 98 QStringList prof = config.readListEntry("SyncProfileNames");
99 mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 99 mLocalMachineName = config.readEntry("LocalMachineName","undefined");
100 if ( prof.count() < 2 ) { 100 if ( prof.count() < 2 ) {
101 prof.clear(); 101 prof.clear();
102#ifdef DESKTOP_VERSION
103#ifdef _WIN32_
104 prof << i18n("OutLook(not_implemented)");
105#else
106 prof << i18n("KDE_Desktop");
107#endif
108#else
102 prof << i18n("Sharp_DTM"); 109 prof << i18n("Sharp_DTM");
110#endif
103 prof << i18n("Local_file"); 111 prof << i18n("Local_file");
104 prof << i18n("Last_file"); 112 prof << i18n("Last_file");
105 KSyncProfile* temp = new KSyncProfile (); 113 KSyncProfile* temp = new KSyncProfile ();
106 temp->setName( prof[0] ); 114 temp->setName( prof[0] );
107 temp->writeConfig(&config); 115 temp->writeConfig(&config);
108 temp->setName( prof[1] ); 116 temp->setName( prof[1] );
109 temp->writeConfig(&config); 117 temp->writeConfig(&config);
110 temp->setName( prof[2] ); 118 temp->setName( prof[2] );
111 temp->writeConfig(&config); 119 temp->writeConfig(&config);
112 config.setGroup("General"); 120 config.setGroup("General");
113 config.writeEntry("SyncProfileNames",prof); 121 config.writeEntry("SyncProfileNames",prof);
114 config.writeEntry("ExternSyncProfiles","Sharp_DTM"); 122 config.writeEntry("ExternSyncProfiles","Sharp_DTM");
@@ -119,27 +127,29 @@ void KSyncManager::fillSyncMenu()
119 mSyncProfileNames = prof; 127 mSyncProfileNames = prof;
120 unsigned int i; 128 unsigned int i;
121 for ( i = 0; i < prof.count(); ++i ) { 129 for ( i = 0; i < prof.count(); ++i ) {
122 mSyncMenu->insertItem( prof[i], 1000+i ); 130 mSyncMenu->insertItem( prof[i], 1000+i );
123 if ( i == 2 ) 131 if ( i == 2 )
124 mSyncMenu->insertSeparator(); 132 mSyncMenu->insertSeparator();
125 } 133 }
126 QDir app_dir; 134 QDir app_dir;
127 //US do not display SharpDTM if app is pwmpi, or no sharpfiles available 135 //US do not display SharpDTM if app is pwmpi, or no sharpfiles available
128 if ( mTargetApp == PWMPI) { 136 if ( mTargetApp == PWMPI) {
129 mSyncMenu->removeItem( 1000 ); 137 mSyncMenu->removeItem( 1000 );
130 } 138 }
139#ifndef DESKTOP_VERSION
131 else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 140 else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
132 mSyncMenu->removeItem( 1000 ); 141 mSyncMenu->removeItem( 1000 );
133 } 142 }
143#endif
134 mSyncMenu->removeItem( 1002 ); 144 mSyncMenu->removeItem( 1002 );
135} 145}
136 146
137void KSyncManager::slotSyncMenu( int action ) 147void KSyncManager::slotSyncMenu( int action )
138{ 148{
139 //qDebug("syncaction %d ", action); 149 //qDebug("syncaction %d ", action);
140 if ( action == 0 ) { 150 if ( action == 0 ) {
141 151
142 // seems to be a Qt2 event handling bug 152 // seems to be a Qt2 event handling bug
143 // syncmenu.clear causes a segfault at first time 153 // syncmenu.clear causes a segfault at first time
144 // when we call it after the main event loop, it is ok 154 // when we call it after the main event loop, it is ok
145 // same behaviour when calling OM/Pi via QCOP for the first time 155 // same behaviour when calling OM/Pi via QCOP for the first time
@@ -177,25 +187,29 @@ void KSyncManager::slotSyncMenu( int action )
177 temp->setName(mSyncProfileNames[mCurrentSyncProfile]); 187 temp->setName(mSyncProfileNames[mCurrentSyncProfile]);
178 temp->readConfig(&config); 188 temp->readConfig(&config);
179 mAskForPreferences = temp->getAskForPreferences(); 189 mAskForPreferences = temp->getAskForPreferences();
180 mSyncAlgoPrefs = temp->getSyncPrefs(); 190 mSyncAlgoPrefs = temp->getSyncPrefs();
181 mWriteBackFile = temp->getWriteBackFile(); 191 mWriteBackFile = temp->getWriteBackFile();
182 mWriteBackExistingOnly = temp->getWriteBackExisting(); 192 mWriteBackExistingOnly = temp->getWriteBackExisting();
183 mIsKapiFile = temp->getIsKapiFile(); 193 mIsKapiFile = temp->getIsKapiFile();
184 mWriteBackInFuture = 0; 194 mWriteBackInFuture = 0;
185 if ( temp->getWriteBackFuture() ) 195 if ( temp->getWriteBackFuture() )
186 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 196 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
187 mShowSyncSummary = temp->getShowSummaryAfterSync(); 197 mShowSyncSummary = temp->getShowSummaryAfterSync();
188 if ( action == 1000 ) { 198 if ( action == 1000 ) {
199#ifdef DESKTOP_VERSION
200 syncKDE();
201#else
189 syncSharp(); 202 syncSharp();
203#endif
190 204
191 } else if ( action == 1001 ) { 205 } else if ( action == 1001 ) {
192 syncLocalFile(); 206 syncLocalFile();
193 207
194 } else if ( action == 1002 ) { 208 } else if ( action == 1002 ) {
195 mWriteBackFile = false; 209 mWriteBackFile = false;
196 mAskForPreferences = false; 210 mAskForPreferences = false;
197 mShowSyncSummary = false; 211 mShowSyncSummary = false;
198 mSyncAlgoPrefs = 3; 212 mSyncAlgoPrefs = 3;
199 quickSyncLocalFile(); 213 quickSyncLocalFile();
200 214
201 } else if ( action >= 1003 ) { 215 } else if ( action >= 1003 ) {
@@ -732,24 +746,54 @@ void KSyncManager::confSync()
732 } 746 }
733 sp->usrReadConfig(); 747 sp->usrReadConfig();
734#ifndef DESKTOP_VERSION 748#ifndef DESKTOP_VERSION
735 sp->showMaximized(); 749 sp->showMaximized();
736#else 750#else
737 sp->show(); 751 sp->show();
738#endif 752#endif
739 sp->exec(); 753 sp->exec();
740 mSyncProfileNames = sp->getSyncProfileNames(); 754 mSyncProfileNames = sp->getSyncProfileNames();
741 mLocalMachineName = sp->getLocalMachineName (); 755 mLocalMachineName = sp->getLocalMachineName ();
742 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 756 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
743} 757}
758void KSyncManager::syncKDE()
759{
760 emit save();
761 switch(mTargetApp)
762 {
763 case (KAPI):
764
765 break;
766 case (KOPI):
767 {
768 QString command ="./kdecaldump";
769 system ( command.latin1());
770 if ( syncWithFile( "/tmp/kdedumpall.ics",true ) ) {
771 if ( mWriteBackFile ) {
772 command += " --read";
773 system ( command.latin1());
774 }
775 }
776
777 }
778 break;
779 case (PWMPI):
780
781 break;
782 default:
783 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
784 break;
785
786 }
787}
744 788
745void KSyncManager::syncSharp() 789void KSyncManager::syncSharp()
746{ 790{
747 791
748 if ( ! syncExternalApplication("sharp") ) 792 if ( ! syncExternalApplication("sharp") )
749 qDebug("ERROR sync sharp "); 793 qDebug("ERROR sync sharp ");
750} 794}
751 795
752bool KSyncManager::syncExternalApplication(QString resource) 796bool KSyncManager::syncExternalApplication(QString resource)
753{ 797{
754 798
755 emit save(); 799 emit save();
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 9094aac..7d5b05e 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -161,24 +161,25 @@ class KSyncManager : public QObject
161 void syncPi(); 161 void syncPi();
162 KServerSocket * mServerSocket; 162 KServerSocket * mServerSocket;
163 void enableQuick(); 163 void enableQuick();
164 KPimPrefs* mPrefs; 164 KPimPrefs* mPrefs;
165 QString mDefFileName; 165 QString mDefFileName;
166 QString mCurrentSyncDevice; 166 QString mCurrentSyncDevice;
167 QString mCurrentSyncName; 167 QString mCurrentSyncName;
168 void quickSyncLocalFile(); 168 void quickSyncLocalFile();
169 bool syncWithFile( QString fn , bool quick ); 169 bool syncWithFile( QString fn , bool quick );
170 void syncLocalFile(); 170 void syncLocalFile();
171 void syncPhone(); 171 void syncPhone();
172 void syncSharp(); 172 void syncSharp();
173 void syncKDE();
173 bool syncExternalApplication(QString); 174 bool syncExternalApplication(QString);
174 int mCurrentSyncProfile ; 175 int mCurrentSyncProfile ;
175 void syncRemote( KSyncProfile* prof, bool ask = true); 176 void syncRemote( KSyncProfile* prof, bool ask = true);
176 void edit_sync_options(); 177 void edit_sync_options();
177 void edit_pisync_options(); 178 void edit_pisync_options();
178 int ringSync(); 179 int ringSync();
179 QString getPassword( ); 180 QString getPassword( );
180 181
181 private slots: 182 private slots:
182 void confSync(); 183 void confSync();
183 private: 184 private:
184 bool mBlockSaveFlag; 185 bool mBlockSaveFlag;