summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-10-09 21:35:22 (UTC)
committer zautrix <zautrix>2004-10-09 21:35:22 (UTC)
commit213a9d993e5a4751b64e18320cfbebb000681d13 (patch) (unidiff)
tree995b465797464e689b73d3271ff4a3f8f0d3749b /kaddressbook
parentd68435216e1ebc5a7fed391157197994e13992b3 (diff)
downloadkdepimpi-213a9d993e5a4751b64e18320cfbebb000681d13.zip
kdepimpi-213a9d993e5a4751b64e18320cfbebb000681d13.tar.gz
kdepimpi-213a9d993e5a4751b64e18320cfbebb000681d13.tar.bz2
ab phone sync implemented
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp65
-rw-r--r--kaddressbook/kabcore.h3
2 files changed, 47 insertions, 21 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 452f1bc..a7967cb 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2058,842 +2058,867 @@ void KABCore::addActionsManually()
2058 } 2058 }
2059 } 2059 }
2060 //mActionQuit->plug ( tb ); 2060 //mActionQuit->plug ( tb );
2061 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2061 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2062 2062
2063 //US link the searchwidget first to this. 2063 //US link the searchwidget first to this.
2064 // The real linkage to the toolbar happens later. 2064 // The real linkage to the toolbar happens later.
2065//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2065//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2066//US tb->insertItem( mIncSearchWidget ); 2066//US tb->insertItem( mIncSearchWidget );
2067/*US 2067/*US
2068 mIncSearchWidget = new IncSearchWidget( tb ); 2068 mIncSearchWidget = new IncSearchWidget( tb );
2069 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2069 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2070 SLOT( incrementalSearch( const QString& ) ) ); 2070 SLOT( incrementalSearch( const QString& ) ) );
2071 2071
2072 mJumpButtonBar = new JumpButtonBar( this, this ); 2072 mJumpButtonBar = new JumpButtonBar( this, this );
2073 2073
2074//US topLayout->addWidget( mJumpButtonBar ); 2074//US topLayout->addWidget( mJumpButtonBar );
2075 this->layout()->add( mJumpButtonBar ); 2075 this->layout()->add( mJumpButtonBar );
2076*/ 2076*/
2077 2077
2078#endif //KAB_EMBEDDED 2078#endif //KAB_EMBEDDED
2079 2079
2080 mActionExport2phone->plug( ExportMenu ); 2080 mActionExport2phone->plug( ExportMenu );
2081 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2081 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2082 syncManager->fillSyncMenu(); 2082 syncManager->fillSyncMenu();
2083 2083
2084} 2084}
2085void KABCore::showLicence() 2085void KABCore::showLicence()
2086{ 2086{
2087 KApplication::showLicence(); 2087 KApplication::showLicence();
2088} 2088}
2089void KABCore::removeVoice() 2089void KABCore::removeVoice()
2090{ 2090{
2091 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2091 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2092 return; 2092 return;
2093 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2093 KABC::Addressee::List list = mViewManager->selectedAddressees();
2094 KABC::Addressee::List::Iterator it; 2094 KABC::Addressee::List::Iterator it;
2095 for ( it = list.begin(); it != list.end(); ++it ) { 2095 for ( it = list.begin(); it != list.end(); ++it ) {
2096 2096
2097 if ( (*it).removeVoice() ) 2097 if ( (*it).removeVoice() )
2098 contactModified((*it) ); 2098 contactModified((*it) );
2099 } 2099 }
2100} 2100}
2101 2101
2102 2102
2103 2103
2104void KABCore::clipboardDataChanged() 2104void KABCore::clipboardDataChanged()
2105{ 2105{
2106 2106
2107 if ( mReadWrite ) 2107 if ( mReadWrite )
2108 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2108 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2109 2109
2110} 2110}
2111 2111
2112void KABCore::updateActionMenu() 2112void KABCore::updateActionMenu()
2113{ 2113{
2114 UndoStack *undo = UndoStack::instance(); 2114 UndoStack *undo = UndoStack::instance();
2115 RedoStack *redo = RedoStack::instance(); 2115 RedoStack *redo = RedoStack::instance();
2116 2116
2117 if ( undo->isEmpty() ) 2117 if ( undo->isEmpty() )
2118 mActionUndo->setText( i18n( "Undo" ) ); 2118 mActionUndo->setText( i18n( "Undo" ) );
2119 else 2119 else
2120 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2120 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2121 2121
2122 mActionUndo->setEnabled( !undo->isEmpty() ); 2122 mActionUndo->setEnabled( !undo->isEmpty() );
2123 2123
2124 if ( !redo->top() ) 2124 if ( !redo->top() )
2125 mActionRedo->setText( i18n( "Redo" ) ); 2125 mActionRedo->setText( i18n( "Redo" ) );
2126 else 2126 else
2127 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2127 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2128 2128
2129 mActionRedo->setEnabled( !redo->isEmpty() ); 2129 mActionRedo->setEnabled( !redo->isEmpty() );
2130} 2130}
2131 2131
2132void KABCore::configureKeyBindings() 2132void KABCore::configureKeyBindings()
2133{ 2133{
2134#ifndef KAB_EMBEDDED 2134#ifndef KAB_EMBEDDED
2135 KKeyDialog::configure( actionCollection(), true ); 2135 KKeyDialog::configure( actionCollection(), true );
2136#else //KAB_EMBEDDED 2136#else //KAB_EMBEDDED
2137 qDebug("KABCore::configureKeyBindings() not implemented"); 2137 qDebug("KABCore::configureKeyBindings() not implemented");
2138#endif //KAB_EMBEDDED 2138#endif //KAB_EMBEDDED
2139} 2139}
2140 2140
2141#ifdef KAB_EMBEDDED 2141#ifdef KAB_EMBEDDED
2142void KABCore::configureResources() 2142void KABCore::configureResources()
2143{ 2143{
2144 KRES::KCMKResources dlg( this, "" , 0 ); 2144 KRES::KCMKResources dlg( this, "" , 0 );
2145 2145
2146 if ( !dlg.exec() ) 2146 if ( !dlg.exec() )
2147 return; 2147 return;
2148 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2148 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2149} 2149}
2150#endif //KAB_EMBEDDED 2150#endif //KAB_EMBEDDED
2151 2151
2152 2152
2153/* this method will be called through the QCop interface from Ko/Pi to select addresses 2153/* this method will be called through the QCop interface from Ko/Pi to select addresses
2154 * for the attendees list of an event. 2154 * for the attendees list of an event.
2155 */ 2155 */
2156void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2156void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2157{ 2157{
2158 QStringList nameList; 2158 QStringList nameList;
2159 QStringList emailList; 2159 QStringList emailList;
2160 QStringList uidList; 2160 QStringList uidList;
2161 2161
2162 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2162 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2163 uint i=0; 2163 uint i=0;
2164 for (i=0; i < list.count(); i++) 2164 for (i=0; i < list.count(); i++)
2165 { 2165 {
2166 nameList.append(list[i].realName()); 2166 nameList.append(list[i].realName());
2167 emailList.append(list[i].preferredEmail()); 2167 emailList.append(list[i].preferredEmail());
2168 uidList.append(list[i].uid()); 2168 uidList.append(list[i].uid());
2169 } 2169 }
2170 2170
2171 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2171 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2172 2172
2173} 2173}
2174 2174
2175/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2175/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2176 * to put them into the calendar. 2176 * to put them into the calendar.
2177 */ 2177 */
2178void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2178void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2179{ 2179{
2180 // qDebug("KABCore::requestForBirthdayList"); 2180 // qDebug("KABCore::requestForBirthdayList");
2181 QStringList birthdayList; 2181 QStringList birthdayList;
2182 QStringList anniversaryList; 2182 QStringList anniversaryList;
2183 QStringList realNameList; 2183 QStringList realNameList;
2184 QStringList preferredEmailList; 2184 QStringList preferredEmailList;
2185 QStringList assembledNameList; 2185 QStringList assembledNameList;
2186 QStringList uidList; 2186 QStringList uidList;
2187 2187
2188 KABC::AddressBook::Iterator it; 2188 KABC::AddressBook::Iterator it;
2189 2189
2190 int count = 0; 2190 int count = 0;
2191 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2191 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2192 ++count; 2192 ++count;
2193 } 2193 }
2194 QProgressBar bar(count,0 ); 2194 QProgressBar bar(count,0 );
2195 int w = 300; 2195 int w = 300;
2196 if ( QApplication::desktop()->width() < 320 ) 2196 if ( QApplication::desktop()->width() < 320 )
2197 w = 220; 2197 w = 220;
2198 int h = bar.sizeHint().height() ; 2198 int h = bar.sizeHint().height() ;
2199 int dw = QApplication::desktop()->width(); 2199 int dw = QApplication::desktop()->width();
2200 int dh = QApplication::desktop()->height(); 2200 int dh = QApplication::desktop()->height();
2201 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2201 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2202 bar.show(); 2202 bar.show();
2203 bar.setCaption (i18n("collecting birthdays - close to abort!") ); 2203 bar.setCaption (i18n("collecting birthdays - close to abort!") );
2204 qApp->processEvents(); 2204 qApp->processEvents();
2205 2205
2206 QDate bday; 2206 QDate bday;
2207 QString anni; 2207 QString anni;
2208 QString formattedbday; 2208 QString formattedbday;
2209 2209
2210 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2210 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2211 { 2211 {
2212 if ( ! bar.isVisible() ) 2212 if ( ! bar.isVisible() )
2213 return; 2213 return;
2214 bar.setProgress( count++ ); 2214 bar.setProgress( count++ );
2215 qApp->processEvents(); 2215 qApp->processEvents();
2216 bday = (*it).birthday().date(); 2216 bday = (*it).birthday().date();
2217 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2217 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2218 2218
2219 if ( bday.isValid() || !anni.isEmpty()) 2219 if ( bday.isValid() || !anni.isEmpty())
2220 { 2220 {
2221 if (bday.isValid()) 2221 if (bday.isValid())
2222 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2222 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2223 else 2223 else
2224 formattedbday = "NOTVALID"; 2224 formattedbday = "NOTVALID";
2225 if (anni.isEmpty()) 2225 if (anni.isEmpty())
2226 anni = "INVALID"; 2226 anni = "INVALID";
2227 2227
2228 birthdayList.append(formattedbday); 2228 birthdayList.append(formattedbday);
2229 anniversaryList.append(anni); //should be ISODate 2229 anniversaryList.append(anni); //should be ISODate
2230 realNameList.append((*it).realName()); 2230 realNameList.append((*it).realName());
2231 preferredEmailList.append((*it).preferredEmail()); 2231 preferredEmailList.append((*it).preferredEmail());
2232 assembledNameList.append((*it).assembledName()); 2232 assembledNameList.append((*it).assembledName());
2233 uidList.append((*it).uid()); 2233 uidList.append((*it).uid());
2234 2234
2235 qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); 2235 qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2236 } 2236 }
2237 } 2237 }
2238 2238
2239 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2239 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2240 2240
2241} 2241}
2242 2242
2243/* this method will be called through the QCop interface from other apps to show details of a contact. 2243/* this method will be called through the QCop interface from other apps to show details of a contact.
2244 */ 2244 */
2245void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2245void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2246{ 2246{
2247 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2247 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2248 2248
2249 QString foundUid = QString::null; 2249 QString foundUid = QString::null;
2250 if ( ! uid.isEmpty() ) { 2250 if ( ! uid.isEmpty() ) {
2251 Addressee adrr = mAddressBook->findByUid( uid ); 2251 Addressee adrr = mAddressBook->findByUid( uid );
2252 if ( !adrr.isEmpty() ) { 2252 if ( !adrr.isEmpty() ) {
2253 foundUid = uid; 2253 foundUid = uid;
2254 } 2254 }
2255 if ( email == "sendbacklist" ) { 2255 if ( email == "sendbacklist" ) {
2256 //qDebug("ssssssssssssssssssssssend "); 2256 //qDebug("ssssssssssssssssssssssend ");
2257 QStringList nameList; 2257 QStringList nameList;
2258 QStringList emailList; 2258 QStringList emailList;
2259 QStringList uidList; 2259 QStringList uidList;
2260 nameList.append(adrr.realName()); 2260 nameList.append(adrr.realName());
2261 emailList = adrr.emails(); 2261 emailList = adrr.emails();
2262 uidList.append( adrr.preferredEmail()); 2262 uidList.append( adrr.preferredEmail());
2263 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2263 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2264 return; 2264 return;
2265 } 2265 }
2266 2266
2267 } 2267 }
2268 2268
2269 if ( email == "sendbacklist" ) 2269 if ( email == "sendbacklist" )
2270 return; 2270 return;
2271 if (foundUid.isEmpty()) 2271 if (foundUid.isEmpty())
2272 { 2272 {
2273 //find the uid of the person first 2273 //find the uid of the person first
2274 Addressee::List namelist; 2274 Addressee::List namelist;
2275 Addressee::List emaillist; 2275 Addressee::List emaillist;
2276 2276
2277 if (!name.isEmpty()) 2277 if (!name.isEmpty())
2278 namelist = mAddressBook->findByName( name ); 2278 namelist = mAddressBook->findByName( name );
2279 2279
2280 if (!email.isEmpty()) 2280 if (!email.isEmpty())
2281 emaillist = mAddressBook->findByEmail( email ); 2281 emaillist = mAddressBook->findByEmail( email );
2282 qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2282 qDebug("count %d %d ", namelist.count(),emaillist.count() );
2283 //check if we have a match in Namelist and Emaillist 2283 //check if we have a match in Namelist and Emaillist
2284 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2284 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2285 foundUid = emaillist[0].uid(); 2285 foundUid = emaillist[0].uid();
2286 } 2286 }
2287 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2287 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2288 foundUid = namelist[0].uid(); 2288 foundUid = namelist[0].uid();
2289 else 2289 else
2290 { 2290 {
2291 for (int i = 0; i < namelist.count(); i++) 2291 for (int i = 0; i < namelist.count(); i++)
2292 { 2292 {
2293 for (int j = 0; j < emaillist.count(); j++) 2293 for (int j = 0; j < emaillist.count(); j++)
2294 { 2294 {
2295 if (namelist[i] == emaillist[j]) 2295 if (namelist[i] == emaillist[j])
2296 { 2296 {
2297 foundUid = namelist[i].uid(); 2297 foundUid = namelist[i].uid();
2298 } 2298 }
2299 } 2299 }
2300 } 2300 }
2301 } 2301 }
2302 } 2302 }
2303 else 2303 else
2304 { 2304 {
2305 foundUid = uid; 2305 foundUid = uid;
2306 } 2306 }
2307 2307
2308 if (!foundUid.isEmpty()) 2308 if (!foundUid.isEmpty())
2309 { 2309 {
2310 2310
2311 // raise Ka/Pi if it is in the background 2311 // raise Ka/Pi if it is in the background
2312#ifndef DESKTOP_VERSION 2312#ifndef DESKTOP_VERSION
2313#ifndef KORG_NODCOP 2313#ifndef KORG_NODCOP
2314 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2314 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2315#endif 2315#endif
2316#endif 2316#endif
2317 2317
2318 mMainWindow->showMaximized(); 2318 mMainWindow->showMaximized();
2319 mMainWindow-> raise(); 2319 mMainWindow-> raise();
2320 2320
2321 mViewManager->setSelected( "", false); 2321 mViewManager->setSelected( "", false);
2322 mViewManager->refreshView( "" ); 2322 mViewManager->refreshView( "" );
2323 mViewManager->setSelected( foundUid, true ); 2323 mViewManager->setSelected( foundUid, true );
2324 mViewManager->refreshView( foundUid ); 2324 mViewManager->refreshView( foundUid );
2325 2325
2326 if ( !mMultipleViewsAtOnce ) 2326 if ( !mMultipleViewsAtOnce )
2327 { 2327 {
2328 setDetailsVisible( true ); 2328 setDetailsVisible( true );
2329 mActionDetails->setChecked(true); 2329 mActionDetails->setChecked(true);
2330 } 2330 }
2331 } 2331 }
2332} 2332}
2333 2333
2334 2334
2335void KABCore::faq() 2335void KABCore::faq()
2336{ 2336{
2337 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2337 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2338} 2338}
2339 2339
2340#include <libkcal/syncdefines.h> 2340#include <libkcal/syncdefines.h>
2341 2341
2342KABC::Addressee KABCore::getLastSyncAddressee() 2342KABC::Addressee KABCore::getLastSyncAddressee()
2343{ 2343{
2344 Addressee lse; 2344 Addressee lse;
2345 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2345 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2346 2346
2347 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2347 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2348 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2348 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2349 if (lse.isEmpty()) { 2349 if (lse.isEmpty()) {
2350 qDebug("Creating new last-syncAddressee "); 2350 qDebug("Creating new last-syncAddressee ");
2351 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2351 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2352 QString sum = ""; 2352 QString sum = "";
2353 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2353 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2354 sum = "E: "; 2354 sum = "E: ";
2355 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2355 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2356 lse.setRevision( mLastAddressbookSync ); 2356 lse.setRevision( mLastAddressbookSync );
2357 lse.setCategories( i18n("SyncEvent") ); 2357 lse.setCategories( i18n("SyncEvent") );
2358 mAddressBook->insertAddressee( lse ); 2358 mAddressBook->insertAddressee( lse );
2359 } 2359 }
2360 return lse; 2360 return lse;
2361} 2361}
2362int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2362int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2363{ 2363{
2364 2364
2365 //void setZaurusId(int id); 2365 //void setZaurusId(int id);
2366 // int zaurusId() const; 2366 // int zaurusId() const;
2367 // void setZaurusUid(int id); 2367 // void setZaurusUid(int id);
2368 // int zaurusUid() const; 2368 // int zaurusUid() const;
2369 // void setZaurusStat(int id); 2369 // void setZaurusStat(int id);
2370 // int zaurusStat() const; 2370 // int zaurusStat() const;
2371 // 0 equal 2371 // 0 equal
2372 // 1 take local 2372 // 1 take local
2373 // 2 take remote 2373 // 2 take remote
2374 // 3 cancel 2374 // 3 cancel
2375 QDateTime lastSync = mLastAddressbookSync; 2375 QDateTime lastSync = mLastAddressbookSync;
2376 QDateTime localMod = local->revision(); 2376 QDateTime localMod = local->revision();
2377 QDateTime remoteMod = remote->revision(); 2377 QDateTime remoteMod = remote->revision();
2378 2378
2379 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2379 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2380 2380
2381 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2381 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2382 bool remCh, locCh; 2382 bool remCh, locCh;
2383 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2383 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2384 2384
2385 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2385 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2386 locCh = ( localMod > mLastAddressbookSync ); 2386 locCh = ( localMod > mLastAddressbookSync );
2387 if ( !remCh && ! locCh ) { 2387 if ( !remCh && ! locCh ) {
2388 //qDebug("both not changed "); 2388 //qDebug("both not changed ");
2389 lastSync = localMod.addDays(1); 2389 lastSync = localMod.addDays(1);
2390 if ( mode <= SYNC_PREF_ASK ) 2390 if ( mode <= SYNC_PREF_ASK )
2391 return 0; 2391 return 0;
2392 } else { 2392 } else {
2393 if ( locCh ) { 2393 if ( locCh ) {
2394 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2394 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2395 lastSync = localMod.addDays( -1 ); 2395 lastSync = localMod.addDays( -1 );
2396 if ( !remCh ) 2396 if ( !remCh )
2397 remoteMod =( lastSync.addDays( -1 ) ); 2397 remoteMod =( lastSync.addDays( -1 ) );
2398 } else { 2398 } else {
2399 //qDebug(" not loc changed "); 2399 //qDebug(" not loc changed ");
2400 lastSync = localMod.addDays( 1 ); 2400 lastSync = localMod.addDays( 1 );
2401 if ( remCh ) 2401 if ( remCh )
2402 remoteMod =( lastSync.addDays( 1 ) ); 2402 remoteMod =( lastSync.addDays( 1 ) );
2403 2403
2404 } 2404 }
2405 } 2405 }
2406 full = true; 2406 full = true;
2407 if ( mode < SYNC_PREF_ASK ) 2407 if ( mode < SYNC_PREF_ASK )
2408 mode = SYNC_PREF_ASK; 2408 mode = SYNC_PREF_ASK;
2409 } else { 2409 } else {
2410 if ( localMod == remoteMod ) 2410 if ( localMod == remoteMod )
2411 return 0; 2411 return 0;
2412 2412
2413 } 2413 }
2414 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 2414 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
2415 2415
2416 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod); 2416 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod);
2417 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 2417 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
2418 //full = true; //debug only 2418 //full = true; //debug only
2419 if ( full ) { 2419 if ( full ) {
2420 bool equ = ( (*local) == (*remote) ); 2420 bool equ = ( (*local) == (*remote) );
2421 if ( equ ) { 2421 if ( equ ) {
2422 //qDebug("equal "); 2422 //qDebug("equal ");
2423 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2423 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2424 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2424 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2425 } 2425 }
2426 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2426 if ( mode < SYNC_PREF_FORCE_LOCAL )
2427 return 0; 2427 return 0;
2428 2428
2429 }//else //debug only 2429 }//else //debug only
2430 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2430 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2431 } 2431 }
2432 int result; 2432 int result;
2433 bool localIsNew; 2433 bool localIsNew;
2434 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); 2434 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
2435 2435
2436 if ( full && mode < SYNC_PREF_NEWEST ) 2436 if ( full && mode < SYNC_PREF_NEWEST )
2437 mode = SYNC_PREF_ASK; 2437 mode = SYNC_PREF_ASK;
2438 2438
2439 switch( mode ) { 2439 switch( mode ) {
2440 case SYNC_PREF_LOCAL: 2440 case SYNC_PREF_LOCAL:
2441 if ( lastSync > remoteMod ) 2441 if ( lastSync > remoteMod )
2442 return 1; 2442 return 1;
2443 if ( lastSync > localMod ) 2443 if ( lastSync > localMod )
2444 return 2; 2444 return 2;
2445 return 1; 2445 return 1;
2446 break; 2446 break;
2447 case SYNC_PREF_REMOTE: 2447 case SYNC_PREF_REMOTE:
2448 if ( lastSync > remoteMod ) 2448 if ( lastSync > remoteMod )
2449 return 1; 2449 return 1;
2450 if ( lastSync > localMod ) 2450 if ( lastSync > localMod )
2451 return 2; 2451 return 2;
2452 return 2; 2452 return 2;
2453 break; 2453 break;
2454 case SYNC_PREF_NEWEST: 2454 case SYNC_PREF_NEWEST:
2455 if ( localMod > remoteMod ) 2455 if ( localMod > remoteMod )
2456 return 1; 2456 return 1;
2457 else 2457 else
2458 return 2; 2458 return 2;
2459 break; 2459 break;
2460 case SYNC_PREF_ASK: 2460 case SYNC_PREF_ASK:
2461 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2461 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2462 if ( lastSync > remoteMod ) 2462 if ( lastSync > remoteMod )
2463 return 1; 2463 return 1;
2464 if ( lastSync > localMod ) 2464 if ( lastSync > localMod )
2465 return 2; 2465 return 2;
2466 localIsNew = localMod >= remoteMod; 2466 localIsNew = localMod >= remoteMod;
2467 //qDebug("conflict! ************************************** "); 2467 //qDebug("conflict! ************************************** ");
2468 { 2468 {
2469 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2469 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2470 result = acd.executeD(localIsNew); 2470 result = acd.executeD(localIsNew);
2471 return result; 2471 return result;
2472 } 2472 }
2473 break; 2473 break;
2474 case SYNC_PREF_FORCE_LOCAL: 2474 case SYNC_PREF_FORCE_LOCAL:
2475 return 1; 2475 return 1;
2476 break; 2476 break;
2477 case SYNC_PREF_FORCE_REMOTE: 2477 case SYNC_PREF_FORCE_REMOTE:
2478 return 2; 2478 return 2;
2479 break; 2479 break;
2480 2480
2481 default: 2481 default:
2482 // SYNC_PREF_TAKE_BOTH not implemented 2482 // SYNC_PREF_TAKE_BOTH not implemented
2483 break; 2483 break;
2484 } 2484 }
2485 return 0; 2485 return 0;
2486} 2486}
2487 2487
2488 2488
2489bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) 2489bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
2490{ 2490{
2491 bool syncOK = true; 2491 bool syncOK = true;
2492 int addedAddressee = 0; 2492 int addedAddressee = 0;
2493 int addedAddresseeR = 0; 2493 int addedAddresseeR = 0;
2494 int deletedAddresseeR = 0; 2494 int deletedAddresseeR = 0;
2495 int deletedAddresseeL = 0; 2495 int deletedAddresseeL = 0;
2496 int changedLocal = 0; 2496 int changedLocal = 0;
2497 int changedRemote = 0; 2497 int changedRemote = 0;
2498 2498
2499 QString mCurrentSyncName = syncManager->getCurrentSyncName(); 2499 QString mCurrentSyncName = syncManager->getCurrentSyncName();
2500 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2500 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2501 2501
2502 //QPtrList<Addressee> el = local->rawAddressees(); 2502 //QPtrList<Addressee> el = local->rawAddressees();
2503 Addressee addresseeR; 2503 Addressee addresseeR;
2504 QString uid; 2504 QString uid;
2505 int take; 2505 int take;
2506 Addressee addresseeL; 2506 Addressee addresseeL;
2507 Addressee addresseeRSync; 2507 Addressee addresseeRSync;
2508 Addressee addresseeLSync; 2508 Addressee addresseeLSync;
2509 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); 2509 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees();
2510 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); 2510 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
2511 bool fullDateRange = false; 2511 bool fullDateRange = false;
2512 local->resetTempSyncStat(); 2512 local->resetTempSyncStat();
2513 mLastAddressbookSync = QDateTime::currentDateTime(); 2513 mLastAddressbookSync = QDateTime::currentDateTime();
2514 QDateTime modifiedCalendar = mLastAddressbookSync;; 2514 QDateTime modifiedCalendar = mLastAddressbookSync;;
2515 addresseeLSync = getLastSyncAddressee(); 2515 addresseeLSync = getLastSyncAddressee();
2516 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); 2516 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1());
2517 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); 2517 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
2518 if ( !addresseeR.isEmpty() ) { 2518 if ( !addresseeR.isEmpty() ) {
2519 addresseeRSync = addresseeR; 2519 addresseeRSync = addresseeR;
2520 remote->removeAddressee(addresseeR ); 2520 remote->removeAddressee(addresseeR );
2521 2521
2522 } else { 2522 } else {
2523 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2523 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2524 addresseeRSync = addresseeLSync ; 2524 addresseeRSync = addresseeLSync ;
2525 } else { 2525 } else {
2526 qDebug("FULLDATE 1"); 2526 qDebug("FULLDATE 1");
2527 fullDateRange = true; 2527 fullDateRange = true;
2528 Addressee newAdd; 2528 Addressee newAdd;
2529 addresseeRSync = newAdd; 2529 addresseeRSync = newAdd;
2530 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); 2530 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
2531 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); 2531 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
2532 addresseeRSync.setRevision( mLastAddressbookSync ); 2532 addresseeRSync.setRevision( mLastAddressbookSync );
2533 addresseeRSync.setCategories( i18n("SyncAddressee") ); 2533 addresseeRSync.setCategories( i18n("SyncAddressee") );
2534 } 2534 }
2535 } 2535 }
2536 if ( addresseeLSync.revision() == mLastAddressbookSync ) { 2536 if ( addresseeLSync.revision() == mLastAddressbookSync ) {
2537 qDebug("FULLDATE 2"); 2537 qDebug("FULLDATE 2");
2538 fullDateRange = true; 2538 fullDateRange = true;
2539 } 2539 }
2540 if ( ! fullDateRange ) { 2540 if ( ! fullDateRange ) {
2541 if ( addresseeLSync.revision() != addresseeRSync.revision() ) { 2541 if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
2542 2542
2543 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2543 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
2544 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 2544 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2545 fullDateRange = true; 2545 fullDateRange = true;
2546 qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); 2546 qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() );
2547 } 2547 }
2548 } 2548 }
2549 // fullDateRange = true; // debug only! 2549 // fullDateRange = true; // debug only!
2550 if ( fullDateRange ) 2550 if ( fullDateRange )
2551 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); 2551 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
2552 else 2552 else
2553 mLastAddressbookSync = addresseeLSync.revision(); 2553 mLastAddressbookSync = addresseeLSync.revision();
2554 // for resyncing if own file has changed 2554 // for resyncing if own file has changed
2555 // PENDING fixme later when implemented 2555 // PENDING fixme later when implemented
2556#if 0 2556#if 0
2557 if ( mCurrentSyncDevice == "deleteaftersync" ) { 2557 if ( mCurrentSyncDevice == "deleteaftersync" ) {
2558 mLastAddressbookSync = loadedFileVersion; 2558 mLastAddressbookSync = loadedFileVersion;
2559 qDebug("setting mLastAddressbookSync "); 2559 qDebug("setting mLastAddressbookSync ");
2560 } 2560 }
2561#endif 2561#endif
2562 2562
2563 //qDebug("*************************** "); 2563 //qDebug("*************************** ");
2564 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 2564 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2565 QStringList er = remote->uidList(); 2565 QStringList er = remote->uidList();
2566 Addressee inR ;//= er.first(); 2566 Addressee inR ;//= er.first();
2567 Addressee inL; 2567 Addressee inL;
2568 2568
2569 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); 2569 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
2570 2570
2571 int modulo = (er.count()/10)+1; 2571 int modulo = (er.count()/10)+1;
2572 int incCounter = 0; 2572 int incCounter = 0;
2573 while ( incCounter < er.count()) { 2573 while ( incCounter < er.count()) {
2574 if (syncManager->isProgressBarCanceled()) 2574 if (syncManager->isProgressBarCanceled())
2575 return false; 2575 return false;
2576 if ( incCounter % modulo == 0 ) 2576 if ( incCounter % modulo == 0 )
2577 syncManager->showProgressBar(incCounter); 2577 syncManager->showProgressBar(incCounter);
2578 2578
2579 uid = er[ incCounter ]; 2579 uid = er[ incCounter ];
2580 bool skipIncidence = false; 2580 bool skipIncidence = false;
2581 if ( uid.left(19) == QString("last-syncAddressee-") ) 2581 if ( uid.left(19) == QString("last-syncAddressee-") )
2582 skipIncidence = true; 2582 skipIncidence = true;
2583 QString idS,OidS; 2583 QString idS,OidS;
2584 qApp->processEvents(); 2584 qApp->processEvents();
2585 if ( !skipIncidence ) { 2585 if ( !skipIncidence ) {
2586 inL = local->findByUid( uid ); 2586 inL = local->findByUid( uid );
2587 inR = remote->findByUid( uid ); 2587 inR = remote->findByUid( uid );
2588 //inL.setResource( 0 ); 2588 //inL.setResource( 0 );
2589 //inR.setResource( 0 ); 2589 //inR.setResource( 0 );
2590 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars 2590 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
2591 if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { 2591 if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) {
2592 //qDebug("take %d %s ", take, inL.summary().latin1()); 2592 //qDebug("take %d %s ", take, inL.summary().latin1());
2593 if ( take == 3 ) 2593 if ( take == 3 )
2594 return false; 2594 return false;
2595 if ( take == 1 ) {// take local 2595 if ( take == 1 ) {// take local
2596 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2596 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2597 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2597 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2598 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2598 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2599 local->insertAddressee( inL, false ); 2599 local->insertAddressee( inL, false );
2600 idS = inR.externalUID(); 2600 idS = inR.externalUID();
2601 OidS = inR.originalExternalUID(); 2601 OidS = inR.originalExternalUID();
2602 } 2602 }
2603 else 2603 else
2604 idS = inR.IDStr(); 2604 idS = inR.IDStr();
2605 remote->removeAddressee( inR ); 2605 remote->removeAddressee( inR );
2606 inR = inL; 2606 inR = inL;
2607 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 2607 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
2608 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2608 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2609 inR.setOriginalExternalUID( OidS ); 2609 inR.setOriginalExternalUID( OidS );
2610 inR.setExternalUID( idS ); 2610 inR.setExternalUID( idS );
2611 } else { 2611 } else {
2612 inR.setIDStr( idS ); 2612 inR.setIDStr( idS );
2613 } 2613 }
2614 inR.setResource( 0 ); 2614 inR.setResource( 0 );
2615 remote->insertAddressee( inR , false); 2615 remote->insertAddressee( inR , false);
2616 ++changedRemote; 2616 ++changedRemote;
2617 } else { // take == 2 take remote 2617 } else { // take == 2 take remote
2618 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2618 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2619 if ( inR.revision().date().year() < 2004 ) 2619 if ( inR.revision().date().year() < 2004 )
2620 inR.setRevision( modifiedCalendar ); 2620 inR.setRevision( modifiedCalendar );
2621 } 2621 }
2622 idS = inL.IDStr(); 2622 idS = inL.IDStr();
2623 local->removeAddressee( inL ); 2623 local->removeAddressee( inL );
2624 inL = inR; 2624 inL = inR;
2625 inL.setIDStr( idS ); 2625 inL.setIDStr( idS );
2626 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2626 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2627 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2627 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2628 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2628 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2629 } 2629 }
2630 inL.setResource( 0 ); 2630 inL.setResource( 0 );
2631 local->insertAddressee( inL , false ); 2631 local->insertAddressee( inL , false );
2632 ++changedLocal; 2632 ++changedLocal;
2633 } 2633 }
2634 } 2634 }
2635 } else { // no conflict 2635 } else { // no conflict
2636 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2636 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2637 QString des = addresseeLSync.note(); 2637 QString des = addresseeLSync.note();
2638 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 2638 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
2639 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 2639 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
2640 remote->insertAddressee( inR, false ); 2640 remote->insertAddressee( inR, false );
2641 ++deletedAddresseeR; 2641 ++deletedAddresseeR;
2642 } else { 2642 } else {
2643 inR.setRevision( modifiedCalendar ); 2643 inR.setRevision( modifiedCalendar );
2644 remote->insertAddressee( inR, false ); 2644 remote->insertAddressee( inR, false );
2645 inL = inR; 2645 inL = inR;
2646 inL.setResource( 0 ); 2646 inL.setResource( 0 );
2647 local->insertAddressee( inL , false); 2647 local->insertAddressee( inL , false);
2648 ++addedAddressee; 2648 ++addedAddressee;
2649 } 2649 }
2650 } else { 2650 } else {
2651 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { 2651 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) {
2652 inR.setRevision( modifiedCalendar ); 2652 inR.setRevision( modifiedCalendar );
2653 remote->insertAddressee( inR, false ); 2653 remote->insertAddressee( inR, false );
2654 inR.setResource( 0 ); 2654 inR.setResource( 0 );
2655 local->insertAddressee( inR, false ); 2655 local->insertAddressee( inR, false );
2656 ++addedAddressee; 2656 ++addedAddressee;
2657 } else { 2657 } else {
2658 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); 2658 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR);
2659 remote->removeAddressee( inR ); 2659 remote->removeAddressee( inR );
2660 ++deletedAddresseeR; 2660 ++deletedAddresseeR;
2661 } 2661 }
2662 } 2662 }
2663 } 2663 }
2664 } 2664 }
2665 ++incCounter; 2665 ++incCounter;
2666 } 2666 }
2667 er.clear(); 2667 er.clear();
2668 QStringList el = local->uidList(); 2668 QStringList el = local->uidList();
2669 modulo = (el.count()/10)+1; 2669 modulo = (el.count()/10)+1;
2670 2670
2671 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); 2671 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
2672 incCounter = 0; 2672 incCounter = 0;
2673 while ( incCounter < el.count()) { 2673 while ( incCounter < el.count()) {
2674 qApp->processEvents(); 2674 qApp->processEvents();
2675 if (syncManager->isProgressBarCanceled()) 2675 if (syncManager->isProgressBarCanceled())
2676 return false; 2676 return false;
2677 if ( incCounter % modulo == 0 ) 2677 if ( incCounter % modulo == 0 )
2678 syncManager->showProgressBar(incCounter); 2678 syncManager->showProgressBar(incCounter);
2679 uid = el[ incCounter ]; 2679 uid = el[ incCounter ];
2680 bool skipIncidence = false; 2680 bool skipIncidence = false;
2681 if ( uid.left(19) == QString("last-syncAddressee-") ) 2681 if ( uid.left(19) == QString("last-syncAddressee-") )
2682 skipIncidence = true; 2682 skipIncidence = true;
2683 if ( !skipIncidence ) { 2683 if ( !skipIncidence ) {
2684 inL = local->findByUid( uid ); 2684 inL = local->findByUid( uid );
2685 inR = remote->findByUid( uid ); 2685 inR = remote->findByUid( uid );
2686 if ( inR.isEmpty() ) { 2686 if ( inR.isEmpty() ) {
2687 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2687 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2688 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 2688 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
2689 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2689 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2690 local->removeAddressee( inL ); 2690 local->removeAddressee( inL );
2691 ++deletedAddresseeL; 2691 ++deletedAddresseeL;
2692 } else { 2692 } else {
2693 if ( ! syncManager->mWriteBackExistingOnly ) { 2693 if ( ! syncManager->mWriteBackExistingOnly ) {
2694 inL.removeID(mCurrentSyncDevice ); 2694 inL.removeID(mCurrentSyncDevice );
2695 ++addedAddresseeR; 2695 ++addedAddresseeR;
2696 inL.setRevision( modifiedCalendar ); 2696 inL.setRevision( modifiedCalendar );
2697 local->insertAddressee( inL, false ); 2697 local->insertAddressee( inL, false );
2698 inR = inL; 2698 inR = inL;
2699 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 2699 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
2700 inR.setResource( 0 ); 2700 inR.setResource( 0 );
2701 remote->insertAddressee( inR, false ); 2701 remote->insertAddressee( inR, false );
2702 } 2702 }
2703 } 2703 }
2704 } else { 2704 } else {
2705 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 2705 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
2706 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2706 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2707 local->removeAddressee( inL ); 2707 local->removeAddressee( inL );
2708 ++deletedAddresseeL; 2708 ++deletedAddresseeL;
2709 } else { 2709 } else {
2710 if ( ! syncManager->mWriteBackExistingOnly ) { 2710 if ( ! syncManager->mWriteBackExistingOnly ) {
2711 ++addedAddresseeR; 2711 ++addedAddresseeR;
2712 inL.setRevision( modifiedCalendar ); 2712 inL.setRevision( modifiedCalendar );
2713 local->insertAddressee( inL, false ); 2713 local->insertAddressee( inL, false );
2714 inR = inL; 2714 inR = inL;
2715 inR.setResource( 0 ); 2715 inR.setResource( 0 );
2716 remote->insertAddressee( inR, false ); 2716 remote->insertAddressee( inR, false );
2717 } 2717 }
2718 } 2718 }
2719 } 2719 }
2720 } 2720 }
2721 } 2721 }
2722 ++incCounter; 2722 ++incCounter;
2723 } 2723 }
2724 el.clear(); 2724 el.clear();
2725 syncManager->hideProgressBar(); 2725 syncManager->hideProgressBar();
2726 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2726 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2727 // get rid of micro seconds 2727 // get rid of micro seconds
2728 QTime t = mLastAddressbookSync.time(); 2728 QTime t = mLastAddressbookSync.time();
2729 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2729 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2730 addresseeLSync.setRevision( mLastAddressbookSync ); 2730 addresseeLSync.setRevision( mLastAddressbookSync );
2731 addresseeRSync.setRevision( mLastAddressbookSync ); 2731 addresseeRSync.setRevision( mLastAddressbookSync );
2732 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2732 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2733 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2733 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2734 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2734 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2735 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2735 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2736 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2736 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2737 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2737 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2738 addresseeRSync.setNote( "" ) ; 2738 addresseeRSync.setNote( "" ) ;
2739 addresseeLSync.setNote( "" ); 2739 addresseeLSync.setNote( "" );
2740 2740
2741 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2741 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2742 remote->insertAddressee( addresseeRSync, false ); 2742 remote->insertAddressee( addresseeRSync, false );
2743 local->insertAddressee( addresseeLSync, false ); 2743 local->insertAddressee( addresseeLSync, false );
2744 QString mes; 2744 QString mes;
2745 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); 2745 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
2746 if ( syncManager->mShowSyncSummary ) { 2746 if ( syncManager->mShowSyncSummary ) {
2747 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); 2747 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") );
2748 } 2748 }
2749 qDebug( mes ); 2749 qDebug( mes );
2750 return syncOK; 2750 return syncOK;
2751} 2751}
2752 2752
2753 2753
2754//this is a overwritten callbackmethods from the syncinterface 2754//this is a overwritten callbackmethods from the syncinterface
2755bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 2755bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2756{ 2756{
2757 2757
2758 //pending prepare addresseeview for output 2758 //pending prepare addresseeview for output
2759 //pending detect, if remote file has REV field. if not switch to external sync 2759 //pending detect, if remote file has REV field. if not switch to external sync
2760 mGlobalSyncMode = SYNC_MODE_NORMAL; 2760 mGlobalSyncMode = SYNC_MODE_NORMAL;
2761 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2761 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2762 2762
2763 AddressBook abLocal(filename,"syncContact"); 2763 AddressBook abLocal(filename,"syncContact");
2764 bool syncOK = false; 2764 bool syncOK = false;
2765 if ( abLocal.load() ) { 2765 if ( abLocal.load() ) {
2766 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); 2766 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
2767 bool external = false; 2767 bool external = false;
2768 bool isXML = false; 2768 bool isXML = false;
2769 if ( filename.right(4) == ".xml") { 2769 if ( filename.right(4) == ".xml") {
2770 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2770 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2771 isXML = true; 2771 isXML = true;
2772 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); 2772 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2773 } else { 2773 } else {
2774 Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2774 Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2775 if ( ! lse.isEmpty() ) { 2775 if ( ! lse.isEmpty() ) {
2776 if ( lse.familyName().left(4) == "!E: " ) 2776 if ( lse.familyName().left(4) == "!E: " )
2777 external = true; 2777 external = true;
2778 } else { 2778 } else {
2779 bool found = false; 2779 bool found = false;
2780 AddressBook::Iterator it; 2780 AddressBook::Iterator it;
2781 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2781 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2782 if ( (*it).revision().date().year() > 2003 ) { 2782 if ( (*it).revision().date().year() > 2003 ) {
2783 found = true; 2783 found = true;
2784 break; 2784 break;
2785 } 2785 }
2786 } 2786 }
2787 external = ! found; 2787 external = ! found;
2788 } 2788 }
2789 2789
2790 if ( external ) { 2790 if ( external ) {
2791 qDebug("Setting vcf mode to external "); 2791 qDebug("Setting vcf mode to external ");
2792 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2792 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2793 AddressBook::Iterator it; 2793 AddressBook::Iterator it;
2794 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2794 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2795 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 2795 (*it).setID( mCurrentSyncDevice, (*it).uid() );
2796 (*it).computeCsum( mCurrentSyncDevice ); 2796 (*it).computeCsum( mCurrentSyncDevice );
2797 } 2797 }
2798 } 2798 }
2799 } 2799 }
2800 //AddressBook::Iterator it; 2800 //AddressBook::Iterator it;
2801 //QStringList vcards; 2801 //QStringList vcards;
2802 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2802 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2803 // qDebug("Name %s ", (*it).familyName().latin1()); 2803 // qDebug("Name %s ", (*it).familyName().latin1());
2804 //} 2804 //}
2805 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 2805 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
2806 if ( syncOK ) { 2806 if ( syncOK ) {
2807 if ( syncManager->mWriteBackFile ) 2807 if ( syncManager->mWriteBackFile )
2808 { 2808 {
2809 if ( external ) 2809 if ( external )
2810 abLocal.removeSyncAddressees( !isXML); 2810 abLocal.removeSyncAddressees( !isXML);
2811 qDebug("Saving remote AB "); 2811 qDebug("Saving remote AB ");
2812 if ( ! abLocal.saveAB()) 2812 if ( ! abLocal.saveAB())
2813 qDebug("Error writing back AB to file "); 2813 qDebug("Error writing back AB to file ");
2814 if ( isXML ) { 2814 if ( isXML ) {
2815 // afterwrite processing 2815 // afterwrite processing
2816 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2816 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2817 } 2817 }
2818 } 2818 }
2819 } 2819 }
2820 setModified(); 2820 setModified();
2821 2821
2822 } 2822 }
2823 if ( syncOK ) 2823 if ( syncOK )
2824 mViewManager->refreshView(); 2824 mViewManager->refreshView();
2825 return syncOK; 2825 return syncOK;
2826#if 0
2827 2826
2828 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
2829 getEventViewerDialog()->setSyncMode( true );
2830 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
2831 getEventViewerDialog()->setSyncMode( false );
2832 if ( syncOK ) {
2833 if ( KOPrefs::instance()->mWriteBackFile )
2834 {
2835 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
2836 storage->save();
2837 }
2838 }
2839 setModified();
2840 }
2841
2842#endif
2843} 2827}
2844 2828
2845 2829
2846//this is a overwritten callbackmethods from the syncinterface 2830//this is a overwritten callbackmethods from the syncinterface
2847bool KABCore::syncExternal(KSyncManager* manager, QString resource) 2831bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2848{ 2832{
2833 if ( resource == "phone" )
2834 return syncPhone();
2849 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2835 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2850 2836
2851 AddressBook abLocal( resource,"syncContact"); 2837 AddressBook abLocal( resource,"syncContact");
2852 bool syncOK = false; 2838 bool syncOK = false;
2853 if ( abLocal.load() ) { 2839 if ( abLocal.load() ) {
2854 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2840 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
2855 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2841 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2856 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); 2842 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2857 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2843 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2858 if ( syncOK ) { 2844 if ( syncOK ) {
2859 if ( syncManager->mWriteBackFile ) { 2845 if ( syncManager->mWriteBackFile ) {
2860 abLocal.saveAB(); 2846 abLocal.saveAB();
2861 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2847 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2862 } 2848 }
2863 } 2849 }
2864 setModified(); 2850 setModified();
2865 } 2851 }
2866 if ( syncOK ) 2852 if ( syncOK )
2867 mViewManager->refreshView(); 2853 mViewManager->refreshView();
2868 return syncOK; 2854 return syncOK;
2869 2855
2870} 2856}
2871 2857void KABCore::message( QString m )
2872void KABCore::getFile( bool success )
2873{ 2858{
2859
2860 topLevelWidget()->setCaption( m );
2874 QTimer::singleShot( 15000, this , SLOT ( setCaptionBack())); 2861 QTimer::singleShot( 15000, this , SLOT ( setCaptionBack()));
2862}
2863bool KABCore::syncPhone()
2864{
2865 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2866 QString fileName;
2867#ifdef _WIN32_
2868 fileName = locateLocal("tmp", "phonefile.vcf");
2869#else
2870 fileName = "/tmp/phonefile.vcf";
2871#endif
2872 if ( !PhoneAccess::readFromPhone( fileName) ) {
2873 message(i18n("Phone access failed!"));
2874 return false;
2875 }
2876 AddressBook abLocal( fileName,"syncContact");
2877 bool syncOK = false;
2878 if ( abLocal.load() ) {
2879 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
2880 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2881 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
2882 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2883 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2884 if ( syncOK ) {
2885 if ( syncManager->mWriteBackFile ) {
2886 abLocal.saveABphone( fileName );
2887 abLocal.preparePhoneSync( mCurrentSyncDevice, false );
2888 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2889 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2890 }
2891 }
2892 setModified();
2893 }
2894 if ( syncOK )
2895 mViewManager->refreshView();
2896 return syncOK;
2897}
2898void KABCore::getFile( bool success )
2899{
2875 if ( ! success ) { 2900 if ( ! success ) {
2876 setCaption( i18n("Error receiving file. Nothing changed!") ); 2901 message( i18n("Error receiving file. Nothing changed!") );
2877 return; 2902 return;
2878 } 2903 }
2879 mAddressBook->importFromFile( sentSyncFile() , false, true ); 2904 mAddressBook->importFromFile( sentSyncFile() , false, true );
2880 topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); 2905 message( i18n("Pi-Sync successful!") );
2881 mViewManager->refreshView(); 2906 mViewManager->refreshView();
2882} 2907}
2883void KABCore::syncFileRequest() 2908void KABCore::syncFileRequest()
2884{ 2909{
2885 mAddressBook->export2File( sentSyncFile() ); 2910 mAddressBook->export2File( sentSyncFile() );
2886} 2911}
2887QString KABCore::sentSyncFile() 2912QString KABCore::sentSyncFile()
2888{ 2913{
2889#ifdef _WIN32_ 2914#ifdef _WIN32_
2890 return locateLocal( "tmp", "copysyncab.vcf" ); 2915 return locateLocal( "tmp", "copysyncab.vcf" );
2891#else 2916#else
2892 return QString( "/tmp/copysyncab.vcf" ); 2917 return QString( "/tmp/copysyncab.vcf" );
2893#endif 2918#endif
2894} 2919}
2895 2920
2896void KABCore::setCaptionBack() 2921void KABCore::setCaptionBack()
2897{ 2922{
2898 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 2923 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
2899} 2924}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 43c5f99..04ce33d 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,483 +1,484 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32 32
33#include <qwidget.h> 33#include <qwidget.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <ksyncmanager.h> 35#include <ksyncmanager.h>
36 36
37namespace KABC { 37namespace KABC {
38class AddressBook; 38class AddressBook;
39} 39}
40 40
41#ifndef KAB_EMBEDDED 41#ifndef KAB_EMBEDDED
42class KAboutData; 42class KAboutData;
43class KConfig; 43class KConfig;
44 44
45class KAddressBookService; 45class KAddressBookService;
46class LDAPSearchDialog; 46class LDAPSearchDialog;
47#else //KAB_EMBEDDED 47#else //KAB_EMBEDDED
48class KAddressBookMain; 48class KAddressBookMain;
49//US class QAction; 49//US class QAction;
50#endif //KAB_EMBEDDED 50#endif //KAB_EMBEDDED
51class KCMultiDialog; 51class KCMultiDialog;
52class KXMLGUIClient; 52class KXMLGUIClient;
53class ExtensionManager; 53class ExtensionManager;
54class XXPortManager; 54class XXPortManager;
55class JumpButtonBar; 55class JumpButtonBar;
56class IncSearchWidget; 56class IncSearchWidget;
57class KDGanttMinimizeSplitter; 57class KDGanttMinimizeSplitter;
58class KAction; 58class KAction;
59class KActionCollection; 59class KActionCollection;
60class KToggleAction; 60class KToggleAction;
61class KSyncProfile; 61class KSyncProfile;
62 62
63class QAction; 63class QAction;
64class QMenuBar; 64class QMenuBar;
65class QSplitter; 65class QSplitter;
66class ViewContainer; 66class ViewContainer;
67class ViewManager; 67class ViewManager;
68class AddresseeEditorDialog; 68class AddresseeEditorDialog;
69class Ir; 69class Ir;
70 70
71class KABCore : public QWidget, public KSyncInterface 71class KABCore : public QWidget, public KSyncInterface
72{ 72{
73 Q_OBJECT 73 Q_OBJECT
74 74
75 public: 75 public:
76 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 76 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
77 77
78 78
79 ~KABCore(); 79 ~KABCore();
80 80
81 81
82#ifdef KAB_EMBEDDED 82#ifdef KAB_EMBEDDED
83 //US added functionality 83 //US added functionality
84 QPopupMenu* getViewMenu() {return viewMenu;} 84 QPopupMenu* getViewMenu() {return viewMenu;}
85 QPopupMenu* getFilterMenu() {return filterMenu;} 85 QPopupMenu* getFilterMenu() {return filterMenu;}
86 QPopupMenu* getSettingsMenu() {return settingsMenu;} 86 QPopupMenu* getSettingsMenu() {return settingsMenu;}
87 void addActionsManually(); 87 void addActionsManually();
88#endif //KAB_EMBEDDED 88#endif //KAB_EMBEDDED
89 /** 89 /**
90 Restores the global settings. 90 Restores the global settings.
91 */ 91 */
92 void restoreSettings(); 92 void restoreSettings();
93 93
94 /** 94 /**
95 Saves the global settings. 95 Saves the global settings.
96 */ 96 */
97 void saveSettings(); 97 void saveSettings();
98 98
99 /** 99 /**
100 Returns a pointer to the StdAddressBook of the application. 100 Returns a pointer to the StdAddressBook of the application.
101 */ 101 */
102 KABC::AddressBook *addressBook() const; 102 KABC::AddressBook *addressBook() const;
103 103
104 /** 104 /**
105 Returns a pointer to the KConfig object of the application. 105 Returns a pointer to the KConfig object of the application.
106 */ 106 */
107 static KConfig *config(); 107 static KConfig *config();
108 108
109 /** 109 /**
110 Returns a pointer to the global KActionCollection object. So 110 Returns a pointer to the global KActionCollection object. So
111 other classes can register their actions easily. 111 other classes can register their actions easily.
112 */ 112 */
113 KActionCollection *actionCollection() const; 113 KActionCollection *actionCollection() const;
114 114
115 /** 115 /**
116 Returns the current search field of the Incremental Search Widget. 116 Returns the current search field of the Incremental Search Widget.
117 */ 117 */
118 KABC::Field *currentSearchField() const; 118 KABC::Field *currentSearchField() const;
119 119
120 /** 120 /**
121 Returns the uid list of the currently selected contacts. 121 Returns the uid list of the currently selected contacts.
122 */ 122 */
123 QStringList selectedUIDs() const; 123 QStringList selectedUIDs() const;
124 124
125 /** 125 /**
126 Displays the ResourceSelectDialog and returns the selected 126 Displays the ResourceSelectDialog and returns the selected
127 resource or a null pointer if no resource was selected by 127 resource or a null pointer if no resource was selected by
128 the user. 128 the user.
129 */ 129 */
130 KABC::Resource *requestResource( QWidget *parent ); 130 KABC::Resource *requestResource( QWidget *parent );
131 131
132#ifndef KAB_EMBEDDED 132#ifndef KAB_EMBEDDED
133 static KAboutData *createAboutData(); 133 static KAboutData *createAboutData();
134#endif //KAB_EMBEDDED 134#endif //KAB_EMBEDDED
135 135
136#ifdef KAB_EMBEDDED 136#ifdef KAB_EMBEDDED
137 inline QPopupMenu* getImportMenu() { return ImportMenu;} 137 inline QPopupMenu* getImportMenu() { return ImportMenu;}
138 inline QPopupMenu* getExportMenu() { return ExportMenu;} 138 inline QPopupMenu* getExportMenu() { return ExportMenu;}
139#endif //KAB_EMBEDDED 139#endif //KAB_EMBEDDED
140 140
141 public slots: 141 public slots:
142#ifdef KAB_EMBEDDED 142#ifdef KAB_EMBEDDED
143 void createAboutData(); 143 void createAboutData();
144#endif //KAB_EMBEDDED 144#endif //KAB_EMBEDDED
145 145
146 void statusMessage(QString, int time = 0 ); 146 void statusMessage(QString, int time = 0 );
147 void showLicence(); 147 void showLicence();
148 void faq(); 148 void faq();
149 149
150 /** 150 /**
151 Is called whenever a contact is selected in the view. 151 Is called whenever a contact is selected in the view.
152 */ 152 */
153 void setContactSelected( const QString &uid ); 153 void setContactSelected( const QString &uid );
154 154
155 /** 155 /**
156 Opens the preferred mail composer with all selected contacts as 156 Opens the preferred mail composer with all selected contacts as
157 arguments. 157 arguments.
158 */ 158 */
159 void sendMail(); 159 void sendMail();
160 160
161 /** 161 /**
162 Opens the preferred mail composer with the given contacts as 162 Opens the preferred mail composer with the given contacts as
163 arguments. 163 arguments.
164 */ 164 */
165 void sendMail( const QString& email ); 165 void sendMail( const QString& email );
166 166
167 167
168 void mailVCard(); 168 void mailVCard();
169 void mailVCard(const QStringList& uids); 169 void mailVCard(const QStringList& uids);
170 170
171 /** 171 /**
172 Beams the "WhoAmI contact. 172 Beams the "WhoAmI contact.
173 */ 173 */
174 void beamMySelf(); 174 void beamMySelf();
175 175
176 void beamVCard(); 176 void beamVCard();
177 void export2phone(); 177 void export2phone();
178 void beamVCard(const QStringList& uids); 178 void beamVCard(const QStringList& uids);
179 void beamDone( Ir *ir ); 179 void beamDone( Ir *ir );
180 180
181 181
182 /** 182 /**
183 Starts the preferred web browser with the given URL as argument. 183 Starts the preferred web browser with the given URL as argument.
184 */ 184 */
185 void browse( const QString& url ); 185 void browse( const QString& url );
186 186
187 /** 187 /**
188 Select all contacts in the view. 188 Select all contacts in the view.
189 */ 189 */
190 void selectAllContacts(); 190 void selectAllContacts();
191 191
192 /** 192 /**
193 Deletes all selected contacts from the address book. 193 Deletes all selected contacts from the address book.
194 */ 194 */
195 void deleteContacts(); 195 void deleteContacts();
196 196
197 /** 197 /**
198 Deletes given contacts from the address book. 198 Deletes given contacts from the address book.
199 199
200 @param uids The uids of the contacts, which shall be deleted. 200 @param uids The uids of the contacts, which shall be deleted.
201 */ 201 */
202 void deleteContacts( const QStringList &uids ); 202 void deleteContacts( const QStringList &uids );
203 203
204 /** 204 /**
205 Copys the selected contacts into clipboard for later pasting. 205 Copys the selected contacts into clipboard for later pasting.
206 */ 206 */
207 void copyContacts(); 207 void copyContacts();
208 208
209 /** 209 /**
210 Cuts the selected contacts and stores them for later pasting. 210 Cuts the selected contacts and stores them for later pasting.
211 */ 211 */
212 void cutContacts(); 212 void cutContacts();
213 213
214 /** 214 /**
215 Paste contacts from clipboard into the address book. 215 Paste contacts from clipboard into the address book.
216 */ 216 */
217 void pasteContacts(); 217 void pasteContacts();
218 218
219 /** 219 /**
220 Paste given contacts into the address book. 220 Paste given contacts into the address book.
221 221
222 @param list The list of addressee, which shall be pasted. 222 @param list The list of addressee, which shall be pasted.
223 */ 223 */
224 void pasteContacts( KABC::Addressee::List &list ); 224 void pasteContacts( KABC::Addressee::List &list );
225 225
226 /** 226 /**
227 Sets the whoAmI contact, that is used by many other programs to 227 Sets the whoAmI contact, that is used by many other programs to
228 get personal information about the current user. 228 get personal information about the current user.
229 */ 229 */
230 void setWhoAmI(); 230 void setWhoAmI();
231 231
232 /** 232 /**
233 Displays the category dialog and applies the result to all 233 Displays the category dialog and applies the result to all
234 selected contacts. 234 selected contacts.
235 */ 235 */
236 void setCategories(); 236 void setCategories();
237 237
238 /** 238 /**
239 Sets the field list of the Incremental Search Widget. 239 Sets the field list of the Incremental Search Widget.
240 */ 240 */
241 void setSearchFields( const KABC::Field::List &fields ); 241 void setSearchFields( const KABC::Field::List &fields );
242 242
243 /** 243 /**
244 Search with the current search field for a contact, that matches 244 Search with the current search field for a contact, that matches
245 the given text, and selects it in the view. 245 the given text, and selects it in the view.
246 */ 246 */
247 void incrementalSearch( const QString& text ); 247 void incrementalSearch( const QString& text );
248 248
249 /** 249 /**
250 Marks the address book as modified. 250 Marks the address book as modified.
251 */ 251 */
252 void setModified(); 252 void setModified();
253 /** 253 /**
254 Marks the address book as modified without refreshing the view. 254 Marks the address book as modified without refreshing the view.
255 */ 255 */
256 void setModifiedWOrefresh(); 256 void setModifiedWOrefresh();
257 257
258 /** 258 /**
259 Marks the address book as modified concerning the argument. 259 Marks the address book as modified concerning the argument.
260 */ 260 */
261 void setModified( bool modified ); 261 void setModified( bool modified );
262 262
263 /** 263 /**
264 Returns whether the address book is modified. 264 Returns whether the address book is modified.
265 */ 265 */
266 bool modified() const; 266 bool modified() const;
267 267
268 /** 268 /**
269 Called whenever an contact is modified in the contact editor 269 Called whenever an contact is modified in the contact editor
270 dialog or the quick edit. 270 dialog or the quick edit.
271 */ 271 */
272 void contactModified( const KABC::Addressee &addr ); 272 void contactModified( const KABC::Addressee &addr );
273 273
274 /** 274 /**
275 DCOP METHODS. 275 DCOP METHODS.
276 */ 276 */
277 void addEmail( QString addr ); 277 void addEmail( QString addr );
278 void importVCard( const KURL& url, bool showPreview ); 278 void importVCard( const KURL& url, bool showPreview );
279 void importVCard( const QString& vCard, bool showPreview ); 279 void importVCard( const QString& vCard, bool showPreview );
280 void newContact(); 280 void newContact();
281 QString getNameByPhone( const QString& phone ); 281 QString getNameByPhone( const QString& phone );
282 /** 282 /**
283 END DCOP METHODS 283 END DCOP METHODS
284 */ 284 */
285 285
286 /** 286 /**
287 Saves the contents of the AddressBook back to disk. 287 Saves the contents of the AddressBook back to disk.
288 */ 288 */
289 void save(); 289 void save();
290 290
291 /** 291 /**
292 Undos the last command using the undo stack. 292 Undos the last command using the undo stack.
293 */ 293 */
294 void undo(); 294 void undo();
295 295
296 /** 296 /**
297 Redos the last command that was undone, using the redo stack. 297 Redos the last command that was undone, using the redo stack.
298 */ 298 */
299 void redo(); 299 void redo();
300 300
301 /** 301 /**
302 Shows the edit dialog for the given uid. If the uid is QString::null, 302 Shows the edit dialog for the given uid. If the uid is QString::null,
303 the method will try to find a selected addressee in the view. 303 the method will try to find a selected addressee in the view.
304 */ 304 */
305 void editContact( const QString &uid /*US = QString::null*/ ); 305 void editContact( const QString &uid /*US = QString::null*/ );
306//US added a second method without defaultparameter 306//US added a second method without defaultparameter
307 void editContact2(); 307 void editContact2();
308 308
309 /** 309 /**
310 Shows or edits the detail view for the given uid. If the uid is QString::null, 310 Shows or edits the detail view for the given uid. If the uid is QString::null,
311 the method will try to find a selected addressee in the view. 311 the method will try to find a selected addressee in the view.
312 */ 312 */
313 void executeContact( const QString &uid /*US = QString::null*/ ); 313 void executeContact( const QString &uid /*US = QString::null*/ );
314 314
315 /** 315 /**
316 Launches the configuration dialog. 316 Launches the configuration dialog.
317 */ 317 */
318 void openConfigDialog(); 318 void openConfigDialog();
319 319
320 /** 320 /**
321 Launches the ldap search dialog. 321 Launches the ldap search dialog.
322 */ 322 */
323 void openLDAPDialog(); 323 void openLDAPDialog();
324 324
325 /** 325 /**
326 Creates a KAddressBookPrinter, which will display the print 326 Creates a KAddressBookPrinter, which will display the print
327 dialog and do the printing. 327 dialog and do the printing.
328 */ 328 */
329 void print(); 329 void print();
330 330
331 /** 331 /**
332 Registers a new GUI client, so plugins can register its actions. 332 Registers a new GUI client, so plugins can register its actions.
333 */ 333 */
334 void addGUIClient( KXMLGUIClient *client ); 334 void addGUIClient( KXMLGUIClient *client );
335 335
336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
339 339
340 340
341 signals: 341 signals:
342 void contactSelected( const QString &name ); 342 void contactSelected( const QString &name );
343 void contactSelected( const QPixmap &pixmap ); 343 void contactSelected( const QPixmap &pixmap );
344 public slots: 344 public slots:
345 void recieve(QString cmsg ); 345 void recieve(QString cmsg );
346 void getFile( bool success ); 346 void getFile( bool success );
347 void syncFileRequest(); 347 void syncFileRequest();
348 void setDetailsVisible( bool visible ); 348 void setDetailsVisible( bool visible );
349 void setDetailsToState(); 349 void setDetailsToState();
350 // void slotSyncMenu( int ); 350 // void slotSyncMenu( int );
351 private slots: 351 private slots:
352 void setJumpButtonBarVisible( bool visible ); 352 void setJumpButtonBarVisible( bool visible );
353 void setCaptionBack(); 353 void setCaptionBack();
354 void importFromOL(); 354 void importFromOL();
355 void extensionModified( const KABC::Addressee::List &list ); 355 void extensionModified( const KABC::Addressee::List &list );
356 void extensionChanged( int id ); 356 void extensionChanged( int id );
357 void clipboardDataChanged(); 357 void clipboardDataChanged();
358 void updateActionMenu(); 358 void updateActionMenu();
359 void configureKeyBindings(); 359 void configureKeyBindings();
360 void removeVoice(); 360 void removeVoice();
361#ifdef KAB_EMBEDDED 361#ifdef KAB_EMBEDDED
362 void configureResources(); 362 void configureResources();
363#endif //KAB_EMBEDDED 363#endif //KAB_EMBEDDED
364 364
365 void slotEditorDestroyed( const QString &uid ); 365 void slotEditorDestroyed( const QString &uid );
366 void configurationChanged(); 366 void configurationChanged();
367 void addressBookChanged(); 367 void addressBookChanged();
368 368
369 private: 369 private:
370 void initGUI(); 370 void initGUI();
371 void initActions(); 371 void initActions();
372 372
373 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 373 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
374 const char *name = 0 ); 374 const char *name = 0 );
375 375
376 KXMLGUIClient *mGUIClient; 376 KXMLGUIClient *mGUIClient;
377 377
378 KABC::AddressBook *mAddressBook; 378 KABC::AddressBook *mAddressBook;
379 379
380 ViewManager *mViewManager; 380 ViewManager *mViewManager;
381 // QSplitter *mDetailsSplitter; 381 // QSplitter *mDetailsSplitter;
382 KDGanttMinimizeSplitter *mExtensionBarSplitter; 382 KDGanttMinimizeSplitter *mExtensionBarSplitter;
383 ViewContainer *mDetails; 383 ViewContainer *mDetails;
384 KDGanttMinimizeSplitter* mMiniSplitter; 384 KDGanttMinimizeSplitter* mMiniSplitter;
385 XXPortManager *mXXPortManager; 385 XXPortManager *mXXPortManager;
386 JumpButtonBar *mJumpButtonBar; 386 JumpButtonBar *mJumpButtonBar;
387 IncSearchWidget *mIncSearchWidget; 387 IncSearchWidget *mIncSearchWidget;
388 ExtensionManager *mExtensionManager; 388 ExtensionManager *mExtensionManager;
389 389
390 KCMultiDialog *mConfigureDialog; 390 KCMultiDialog *mConfigureDialog;
391 391
392#ifndef KAB_EMBEDDED 392#ifndef KAB_EMBEDDED
393 LDAPSearchDialog *mLdapSearchDialog; 393 LDAPSearchDialog *mLdapSearchDialog;
394#endif //KAB_EMBEDDED 394#endif //KAB_EMBEDDED
395 // QDict<AddresseeEditorDialog> mEditorDict; 395 // QDict<AddresseeEditorDialog> mEditorDict;
396 AddresseeEditorDialog *mEditorDialog; 396 AddresseeEditorDialog *mEditorDialog;
397 bool mReadWrite; 397 bool mReadWrite;
398 bool mModified; 398 bool mModified;
399 bool mIsPart; 399 bool mIsPart;
400 bool mMultipleViewsAtOnce; 400 bool mMultipleViewsAtOnce;
401 401
402 402
403 //US file menu 403 //US file menu
404 KAction *mActionMail; 404 KAction *mActionMail;
405 KAction *mActionBeam; 405 KAction *mActionBeam;
406 KAction *mActionExport2phone; 406 KAction *mActionExport2phone;
407 KAction* mActionPrint; 407 KAction* mActionPrint;
408 KAction* mActionNewContact; 408 KAction* mActionNewContact;
409 KAction *mActionSave; 409 KAction *mActionSave;
410 KAction *mActionEditAddressee; 410 KAction *mActionEditAddressee;
411 KAction *mActionMailVCard; 411 KAction *mActionMailVCard;
412 KAction *mActionBeamVCard; 412 KAction *mActionBeamVCard;
413 413
414 KAction *mActionQuit; 414 KAction *mActionQuit;
415 415
416 //US edit menu 416 //US edit menu
417 KAction *mActionCopy; 417 KAction *mActionCopy;
418 KAction *mActionCut; 418 KAction *mActionCut;
419 KAction *mActionPaste; 419 KAction *mActionPaste;
420 KAction *mActionSelectAll; 420 KAction *mActionSelectAll;
421 KAction *mActionUndo; 421 KAction *mActionUndo;
422 KAction *mActionRedo; 422 KAction *mActionRedo;
423 KAction *mActionDelete; 423 KAction *mActionDelete;
424 424
425 //US settings menu 425 //US settings menu
426 KAction *mActionConfigResources; 426 KAction *mActionConfigResources;
427 KAction *mActionConfigKAddressbook; 427 KAction *mActionConfigKAddressbook;
428 KAction *mActionConfigShortcuts; 428 KAction *mActionConfigShortcuts;
429 KAction *mActionConfigureToolbars; 429 KAction *mActionConfigureToolbars;
430 KAction *mActionKeyBindings; 430 KAction *mActionKeyBindings;
431 KToggleAction *mActionJumpBar; 431 KToggleAction *mActionJumpBar;
432 KToggleAction *mActionDetails; 432 KToggleAction *mActionDetails;
433 KAction *mActionWhoAmI; 433 KAction *mActionWhoAmI;
434 KAction *mActionCategories; 434 KAction *mActionCategories;
435 KAction *mActionAboutKAddressbook; 435 KAction *mActionAboutKAddressbook;
436 KAction *mActionLicence; 436 KAction *mActionLicence;
437 KAction *mActionFaq; 437 KAction *mActionFaq;
438 438
439 KAction *mActionDeleteView; 439 KAction *mActionDeleteView;
440 440
441 QPopupMenu *viewMenu; 441 QPopupMenu *viewMenu;
442 QPopupMenu *filterMenu; 442 QPopupMenu *filterMenu;
443 QPopupMenu *settingsMenu; 443 QPopupMenu *settingsMenu;
444 QPopupMenu *changeMenu; 444 QPopupMenu *changeMenu;
445//US QAction *mActionSave; 445//US QAction *mActionSave;
446 QPopupMenu *ImportMenu; 446 QPopupMenu *ImportMenu;
447 QPopupMenu *ExportMenu; 447 QPopupMenu *ExportMenu;
448 //LR additional methods 448 //LR additional methods
449 KAction *mActionRemoveVoice; 449 KAction *mActionRemoveVoice;
450 KAction * mActionImportOL; 450 KAction * mActionImportOL;
451 451
452#ifndef KAB_EMBEDDED 452#ifndef KAB_EMBEDDED
453 KAddressBookService *mAddressBookService; 453 KAddressBookService *mAddressBookService;
454#endif //KAB_EMBEDDED 454#endif //KAB_EMBEDDED
455 455
456 class KABCorePrivate; 456 class KABCorePrivate;
457 KABCorePrivate *d; 457 KABCorePrivate *d;
458 //US bool mBlockSaveFlag; 458 //US bool mBlockSaveFlag;
459 459
460#ifdef KAB_EMBEDDED 460#ifdef KAB_EMBEDDED
461 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 461 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
462#endif //KAB_EMBEDDED 462#endif //KAB_EMBEDDED
463 463
464 //this are the overwritten callbackmethods from the syncinterface 464 //this are the overwritten callbackmethods from the syncinterface
465 virtual bool sync(KSyncManager* manager, QString filename, int mode); 465 virtual bool sync(KSyncManager* manager, QString filename, int mode);
466 virtual bool syncExternal(KSyncManager* manager, QString resource); 466 virtual bool syncExternal(KSyncManager* manager, QString resource);
467 467 bool syncPhone();
468 void message( QString m );
468 469
469 // LR ******************************* 470 // LR *******************************
470 // sync stuff! 471 // sync stuff!
471 QString sentSyncFile(); 472 QString sentSyncFile();
472 QPopupMenu *syncMenu; 473 QPopupMenu *syncMenu;
473 KSyncManager* syncManager; 474 KSyncManager* syncManager;
474 int mGlobalSyncMode; 475 int mGlobalSyncMode;
475 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 476 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
476 KABC::Addressee getLastSyncAddressee(); 477 KABC::Addressee getLastSyncAddressee();
477 QDateTime mLastAddressbookSync; 478 QDateTime mLastAddressbookSync;
478 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 479 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
479 // ********************* 480 // *********************
480 481
481}; 482};
482 483
483#endif 484#endif