# HG changeset patch # User hgs # Date 1277379854 -10800 # Node ID 6c9acdc6adc037dad40e6395d58ccbe7bb38550a # Parent 41c0a814d878948c12a0628a697ab7fdc4b8fb1c 201025 diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/inc/logsbaseview.h --- a/logsui/logsapp/inc/logsbaseview.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/inc/logsbaseview.h Thu Jun 24 14:44:14 2010 +0300 @@ -47,7 +47,7 @@ friend class UT_LogsBaseView; public: - + virtual ~LogsBaseView(); public: @@ -74,7 +74,6 @@ virtual void handleExit(); virtual void callKeyPressed(); - void closeEmptyMenu(); signals: @@ -139,7 +138,7 @@ /** * Loads appropriate section from *.docml to resize list widget */ - void updateListSize(); + void updateListSize( HbListView& list ); protected: @@ -190,6 +189,11 @@ void updateDialpadCallAndMessagingActions(); bool tryMatchesViewTransition(); bool isDialpadInput() const; + void ensureListPositioning( HbListView& list ); + void scrollToTopItem( HbListView* list ); + + void updateMenuVisibility(); + void setMenuVisible(bool visible); protected: @@ -214,6 +218,7 @@ QString mLayoutSectionName; QStringList mActivities; + HbMenu* mOptionsMenu; }; diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/inc/logscomponentrepository.h --- a/logsui/logsapp/inc/logscomponentrepository.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/inc/logscomponentrepository.h Thu Jun 24 14:44:14 2010 +0300 @@ -31,8 +31,10 @@ /** * */ -class LogsComponentRepository : public HbDocumentLoader +class LogsComponentRepository : public QObject, public HbDocumentLoader { + Q_OBJECT + friend class UT_LogsComponentRepository; friend class UT_LogsViewManager; @@ -43,9 +45,9 @@ public: - LogsRecentCallsView* recentCallsView(); - LogsDetailsView* detailsView(); - LogsMatchesView* matchesView(); + LogsRecentCallsView* recentCallsView(bool onlyInit = false); + LogsDetailsView* detailsView(bool onlyInit = false); + LogsMatchesView* matchesView(bool onlyInit = false); /** * Returns dialpad. Must be always a valid pointer. @@ -63,6 +65,10 @@ void setObjectTreeToView( LogsAppViewId viewId ); bool loadSection( LogsAppViewId viewId, const QString& sectionName ); + +private slots: + + void lazyInit(); private: @@ -71,6 +77,10 @@ void addToolbarToObjectList( QObjectList& list ); + QGraphicsWidget* doLoadView( + const QString &fileName, const QString &viewName, + QObjectList &viewComponents, LogsAppViewId viewId, bool onlyInit ); + private: LogsAbstractViewManager& mViewManager; @@ -84,6 +94,7 @@ Dialpad* mDialpad; DialpadKeyHandler* mDialpadKeyHandler; LogsModel* mModel; + QObjectList* mCurrentObjectTree; }; #endif // LOGSCOMPONENTREPOSITORY_H diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/inc/logsdefs.h --- a/logsui/logsapp/inc/logsdefs.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/inc/logsdefs.h Thu Jun 24 14:44:14 2010 +0300 @@ -39,6 +39,7 @@ const char logsToolbarId[] = "logs_toolbar"; const char logsButtonAddToContactsId[] = "logs_button_addtocontacts"; const char logsPageIndicatorId[] = "logs_page_indicator"; +const char logsContentId[] = "logs_content"; //action ids const char logsCommonVideoCallMenuActionId[] = "logs_act_video_call"; @@ -101,6 +102,7 @@ const char logsActivityParamShowDialpad[] = "show_dialpad"; // val type bool const char logsActivityParamDialpadText[] = "dialpad_text"; // val type string +const char logsActivityParamInternalViewId[] = "view_id"; // val type int #endif // LOGSDEFS_H diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/inc/logseffecthandler.h --- a/logsui/logsapp/inc/logseffecthandler.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/inc/logseffecthandler.h Thu Jun 24 14:44:14 2010 +0300 @@ -41,13 +41,15 @@ void startDissappearAppearByFadingEffect(QObject& effectTarget); void startDissappearAppearByMovingEffect( - QObject& effectTarget, QObject& secondaryEffectTarget, bool dissappearToLeft, int origX); + QObject& effectTarget, QObject& secondaryEffectTarget, bool dissappearToLeft, + int origX, int secondaryOrigX); void startMoveNotPossibleEffect(QObject& effectTarget, bool moveLeft, int origX); signals: void dissappearByMovingComplete(); void dissappearByFadingComplete(); + void appearByMovingComplete(); private slots: diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/inc/logsmainwindow.h --- a/logsui/logsapp/inc/logsmainwindow.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/inc/logsmainwindow.h Thu Jun 24 14:44:14 2010 +0300 @@ -21,8 +21,6 @@ #include #include -class LogsForegroundWatcher; - class LogsMainWindow : public HbMainWindow { @@ -45,12 +43,9 @@ signals: void callKeyPressed(); - void appFocusGained(); - void appFocusLost(); private: - LogsForegroundWatcher* mWatcher; bool mForeground; friend class UT_LogsMainWindow; diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/inc/logsmatchesview.h --- a/logsui/logsapp/inc/logsmatchesview.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/inc/logsmatchesview.h Thu Jun 24 14:44:14 2010 +0300 @@ -74,6 +74,7 @@ HbListView* mListView; //not owned LogsMatchesModel* mModel; //owned HbPushButton* mAddToContactsButton; // not owned + bool mAddToContactsButtonDisabled; }; #endif // LOGSMATCHESVIEW_H diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/inc/logsrecentcallsview.h --- a/logsui/logsapp/inc/logsrecentcallsview.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/inc/logsrecentcallsview.h Thu Jun 24 14:44:14 2010 +0300 @@ -19,7 +19,7 @@ #include "logsfilter.h" #include "logsbaseview.h" -#include +#include class HbListView; class HbLabel; @@ -80,8 +80,8 @@ void rightFlick(); void dissappearByFadingComplete(); void dissappearByMovingComplete(); + void appearByMovingComplete(); bool markMissedCallsSeen(); - void scrollToTopItem(); private: // from LogsBaseView @@ -106,7 +106,6 @@ //from HbWidget void gestureEvent(QGestureEvent *event); - QSwipeGesture::SwipeDirection swipeAngleToDirection(int angle, int delta); int getListItemTextWidth(); @@ -126,11 +125,14 @@ bool mMoveLeftInList; LogsEffectHandler* mEffectHandler; int mListViewX; + int mEmptyListLabelX; LogsMatchesModel* mMatchesModel; bool mMarkingMissedAsSeen; LogsPageIndicator* mPageIndicator; bool mFirstActivation; + HbScrollArea::ScrollBarPolicy mListScrollBarPolicy; + }; #endif // LOGSRECENTCALLSVIEW_H diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/inc/logsservicehandler.h --- a/logsui/logsapp/inc/logsservicehandler.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/inc/logsservicehandler.h Thu Jun 24 14:44:14 2010 +0300 @@ -36,7 +36,7 @@ signals: - void activateView(LogsServices::LogsView activatedView, bool showDialpad); + void activateView(LogsServices::LogsView activatedView, bool showDialpad, QString dialpadText); void activateView(QString dialpadText); public: diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/inc/logsservicehandlerold.h --- a/logsui/logsapp/inc/logsservicehandlerold.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/inc/logsservicehandlerold.h Thu Jun 24 14:44:14 2010 +0300 @@ -35,7 +35,7 @@ signals: - void activateView(LogsServices::LogsView activatedView, bool showDialpad); + void activateView(LogsServices::LogsView activatedView, bool showDialpad, QString dialpadText); void activateView(QString dialpadText); public: diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/inc/logsviewmanager.h --- a/logsui/logsapp/inc/logsviewmanager.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/inc/logsviewmanager.h Thu Jun 24 14:44:14 2010 +0300 @@ -55,10 +55,10 @@ public slots: + void changeRecentViewViaService( + LogsServices::LogsView view, bool showDialpad, QString dialpadText); + void changeMatchesViewViaService(QString dialpadText); void changeRecentView(LogsServices::LogsView view, bool showDialpad); - void changeMatchesView(QString dialpadText); - void appFocusGained(); - void appFocusLost(); public: // From LogsAbstractViewManager @@ -77,13 +77,13 @@ private: - void initViews(); bool doActivateView(LogsAppViewId viewId, bool showDialpad, QVariant args, const QString& dialpadText = QString()); bool loadActivity(); LogsAppViewId checkMatchesViewTransition( LogsAppViewId viewId, const QString& dialpadText); void handleFirstActivation(); + LogsBaseView* createView(LogsAppViewId viewId); private: //data diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/logsapp.pro --- a/logsui/logsapp/logsapp.pro Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/logsapp.pro Thu Jun 24 14:44:14 2010 +0300 @@ -43,7 +43,7 @@ HEADERS += inc/logseffecthandler.h HEADERS += inc/logspageindicator.h HEADERS += inc/logspageindicatoritem.h -HEADERS += ../logsengine/logssymbianos/inc/logsforegroundwatcher.h +HEADERS += inc/logscomponentrepository.h SOURCES += src/main.cpp SOURCES += src/logsmainwindow.cpp @@ -58,7 +58,6 @@ SOURCES += src/logseffecthandler.cpp SOURCES += src/logspageindicator.cpp SOURCES += src/logspageindicatoritem.cpp -SOURCES += ../logsengine/logssymbianos/src/logsforegroundwatcher.cpp symbian: { TARGET.UID2 = 0x100039CE diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/resources/detailsView.docml --- a/logsui/logsapp/resources/detailsView.docml Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/resources/detailsView.docml Thu Jun 24 14:44:14 2010 +0300 @@ -1,25 +1,25 @@ - + - + - + - + - + @@ -34,16 +34,16 @@ - + - + - + - + diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/resources/matchesView.docml --- a/logsui/logsapp/resources/matchesView.docml Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/resources/matchesView.docml Thu Jun 24 14:44:14 2010 +0300 @@ -22,16 +22,16 @@ - + - + - + - + @@ -46,6 +46,7 @@ + @@ -63,17 +64,6 @@ - - - - - - - - - - - @@ -109,6 +99,17 @@ + + + + + + + + + + +
@@ -117,6 +118,17 @@ + + + + + + + + + + +
@@ -125,6 +137,17 @@ + + + + + + + + + + +
diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/resources/recentCallsView.docml --- a/logsui/logsapp/resources/recentCallsView.docml Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/resources/recentCallsView.docml Thu Jun 24 14:44:14 2010 +0300 @@ -7,7 +7,7 @@ - + @@ -28,19 +28,19 @@ - + - + - + - + @@ -57,7 +57,6 @@ - diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/src/logsbaseview.cpp --- a/logsui/logsapp/src/logsbaseview.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/src/logsbaseview.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -43,7 +43,8 @@ #include #include #include - +#include +#include Q_DECLARE_METATYPE(LogsCall*) Q_DECLARE_METATYPE(LogsMessage*) @@ -70,7 +71,8 @@ mMessage(0), mContact(0), mDetailsModel(0), - mCallTypeMapper(0) + mCallTypeMapper(0), + mOptionsMenu(0) { LOGS_QDEBUG( "logs [UI] -> LogsBaseView::LogsBaseView()" ); @@ -96,6 +98,7 @@ delete mContact; delete mDetailsModel; delete mCallTypeMapper; + delete mOptionsMenu; LOGS_QDEBUG( "logs [UI] <- LogsBaseView::~LogsBaseView()" ); } @@ -278,8 +281,6 @@ mInitialized = true; initFilterMenu(); addActionNamesToMap(); - connect(menu(), SIGNAL(aboutToShow()), this, - SLOT(closeEmptyMenu()), Qt::QueuedConnection); } // ----------------------------------------------------------------------------- @@ -336,7 +337,7 @@ listView()->scrollTo( topIndex ); listView()->setCurrentIndex( topIndex, QItemSelectionModel::Select ); initiateCallback(topIndex); - } + } LOGS_QDEBUG( "logs [UI] <- LogsBaseView::callKeyPressed()" ); } @@ -366,32 +367,17 @@ } // ----------------------------------------------------------------------------- -// LogsBaseView::closeEmptyMenu() -// ----------------------------------------------------------------------------- -// -void LogsBaseView::closeEmptyMenu() -{ - bool visibleActionsExist = false; - foreach (QAction* action, menu()->actions()) { - if (action->isVisible()) { - visibleActionsExist = true ; - } - } - - if (!visibleActionsExist) { - menu()->close(); - } -} -// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void LogsBaseView::openDialpad() { LOGS_QDEBUG( "logs [UI] -> LogsBaseView::openDialpad()" ); + updateCallButton(); setDialpadPosition(); mDialpad->openDialpad(); + LOGS_QDEBUG( "logs [UI] <- LogsBaseView::openDialpad()" ); } @@ -402,16 +388,12 @@ void LogsBaseView::openContactsApp() { LOGS_QDEBUG( "logs [UI] -> LogsBaseView::openContactsApp()" ); - - // Need to do request in async manner, otherwise new phonebook ui process - // will be started due bug(?) in highway. - XQServiceRequest snd("com.nokia.services.phonebookappservices.Launch","launch()", false); + XQServiceRequest snd("com.nokia.services.phonebookappservices.Launch","launch()"); XQRequestInfo info; info.setForeground(true); snd.setInfo(info); int retValue; snd.send(retValue); - LOGS_QDEBUG( "logs [UI] <- LogsBaseView::openContactsApp()" ); } @@ -744,14 +726,14 @@ popup->setAttribute(Qt::WA_DeleteOnClose); popup->setTimeout( HbPopup::NoTimeout ); popup->addAction( - new HbAction(hbTrId("txt_dial_button_cancel"), popup)); + new HbAction(hbTrId("txt_common_button_cancel"), popup)); HbWidget* buttonWidget = new HbWidget(popup); QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); HbPushButton* addButton = new HbPushButton(buttonWidget); addButton->setStretched(true); - addButton->setText(hbTrId("txt_dial_list_save_as_a_new_contact")); + addButton->setText(hbTrId("txt_dial_button_save_as_a_new_contact")); HbIcon plusIcon("qtg_mono_plus"); addButton->setIcon(plusIcon); connect(addButton, SIGNAL(clicked()), popup, SLOT(close())); @@ -759,7 +741,7 @@ HbPushButton* updateButton = new HbPushButton(buttonWidget); updateButton->setStretched(true); - updateButton->setText(hbTrId("txt_dial_list_update_existing_contact")); + updateButton->setText(hbTrId("txt_dial_button_update_existing_contact")); updateButton->setIcon(plusIcon); connect(updateButton, SIGNAL(clicked()), popup, SLOT(close())); connect(updateButton, SIGNAL(clicked()), @@ -1034,7 +1016,7 @@ // Loads appropriate section from *.docml to resize list widget // ----------------------------------------------------------------------------- // -void LogsBaseView::updateListSize() +void LogsBaseView::updateListSize( HbListView& list ) { LOGS_QDEBUG( "logs [UI] -> LogsBaseView::updateListSize()" ); QString newSection( logsViewDefaultSection ); @@ -1050,10 +1032,13 @@ newSection = QString( logsViewDefaultSection ); } - if (newSection != mLayoutSectionName) { - mLayoutSectionName = newSection; - LOGS_QDEBUG_2( "logs [UI] loading new section: ", newSection ); - mRepository.loadSection( viewId(), newSection ); + bool sectionChanged( mLayoutSectionName != newSection ); + mLayoutSectionName = newSection; + LOGS_QDEBUG_2( "logs [UI] loading new section: ", newSection ); + mRepository.loadSection( viewId(), newSection ); + + if ( sectionChanged ){ + ensureListPositioning( list ); } LOGS_QDEBUG( "logs [UI] <- LogsBaseView::updateListSize()" ); @@ -1202,3 +1187,87 @@ return ( mDialpad->isOpen() && !mDialpad->editor().text().isEmpty() ); } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void LogsBaseView::ensureListPositioning( HbListView& list ) +{ + LOGS_QDEBUG( "logs [UI] -> LogsBaseView::ensureListPositioning()" ); + + HbWidget* content = + qobject_cast( mRepository.findWidget( logsContentId ) ); + QList visibleItems = list.visibleItems(); + if ( content && visibleItems.count() > 0 ){ + LOGS_QDEBUG_2( "logs [UI] contentsRect:", content->contentsRect() ); + QRectF rect = content->contentsRect(); + rect.adjust( 0, list.pos().y(), 0, -list.pos().y() ); + LOGS_QDEBUG_2( "logs [UI] listRect:", rect ); + list.setGeometry(rect); + + HbScrollArea::ScrollBarPolicy prevPolicy = list.verticalScrollBarPolicy(); + list.setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff); + list.setVerticalScrollBarPolicy(prevPolicy); + + qreal itemHeight = visibleItems.at(0)->size().height(); + HbModelIterator* modelIt = list.modelIterator(); + if ( modelIt && itemHeight > 0 ) { + int maxVisibleItems = rect.height() / itemHeight; + LOGS_QDEBUG_2( "logs [UI] max visible items:", maxVisibleItems ); + if ( modelIt->indexCount() <= maxVisibleItems ){ + // All items can fit the rect reserved for the list, force them to fit + list.ensureVisible(QPointF(0,0)); + } else if ( visibleItems.count() < maxVisibleItems ) { + // All items cannot fit the rect reserved, force to reserve whole + // area so that current index is tried to be centered + list.scrollTo(list.currentIndex(), HbAbstractItemView::PositionAtCenter); + } + } + } + LOGS_QDEBUG( "logs [UI] <- LogsBaseView::ensureListPositioning()" ); +} + +// ----------------------------------------------------------------------------- +// LogsBaseView::scrollToTopItem +// ----------------------------------------------------------------------------- +// +void LogsBaseView::scrollToTopItem( HbListView* list ) +{ + LOGS_QDEBUG( "logs [UI] -> LogsBaseView::scrollToTopItem()" ); + + if ( list && list->verticalScrollBar() ){ + list->verticalScrollBar()->setValue(0.0); + } + + LOGS_QDEBUG( "logs [UI] <- LogsBaseView::scrollToTopItem()" ); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void LogsBaseView::updateMenuVisibility() +{ + bool visibleActionsExist = false; + HbMenu* optionsMenu = mOptionsMenu ? mOptionsMenu : menu(); + foreach (QAction* action, optionsMenu->actions()) { + if (action->isVisible()) { + visibleActionsExist = true; + } + } + setMenuVisible(visibleActionsExist); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void LogsBaseView::setMenuVisible(bool visible) +{ + if (!visible && !mOptionsMenu) { + mOptionsMenu = takeMenu(); + } else if (visible && mOptionsMenu) { + setMenu(mOptionsMenu); + mOptionsMenu = 0; + } +} diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/src/logscomponentrepository.cpp --- a/logsui/logsapp/src/logscomponentrepository.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/src/logscomponentrepository.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -29,21 +29,28 @@ #include #include #include +#include +#include + +const int logsRepositoryLazyInitTimerMsec = 3000; // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // LogsComponentRepository::LogsComponentRepository(LogsAbstractViewManager& viewManager) - : HbDocumentLoader(), + : QObject(), + HbDocumentLoader(), mViewManager(viewManager), mRecentCallsView(0), mDetailsView(0), mMatchesView(0), mDialpad(0), - mDialpadKeyHandler(0) + mDialpadKeyHandler(0), + mCurrentObjectTree(0) { - mModel = new LogsModel(LogsModel::LogsRecentModel); + mModel = new LogsModel(LogsModel::LogsRecentModel, ETrue); + QTimer::singleShot(logsRepositoryLazyInitTimerMsec, this, SLOT(lazyInit())); } // ----------------------------------------------------------------------------- @@ -85,22 +92,16 @@ // // ----------------------------------------------------------------------------- // -LogsRecentCallsView* LogsComponentRepository::recentCallsView() +LogsRecentCallsView* LogsComponentRepository::recentCallsView(bool onlyInit) { LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::recentCallsView()" ); - setObjectTreeToView( LogsRecentViewId ); if ( !mRecentCallsView ) { - bool ok = false; - mRecentViewComponents = load( logsRecentCallsViewFile, &ok ); - if ( ok ) { - mRecentCallsView = qobject_cast - ( findWidget(logsRecentCallsViewId) ); - - addToolbarToObjectList(mRecentViewComponents); - } else { - LOGS_QCRITICAL( "logs [UI] XML loading failed..." ); - } + mRecentCallsView = qobject_cast(doLoadView( + logsRecentCallsViewFile, logsRecentCallsViewId, + mRecentViewComponents, LogsRecentViewId, onlyInit)); + } else if ( !onlyInit ){ + setObjectTreeToView( LogsRecentViewId ); } LOGS_QDEBUG( "logs [UI] <- LogsComponentRepository::recentCallsView()" ); @@ -111,23 +112,18 @@ // // ----------------------------------------------------------------------------- // -LogsDetailsView* LogsComponentRepository::detailsView() +LogsDetailsView* LogsComponentRepository::detailsView(bool onlyInit) { - LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::detailsView()" ); - setObjectTreeToView( LogsDetailsViewId ); - + LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::detailsView()" ); + if ( !mDetailsView ) { - bool ok = false; - mDetailsViewComponents = load( logsDetailsViewFile, &ok ); - if ( ok ) { - mDetailsView = qobject_cast - ( findWidget(logsDetailsViewId) ); - - addToolbarToObjectList(mDetailsViewComponents); - } else { - LOGS_QCRITICAL( "logs [UI] XML loading failed..." ); - } + mDetailsView = qobject_cast(doLoadView( + logsDetailsViewFile, logsDetailsViewId, + mDetailsViewComponents, LogsDetailsViewId, onlyInit)); + } else if ( !onlyInit ){ + setObjectTreeToView( LogsDetailsViewId ); } + LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::detailsView()" ); return mDetailsView; } @@ -136,22 +132,16 @@ // // ----------------------------------------------------------------------------- // -LogsMatchesView* LogsComponentRepository::matchesView() +LogsMatchesView* LogsComponentRepository::matchesView(bool onlyInit) { LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::matchedCallsView()" ); - setObjectTreeToView( LogsMatchesViewId ); if ( !mMatchesView ) { - bool ok = false; - mMatchesViewComponents = load( logsMatchedCallsViewFile, &ok ); - if ( ok ) { - mMatchesView = qobject_cast - ( findWidget(logsMatchesViewId) ); - - addToolbarToObjectList(mMatchesViewComponents); - } else { - LOGS_QCRITICAL( "logs [UI] XML loading failed..." ); - } + mMatchesView = qobject_cast(doLoadView( + logsMatchedCallsViewFile, logsMatchesViewId, + mMatchesViewComponents, LogsMatchesViewId, onlyInit)); + } else if ( !onlyInit ){ + setObjectTreeToView( LogsMatchesViewId ); } LOGS_QDEBUG( "logs [UI] <- LogsComponentRepository::matchedCallsView()" ); @@ -188,12 +178,17 @@ void LogsComponentRepository::setObjectTreeToView( LogsAppViewId viewId ) { reset(); + QObjectList* objTree = 0; if ( viewId == LogsRecentViewId ) { - setObjectTree( mRecentViewComponents ); + objTree = &mRecentViewComponents; } else if ( viewId == LogsDetailsViewId ) { - setObjectTree( mDetailsViewComponents ); + objTree = &mDetailsViewComponents; } else if ( viewId == LogsMatchesViewId ) { - setObjectTree( mMatchesViewComponents ); + objTree = &mMatchesViewComponents; + } + if ( objTree ){ + setObjectTree( *objTree ); + mCurrentObjectTree = objTree; } } @@ -259,3 +254,43 @@ return ok; } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void LogsComponentRepository::lazyInit() +{ + mModel->refreshData(); + recentCallsView(true); + detailsView(true); + matchesView(true); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +QGraphicsWidget* LogsComponentRepository::doLoadView( + const QString &fileName, const QString &viewName, + QObjectList& viewComponents, LogsAppViewId viewId, bool onlyInit) +{ + QObjectList* prevObjectTree = mCurrentObjectTree; + setObjectTreeToView( viewId ); + + QGraphicsWidget* view = 0; + bool ok = false; + viewComponents = load( fileName, &ok ); + if ( ok ) { + view = findWidget(viewName); + addToolbarToObjectList(viewComponents); + } else { + LOGS_QCRITICAL( "logs [UI] XML loading failed..." ); + } + + if ( onlyInit && prevObjectTree ){ + LOGS_QDEBUG( "logs [UI] set back previous object tree" ) + mCurrentObjectTree = prevObjectTree; + setObjectTree( *mCurrentObjectTree ); + } + return view; +} diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/src/logsdetailsview.cpp --- a/logsui/logsapp/src/logsdetailsview.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/src/logsdetailsview.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -97,6 +97,8 @@ updateMenu(); + scrollToTopItem(mListView); + LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::activated()" ); } @@ -390,7 +392,7 @@ if ( mListView ) { updateMenu(); updateListLayoutName(*mListView, true); - updateListSize(); + updateListSize(*mListView); } LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::updateWidgetsSizeAndLayout()" ); } diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/src/logseffecthandler.cpp --- a/logsui/logsapp/src/logseffecthandler.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/src/logseffecthandler.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -31,6 +31,7 @@ const int logsMoveNotPossibleAmount = 30; const int logsDissappearByMovingIndex = 0; +const int logsPauseBetweenDissappearAndAppearIndex = 1; const int logsAppearByMovingIndex = 2; // ----------------------------------------------------------------------------- @@ -72,6 +73,7 @@ connect(mMoveGroup, SIGNAL(currentAnimationChanged(QAbstractAnimation *)), this, SLOT( moveAnimationChanged(QAbstractAnimation *))); + connect(mMoveGroup, SIGNAL(finished()), this, SIGNAL(appearByMovingComplete()) ); connect(mFadeGroup, SIGNAL(currentAnimationChanged(QAbstractAnimation *)), this, SLOT( fadeAnimationChanged(QAbstractAnimation *))); @@ -101,7 +103,8 @@ // void LogsEffectHandler::moveAnimationChanged(QAbstractAnimation *currentAnimation) { - if ( mMoveGroup->indexOfAnimation(currentAnimation) == 1 ) { + int indexOfAnimation = mMoveGroup->indexOfAnimation(currentAnimation); + if (indexOfAnimation == logsPauseBetweenDissappearAndAppearIndex ) { emit dissappearByMovingComplete(); } } @@ -112,7 +115,8 @@ // void LogsEffectHandler::fadeAnimationChanged(QAbstractAnimation *currentAnimation) { - if ( mFadeGroup->indexOfAnimation(currentAnimation) == 1 ) { + int indexOfAnimation = mFadeGroup->indexOfAnimation(currentAnimation); + if ( indexOfAnimation == logsPauseBetweenDissappearAndAppearIndex ) { emit dissappearByFadingComplete(); } } @@ -137,12 +141,13 @@ // void LogsEffectHandler::startDissappearAppearByMovingEffect( QObject& effectTarget, QObject& secondaryEffectTarget, - bool dissappearToLeft, int origX) + bool dissappearToLeft, int origX, int secondaryOrigX) { doStartDissappearAppearByMovingEffect( *mMoveGroup, effectTarget, dissappearToLeft, origX); + doStartDissappearAppearByMovingEffect( - *mMoveGroup2, secondaryEffectTarget, dissappearToLeft, origX); + *mMoveGroup2, secondaryEffectTarget, dissappearToLeft, secondaryOrigX); } // ----------------------------------------------------------------------------- diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/src/logsmainwindow.cpp --- a/logsui/logsapp/src/logsmainwindow.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/src/logsmainwindow.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -17,7 +17,6 @@ #include "logsmainwindow.h" #include "logslogger.h" -#include "logsforegroundwatcher.h" #include #include @@ -27,12 +26,6 @@ // LogsMainWindow::LogsMainWindow() : HbMainWindow(), mForeground(false) { - if ( viewport() ){ - viewport()->grabGesture(Qt::SwipeGesture); - } - mWatcher = new LogsForegroundWatcher(this); - connect( mWatcher, SIGNAL(losingForeground()), this, SIGNAL(appFocusLost()) ); - connect( mWatcher, SIGNAL(gainingForeground()), this, SIGNAL(appFocusGained()) ); } // ----------------------------------------------------------------------------- @@ -41,9 +34,6 @@ // LogsMainWindow::~LogsMainWindow() { - if ( viewport() ){ - viewport()->ungrabGesture(Qt::SwipeGesture); - } } // ----------------------------------------------------------------------------- diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/src/logsmatchesview.cpp --- a/logsui/logsapp/src/logsmatchesview.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/src/logsmatchesview.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -45,7 +45,8 @@ : LogsBaseView(LogsMatchesViewId, repository, viewManager), mListView(0), mModel(0), - mAddToContactsButton(0) + mAddToContactsButton(0), + mAddToContactsButtonDisabled(false) { LOGS_QDEBUG( "logs [UI] <-> LogsMatchesView::LogsMatchesView()" ); @@ -69,7 +70,10 @@ // void LogsMatchesView::activated(bool showDialer, QVariant args) { - //base class handling first + // Disable add to contacts button handling while view is activated + // to avoid unnecessary quick appear/dissappear of it. + mAddToContactsButtonDisabled = true; + LogsBaseView::activated(showDialer, args); LogsMatchesModel* model = qVariantValue(args); @@ -77,6 +81,10 @@ dialpadEditorTextChanged(); activateEmptyListIndicator(mModel); + + scrollToTopItem(mListView); + + mAddToContactsButtonDisabled = false; } // ----------------------------------------------------------------------------- @@ -190,8 +198,9 @@ void LogsMatchesView::handleBackSoftkey() { LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::::handleBackSoftkey()" ); - + mDialpad->editor().blockSignals(true); mDialpad->editor().setText(QString()); + mDialpad->editor().blockSignals(false); if (mDialpad->isOpen()){ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::::handleBackSoftkey() closeDialpad" ); @@ -201,7 +210,7 @@ mDialpad->closeDialpad(); mDialpad->blockSignals(false); } - + LogsBaseView::handleBackSoftkey(); LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::::handleBackSoftkey()" ); @@ -213,6 +222,7 @@ // void LogsMatchesView::dialpadEditorTextChanged() { + LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::::dialpadEditorTextChanged()" ); updateCallButton(); updateMenu(); @@ -223,6 +233,7 @@ } else if ( mModel ) { mModel->logsMatches( pattern ); } + LOGS_QDEBUG_2( "logs [UI] <- LogsMatchesView::::dialpadEditorTextChanged(), text: ", pattern ); } // ----------------------------------------------------------------------------- @@ -257,7 +268,7 @@ if ( mListView ) { updateMenu(); updateListLayoutName(*mListView); - updateListSize(); + updateListSize(*mListView); } LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::updateWidgetsSizeAndLayout()" ); } @@ -295,9 +306,9 @@ { LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::updateMenu()" ); - updateDialpadCallAndMessagingActions(); - + updateDialpadCallAndMessagingActions(); updateContactSearchAction(); + updateMenuVisibility(); LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::updateMenu()" ); } @@ -311,6 +322,7 @@ if (mAddToContactsButton) { LOGS_QDEBUG( "logs [UI] <-> LogsMatchesView::updateAddContactButton()" ); bool matchesFound(model() && (model()->rowCount() > 0)); - mAddToContactsButton->setVisible(!matchesFound && isDialpadInput()); + mAddToContactsButton->setVisible( + !mAddToContactsButtonDisabled && !matchesFound && isDialpadInput() ); } } diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/src/logsrecentcallsview.cpp --- a/logsui/logsapp/src/logsrecentcallsview.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/src/logsrecentcallsview.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -42,13 +42,13 @@ #include #include #include +#include #include #include Q_DECLARE_METATYPE(LogsMatchesModel*) const int logsMissedCallsMarkingDelayMs = 1000; -const int logsSwipeAngleDelta = 30; // angle is from 0 to 360 // ----------------------------------------------------------------------------- // LogsRecentCallsView::LogsRecentCallsView @@ -65,10 +65,12 @@ mMoveLeftInList(false), mEffectHandler(0), mListViewX(0), + mEmptyListLabelX(0), mMatchesModel(0), mMarkingMissedAsSeen(false), mPageIndicator(0), - mFirstActivation(true) + mFirstActivation(true), + mListScrollBarPolicy(HbScrollArea::ScrollBarAutoHide) { LOGS_QDEBUG( "logs [UI] <-> LogsRecentCallsView::LogsRecentCallsView()" ); mModel = mRepository.model(); @@ -130,6 +132,10 @@ mFirstActivation = false; + if (mEmptyListLabel) { + mEmptyListLabelX = mEmptyListLabel->pos().x(); + } + LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::activated()" ); } @@ -213,7 +219,8 @@ this, SLOT(dissappearByMovingComplete())); connect(mEffectHandler, SIGNAL(dissappearByFadingComplete()), this, SLOT(dissappearByFadingComplete())); - + connect(mEffectHandler, SIGNAL(appearByMovingComplete()), + this, SLOT(appearByMovingComplete())); mPageIndicator = qobject_cast (mRepository.findWidget(logsPageIndicatorId)); @@ -440,6 +447,8 @@ mListViewX = mListView->pos().x(); grabGesture(Qt::SwipeGesture); + + mListScrollBarPolicy = mListView->verticalScrollBarPolicy(); LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::initListWidget() " ); } @@ -464,7 +473,7 @@ mListView->setModel( mFilter );//ownership not transferred - scrollToTopItem(); + scrollToTopItem(mListView); activateEmptyListIndicator(mFilter); @@ -536,55 +545,25 @@ { QGesture* gesture = event->gesture(Qt::SwipeGesture); if (gesture) { - QSwipeGesture* swipe = static_cast(gesture); - if (swipe->state() == Qt::GestureFinished) { - QSwipeGesture::SwipeDirection direction = swipeAngleToDirection( - swipe->swipeAngle(), logsSwipeAngleDelta); - if (mViewManager.mainWindow().orientation() == Qt::Vertical) { - if (direction == QSwipeGesture::Left) { - leftFlick(); - event->accept(Qt::SwipeGesture); - } else if (direction == QSwipeGesture::Right) { - rightFlick(); - event->accept(Qt::SwipeGesture); - } - } else { - if (direction == QSwipeGesture::Down) { - rightFlick(); - event->accept(Qt::SwipeGesture); - } else if (direction == QSwipeGesture::Up) { - leftFlick(); - event->accept(Qt::SwipeGesture); - } + LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::gestureEvent()" ); + HbSwipeGesture* swipe = static_cast(gesture); + if (swipe && swipe->state() == Qt::GestureFinished) { + LOGS_QDEBUG_2( "logs [UI] sceneSwipeAngle: ", swipe->sceneSwipeAngle() ); + LOGS_QDEBUG_2( "logs [UI] swipeAngle: ", swipe->swipeAngle() ); + + QSwipeGesture::SwipeDirection direction = swipe->sceneHorizontalDirection(); + if (direction == QSwipeGesture::Left) { + leftFlick(); + event->accept(Qt::SwipeGesture); + } else if (direction == QSwipeGesture::Right) { + rightFlick(); + event->accept(Qt::SwipeGesture); } } } } // ----------------------------------------------------------------------------- -// LogsRecentCallsView::swipeAngleToDirection -// ----------------------------------------------------------------------------- -// -QSwipeGesture::SwipeDirection LogsRecentCallsView::swipeAngleToDirection( - int angle, int delta) -{ - QSwipeGesture::SwipeDirection direction(QSwipeGesture::NoDirection); - if ((angle > 90-delta) && (angle < 90+delta)) { - direction = QSwipeGesture::Up; - } else if ((angle > 270-delta) && (angle < 270+delta)) { - direction = QSwipeGesture::Down; - } else if (((angle >= 0) && (angle < delta)) - || ((angle > 360-delta) && (angle <= 360))) { - direction = QSwipeGesture::Right; - } else if ((angle > 180-delta) && (angle < 180+delta)) { - direction = QSwipeGesture::Left; - } - LOGS_QDEBUG_4( "logs [UI] LogsRecentCallsView::swipeAngleToDirection() angle: ", - angle, " direction: ", direction ); - return direction; -} - -// ----------------------------------------------------------------------------- // LogsRecentCallsView::leftFlick // ----------------------------------------------------------------------------- // @@ -599,7 +578,8 @@ if (model() && model()->rowCount() > 0) { mEffectHandler->startMoveNotPossibleEffect(*mListView, false, mListViewX); } else { - mEffectHandler->startMoveNotPossibleEffect(*mEmptyListLabel, false, mListViewX); + mEffectHandler->startMoveNotPossibleEffect(*mEmptyListLabel, + false, mEmptyListLabelX); } } LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::leftFlick()" ); @@ -620,7 +600,8 @@ if (model() && model()->rowCount() > 0) { mEffectHandler->startMoveNotPossibleEffect(*mListView, true, mListViewX); } else { - mEffectHandler->startMoveNotPossibleEffect(*mEmptyListLabel, true, mListViewX); + mEffectHandler->startMoveNotPossibleEffect(*mEmptyListLabel, + true, mEmptyListLabelX); } } LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::rightFlick()" ); @@ -643,11 +624,13 @@ } mMoveLeftInList = mConversionMap.value(view) < mConversionMap.value(mCurrentView); - mAppearingView = view; + // Disable scrollbar while moving the list for more nice looks + mListView->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff); mEffectHandler->startDissappearAppearByFadingEffect(*mViewName); mEffectHandler->startDissappearAppearByMovingEffect( - *mListView, *mEmptyListLabel, !mMoveLeftInList, mListViewX); + *mListView, *mEmptyListLabel, !mMoveLeftInList, + mListViewX, mEmptyListLabelX); mPageIndicator->setActiveItemIndex(mConversionMap.value(mAppearingView)); @@ -677,11 +660,26 @@ { LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::dissappearByMovingComplete()" ) - updateView( mAppearingView ); + updateView( mAppearingView ); LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::dissappearByMovingComplete()" ) } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void LogsRecentCallsView::appearByMovingComplete() +{ + LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::appearByMovingComplete()" ) + + // Restore scrollbar which was hidden when animation started + mListView->setVerticalScrollBarPolicy(mListScrollBarPolicy); + + LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::appearByMovingComplete()" ) +} + // ----------------------------------------------------------------------------- // LogsRecentCallsView::updateMenu // ----------------------------------------------------------------------------- @@ -703,6 +701,8 @@ updateDialpadCallAndMessagingActions(); updateContactSearchAction(); + updateMenuVisibility(); + LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateMenu()" ); } @@ -727,7 +727,7 @@ if ( mListView ) { updateMenu(); updateListLayoutName(*mListView); - updateListSize(); + updateListSize(*mListView); LogsConfigurationParams param; param.setListItemTextWidth( getListItemTextWidth() ); mModel->updateConfiguration(param); @@ -815,18 +815,3 @@ } return mMarkingMissedAsSeen; } - -// ----------------------------------------------------------------------------- -// LogsRecentCallsView::scrollToTopItem -// ----------------------------------------------------------------------------- -// -void LogsRecentCallsView::scrollToTopItem() -{ - LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::scrollToTopItem()" ); - disconnect( mFilter, SIGNAL(rowsInserted(const QModelIndex&,int,int)), - this, SLOT(scrollToTopItem())); - if ( mFilter && mFilter->hasIndex(0,0) ) { - mListView->scrollTo( mFilter->index(0,0) ); - } - LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::scrollToTopItem()" ); -} diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/src/logsservicehandler.cpp --- a/logsui/logsapp/src/logsservicehandler.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/src/logsservicehandler.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -82,7 +82,7 @@ if (!dialpadText.isEmpty()) { emit activateView(dialpadText); } else { - emit activateView((LogsServices::LogsView)activatedView, showDialpad); + emit activateView((LogsServices::LogsView)activatedView, showDialpad, dialpadText); } LOGS_QDEBUG( "logs [UI] <- LogsServiceHandler::show()" ) return 0; diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/src/logsservicehandlerold.cpp --- a/logsui/logsapp/src/logsservicehandlerold.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/src/logsservicehandlerold.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -69,7 +69,7 @@ LOGS_QDEBUG( "logs [UI] Bring app to foreground" ) mMainWindow.bringAppToForeground(); - emit activateView((LogsServices::LogsView)activatedView, showDialpad); + emit activateView((LogsServices::LogsView)activatedView, showDialpad, QString()); LOGS_QDEBUG( "logs [UI] <- LogsServiceHandlerOld::start()" ) return 0; diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/src/logsviewmanager.cpp --- a/logsui/logsapp/src/logsviewmanager.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/src/logsviewmanager.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -56,22 +56,18 @@ this, SLOT(handleOrientationChanged()) ); mComponentsRepository = new LogsComponentRepository(*this); - initViews(); - connect( &mService, SIGNAL( activateView(LogsServices::LogsView, bool) ), - this, SLOT( changeRecentView(LogsServices::LogsView, bool) ) ); + connect( &mService, SIGNAL( activateView(LogsServices::LogsView, bool, QString) ), + this, SLOT( changeRecentViewViaService(LogsServices::LogsView, bool, QString) ) ); connect( &mService, SIGNAL( activateView(QString) ), - this, SLOT( changeMatchesView(QString) )); + this, SLOT( changeMatchesViewViaService(QString) )); - connect( &mServiceOld, SIGNAL( activateView(LogsServices::LogsView, bool) ), - this, SLOT( changeRecentView(LogsServices::LogsView, bool) ) ); + connect( &mServiceOld, SIGNAL( activateView(LogsServices::LogsView, bool, QString) ), + this, SLOT( changeRecentViewViaService(LogsServices::LogsView, bool, QString) ) ); connect( &mServiceOld, SIGNAL( activateView(QString) ), - this, SLOT( changeMatchesView(QString) )); - - connect( &mMainWindow, SIGNAL(appFocusGained()), this, SLOT(appFocusGained()) ); - connect( &mMainWindow, SIGNAL(appFocusLost()), this, SLOT(appFocusLost()) ); + this, SLOT( changeMatchesViewViaService(QString) )); QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); @@ -95,84 +91,40 @@ } // ----------------------------------------------------------------------------- -// LogsViewManager::initViews +// LogsViewManager::changeRecentViewViaService // ----------------------------------------------------------------------------- // -void LogsViewManager::initViews() +void LogsViewManager::changeRecentViewViaService( + LogsServices::LogsView view, bool showDialpad, QString dialpadText) { - LOGS_QDEBUG( "logs [UI] -> LogsViewManager::initViews()" ); - - // Don't activate any view, app focus gaining or service request - // will cause view activation - // - LogsRecentCallsView* view = mComponentsRepository->recentCallsView(); - Q_ASSERT_X(view != 0, "logs [UI] ", "recentCallsView not found!"); - LOGS_QDEBUG( "logs [UI] adding view" ); - mViewStack.append(view); - mMainWindow.addView(view); - - LogsDetailsView* detailsView = mComponentsRepository->detailsView(); - mViewStack.append(detailsView); - mMainWindow.addView(detailsView); - - LogsMatchesView* matchesView = mComponentsRepository->matchesView(); - mViewStack.append(matchesView); - mMainWindow.addView(matchesView); + mComponentsRepository->dialpad()->editor().setText(dialpadText); + changeRecentView(view, showDialpad); +} - LOGS_QDEBUG( "logs [UI] <- LogsViewManager::initViews()" ); +// ----------------------------------------------------------------------------- +// LogsViewManager::changeMatchesViewViaService +// ----------------------------------------------------------------------------- +// +void LogsViewManager::changeMatchesViewViaService(QString dialpadText) +{ + LOGS_QDEBUG( "logs [UI] -> LogsViewManager::changeMatchesView()" ); + mComponentsRepository->dialpad()->editor().setText(dialpadText); + doActivateView(LogsMatchesViewId, true, QVariant()); + LOGS_QDEBUG( "logs [UI] <- LogsViewManager::changeMatchesView()" ); } // ----------------------------------------------------------------------------- // LogsViewManager::changeRecentView // ----------------------------------------------------------------------------- // -void LogsViewManager::changeRecentView(LogsServices::LogsView view, bool showDialpad) +void LogsViewManager::changeRecentView( + LogsServices::LogsView view, bool showDialpad) { QVariant args(view); doActivateView(LogsRecentViewId, showDialpad, args); } // ----------------------------------------------------------------------------- -// LogsViewManager::changeMatchesView -// ----------------------------------------------------------------------------- -// -void LogsViewManager::changeMatchesView(QString dialpadText) -{ - LOGS_QDEBUG( "logs [UI] -> LogsViewManager::changeMatchesView()" ); - doActivateView(LogsMatchesViewId, true, QVariant(), dialpadText); - LOGS_QDEBUG( "logs [UI] <- LogsViewManager::changeMatchesView()" ); -} - -// ----------------------------------------------------------------------------- -// LogsViewManager::appFocusGained -// Activate recent view if gaining focus first time and app was not started -// via highway service. If app was started by using service request, -// wait the request to appear before activating view. -// ----------------------------------------------------------------------------- -// -void LogsViewManager::appFocusGained() -{ - LOGS_QDEBUG( "logs [UI] -> LogsViewManager::appFocusGained()" ); - - foreach ( LogsBaseView* view, mViewStack ){ - disconnect( view, SIGNAL(exitAllowed()), this, SLOT(proceedExit()) ); - } - - LOGS_QDEBUG( "logs [UI] <- LogsViewManager::appFocusGained()" ); -} - -// ----------------------------------------------------------------------------- -// LogsViewManager::appFocusLost -// ----------------------------------------------------------------------------- -// -void LogsViewManager::appFocusLost() -{ - LOGS_QDEBUG( "logs [UI] -> LogsViewManager::appFocusLost()" ); - - LOGS_QDEBUG( "logs [UI] <- LogsViewManager::appFocusLost()" ); -} - -// ----------------------------------------------------------------------------- // LogsViewManager::proceedExit // ----------------------------------------------------------------------------- // @@ -180,11 +132,6 @@ { LOGS_QDEBUG( "logs [UI] -> LogsViewManager::proceedExit()" ); - // Instead of compressing data, exit the application for real because - // of bug in wk16 platform which prevents bg/fg switching of the app. - // - - //mComponentsRepository->model()->compressData(); qApp->quit(); LOGS_QDEBUG( "logs [UI] <- LogsViewManager::proceedExit()" ); @@ -257,10 +204,9 @@ // bool LogsViewManager::activatePreviousView() { - if ( mViewStack.count() < 2 ){ - return false; - } - return doActivateView(mViewStack.at(1)->viewId(), false, QVariant()); + LogsAppViewId viewId = ( mViewStack.count() > 1 ) ? + mViewStack.at(1)->viewId() : LogsRecentViewId; + return doActivateView(viewId, false, QVariant()); } // ----------------------------------------------------------------------------- @@ -287,6 +233,10 @@ } } + if ( !newView ){ + newView = createView(viewId); + } + if ( oldView && newView && oldView != newView ){ oldView->deactivated(); disconnect( &mMainWindow, SIGNAL( callKeyPressed() ), oldView, 0 ); @@ -295,6 +245,9 @@ if ( newView ){ mViewStack.insert(0, newView); mMainWindow.setCurrentView(newView); + //Setting mainwindow interactive to enable user input during + //view switching animation. + mMainWindow.setInteractive(true); mViewActivationArgs = args; mViewActivationShowDialpad = showDialpad; completeViewActivation(); @@ -358,12 +311,23 @@ } QVariantHash metaData; - metaData.insert("screenshot", QPixmap::grabWidget(&mMainWindow, mMainWindow.rect())); + + LOGS_QDEBUG( "logs [UI] Start taking screenshot" ); + QImage* img = new QImage(mMainWindow.rect().size(), QImage::Format_ARGB32_Premultiplied); + QPainter p( img ); + // Use render instead of QPixmap::grabWidget as otherwise screenshot + // may become empty. + mMainWindow.render( &p, mMainWindow.rect(), mMainWindow.rect() ); + metaData.insert("screenshot", QPixmap::fromImage(*img)); + delete img; + LOGS_QDEBUG( "logs [UI] End taking screenshot" ); QByteArray serializedActivity; QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); metaData.insert( + logsActivityParamInternalViewId, mViewStack.at(0)->viewId() ); + metaData.insert( logsActivityParamShowDialpad, mComponentsRepository->dialpad()->isOpen() ); metaData.insert( logsActivityParamDialpadText, mComponentsRepository->dialpad()->editor().text() ); @@ -400,6 +364,16 @@ } } + QList allParams = hbApp->activityManager()->activities(); + QVariantHash params = allParams.isEmpty() ? QVariantHash() : allParams.at(0); + LOGS_QDEBUG_2( "logs [UI] Activity params", params ); + + if ( !matchingView ){ + // Try if creating such view is possible + int viewId = params.value(logsActivityParamInternalViewId).toInt(); + matchingView = createView(static_cast(viewId)); + } + if ( matchingView ){ // Should have only one param hash in the list, use first always QList allParams = hbApp->activityManager()->activities(); @@ -426,8 +400,7 @@ LogsAppViewId viewId, const QString& dialpadText) { if ( !dialpadText.isEmpty() ){ - Dialpad* dialpad = mComponentsRepository->dialpad(); - dialpad->editor().setText(dialpadText); + mComponentsRepository->dialpad()->editor().setText(dialpadText); } if ( viewId == LogsMatchesViewId ){ @@ -467,3 +440,23 @@ } LOGS_QDEBUG( "logs [UI] <- LogsViewManager::handleFirstActivation()" ); } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +LogsBaseView* LogsViewManager::createView(LogsAppViewId viewId) +{ + LogsBaseView* newView = 0; + if ( viewId == LogsRecentViewId ){ + newView = mComponentsRepository->recentCallsView(); + mMainWindow.addView(newView); + } else if ( viewId == LogsMatchesViewId ) { + newView = mComponentsRepository->matchesView(); + mMainWindow.addView(newView); + } else if ( viewId == LogsDetailsViewId ) { + newView = mComponentsRepository->detailsView(); + mMainWindow.addView(newView); + } + return newView; +} diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsbaseview.h --- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsbaseview.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsbaseview.h Thu Jun 24 14:44:14 2010 +0300 @@ -67,7 +67,8 @@ void testInitiateCallback(); void testShowListItemMenu(); void testPopulateListItemMenu(); - void testCloseEmptyMenu(); + void testUpdateMenuVisibility(); + void testSetMenuVisible(); void testSaveContact(); void testUpdateCall(); void testUpdateMessage(); @@ -89,6 +90,7 @@ void testSaveActivity(); void testLoadActivity(); void testClearActivity(); + void testEnsureListPositioning(); private: diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/inc/ut_logscomponentrepository.h --- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logscomponentrepository.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logscomponentrepository.h Thu Jun 24 14:44:14 2010 +0300 @@ -56,6 +56,7 @@ void testDialpad(); void testLoadSection(); void testAddToolbarToObjectList(); + void testLazyInit(); private: diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsrecentcallsview.h --- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsrecentcallsview.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsrecentcallsview.h Thu Jun 24 14:44:14 2010 +0300 @@ -64,7 +64,6 @@ void testOpenDialpad(); void testDialpadEditorTextChanged(); void testGestureEvent(); - void testSwipeAngleToDirection(); void testViewChangeByFlicking(); void testModel(); void testShowListItemMenu(); diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsviewmanager.h --- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsviewmanager.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsviewmanager.h Thu Jun 24 14:44:14 2010 +0300 @@ -53,8 +53,8 @@ void testConstructorDestructor(); void testActivateView(); void testchangeMatchesView(); + void testchangeRecentView(); void testExitApplication(); - void testAppFocusGained(); void testStartingWithService(); void testHandleOrientationChanged(); void testCompleteViewActivation(); diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsforegroundwatcher.cpp --- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsforegroundwatcher.cpp Fri Jun 11 13:38:41 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "logsforegroundwatcher.h" - -// ----------------------------------------------------------------------------- -// Currently no other way to monitor app foreground/background switches. -// HbForegroundWatcher might become public at some point which could be then -// used instead. -// ----------------------------------------------------------------------------- -// -LogsForegroundWatcher::LogsForegroundWatcher(QObject* parent) : QObject(parent) -{ -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void LogsForegroundWatcher::HandleGainingForeground() -{ - emit gainingForeground(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void LogsForegroundWatcher::HandleLosingForeground() -{ - emit losingForeground(); -} - diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsforegroundwatcher.h --- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsforegroundwatcher.h Fri Jun 11 13:38:41 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef LOGSFOREGROUNDWATCHER_H -#define LOGSFOREGROUNDWATCHER_H - - -#include - -class LogsForegroundWatcher : public QObject -{ - Q_OBJECT - -public: - - LogsForegroundWatcher(QObject* parent = 0); - virtual ~LogsForegroundWatcher(){} - -signals: - void gainingForeground(); - void losingForeground(); - -public: // from MCoeForegroundObserver - void HandleGainingForeground(); - void HandleLosingForeground(); - -}; - -#endif //LOGSFOREGROUNDWATCHER_H diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/src/ut_logsbaseview.cpp --- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsbaseview.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsbaseview.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -80,6 +80,7 @@ QVERIFY( !mBaseView->mMessage ); QVERIFY( !mBaseView->mContact ); QVERIFY( !mBaseView->mCallTypeMapper ); + QVERIFY( !mBaseView->mOptionsMenu ); } void UT_LogsBaseView::testActivated() @@ -273,30 +274,71 @@ QVERIFY( HbStubHelper::widgetActionsCount() == 5 ); } - - -void UT_LogsBaseView::testCloseEmptyMenu() +void UT_LogsBaseView::testUpdateMenuVisibility() { - LogsRecentCallsView* view = mRepository->recentCallsView(); - - //visible actions exist - QVERIFY( view->menu()->actions().count() > 0 ); - HbStubHelper::setWidgetOpen(true); - view->closeEmptyMenu(); - QVERIFY(HbStubHelper::isWidgetOpen()); + HbMenu* menu = new HbMenu; + HbAction* action = menu->addAction("action1"); + mBaseView->setMenu(menu); - //no visible actions - foreach (QAction* action, view->menu()->actions()) { - action->setVisible(false); - } - view->closeEmptyMenu(); - QVERIFY(!HbStubHelper::isWidgetOpen()); + // No visible actions in menu => menu is replaced by empty one + QVERIFY(!mBaseView->mOptionsMenu); + QVERIFY(!mBaseView->menu()->isEmpty()); + action->setVisible(false); + mBaseView->updateMenuVisibility(); + QVERIFY(mBaseView->menu()->isEmpty()); + QVERIFY(mBaseView->mOptionsMenu == menu); + QVERIFY(mBaseView->menu() != menu); + + // Visible action exists => restoring the menu + action->setVisible(true); + QVERIFY(mBaseView->mOptionsMenu); + mBaseView->updateMenuVisibility(); + QVERIFY(!mBaseView->menu()->isEmpty()); + QVERIFY(!mBaseView->mOptionsMenu); + QVERIFY(mBaseView->menu() == menu); + + // Menu has no actions => menu is replaced by empty one + mBaseView->setMenu(0); + menu = mBaseView->menu(); + QVERIFY(!mBaseView->mOptionsMenu); + QVERIFY(mBaseView->menu()->isEmpty()); + mBaseView->updateMenuVisibility(); + QVERIFY(mBaseView->menu()->isEmpty()); + QVERIFY(mBaseView->mOptionsMenu == menu); + QVERIFY(mBaseView->menu() != menu); +} + +void UT_LogsBaseView::testSetMenuVisible() +{ + HbMenu* menu = new HbMenu; + menu->addAction("action1"); + mBaseView->setMenu(menu); - //no actions - HbStubHelper::setWidgetOpen(true); - view->menu()->actions().clear(); - view->closeEmptyMenu(); - QVERIFY(!HbStubHelper::isWidgetOpen()); + // Hiding menu, view menu is replaced by empty menu + QVERIFY(!mBaseView->mOptionsMenu); + QVERIFY(!mBaseView->menu()->isEmpty()); + mBaseView->setMenuVisible(false); + QVERIFY(mBaseView->menu()->isEmpty()); + QVERIFY(mBaseView->mOptionsMenu == menu); + QVERIFY(mBaseView->menu() != menu); + + // Trying to hide again, nothing happens + mBaseView->setMenuVisible(false); + QVERIFY(mBaseView->menu()->isEmpty()); + QVERIFY(mBaseView->mOptionsMenu == menu); + QVERIFY(mBaseView->menu() != menu); + + // Showing menu, original menu is restored + mBaseView->setMenuVisible(true); + QVERIFY(!mBaseView->menu()->isEmpty()); + QVERIFY(!mBaseView->mOptionsMenu); + QVERIFY(mBaseView->menu() == menu); + + // Showing again, nothing happen + mBaseView->setMenuVisible(true); + QVERIFY(!mBaseView->menu()->isEmpty()); + QVERIFY(!mBaseView->mOptionsMenu); + QVERIFY(mBaseView->menu() == menu); } void UT_LogsBaseView::testSaveContact() @@ -409,23 +451,24 @@ mBaseView->mLayoutSectionName = "dummy"; //default section is loaded + HbListView view; mBaseView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); mBaseView->mDialpad->closeDialpad(); - mBaseView->updateListSize(); + mBaseView->updateListSize(view); QVERIFY( mBaseView->mLayoutSectionName == logsViewDefaultSection ); //same section again, not loaded - mBaseView->updateListSize(); + mBaseView->updateListSize(view); QVERIFY( mBaseView->mLayoutSectionName == logsViewDefaultSection ); //portrait with dialpad mBaseView->mDialpad->openDialpad(); - mBaseView->updateListSize(); + mBaseView->updateListSize(view); QVERIFY( mBaseView->mLayoutSectionName == logsViewPortraitDialpadSection ); //landscape with dialpad mBaseView->mViewManager.mainWindow().setOrientation( Qt::Horizontal ); - mBaseView->updateListSize(); + mBaseView->updateListSize(view); QVERIFY( mBaseView->mLayoutSectionName == logsViewLandscapeDialpadSection ); } @@ -571,3 +614,75 @@ mBaseView->clearActivity(*manager); QCOMPARE( manager->activities().count(), 0 ); } + +void UT_LogsBaseView::testEnsureListPositioning() +{ + HbStubHelper::reset(); + HbListView list; + QStringList itemTexts; + itemTexts.append( "foo1" ); + itemTexts.append( "foo2" ); + QStringListModel model; + model.setStringList(itemTexts); + + itemTexts.append( "foo3" ); + itemTexts.append( "foo4" ); + QStringListModel model2; + model2.setStringList(itemTexts); + + list.setModel(&model); + + // No content found, nop + mBaseView->ensureListPositioning(list); + QVERIFY( !HbStubHelper::listEnsureVisibleCalled() ); + QVERIFY( !HbStubHelper::listScrollToCalled() ); + + // Content found, no visible items, nop + mRepository->recentCallsView(); + mBaseView->activated(false, QVariant()); + mBaseView->ensureListPositioning(list); + QVERIFY( !HbStubHelper::listEnsureVisibleCalled() ); + QVERIFY( !HbStubHelper::listScrollToCalled() ); + + // Content found and visible items which can fit the screen, height of item zero, nop + HbWidget* content = + qobject_cast( mRepository->findWidget( logsContentId ) ); + content->setContentsMargins(0,0,0,0); + content->setGeometry( QRectF(0,0,100,200) ); + + HbListViewItem* item = new HbListViewItem; + HbStubHelper::listItems().append(item); + HbListViewItem* item2 = new HbListViewItem; + HbStubHelper::listItems().append(item2); + mBaseView->ensureListPositioning(list); + QVERIFY( !HbStubHelper::listEnsureVisibleCalled() ); + QVERIFY( !HbStubHelper::listScrollToCalled() ); + + // Screen is already filled with items, nop + list.setModel(&model2); + HbListViewItem* item3 = new HbListViewItem; + HbStubHelper::listItems().append(item3); + item->setGeometry(QRectF(0,0,100,100)); + item2->setGeometry(QRectF(0,0,100,100)); + item3->setGeometry(QRectF(0,0,100,100)); + mBaseView->ensureListPositioning(list); + QVERIFY( !HbStubHelper::listEnsureVisibleCalled() ); + QVERIFY( !HbStubHelper::listScrollToCalled() ); + + // Content found and visible items which can fit the screen, all items ensured visible + list.setModel(&model); + delete HbStubHelper::listItems().takeLast(); + mBaseView->ensureListPositioning(list); + QVERIFY( HbStubHelper::listEnsureVisibleCalled() ); + QVERIFY( !HbStubHelper::listScrollToCalled() ); + + // Content found and more visible items which can fit the screen and currently screen + // is not full of items, ensure that area is filled by scrolling + list.setModel(&model2); + list.setCurrentIndex(model2.index(0,0)); + delete HbStubHelper::listItems().takeLast(); + mBaseView->ensureListPositioning(list); + QVERIFY( HbStubHelper::listEnsureVisibleCalled() ); + QVERIFY( HbStubHelper::listScrollToCalled() ); + +} diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/src/ut_logscomponentrepository.cpp --- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logscomponentrepository.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logscomponentrepository.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -151,3 +151,19 @@ QVERIFY( mRepository->mRecentViewComponents.at(0)->objectName() == logsToolbarId ); delete view; } + +void UT_LogsComponentRepository::testLazyInit() +{ + QObjectList dummyObjList; + mRepository->mCurrentObjectTree = &dummyObjList; + QVERIFY( !mRepository->mRecentCallsView ); + QVERIFY( !mRepository->mDetailsView ); + QVERIFY( !mRepository->mMatchesView ); + QVERIFY( !mRepository->model()->mRefreshCalled ); + mRepository->lazyInit(); + QVERIFY( mRepository->mRecentCallsView ); + QVERIFY( mRepository->mDetailsView ); + QVERIFY( mRepository->mMatchesView ); + QVERIFY( mRepository->model()->mRefreshCalled ); + QVERIFY( mRepository->mCurrentObjectTree == &dummyObjList ); +} diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/src/ut_logseffecthandler.cpp --- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logseffecthandler.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logseffecthandler.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -77,7 +77,7 @@ void UT_LogsEffectHandler::testStartDissappearAppearByMovingEffect() { QVERIFY( mEffect->mMoveGroup->state() == QAbstractAnimation::Stopped ); - mEffect->startDissappearAppearByMovingEffect(*mLabel, *mLabel2, false, 0); + mEffect->startDissappearAppearByMovingEffect(*mLabel, *mLabel2, false, 0, 0); QVERIFY( mEffect->mMoveGroup->state() == QAbstractAnimation::Running ); QVERIFY( mEffect->mMoveGroup2->state() == QAbstractAnimation::Running ); @@ -90,7 +90,7 @@ QVERIFY(spy.count() == 1 ); // When effect is running and new effect is requested, previous effect is stopped - mEffect->startDissappearAppearByMovingEffect(*mLabel, *mLabel2, true, 0); + mEffect->startDissappearAppearByMovingEffect(*mLabel, *mLabel2, true, 0, 0); } void UT_LogsEffectHandler::testStartMoveNotPossibleEffect() diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmatchesview.cpp --- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmatchesview.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmatchesview.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -77,7 +77,7 @@ { //activate for the first time mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); - mRepository->matchesView(); + LogsMatchesView* view = mRepository->matchesView(); QVERIFY( !mMatchesView->mInitialized ); QVERIFY( !mMatchesView->mListView ); QVERIFY( !mMatchesView->mModel ); @@ -90,6 +90,7 @@ QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout ); QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection ); QVERIFY( mMatchesView->mAddToContactsButton ); + QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); //activate once again, model recreated mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal ); @@ -101,6 +102,7 @@ QVERIFY( mMatchesView->mActionMap.count() == 4 ); QVERIFY( mMatchesView->mListView->layoutName() == logsListLandscapeDialpadLayout ); QVERIFY( mMatchesView->mLayoutSectionName == logsViewLandscapeDialpadSection ); + QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); //Pass model as input arg LogsDbConnector* dbConnector = 0; @@ -119,12 +121,14 @@ QVERIFY( mMatchesView->mListView ); QVERIFY( mMatchesView->mModel == model2 ); QVERIFY( mMatchesView->mModel->mLastCall.isEmpty() ); + QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); // After passing model as input arg, do not pass model mMatchesView->activated( true,QVariant() ); QVERIFY( mMatchesView->mListView ); QVERIFY( mMatchesView->mModel ); QVERIFY( mMatchesView->mModel->mLastCall == QLatin1String("constructor") ); + delete view; } @@ -240,17 +244,18 @@ //text erased from input, view changed to recent calls mMatchesView->mDialpad->editor().setText( QString("") ); + mMatchesView->dialpadEditorTextChanged(); QVERIFY( mViewManager->mViewId == LogsRecentViewId ); } void UT_LogsMatchesView::testDialpadClosed() { + LogsMatchesView* view = mRepository->matchesView(); mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal ); - mMatchesView->mListView = new HbListView(); + mMatchesView->initView(); mMatchesView->mLayoutSectionName = QString("landscape_dialpad"); QString hello("hello"); mMatchesView->mDialpad->editor().setText( hello ); - mMatchesView->mAddToContactsButton = new HbPushButton(); mMatchesView->mAddToContactsButton->setVisible(true); mMatchesView->dialpadClosed(); @@ -258,21 +263,18 @@ QVERIFY( mMatchesView->mDialpad->editor().text() == hello ); QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection ); QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); - delete mMatchesView->mListView; - mMatchesView->mListView = 0; - delete mMatchesView->mAddToContactsButton; - mMatchesView->mAddToContactsButton = 0; + delete view; } void UT_LogsMatchesView::testDialpadOpened() { //widgets size and layout updated + LogsMatchesView* view = mRepository->matchesView(); mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); - mMatchesView->mListView = new HbListView(); + mMatchesView->initView(); mMatchesView->mLayoutSectionName = QString("dummy"); mMatchesView->mListView->setLayoutName("dummy"); mMatchesView->mDialpad->mIsOpen = true; - mMatchesView->mAddToContactsButton = new HbPushButton(); mMatchesView->mAddToContactsButton->setVisible(false); mMatchesView->mDialpad->editor().setText( "hello" ); mMatchesView->mDialpad->mIsOpen = true; @@ -282,10 +284,7 @@ QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout ); QVERIFY( mMatchesView->mLayoutSectionName == logsViewPortraitDialpadSection ); QVERIFY( mMatchesView->mAddToContactsButton->isVisible() ); - delete mMatchesView->mListView; - mMatchesView->mListView = 0; - delete mMatchesView->mAddToContactsButton; - mMatchesView->mAddToContactsButton = 0; + delete view; } void UT_LogsMatchesView::testModel() @@ -304,7 +303,7 @@ mMatchesView->updateWidgetsSizeAndLayout(); //listView exists, layout and size updated, dialpad not visible - mRepository->matchesView(); + LogsMatchesView* view = mRepository->matchesView(); mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); mMatchesView->mDialpad->closeDialpad(); mMatchesView->mListView = new HbListView(); @@ -331,14 +330,16 @@ QVERIFY( messageAction->isVisible() ); delete mMatchesView->mListView; - mMatchesView->mListView = 0; -} + mMatchesView->mListView = 0; + delete view; + } void UT_LogsMatchesView::testHandleOrientationChanged() { //dialpad position recalculated and layout/size updated QPointF pos; - mMatchesView->mListView = new HbListView(); + LogsMatchesView* view = mRepository->matchesView(); + mMatchesView->initView(); mMatchesView->mListView->setLayoutName("dummy"); mMatchesView->mLayoutSectionName = "dummy"; mMatchesView->mDialpad->setPos(pos); @@ -349,8 +350,7 @@ QVERIFY( pos != mMatchesView->mDialpad->pos() ); QVERIFY( mMatchesView->mListView->layoutName() == logsListLandscapeLayout ); QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection ); - delete mMatchesView->mListView; - mMatchesView->mListView = 0; + delete view; } void UT_LogsMatchesView::testUpdateEmptyListWidgetsVisibility() @@ -369,6 +369,12 @@ QVERIFY( mMatchesView->mEmptyListLabel->isVisible() ); QVERIFY( mMatchesView->mAddToContactsButton->isVisible() ); + + mMatchesView->mAddToContactsButtonDisabled = true; + mMatchesView->updateEmptyListWidgetsVisibility(); + QVERIFY( mMatchesView->mEmptyListLabel->isVisible() ); + QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); + delete mMatchesView->mEmptyListLabel; mMatchesView->mEmptyListLabel = 0; delete mMatchesView->mAddToContactsButton; @@ -433,7 +439,8 @@ status = view->mModel->predictiveSearchStatus(); QVERIFY( status == 2 ); QVERIFY( mViewManager->mViewId == LogsRecentViewId ); - QVERIFY( mMatchesView->mDialpad->editor().text() == "1234" ); + QVERIFY( mMatchesView->mDialpad->editor().text() == "1234" ); + delete view; } diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/src/ut_logsrecentcallsview.cpp --- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsrecentcallsview.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsrecentcallsview.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -32,7 +32,7 @@ //SYSTEM #include -#include +#include #include #include #include @@ -251,11 +251,15 @@ HbAction* action = new HbAction(); action->setObjectName(logsShowFilterMissedMenuActionId); mRecentCallsView->changeFilter(action); + // Scrollbar is disbaled while changing the list and is restored when appearByMoving slot is called + QVERIFY( mRecentCallsView->mListView->verticalScrollBarPolicy() == HbScrollArea::ScrollBarAlwaysOff ); // Because of effects, filter is not changed immediately, simulate effect completion QVERIFY( mRecentCallsView->mAppearingView == LogsServices::ViewMissed ); mRecentCallsView->dissappearByMovingComplete(); - QVERIFY( mRecentCallsView->mFilter->filterType() == LogsFilter::Missed ); + QVERIFY( mRecentCallsView->mFilter->filterType() == LogsFilter::Missed ); + mRecentCallsView->appearByMovingComplete(); + QVERIFY( mRecentCallsView->mListView->verticalScrollBarPolicy() != HbScrollArea::ScrollBarAlwaysOff ); delete action; delete mRecentCallsView->mListView; @@ -393,9 +397,8 @@ view->activated( false, QVariant(LogsServices::ViewCalled) ); view->mCurrentView = LogsServices::ViewCalled; view->mAppearingView = LogsServices::ViewCalled; - mRecentCallsView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); - QSwipeGesture* swipe = new QSwipeGesture(); + HbSwipeGesture* swipe = new HbSwipeGesture(); QList list; QGestureEvent event(list); event.ignore(Qt::SwipeGesture); @@ -404,7 +407,8 @@ QVERIFY(!event.isAccepted(Qt::SwipeGesture)); view->gestureEvent(&event); QVERIFY(!event.isAccepted(Qt::SwipeGesture)); - QVERIFY(view->mAppearingView == LogsServices::ViewCalled); + QCOMPARE(view->mCurrentView, LogsServices::ViewCalled); + QCOMPARE(view->mAppearingView, LogsServices::ViewCalled); //swipe gesture in event, but gesture isn't finished list.append(swipe); @@ -414,86 +418,36 @@ QVERIFY(swipe->state() != Qt::GestureFinished); view->gestureEvent(&event2); QVERIFY(!event2.isAccepted(Qt::SwipeGesture)); - QVERIFY(view->mAppearingView == LogsServices::ViewCalled); + QCOMPARE(view->mCurrentView, LogsServices::ViewCalled); + QCOMPARE(view->mAppearingView, LogsServices::ViewCalled); - //vertical orientation swipe right up + //swipe right HbStubHelper::setGestureState(Qt::GestureFinished); event2.setAccepted(Qt::SwipeGesture, false); - swipe->setSwipeAngle(10); + swipe->setSceneSwipeAngle(10); view->gestureEvent(&event2); - QVERIFY( view->mAppearingView == LogsServices::ViewAll ); + QCOMPARE(view->mCurrentView, LogsServices::ViewCalled); + QCOMPARE(view->mAppearingView, LogsServices::ViewAll ); QVERIFY( event2.isAccepted(Qt::SwipeGesture) ); - //vertical orientation swipe left up - event2.setAccepted(Qt::SwipeGesture, false); - swipe->setSwipeAngle(170); - view->gestureEvent(&event2); - QVERIFY(view->mAppearingView == LogsServices::ViewReceived); - QVERIFY(event2.isAccepted(Qt::SwipeGesture)); - - //vertical orientation swipe down, nothing happens + //swipe left event2.setAccepted(Qt::SwipeGesture, false); - swipe->setSwipeAngle(70); - view->mAppearingView = view->mCurrentView; + swipe->setSceneSwipeAngle(170); view->gestureEvent(&event2); - QVERIFY(view->mAppearingView == LogsServices::ViewCalled); - QVERIFY(!event2.isAccepted(Qt::SwipeGesture)); - - //horizontal orientation swipe right up - mRecentCallsView->mViewManager.mainWindow().setOrientation( Qt::Horizontal ); - event2.setAccepted(Qt::SwipeGesture, false); - swipe->setSwipeAngle(80); - view->gestureEvent(&event2); - QVERIFY(view->mAppearingView == LogsServices::ViewReceived); + QCOMPARE(view->mCurrentView, LogsServices::ViewCalled); + QCOMPARE(view->mAppearingView, LogsServices::ViewReceived); QVERIFY(event2.isAccepted(Qt::SwipeGesture)); - //horizontal orientation swipe right down + //swipe down, nothing happens event2.setAccepted(Qt::SwipeGesture, false); - swipe->setSwipeAngle(280); - view->gestureEvent(&event2); - QVERIFY(view->mAppearingView == LogsServices::ViewAll); - QVERIFY(event2.isAccepted(Qt::SwipeGesture)); - - //horizontal orientation swipe left, nothing happens - event2.setAccepted(Qt::SwipeGesture, false); - swipe->setSwipeAngle(200); + swipe->setSceneSwipeAngle(70); view->mAppearingView = view->mCurrentView; view->gestureEvent(&event2); - QVERIFY(view->mAppearingView == LogsServices::ViewCalled); + QCOMPARE(view->mCurrentView, LogsServices::ViewCalled); + QCOMPARE(view->mAppearingView, LogsServices::ViewCalled); QVERIFY(!event2.isAccepted(Qt::SwipeGesture)); } -void UT_LogsRecentCallsView::testSwipeAngleToDirection() -{ - int delta = 30; - QCOMPARE(mRecentCallsView->swipeAngleToDirection(61, delta), QSwipeGesture::Up); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(119, delta), QSwipeGesture::Up); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(90, delta), QSwipeGesture::Up); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(60, delta), QSwipeGesture::NoDirection); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(120, delta), QSwipeGesture::NoDirection); - - QCOMPARE(mRecentCallsView->swipeAngleToDirection(241, delta), QSwipeGesture::Down); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(299, delta), QSwipeGesture::Down); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(270, delta), QSwipeGesture::Down); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(300, delta), QSwipeGesture::NoDirection); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(240, delta), QSwipeGesture::NoDirection); - - QCOMPARE(mRecentCallsView->swipeAngleToDirection(29, delta), QSwipeGesture::Right); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(331, delta), QSwipeGesture::Right); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(0, delta), QSwipeGesture::Right); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(360, delta), QSwipeGesture::Right); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(30, delta), QSwipeGesture::NoDirection); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(330, delta), QSwipeGesture::NoDirection); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(361, delta), QSwipeGesture::NoDirection); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(-1, delta), QSwipeGesture::NoDirection); - - QCOMPARE(mRecentCallsView->swipeAngleToDirection(151, delta), QSwipeGesture::Left); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(209, delta), QSwipeGesture::Left); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(180, delta), QSwipeGesture::Left); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(150, delta), QSwipeGesture::NoDirection); - QCOMPARE(mRecentCallsView->swipeAngleToDirection(210, delta), QSwipeGesture::NoDirection); -} - void UT_LogsRecentCallsView::testViewChangeByFlicking() { // At leftmost list, moving to left not possible diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/src/ut_logsservicehandler.cpp --- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsservicehandler.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsservicehandler.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -89,7 +89,7 @@ void UT_LogsServiceHandler::testStart() { qRegisterMetaType< LogsServices::LogsView >("LogsServices::LogsView"); - QSignalSpy spy(mServiceOld, SIGNAL(activateView(LogsServices::LogsView, bool))); + QSignalSpy spy(mServiceOld, SIGNAL(activateView(LogsServices::LogsView, bool, QString))); // Wrong view QVERIFY( mServiceOld->start( 9999, true ) != 0 ); @@ -121,7 +121,7 @@ void UT_LogsServiceHandler::testShow() { qRegisterMetaType< LogsServices::LogsView >("LogsServices::LogsView"); - QSignalSpy spy(mService, SIGNAL(activateView(LogsServices::LogsView, bool))); + QSignalSpy spy(mService, SIGNAL(activateView(LogsServices::LogsView, bool, QString))); QSignalSpy spy2(mService, SIGNAL(activateView(QString))); QVariantMap map; diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/src/ut_logsviewmanager.cpp --- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsviewmanager.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsviewmanager.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -68,37 +68,39 @@ { QVERIFY( mLogsViewManager ); QVERIFY( mLogsViewManager->mComponentsRepository ); - QVERIFY( mLogsViewManager->mMainWindow.views().count() == 3 ); + QVERIFY( mLogsViewManager->mMainWindow.views().count() == 1 ); QVERIFY( mLogsViewManager->mMainWindow.currentView() != 0 ); QVERIFY( static_cast( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsRecentViewId ); - QVERIFY( mLogsViewManager->mViewStack.count() == 3 ); + QVERIFY( mLogsViewManager->mViewStack.count() == 1 ); delete mLogsViewManager; mLogsViewManager = 0; // Contructor when activity restoring started the app + delete mMainWindow; + mMainWindow = 0; + mMainWindow = new LogsMainWindow(); HbStubHelper::setActivityReason(Hb::ActivationReasonActivity); mLogsViewManager = new LogsViewManager(*mMainWindow, *mService, *mServiceOld); QVERIFY( mLogsViewManager->mComponentsRepository ); - QVERIFY( mLogsViewManager->mMainWindow.currentView() != 0 ); - QVERIFY( static_cast( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsMatchesViewId ); - QVERIFY( mLogsViewManager->mViewStack.count() == 3 ); + QVERIFY( static_cast( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsRecentViewId ); + QVERIFY( mLogsViewManager->mViewStack.count() == 1 ); HbStubHelper::reset(); +} -} void UT_LogsViewManager::testActivateView() { // Activate already active view QVERIFY( mLogsViewManager->activateView(LogsRecentViewId) ); QVERIFY( mLogsViewManager->activateView(LogsRecentViewId) ); - QCOMPARE( mLogsViewManager->mMainWindow.views().count(), 3 ); + QCOMPARE( mLogsViewManager->mMainWindow.views().count(), 1 ); QVERIFY( mLogsViewManager->mMainWindow.currentView() == mLogsViewManager->mComponentsRepository->recentCallsView() ); // Activate other view QVERIFY( mLogsViewManager->activateView(LogsDetailsViewId) ); - QVERIFY( mLogsViewManager->mMainWindow.views().count() == 3 ); + QVERIFY( mLogsViewManager->mMainWindow.views().count() == 2 ); QVERIFY( mLogsViewManager->mMainWindow.currentView() == mLogsViewManager->mComponentsRepository->detailsView() ); QVERIFY( mLogsViewManager->mViewStack.at(0) == @@ -106,7 +108,7 @@ // Try to activate unknown view QVERIFY( !mLogsViewManager->activateView(LogsUnknownViewId) ); - QVERIFY( mLogsViewManager->mMainWindow.views().count() == 3 ); + QVERIFY( mLogsViewManager->mMainWindow.views().count() == 2 ); QVERIFY( mLogsViewManager->mMainWindow.currentView() == mLogsViewManager->mComponentsRepository->detailsView() ); QVERIFY( mLogsViewManager->mViewStack.at(0) == @@ -114,7 +116,7 @@ // Go back to previous view QVERIFY( mLogsViewManager->activatePreviousView() ); - QVERIFY( mLogsViewManager->mMainWindow.views().count() == 3 ); + QVERIFY( mLogsViewManager->mMainWindow.views().count() == 2 ); QVERIFY( mLogsViewManager->mMainWindow.currentView() == mLogsViewManager->mComponentsRepository->recentCallsView() ); QVERIFY( mLogsViewManager->mViewStack.at(0) == @@ -124,15 +126,32 @@ void UT_LogsViewManager::testchangeMatchesView() { //Open Matches view, dialpad visible with predefined number - mLogsViewManager->changeMatchesView(QString("+123456")); + mLogsViewManager->changeMatchesViewViaService(QString("+123456")); QVERIFY( mLogsViewManager->mMainWindow.currentView() == mLogsViewManager->mComponentsRepository->matchesView() ); // Contact search disabled, go to recent calls view instead mLogsViewManager->mComponentsRepository->mModel->mPredectiveSearchStatus = 0; - mLogsViewManager->changeMatchesView(QString("+123456777")); + QString dialString("+123456777"); + mLogsViewManager->changeMatchesViewViaService(dialString); QVERIFY( mLogsViewManager->mMainWindow.currentView() == mLogsViewManager->mComponentsRepository->recentCallsView() ); + QVERIFY( mLogsViewManager->mComponentsRepository->mDialpad->mLineEdit->text() == dialString ); +} + +void UT_LogsViewManager::testchangeRecentView() +{ + QString dialString("+123456777"); + mLogsViewManager->changeRecentViewViaService(LogsServices::ViewCalled, false, dialString); + QVERIFY( mLogsViewManager->mMainWindow.currentView() == + mLogsViewManager->mComponentsRepository->recentCallsView() ); + QVERIFY( mLogsViewManager->mComponentsRepository->mDialpad->mLineEdit->text() == dialString ); + + // Empty string clears dialpad input + mLogsViewManager->changeRecentViewViaService(LogsServices::ViewCalled, false, ""); + QVERIFY( mLogsViewManager->mMainWindow.currentView() == + mLogsViewManager->mComponentsRepository->recentCallsView() ); + QVERIFY( mLogsViewManager->mComponentsRepository->mDialpad->mLineEdit->text().isEmpty() ); } void UT_LogsViewManager::testExitApplication() @@ -160,12 +179,6 @@ QVERIFY( HbStubHelper::quitCalled() ); } -void UT_LogsViewManager::testAppFocusGained() -{ - mLogsViewManager->appFocusGained(); - // Nothing to verify -} - void UT_LogsViewManager::testStartingWithService() { // If app is started with highway service, view is not activated @@ -177,9 +190,9 @@ service.mIsAppStartedUsingService = true; LogsViewManager vm(window, service, serviceOld); QVERIFY( vm.mComponentsRepository ); - QVERIFY( vm.mMainWindow.views().count() == 3 ); + QVERIFY( vm.mMainWindow.views().count() == 0 ); QVERIFY( vm.mMainWindow.currentView() == 0 ); - QVERIFY( vm.mViewStack.count() == 3 ); + QVERIFY( vm.mViewStack.count() == 0 ); } void UT_LogsViewManager::testHandleOrientationChanged() @@ -202,6 +215,7 @@ void UT_LogsViewManager::testSaveActivity() { + mLogsViewManager->activateView(LogsRecentViewId, false, QVariant()); HbStubHelper::setActivityReason(Hb::ActivationReasonActivity); HbApplication* hbApp = static_cast(qApp); HbActivityManager* manager = hbApp->activityManager(); @@ -210,6 +224,7 @@ QCOMPARE( manager->activities().count(), 1 ); QVERIFY( !manager->activities().at(0).value(logsActivityParamShowDialpad).toBool() ); QVERIFY( manager->activities().at(0).value(logsActivityParamDialpadText).toString().isEmpty() ); + QCOMPARE( manager->activities().at(0).value(logsActivityParamInternalViewId).toInt(), (int)LogsRecentViewId ); // Make sure that only one activity is reported mLogsViewManager->mComponentsRepository->dialpad()->mIsOpen = true; @@ -218,6 +233,7 @@ QCOMPARE( manager->activities().count(), 1 ); QVERIFY( manager->activities().at(0).value(logsActivityParamShowDialpad).toBool() ); QCOMPARE( manager->activities().at(0).value(logsActivityParamDialpadText).toString(), QString("12345") ); + QCOMPARE( manager->activities().at(0).value(logsActivityParamInternalViewId).toInt(), (int)LogsMatchesViewId ); // No views, nothing to save mLogsViewManager->mViewStack.clear(); @@ -239,6 +255,7 @@ QVariantHash params; params.insert(logsActivityParamShowDialpad, false); params.insert(logsActivityParamDialpadText, QString("")); + params.insert(logsActivityParamInternalViewId, LogsRecentViewId); manager->addActivity(QString(), QVariant(), params); QVERIFY( mLogsViewManager->loadActivity() ); QVERIFY( static_cast( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsRecentViewId ); @@ -251,6 +268,7 @@ QVariantHash params2; params2.insert(logsActivityParamShowDialpad, true); params2.insert(logsActivityParamDialpadText, QString("33333")); + params.insert(logsActivityParamInternalViewId, LogsMatchesViewId); manager->addActivity(QString(), QVariant(), params2); QVERIFY( mLogsViewManager->loadActivity() ); QVERIFY( static_cast( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsMatchesViewId ); diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp --- a/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -29,6 +29,8 @@ #include #include #include +#include +#include int actionCount = 0; Qt::Orientation windowOrientation = Qt::Vertical; @@ -50,6 +52,9 @@ HbActivityManager testActivityManager; Hb::ActivationReason testActivationReason = Hb::ActivationReasonNormal; QString testActivityId = "LogsViewMatches"; +QList testViewItems; +bool testEnsureVisibleCalled = false; +bool testScrollToCalled = false; void HbStubHelper::reset() { @@ -63,10 +68,12 @@ testActivationReason = Hb::ActivationReasonNormal; testActivityId = "LogsViewMatches"; testActivities.clear(); + qDeleteAll(testViewItems); + testViewItems.clear(); + testScrollToCalled = false; + testEnsureVisibleCalled = false; } - - int HbStubHelper::widgetActionsCount() { return actionCount; @@ -135,6 +142,21 @@ testActivityId = activityId; } +QList& HbStubHelper::listItems() +{ + return testViewItems; +} + +bool HbStubHelper::listScrollToCalled() +{ + return testScrollToCalled; +} + +bool HbStubHelper::listEnsureVisibleCalled() +{ + return testEnsureVisibleCalled; +} + // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -331,7 +353,6 @@ void HbMainWindow::setCurrentView(HbView *view, bool animate, Hb::ViewSwitchFlags flags) { - Q_UNUSED(animate) Q_UNUSED(flags) testView = view; } @@ -404,3 +425,39 @@ Q_UNUSED(colorRole); return testColor; } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HbListView::scrollTo(const QModelIndex &index, ScrollHint hint) +{ + Q_UNUSED(index); + Q_UNUSED(hint); + testScrollToCalled = true; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +QList HbAbstractItemView::visibleItems() const +{ + QList visible; + foreach ( HbListViewItem* item, testViewItems ){ + visible.append( item ); + } + return visible; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void HbScrollArea::ensureVisible(const QPointF &position, qreal xMargin, qreal yMargin) +{ + Q_UNUSED(position); + Q_UNUSED(xMargin); + Q_UNUSED(yMargin); + testEnsureVisibleCalled = true; +} diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs_helper.h --- a/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs_helper.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs_helper.h Thu Jun 24 14:44:14 2010 +0300 @@ -17,6 +17,9 @@ #ifndef HBSTUB_HELPER_H #define HBSTUB_HELPER_H + +class HbListViewItem; + /** * Helper class to control logsdbconnector stub behavior * @@ -37,6 +40,9 @@ static void setColorScheme(QColor col); static void setActivityReason(Hb::ActivationReason reason); static void setActivityId(QString activityId); + static QList& listItems(); + static bool listScrollToCalled(); + static bool listEnsureVisibleCalled(); }; #endif diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/stubs/qthighway_stub.cpp --- a/logsui/logsapp/tsrc/ut_logsapp/stubs/qthighway_stub.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/qthighway_stub.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -134,11 +134,21 @@ { return true; } + void XQServiceRequest::addArg(const QVariant& v) { } +void XQServiceRequest::setInfo(const XQRequestInfo &info) +{ + Q_UNUSED(info); +} + +void XQRequestInfo::setForeground(bool on) +{ + Q_UNUSED(on) +} // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsapp/tsrc/ut_logsapp/ut_logsapp.pro --- a/logsui/logsapp/tsrc/ut_logsapp/ut_logsapp.pro Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsapp/tsrc/ut_logsapp/ut_logsapp.pro Thu Jun 24 14:44:14 2010 +0300 @@ -51,6 +51,7 @@ HEADERS += inc/ut_logsservicehandler.h HEADERS += ../../inc/logsmainwindow.h HEADERS += ../../inc/logsviewmanager.h +HEADERS += ../../inc/logscomponentrepository.h HEADERS += ../../inc/logsrecentcallsview.h HEADERS += ../../inc/logsbaseview.h HEADERS += ../../inc/logsdetailsview.h @@ -63,7 +64,6 @@ #HEADERS += ../../../logsengine/inc/logscommondata.h HEADERS += ../../../logsengine/inc/logsconfigurationparams.h HEADERS += logsengine_stub/logscontact.h -HEADERS += logsengine_stub/logsforegroundwatcher.h HEADERS += ./stubs/dialpad.h HEADERS += ./stubs/dialpadkeyhandler.h @@ -83,7 +83,6 @@ SOURCES += logsengine_stub/logseventdata.cpp SOURCES += logsengine_stub/logscontact.cpp SOURCES += logsengine_stub/logsmatchesmodel.cpp -SOURCES += logsengine_stub/logsforegroundwatcher.cpp SOURCES += ../../../logsengine/src/logsconfigurationparams.cpp SOURCES += src/ut_logsbaseview.cpp SOURCES += src/ut_logsrecentcallsview.cpp diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/src/logscntfinder.cpp --- a/logsui/logscntfinder/src/logscntfinder.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/src/logscntfinder.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -1,4 +1,4 @@ -/* + /* * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/src/logspredictivetranslator.cpp --- a/logsui/logscntfinder/src/logspredictivetranslator.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/src/logspredictivetranslator.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -143,7 +143,8 @@ } else { delete mNameTranslator; mNameTranslator = new LogsPredictiveLatin12KeyTranslator(); - if( mNameTranslator->encodes( name ) ) { + if( mNameTranslator->mKeyMap && + mNameTranslator->encodes( name ) ) { nameTranslator = mNameTranslator; LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveTranslator::\ nameTranslator() - use latin" ) @@ -151,7 +152,8 @@ } delete mNameTranslator; mNameTranslator = new LogsPredictiveThai12KeyTranslator(); - if( mNameTranslator->encodes( name ) ) { + if( mNameTranslator->mKeyMap && + mNameTranslator->encodes( name ) ) { nameTranslator = mNameTranslator; LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveTranslator::\ nameTranslator() - use thai" ) diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/tsrc/pt_logscntfinder/src/main.cpp --- a/logsui/logscntfinder/tsrc/pt_logscntfinder/src/main.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/tsrc/pt_logscntfinder/src/main.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -42,9 +42,9 @@ PT_LogsCntFinderQwerty pt_LogsCntFinderQwerty( samples ); resultFileName = "c:/data/others/pt_logscntfinderqwerty.txt"; - QStringList args_logsCntFinderQwertry( "PT_LogsCntFinderQwerty"); - args_logsCntFinder << "-o" << resultFileName; - QTest::qExec(&pt_LogsCntFinderQwerty, args_logsCntFinderQwertry); + QStringList args_logsCntFinderQwerty( "PT_LogsCntFinderQwerty"); + args_logsCntFinderQwerty << "-o" << resultFileName; + QTest::qExec(&pt_LogsCntFinderQwerty, args_logsCntFinderQwerty); return 0; } diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/tsrc/pt_logscntfinder/src/pt_logscntfinder.cpp --- a/logsui/logscntfinder/tsrc/pt_logscntfinder/src/pt_logscntfinder.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/tsrc/pt_logscntfinder/src/pt_logscntfinder.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -145,17 +145,33 @@ //open symbian database m_manager = new QContactManager("symbian"); + /* //qDebug() << "PT_LogsCntFinder::init remove old contacts"; // Remove all contacts from the database + QList firstnamelist; + QList Lastnamelist; + firstnamelist<<"Micheal"<<"Evans"<<"Kacris"<<"Xiao"; + Lastnamelist<<"Ribecca"<<"Tina"<<"Bob"<<"George"<<"Anna"; + + for( int z = 0;z<30;z++) { + //for( int z = 0;z<10;z++) { + for(int i =0; i < firstnamelist.count(); i++) { + for(int k =0; k < Lastnamelist.count(); k++) { + //emailaddress = firstnamelist[i].Lastnamelist[k] + createContact_one_Contact(firstnamelist[i], Lastnamelist[k], QString("03432")); + } + } + } + */ + QList cnt_ids = m_manager->contactIds(); qDebug() << "contacts now in db" << cnt_ids.count(); - if ( cnt_ids.count() == 600 ) { + if ( cnt_ids.count() < 600 ) { QString f("Jack"); QString l("Whatever"); createContact_one_Contact( f,l, QString("03432")); } - cnt_ids = m_manager->contactIds(); qDebug() << "contacts now " << cnt_ids.count(); @@ -175,6 +191,7 @@ +//void PT_LogsCntFinder::createContact_one_Contact(QString& firstname, QString& Lastname, QString phnumber, QString& emailaddress) void PT_LogsCntFinder::createContact_one_Contact(QString& firstname, QString& Lastname, QString phnumber) { //Currenlty we can only fetch firstname,lastname,companyname and sip/email/phone from the databse @@ -193,6 +210,11 @@ number.setNumber(phnumber); phonecontact.saveDetail(&number); + QContactEmailAddress email; + QString emailaddress = firstname + "." + Lastname + "@ovi.com"; + email.setEmailAddress(emailaddress); + phonecontact.saveDetail(&email); + m_manager->saveContact(&phonecontact); } @@ -298,9 +320,12 @@ QList tests; tests.append( PtTest("5") ); + tests.append( PtTest("05") ); tests.append( PtTest("52") ); tests.append( PtTest("522") ); tests.append( PtTest("5220") ); + tests.append( PtTest("05220") ); + tests.append( PtTest("052207") ); tests.append( PtTest("522000000000007") ); tests.append( PtTest("205") ); tests.append( PtTest("34096") ); diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/tsrc/pt_logscntfinder/src/pt_logscntfinderqwerty.cpp --- a/logsui/logscntfinder/tsrc/pt_logscntfinder/src/pt_logscntfinderqwerty.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/tsrc/pt_logscntfinder/src/pt_logscntfinderqwerty.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -80,7 +80,8 @@ tests.append( PtTest("a") ); tests.append( PtTest("5") ); tests.append( PtTest("Paul") ); - tests.append( PtTest("Paul Mes") ); + tests.append( PtTest("Paul sw") ); + tests.append( PtTest("P S") ); t.start(); diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/tsrc/st_logscntfinder/inc/st_logscntfinder.h --- a/logsui/logscntfinder/tsrc/st_logscntfinder/inc/st_logscntfinder.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/tsrc/st_logscntfinder/inc/st_logscntfinder.h Thu Jun 24 14:44:14 2010 +0300 @@ -67,7 +67,8 @@ void testPredictiveSearchQueryFullyCached(); void testPredictiveSearchQueryPartialCachedNoResults(); void testPredictiveSearchQueryFullyCachedNoResults(); - void testPredictiveSearchQueryCachedZeroCase(); + void testPredictiveSearchQueryPartialCachedZeroCase(); + void testPredictiveSearchQueryFullyCachedZerosCase(); void testPredictiveSearchQueryLogs(); void testPredictiveSearchQueryLogsZeroCase(); void testPredictiveSearchQueryLogsContactsPartialCached(); @@ -76,6 +77,7 @@ void testPredictiveSearchQueryLogsContactsPhoneNumberMatch(); void testPredictiveSearchQueryLimit(); void testQueryOrder(); + void testContactWithNonMappedChars(); private: @@ -89,6 +91,7 @@ void createContacts(); void createContactsForQueryOrder(); void createContactsForQueryZero(); + void createContactsWithNonMappedChars(); void createHistoryEvents(); void createLogEvent( QString firstname, diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/tsrc/st_logscntfinder/src/st_logscntfinder.cpp --- a/logsui/logscntfinder/tsrc/st_logscntfinder/src/st_logscntfinder.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/tsrc/st_logscntfinder/src/st_logscntfinder.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -36,10 +36,14 @@ void ST_LogsCntFinder::initTestCase() { + //open symbian database + m_manager = new QContactManager("symbian"); } void ST_LogsCntFinder::cleanupTestCase() { + delete m_manager; + m_manager = 0; } @@ -50,8 +54,6 @@ HbInputSettingProxy::instance()->setGlobalInputLanguage( eng ); m_finder = 0; - //open symbian database - m_manager = new QContactManager("symbian"); m_finder = new LogsCntFinder(*m_manager); QVERIFY(m_finder); @@ -59,7 +61,7 @@ QList cnt_ids = m_manager->contactIds(); qDebug() << "contacts now before deleting" << cnt_ids.count(); - QVERIFY( m_manager->removeContacts(cnt_ids, 0 ) ); + m_manager->removeContacts(cnt_ids, 0 ); cnt_ids = m_manager->contactIds(); QCOMPARE(cnt_ids.count(), 0); @@ -71,8 +73,6 @@ void ST_LogsCntFinder::cleanup() { - delete m_manager; - m_manager = 0; delete m_finder; m_finder = 0; HbInputLanguage eng( QLocale::English ); @@ -110,8 +110,7 @@ createOneContact( QString("Tisha"), QString("Iatzkovits"), QString("932472398") ); createOneContact( QString("Wilda"), QString("Lazar"), QString("932472398") ); createOneContact( QString("Una Vivi"), QString("Kantsak"), QString("932472398") ); - - + int contactsCount = m_manager->contactIds().count(); QCOMPARE(contactsCount, 13); @@ -128,20 +127,27 @@ void ST_LogsCntFinder::createContactsForQueryZero() { createContacts(); - createOneContact( QString("Dlice 00202"), QString("Qwerty"), QString("45789348") ); + createOneContact( QString("Dlice 0202"), QString("Qwerty"), QString("45789348") ); createOneContact( QString("#Paula 2003"), QString("Augustin Ci"), QString("0078945617") ); createOneContact( QString("Paula 02010"), QString("Ezerty Adam"), QString("78945617") ); - createOneContact( QString("Ced"), QString("Y,g"), QString("+78945617") ); + createOneContact( QString("Ced"), QString(",Yg"), QString("+78945617") ); createOneContact( QString("Jari-Pekka"), QString(" "), QString("78945617") ); int contactsCount = m_manager->contactIds().count(); QCOMPARE(contactsCount, 18); } - +void ST_LogsCntFinder::createContactsWithNonMappedChars() +{ + + createOneContact( QString("Hannu%"), QString(""), QString("932472398") ); + createOneContact( QString("%Hannu"), QString(""), QString("932472398") ); + +} void ST_LogsCntFinder::createHistoryEvents() -{ +{ + //inserted inreverse order createLogEvent( QString("Stefann Albert"), QString("Fedrernn"), QString("932472398") ); createLogEvent( QString("Jonn"), QString("Lennon"), QString("932472398") ); createLogEvent( QString("Dim-Petter"), QString("Jones"), QString("932472398") ); @@ -307,7 +313,7 @@ { createContactsForQueryZero(); - m_finder->predictiveSearchQuery( QString("00202") ); + m_finder->predictiveSearchQuery( QString("0202") ); QCOMPARE( m_finder->resultsCount(), 2 ); } @@ -316,7 +322,7 @@ createContactsForQueryZero(); m_finder->predictiveSearchQuery( QString("02010") ); - QCOMPARE( m_finder->resultsCount(), 1 ); + QCOMPARE( m_finder->resultsCount(), 2 ); } void ST_LogsCntFinder::testPredictiveSearchQueryZeroMiddle() @@ -464,33 +470,67 @@ } -// 6 -> 69 (no match) -> 692 (no match) -> 69 (no match) -> 6 (all cached) -void ST_LogsCntFinder::testPredictiveSearchQueryCachedZeroCase() +// +void ST_LogsCntFinder::testPredictiveSearchQueryPartialCachedZeroCase() { createContacts(); - m_finder->predictiveSearchQuery( QString("2") ); + m_finder->predictiveSearchQuery( QString("2") );//db QCOMPARE( m_finder->resultsCount(), 3 ); CHECK_RESULTS( 2, "Levis", "Augustin" );//Augustin Zi - m_finder->predictiveSearchQuery( QString("20") ); + m_finder->predictiveSearchQuery( QString("20") );//db QCOMPARE( m_finder->resultsCount(), 3 ); CHECK_RESULTS( 2, "Levis", "Augustin" );//Augustin Zi - m_finder->predictiveSearchQuery( QString("209") ); + m_finder->predictiveSearchQuery( QString("209") );//db QCOMPARE( m_finder->resultsCount(), 1 ); CHECK_RESULTS( 1, "Levis", "Augustin" ); //Augustin Zi - m_finder->predictiveSearchQuery( QString("20") ); + m_finder->predictiveSearchQuery( QString("20") );//db QCOMPARE( m_finder->resultsCount(), 3 ); CHECK_RESULTS( 2, "Levis", "Augustin" );//Augustin Zi - m_finder->predictiveSearchQuery( QString("2") ); + m_finder->predictiveSearchQuery( QString("2") );//db QCOMPARE( m_finder->resultsCount(), 3 ); CHECK_RESULTS( 2, "Levis", "Augustin" );//Augustin Zi } +// +void ST_LogsCntFinder::testPredictiveSearchQueryFullyCachedZerosCase() +{ + createContacts(); + + m_finder->predictiveSearchQuery( QString("2") ); //db + QCOMPARE( m_finder->resultsCount(), 3 ); + CHECK_RESULTS( 3, "Levis", "Augustin" );//Augustin Zi + + m_finder->predictiveSearchQuery( QString("20") );//cache + QCOMPARE( m_finder->resultsCount(), 3 ); + CHECK_RESULTS( 3, "Levis", "Augustin" );//Augustin Zi + + m_finder->predictiveSearchQuery( QString("200") );//cache + QCOMPARE( m_finder->resultsCount(), 3 ); + CHECK_RESULTS( 3, "Levis", "Augustin" );//Augustin Zi + + m_finder->predictiveSearchQuery( QString("2009") );//cache + QCOMPARE( m_finder->resultsCount(), 1 ); + CHECK_RESULTS( 1, "Levis", "Augustin" ); //Augustin Zi + + m_finder->predictiveSearchQuery( QString("200") );//db + QCOMPARE( m_finder->resultsCount(), 3 ); + CHECK_RESULTS( 3, "Levis", "Augustin" );//Augustin Zi + + m_finder->predictiveSearchQuery( QString("20") );//db + QCOMPARE( m_finder->resultsCount(), 3 ); + CHECK_RESULTS( 3, "Levis", "Augustin" );//Augustin Zi + + m_finder->predictiveSearchQuery( QString("2") );//db + QCOMPARE( m_finder->resultsCount(), 3 ); + CHECK_RESULTS( 3, "Levis", "Augustin" );//Augustin Zi + +} //There is recent call in logs, no contacts DB void ST_LogsCntFinder::testPredictiveSearchQueryLogs() @@ -512,7 +552,6 @@ QCOMPARE( m_finder->resultsCount(), 1 ); CHECK_RESULTS( 1, "Jonn", "Lennon" ); - QCOMPARE( m_finder->resultsCount(), 0 ); m_finder->predictiveSearchQuery( QString("5") ); QCOMPARE( m_finder->resultsCount(), 2 ); CHECK_RESULTS( 2, "Dim-Petter", "Jones" ); @@ -536,7 +575,7 @@ m_finder->predictiveSearchQuery( QString("503") ); QCOMPARE( m_finder->resultsCount(), 1 ); - CHECK_RESULTS( 2, "Dim-Petter", "Jones" ); + CHECK_RESULTS( 1, "Dim-Petter", "Jones" ); m_finder->predictiveSearchQuery( QString("50") ); QCOMPARE( m_finder->resultsCount(), 2 ); @@ -636,11 +675,11 @@ m_finder->predictiveSearchQuery( QString("9") ); QCOMPARE( m_finder->resultsCount(), 6 ); //3 history + 3 contacts - CHECK_RESULTS( 5, "Stefann", "Fedrernn" ); + CHECK_RESULTS( 5, "Dim-Petter", "Jones" ); m_finder->predictiveSearchQuery( QString("93") ); QCOMPARE( m_finder->resultsCount(), 3 ); - CHECK_RESULTS( 1, "Stefann", "Fedrernn" ); + CHECK_RESULTS( 1, "Dim-Petter", "Jones" ); } @@ -711,3 +750,24 @@ QCOMPARE(m_finder->resultAt(7).lastName().at(0).text(), QString("Yadira")); } +void ST_LogsCntFinder::testContactWithNonMappedChars() +{ + //Hannu% + //%Hannu + createContactsWithNonMappedChars(); + + m_finder->predictiveSearchQuery( QString("4") ); + QCOMPARE( m_finder->resultsCount(), 1 );//Hannu% + QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString("Hannu%")); + + m_finder->predictiveSearchQuery( QString("42") );//all cached + QCOMPARE( m_finder->resultsCount(), 1 );//Hannu% + QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString("Hannu%")); + + m_finder->predictiveSearchQuery( QString("") );//empty cache + m_finder->predictiveSearchQuery( QString("42") ); + QCOMPARE( m_finder->resultsCount(), 1 );//Hannu% + QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString("Hannu%")); + +} + diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/tsrc/st_logscntfinder/src/st_logscntfinderqwerty.cpp --- a/logsui/logscntfinder/tsrc/st_logscntfinder/src/st_logscntfinderqwerty.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/tsrc/st_logscntfinder/src/st_logscntfinderqwerty.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -77,7 +77,7 @@ // Remove all contacts from the database QList cnt_ids = m_manager->contactIds(); - QVERIFY( m_manager->removeContacts(cnt_ids, 0 ) ); + m_manager->removeContacts(cnt_ids, 0 ); cnt_ids = m_manager->contactIds(); QCOMPARE(cnt_ids.count(), 0); @@ -97,7 +97,7 @@ // Remove all contacts from the database QList cnt_ids = m_manager->contactIds(); - QVERIFY( m_manager->removeContacts(cnt_ids, 0 ) ); + m_manager->removeContacts(cnt_ids, 0 ); cnt_ids = m_manager->contactIds(); QVERIFY(0 == cnt_ids.count()); @@ -128,7 +128,6 @@ { createContacts(); - QEXPECT_FAIL("", "Not implemented", Abort ); QContactDetailFilter df; df.setDetailDefinitionName(QContactName::DefinitionName, QContactEmailAddress::FieldEmailAddress ); @@ -161,7 +160,6 @@ { createContacts(); - QEXPECT_FAIL("", "Not implemented", Abort ); QContactDetailFilter df; df.setDetailDefinitionName(QContactName::DefinitionName, QContactEmailAddress::FieldEmailAddress ); @@ -186,7 +184,6 @@ { createContacts(); - QEXPECT_FAIL("", "Not implemented", Abort ); QContactDetailFilter df; df.setDetailDefinitionName(QContactName::DefinitionName, QContactEmailAddress::FieldEmailAddress ); @@ -210,7 +207,6 @@ { createContacts(); - QEXPECT_FAIL("", "Not implemented", Abort ); QContactDetailFilter df; df.setDetailDefinitionName(QContactName::DefinitionName, QContactEmailAddress::FieldEmailAddress ); @@ -230,7 +226,6 @@ { createContacts(); - QEXPECT_FAIL("", "Not implemented", Abort ); QContactDetailFilter df; df.setDetailDefinitionName(QContactName::DefinitionName, QContactEmailAddress::FieldEmailAddress ); @@ -254,7 +249,6 @@ { createContacts(); - QEXPECT_FAIL("", "Not implemented", Abort ); QContactDetailFilter df; df.setDetailDefinitionName(QContactName::DefinitionName, QContactEmailAddress::FieldEmailAddress ); diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/tsrc/stubs/qtcontacts_stubs.cpp --- a/logsui/logscntfinder/tsrc/stubs/qtcontacts_stubs.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/tsrc/stubs/qtcontacts_stubs.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -170,9 +170,10 @@ return list; } + QContact QContactManager::contact( - const QContactLocalId& contactId, - const QStringList& /*definitionRestrictions*/ ) const + const QContactLocalId& contactId, + const QContactFetchHint& /*fetchHint*/) const { QContact contact; QContactId id; @@ -182,6 +183,7 @@ return contact; } + // ---------------------------------------------------------------------------- // QContactDetailFilter // ---------------------------------------------------------------------------- diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictivethai12keytranslator.cpp --- a/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictivethai12keytranslator.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictivethai12keytranslator.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -56,6 +56,7 @@ void UT_LogsPredictiveThai12KeyTranslator::testTranslateText() { + QEXPECT_FAIL("", "No proper Thai keymap yet", Abort ); QCOMPARE( mTranslator->translateText( QString( "0123456789" ) ), QString( "0123456789" ) ); //finds name latin name translator QCOMPARE( mTranslator->translateText( QString( "Nokia" ) ), QString( "66542" ) ); @@ -81,6 +82,7 @@ void UT_LogsPredictiveThai12KeyTranslator::testTranslateChar() { + QEXPECT_FAIL("", "No proper Thai keymap yet", Abort ); bool ok; QCOMPARE( mTranslator->translateChar( QChar('0'), ok ), QChar('0') ); @@ -113,12 +115,6 @@ void UT_LogsPredictiveThai12KeyTranslator::testEncodes() { - //thai - const int ucsize = 9; - const QChar thaiName2[] = {0x0E01,0x0E06,0x0E2F,0x0E0E,0x0E14,0x0E19,0x0E30,0x0E23,0x0E2A }; - - QVERIFY( mTranslator->encodes( QString( thaiName2,ucsize ) ) ); - //china QString uni1; uni1.append(QChar(0x4E0E)); @@ -126,7 +122,14 @@ QVERIFY( !mTranslator->encodes( uni1) ); QVERIFY( !mTranslator->encodes( QString( "Zulu" ) ) ); - + + QEXPECT_FAIL("", "No proper Thai keymap yet", Abort ); + //thai + const int ucsize = 9; + const QChar thaiName2[] = {0x0E01,0x0E06,0x0E2F,0x0E0E,0x0E14,0x0E19,0x0E30,0x0E23,0x0E2A }; + + QVERIFY( mTranslator->encodes( QString( thaiName2,ucsize ) ) ); + } diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictivetranslator.cpp --- a/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictivetranslator.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictivetranslator.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -87,6 +87,10 @@ 2 ); QVERIFY( ok ); + QString test2( "Hannu%"); + QCOMPARE( mTranslator->LogsPredictiveTranslator::translate( test2, &ok ).length(),test2.length() -1 ); + QVERIFY( !ok ); + } void UT_LogsPredictiveTranslator::testTranslatePattern() @@ -105,11 +109,16 @@ QCOMPARE( mTranslator->translateText( test1 ).length(), test1.length() ); + QString test2( "Hannu%"); + QCOMPARE( mTranslator->translateText( test2 ).length(), test2.length() - 1 ); + + QEXPECT_FAIL("", "No proper Thai keymap yet", Abort ); //text is thai, input lang latin const int ucsize = 9; // 1 2 3 4 5 6 7 8 9 const QChar thaiName1[] = {0x0E01,0x0E06,0x0E0A,0x0E0E,0x0E14,0x0E19,0x0E1E,0x0E23,0x0E2A }; QCOMPARE( mTranslator->translateText( QString( thaiName1,ucsize ) ), QString( "123456789" ) ); + } @@ -120,6 +129,22 @@ QVERIFY( !mTranslator->mNameTranslator ); QCOMPARE( mTranslator->nameTranslator( test1 ).mib(), MIBenumLatin ); QVERIFY( mTranslator->mNameTranslator ); + + //china + QString uni; + uni.append(QChar(0x0219)); + uni.append(QChar(0x4E0F)); + QCOMPARE( mTranslator->nameTranslator( uni ).mib(), MIBenumLatin ); + QVERIFY( !mTranslator->mNameTranslator ); + QCOMPARE( mTranslator->mib(), MIBenumLatin ); + + //unmapped + QString test2( "Hannu%"); + QCOMPARE( mTranslator->nameTranslator( test2 ).mib(), MIBenumLatin ); + QVERIFY( !mTranslator->mNameTranslator ); + QCOMPARE( mTranslator->mib(), MIBenumLatin ); + + QEXPECT_FAIL("", "No proper Thai keymap yet", Abort ); //text is thai, input lang latin const int ucsize = 9; @@ -135,16 +160,6 @@ QCOMPARE( mTranslator->mNameTranslator->mib(), MIBenumThai ); QCOMPARE( mTranslator->mib(), MIBenumLatin ); - - //china - QString uni; - uni.append(QChar(0x0219)); - uni.append(QChar(0x4E0F)); - QCOMPARE( mTranslator->nameTranslator( uni ).mib(), MIBenumLatin ); - QVERIFY( !mTranslator->mNameTranslator ); - QCOMPARE( mTranslator->mib(), MIBenumLatin ); - - } diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logscntfinder/tsrc/ut_logscntfinder/ut_logscntfinder.pro --- a/logsui/logscntfinder/tsrc/ut_logscntfinder/ut_logscntfinder.pro Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/ut_logscntfinder.pro Thu Jun 24 14:44:14 2010 +0300 @@ -66,7 +66,7 @@ symbian: { TARGET.UID2 = 0x100039CE - TARGET.UID3 = 0xEfa329b2 + TARGET.UID3 = 0xEfa329b3 TARGET.CAPABILITY = ALL -TCB TARGET.EPOCALLOWDLLDATA = 1 LIBS += -lflogger -lqtcontacts diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/inc/logsengdefs.h --- a/logsui/logsengine/inc/logsengdefs.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/inc/logsengdefs.h Thu Jun 24 14:44:14 2010 +0300 @@ -56,18 +56,13 @@ const int logsEventALS = 0x4; const int logsDeleteCountInit = -1; -const int logsReadSizeCompressEnabled = 20; +const int logsReadSizeCompressEnabled = 10; const int logsReadSizeUndefined = -1; // MACROS #define DESC_TO_QSTRING( desc )\ QString::fromUtf16( desc.Ptr(), desc.Length() ); -#define LOGSENG_PANIC() User::Invariant() - -#define LOGSENG_ASSERT( cond )\ -if ( !(cond) ) LOGSENG_PANIC; - // DATA TYPES class LogsEventStrings diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/inc/logsmatchesmodel.h --- a/logsui/logsengine/inc/logsmatchesmodel.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/inc/logsmatchesmodel.h Thu Jun 24 14:44:14 2010 +0300 @@ -26,6 +26,7 @@ class LogsDbConnector; class LogsCntFinder; class LogsCntEntry; +class LogsCntText; class LogsContact; class LogsMatchesModelItemContainer; class LogsThumbIconManager; @@ -74,6 +75,7 @@ void eventsUpdated(const QModelIndex& first, const QModelIndex& last); void eventsAdded(const QModelIndex& parent, int first, int last); void eventsRemoved(const QModelIndex& parent, int first, int last); + void eventsResetted(); void doSearchQuery(); void doModelReset(); @@ -89,6 +91,7 @@ void getLogsMatches( const QString& pattern, bool async = false, bool force = false ); void updateSearchEntry(LogsCntEntry& entry, LogsEvent& event); QString stripPhoneNumber(const QString& phoneNumber) const; + void addEventForSearching(int index, LogsEvent& event); private: //data @@ -125,6 +128,7 @@ unsigned int contact() const; QString number() const; QString contactName() const; + QString contactNameSimple() const; bool isNull() const; bool isEventMatch() const; QStringList texts(); @@ -136,13 +140,18 @@ QString getFormattedCallerId(const LogsCntEntry& entry) const; void getFormattedContactInfo( - const LogsCntEntry& entry, QString& contactName, QString& contactNumber ) const; + const LogsCntEntry& entry, QString& contactName, + QString& contactNameSimple, QString& contactNumber ) const; + void getFormattedName(QString& formattedName, const QList& list) const; + void getFormattedName(QString& formattedName, QString& formattedNameSimple, + const QList& list) const; private: LogsAbstractModel& mParentModel; unsigned int mContactId; QString mContactName; + QString mContactNameSimple; QString mContactNumber; QString mAvatarPath; QString mFormattedCallerId; diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/inc/logsmessage.h --- a/logsui/logsengine/inc/logsmessage.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/inc/logsmessage.h Thu Jun 24 14:44:14 2010 +0300 @@ -69,6 +69,7 @@ XQServiceRequest* mService; private: friend class UT_LogsMessage; + friend class UT_LogsMatchesModel; }; diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/logssymbianos/inc/logsforegroundwatcher.h --- a/logsui/logsengine/logssymbianos/inc/logsforegroundwatcher.h Fri Jun 11 13:38:41 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef LOGSFOREGROUNDWATCHER_H -#define LOGSFOREGROUNDWATCHER_H - - -#include -#include - -class LogsForegroundWatcher : public QObject, public MCoeForegroundObserver -{ - Q_OBJECT - -public: - - LogsForegroundWatcher(QObject* parent = 0); - virtual ~LogsForegroundWatcher(){} - -signals: - void gainingForeground(); - void losingForeground(); - -public: // from MCoeForegroundObserver - void HandleGainingForeground(); - void HandleLosingForeground(); - -}; - -#endif //LOGSFOREGROUNDWATCHER_H diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/logssymbianos/src/logsdbconnector.cpp --- a/logsui/logsengine/logssymbianos/src/logsdbconnector.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/logssymbianos/src/logsdbconnector.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -509,10 +509,6 @@ } deleteRemoved(readCount); - - if ( mCompressionEnabled ){ - mReader->stop(); - } LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::readCompleted()" ) } diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/logssymbianos/src/logsforegroundwatcher.cpp --- a/logsui/logsengine/logssymbianos/src/logsforegroundwatcher.cpp Fri Jun 11 13:38:41 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "logsforegroundwatcher.h" -#include "logslogger.h" - -// ----------------------------------------------------------------------------- -// Currently no other way to monitor app foreground/background switches. -// HbForegroundWatcher might become public at some point which could be then -// used instead. -// ----------------------------------------------------------------------------- -// -LogsForegroundWatcher::LogsForegroundWatcher(QObject* parent) : QObject(parent) -{ - CCoeEnv* env = CCoeEnv::Static(); - if (env) { - TRAP_IGNORE(env->AddForegroundObserverL(*this)); - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void LogsForegroundWatcher::HandleGainingForeground() -{ - LOGS_QDEBUG( "logs [UI] -> LogsForegroundWatcher::HandleGainingForeground" ); - emit gainingForeground(); - LOGS_QDEBUG( "logs [UI] <- LogsForegroundWatcher::HandleGainingForeground" ); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void LogsForegroundWatcher::HandleLosingForeground() -{ - LOGS_QDEBUG( "logs [UI] -> LogsForegroundWatcher::HandleLosingForeground" ); - emit losingForeground(); - LOGS_QDEBUG( "logs [UI] <- LogsForegroundWatcher::HandleLosingForeground" ); -} - diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/logssymbianos/tsrc/stubs/centralrepository_stub.cpp --- a/logsui/logsengine/logssymbianos/tsrc/stubs/centralrepository_stub.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/logssymbianos/tsrc/stubs/centralrepository_stub.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -27,6 +27,7 @@ mFailCode = KErrNone; mCurrentVal = 0; } + void CentralRepositoryStubHelper::setFailCode(TInt err) { mFailCode = err; @@ -76,7 +77,7 @@ // // ----------------------------------------------------------------------------- // -TInt CRepository::Get(TUint32 aKey, TInt& aValue) +TInt CRepository::Get(TUint32 /*aKey*/, TInt& aValue) { aValue = mCurrentVal; return mFailCode; @@ -87,7 +88,7 @@ // // ----------------------------------------------------------------------------- // -TInt CRepository::Set(TUint32 aKey, TInt aValue) +TInt CRepository::Set(TUint32 /*aKey*/, TInt aValue) { if ( mFailCode == KErrNone ) { diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/logssymbianos/tsrc/stubs/qtcontacts_stubs.cpp --- a/logsui/logsengine/logssymbianos/tsrc/stubs/qtcontacts_stubs.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/logssymbianos/tsrc/stubs/qtcontacts_stubs.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -187,12 +187,6 @@ QContactPhoneNumber number; return number; } - else if ( definitionId == QContactAvatar::DefinitionName){ - QContactAvatar avatar; - avatar.setSubType(QContactAvatar::SubTypeImage); - avatar.setAvatar("c:\\data\\images\\logstest1.jpg"); - return avatar; - } QContactDetail detail; return detail; } @@ -263,8 +257,7 @@ } else if ( key == QContactPhoneNumber::FieldNumber ) { return QString( "12345" ); } - else if ( key == QContactAvatar::FieldAvatar){ - return QString( "Avatar" ); - } return QString(""); } + + diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logsforegroundwatcher.h --- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logsforegroundwatcher.h Fri Jun 11 13:38:41 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef UT_LOGSFOREGROUNDWATCHER_H -#define UT_LOGSFOREGROUNDWATCHER_H - -#include - -class LogsForegroundWatcher; - -class UT_LogsForegroundWatcher : public QObject -{ - Q_OBJECT - -private slots: - -/* - * In addition, there are four private slots that are not treated as testfunctions. - * They will be executed by the testing framework and can be used to initialize and clean up - * either the entire test or the current test function. - * - * initTestCase() will be called before the first testfunction is executed. - * cleanupTestCase() will be called after the last testfunction was executed. - * init() will be called before each testfunction is executed. - * cleanup() will be called after every testfunction. -*/ - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -private slots: //test methods - void testConstructor(); - void testHandleLosingForeground(); - void testHandleGainingForeground(); - - -private: - - LogsForegroundWatcher* mWatcher; - -}; - - -#endif //UT_LOGSFOREGROUNDWATCHER_H diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/main.cpp --- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/main.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/main.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -23,7 +23,6 @@ #include "ut_logsreaderstates.h" #include "ut_logseventparser.h" #include "ut_logseventdataparser.h" -#include "ut_logsforegroundwatcher.h" #include "testresultxmlparser.h" #include "ut_logsremove.h" @@ -82,14 +81,6 @@ QT_TRAP_THROWING( QTest::qExec(&ut_logsEventData, args_logsEventData); ) parser.parseAndPrintResults(resultFileName,true); - UT_LogsForegroundWatcher ut_logsForegroundWatcher; - resultFileName = "c:/ut_logs_logsForegroundWatcher.xml"; - QStringList args_logsForegroundWatcher( "ut_logsForegroundWatcher"); - args_logsForegroundWatcher << "-xml" << "-o" << resultFileName; - QT_TRAP_THROWING( QTest::qExec(&ut_logsForegroundWatcher, args_logsForegroundWatcher); ) - parser.parseAndPrintResults(resultFileName,true); - - if (promptOnExit) { printf("Press any key...\n"); diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsdbconnector.cpp --- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsdbconnector.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsdbconnector.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -287,13 +287,13 @@ QVERIFY( mDbConnector->mEvents.count() == 1 ); QVERIFY( mEvents.count() == 1 ); - // Read completed when compression is enabled, reader is stopped + // Read completed when compression is enabled, reader is not stopped QVERIFY( mDbConnector->init() == 0 ); QVERIFY( mDbConnector->start() == 0 ); QVERIFY( mDbConnector->mReader->mLogViewRecent != 0 ); mDbConnector->mCompressionEnabled = true; mDbConnector->readCompleted(0); - QVERIFY( mDbConnector->mReader->mLogViewRecent == 0 ); + QVERIFY( mDbConnector->mReader->mLogViewRecent != 0 ); } void UT_LogsDbConnector::testErrorOccurred() diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsforegroundwatcher.cpp --- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsforegroundwatcher.cpp Fri Jun 11 13:38:41 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "ut_logsforegroundwatcher.h" -#include "logsforegroundwatcher.h" - -#include -#include - -CCoeEnv* testEnv = 0; - -CCoeEnv* CCoeEnv::Static() -{ - testEnv = new CCoeEnv(); - return testEnv; -} - -CCoeEnv::CCoeEnv() : CActive(EPriorityNormal) -{ - -} - -CCoeEnv::~CCoeEnv() -{ -} - -void CCoeEnv::AddForegroundObserverL(MCoeForegroundObserver& /*aForegroundObserver*/) -{ - -} - -void UT_LogsForegroundWatcher::initTestCase() -{ -} - -void UT_LogsForegroundWatcher::cleanupTestCase() -{ - delete testEnv; - testEnv = 0; -} - -void UT_LogsForegroundWatcher::init() -{ - mWatcher = new LogsForegroundWatcher(); -} - -void UT_LogsForegroundWatcher::cleanup() -{ - delete mWatcher; -} - -void UT_LogsForegroundWatcher::testConstructor() -{ - QVERIFY( mWatcher ); -} - -void UT_LogsForegroundWatcher::testHandleLosingForeground() -{ - QSignalSpy spyGaining( mWatcher, SIGNAL(gainingForeground()) ); - QSignalSpy spyLosing( mWatcher, SIGNAL(losingForeground()) ); - mWatcher->HandleLosingForeground(); - QVERIFY( spyGaining.count() == 0 ); - QVERIFY( spyLosing.count() == 1 ); -} - -void UT_LogsForegroundWatcher::testHandleGainingForeground() -{ - QSignalSpy spyGaining( mWatcher, SIGNAL(gainingForeground()) ); - QSignalSpy spyLosing( mWatcher, SIGNAL(losingForeground()) ); - mWatcher->HandleGainingForeground(); - QVERIFY( spyGaining.count() == 1 ); - QVERIFY( spyLosing.count() == 0 ); -} - diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/ut_logssymbianos.pro --- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/ut_logssymbianos.pro Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/ut_logssymbianos.pro Thu Jun 24 14:44:14 2010 +0300 @@ -45,13 +45,11 @@ HEADERS += inc/ut_logseventparser.h HEADERS += inc/ut_logseventdataparser.h HEADERS += inc/ut_logsremove.h -HEADERS += inc/ut_logsforegroundwatcher.h HEADERS += ../../inc/logsdbconnector.h HEADERS += ../../inc/logsreader.h HEADERS += ../../inc/logsreaderstates.h HEADERS += ../../inc/logsreaderobserver.h HEADERS += ../../inc/logsremove.h -HEADERS += ../../inc/logsforegroundwatcher.h HEADERS += ../../../../../recents_plat/logs_engine_api/inc/logsevent.h HEADERS += ../../../inc/logseventdata.h HEADERS += ../../../inc/logscommondata.h @@ -66,14 +64,12 @@ SOURCES += src/ut_logseventparser.cpp SOURCES += src/ut_logseventdataparser.cpp SOURCES += src/ut_logsremove.cpp -SOURCES += src/ut_logsforegroundwatcher.cpp SOURCES += ../../src/logsdbconnector.cpp SOURCES += ../../src/logsreader.cpp SOURCES += ../../src/logsreaderstates.cpp SOURCES += ../../src/logseventparser.cpp SOURCES += ../../src/logseventdataparser.cpp SOURCES += ../../src/logsremove.cpp -SOURCES += ../../src/logsforegroundwatcher.cpp SOURCES += ../../../src/logsevent.cpp SOURCES += ../../../src/logseventdata.cpp SOURCES += ../../../src/logscommondata.cpp diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/src/logscall.cpp --- a/logsui/logsengine/src/logscall.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/src/logscall.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -128,9 +128,9 @@ LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::callToNumber(), type", callType ) if (callType == TypeLogsVoiceCall) { - createcall("com.nokia.services.telephony", "dial(QString)", number, false); + createcall("com.nokia.symbian.ICallDial", "dial(QString)", number, false); } else if (callType == TypeLogsVideoCall) { - createcall("com.nokia.services.telephony", "dialVideo(QString)", number, false); + createcall("com.nokia.symbian.ICallDial", "dialVideo(QString)", number, false); } else if (callType == TypeLogsVoIPCall){ if ( serviceId ){ @@ -140,7 +140,7 @@ // also contact must be passed if available if change service is // provided (no point change service and try to call service specific // uri with another service)? - createCallWithService("com.nokia.services.telephony", + createCallWithService("com.nokia.symbian.ICallDial", "dialVoipService(QString,int)", number, false, serviceId); } else { @@ -148,7 +148,7 @@ // offer any kind of service selection. Normally voip call // should always have service id set but if it's missing // for some reason, then this provides call failure UI. - createcall("com.nokia.services.telephony", + createcall("com.nokia.symbian.ICallDial", "dialVoip(QString)", number, false); } } @@ -189,6 +189,7 @@ void LogsCall::createcall(QString service, QString type, QString num, bool sync) { LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createcall(), num", num ) + LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createcall(), service", service ) XQServiceRequest snd(service, type, sync); snd << num; // Start call at bg, call UI will bring itself to foreground when ever diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/src/logscontact.cpp --- a/logsui/logsengine/src/logscontact.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/src/logscontact.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -200,7 +200,10 @@ SLOT(handleRequestCompleted(QVariant))); mService->setArguments(arguments); - + XQRequestInfo info; + info.setForeground(true); + mService->setInfo(info); + QVariant retValue; return mService->send(retValue); } diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/src/logsevent.cpp --- a/logsui/logsengine/src/logsevent.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/src/logsevent.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -642,18 +642,11 @@ { QString firstName = name.value(QContactName::FieldFirstName); QString lastName = name.value(QContactName::FieldLastName); - QString parsedName; - if (!lastName.isEmpty()) { - if (!firstName.isEmpty()) { - parsedName = - QString(QLatin1String("%1 %2")).arg(firstName).arg(lastName); - } - else { - parsedName = lastName; - } - } else if (!firstName.isEmpty()) { - parsedName = firstName; + QString parsedName = firstName; + if (!parsedName.isEmpty() && !lastName.isEmpty()) { + parsedName.append(" "); } + parsedName.append(lastName); return parsedName; } diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/src/logsmatchesmodel.cpp --- a/logsui/logsengine/src/logsmatchesmodel.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/src/logsmatchesmodel.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -165,7 +165,8 @@ } const LogsMatchesModelItemContainer& matchItem = static_cast( item ); - LogsMessage* logsMessage = new LogsMessage(matchItem.contact(), matchItem.number(),matchItem.contactName()); + LogsMessage* logsMessage = new LogsMessage( + matchItem.contact(), matchItem.number(),matchItem.contactNameSimple()); if (!logsMessage->isMessagingAllowed()) { delete logsMessage; logsMessage = 0; @@ -298,6 +299,39 @@ } // ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void LogsMatchesModel::eventsResetted() +{ + LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::eventsResetted()" ); + + QMap unusedEvents = mSearchEvents; + for ( int i = 0; i < mParentModel.rowCount(); ++i ){ + LogsEvent* event = qVariantValue( + mParentModel.data( mParentModel.index(i, 0), LogsModel::RoleFullEvent ) ); + if ( event ){ + QObject* key = mSearchEvents.key(event); + if ( key ){ + unusedEvents.remove(key); + } else { + addEventForSearching(i, *event); + } + } + } + + QMap::iterator unusedIt; + for (unusedIt = unusedEvents.begin(); unusedIt != unusedEvents.end(); ++unusedIt){ + mLogsCntFinder->deleteEntry(*unusedIt.key()); + mSearchEvents.remove(unusedIt.key()); + } + + forceSearchQuery(); + + LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::eventsResetted()" ); +} + +// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // @@ -315,7 +349,7 @@ this, SLOT(eventsAdded(const QModelIndex&,int,int))); connect( &mParentModel, SIGNAL(rowsRemoved(const QModelIndex&,int,int)), this, SLOT(eventsRemoved(const QModelIndex&,int,int))); - connect( &mParentModel, SIGNAL(modelReset()), this, SLOT(doModelReset())); + connect( &mParentModel, SIGNAL(modelReset()), this, SLOT(eventsResetted())); readEvents(0, mParentModel.rowCount()); mIconManager = new LogsThumbIconManager(); connect(mIconManager, SIGNAL(contactIconReady(int)), @@ -373,11 +407,7 @@ LogsEvent* event = qVariantValue( mParentModel.data( mParentModel.index(i, 0), LogsModel::RoleFullEvent ) ); if ( event ){ - QObject* entryHandle = new QObject(this); - LogsCntEntry* entry = new LogsCntEntry(*entryHandle, 0); - updateSearchEntry(*entry, *event); - mLogsCntFinder->insertEntry(i, entry); - mSearchEvents.insert(entryHandle, event); + addEventForSearching(i, *event); } } } @@ -447,10 +477,12 @@ // void LogsMatchesModel::doModelReset() { + LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::doModelReset()" ); qDeleteAll(mMatches); mMatches.clear(); mResultCount = 0; reset(); + LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::doModelReset()" ); } // ----------------------------------------------------------------------------- @@ -512,6 +544,19 @@ // // ----------------------------------------------------------------------------- // +void LogsMatchesModel::addEventForSearching(int index, LogsEvent& event) +{ + QObject* entryHandle = new QObject(this); + LogsCntEntry* entry = new LogsCntEntry(*entryHandle, 0); + updateSearchEntry(*entry, event); + mLogsCntFinder->insertEntry(index, entry); + mSearchEvents.insert(entryHandle, &event); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// LogsMatchesModelItemContainer::LogsMatchesModelItemContainer( LogsAbstractModel& parentModel, LogsThumbIconManager& thumbIconManager, @@ -594,6 +639,15 @@ // // ----------------------------------------------------------------------------- // +QString LogsMatchesModelItemContainer::contactNameSimple() const +{ + return mContactNameSimple; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// bool LogsMatchesModelItemContainer::isNull() const { return ( !mEvent && !mContactId ); @@ -651,7 +705,7 @@ if ( mEvent ){ mFormattedCallerId = getFormattedCallerId(entry); } else if ( mContactId > 0 ){ - getFormattedContactInfo(entry, mContactName, mContactNumber); + getFormattedContactInfo(entry, mContactName, mContactNameSimple, mContactNumber); mAvatarPath.clear(); mAvatarPath = entry.avatarPath(); } @@ -675,12 +729,7 @@ const LogsCntEntry& entry) const { QString callerId; - foreach( LogsCntText name, entry.firstName() ) { - callerId.append( name.richText() ); - if ( name.text().length() > 0 ) { - callerId.append(" "); - } - } + getFormattedName(callerId, entry.firstName()); if ( callerId.length() == 0 ) { callerId = entry.phoneNumber().richText(); @@ -695,24 +744,49 @@ // void LogsMatchesModelItemContainer::getFormattedContactInfo( const LogsCntEntry& entry, - QString& contactName, + QString& contactName, + QString& contactNameSimple, QString& contactNumber ) const { contactName.clear(); - foreach( LogsCntText name, entry.firstName() ) { - contactName.append( name.richText() ); + + getFormattedName(contactName, contactNameSimple, entry.firstName()); + getFormattedName(contactName, contactNameSimple, entry.lastName()); + + contactName = contactName.trimmed(); + contactNameSimple = contactNameSimple.trimmed(); + contactNumber = entry.phoneNumber().text(); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void LogsMatchesModelItemContainer::getFormattedName( + QString& formattedName, const QList& list) const +{ + foreach( LogsCntText name, list ) { if ( name.text().length() > 0 ) { - contactName.append(" "); + formattedName.append(name.richText()); + formattedName.append(" "); } } - - foreach( LogsCntText lastname, entry.lastName() ) { - contactName.append( lastname.richText() ); - if ( lastname.text().length() > 0 ) { - contactName.append(" "); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void LogsMatchesModelItemContainer::getFormattedName( + QString& formattedName, QString& formattedNameSimple, + const QList& list) const +{ + foreach( LogsCntText name, list ) { + if ( name.text().length() > 0 ) { + formattedName.append(name.richText()); + formattedName.append(" "); + formattedNameSimple.append(name.text()); + formattedNameSimple.append(" "); } } - contactName = contactName.trimmed(); - - contactNumber = entry.phoneNumber().text(); } diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/src/logsmessage.cpp --- a/logsui/logsengine/src/logsmessage.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/src/logsmessage.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -146,6 +146,9 @@ arguments.append(QVariant(contactId)); arguments.append(QVariant(displayName)); request.setArguments(arguments); + XQRequestInfo info; + info.setForeground(true); + request.setInfo(info); QVariant retValue; bool ret = request.send(retValue); LOGS_QDEBUG_2( "logs [ENG] <- LogsMessage::doSendMessageToNumber()", ret ) diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/tsrc/stubs/logscntfinder.h --- a/logsui/logsengine/tsrc/stubs/logscntfinder.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/tsrc/stubs/logscntfinder.h Thu Jun 24 14:44:14 2010 +0300 @@ -35,7 +35,7 @@ inline LogsCntText() : mHighlights(0){} inline const QString& text() const {return mText;} - inline int highlights() const {return mHighlights;} + int highlights() const; QString richText( QString startTag = QString(""), QString endTag = QString("")) const; @@ -48,6 +48,7 @@ friend class LogsCntEntry; friend class UT_LogsCntEntry; friend class UT_LogsCntFinder; + friend class UT_LogsMatchesModel; }; typedef QList LogsCntTextList; @@ -100,6 +101,7 @@ friend class UT_LogsCntEntry; friend class UT_LogsCntFinder; + friend class UT_LogsMatchesModel; }; typedef QList LogsCntEntryList; diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/tsrc/stubs/logscntfinder_stub.cpp --- a/logsui/logsengine/tsrc/stubs/logscntfinder_stub.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/tsrc/stubs/logscntfinder_stub.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -24,6 +24,8 @@ #include #include +QString testHighlights; + // ----------------------------------------------------------------------------- // LogsCntEntry::richText() // ----------------------------------------------------------------------------- @@ -42,6 +44,15 @@ } // ----------------------------------------------------------------------------- +// LogsCntEntry::highlights() +// ----------------------------------------------------------------------------- +// +int LogsCntText::highlights() const +{ + return testHighlights.length() ; +} + +// ----------------------------------------------------------------------------- // LogsCntEntry::LogsCntEntry() // ----------------------------------------------------------------------------- // @@ -204,6 +215,7 @@ // void LogsCntEntry::setHighlights( const QString& pattern ) { + testHighlights = pattern; } // ----------------------------------------------------------------------------- diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/tsrc/stubs/qthighway_stub.cpp --- a/logsui/logsengine/tsrc/stubs/qthighway_stub.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/tsrc/stubs/qthighway_stub.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -106,3 +106,9 @@ { return qtHighwayStubRequestBg; } + + +void XQRequestInfo::setForeground(bool on) +{ + Q_UNUSED(on) +} diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsmatchesmodel.h --- a/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsmatchesmodel.h Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsmatchesmodel.h Thu Jun 24 14:44:14 2010 +0300 @@ -52,6 +52,7 @@ void testDataAdded(); void testDataUpdated(); void testDataRemoved(); + void testDataResetted(); void testLogsMatches(); void testCreateContactWithNumber(); void testCreateCall(); diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/tsrc/ut_logsengine/src/ut_logscall.cpp --- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscall.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscall.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -119,21 +119,21 @@ { QtHighwayStubHelper::reset(); mLogsCall->call(LogsCall::TypeLogsVoiceCall); - QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" ); + QVERIFY( QtHighwayStubHelper::service() == "com.nokia.symbian.ICallDial" ); QVERIFY( QtHighwayStubHelper::message() == "dial(QString)" ); QVERIFY( QtHighwayStubHelper::isRequestBg() ); // Video call message is longer than voice call QtHighwayStubHelper::reset(); mLogsCall->call(LogsCall::TypeLogsVideoCall); - QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" ); + QVERIFY( QtHighwayStubHelper::service() == "com.nokia.symbian.ICallDial" ); QVERIFY( QtHighwayStubHelper::message() == "dialVideo(QString)" ); QVERIFY( QtHighwayStubHelper::isRequestBg() ); QtHighwayStubHelper::reset(); mLogsCall->mServiceId = 3; mLogsCall->call(LogsCall::TypeLogsVoIPCall); - QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" ); + QVERIFY( QtHighwayStubHelper::service() == "com.nokia.symbian.ICallDial" ); QVERIFY( QtHighwayStubHelper::message() == "dialVoipService(QString,int)" ); QVERIFY( QtHighwayStubHelper::isRequestBg() ); @@ -149,7 +149,7 @@ { QtHighwayStubHelper::reset(); mLogsCall->initiateCallback(); - QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" ); + QVERIFY( QtHighwayStubHelper::service() == "com.nokia.symbian.ICallDial" ); QVERIFY( QtHighwayStubHelper::message() == "dial(QString)" ); QVERIFY( QtHighwayStubHelper::isRequestBg() ); @@ -157,7 +157,7 @@ mLogsCall->mDefaultCall = LogsCall::TypeLogsVideoCall; QtHighwayStubHelper::reset(); mLogsCall->initiateCallback(); - QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" ); + QVERIFY( QtHighwayStubHelper::service() == "com.nokia.symbian.ICallDial" ); QVERIFY( QtHighwayStubHelper::message() == "dialVideo(QString)" ); QVERIFY( QtHighwayStubHelper::isRequestBg() ); @@ -165,7 +165,7 @@ QtHighwayStubHelper::reset(); mLogsCall->mServiceId = 3; mLogsCall->initiateCallback(); - QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" ); + QVERIFY( QtHighwayStubHelper::service() == "com.nokia.symbian.ICallDial" ); QVERIFY( QtHighwayStubHelper::message() == "dialVoipService(QString,int)" ); QVERIFY( QtHighwayStubHelper::isRequestBg() ); } diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/tsrc/ut_logsengine/src/ut_logsevent.cpp --- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsevent.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsevent.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -172,16 +172,16 @@ QtContactsStubsHelper::reset(); QContactName name; QtContactsStubsHelper::setContactNames("firstname", ""); - QVERIFY(event.parseContactName(name) == "firstname"); + QCOMPARE(event.parseContactName(name), QString("firstname")); QtContactsStubsHelper::setContactNames("firstname", "lastname"); - QVERIFY(event.parseContactName(name) == "firstname lastname"); + QCOMPARE(event.parseContactName(name), QString("firstname lastname")); QtContactsStubsHelper::setContactNames("", "lastname"); - QVERIFY(event.parseContactName(name) == "lastname"); + QCOMPARE(event.parseContactName(name), QString("lastname")); QtContactsStubsHelper::setContactNames("", ""); - QVERIFY(event.parseContactName(name) == ""); + QCOMPARE(event.parseContactName(name), QString("")); } void UT_LogsEvent::testSerialization() diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmatchesmodel.cpp --- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmatchesmodel.cpp Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmatchesmodel.cpp Thu Jun 24 14:44:14 2010 +0300 @@ -331,6 +331,55 @@ // // ----------------------------------------------------------------------------- // +void UT_LogsMatchesModel::testDataResetted() +{ + // Have few events and then get reset where one event is removed and + // one new event is added + // + LogsEvent* event = new LogsEvent(); + QString event1Name("event1"); + event->setRemoteParty(event1Name); + LogsEvent* event2 = new LogsEvent(); + QString event2Name("event2"); + event2->setRemoteParty(event2Name); + LogsEvent* event3 = new LogsEvent(); + QString event3Name("event3"); + event3->setRemoteParty(event3Name); + mModel->mEvents.append(event); + mModel->mEvents.append(event2); + mModel->mEvents.append(event3); + mMatchesModel->eventsAdded(QModelIndex(), 0, 2); + QCOMPARE( mMatchesModel->mSearchEvents.count(), 3 ); + QCOMPARE( mMatchesModel->mLogsCntFinder->mHistoryEvents.count(), 3 ); + QCOMPARE( mMatchesModel->mLogsCntFinder->mHistoryEvents.at(0)->firstName().at(0).text(), event1Name ); + QCOMPARE( mMatchesModel->mLogsCntFinder->mHistoryEvents.at(1)->firstName().at(0).text(), event2Name ); + QCOMPARE( mMatchesModel->mLogsCntFinder->mHistoryEvents.at(2)->firstName().at(0).text(), event3Name ); + + mModel->mEvents.clear(); + + LogsEvent* event4 = new LogsEvent(); + QString event4Name("event4"); + event4->setRemoteParty(event4Name); + mModel->mEvents.append(event4); + + mModel->mEvents.append(event); + mModel->mEvents.append(event3); + + QSignalSpy spy(mMatchesModel, SIGNAL(modelReset())); + mMatchesModel->eventsResetted(); + QCOMPARE( mMatchesModel->mSearchEvents.count(), 3 ); + QCOMPARE( mMatchesModel->mLogsCntFinder->mHistoryEvents.count(), 3 ); + QCOMPARE( mMatchesModel->mLogsCntFinder->mHistoryEvents.at(0)->firstName().at(0).text(), event4Name ); + QCOMPARE( mMatchesModel->mLogsCntFinder->mHistoryEvents.at(1)->firstName().at(0).text(), event1Name ); + QCOMPARE( mMatchesModel->mLogsCntFinder->mHistoryEvents.at(2)->firstName().at(0).text(), event3Name ); + QCOMPARE( spy.count(), 1 ); + delete event2; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// void UT_LogsMatchesModel::testLogsMatches() { QVERIFY( mMatchesModel->mLogsCntFinder ); @@ -487,9 +536,12 @@ // With contact, messaging supported LogsMatchesModelItemContainer item3(*mModel, *mMatchesModel->mIconManager, 2); item3.setContact(2); + item3.mContactName = "somename"; + item3.mContactNameSimple = "somename"; var = mMatchesModel->createMessage(item3); message = qVariantValue( var ); QVERIFY( message ); + QVERIFY( message->mDisplayName == "somename" ); delete message; } @@ -605,22 +657,26 @@ void UT_LogsMatchesModel::testGetFormattedContactInfo() { QString name; + QString nameSimple; QString number; QVERIFY( mMatchesModel->mIconManager ); // Entry is not initialized, name and number are empty LogsCntEntry entry(0); LogsMatchesModelItemContainer item(*mModel, *mMatchesModel->mIconManager, 0); - item.getFormattedContactInfo(entry, name, number); - QVERIFY( name.length() == 0 && number.length() == 0 ); + item.getFormattedContactInfo(entry, name, nameSimple, number); + QVERIFY( name.length() == 0 && nameSimple.length() == 0 && number.length() == 0 ); // Entry is initialized, name and number are not empty entry.setFirstName("long firstname"); entry.setLastName("long lastname"); entry.setPhoneNumber("number"); - item.getFormattedContactInfo(entry, name, number); - QVERIFY( name == "long firstname long lastname" ); - QVERIFY( number == "number" ); + entry.setHighlights("lo"); + item.getFormattedContactInfo(entry, name, nameSimple, number); + QCOMPARE( nameSimple, QString("long firstname long lastname") ); + QVERIFY( nameSimple.length() < name.length() ); + QCOMPARE( number, QString("number") ); + entry.setHighlights(""); } // ----------------------------------------------------------------------------- diff -r 41c0a814d878 -r 6c9acdc6adc0 logsui/tsrc/unittestrunner/unittest_qt_config.txt --- a/logsui/tsrc/unittestrunner/unittest_qt_config.txt Fri Jun 11 13:38:41 2010 +0300 +++ b/logsui/tsrc/unittestrunner/unittest_qt_config.txt Thu Jun 24 14:44:14 2010 +0300 @@ -1,4 +1,4 @@ ut_logsengine -noprompt,ut_logs_logsModel.xml,ut_logs_logsDetailsModel.xml,ut_logs_logsMatchesModel.xml,ut_logs_logsFilter.xml,ut_logs_logsCustomFilter.xml,ut_logs_logsCall.xml,ut_logs_logsContact.xml,ut_logs_logsMessage.xml,ut_logs_logsEvent.xml,ut_logs_logsEventData.xml ut_logssymbianos -noprompt,ut_logs_logsDbConnector.xml,ut_logs_logsRemove.xml,ut_logs_logsReader.xml,ut_logs_logsReaderStates.xml,ut_logs_logsEventParser.xml,ut_logs_logsEventDataParser.xml,ut_logs_logsForegroundWatcher.xml -ut_logscntfinder -noprompt,ut_logs_logsCntFinder.xml,ut_logs_logsPredictiveTranslator.xml,ut_logs_logscntentry.xml +ut_logscntfinder -noprompt,UT_LogsPredictiveTranslator.xml, UT_LogsPredictive12KeyTranslator.xml, UT_LogsPredictiveLatin12KeyTranslator.xml, UT_LogsPredictiveThai12KeyTranslator.xml, UT_LogsCntEntry.xml, UT_LogsCntFinder.xml ut_logsapp -noprompt,ut_logsMainWindow.xml,ut_logsRepository.xml,ut_logsViewManager.xml,ut_logsBaseView.xml,ut_logsRecentCallsView.xml,ut_logsDetailsView.xml,ut_logsMatchesView.xml,ut_logsEffectHandler.xml,ut_logsServiceHandler.xml,ut_logsPageIndicator.xml,ut_logsPageIndicatorItem.xml