22 #include <qcontactdetailfilter.h> |
22 #include <qcontactdetailfilter.h> |
23 #include <qcontactphonenumber.h> |
23 #include <qcontactphonenumber.h> |
24 #include <qcontactname.h> |
24 #include <qcontactname.h> |
25 #include <qcontactonlineaccount.h> |
25 #include <qcontactonlineaccount.h> |
26 #include <hbglobal.h> |
26 #include <hbglobal.h> |
|
27 #include <QDataStream> |
27 #include "logsevent.h" |
28 #include "logsevent.h" |
28 #include "logseventparser.h" |
29 #include "logseventparser.h" |
29 #include "logseventdata.h" |
30 #include "logseventdata.h" |
30 #include "logsengdefs.h" |
31 #include "logsengdefs.h" |
31 #include "logslogger.h" |
32 #include "logslogger.h" |
344 bool LogsEvent::isRead() const |
345 bool LogsEvent::isRead() const |
345 { |
346 { |
346 return mIsRead; |
347 return mIsRead; |
347 } |
348 } |
348 |
349 |
|
350 // ---------------------------------------------------------------------------- |
|
351 // |
|
352 // ---------------------------------------------------------------------------- |
|
353 // |
|
354 LogsEvent::LogsEvent( QDataStream& serializedEvent ) |
|
355 { |
|
356 LOGS_QDEBUG( "logs [ENG] -> LogsEvent::LogsEvent deserialize") |
|
357 serializedEvent >> mLogId; |
|
358 int tempEnum; |
|
359 serializedEvent >> tempEnum; |
|
360 mDirection = static_cast<LogsEvent::LogsDirection>( tempEnum ); |
|
361 serializedEvent >> tempEnum; |
|
362 mEventType = static_cast<LogsEvent::LogsEventType>( tempEnum ); |
|
363 serializedEvent >> mUid; |
|
364 |
|
365 serializedEvent >> mRemoteParty; |
|
366 serializedEvent >> mNumber; |
|
367 serializedEvent >> mDuplicates; |
|
368 serializedEvent >> mTime; |
|
369 serializedEvent >> mRingDuration; |
|
370 serializedEvent >> mIsRead; |
|
371 serializedEvent >> mIsALS; |
|
372 serializedEvent >> mDuration; |
|
373 |
|
374 serializedEvent >> mIndex; |
|
375 serializedEvent >> mIsInView; |
|
376 serializedEvent >> tempEnum; |
|
377 mEventState = static_cast<LogsEvent::LogsEventState>( tempEnum ); |
|
378 serializedEvent >> mIsLocallySeen; |
|
379 serializedEvent >> mIsPrivate; |
|
380 serializedEvent >> mIsUnknown; |
|
381 |
|
382 LogsEventData* logsEventData = new LogsEventData(serializedEvent); |
|
383 if ( serializedEvent.status() == QDataStream::ReadPastEnd ){ |
|
384 mLogsEventData = 0; |
|
385 delete logsEventData; |
|
386 } else { |
|
387 mLogsEventData = logsEventData; |
|
388 } |
|
389 LOGS_QDEBUG( "logs [ENG] <- LogsEvent::LogsEvent deserialize") |
|
390 |
|
391 } |
|
392 |
|
393 // ---------------------------------------------------------------------------- |
|
394 // |
|
395 // ---------------------------------------------------------------------------- |
|
396 // |
|
397 bool LogsEvent::serialize( QDataStream& serializeDestination ) |
|
398 { |
|
399 LOGS_QDEBUG( "logs [ENG] -> LogsEvent::serialize") |
|
400 serializeDestination << mLogId; |
|
401 serializeDestination << mDirection; |
|
402 serializeDestination << mEventType; |
|
403 serializeDestination << mUid; |
|
404 |
|
405 serializeDestination << mRemoteParty; |
|
406 serializeDestination << mNumber; |
|
407 serializeDestination << mDuplicates; |
|
408 serializeDestination << mTime; |
|
409 serializeDestination << mRingDuration; |
|
410 serializeDestination << mIsRead; |
|
411 serializeDestination << mIsALS; |
|
412 serializeDestination << mDuration; |
|
413 |
|
414 serializeDestination << mIndex; |
|
415 serializeDestination << mIsInView; |
|
416 serializeDestination << mEventState; |
|
417 serializeDestination << mIsLocallySeen; |
|
418 serializeDestination << mIsPrivate; |
|
419 serializeDestination << mIsUnknown; |
|
420 |
|
421 if ( mLogsEventData ){ |
|
422 mLogsEventData->serialize(serializeDestination); |
|
423 } |
|
424 |
|
425 LOGS_QDEBUG( "logs [ENG] <- LogsEvent::serialize") |
|
426 return true; |
|
427 } |
|
428 |
349 // ---------------------------------------------------------------------------- |
429 // ---------------------------------------------------------------------------- |
350 // LogsEvent::RingDuration |
430 // LogsEvent::RingDuration |
351 // |
431 // |
352 // For ring duation feature |
432 // For ring duation feature |
353 // ---------------------------------------------------------------------------- |
433 // ---------------------------------------------------------------------------- |
558 // LogsEvent::parseContactName |
638 // LogsEvent::parseContactName |
559 // ---------------------------------------------------------------------------- |
639 // ---------------------------------------------------------------------------- |
560 // |
640 // |
561 QString LogsEvent::parseContactName(const QContactName& name) |
641 QString LogsEvent::parseContactName(const QContactName& name) |
562 { |
642 { |
563 QString firstName = name.value(QContactName::FieldFirst); |
643 QString firstName = name.value(QContactName::FieldFirstName); |
564 QString lastName = name.value(QContactName::FieldLast); |
644 QString lastName = name.value(QContactName::FieldLastName); |
565 QString parsedName; |
645 QString parsedName; |
566 if (!lastName.isEmpty()) { |
646 if (!lastName.isEmpty()) { |
567 if (!firstName.isEmpty()) { |
647 if (!firstName.isEmpty()) { |
568 parsedName = |
648 parsedName = |
569 QString(QLatin1String("%1 %2")).arg(firstName).arg(lastName); |
649 QString(QLatin1String("%1 %2")).arg(firstName).arg(lastName); |