author | ulf69 <ulf69> | 2004-10-07 01:10:30 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-07 01:10:30 (UTC) |
commit | f434ef382b60c1a420dd0e037d119d082e478491 (patch) (unidiff) | |
tree | c68247486b6f714d0d8e01d8b503a4d36c9325e3 | |
parent | 3338b7239dc2e5cdff95ebc76b6905e6385a5833 (diff) | |
download | kdepimpi-f434ef382b60c1a420dd0e037d119d082e478491.zip kdepimpi-f434ef382b60c1a420dd0e037d119d082e478491.tar.gz kdepimpi-f434ef382b60c1a420dd0e037d119d082e478491.tar.bz2 |
added methods to collect birthday data via QCop (from kopi)
-rw-r--r-- | kaddressbook/kabcore.cpp | 69 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 |
2 files changed, 70 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 9041e45..d9eb391 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -232,128 +232,129 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
232 | 232 | ||
233 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 233 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
234 | SLOT( addressBookChanged() ) ); | 234 | SLOT( addressBookChanged() ) ); |
235 | 235 | ||
236 | #if 0 | 236 | #if 0 |
237 | // LP moved to addressbook init method | 237 | // LP moved to addressbook init method |
238 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 238 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
239 | "X-Department", "KADDRESSBOOK" ); | 239 | "X-Department", "KADDRESSBOOK" ); |
240 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 240 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
241 | "X-Profession", "KADDRESSBOOK" ); | 241 | "X-Profession", "KADDRESSBOOK" ); |
242 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 242 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
243 | "X-AssistantsName", "KADDRESSBOOK" ); | 243 | "X-AssistantsName", "KADDRESSBOOK" ); |
244 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 244 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
245 | "X-ManagersName", "KADDRESSBOOK" ); | 245 | "X-ManagersName", "KADDRESSBOOK" ); |
246 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 246 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
247 | "X-SpousesName", "KADDRESSBOOK" ); | 247 | "X-SpousesName", "KADDRESSBOOK" ); |
248 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 248 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
249 | "X-Office", "KADDRESSBOOK" ); | 249 | "X-Office", "KADDRESSBOOK" ); |
250 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 250 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
251 | "X-IMAddress", "KADDRESSBOOK" ); | 251 | "X-IMAddress", "KADDRESSBOOK" ); |
252 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 252 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
253 | "X-Anniversary", "KADDRESSBOOK" ); | 253 | "X-Anniversary", "KADDRESSBOOK" ); |
254 | 254 | ||
255 | //US added this field to become compatible with Opie/qtopia addressbook | 255 | //US added this field to become compatible with Opie/qtopia addressbook |
256 | // values can be "female" or "male" or "". An empty field represents undefined. | 256 | // values can be "female" or "male" or "". An empty field represents undefined. |
257 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 257 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
258 | "X-Gender", "KADDRESSBOOK" ); | 258 | "X-Gender", "KADDRESSBOOK" ); |
259 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 259 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
260 | "X-Children", "KADDRESSBOOK" ); | 260 | "X-Children", "KADDRESSBOOK" ); |
261 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 261 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
262 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 262 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
263 | #endif | 263 | #endif |
264 | initGUI(); | 264 | initGUI(); |
265 | 265 | ||
266 | mIncSearchWidget->setFocus(); | 266 | mIncSearchWidget->setFocus(); |
267 | 267 | ||
268 | 268 | ||
269 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 269 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
270 | SLOT( setContactSelected( const QString& ) ) ); | 270 | SLOT( setContactSelected( const QString& ) ) ); |
271 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 271 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
272 | SLOT( executeContact( const QString& ) ) ); | 272 | SLOT( executeContact( const QString& ) ) ); |
273 | 273 | ||
274 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 274 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
275 | SLOT( deleteContacts( ) ) ); | 275 | SLOT( deleteContacts( ) ) ); |
276 | connect( mViewManager, SIGNAL( modified() ), | 276 | connect( mViewManager, SIGNAL( modified() ), |
277 | SLOT( setModified() ) ); | 277 | SLOT( setModified() ) ); |
278 | 278 | ||
279 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 279 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
280 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 280 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
281 | 281 | ||
282 | connect( mXXPortManager, SIGNAL( modified() ), | 282 | connect( mXXPortManager, SIGNAL( modified() ), |
283 | SLOT( setModified() ) ); | 283 | SLOT( setModified() ) ); |
284 | 284 | ||
285 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 285 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
286 | SLOT( incrementalSearch( const QString& ) ) ); | 286 | SLOT( incrementalSearch( const QString& ) ) ); |
287 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 287 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
288 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 288 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
289 | 289 | ||
290 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 290 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
291 | SLOT( sendMail( const QString& ) ) ); | 291 | SLOT( sendMail( const QString& ) ) ); |
292 | 292 | ||
293 | 293 | ||
294 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 294 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
295 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 295 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
296 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | ||
296 | 297 | ||
297 | 298 | ||
298 | #ifndef KAB_EMBEDDED | 299 | #ifndef KAB_EMBEDDED |
299 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 300 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
300 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 301 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
301 | 302 | ||
302 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 303 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
303 | SLOT( browse( const QString& ) ) ); | 304 | SLOT( browse( const QString& ) ) ); |
304 | 305 | ||
305 | 306 | ||
306 | mAddressBookService = new KAddressBookService( this ); | 307 | mAddressBookService = new KAddressBookService( this ); |
307 | 308 | ||
308 | #endif //KAB_EMBEDDED | 309 | #endif //KAB_EMBEDDED |
309 | mEditorDialog = 0; | 310 | mEditorDialog = 0; |
310 | createAddresseeEditorDialog( this ); | 311 | createAddresseeEditorDialog( this ); |
311 | setModified( false ); | 312 | setModified( false ); |
312 | } | 313 | } |
313 | 314 | ||
314 | KABCore::~KABCore() | 315 | KABCore::~KABCore() |
315 | { | 316 | { |
316 | // save(); | 317 | // save(); |
317 | //saveSettings(); | 318 | //saveSettings(); |
318 | //KABPrefs::instance()->writeConfig(); | 319 | //KABPrefs::instance()->writeConfig(); |
319 | delete AddresseeConfig::instance(); | 320 | delete AddresseeConfig::instance(); |
320 | mAddressBook = 0; | 321 | mAddressBook = 0; |
321 | KABC::StdAddressBook::close(); | 322 | KABC::StdAddressBook::close(); |
322 | 323 | ||
323 | delete syncManager; | 324 | delete syncManager; |
324 | } | 325 | } |
325 | 326 | ||
326 | void KABCore::restoreSettings() | 327 | void KABCore::restoreSettings() |
327 | { | 328 | { |
328 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 329 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
329 | 330 | ||
330 | bool state; | 331 | bool state; |
331 | 332 | ||
332 | if (mMultipleViewsAtOnce) | 333 | if (mMultipleViewsAtOnce) |
333 | state = KABPrefs::instance()->mDetailsPageVisible; | 334 | state = KABPrefs::instance()->mDetailsPageVisible; |
334 | else | 335 | else |
335 | state = false; | 336 | state = false; |
336 | 337 | ||
337 | mActionDetails->setChecked( state ); | 338 | mActionDetails->setChecked( state ); |
338 | setDetailsVisible( state ); | 339 | setDetailsVisible( state ); |
339 | 340 | ||
340 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 341 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
341 | 342 | ||
342 | mActionJumpBar->setChecked( state ); | 343 | mActionJumpBar->setChecked( state ); |
343 | setJumpButtonBarVisible( state ); | 344 | setJumpButtonBarVisible( state ); |
344 | /*US | 345 | /*US |
345 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 346 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
346 | if ( splitterSize.count() == 0 ) { | 347 | if ( splitterSize.count() == 0 ) { |
347 | splitterSize.append( width() / 2 ); | 348 | splitterSize.append( width() / 2 ); |
348 | splitterSize.append( width() / 2 ); | 349 | splitterSize.append( width() / 2 ); |
349 | } | 350 | } |
350 | mMiniSplitter->setSizes( splitterSize ); | 351 | mMiniSplitter->setSizes( splitterSize ); |
351 | if ( mExtensionBarSplitter ) { | 352 | if ( mExtensionBarSplitter ) { |
352 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 353 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
353 | if ( splitterSize.count() == 0 ) { | 354 | if ( splitterSize.count() == 0 ) { |
354 | splitterSize.append( width() / 2 ); | 355 | splitterSize.append( width() / 2 ); |
355 | splitterSize.append( width() / 2 ); | 356 | splitterSize.append( width() / 2 ); |
356 | } | 357 | } |
357 | mExtensionBarSplitter->setSizes( splitterSize ); | 358 | mExtensionBarSplitter->setSizes( splitterSize ); |
358 | 359 | ||
359 | } | 360 | } |
@@ -2094,128 +2095,196 @@ void KABCore::clipboardDataChanged() | |||
2094 | 2095 | ||
2095 | void KABCore::updateActionMenu() | 2096 | void KABCore::updateActionMenu() |
2096 | { | 2097 | { |
2097 | UndoStack *undo = UndoStack::instance(); | 2098 | UndoStack *undo = UndoStack::instance(); |
2098 | RedoStack *redo = RedoStack::instance(); | 2099 | RedoStack *redo = RedoStack::instance(); |
2099 | 2100 | ||
2100 | if ( undo->isEmpty() ) | 2101 | if ( undo->isEmpty() ) |
2101 | mActionUndo->setText( i18n( "Undo" ) ); | 2102 | mActionUndo->setText( i18n( "Undo" ) ); |
2102 | else | 2103 | else |
2103 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2104 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2104 | 2105 | ||
2105 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2106 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2106 | 2107 | ||
2107 | if ( !redo->top() ) | 2108 | if ( !redo->top() ) |
2108 | mActionRedo->setText( i18n( "Redo" ) ); | 2109 | mActionRedo->setText( i18n( "Redo" ) ); |
2109 | else | 2110 | else |
2110 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2111 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2111 | 2112 | ||
2112 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2113 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2113 | } | 2114 | } |
2114 | 2115 | ||
2115 | void KABCore::configureKeyBindings() | 2116 | void KABCore::configureKeyBindings() |
2116 | { | 2117 | { |
2117 | #ifndef KAB_EMBEDDED | 2118 | #ifndef KAB_EMBEDDED |
2118 | KKeyDialog::configure( actionCollection(), true ); | 2119 | KKeyDialog::configure( actionCollection(), true ); |
2119 | #else //KAB_EMBEDDED | 2120 | #else //KAB_EMBEDDED |
2120 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2121 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2121 | #endif //KAB_EMBEDDED | 2122 | #endif //KAB_EMBEDDED |
2122 | } | 2123 | } |
2123 | 2124 | ||
2124 | #ifdef KAB_EMBEDDED | 2125 | #ifdef KAB_EMBEDDED |
2125 | void KABCore::configureResources() | 2126 | void KABCore::configureResources() |
2126 | { | 2127 | { |
2127 | KRES::KCMKResources dlg( this, "" , 0 ); | 2128 | KRES::KCMKResources dlg( this, "" , 0 ); |
2128 | 2129 | ||
2129 | if ( !dlg.exec() ) | 2130 | if ( !dlg.exec() ) |
2130 | return; | 2131 | return; |
2131 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2132 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2132 | } | 2133 | } |
2133 | #endif //KAB_EMBEDDED | 2134 | #endif //KAB_EMBEDDED |
2134 | 2135 | ||
2135 | 2136 | ||
2136 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2137 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2137 | * for the attendees list of an event. | 2138 | * for the attendees list of an event. |
2138 | */ | 2139 | */ |
2139 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2140 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2140 | { | 2141 | { |
2141 | QStringList nameList; | 2142 | QStringList nameList; |
2142 | QStringList emailList; | 2143 | QStringList emailList; |
2143 | QStringList uidList; | 2144 | QStringList uidList; |
2144 | 2145 | ||
2145 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2146 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2146 | uint i=0; | 2147 | uint i=0; |
2147 | for (i=0; i < list.count(); i++) | 2148 | for (i=0; i < list.count(); i++) |
2148 | { | 2149 | { |
2149 | nameList.append(list[i].realName()); | 2150 | nameList.append(list[i].realName()); |
2150 | emailList.append(list[i].preferredEmail()); | 2151 | emailList.append(list[i].preferredEmail()); |
2151 | uidList.append(list[i].uid()); | 2152 | uidList.append(list[i].uid()); |
2152 | } | 2153 | } |
2153 | 2154 | ||
2154 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2155 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2155 | 2156 | ||
2156 | } | 2157 | } |
2157 | 2158 | ||
2159 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | ||
2160 | * to put them into the calendar. | ||
2161 | */ | ||
2162 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | ||
2163 | { | ||
2164 | // qDebug("KABCore::requestForBirthdayList"); | ||
2165 | QStringList birthdayList; | ||
2166 | QStringList anniversaryList; | ||
2167 | QStringList realNameList; | ||
2168 | QStringList preferredEmailList; | ||
2169 | QStringList assembledNameList; | ||
2170 | QStringList uidList; | ||
2171 | |||
2172 | KABC::AddressBook::Iterator it; | ||
2173 | |||
2174 | int count = 0; | ||
2175 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | ||
2176 | ++count; | ||
2177 | } | ||
2178 | QProgressBar bar(count,0 ); | ||
2179 | int w = 300; | ||
2180 | if ( QApplication::desktop()->width() < 320 ) | ||
2181 | w = 220; | ||
2182 | int h = bar.sizeHint().height() ; | ||
2183 | int dw = QApplication::desktop()->width(); | ||
2184 | int dh = QApplication::desktop()->height(); | ||
2185 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
2186 | bar.show(); | ||
2187 | bar.setCaption (i18n("collecting birthdays - close to abort!") ); | ||
2188 | qApp->processEvents(); | ||
2189 | |||
2190 | QDate bday; | ||
2191 | QString anni; | ||
2192 | QString formattedbday; | ||
2193 | |||
2194 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | ||
2195 | { | ||
2196 | if ( ! bar.isVisible() ) | ||
2197 | return; | ||
2198 | bar.setProgress( count++ ); | ||
2199 | qApp->processEvents(); | ||
2200 | bday = (*it).birthday().date(); | ||
2201 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | ||
2202 | |||
2203 | if ( bday.isValid() || !anni.isEmpty()) | ||
2204 | { | ||
2205 | if (bday.isValid()) | ||
2206 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | ||
2207 | else | ||
2208 | formattedbday = "NOTVALID"; | ||
2209 | if (anni.isEmpty()) | ||
2210 | anni = "INVALID"; | ||
2211 | |||
2212 | birthdayList.append(formattedbday); | ||
2213 | anniversaryList.append(anni); //should be ISODate | ||
2214 | realNameList.append((*it).realName()); | ||
2215 | preferredEmailList.append((*it).preferredEmail()); | ||
2216 | assembledNameList.append((*it).assembledName()); | ||
2217 | uidList.append((*it).uid()); | ||
2218 | |||
2219 | 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() ); | ||
2220 | } | ||
2221 | } | ||
2222 | |||
2223 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | ||
2224 | |||
2225 | } | ||
2226 | |||
2158 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2227 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2159 | */ | 2228 | */ |
2160 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2229 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2161 | { | 2230 | { |
2162 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2231 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2163 | 2232 | ||
2164 | QString foundUid = QString::null; | 2233 | QString foundUid = QString::null; |
2165 | if ( ! uid.isEmpty() ) { | 2234 | if ( ! uid.isEmpty() ) { |
2166 | Addressee adrr = mAddressBook->findByUid( uid ); | 2235 | Addressee adrr = mAddressBook->findByUid( uid ); |
2167 | if ( !adrr.isEmpty() ) { | 2236 | if ( !adrr.isEmpty() ) { |
2168 | foundUid = uid; | 2237 | foundUid = uid; |
2169 | } | 2238 | } |
2170 | if ( email == "sendbacklist" ) { | 2239 | if ( email == "sendbacklist" ) { |
2171 | //qDebug("ssssssssssssssssssssssend "); | 2240 | //qDebug("ssssssssssssssssssssssend "); |
2172 | QStringList nameList; | 2241 | QStringList nameList; |
2173 | QStringList emailList; | 2242 | QStringList emailList; |
2174 | QStringList uidList; | 2243 | QStringList uidList; |
2175 | nameList.append(adrr.realName()); | 2244 | nameList.append(adrr.realName()); |
2176 | emailList = adrr.emails(); | 2245 | emailList = adrr.emails(); |
2177 | uidList.append( adrr.preferredEmail()); | 2246 | uidList.append( adrr.preferredEmail()); |
2178 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2247 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2179 | return; | 2248 | return; |
2180 | } | 2249 | } |
2181 | 2250 | ||
2182 | } | 2251 | } |
2183 | 2252 | ||
2184 | if ( email == "sendbacklist" ) | 2253 | if ( email == "sendbacklist" ) |
2185 | return; | 2254 | return; |
2186 | if (foundUid.isEmpty()) | 2255 | if (foundUid.isEmpty()) |
2187 | { | 2256 | { |
2188 | //find the uid of the person first | 2257 | //find the uid of the person first |
2189 | Addressee::List namelist; | 2258 | Addressee::List namelist; |
2190 | Addressee::List emaillist; | 2259 | Addressee::List emaillist; |
2191 | 2260 | ||
2192 | if (!name.isEmpty()) | 2261 | if (!name.isEmpty()) |
2193 | namelist = mAddressBook->findByName( name ); | 2262 | namelist = mAddressBook->findByName( name ); |
2194 | 2263 | ||
2195 | if (!email.isEmpty()) | 2264 | if (!email.isEmpty()) |
2196 | emaillist = mAddressBook->findByEmail( email ); | 2265 | emaillist = mAddressBook->findByEmail( email ); |
2197 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2266 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2198 | //check if we have a match in Namelist and Emaillist | 2267 | //check if we have a match in Namelist and Emaillist |
2199 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2268 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2200 | foundUid = emaillist[0].uid(); | 2269 | foundUid = emaillist[0].uid(); |
2201 | } | 2270 | } |
2202 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2271 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2203 | foundUid = namelist[0].uid(); | 2272 | foundUid = namelist[0].uid(); |
2204 | else | 2273 | else |
2205 | { | 2274 | { |
2206 | for (int i = 0; i < namelist.count(); i++) | 2275 | for (int i = 0; i < namelist.count(); i++) |
2207 | { | 2276 | { |
2208 | for (int j = 0; j < emaillist.count(); j++) | 2277 | for (int j = 0; j < emaillist.count(); j++) |
2209 | { | 2278 | { |
2210 | if (namelist[i] == emaillist[j]) | 2279 | if (namelist[i] == emaillist[j]) |
2211 | { | 2280 | { |
2212 | foundUid = namelist[i].uid(); | 2281 | foundUid = namelist[i].uid(); |
2213 | } | 2282 | } |
2214 | } | 2283 | } |
2215 | } | 2284 | } |
2216 | } | 2285 | } |
2217 | } | 2286 | } |
2218 | else | 2287 | else |
2219 | { | 2288 | { |
2220 | foundUid = uid; | 2289 | foundUid = uid; |
2221 | } | 2290 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index e6f286b..c9c0d38 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -274,128 +274,129 @@ class KABCore : public QWidget, public KSyncInterface | |||
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 | 339 | ||
339 | 340 | ||
340 | signals: | 341 | signals: |
341 | void contactSelected( const QString &name ); | 342 | void contactSelected( const QString &name ); |
342 | void contactSelected( const QPixmap &pixmap ); | 343 | void contactSelected( const QPixmap &pixmap ); |
343 | public slots: | 344 | public slots: |
344 | void setDetailsVisible( bool visible ); | 345 | void setDetailsVisible( bool visible ); |
345 | void setDetailsToState(); | 346 | void setDetailsToState(); |
346 | // void slotSyncMenu( int ); | 347 | // void slotSyncMenu( int ); |
347 | private slots: | 348 | private slots: |
348 | void setJumpButtonBarVisible( bool visible ); | 349 | void setJumpButtonBarVisible( bool visible ); |
349 | void importFromOL(); | 350 | void importFromOL(); |
350 | void extensionModified( const KABC::Addressee::List &list ); | 351 | void extensionModified( const KABC::Addressee::List &list ); |
351 | void extensionChanged( int id ); | 352 | void extensionChanged( int id ); |
352 | void clipboardDataChanged(); | 353 | void clipboardDataChanged(); |
353 | void updateActionMenu(); | 354 | void updateActionMenu(); |
354 | void configureKeyBindings(); | 355 | void configureKeyBindings(); |
355 | void removeVoice(); | 356 | void removeVoice(); |
356 | #ifdef KAB_EMBEDDED | 357 | #ifdef KAB_EMBEDDED |
357 | void configureResources(); | 358 | void configureResources(); |
358 | #endif //KAB_EMBEDDED | 359 | #endif //KAB_EMBEDDED |
359 | 360 | ||
360 | void slotEditorDestroyed( const QString &uid ); | 361 | void slotEditorDestroyed( const QString &uid ); |
361 | void configurationChanged(); | 362 | void configurationChanged(); |
362 | void addressBookChanged(); | 363 | void addressBookChanged(); |
363 | 364 | ||
364 | private: | 365 | private: |
365 | void initGUI(); | 366 | void initGUI(); |
366 | void initActions(); | 367 | void initActions(); |
367 | 368 | ||
368 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 369 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
369 | const char *name = 0 ); | 370 | const char *name = 0 ); |
370 | 371 | ||
371 | KXMLGUIClient *mGUIClient; | 372 | KXMLGUIClient *mGUIClient; |
372 | 373 | ||
373 | KABC::AddressBook *mAddressBook; | 374 | KABC::AddressBook *mAddressBook; |
374 | 375 | ||
375 | ViewManager *mViewManager; | 376 | ViewManager *mViewManager; |
376 | // QSplitter *mDetailsSplitter; | 377 | // QSplitter *mDetailsSplitter; |
377 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 378 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
378 | ViewContainer *mDetails; | 379 | ViewContainer *mDetails; |
379 | KDGanttMinimizeSplitter* mMiniSplitter; | 380 | KDGanttMinimizeSplitter* mMiniSplitter; |
380 | XXPortManager *mXXPortManager; | 381 | XXPortManager *mXXPortManager; |
381 | JumpButtonBar *mJumpButtonBar; | 382 | JumpButtonBar *mJumpButtonBar; |
382 | IncSearchWidget *mIncSearchWidget; | 383 | IncSearchWidget *mIncSearchWidget; |
383 | ExtensionManager *mExtensionManager; | 384 | ExtensionManager *mExtensionManager; |
384 | 385 | ||
385 | KCMultiDialog *mConfigureDialog; | 386 | KCMultiDialog *mConfigureDialog; |
386 | 387 | ||
387 | #ifndef KAB_EMBEDDED | 388 | #ifndef KAB_EMBEDDED |
388 | LDAPSearchDialog *mLdapSearchDialog; | 389 | LDAPSearchDialog *mLdapSearchDialog; |
389 | #endif //KAB_EMBEDDED | 390 | #endif //KAB_EMBEDDED |
390 | // QDict<AddresseeEditorDialog> mEditorDict; | 391 | // QDict<AddresseeEditorDialog> mEditorDict; |
391 | AddresseeEditorDialog *mEditorDialog; | 392 | AddresseeEditorDialog *mEditorDialog; |
392 | bool mReadWrite; | 393 | bool mReadWrite; |
393 | bool mModified; | 394 | bool mModified; |
394 | bool mIsPart; | 395 | bool mIsPart; |
395 | bool mMultipleViewsAtOnce; | 396 | bool mMultipleViewsAtOnce; |
396 | 397 | ||
397 | 398 | ||
398 | //US file menu | 399 | //US file menu |
399 | KAction *mActionMail; | 400 | KAction *mActionMail; |
400 | KAction *mActionBeam; | 401 | KAction *mActionBeam; |
401 | KAction *mActionExport2phone; | 402 | KAction *mActionExport2phone; |