-rw-r--r-- | kaddressbook/kabcore.cpp | 27 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 |
2 files changed, 27 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 7be5db8..7acf1ee 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -199,229 +199,230 @@ private: | |||
199 | 199 | ||
200 | 200 | ||
201 | class KAex2phonePrefs : public QDialog | 201 | class KAex2phonePrefs : public QDialog |
202 | { | 202 | { |
203 | public: | 203 | public: |
204 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 204 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
205 | QDialog( parent, name, true ) | 205 | QDialog( parent, name, true ) |
206 | { | 206 | { |
207 | setCaption( i18n("Export to phone options") ); | 207 | setCaption( i18n("Export to phone options") ); |
208 | QVBoxLayout* lay = new QVBoxLayout( this ); | 208 | QVBoxLayout* lay = new QVBoxLayout( this ); |
209 | lay->setSpacing( 3 ); | 209 | lay->setSpacing( 3 ); |
210 | lay->setMargin( 3 ); | 210 | lay->setMargin( 3 ); |
211 | QLabel *lab; | 211 | QLabel *lab; |
212 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 212 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
213 | lab->setAlignment (AlignHCenter ); | 213 | lab->setAlignment (AlignHCenter ); |
214 | QHBox* temphb; | 214 | QHBox* temphb; |
215 | temphb = new QHBox( this ); | 215 | temphb = new QHBox( this ); |
216 | new QLabel( i18n("I/O device: "), temphb ); | 216 | new QLabel( i18n("I/O device: "), temphb ); |
217 | mPhoneDevice = new QLineEdit( temphb); | 217 | mPhoneDevice = new QLineEdit( temphb); |
218 | lay->addWidget( temphb ); | 218 | lay->addWidget( temphb ); |
219 | temphb = new QHBox( this ); | 219 | temphb = new QHBox( this ); |
220 | new QLabel( i18n("Connection: "), temphb ); | 220 | new QLabel( i18n("Connection: "), temphb ); |
221 | mPhoneConnection = new QLineEdit( temphb); | 221 | mPhoneConnection = new QLineEdit( temphb); |
222 | lay->addWidget( temphb ); | 222 | lay->addWidget( temphb ); |
223 | temphb = new QHBox( this ); | 223 | temphb = new QHBox( this ); |
224 | new QLabel( i18n("Model(opt.): "), temphb ); | 224 | new QLabel( i18n("Model(opt.): "), temphb ); |
225 | mPhoneModel = new QLineEdit( temphb); | 225 | mPhoneModel = new QLineEdit( temphb); |
226 | lay->addWidget( temphb ); | 226 | lay->addWidget( temphb ); |
227 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 227 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
228 | // lay->addWidget( mWriteToSim ); | 228 | // lay->addWidget( mWriteToSim ); |
229 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 229 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
230 | lab->setAlignment (AlignHCenter ); | 230 | lab->setAlignment (AlignHCenter ); |
231 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 231 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
232 | lay->addWidget( ok ); | 232 | lay->addWidget( ok ); |
233 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 233 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
234 | lay->addWidget( cancel ); | 234 | lay->addWidget( cancel ); |
235 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 235 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
236 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 236 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
237 | resize( 220, 240 ); | 237 | resize( 220, 240 ); |
238 | 238 | ||
239 | } | 239 | } |
240 | 240 | ||
241 | public: | 241 | public: |
242 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 242 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
243 | QCheckBox* mWriteToSim; | 243 | QCheckBox* mWriteToSim; |
244 | }; | 244 | }; |
245 | 245 | ||
246 | 246 | ||
247 | bool pasteWithNewUid = true; | 247 | bool pasteWithNewUid = true; |
248 | 248 | ||
249 | #ifdef KAB_EMBEDDED | 249 | #ifdef KAB_EMBEDDED |
250 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 250 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
251 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 251 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
252 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 252 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
253 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 253 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
254 | #else //KAB_EMBEDDED | 254 | #else //KAB_EMBEDDED |
255 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 255 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
256 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 256 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
257 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 257 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
258 | mReadWrite( readWrite ), mModified( false ) | 258 | mReadWrite( readWrite ), mModified( false ) |
259 | #endif //KAB_EMBEDDED | 259 | #endif //KAB_EMBEDDED |
260 | { | 260 | { |
261 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 261 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
262 | // syncManager->setBlockSave(false); | 262 | // syncManager->setBlockSave(false); |
263 | mMiniSplitter = 0; | ||
263 | mExtensionBarSplitter = 0; | 264 | mExtensionBarSplitter = 0; |
264 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 265 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
265 | mAddressBook = KABC::StdAddressBook::self(); | 266 | mAddressBook = KABC::StdAddressBook::self(); |
266 | KABC::StdAddressBook::setAutomaticSave( false ); | 267 | KABC::StdAddressBook::setAutomaticSave( false ); |
267 | 268 | ||
268 | #ifndef KAB_EMBEDDED | 269 | #ifndef KAB_EMBEDDED |
269 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 270 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
270 | #endif //KAB_EMBEDDED | 271 | #endif //KAB_EMBEDDED |
271 | 272 | ||
272 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 273 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
273 | SLOT( addressBookChanged() ) ); | 274 | SLOT( addressBookChanged() ) ); |
274 | 275 | ||
275 | #if 0 | 276 | #if 0 |
276 | // LP moved to addressbook init method | 277 | // LP moved to addressbook init method |
277 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 278 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
278 | "X-Department", "KADDRESSBOOK" ); | 279 | "X-Department", "KADDRESSBOOK" ); |
279 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 280 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
280 | "X-Profession", "KADDRESSBOOK" ); | 281 | "X-Profession", "KADDRESSBOOK" ); |
281 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 282 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
282 | "X-AssistantsName", "KADDRESSBOOK" ); | 283 | "X-AssistantsName", "KADDRESSBOOK" ); |
283 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 284 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
284 | "X-ManagersName", "KADDRESSBOOK" ); | 285 | "X-ManagersName", "KADDRESSBOOK" ); |
285 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 286 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
286 | "X-SpousesName", "KADDRESSBOOK" ); | 287 | "X-SpousesName", "KADDRESSBOOK" ); |
287 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 288 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
288 | "X-Office", "KADDRESSBOOK" ); | 289 | "X-Office", "KADDRESSBOOK" ); |
289 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 290 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
290 | "X-IMAddress", "KADDRESSBOOK" ); | 291 | "X-IMAddress", "KADDRESSBOOK" ); |
291 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 292 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
292 | "X-Anniversary", "KADDRESSBOOK" ); | 293 | "X-Anniversary", "KADDRESSBOOK" ); |
293 | 294 | ||
294 | //US added this field to become compatible with Opie/qtopia addressbook | 295 | //US added this field to become compatible with Opie/qtopia addressbook |
295 | // values can be "female" or "male" or "". An empty field represents undefined. | 296 | // values can be "female" or "male" or "". An empty field represents undefined. |
296 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 297 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
297 | "X-Gender", "KADDRESSBOOK" ); | 298 | "X-Gender", "KADDRESSBOOK" ); |
298 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 299 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
299 | "X-Children", "KADDRESSBOOK" ); | 300 | "X-Children", "KADDRESSBOOK" ); |
300 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 301 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
301 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 302 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
302 | #endif | 303 | #endif |
303 | initGUI(); | 304 | initGUI(); |
304 | 305 | ||
305 | mIncSearchWidget->setFocus(); | 306 | mIncSearchWidget->setFocus(); |
306 | 307 | ||
307 | 308 | ||
308 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 309 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
309 | SLOT( setContactSelected( const QString& ) ) ); | 310 | SLOT( setContactSelected( const QString& ) ) ); |
310 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 311 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
311 | SLOT( executeContact( const QString& ) ) ); | 312 | SLOT( executeContact( const QString& ) ) ); |
312 | 313 | ||
313 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 314 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
314 | SLOT( deleteContacts( ) ) ); | 315 | SLOT( deleteContacts( ) ) ); |
315 | connect( mViewManager, SIGNAL( modified() ), | 316 | connect( mViewManager, SIGNAL( modified() ), |
316 | SLOT( setModified() ) ); | 317 | SLOT( setModified() ) ); |
317 | 318 | ||
318 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 319 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
319 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 320 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
320 | 321 | ||
321 | connect( mXXPortManager, SIGNAL( modified() ), | 322 | connect( mXXPortManager, SIGNAL( modified() ), |
322 | SLOT( setModified() ) ); | 323 | SLOT( setModified() ) ); |
323 | 324 | ||
324 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 325 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
325 | SLOT( incrementalSearch( const QString& ) ) ); | 326 | SLOT( incrementalSearch( const QString& ) ) ); |
326 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 327 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
327 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 328 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
328 | 329 | ||
329 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 330 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
330 | SLOT( sendMail( const QString& ) ) ); | 331 | SLOT( sendMail( const QString& ) ) ); |
331 | 332 | ||
332 | 333 | ||
333 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 334 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
334 | 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&))); | 335 | 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&))); |
335 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 336 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
336 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 337 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
337 | 338 | ||
338 | 339 | ||
339 | #ifndef KAB_EMBEDDED | 340 | #ifndef KAB_EMBEDDED |
340 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 341 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
341 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 342 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
342 | 343 | ||
343 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 344 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
344 | SLOT( browse( const QString& ) ) ); | 345 | SLOT( browse( const QString& ) ) ); |
345 | 346 | ||
346 | 347 | ||
347 | mAddressBookService = new KAddressBookService( this ); | 348 | mAddressBookService = new KAddressBookService( this ); |
348 | 349 | ||
349 | #endif //KAB_EMBEDDED | 350 | #endif //KAB_EMBEDDED |
350 | 351 | ||
351 | mMessageTimer = new QTimer( this ); | 352 | mMessageTimer = new QTimer( this ); |
352 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 353 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
353 | mEditorDialog = 0; | 354 | mEditorDialog = 0; |
354 | createAddresseeEditorDialog( this ); | 355 | createAddresseeEditorDialog( this ); |
355 | setModified( false ); | 356 | setModified( false ); |
356 | mBRdisabled = false; | 357 | mBRdisabled = false; |
357 | #ifndef DESKTOP_VERSION | 358 | #ifndef DESKTOP_VERSION |
358 | infrared = 0; | 359 | infrared = 0; |
359 | #endif | 360 | #endif |
360 | //toggleBeamReceive( ); | 361 | //toggleBeamReceive( ); |
361 | 362 | ||
362 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 363 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
363 | QTimer::singleShot( 1, this , SLOT ( updateToolBar())); | 364 | QTimer::singleShot( 1000, this , SLOT ( updateToolBar())); |
364 | } | 365 | } |
365 | 366 | ||
366 | void KABCore::updateToolBar() | 367 | void KABCore::updateToolBar() |
367 | { | 368 | { |
368 | mMainWindow->toolBar()->repaint(); | 369 | mMainWindow->toolBar()->repaint(); |
369 | } | 370 | } |
370 | KABCore::~KABCore() | 371 | KABCore::~KABCore() |
371 | { | 372 | { |
372 | // save(); | 373 | // save(); |
373 | //saveSettings(); | 374 | //saveSettings(); |
374 | //KABPrefs::instance()->writeConfig(); | 375 | //KABPrefs::instance()->writeConfig(); |
375 | delete AddresseeConfig::instance(); | 376 | delete AddresseeConfig::instance(); |
376 | mAddressBook = 0; | 377 | mAddressBook = 0; |
377 | KABC::StdAddressBook::close(); | 378 | KABC::StdAddressBook::close(); |
378 | 379 | ||
379 | delete syncManager; | 380 | delete syncManager; |
380 | #ifndef DESKTOP_VERSION | 381 | #ifndef DESKTOP_VERSION |
381 | if ( infrared ) | 382 | if ( infrared ) |
382 | delete infrared; | 383 | delete infrared; |
383 | #endif | 384 | #endif |
384 | } | 385 | } |
385 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 386 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
386 | { | 387 | { |
387 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 388 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
388 | if ( cmsg == "setDocument(QString)" ) { | 389 | if ( cmsg == "setDocument(QString)" ) { |
389 | QDataStream stream( data, IO_ReadOnly ); | 390 | QDataStream stream( data, IO_ReadOnly ); |
390 | QString fileName; | 391 | QString fileName; |
391 | stream >> fileName; | 392 | stream >> fileName; |
392 | recieve( fileName ); | 393 | recieve( fileName ); |
393 | return; | 394 | return; |
394 | } | 395 | } |
395 | } | 396 | } |
396 | void KABCore::toggleBeamReceive( ) | 397 | void KABCore::toggleBeamReceive( ) |
397 | { | 398 | { |
398 | if ( mBRdisabled ) | 399 | if ( mBRdisabled ) |
399 | return; | 400 | return; |
400 | #ifndef DESKTOP_VERSION | 401 | #ifndef DESKTOP_VERSION |
401 | if ( infrared ) { | 402 | if ( infrared ) { |
402 | qDebug("AB disable BeamReceive "); | 403 | qDebug("AB disable BeamReceive "); |
403 | delete infrared; | 404 | delete infrared; |
404 | infrared = 0; | 405 | infrared = 0; |
405 | mActionBR->setChecked(false); | 406 | mActionBR->setChecked(false); |
406 | return; | 407 | return; |
407 | } | 408 | } |
408 | qDebug("AB enable BeamReceive "); | 409 | qDebug("AB enable BeamReceive "); |
409 | mActionBR->setChecked(true); | 410 | mActionBR->setChecked(true); |
410 | 411 | ||
411 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 412 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
412 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 413 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
413 | #endif | 414 | #endif |
414 | } | 415 | } |
415 | 416 | ||
416 | 417 | ||
417 | void KABCore::disableBR(bool b) | 418 | void KABCore::disableBR(bool b) |
418 | { | 419 | { |
419 | #ifndef DESKTOP_VERSION | 420 | #ifndef DESKTOP_VERSION |
420 | if ( b ) { | 421 | if ( b ) { |
421 | if ( infrared ) { | 422 | if ( infrared ) { |
422 | toggleBeamReceive( ); | 423 | toggleBeamReceive( ); |
423 | } | 424 | } |
424 | mBRdisabled = true; | 425 | mBRdisabled = true; |
425 | } else { | 426 | } else { |
426 | if ( mBRdisabled ) { | 427 | if ( mBRdisabled ) { |
427 | mBRdisabled = false; | 428 | mBRdisabled = false; |
@@ -715,131 +716,155 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
715 | 716 | ||
716 | 717 | ||
717 | 718 | ||
718 | QDir().mkdir( dirName, true ); | 719 | QDir().mkdir( dirName, true ); |
719 | 720 | ||
720 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 721 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
721 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 722 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
722 | 723 | ||
723 | if ( a.isEmpty() ) | 724 | if ( a.isEmpty() ) |
724 | continue; | 725 | continue; |
725 | 726 | ||
726 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 727 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
727 | 728 | ||
728 | QString fileName = dirName + "/" + name; | 729 | QString fileName = dirName + "/" + name; |
729 | 730 | ||
730 | QFile outFile(fileName); | 731 | QFile outFile(fileName); |
731 | 732 | ||
732 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 733 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
733 | KABC::VCardConverter converter; | 734 | KABC::VCardConverter converter; |
734 | QString vcard; | 735 | QString vcard; |
735 | 736 | ||
736 | converter.addresseeToVCard( a, vcard ); | 737 | converter.addresseeToVCard( a, vcard ); |
737 | 738 | ||
738 | QTextStream t( &outFile ); // use a text stream | 739 | QTextStream t( &outFile ); // use a text stream |
739 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 740 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
740 | t << vcard; | 741 | t << vcard; |
741 | 742 | ||
742 | outFile.close(); | 743 | outFile.close(); |
743 | 744 | ||
744 | urls.append( fileName ); | 745 | urls.append( fileName ); |
745 | } | 746 | } |
746 | } | 747 | } |
747 | 748 | ||
748 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 749 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
749 | 750 | ||
750 | 751 | ||
751 | /*US | 752 | /*US |
752 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 753 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
753 | QString::null, // subject | 754 | QString::null, // subject |
754 | QString::null, // body | 755 | QString::null, // body |
755 | QString::null, | 756 | QString::null, |
756 | urls ); // attachments | 757 | urls ); // attachments |
757 | */ | 758 | */ |
758 | 759 | ||
759 | } | 760 | } |
760 | 761 | ||
761 | /** | 762 | /** |
762 | Beams the "WhoAmI contact. | 763 | Beams the "WhoAmI contact. |
763 | */ | 764 | */ |
764 | void KABCore::beamMySelf() | 765 | void KABCore::beamMySelf() |
765 | { | 766 | { |
766 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 767 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
767 | if (!a.isEmpty()) | 768 | if (!a.isEmpty()) |
768 | { | 769 | { |
769 | QStringList uids; | 770 | QStringList uids; |
770 | uids << a.uid(); | 771 | uids << a.uid(); |
771 | 772 | ||
772 | beamVCard(uids); | 773 | beamVCard(uids); |
773 | } else { | 774 | } else { |
774 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 775 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
775 | 776 | ||
776 | 777 | ||
777 | } | 778 | } |
778 | } | 779 | } |
780 | void KABCore::resizeEvent(QResizeEvent* e ) | ||
781 | { | ||
782 | if ( !mMiniSplitter ) | ||
783 | return; | ||
784 | if ( QApplication::desktop()->width() >= 480 ) { | ||
785 | int fac = QApplication::desktop()->width()/QApplication::desktop()->height(); | ||
786 | if ( fac > 0 ) { // e.g. 640x480 | ||
787 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | ||
788 | mMiniSplitter->setOrientation( Qt::Horizontal); | ||
789 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | ||
790 | if ( QApplication::desktop()->width() <= 640 ) | ||
791 | topLevelWidget()->showMaximized(); | ||
792 | } | ||
793 | } else {// e.g. 480x640 | ||
794 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | ||
795 | mMiniSplitter->setOrientation( Qt::Vertical ); | ||
796 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | ||
797 | if ( QApplication::desktop()->width() <= 640 ) | ||
798 | topLevelWidget()->showMaximized(); | ||
799 | } | ||
800 | } | ||
801 | } | ||
779 | 802 | ||
803 | } | ||
780 | void KABCore::export2phone() | 804 | void KABCore::export2phone() |
781 | { | 805 | { |
806 | |||
782 | QStringList uids; | 807 | QStringList uids; |
783 | XXPortSelectDialog dlg( this, false, this ); | 808 | XXPortSelectDialog dlg( this, false, this ); |
784 | if ( dlg.exec() ) | 809 | if ( dlg.exec() ) |
785 | uids = dlg.uids(); | 810 | uids = dlg.uids(); |
786 | else | 811 | else |
787 | return; | 812 | return; |
788 | if ( uids.isEmpty() ) | 813 | if ( uids.isEmpty() ) |
789 | return; | 814 | return; |
790 | // qDebug("count %d ", uids.count()); | 815 | // qDebug("count %d ", uids.count()); |
791 | 816 | ||
792 | KAex2phonePrefs ex2phone; | 817 | KAex2phonePrefs ex2phone; |
793 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 818 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
794 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 819 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
795 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 820 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
796 | 821 | ||
797 | if ( !ex2phone.exec() ) { | 822 | if ( !ex2phone.exec() ) { |
798 | return; | 823 | return; |
799 | } | 824 | } |
800 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 825 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
801 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 826 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
802 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 827 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
803 | 828 | ||
804 | 829 | ||
805 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 830 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
806 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 831 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
807 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 832 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
808 | 833 | ||
809 | QString fileName = getPhoneFile(); | 834 | QString fileName = getPhoneFile(); |
810 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 835 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
811 | return; | 836 | return; |
812 | 837 | ||
813 | message(i18n("Exporting to phone...")); | 838 | message(i18n("Exporting to phone...")); |
814 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 839 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
815 | 840 | ||
816 | } | 841 | } |
817 | QString KABCore::getPhoneFile() | 842 | QString KABCore::getPhoneFile() |
818 | { | 843 | { |
819 | #ifdef DESKTOP_VERSION | 844 | #ifdef DESKTOP_VERSION |
820 | return locateLocal("tmp", "phonefile.vcf"); | 845 | return locateLocal("tmp", "phonefile.vcf"); |
821 | #else | 846 | #else |
822 | return "/tmp/phonefile.vcf"; | 847 | return "/tmp/phonefile.vcf"; |
823 | #endif | 848 | #endif |
824 | 849 | ||
825 | } | 850 | } |
826 | void KABCore::writeToPhone( ) | 851 | void KABCore::writeToPhone( ) |
827 | { | 852 | { |
828 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 853 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
829 | message(i18n("Export to phone finished!")); | 854 | message(i18n("Export to phone finished!")); |
830 | else | 855 | else |
831 | qDebug(i18n("Error exporting to phone")); | 856 | qDebug(i18n("Error exporting to phone")); |
832 | } | 857 | } |
833 | void KABCore::beamVCard() | 858 | void KABCore::beamVCard() |
834 | { | 859 | { |
835 | QStringList uids = mViewManager->selectedUids(); | 860 | QStringList uids = mViewManager->selectedUids(); |
836 | if ( !uids.isEmpty() ) | 861 | if ( !uids.isEmpty() ) |
837 | beamVCard( uids ); | 862 | beamVCard( uids ); |
838 | } | 863 | } |
839 | 864 | ||
840 | 865 | ||
841 | void KABCore::beamVCard(const QStringList& uids) | 866 | void KABCore::beamVCard(const QStringList& uids) |
842 | { | 867 | { |
843 | 868 | ||
844 | // LR: we should use the /tmp dir on the Zaurus, | 869 | // LR: we should use the /tmp dir on the Zaurus, |
845 | // because: /tmp = RAM, (HOME)/kdepim = flash memory | 870 | // because: /tmp = RAM, (HOME)/kdepim = flash memory |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 0a52838..fe2d3a2 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -321,128 +321,129 @@ class KABCore : public QWidget, public KSyncInterface | |||
321 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 321 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
322 | the method will try to find a selected addressee in the view. | 322 | the method will try to find a selected addressee in the view. |
323 | */ | 323 | */ |
324 | void executeContact( const QString &uid /*US = QString::null*/ ); | 324 | void executeContact( const QString &uid /*US = QString::null*/ ); |
325 | 325 | ||
326 | /** | 326 | /** |
327 | Launches the configuration dialog. | 327 | Launches the configuration dialog. |
328 | */ | 328 | */ |
329 | void openConfigDialog(); | 329 | void openConfigDialog(); |
330 | 330 | ||
331 | /** | 331 | /** |
332 | Launches the ldap search dialog. | 332 | Launches the ldap search dialog. |
333 | */ | 333 | */ |
334 | void openLDAPDialog(); | 334 | void openLDAPDialog(); |
335 | 335 | ||
336 | /** | 336 | /** |
337 | Creates a KAddressBookPrinter, which will display the print | 337 | Creates a KAddressBookPrinter, which will display the print |
338 | dialog and do the printing. | 338 | dialog and do the printing. |
339 | */ | 339 | */ |
340 | void print(); | 340 | void print(); |
341 | 341 | ||
342 | /** | 342 | /** |
343 | Registers a new GUI client, so plugins can register its actions. | 343 | Registers a new GUI client, so plugins can register its actions. |
344 | */ | 344 | */ |
345 | void addGUIClient( KXMLGUIClient *client ); | 345 | void addGUIClient( KXMLGUIClient *client ); |
346 | 346 | ||
347 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 347 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
348 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 348 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
349 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 349 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
350 | 350 | ||
351 | 351 | ||
352 | signals: | 352 | signals: |
353 | void contactSelected( const QString &name ); | 353 | void contactSelected( const QString &name ); |
354 | void contactSelected( const QPixmap &pixmap ); | 354 | void contactSelected( const QPixmap &pixmap ); |
355 | public slots: | 355 | public slots: |
356 | void recieve(QString cmsg ); | 356 | void recieve(QString cmsg ); |
357 | void getFile( bool success ); | 357 | void getFile( bool success ); |
358 | void syncFileRequest(); | 358 | void syncFileRequest(); |
359 | void setDetailsVisible( bool visible ); | 359 | void setDetailsVisible( bool visible ); |
360 | void setDetailsToState(); | 360 | void setDetailsToState(); |
361 | // void slotSyncMenu( int ); | 361 | // void slotSyncMenu( int ); |
362 | private slots: | 362 | private slots: |
363 | void updateToolBar(); | 363 | void updateToolBar(); |
364 | void receive( const QCString& cmsg, const QByteArray& data ); | 364 | void receive( const QCString& cmsg, const QByteArray& data ); |
365 | void toggleBeamReceive( ); | 365 | void toggleBeamReceive( ); |
366 | void disableBR(bool); | 366 | void disableBR(bool); |
367 | void setJumpButtonBarVisible( bool visible ); | 367 | void setJumpButtonBarVisible( bool visible ); |
368 | void setCaptionBack(); | 368 | void setCaptionBack(); |
369 | void importFromOL(); | 369 | void importFromOL(); |
370 | void extensionModified( const KABC::Addressee::List &list ); | 370 | void extensionModified( const KABC::Addressee::List &list ); |
371 | void extensionChanged( int id ); | 371 | void extensionChanged( int id ); |
372 | void clipboardDataChanged(); | 372 | void clipboardDataChanged(); |
373 | void updateActionMenu(); | 373 | void updateActionMenu(); |
374 | void configureKeyBindings(); | 374 | void configureKeyBindings(); |
375 | void removeVoice(); | 375 | void removeVoice(); |
376 | #ifdef KAB_EMBEDDED | 376 | #ifdef KAB_EMBEDDED |
377 | void configureResources(); | 377 | void configureResources(); |
378 | #endif //KAB_EMBEDDED | 378 | #endif //KAB_EMBEDDED |
379 | 379 | ||
380 | void slotEditorDestroyed( const QString &uid ); | 380 | void slotEditorDestroyed( const QString &uid ); |
381 | void configurationChanged(); | 381 | void configurationChanged(); |
382 | void addressBookChanged(); | 382 | void addressBookChanged(); |
383 | 383 | ||
384 | private: | 384 | private: |
385 | void resizeEvent(QResizeEvent* e ); | ||
385 | bool mBRdisabled; | 386 | bool mBRdisabled; |
386 | #ifndef DESKTOP_VERSION | 387 | #ifndef DESKTOP_VERSION |
387 | QCopChannel* infrared; | 388 | QCopChannel* infrared; |
388 | #endif | 389 | #endif |
389 | QTimer *mMessageTimer; | 390 | QTimer *mMessageTimer; |
390 | void initGUI(); | 391 | void initGUI(); |
391 | void initActions(); | 392 | void initActions(); |
392 | QString getPhoneFile(); | 393 | QString getPhoneFile(); |
393 | 394 | ||
394 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 395 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
395 | const char *name = 0 ); | 396 | const char *name = 0 ); |
396 | 397 | ||
397 | KXMLGUIClient *mGUIClient; | 398 | KXMLGUIClient *mGUIClient; |
398 | 399 | ||
399 | KABC::AddressBook *mAddressBook; | 400 | KABC::AddressBook *mAddressBook; |
400 | 401 | ||
401 | ViewManager *mViewManager; | 402 | ViewManager *mViewManager; |
402 | // QSplitter *mDetailsSplitter; | 403 | // QSplitter *mDetailsSplitter; |
403 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 404 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
404 | ViewContainer *mDetails; | 405 | ViewContainer *mDetails; |
405 | KDGanttMinimizeSplitter* mMiniSplitter; | 406 | KDGanttMinimizeSplitter* mMiniSplitter; |
406 | XXPortManager *mXXPortManager; | 407 | XXPortManager *mXXPortManager; |
407 | JumpButtonBar *mJumpButtonBar; | 408 | JumpButtonBar *mJumpButtonBar; |
408 | IncSearchWidget *mIncSearchWidget; | 409 | IncSearchWidget *mIncSearchWidget; |
409 | ExtensionManager *mExtensionManager; | 410 | ExtensionManager *mExtensionManager; |
410 | 411 | ||
411 | KCMultiDialog *mConfigureDialog; | 412 | KCMultiDialog *mConfigureDialog; |
412 | 413 | ||
413 | #ifndef KAB_EMBEDDED | 414 | #ifndef KAB_EMBEDDED |
414 | LDAPSearchDialog *mLdapSearchDialog; | 415 | LDAPSearchDialog *mLdapSearchDialog; |
415 | #endif //KAB_EMBEDDED | 416 | #endif //KAB_EMBEDDED |
416 | // QDict<AddresseeEditorDialog> mEditorDict; | 417 | // QDict<AddresseeEditorDialog> mEditorDict; |
417 | AddresseeEditorDialog *mEditorDialog; | 418 | AddresseeEditorDialog *mEditorDialog; |
418 | bool mReadWrite; | 419 | bool mReadWrite; |
419 | bool mModified; | 420 | bool mModified; |
420 | bool mIsPart; | 421 | bool mIsPart; |
421 | bool mMultipleViewsAtOnce; | 422 | bool mMultipleViewsAtOnce; |
422 | 423 | ||
423 | 424 | ||
424 | //US file menu | 425 | //US file menu |
425 | KAction *mActionMail; | 426 | KAction *mActionMail; |
426 | KAction *mActionBeam; | 427 | KAction *mActionBeam; |
427 | KToggleAction *mActionBR; | 428 | KToggleAction *mActionBR; |
428 | KAction *mActionExport2phone; | 429 | KAction *mActionExport2phone; |
429 | KAction* mActionPrint; | 430 | KAction* mActionPrint; |
430 | KAction* mActionNewContact; | 431 | KAction* mActionNewContact; |
431 | KAction *mActionSave; | 432 | KAction *mActionSave; |
432 | KAction *mActionEditAddressee; | 433 | KAction *mActionEditAddressee; |
433 | KAction *mActionMailVCard; | 434 | KAction *mActionMailVCard; |
434 | KAction *mActionBeamVCard; | 435 | KAction *mActionBeamVCard; |
435 | 436 | ||
436 | KAction *mActionQuit; | 437 | KAction *mActionQuit; |
437 | 438 | ||
438 | //US edit menu | 439 | //US edit menu |
439 | KAction *mActionCopy; | 440 | KAction *mActionCopy; |
440 | KAction *mActionCut; | 441 | KAction *mActionCut; |
441 | KAction *mActionPaste; | 442 | KAction *mActionPaste; |
442 | KAction *mActionSelectAll; | 443 | KAction *mActionSelectAll; |
443 | KAction *mActionUndo; | 444 | KAction *mActionUndo; |
444 | KAction *mActionRedo; | 445 | KAction *mActionRedo; |
445 | KAction *mActionDelete; | 446 | KAction *mActionDelete; |
446 | 447 | ||
447 | //US settings menu | 448 | //US settings menu |
448 | KAction *mActionConfigResources; | 449 | KAction *mActionConfigResources; |