--- a/layers.sysdef.xml Mon Aug 23 18:14:51 2010 +0300
+++ b/layers.sysdef.xml Fri Sep 03 14:26:05 2010 +0300
@@ -1,18 +1,22 @@
<?xml version="1.0"?>
-<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_0.dtd" [
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
<!ENTITY layer_real_source_path "sf/app/recents" >
]>
-<SystemDefinition name="recents" schema="1.5.0">
+<SystemDefinition name="recents" schema="1.5.1">
<systemModel>
+
<layer name="app_layer">
-
<module name="recents">
<unit unitID="recents" bldFile="&layer_real_source_path;" name="recents" mrp="" proFile="recents.pro"/>
</module>
-
</layer>
-
-
+
+ <layer name="unit_test_layer">
+ <module name="recents_unit_test">
+ <unit unitID="recents_unit_test" name="recents_unit_test" bldFile="&layer_real_source_path;/tsrc" mrp="" proFile="tsrc.pro"/>
+ </module>
+ </layer>
+
</systemModel>
</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logsapplication.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* 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 LOGSAPPLICATION_H
+#define LOGSAPPLICATION_H
+
+#include <QObject>
+#include <hbapplication.h>
+
+class LogsApplication : public HbApplication
+{
+ Q_OBJECT
+
+public:
+ LogsApplication(int &argc, char *argv[]);
+ ~LogsApplication();
+
+ bool logsFeaturePreloadingEnabled();
+ bool logsFeatureFakeExitEnabled();
+
+public slots: // from HbApplication
+
+ void testLogsAppEngineReady();
+ void testLogsHandleAppViewReady();
+signals:
+ /*!
+ * Testing framework support.
+ * Application ready signal is emitted after startup when UI is fully loaded and functional.
+ */
+ void applicationReady();
+
+private: //data for appplicationReady signal
+ bool mViewReady;
+ bool mReadCompleted;
+
+ // Temporary "feature" flags, to be replaced by real flags once those are known
+ bool mFeaturePreloadedEnabled;
+ bool mFeatureFakeExitEnabled;
+
+ friend class UT_LogsApplication;
+ friend class UT_LogsViewManager;
+};
+
+#endif // LOGSAPPLICATION_H
--- a/logsui/logsapp/inc/logsbaseview.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/inc/logsbaseview.h Fri Sep 03 14:26:05 2010 +0300
@@ -193,7 +193,7 @@
void updateDialpadCallAndMessagingActions();
bool tryMatchesViewTransition();
bool isDialpadInput() const;
- void ensureListPositioning( HbListView& list );
+ void ensureListPositioning( HbListView& list, bool listSizeDecreased );
void scrollToTopItem( HbListView* list );
void updateMenuVisibility();
--- a/logsui/logsapp/inc/logsmainwindow.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/inc/logsmainwindow.h Fri Sep 03 14:26:05 2010 +0300
@@ -21,7 +21,11 @@
#include <QObject>
#include <hbmainwindow.h>
+class XQKeyCapture;
+/**
+ *
+ */
class LogsMainWindow : public HbMainWindow
{
Q_OBJECT
@@ -46,9 +50,13 @@
void callKeyPressed();
void localeChanged();
void appGainedForeground();
-
+
+private:
+ void startKeyCapture();
+ void stopKeyCapture();
private:
+ XQKeyCapture* mKeyCapture;
bool mForeground;
bool mLocaleChanged;
--- a/logsui/logsapp/inc/logsrecentcallsview.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/inc/logsrecentcallsview.h Fri Sep 03 14:26:05 2010 +0300
@@ -105,17 +105,16 @@
void changeView(XQService::LogsViewIndex view);
void updateMenu();
void handleMissedCallsMarking();
+ void handleMissedCallsCounter();
//from HbWidget
void gestureEvent(QGestureEvent *event);
- bool eventFilter(QObject *obj, QEvent *event);
int getListItemTextWidth();
bool decideListMoveDirection(
QSwipeGesture::SwipeDirection direction);
bool moveToLeft(bool toLeft) const;
-
private:
HbGroupBox* mViewName; //not owned
--- a/logsui/logsapp/inc/logsviewmanager.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/inc/logsviewmanager.h Fri Sep 03 14:26:05 2010 +0300
@@ -77,16 +77,24 @@
void saveActivity();
void closeEmbeddedApplication();
void appGainedForeground();
+ void activityRequested(const QString &activityId);
private:
bool doActivateView(LogsAppViewId viewId, bool showDialpad,
- QVariant args, const QString& dialpadText = QString());
+ QVariant args, const QString& dialpadText = QString(),
+ bool reset = false);
bool loadActivity();
LogsAppViewId checkMatchesViewTransition(
LogsAppViewId viewId, const QString& dialpadText);
void handleFirstActivation();
LogsBaseView* createView(LogsAppViewId viewId);
+ void doFakeExit();
+ bool doLoadActivity(const QString& activityId);
+ void clearActivities();
+ void activateViewViaService(
+ LogsAppViewId viewId, bool showDialpad,
+ const QString& dialpadText, const QVariant& args = QVariant());
private: //data
--- a/logsui/logsapp/logsapp.pro Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/logsapp.pro Fri Sep 03 14:26:05 2010 +0300
@@ -33,6 +33,7 @@
# Input
HEADERS += inc/logsmainwindow.h
+HEADERS += inc/logsapplication.h
HEADERS += inc/logsviewmanager.h
HEADERS += inc/logsbaseview.h
HEADERS += inc/logsrecentcallsview.h
@@ -47,6 +48,7 @@
SOURCES += src/main.cpp
SOURCES += src/logsmainwindow.cpp
+SOURCES += src/logsapplication.cpp
SOURCES += src/logsviewmanager.cpp
SOURCES += src/logscomponentrepository.cpp
SOURCES += src/logsbaseview.cpp
@@ -63,7 +65,7 @@
TARGET.UID2 = 0x100039CE
TARGET.UID3 = 0x101F4CD5
TARGET.CAPABILITY = CAP_APPLICATION NetworkControl
- LIBS += -lxqservice -lxqserviceutil -llogsengine -ldialpad
+ LIBS += -lxqservice -lxqserviceutil -llogsengine -ldialpad -lxqkeycapture -ltstaskmonitorclient
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logsapplication.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2009-2010 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 <QObject>
+#include <QString>
+#include "logsapplication.h"
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsApplication::LogsApplication(int &argc, char *argv[])
+ : HbApplication(argc, argv),mViewReady(false),mReadCompleted(false),
+ mFeaturePreloadedEnabled(false), mFeatureFakeExitEnabled(false)
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsApplication::~LogsApplication()
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsApplication::logsFeaturePreloadingEnabled()
+{
+ return mFeaturePreloadedEnabled;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsApplication::logsFeatureFakeExitEnabled()
+{
+ return mFeatureFakeExitEnabled;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsApplication::testLogsAppEngineReady(){
+ if (mViewReady && !mReadCompleted){
+ emit applicationReady();
+ }
+ mReadCompleted = true;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsApplication::testLogsHandleAppViewReady(){
+ if (mReadCompleted && !mViewReady){
+ emit applicationReady();
+ }
+ mViewReady = true;
+}
+
+// end of file
--- a/logsui/logsapp/src/logsbaseview.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/src/logsbaseview.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -131,10 +131,9 @@
void LogsBaseView::resetView()
{
LOGS_QDEBUG( "logs [UI] -> LogsBaseView::resetView()" );
- mDialpad->editor().setText(QString());
- if ( mDialpad->isOpen() ){
- mDialpad->closeDialpad();
- }
+
+ scrollToTopItem(listView());
+
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::resetView()" );
}
@@ -637,6 +636,11 @@
contactAction->setText(hbTrId("txt_dialer_ui_menu_open_contact"));
QObject::connect( contactAction, SIGNAL(triggered()),
mContact, SLOT(open()) );
+ } else if (mContact->allowedRequestType() ==
+ LogsContact::TypeLogsContactOpenGroup) {
+ contactAction->setText(hbTrId("txt_dialer_menu_open_group"));
+ QObject::connect( contactAction, SIGNAL(triggered()),
+ mContact, SLOT(open()) );
}
else {
contactAction->setText(hbTrId("txt_common_menu_add_to_contacts"));
@@ -983,7 +987,7 @@
SLOT(deleteEventAnswer(int)),
HbMessageBox::Ok | HbMessageBox::Cancel,
new HbLabel(hbTrId("txt_dialer_ui_title_delete_event")));
- }
+ }
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::deleteEvent()" );
}
@@ -1096,7 +1100,8 @@
mRepository.loadSection( viewId(), newSection );
if ( sectionChanged ){
- ensureListPositioning( list );
+ bool listSizeDecreased(mDialpad->isOpen());
+ ensureListPositioning( list, listSizeDecreased );
}
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::updateListSize()" );
@@ -1218,39 +1223,60 @@
//
// -----------------------------------------------------------------------------
//
-void LogsBaseView::ensureListPositioning( HbListView& list )
+void LogsBaseView::ensureListPositioning(HbListView& list, bool listSizeDecreased)
{
LOGS_QDEBUG( "logs [UI] -> LogsBaseView::ensureListPositioning()" );
-
+
HbWidget* content =
qobject_cast<HbWidget*>( mRepository.findWidget( logsContentId ) );
QList<HbAbstractViewItem *> 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);
+ LOGS_QDEBUG_2( "logs [UI] contentsRect:", rect );
+
+ // Important to force geometry as otherwise in dialpad opening case,
+ // list is not scrollable if having few items (e.g. 4), find out current
+ // fully visible item before geometry change so that list can be positioned
+ // correctly
+ HbAbstractViewItem* firstFullyVisibleItem = visibleItems.at(0);
+ qreal itemHeight = firstFullyVisibleItem->size().height();
- HbScrollArea::ScrollBarPolicy prevPolicy = list.verticalScrollBarPolicy();
- list.setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
- list.setVerticalScrollBarPolicy(prevPolicy);
+ // If at least 3/4 of the item is visible, it is considered as first fully visible
+ bool fullyVisible = ( firstFullyVisibleItem->mapRectToItem(
+ &list, firstFullyVisibleItem->boundingRect()).y() + itemHeight / 4 >= 0 );
+ if ( !fullyVisible && visibleItems.count() > 1 ){
+ firstFullyVisibleItem = visibleItems.at(1);
+ }
+ QRectF listRect = rect;
+ listRect.adjust(0, list.pos().y(), 0, 0);
+ LOGS_QDEBUG_2( "logs [UI] listRect:", listRect );
+ list.setGeometry(listRect);
- qreal itemHeight = visibleItems.at(0)->size().height();
HbModelIterator* modelIt = list.modelIterator();
+ bool allItemsFitToReservedRect = true;
if ( modelIt && itemHeight > 0 ) {
int maxVisibleItems = rect.height() / itemHeight;
LOGS_QDEBUG_2( "logs [UI] max visible items:", maxVisibleItems );
- if ( modelIt->indexCount() <= maxVisibleItems ){
+ allItemsFitToReservedRect = ( modelIt->indexCount() <= maxVisibleItems );
+ if ( allItemsFitToReservedRect ){
// All items can fit the rect reserved for the list, force them to fit
list.ensureVisible(QPointF(0,0));
- } else if ( visibleItems.count() < maxVisibleItems ) {
+ } else {
// 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);
+ // area so that current fully visible item is tried to be set to top
+ list.scrollTo(firstFullyVisibleItem->modelIndex(),
+ HbAbstractItemView::PositionAtTop);
+
}
}
- }
+ if ( listSizeDecreased && !allItemsFitToReservedRect ){
+ // Make sure that user understands that list is scrollable after geometry
+ // changed to smaller
+ HbScrollArea::ScrollBarPolicy prevPolicy = list.verticalScrollBarPolicy();
+ list.setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
+ list.setVerticalScrollBarPolicy(prevPolicy);
+ }
+ }
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::ensureListPositioning()" );
}
@@ -1261,9 +1287,16 @@
void LogsBaseView::scrollToTopItem( HbListView* list )
{
LOGS_QDEBUG( "logs [UI] -> LogsBaseView::scrollToTopItem()" );
-
- if ( list && list->verticalScrollBar() ){
- list->verticalScrollBar()->setValue(0.0);
+
+ if ( list ){
+ if ( model() && model()->hasIndex(0,0) ) {
+ QModelIndex topIndex = model()->index(0,0);
+ list->scrollTo( topIndex );
+ }
+ // Force also scrollbar to show itself correctly
+ if ( list->verticalScrollBar() ){
+ list->verticalScrollBar()->setValue(0.0);
+ }
}
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::scrollToTopItem()" );
--- a/logsui/logsapp/src/logscomponentrepository.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/src/logscomponentrepository.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -260,7 +260,6 @@
//
void LogsComponentRepository::lazyInit()
{
- mModel->refreshData();
recentCallsView(true);
detailsView(true);
matchesView(true);
--- a/logsui/logsapp/src/logsdetailsview.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/src/logsdetailsview.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -413,7 +413,7 @@
}
// -----------------------------------------------------------------------------
-// LogsDetailsView::updateWidgetsSizeAndLayout
+//
// -----------------------------------------------------------------------------
//
void LogsDetailsView::updateWidgetsSizeAndLayout()
@@ -427,26 +427,46 @@
LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::updateWidgetsSizeAndLayout()" );
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
LogsDetailsViewItem::LogsDetailsViewItem()
: HbListViewItem(0)
{
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
LogsDetailsViewItem::~LogsDetailsViewItem( )
{
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
void LogsDetailsViewItem::pressStateChanged(bool value, bool animate)
{
Q_UNUSED(value);
Q_UNUSED(animate);
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
HbAbstractViewItem *LogsDetailsViewItem::createItem()
{
return new LogsDetailsViewItem(*this);
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
void LogsDetailsViewItem::updateChildItems()
{
HbListViewItem::updateChildItems();
--- a/logsui/logsapp/src/logsmainwindow.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/src/logsmainwindow.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -20,27 +20,31 @@
#include <QKeyEvent>
#include <QApplication>
#include <xqserviceutil.h>
+#include <xqkeycapture.h>
// -----------------------------------------------------------------------------
-// LogsMainWindow::LogsMainWindow
+//
// -----------------------------------------------------------------------------
//
LogsMainWindow::LogsMainWindow()
: HbMainWindow(), mForeground(false), mLocaleChanged(false)
{
qApp->installEventFilter(this);
+ mKeyCapture = new XQKeyCapture;
}
// -----------------------------------------------------------------------------
-// LogsMainWindow::~LogsMainWindow
+//
// -----------------------------------------------------------------------------
//
LogsMainWindow::~LogsMainWindow()
{
+ stopKeyCapture();
+ delete mKeyCapture;
}
// -----------------------------------------------------------------------------
-// LogsMainWindow::sendAppToBackground
+//
// -----------------------------------------------------------------------------
//
void LogsMainWindow::sendAppToBackground()
@@ -51,7 +55,7 @@
}
// -----------------------------------------------------------------------------
-// LogsMainWindow::bringAppToForeground
+//
// -----------------------------------------------------------------------------
//
void LogsMainWindow::bringAppToForeground()
@@ -63,7 +67,7 @@
}
// -----------------------------------------------------------------------------
-// LogsMainWindow::isForeground
+//
// -----------------------------------------------------------------------------
//
bool LogsMainWindow::isForeground() const
@@ -72,15 +76,15 @@
}
// -----------------------------------------------------------------------------
-// LogsMainWindow::keyPressEvent
+//
// -----------------------------------------------------------------------------
//
void LogsMainWindow::keyPressEvent( QKeyEvent *event )
{
LOGS_QDEBUG_2( "LogsMainWindow::keyPressEvent, key", event->key() );
- if ( event->key() == Qt::Key_Call || event->key() == Qt::Key_Yes ) {
- // Handling at window level seems to be only way to avoid other
- // applications to handle call key as well.
+ if ( event->key() == Qt::Key_Call
+ || event->key() == Qt::Key_Yes
+ || event->key() == Qt::Key_Enter ) {
emit callKeyPressed();
event->accept();
return;
@@ -89,13 +93,14 @@
}
// -----------------------------------------------------------------------------
-// LogsMainWindow::eventFilter
+//
// -----------------------------------------------------------------------------
//
bool LogsMainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::ApplicationActivate) {
LOGS_QDEBUG( "logs [UI] -> eventFilter(), QEvent::ApplicationActivate" );
+ startKeyCapture();
mForeground = true;
if (mLocaleChanged) {
LOGS_QDEBUG( "logs [UI] -> locale changed when we were on BG" );
@@ -103,8 +108,9 @@
mLocaleChanged = false;
}
emit appGainedForeground();
- } else if (event->type() == QEvent::ApplicationDeactivate) {
+ } else if (event->type() == QEvent::ApplicationDeactivate ) {
LOGS_QDEBUG( "logs [UI] -> eventFilter(), QEvent::ApplicationDeactivate" );
+ stopKeyCapture();
mForeground = false;
} else if (event->type() == QEvent::LocaleChange) {
if (mForeground) {
@@ -116,3 +122,23 @@
return HbMainWindow::eventFilter(obj,event);
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMainWindow::startKeyCapture()
+{
+ mKeyCapture->captureKey(Qt::Key_Yes);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMainWindow::stopKeyCapture()
+{
+ if ( mKeyCapture ){
+ mKeyCapture->cancelCaptureKey(Qt::Key_Yes);
+ }
+}
--- a/logsui/logsapp/src/logsrecentcallsview.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/src/logsrecentcallsview.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -21,9 +21,6 @@
#include "logsmodel.h"
#include "logsdefs.h"
#include "logslogger.h"
-#include "logscall.h"
-#include "logsmessage.h"
-#include "logscontact.h"
#include "logseffecthandler.h"
#include "logsmatchesmodel.h"
#include "logspageindicator.h"
@@ -46,7 +43,6 @@
#include <hbactivitymanager.h>
#include <hbstyleloader.h>
#include <QTimer>
-#include <QApplication>
Q_DECLARE_METATYPE(LogsMatchesModel*)
@@ -128,8 +124,10 @@
// or if view has to be changed
if ( !mFilter || ( !args.isNull() && (mCurrentView != view) ) ) {
updateView( view );
+ } else {
+ activateEmptyListIndicator(mFilter);
+ handleMissedCallsCounter();
}
- activateEmptyListIndicator(mFilter);
mPageIndicator->setActiveItemIndex(mConversionMap.value(mCurrentView));
@@ -137,8 +135,6 @@
mEmptyListLabelX = mEmptyListLabel->pos().x();
}
- qApp->installEventFilter(this);
-
LogsBaseView::activationCompleted();
LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::activated()" );
@@ -156,7 +152,6 @@
LogsBaseView::deactivated();
deactivateEmptyListIndicator(mFilter);
- qApp->removeEventFilter(this);
}
// -----------------------------------------------------------------------------
@@ -383,7 +378,8 @@
LogsFilter::FilterType filter = getFilter( view );
updateFilter(filter);
updateViewName();
- updateContextMenuItems(mCurrentView);
+ updateContextMenuItems(mCurrentView);
+ handleMissedCallsCounter();
LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateView()" );
}
@@ -487,7 +483,7 @@
scrollToTopItem(mListView);
activateEmptyListIndicator(mFilter);
-
+
LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateFilter() " );
} else {
LOGS_QWARNING( "logs [UI] LogsRecentCallsView::updateFilter(), !no list widget!" );
@@ -548,35 +544,6 @@
return filter;
}
-
-// -----------------------------------------------------------------------------
-// LogsRecentCallsView::eventFilter
-// -----------------------------------------------------------------------------
-//
-bool LogsRecentCallsView::eventFilter(QObject *obj, QEvent *event)
-{
- //This is a hack to fix ou1cimx1#481152(horizontal swiping initiates call)
- //Since w26 HbAbstractViewItemPrivate is setting threshold for Tap gesture
- //to be the bounding rect (i.e. if swiping is happening inside one list item
- //it will also be considered as a tap => item activated => call)
- //We are trying to prevent usage of the list item rect threshold by
- //setting "horizontallyRestricted" property.
- //See HbAbstractViewItemPrivate::tapTriggered() and
- //HbTapGestureLogic::handleMouseMove() for more info
- if (event->type() == QEvent::Gesture) {
- QGestureEvent* gesture = static_cast<QGestureEvent*> (event);
- QTapGesture* tap = qobject_cast<QTapGesture*>(gesture->gesture(Qt::TapGesture));
- //only change property if swiping on our list, since for the menu it is
- //fine to generate tap gesture event during swiping on one item
- bool tapOnListView = (mListView && mListView->currentViewItem() == obj);
- if (tap && tapOnListView && tap->state() == Qt::GestureStarted) {
- tap->setProperty("horizontallyRestricted", true);
- LOGS_QDEBUG( "logs [UI] TapGesture on list, setting horizontallyRestricted" );
- }
- }
- return LogsBaseView::eventFilter(obj,event);
-}
-
// -----------------------------------------------------------------------------
// LogsRecentCallsView::gestureEvent
// -----------------------------------------------------------------------------
@@ -587,15 +554,26 @@
if (gesture) {
LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::gestureEvent()" );
HbSwipeGesture* swipe = static_cast<HbSwipeGesture *>(gesture);
- if (swipe && swipe->state() == Qt::GestureFinished) {
- LOGS_QDEBUG_2( "logs [UI] sceneSwipeAngle: ", swipe->sceneSwipeAngle() );
- LOGS_QDEBUG_2( "logs [UI] swipeAngle: ", swipe->swipeAngle() );
-
+ if (swipe) {
QSwipeGesture::SwipeDirection direction = swipe->sceneHorizontalDirection();
- if ( decideListMoveDirection(direction) )
- event->accept(Qt::SwipeGesture);
+ if (swipe->state() == Qt::GestureStarted) {
+ //fix for ou1cimx1#481152, if policy not set then every swipe
+ //within list item boundaries will also activate list item
+ if (direction == QSwipeGesture::Left
+ || direction == QSwipeGesture::Right) {
+ swipe->setGestureCancelPolicy(QGesture::CancelAllInContext);
+ LOGS_QDEBUG( "logs [UI] swipe->state() == Qt::GestureStarted" );
+ }
+ } else if (swipe->state() == Qt::GestureFinished) {
+ LOGS_QDEBUG_2( "logs [UI] sceneSwipeAngle: ", swipe->sceneSwipeAngle() );
+ LOGS_QDEBUG_2( "logs [UI] swipeAngle: ", swipe->swipeAngle() );
+
+ if ( decideListMoveDirection(direction) ) {
+ event->accept(Qt::SwipeGesture);
+ }
}
}
+ }
}
// -----------------------------------------------------------------------------
@@ -918,3 +896,16 @@
}
return toLeft;
}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::handleMissedCallsCounter
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::handleMissedCallsCounter()
+{
+ if (mModel && mCurrentView == XQService::LogsViewMissed) {
+ LOGS_QDEBUG( "logs [UI] <-> LogsRecentCallsView::clearMissedCallsCounter()" );
+ mModel->clearMissedCallsCounter();
+ }
+}
+
--- a/logsui/logsapp/src/logsviewmanager.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/src/logsviewmanager.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -26,6 +26,7 @@
#include "logsservicehandler.h"
#include "logsservicehandlerold.h"
#include "logsmainwindow.h"
+#include "logsapplication.h"
//SYSTEM
#include <hbmainwindow.h>
@@ -35,6 +36,7 @@
#include <dialpad.h>
#include <hbactivitymanager.h>
#include <hbapplication.h>
+#include <tstasksettings.h>
// -----------------------------------------------------------------------------
// LogsViewManager::LogsViewManager
@@ -97,10 +99,8 @@
void LogsViewManager::changeRecentViewViaService(
XQService::LogsViewIndex view, bool showDialpad, QString dialpadText)
{
- closeEmbeddedApplication();
- mMainWindow.bringAppToForeground();
- mComponentsRepository->dialpad()->editor().setText(dialpadText);
- changeRecentView(view, showDialpad);
+ QVariant args(view);
+ activateViewViaService(LogsRecentViewId, showDialpad, dialpadText, args);
}
// -----------------------------------------------------------------------------
@@ -109,12 +109,7 @@
//
void LogsViewManager::changeMatchesViewViaService(QString dialpadText)
{
- LOGS_QDEBUG( "logs [UI] -> LogsViewManager::changeMatchesView()" );
- closeEmbeddedApplication();
- mMainWindow.bringAppToForeground();
- mComponentsRepository->dialpad()->editor().setText(dialpadText);
- doActivateView(LogsMatchesViewId, true, QVariant());
- LOGS_QDEBUG( "logs [UI] <- LogsViewManager::changeMatchesView()" );
+ activateViewViaService(LogsMatchesViewId, true, dialpadText);
}
// -----------------------------------------------------------------------------
@@ -136,7 +131,11 @@
{
LOGS_QDEBUG( "logs [UI] -> LogsViewManager::proceedExit()" );
- qApp->quit();
+ if ( static_cast<LogsApplication*>( qApp )->logsFeatureFakeExitEnabled() ){
+ doFakeExit();
+ } else {
+ qApp->quit();
+ }
LOGS_QDEBUG( "logs [UI] <- LogsViewManager::proceedExit()" );
}
@@ -223,7 +222,8 @@
// -----------------------------------------------------------------------------
//
bool LogsViewManager::doActivateView(
- LogsAppViewId viewId, bool showDialpad, QVariant args, const QString& dialpadText)
+ LogsAppViewId viewId, bool showDialpad,
+ QVariant args, const QString& dialpadText, bool reset)
{
LOGS_QDEBUG( "logs [UI] -> LogsViewManager::doActivateView()" );
@@ -251,6 +251,9 @@
if ( newView ){
mViewStack.insert(0, newView);
+ if ( reset ){
+ newView->resetView();
+ }
mMainWindow.setCurrentView(newView);
//Setting mainwindow interactive to enable user input during
//view switching animation.
@@ -289,9 +292,6 @@
connect( &mMainWindow, SIGNAL(localeChanged()),
newView, SLOT(localeChanged()),
Qt::UniqueConnection );
-
- // First activation completed, clear counter
- mComponentsRepository->model()->clearMissedCallsCounter();
}
LOGS_QDEBUG( "logs [UI] <- LogsViewManager::completeViewActivation()" );
}
@@ -319,11 +319,9 @@
return;
}
+ clearActivities();
+
HbActivityManager* activityManager = static_cast<HbApplication*>(qApp)->activityManager();
- foreach ( LogsBaseView* view, mViewStack ){
- view->clearActivity(*activityManager);
- }
-
QVariantHash metaData;
LOGS_QDEBUG( "logs [UI] Start taking screenshot" );
QImage* img = new QImage(mMainWindow.rect().size(), QImage::Format_ARGB32_Premultiplied);
@@ -361,48 +359,9 @@
bool LogsViewManager::loadActivity()
{
LOGS_QDEBUG( "logs [UI] -> LogsViewManager::loadActivity()" );
- bool loaded = false;
HbApplication* hbApp = static_cast<HbApplication*>(qApp);
QString activityId = hbApp->activateId();
- LOGS_QDEBUG_2( "logs [UI] activity id:", activityId );
- bool ok = hbApp->activityManager()->waitActivity();
- if ( !ok ){
- LOGS_QDEBUG( "logs [UI] Activity reschedule failed" );
- }
-
- LogsBaseView* matchingView = 0;
- for ( int i = 0; i < mViewStack.count() && !matchingView; i++ ){
- if ( mViewStack.at(i)->matchWithActivityId(activityId) ){
- matchingView = mViewStack.at(i);
- }
- }
-
- QList<QVariantHash> 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<LogsAppViewId>(viewId));
- }
-
- if ( matchingView ){
- // Should have only one param hash in the list, use first always
- QList<QVariantHash> allParams = hbApp->activityManager()->activities();
- QVariantHash params = allParams.isEmpty() ? QVariantHash() : allParams.at(0);
- LOGS_QDEBUG_2( "logs [UI] Activity params", params );
- bool showDialpad = params.value(logsActivityParamShowDialpad).toBool();
- QString dialpadText = params.value(logsActivityParamDialpadText).toString();
-
- QByteArray serializedActivity = hbApp->activateData().toByteArray();
- QDataStream stream(&serializedActivity, QIODevice::ReadOnly);
-
- QVariant args = matchingView->loadActivity(activityId, stream, params);
- loaded = doActivateView( matchingView->viewId(), showDialpad, args, dialpadText );
- }
- LOGS_QDEBUG_2( "logs [UI] <- LogsViewManager::loadActivity() loaded:", loaded );
- return loaded;
+ return doLoadActivity(activityId);
}
// -----------------------------------------------------------------------------
@@ -433,24 +392,27 @@
void LogsViewManager::handleFirstActivation()
{
LOGS_QDEBUG( "logs [UI] -> LogsViewManager::handleFirstActivation()" );
- bool useSavedActivity( static_cast<HbApplication*>(qApp)->activateReason() ==
- Hb::ActivationReasonActivity );
+ LogsApplication* app = static_cast<LogsApplication*>(qApp);
+ Hb::ActivationReason reason = app->activateReason();
+ bool isStartedByService(
+ mService.isStartedUsingService() || mServiceOld.isStartedUsingService() );
+ if ( !app->logsFeaturePreloadingEnabled() ||
+ reason == Hb::ActivationReasonActivity ||
+ isStartedByService ){
+ // Start immediately using all possible resources
+ mComponentsRepository->model()->refreshData();
+ }
- if ( useSavedActivity && loadActivity() ){
+ if ( reason == Hb::ActivationReasonActivity && loadActivity() ){
LOGS_QDEBUG( "logs [UI] loaded saved activity" );
mMainWindow.bringAppToForeground();
- } else if ( mFirstActivation && !mService.isStartedUsingService() &&
- !mServiceOld.isStartedUsingService()) {
+ } else if ( mFirstActivation && !isStartedByService ) {
changeRecentView( XQService::LogsViewAll, false );
mMainWindow.bringAppToForeground();
}
- // Clear previously stored activations
+ clearActivities();
- HbActivityManager* activityManager = static_cast<HbApplication*>(qApp)->activityManager();
- foreach ( LogsBaseView* view, mViewStack ){
- view->clearActivity(*activityManager);
- }
LOGS_QDEBUG( "logs [UI] <- LogsViewManager::handleFirstActivation()" );
}
@@ -498,5 +460,131 @@
foreach ( LogsBaseView* view, mViewStack ){
disconnect( view, SIGNAL(exitAllowed()), this, SLOT(proceedExit()) );
}
+
+ if ( static_cast<LogsApplication*>( qApp )->logsFeatureFakeExitEnabled() ||
+ static_cast<LogsApplication*>( qApp )->logsFeaturePreloadingEnabled() ){
+ mComponentsRepository->model()->refreshData();
+ TsTaskSettings taskSettings;
+ taskSettings.setVisibility(true);
+ }
+
LOGS_QDEBUG( "logs [UI] <- LogsViewManager::appGainedForeground()" );
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::activityRequested(const QString &activityId)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::activityRequested()" );
+ if ( doLoadActivity(activityId) ){
+ clearActivities();
+ mMainWindow.bringAppToForeground();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::activityRequested()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::doFakeExit()
+{
+ saveActivity();
+ HbActivityManager* activityManager =
+ static_cast<HbApplication*>(qApp)->activityManager();
+ connect( activityManager, SIGNAL(activityRequested(QString)),
+ this, SLOT(activityRequested(QString)), Qt::UniqueConnection );
+ mComponentsRepository->model()->compressData();
+ TsTaskSettings taskSettings;
+ taskSettings.setVisibility(false);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsViewManager::doLoadActivity(const QString& activityId)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::doLoadActivity()" );
+ bool loaded = false;
+ HbApplication* hbApp = static_cast<HbApplication*>(qApp);
+ LOGS_QDEBUG_2( "logs [UI] activity id:", activityId );
+ bool ok = hbApp->activityManager()->waitActivity();
+ if ( !ok ){
+ LOGS_QDEBUG( "logs [UI] Activity reschedule failed" );
+ }
+
+ LogsBaseView* matchingView = 0;
+ for ( int i = 0; i < mViewStack.count() && !matchingView; i++ ){
+ if ( mViewStack.at(i)->matchWithActivityId(activityId) ){
+ matchingView = mViewStack.at(i);
+ }
+ }
+
+ QList<QVariantHash> 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<LogsAppViewId>(viewId));
+ }
+
+ if ( matchingView ){
+ // Should have only one param hash in the list, use first always
+ QList<QVariantHash> allParams = hbApp->activityManager()->activities();
+ QVariantHash params = allParams.isEmpty() ? QVariantHash() : allParams.at(0);
+ LOGS_QDEBUG_2( "logs [UI] Activity params", params );
+ bool showDialpad = params.value(logsActivityParamShowDialpad).toBool();
+ QString dialpadText = params.value(logsActivityParamDialpadText).toString();
+
+ QByteArray serializedActivity = hbApp->activateData().toByteArray();
+ QDataStream stream(&serializedActivity, QIODevice::ReadOnly);
+
+ QVariant args = matchingView->loadActivity(activityId, stream, params);
+ loaded = doActivateView(
+ matchingView->viewId(), showDialpad, args, dialpadText, true );
+ }
+
+ LOGS_QDEBUG_2( "logs [UI] <- LogsViewManager::doLoadActivity() loaded:", loaded );
+ return loaded;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::clearActivities()
+{
+ HbApplication* hbApp = static_cast<HbApplication*>(qApp);
+ HbActivityManager* activityManager = hbApp->activityManager();
+ foreach ( LogsBaseView* view, mViewStack ){
+ view->clearActivity(*activityManager);
+ }
+ disconnect( activityManager, SIGNAL(activityRequested(QString)),
+ this, SLOT(activityRequested(QString)) );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::activateViewViaService(
+ LogsAppViewId viewId, bool showDialpad,
+ const QString& dialpadText, const QVariant& args)
+{
+ LOGS_QDEBUG_2( "logs [UI] -> LogsViewManager::activateViewViaService()", viewId );
+ clearActivities();
+ closeEmbeddedApplication();
+ mMainWindow.bringAppToForeground();
+ Dialpad* dpad = mComponentsRepository->dialpad();
+ if ( !showDialpad ){
+ dpad->closeDialpad();
+ }
+ dpad->editor().setText(dialpadText);
+ doActivateView(viewId, showDialpad, args, QString(), true);
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::activateViewViaService()" );
+}
--- a/logsui/logsapp/src/main.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/src/main.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -15,6 +15,7 @@
*
*/
//USER
+#include "logsapplication.h"
#include "logsmainwindow.h"
#include "logsviewmanager.h"
#include "logsservicehandler.h"
@@ -39,7 +40,7 @@
{
LOGS_QDEBUG( "logs [UI] -> main()" )
- HbApplication app(argc, argv);
+ LogsApplication app(argc, argv);
#ifdef LOGS_USE_QTRANSLATOR
QString lang = QLocale::system().name();
@@ -63,6 +64,8 @@
#endif
LogsMainWindow window;
+ //Application ready signal is emitted after startup when UI is fully loaded and functional
+ QObject::connect( &window, SIGNAL(viewReady()), &app, SLOT(testLogsHandleAppViewReady()) );
HbStyleLoader::registerFilePath(":/logslayouts");
// Create service handler asap so that services are published fast.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsapplication.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,58 @@
+
+/*
+* 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_LOGSAPPLICATION_H
+#define UT_LOGSAPPLICATION_H
+
+
+#include <QObject>
+
+class LogsApplication;
+
+class UT_LogsApplication : 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 testtestLogsAppEngineReady();
+ void testtestLogsHandleAppViewReady();
+
+private:
+
+ LogsApplication* mLogsApplication;
+};
+
+#endif //UT_LOGSAPPLICATION_H
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsbaseview.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsbaseview.h Fri Sep 03 14:26:05 2010 +0300
@@ -23,7 +23,7 @@
class LogsBaseView;
class LogsComponentRepository;
-class HbMainWindow;
+class LogsMainWindow;
class UT_LogsBaseView : public QObject
@@ -97,7 +97,7 @@
LogsBaseView* mBaseView;
LogsComponentRepository* mRepository;
- HbMainWindow* mMainWindow;
+ LogsMainWindow* mMainWindow;
LogsViewManagerStub* mViewManager;
};
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logscomponentrepository.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logscomponentrepository.h Fri Sep 03 14:26:05 2010 +0300
@@ -23,7 +23,7 @@
#include "logsviewmanagerstub.h"
class LogsComponentRepository;
-class HbMainWindow;
+class LogsMainWindow;
class UT_LogsComponentRepository : public QObject
{
@@ -60,7 +60,7 @@
private:
- HbMainWindow* mMainWindow;
+ LogsMainWindow* mMainWindow;
LogsComponentRepository* mRepository;
LogsViewManagerStub* mViewManager;
};
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsdetailsview.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsdetailsview.h Fri Sep 03 14:26:05 2010 +0300
@@ -23,7 +23,7 @@
class LogsDetailsView;
class LogsComponentRepository;
-class HbMainWindow;
+class LogsMainWindow;
class UT_LogsDetailsView : public QObject
@@ -73,7 +73,7 @@
LogsDetailsView* mDetailsView;
LogsComponentRepository* mRepository;
- HbMainWindow* mMainWindow;
+ LogsMainWindow* mMainWindow;
LogsViewManagerStub* mViewManager;
};
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsmatchesview.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsmatchesview.h Fri Sep 03 14:26:05 2010 +0300
@@ -23,7 +23,7 @@
class LogsMatchesView;
class LogsComponentRepository;
-class HbMainWindow;
+class LogsMainWindow;
class UT_LogsMatchesView : public QObject
@@ -72,7 +72,7 @@
LogsMatchesView* mMatchesView;
LogsComponentRepository* mRepository;
- HbMainWindow* mMainWindow;
+ LogsMainWindow* mMainWindow;
LogsViewManagerStub* mViewManager;
};
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsrecentcallsview.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsrecentcallsview.h Fri Sep 03 14:26:05 2010 +0300
@@ -23,7 +23,7 @@
class LogsRecentCallsView;
class LogsComponentRepository;
-class HbMainWindow;
+class LogsMainWindow;
class QModelIndex;
class UT_LogsRecentCallsView : public QObject
@@ -84,7 +84,6 @@
void testDialpadOpened();
void testSaveActivity();
void testLoadActivity();
- void testEventFilter();
private: //helper functions
@@ -94,7 +93,7 @@
LogsRecentCallsView* mRecentCallsView;
LogsComponentRepository* mRepository;
- HbMainWindow* mMainWindow;
+ LogsMainWindow* mMainWindow;
LogsViewManagerStub* mViewManager;
};
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsviewmanager.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsviewmanager.h Fri Sep 03 14:26:05 2010 +0300
@@ -61,6 +61,7 @@
void testSaveActivity();
void testLoadActivity();
void testAppGainedForeground();
+ void testActivityRequested();
private:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/install/ut_logsapp.pkg Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,37 @@
+;
+; 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:
+;
+; A package file for creating an installation file for Logs
+; which updates Logs binaries from ROM (eclipsing)
+
+; Supported languages
+&EN
+
+; Header
+#{"ut_logsapp"},(0xEB768CBC),1,0,0
+
+; Localised Vendor name
+%{"Symbian"}
+
+; Unique Vendor name
+:"Symbian"
+
+
+; -----------------------------------------------------------------------------------
+
+; Backup registration and restore
+"\epoc32\release\armv5\urel\ut_logsapp.exe"-"!:\sys\bin\ut_logsapp.exe"
+"\epoc32\data\z\resource\apps\ut_logsapp.rsc"-"!:\resource\apps\ut_logsapp.rsc"
+"\epoc32\data\z\private\10003a3f\import\apps\ut_logsapp_reg.rsc"-"!:\private\10003a3f\import\apps\ut_logsapp_reg.rsc"
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscontact.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscontact.h Fri Sep 03 14:26:05 2010 +0300
@@ -34,7 +34,8 @@
public:
enum RequestType {
TypeLogsContactOpen, //contact is in phonebook, can open it
- TypeLogsContactSave //contact isn't in phonebook, can save it
+ TypeLogsContactSave, //contact isn't in phonebook, can save it
+ TypeLogsContactOpenGroup //contact is a group in phonebook, can open it
};
public:
--- a/logsui/logsapp/tsrc/ut_logsapp/src/main.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/main.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -15,6 +15,7 @@
*
*/
#include "ut_logsmainwindow.h"
+#include "ut_logsapplication.h"
#include "ut_logscomponentrepository.h"
#include "ut_logsviewmanager.h"
#include "ut_logsbaseview.h"
@@ -25,98 +26,67 @@
#include "ut_logsservicehandler.h"
#include "ut_logspageindicator.h"
#include "ut_logspageindicatoritem.h"
-#include "testresultxmlparser.h"
+#include "testrunner.h"
#include <QtTest/QtTest>
-
-#define UT_ARGS( args, file )\
- QStringList args( "ut_logsapp");\
- args << "-silent" << "-xml" << "-o" << file
-
-
int main(int argc, char *argv[])
{
- bool promptOnExit(true);
- for (int i=0; i<argc; i++) {
- if (QString(argv[i]) == "-noprompt")
- promptOnExit = false;
- }
printf("Running tests...\n");
QApplication app(argc, argv);
- TestResultXmlParser parser;
+ QStringList args = app.arguments();
+ QString combinedOutputFileName;
+ for ( int i = 0; i < args.count(); i++ ){
+ QString arg = args.at(i);
+ if ( arg == QString("-o") && i + 1 < args.count() ){
+ i++;
+ combinedOutputFileName = args.at(i);
+ }
+ }
+
+ TestRunner testRunner("LogsApp", combinedOutputFileName);
UT_LogsMainWindow ut_logsMainWindow;
- QString resultFileNameForMainWindow = "c:/ut_logsMainWindow.xml";
- UT_ARGS( args_logsMainWindow, resultFileNameForMainWindow );
- QTest::qExec( &ut_logsMainWindow, args_logsMainWindow );
- parser.parseAndPrintResults(resultFileNameForMainWindow);
+ testRunner.runTests(ut_logsMainWindow);
UT_LogsComponentRepository ut_logsRepository;
- QString resultFileNameForComponentRepository = "c:/ut_logsRepository.xml";
- UT_ARGS( args_logsRepository, resultFileNameForComponentRepository );
- QTest::qExec( &ut_logsRepository, args_logsRepository );
- parser.parseAndPrintResults(resultFileNameForComponentRepository);
+ testRunner.runTests(ut_logsRepository);
UT_LogsViewManager ut_logsViewManager;
- QString resultFileNameForViewManager = "c:/ut_logsViewManager.xml";
- UT_ARGS( args_logsViewManager, resultFileNameForViewManager );
- QTest::qExec( &ut_logsViewManager, args_logsViewManager );
- parser.parseAndPrintResults(resultFileNameForViewManager);
-
+ testRunner.runTests(ut_logsViewManager);
+
UT_LogsBaseView ut_logsBaseView;
- QString resultFileNameForBaseView = "c:/ut_logsBaseView.xml";
- UT_ARGS( args_logsBaseView, resultFileNameForBaseView );
- QTest::qExec( &ut_logsBaseView, args_logsBaseView );
- parser.parseAndPrintResults(resultFileNameForBaseView);
+ testRunner.runTests(ut_logsBaseView);
UT_LogsRecentCallsView ut_logsRecentCallsView;
- QString resultFileNameForRecentCallsView = "c:/ut_logsRecentCallsView.xml";
- UT_ARGS( args_logsRecentCallsView, resultFileNameForRecentCallsView );
- QTest::qExec( &ut_logsRecentCallsView, args_logsRecentCallsView );
- parser.parseAndPrintResults(resultFileNameForRecentCallsView);
+ testRunner.runTests(ut_logsRecentCallsView);
UT_LogsDetailsView ut_logsDetailsView;
- QString resultFileNameForDetailsView = "c:/ut_logsDetailsView.xml";
- UT_ARGS( args_logsDetailsView, resultFileNameForDetailsView );
- QTest::qExec( &ut_logsDetailsView, args_logsDetailsView );
- parser.parseAndPrintResults(resultFileNameForDetailsView);
+ testRunner.runTests(ut_logsDetailsView);
UT_LogsMatchesView ut_logsMatchesView;
- QString resultFileNameForMatchesView = "c:/ut_logsMatchesView.xml";
- UT_ARGS( args_logsMatchesView, resultFileNameForMatchesView );
- QTest::qExec( &ut_logsMatchesView, args_logsMatchesView );
- parser.parseAndPrintResults(resultFileNameForMatchesView);
-
+ testRunner.runTests(ut_logsMatchesView);
+
UT_LogsEffectHandler ut_logsEffectHandler;
- QString resultFileNameForEffectHandler = "c:/ut_logsEffectHandler.xml";
- UT_ARGS( args_logsEffectHandler, resultFileNameForEffectHandler );
- QTest::qExec( &ut_logsEffectHandler, args_logsEffectHandler );
- parser.parseAndPrintResults(resultFileNameForEffectHandler);
-
+ testRunner.runTests(ut_logsEffectHandler);
+
UT_LogsServiceHandler ut_logsServiceHandler;
- QString resultFileNameForServiceHandler = "c:/ut_logsServiceHandler.xml";
- UT_ARGS( args_logsServiceHandler, resultFileNameForServiceHandler );
- QTest::qExec( &ut_logsServiceHandler, args_logsServiceHandler );
- parser.parseAndPrintResults(resultFileNameForServiceHandler);
+ testRunner.runTests(ut_logsServiceHandler);
UT_LogsPageIndicator ut_logsPageIndicator;
- QString resultFileNameForPageIndicator = "c:/ut_logsPageIndicator.xml";
- UT_ARGS( args_logsPageIndicator, resultFileNameForPageIndicator );
- QTest::qExec( &ut_logsPageIndicator, args_logsPageIndicator );
- parser.parseAndPrintResults(resultFileNameForPageIndicator);
-
+ testRunner.runTests(ut_logsPageIndicator);
+
UT_LogsPageIndicatorItem ut_logsPageIndicatorItem;
- QString resultFileNameForPageIndicatorItem = "c:/ut_logsPageIndicatorItem.xml";
- UT_ARGS( args_logsPageIndicatorItem, resultFileNameForPageIndicatorItem );
- QTest::qExec( &ut_logsPageIndicatorItem, args_logsPageIndicatorItem );
- parser.parseAndPrintResults(resultFileNameForPageIndicatorItem);
-
- if (promptOnExit) {
- printf("Press any key...\n");
- //getchar();
- }
+ testRunner.runTests(ut_logsPageIndicatorItem);
+
+ //qApp is deleted after this testcase is run
+ //keep this testcase last
+ UT_LogsApplication ut_logsApplication;
+ testRunner.runTests(ut_logsApplication);
+
+ testRunner.printResults();
+
return 0;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsapplication.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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:
+*
+*/
+
+//USER
+#include "ut_logsapplication.h"
+//#include "hbapplication.h"
+#include "logsapplication.h"
+#include "qthighway_stub_helper.h"
+#include "hbstubs_helper.h"
+//SYSTEM
+#include <QtTest/QtTest>
+#include <hbmainwindow.h>
+#include <QKeyEvent>
+
+void UT_LogsApplication::initTestCase()
+{
+
+}
+
+void UT_LogsApplication::cleanupTestCase()
+{
+
+}
+
+
+void UT_LogsApplication::init()
+{
+ int value = qApp->argc();
+ mLogsApplication = new LogsApplication(value,qApp->argv());
+
+}
+
+void UT_LogsApplication::cleanup()
+{
+ delete mLogsApplication;
+ mLogsApplication = 0;
+}
+
+void UT_LogsApplication::testtestLogsAppEngineReady()
+{
+ QSignalSpy spy( mLogsApplication, SIGNAL(applicationReady()) );
+ // Not handled
+ QVERIFY( mLogsApplication->mReadCompleted == false );
+ QVERIFY( mLogsApplication->mViewReady == false );
+ mLogsApplication->testLogsAppEngineReady();
+ QVERIFY( spy.count() == 0 );
+
+ QVERIFY( mLogsApplication->mReadCompleted == true );
+ QVERIFY( mLogsApplication->mViewReady == false );
+ // Not handled
+ mLogsApplication->testLogsAppEngineReady();
+ QVERIFY( spy.count() == 0 );
+
+ // Handled
+ mLogsApplication->mReadCompleted = false;
+ mLogsApplication->mViewReady = true;
+ mLogsApplication->testLogsAppEngineReady();
+ QVERIFY( spy.count() == 1 );
+
+ spy.clear();
+ mLogsApplication->mViewReady = false;
+ mLogsApplication->mReadCompleted = false;
+ mLogsApplication->testLogsAppEngineReady();
+ QVERIFY( spy.count() == 0 );
+
+ mLogsApplication->testLogsHandleAppViewReady();
+ QVERIFY( spy.count() == 1 );
+
+}
+
+void UT_LogsApplication::testtestLogsHandleAppViewReady()
+{
+ QSignalSpy spy( mLogsApplication, SIGNAL(applicationReady()) );
+ // Not handled
+ QVERIFY( mLogsApplication->mReadCompleted == false );
+ QVERIFY( mLogsApplication->mViewReady == false );
+ mLogsApplication->testLogsHandleAppViewReady();
+ QVERIFY( spy.count() == 0 );
+
+ QVERIFY( mLogsApplication->mReadCompleted == false );
+ QVERIFY( mLogsApplication->mViewReady == true );
+ // Not handled
+ mLogsApplication->testLogsHandleAppViewReady();
+ QVERIFY( spy.count() == 0 );
+
+ // Handled
+ mLogsApplication->mViewReady = false;
+ mLogsApplication->mReadCompleted = true;
+ mLogsApplication->testLogsHandleAppViewReady();
+ QVERIFY( spy.count() == 1 );
+
+ spy.clear();
+ mLogsApplication->mViewReady = false;
+ mLogsApplication->mReadCompleted = false;
+ mLogsApplication->testLogsHandleAppViewReady();
+ QVERIFY( spy.count() == 0 );
+
+ mLogsApplication->testLogsAppEngineReady();
+ QVERIFY( spy.count() == 1 );
+}
+
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsbaseview.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsbaseview.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -26,10 +26,10 @@
#include "hbstubs_helper.h"
#include "logsmodel.h"
#include "logsdetailsmodel.h"
+#include "logsmainwindow.h"
//SYSTEM
#include <QtTest/QtTest>
-#include <hbmainwindow.h>
#include <hbaction.h>
#include <hbinstance.h>
#include <hbmenu.h>
@@ -44,7 +44,7 @@
void UT_LogsBaseView::initTestCase()
{
- mMainWindow = new HbMainWindow();
+ mMainWindow = new LogsMainWindow();
mViewManager = new LogsViewManagerStub(*mMainWindow);
}
@@ -103,18 +103,7 @@
void UT_LogsBaseView::testResetView()
{
- // Opened dialpad is closed and text in it is cleared
- mBaseView->mDialpad->mIsOpen = true;
- mBaseView->mDialpad->mLineEdit->setText("testing");
- mBaseView->resetView();
- QVERIFY( !mBaseView->mDialpad->mIsOpen );
- QVERIFY( mBaseView->mDialpad->mLineEdit->text() == "" );
-
- // Text is cleared even if dialpad would be closed
- mBaseView->mDialpad->mLineEdit->setText("testingagain");
- mBaseView->resetView();
- QVERIFY( !mBaseView->mDialpad->mIsOpen );
- QVERIFY( mBaseView->mDialpad->mLineEdit->text() == "" );
+ mBaseView->resetView(); // NOP
}
void UT_LogsBaseView::testShowFilterMenu()
@@ -658,16 +647,16 @@
list.setModel(&model);
// No content found, nop
- mBaseView->ensureListPositioning(list);
+ mBaseView->ensureListPositioning(list, false);
QVERIFY( !HbStubHelper::listEnsureVisibleCalled() );
QVERIFY( !HbStubHelper::listScrollToCalled() );
// Content found, no visible items, nop
mRepository->recentCallsView();
mBaseView->activated(false, QVariant());
- mBaseView->ensureListPositioning(list);
+ mBaseView->ensureListPositioning(list, false);
QVERIFY( !HbStubHelper::listEnsureVisibleCalled() );
- QVERIFY( !HbStubHelper::listScrollToCalled() );
+ QVERIFY( !HbStubHelper::listScrollBarPolicySet() );
// Content found and visible items which can fit the screen, height of item zero, nop
HbWidget* content =
@@ -679,38 +668,45 @@
HbStubHelper::listItems().append(item);
HbListViewItem* item2 = new HbListViewItem;
HbStubHelper::listItems().append(item2);
- mBaseView->ensureListPositioning(list);
+ mBaseView->ensureListPositioning(list, false);
QVERIFY( !HbStubHelper::listEnsureVisibleCalled() );
QVERIFY( !HbStubHelper::listScrollToCalled() );
+ QVERIFY( !HbStubHelper::listScrollBarPolicySet() );
- // Screen is already filled with items, nop
+ // Screen is already filled with items, scrolled to first fully visible item
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);
+ mBaseView->ensureListPositioning(list, false);
QVERIFY( !HbStubHelper::listEnsureVisibleCalled() );
- QVERIFY( !HbStubHelper::listScrollToCalled() );
+ QVERIFY( !HbStubHelper::listScrollToCalled() ); // Should be true but stub does not work due virtual method definition
+ // List size not decreased, therefore no scrollbar force
+ QVERIFY( !HbStubHelper::listScrollBarPolicySet() );
// Content found and visible items which can fit the screen, all items ensured visible
+ HbStubHelper::resetListScrolling();
list.setModel(&model);
delete HbStubHelper::listItems().takeLast();
- mBaseView->ensureListPositioning(list);
+ mBaseView->ensureListPositioning(list, true);
QVERIFY( HbStubHelper::listEnsureVisibleCalled() );
QVERIFY( !HbStubHelper::listScrollToCalled() );
+ // List size decreased but items fit the screen, therefore no scrollbar force
+ QVERIFY( !HbStubHelper::listScrollBarPolicySet() );
// 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
+ HbStubHelper::resetListScrolling();
list.setModel(&model2);
list.setCurrentIndex(model2.index(0,0));
delete HbStubHelper::listItems().takeLast();
- mBaseView->ensureListPositioning(list);
- QVERIFY( HbStubHelper::listEnsureVisibleCalled() );
- // TODO: stub does not work due it uses virtual table inside hbcore. Whole
- // list should be stubbed.
- //QVERIFY( HbStubHelper::listScrollToCalled() );
+ mBaseView->ensureListPositioning(list, true);
+ QVERIFY( !HbStubHelper::listEnsureVisibleCalled() );
+ QVERIFY( !HbStubHelper::listScrollToCalled() ); // Should be true but stub does not work due virtual method definition
+ // List size decreased and all items do not fit the screen, therefore scrollbar force
+ QVERIFY( HbStubHelper::listScrollBarPolicySet() );
}
void UT_LogsBaseView::testCancelServiceRequest()
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logscomponentrepository.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logscomponentrepository.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -22,14 +22,14 @@
#include "logsmatchesview.h"
#include "logscomponentrepository.h"
#include "logsdefs.h"
+#include "logsmainwindow.h"
//SYSTEM
#include <QtTest/QtTest>
-#include <hbmainwindow.h>
void UT_LogsComponentRepository::initTestCase()
{
- mMainWindow = new HbMainWindow();
+ mMainWindow = new LogsMainWindow();
mViewManager = new LogsViewManagerStub(*mMainWindow);
}
@@ -159,11 +159,9 @@
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 );
}
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsdetailsview.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsdetailsview.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -24,10 +24,10 @@
#include "logsmessage.h"
#include "logsdefs.h"
#include "logscontact.h"
+#include "logsmainwindow.h"
//SYSTEM
#include <QtTest/QtTest>
-#include <hbmainwindow.h>
#include <hblistview.h>
#include <hblabel.h>
#include <hbaction.h>
@@ -43,7 +43,7 @@
void UT_LogsDetailsView::initTestCase()
{
- mMainWindow = new HbMainWindow();
+ mMainWindow = new LogsMainWindow();
mViewManager = new LogsViewManagerStub(*mMainWindow);
}
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmainwindow.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmainwindow.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -25,6 +25,7 @@
#include <QtTest/QtTest>
#include <hbmainwindow.h>
#include <QKeyEvent>
+#include <xqkeycapture.h>
void UT_LogsMainWindow::initTestCase()
{
@@ -61,6 +62,11 @@
mMainWindow->keyPressEvent( &event2 );
QVERIFY( spy.count() == 1 );
+ // Handled
+ spy.clear();
+ QKeyEvent event3( QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
+ mMainWindow->keyPressEvent( &event3 );
+ QVERIFY( spy.count() == 1 );
}
void UT_LogsMainWindow::testSendAppToBackground()
@@ -87,6 +93,7 @@
{
QSignalSpy spy( mMainWindow, SIGNAL(localeChanged()) );
QSignalSpy foregroundSpy( mMainWindow, SIGNAL(appGainedForeground()) );
+ QVERIFY( !mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
//Event we are not interested in
QEvent event(QEvent::Show);
@@ -94,6 +101,7 @@
QVERIFY( !mMainWindow->isForeground() );
QVERIFY( !mMainWindow->mLocaleChanged );
QCOMPARE( foregroundSpy.count(), 0 );
+ QVERIFY( !mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
//Coming foreground, locale not changed
QEvent eventFg(QEvent::ApplicationActivate);
@@ -101,6 +109,7 @@
QVERIFY( mMainWindow->isForeground() );
QVERIFY( !mMainWindow->mLocaleChanged );
QCOMPARE( foregroundSpy.count(), 1 );
+ QVERIFY( mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
foregroundSpy.clear();
//LocaleChange event on FG
@@ -109,25 +118,39 @@
QVERIFY( mMainWindow->isForeground() );
QVERIFY( !mMainWindow->mLocaleChanged );
QVERIFY( spy.count() == 1 );
+ QVERIFY( mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
QCOMPARE( foregroundSpy.count(), 0 );
spy.clear();
- //Going background
+ //Going background partially, surface check is not reliable at the moment so
+ // don't care about that, just handle as full foreground loosing
+ HbStubHelper::createWindowSurface();
QEvent eventBg(QEvent::ApplicationDeactivate);
QVERIFY( !mMainWindow->eventFilter(this, &eventBg) );
QVERIFY( !mMainWindow->isForeground() );
QVERIFY( !mMainWindow->mLocaleChanged );
+ QVERIFY( !mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
QCOMPARE( foregroundSpy.count(), 0 );
+ //Going background fully
+ HbStubHelper::reset();
+ QVERIFY( !mMainWindow->eventFilter(this, &eventBg) );
+ QVERIFY( !mMainWindow->isForeground() );
+ QVERIFY( !mMainWindow->mLocaleChanged );
+ QVERIFY( !mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
+ QCOMPARE( foregroundSpy.count(), 0 );
+
//LocaleChange event on BG
QVERIFY( !mMainWindow->eventFilter(this, &eventLocale) );
QVERIFY( !mMainWindow->isForeground() );
QVERIFY( mMainWindow->mLocaleChanged );
+ QVERIFY( !mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
QVERIFY( spy.count() == 0 );
//Coming foreground after locale cange event
QVERIFY( !mMainWindow->eventFilter(this, &eventFg) );
QVERIFY( mMainWindow->isForeground() );
QVERIFY( !mMainWindow->mLocaleChanged );
+ QVERIFY( mMainWindow->mKeyCapture->mKeys.contains(Qt::Key_Yes) );
QVERIFY( spy.count() == 1 );
}
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmatchesview.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmatchesview.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -25,6 +25,7 @@
#include "logsmodel.h"
#include "logscontact.h"
#include "logsmessage.h"
+#include "logsmainwindow.h"
//SYSTEM
#include <QtTest/QtTest>
@@ -39,7 +40,7 @@
void UT_LogsMatchesView::initTestCase()
{
- mMainWindow = new HbMainWindow();
+ mMainWindow = new LogsMainWindow();
mViewManager = new LogsViewManagerStub(*mMainWindow);
}
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsrecentcallsview.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsrecentcallsview.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -29,11 +29,11 @@
#include "logsmessage.h"
#include "logscontact.h"
#include "logsmatchesmodel.h"
+#include "logsmainwindow.h"
//SYSTEM
#include <QtTest/QtTest>
#include <hbswipegesture.h>
-#include <hbmainwindow.h>
#include <hblistview.h>
#include <hblabel.h>
#include <hbaction.h>
@@ -59,7 +59,7 @@
void UT_LogsRecentCallsView::initTestCase()
{
- mMainWindow = new HbMainWindow();
+ mMainWindow = new LogsMainWindow();
mViewManager = new LogsViewManagerStub(*mMainWindow);
}
@@ -132,20 +132,33 @@
QVERIFY( view->mInitialized );
QVERIFY( view->mFilter );
QVERIFY( view->mEmptyListLabel );
+ QVERIFY( !view->mModel->mMissedCallsCounterCleared );
VERIFY_CHECKED_ACTION( view, logsShowFilterRecentMenuActionId )
// Change views
view->activated(false, QVariant(XQService::LogsViewReceived));
QVERIFY( view->mFilter );
QVERIFY( view->mFilter->filterType() == LogsFilter::Received );
+ QVERIFY( !view->mModel->mMissedCallsCounterCleared );
VERIFY_CHECKED_ACTION( view, logsShowFilterReceivedMenuActionId )
view->activated(false, QVariant(XQService::LogsViewMissed));
- QVERIFY( view->mFilter->filterType() == LogsFilter::Missed );
+ QVERIFY( view->mFilter->filterType() == LogsFilter::Missed );
+ QVERIFY( view->mModel->mMissedCallsCounterCleared );
VERIFY_CHECKED_ACTION( view, logsShowFilterMissedMenuActionId )
+
+ // Change to missed view again, no need to update view, only
+ // missed call counter updated
+ view->mModel->mMissedCallsCounterCleared = false;
+ view->updateFilter(LogsFilter::Received);
+ view->activated(false, QVariant(XQService::LogsViewMissed));
+ QVERIFY( view->mFilter->filterType() == LogsFilter::Received );
+ QVERIFY( view->mModel->mMissedCallsCounterCleared );
+ view->mModel->mMissedCallsCounterCleared = false;
view->activated(false, QVariant(XQService::LogsViewCalled));
QVERIFY( view->mFilter->filterType() == LogsFilter::Called );
+ QVERIFY( !view->mModel->mMissedCallsCounterCleared );
VERIFY_CHECKED_ACTION( view, logsShowFilterDialledMenuActionId )
view->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
@@ -153,6 +166,7 @@
view->mActivating = true;
view->activated(false, QVariant(XQService::LogsViewAll));
QVERIFY( view->mFilter->filterType() == LogsFilter::All );
+ QVERIFY( !view->mModel->mMissedCallsCounterCleared );
VERIFY_CHECKED_ACTION( view, logsShowFilterRecentMenuActionId )
QVERIFY( !view->mDialpad->editor().text().isEmpty() );
QVERIFY( view->mListView->layoutName() == logsListLandscapeLayout );
@@ -440,8 +454,28 @@
QCOMPARE(view->mCurrentView, XQService::LogsViewCalled);
QCOMPARE(view->mAppearingView, XQService::LogsViewCalled);
+ //vertical swipe started, gesture cancel policy not modified
+ HbStubHelper::setGestureState(Qt::GestureStarted);
+ event2.setAccepted(Qt::SwipeGesture, false);
+ swipe->setSceneSwipeAngle(70);
+ QVERIFY(swipe->gestureCancelPolicy() == QGesture::CancelNone);
+ view->gestureEvent(&event2);
+ QCOMPARE(view->mCurrentView, XQService::LogsViewCalled);
+ QCOMPARE(view->mAppearingView, XQService::LogsViewCalled);
+ QVERIFY(swipe->gestureCancelPolicy() == QGesture::CancelNone);
+
+ //horizontal swipe started, gesture cancel policy modified to prevent tap
+ const int swipeAngleRight = 10;
+ HbStubHelper::setGestureState(Qt::GestureStarted);
+ event2.setAccepted(Qt::SwipeGesture, false);
+ swipe->setSceneSwipeAngle(swipeAngleRight);
+ QVERIFY(swipe->gestureCancelPolicy() == QGesture::CancelNone);
+ view->gestureEvent(&event2);
+ QCOMPARE(view->mCurrentView, XQService::LogsViewCalled);
+ QCOMPARE(view->mAppearingView, XQService::LogsViewCalled);
+ QVERIFY(swipe->gestureCancelPolicy() == QGesture::CancelAllInContext);
+
//swipe right
- const int swipeAngleRight = 10;
HbStubHelper::setGestureState(Qt::GestureFinished);
event2.setAccepted(Qt::SwipeGesture, false);
swipe->setSceneSwipeAngle(swipeAngleRight);
@@ -979,38 +1013,3 @@
QVERIFY( args2.toInt() == XQService::LogsViewMissed);
}
-
-void UT_LogsRecentCallsView::testEventFilter()
-{
- // Non-gesture event
- HbLabel object;
- QEvent dummyEvent(QEvent::Show);
- QVERIFY( !mRecentCallsView->eventFilter(&object, &dummyEvent) );
-
- // Swipe gesture event
- QList<QGesture*> list;
- QGestureEvent event(list);
- QSwipeGesture* swipe = new QSwipeGesture();
- list.append(swipe);
- QVERIFY( !mRecentCallsView->eventFilter(&object, &event) );
- QVERIFY( !swipe->property("horizontallyRestricted").isValid() );
-
- // Tap gesture on some other object (not mListView)
- QTapGesture* tap = new QTapGesture();
- list.append(tap);
- QGestureEvent event2(list);
- HbStubHelper::setGestureState(Qt::GestureStarted);
- QVERIFY( !mRecentCallsView->eventFilter(&object, &event2) );
- QVERIFY( !tap->property("horizontallyRestricted").isValid() );
-
- //Tap gesture on list item => property is set
- mRecentCallsView->mListView = new HbListView();
- mRepository->model()->mTextData.append("testdata");
- HbAbstractViewItem* viewItem = mRecentCallsView->mListView->currentViewItem();
- QVERIFY( !mRecentCallsView->eventFilter(viewItem, &event2) );
- QVERIFY( tap->property("horizontallyRestricted").isValid() );
-
- qDeleteAll(list);
- delete mRecentCallsView->mListView;
- mRecentCallsView->mListView = 0;
-}
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsviewmanager.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsviewmanager.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -28,9 +28,9 @@
#include "hbstubs_helper.h"
#include "logscontact.h"
#include "qthighway_stub_helper.h"
+#include "logsapplication.h"
//SYSTEM
-#include <HbMainWindow.h>
#include <QtTest/QtTest>
#include <HbView.h>
#include <hbapplication.h>
@@ -64,6 +64,10 @@
mServiceOld = 0;
delete mMainWindow;
mMainWindow = 0;
+ LogsApplication* app = static_cast<LogsApplication*>( qApp );
+ app->mFeatureFakeExitEnabled = false;
+ app->mFeaturePreloadedEnabled = false;
+
}
void UT_LogsViewManager::testConstructorDestructor()
@@ -74,6 +78,7 @@
QVERIFY( mLogsViewManager->mMainWindow.currentView() != 0 );
QVERIFY( static_cast<LogsBaseView*>( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsRecentViewId );
QVERIFY( mLogsViewManager->mViewStack.count() == 1 );
+ QVERIFY( !mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
delete mLogsViewManager;
mLogsViewManager = 0;
@@ -87,7 +92,25 @@
QVERIFY( mLogsViewManager->mComponentsRepository );
QVERIFY( static_cast<LogsBaseView*>( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsRecentViewId );
QVERIFY( mLogsViewManager->mViewStack.count() == 1 );
+ QVERIFY( mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
HbStubHelper::reset();
+
+ // Constructor when service request started the app
+ delete mMainWindow;
+ mMainWindow = 0;
+ mMainWindow = new LogsMainWindow();
+ HbStubHelper::setActivityReason(Hb::ActivationReasonNormal);
+ QtHighwayStubHelper::setIsService(true);
+ LogsServiceHandler* handler2 = new LogsServiceHandler();
+ mLogsViewManager->mComponentsRepository->model()->mRefreshCalled = false;
+ mLogsViewManager = new LogsViewManager(*mMainWindow, *handler2, *mServiceOld);
+ QVERIFY( mLogsViewManager->mComponentsRepository );
+ QVERIFY( static_cast<LogsBaseView*>( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsRecentViewId );
+ QVERIFY( mLogsViewManager->mViewStack.count() == 0 ); // Waiting for signal
+ QVERIFY( mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
+ HbStubHelper::reset();
+ QtHighwayStubHelper::reset();
+ delete handler2;
}
@@ -171,13 +194,15 @@
QVERIFY( mLogsViewManager->mComponentsRepository->mDialpad->mLineEdit->text() == dialString );
QVERIFY( HbStubHelper::isWidgetRaised() );
- // Empty string clears dialpad input
+ // Empty string clears dialpad input, check also that dialpad gets closed
QtHighwayStubHelper::reset();
+ mLogsViewManager->mComponentsRepository->mDialpad->mIsOpen = true;
mLogsViewManager->changeRecentViewViaService(XQService::LogsViewCalled, false, "");
QVERIFY( mLogsViewManager->mMainWindow.currentView() ==
mLogsViewManager->mComponentsRepository->recentCallsView() );
QVERIFY( mLogsViewManager->mComponentsRepository->mDialpad->mLineEdit->text().isEmpty() );
QVERIFY( HbStubHelper::isWidgetRaised() );
+ QVERIFY( !mLogsViewManager->mComponentsRepository->mDialpad->mIsOpen );
//Open recent view, view stack not empty, embedded service canceled
QtHighwayStubHelper::reset();
@@ -219,6 +244,23 @@
mLogsViewManager->mComponentsRepository->recentCallsView()->mMarkingMissedAsSeen = false;
mLogsViewManager->proceedExit();
QVERIFY( HbStubHelper::quitCalled() );
+ QVERIFY( !mLogsViewManager->mComponentsRepository->model()->mCompressCalled );
+
+ // Fake exit enabled, data is compressed, app hidden and activity saved
+ LogsApplication* app = static_cast<LogsApplication*>( qApp );
+ app->mFeatureFakeExitEnabled = true;
+ HbStubHelper::reset();
+ mLogsViewManager->mComponentsRepository->model()->mCompressCalled = false;
+ QtHighwayStubHelper::reset();
+ QCOMPARE( app->activityManager()->activities().count(), 0 );
+ mLogsViewManager->exitApplication();
+ QVERIFY( !HbStubHelper::quitCalled() );
+ QVERIFY( QtHighwayStubHelper::utilToBackground() );
+ QVERIFY( mLogsViewManager->mComponentsRepository->model()->mCompressCalled );
+ QVERIFY( HbStubHelper::isTsTaskVisibilitySet() );
+ QVERIFY( !HbStubHelper::tsTaskVisibility() );
+ QCOMPARE( app->activityManager()->activities().count(), 1 );
+
}
void UT_LogsViewManager::testStartingWithService()
@@ -250,9 +292,7 @@
mLogsViewManager->activateView(LogsRecentViewId, true, QVariant());
QVERIFY(!mLogsViewManager->mFirstActivation);
QVERIFY(mLogsViewManager->mViewActivationShowDialpad);
- QVERIFY(!mLogsViewManager->mComponentsRepository->model()->mMissedCallsCounterCleared);
mLogsViewManager->completeViewActivation(); // Simulate paint completion (viewReady signal)
- QVERIFY(mLogsViewManager->mComponentsRepository->model()->mMissedCallsCounterCleared);
}
void UT_LogsViewManager::testSaveActivity()
@@ -332,7 +372,52 @@
QVERIFY( HbStubHelper::quitCalled() );
HbStubHelper::reset();
+ mLogsViewManager->mComponentsRepository->model()->mRefreshCalled = false;
mLogsViewManager->appGainedForeground();
emit mLogsViewManager->mViewStack.at(0)->exitAllowed();
QVERIFY( !HbStubHelper::quitCalled() );
+ QVERIFY( !mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
+
+ // Gaining foreground causes data refresh if fake exit or preloading feature is enabled
+ HbStubHelper::reset();
+ LogsApplication* app = static_cast<LogsApplication*>( qApp );
+ app->mFeatureFakeExitEnabled = true;
+ mLogsViewManager->appGainedForeground();
+ QVERIFY( mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
+ QVERIFY( HbStubHelper::isTsTaskVisibilitySet() );
+ QVERIFY( HbStubHelper::tsTaskVisibility() );
+
+ HbStubHelper::reset();
+ mLogsViewManager->mComponentsRepository->model()->mRefreshCalled = false;
+ app->mFeatureFakeExitEnabled = false;
+ app->mFeaturePreloadedEnabled = true;
+ mLogsViewManager->appGainedForeground();
+ QVERIFY( mLogsViewManager->mComponentsRepository->model()->mRefreshCalled );
+ QVERIFY( HbStubHelper::isTsTaskVisibilitySet() );
+ QVERIFY( HbStubHelper::tsTaskVisibility() );
}
+
+void UT_LogsViewManager::testActivityRequested()
+{
+ HbApplication* hbApp = static_cast<HbApplication*>(qApp);
+ HbActivityManager* manager = hbApp->activityManager();
+
+ HbStubHelper::reset();
+ HbStubHelper::setActivityId("unknownActivity");
+ mLogsViewManager->activityRequested("unknownActivity");
+ QVERIFY( !HbStubHelper::isWidgetRaised() );
+
+ HbStubHelper::setActivityId(logsActivityIdViewRecent);
+ mLogsViewManager->mComponentsRepository->dialpad()->mIsOpen = false;
+ mLogsViewManager->mComponentsRepository->dialpad()->mLineEdit->setText("");
+ QVariantHash params;
+ params.insert(logsActivityParamShowDialpad, false);
+ params.insert(logsActivityParamDialpadText, QString(""));
+ params.insert(logsActivityParamInternalViewId, LogsRecentViewId);
+ manager->addActivity(QString(), QVariant(), params);
+ mLogsViewManager->activityRequested(logsActivityIdViewRecent);
+ QVERIFY( static_cast<LogsBaseView*>( mLogsViewManager->mMainWindow.currentView() )->viewId() == LogsRecentViewId );
+ QVERIFY( !mLogsViewManager->mComponentsRepository->dialpad()->mIsOpen );
+ QCOMPARE( mLogsViewManager->mComponentsRepository->dialpad()->mLineEdit->text(), QString("") );
+ QVERIFY( HbStubHelper::isWidgetRaised() );
+}
--- a/logsui/logsapp/tsrc/ut_logsapp/stubs/hbapplication.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbapplication.h Fri Sep 03 14:26:05 2010 +0300
@@ -19,6 +19,8 @@
#include <qobject.h>
#include <qglobal.h>
+#include <qapplication.h>
+#include <hbnamespace.h>
class HbActivityManager;
--- a/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -34,6 +34,8 @@
#include <hbmessagebox.h>
#include <hbnotificationdialog.h>
#include <hbstringutil.h>
+#include "xqkeycapture.h"
+#include "tstasksettings.h"
int actionCount = 0;
Qt::Orientation windowOrientation = Qt::Vertical;
@@ -61,6 +63,18 @@
bool testScrollToCalled = false;
Qt::LayoutDirection testLayoutDirection = Qt::LeftToRight;
bool testConversionEnabled = false;
+bool testScrollBarPolicySet = false;
+HbScrollArea::ScrollBarPolicy testScrollBarPolicy = HbScrollArea::ScrollBarAsNeeded;
+QWindowSurface* testWindowSurface = 0;
+QString testNotifDialogText;
+bool testIsTsTaskVisibilitySet = false;
+bool testTsTaskVisibility = false;
+
+class QWindowSurface{
+public:
+ QWindowSurface(){}
+ ~QWindowSurface(){}
+};
void HbStubHelper::reset()
{
@@ -80,6 +94,11 @@
testEnsureVisibleCalled = false;
testPopupShowPlacement = HbPopup::TopLeftCorner;
testConversionEnabled = false;
+ testScrollBarPolicySet = false;
+ delete testWindowSurface;
+ testWindowSurface = 0;
+ testIsTsTaskVisibilitySet = false;
+ testTsTaskVisibility = false;
}
int HbStubHelper::widgetActionsCount()
@@ -175,7 +194,39 @@
testConversionEnabled = enabled;
}
-QString testNotifDialogText;
+bool HbStubHelper::listScrollBarPolicySet()
+{
+ return testScrollBarPolicySet;
+}
+
+void HbStubHelper::resetListScrolling()
+{
+ testEnsureVisibleCalled = false;
+ testScrollBarPolicySet = false;
+ testScrollToCalled = false;
+}
+
+void HbStubHelper::createWindowSurface()
+{
+ if ( !testWindowSurface ){
+ testWindowSurface = new QWindowSurface;
+ }
+}
+
+bool HbStubHelper::isTsTaskVisibilitySet()
+{
+ return testIsTsTaskVisibilitySet;
+}
+
+bool HbStubHelper::tsTaskVisibility()
+{
+ return testTsTaskVisibility;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
void HbNotificationDialog::launchDialog(const QString &title, QGraphicsScene *scene)
{
Q_UNUSED(scene);
@@ -197,6 +248,10 @@
testQuitCalled = true;
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int version)
: QCoreApplication(argc, argv)
{
@@ -218,12 +273,20 @@
return testLayoutDirection;
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
bool QGraphicsWidget::close()
{
testIsWidgetOpen = false;
return true;
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
void QWidget::setVisible(bool visible)
{
Q_UNUSED(visible);
@@ -234,6 +297,15 @@
testIsWidgetRaised = true;
}
+QWindowSurface* QWidget::windowSurface() const
+{
+ return testWindowSurface;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
QPixmap QPixmap::grabWidget(QWidget *widget, const QRect &rect)
{
Q_UNUSED(widget);
@@ -338,6 +410,10 @@
testPopupShowPlacement = placement;
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
void HbDialog::open(QObject *receiver, const char *member)
{
Q_UNUSED(receiver)
@@ -350,6 +426,10 @@
testDialogShown = true;
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
void HbMessageBox::question(const QString &questionText,
QObject *receiver ,
const char *member,
@@ -529,6 +609,21 @@
//
// -----------------------------------------------------------------------------
//
+void HbScrollArea::setVerticalScrollBarPolicy(ScrollBarPolicy policy)
+{
+ testScrollBarPolicySet = true;
+ testScrollBarPolicy = policy;
+}
+
+HbScrollArea::ScrollBarPolicy HbScrollArea::verticalScrollBarPolicy() const
+{
+ return testScrollBarPolicy;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
QString HbStringUtil::convertDigitsTo( const QString str, const DigitType digitType )
{
Q_UNUSED(digitType);
@@ -538,14 +633,60 @@
return str;
}
-bool QObject::eventFilter(QObject *obj, QEvent *event)
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+XQKeyCapture::XQKeyCapture()
{
- Q_UNUSED(obj)
- Q_UNUSED(event)
- return false;
+
+}
+
+XQKeyCapture::~XQKeyCapture()
+{
+
}
-void QObject::installEventFilter(QObject *obj)
+bool XQKeyCapture::captureKey(Qt::Key aKey,
+ Qt::KeyboardModifiers aModifiersMask,
+ Qt::KeyboardModifiers aModifier)
+{
+ Q_UNUSED(aModifiersMask);
+ Q_UNUSED(aModifier);
+ mKeys.append(aKey);
+ return true;
+}
+
+bool XQKeyCapture::cancelCaptureKey(Qt::Key aKey,
+ Qt::KeyboardModifiers aModifiersMask,
+ Qt::KeyboardModifiers aModifier)
{
- Q_UNUSED(obj)
+ Q_UNUSED(aModifiersMask);
+ Q_UNUSED(aModifier);
+ int index = mKeys.indexOf(aKey);
+ if ( index >= 0 ){
+ mKeys.takeAt(index);
+ }
+ return true;
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TsTaskSettings::TsTaskSettings()
+{
+
+}
+TsTaskSettings::~TsTaskSettings()
+{
+
+}
+
+bool TsTaskSettings::setVisibility(bool visible)
+{
+ testTsTaskVisibility = visible;
+ testIsTsTaskVisibilitySet = true;
+ return true;
+}
+
--- a/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs_helper.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs_helper.h Fri Sep 03 14:26:05 2010 +0300
@@ -45,6 +45,11 @@
static bool listEnsureVisibleCalled();
static int menuShownPlacement();
static void stringUtilDigitConversion(bool enabled);
+ static bool listScrollBarPolicySet();
+ static void resetListScrolling();
+ static void createWindowSurface();
+ static bool isTsTaskVisibilitySet();
+ static bool tsTaskVisibility();
};
#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/tstasksettings.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* 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 TSTASKSETTINGS_H
+#define TSTASKSETTINGS_H
+
+
+class TsTaskSettings
+{
+
+public:
+ TsTaskSettings();
+ ~TsTaskSettings();
+
+ bool setVisibility(bool);
+
+};
+
+#endif //TSTASKSETTINGS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/xqkeycapture.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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 XQKEYCAPTURE_H
+#define XQKEYCAPTURE_H
+
+#include <qnamespace.h>
+#include <QList>
+#include <QEvent>
+
+class XQKeyCapture {
+
+public:
+ XQKeyCapture();
+
+ ~XQKeyCapture();
+
+ bool captureKey(Qt::Key aKey,
+ Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier,
+ Qt::KeyboardModifiers aModifier = Qt::NoModifier);
+
+ bool cancelCaptureKey(Qt::Key aKey,
+ Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier,
+ Qt::KeyboardModifiers aModifier = Qt::NoModifier);
+
+public: // Test stuff
+ QList<Qt::Key> mKeys;
+};
+
+#endif /* XQKEYCAPTURE_H */
--- a/logsui/logsapp/tsrc/ut_logsapp/ut_logsapp.pro Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/ut_logsapp.pro Fri Sep 03 14:26:05 2010 +0300
@@ -22,7 +22,8 @@
CONFIG += hb
RESOURCES += ../../logsapp.qrc
-INCLUDEPATH = stubs $$INCLUDEPATH
+DEPENDPATH += .
+PREPEND_INCLUDEPATH = stubs
INCLUDEPATH += .
INCLUDEPATH += ../../
INCLUDEPATH += ../../inc
@@ -37,6 +38,10 @@
DEFINES += QT_NO_DEBUG_OUTPUT
# Input
+
+HEADERS += stubs/xqkeycapture.h
+HEADERS += stubs/tstasksettings.h
+HEADERS += ./stubs/hbapplication.h
HEADERS += inc/ut_logsmainwindow.h
HEADERS += inc/ut_logscomponentrepository.h
HEADERS += inc/ut_logsviewmanager.h
@@ -48,7 +53,9 @@
HEADERS += inc/ut_logspageindicator.h
HEADERS += inc/ut_logspageindicatoritem.h
HEADERS += inc/ut_logsservicehandler.h
+HEADERS += inc/ut_logsapplication.h
HEADERS += ../../inc/logsmainwindow.h
+HEADERS += ../../inc/logsapplication.h
HEADERS += ../../inc/logsviewmanager.h
HEADERS += ../../inc/logscomponentrepository.h
HEADERS += ../../inc/logsrecentcallsview.h
@@ -91,6 +98,7 @@
SOURCES += src/ut_logsservicehandler.cpp
SOURCES += src/ut_logspageindicator.cpp
SOURCES += src/ut_logspageindicatoritem.cpp
+SOURCES += src/ut_logsapplication.cpp
SOURCES += ../../src/logsbaseview.cpp
SOURCES += ../../src/logsrecentcallsview.cpp
SOURCES += ../../src/logsdetailsview.cpp
@@ -100,7 +108,8 @@
SOURCES += ../../src/logseffecthandler.cpp
SOURCES += ../../src/logspageindicator.cpp
SOURCES += ../../src/logspageindicatoritem.cpp
-SOURCES += ../../../tsrc/qtestutils/src/testresultxmlparser.cpp
+SOURCES += ../../src/logsapplication.cpp
+SOURCES += ../../../tsrc/qtestutils/src/testrunner.cpp
SOURCES += ./stubs/hbstubs.cpp
SOURCES += ./stubs/qthighway_stub.cpp
SOURCES += ./stubs/dialpad_stub.cpp
@@ -111,6 +120,9 @@
TARGET.UID3 = 0xEb768cbc
TARGET.CAPABILITY = ALL -TCB
TARGET.EPOCALLOWDLLDATA = 1
- LIBS += -lxqservice -lxqserviceutil
+ LIBS += -lxqservice -lxqserviceutil -lxqkeycapture
}
+DOCML += ../../resources/recentCallsView.docml
+DOCML += ../../resources/matchesView.docml
+DOCML += ../../resources/detailsView.docml
--- a/logsui/logscntfinder/inc/logscntentry.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/inc/logscntentry.h Fri Sep 03 14:26:05 2010 +0300
@@ -88,12 +88,12 @@
void doSetText( const QString& text, LogsCntTextList& textlist );
void doSetHighlights( const QString& pattern, LogsCntTextList& nameArray );
+ void doSetHighlights( const QString& patternItem, QMutableListIterator<LogsCntText>& names );
+
void resetHighlights( LogsCntTextList& nameArray );
bool doSimpleMatch( const QString& pattern ) const;
- bool doComplexMatch( QStringList patternArray ) const;
- int startsWith( const LogsCntText& nameItem, const QString& pattern,
- bool optimize = true ) const;
-
+ bool doComplexMatch( const QStringList& patternArray ) const;
+ int startsWith( const LogsCntText& nameItem, const QString& pattern ) const;
private:
--- a/logsui/logscntfinder/inc/logspredictive12keytranslator.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/inc/logspredictive12keytranslator.h Fri Sep 03 14:26:05 2010 +0300
@@ -41,6 +41,7 @@
QStringList patternTokens( const QString& pattern ) const;
int hasPatternSeparators( const QString& pattern ) const;
const QChar translateChar( const QChar character ) const;
+ QString& trimPattern( QString& pattern, bool tailOnly ) const;
protected:
@@ -48,7 +49,7 @@
private:
- void padWithZeros( QString& token, const QString& source, int padIndex ) const;
+ void splitPattern( const QString& pattern, QString& car, QString& cdr ) const;
private:
--- a/logsui/logscntfinder/inc/logspredictivetranslator.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/inc/logspredictivetranslator.h Fri Sep 03 14:26:05 2010 +0300
@@ -46,6 +46,7 @@
virtual QStringList nameTokens( const QString& name ) const = 0;
virtual QStringList patternTokens( const QString& pattern ) const = 0;
+ virtual QString& trimPattern( QString& pattern, bool tailOnly = false ) const = 0;
virtual int hasPatternSeparators( const QString& pattern ) const = 0;
virtual const QChar translateChar( const QChar character, bool& ok ) const = 0;
virtual int mib() const = 0;
--- a/logsui/logscntfinder/src/logscntentry.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/src/logscntentry.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -272,37 +272,56 @@
{
LogsPredictiveTranslator* translator = LogsPredictiveTranslator::instance();
- QMutableListIterator<LogsCntText> names( nameArray );
- bool hasSeparators = translator->hasPatternSeparators( pattern );
+ QMutableListIterator<LogsCntText> names( nameArray );
+ QString modifiedPattern = pattern;
+ modifiedPattern = translator->trimPattern( modifiedPattern, true );
+
+ bool hasSeparators = translator->hasPatternSeparators( modifiedPattern );
//simple
while( names.hasNext() ) {
LogsCntText& nameItem = names.next();
//must use non-optimized version with whole pattern
- nameItem.mHighlights = startsWith( nameItem, pattern, false );
+ nameItem.mHighlights = startsWith( nameItem, modifiedPattern );
+ }
+
+ if ( hasSeparators ) {
+ //complex
+ QListIterator<QString> patternArray( translator->patternTokens( modifiedPattern ) );
+ while( patternArray.hasNext() ) {
+ QString patternItem = patternArray.next();
+ doSetHighlights( patternItem, names );
+ translator->trimPattern( patternItem );
+ doSetHighlights( patternItem, names );
+ }
}
- //complex
- QListIterator<QString> patternArray( translator->patternTokens( pattern ) );
- while( hasSeparators && patternArray.hasNext() ) {
- QString patternItem = patternArray.next();
- names.toFront();
- while( names.hasNext() ) {
- LogsCntText& nameItem = names.next();
- int matchSize = startsWith( nameItem, patternItem, !hasSeparators );
- nameItem.mHighlights = matchSize > nameItem.mHighlights ?
- matchSize : nameItem.mHighlights;
- }
- }
}
+// -----------------------------------------------------------------------------
+// LogsCntEntry::doSetHighlights()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::doSetHighlights( const QString& patternItem,
+ QMutableListIterator<LogsCntText>& names )
+
+{
+ names.toFront();
+ while( names.hasNext() ) {
+ LogsCntText& nameItem = names.next();
+ int matchSize = startsWith( nameItem, patternItem );
+ nameItem.mHighlights = matchSize > nameItem.mHighlights ?
+ matchSize : nameItem.mHighlights;
+ }
+
+}
// -----------------------------------------------------------------------------
// LogsCntEntry::startsWith()
// -----------------------------------------------------------------------------
//
int LogsCntEntry::startsWith( const LogsCntText& nameItem,
- const QString& pattern, bool optimize ) const
+ const QString& pattern ) const
{
LOGS_QDEBUG( "logs [FINDER] -> LogsCntEntry::startsWith()" )
//assumed that text has found based on pattern, thus only checking with
@@ -313,12 +332,7 @@
if ( text.isEmpty() || matchCount > text.length() ) {
matchCount = 0;
} else {
- if ( !optimize ) {
- matchCount = text.startsWith( pattern ) ? matchCount : 0;
- } else {
- matchCount = *text.data() == *pattern.data() ?
- matchCount : 0;
- }
+ matchCount = text.startsWith( pattern ) ? matchCount : 0;
}
LOGS_QDEBUG( "logs [FINDER] -> LogsCntEntry::startsWith()" )
return matchCount;
@@ -346,13 +360,24 @@
if ( pattern.length() > 0 ) {
LogsPredictiveTranslator* translator = LogsPredictiveTranslator::instance();
+ QString modifiedPattern = pattern;
+ modifiedPattern = translator->trimPattern( modifiedPattern, true );
+
//direct match with phone number is enough
match = ( type() == EntryTypeHistory &&
mPhoneNumber.mTranslatedText.startsWith( pattern ) ) ||
- doSimpleMatch( pattern );
+ doSimpleMatch( modifiedPattern );
- match = !match && translator->hasPatternSeparators( pattern ) ?
- doComplexMatch( translator->patternTokens( pattern) ) : match;
+ if (!match && translator->hasPatternSeparators( modifiedPattern ) ) {
+ QStringList patternArray = translator->patternTokens( modifiedPattern );
+ match = doComplexMatch( patternArray );
+ if (!match ) {
+ for(int i=0;i<patternArray.length();i++ ) {
+ translator->trimPattern( patternArray[i] );
+ }
+ match = doComplexMatch( patternArray );
+ }
+ }
}
return match;
@@ -380,7 +405,7 @@
// LogsCntEntry::doComplexMatch()
// -----------------------------------------------------------------------------
//
-bool LogsCntEntry::doComplexMatch( QStringList patternArray ) const
+bool LogsCntEntry::doComplexMatch( const QStringList& patternArray ) const
{
const bool zero = false;
--- a/logsui/logscntfinder/src/logspredictive12keytranslator.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/src/logspredictive12keytranslator.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -17,6 +17,7 @@
#include <QObject>
#include <QLocale>
#include <QHash>
+#include <QRegExp>
#include <hbinputkeymapfactory.h>
#include <hbinputkeymap.h>
#include <hbinputsettingproxy.h>
@@ -25,7 +26,7 @@
#include "logslogger.h"
const QChar ZeroSepar('0');
-
+const int NotAssigned = -1;
// -----------------------------------------------------------------------------
// LogsPredictive12KeyTranslator::LogsPredictive12KeyTranslator()
@@ -56,30 +57,25 @@
}
// -----------------------------------------------------------------------------
-// LogsPredictive12KeyTranslator::LogsPredictive12KeyTranslator()
+// LogsPredictive12KeyTranslator::patternTokens()
// -----------------------------------------------------------------------------
//
QStringList LogsPredictive12KeyTranslator::patternTokens( const QString& pattern ) const
{
+
LOGS_QDEBUG( "logs [FINDER] -> LogsPredictive12KeyTranslator::\
patternTokens()" )
LOGS_QDEBUG_2( "logs [FINDER] pattern ", pattern );
-
- QStringList target = pattern.split( ZeroSepar, QString::SkipEmptyParts );
- if ( target.length() > 1 ) {
- LOGS_QDEBUG( "logs [FINDER] has separator(s) " )
- QString& first = target[0];
- QString& last = target[target.length()-1];
- padWithZeros( first, pattern, 0 );
- padWithZeros( last, pattern, last.length() );
- } else if ( target.length() == 1 && //0280 -> 028
- pattern[pattern.length()-1] == ZeroSepar ) {
- LOGS_QDEBUG( "logs [FINDER] no separators, trailing zero(s) " )
- QString& first = target[0];
- padWithZeros( first, pattern, 0 );
- } else if ( target.length() == 0 ) {
- LOGS_QDEBUG( "logs [FINDER] only separators " )
- target.append( ZeroSepar );
+ QString car;
+ QString cdr;
+
+ QStringList target;
+ splitPattern( pattern, car, cdr );
+ if ( car.length() ) {
+ target.append( car );
+ if ( cdr.length() ) {
+ target.append( cdr );
+ }
}
LOGS_QDEBUG( "logs [FINDER] <- LogsPredictive12KeyTranslator::\
patternTokens()" )
@@ -87,6 +83,68 @@
}
// -----------------------------------------------------------------------------
+// LogsPredictive12KeyTranslator::splitPattern()
+// -----------------------------------------------------------------------------
+//
+void LogsPredictive12KeyTranslator::splitPattern( const QString& pattern,
+ QString& car, QString& cdr ) const
+{
+ car = "";
+ cdr = "";
+
+ QChar current;
+ QChar previous;
+ int splitStart = NotAssigned;
+ int splitEnd = NotAssigned;
+ int index = 0;
+ while( splitEnd == NotAssigned && index < pattern.length() ) {
+ current = pattern[index];
+ splitStart = splitStart == NotAssigned &&
+ ( previous != ZeroSepar && previous != QChar() ) &&
+ current == ZeroSepar ?
+ index : splitStart;
+ splitEnd = splitStart != NotAssigned &&
+ previous == ZeroSepar &&
+ current != ZeroSepar ?
+ index : splitEnd;
+ previous = current;
+ index++;
+ }
+
+ if ( splitStart != NotAssigned && splitEnd != NotAssigned ) {
+ car = pattern.left( splitStart );
+ cdr = pattern.right( pattern.length() - splitEnd );
+ } else {
+ car = pattern;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsPredictive12KeyTranslator::trimPattern()
+// -----------------------------------------------------------------------------
+//
+QString& LogsPredictive12KeyTranslator::trimPattern( QString& pattern,
+ bool tailOnly ) const
+{
+ QRegExp lead("^0*");//remove leading zeros
+ QRegExp trail("0*$");//remove trailing zeros
+
+ if ( pattern.length() ) {
+ if ( !tailOnly ) {
+ pattern.remove( lead );
+ }
+
+ pattern.remove( trail );
+
+ if( !pattern.length() ) {
+ pattern += ZeroSepar;
+ }
+ }
+ return pattern;
+}
+
+
+// -----------------------------------------------------------------------------
// LogsPredictive12KeyTranslator::hasPatternSeparators()
// -----------------------------------------------------------------------------
//
@@ -112,24 +170,3 @@
}
-
-// -----------------------------------------------------------------------------
-// LogsPredictive12KeyTranslator::padWithLeadingZeros()
-// -----------------------------------------------------------------------------
-//
-void LogsPredictive12KeyTranslator::padWithZeros( QString& token,
- const QString& source, int padIndex ) const
-{
- const QChar* content = source.data();
- int index = !padIndex ? 0 : source.length()-1;
-
- while( index >= 0 && index < source.length() ) {
- if ( content[ index ] == ZeroSepar ) {
- token.insert( padIndex, ZeroSepar );
- index = !padIndex ? index+1 : index-1;
- } else {
- index = -1;
- }
- }
-}
-
--- a/logsui/logscntfinder/tsrc/pt_logscntfinder/src/pt_logscntfinderqwerty.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/tsrc/pt_logscntfinder/src/pt_logscntfinderqwerty.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -25,7 +25,7 @@
{
QContactDetailFilter df;
- df.setDetailDefinitionName(QContactName::DefinitionName, QContactEmailAddress::FieldEmailAddress );
+ df.setDetailDefinitionName(QContactEmailAddress::DefinitionName, QContactEmailAddress::FieldEmailAddress );
df.setMatchFlags( QContactFilter::MatchKeypadCollation );
QString pattern = mPattern + QChar(30) + QString("vqwerty");
df.setValue( pattern );
--- a/logsui/logscntfinder/tsrc/st_logscntfinder/inc/st_logscntfinder.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/tsrc/st_logscntfinder/inc/st_logscntfinder.h Fri Sep 03 14:26:05 2010 +0300
@@ -66,6 +66,7 @@
void testPredictiveSearchQueryFullyCachedNoResults();
void testPredictiveSearchQueryPartialCachedZeroCase();
void testPredictiveSearchQueryFullyCachedZerosStartCase();
+ void testPredictiveSearchQueryFullyCachedZerosStartCase_2();
void testPredictiveSearchQueryFullyCachedZerosEndCase();
void testPredictiveSearchQueryLogs();
void testPredictiveSearchQueryLogsZeroCase();
--- a/logsui/logscntfinder/tsrc/st_logscntfinder/src/st_logscntfinder.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/tsrc/st_logscntfinder/src/st_logscntfinder.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -387,6 +387,7 @@
//#Paula 2003, Augustin Ci <= 2003 was found with pattern 002
//Paula 002010, Ezerty Adam
+
}
void ST_LogsCntFinder::testPredictiveSearchQueryZeroStartZeroEnd()
@@ -404,8 +405,22 @@
m_finder->predictiveSearchQuery( QString("") );
- m_finder->predictiveSearchQuery( QString("002010") );
+ m_finder->predictiveSearchQuery( QString("20020") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ //#Paula 2003, Augustin Ci
+
+ m_finder->predictiveSearchQuery( QString("") );
+
+ m_finder->predictiveSearchQuery( QString("200200") );
QCOMPARE( m_finder->resultsCount(), 1 );
+ //#Paula 2003, Augustin Ci
+
+ m_finder->predictiveSearchQuery( QString("") );
+
+ m_finder->predictiveSearchQuery( QString("2002000") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ //#Paula 2003, Augustin Ci
+
}
void ST_LogsCntFinder::testPredictiveSearchQueryZeroMiddle()
@@ -622,6 +637,10 @@
QCOMPARE( m_finder->resultsCount(), 3 );
CHECK_RESULTS( 3, IGNORE_TEST, IGNORE_TEST, IGNORE_TEST_I ); //SET: cache size, CHECK: 1. result fn, 1. result ln, highlights
+ //Dlice 00202, Qwerty
+ //#Paula 2003, Augustin Ci
+ //Paula 002010, Ezerty Adam
+
m_finder->predictiveSearchQuery( QString("0020") );//db
QCOMPARE( m_finder->resultsCount(), 7 );
CHECK_RESULTS( 7, IGNORE_TEST, IGNORE_TEST, IGNORE_TEST_I ); //SET: cache size, CHECK: 1. result fn, 1. result ln, highlights
@@ -640,6 +659,52 @@
}
+void ST_LogsCntFinder::testPredictiveSearchQueryFullyCachedZerosStartCase_2()
+{
+ createContactsForQueryZero();
+
+ m_finder->predictiveSearchQuery( QString("0") ); //db
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ CHECK_RESULTS( 2, IGNORE_TEST, IGNORE_TEST, IGNORE_TEST_I ); //SET: cache size, CHECK: 1. result fn, 1. result ln, highlights
+
+ m_finder->predictiveSearchQuery( QString("00") );//db
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ CHECK_RESULTS( 2, IGNORE_TEST, IGNORE_TEST, IGNORE_TEST_I ); //SET: cache size, CHECK: 1. result fn, 1. result ln, highlights
+
+ m_finder->predictiveSearchQuery( QString("002") );//db
+ QCOMPARE( m_finder->resultsCount(), 7 );//002 + 2 matches
+ CHECK_RESULTS( 7, IGNORE_TEST, IGNORE_TEST, IGNORE_TEST_I ); //SET: cache size, CHECK: 1. result fn, 1. result ln, highlights
+
+ m_finder->predictiveSearchQuery( QString("0023") );//cache
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ CHECK_RESULTS( 2, IGNORE_TEST, IGNORE_TEST, IGNORE_TEST_I ); //SET: cache size, CHECK: 1. result fn, 1. result ln, highlights
+
+ //Paula 002010, Ezerty Adam
+ //Ced, Y0g
+
+
+ m_finder->predictiveSearchQuery( QString("00230") );//cache
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ CHECK_RESULTS( 2, IGNORE_TEST, IGNORE_TEST, IGNORE_TEST_I ); //SET: cache size, CHECK: 1. result fn, 1. result ln, highlights
+
+ m_finder->predictiveSearchQuery( QString("0023") );//db
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ CHECK_RESULTS( 2, IGNORE_TEST, IGNORE_TEST, IGNORE_TEST_I ); //SET: cache size, CHECK: 1. result fn, 1. result ln, highlights
+
+ m_finder->predictiveSearchQuery( QString("002") );//db
+ QCOMPARE( m_finder->resultsCount(), 7 );//002 + 2 matches
+ CHECK_RESULTS( 7, IGNORE_TEST, IGNORE_TEST, IGNORE_TEST_I ); //SET: cache size, CHECK: 1. result fn, 1. result ln, highlights
+
+ m_finder->predictiveSearchQuery( QString("00") );//db
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ CHECK_RESULTS( 2, IGNORE_TEST, IGNORE_TEST, IGNORE_TEST_I ); //SET: cache size, CHECK: 1. result fn, 1. result ln, highlights
+
+ m_finder->predictiveSearchQuery( QString("0") ); //db
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ CHECK_RESULTS( 2, IGNORE_TEST, IGNORE_TEST, IGNORE_TEST_I ); //SET: cache size, CHECK: 1. result fn, 1. result ln, highlights
+
+}
+
//
void ST_LogsCntFinder::testPredictiveSearchQueryFullyCachedZerosEndCase()
{
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logspredictive12keytranslator.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logspredictive12keytranslator.h Fri Sep 03 14:26:05 2010 +0300
@@ -49,6 +49,9 @@
void testPatternTokens();
void testHasPatternSeparators();
void testTranslateChar();
+ void testSplitPattern();
+ void testTrimPattern();
+
private:
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/src/main.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/main.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -25,50 +25,46 @@
#include "ut_logspredictivethai12keytranslator.h"
#include "ut_logscntentry.h"
-#include "testresultxmlparser.h"
-
-
-#define UTEST_CLASS( tc )\
- tc tc##_instance;\
- QStringList tc##_args( #tc );\
- resultFileName = QString("c:/") + QString( #tc ) + QString(".xml");\
- tc##_args << "-xml" << "-o" << resultFileName;\
- QTest::qExec(&tc##_instance, tc##_args);\
- parser.parseAndPrintResults(resultFileName,true)
-
+#include "testrunner.h"
int main(int argc, char *argv[])
-{
- bool promptOnExit(true);
- bool useQApplication(true);
- for (int i=0; i<argc; i++) {
- if (QString(argv[i]) == "-noprompt")
- promptOnExit = false;
- else if (QString(argv[i]) == "-noqapp")
- useQApplication = false;
+{
+ printf("Running tests...\n");
+
+ QApplication app(argc, argv);
+ QStringList args = app.arguments();
+ QString combinedOutputFileName;
+ for ( int i = 0; i < args.count(); i++ ){
+ QString arg = args.at(i);
+ if ( arg == QString("-o") && i + 1 < args.count() ){
+ i++;
+ combinedOutputFileName = args.at(i);
+ }
}
- printf("Running tests...\n");
- QApplication* app = 0;
- if ( useQApplication )
- app = new QApplication(argc, argv);
+ TestRunner testRunner("LogsCntFinder", combinedOutputFileName);
- TestResultXmlParser parser;
- QString resultFileName;
+ UT_LogsPredictiveTranslator ut_logsPredictiveTranslator;
+ testRunner.runTests(ut_logsPredictiveTranslator);
+
+ UT_LogsPredictive12KeyTranslator ut_logsPredictive12KeyTranslator;
+ testRunner.runTests(ut_logsPredictive12KeyTranslator);
+
+ UT_LogsPredictiveLatin12KeyTranslator ut_logsPredictiveLatin12KeyTranslator;
+ testRunner.runTests(ut_logsPredictiveLatin12KeyTranslator);
- UTEST_CLASS( UT_LogsPredictiveTranslator );
- UTEST_CLASS( UT_LogsPredictive12KeyTranslator );
- UTEST_CLASS( UT_LogsPredictiveLatin12KeyTranslator );
- UTEST_CLASS( UT_LogsPredictiveThai12KeyTranslator );
- UTEST_CLASS( UT_LogsCntEntry );
- UTEST_CLASS( UT_LogsCntFinder );
+ UT_LogsPredictiveThai12KeyTranslator ut_logsPredictiveThai12KeyTranslator;
+ testRunner.runTests(ut_logsPredictiveThai12KeyTranslator);
+
+ UT_LogsCntEntry ut_logsCntEntry;
+ testRunner.runTests(ut_logsCntEntry);
- if (promptOnExit) {
- printf("Press any key...\n");
- getchar();
- }
- delete app;
+ UT_LogsCntFinder ut_logsCntFinder;
+ testRunner.runTests(ut_logsCntFinder);
+
+ testRunner.printResults();
+
return 0;
}
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logscntentry.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logscntentry.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -207,22 +207,46 @@
mEntry->setHighlights( PATTERN( "20505" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
- QVERIFY( mEntry->firstName()[1].highlights() == 1);
- QVERIFY( mEntry->firstName()[2].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->firstName()[2].highlights() == 0);
QVERIFY( mEntry->lastName()[0].highlights() == 0);
mEntry->setHighlights( PATTERN( "50205" ) );
- QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
QVERIFY( mEntry->firstName()[1].highlights() == 1);
QVERIFY( mEntry->firstName()[2].highlights() == 1);
QVERIFY( mEntry->lastName()[0].highlights() == 0);
mEntry->setHighlights( PATTERN( "50502" ) );
- QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
QVERIFY( mEntry->firstName()[1].highlights() == 1);
QVERIFY( mEntry->firstName()[2].highlights() == 1);
QVERIFY( mEntry->lastName()[0].highlights() == 0);
+ mEntry->setHighlights( PATTERN( "00200" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->firstName()[2].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "002400" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 2);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->firstName()[2].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "00240054" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 2);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->firstName()[2].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "240054" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 2);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->firstName()[2].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
mEntry->setFirstName( QString( "Big John" ) );
mEntry->setLastName( QString( "Johnson" ) );
@@ -270,7 +294,7 @@
QVERIFY( mEntry->lastName()[0].highlights() == 0);
mEntry->setHighlights( PATTERN( "0506" ) );
- QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 2);
QVERIFY( mEntry->lastName()[0].highlights() == 1);
@@ -282,17 +306,17 @@
mEntry->setHighlights( PATTERN( "5060" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 0);
- QVERIFY( mEntry->lastName()[0].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);
mEntry->setHighlights( PATTERN( "05060" ) );
- QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 2);
- QVERIFY( mEntry->lastName()[0].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);
mEntry->setHighlights( PATTERN( "050506" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 2);
- QVERIFY( mEntry->lastName()[0].highlights() == 1);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
mEntry->setPhoneNumber( QString( "+1234567" ) );
QVERIFY( mEntry->phoneNumber().text() == QString( "+1234567" ) );
@@ -502,7 +526,8 @@
QVERIFY( mEntry->match( PATTERN( "605" ) ) );//match John and macth Malkovich
QVERIFY( !mEntry->match( PATTERN( "505" ) ) );//match John "two times"
QVERIFY( mEntry->match( PATTERN( "60005" ) ) );//match John and match Malkovich
- QVERIFY( !mEntry->match( PATTERN( "6000500" ) ) );//match John and match Malkovich
+ QVERIFY( mEntry->match( PATTERN( "6000500" ) ) );//match John and match Malkovich
+ QVERIFY( !mEntry->match( PATTERN( "6000501" ) ) );//match John and match Malkovich
mEntry->setFirstName( QString( "John Malkovich" ) );
mEntry->setLastName( QString( "" ) );
@@ -514,7 +539,7 @@
QVERIFY( mEntry->match( PATTERN( "605" ) ) );//match John and macth Malkovich
QVERIFY( !mEntry->match( PATTERN( "505" ) ) );//match John "two times"
QVERIFY( mEntry->match( PATTERN( "60005" ) ) );//match John and match Malkovich
- QVERIFY( !mEntry->match( PATTERN( "6000500" ) ) );//match John and match Malkovich
+ QVERIFY( mEntry->match( PATTERN( "6000500" ) ) );//match John and match Malkovich
mEntry->setFirstName( QString( "" ) );
mEntry->setLastName( QString( "John Malkovich" ) );
@@ -526,16 +551,27 @@
QVERIFY( mEntry->match( PATTERN( "605" ) ) );//match John and macth Malkovich
QVERIFY( !mEntry->match( PATTERN( "505" ) ) );//match John "two times"
QVERIFY( mEntry->match( PATTERN( "60005" ) ) );//match John and match Malkovich
- QVERIFY( !mEntry->match( PATTERN( "6000500" ) ) );//match John and match Malkovich
+ QVERIFY( mEntry->match( PATTERN( "6000500" ) ) );//match John and match Malkovich
mEntry->setFirstName( QString( "John Peter" ) );
mEntry->setLastName( QString( "Malkovich" ) );
- QVERIFY( mEntry->match( PATTERN( "50607" ) ) );//match John and match Malkovich match Peter
+ QVERIFY( !mEntry->match( PATTERN( "50607" ) ) );//match John and match Malkovich match Peter
QVERIFY( mEntry->match( PATTERN( "506" ) ) );//match John and macth Malkovich match ignore Peter
QVERIFY( !mEntry->match( PATTERN( "50608" ) ) );//match John and match Malkovich match not Peter
QVERIFY( !mEntry->match( PATTERN( "5060702" ) ) );//match John and match Malkovich match Peter + no match extra
QVERIFY( !mEntry->match( PATTERN( "5060706" ) ) );//match John and match Malkovich match Peter + macth extra
+ QVERIFY( mEntry->match( PATTERN( "5060" ) ) );//match John and macth Malkovich match ignore Peter
+
+ mEntry->setFirstName( QString( "John Peter" ) );
+ mEntry->setLastName( QString( "M0rkovich" ) );
+ QVERIFY( mEntry->match( PATTERN( "50607" ) ) );//match John and match M0rkovich
+ QVERIFY( !mEntry->match( PATTERN( "60705" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "50600" ) ) );//match John and match M0rkovich
+ QVERIFY( mEntry->match( PATTERN( "5060" ) ) );//match John and match M0rkovich
+ QVERIFY( mEntry->match( PATTERN( "506" ) ) );//match John and match M0rkovich
+ QVERIFY( mEntry->match( PATTERN( "605" ) ) );//match John and match M0rkovich
+
mEntry->setFirstName( QString( "John Kalkovich" ) );
mEntry->setLastName( QString( "" ) );
@@ -545,9 +581,15 @@
mEntry->setFirstName( QString( "John John Malkovich" ) );
mEntry->setLastName( QString( "" ) );
- QVERIFY( mEntry->match( PATTERN( "50605" ) ) );//match John and match Malkovich and match John
+ QVERIFY( !mEntry->match( PATTERN( "50605" ) ) );//match John and match Malkovich and match John
QVERIFY( mEntry->match( PATTERN( "506" ) ) );//match Johns and macth Malkovich
+ QVERIFY( mEntry->match( PATTERN( "505" ) ) );//match Johns and macth Malkovich
+ QVERIFY( mEntry->match( PATTERN( "005050" ) ) );//match Johns and macth Malkovich
+ QVERIFY( mEntry->match( PATTERN( "05050" ) ) );//match Johns and macth Malkovich
+ QVERIFY( mEntry->match( PATTERN( "5050" ) ) );//match Johns and macth Malkovich
+ QVERIFY( mEntry->match( PATTERN( "0505" ) ) );//match Johns and macth Malkovich
QVERIFY( !mEntry->match( PATTERN( "50608" ) ) );//match John and match Malkovich match not Peter
+ QVERIFY( mEntry->match( PATTERN( "5060" ) ) );//match John and match Malkovich match not Peter
mEntry->setFirstName( QString( "John 0John Malkovich" ) );
mEntry->setLastName( QString( "" ) );
@@ -558,14 +600,14 @@
QVERIFY( mEntry->match( PATTERN( "0" ) ) );
QVERIFY( mEntry->match( PATTERN( "05" ) ) );
QVERIFY( mEntry->match( PATTERN( "0505" ) ) );
- QVERIFY( mEntry->match( PATTERN( "0505" ) ) );
QVERIFY( mEntry->match( PATTERN( "05005" ) ) );
QVERIFY( mEntry->match( PATTERN( "6005" ) ) );
- QVERIFY( !mEntry->match( PATTERN( "05050" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "05050" ) ) );
QVERIFY( !mEntry->match( PATTERN( "00505" ) ) );
QVERIFY( !mEntry->match( PATTERN( "005050" ) ) );
QVERIFY( mEntry->match( PATTERN( "0506" ) ) );
- QVERIFY( mEntry->match( PATTERN( "050506" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "05060" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "050506" ) ) );
mEntry->setPhoneNumber( QString( "+20298457698576" ) );
mEntry->setFirstName( QString( "John" ) );
@@ -626,7 +668,20 @@
mEntry->setFirstName( QString("Alice 028") );
mEntry->setLastName( QString( "Ming" ) );
QVERIFY( mEntry->match( PATTERN( "02806" ) ) );
- QVERIFY( mEntry->match( PATTERN( "0280" ) ) );//not supported
+ QVERIFY( mEntry->match( PATTERN( "0" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "02" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "028" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0280" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0250" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "64" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "640" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0640" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "202" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "200" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "20028" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "02802" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "028002" ) ) );
+
mEntry->setFirstName( QString("Ali") + QString( QChar(3) ) + QString("ce") );
QVERIFY( mEntry->match( PATTERN( "2" ) ) );//A
@@ -640,6 +695,21 @@
mEntry->setLastName( QString( "Malkovich" ) );
QVERIFY( mEntry->match( PATTERN( "000" ) ) );
+ mEntry->setFirstName( QString("Zlice 00234") );
+ mEntry->setLastName( QString( "Ming" ) );
+ QVERIFY( mEntry->match( PATTERN( "002" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0020" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0023" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "00209" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0000950" ) ) );
+
+ mEntry->setFirstName( QString("Alice") );
+ mEntry->setLastName( QString( "Ming" ) );
+ QVERIFY( mEntry->match( PATTERN( "002" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0020" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "00202" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0025000000000" ) ) );
+
}
void UT_LogsCntEntry::testStartsWith_latin12k()
@@ -654,8 +724,8 @@
QCOMPARE( mEntry->startsWith( mEntry->firstName()[0], QString("1234") ), 0 );
QCOMPARE( mEntry->startsWith( mEntry->firstName()[0], QString("1") ), 1 );
QCOMPARE( mEntry->startsWith( mEntry->firstName()[0], QString("123") ), 3 );
- QCOMPARE( mEntry->startsWith( mEntry->firstName()[0], QString("12"), true ), 2 );
- QCOMPARE( mEntry->startsWith( mEntry->firstName()[0], QString("12"), false ), 2 );
+ QCOMPARE( mEntry->startsWith( mEntry->firstName()[0], QString("12")), 2 );
+ QCOMPARE( mEntry->startsWith( mEntry->firstName()[0], QString("12")), 2 );
}
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictive12keytranslator.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictive12keytranslator.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -76,22 +76,122 @@
QVERIFY( mTranslator->mKeyMap );
}
+void UT_LogsPredictive12KeyTranslator::testSplitPattern()
+{
+ QString car;
+ QString cdr;
+
+ mTranslator->splitPattern( QString( "122" ), car, cdr );
+ QCOMPARE( car, QString("122" ) );
+ QCOMPARE( cdr, QString("" ) );
+
+ mTranslator->splitPattern( QString( "01220" ), car, cdr );
+ QCOMPARE( car, QString("01220" ) );
+ QCOMPARE( cdr, QString("" ) );
+
+ mTranslator->splitPattern( QString( "0122020" ), car, cdr );
+ QCOMPARE( car, QString("0122" ) );
+ QCOMPARE( cdr, QString("20" ) );
+
+ mTranslator->splitPattern( QString( "012200020" ), car, cdr );
+ QCOMPARE( car, QString("0122" ) );
+ QCOMPARE( cdr, QString("20" ) );
+
+ mTranslator->splitPattern( QString( "0122050020" ), car, cdr );
+ QCOMPARE( car, QString("0122" ) );
+ QCOMPARE( cdr, QString("50020" ) );
+
+ mTranslator->splitPattern( QString( "00000" ), car, cdr );
+ QCOMPARE( car, QString("00000" ) );
+ QCOMPARE( cdr, QString("" ) );
+
+ mTranslator->splitPattern( QString( "0" ), car, cdr );
+ QCOMPARE( car, QString("0" ) );
+ QCOMPARE( cdr, QString("" ) );
+
+ mTranslator->splitPattern( QString( "" ), car, cdr );
+ QCOMPARE( car, QString("" ) );
+ QCOMPARE( cdr, QString("" ) );
+
+}
+
+void UT_LogsPredictive12KeyTranslator::testTrimPattern()
+{
+ QString pattern;
+
+ pattern = "1";
+ QCOMPARE( mTranslator->trimPattern( pattern, false ), QString( "1") );
+
+ pattern = "122";
+ QCOMPARE( mTranslator->trimPattern( pattern, false ), QString( "122") );
+
+ pattern = "0122";
+ QCOMPARE( mTranslator->trimPattern( pattern, false ), QString( "122") );
+
+ pattern = "0122";
+ QCOMPARE( mTranslator->trimPattern( pattern, true ), QString( "0122") );
+
+ pattern = "1220";
+ QCOMPARE( mTranslator->trimPattern( pattern, false ), QString( "122") );
+
+ pattern = "1220";
+ QCOMPARE( mTranslator->trimPattern( pattern, true ), QString( "122") );
+
+ pattern = "01220";
+ QCOMPARE( mTranslator->trimPattern( pattern, false ), QString( "122") );
+
+ pattern = "01220";
+ QCOMPARE( mTranslator->trimPattern( pattern, true ), QString( "0122") );
+
+ pattern = "012020";
+ QCOMPARE( mTranslator->trimPattern( pattern, false ), QString( "1202") );
+
+ pattern = "012020";
+ QCOMPARE( mTranslator->trimPattern( pattern, true ), QString( "01202") );
+
+ pattern = "000120200";
+ QCOMPARE( mTranslator->trimPattern( pattern, false ), QString( "1202") );
+
+ pattern = "00012000200";
+ QCOMPARE( mTranslator->trimPattern( pattern , false), QString( "120002") );
+
+ pattern = "0001200024500";
+ QCOMPARE( mTranslator->trimPattern( pattern , false), QString( "12000245") );
+
+ pattern = "000";
+ QCOMPARE( mTranslator->trimPattern( pattern, false ), QString( "0") );
+
+ pattern = "0";
+ QCOMPARE( mTranslator->trimPattern( pattern, false ), QString( "0") );
+
+ pattern = "";
+ QCOMPARE( mTranslator->trimPattern( pattern, false ), QString( "") );
+
+
+}
+
void UT_LogsPredictive12KeyTranslator::testPatternTokens()
{
+
QCOMPARE( mTranslator->patternTokens( QString("122" ) ).length(), 1 );
QCOMPARE( mTranslator->patternTokens( QString("122" ) )[0], QString("122" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("01220" ) ).length(), 1 );
+ QCOMPARE( mTranslator->patternTokens( QString("01220" ) )[0], QString("01220" ) );
QCOMPARE( mTranslator->patternTokens( QString("102" ) ).length(), 2 );
QCOMPARE( mTranslator->patternTokens( QString("102" ) )[0], QString("1" ) );
QCOMPARE( mTranslator->patternTokens( QString("102" ) )[1], QString("2" ) );
QCOMPARE( mTranslator->patternTokens( QString("0010200" ) ).length(), 2 );
QCOMPARE( mTranslator->patternTokens( QString("0010200" ) )[0], QString("001" ) );
QCOMPARE( mTranslator->patternTokens( QString("0010200" ) )[1], QString("200" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("0010200564760635" ) ).length(), 2 );
+ QCOMPARE( mTranslator->patternTokens( QString("0010200564760635" ) )[0], QString("001" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("0010200564760635" ) )[1], QString("200564760635" ) );
QCOMPARE( mTranslator->patternTokens( QString("0" ) ).length(), 1 );
QCOMPARE( mTranslator->patternTokens( QString("0" ) )[0], QString("0" ) );
QCOMPARE( mTranslator->patternTokens( QString("000" ) ).length(), 1 );
- QCOMPARE( mTranslator->patternTokens( QString("000" ) )[0], QString("0" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("000" ) )[0], QString("000" ) );
QCOMPARE( mTranslator->patternTokens( QString("001" ) ).length(), 1 );
- QCOMPARE( mTranslator->patternTokens( QString("001" ) )[0], QString("1" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("001" ) )[0], QString("001" ) );
}
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/ut_logscntfinder.pro Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/ut_logscntfinder.pro Fri Sep 03 14:26:05 2010 +0300
@@ -61,7 +61,7 @@
SOURCES += ../../src/logspredictive12keytranslator.cpp
SOURCES += ../../src/logspredictivelatin12keytranslator.cpp
SOURCES += ../../src/logspredictivethai12keytranslator.cpp
-SOURCES += ../../../tsrc/qtestutils/src/testresultxmlparser.cpp
+SOURCES += ../../../tsrc/qtestutils/src/testrunner.cpp
SOURCES += ../stubs/qtcontacts_stubs.cpp
symbian: {
--- a/logsui/logsengine/inc/logscommondata.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/inc/logscommondata.h Fri Sep 03 14:26:05 2010 +0300
@@ -28,6 +28,8 @@
QTM_USE_NAMESPACE
+class XQSettingsManager;
+
/**
* Commonly shared data.
*/
@@ -61,17 +63,50 @@
int updateConfiguration(const LogsConfigurationParams& params);
LogsConfigurationParams& currentConfiguration();
- void setTelNumMatchLen(int matchLen);
int telNumMatchLen() const;
+ /**
+ * Returns cenrep key status of predictive search feature.
+ * @return 0 - feature is permanently off and can't be turned on,
+ * 1 - feature is on
+ * 2 - feature is temporarily off and can be turned on
+ * negative value indicates some error in fetching the key
+ */
+ int predictiveSearchStatus();
+
+ /**
+ * Allows to modify cenrep key value of predictive search features.
+ * However, this function can't be used if feature is set permanently off
+ * (see predictiveSearchStatus())
+ * @param enabled, specify whether cenrep key will be set to 1 or 2
+ * @ return 0 if cenrep key value modified succesfully,
+ * -1 in case of some error
+ */
+ int setPredictiveSearch(bool enabled);
+
+ /**
+ * Clear missed calls counter.
+ * @return 0 if clearing was success
+ */
+ int clearMissedCallsCounter();
+
+ bool getTelNumMatchLen(int& matchLen);
+
+
+ private:
+
+ int getPredictiveSearchStatus();
+
private:
QContactManager* mContactManager;
int mMaxReadSize;
LogsEvent::LogsDirection mMaxReadSizeDir;
LogsConfigurationParams mConfiguration;
+ XQSettingsManager* mSettingsManager;
int mMatchLen;
-
+ int mPredictiveSearchStatus;
+
private:
friend class UT_LogsCommonData;
friend class UT_LogsModel;
--- a/logsui/logsengine/inc/logscontact.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/inc/logscontact.h Fri Sep 03 14:26:05 2010 +0300
@@ -18,7 +18,7 @@
#define LOGSCONTACT_H
#include <QObject>
-#include <qtcontacts.h>
+#include <qcontact.h>
#include <logsexport.h>
//forward declarations
@@ -38,8 +38,9 @@
public:
enum RequestType {
- TypeLogsContactOpen, //contact is in phonebook, can open it
- TypeLogsContactSave //contact isn't in phonebook, can save it
+ TypeLogsContactOpen, //contact is in phonebook, can open it
+ TypeLogsContactSave, //contact isn't in phonebook, can save it
+ TypeLogsContactOpenGroup //contact is a group in phonebook, can open it
};
public:
@@ -126,6 +127,8 @@
const QString& operation,
const QList<QVariant>& arguments);
+ bool isContactGroup();
+
private: //data
--- a/logsui/logsengine/logsengine.pro Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logsengine.pro Fri Sep 03 14:26:05 2010 +0300
@@ -97,7 +97,7 @@
TARGET.EPOCALLOWDLLDATA = 1
LIBS += -lflogger -llogcli -llogwrap -lefsrv -lxqservice -lxqserviceutil \
-lqtcontacts -llogscntfinder -lthumbnailmanagerqt \
- -lcentralrepository
+ -lxqsettingsmanager
defFiles = "$${LITERAL_HASH}ifdef WINS" \
"DEFFILE bwins/logsengine.def" \
--- a/logsui/logsengine/logssymbianos/inc/logsdbconnector.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/inc/logsdbconnector.h Fri Sep 03 14:26:05 2010 +0300
@@ -36,7 +36,6 @@
class LogsEvent;
class LogsRemove;
class RFs;
-class CRepository;
// CLASS DECLARATIONS
@@ -159,12 +158,6 @@
bool markEventsSeen(const QList<LogsEvent*>& events);
/**
- * Clear missed calls counter.
- * @return 0 if clearing was success
- */
- int clearMissedCallsCounter();
-
- /**
* Read duplicates for specified event
* @param eventId
* @return 0 if reading started succesfully
@@ -179,26 +172,6 @@
int refreshData();
int compressData();
-
-
- /**
- * Returns cenrep key status of predictive search feature.
- * @return 0 - feature is permanently off and can't be turned on,
- * 1 - feature is on
- * 2 - feature is temporarily off and can be turned on
- * negative value indicates some error in fetching the key
- */
- int predictiveSearchStatus();
-
- /**
- * Allows to modify cenrep key value of predictive search features.
- * However, this function can't be used if feature is set permanently off
- * (see predictiveSearchStatus())
- * @param enabled, specify whether cenrep key will be set to 1 or 2
- * @ return 0 if cenrep key value modified succesfully,
- * -1 in case of some error
- */
- int setPredictiveSearch(bool enabled);
protected: // From LogsReaderObserver
@@ -219,7 +192,7 @@
void deleteInvalidEvents(int newEventCount);
int doMarkEventSeen();
bool handleModifyingCompletion(int err=0);
- void getTelNumMatchLenL(int& matchLen);
+ void releaseDbConnections();
private: // data
@@ -231,9 +204,9 @@
RFs* mFsSession;
LogsReader* mReader;
LogsRemove* mLogsRemove;
- CRepository* mRepository;
bool mCompressionEnabled;
-
+ bool mFirstReadCompleted;
+
QList<LogsEvent*> mEvents;
QList<LogsEvent*> mDuplicatedEvents;
QList<int> mRemovedEventIndexes;
--- a/logsui/logsengine/logssymbianos/inc/logsreader.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/inc/logsreader.h Fri Sep 03 14:26:05 2010 +0300
@@ -174,6 +174,7 @@
void prepareReadingL();
void setGlobalObserver();
void clearGlobalObserver();
+ void cleanContactCache();
private: // data
--- a/logsui/logsengine/logssymbianos/inc/logsreaderstates.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/inc/logsreaderstates.h Fri Sep 03 14:26:05 2010 +0300
@@ -24,6 +24,7 @@
#include <logclientchangeobserver.h>
#include <logviewchangeobserver.h>
#include "logsduplicatelookup.h"
+#include "logsreaderstatecontext.h"
// FORWARD DECLARATION
class LogsReaderStateContext;
@@ -204,6 +205,10 @@
virtual bool enterL();
private:
void mergeDuplicates( LogsEvent& usedEvent, LogsEvent& discardedEvent ) const;
+ void searchMatchForNumber( QHash<QString, ContactCacheEntry>& contactMappings,
+ QSet<QString>& numbersWithoutMatch,
+ LogsEvent& event,
+ const QString& num);
private:
LogsDuplicateLookup mDuplicateLookup;
--- a/logsui/logsengine/logssymbianos/src/logsdbconnector.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/src/logsdbconnector.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -25,18 +25,9 @@
#include "logscommondata.h"
#include <logcli.h>
#include <f32file.h>
-#include <centralrepository.h>
-#include <LogsDomainCRKeys.h>
-
+#include <QApplication>
// CONSTANTS
-// Telephony Configuration API
-// Keys under this category are used in defining telephony configuration.
-const TUid logsTelConfigurationCRUid = {0x102828B8};
-
-// Amount of digits to be used in contact matching.
-// This allows a customer to variate the amount of digits to be matched.
-const TUint32 logsTelMatchDigits = 0x00000001;
// ----------------------------------------------------------------------------
@@ -52,8 +43,8 @@
mLogClient( 0 ),
mReader( 0 ),
mLogsRemove( 0 ),
- mRepository( 0 ),
- mCompressionEnabled(false)
+ mCompressionEnabled(false),
+ mFirstReadCompleted(false)
{
LOGS_QDEBUG( "logs [ENG] <-> LogsDbConnector::LogsDbConnector()" )
mFsSession = new RFs();
@@ -78,8 +69,6 @@
qDeleteAll( mEvents );
qDeleteAll( mDuplicatedEvents );
- delete mRepository;
-
LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::~LogsDbConnector()" )
}
@@ -198,8 +187,6 @@
mReader = new LogsReader(
*mFsSession, *mLogClient, mLogEventStrings, mEvents, *this, mCheckAllEvents );
- mRepository = CRepository::NewL( KCRUidLogs );
-
if ( mResourceControl ){
LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::initL(), resource control enabled" )
LogsCommonData::getInstance().configureReadSize(
@@ -209,13 +196,8 @@
//Get number of digits used to match
int matchLen;
- TRAPD( err, getTelNumMatchLenL(matchLen) )
- if ( err ){
- LOGS_QDEBUG( "logs [ENG] Getting tel num match len failed, use default" );
- matchLen = logsDefaultMatchLength;
- }
+ LogsCommonData::getInstance().getTelNumMatchLen(matchLen);
LOGS_QDEBUG_2( "logs [ENG] Tel number match length", matchLen )
- LogsCommonData::getInstance().setTelNumMatchLen(matchLen);
}
// ----------------------------------------------------------------------------
@@ -284,25 +266,6 @@
}
// ----------------------------------------------------------------------------
-// LogsDbConnector::clearMissedCallsCounter
-// ----------------------------------------------------------------------------
-//
-int LogsDbConnector::clearMissedCallsCounter()
-{
- LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::clearMissedCallsCounter()" )
- if ( !mRepository ){
- return -1;
- }
- TInt value(0);
- int err = mRepository->Get( KLogsNewMissedCalls, value );
- if ( !err && value != 0 ){
- err = mRepository->Set( KLogsNewMissedCalls, 0 );
- }
- LOGS_QDEBUG_2( "logs [ENG] <- LogsDbConnector::clearMissedCallsCounter(), err", err )
- return err;
-}
-
-// ----------------------------------------------------------------------------
// LogsDbConnector::readDuplicates
// ----------------------------------------------------------------------------
//
@@ -351,6 +314,9 @@
err = mReader->start();
}
}
+ if ( !mLogsRemove ){
+ mLogsRemove = new LogsRemove( *this, mCheckAllEvents );
+ }
LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::refreshData()" )
return err;
}
@@ -386,50 +352,15 @@
}
emit dataRemoved(removedIndexes);
deleteInvalidEvents( numEventsLeftInMemory );
- mReader->stop();
}
+
+ releaseDbConnections();
+
LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::compressData()" )
return 0;
}
// ----------------------------------------------------------------------------
-// LogsDbConnector::predictiveSearchStatus
-// ----------------------------------------------------------------------------
-//
-int LogsDbConnector::predictiveSearchStatus()
-{
- LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::predictiveSearchStatus()" )
- int status(-1);
- if ( mRepository ) {
- TInt value(0);
- status = mRepository->Get( KLogsPredictiveSearch, value );
- if ( !status ) {
- status = value;
- }
- }
- LOGS_QDEBUG_2( "logs [ENG] <- LogsDbConnector::predictiveSearchStatus(), status:",
- status )
- return status;
-}
-
-// ----------------------------------------------------------------------------
-// LogsDbConnector::setPredictiveSearch
-// ----------------------------------------------------------------------------
-//
-int LogsDbConnector::setPredictiveSearch(bool enabled)
-{
- int err(-1);
- int status = predictiveSearchStatus();
- //if status == 0, it means that predictive search is permanently Off
- //and we are not allowed to modify it
- if (status != 0 && mRepository) {
- int value = enabled ? 1 : 2;
- err = mRepository->Set( KLogsPredictiveSearch, value );
- }
- return err;
-}
-
-// ----------------------------------------------------------------------------
// LogsDbConnector::handleTemporaryError
// ----------------------------------------------------------------------------
//
@@ -536,10 +467,17 @@
if ( !mUpdatedEventIndexes.isEmpty() ){
emit dataUpdated(mUpdatedEventIndexes);
}
+ }
+ qDeleteAll(toBeDeletedEvents);
+
+ if ( qApp && !mFirstReadCompleted){
+ // Just used for testing purposes
+ QMetaObject::invokeMethod(qApp, "testLogsAppEngineReady" );
+ mFirstReadCompleted = true;
}
-
- qDeleteAll(toBeDeletedEvents);
-
+ if ( mCompressionEnabled ){
+ releaseDbConnections();
+ }
LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::readCompleted()" )
}
@@ -642,15 +580,16 @@
}
// ----------------------------------------------------------------------------
-// LogsDbConnector::getTelNumMatchLenL
+//
// ----------------------------------------------------------------------------
//
-void LogsDbConnector::getTelNumMatchLenL(int& matchLen)
+void LogsDbConnector::releaseDbConnections()
{
- TInt tempMatchLen;
- CRepository* repository = CRepository::NewL(logsTelConfigurationCRUid);
- CleanupStack::PushL(repository);
- User::LeaveIfError( repository->Get(logsTelMatchDigits, tempMatchLen) );
- CleanupStack::PopAndDestroy(repository);
- matchLen = tempMatchLen;
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::releaseDbConnections()" )
+ if ( mReader ){
+ mReader->stop();
+ }
+ delete mLogsRemove;
+ mLogsRemove = 0;
+ LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::releaseDbConnections()" )
}
--- a/logsui/logsengine/logssymbianos/src/logsreader.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/src/logsreader.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -102,6 +102,14 @@
Cancel();
deleteLogViews();
clearGlobalObserver();
+ cleanContactCache();
+
+ qDeleteAll( mReadStates );
+ mReadStates.clear();
+ qDeleteAll( mModifyingStates );
+ mModifyingStates.clear();
+ qDeleteAll( mDuplicateReadingStates );
+ mDuplicateReadingStates.clear();
LOGS_QDEBUG( "logs [ENG] <- LogsReader::stop()" )
}
@@ -114,16 +122,8 @@
{
LOGS_QDEBUG( "logs [ENG] -> LogsReader::updateDetails()" )
- if ( clearCached ){
- mContactCache.clear();
- }
- foreach (LogsEvent* event, mEvents){
- event->prepareForContactMatching();
- if ( clearCached && event->contactMatched() ){
- event->setContactMatched( false );
- event->setRemoteParty("");
- }
- }
+ Q_UNUSED( clearCached );
+ cleanContactCache();
start();
@@ -614,3 +614,15 @@
mGlobalObserverSet = false;
}
}
+
+// ----------------------------------------------------------------------------
+// LogsReader::cleanContactCache
+// ----------------------------------------------------------------------------
+//
+void LogsReader::cleanContactCache()
+{
+ mContactCache.clear();
+ foreach (LogsEvent* event, mEvents){
+ event->prepareForContactMatching();
+ }
+}
--- a/logsui/logsengine/logssymbianos/src/logsreaderstates.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/src/logsreaderstates.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -21,7 +21,6 @@
#include <logwraplimits.h>
#include "logsreaderstates.h"
#include "logsstatebasecontext.h"
-#include "logsreaderstatecontext.h"
#include "logsevent.h"
#include "logseventdata.h"
#include "logsengdefs.h"
@@ -425,31 +424,19 @@
void LogsReaderStateFillDetails::fillDetails()
{
mDuplicateLookup.invalidate();
-
+ QSet<QString> numbersWithoutMatch;
QHash<QString, ContactCacheEntry>& contactMappings = mContext.contactCache();
QList<LogsEvent*> &events = mContext.events();
foreach ( LogsEvent* event, events ){
if ( event->isInView() ){
const QString& num = event->getNumberForCalling();
- if ( contactMappings.contains(num) ) {
- // Matching cached contact found, use that
- LOGS_QDEBUG_2( "logs [ENG] Use existing contact for num:", num )
- ContactCacheEntry entry = contactMappings.value(num);
- event->setContactMatched( true );
- event->setRemoteParty( entry.mRemoteParty );
- event->setContactLocalId( entry.mContactLocalId );
- } else if ( event->remoteParty().length() == 0 ) {
- // No remote party name, search for match from phonebook
- QString contactNameStr = event->updateRemotePartyFromContacts(
- LogsCommonData::getInstance().contactManager());
- if (contactNameStr.length() > 0){
- LOGS_QDEBUG_3( "LogsReaderStateFillDetails, (name, num):",
- contactNameStr, num );
- // Cache the new contact name
- event->setContactMatched( true );
- ContactCacheEntry contactEntry(contactNameStr, event->contactLocalId());
- contactMappings.insert( num, contactEntry );
- }
+ if ( !event->remoteParty().isEmpty() ){
+ // NOP
+ } else if ( numbersWithoutMatch.contains(num) ) {
+ event->setRemoteParty( "", true ); // No contact match found
+ } else {
+ // No remote party name, search match from contact cache or phonebook
+ searchMatchForNumber(contactMappings, numbersWithoutMatch, *event, num);
}
if ( mBaseContext.isRecentView() ){
LogsEvent* duplicateEvent = mDuplicateLookup.findDuplicate(*event);
@@ -464,6 +451,39 @@
mDuplicateLookup.cleanup();
}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFillDetails::searchMatchForNumber
+// ----------------------------------------------------------------------------
+//
+void LogsReaderStateFillDetails::searchMatchForNumber(
+ QHash<QString, ContactCacheEntry>& contactMappings,
+ QSet<QString>& numbersWithoutMatch,
+ LogsEvent& event,
+ const QString& num)
+{
+ if ( contactMappings.contains(num) ) {
+ // Matching cached contact found, use that
+ LOGS_QDEBUG_2( "logs [ENG] Use existing contact for num:", num )
+ ContactCacheEntry entry = contactMappings.value(num);
+ event.setRemoteParty( entry.mRemoteParty, true );
+ event.setContactLocalId( entry.mContactLocalId );
+ } else {
+ QString contactNameStr;
+ if (event.updateRemotePartyFromContacts(
+ LogsCommonData::getInstance().contactManager(), contactNameStr)){
+ LOGS_QDEBUG_3( "LogsReaderStateFillDetails, (name, num):",
+ contactNameStr, num );
+ // Cache the new contact name
+ ContactCacheEntry contactEntry(contactNameStr, event.contactLocalId());
+ contactMappings.insert( num, contactEntry );
+ } else {
+ // Avoid searching match again for the same number at this round
+ event.setRemoteParty( "", true ); // No contact match found
+ numbersWithoutMatch.insert( num );
+ }
+ }
+}
// ----------------------------------------------------------------------------
// LogsReaderStateFillDetails::mergeDuplicates
--- a/logsui/logsengine/logssymbianos/tsrc/stubs/centralrepository_stub.cpp Mon Aug 23 18:14:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
-* Copyright (c) 2005 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 <centralrepository.h>
-#include "centralrepository_stub_helper.h"
-
-TInt mFailCode = KErrNone;
-TInt mCurrentVal = 0;
-
-void CentralRepositoryStubHelper::reset()
-{
- mFailCode = KErrNone;
- mCurrentVal = 0;
-}
-
-void CentralRepositoryStubHelper::setFailCode(TInt err)
-{
- mFailCode = err;
-}
-void CentralRepositoryStubHelper::setCurrentVal(TInt val)
-{
- mCurrentVal = val;
-}
-TInt CentralRepositoryStubHelper::currentVal()
-{
- return mCurrentVal;
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CRepository* CRepository::NewL( TUid aRepositoryUid )
- {
- CRepository* self = CRepository::NewLC( aRepositoryUid );
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CRepository* CRepository::NewLC( TUid /*aRepositoryUid*/ )
- {
- CRepository* self = new (ELeave) CRepository();
- CleanupStack::PushL( self );
- return self;
- }
-
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CRepository::~CRepository()
- {
- }
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-TInt CRepository::Get(TUint32 /*aKey*/, TInt& aValue)
- {
- aValue = mCurrentVal;
- return mFailCode;
- }
-
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-TInt CRepository::Set(TUint32 /*aKey*/, TInt aValue)
- {
- if ( mFailCode == KErrNone )
- {
- mCurrentVal = aValue;
- }
- return mFailCode;
- }
-
-
--- a/logsui/logsengine/logssymbianos/tsrc/stubs/centralrepository_stub_helper.h Mon Aug 23 18:14:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-* Copyright (c) 2004-2006 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 __CENTRALREPOSITORYHELPER_H__
-#define __CENTRALREPOSITORYHELPER_H__
-
-class CentralRepositoryStubHelper{
-
-public: // Stub data
-
- static void reset();
- static void setFailCode(TInt err);
- static void setCurrentVal(TInt val);
- static TInt currentVal();
-
-};
-
-#endif // __CENTRALREPOSITORYHELPER_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/stubs/qcontactmanager.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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 QCONTACTMANAGER_H
+#define QCONTACTMANAGER_H
+
+#include <QObject>
+
+#include <QMap>
+#include <QString>
+#include <QList>
+
+#include "qcontact.h"
+#include "qcontactid.h"
+#include "qcontactsortorder.h"
+#include "qcontactfetchhint.h"
+
+QTM_BEGIN_NAMESPACE
+
+class QContactFilter;
+class QContactAction;
+
+class QContactManager
+{
+public:
+ explicit QContactManager(const QString& managerName = QString(), const QMap<QString, QString>& parameters = (QMap<QString, QString>()), QObject* parent = 0);
+ ~QContactManager();
+
+ QList<QContactLocalId> contactIds(const QList<QContactSortOrder>& sortOrders = QList<QContactSortOrder>()) const;
+ QList<QContactLocalId> contactIds(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders = QList<QContactSortOrder>()) const;
+
+ QList<QContact> contacts(const QList<QContactSortOrder>& sortOrders = QList<QContactSortOrder>(), const QContactFetchHint& fetchHint = QContactFetchHint()) const;
+ QList<QContact> contacts(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders = QList<QContactSortOrder>(), const QContactFetchHint& fetchHint = QContactFetchHint()) const;
+ QContact contact(const QContactLocalId& contactId, const QContactFetchHint& fetchHint = QContactFetchHint()) const; // retrieve a contact
+};
+
+QTM_END_NAMESPACE
+
+#endif
--- a/logsui/logsengine/logssymbianos/tsrc/stubs/qtcontacts_stubs.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/stubs/qtcontacts_stubs.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -33,6 +33,8 @@
QString logsTestAvatar = "";
QString logsFirstName = "";
QString logsLastName = "";
+int testContactIdsMethodCallCount = 0;
+
Q_DECLARE_METATYPE(QContactAvatar *)
void QtContactsStubsHelper::reset()
@@ -42,6 +44,7 @@
logsTestContactLocalId = 0;
logsFirstName = "";
logsLastName = "";
+ testContactIdsMethodCallCount = 0;
}
void QtContactsStubsHelper::setContactId(int id)
@@ -55,6 +58,11 @@
logsLastName = last;
}
+int QtContactsStubsHelper::contactIdsMethodCallCount()
+{
+ return testContactIdsMethodCallCount;
+}
+
// ----------------------------------------------------------------------------
// QContactData
// ----------------------------------------------------------------------------
@@ -111,6 +119,7 @@
if ( QString("11112222").endsWith(matchNum) ){
list.append( logsTestContactId );
}
+ testContactIdsMethodCallCount++;
return list;
}
@@ -151,6 +160,11 @@
logsTestNumber = value.toString();
}
+QVariant QContactDetailFilter::value() const
+{
+ return QVariant(logsTestNumber);
+}
+
// ----------------------------------------------------------------------------
// QContact
// ----------------------------------------------------------------------------
@@ -216,6 +230,14 @@
return logsTestContactLocalId;
}
+QString QContact::type() const
+{
+ if (logsTestContactLocalId == 99) {
+ return QContactType::TypeGroup;
+ } else {
+ return QContactType::TypeContact;
+ }
+}
// ----------------------------------------------------------------------------
// QContactDetail
--- a/logsui/logsengine/logssymbianos/tsrc/stubs/qtcontacts_stubs_helper.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/stubs/qtcontacts_stubs_helper.h Fri Sep 03 14:26:05 2010 +0300
@@ -24,4 +24,5 @@
static void reset();
static void setContactId(int id);
static void setContactNames(const QString& first, const QString& last);
+ static int contactIdsMethodCallCount();
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/stubs/xqsettingskey.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2005 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 XQSETTINGSITEM_H
+#define XQSETTINGSITEM_H
+
+
+// CLASS DECLARATION
+class XQSettingsKey
+{
+public:
+ enum Target
+ {
+ TargetCentralRepository = 0,
+ TargetPublishAndSubscribe
+ };
+
+ XQSettingsKey(XQSettingsKey::Target target, long int uid, unsigned long int key);
+ ~XQSettingsKey();
+
+ XQSettingsKey::Target target() const;
+ long int uid() const;
+ unsigned long int key() const;
+
+protected:
+ XQSettingsKey::Target m_target;
+ long int m_uid;
+ unsigned long int m_key;
+};
+
+
+#endif //XQSETTINGSITEM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/stubs/xqsettingsmanager.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2005 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 XQSETTINGSMANAGER_H
+#define XQSETTINGSMANAGER_H
+
+#include "xqsettingskey.h"
+
+// CLASS DECLARATION
+class XQSettingsManager
+{
+public:
+
+ enum Type
+ {
+ TypeVariant = 0,
+ TypeInt,
+ TypeDouble,
+ TypeString,
+ TypeByteArray
+ };
+
+ XQSettingsManager();
+ ~XQSettingsManager();
+
+ QVariant readItemValue(const XQSettingsKey& key, XQSettingsManager::Type type = XQSettingsManager::TypeVariant);
+ bool writeItemValue(const XQSettingsKey& key, const QVariant& value);
+
+public:
+ static bool mFailed;
+ static int mCurrentVal;
+};
+
+#endif // XQSETTINGSMANAGER_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/stubs/xqsettingsmanager_stub.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2005 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 <qglobal.h>
+#include <QVariant>
+#include <xqsettingsmanager.h>
+#include <xqsettingskey.h>
+
+bool XQSettingsManager::mFailed = false;
+int XQSettingsManager::mCurrentVal = 0;
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// XQSettingsManager
+//////////////////////////////////////////////////////////////////////////////////////////
+
+XQSettingsManager::XQSettingsManager()
+{
+}
+
+XQSettingsManager::~XQSettingsManager()
+{
+
+}
+
+QVariant XQSettingsManager::readItemValue(const XQSettingsKey& key,
+ XQSettingsManager::Type type)
+{
+ Q_UNUSED(key);
+ Q_UNUSED(type);
+ if (mFailed)
+ return QVariant();
+ else
+ return QVariant(mCurrentVal);
+}
+
+bool XQSettingsManager::writeItemValue(const XQSettingsKey& key, const QVariant& value)
+{
+ Q_UNUSED(key);
+ if (mFailed) {
+ return false;
+ }
+ else {
+ mCurrentVal = value.toInt();
+ return true;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// XQSettingsKey
+//////////////////////////////////////////////////////////////////////////////////////////
+
+XQSettingsKey::XQSettingsKey(XQSettingsKey::Target target, long int uid, unsigned long int key)
+{
+ m_target = target;
+ m_uid = uid;
+ m_key = key;
+}
+
+XQSettingsKey::~XQSettingsKey()
+{
+
+}
+
+XQSettingsKey::Target XQSettingsKey::target() const
+{
+ return m_target;
+}
+
+long int XQSettingsKey::uid() const
+{
+ return m_uid;
+}
+
+unsigned long int XQSettingsKey::key() const
+{
+ return m_key;
+}
--- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logsdbconnector.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logsdbconnector.h Fri Sep 03 14:26:05 2010 +0300
@@ -56,11 +56,8 @@
void testReadCompleted();
void testErrorOccurred();
void testUpdateDetails();
- void testClearMissedCallsCounter();
void testRefreshData();
void testCompressData();
- void testPredictiveSearchStatus();
- void testSetPredictiveSearch();
private:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/install/ut_logssymbianos.pkg Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,37 @@
+;
+; 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:
+;
+; A package file for creating an installation file for Logs
+; which updates Logs binaries from ROM (eclipsing)
+
+; Supported languages
+&EN
+
+; Header
+#{"ut_logssymbianos"},(0xEfaaa9b2),1,0,0
+
+; Localised Vendor name
+%{"Symbian"}
+
+; Unique Vendor name
+:"Symbian"
+
+
+; -----------------------------------------------------------------------------------
+
+; Backup registration and restore
+"\epoc32\release\armv5\urel\ut_logssymbianos.exe"-"!:\sys\bin\ut_logssymbianos.exe"
+"\epoc32\data\z\resource\apps\ut_logssymbianos.rsc"-"!:\resource\apps\ut_logssymbianos.rsc"
+"\epoc32\data\z\private\10003a3f\import\apps\ut_logssymbianos_reg.rsc"-"!:\private\10003a3f\import\apps\ut_logssymbianos_reg.rsc"
--- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/main.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/main.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -23,76 +23,51 @@
#include "ut_logsreaderstates.h"
#include "ut_logseventparser.h"
#include "ut_logseventdataparser.h"
-#include "testresultxmlparser.h"
+#include "testrunner.h"
#include "ut_logsremove.h"
#include "ut_logsremovestates.h"
int main(int argc, char *argv[])
{
- bool promptOnExit(true);
- for (int i=0; i<argc; i++) {
- if (QString(argv[i]) == "-noprompt")
- promptOnExit = false;
+ printf("Running tests...\n");
+
+ QApplication app(argc, argv);
+ QStringList args = app.arguments();
+ QString combinedOutputFileName;
+ for ( int i = 0; i < args.count(); i++ ){
+ QString arg = args.at(i);
+ if ( arg == QString("-o") && i + 1 < args.count() ){
+ i++;
+ combinedOutputFileName = args.at(i);
+ }
}
- printf("Running tests...\n");
- QApplication app(argc, argv);
- TestResultXmlParser parser;
+ TestRunner testRunner("LogsSymbianOS", combinedOutputFileName);
UT_LogsDbConnector ut_logsDbConnector;
- QString resultFileName = "c:/ut_logs_logsDbConnector.xml";
- QStringList args_logsDbConnector( "ut_logsDbConnector");
- args_logsDbConnector << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsDbConnector, args_logsDbConnector);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsDbConnector);
UT_LogsRemove ut_logsRemove;
- resultFileName = "c:/ut_logs_logsRemove.xml";
- QStringList args_logsRemove( "ut_logsRemove");
- args_logsRemove << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsRemove, args_logsRemove);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsRemove);
UT_LogsRemoveStates ut_logsRemoveStates;
- resultFileName = "c:/ut_logs_logsRemoveStates.xml";
- QStringList args_logsRemoveStates( "ut_logsRemoveStates");
- args_logsRemoveStates << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsRemoveStates, args_logsRemoveStates);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsRemoveStates);
UT_LogsReader ut_logsReader;
- resultFileName = "c:/ut_logs_logsReader.xml";
- QStringList args_logsReader( "ut_logsReader");
- args_logsReader << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsReader, args_logsReader);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsReader);
UT_LogsReaderStates ut_logsReaderStates;
- resultFileName = "c:/ut_logs_logsReaderStates.xml";
- QStringList args_logsReaderStates( "ut_logsReaderStates");
- args_logsReaderStates << "-xml" << "-o" << resultFileName;
- QT_TRAP_THROWING( QTest::qExec(&ut_logsReaderStates, args_logsReaderStates); )
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsReaderStates);
UT_LogsEventParser ut_logsEvent;
- resultFileName = "c:/ut_logs_logsEventParser.xml";
- QStringList args_logsEvent( "ut_logsEvent");
- args_logsEvent << "-xml" << "-o" << resultFileName;
- QT_TRAP_THROWING( QTest::qExec(&ut_logsEvent, args_logsEvent); )
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsEvent);
UT_LogsEventDataParser ut_logsEventData;
- resultFileName = "c:/ut_logs_logsEventDataParser.xml";
- QStringList args_logsEventData( "ut_logsEventData");
- args_logsEventData << "-xml" << "-o" << resultFileName;
- QT_TRAP_THROWING( QTest::qExec(&ut_logsEventData, args_logsEventData); )
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsEventData);
- if (promptOnExit) {
- printf("Press any key...\n");
- getchar();
- }
+ testRunner.printResults();
+
return 0;
}
--- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsdbconnector.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsdbconnector.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -20,7 +20,8 @@
#include "logsmodel.h"
#include "logsreader.h"
#include "logscommondata.h"
-#include "centralrepository_stub_helper.h"
+#include "logsremove.h"
+#include <xqsettingsmanager.h>
#include <QtTest/QtTest>
@@ -92,7 +93,7 @@
QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeUndefined );
// Resource control enabled
- CentralRepositoryStubHelper::setCurrentVal(logsDefaultMatchLength + 2);
+ XQSettingsManager::mCurrentVal = logsDefaultMatchLength + 2;
LogsDbConnector* connector = new LogsDbConnector(mEvents, false, true);
QVERIFY( connector->init() == 0 );
QVERIFY( connector->mReader );
@@ -101,10 +102,11 @@
QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeCompressEnabled );
QCOMPARE( LogsCommonData::getInstance().telNumMatchLen(), logsDefaultMatchLength + 2 );
delete connector;
+ LogsCommonData::getInstance().freeCommonData();
// Match len not found, default is used
- CentralRepositoryStubHelper::setCurrentVal(logsDefaultMatchLength + 2);
- CentralRepositoryStubHelper::setFailCode( -1 );
+ XQSettingsManager::mCurrentVal = logsDefaultMatchLength + 2;
+ XQSettingsManager::mFailed = true;
connector = new LogsDbConnector(mEvents);
QVERIFY( connector->init() == 0 );
QVERIFY( connector->mReader );
@@ -350,13 +352,14 @@
QVERIFY( mDbConnector->mEvents.count() == 1 );
QVERIFY( mEvents.count() == 1 );
- // Read completed when compression is enabled, reader is not stopped
+ // Read completed when compression is enabled, reader is stopped
QVERIFY( mDbConnector->init() == 0 );
QVERIFY( mDbConnector->start() == 0 );
QVERIFY( mDbConnector->mReader->mLogViewRecent != 0 );
mDbConnector->mCompressionEnabled = true;
mDbConnector->readCompleted();
- QVERIFY( mDbConnector->mReader->mLogViewRecent != 0 );
+ QVERIFY( !mDbConnector->mReader->mLogViewRecent );
+ QVERIFY( !mDbConnector->mLogsRemove );
}
void UT_LogsDbConnector::testErrorOccurred()
@@ -385,28 +388,6 @@
QVERIFY( spyUpdated.count() == 0 ); // Will happen asynchronously
}
-void UT_LogsDbConnector::testClearMissedCallsCounter()
-{
- // Not ready
- QVERIFY( mDbConnector->clearMissedCallsCounter() != 0 );
-
- // Ready and value is changed
- mDbConnector->init();
- CentralRepositoryStubHelper::reset();
- CentralRepositoryStubHelper::setCurrentVal(5);
- QVERIFY( mDbConnector->clearMissedCallsCounter() == 0 );
- QVERIFY( CentralRepositoryStubHelper::currentVal() == 0 );
-
- // Ready and no need to change value as it is already zero
- QVERIFY( mDbConnector->clearMissedCallsCounter() == 0 );
- QVERIFY( CentralRepositoryStubHelper::currentVal() == 0 );
-
- // Fails with some error
- CentralRepositoryStubHelper::setCurrentVal(100);
- CentralRepositoryStubHelper::setFailCode(KErrNotFound);
- QVERIFY( mDbConnector->clearMissedCallsCounter() != 0 );
-}
-
void UT_LogsDbConnector::testRefreshData()
{
QVERIFY( mDbConnector->refreshData() != 0 );
@@ -423,11 +404,14 @@
QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeUndefined );
// Reader exists, compressed before, reading started
+ delete mDbConnector->mLogsRemove;
+ mDbConnector->mLogsRemove = 0;
mDbConnector->mCompressionEnabled = true;
QVERIFY( mDbConnector->refreshData() == 0 );
QVERIFY( mDbConnector->mReader->IsActive() );
QVERIFY( !mDbConnector->mCompressionEnabled );
QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeUndefined );
+ QVERIFY( mDbConnector->mLogsRemove );
// Reading not started again as already active
LogsCommonData::getInstance().configureReadSize(30, LogsEvent::DirUndefined);
@@ -436,6 +420,7 @@
QVERIFY( mDbConnector->mReader->IsActive() );
QVERIFY( !mDbConnector->mCompressionEnabled );
QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeUndefined );
+ QVERIFY( mDbConnector->mLogsRemove );
}
void UT_LogsDbConnector::testCompressData()
@@ -455,6 +440,7 @@
QVERIFY( spyRemoved.count() == 1 );
QList<int> removedIndexes = qvariant_cast< QList<int> >(spyRemoved.at(0).at(0));
QVERIFY( removedIndexes.count() == 0 );
+ QVERIFY( !mDbConnector->mLogsRemove );
// Less events than compression limit is, nothing really done
int numEvents = 3;
@@ -488,49 +474,3 @@
QVERIFY( removedIndexes3.at(2) == ( numEventsMoreThanCompressLimit - 1 ) );
QVERIFY( mDbConnector->mModelEvents.count() == logsReadSizeCompressEnabled );
}
-
-void UT_LogsDbConnector::testPredictiveSearchStatus()
-{
- // Not ready
- QVERIFY( mDbConnector->predictiveSearchStatus() != 0 );
-
- // Ready and value returned
- mDbConnector->init();
- CentralRepositoryStubHelper::reset();
- CentralRepositoryStubHelper::setCurrentVal(2);
- QVERIFY( mDbConnector->predictiveSearchStatus() == 2 );
-
- // Fails with some error
- CentralRepositoryStubHelper::setCurrentVal(2);
- CentralRepositoryStubHelper::setFailCode(KErrNotSupported);
- QVERIFY( mDbConnector->predictiveSearchStatus() == KErrNotSupported );
-}
-
-void UT_LogsDbConnector::testSetPredictiveSearch()
-{
- // Not ready
- QVERIFY( mDbConnector->setPredictiveSearch(true) != 0 );
-
- // Ready and value change is not allowed
- mDbConnector->init();
- CentralRepositoryStubHelper::reset();
- CentralRepositoryStubHelper::setCurrentVal(0);
- QVERIFY( mDbConnector->setPredictiveSearch(true) != 0 );
- QVERIFY( CentralRepositoryStubHelper::currentVal() == 0 );
-
- // Ready and value is changed
- CentralRepositoryStubHelper::setCurrentVal(2);
- QVERIFY( mDbConnector->setPredictiveSearch(true) == 0 );
- QVERIFY( CentralRepositoryStubHelper::currentVal() == 1 );
-
- // Ready and value is changed
- CentralRepositoryStubHelper::setCurrentVal(1);
- QVERIFY( mDbConnector->setPredictiveSearch(false) == 0 );
- QVERIFY( CentralRepositoryStubHelper::currentVal() == 2 );
-
- // Fails with some error
- CentralRepositoryStubHelper::setCurrentVal(1);
- CentralRepositoryStubHelper::setFailCode(KErrNotFound);
- QVERIFY( mDbConnector->setPredictiveSearch(false) == KErrNotFound );
-}
-
--- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsreader.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsreader.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -104,10 +104,16 @@
mReader->stop();
QVERIFY( mReader->start() == 0 );
QVERIFY( mReader->IsActive() );
+ ContactCacheEntry contactEntry("name", 1);
+ mReader->mContactCache.insert("12345", contactEntry);
mReader->stop();
QVERIFY( !mReader->IsActive() );
QVERIFY( !mReader->mLogViewEvent );
QVERIFY( !mReader->mDuplicatesView );
+ QCOMPARE( mReader->mReadStates.count(), 0 );
+ QCOMPARE( mReader->mModifyingStates.count(), 0 );
+ QCOMPARE( mReader->mDuplicateReadingStates.count(), 0 );
+ QCOMPARE( mReader->mContactCache.count(), 0 );
}
void UT_LogsReader::testMarkEventSeen()
@@ -254,6 +260,7 @@
void UT_LogsReader::testUpdateDetails()
{
+ // Full clearing is done always
QVERIFY( !mReader->IsActive() );
LogsEvent* ev = new LogsEvent;
ev->setContactMatched(true);
@@ -262,13 +269,14 @@
mReader->mContactCache.insert("12345", contactEntry);
mReader->updateDetails(false);
QVERIFY( mReader->IsActive() );
- QVERIFY( mReader->mContactCache.count() == 1 );
- QVERIFY( ev->contactMatched() );
+ QVERIFY( mReader->mContactCache.count() == 0 );
+ mReader->mContactCache.insert("12345", contactEntry);
+ ContactCacheEntry contactEntry2("name2", 1);
+ mReader->mContactCache.insert("123456666", contactEntry2);
mReader->updateDetails(true);
QVERIFY( mReader->IsActive() );
QVERIFY( mReader->mContactCache.count() == 0 );
- QVERIFY( !ev->contactMatched() );
}
void UT_LogsReader::testLock()
--- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsreaderstates.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsreaderstates.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -435,14 +435,19 @@
QVERIFY( !logsEvent->contactLocalId() );
QVERIFY(!logsEvent->contactMatched());
+
// Some events, nothing yet in cache, match from phonebook found (international format)
+ // Match is not used for event which has already remoteparty name
QtContactsStubsHelper::setContactNames("first", "last");
logsEvent->setNumber( "+3581112222" );
+ logsEvent2->setNumber( "+3581112222" );
QVERIFY( !state.enterL() );
QVERIFY( mContactCache.count() == 1 );
QVERIFY( logsEvent->contactLocalId() == contactId );
QVERIFY(logsEvent->contactMatched());
- QVERIFY(logsEvent->remoteParty().length() > 0);
+ QCOMPARE(logsEvent->remoteParty(), QString("first last") );
+ QVERIFY(!logsEvent2->contactMatched());
+ QCOMPARE(logsEvent2->remoteParty(), QString("remote2") );
// Some events, nothing yet in cache, match from phonebook found (local format)
mContactCache.clear();
@@ -453,7 +458,7 @@
QVERIFY( mContactCache.count() == 1 );
QVERIFY( logsEvent->contactLocalId() == contactId );
QVERIFY(logsEvent->contactMatched());
- QVERIFY(logsEvent->remoteParty().length() > 0);
+ QCOMPARE(logsEvent->remoteParty(), QString("first last") );
// Some events, matching info found from cache
logsEvent->setLogsEventData(NULL);
@@ -465,7 +470,7 @@
QVERIFY( logsEvent->contactLocalId() == contactId );
QtContactsStubsHelper::setContactNames("updated", "last");
- QVERIFY( logsEvent->remoteParty() == "first last" );
+ QCOMPARE(logsEvent->remoteParty(), QString("first last") );
mContactCache.clear();
logsEvent->setContactMatched( false );
logsEvent->setRemoteParty("");
@@ -483,6 +488,7 @@
mContactCache.clear();
logsEvent->setContactMatched( false );
logsEvent->setRemoteParty("");
+ logsEvent->setNumber( "5555" );
QVERIFY( mContactCache.count() == 0 );
QVERIFY( logsEvent->remoteParty().length() == 0 );
QVERIFY( !state.enterL() );
@@ -490,6 +496,23 @@
QVERIFY( logsEvent->remoteParty().length() == 0 );
QVERIFY(!logsEvent->contactMatched());
+ // Check that optimization for avoiding multiple searches
+ // per one number works
+ QtContactsStubsHelper::reset();
+ mContactCache.clear();
+ LogsEvent* logsEvent3 = new LogsEvent;
+ logsEvent3->setNumber( "5555" );
+ logsEvent3->setIsInView(true);
+ mEvents.append( logsEvent3 );
+ QCOMPARE( logsEvent->number(), logsEvent3->number() );
+ QVERIFY( !state.enterL() );
+ QVERIFY( mContactCache.count() == 0 );
+ QVERIFY( logsEvent->remoteParty().length() == 0 );
+ QVERIFY( logsEvent3->remoteParty().length() == 0 );
+ QVERIFY(!logsEvent->contactMatched());
+ QVERIFY(!logsEvent3->contactMatched());
+ QCOMPARE( QtContactsStubsHelper::contactIdsMethodCallCount(), 1 );
+
}
void UT_LogsReaderStates::testStateFillDetails2()
--- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/ut_logssymbianos.pro Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/ut_logssymbianos.pro Fri Sep 03 14:26:05 2010 +0300
@@ -23,11 +23,9 @@
CONFIG += hb
DEPENDPATH += .
-INCLUDEPATH = ../stubs/ $$INCLUDEPATH
+PREPEND_INCLUDEPATH = ../stubs
INCLUDEPATH += .
-INCLUDEPATH += /epoc32/include
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-INCLUDEPATH += /epoc32/include/ecom
INCLUDEPATH += ../../
INCLUDEPATH += ../../inc
INCLUDEPATH += ../../../
@@ -45,7 +43,6 @@
HEADERS += inc/ut_logseventdataparser.h
HEADERS += inc/ut_logsremove.h
HEADERS += inc/ut_logsremovestates.h
-HEADERS += inc/ut_logssystemtimeobserver.h
HEADERS += ../../inc/logsdbconnector.h
HEADERS += ../../inc/logsworker.h
HEADERS += ../../inc/logsreader.h
@@ -53,7 +50,6 @@
HEADERS += ../../inc/logsreaderobserver.h
HEADERS += ../../inc/logsremove.h
HEADERS += ../../inc/logsremovestates.h
-HEADERS += ../../inc/logssystemtimeobserver.h
HEADERS += ../../../../../recents_plat/logs_engine_api/inc/logsevent.h
HEADERS += ../../../inc/logseventdata.h
HEADERS += ../../../inc/logscommondata.h
@@ -84,10 +80,10 @@
SOURCES += ../../../src/logsconfigurationparams.cpp
SOURCES += ../../../src/logsduplicatelookup.cpp
-SOURCES += ../../../../tsrc/qtestutils/src/testresultxmlparser.cpp
+SOURCES += ../../../../tsrc/qtestutils/src/testrunner.cpp
SOURCES += ../stubs/logclient_stubs.cpp
SOURCES += ../stubs/qtcontacts_stubs.cpp
-SOURCES += ../stubs/centralrepository_stub.cpp
+SOURCES += ../stubs/xqsettingsmanager_stub.cpp
symbian: {
TARGET.UID2 = 0x100039CE
--- a/logsui/logsengine/src/logsabstractmodel.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/src/logsabstractmodel.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -28,6 +28,7 @@
#include <hbextendedlocale.h>
#include <hbstringutil.h>
#include "logsconfigurationparams.h"
+#include "logscommondata.h"
Q_DECLARE_METATYPE(LogsEvent *)
Q_DECLARE_METATYPE(LogsCall *)
@@ -79,7 +80,7 @@
if ( !mDbConnector ){
return -1;
}
- return mDbConnector->predictiveSearchStatus();
+ return LogsCommonData::getInstance().predictiveSearchStatus();
}
// -----------------------------------------------------------------------------
@@ -210,11 +211,9 @@
//
// -----------------------------------------------------------------------------
//
-int LogsAbstractModel::doSetPredictiveSearch(bool enabled){
- if ( !mDbConnector ){
- return -1;
- }
- return mDbConnector->setPredictiveSearch(enabled);
+int LogsAbstractModel::doSetPredictiveSearch(bool enabled)
+{
+ return LogsCommonData::getInstance().setPredictiveSearch(enabled);
}
// -----------------------------------------------------------------------------
--- a/logsui/logsengine/src/logscommondata.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/src/logscommondata.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -22,18 +22,34 @@
#include "logsengdefs.h"
//SYSTEM
+#include <xqsettingsmanager.h>
#include <qcontactmanager.h>
-
+#include <LogsDomainCRKeys.h>
static LogsCommonData* mLogsCommonInstance = 0;
-
+
+// CONSTANTS
+
+// Telephony Configuration API
+// Keys under this category are used in defining telephony configuration.
+const TUid logsTelConfigurationCRUid = {0x102828B8};
+
+// Amount of digits to be used in contact matching.
+// This allows a customer to variate the amount of digits to be matched.
+const TUint32 logsTelMatchDigits = 0x00000001;
+
+const int logsNotInitialized = -1;
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
LogsCommonData::LogsCommonData() :
mContactManager(0), mMaxReadSize(-1),
- mMaxReadSizeDir(LogsEvent::DirUndefined), mMatchLen(logsDefaultMatchLength)
+ mMaxReadSizeDir(LogsEvent::DirUndefined),
+ mSettingsManager(new XQSettingsManager()),
+ mMatchLen(logsDefaultMatchLength),
+ mPredictiveSearchStatus(logsNotInitialized)
{
LOGS_QDEBUG( "logs [ENG] <-> LogsCommonData::LogsCommonData()" )
}
@@ -46,6 +62,7 @@
{
LOGS_QDEBUG( "logs [ENG] -> LogsCommonData::~LogsCommonData()" )
delete mContactManager;
+ delete mSettingsManager;
LOGS_QDEBUG( "logs [ENG] <- LogsCommonData::~LogsCommonData()" )
}
@@ -136,18 +153,110 @@
//
// -----------------------------------------------------------------------------
//
-void LogsCommonData::setTelNumMatchLen(int matchLen)
+int LogsCommonData::telNumMatchLen() const
{
- mMatchLen = matchLen;
+ return mMatchLen;
+}
+
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsCommonData::predictiveSearchStatus()
+{
+ if (mPredictiveSearchStatus == logsNotInitialized) {
+ mPredictiveSearchStatus = getPredictiveSearchStatus();
+ }
+ return mPredictiveSearchStatus;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
-int LogsCommonData::telNumMatchLen() const
+int LogsCommonData::getPredictiveSearchStatus()
+{
+ int status(logsNotInitialized);
+ LOGS_QDEBUG( "logs [ENG] -> LogsCommonData::getPredictiveSearchStatus()" )
+ XQSettingsKey key(XQSettingsKey::TargetCentralRepository,
+ KCRUidLogs.iUid,
+ KLogsPredictiveSearch);
+ QVariant value = mSettingsManager->readItemValue(key,
+ XQSettingsManager::TypeInt);
+ if (!value.isNull()) {
+ status = value.toInt();
+ }
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsCommonData::getPredictiveSearchStatus(), status: ", status )
+ return status;
+}
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsCommonData::setPredictiveSearch(bool enabled)
{
- return mMatchLen;
+ int err(-1);
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsCommonData::setPredictiveSearch(), enabled: ", enabled )
+ if (predictiveSearchStatus() != 0) {
+ XQSettingsKey key(XQSettingsKey::TargetCentralRepository,
+ KCRUidLogs.iUid,
+ KLogsPredictiveSearch);
+ int value = enabled ? 1 : 2;
+ if (mSettingsManager->writeItemValue(key, QVariant(value))) {
+ err = 0;
+ mPredictiveSearchStatus = value;
+ }
+ }
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsCommonData::setPredictiveSearch(), err: ", err )
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsCommonData::clearMissedCallsCounter()
+{
+ int err(-1);
+ XQSettingsKey key(XQSettingsKey::TargetCentralRepository,
+ KCRUidLogs.iUid,
+ KLogsNewMissedCalls);
+ QVariant value = mSettingsManager->readItemValue(
+ key, XQSettingsManager::TypeInt);
+ if (!value.isNull()) {
+ err = 0;
+ if (value.toInt() > 0) {
+ err = mSettingsManager->writeItemValue(key, 0) ? 0 : -1;
+ }
+ }
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsCommonData::getTelNumMatchLen(int& matchLen)
+{
+ bool ok(false);
+ //use local manager, since normally this function is called only once,
+ //after that we can clean related cenrep handler resources
+ XQSettingsManager manager;
+ XQSettingsKey key(XQSettingsKey::TargetCentralRepository,
+ logsTelConfigurationCRUid.iUid,
+ logsTelMatchDigits);
+ QVariant value = manager.readItemValue(
+ key, XQSettingsManager::TypeInt);
+ if (!value.isNull()) {
+ matchLen = value.toInt();
+ mMatchLen = matchLen;
+ ok = true;
+ }
+ return ok;
}
// End of file
--- a/logsui/logsengine/src/logscontact.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/src/logscontact.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -27,6 +27,8 @@
//SYSTEM
#include <QVariant>
#include <qcontactmanager.h>
+#include <qcontactonlineaccount.h>
+#include <qcontactphonenumber.h>
#include <xqappmgr.h>
#include <cntservicescontact.h>
@@ -90,7 +92,13 @@
LogsContact::RequestType type = TypeLogsContactSave;
if ( isContactInPhonebook() ) {
- type = TypeLogsContactOpen;
+ if (isContactGroup()) {
+ type = TypeLogsContactOpenGroup;
+ LOGS_QDEBUG( "logs [ENG] -> TypeLogsContactOpenGroup" )
+ } else {
+ type = TypeLogsContactOpen;
+ LOGS_QDEBUG( "logs [ENG] -> TypeLogsContactOpenGroup" )
+ }
}
LOGS_QDEBUG_2( "logs [ENG] <- LogsContact::allowedRequestType(): ", type )
@@ -114,11 +122,14 @@
{
LOGS_QDEBUG( "logs [ENG] -> LogsContact::open()")
bool ret = false;
- if ( allowedRequestType() == TypeLogsContactOpen ) {
- mCurrentRequest = TypeLogsContactOpen;
-
+ LogsContact::RequestType type = allowedRequestType();
+ if ( type == TypeLogsContactOpen || type == TypeLogsContactOpenGroup) {
+ mCurrentRequest = type;
QString interface("com.nokia.symbian.IContactsView");
QString operation("openContactCard(int)");
+ if (type == TypeLogsContactOpenGroup) {
+ operation = "openGroup(int)";
+ }
QList<QVariant> arguments;
arguments.append( QVariant(mContactId) );
ret = requestPhonebookService( interface, operation, arguments );
@@ -168,6 +179,19 @@
LOGS_QDEBUG( "logs [ENG] <- LogsContact::cancelServiceRequest()" )
}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsContact::isContactGroup()
+{
+ bool isGroup = (mContact.type() == QContactType::TypeGroup);
+ LOGS_QDEBUG_2( "logs [ENG] <-> LogsContact::isContactGroup(): ", isGroup )
+ return isGroup;
+}
+
+
// ----------------------------------------------------------------------------
//
// ----------------------------------------------------------------------------
@@ -261,7 +285,8 @@
//cleaned up, since remote party info might have been changed.
//However, if remote party info is taken from symbian DB, it won't be
//updated
- bool clearCached = ( mCurrentRequest == TypeLogsContactOpen );
+ bool clearCached = ( mCurrentRequest == TypeLogsContactOpen
+ || mCurrentRequest == TypeLogsContactOpenGroup );
if ( modified ) {
mContact = contact();
mDbConnector.updateDetails(clearCached);
@@ -293,8 +318,7 @@
//
bool LogsContact::isContactInPhonebook()
{
- QContactLocalId localId = mContactId;
- return ( localId && localId == mContact.localId() );
+ return ( mContactId && mContactId == mContact.localId() );
}
// End of file
--- a/logsui/logsengine/src/logsdetailsmodel.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/src/logsdetailsmodel.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -172,8 +172,9 @@
{
if ( modified ){
mEvent->prepareForContactMatching();
+ QString remoteParty;
if ( mEvent->updateRemotePartyFromContacts(
- LogsCommonData::getInstance().contactManager() ).length() > 0 ) {
+ LogsCommonData::getInstance().contactManager(), remoteParty ) ) {
updateModel();
}
}
--- a/logsui/logsengine/src/logsevent.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/src/logsevent.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -167,11 +167,14 @@
// LogsEvent::setRemoteParty
// ----------------------------------------------------------------------------
//
-void LogsEvent::setRemoteParty( const QString& remoteParty )
+void LogsEvent::setRemoteParty( const QString& remoteParty, bool contactMatch )
{
- if ( mEventState == EventNotUpdated && mRemoteParty != remoteParty ){
- LOGS_QDEBUG( "logs [ENG] <-> LogsEvent::setRemoteParty, event updated")
- mEventState = LogsEvent::EventUpdated;
+ if ( contactMatch ){
+ setContactMatched( !remoteParty.isEmpty() );
+ if ( mEventState == EventNotUpdated &&
+ ( remoteParty.isEmpty() || mRemoteParty != remoteParty ) ){
+ mEventState = EventUpdated;
+ }
}
mRemoteParty = remoteParty;
}
@@ -630,8 +633,10 @@
//
// ----------------------------------------------------------------------------
//
-QString LogsEvent::updateRemotePartyFromContacts(QContactManager& manager)
+bool LogsEvent::updateRemotePartyFromContacts(
+ QContactManager& manager, QString& contactNameStr)
{
+ bool updatedRemoteParty = false;
QContactDetailFilter phoneFilter;
if ( mEventType == TypeVoIPCall && mLogsEventData && !mLogsEventData->remoteUrl().isEmpty() ) {
phoneFilter.setDetailDefinitionName( QContactOnlineAccount::DefinitionName,
@@ -645,12 +650,11 @@
phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
} else {
// Searching not possible
- return QString();
+ return updatedRemoteParty;
}
LOGS_QDEBUG_2( "logs [ENG] Try to find contact for num:", phoneFilter.value().toString() )
- QString contactNameStr;
QList<QContactLocalId> matchingContacts = manager.contactIds(phoneFilter);
LOGS_QDEBUG_2( "logs [ENG] Number of matches:", matchingContacts.size() )
if (matchingContacts.size() == 1) {
@@ -661,15 +665,13 @@
// cannot use.
QContactName contactName = match.detail(QContactName::DefinitionName);
contactNameStr = parseContactName(contactName);
- if (contactNameStr.length() > 0){
- LOGS_QDEBUG_3( "getRemotePartyFromContacts, (name, num):",
- contactNameStr, mNumber );
- // Fill event with new contact info
- setRemoteParty( contactNameStr );
- setContactLocalId( matchingContacts.at(0) );
- }
+ LOGS_QDEBUG_3( "getRemotePartyFromContacts, (name, num):", contactNameStr, mNumber );
+ // Fill event with new contact info
+ setRemoteParty( contactNameStr, true );
+ setContactLocalId( matchingContacts.at(0) );
+ updatedRemoteParty = true;
}
- return contactNameStr;
+ return updatedRemoteParty;
}
// ----------------------------------------------------------------------------
@@ -694,12 +696,9 @@
//
void LogsEvent::prepareForContactMatching()
{
- // If event would be in "added" state when contact mathing is done, event state
- // would not go to "updated" in case of associated contact was modified or
- // new matching contact was found. This would prevent list update.
- if ( mEventState == EventAdded ) {
- LOGS_QDEBUG( "logs [ENG] <-> LogsEvent::prepareForContactMatching, prepared")
- mEventState = EventNotUpdated;
+ if ( contactMatched() ){
+ setRemoteParty("");
+ setContactMatched(false);
}
}
--- a/logsui/logsengine/src/logsmatchesmodel.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/src/logsmatchesmodel.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -206,7 +206,7 @@
int LogsMatchesModel::doSetPredictiveSearch(bool enabled)
{
LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::doSetPredictiveSearch()" )
- int err = mDbConnector->setPredictiveSearch(enabled);
+ int err = LogsCommonData::getInstance().setPredictiveSearch(enabled);
if (!err) {
//in case of search is turned off, getLogMatches will only reset
//previous search results
@@ -334,7 +334,7 @@
//
void LogsMatchesModel::initPredictiveSearch()
{
- int searchStatus = mDbConnector->predictiveSearchStatus();
+ int searchStatus = LogsCommonData::getInstance().predictiveSearchStatus();
//searchStatus equal to 0 means that search should be permanently disabled
if (searchStatus != 0) {
mLogsCntFinder = new LogsCntFinder(LogsCommonData::getInstance().contactManager(),
@@ -453,8 +453,8 @@
void LogsMatchesModel::doSearchQuery()
{
LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::doSearchQuery()" );
- if (mCurrentSearchPattern != mPrevSearchPattern &&
- mDbConnector->predictiveSearchStatus() == 1 ){
+ if (mCurrentSearchPattern != mPrevSearchPattern &&
+ LogsCommonData::getInstance().predictiveSearchStatus() == 1) {
mPrevSearchPattern = mCurrentSearchPattern;
if (mCurrentSearchPattern.length() > 0) {
LOGS_QDEBUG( "logs [ENG] do search" );
--- a/logsui/logsengine/src/logsmodel.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/src/logsmodel.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -129,7 +129,7 @@
int LogsModel::clearMissedCallsCounter()
{
LOGS_QDEBUG( "logs [ENG] -> LogsModel::clearMissedCallsCounter()" )
- int err = mDbConnector->clearMissedCallsCounter();
+ int err = LogsCommonData::getInstance().clearMissedCallsCounter();
LOGS_QDEBUG_2( "logs [ENG] <- LogsModel::clearMissedCallsCounter(), err", err )
return err;
}
--- a/logsui/logsengine/tsrc/stubs/logscntfinder.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/stubs/logscntfinder.h Fri Sep 03 14:26:05 2010 +0300
@@ -21,7 +21,11 @@
#include <QObject>
#include <QList>
#include <QString>
-#include <qtcontacts.h>
+#include <qmobilityglobal.h>
+
+QTM_BEGIN_NAMESPACE
+class QContactManager;
+QTM_END_NAMESPACE
QTM_USE_NAMESPACE
--- a/logsui/logsengine/tsrc/stubs/logscntfinder_stub.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/stubs/logscntfinder_stub.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -19,10 +19,10 @@
#include "logslogger.h"
#include <QStringList>
-#include <QContactManager.h>
-#include <QContact.h>
-#include <QContactName.h>
-#include <QContactPhoneNumber.h>
+#include <qcontactmanager.h>
+#include <qcontact.h>
+#include <qcontactname.h>
+#include <qcontactphonenumber.h>
QString testHighlights;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/stubs/xqaiwinterfacedescriptor.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* 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 XQAIWINTERFACEDESCRIPTOR_H
+#define XQAIWINTERFACEDESCRIPTOR_H
+
+#include <QString>
+
+
+class XQAiwInterfaceDescriptor
+{
+public:
+ XQAiwInterfaceDescriptor();
+ ~XQAiwInterfaceDescriptor();
+
+ QString interfaceName() const;
+};
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/stubs/xqaiwrequest.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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 XQAIWREQUEST_H_
+#define XQAIWREQUEST_H_
+
+
+#include <QObject>
+#include <QList>
+#include <QVariant>
+#include <xqaiwinterfacedescriptor.h>
+
+
+class XQAiwRequest : public QObject
+ {
+ Q_OBJECT
+
+public:
+
+ XQAiwRequest(const XQAiwInterfaceDescriptor &descriptor, const QString &operation, bool embedded = true);
+ virtual ~XQAiwRequest();
+
+public slots:
+
+ void setArguments(const QList<QVariant> &arguments);
+ const XQAiwInterfaceDescriptor &descriptor() const;
+
+ bool send();
+
+ const QString &operation() const;
+
+ void setSynchronous(bool synchronous);
+
+
+signals:
+
+ void requestOk(const QVariant& result);
+ void requestError(int errorCode, const QString& errorMessage);
+
+ };
+
+#endif /* XQAIWREQUEST_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/stubs/xqappmgr.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* 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 XQAPPLICATIONMANAGER_H
+#define XQAPPLICATIONMANAGER_H
+
+#include <QString>
+#include <xqaiwrequest.h>
+
+class XQApplicationManager
+{
+public:
+
+ XQApplicationManager();
+ virtual ~XQApplicationManager();
+
+public:
+
+ XQAiwRequest* create( const QString& interface, const QString& operation, bool embedded = true);
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/stubs/xqservicerequest.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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 XQSERVICEREQUEST_H
+#define XQSERVICEREQUEST_H
+
+#include <QVariant>
+#include <xqrequestinfo.h>
+#include <QObject>
+
+class XQServiceRequest : public QObject
+{
+ Q_OBJECT
+public:
+
+ XQServiceRequest();
+ XQServiceRequest(const QString& fullServiceName, const QString& message, const bool& synchronous = true);
+ virtual ~XQServiceRequest();
+
+ bool send(QVariant& retValue) ;
+
+ void setSynchronous(const bool &synchronous);
+ bool isSynchronous() const;
+
+ QString service() const;
+ QString message() const;
+
+ void setArguments(const QList<QVariant> &arguments);
+
+ template<typename T>
+ inline XQServiceRequest &operator<< (const T &var)
+ {
+ QVariant v = qVariantFromValue(var);
+ addArg(v);
+ return *this;
+ }
+
+ void setInfo(const XQRequestInfo &info);
+ XQRequestInfo info() const;
+
+signals:
+ void requestCompleted(const QVariant& value) ;
+ void requestError(int err);
+
+private:
+ void addArg(const QVariant& v);
+};
+
+
+#endif
--- a/logsui/logsengine/tsrc/symbianos_stub/logsdbconnector_stub.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/symbianos_stub/logsdbconnector_stub.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -23,12 +23,10 @@
// CONSTANTS
QString logsLastCalledFunction = "";
-int logsPredictiveSearchStatus = 0;
void LogsDbConnectorStubHelper::reset()
{
logsLastCalledFunction = "";
- logsPredictiveSearchStatus = 0;
}
QString LogsDbConnectorStubHelper::lastCalledFunction()
@@ -36,11 +34,6 @@
return logsLastCalledFunction;
}
-void LogsDbConnectorStubHelper::setPredictiveSearch(int status)
-{
- logsPredictiveSearchStatus = status;
-}
-
// ----------------------------------------------------------------------------
// LogsDbConnector::LogsDbConnector
// ----------------------------------------------------------------------------
@@ -104,16 +97,6 @@
}
// ----------------------------------------------------------------------------
-// LogsDbConnector::clearMissedCallsCounter
-// ----------------------------------------------------------------------------
-//
-int LogsDbConnector::clearMissedCallsCounter()
-{
- logsLastCalledFunction = "clearMissedCallsCounter";
- return 0;
-}
-
-// ----------------------------------------------------------------------------
// LogsDbConnector::clearEvents
// ----------------------------------------------------------------------------
//
@@ -252,28 +235,3 @@
{
return 0;
}
-
-// ----------------------------------------------------------------------------
-// LogsDbConnector::predictiveSearchStatus
-// ----------------------------------------------------------------------------
-//
-int LogsDbConnector::predictiveSearchStatus()
-{
- logsLastCalledFunction = "predictiveSearchStatus";
- return logsPredictiveSearchStatus;
-}
-
-// ----------------------------------------------------------------------------
-// LogsDbConnector::setPredictiveSearch
-// ----------------------------------------------------------------------------
-//
-int LogsDbConnector::setPredictiveSearch(bool enabled)
-{
- logsLastCalledFunction = "setPredictiveSearch";
- if (logsPredictiveSearchStatus != 0) {
- logsPredictiveSearchStatus = enabled ? 1 : 2;
- return 0;
- } else {
- return -1;
- }
-}
--- a/logsui/logsengine/tsrc/symbianos_stub/logsdbconnector_stub_helper.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/symbianos_stub/logsdbconnector_stub_helper.h Fri Sep 03 14:26:05 2010 +0300
@@ -24,5 +24,4 @@
public:
static void reset();
static QString lastCalledFunction();
- static void setPredictiveSearch(int);
};
--- a/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logscommondata.h Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logscommondata.h Fri Sep 03 14:26:05 2010 +0300
@@ -46,6 +46,9 @@
void testGetContactManager();
void testFreeCommonData();
void testCurrentConfiguration();
+ void testClearMissedCallsCounter();
+ void testPredictiveSearchStatus();
+ void testSetPredictiveSearch();
private:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/install/ut_logsengine.pkg Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,37 @@
+;
+; 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:
+;
+; A package file for creating an installation file for Logs
+; which updates Logs binaries from ROM (eclipsing)
+
+; Supported languages
+&EN
+
+; Header
+#{"ut_logsengine"},(0xEfa329b2),1,0,0
+
+; Localised Vendor name
+%{"Symbian"}
+
+; Unique Vendor name
+:"Symbian"
+
+
+; -----------------------------------------------------------------------------------
+
+; Backup registration and restore
+"\epoc32\release\armv5\urel\ut_logsengine.exe"-"!:\sys\bin\ut_logsengine.exe"
+"\epoc32\data\z\resource\apps\ut_logsengine.rsc"-"!:\resource\apps\ut_logsengine.rsc"
+"\epoc32\data\z\private\10003a3f\import\apps\ut_logsengine_reg.rsc"-"!:\private\10003a3f\import\apps\ut_logsengine_reg.rsc"
--- a/logsui/logsengine/tsrc/ut_logsengine/src/main.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/main.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -32,125 +32,69 @@
#include "ut_logscommondata.h"
#include "ut_logsconfigurationparams.h"
#include "ut_logsduplicatelookup.h"
-#include "testresultxmlparser.h"
+#include "testrunner.h"
int main(int argc, char *argv[])
{
- bool promptOnExit(true);
- for (int i=0; i<argc; i++) {
- if (QString(argv[i]) == "-noprompt")
- promptOnExit = false;
+ printf("Running tests...\n");
+
+ QApplication app(argc, argv);
+ QStringList args = app.arguments();
+ QString combinedOutputFileName;
+ for ( int i = 0; i < args.count(); i++ ){
+ QString arg = args.at(i);
+ if ( arg == QString("-o") && i + 1 < args.count() ){
+ i++;
+ combinedOutputFileName = args.at(i);
+ }
}
- printf("Running tests...\n");
-
- QApplication app(argc, argv);
- TestResultXmlParser parser;
+ TestRunner testRunner("LogsEngine", combinedOutputFileName);
UT_LogsModel ut_logsModel;
- QString resultFileName = "c:/ut_logs_logsModel.xml";
- QStringList args_logsModel( "ut_logsModel");
- args_logsModel << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsModel, args_logsModel);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsModel);
UT_LogsDetailsModel ut_logsDetailsModel;
- resultFileName = "c:/ut_logs_logsDetailsModel.xml";
- QStringList args_logsDetailsModel( "ut_logsDetailsModel");
- args_logsDetailsModel << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsDetailsModel, args_logsDetailsModel);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsDetailsModel);
UT_LogsMatchesModel ut_logsMatchesModel;
- resultFileName = "c:/ut_logs_logsMatchesModel.xml";
- QStringList args_logsMatchesModel( "ut_logsMatchesModel");
- args_logsMatchesModel << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsMatchesModel, args_logsMatchesModel);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsMatchesModel);
UT_LogsThumbnailManager ut_logsThumbnailManager;
- resultFileName = "c:/ut_logs_logsThumbnailManager.xml";
- QStringList args_logsThumbnailManager( "ut_logsThumbnailManager");
- args_logsThumbnailManager << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsThumbnailManager, args_logsThumbnailManager);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsThumbnailManager);
UT_LogsFilter ut_logsFilter;
- resultFileName = "c:/ut_logs_logsFilter.xml";
- QStringList args_logsFilter( "ut_logsFilter");
- args_logsFilter << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsFilter, args_logsFilter);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsFilter);
UT_LogsCustomFilter ut_logsCustomFilter;
- resultFileName = "c:/ut_logs_logsCustomFilter.xml";
- QStringList args_logsCustomFilter( "ut_logsCustomFilter");
- args_logsCustomFilter << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsCustomFilter, args_logsCustomFilter);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsCustomFilter);
UT_LogsCall ut_logscall;
- resultFileName = "c:/ut_logs_logsCall.xml";
- QStringList args_logsCall( "ut_logsCall");
- args_logsCall << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logscall, args_logsCall);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logscall);
UT_LogsContact ut_logsContact;
- resultFileName = "c:/ut_logs_logsContact.xml";
- QStringList args_logsContact( "ut_logsContact");
- args_logsContact << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsContact, args_logsContact);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsContact);
UT_LogsMessage ut_logsMessage;
- resultFileName = "c:/ut_logs_logsMessage.xml";
- QStringList args_logsMessage( "ut_logsMessage");
- args_logsMessage << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsMessage, args_logsMessage);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsMessage);
UT_LogsEvent ut_logsEvent;
- resultFileName = "c:/ut_logs_logsEvent.xml";
- QStringList args_logsEvent( "ut_logsEvent");
- args_logsEvent << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsEvent, args_logsEvent);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsEvent);
UT_LogsEventData ut_logsEventdata;
- resultFileName = "c:/ut_logs_logsEventData.xml";
- QStringList args_logsEventData( "ut_logsEventData");
- args_logsEventData << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsEventdata, args_logsEventData);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsEventdata);
UT_LogsCommonData ut_logsCommonData;
- resultFileName = "c:/ut_logs_logsCommonData.xml";
- QStringList args_logsCommonData( "ut_logsCommonData");
- args_logsCommonData << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsCommonData, args_logsCommonData);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsCommonData);
UT_LogsConfigurationParams ut_logsConfigurationParams;
- resultFileName = "c:/ut_logs_logsConfigurationParams.xml";
- QStringList args_logsConfigurationParams( "ut_logsConfigurationParams");
- args_logsConfigurationParams << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsConfigurationParams, args_logsConfigurationParams);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsConfigurationParams);
UT_LogsDuplicateLookup ut_logsLookup;
- resultFileName = "c:/ut_logs_logsDuplicateLookup.xml";
- QStringList args_logsDuplicateLookup( "ut_logsDuplicateLookup");
- args_logsDuplicateLookup << "-xml" << "-o" << resultFileName;
- QTest::qExec(&ut_logsLookup, args_logsDuplicateLookup);
- parser.parseAndPrintResults(resultFileName,true);
+ testRunner.runTests(ut_logsLookup);
-
-
- if (promptOnExit) {
- printf("Press any key...\n");
- getchar();
- }
+ testRunner.printResults();
+
return 0;
}
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscommondata.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscommondata.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -17,6 +17,7 @@
#include "ut_logscommondata.h"
#include "logscommondata.h"
#include "logsconfigurationparams.h"
+#include <xqsettingsmanager.h>
#include <QtTest/QtTest>
@@ -66,3 +67,73 @@
QVERIFY( test.listItemTextWidth() == 400 );
QVERIFY( test.localeChanged() );
}
+
+
+void UT_LogsCommonData::testClearMissedCallsCounter()
+{
+ // Value is changed
+// LogsCommonData::freeCommonData();
+ XQSettingsManager::mFailed = false;
+ XQSettingsManager::mCurrentVal = 5;
+ QVERIFY( LogsCommonData::getInstance().clearMissedCallsCounter() == 0 );
+ QVERIFY( XQSettingsManager::mCurrentVal == 0 );
+
+ // No need to change value as it is already zero
+ QVERIFY( LogsCommonData::getInstance().clearMissedCallsCounter() == 0 );
+ QVERIFY( XQSettingsManager::mCurrentVal == 0 );
+
+ // Fails with some error
+ XQSettingsManager::mFailed = true;
+ XQSettingsManager::mCurrentVal = 5;
+ QVERIFY( LogsCommonData::getInstance().clearMissedCallsCounter() != 0 );
+ QVERIFY( XQSettingsManager::mCurrentVal == 5 );
+}
+
+void UT_LogsCommonData::testPredictiveSearchStatus()
+{
+
+ // Predictive search fetching failed
+ LogsCommonData::freeCommonData();
+ XQSettingsManager::mFailed = true;
+ XQSettingsManager::mCurrentVal = 1;
+ QVERIFY( LogsCommonData::getInstance().mPredictiveSearchStatus == -1 );
+ QVERIFY( LogsCommonData::getInstance().predictiveSearchStatus() == -1 );
+ QVERIFY( LogsCommonData::getInstance().mPredictiveSearchStatus == -1 );
+
+ // Predictive search value asked from settings manager
+ XQSettingsManager::mFailed = false;
+ QVERIFY( LogsCommonData::getInstance().predictiveSearchStatus() == 1 );
+ QVERIFY( LogsCommonData::getInstance().mPredictiveSearchStatus == 1 );
+
+ // Predictive search asked again, local value returned
+ XQSettingsManager::mCurrentVal = 2;
+ QVERIFY( LogsCommonData::getInstance().predictiveSearchStatus() == 1 );
+ QVERIFY( LogsCommonData::getInstance().mPredictiveSearchStatus == 1 );
+}
+
+void UT_LogsCommonData::testSetPredictiveSearch()
+{
+ // Value change is not allowed
+ LogsCommonData::getInstance().mPredictiveSearchStatus = 0;
+ QVERIFY( LogsCommonData::getInstance().setPredictiveSearch(true) == -1 );
+ QVERIFY( LogsCommonData::getInstance().mPredictiveSearchStatus == 0 );
+
+ // Value changed, setting predictive search On
+ LogsCommonData::getInstance().mPredictiveSearchStatus = 2;
+ QVERIFY( LogsCommonData::getInstance().setPredictiveSearch(true) == 0 );
+ QVERIFY( LogsCommonData::getInstance().mPredictiveSearchStatus == 1 );
+ QVERIFY( XQSettingsManager::mCurrentVal == 1 );
+
+ // Value changed, setting predictive search Off
+ LogsCommonData::getInstance().mPredictiveSearchStatus = 1;
+ QVERIFY( LogsCommonData::getInstance().setPredictiveSearch(false) == 0 );
+ QVERIFY( LogsCommonData::getInstance().mPredictiveSearchStatus == 2 );
+ QVERIFY( XQSettingsManager::mCurrentVal == 2 );
+
+ // Fails with some error
+ XQSettingsManager::mFailed = true;
+ QVERIFY( LogsCommonData::getInstance().setPredictiveSearch(true) == -1 );
+ QVERIFY( LogsCommonData::getInstance().mPredictiveSearchStatus == 2 );
+ QVERIFY( XQSettingsManager::mCurrentVal == 2 );
+}
+
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscontact.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscontact.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -30,6 +30,8 @@
const char logsIContactsView[] = "com.nokia.symbian.IContactsView";
const char logsIContactsEdit[] = "com.nokia.symbian.IContactsEdit";
+const int groupId = 99;
+
void UT_LogsContact::initTestCase()
{
@@ -90,6 +92,16 @@
QVERIFY( mLogsEvent->logsEventData()->contactLocalId() );
QVERIFY( mLogsContact->allowedRequestType() == LogsContact::TypeLogsContactOpen );
+ //group is in phonebook => open is allowed
+ mLogsEvent->logsEventData()->setContactLocalId(groupId);
+ QtContactsStubsHelper::setContactId(groupId);
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( mLogsEvent->logsEventData()->contactLocalId() );
+ QVERIFY( mLogsContact->allowedRequestType() == LogsContact::TypeLogsContactOpenGroup );
+
+
//contact not in phonebook, but caller ID present => save allowed
QtContactsStubsHelper::reset();
delete mLogsContact;
@@ -122,7 +134,7 @@
== logsIContactsView );
QVERIFY( mLogsContact->mAiwRequest->operation() == "openContactCard(int)" );
QVERIFY( QtHighwayStubHelper::isRequestEmbedded() );
- QVERIFY( !QtHighwayStubHelper::isRequestSynchronous() );
+ QVERIFY( !QtHighwayStubHelper::isRequestSynchronous() );
// Same but without using logsevent at construction
QtHighwayStubHelper::reset();
@@ -136,6 +148,22 @@
QVERIFY( QtHighwayStubHelper::isRequestEmbedded() );
QVERIFY( !QtHighwayStubHelper::isRequestSynchronous() );
+ //group is in phonebook, open is ok
+ QtHighwayStubHelper::reset();
+ mLogsEvent->logsEventData()->setContactLocalId(groupId);
+ QtContactsStubsHelper::setContactId(groupId);
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( mLogsContact->open() );
+ QVERIFY( mLogsContact->mAiwRequest );
+ QVERIFY( mLogsContact->mCurrentRequest == LogsContact::TypeLogsContactOpenGroup );
+ QVERIFY( mLogsContact->mAiwRequest->descriptor().interfaceName()
+ == logsIContactsView );
+ QVERIFY( mLogsContact->mAiwRequest->operation() == "openGroup(int)" );
+ QVERIFY( QtHighwayStubHelper::isRequestEmbedded() );
+ QVERIFY( !QtHighwayStubHelper::isRequestSynchronous() );
+
// Request sending failed
QtHighwayStubHelper::reset();
QtHighwayStubHelper::setFailCreateAiwRequest(true);
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsevent.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsevent.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -133,37 +133,62 @@
void UT_LogsEvent::testUpdateRemotePartyFromContacts()
{
// No search term
+ unsigned int testContactId = 99;
+ unsigned int testNoContactId = 0;
+ QtContactsStubsHelper::setContactId( testContactId );
QContactManager manager;
LogsEvent event;
- QVERIFY( event.updateRemotePartyFromContacts(manager).length() == 0 );
+ QString remoteParty;
+ QVERIFY( !event.updateRemotePartyFromContacts(manager, remoteParty) );
+ QVERIFY( remoteParty.isEmpty() );
QVERIFY( event.remoteParty().length() == 0 );
+ QCOMPARE( event.contactLocalId(), testNoContactId );
// Number as search term, no match
event.setNumber("12345");
- QVERIFY( event.updateRemotePartyFromContacts(manager).length() == 0 );
+ QVERIFY( !event.updateRemotePartyFromContacts(manager, remoteParty) );
+ QVERIFY( remoteParty.isEmpty() );
QVERIFY( event.remoteParty().length() == 0 );
+ QCOMPARE( event.contactLocalId(), testNoContactId );
// Number as search term, match
QtContactsStubsHelper::setContactNames("first", "last");
event.setNumber("11112222");
- QString newRemoteParty = event.updateRemotePartyFromContacts(manager);
- QVERIFY( newRemoteParty.length() > 0 );
+ QString newRemoteParty;
+ QVERIFY( event.updateRemotePartyFromContacts(manager, newRemoteParty) );
+ QVERIFY( !newRemoteParty.isEmpty() );
QVERIFY( newRemoteParty == event.remoteParty() );
+ QCOMPARE( event.contactLocalId(), testContactId );
+
+ // Even if contact is unnamed, contact id is stored
+ LogsEvent eventNoContactName;
+ eventNoContactName.setNumber("11112222");
+ QtContactsStubsHelper::setContactNames("", "");
+ newRemoteParty.clear();
+ QVERIFY( eventNoContactName.updateRemotePartyFromContacts(manager, newRemoteParty) );
+ QVERIFY( newRemoteParty.isEmpty() );
+ QVERIFY( newRemoteParty == eventNoContactName.remoteParty() );
+ QCOMPARE( eventNoContactName.contactLocalId(), testContactId );
// Voip address as search term, no match
+ QtContactsStubsHelper::setContactNames("first", "last");
LogsEvent event2;
LogsEventData* eventData = new LogsEventData;
eventData->mRemoteUrl = "1.2.3.4";
event2.setLogsEventData(eventData);
event2.setEventType(LogsEvent::TypeVoIPCall);
- QVERIFY( event2.updateRemotePartyFromContacts(manager).length() == 0 );
+ QVERIFY( !event2.updateRemotePartyFromContacts(manager, remoteParty) );
+ QVERIFY( remoteParty.isEmpty() );
QVERIFY( event2.remoteParty().length() == 0 );
+ QCOMPARE( event2.contactLocalId(), testNoContactId );
// Voip address as search term, match
eventData->mRemoteUrl = "11112222";
- newRemoteParty = event2.updateRemotePartyFromContacts(manager);
- QVERIFY( newRemoteParty.length() > 0 );
+ newRemoteParty.clear();
+ QVERIFY( event2.updateRemotePartyFromContacts(manager, newRemoteParty) );
+ QVERIFY( !newRemoteParty.isEmpty() );
QVERIFY( newRemoteParty == event.remoteParty() );
+ QCOMPARE( event2.contactLocalId(), testContactId );
}
void UT_LogsEvent::testParseContactName()
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmatchesmodel.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmatchesmodel.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -25,8 +25,9 @@
#include "logseventdata.h"
#include "qtcontacts_stubs_helper.h"
#include "logscntfinder.h"
-#include "logsdbconnector_stub_helper.h"
#include "hbstubs_helper.h"
+#include "logscommondata.h"
+#include <xqsettingsmanager.h>
#include <QtTest/QtTest>
@@ -61,7 +62,8 @@
{
HbStubHelper::reset();
mModel = new LogsModel();
- LogsDbConnectorStubHelper::setPredictiveSearch(1);
+ XQSettingsManager::mFailed = false;
+ XQSettingsManager::mCurrentVal = 1;
mMatchesModel = mModel->logsMatchesModel();
}
@@ -91,7 +93,8 @@
// Predictive search is off
delete mMatchesModel;
mMatchesModel = 0;
- LogsDbConnectorStubHelper::setPredictiveSearch(2);
+ LogsCommonData::getInstance().freeCommonData();
+ XQSettingsManager::mCurrentVal = 2;
mMatchesModel = mModel->logsMatchesModel();
QVERIFY( mMatchesModel );
QVERIFY( mMatchesModel->mIconManager );
@@ -100,7 +103,8 @@
// Predictive search status fetching failure=> assume that search is on
delete mMatchesModel;
mMatchesModel = 0;
- LogsDbConnectorStubHelper::setPredictiveSearch(-1);
+ LogsCommonData::getInstance().freeCommonData();
+ XQSettingsManager::mCurrentVal = -1;
mMatchesModel = mModel->logsMatchesModel();
QVERIFY( mMatchesModel );
QVERIFY( mMatchesModel->mIconManager );
@@ -109,7 +113,8 @@
// Predictive search is permanently disabled
delete mMatchesModel;
mMatchesModel = 0;
- LogsDbConnectorStubHelper::setPredictiveSearch(0);
+ XQSettingsManager::mCurrentVal = 0;
+ LogsCommonData::getInstance().freeCommonData();
mMatchesModel = mModel->logsMatchesModel();
QVERIFY( mMatchesModel );
QVERIFY( !mMatchesModel->mIconManager );
@@ -707,9 +712,9 @@
//
void UT_LogsMatchesModel::testPredictiveSearchStatus()
{
- LogsDbConnectorStubHelper::reset();
+ LogsCommonData::getInstance().freeCommonData();
+ XQSettingsManager::mCurrentVal = 0;
QVERIFY( mMatchesModel->predictiveSearchStatus() == 0 );
- QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "predictiveSearchStatus" );
}
// -----------------------------------------------------------------------------
@@ -721,10 +726,9 @@
QVERIFY( mMatchesModel->mLogsCntFinder );
QVERIFY( mMatchesModel->mIconManager );
// Predictive search is permanently off in cenrep, setting the value fails
- LogsDbConnectorStubHelper::reset();
- QVERIFY( mMatchesModel->setPredictiveSearch(false) != 0 );
- QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "setPredictiveSearch" );
-
+ LogsCommonData::getInstance().freeCommonData();
+ XQSettingsManager::mCurrentVal = 0;
+ QVERIFY( mMatchesModel->setPredictiveSearch(false) != 0 );
// Turning off is ok, search results are reset
mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern = "9";
@@ -733,7 +737,8 @@
mMatchesModel->mMatches.append(item);
mMatchesModel->mPrevSearchPattern = "123";
mMatchesModel->mCurrentSearchPattern = "567";
- LogsDbConnectorStubHelper::setPredictiveSearch(1);
+ LogsCommonData::getInstance().freeCommonData();
+ XQSettingsManager::mCurrentVal = 1;
QVERIFY( mMatchesModel->setPredictiveSearch(false) == 0 );
QVERIFY( mMatchesModel->mMatches.count() == 0 );
QVERIFY( mMatchesModel->mPrevSearchPattern.isEmpty() );
@@ -746,6 +751,5 @@
QVERIFY( mMatchesModel->mPrevSearchPattern.isEmpty() );
mMatchesModel->doSearchQuery(); // simulate async completion
QVERIFY( mMatchesModel->mPrevSearchPattern == "567" );
- QVERIFY( mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern == "567" );
-
+ QVERIFY( mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern == "567" );
}
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmodel.cpp Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmodel.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -31,6 +31,7 @@
#include <hbicon.h>
#include <QtTest/QtTest>
#include <hbfontspec.h>
+#include <xqsettingsmanager.h>
Q_DECLARE_METATYPE(LogsEvent *)
Q_DECLARE_METATYPE(LogsCall *)
@@ -522,6 +523,8 @@
void UT_LogsModel::testClearMissedCallsCounter()
{
+ XQSettingsManager::mFailed = false;
+ XQSettingsManager::mCurrentVal = 1;
QVERIFY( mModel->clearMissedCallsCounter() == 0 );
}
@@ -539,16 +542,16 @@
void UT_LogsModel::testPredictiveSearchStatus()
{
- LogsDbConnectorStubHelper::setPredictiveSearch(1);
+ LogsCommonData::getInstance().freeCommonData();
+ XQSettingsManager::mCurrentVal = 1;
QVERIFY( mModel->predictiveSearchStatus() == 1 );
- QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "predictiveSearchStatus" );
}
void UT_LogsModel::testSetPredictiveSearch()
{
- LogsDbConnectorStubHelper::setPredictiveSearch(2);
+ XQSettingsManager::mCurrentVal = 2;
QVERIFY( mModel->setPredictiveSearch(true) == 0 );
- QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "setPredictiveSearch" );
+ QVERIFY( mModel->predictiveSearchStatus() == 1 );
}
void UT_LogsModel::testUpdateConfiguration()
--- a/logsui/logsengine/tsrc/ut_logsengine/ut_logsengine.pro Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/ut_logsengine.pro Fri Sep 03 14:26:05 2010 +0300
@@ -23,13 +23,11 @@
CONFIG += hb
DEPENDPATH += .
+PREPEND_INCLUDEPATH = ../../logssymbianos/tsrc/stubs/ ../stubs
INCLUDEPATH += .
INCLUDEPATH += ../symbianos_stub
INCLUDEPATH += ../hbstubs
-INCLUDEPATH += ../stubs
-INCLUDEPATH += /epoc32/include
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-INCLUDEPATH += /epoc32/include/ecom
INCLUDEPATH += ../../inc
INCLUDEPATH += ../../logssymbianos/inc
INCLUDEPATH += ../../../inc
@@ -38,6 +36,9 @@
DEFINES += QT_NO_DEBUG_OUTPUT
# Input
+HEADERS += ../stubs/xqservicerequest.h
+HEADERS += ../stubs/xqaiwrequest.h
+
HEADERS += inc/ut_logsmodel.h
HEADERS += inc/ut_logsdetailsmodel.h
HEADERS += inc/ut_logsmatchesmodel.h
@@ -54,14 +55,14 @@
HEADERS += inc/ut_logsduplicatelookup.h
HEADERS += ../../../../recents_plat/logs_engine_api/inc/logsabstractmodel.h
HEADERS += ../../../../recents_plat/logs_engine_api/inc/logsmodel.h
+HEADERS += ../../../../recents_plat/logs_engine_api/inc/logsfilter.h
+HEADERS += ../../../../recents_plat/logs_engine_api/inc/logscustomfilter.h
+HEADERS += ../../../../recents_plat/logs_engine_api/inc/logsevent.h
HEADERS += ../../inc/logsdetailsmodel.h
HEADERS += ../../inc/logsmatchesmodel.h
-HEADERS += ../../../../recents_plat/logs_engine_api/inc/logsfilter.h
-HEADERS += ../../../../recents_plat/logs_engine_api/inc/logscustomfilter.h
HEADERS += ../../inc/logscall.h
HEADERS += ../../inc/logscontact.h
HEADERS += ../../inc/logsmessage.h
-HEADERS += ../../../../recents_plat/logs_engine_api/inc/logsevent.h
HEADERS += ../../inc/logseventdata.h
HEADERS += ../../inc/logsthumbnailmanager.h
HEADERS += ../../inc/logscommondata.h
@@ -74,6 +75,7 @@
HEADERS += ../stubs/logscntfinder.h
+
SOURCES += src/main.cpp
SOURCES += src/ut_logsmodel.cpp
SOURCES += src/ut_logsdetailsmodel.cpp
@@ -108,11 +110,12 @@
SOURCES += ../symbianos_stub/logsdbconnector_stub.cpp
SOURCES += ../symbianos_stub/logseventparser_stub.cpp
SOURCES += ../symbianos_stub/logseventdataparser_stub.cpp
-SOURCES += ../../../tsrc/qtestutils/src/testresultxmlparser.cpp
+SOURCES += ../../../tsrc/qtestutils/src/testrunner.cpp
SOURCES += ../stubs/qthighway_stub.cpp
SOURCES += ../stubs/logscntfinder_stub.cpp
SOURCES += ../../logssymbianos/tsrc/stubs/logclient_stubs.cpp
SOURCES += ../../logssymbianos/tsrc/stubs/qtcontacts_stubs.cpp
+SOURCES += ../../logssymbianos/tsrc/stubs/xqsettingsmanager_stub.cpp
symbian: {
TARGET.UID2 = 0x100039CE
--- a/logsui/tsrc/logsservicestester/logsservicestester.pro Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/tsrc/logsservicestester/logsservicestester.pro Fri Sep 03 14:26:05 2010 +0300
@@ -19,7 +19,7 @@
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
-INCLUDEPATH += ..\..\logsapp\inc
+INCLUDEPATH += ../../logsapp/inc
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
CONFIG += hb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/qtestutils/inc/testrunner.h Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* 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 TESTRUNNER_H
+#define TESTRUNNER_H
+
+#include <QXmlDefaultHandler>
+
+class QXmlStreamWriter;
+class QXmlStreamReader;
+
+class TestRunner : public QXmlDefaultHandler
+{
+public: // Constructors and destructor
+ TestRunner(const QString& name, const QString& combinedOutputFileName = QString() );
+ ~TestRunner();
+
+public: // New functions
+
+ int runTests(QObject& testObject);
+ void printResults();
+
+protected: // From QXmlContentHandler
+ bool startElement(
+ const QString& namespaceURI,
+ const QString& localName,
+ const QString& qName,
+ const QXmlAttributes& atts);
+
+ bool endElement(
+ const QString& namespaceURI,
+ const QString& localName,
+ const QString& qName);
+
+ bool characters(const QString& ch);
+
+private: // New functions
+
+ void parse(const QString& fileName);
+ void combineResults();
+ void appendToXml(QXmlStreamWriter& writer, QXmlStreamReader& reader, QString& caseName);
+
+private: // Data
+ QStringList mTestRunParams;
+ QString mHomeDir;
+ int mTestCount;
+ QStringList mErrors;
+ bool mParsingIncidentElement;
+ bool mParsingDescriptionElement;
+ bool mCurrentTestFailed;
+ QString mCurrentTestName;
+ QString mCurrentTestFile;
+ int mCurrentTestFailureLine;
+ QString mCombinedOutputFileName;
+ QStringList mResultFiles;
+};
+
+
+#endif // TESTRUNNER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/qtestutils/src/testrunner.cpp Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,217 @@
+/*
+* 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 "testrunner.h"
+#include <QtTest/QtTest>
+#include <QDir>
+#include <stdio.h>
+
+const char testCaseElement[] = "TestCase";
+const char testFunctionElement[] = "TestFunction";
+const char incidentElement[] = "Incident";
+const char descriptionElement[] = "Description";
+const char nameAttr[] = "name";
+const char typeAttr[] = "type";
+const char fileAttr[] = "file";
+const char lineAttr[] = "line";
+const char attrValueFail[] = "fail";
+
+
+TestRunner::TestRunner(const QString& name, const QString& combinedOutputFileName)
+: mTestCount(0),
+ mParsingIncidentElement(false),
+ mParsingDescriptionElement(false),
+ mCurrentTestFailed(false),
+ mCurrentTestFailureLine(0),
+ mCombinedOutputFileName(combinedOutputFileName)
+{
+ mTestRunParams.append(name);
+ mTestRunParams.append("-xml");
+ mTestRunParams.append("-o");
+ mHomeDir = QDir::homePath();
+ mTestRunParams.append(QString()); // Initial result file name
+
+ if (!mHomeDir.endsWith(QString::fromAscii("/")))
+ mHomeDir += QString::fromAscii("/");
+}
+
+TestRunner::~TestRunner()
+{
+}
+
+int TestRunner::runTests(QObject& testObject)
+{
+ QString className(testObject.metaObject()->className());
+ printf("Running tests for %s ... ", className.toUtf8().data());
+ QString resultFileName = mHomeDir + className + ".xml";
+ mTestRunParams.replace(mTestRunParams.count()-1,resultFileName);
+ int errorsBefore = mErrors.count();
+ int error = QTest::qExec(&testObject, mTestRunParams);
+ parse(resultFileName);
+ mResultFiles.append(resultFileName);
+ printf("Failures: %d\n",mErrors.count()-errorsBefore);
+ fflush(stdout);
+ return error;
+}
+
+void TestRunner::printResults()
+{
+ printf("\nTests executed: %d\n",mTestCount);
+ if (mErrors.count() > 0) {
+ printf("Failures (%d):\n", mErrors.count());
+ foreach(QString error, mErrors) {
+ printf("\n%s", error.toUtf8().data());
+ }
+ printf("\n");
+ } else {
+ printf("All passed.\n\n");
+ }
+ fflush(stdout);
+
+ combineResults();
+}
+
+void TestRunner::parse(const QString& fileName)
+{
+ QFile file(fileName);
+ QXmlInputSource inputSource(&file);
+ QXmlSimpleReader reader;
+ reader.setContentHandler(this);
+ reader.parse(inputSource);
+}
+
+bool TestRunner::startElement(
+ const QString& /*namespaceURI*/,
+ const QString& /*localName*/,
+ const QString& qName,
+ const QXmlAttributes& atts)
+{
+ if (qName == QString::fromAscii(testFunctionElement)) {
+ mTestCount++;
+ mCurrentTestName = atts.value(QString::fromAscii(nameAttr));
+ return true;
+ }
+ if (qName == QString::fromAscii(incidentElement)) {
+ mParsingIncidentElement = true;
+ if (atts.value(QString::fromAscii(typeAttr)) == QString::fromAscii(attrValueFail)) {
+ mCurrentTestFailed = true;
+ mCurrentTestFile = atts.value(QString::fromAscii(fileAttr));
+ mCurrentTestFailureLine = atts.value(QString::fromAscii(lineAttr)).toInt();
+ }
+ return true;
+ }
+ mParsingDescriptionElement =
+ (qName == QString::fromAscii(descriptionElement));
+ return true;
+}
+
+bool TestRunner::endElement(
+ const QString& /*namespaceURI*/,
+ const QString& /*localName*/,
+ const QString& qName)
+{
+ if (qName == QString::fromAscii(incidentElement)) {
+ mParsingIncidentElement = false;
+ mCurrentTestFailed = false;
+ return true;
+ }
+ if (qName == QString::fromAscii(descriptionElement)) {
+ mParsingDescriptionElement = false;
+ }
+ return true;
+}
+
+bool TestRunner::characters(const QString& ch)
+{
+ if (mParsingIncidentElement &&
+ mParsingDescriptionElement &&
+ mCurrentTestFailed) {
+ QByteArray testResult = mCurrentTestName.toAscii() + " failed:\n";
+ testResult += "File: ";
+ testResult += mCurrentTestFile.toAscii();
+ testResult += "\n";
+ testResult += "Line: ";
+ testResult += QByteArray::number(mCurrentTestFailureLine);
+ testResult += "\n";
+ testResult += "Reason: ";
+ testResult += ch.toAscii();
+ testResult += "\n";
+ mErrors.append(QString::fromAscii(testResult.data()));
+ }
+ return true;
+}
+
+void TestRunner::combineResults()
+{
+ if ( mCombinedOutputFileName.isEmpty() ){
+ return;
+ }
+ if ( !mCombinedOutputFileName.contains(QString::fromAscii("/")) ){
+ mCombinedOutputFileName.prepend( mHomeDir );
+ }
+ QFile file(mCombinedOutputFileName);
+ if (!file.open(QIODevice::WriteOnly)){
+ return;
+ }
+
+ QXmlStreamWriter writer(&file);
+ writer.setAutoFormatting(true);
+ writer.writeStartDocument();
+ QString caseName;
+ foreach ( QString resultFile, mResultFiles ){
+ QFile readFile( resultFile );
+ if ( resultFile != mCombinedOutputFileName && readFile.open(QIODevice::ReadOnly) ){
+ QXmlStreamReader reader(&readFile);
+ appendToXml(writer, reader, caseName);
+ readFile.close();
+ }
+ }
+ writer.writeEndDocument();
+ file.close();
+}
+
+void TestRunner::appendToXml(QXmlStreamWriter& writer, QXmlStreamReader& reader, QString& caseName)
+{
+ while (!reader.atEnd()) {
+ QXmlStreamReader::TokenType type = reader.readNext();
+ if ( type == QXmlStreamReader::StartDocument ||
+ type == QXmlStreamReader::EndDocument ){
+ // Ignored
+ } else if ( reader.name() == testCaseElement ){
+ if ( type == QXmlStreamReader::StartElement ){
+ QString tempCaseName = reader.attributes().value(nameAttr).toString();
+ if ( caseName.isEmpty() && type == QXmlStreamReader::StartElement){
+ writer.writeStartElement(testCaseElement);
+ writer.writeAttribute(nameAttr, mTestRunParams.at(0));
+ }
+ caseName = tempCaseName;
+ }
+ } else if ( type == QXmlStreamReader::StartElement ) {
+ if ( reader.name() == testFunctionElement ){
+ QString tempFuncName = reader.attributes().value(nameAttr).toString();
+ if ( !tempFuncName.isEmpty() ){
+ writer.writeStartElement(testFunctionElement);
+ writer.writeAttribute(nameAttr, caseName + "::" + tempFuncName);
+ }
+ } else {
+ writer.writeCurrentToken( reader );
+ }
+ } else {
+ writer.writeCurrentToken( reader );
+ }
+ }
+}
--- a/logsui/tsrc/unittestrunner/unittest_qt_config.txt Mon Aug 23 18:14:51 2010 +0300
+++ b/logsui/tsrc/unittestrunner/unittest_qt_config.txt Fri Sep 03 14:26:05 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_logsRemoveStates.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
+ut_logsengine -noprompt -o C:/ut_logsengine_all.xml,ut_logsengine_all.xml
+ut_logssymbianos -noprompt -o C:/ut_logssymbianos_all.xml,ut_logssymbianos_all.xml
+ut_logscntfinder -noprompt -o C:/ut_logscntfinder_all.xml,ut_logscntfinder_all.xml
+ut_logsapp -noprompt -o C:/ut_logsapp_all.xml,ut_logsapp_all.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0" xmlns:qt="http://www.nokia.com/qt">
+ <package id="recents" name="Recent Events" levels="engine support ui api">
+ <collection id="recents_plat" name="Recent Events Platform Interfaces" level="api">
+ <component id="logs_services_api" name="Logs Services API" class="api" filter="s60" introduced="^4">
+ <unit base="recents_plat/logs_services_api"/>
+ </component>
+ <component id="logs_engine_api" name="Logs Engine API" class="api" filter="s60" introduced="^4">
+ <unit base="recents_plat/logs_engine_api"/>
+ </component>
+ <component id="logs_timers_api" name="Logs Timers API" class="api" filter="s60">
+ <unit base="recents_plat/logs_timers_api"/>
+ </component>
+ <component id="logs_engine_api_extensions" name="Logs Engine API Extensions" class="api" filter="s60">
+ <unit base="recents_plat/logs_engine_api_extensions"/>
+ </component>
+ </collection>
+ <collection id="logsui" name="Logs UI" level="ui">
+ <!-- split into actual components -->
+ <component id="logsservices" filter="s60" name="Logs Services" introduced="^4">
+ <!-- <unit bldFile="logsui/logsservices" qt:proFile="logsui.pro"/> -->
+ </component>
+ <component id="logscntfinder" filter="s60" name="Logs Contact finder">
+ <!--<unit bldFile="logsui/logscntfinder" qt:proFile="logscntfinder.pro"/> -->
+ </component>
+ <component id="logsengine" filter="s60" name="Logs Engine" introduced="^4">
+ <!--<unit bldFile="logsui/logsengine" qt:proFile="logsengine.pro"/> -->
+ </component>
+ <component id="logsapp" filter="s60" name="Logs Application">
+ <!--<unit bldFile="logsui/logsapp" qt:proFile="logsapp.pro"/> -->
+ </component>
+ <component id="logsui_build" filter="s60" name="Logs UI Build">
+ <unit bldFile="logsui" qt:proFile="logsui.pro"/>
+ </component>
+ </collection>
+ </package>
+</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,1 @@
+<PackageMap root="sf" layer="app"/>
--- a/recents_plat/logs_engine_api/inc/logsevent.h Mon Aug 23 18:14:51 2010 +0300
+++ b/recents_plat/logs_engine_api/inc/logsevent.h Fri Sep 03 14:26:05 2010 +0300
@@ -239,8 +239,9 @@
/**
* Set remote party name for the event.
+ * @param contactMatch, use true if remoteparty is set by contact matching
*/
- void setRemoteParty( const QString& remoteParty );
+ void setRemoteParty( const QString& remoteParty, bool contactMatch = false );
/**
* Set indication of result of searching matching
@@ -274,9 +275,11 @@
* Search matching contact from contacts and update
* event with possible match.
* @param manager
- * @return name of matched contact, zero length string if no match found.
+ * @param contactNameStr, on return updated contact name
+ * @return true if found matching contact, otherwise false
*/
- QString updateRemotePartyFromContacts(QContactManager& manager);
+ bool updateRemotePartyFromContacts(
+ QContactManager& manager, QString& contactNameStr);
/**
* Prepares the event for contact matching.
--- a/sysdef_1_5_0.dtd Mon Aug 23 18:14:51 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
- <!ELEMENT SystemDefinition (systemModel?, build?)>
- <!ATTLIST SystemDefinition
- name CDATA #REQUIRED
- schema CDATA #REQUIRED>
- <!ELEMENT systemModel (layer+)>
- <!ELEMENT layer (logicalset* | module*)*>
- <!ATTLIST layer
- name CDATA #REQUIRED
- levels CDATA #IMPLIED
- span CDATA #IMPLIED>
- <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalset name CDATA #REQUIRED>
- <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalsubset name CDATA #REQUIRED>
- <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
- <!ATTLIST module
- name CDATA #REQUIRED
- level CDATA #IMPLIED>
- <!ELEMENT component (unit* | package* | prebuilt*)*>
- <!ATTLIST component name CDATA #REQUIRED>
- <!ELEMENT unit EMPTY>
- <!ATTLIST unit
- unitID ID #REQUIRED
- name CDATA #REQUIRED
- mrp CDATA #REQUIRED
- filter CDATA #IMPLIED
- bldFile CDATA #REQUIRED
- priority CDATA #IMPLIED
- contract CDATA #IMPLIED
- proFile CDATA #IMPLIED>
- <!ELEMENT package EMPTY>
- <!ATTLIST package
- name CDATA #REQUIRED
- mrp CDATA #REQUIRED
- filter CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT prebuilt EMPTY>
- <!ATTLIST prebuilt
- name CDATA #REQUIRED
- version CDATA #REQUIRED
- late (Y|N) #IMPLIED
- filter CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
- <!ELEMENT unitList (unitRef+)>
- <!ATTLIST unitList
- name ID #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT unitRef EMPTY>
- <!ATTLIST unitRef unit IDREF #REQUIRED>
- <!ELEMENT targetList EMPTY>
- <!ATTLIST targetList
- name ID #REQUIRED
- description CDATA #REQUIRED
- target IDREFS #REQUIRED>
- <!ELEMENT target EMPTY>
- <!ATTLIST target
- name ID #REQUIRED
- abldTarget CDATA #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT option EMPTY>
- <!ATTLIST option
- name ID #REQUIRED
- abldOption CDATA #REQUIRED
- description CDATA #REQUIRED
- enable (Y | N | y | n) #REQUIRED>
- <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
- <!ATTLIST configuration
- name ID #REQUIRED
- description CDATA #REQUIRED
- filter CDATA #REQUIRED>
- <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
- <!ELEMENT unitListRef EMPTY>
- <!ATTLIST unitListRef unitList IDREF #REQUIRED>
- <!ELEMENT layerRef EMPTY>
- <!ATTLIST layerRef layerName CDATA #REQUIRED>
- <!ELEMENT buildLayer EMPTY>
- <!ATTLIST buildLayer
- command CDATA #REQUIRED
- targetList IDREFS #IMPLIED
- unitParallel (Y | N | y | n) #REQUIRED
- targetParallel (Y | N | y | n) #IMPLIED>
- <!ELEMENT specialInstructions EMPTY>
- <!ATTLIST specialInstructions
- name CDATA #REQUIRED
- cwd CDATA #REQUIRED
- command CDATA #REQUIRED>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_5_1.dtd Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,88 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+ name CDATA #REQUIRED
+ levels CDATA #IMPLIED
+ span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+ name CDATA #REQUIRED
+ level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+ unitID ID #REQUIRED
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ bldFile CDATA #REQUIRED
+ priority CDATA #IMPLIED
+ contract CDATA #IMPLIED
+ proFile CDATA #IMPLIED
+ qmakeArgs CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+ name CDATA #REQUIRED
+ version CDATA #REQUIRED
+ late (Y|N) #IMPLIED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+ name ID #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+ name ID #REQUIRED
+ abldTarget CDATA #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+ name ID #REQUIRED
+ abldOption CDATA #REQUIRED
+ description CDATA #REQUIRED
+ enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+ command CDATA #REQUIRED
+ targetList IDREFS #IMPLIED
+ unitParallel (Y | N | y | n) #REQUIRED
+ targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+ name CDATA #REQUIRED
+ cwd CDATA #REQUIRED
+ command CDATA #REQUIRED>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/tsrc.pro Fri Sep 03 14:26:05 2010 +0300
@@ -0,0 +1,26 @@
+#
+# 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:
+#
+#
+
+TEMPLATE = subdirs
+CONFIG += ordered
+
+SUBDIRS += \
+ ./../logsui/logsengine/tsrc/ut_logsengine \
+ ./../logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos \
+ ./../logsui/logscntfinder/tsrc/ut_logscntfinder \
+ ./../logsui/logsapp/tsrc/ut_logsapp
+