--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_0.dtd" [
+ <!ENTITY layer_real_source_path "sf/app/recents" >
+]>
+
+<SystemDefinition name="recents" schema="1.5.0">
+ <systemModel>
+ <layer name="app_layer">
+
+ <module name="recents">
+ <unit unitID="recents" bldFile="&layer_real_source_path;" name="recents" mrp="" proFile="recents.pro"/>
+ </module>
+
+ </layer>
+
+
+ </systemModel>
+</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/bwins/logscntfinderu.def Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,18 @@
+EXPORTS
+ ?resultsCount@LogsCntFinder@@QBEHXZ @ 1 NONAME ; int LogsCntFinder::resultsCount(void) const
+ ?getEntry@LogsCntFinder@@QBEPAVLogsCntEntry@@ABVQObject@@@Z @ 2 NONAME ; class LogsCntEntry * LogsCntFinder::getEntry(class QObject const &) const
+ ?deleteEntry@LogsCntFinder@@QAEXABVQObject@@@Z @ 3 NONAME ; void LogsCntFinder::deleteEntry(class QObject const &)
+ ?contactId@LogsCntEntry@@QBEIXZ @ 4 NONAME ; unsigned int LogsCntEntry::contactId(void) const
+ ?type@LogsCntEntry@@QBE?AW4EntryType@1@XZ @ 5 NONAME ; enum LogsCntEntry::EntryType LogsCntEntry::type(void) const
+ ?setFirstName@LogsCntEntry@@QAEXABVQString@@@Z @ 6 NONAME ; void LogsCntEntry::setFirstName(class QString const &)
+ ??0LogsCntEntry@@QAE@AAVQObject@@I@Z @ 7 NONAME ; LogsCntEntry::LogsCntEntry(class QObject &, unsigned int)
+ ?resultAt@LogsCntFinder@@QAEABVLogsCntEntry@@H@Z @ 8 NONAME ; class LogsCntEntry const & LogsCntFinder::resultAt(int)
+ ?predictiveSearchQuery@LogsCntFinder@@QAEXABVQString@@@Z @ 9 NONAME ; void LogsCntFinder::predictiveSearchQuery(class QString const &)
+ ?lastName@LogsCntEntry@@QBEABV?$QList@VLogsCntText@@@@XZ @ 10 NONAME ; class QList<class LogsCntText> const & LogsCntEntry::lastName(void) const
+ ?handle@LogsCntEntry@@QBEPAVQObject@@XZ @ 11 NONAME ; class QObject * LogsCntEntry::handle(void) const
+ ??1LogsCntFinder@@UAE@XZ @ 12 NONAME ; LogsCntFinder::~LogsCntFinder(void)
+ ?firstName@LogsCntEntry@@QBEABV?$QList@VLogsCntText@@@@XZ @ 13 NONAME ; class QList<class LogsCntText> const & LogsCntEntry::firstName(void) const
+ ?setLastName@LogsCntEntry@@QAEXABVQString@@@Z @ 14 NONAME ; void LogsCntEntry::setLastName(class QString const &)
+ ??0LogsCntFinder@@QAE@XZ @ 15 NONAME ; LogsCntFinder::LogsCntFinder(void)
+ ?insertEntry@LogsCntFinder@@QAEXHPAVLogsCntEntry@@@Z @ 16 NONAME ; void LogsCntFinder::insertEntry(int, class LogsCntEntry *)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/cenrep/backup_registration.xml Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,6 @@
+<?xml version="1.0" standalone="yes"?>
+<!-- Backup registration file for Logs Application cenrep keys -->
+<backup_registration version="1.0">
+ <proxy_data_manager sid = "0x10202BE9" />
+ <restore requires_reboot = "no"/>
+</backup_registration>
Binary file logsui/cenrep/keys_logs.xls has changed
Binary file logsui/conf/logs.confml has changed
Binary file logsui/conf/logs_101F874E.crml has changed
Binary file logsui/conf/logs_102750C6.crml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/inc/logscntfinderexport.h Tue May 04 12:39:37 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 LOGSCNTFINDEREXPORT_H
+#define LOGSCNTFINDEREXPORT_H
+
+#include <qglobal.h>
+
+#if !defined(LOGSCNTFINDER_EXPORT)
+#if defined(LOGSCNTFINDER_LIB)
+#define LOGSCNTFINDER_EXPORT Q_DECL_EXPORT
+#else
+#define LOGSCNTFINDER_EXPORT Q_DECL_IMPORT
+#endif
+#endif
+
+
+
+#endif // LOGSCNTFINDEREXPORT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/inc/logsexport.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 LOGSEXPORT_H
+#define LOGSEXPORT_H
+
+#include <qglobal.h>
+
+#if !defined(LOGSENGINE_EXPORT)
+#if defined(LOGSENGINE_LIB)
+#define LOGSENGINE_EXPORT Q_DECL_EXPORT
+#else
+#define LOGSENGINE_EXPORT Q_DECL_IMPORT
+#endif
+#endif
+
+#if !defined(LOGSSERVICES_EXPORT)
+#if defined(LOGSSERVICES_LIB)
+#define LOGSSERVICES_EXPORT Q_DECL_EXPORT
+#else
+#define LOGSSERVICES_EXPORT Q_DECL_IMPORT
+#endif
+#endif
+
+
+#endif // LOGSEXPORT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/inc/logslogger.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 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: ?Description
+*
+*/
+
+
+#ifndef LOGSLOGGER_H
+#define LOGSLOGGER_H
+
+#include <QDebug>
+
+
+// Disabled PC_lint warning for "Undefined preprocessor variable 'UNIT_TESTING'"
+//lint -e553
+#if ( !defined(_DEBUG) || defined(QT_NO_DEBUG_OUTPUT) ) // release or unit test build; no logs
+
+#define LOGS_QDEBUG( a )
+#define LOGS_QDEBUG_2( a, b)
+#define LOGS_QDEBUG_3( a, b, c)
+#define LOGS_QDEBUG_4( a, b, c, d)
+#define LOGS_QDEBUG_5( a, b, c, d, e)
+#define LOGS_QWARNING( a )
+#define LOGS_QWARNING_2( a, b )
+#define LOGS_QCRITICAL( a )
+#define LOGS_QCRITICAL_2( a, b )
+#define LOGS_QCRITICAL_3( a, b, c)
+#define LOGS_QDEBUG_EVENT( ev )
+#define LOGS_QDEBUG_EVENT_ARR( arr )
+
+#else // debug build; logs
+
+
+const char logsDebugPrefix[] = "Debug: ";
+const char logsWarningPrefix[] = "Warning: ";
+const char logsCriticalPrefix[] = "Critical: ";
+const char logsFatalPrefix[] = "Fatal: ";
+
+#include <e32debug.h> // RDebug
+#include <QFile>
+#include <QTextStream>
+#include <qapplication.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+const char logsLogFile[] = "C:/logs/logsapp/logsappdebug.txt";// Logs application log filename.
+
+
+#define LOGS_QDEBUG( a )\
+ qDebug() << a;
+
+#define LOGS_QDEBUG_2( a, b)\
+ qDebug() << a << b;
+
+#define LOGS_QDEBUG_3( a, b, c)\
+ qDebug() << a << b << c;
+
+#define LOGS_QDEBUG_4( a, b, c, d)\
+ qDebug() << a << b << c << d;
+
+#define LOGS_QDEBUG_5( a, b, c, d, e)\
+ qDebug() << a << b << c << d << e;
+
+#define LOGS_QWARNING( a )\
+ qWarning() << a;
+
+#define LOGS_QWARNING_2( a, b )\
+ qWarning() << a << b;
+
+#define LOGS_QCRITICAL( a )\
+ qCritical() << a;
+
+#define LOGS_QCRITICAL_2( a, b )\
+ qCritical() << a << b;
+
+#define LOGS_QCRITICAL_3( a, b, c)\
+ qCritical() << a << b << c;
+
+// Event logging can be disabled by commenting line below
+#define LOGS_EVENT_LOGGING_ENABLED
+
+#ifdef LOGS_EVENT_LOGGING_ENABLED
+#define LOGS_QDEBUG_EVENT( ev ) \
+ qDebug() << "Logs event index:" << ev->index() << "type:" << ev->eventType() \
+ << "dir:" << ev->direction() << "remote:" << ev->remoteParty() << "num:" << ev->number() \
+ << "inView:" << ev->isInView() << "state:" << ev->eventState();
+
+#define LOGS_QDEBUG_EVENT_ARR( arr )\
+ qDebug() << "Logs event arr:";\
+ foreach( LogsEvent* e, arr ) { \
+ LOGS_QDEBUG_EVENT( e ) }
+#else
+#define LOGS_QDEBUG_EVENT( ev )
+#define LOGS_QDEBUG_EVENT_ARR( arr )
+#endif
+
+// File logging can be disabled by commenting definition below.
+#define LOGS_FILE_LOGGING_ENABLED
+
+#if ( defined __WINSCW__ ) || ( defined __WINS__ )
+// No sense to have file logging enabled in wins
+#undef LOGS_FILE_LOGGING_ENABLED
+#endif
+
+#ifdef LOGS_FILE_LOGGING_ENABLED
+const bool logsFileLoggingEnabled = ETrue;
+#else
+const bool logsFileLoggingEnabled = EFalse;
+#endif
+
+
+#endif
+
+#endif // LOGSLOGGER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logsabstractviewmanager.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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 LOGABSTRACTVIEWMANAGER_H
+#define LOGABSTRACTVIEWMANAGER_H
+
+
+#include "logsdefs.h"
+class HbMainWindow;
+
+/**
+ * For view changing.
+ */
+class LogsAbstractViewManager
+{
+public:
+
+ /**
+ * Activate view. Previously active view is deactivated.
+ * @param viewId, id for activated view
+ * @return true if activated succesfully, otherwise false
+ */
+ virtual bool activateView(LogsAppViewId viewId) = 0;
+
+ /**
+ * Activate view by giving activation arguments. Previously active
+ * view is deactivated.
+ * @param viewId, id for activated view
+ * @param showDialer, true if view should show dialer when activated
+ * @param args, custom arguments for view
+ * @return true if activated succesfully, otherwise false
+ */
+ virtual bool activateView(LogsAppViewId viewId, bool showDialer, QVariant args) = 0;
+
+ /**
+ * Activate previous view.
+ * @return true if activated succesfully, otherwise false
+ */
+ virtual bool activatePreviousView() = 0;
+
+ /**
+ * Returns application main window
+ */
+ virtual HbMainWindow& mainWindow() = 0;
+
+ /**
+ * Exit the application.
+ */
+ virtual void exitApplication() = 0;
+
+};
+
+#endif //LOGABSTRACTVIEWMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logsbaseview.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* 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 LOGSBASEVIEW_H
+#define LOGSBASEVIEW_H
+
+#include <hbview.h>
+#include <logsservices.h>
+#include "logsdefs.h"
+
+class LogsComponentRepository;
+class LogsAbstractViewManager;
+class Dialpad;
+class LogsCall;
+class LogsMessage;
+class LogsContact;
+class LogsDetailsModel;
+class HbAbstractViewItem;
+class HbMenu;
+class QSignalMapper;
+class HbLabel;
+class HbListView;
+
+/**
+ *
+ */
+class LogsBaseView : public HbView
+{
+ Q_OBJECT
+ friend class UT_LogsBaseView;
+
+public:
+
+ virtual ~LogsBaseView();
+
+public:
+ enum LogsViewMap{
+ ViewAll,
+ ViewCalled,
+ ViewReceived,
+ ViewMissed
+ };
+
+ LogsAppViewId viewId() const;
+ virtual void activated(bool showDialer, QVariant args);
+ virtual void deactivated();
+ virtual bool isExitAllowed();
+ virtual void resetView();
+
+public slots:
+
+ virtual void handleExit();
+ void closeEmptyMenu();
+
+signals:
+
+ void exitAllowed();
+
+protected slots:
+
+ virtual void handleBackSoftkey();
+ virtual void dialpadOpened();
+ virtual void dialpadClosed();
+ virtual void dialpadEditorTextChanged();
+ virtual void updateEmptyListWidgetsVisibility();
+ virtual void updateWidgetsSizeAndLayout();
+
+ //slots bellow are used in *.docml
+ void showFilterMenu();
+ void openDialpad();
+ void openContactsApp();
+ void notSupported();
+ void changeFilter(HbAction* action);
+
+ //other slots
+ void showListItemMenu(HbAbstractViewItem* item, const QPointF& coords);
+ void initiateCallback(const QModelIndex &listIndex);
+ void initiateCall(int callType);
+ void createMessage();
+ void saveContact();
+ void updateEmptyListLabelVisibility();
+ void showCallDetails();
+ void deleteEvent();
+
+ void handleOrientationChanged();
+
+protected:
+
+ explicit LogsBaseView( LogsAppViewId viewId,
+ LogsComponentRepository& repository,
+ LogsAbstractViewManager& viewManager );
+
+ void setDialpadPosition();
+ void initFilterMenu();
+ void addActionNamesToMap();
+
+ void updateCall(const QModelIndex& listIndex);
+ void updateMessage(const QModelIndex& listIndex);
+ void updateContact(const QModelIndex& listIndex);
+ void updateDetailsModel(const QModelIndex &listIndex);
+
+ /**
+ * Sets appropriate list widget layout using listView.setLayoutName()
+ * @param ignoreDialpad if true, dialpad visiblilty won't affect layout
+ */
+ void updateListLayoutName( HbListView& list, bool ignoreDialpad = false );
+ /**
+ * Loads appropriate section from *.docml to resize list widget
+ */
+ void updateListSize();
+
+protected:
+
+ /**
+ * Initialize view widgets from the docml file. Must be called once on first
+ * view activation.
+ */
+ virtual void initView();
+
+ virtual QAbstractItemModel* model() const;
+
+ virtual void populateListItemMenu(HbMenu& menu);
+
+ /**
+ * Updates data specific to the list item, e.g. call/message/contact
+ */
+ virtual void updateListItemData(const QModelIndex& listIndex);
+
+ /*
+ * Update call button state.
+ */
+ virtual void updateCallButton();
+
+ void activateEmptyListIndicator(QAbstractItemModel* model);
+ void deactivateEmptyListIndicator(QAbstractItemModel* model);
+
+ void addViewSwitchingEffects();
+ void toggleActionAvailability( HbAction* action, bool available );
+ /*
+ *
+ */
+ bool askConfirmation( QString heading , QString text );
+
+protected:
+
+ LogsAppViewId mViewId;
+ LogsComponentRepository& mRepository;
+ LogsAbstractViewManager& mViewManager;
+ HbAction* mSoftKeyBackAction;
+
+ HbMenu* mShowFilterMenu; //not owned
+ Dialpad* mDialpad; //not owned
+ HbLabel* mEmptyListLabel; // not owned
+
+ QMap<LogsServices::LogsView, QString> mActionMap;
+
+ bool mInitialized;
+
+ LogsCall* mCall; //owned
+ LogsMessage* mMessage; //owned
+ LogsContact* mContact; //owned
+ LogsDetailsModel* mDetailsModel; //owned
+
+ QSignalMapper* mCallTypeMapper;
+ QString mLayoutSectionName;
+};
+
+
+
+
+#endif // LOGSBASEVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logscomponentrepository.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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 LOGSCOMPONENTREPOSITORY_H
+#define LOGSCOMPONENTREPOSITORY_H
+
+#include "logsdefs.h"
+#include <hbdocumentloader.h>
+
+class LogsRecentCallsView;
+class LogsDetailsView;
+class LogsMatchesView;
+class Dialpad;
+class DialpadKeyHandler;
+class LogsAbstractViewManager;
+class LogsModel;
+
+/**
+ *
+ */
+class LogsComponentRepository : public HbDocumentLoader
+{
+ friend class UT_LogsComponentRepository;
+
+public:
+
+ explicit LogsComponentRepository(LogsAbstractViewManager& viewManager);
+ ~LogsComponentRepository();
+
+public:
+
+ LogsRecentCallsView* recentCallsView();
+ LogsDetailsView* detailsView();
+ LogsMatchesView* matchesView();
+
+ /**
+ * Returns dialpad. Must be always a valid pointer.
+ */
+ Dialpad* dialpad();
+
+ /**
+ * Returns model. Must be always a valid pointer.
+ */
+ LogsModel* model() const;
+
+ /**
+ * Sets object tree to a proper view object list
+ */
+ void setObjectTreeToView( LogsAppViewId viewId );
+
+ bool loadSection( LogsAppViewId viewId, const QString& sectionName );
+
+private:
+
+ //from HbDocumentLoader
+ QObject *createObject(const QString& type, const QString &name);
+
+ void addToolbarToObjectList( QObjectList& list );
+
+private:
+
+ LogsAbstractViewManager& mViewManager;
+ LogsRecentCallsView* mRecentCallsView;
+ LogsDetailsView* mDetailsView;
+ LogsMatchesView* mMatchesView;
+ QObjectList mRecentViewComponents;
+ QObjectList mDetailsViewComponents;
+ QObjectList mMatchesViewComponents;
+
+ Dialpad* mDialpad;
+ DialpadKeyHandler* mDialpadKeyHandler;
+ LogsModel* mModel;
+};
+
+#endif // LOGSCOMPONENTREPOSITORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logsdefs.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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 LOGSDEFS_H
+#define LOGSDEFS_H
+
+//#ifndef QT_TESTLIB_LIB
+const char logsRecentCallsViewFile[] = ":/docml/recentCallsView.docml";
+const char logsDetailsViewFile[] = ":/docml/detailsView.docml";
+const char logsMatchedCallsViewFile[] = ":/docml/matchesView.docml";
+
+//view ids
+const char logsRecentCallsViewId[] = "logs_recent_calls_view";
+const char logsDetailsViewId[] = "logs_details_view";
+const char logsMatchesViewId[] = "logs_matches_view";
+
+//widget ids
+const char logsListWidgetId[] = "logs_list_view";
+const char logsDetailsListWidgetId[] = "logs_details_list_view";
+const char logsGroupboxViewNameId[] = "logs_groupbox_recent_calls";
+const char logsGroupboxDetailViewNameId[] = "logs_groupbox_remote_party_info";
+const char logsDetailsViewMenuId[] = "logs_details_view_menu";
+const char logsShowFilterMenuId[] = "logs_show_filter_menu";
+const char logsLabelEmptyListId[] = "logs_label_empty_list";
+const char logsToolbarId[] = "logs_toolbar";
+const char logsButtonAddToContactsId[] = "logs_button_addtocontacts";
+const char logsPageIndicatorId[] = "logs_page_indicator";
+
+//action ids
+const char logsCommonVideoCallMenuActionId[] = "logs_act_video_call";
+const char logsCommonMessageMenuActionId[] = "logs_act_create_message";
+
+const char logsDetailsViewVoiceCallMenuActionId[] = "logs_act_voice_call";
+const char logsDetailsViewInternetCallMenuActionId[] = "logs_act_internet_call";
+const char logsDetailsAddToContactsMenuActionId[] = "logs_act_add_to_contacts";
+const char logsDetailsOpenContactMenuActionId[] = "logs_act_open_contact";
+const char logsRecentViewClearListMenuActionId[] = "logs_act_clear_list";
+
+const char logsShowFilterReceivedMenuActionId[] = "logs_act_received";
+const char logsShowFilterDialledMenuActionId[] = "logs_act_dialled";
+const char logsShowFilterMissedMenuActionId[] = "logs_act_missed";
+const char logsShowFilterRecentMenuActionId[] = "logs_act_recent";
+
+
+//list layout names from *.widgetml
+const char logsListDefaultLayout[] = "default";
+const char logsListLandscapeLayout[] = "logsLandscape";
+const char logsListLandscapeDialpadLayout[] = "logsLandscapeDialpad";
+
+//view layout *.docml section names
+const char logsViewDefaultSection[] = "default";
+const char logsViewPortraitDialpadSection[] = "portrait_dialpad";
+const char logsViewLandscapeDialpadSection[] = "landscape_dialpad";
+
+
+//view identifiers
+enum LogsAppViewId {
+ LogsUnknownViewId,
+ LogsRecentViewId,
+ LogsDetailsViewId,
+ LogsMatchesViewId
+};
+
+#endif // LOGSDEFS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logsdetailsview.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* 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 LOGSDETAILSVIEW_H
+#define LOGSDETAILSVIEW_H
+
+#include "logsbaseview.h"
+
+class HbListView;
+class HbGroupBox;
+class HbAction;
+class LogsComponentRepository;
+class HbAction;
+class LogsAbstractViewManager;
+
+/**
+ *
+ */
+class LogsDetailsView : public LogsBaseView
+{
+ Q_OBJECT
+ friend class UT_LogsDetailsView;
+
+public:
+ explicit LogsDetailsView( LogsComponentRepository& repository,
+ LogsAbstractViewManager& viewManager );
+ ~LogsDetailsView();
+
+public: // From LogsBaseView
+
+ virtual void activated(bool showDialer, QVariant args);
+ virtual void deactivated();
+
+public slots:
+
+ void callKeyPressed();
+
+private slots:
+
+ void initiateVoiceCall();
+ void initiateVideoCall();
+ void addToContacts();
+ void openContact();
+ void contactActionCompleted(bool modified);
+ void deleteEvent();//overrides base class implementation
+ void copyNumberToClipboard();
+
+ //from LogsBaseView
+ virtual void handleBackSoftkey();
+
+private: // from LogsBaseView
+
+ virtual void initView();
+ virtual QAbstractItemModel* model() const;
+ virtual void updateWidgetsSizeAndLayout();
+
+private:
+
+ void initListWidget();
+ void updateMenu();
+
+private:
+
+ HbGroupBox* mViewName; //not owned
+ HbListView* mListView; //not owned
+};
+
+#endif // LOGSDETAILSVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logseffecthandler.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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 LOGSEFFECTHANDLER_H
+#define LOGSEFFECTHANDLER_H
+
+#include <QObject>
+#include <QPointF>
+
+class QPropertyAnimation;
+class QEasingCurve;
+class QSequentialAnimationGroup;
+class QAbstractAnimation;
+class LogsEffectContainer;
+
+/**
+ *
+ */
+class LogsEffectHandler : public QObject
+{
+ Q_OBJECT
+ friend class UT_LogsEffectHandler;
+ friend class UT_LogsRecentCallsView;
+
+public:
+ explicit LogsEffectHandler();
+ ~LogsEffectHandler();
+
+ void startDissappearAppearByFadingEffect(QObject& effectTarget);
+ void startDissappearAppearByMovingEffect(
+ QObject& effectTarget, QObject& secondaryEffectTarget, bool dissappearToLeft, int origX);
+ void startMoveNotPossibleEffect(QObject& effectTarget, bool moveLeft, int origX);
+
+signals:
+
+ void dissappearByMovingComplete();
+ void dissappearByFadingComplete();
+
+private slots:
+
+ void moveAnimationChanged(QAbstractAnimation *currentAnimation);
+ void fadeAnimationChanged(QAbstractAnimation *currentAnimation);
+
+private:
+
+ void doStartDissappearAppearByMovingEffect(
+ QSequentialAnimationGroup& group, QObject& effectTarget,
+ bool dissappearToLeft, int origX);
+
+ void initAppearByMovingEffect(QPropertyAnimation& animation, QObject* effectTarget,
+ bool appearFromLeft, int origX);
+ void initDissappearByMovingEffect(QPropertyAnimation& animation, QObject* effectTarget,
+ bool dissappearToLeft, int origX);
+ void initOpacityEffect(
+ QPropertyAnimation& animation, QObject* effectTarget,
+ qreal startVal, qreal endVal, int duration);
+ void initMoveHorizontallyEffect(
+ QPropertyAnimation& animation, QObject* effectTarget,
+ int startVal, int endVal, int duration, const QEasingCurve& easingCurve);
+
+private:
+
+ QPropertyAnimation* mItemAppearByFadingAnimation;
+ QPropertyAnimation* mItemDissappearByFadingAnimation;
+ QPropertyAnimation* mItemMoveNotPossibleAnimationStart;
+ QPropertyAnimation* mItemMoveNotPossibleAnimationEnd;
+ QSequentialAnimationGroup* mMoveGroup;
+ QSequentialAnimationGroup* mMoveGroup2;
+ QSequentialAnimationGroup* mFadeGroup;
+ QSequentialAnimationGroup* mMoveNotPossibleGroup;
+
+};
+
+#endif // LOGSEFFECTHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logsmainwindow.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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 LOGSMAINWINDOW_H
+#define LOGSMAINWINDOW_H
+
+
+#include <QObject>
+#include <hbmainwindow.h>
+
+class LogsForegroundWatcher;
+
+
+class LogsMainWindow : public HbMainWindow
+ {
+ Q_OBJECT
+
+public:
+
+ LogsMainWindow();
+ virtual ~LogsMainWindow();
+
+ void sendAppToBackground();
+ void bringAppToForeground();
+
+ bool isForeground() const;
+
+protected: // From HbMainWindow
+
+ void keyPressEvent( QKeyEvent *event );
+
+signals:
+
+ void callKeyPressed();
+ void appFocusGained();
+ void appFocusLost();
+
+private:
+
+ LogsForegroundWatcher* mWatcher;
+ bool mForeground;
+
+ friend class UT_LogsMainWindow;
+ friend class UT_LogsServiceHandler;
+ friend class UT_LogsViewManager;
+
+ };
+
+
+#endif //LOGSMAINWINDOW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logsmatchesview.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* 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 LOGSMATCHESVIEW_H
+#define LOGSMATCHESVIEW_H
+
+#include "logsbaseview.h"
+#include "logscall.h"
+
+class HbListView;
+class HbAction;
+class HbPushButton;
+class LogsComponentRepository;
+class LogsAbstractViewManager;
+class LogsMatchesModel;
+
+/**
+ *
+ */
+class LogsMatchesView : public LogsBaseView
+{
+ Q_OBJECT
+ friend class UT_LogsMatchesView;
+
+public:
+ explicit LogsMatchesView( LogsComponentRepository& repository,
+ LogsAbstractViewManager& viewManager );
+ ~LogsMatchesView();
+
+public: // From LogsBaseView
+
+ virtual void activated(bool showDialer, QVariant args);
+ virtual void deactivated();
+
+public slots:
+
+ void callKeyPressed();
+ void saveNumberInDialpadToContacts();
+ void videoCallToCurrentNum();
+ void sendMessageToCurrentNum();
+
+protected slots: //from LogsBaseView
+
+ virtual void handleBackSoftkey();
+ virtual void dialpadEditorTextChanged();
+ virtual void dialpadOpened();
+ virtual void dialpadClosed();
+ virtual void updateWidgetsSizeAndLayout();
+ virtual void updateEmptyListWidgetsVisibility();
+
+private: //from LogsBaseView
+
+ virtual void initView();
+ virtual QAbstractItemModel* model() const;
+
+private:
+
+ void initListWidget();
+ void updateModel(LogsMatchesModel* model);
+ void updateMenu();
+ void callToCurrentNum( LogsCall::CallType callType );
+ void updateAddContactButton();
+
+private:
+
+ HbListView* mListView; //not owned
+ LogsMatchesModel* mModel; //owned
+ HbPushButton* mAddToContactsButton; // not owned
+};
+
+#endif // LOGSMATCHESVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logspageindicator.h Tue May 04 12:39:37 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 LOGSPAGEINDICATOR_H
+#define LOGSPAGEINDICATOR_H
+
+#include <hbwidget.h>
+
+
+class LogsPageIndicatorItem;
+
+
+class LogsPageIndicator: public HbWidget
+{
+ friend class UT_LogsPageIndicator;
+ Q_OBJECT
+
+public:
+
+ explicit LogsPageIndicator(QGraphicsItem *parent = 0);
+ ~LogsPageIndicator();
+
+public:
+
+ void initialize(int itemCount, int activeItemIndex);
+
+ int itemCount() const;
+
+ void setActiveItemIndex(int index);
+ int activeItemIndex() const;
+
+
+private:
+
+ void layoutItems();
+
+private:
+
+ QList<LogsPageIndicatorItem *> mItems;
+ int mActiveItemIndex;
+};
+
+#endif //LOGSPAGEINDICATOR
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logspageindicatoritem.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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 LOGSPAGEINDICATORITEM_H
+#define LOGSPAGEINDICATORITEM_H
+
+#include <hbiconitem.h>
+
+
+class LogsPageIndicatorItem : public HbIconItem
+{
+ Q_OBJECT
+ friend class UT_LogsPageIndicatorItem;
+
+public:
+
+ explicit LogsPageIndicatorItem(bool active = false, QGraphicsItem *parent = 0);
+ ~LogsPageIndicatorItem();
+
+public:
+
+ void setActive(bool active = true);
+ bool isActive() const;
+
+
+private:
+
+ void startAnimation();
+
+private slots:
+
+ void animationFinished();
+
+private:
+
+ bool mIsActive;
+};
+
+#endif // LOGSPAGEINDICATORITEM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logsrecentcallsview.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* 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 LOGSRECENTCALLSVIEW_H
+#define LOGSRECENTCALLSVIEW_H
+
+#include "logsfilter.h"
+#include "logsbaseview.h"
+#include <QGesture>
+
+class HbListView;
+class HbLabel;
+class LogsComponentRepository;
+class LogsModel;
+class HbAbstractViewItem;
+class LogsAbstractViewManager;
+class LogsEffectHandler;
+class HbGroupBox;
+class LogsMatchesModel;
+class LogsPageIndicator;
+
+
+/**
+ *
+ */
+class LogsRecentCallsView : public LogsBaseView
+{
+ Q_OBJECT
+ friend class UT_LogsRecentCallsView;
+ friend class UT_LogsViewManager;
+
+public:
+ explicit LogsRecentCallsView( LogsComponentRepository& repository,
+ LogsAbstractViewManager& viewManager );
+ ~LogsRecentCallsView();
+
+public: // From LogsBaseView
+
+ virtual void activated(bool showDialer, QVariant args);
+ virtual void deactivated();
+ virtual bool isExitAllowed();
+ virtual void resetView();
+
+public slots:
+
+ void handleExit();
+ void callKeyPressed();
+ void markingCompleted(int err);
+
+protected slots: // from LogsBaseView
+
+ virtual void handleBackSoftkey();
+ void openDialpad();
+ virtual void dialpadEditorTextChanged();
+ void changeFilter(HbAction* action);
+ virtual void updateEmptyListWidgetsVisibility();
+ virtual void updateWidgetsSizeAndLayout();
+
+
+private slots:
+
+ void clearList();
+ void updateView(LogsServices::LogsView view);
+ void leftFlick();
+ void rightFlick();
+ void dissappearByFadingComplete();
+ void dissappearByMovingComplete();
+ bool markMissedCallsSeen();
+ void scrollToTopItem();
+
+private: // from LogsBaseView
+
+ virtual void initView();
+ virtual QAbstractItemModel* model() const;
+ virtual void updateCallButton();
+
+private:
+
+ void addStringsToMap();
+ void initListWidget();
+ void updateFilter(LogsFilter::FilterType type);
+ void updateViewName();
+ void updateContextMenuItems(LogsServices::LogsView view);
+ LogsFilter::FilterType getFilter(LogsServices::LogsView view);
+ void changeView(LogsServices::LogsView view);
+ void updateMenu();
+ void handleMissedCallsMarking();
+
+ //from HbWidget
+ void gestureEvent(QGestureEvent *event);
+
+ QSwipeGesture::SwipeDirection swipeAngleToDirection(int angle, int delta);
+
+private:
+
+ HbGroupBox* mViewName; //not owned
+ HbListView* mListView;//not owned
+ LogsFilter* mFilter; //owned
+
+ QMap<LogsBaseView::LogsViewMap, QString> mTitleMap;
+ QMap<LogsServices::LogsView, LogsBaseView::LogsViewMap> mConversionMap;
+
+ LogsModel* mModel;
+
+ LogsServices::LogsView mCurrentView;
+ LogsServices::LogsView mAppearingView;
+ bool mMoveLeftInList;
+ LogsEffectHandler* mEffectHandler;
+ int mListViewX;
+ LogsMatchesModel* mMatchesModel;
+ bool mMarkingMissedAsSeen;
+ LogsPageIndicator* mPageIndicator;
+ bool mResetted;
+
+};
+
+#endif // LOGSRECENTCALLSVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logsservicehandler.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 LOGSSERVICEHANDLER_H
+#define LOGSSERVICEHANDLER_H
+
+#include <xqserviceprovider.h>
+#include <logsservices.h>
+
+class LogsMainWindow;
+
+class LogsServiceHandler : public XQServiceProvider
+ {
+ Q_OBJECT
+ public:
+ explicit LogsServiceHandler(LogsMainWindow& mainWindow);
+ ~LogsServiceHandler();
+
+ public slots:
+ int start(int activatedView, bool showDialpad);
+ int startWithNum(int activatedView, bool showDialpad, QString dialpadText);
+
+ signals:
+
+ void activateView(LogsServices::LogsView activatedView, bool showDialpad);
+ void activateView(QString dialpadText);
+
+ public:
+
+ LogsServices::LogsView currentlyActivatedView();
+ bool isStartedUsingService() const;
+
+ private:
+ int mActivatedView;
+ LogsMainWindow& mMainWindow;
+ bool mIsAppStartedUsingService;
+
+ private:
+ friend class UT_LogsServiceHandler;
+ friend class UT_LogsViewManager;
+ };
+
+#endif //LOGSSERVICEHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/inc/logsviewmanager.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* 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 LOGVIEWMANAGER_H
+#define LOGVIEWMANAGER_H
+
+
+#include <QObject>
+#include <QList>
+#include <QVariant>
+#include <logsservices.h>
+#include "logsabstractviewmanager.h"
+
+class HbMainWindow;
+class LogsComponentRepository;
+class LogsServiceHandler;
+class LogsMainWindow;
+class HbView;
+class LogsBaseView;
+
+/**
+ *
+ */
+class LogsViewManager : public QObject, public LogsAbstractViewManager
+{
+ Q_OBJECT
+
+ friend class UT_LogsViewManager;
+ friend class UT_LogsServiceHandler;
+
+public:
+
+ /**
+ * Constructor
+ * @param mainWindow
+ * @param service
+ */
+ LogsViewManager( LogsMainWindow& mainWindow, LogsServiceHandler& service );
+ ~LogsViewManager();
+
+public slots:
+
+ void changeRecentView(LogsServices::LogsView view, bool showDialpad);
+ void changeMatchesView(QString dialpadText);
+ void appFocusGained();
+ void appFocusLost();
+
+public: // From LogsAbstractViewManager
+
+ virtual bool activateView(LogsAppViewId viewId);
+ virtual bool activateView(LogsAppViewId viewId, bool showDialpad, QVariant args);
+ virtual bool activatePreviousView();
+ virtual HbMainWindow& mainWindow();
+ virtual void exitApplication();
+
+private slots:
+
+ void proceedExit();
+ void handleOrientationChanged();
+ void completeViewActivation();
+
+private:
+
+ void initViews();
+ bool doActivateView(LogsAppViewId viewId, bool showDialpad, QVariant args);
+
+private: //data
+
+ LogsMainWindow& mMainWindow;
+ LogsServiceHandler& mService;
+ LogsComponentRepository* mComponentsRepository;
+ QList<LogsBaseView*> mViewStack;
+ bool mFirstActivation;
+ QVariant mViewActivationArgs;
+ bool mViewActivationShowDialpad;
+
+};
+
+#endif //LOGVIEWMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/logsapp.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,70 @@
+#
+# 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 = app
+TARGET = logs
+CONFIG += hb
+CONFIG += service
+RESOURCES += logsapp.qrc
+TRANSLATIONS = dialer.ts
+
+INCLUDEPATH += ./
+INCLUDEPATH += ./inc
+INCLUDEPATH += ../logsengine
+INCLUDEPATH += ../logsengine/inc
+INCLUDEPATH += ../logsengine/logssymbianos/inc
+
+INCLUDEPATH += ../inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+# Input
+HEADERS += inc/logsmainwindow.h
+HEADERS += inc/logsviewmanager.h
+HEADERS += inc/logsbaseview.h
+HEADERS += inc/logsrecentcallsview.h
+HEADERS += inc/logsdetailsview.h
+HEADERS += inc/logsmatchesview.h
+HEADERS += inc/logsservicehandler.h
+HEADERS += inc/logseffecthandler.h
+HEADERS += inc/logspageindicator.h
+HEADERS += inc/logspageindicatoritem.h
+HEADERS += ../logsengine/logssymbianos/inc/logsforegroundwatcher.h
+
+SOURCES += src/main.cpp
+SOURCES += src/logsmainwindow.cpp
+SOURCES += src/logsviewmanager.cpp
+SOURCES += src/logscomponentrepository.cpp
+SOURCES += src/logsbaseview.cpp
+SOURCES += src/logsrecentcallsview.cpp
+SOURCES += src/logsdetailsview.cpp
+SOURCES += src/logsmatchesview.cpp
+SOURCES += src/logsservicehandler.cpp
+SOURCES += src/logseffecthandler.cpp
+SOURCES += src/logspageindicator.cpp
+SOURCES += src/logspageindicatoritem.cpp
+SOURCES += ../logsengine/logssymbianos/src/logsforegroundwatcher.cpp
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0x101F4CD5
+ TARGET.CAPABILITY = CAP_APPLICATION AllFiles
+ LIBS += -lxqservice -lxqserviceutil -llogsengine -ldialpad
+
+}
+
+SERVICE.FILE = service_conf.xml
+SERVICE.OPTIONS = embeddable
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/logsapp.qrc Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,16 @@
+<RCC>
+ <qresource prefix="/docml" >
+ <file alias="detailsView.docml" >resources/detailsView.docml</file>
+ <file alias="recentCallsView.docml" >resources/recentCallsView.docml</file>
+ <file alias="matchesView.docml" >resources/matchesView.docml</file>
+ </qresource>
+ <qresource prefix="/" >
+ <file alias="view_show.fxml">resources/logs_view_fade_in_scale.fxml</file>
+ <file alias="view_hide.fxml">resources/logs_view_fade_out.fxml</file>
+ <file alias="logs_default">resources/logs_default.qm</file>
+ </qresource>
+ <qresource prefix="/logslayouts" >
+ <file alias="hblistviewitem.css">resources/hblistviewitem.css</file>
+ <file alias="hblistviewitem.widgetml">resources/hblistviewitem.widgetml</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/resources/hblistviewitem.css Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,38 @@
+HbListViewItem[layoutName="logsLandscape"]{
+ layout:logs-landscape;
+}
+
+HbListViewItem[layoutName="logsLandscapeDialpad"]{
+ layout:logs-landscape;
+}
+
+HbListViewItem::text-1[layoutName="logsLandscape"]{
+ fixed-width: 40.0un;
+ text-height: var(hb-param-text-height-primary);
+}
+
+HbListViewItem::text-2[layoutName="logsLandscape"]{
+
+ fixed-width: 40.0un;
+ text-height: var(hb-param-text-height-secondary);
+}
+
+HbListViewItem::text-1[layoutName="logsLandscapeDialpad"]{
+ fixed-width: 38.0un;
+ text-height: var(hb-param-text-height-primary);
+}
+
+HbListViewItem::text-2[layoutName="logsLandscapeDialpad"]{
+ fixed-width: 0.0un;
+ text-height: 0.0un;
+}
+
+HbListViewItem::text-1[layoutName="default"]{
+ fixed-width: 40.0un;
+ text-height: var(hb-param-text-height-primary);
+}
+
+HbListViewItem::text-2[layoutName="default"]{
+ fixed-width: 40.0un;
+ text-height: var(hb-param-text-height-secondary);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/resources/hblistviewitem.widgetml Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,78 @@
+<hbwidget version="0.1" type="listviewitem">
+
+<!-- logs-landscape -->
+ <!--
+ Required items:
+ icon-1 & text-1
+
+ Items from left to right:
+ icon -1 -> text-1 -> text-2 -> icon-2 ->
+
+ Other:
+ icon-1: connected from TOP to item TOP and BOTTOM to item BOTTOM
+ icon-2: center aligned with icon-1 center
+
+ text-1: center aligned with icon-1 center
+ text-2: center aligned with icon-1 center
+ -->
+ <layout name="logs-landscape" type="mesh">
+ <meshitem src="icon-1" srcEdge="LEFT" dst="" dstEdge="LEFT" spacing="-var(hb-param-margin-gene-left)"/>
+ <meshitem src="icon-1" srcEdge="TOP" dst="" dstEdge="TOP" spacing="0.0un"/>
+ <meshitem src="icon-1" srcEdge="RIGHT" dst="text-1" dstEdge="LEFT" spacing="var(hb-param-margin-gene-middle-horizontal)" />
+ <meshitem src="icon-1" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacing="var(hb-param-margin-gene-bottom)" />
+
+ <meshitem src="text-1" srcEdge="RIGHT" dst="text-2" dstEdge="LEFT" spacing="var(hb-param-margin-gene-middle-horizontal)" />
+ <meshitem src="text-1" srcEdge="CENTERV" dst="icon-1" dstEdge="CENTERV" />
+
+ <meshitem src="text-2" srcEdge="RIGHT" dst="icon-2" dstEdge="LEFT" spacing="var(hb-param-margin-gene-middle-horizontal)"/>
+ <meshitem src="text-2" srcEdge="CENTERV" dst="icon-1" dstEdge="CENTERV" />
+
+ <meshitem src="icon-2" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing="var(hb-param-margin-gene-right)"/>
+ <meshitem src="icon-2" srcEdge="CENTERV" dst="icon-1" dstEdge="CENTERV" />
+
+ <meshitem src="background" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+ <meshitem src="background" srcEdge="TOP" dst="" dstEdge="TOP" />
+ <meshitem src="background" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+ <meshitem src="background" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+
+ <meshitem src="frame" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+ <meshitem src="frame" srcEdge="TOP" dst="" dstEdge="TOP" />
+ <meshitem src="frame" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+ <meshitem src="frame" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+ </layout>
+
+
+<!-- logs-landscape-dialpad -->
+ <!--
+ Required items:
+ icon-1 & text-1
+
+ Items from left to right:
+ icon -1 -> text-1
+
+ Other:
+ icon-1: connected from TOP to item TOP and BOTTOM to item BOTTOM
+
+ text-1: center aligned with icon-1 center
+ -->
+ <layout name="logs-landscape-dialpad" type="mesh">
+ <meshitem src="icon-1" srcEdge="LEFT" dst="" dstEdge="LEFT" spacing="-var(hb-param-margin-gene-left)"/>
+ <meshitem src="icon-1" srcEdge="TOP" dst="" dstEdge="TOP" spacing="0.0un"/>
+ <meshitem src="icon-1" srcEdge="RIGHT" dst="text-1" dstEdge="LEFT" spacing="var(hb-param-margin-gene-middle-horizontal)" />
+ <meshitem src="icon-1" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacing="var(hb-param-margin-gene-bottom)" />
+
+ <meshitem src="text-1" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing="var(hb-param-margin-gene-right)" />
+ <meshitem src="text-1" srcEdge="CENTERV" dst="icon-1" dstEdge="CENTERV" />
+
+ <meshitem src="background" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+ <meshitem src="background" srcEdge="TOP" dst="" dstEdge="TOP" />
+ <meshitem src="background" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+ <meshitem src="background" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+
+ <meshitem src="frame" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+ <meshitem src="frame" srcEdge="TOP" dst="" dstEdge="TOP" />
+ <meshitem src="frame" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+ <meshitem src="frame" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+ </layout>
+
+</hbwidget>
\ No newline at end of file
Binary file logsui/logsapp/resources/logs_default.qm has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/resources/logs_view_fade_in_scale.fxml Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,23 @@
+<layers>
+ <visual>
+ <param name="scale_x" type="anim">
+ <duration>0.4</duration>
+ <keyframe at="0.0">0.8</keyframe>
+ <keyframe at="1.0">1.0</keyframe>
+ </param>
+ <param name="scale_y" type="anim">
+ <duration>0.4</duration>
+ <keyframe at="0.0">0.8</keyframe>
+ <keyframe at="1.0">1.0</keyframe>
+ </param>
+ <param name="opacity" type="anim">
+ <duration>0.4</duration>
+ <style>linear</style>
+ <keyframe at="0.0">0.1</keyframe>
+ <keyframe at="1.0">1.0</keyframe>
+ </param>
+
+ <param name="scale_origin_x" ref="visual.width">0.5</param>
+ <param name="scale_origin_y" ref="visual.height">0.5</param>
+ </visual>
+</layers>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/resources/logs_view_fade_out.fxml Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,10 @@
+<layers>
+ <visual>
+ <param name="opacity" type="anim">
+ <duration>0.2</duration>
+ <style>linear</style>
+ <keyframe at="0.0">1.0</keyframe>
+ <keyframe at="1.0">0.0</keyframe>
+ </param>
+ </visual>
+</layers>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/service_conf.xml Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<service name="com.nokia.services.logsservices" filepath="must-not-be-empty" >
+ <description>Logs services</description>
+ <interface name="starter" version="1.0" capabilities="">
+ <description>Starter interface</description>
+ </interface>
+</service>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logsbaseview.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,909 @@
+/*
+* 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 "logsbaseview.h"
+#include "logscomponentrepository.h"
+#include "logsabstractviewmanager.h"
+#include "logsdefs.h"
+#include "logslogger.h"
+#include "logscall.h"
+#include "logsmessage.h"
+#include "logscontact.h"
+#include "logsabstractmodel.h"
+#include "logsdetailsmodel.h"
+
+//SYSTEM
+#include <hbaction.h>
+#include <hbmainwindow.h>
+#include <hbmessagebox.h>
+#include <hbtoolbar.h>
+#include <hbmenu.h>
+#include <dialpad.h>
+#include <hblineedit.h>
+#include <hbeffect.h>
+#include <hbabstractviewitem.h>
+#include <QSignalMapper>
+#include <xqservicerequest.h>
+#include <hblabel.h>
+#include <hblistview.h>
+#include <QGraphicsLinearLayout>
+#include <hbpushbutton.h>
+
+
+Q_DECLARE_METATYPE(LogsCall*)
+Q_DECLARE_METATYPE(LogsMessage*)
+Q_DECLARE_METATYPE(LogsContact*)
+Q_DECLARE_METATYPE(LogsDetailsModel*)
+
+const int contextMenuTimeout = 5000000; //5 secs
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsBaseView::LogsBaseView(
+ LogsAppViewId viewId,
+ LogsComponentRepository& repository,
+ LogsAbstractViewManager& viewManager )
+ : HbView(0),
+ mViewId( viewId ),
+ mRepository( repository ),
+ mViewManager( viewManager ),
+ mShowFilterMenu(0),
+ mEmptyListLabel(0),
+ mInitialized(false),
+ mCall(0),
+ mMessage(0),
+ mContact(0),
+ mDetailsModel(0),
+ mCallTypeMapper(0)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::LogsBaseView()" );
+
+ mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this);
+ connect(mSoftKeyBackAction, SIGNAL(triggered()), this,
+ SLOT(handleBackSoftkey()));
+
+ mDialpad = mRepository.dialpad();
+
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::LogsBaseView()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsBaseView::~LogsBaseView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::~LogsBaseView()" );
+
+ delete mCall;
+ delete mMessage;
+ delete mContact;
+ delete mDetailsModel;
+ delete mCallTypeMapper;
+
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::~LogsBaseView()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsAppViewId LogsBaseView::viewId() const
+{
+ return mViewId;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsBaseView::isExitAllowed()
+{
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::resetView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::resetView()" );
+ mDialpad->editor().setText(QString());
+ if ( mDialpad->isOpen() ){
+ mDialpad->closeDialpad();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::resetView()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::activated(bool showDialer, QVariant args)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::activated()" );
+ Q_UNUSED(args);
+ //we have to set object tree of the repository to the current view
+ mRepository.setObjectTreeToView( mViewId );
+
+ if (!mInitialized) {
+ initView();
+ }
+
+ connect( mDialpad, SIGNAL( aboutToClose() ), this,
+ SLOT( dialpadClosed() ), Qt::QueuedConnection );
+ connect( mDialpad, SIGNAL( aboutToOpen() ), this,
+ SLOT( dialpadOpened() ), Qt::QueuedConnection );
+ connect( &mDialpad->editor(), SIGNAL( contentsChanged() ), this,
+ SLOT( dialpadEditorTextChanged() ) );
+
+ if ( navigationAction() != mSoftKeyBackAction ) {
+ setNavigationAction(mSoftKeyBackAction);
+ }
+
+ if (showDialer && !mDialpad->isOpen()) {
+ openDialpad();
+ }
+
+ updateWidgetsSizeAndLayout();
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::activated()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::deactivated()
+{
+ LOGS_QDEBUG( "logs [UI] <-> LogsBaseView::deactivated()" );
+ disconnect( mDialpad, SIGNAL( aboutToClose() ), this,
+ SLOT( dialpadClosed() ) );
+ disconnect( mDialpad, SIGNAL( aboutToOpen() ), this,
+ SLOT( dialpadOpened() ) );
+ disconnect( &mDialpad->editor(), SIGNAL( contentsChanged() ), this,
+ SLOT( dialpadEditorTextChanged() ) );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::notSupported()
+{
+ HbMessageBox* messageBox = new HbMessageBox(QString("Not supported"));
+ messageBox->setAttribute(Qt::WA_DeleteOnClose);
+ messageBox->setTimeout( HbMessageBox::StandardTimeout );
+ messageBox->show();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::handleBackSoftkey()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::handleBackSoftkey()" );
+ mViewManager.activateView( LogsRecentViewId, false, QVariant() );
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::handleBackSoftkey()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::initFilterMenu()
+{
+ mShowFilterMenu =
+ qobject_cast<HbMenu*>( mRepository.findWidget( logsShowFilterMenuId ) );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::addActionNamesToMap()
+{
+ mActionMap.clear();
+ mActionMap.insert(LogsServices::ViewReceived, logsShowFilterReceivedMenuActionId);
+ mActionMap.insert(LogsServices::ViewCalled, logsShowFilterDialledMenuActionId);
+ mActionMap.insert(LogsServices::ViewMissed, logsShowFilterMissedMenuActionId);
+ mActionMap.insert(LogsServices::ViewAll, logsShowFilterRecentMenuActionId);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::initView()
+{
+ Q_ASSERT_X( !mInitialized, "logs [UI] ", "view is already initialized!!" );
+ mInitialized = true;
+ initFilterMenu();
+ addActionNamesToMap();
+ connect(menu(), SIGNAL(aboutToShow()), this,
+ SLOT(closeEmptyMenu()), Qt::QueuedConnection);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QAbstractItemModel* LogsBaseView::model() const
+{
+ LOGS_QDEBUG( "logs [UI] <-> LogsBaseView::model()" );
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::handleExit()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::handleExit()" );
+ mViewManager.exitApplication();
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::handleExit()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::showFilterMenu()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::showFilterMenu()" );
+ if ( mShowFilterMenu ) {
+ QRectF toolbarGeometry = toolBar()->geometry();
+ QSizeF menuSize = mShowFilterMenu->size();
+ LOGS_QDEBUG_2("logs [UI] menusize:", menuSize)
+
+ QPointF pos( toolbarGeometry.bottomRight().x(),
+ toolbarGeometry.topRight().y() );
+
+ pos.setX(toolbarGeometry.bottomRight().x());
+ pos.setY(toolbarGeometry.topRight().y());
+
+ mShowFilterMenu->setPreferredPos(pos,HbPopup::BottomRightCorner);
+ LOGS_QDEBUG_2("logs [UI] menupos:", pos)
+ mShowFilterMenu->exec();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::showFilterMenu()" );
+}
+// -----------------------------------------------------------------------------
+// LogsBaseView::closeEmptyMenu()
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::closeEmptyMenu()
+{
+ bool visibleActionsExist = false;
+ foreach (QAction* action, menu()->actions()) {
+ if (action->isVisible()) {
+ visibleActionsExist = true ;
+ }
+ }
+
+ if (!visibleActionsExist) {
+ menu()->close();
+ }
+}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::openDialpad()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::openDialpad()" );
+ updateCallButton();
+ setDialpadPosition();
+ mDialpad->openDialpad();
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::openDialpad()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::openContactsApp()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::openContactsApp()" );
+
+ // Need to do request in async manner, otherwise new phonebook ui process
+ // will be started due bug(?) in highway.
+ XQServiceRequest snd("com.nokia.services.phonebookappservices.Launch","launch()", false);
+ int retValue;
+ snd.send(retValue);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::openContactsApp()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::setDialpadPosition()
+{
+ HbMainWindow& window = mViewManager.mainWindow();
+ // layoutrect broken, fix will be in MCL wk14, use workaround meanwhile
+ //QRectF screenRect = window.layoutRect();
+ QRectF screenRect = (window.orientation() == Qt::Horizontal) ?
+ QRectF(0,0,640,360) : QRectF(0,0,360,640);
+
+ LOGS_QDEBUG_2( "logs [UI] -> LogsBaseView::setDialpadPosition(), screenRect:",
+ screenRect );
+ if (window.orientation() == Qt::Horizontal) {
+ // dialpad takes half of the screen width
+ mDialpad->setPos(QPointF(screenRect.width()/2,
+ this->scenePos().y()));
+ mDialpad->setPreferredSize(screenRect.width()/2,
+ (screenRect.height()-scenePos().y()));
+ } else {
+ // dialpad takes 65% of the screen height
+ qreal screenHeight = screenRect.height();
+ mDialpad->setPos(QPointF(0, screenHeight/2.25));
+ mDialpad->setPreferredSize(screenRect.width(),
+ screenHeight-screenHeight/2.25);
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::setDialpadPosition()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::dialpadOpened()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::dialpadOpened()" );
+ updateWidgetsSizeAndLayout();
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::dialpadOpened()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::dialpadClosed()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::dialpadClosed()" );
+ mDialpad->editor().setText(QString());
+ updateWidgetsSizeAndLayout();
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::dialpadClosed()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::dialpadEditorTextChanged()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::dialpadEditorTextChanged()" );
+ if ( mDialpad->editor().text().length() > 0 ) {
+ mViewManager.activateView( LogsMatchesViewId, true, QVariant() );
+ } else {
+ updateCallButton();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::dialpadEditorTextChanged()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::changeFilter(HbAction* action)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::changeFilter()" );
+ LogsServices::LogsView view = mActionMap.key( action->objectName(),
+ LogsServices::ViewAll );
+ QVariant args(view);
+ mViewManager.activateView( LogsRecentViewId, false, args );
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::changeFilter()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::showListItemMenu(
+ HbAbstractViewItem* item, const QPointF& coords )
+{
+ HbMenu itemContextMenu(0);
+ itemContextMenu.setDismissPolicy(HbMenu::TapAnywhere);
+ itemContextMenu.setTimeout(contextMenuTimeout);
+
+ updateListItemData(item->modelIndex());
+ populateListItemMenu(itemContextMenu);
+
+ if (mDialpad->isOpen()) {
+ mDialpad->closeDialpad();
+ }
+ if (itemContextMenu.actions().count() > 0) {
+ itemContextMenu.exec(coords);
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::populateListItemMenu(HbMenu& menu)
+{
+ delete mCallTypeMapper;
+ mCallTypeMapper = 0;
+
+ if (mCall) {
+ mCallTypeMapper = new QSignalMapper();
+
+ foreach(LogsCall::CallType callType, mCall->allowedCallTypes()){
+ HbAction* callAction = new HbAction;
+ if (callType == LogsCall::TypeLogsVoiceCall){
+ callAction->setText(hbTrId("txt_common_menu_voice_call"));
+ }
+ else if (callType == LogsCall::TypeLogsVideoCall){
+ callAction->setText(hbTrId("txt_common_menu_video_call"));
+ }
+ else if (callType == LogsCall::TypeLogsVoIPCall){
+ callAction->setText(hbTrId("txt_common_menu_internet_call"));
+ }
+
+ connect(callAction, SIGNAL(triggered()),
+ mCallTypeMapper, SLOT( map()) );
+ mCallTypeMapper->setMapping(callAction, callType);
+
+ // Default call type must be the first item in context menu
+ if (callType != mCall->defaultCallType() ||
+ menu.actions().count() == 0){
+ menu.addAction(callAction);
+ } else {
+ menu.insertAction(menu.actions().at(0), callAction);
+ }
+ }
+ connect(mCallTypeMapper, SIGNAL(mapped(int)),
+ this, SLOT( initiateCall(int)) );
+ }
+
+ if (mMessage) {
+ HbAction* messageAction = new HbAction;
+ messageAction->setText(hbTrId("txt_common_menu_create_message"));
+ menu.addAction(messageAction);
+ QObject::connect( messageAction, SIGNAL(triggered()),
+ this, SLOT( createMessage() ) );
+ }
+ if (mContact) {
+ HbAction* contactAction = new HbAction;
+ if (mContact->allowedRequestType() ==
+ LogsContact::TypeLogsContactOpen) {
+ contactAction->setText(hbTrId("txt_dialer_ui_menu_open_contact"));
+ QObject::connect( contactAction, SIGNAL(triggered()),
+ mContact, SLOT(open()) );
+ }
+ else {
+ contactAction->setText(hbTrId("txt_common_menu_add_to_contacts"));
+ QObject::connect( contactAction, SIGNAL(triggered()),
+ this, SLOT(saveContact()) );
+
+ }
+ menu.addAction(contactAction);
+ }
+ if (mDetailsModel) {
+ HbAction* callDetailsAction = new HbAction;
+ callDetailsAction->setText(hbTrId("txt_dialer_ui_menu_call_details"));
+ menu.addAction(callDetailsAction);
+ QObject::connect(callDetailsAction, SIGNAL(triggered()),
+ this, SLOT(showCallDetails()));
+
+ HbAction* deleteAction = new HbAction;
+ deleteAction->setText(hbTrId("txt_common_menu_delete"));
+ menu.addAction(deleteAction);
+ QObject::connect(deleteAction, SIGNAL(triggered()),
+ this, SLOT(deleteEvent()));
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateListItemData(const QModelIndex& listIndex)
+{
+ updateCall(listIndex);
+ updateMessage(listIndex);
+ updateContact(listIndex);
+ updateDetailsModel(listIndex);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateCallButton()
+{
+ mDialpad->setCallButtonEnabled( !mDialpad->editor().text().isEmpty() );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::initiateCallback(const QModelIndex& index)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::initiateCallback()" );
+ updateCall(index);
+
+ if (mCall) {
+ mCall->initiateCallback();
+ }
+ delete mCall;
+ mCall = 0;
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::initiateCallback()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::initiateCall(int callType)
+{
+ if (mCall) {
+ mCall->call( static_cast<LogsCall::CallType>(callType) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::createMessage()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::createMessage()" );
+ if (mMessage) {
+ mMessage->sendMessage();
+ }
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::createMessage()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::saveContact()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::saveContact()" );
+
+ if (mContact){
+ HbDialog* popup = new HbDialog();
+ popup->setDismissPolicy(HbDialog::NoDismiss);
+ popup->setHeadingWidget(
+ new HbLabel(hbTrId("txt_dial_title_add_to_contacts"), popup));
+ popup->setAttribute(Qt::WA_DeleteOnClose);
+ popup->setTimeout( HbPopup::NoTimeout );
+ popup->setSecondaryAction(
+ new HbAction(hbTrId("txt_dial_button_cancel"), popup));
+
+ HbWidget* buttonWidget = new HbWidget(popup);
+ QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
+
+ HbPushButton* addButton = new HbPushButton(buttonWidget);
+ addButton->setOrientation(Qt::Horizontal);
+ addButton->setText(hbTrId("txt_dial_list_save_as_a_new_contact"));
+ HbIcon plusIcon("qtg_mono_plus");
+ addButton->setIcon(plusIcon);
+ connect(addButton, SIGNAL(clicked()), popup, SLOT(close()));
+ connect(addButton, SIGNAL(clicked()), mContact, SLOT(addNew()));
+
+ HbPushButton* updateButton = new HbPushButton(buttonWidget);
+ updateButton->setOrientation(Qt::Horizontal);
+ updateButton->setText(hbTrId("txt_dial_list_update_existing_contact"));
+ updateButton->setIcon(plusIcon);
+ connect(updateButton, SIGNAL(clicked()), popup, SLOT(close()));
+ connect(updateButton, SIGNAL(clicked()),
+ mContact, SLOT(updateExisting()));
+
+ layout->addItem(addButton);
+ layout->addItem(updateButton);
+
+ buttonWidget->setLayout(layout);
+ popup->setContentWidget(buttonWidget);
+
+ popup->exec();
+ }
+
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::saveContact()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateCall(const QModelIndex &listIndex)
+{
+ delete mCall;
+ mCall = 0;
+ if ( model() ) {
+ mCall = qVariantValue<LogsCall*>( model()->data(
+ listIndex, LogsAbstractModel::RoleCall ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateMessage(const QModelIndex &listIndex)
+{
+ delete mMessage;
+ mMessage = 0;
+ if ( model() ) {
+ mMessage = qVariantValue<LogsMessage*>( model()->data(
+ listIndex, LogsAbstractModel::RoleMessage ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateContact(const QModelIndex &listIndex)
+{
+ delete mContact;
+ mContact = 0;
+ if ( model() ) {
+ mContact = qVariantValue<LogsContact*>( model()->data(
+ listIndex, LogsAbstractModel::RoleContact ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateDetailsModel(const QModelIndex &listIndex)
+{
+ delete mDetailsModel;
+ mDetailsModel = 0;
+ if ( model() ) {
+ mDetailsModel = qVariantValue<LogsDetailsModel*>( model()->data(
+ listIndex, LogsAbstractModel::RoleDetailsModel ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::activateEmptyListIndicator(QAbstractItemModel* model)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::activateEmptyListIndicator()" );
+ if ( !mEmptyListLabel ){
+ mEmptyListLabel = qobject_cast<HbLabel*>(
+ mRepository.findWidget( logsLabelEmptyListId ) );
+ }
+ if ( model ){
+ // Listen for changes in model and update empty list label accordingly
+ connect( model, SIGNAL(rowsInserted(const QModelIndex&,int,int)),
+ this, SLOT(updateEmptyListWidgetsVisibility()));
+ connect( model, SIGNAL(rowsRemoved(const QModelIndex&,int,int)),
+ this, SLOT(updateEmptyListWidgetsVisibility()));
+ connect( model, SIGNAL(modelReset()),
+ this, SLOT(updateEmptyListWidgetsVisibility()));
+ // Update to reflect current situation
+ updateEmptyListWidgetsVisibility();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::activateEmptyListIndicator()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::deactivateEmptyListIndicator(QAbstractItemModel* model)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::deactivateEmptyListIndicator()" );
+ if ( model ){
+ disconnect( model, SIGNAL(rowsInserted(const QModelIndex&,int,int)),
+ this, SLOT(updateEmptyListWidgetsVisibility()));
+ disconnect( model, SIGNAL(rowsRemoved(const QModelIndex&,int,int)),
+ this, SLOT(updateEmptyListWidgetsVisibility()));
+ disconnect( model, SIGNAL(modelReset()),
+ this, SLOT(updateEmptyListWidgetsVisibility()));
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::deactivateEmptyListIndicator()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::addViewSwitchingEffects()
+{
+ // Add view switching effects, these are called when
+ // HbMainWindow::setCurrentView is called, may be removed once orbit
+ // has some built-in effects for view switching.
+ HbEffect::add(this, ":/view_show.fxml", "show");
+ HbEffect::add(this, ":/view_hide.fxml", "hide");
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateEmptyListWidgetsVisibility()
+{
+ updateEmptyListLabelVisibility();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateEmptyListLabelVisibility()
+{
+ if ( mEmptyListLabel && model() ){
+ LOGS_QDEBUG( "logs [UI] <-> LogsBaseView::updateEmptyListLabelVisibility()" );
+ bool visible(model()->rowCount() == 0);
+ mEmptyListLabel->setVisible(visible);
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::showCallDetails()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::showCallDetails()" );
+
+ if ( !mDetailsModel ){
+ return;
+ }
+
+ QVariant arg = qVariantFromValue( mDetailsModel );
+ if ( mViewManager.activateView(LogsDetailsViewId, false, arg) ){
+ mDetailsModel = 0;
+ }
+
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::showCallDetails()" );
+}
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::deleteEvent()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::deleteEvent()" );
+ if ( mDetailsModel ) {
+ if ( askConfirmation( hbTrId("txt_dialer_ui_title_delete_event"),
+ hbTrId("txt_dialer_info_call_event_will_be_removed_from"))){
+ mDetailsModel->clearEvent();
+ }
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::deleteEvent()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateWidgetsSizeAndLayout()
+{
+}
+
+// -----------------------------------------------------------------------------
+// Sets appropriate list widget layout using listView.setLayoutName()
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateListLayoutName( HbListView& listView, bool ignoreDialpad )
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::updateListLayoutName()" );
+ QString newLayout( logsListDefaultLayout );
+ Qt::Orientation orientation = mViewManager.mainWindow().orientation();
+ if (orientation == Qt::Horizontal) {
+ if (mDialpad->isOpen()) {
+ if (ignoreDialpad) {
+ newLayout = QString( logsListDefaultLayout );
+ } else {
+ newLayout = QString( logsListLandscapeDialpadLayout );
+ }
+ } else {
+ newLayout = QString( logsListLandscapeLayout );
+ }
+ } else {
+ newLayout = QString( logsListDefaultLayout );
+ }
+
+ if (newLayout != listView.layoutName()) {
+ LOGS_QDEBUG_2( "logs [UI] setting new list layout name: ", newLayout );
+ listView.setLayoutName( newLayout );
+ }
+
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::updateListLayoutName()" );
+}
+
+// -----------------------------------------------------------------------------
+// Loads appropriate section from *.docml to resize list widget
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateListSize()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::updateListSize()" );
+ QString newSection( logsViewDefaultSection );
+ Qt::Orientation orientation = mViewManager.mainWindow().orientation();
+
+ if (mDialpad->isOpen()) {
+ if (orientation == Qt::Horizontal) {
+ newSection = QString( logsViewLandscapeDialpadSection );
+ } else {
+ newSection = QString( logsViewPortraitDialpadSection );
+ }
+ } else {
+ newSection = QString( logsViewDefaultSection );
+ }
+
+ if (newSection != mLayoutSectionName) {
+ mLayoutSectionName = newSection;
+ LOGS_QDEBUG_2( "logs [UI] loading new section: ", newSection );
+ mRepository.loadSection( viewId(), newSection );
+ }
+
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::updateListSize()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::handleOrientationChanged()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::handleOrientationChanged()!" );
+ setDialpadPosition();
+ updateWidgetsSizeAndLayout();
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::handleOrientationChanged()");
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::toggleActionAvailability( HbAction* action, bool available )
+{
+ if ( action ){
+ action->setVisible( available );
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsBaseView::askConfirmation( QString heading , QString text )
+{
+ bool result(false);
+ HbMessageBox *note = new HbMessageBox("", HbMessageBox::MessageTypeQuestion);
+ note->setHeadingWidget(new HbLabel( heading ));
+ note->setText( text );
+ note->setPrimaryAction(new HbAction(hbTrId("txt_common_button_ok"), note));
+ note->setSecondaryAction(new HbAction(hbTrId("txt_common_button_cancel"), note));
+ HbAction *selected = note->exec();
+ if (selected == note->primaryAction()){
+ result = true;
+ }
+ delete note;
+ return result;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logscomponentrepository.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,261 @@
+/*
+* 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 "logscomponentrepository.h"
+#include "logsrecentcallsview.h"
+#include "logsmatchesview.h"
+#include "logsdetailsview.h"
+#include "logslogger.h"
+#include "logsmodel.h"
+#include "logsabstractviewmanager.h"
+#include "logspageindicator.h"
+
+//SYSTEM
+#include <QObject>
+#include <dialpad.h>
+#include <dialpadkeyhandler.h>
+#include <hbtoolbar.h>
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsComponentRepository::LogsComponentRepository(LogsAbstractViewManager& viewManager)
+ : HbDocumentLoader(),
+ mViewManager(viewManager),
+ mRecentCallsView(0),
+ mDetailsView(0),
+ mMatchesView(0),
+ mDialpad(0),
+ mDialpadKeyHandler(0)
+{
+ bool resourceControl = true;
+ mModel = new LogsModel(LogsModel::LogsRecentModel, resourceControl);
+}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsComponentRepository::~LogsComponentRepository()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::~LogsComponentRepository()" );
+
+ mRecentViewComponents.clear();
+ mDetailsViewComponents.clear();
+ mMatchesViewComponents.clear();
+ delete mDialpadKeyHandler;
+ delete mDialpad;
+ delete mModel;
+
+ LOGS_QDEBUG( "logs [UI] <- LogsComponentRepository::~LogsComponentRepository()" );
+}
+
+
+// -----------------------------------------------------------------------------
+// HbDocumentLoader will not add HbToolBar into the object list (at least on w02),
+// since toolbar has a parent (view), so let's do it ourselves
+// -----------------------------------------------------------------------------
+//
+void LogsComponentRepository::addToolbarToObjectList( QObjectList& list )
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::addToolbarToObjectList()" );
+ HbToolBar* toolbar = qobject_cast<HbToolBar*>( findWidget( logsToolbarId ) );
+ if ( toolbar && !list.contains(toolbar) ) {
+ LOGS_QDEBUG( "logs [UI] adding toolbar to object list" );
+ list.append(toolbar);
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsComponentRepository::addToolbarToObjectList()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsRecentCallsView* LogsComponentRepository::recentCallsView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::recentCallsView()" );
+ setObjectTreeToView( LogsRecentViewId );
+
+ if ( !mRecentCallsView ) {
+ bool ok = false;
+ mRecentViewComponents = load( logsRecentCallsViewFile, &ok );
+ if ( ok ) {
+ mRecentCallsView = qobject_cast<LogsRecentCallsView*>
+ ( findWidget(logsRecentCallsViewId) );
+
+ addToolbarToObjectList(mRecentViewComponents);
+ } else {
+ LOGS_QCRITICAL( "logs [UI] XML loading failed..." );
+ }
+ }
+
+ LOGS_QDEBUG( "logs [UI] <- LogsComponentRepository::recentCallsView()" );
+ return mRecentCallsView;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsDetailsView* LogsComponentRepository::detailsView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::detailsView()" );
+ setObjectTreeToView( LogsDetailsViewId );
+
+ if ( !mDetailsView ) {
+ bool ok = false;
+ mDetailsViewComponents = load( logsDetailsViewFile, &ok );
+ if ( ok ) {
+ mDetailsView = qobject_cast<LogsDetailsView*>
+ ( findWidget(logsDetailsViewId) );
+
+ addToolbarToObjectList(mDetailsViewComponents);
+ } else {
+ LOGS_QCRITICAL( "logs [UI] XML loading failed..." );
+ }
+ }
+ LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::detailsView()" );
+ return mDetailsView;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMatchesView* LogsComponentRepository::matchesView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::matchedCallsView()" );
+ setObjectTreeToView( LogsMatchesViewId );
+
+ if ( !mMatchesView ) {
+ bool ok = false;
+ mMatchesViewComponents = load( logsMatchedCallsViewFile, &ok );
+ if ( ok ) {
+ mMatchesView = qobject_cast<LogsMatchesView*>
+ ( findWidget(logsMatchesViewId) );
+
+ addToolbarToObjectList(mMatchesViewComponents);
+ } else {
+ LOGS_QCRITICAL( "logs [UI] XML loading failed..." );
+ }
+ }
+
+ LOGS_QDEBUG( "logs [UI] <- LogsComponentRepository::matchedCallsView()" );
+ return mMatchesView;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+Dialpad* LogsComponentRepository::dialpad()
+{
+ if ( !mDialpad ) {
+ mDialpad = new Dialpad(mViewManager.mainWindow());
+ mDialpadKeyHandler =
+ new DialpadKeyHandler(mDialpad, mViewManager.mainWindow());
+ }
+ return mDialpad;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsModel* LogsComponentRepository::model() const
+{
+ return mModel;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsComponentRepository::setObjectTreeToView( LogsAppViewId viewId )
+{
+ reset();
+ if ( viewId == LogsRecentViewId ) {
+ setObjectTree( mRecentViewComponents );
+ } else if ( viewId == LogsDetailsViewId ) {
+ setObjectTree( mDetailsViewComponents );
+ } else if ( viewId == LogsMatchesViewId ) {
+ setObjectTree( mMatchesViewComponents );
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QObject* LogsComponentRepository::createObject(const QString& type,
+ const QString &name)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::createObject()" );
+
+ QObject* object = 0;
+
+ if (name == logsRecentCallsViewId) {
+ LOGS_QDEBUG( "logs [UI] creating recent calls view" );
+ object = new LogsRecentCallsView(*this, mViewManager);
+ } else if (name == logsDetailsViewId) {
+ LOGS_QDEBUG( "logs [UI] creating details view" );
+ object = new LogsDetailsView(*this, mViewManager);
+ } else if (name == logsMatchesViewId) {
+ LOGS_QDEBUG( "logs [UI] creating matches view" );
+ object = new LogsMatchesView(*this, mViewManager);
+ } else if (name == logsPageIndicatorId) {
+ LOGS_QDEBUG( "logs [UI] creating LogsPageIndicator" );
+ object = new LogsPageIndicator;
+ } else {
+ object = HbDocumentLoader::createObject( type, name );
+ }
+
+ if (object)
+ object->setObjectName(name);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsComponentRepository::createObject()" );
+ return object;
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsComponentRepository::loadSection
+// -----------------------------------------------------------------------------
+//
+bool LogsComponentRepository::loadSection( LogsAppViewId viewId,
+ const QString& sectionName )
+ {
+ LOGS_QDEBUG( "logs [UI] -> LogsComponentRepository::loadSection()" )
+ bool ok( false );
+
+ QString fileName;
+ if ( viewId == LogsRecentViewId ) {
+ fileName = logsRecentCallsViewFile;
+ } else if ( viewId == LogsMatchesViewId ) {
+ fileName = logsMatchedCallsViewFile;
+ } else if ( viewId == LogsDetailsViewId ) {
+ fileName = logsDetailsViewFile;
+ }
+
+ if ( fileName.length() > 0 ) {
+ load( fileName, sectionName, &ok );
+ }
+
+ LOGS_QDEBUG_2( "logs [UI] -> LogsComponentRepository::loadSection(): ", ok )
+ return ok;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logsdetailsview.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,364 @@
+/*
+* 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 "logsdetailsview.h"
+#include "logsdetailsmodel.h"
+#include "logscall.h"
+#include "logsmessage.h"
+#include "logslogger.h"
+#include "logscomponentrepository.h"
+#include "logsabstractviewmanager.h"
+#include "logsdefs.h"
+#include "logscontact.h"
+
+//SYSTEM
+#include <hblistview.h>
+#include <hbaction.h>
+#include <hbgroupbox.h>
+#include <hbmessagebox.h>
+#include <hblabel.h>
+Q_DECLARE_METATYPE(LogsDetailsModel*)
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsDetailsView::LogsDetailsView(
+ LogsComponentRepository& repository, LogsAbstractViewManager& viewManager )
+ : LogsBaseView(LogsDetailsViewId, repository, viewManager),
+ mViewName(0),
+ mListView(0)
+{
+ LOGS_QDEBUG( "logs [UI] <-> LogsDetailsView::LogsDetailsView()" );
+
+ //TODO: taking away due to toolbar bug. If toolbar visibility changes on view
+ //activation, there will be a crash due to previous view effect is playing
+ //addViewSwitchingEffects();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsDetailsView::~LogsDetailsView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::~LogsDetailsView()" );
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::~LogsDetailsView()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::activated(bool showDialer, QVariant args)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::activated()" );
+ //base class handling first
+ LogsBaseView::activated(showDialer, args);
+
+ LogsDetailsModel* model = qVariantValue<LogsDetailsModel*>(args);
+ if ( !model ){
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::activated(), no model" );
+ return;
+ }
+
+ if ( mListView && mDetailsModel && mDetailsModel != model ){
+ mListView->setModel( 0 );
+ delete mDetailsModel;
+ }
+ mDetailsModel = model;
+
+ if (mViewName){
+ mViewName->setHeading(mDetailsModel->headerData(0, Qt::Vertical).toString());
+ }
+
+ if ( mListView ){
+ mListView->setModel( mDetailsModel );//ownership not transferred
+ }
+
+ updateMenu();
+
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::activated()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsDetailsView::deactivated
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::deactivated()
+{
+ //base class handling first
+ LogsBaseView::deactivated();
+ if ( mListView ){
+ mListView->setModel( 0 );
+ }
+ delete mDetailsModel;
+ mDetailsModel = 0;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::callKeyPressed()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::callKeyPressed()" );
+ if ( mCall ){
+ mCall->initiateCallback();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::callKeyPressed()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsDetailsView::initiateVoiceCall
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::initiateVoiceCall()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::initiateVoiceCall()" );
+ if ( mCall ){
+ mCall->call(LogsCall::TypeLogsVoiceCall);
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::initiateVoiceCall()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::initiateVideoCall()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::initiateVideoCall()" );
+ if ( mCall ){
+ mCall->call(LogsCall::TypeLogsVideoCall);
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::initiateVideoCall()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::addToContacts()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::addToContacts()" );
+ if ( mContact ){
+ // Use async connection to ensure that model can handle
+ // contact operation completion before view
+ QObject::connect(mContact, SIGNAL(saveCompleted(bool)),
+ this, SLOT(contactActionCompleted(bool)),
+ Qt::QueuedConnection);
+ this->saveContact();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::addToContacts()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::openContact()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::openContact()" );
+ if ( mContact ){
+ // Use async connection to ensure that model can handle
+ // contact operation completion before view
+ QObject::connect(mContact, SIGNAL(openCompleted(bool)),
+ this, SLOT(contactActionCompleted(bool)),
+ Qt::QueuedConnection);
+ mContact->open();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::openContact()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::contactActionCompleted(bool modified)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::contactActionCompleted()" );
+
+ if (modified){
+ updateMenu();
+ if (mViewName){
+ mViewName->setHeading(
+ mDetailsModel->headerData(0, Qt::Vertical).toString());
+ }
+ }
+
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::contactActionCompleted()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::deleteEvent()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::deleteEvent()" );
+ if ( mDetailsModel ) {
+ if ( askConfirmation( hbTrId("txt_dialer_ui_title_delete_event"),
+ hbTrId("txt_dialer_info_call_event_will_be_removed_from"))){
+ mDetailsModel->clearEvent();
+ handleBackSoftkey();
+ }
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::deleteEvent()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsDetailsView::copyNumberToClipboard()
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::copyNumberToClipboard()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::copyNumberToClipboard()" );
+ if ( mDetailsModel ) {
+ mDetailsModel->getNumberToClipboard();
+ handleBackSoftkey();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::copyNumberToClipboard()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsDetailsView::handleBackSoftkey
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::handleBackSoftkey()
+{
+ mViewManager.activatePreviousView();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::initView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::initView()" );
+ //base class handling first
+ LogsBaseView::initView();
+
+ mViewName = qobject_cast<HbGroupBox*>(
+ mRepository.findWidget( logsGroupboxDetailViewNameId ) );
+ initListWidget();
+
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::initView()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QAbstractItemModel* LogsDetailsView::model() const
+{
+ return mDetailsModel;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::initListWidget()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::initListWidget()" );
+ mListView = qobject_cast<HbListView*>
+ ( mRepository.findWidget( logsDetailsListWidgetId ) );
+ Q_ASSERT_X(mListView != 0, "logs [UI] ", "couldn't find list widget !!");
+
+ mListView->setItemRecycling(true);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::initListWidget() " );
+}
+
+// -----------------------------------------------------------------------------
+// LogsDetailsView::updateMenu
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::updateMenu()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::updateMenu()" );
+ if ( !mDetailsModel ) {
+ return;
+ }
+
+ updateCall( mDetailsModel->index(0) );
+ updateMessage( mDetailsModel->index(0) );
+ updateContact( mDetailsModel->index(0) );
+
+ HbAction* voiceCallAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsDetailsViewVoiceCallMenuActionId ) );
+ HbAction* videoCallAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsCommonVideoCallMenuActionId ) );
+ HbAction* internetCallAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsDetailsViewInternetCallMenuActionId ) );
+ HbAction* messageAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsCommonMessageMenuActionId ) );
+ HbAction* addToContactsAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsDetailsAddToContactsMenuActionId ) );
+ HbAction* openContactAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsDetailsOpenContactMenuActionId ) );
+
+ bool voiceCallAvailable(false);
+ bool videoCallAvailable(false);
+ bool internetCallAvailable(false); // Currently always disabled
+ if (mCall) {
+ foreach( LogsCall::CallType callType, mCall->allowedCallTypes() ){
+ if ( callType == LogsCall::TypeLogsVoiceCall ){
+ voiceCallAvailable = true;
+ } else if ( callType == LogsCall::TypeLogsVideoCall ) {
+ videoCallAvailable = true;
+ }
+ }
+ }
+
+ bool contactCanBeAdded(false);
+ bool contactCanBeOpened(false);
+ if (mContact){
+ if (mContact->allowedRequestType() == LogsContact::TypeLogsContactSave){
+ contactCanBeAdded = true;
+ }
+ if (mContact->allowedRequestType() == LogsContact::TypeLogsContactOpen){
+ contactCanBeOpened = true;
+ }
+ }
+
+ toggleActionAvailability(voiceCallAction, voiceCallAvailable);
+ toggleActionAvailability(videoCallAction, videoCallAvailable);
+ toggleActionAvailability(internetCallAction, internetCallAvailable);
+ toggleActionAvailability(messageAction, mMessage);
+ toggleActionAvailability(addToContactsAction, contactCanBeAdded);
+ toggleActionAvailability(openContactAction, contactCanBeOpened);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::updateMenu()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsDetailsView::updateWidgetsSizeAndLayout
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::updateWidgetsSizeAndLayout()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::updateWidgetsSizeAndLayout()" );
+ if ( mListView ) {
+ updateListLayoutName(*mListView, true);
+ updateListSize();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::updateWidgetsSizeAndLayout()" );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logseffecthandler.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,266 @@
+/*
+* 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 "logseffecthandler.h"
+#include "logslogger.h"
+
+//SYSTEM
+#include <QPropertyAnimation>
+#include <QSequentialAnimationGroup>
+#include <hbinstance.h>
+
+const int logsMoveByExtra = 20;
+const int logsEffectDelayBetween = 200;
+const int logsEffectAppearDurationInMs = 500;
+const int logsEffectDissappearDurationInMs = 300;
+const int logsEffectMoveNotPossibleDurationInMs = 200;
+const int logsMoveNotPossibleAmount = 30;
+
+const int logsDissappearByMovingIndex = 0;
+const int logsAppearByMovingIndex = 2;
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsEffectHandler::LogsEffectHandler() : QObject()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsEffectHandler::LogsEffectHandler()" );
+
+ QPropertyAnimation* itemAppearByMovingAnimation = new QPropertyAnimation();
+ QPropertyAnimation* itemAppearByMovingAnimation2 = new QPropertyAnimation();
+ QPropertyAnimation* itemDissappearByMovingAnimation = new QPropertyAnimation();
+ QPropertyAnimation* itemDissappearByMovingAnimation2 = new QPropertyAnimation();
+
+ mItemAppearByFadingAnimation = new QPropertyAnimation();
+ mItemDissappearByFadingAnimation = new QPropertyAnimation();
+ mItemMoveNotPossibleAnimationStart = new QPropertyAnimation();
+ mItemMoveNotPossibleAnimationEnd = new QPropertyAnimation();
+
+ mMoveGroup = new QSequentialAnimationGroup;
+ mMoveGroup2 = new QSequentialAnimationGroup;
+ mFadeGroup = new QSequentialAnimationGroup;
+ mMoveNotPossibleGroup = new QSequentialAnimationGroup;
+
+ mMoveGroup->addAnimation(itemDissappearByMovingAnimation);
+ mMoveGroup->addPause(logsEffectDelayBetween);
+ mMoveGroup->addAnimation(itemAppearByMovingAnimation);
+
+ mMoveGroup2->addAnimation(itemDissappearByMovingAnimation2);
+ mMoveGroup2->addPause(logsEffectDelayBetween);
+ mMoveGroup2->addAnimation(itemAppearByMovingAnimation2);
+
+ mFadeGroup->addAnimation(mItemDissappearByFadingAnimation);
+ mFadeGroup->addAnimation(mItemAppearByFadingAnimation);
+
+ mMoveNotPossibleGroup->addAnimation(mItemMoveNotPossibleAnimationStart);
+ mMoveNotPossibleGroup->addAnimation(mItemMoveNotPossibleAnimationEnd);
+
+ connect(mMoveGroup, SIGNAL(currentAnimationChanged(QAbstractAnimation *)),
+ this, SLOT( moveAnimationChanged(QAbstractAnimation *)));
+ connect(mFadeGroup, SIGNAL(currentAnimationChanged(QAbstractAnimation *)),
+ this, SLOT( fadeAnimationChanged(QAbstractAnimation *)));
+
+ LOGS_QDEBUG( "logs [UI] <- LogsEffectHandler::LogsEffectHandler()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsEffectHandler::~LogsEffectHandler()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsEffectHandler::~LogsEffectHandler()" );
+
+ // Groups delete attached animations
+ delete mMoveGroup;
+ delete mMoveGroup2;
+ delete mFadeGroup;
+ delete mMoveNotPossibleGroup;
+
+ LOGS_QDEBUG( "logs [UI] <- LogsEffectHandler::~LogsEffectHandler()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsEffectHandler::moveAnimationChanged(QAbstractAnimation *currentAnimation)
+{
+ if ( mMoveGroup->indexOfAnimation(currentAnimation) == 1 ) {
+ emit dissappearByMovingComplete();
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsEffectHandler::fadeAnimationChanged(QAbstractAnimation *currentAnimation)
+{
+ if ( mFadeGroup->indexOfAnimation(currentAnimation) == 1 ) {
+ emit dissappearByFadingComplete();
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsEffectHandler::startDissappearAppearByFadingEffect(QObject& effectTarget)
+{
+ initOpacityEffect(*mItemDissappearByFadingAnimation, &effectTarget,
+ 1.0, 0.0, logsEffectDissappearDurationInMs);
+ initOpacityEffect(*mItemAppearByFadingAnimation, &effectTarget,
+ 0.0, 1.0, logsEffectAppearDurationInMs);
+ mFadeGroup->start();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsEffectHandler::startDissappearAppearByMovingEffect(
+ QObject& effectTarget, QObject& secondaryEffectTarget,
+ bool dissappearToLeft, int origX)
+{
+ doStartDissappearAppearByMovingEffect(
+ *mMoveGroup, effectTarget, dissappearToLeft, origX);
+ doStartDissappearAppearByMovingEffect(
+ *mMoveGroup2, secondaryEffectTarget, dissappearToLeft, origX);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsEffectHandler::doStartDissappearAppearByMovingEffect(
+ QSequentialAnimationGroup& group, QObject& effectTarget,
+ bool dissappearToLeft, int origX)
+{
+ initDissappearByMovingEffect(
+ static_cast<QPropertyAnimation&>(*group.animationAt(logsDissappearByMovingIndex)),
+ &effectTarget, dissappearToLeft, origX);
+ initAppearByMovingEffect(
+ static_cast<QPropertyAnimation&>(*group.animationAt(logsAppearByMovingIndex)),
+ &effectTarget, !dissappearToLeft, origX);
+ group.start();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsEffectHandler::startMoveNotPossibleEffect(
+ QObject& effectTarget, bool moveLeft, int origX)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsEffectHandler::startMoveNotPossibleEffect()" );
+
+ // Move a bit to attempted direction and then back
+ //
+ //int origX = effectTarget.property("x").toInt();
+ int moveNotPossiblePos =
+ moveLeft ? -logsMoveNotPossibleAmount : logsMoveNotPossibleAmount;
+ QEasingCurve easing(QEasingCurve::OutBack);
+ initMoveHorizontallyEffect(
+ *mItemMoveNotPossibleAnimationStart, &effectTarget, origX, moveNotPossiblePos,
+ logsEffectMoveNotPossibleDurationInMs, easing);
+ QEasingCurve easing2(QEasingCurve::OutQuad);
+ initMoveHorizontallyEffect(
+ *mItemMoveNotPossibleAnimationEnd, &effectTarget, moveNotPossiblePos, origX,
+ logsEffectMoveNotPossibleDurationInMs, easing2);
+ mMoveNotPossibleGroup->start();
+
+ LOGS_QDEBUG( "logs [UI] <- LogsEffectHandler::startMoveNotPossibleEffect()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsEffectHandler::initAppearByMovingEffect(
+ QPropertyAnimation& animation, QObject* effectTarget, bool appearFromLeft, int origX)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsEffectHandler::startAppearByMovingEffect()" );
+
+ Q_ASSERT(!hbInstance->allMainWindows().isEmpty());
+ int moveBy = hbInstance->allMainWindows().at(0)->layoutRect().width() + logsMoveByExtra;
+ int startPos = appearFromLeft ? -moveBy : moveBy;
+ QEasingCurve easing(QEasingCurve::OutQuad); // decelerating
+ initMoveHorizontallyEffect(
+ animation, effectTarget, startPos, origX,
+ logsEffectAppearDurationInMs, easing);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsEffectHandler::startAppearByMovingEffect()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsEffectHandler::initDissappearByMovingEffect(
+ QPropertyAnimation& animation, QObject* effectTarget, bool dissappearToLeft, int origX)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsEffectHandler::startDissappearByMovingEffect()" );
+
+ Q_ASSERT(!hbInstance->allMainWindows().isEmpty());
+ int moveBy = hbInstance->allMainWindows().at(0)->layoutRect().width() + logsMoveByExtra;
+ int endPos = dissappearToLeft ? -moveBy : moveBy;
+ QEasingCurve easing(QEasingCurve::InQuad); // accelerating
+ initMoveHorizontallyEffect(
+ animation, effectTarget, origX, endPos,
+ logsEffectDissappearDurationInMs, easing);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsEffectHandler::startDissappearByMovingEffect()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsEffectHandler::initOpacityEffect(
+ QPropertyAnimation& animation, QObject* effectTarget,
+ qreal startVal, qreal endVal, int duration)
+{
+ if (animation.state() == QAbstractAnimation::Running ){
+ animation.stop();
+ }
+ animation.setTargetObject(effectTarget);
+ animation.setPropertyName("opacity");
+ animation.setStartValue(startVal);
+ animation.setEndValue(endVal);
+ animation.setDuration(duration);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsEffectHandler::initMoveHorizontallyEffect(
+ QPropertyAnimation& animation, QObject* effectTarget,
+ int startVal, int endVal, int duration, const QEasingCurve& easingCurve)
+{
+ if (animation.state() == QAbstractAnimation::Running ){
+ animation.stop();
+ }
+ animation.setTargetObject(effectTarget);
+ animation.setPropertyName("x");
+ animation.setStartValue(startVal);
+ animation.setEndValue(endVal);
+ animation.setDuration(duration);
+ animation.setEasingCurve(easingCurve);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logsmainwindow.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* 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 "logsmainwindow.h"
+#include "logslogger.h"
+#include "logsforegroundwatcher.h"
+#include <QKeyEvent>
+#include <xqserviceutil.h>
+
+// -----------------------------------------------------------------------------
+// LogsMainWindow::LogsMainWindow
+// -----------------------------------------------------------------------------
+//
+LogsMainWindow::LogsMainWindow() : HbMainWindow(), mForeground(false)
+{
+ if ( viewport() ){
+ viewport()->grabGesture(Qt::SwipeGesture);
+ }
+ mWatcher = new LogsForegroundWatcher(this);
+ connect( mWatcher, SIGNAL(losingForeground()), this, SIGNAL(appFocusLost()) );
+ connect( mWatcher, SIGNAL(gainingForeground()), this, SIGNAL(appFocusGained()) );
+}
+
+// -----------------------------------------------------------------------------
+// LogsMainWindow::~LogsMainWindow
+// -----------------------------------------------------------------------------
+//
+LogsMainWindow::~LogsMainWindow()
+{
+ if ( viewport() ){
+ viewport()->ungrabGesture(Qt::SwipeGesture);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsMainWindow::sendAppToBackground
+// -----------------------------------------------------------------------------
+//
+void LogsMainWindow::sendAppToBackground()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMainWindow::sendAppToBackground" );
+ mForeground = false;
+ XQServiceUtil::toBackground(true);
+ LOGS_QDEBUG( "logs [UI] <- LogsMainWindow::sendAppToBackground" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsMainWindow::bringAppToForeground
+// -----------------------------------------------------------------------------
+//
+void LogsMainWindow::bringAppToForeground()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMainWindow::bringAppToForeground" );
+ if ( !mForeground ){
+ mForeground = true;
+ show();
+ raise();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsMainWindow::bringAppToForeground" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsMainWindow::isForeground
+// -----------------------------------------------------------------------------
+//
+bool LogsMainWindow::isForeground() const
+{
+ return mForeground;
+}
+
+// -----------------------------------------------------------------------------
+// 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.
+ emit callKeyPressed();
+ event->accept();
+ return;
+ }
+ HbMainWindow::keyPressEvent(event);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logsmatchesview.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,357 @@
+/*
+* 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 "logsmatchesview.h"
+#include "logscomponentrepository.h"
+#include "logsabstractviewmanager.h"
+#include "logsdefs.h"
+#include "logslogger.h"
+#include "logsmodel.h"
+#include "logsmatchesmodel.h"
+#include "logscall.h"
+#include "logscontact.h"
+#include "logsmessage.h"
+
+//SYSTEM
+#include <hblistview.h>
+#include <hbaction.h>
+#include <dialpad.h>
+#include <hblineedit.h>
+#include <hbabstractviewitem.h>
+#include <hblistviewitem.h>
+#include <hbpushbutton.h>
+
+Q_DECLARE_METATYPE(LogsMatchesModel*)
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::LogsMatchesView
+// -----------------------------------------------------------------------------
+//
+LogsMatchesView::LogsMatchesView(
+ LogsComponentRepository& repository, LogsAbstractViewManager& viewManager )
+ : LogsBaseView(LogsMatchesViewId, repository, viewManager),
+ mListView(0),
+ mModel(0),
+ mAddToContactsButton(0)
+{
+ LOGS_QDEBUG( "logs [UI] <-> LogsMatchesView::LogsMatchesView()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::~LogsMatchesView
+// -----------------------------------------------------------------------------
+//
+LogsMatchesView::~LogsMatchesView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::~LogsMatchesView()" );
+ delete mModel;
+ LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::~LogsMatchesView()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::activated
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::activated(bool showDialer, QVariant args)
+{
+ //base class handling first
+ LogsBaseView::activated(showDialer, args);
+
+ LogsMatchesModel* model = qVariantValue<LogsMatchesModel*>(args);
+ updateModel(model);
+ dialpadEditorTextChanged();
+
+ activateEmptyListIndicator(mModel);
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::deactivated
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::deactivated()
+{
+ //base class handling first
+ LogsBaseView::deactivated();
+
+ deactivateEmptyListIndicator(mModel);
+
+ delete mModel;
+ mModel = 0;
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::initView
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::initView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::initView()" );
+ //base class handling first
+ LogsBaseView::initView();
+
+ initListWidget();
+
+ mAddToContactsButton = qobject_cast<HbPushButton*>(
+ mRepository.findWidget( logsButtonAddToContactsId ) );
+
+ LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::initView()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QAbstractItemModel* LogsMatchesView::model() const
+{
+ return mModel;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::callKeyPressed()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::callKeyPressed()" );
+
+ callToCurrentNum( LogsCall::TypeLogsVoiceCall );
+
+ LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::callKeyPressed()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::videoCallToCurrentNum()
+{
+ callToCurrentNum( LogsCall::TypeLogsVideoCall );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::sendMessageToCurrentNum()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::sendMessageToCurrentNum()" );
+ if ( mDialpad->editor().text().length() > 0 ){
+ // Message to inputted number
+ LogsMessage::sendMessageToNumber( mDialpad->editor().text() );
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::sendMessageToCurrentNum()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::saveNumberInDialpadToContacts()
+{
+ if (mDialpad->editor().text().length() > 0){
+ delete mContact;
+ mContact = 0;
+ mContact = mModel->createContact(mDialpad->editor().text());
+ this->saveContact();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::initListWidget
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::initListWidget()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::initListWidget()" );
+ mListView = qobject_cast<HbListView*>
+ ( mRepository.findWidget( logsListWidgetId ) );
+ Q_ASSERT_X(mListView != 0, "logs [UI] ", "couldn't find list widget !!");
+
+ mListView->setItemRecycling(true);
+ mListView->setFrictionEnabled(true);
+ mListView->listItemPrototype()->setTextFormat(Qt::RichText);
+
+ connect(mListView, SIGNAL(activated(const QModelIndex)),
+ this, SLOT(initiateCallback(const QModelIndex)));
+
+ connect(mListView,
+ SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)),
+ this,
+ SLOT(showListItemMenu(HbAbstractViewItem*, const QPointF&)));
+
+ LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::initListWidget() " );
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::updateModel
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::updateModel(LogsMatchesModel* model)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::updateModel()" );
+
+ if ( !model || model != mModel ){
+ LOGS_QDEBUG( "logs [UI] Delete old model" );
+ delete mModel;
+ mModel = 0;
+ }
+
+ if ( !model ){
+ LOGS_QDEBUG( "logs [UI] Create new model" );
+ mModel = mRepository.model()->logsMatchesModel();
+ } else {
+ LOGS_QDEBUG( "logs [UI] Use given model" );
+ mModel = model;
+ }
+ if ( mListView ) {
+ mListView->setModel( mModel );//ownership not transferred
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::updateModel()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::::handleBackSoftkey
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::handleBackSoftkey()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::::handleBackSoftkey()" );
+
+ if (mDialpad->isOpen()){
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::::handleBackSoftkey() closeDialpad" );
+ // Block aboutToClose signal to interfere with layout loading
+ // at backstepping phase
+ mDialpad->blockSignals(true);
+ mDialpad->closeDialpad();
+ mDialpad->blockSignals(false);
+ }
+
+ LogsBaseView::handleBackSoftkey();
+
+ LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::::handleBackSoftkey()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::dialpadEditorTextChanged
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::dialpadEditorTextChanged()
+{
+ updateCallButton();
+ updateMenu();
+
+ QString pattern = mDialpad->editor().text();
+ if ( pattern.isEmpty() ){
+ // Treat empty input field same was as back press
+ LogsBaseView::handleBackSoftkey();
+ } else if ( mModel ) {
+ mModel->logsMatches( pattern );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::dialpadOpened
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::dialpadOpened()
+{
+ LogsBaseView::dialpadOpened();
+ updateAddContactButton();
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::dialpadClosed
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::dialpadClosed()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::dialpadClosed()" );
+ updateWidgetsSizeAndLayout();
+ updateAddContactButton();
+ LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::dialpadClosed()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::updateWidgetsSizeAndLayout
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::updateWidgetsSizeAndLayout()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::updateWidgetsSizeAndLayout()" );
+ if ( mListView ) {
+ updateMenu();
+ updateListLayoutName(*mListView);
+ updateListSize();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::updateWidgetsSizeAndLayout()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::updateEmptyListWidgetsVisibility
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::updateEmptyListWidgetsVisibility()
+{
+ updateEmptyListLabelVisibility();
+ updateAddContactButton();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::updateMenu()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::updateMenu()" );
+ HbAction* videoCallAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsCommonVideoCallMenuActionId ) );
+ HbAction* sendMessageAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsCommonMessageMenuActionId ) );
+
+ bool visible( mDialpad->isOpen() && !mDialpad->editor().text().isEmpty() );
+
+ toggleActionAvailability( videoCallAction, visible );
+ toggleActionAvailability( sendMessageAction, visible );
+ LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::updateMenu()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::callToCurrentNum( LogsCall::CallType callType )
+{
+ if ( mDialpad->editor().text().length() > 0 ){
+ // Call to inputted number
+ LogsCall::callToNumber( callType, mDialpad->editor().text() );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsMatchesView::updateAddContactButton
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::updateAddContactButton()
+{
+ if (mAddToContactsButton) {
+ LOGS_QDEBUG( "logs [UI] <-> LogsMatchesView::updateAddContactButton()" );
+ bool matchesFound(model() && (model()->rowCount() > 0));
+ mAddToContactsButton->setVisible(!matchesFound
+ && mDialpad->isOpen()
+ && !mDialpad->editor().text().isEmpty());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logspageindicator.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* 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 <QGraphicsLinearLayout>
+
+#include "logspageindicator.h"
+#include "logspageindicatoritem.h"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsPageIndicator::LogsPageIndicator(QGraphicsItem *parent)
+ : HbWidget(parent),
+ mActiveItemIndex(-1)
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsPageIndicator::~LogsPageIndicator()
+{
+ qDeleteAll(mItems);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsPageIndicator::initialize(int itemCount, int activeItemIndex)
+{
+ qDeleteAll(mItems);
+ mItems.clear();
+ mActiveItemIndex = -1;
+
+ if (itemCount < 1 || activeItemIndex < 0 ||
+ itemCount <= activeItemIndex) {
+ return;
+ }
+
+ for (int i = 0; i < itemCount; ++i) {
+ mItems << new LogsPageIndicatorItem(i == activeItemIndex);
+ }
+ mActiveItemIndex = activeItemIndex;
+ layoutItems();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsPageIndicator::itemCount() const
+{
+ return mItems.count();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsPageIndicator::setActiveItemIndex(int activeItemIndex)
+{
+ if (activeItemIndex < 0 || itemCount() <= activeItemIndex) {
+ return;
+ }
+
+ mActiveItemIndex = activeItemIndex;
+ for (int i = 0; i < mItems.count(); ++i) {
+ mItems[i]->setActive(i == activeItemIndex);
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsPageIndicator::activeItemIndex() const
+{
+ return mActiveItemIndex;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsPageIndicator::layoutItems()
+{
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout;
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->addStretch();
+ foreach (LogsPageIndicatorItem *item, mItems) {
+ layout->addItem(item);
+ }
+ layout->addStretch();
+ setLayout(layout);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logspageindicatoritem.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* 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 <QGraphicsColorizeEffect>
+#include <QPropertyAnimation>
+
+#include "logspageindicatoritem.h"
+
+
+const char logsNormalIconName[] = "qtg_graf_hspage_normal";//"qtg_mono_tab_passive";//
+const char logsHighlightIconName[] = "qtg_graf_hspage_highlight";//"qtg_mono_tab_active";//
+
+const int logsEffectDurationInMs = 1000;
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsPageIndicatorItem::LogsPageIndicatorItem(bool active, QGraphicsItem *parent)
+ : HbIconItem(parent),
+ mIsActive(active)
+{
+ if (active) {
+ setIcon(HbIcon(logsHighlightIconName));
+ } else {
+ setIcon(HbIcon(logsNormalIconName));
+ }
+
+ QGraphicsColorizeEffect *effect = new QGraphicsColorizeEffect;
+ effect->setColor(Qt::white);
+ effect->setStrength(0);
+ effect->setEnabled(false);
+ setGraphicsEffect(effect);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsPageIndicatorItem::~LogsPageIndicatorItem()
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsPageIndicatorItem::setActive(bool active)
+{
+ if (mIsActive != active) {
+ mIsActive = active;
+ if (mIsActive) {
+ setIcon(HbIcon(logsHighlightIconName));
+ startAnimation();
+ } else {
+ setIcon(HbIcon(logsNormalIconName));
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsPageIndicatorItem::isActive() const
+{
+ return mIsActive;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsPageIndicatorItem::startAnimation()
+{
+ graphicsEffect()->setEnabled(true);
+ setTransformOriginPoint(rect().center());
+ QPropertyAnimation *animation =
+ new QPropertyAnimation(graphicsEffect(), "strength");
+ animation->setDuration(logsEffectDurationInMs);
+ animation->setKeyValueAt(0.2, 1);
+ animation->setEndValue(0);
+ connect(animation, SIGNAL(finished()), SLOT(animationFinished()));
+ animation->start(QAbstractAnimation::DeleteWhenStopped);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsPageIndicatorItem::animationFinished()
+{
+ graphicsEffect()->setEnabled(false);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logsrecentcallsview.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,724 @@
+/*
+* 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 "logsrecentcallsview.h"
+#include "logscomponentrepository.h"
+#include "logsabstractviewmanager.h"
+#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"
+
+//SYSTEM
+#include <hbview.h>
+#include <hblistview.h>
+#include <hbabstractviewitem.h>
+#include <hblabel.h>
+#include <hbmenu.h>
+#include <hbaction.h>
+#include <hbtoolbar.h>
+#include <dialpad.h>
+#include <hblineedit.h>
+#include <hbgroupbox.h>
+#include <hbmessagebox.h>
+#include <hbmainwindow.h>
+#include <QTimer>
+
+Q_DECLARE_METATYPE(LogsMatchesModel*)
+
+const int logsMissedCallsMarkingDelayMs = 1000;
+const int logsSwipeAngleDelta = 30; // angle is from 0 to 360
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::LogsRecentCallsView
+// -----------------------------------------------------------------------------
+//
+LogsRecentCallsView::LogsRecentCallsView(
+ LogsComponentRepository& repository, LogsAbstractViewManager& viewManager )
+ : LogsBaseView(LogsRecentViewId, repository, viewManager),
+ mViewName(0),
+ mListView(0),
+ mFilter(0),
+ mCurrentView(LogsServices::ViewAll),
+ mAppearingView(LogsServices::ViewAll),
+ mMoveLeftInList(false),
+ mEffectHandler(0),
+ mListViewX(0),
+ mMatchesModel(0),
+ mMarkingMissedAsSeen(false),
+ mPageIndicator(0),
+ mResetted(false)
+{
+ LOGS_QDEBUG( "logs [UI] <-> LogsRecentCallsView::LogsRecentCallsView()" );
+ mModel = mRepository.model();
+
+ //TODO: taking away due to toolbar bug. If toolbar visibility changes on view
+ //activation, there will be a crash due to previous view effect is playing
+ //addViewSwitchingEffects();
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::~LogsRecentCallsView
+// -----------------------------------------------------------------------------
+//
+LogsRecentCallsView::~LogsRecentCallsView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::~LogsRecentCallsView()" );
+
+ delete mMatchesModel;
+ mModel = 0;
+
+ delete mEffectHandler;
+ delete mFilter;
+
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::~LogsRecentCallsView()" );
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::activated
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::activated(bool showDialer, QVariant args)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::activated()" );
+ // base class handling first
+ LogsBaseView::activated(showDialer, args);
+
+ LogsServices::LogsView view = static_cast<LogsServices::LogsView>( args.toInt() );
+
+ // View update is needed when we activate view for the first time (!mFilter)
+ // or if view has to be changed
+ if ( !mFilter || ( !args.isNull() && (mCurrentView != view) ) ) {
+ updateView( view );
+ }
+ activateEmptyListIndicator(mFilter);
+
+ mDialpad->editor().setText(QString());
+
+ mPageIndicator->setActiveItemIndex(mConversionMap.value(mCurrentView));
+
+ if ( mResetted ){
+ // After reset, first data addition should cause scrolling to topitem
+ connect( mFilter, SIGNAL(rowsInserted(const QModelIndex&,int,int)),
+ this, SLOT(scrollToTopItem()) );
+ mResetted = false;
+ }
+
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::activated()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::deactivated
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::deactivated()
+{
+ //base class handling first
+ LogsBaseView::deactivated();
+
+ deactivateEmptyListIndicator(mFilter);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::handleExit()
+{
+ markMissedCallsSeen();
+ LogsBaseView::handleExit();
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::isExitAllowed
+// -----------------------------------------------------------------------------
+//
+bool LogsRecentCallsView::isExitAllowed()
+{
+ return !mMarkingMissedAsSeen;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::resetView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::resetView()" );
+ LogsBaseView::resetView();
+ mResetted = true;
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::resetView()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::initView
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::initView()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::initView()" );
+ //base class handling first
+ LogsBaseView::initView();
+
+ mViewName =
+ qobject_cast<HbGroupBox*>(mRepository.findWidget(logsGroupboxViewNameId));
+
+ addStringsToMap();
+ initListWidget();
+
+ mEffectHandler = new LogsEffectHandler;
+ connect(mEffectHandler, SIGNAL(dissappearByMovingComplete()),
+ this, SLOT(dissappearByMovingComplete()));
+ connect(mEffectHandler, SIGNAL(dissappearByFadingComplete()),
+ this, SLOT(dissappearByFadingComplete()));
+
+ mPageIndicator = qobject_cast<LogsPageIndicator*>
+ (mRepository.findWidget(logsPageIndicatorId));
+
+ mPageIndicator->initialize(mTitleMap.count(), mConversionMap.value(mCurrentView));
+
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::initView()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::model
+// -----------------------------------------------------------------------------
+//
+QAbstractItemModel* LogsRecentCallsView::model() const
+{
+ return mFilter;
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::callKeyPressed
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::callKeyPressed()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::callKeyPressed()" );
+ // Call to topmost item in current list
+ if ( mListView && mFilter && mFilter->hasIndex(0,0) ) {
+ QModelIndex topIndex = mFilter->index(0,0);
+ mListView->scrollTo( topIndex );
+ mListView->setCurrentIndex( topIndex, QItemSelectionModel::Select );
+ initiateCallback(topIndex);
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::callKeyPressed()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::markingCompleted
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::markingCompleted(int err)
+{
+ LOGS_QDEBUG_2( "logs [UI] -> LogsRecentCallsView::markingCompleted(), err", err );
+ Q_UNUSED(err);
+ mMarkingMissedAsSeen = false;
+ emit exitAllowed();
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::markingCompleted()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::openDialpad
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::openDialpad()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::openDialpad()" );
+ LogsBaseView::openDialpad();
+
+ // Create matches model already before any input to optimize
+ // first search
+ if ( !mMatchesModel ){
+ mMatchesModel = mModel->logsMatchesModel();
+ }
+
+ updateCallButton();
+
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::openDialpad()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::dialpadEditorTextChanged
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::dialpadEditorTextChanged()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::dialpadEditorTextChanged()" );
+ if ( mDialpad->editor().text().length() > 0 ) {
+ QVariant arg = qVariantFromValue( mMatchesModel );
+ if ( mViewManager.activateView( LogsMatchesViewId, true, arg ) ){
+ mMatchesModel = 0; // Ownership was given to matches view
+ }
+ } else {
+ updateCallButton();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::dialpadEditorTextChanged()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::clearList
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::clearList()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::clearList()->" );
+ if ( mFilter ) {
+ if ( askConfirmation( hbTrId("txt_dialer_ui_title_clear_list"),
+ hbTrId("txt_dialer_ui_info_all_call_events_will_be_remo"))){
+ mModel->clearList( mFilter->clearType() );
+ }
+ }
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::clearList()<-" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::updateView
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::updateView(LogsServices::LogsView view)
+{
+ LOGS_QDEBUG_2( "logs [UI] -> LogsRecentCallsView::updateView(), view:", view );
+ mCurrentView = view;
+ LogsFilter::FilterType filter = getFilter( view );
+ updateFilter(filter);
+ updateViewName();
+ updateContextMenuItems(mCurrentView);
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateView()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::changeFilter
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::changeFilter(HbAction* action)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::changeFilter()" );
+ LogsServices::LogsView view = mActionMap.key( action->objectName(),
+ LogsServices::ViewAll );
+ updateContextMenuItems(view);
+ changeView(view);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::changeFilter()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::handleBackSoftkey
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::handleBackSoftkey()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::handleBackSoftkey()" );
+ handleExit();
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::handleBackSoftkey()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::addStringsToMap
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::addStringsToMap()
+{
+ mTitleMap.insert(LogsBaseView::ViewAll, hbTrId("txt_dialer_subhead_recent_calls"));
+ mTitleMap.insert(LogsBaseView::ViewCalled, hbTrId("txt_dialer_subhead_dialled_calls"));
+ mTitleMap.insert(LogsBaseView::ViewReceived, hbTrId("txt_dial_subhead_received_calls"));
+ mTitleMap.insert(LogsBaseView::ViewMissed, hbTrId("txt_dialer_subhead_missed_calls"));
+
+ mConversionMap.insert(LogsServices::ViewAll, LogsBaseView::ViewAll);
+ mConversionMap.insert(LogsServices::ViewCalled, LogsBaseView::ViewCalled);
+ mConversionMap.insert(LogsServices::ViewReceived, LogsBaseView::ViewReceived);
+ mConversionMap.insert(LogsServices::ViewMissed, LogsBaseView::ViewMissed);
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::initListWidget
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::initListWidget()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::initListWidget()" );
+ mListView = qobject_cast<HbListView*>
+ ( mRepository.findWidget( logsListWidgetId ) );
+ Q_ASSERT_X(mListView != 0, "logs [UI] ", "couldn't find list widget !!");
+
+
+ // Optimize memory usage, list reserves only memory for visible items
+ mListView->setItemRecycling(true);
+
+ connect(mListView, SIGNAL(activated(const QModelIndex)),
+ this, SLOT(initiateCallback(const QModelIndex)));
+ connect(mListView,
+ SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)),
+ this,
+ SLOT(showListItemMenu(HbAbstractViewItem*, const QPointF&)));
+
+ mListView->setScrollingStyle(HbScrollArea::PanOrFlick);
+ mListView->setFrictionEnabled(true);
+
+ mListViewX = mListView->pos().x();
+
+ grabGesture(Qt::SwipeGesture);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::initListWidget() " );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::updateFilter
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::updateFilter(LogsFilter::FilterType type)
+{
+ if ( mListView ) {
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::updateFilter()" );
+
+ deactivateEmptyListIndicator(mFilter);
+
+ handleMissedCallsMarking();
+
+ delete mFilter;
+ mFilter = 0;
+ mFilter = new LogsFilter( type );
+ mFilter->setSourceModel( mModel );
+
+ mListView->setModel( mFilter );//ownership not transferred
+
+ scrollToTopItem();
+
+ activateEmptyListIndicator(mFilter);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateFilter() " );
+ } else {
+ LOGS_QWARNING( "logs [UI] LogsRecentCallsView::updateFilter(), !no list widget!" );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::updateViewName
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::updateViewName()
+{
+ if ( mViewName ) {
+ mViewName->setHeading( mTitleMap.value(mConversionMap.value(mCurrentView)));
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::updateContextMenuItems
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::updateContextMenuItems(LogsServices::LogsView view)
+{
+ LOGS_QDEBUG_2(
+ "logs [UI] -> LogsRecentCallsView::updateContextMenuItems(), view:", view );
+ if ( mShowFilterMenu ) {
+ QString activeActionName = mActionMap.value(view);
+ foreach (QAction* action, mShowFilterMenu->actions() ) {
+ action->setChecked( action->objectName() == activeActionName );
+ }
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateContextMenuItems()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::getFilter
+// -----------------------------------------------------------------------------
+//
+LogsFilter::FilterType LogsRecentCallsView::getFilter(LogsServices::LogsView view)
+{
+ LogsFilter::FilterType filter = LogsFilter::All;
+ switch (view){
+ case LogsServices::ViewAll:
+ filter = LogsFilter::All;
+ break;
+ case LogsServices::ViewReceived:
+ filter = LogsFilter::Received;
+ break;
+ case LogsServices::ViewCalled:
+ filter = LogsFilter::Called;
+ break;
+ case LogsServices::ViewMissed:
+ filter = LogsFilter::Missed;
+ break;
+ default:
+ break;
+ }
+ return filter;
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::gestureEvent
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::gestureEvent(QGestureEvent *event)
+{
+ QGesture* gesture = event->gesture(Qt::SwipeGesture);
+ if (gesture) {
+ QSwipeGesture* swipe = static_cast<QSwipeGesture *>(gesture);
+ if (swipe->state() == Qt::GestureFinished) {
+ QSwipeGesture::SwipeDirection direction = swipeAngleToDirection(
+ swipe->swipeAngle(), logsSwipeAngleDelta);
+ if (mViewManager.mainWindow().orientation() == Qt::Vertical) {
+ if (direction == QSwipeGesture::Left) {
+ leftFlick();
+ event->accept(Qt::SwipeGesture);
+ } else if (direction == QSwipeGesture::Right) {
+ rightFlick();
+ event->accept(Qt::SwipeGesture);
+ }
+ } else {
+ if (direction == QSwipeGesture::Down) {
+ rightFlick();
+ event->accept(Qt::SwipeGesture);
+ } else if (direction == QSwipeGesture::Up) {
+ leftFlick();
+ event->accept(Qt::SwipeGesture);
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::swipeAngleToDirection
+// -----------------------------------------------------------------------------
+//
+QSwipeGesture::SwipeDirection LogsRecentCallsView::swipeAngleToDirection(
+ int angle, int delta)
+{
+ QSwipeGesture::SwipeDirection direction(QSwipeGesture::NoDirection);
+ if ((angle > 90-delta) && (angle < 90+delta)) {
+ direction = QSwipeGesture::Up;
+ } else if ((angle > 270-delta) && (angle < 270+delta)) {
+ direction = QSwipeGesture::Down;
+ } else if (((angle >= 0) && (angle < delta))
+ || ((angle > 360-delta) && (angle <= 360))) {
+ direction = QSwipeGesture::Right;
+ } else if ((angle > 180-delta) && (angle < 180+delta)) {
+ direction = QSwipeGesture::Left;
+ }
+ LOGS_QDEBUG_4( "logs [UI] LogsRecentCallsView::swipeAngleToDirection() angle: ",
+ angle, " direction: ", direction );
+ return direction;
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::leftFlick
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::leftFlick()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::leftFlick()" );
+ if ( mConversionMap.value(mCurrentView) + 1 < mTitleMap.count() ){
+ LogsBaseView::LogsViewMap viewmap =
+ static_cast<LogsBaseView::LogsViewMap>(mConversionMap.value(mCurrentView) +1);
+ changeView( mConversionMap.key(viewmap) );
+ } else {
+ if (model() && model()->rowCount() > 0) {
+ mEffectHandler->startMoveNotPossibleEffect(*mListView, false, mListViewX);
+ } else {
+ mEffectHandler->startMoveNotPossibleEffect(*mEmptyListLabel, false, mListViewX);
+ }
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::leftFlick()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::rightFlick
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::rightFlick()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::rightFlick()" );
+ if ( mConversionMap.value(mCurrentView) > 0 ){
+ LogsBaseView::LogsViewMap viewmap =
+ static_cast<LogsBaseView::LogsViewMap>(mConversionMap.value(mCurrentView) - 1);
+ changeView( mConversionMap.key(viewmap) );
+ } else {
+ if (model() && model()->rowCount() > 0) {
+ mEffectHandler->startMoveNotPossibleEffect(*mListView, true, mListViewX);
+ } else {
+ mEffectHandler->startMoveNotPossibleEffect(*mEmptyListLabel, true, mListViewX);
+ }
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::rightFlick()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::changeView
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::changeView(LogsServices::LogsView view)
+{
+ LOGS_QDEBUG_2( "logs [UI] -> LogsRecentCallsView::changeView(), view:", view );
+
+ if ( view == mCurrentView ){
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::changeView(), view already correct" );
+ // Already correct view, running animation can continue but make sure that
+ // appearing view is then correct.
+ mAppearingView = view;
+ return;
+ }
+
+ mMoveLeftInList = mConversionMap.value(view) < mConversionMap.value(mCurrentView);
+
+ mAppearingView = view;
+ mEffectHandler->startDissappearAppearByFadingEffect(*mViewName);
+ mEffectHandler->startDissappearAppearByMovingEffect(
+ *mListView, *mEmptyListLabel, !mMoveLeftInList, mListViewX);
+
+ mPageIndicator->setActiveItemIndex(mConversionMap.value(mAppearingView));
+
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::changeView()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::dissappearByFadingComplete()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::dissappearByFadingComplete()" )
+
+ // Previous view name has dissappeared by fading, set new view name
+ // as it is brought visible by effect
+ mViewName->setHeading( mTitleMap.value(mConversionMap.value(mAppearingView)) );
+
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::dissappearByFadingComplete()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::dissappearByMovingComplete()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::dissappearByMovingComplete()" )
+
+ updateView( mAppearingView );
+
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::dissappearByMovingComplete()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::updateMenu
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::updateMenu()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::updateMenu()" );
+ HbAction* action = qobject_cast<HbAction*>(
+ mRepository.findObject( logsRecentViewClearListMenuActionId ) );
+ if ( action && model() ) {
+ bool visible( model()->rowCount() > 0 );
+ action->setVisible( visible );
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateMenu()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::updateEmptyListWidgetsVisibility
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::updateEmptyListWidgetsVisibility()
+{
+ updateMenu();
+ updateEmptyListLabelVisibility();
+ updateCallButton();
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::updateWidgetsSizeAndLayout
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::updateWidgetsSizeAndLayout()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::updateWidgetsSizeAndLayout()" );
+ if ( mListView ) {
+ updateListLayoutName(*mListView);
+ updateListSize();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateWidgetsSizeAndLayout()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::updateCallButton
+// If dialpad contains text or there is items in list, call button is enabled
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::updateCallButton()
+{
+ bool isVisible = !mDialpad->editor().text().isEmpty();
+ if ( !isVisible && mFilter ) {
+ isVisible = ( mFilter->rowCount() > 0 );
+ }
+ mDialpad->setCallButtonEnabled( isVisible );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::handleMissedCallsMarking
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::handleMissedCallsMarking()
+{
+ if ( mFilter && !mMarkingMissedAsSeen && !mResetted &&
+ ( mFilter->filterType() == LogsFilter::Missed ||
+ mFilter->filterType() == LogsFilter::All ) ){
+ // Don't care if timer would be already running, slot's implementation
+ // takes care that marking is done only once
+ LOGS_QDEBUG( "logs [UI] <-> LogsRecentCallsView::handleMissedCallsMarking()" );
+ QTimer::singleShot(
+ logsMissedCallsMarkingDelayMs, this, SLOT(markMissedCallsSeen()) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::markMissedCallsSeen
+// -----------------------------------------------------------------------------
+//
+bool LogsRecentCallsView::markMissedCallsSeen()
+{
+ if ( !mMarkingMissedAsSeen ){
+ connect( mModel, SIGNAL(markingCompleted(int)),
+ this, SLOT(markingCompleted(int)) );
+ mMarkingMissedAsSeen =
+ mModel->markEventsSeen(LogsModel::TypeLogsClearMissed);
+ }
+ return mMarkingMissedAsSeen;
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::scrollToTopItem
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::scrollToTopItem()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::scrollToTopItem()" );
+ disconnect( mFilter, SIGNAL(rowsInserted(const QModelIndex&,int,int)),
+ this, SLOT(scrollToTopItem()));
+ if ( mFilter && mFilter->hasIndex(0,0) ) {
+ mListView->scrollTo( mFilter->index(0,0) );
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::scrollToTopItem()" );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logsservicehandler.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* 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 "logsservicehandler.h"
+#include "logslogger.h"
+#include "logsmainwindow.h"
+#include <xqserviceutil.h>
+
+//SYSTEM
+
+// -----------------------------------------------------------------------------
+// LogsService::LogsService
+// -----------------------------------------------------------------------------
+//
+LogsServiceHandler::LogsServiceHandler(LogsMainWindow& mainWindow)
+ : XQServiceProvider(QLatin1String("com.nokia.services.logsservices.starter"),0),
+ mActivatedView(0),
+ mMainWindow(mainWindow)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsServiceHandler::LogsServiceHandler()" )
+
+ publishAll();
+ mIsAppStartedUsingService = XQServiceUtil::isService();
+
+ LOGS_QDEBUG_2(
+ "logs [UI] <- LogsServiceHandler::LogsServiceHandler(), is service",
+ mIsAppStartedUsingService )
+}
+
+// -----------------------------------------------------------------------------
+// LogsServiceHandler::~LogsServiceHandler
+// -----------------------------------------------------------------------------
+//
+LogsServiceHandler::~LogsServiceHandler()
+{
+ LOGS_QDEBUG( "logs [UI] <-> LogsServiceHandler::~LogsServiceHandler()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsServiceHandler::start
+// -----------------------------------------------------------------------------
+//
+int LogsServiceHandler::start(int activatedView, bool showDialpad)
+{
+ LOGS_QDEBUG_2( "logs [UI] -> LogsServiceHandler::start(), view:", activatedView )
+
+ if ( activatedView < LogsServices::ViewAll ||
+ activatedView > LogsServices::ViewMissed ){
+ LOGS_QDEBUG( "logs [UI] <- LogsServiceHandler::start(), incorrect view" )
+ return -1;
+ }
+ mIsAppStartedUsingService = true;
+ mActivatedView = activatedView;
+
+ LOGS_QDEBUG( "logs [UI] Bring app to foreground" )
+ mMainWindow.bringAppToForeground();
+
+ emit activateView((LogsServices::LogsView)mActivatedView, showDialpad);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsServiceHandler::start()" )
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// LogsServiceHandler::startWithNum
+// -----------------------------------------------------------------------------
+//
+int LogsServiceHandler::startWithNum(int activatedView, bool showDialpad, QString dialpadText)
+{
+ LOGS_QDEBUG_2( "logs [UI] -> LogsServiceHandler::startWithNum(), view:", activatedView )
+
+ Q_UNUSED(showDialpad);
+
+ if ( activatedView < LogsServices::ViewAll ||
+ activatedView > LogsServices::ViewMissed ){
+ LOGS_QDEBUG( "logs [UI] <- LogsServiceHandler::startWithNum(), incorrect view" )
+ return -1;
+ }
+ mIsAppStartedUsingService = true;
+ mActivatedView = activatedView;
+
+ LOGS_QDEBUG( "logs [UI] Bring app to foreground" )
+ mMainWindow.bringAppToForeground();
+
+ emit activateView(dialpadText);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsServiceHandler::startWithNum()" )
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// LogsServiceHandler::currentlyActivatedView
+// -----------------------------------------------------------------------------
+//
+LogsServices::LogsView LogsServiceHandler::currentlyActivatedView()
+{
+ return (LogsServices::LogsView)mActivatedView;
+}
+
+// -----------------------------------------------------------------------------
+// LogsServiceHandler::isStartedUsingService
+// -----------------------------------------------------------------------------
+//
+bool LogsServiceHandler::isStartedUsingService() const
+{
+ return mIsAppStartedUsingService;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/logsviewmanager.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,335 @@
+/*
+* 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 "logsviewmanager.h"
+#include "logscomponentrepository.h"
+#include "logsrecentcallsview.h"
+#include "logsmatchesview.h"
+#include "logsdetailsview.h"
+#include "logsfilter.h"
+#include "logsdefs.h"
+#include "logslogger.h"
+#include "logsservicehandler.h"
+#include "logsmainwindow.h"
+
+//SYSTEM
+#include <hbmainwindow.h>
+#include <hbview.h>
+#include <logsservices.h>
+#include <QApplication>
+#include <hblineedit.h>
+#include <dialpad.h>
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::LogsViewManager
+// -----------------------------------------------------------------------------
+//
+LogsViewManager::LogsViewManager(
+ LogsMainWindow& mainWindow, LogsServiceHandler& service ) :
+ QObject( 0 ), mMainWindow( mainWindow ), mService( service ),
+ mFirstActivation(true), mViewActivationShowDialpad(false)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::LogsViewManager()" );
+
+ //It is important that we always handle orientation change first, before
+ //dialpad widget. If connection is moved to a view, then it's not guarantied.
+ connect( &mainWindow, SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(handleOrientationChanged()) );
+
+ mComponentsRepository = new LogsComponentRepository(*this);
+ initViews();
+
+ connect( &mService, SIGNAL( activateView(LogsServices::LogsView, bool) ),
+ this, SLOT( changeRecentView(LogsServices::LogsView, bool) ) );
+
+ connect( &mService, SIGNAL( activateView(QString) ),
+ this, SLOT( changeMatchesView(QString) ));
+
+ connect( &mMainWindow, SIGNAL(appFocusGained()), this, SLOT(appFocusGained()) );
+ connect( &mMainWindow, SIGNAL(appFocusLost()), this, SLOT(appFocusLost()) );
+
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::LogsViewManager()" );
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::~LogsViewManager
+// -----------------------------------------------------------------------------
+//
+LogsViewManager::~LogsViewManager()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::~LogsViewManager()" );
+
+ delete mComponentsRepository;
+
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::~LogsViewManager()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::initViews
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::initViews()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::initViews()" );
+
+ // Disable view switching as otherwise flick gestures change
+ // views which is not desired.
+ //Deprecated:
+ //mMainWindow.setViewSwitchingEnabled(false);
+
+ // Don't activate any view, app focus gaining or service request
+ // will cause view activation
+ //
+ LogsRecentCallsView* view = mComponentsRepository->recentCallsView();
+ Q_ASSERT_X(view != 0, "logs [UI] ", "recentCallsView not found!");
+ LOGS_QDEBUG( "logs [UI] adding view" );
+ mViewStack.append(view);
+ mMainWindow.addView(view);
+
+ LogsDetailsView* detailsView = mComponentsRepository->detailsView();
+ mViewStack.append(detailsView);
+ mMainWindow.addView(detailsView);
+
+ LogsMatchesView* matchesView = mComponentsRepository->matchesView();
+ mViewStack.append(matchesView);
+ mMainWindow.addView(matchesView);
+
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::initViews()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::changeRecentView
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::changeRecentView(LogsServices::LogsView view, bool showDialpad)
+{
+ QVariant args(view);
+ doActivateView(LogsRecentViewId, showDialpad, args);
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::changeMatchesView
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::changeMatchesView(QString dialpadText)
+{
+ Dialpad* dialpad = mComponentsRepository->dialpad();
+ dialpad->editor().setText(dialpadText);
+ doActivateView(LogsMatchesViewId, true, QVariant());
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::appFocusGained
+// Activate recent view if gaining focus first time and app was not started
+// via highway service. If app was started by using service request,
+// wait the request to appear before activating view.
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::appFocusGained()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::appFocusGained()" );
+
+ foreach ( LogsBaseView* view, mViewStack ){
+ disconnect( view, SIGNAL(exitAllowed()), this, SLOT(proceedExit()) );
+ }
+
+ if ( mFirstActivation && !mService.isStartedUsingService() ){
+ changeRecentView( mService.currentlyActivatedView(), false );
+ mMainWindow.bringAppToForeground();
+ }
+
+ mComponentsRepository->model()->refreshData();
+
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::appFocusGained()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::appFocusLost
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::appFocusLost()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::appFocusLost()" );
+
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::appFocusLost()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::proceedExit
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::proceedExit()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::proceedExit()" );
+
+ mComponentsRepository->model()->compressData();
+
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::proceedExit()" );
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::activateView
+// -----------------------------------------------------------------------------
+//
+bool LogsViewManager::activateView(LogsAppViewId viewId)
+{
+ return doActivateView(viewId, false, QVariant());
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::activateView
+// -----------------------------------------------------------------------------
+//
+bool LogsViewManager::activateView(
+ LogsAppViewId viewId, bool showDialpad, QVariant args)
+{
+ return doActivateView(viewId, showDialpad, args);
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::mainWindow
+// -----------------------------------------------------------------------------
+//
+HbMainWindow& LogsViewManager::mainWindow()
+{
+ return mMainWindow;
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::exitApplication
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::exitApplication()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::exitApplication()" );
+
+ LOGS_QDEBUG( "logs [UI] Exit delayed" );
+
+ // Fake exit by sending app to background
+ mMainWindow.sendAppToBackground();
+
+ // Set application to default state (recent calls and no dialpad)
+ activateView( LogsRecentViewId, false, QVariant() );
+ mComponentsRepository->recentCallsView()->resetView();
+
+ bool exitAllowed( true );
+ foreach ( LogsBaseView* view, mViewStack ){
+ if ( !view->isExitAllowed() ){
+ exitAllowed = false;
+ connect( view, SIGNAL(exitAllowed()), this, SLOT(proceedExit()) );
+ }
+ }
+ if ( exitAllowed ){
+ LOGS_QDEBUG( "logs [UI] Handle exit immediataly" );
+ proceedExit();
+ } else {
+ // Just wait for signal from view(s) that exiting can proceed
+ LOGS_QDEBUG( "logs [UI] Delayed exit handling" );
+ }
+
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::exitApplication()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::activatePreviousView
+// Previously activated view is at slot 1 of view stack
+// -----------------------------------------------------------------------------
+//
+bool LogsViewManager::activatePreviousView()
+{
+ if ( mViewStack.count() < 2 ){
+ return false;
+ }
+ return doActivateView(mViewStack.at(1)->viewId(), false, QVariant());
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::doActivateView
+// Currently activated view is always at beginning of view stack. Deactivates
+// previously activated view and activates new view and place it at top of
+// view stack.
+// -----------------------------------------------------------------------------
+//
+bool LogsViewManager::doActivateView(
+ LogsAppViewId viewId, bool showDialpad, QVariant args)
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::doActivateView()" );
+
+ bool activated(false);
+ LogsBaseView* newView = 0;
+ LogsBaseView* oldView = mViewStack.count() > 0 ? mViewStack.at(0) : 0;
+
+ for ( int i = 0; i < mViewStack.count(); ++i ){
+ if ( mViewStack.at(i)->viewId() == viewId ){
+ newView = mViewStack.takeAt(i);
+ }
+ }
+
+ if ( oldView && newView && oldView != newView ){
+ oldView->deactivated();
+ disconnect( &mMainWindow, SIGNAL( callKeyPressed() ), oldView, 0 );
+ }
+
+ if ( newView ){
+ mViewStack.insert(0, newView);
+ mMainWindow.setCurrentView(newView);
+ mViewActivationArgs = args;
+ mViewActivationShowDialpad = showDialpad;
+ completeViewActivation();
+ activated = true;
+ }
+
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::doActivateView()" );
+
+ return activated;
+}
+
+// -----------------------------------------------------------------------------
+// LogsViewManager::completeViewActivation
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::completeViewActivation()
+{
+ LOGS_QDEBUG_2( "logs [UI] -> LogsViewManager::completeViewActivation(), first",
+ mFirstActivation );
+ if ( mFirstActivation ){
+ mFirstActivation = false;
+ connect( &mMainWindow, SIGNAL(viewReady()), this, SLOT(completeViewActivation()) );
+ } else {
+ disconnect( &mMainWindow, SIGNAL(viewReady()), this, SLOT(completeViewActivation()) );
+ LogsBaseView* newView = mViewStack.at(0);
+ newView->activated(mViewActivationShowDialpad, mViewActivationArgs);
+ connect( &mMainWindow, SIGNAL( callKeyPressed() ), newView, SLOT( callKeyPressed() ) );
+
+ // First activation completed, clear counter
+ mComponentsRepository->model()->clearMissedCallsCounter();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::completeViewActivation()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsViewManager::handleOrientationChanged()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::handleOrientationChanged()" );
+ QMetaObject::invokeMethod(mMainWindow.currentView(), "handleOrientationChanged");
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::handleOrientationChanged()" );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/src/main.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* 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 "logsmainwindow.h"
+#include "logsviewmanager.h"
+#include "logsservicehandler.h"
+#include "logslogger.h"
+#include "logsdefs.h"
+
+//SYSTEM
+#include <QObject>
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <hbstyleloader.h>
+#include <QTranslator>
+
+int main(int argc, char *argv[])
+{
+ LOGS_QDEBUG( "logs [UI] -> main()" )
+
+ HbApplication app(argc, argv);
+ LogsMainWindow window;
+
+ QString lang = QLocale::system().name();
+ QString path = "z:/resource/qt/translations/";
+ //Load common translator
+ QTranslator commontranslator;
+ bool returncode = false;
+ LOGS_QDEBUG("logs [UI] loading common strings translator");
+ returncode = commontranslator.load( path + "common_" + lang + ".qm");
+ if (returncode==false) {
+ LOGS_QDEBUG("logs [UI] unable to open file: " + path + "common_" + lang + ".qm");
+ } else {
+ app.installTranslator(&commontranslator);
+ }
+
+ //Load application-specific translator
+ QTranslator translator;
+ LOGS_QDEBUG("logs [UI] loading application strings translator");
+ LOGS_QDEBUG("logs [UI] translation filename dialer_" + lang + ".qm");
+ returncode = translator.load( path + "dialer_" + lang + ".qm");
+ if (returncode==false) {
+ LOGS_QDEBUG("logs [UI] .qm file not found from "+path);
+ path = ":/";
+ returncode = translator.load( path + "logs_default.qm");
+ LOGS_QDEBUG("logs [UI]: fallback to default language file logs_default.qm");
+ }
+
+ if (returncode==false) {
+ LOGS_QDEBUG( "logs [UI] .qm file not found from "+path);
+ } else {
+ LOGS_QDEBUG( "logs [UI] .qm loaded successfully from "+path);
+ }
+
+ app.installTranslator(&translator);
+ HbStyleLoader::registerFilePath(":/logslayouts");
+
+ // Create service handler asap so that services are published fast.
+ // Servicehandler cannot be created before HbApplication creation.
+ // This can cause problem of service request not coming through if
+ // HbApplication creation takes long time.
+ LogsServiceHandler service(window);
+ LogsViewManager viewManager(window, service);
+
+ // Don't show window yet as app might be started at background
+ int err = app.exec();
+
+ HbStyleLoader::unregisterFilePath(":/logslayouts");
+
+ LOGS_QDEBUG( "logs [UI] <- main()" )
+ return err;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/logsviewmanagerstub.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* 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 LOGSVIEWMANAGERSTUB_H
+#define LOGSVIEWMANAGERSTUB_H
+
+#include <QVariant>
+#include <hbmainwindow.h>
+#include "logsdefs.h"
+#include "logsabstractviewmanager.h"
+
+
+class LogsViewManagerStub : public LogsAbstractViewManager
+{
+public:
+ LogsViewManagerStub(HbMainWindow& window) : mMainWindow(window),
+ mViewId( LogsUnknownViewId ), mShowDialer(false),
+ mArgs(QVariant()), mPreviousActivated(false), mExitCalled(false)
+ {
+ }
+
+ virtual ~LogsViewManagerStub()
+ {
+ }
+
+ void reset()
+ {
+ mViewId = LogsUnknownViewId;
+ mShowDialer = false;
+ mArgs = QVariant();
+ mPreviousActivated = false;
+ mExitCalled = false;
+ }
+
+public: // From LogsAbstractViewManager
+
+ virtual bool activateView(LogsAppViewId viewId)
+ {
+ mViewId = viewId;
+ return true;
+ }
+ virtual bool activateView(LogsAppViewId viewId, bool showDialer, QVariant args)
+ {
+ mViewId = viewId;
+ mShowDialer = showDialer;
+ mArgs = args;
+ return true;
+ }
+ virtual bool activatePreviousView()
+ {
+ mPreviousActivated = true;
+ return true;
+ }
+
+ virtual HbMainWindow& mainWindow()
+ {
+ return mMainWindow;
+ }
+
+ virtual void exitApplication()
+ {
+ mExitCalled = true;
+ }
+
+public:
+
+ LogsAppViewId mViewId;
+ bool mShowDialer;
+ QVariant mArgs;
+ bool mPreviousActivated;
+ HbMainWindow& mMainWindow;
+ bool mExitCalled;
+
+};
+
+#endif //LOGSVIEWMANAGERSTUB_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsbaseview.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* 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_LOGSBASEVIEW_H
+#define UT_LOGSBASEVIEW_H
+
+
+#include <QObject>
+#include "logsviewmanagerstub.h"
+
+class LogsBaseView;
+class LogsComponentRepository;
+class HbMainWindow;
+
+
+class UT_LogsBaseView : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+
+private slots: //test methods
+
+ void testConstructor();
+ void testActivated();
+ void testDeactivated();
+ void testResetView();
+ void testShowFilterMenu();
+ void testOpenDialpad();
+ void testSetDialpadPostion();
+ void testDialpadClosed();
+ void testDialpadEditorTextChanged();
+ void testChangeFilter();
+ void testOpenContactsApp();
+ void testModel();
+ void testInitiateCall();
+ void testInitiateCallback();
+ void testShowListItemMenu();
+ void testPopulateListItemMenu();
+ void testCloseEmptyMenu();
+ void testSaveContact();
+ void testUpdateCall();
+ void testUpdateMessage();
+ void testUpdateContact();
+ void testActivateEmptyListIndicator();
+ void testDeactivateEmptyListIndicator();
+ void testUpdateEmptyListLabelVisibility();
+ void testUpdateListLayoutName();
+ void testUpdateListSize();
+ void testHandleOrientationChanged();
+ void testHandleExit();
+ void testIsExitAllowed();
+
+private:
+
+ LogsBaseView* mBaseView;
+ LogsComponentRepository* mRepository;
+ HbMainWindow* mMainWindow;
+ LogsViewManagerStub* mViewManager;
+};
+
+#endif //UT_LogsBaseView_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logscomponentrepository.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,67 @@
+
+/*
+* 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_LOGSCOMPONENTREPOSITORY_H
+#define UT_LOGSCOMPONENTREPOSITORY_H
+
+
+#include <QObject>
+#include "logsviewmanagerstub.h"
+
+class LogsComponentRepository;
+class HbMainWindow;
+
+class UT_LogsComponentRepository : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+
+private slots: //test methods
+
+ void testConstructor();
+ void testRecentCallsView();
+ void testDetailsView();
+ void testMatchesView();
+ void testDialpad();
+ void testLoadSection();
+ void testAddToolbarToObjectList();
+
+private:
+
+ HbMainWindow* mMainWindow;
+ LogsComponentRepository* mRepository;
+ LogsViewManagerStub* mViewManager;
+};
+
+#endif //UT_LOGSCOMPONENTREPOSITORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsdetailsview.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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_LOGSDETAILSVIEW_H
+#define UT_LOGSDETAILSVIEW_H
+
+
+#include <QObject>
+#include "logsviewmanagerstub.h"
+
+class LogsDetailsView;
+class LogsComponentRepository;
+class HbMainWindow;
+
+
+class UT_LogsDetailsView : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+
+private slots: //test methods
+
+ void testConstructor();
+ void testActivated();
+ void testDeactivated();
+ void testHandleBackSoftkey();
+ void testCallKeyPressed();
+ void testInitiateVoiceCall();
+ void testInitiateVideoCall();
+ void testUpdateMenu();
+ void testDeleteEvent();
+ void testCopyNumberToClipboard();
+ void testChangeFilter();
+ void testContactActionCompleted();
+ void testModel();
+ void testUpdateWidgetsSizeAndLayout();
+
+private:
+
+ LogsDetailsView* mDetailsView;
+ LogsComponentRepository* mRepository;
+ HbMainWindow* mMainWindow;
+ LogsViewManagerStub* mViewManager;
+};
+
+#endif //UT_LOGSDETAILSVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logseffecthandler.h Tue May 04 12:39:37 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 UT_LOGSEFFECTHANDLER_H
+#define UT_LOGSEFFECTHANDLER_H
+
+
+#include <QObject>
+
+class LogsEffectHandler;
+class HbLabel;
+class HbMainWindow;
+
+class UT_LogsEffectHandler : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+
+private slots: //test methods
+
+ void testConstructor();
+ void testStartDissappearAppearByFadingEffect();
+ void testStartDissappearAppearByMovingEffect();
+ void testStartMoveNotPossibleEffect();
+
+private:
+
+ LogsEffectHandler* mEffect;
+ HbLabel* mLabel;
+ HbLabel* mLabel2;
+ HbMainWindow* mMainWindow;
+};
+
+#endif //UT_LOGSEFFECTHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsmainwindow.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,59 @@
+
+/*
+* 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_LOGSMAINWINDOW_H
+#define UT_LOGSMAINWINDOW_H
+
+
+#include <QObject>
+
+class LogsMainWindow;
+
+class UT_LogsMainWindow : 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 testKeyPressEvent();
+ void testSendAppToBackground();
+ void testBringAppToForeground();
+
+private:
+
+ LogsMainWindow* mMainWindow;
+};
+
+#endif //UT_LOGSMAINWINDOW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsmatchesview.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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_LOGSMATCHESVIEW_H
+#define UT_LOGSMATCHESVIEW_H
+
+
+#include <QObject>
+#include "logsviewmanagerstub.h"
+
+class LogsMatchesView;
+class LogsComponentRepository;
+class HbMainWindow;
+
+
+class UT_LogsMatchesView : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+
+private slots: //test methods
+
+ void testConstructor();
+ void testActivated();
+ void testDeactivated();
+ void testCallKeyPressed();
+ void testVideoCallToCurrentNum();
+ void testSendMessageToCurrentNum();
+ void testSaveNumberInDialpadToContacts();
+ void testDialpadEditorTextChanged();
+ void testDialpadClosed();
+ void testDialpadOpened();
+ void testModel();
+ void testUpdateWidgetsSizeAndLayout();
+ void testHandleOrientationChanged();
+ void testUpdateEmptyListWidgetsVisibility();
+ void testUpdateAddContactButton();
+
+private:
+
+ LogsMatchesView* mMatchesView;
+ LogsComponentRepository* mRepository;
+ HbMainWindow* mMainWindow;
+ LogsViewManagerStub* mViewManager;
+};
+
+#endif //UT_LOGSMATCHESVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logspageindicator.h Tue May 04 12:39:37 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 UT_LOGSPAGEINDICATOR_H
+#define UT_LOGSPAGEINDICATOR_H
+
+
+#include <QObject>
+
+class LogsPageIndicator;
+
+class UT_LogsPageIndicator : 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 testInitialize();
+ void testSetActiveItemIndex();
+
+private:
+
+ LogsPageIndicator* mIndicator;
+};
+
+#endif //UT_LOGSPAGEINDICATOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logspageindicatoritem.h Tue May 04 12:39:37 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_LOGSPAGEINDICATORITEM_H
+#define UT_LOGSPAGEINDICATORITEM_H
+
+
+#include <QObject>
+
+class LogsPageIndicatorItem;
+
+class UT_LogsPageIndicatorItem : 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 testConstructorDestructor();
+ void testSetActive();
+ void testAnimationFinnished();
+
+private:
+
+ LogsPageIndicatorItem* mIndicatorItem;
+};
+
+#endif //UT_LOGSVIEWMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsrecentcallsview.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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_LOGSRECENTCALLSVIEW_H
+#define UT_LOGSRECENTCALLSVIEW_H
+
+
+#include <QObject>
+#include "logsviewmanagerstub.h"
+
+class LogsRecentCallsView;
+class LogsComponentRepository;
+class HbMainWindow;
+class QModelIndex;
+
+class UT_LogsRecentCallsView : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+
+private slots: //test methods
+
+ void testConstructor();
+ void testInitView();
+ void testActivated();
+ void testDeactivated();
+ void testResetView();
+ void testInitListWidget();
+ void testUpdateFilter();
+ void testUpdateViewName();
+ void testChangeFilter();
+ void testInitiateCallback();
+ void testCallKeyPressed();
+ void testShowCallDetails();
+ void testOpenDialpad();
+ void testDialpadEditorTextChanged();
+ void testGestureEvent();
+ void testSwipeAngleToDirection();
+ void testViewChangeByFlicking();
+ void testModel();
+ void testShowListItemMenu();
+ void testUpdateListItemData();
+ void testPopulateListItemMenu();
+ void testUpdateCall();
+ void testUpdateMessage();
+ void testUpdateContact();
+ void testActivateEmptyListIndicator();
+ void testUpdateMenu();
+ void testUpdateWidgetsSizeAndLayout();
+ void testDialpadClosed();
+ void testClearList();
+ void testIsExitAllowed();
+
+private: //helper functions
+
+ inline QModelIndex makeValidFilterIndex(LogsRecentCallsView& view);
+
+private:
+
+ LogsRecentCallsView* mRecentCallsView;
+ LogsComponentRepository* mRepository;
+ HbMainWindow* mMainWindow;
+ LogsViewManagerStub* mViewManager;
+};
+
+#endif //UT_LOGSRECENTCALLSVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsservicehandler.h Tue May 04 12:39:37 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 UT_LOGSSERVICEHANDLER_H
+#define UT_LOGSSERVICEHANDLER_H
+
+
+#include <QObject>
+
+class LogsServiceHandler;
+
+class LogsViewManager;
+class LogsMainWindow;
+
+
+class UT_LogsServiceHandler : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+
+private slots: //test methods
+
+ void testConstructor();
+ void testStart();
+ void testStartWithNum();
+
+private:
+
+ LogsServiceHandler* mService;
+ LogsMainWindow* mMainWindow;
+ LogsViewManager* mLogsViewManager;
+};
+
+#endif //UT_LOGSSERVICEHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsviewmanager.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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_LOGSVIEWMANAGER_H
+#define UT_LOGSVIEWMANAGER_H
+
+
+#include <QObject>
+
+class HbMainWindow;
+class LogsViewManager;
+class LogsMainWindow;
+
+class UT_LogsViewManager : 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 testConstructorDestructor();
+ void testActivateView();
+ void testchangeMatchesView();
+ void testExitApplication();
+ void testAppFocusGained();
+ void testStartingWithService();
+ void testHandleOrientationChanged();
+ void testCompleteViewActivation();
+
+private:
+
+ LogsMainWindow* mMainWindow;
+ LogsViewManager* mLogsViewManager;
+};
+
+#endif //UT_LOGSVIEWMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsabstractmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* 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 "logsabstractmodel.h"
+#include "logsdbconnector.h"
+#include "logsevent.h"
+#include "logslogger.h"
+#include "logscall.h"
+#include "logscontact.h"
+#include "logsengdefs.h"
+#include "logsmessage.h"
+
+Q_DECLARE_METATYPE(LogsEvent *)
+Q_DECLARE_METATYPE(LogsCall *)
+Q_DECLARE_METATYPE(LogsMessage *)
+Q_DECLARE_METATYPE(LogsContact *)
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsAbstractModel::LogsAbstractModel() : QAbstractListModel(), mDbConnector(0)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsAbstractModel::LogsAbstractModel()" )
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsAbstractModel::LogsAbstractModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsAbstractModel::~LogsAbstractModel()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsAbstractModel::~LogsAbstractModel()" )
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsAbstractModel::~LogsAbstractModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariant LogsAbstractModel::doGetData(int role, LogsModelItemContainer& item) const
+{
+ Q_UNUSED(role);
+ Q_UNUSED(item);
+ return QVariant();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariant LogsAbstractModel::createCall(LogsModelItemContainer& item) const
+{
+ Q_UNUSED(item);
+ return QVariant();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariant LogsAbstractModel::createMessage(LogsModelItemContainer& item) const
+{
+ Q_UNUSED(item);
+ return QVariant();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariant LogsAbstractModel::createContact(LogsModelItemContainer& item) const
+{
+ Q_UNUSED(item);
+ return QVariant();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QString LogsAbstractModel::directionIconName(const LogsEvent& event)
+{
+ Q_UNUSED(event);
+ QString direction;
+ return direction;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QString LogsAbstractModel::typeIconName(const LogsEvent& event)
+{
+ Q_UNUSED(event);
+ QString brand;
+ return brand;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsModelItemContainer::LogsModelItemContainer(LogsEvent* event) : mEvent(event)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsModelItemContainer::~LogsModelItemContainer()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsEvent* LogsModelItemContainer::event()
+{
+ return mEvent;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsabstractmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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 LOGSABSTRACTMODEL_H
+#define LOGSABSTRACTMODEL_H
+
+#include <QAbstractListModel>
+#include <logsexport.h>
+#include "logsengdefs.h"
+
+class LogsEvent;
+class LogsDbConnector;
+class LogsModelItemContainer;
+
+/**
+ * Abstract logs model.
+ *
+ */
+class LogsAbstractModel : public QAbstractListModel
+{
+
+public:
+
+ /**
+ * Additional data role types.
+ */
+ enum LogsModelRole {
+ RoleFullEvent = Qt::UserRole + 1, // LogsEvent
+ RoleCall, // LogsCall
+ RoleMessage, // LogsMessage
+ RoleContact, // LogsContact
+ RoleDetailsModel, // LogsDetailsModel
+ RoleBaseLast // Child classes may define roles above this val
+ };
+
+public:
+
+ ~LogsAbstractModel();
+
+public:
+
+ static QString directionIconName(const LogsEvent& event);
+ static QString typeIconName(const LogsEvent& event);
+
+protected:
+
+ QVariant doGetData(int role, LogsModelItemContainer& item) const;
+
+ virtual QVariant createCall(LogsModelItemContainer& item) const;
+ virtual QVariant createMessage(LogsModelItemContainer& item) const;
+ virtual QVariant createContact(LogsModelItemContainer& item) const;
+
+ LogsAbstractModel();
+
+protected: //data
+
+ LogsDbConnector* mDbConnector;
+
+private:
+
+ friend class UT_LogsModel;
+ friend class UT_LogsDetailsModel;
+ friend class UT_LogsFilter;
+ friend class UT_LogsCustomFilter;
+
+};
+
+
+/**
+ * Specialized model may contain other model items than log events.
+ */
+class LogsModelItemContainer {
+public:
+ LogsModelItemContainer(LogsEvent* event = 0);
+ virtual ~LogsModelItemContainer();
+ LogsEvent* event();
+
+private:
+ LogsEvent* mEvent; // not owned
+};
+
+#endif //LOGSABSTRACTMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscall.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* 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 "logscall.h"
+#include "logsmodel.h"
+#include "logsevent.h"
+#include "logslogger.h"
+
+//SYSTEM
+
+bool logsCallToNumberCalled = false;
+QString logsLastCalledFunction = QString();
+
+bool LogsCall::isCallToNumberCalled()
+{
+ return logsCallToNumberCalled;
+}
+
+QString LogsCall::lastCalledFuntion()
+{
+ return logsLastCalledFunction;
+}
+
+void LogsCall::resetTestData()
+{
+ logsCallToNumberCalled = false;
+ logsLastCalledFunction = QString();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsCall::LogsCall(LogsEvent& event)
+:mNumber(event.number()),
+ mDefaultCall( TypeLogsCallNotAvailable ),
+ mEventType(event.eventType()),
+ mTestLastCallType(-1)
+{
+ if (event.eventType() == LogsEvent::TypeVoiceCall){
+ mDefaultCall = TypeLogsVoiceCall;
+ } else if (event.eventType() == LogsEvent::TypeVideoCall) {
+ mDefaultCall = TypeLogsVideoCall;
+ } else if (event.eventType() == LogsEvent::TypeVoIPCall) {
+ mDefaultCall = TypeLogsVoIPCall;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// Stub constructor
+// -----------------------------------------------------------------------------
+//
+LogsCall::LogsCall() :
+ mDefaultCall( TypeLogsCallNotAvailable ),
+ mEventType(LogsEvent::TypeVoiceCall),
+ mTestLastCallType(-1)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsCall::~LogsCall()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void LogsCall::callToNumber(LogsCall::CallType callType, const QString& number,
+ unsigned int serviceId)
+{
+ Q_UNUSED(callType);
+ Q_UNUSED(number);
+ Q_UNUSED(serviceId);
+ logsCallToNumberCalled = true;
+ logsLastCalledFunction = QString("callToNumber");
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsCall::isAllowedCallType()
+{
+ return (mEventType == LogsEvent::TypeVoiceCall);
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+LogsCall::CallType LogsCall::defaultCallType()
+{
+ return mDefaultCall;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+QList<LogsCall::CallType> LogsCall::allowedCallTypes()
+{
+ QList<LogsCall::CallType> list;
+ list.append(LogsCall::TypeLogsVoiceCall);
+ list.append(LogsCall::TypeLogsVideoCall);
+ list.append(LogsCall::TypeLogsVoIPCall);
+ return list;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void LogsCall::call(LogsCall::CallType callType)
+{
+ mTestLastCallType = callType;
+ logsLastCalledFunction = QString("call");
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void LogsCall::initiateCallback()
+ {
+ if (mEventType == LogsEvent::TypeVoiceCall)
+ {
+ call(TypeLogsVoiceCall);
+ }
+ else if (mEventType == LogsEvent::TypeVideoCall)
+ {
+ call(TypeLogsVideoCall);
+ }
+ logsLastCalledFunction = QString("initiateCallback");
+ }
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscall.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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 LOGSCALL_H
+#define LOGSCALL_H
+
+
+#include <xqservicerequest.h>
+#include <hbaction.h>
+#include <hblineedit.h>
+#include <hblabel.h>
+#include <QVariant>
+#include <QObject>
+#include "logsevent.h"
+//#include "logseventdata.h"
+#include <logsexport.h>
+#include <QList>
+/**
+ * LogsCall can be used to make a call
+ * from logs model.
+ */
+class LogsCall
+{
+
+public:
+
+ enum CallType {
+ TypeLogsCallNotAvailable = 0,
+ TypeLogsVoiceCall,
+ TypeLogsVideoCall,
+ TypeLogsVoIPCall
+ };
+
+public:
+
+ explicit LogsCall(LogsEvent& aEvent);
+ explicit LogsCall(); // Stub constructor
+
+ ~LogsCall();
+
+ QList<LogsCall::CallType> allowedCallTypes();
+
+ LogsCall::CallType defaultCallType();
+
+ static void callToNumber(LogsCall::CallType callType, const QString& number,
+ unsigned int serviceId=0);
+
+ bool isAllowedCallType();
+
+public slots:
+
+ void call(LogsCall::CallType aCallType);
+ void initiateCallback();
+
+private: //data
+ QString mNumber;
+ CallType mDefaultCall;
+ LogsEvent::LogsEventType mEventType;
+
+public: // test data & methods
+ int mTestLastCallType;
+
+ static bool isCallToNumberCalled();
+ static QString lastCalledFuntion();
+ static void resetTestData();
+
+};
+
+#endif // LOGSCALL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscontact.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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 "logscontact.h"
+//SYSTEM
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsContact::LogsContact()
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsContact::LogsContact(const QString& number): mNumber(number)
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsContact::~LogsContact()
+{
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+LogsContact::RequestType LogsContact::allowedRequestType()
+{
+ return LogsContact::TypeLogsContactSave;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsContact::open()
+{
+ return false;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsContact::addNew()
+{
+ return false;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsContact::updateExisting()
+{
+ return false;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscontact.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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 LOGSCONTACT_H
+#define LOGSCONTACT_H
+
+#include <QObject>
+#include <logsexport.h>
+
+//forward declarations
+class LogsDbConnector;
+
+/**
+ * LogsContact can be used to modify or create a contact in phonebook
+ *
+ */
+class LogsContact : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum RequestType {
+ TypeLogsContactOpen, //contact is in phonebook, can open it
+ TypeLogsContactSave //contact isn't in phonebook, can save it
+ };
+
+public:
+
+ //explicit LogsContact(LogsEvent& event, LogsDbConnector& dbConnector);
+ explicit LogsContact(); // Stub constructor
+ explicit LogsContact(const QString& number); // Stub constructor
+ ~LogsContact();
+
+ /**
+ * Returns allowed request type
+ */
+ RequestType allowedRequestType();
+
+public slots:
+
+ /**
+ * Launch phonebook view for modification of the contact. Will proceed
+ * only if allowedRequestType() is TypeLogsContactOpen, otherwise returns false.
+ * Emits openCompeted() signal, when contact modifications are done.
+ * @return true if opening was called successfully
+ */
+ bool open();
+
+ /**
+ * Launch phonebook view for creation of a new contact.
+ * Emits openCompleted() signal, when contact saving is done.
+ * @return true if saving was called successfully
+ */
+ bool addNew();
+
+ /**
+ * Launch phonebook view for creation of a new contact.
+ * Emits openCompleted() signal, when contact saving is done.
+ * @return true if saving was called successfully
+ */
+ bool updateExisting();
+
+signals:
+
+ void openCompleted(bool modified);
+ void saveCompleted(bool modified);
+
+public: //stub data
+
+ //LogsEvent& mEvent;
+ QString mNumber;
+
+};
+
+#endif // LOGSCONTACT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsdetailsmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* 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 "logsdetailsmodel.h"
+#include "logsevent.h"
+#include "logsmodel.h"
+#include "logslogger.h"
+#include "logsengdefs.h"
+#include "logscall.h"
+#include "logscontact.h"
+#include "logsmessage.h"
+#include <hbicon.h>
+#include <hblineedit.h>
+#include <QStringList>
+
+Q_DECLARE_METATYPE(LogsCall*)
+Q_DECLARE_METATYPE(LogsContact*)
+Q_DECLARE_METATYPE(LogsMessage*)
+
+const int LogsDetailsRemotePartyRow = 0;
+const int LogsDetailsDateAndTimeRow = 1;
+const int LogsDetailsCallDirectionRow = 2;
+const int LogsDetailsCallTypeRow = 3;
+const int LogsDetailsCallDurationRow = 4;
+
+QString LogsDetailsModel::mLastCallName = QString();
+
+// -----------------------------------------------------------------------------
+// LogsDetailsModel::LogsDetailsModel
+// -----------------------------------------------------------------------------
+//
+LogsDetailsModel::LogsDetailsModel()
+ : LogsAbstractModel(),
+ mEvent( 0 ),
+ mDetailItemsCount( 0 )
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::LogsDetailsModel()" )
+ mLastCallName = QString();
+ LOGS_QDEBUG( "logs [ENG] <- LogsDetailsModel::LogsDetailsModel()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsDetailsModel::~LogsDetailsModel
+// -----------------------------------------------------------------------------
+//
+LogsDetailsModel::~LogsDetailsModel()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::~LogsDetailsModel()" )
+ mLastCallName = QString();
+ LOGS_QDEBUG( "logs [ENG] <- LogsDetailsModel::~LogsDetailsModel()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsDetailsModel::clearEvent
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::clearEvent()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::clearEvent()" )
+ mLastCallName = QString("clearEvent");
+ LOGS_QDEBUG( "logs [ENG] <- LogsDetailsModel::clearEvent()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsDetailsModel::getNumberToClipboard()
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::getNumberToClipboard()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::getNumberToClipboard()" )
+ mLastCallName = QString("getNumberToClipboard");
+ LOGS_QDEBUG( "logs [ENG] <- LogsDetailsModel::getNumberToClipboard()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsDetailsModel::rowCount
+// From QAbstractListModel
+// -----------------------------------------------------------------------------
+//
+int LogsDetailsModel::rowCount(const QModelIndex & /* parent */) const
+{
+ return mDetailItemsCount;
+}
+
+// -----------------------------------------------------------------------------
+// LogsDetailsModel::data
+// From QAbstractListModel
+// -----------------------------------------------------------------------------
+//
+QVariant LogsDetailsModel::data(const QModelIndex &index, int role) const
+{
+ Q_UNUSED(index);
+
+ if ( role == RoleCall && mEvent ) {
+ LogsCall* logsCall = new LogsCall();
+ QVariant var = qVariantFromValue(logsCall);
+ return var;
+ } else if (role == RoleContact ) {
+ LogsContact* logsContact = new LogsContact();
+ QVariant var = qVariantFromValue(logsContact);
+ return var;
+ } else if (role == RoleMessage && mEvent ) {
+ LogsMessage* logsMessage = new LogsMessage();
+ QVariant var = qVariantFromValue(logsMessage);
+ return var;
+ }
+
+ return QVariant();
+}
+
+// -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+QVariant LogsDetailsModel::headerData(int section, Qt::Orientation orientation,
+ int role) const
+{
+ Q_UNUSED(section);
+ Q_UNUSED(orientation);
+
+ if (role == Qt::DisplayRole && mEvent){
+ QString testName("testname");
+ return QVariant(testName);
+ }
+
+ return QVariant();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsdetailsmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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 LOGSDETAILSMODEL_H
+#define LOGSDETAILSMODEL_H
+
+#include <logsexport.h>
+#include <logsabstractmodel.h>
+#include "logsengdefs.h"
+
+class LogsEvent;
+class LogsDbConnector;
+class HbIcon;
+
+/**
+ * Model for log event details.
+ *
+ */
+class LogsDetailsModel : public LogsAbstractModel
+{
+
+
+
+public:
+
+ explicit LogsDetailsModel();
+
+public: // The exported API
+
+ ~LogsDetailsModel();
+ void clearEvent();
+ void getNumberToClipboard();
+
+public: // From QAbstractItemModel
+
+ virtual int rowCount(const QModelIndex &parent) const;
+ virtual QVariant data(const QModelIndex &index, int role) const;
+ virtual QVariant headerData(int section, Qt::Orientation orientation,
+ int role = Qt::DisplayRole) const;
+private:
+
+private: //testing purpose data
+
+ LogsEvent* mEvent;
+ int mDetailItemsCount;
+ QMap<int, HbIcon*> mDetailIcons;
+ QMap<int, QStringList> mDetailTexts;
+ static QString mLastCallName; //last called exported function name
+
+ friend class UT_LogsDetailsView;
+};
+
+#endif //LOGSDETAILSMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsevent.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,468 @@
+/*
+* 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 FILES
+
+#include "logsevent.h"
+#include "logseventparser.h"
+#include "logseventdata.h"
+#include "logsengdefs.h"
+#include "logslogger.h"
+
+// CONSTANTS
+
+// ----------------------------------------------------------------------------
+// logsEvent::logsEvent
+// ----------------------------------------------------------------------------
+//
+LogsEvent::LogsEvent()
+ :
+ mLogId(-1),
+ mDirection(DirUndefined),
+ mEventType(TypeUndefined),
+ mUid(0),
+ mLogsEventData(0),
+ mDuplicates(0),
+ mRingDuration(0),
+ mIsRead(false),
+ mIsALS(false),
+ mDuration(0),
+ mIndex(0),
+ mIsInView(false),
+ mEventState(EventAdded)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::LogsEvent
+// ----------------------------------------------------------------------------
+//
+LogsEvent::LogsEvent( const LogsEvent& event )
+{
+ mLogId = event.mLogId;
+ mDirection = event.mDirection;
+ mEventType = event.mEventType;
+ mUid = event.mUid;
+ if ( event.mLogsEventData ){
+ mLogsEventData = new LogsEventData( *event.mLogsEventData );
+ } else {
+ mLogsEventData = 0;
+ }
+ mRemoteParty = event.mRemoteParty;
+ mNumber = event.mNumber;
+ mDuplicates = event.mDuplicates;
+ mTime = event.mTime;
+ mRingDuration = event.mRingDuration;
+ mIsRead = event.mIsRead;
+ mIsALS = event.mIsALS;
+ mDuration = event.mDuration;
+
+ mIndex = event.mIndex;
+ mIsInView = event.mIsInView;
+ mEventState = event.mEventState;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::~LogsEvent
+// ----------------------------------------------------------------------------
+//
+LogsEvent::~LogsEvent()
+{
+ delete mLogsEventData;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::initializeEventL
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::initializeEventL(
+ const CLogEvent& source,
+ const LogsEventStrings& strings )
+{
+ Q_UNUSED(source)
+ Q_UNUSED(strings)
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsEvent::isEmergencyNumber
+// Checks wether the number is an emergency number
+// ----------------------------------------------------------------------------
+
+bool LogsEvent::isEmergencyNumber(const QString& number)
+{
+ return ( number == logsEmergencyCall911 || number == logsEmergencyCall );
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setDuration()
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setDuration( int duration )
+{
+ mDuration = duration;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setALS()
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setALS( bool isALS )
+{
+ mIsALS = isALS;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setLogId
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setLogId( int logId )
+{
+ mLogId = logId;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setNumber
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::setNumber( const QString& number )
+ {
+ bool changed( mNumber != number );
+ mNumber = number;
+ return changed;
+ }
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setRemoteParty
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setRemoteParty( const QString& remoteParty )
+{
+ if ( mEventState == EventNotUpdated && mRemoteParty != remoteParty ){
+ LOGS_QDEBUG( "logs [ENG] <-> LogsEvent::setRemoteParty, event updated")
+ mEventState = LogsEvent::EventUpdated;
+ }
+ mRemoteParty = remoteParty;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::validate
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::validate()
+{
+ return ( !mNumber.isEmpty() || !mRemoteParty.isEmpty() ||
+ ( mLogsEventData && !mLogsEventData->remoteUrl().isEmpty() ) );
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::directionAsString
+// ----------------------------------------------------------------------------
+//
+QString LogsEvent::directionAsString() const
+{
+ QString dir;
+ if ( mDirection == DirIn ) {
+ dir = QString("Incoming call");
+ } else if ( mDirection == DirOut ) {
+ dir = QString("Outgoing call");
+ } else if ( mDirection == DirMissed ) {
+ dir = QString("Missed call");
+ } else {
+ dir = QString("Direction unknown");
+ }
+ return dir;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::typeAsString
+// ----------------------------------------------------------------------------
+//
+QString LogsEvent::typeAsString() const
+{
+ QString type;
+ if ( mEventType == TypeVoiceCall ) {
+ type = QString("Voice call");
+ } else if ( mEventType == TypeVideoCall ) {
+ type = QString("Video call");
+ } else if ( mEventType == TypeVoIPCall ) {
+ type = QString("VoIP call");
+ } else {
+ type = QString("Type unknown");
+ }
+ return type;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::getNumberForCalling
+// ----------------------------------------------------------------------------
+//
+QString LogsEvent::getNumberForCalling()
+{
+ if (mNumber.isEmpty() && mEventType == TypeVoIPCall && mLogsEventData ) {
+ return mLogsEventData->remoteUrl();
+ }
+ return mNumber;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setDirection
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::setDirection( LogsDirection direction )
+{
+ bool changed( mDirection != direction );
+ mDirection = direction;
+ return changed;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setEventUid
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setEventUid( int uid )
+{
+ mUid = uid;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setEventType
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setEventType( LogsEventType eventType )
+{
+ mEventType = eventType;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::ALS()
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::ALS() const
+{
+ return mIsALS;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::logId
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::logId() const
+ {
+ return mLogId;
+ }
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setIsRead
+// ----------------------------------------------------------------------------
+void LogsEvent::setIsRead(bool isRead)
+{
+ mIsRead = isRead;
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsEvent::Number
+// ----------------------------------------------------------------------------
+//
+const QString& LogsEvent::number() const
+{
+ return mNumber;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::RemoteParty
+// ----------------------------------------------------------------------------
+//
+const QString& LogsEvent::remoteParty() const
+{
+ return mRemoteParty;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::Direction
+// ----------------------------------------------------------------------------
+//
+LogsEvent::LogsDirection LogsEvent::direction() const
+{
+ return mDirection;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::eventUid
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::eventUid() const
+{
+ return mUid;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::eventType
+// ----------------------------------------------------------------------------
+//
+LogsEvent::LogsEventType LogsEvent::eventType() const
+{
+ return mEventType;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::isRead
+// ----------------------------------------------------------------------------
+ bool LogsEvent::isRead() const
+{
+ return mIsRead;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::RingDuration
+//
+// For ring duation feature
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::ringDuration() const
+{
+ return mRingDuration;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::duration
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::duration() const
+{
+ return mDuration;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::SetRingDuration
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setRingDuration( int ringDuration )
+{
+ mRingDuration = ringDuration;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::LogsEventData
+// ----------------------------------------------------------------------------
+//
+LogsEventData* LogsEvent::logsEventData() const
+{
+ return mLogsEventData;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setLogsEventData
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setLogsEventData( LogsEventData* logsEventData )
+{
+ delete mLogsEventData;
+ mLogsEventData = logsEventData;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setTime
+//
+// Time needed in recent views and in detail view (not needed in event view)
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::setTime( const QDateTime& time )
+{
+ bool changed( mTime != time );
+ mTime = time;
+ return changed;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::time
+// ----------------------------------------------------------------------------
+//
+QDateTime LogsEvent::time() const
+{
+ return mTime;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setDuplicates
+//
+// Duplicates needed only in missed calls view
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setDuplicates( int duplicates )
+{
+ mDuplicates = duplicates;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::duplicates
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::duplicates() const
+{
+ return mDuplicates;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setIndex
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setIndex(int index)
+{
+ mIndex = index;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::index
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::index() const
+{
+ return mIndex;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setIsInView
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setIsInView(bool isInView)
+{
+ mIsInView = isInView;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::isInView
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::isInView() const
+{
+ return mIsInView;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::eventState
+// ----------------------------------------------------------------------------
+//
+LogsEvent::LogsEventState LogsEvent::eventState() const
+{
+ return mEventState;
+}
+
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsevent.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,255 @@
+/*
+* 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 LOGSEVENT_H
+#define LOGSEVENT_H
+
+// INCLUDES
+#include <QObject>
+#include <QDateTime>
+#include <logsexport.h>
+
+// FORWARD DECLARATION
+class LogsEventData;
+class LogsEventStrings;
+class CLogEvent;
+
+// CLASS DECLARATION
+
+/**
+ *
+ */
+class LogsEvent
+ {
+public:
+
+ // direction of the event
+ enum LogsDirection
+ {
+ DirUndefined = -1, // undefined
+ DirIn = 0, // incoming
+ DirOut = 1, // outgoing
+ DirMissed = 2 // missed
+ };
+
+ // type of the event
+ enum LogsEventType
+ {
+ TypeUndefined = -1,
+ TypeVoiceCall,
+ TypeVideoCall,
+ TypeVoIPCall
+ };
+
+ enum LogsEventState
+ {
+ EventAdded,
+ EventUpdated,
+ EventNotUpdated
+ };
+
+ public:
+
+ /**
+ * Constructor.
+ */
+ LogsEvent();
+
+ /**
+ * Copy constructor.
+ */
+ LogsEvent( const LogsEvent& event );
+
+ /**
+ * Destructor.
+ */
+ virtual ~LogsEvent();
+
+
+ public:
+
+ /**
+ * Initialized the event with contents of given source event.
+ * Event state and view status are updated automatically at
+ * this phase.
+ * @param source, source event
+ * @param strings, list of strings used for comparison
+ */
+ void initializeEventL( const CLogEvent& source,
+ const LogsEventStrings& strings );
+
+ /**
+ * Check event's view status which tells whether the event is
+ * still valid or not. If event is not anymore in view, it
+ * is not probably needed anymore.
+ */
+ bool isInView() const;
+
+ /**
+ * Get state of the event. Event state is updated
+ * always at initialization phase. See initializeEventL.
+ */
+ LogsEventState eventState() const;
+
+ bool isRead() const;
+
+ void setIsRead(bool isRead);
+
+ QDateTime time() const;
+
+ int logId() const;
+
+ const QString& number() const;
+
+ const QString& remoteParty() const;
+
+ LogsDirection direction() const;
+
+ int eventUid() const;
+
+ LogsEventType eventType() const;
+
+ int duplicates() const;
+
+ LogsEventData* logsEventData() const;
+
+ bool ALS() const;
+
+ bool CNAP() const { return false; };
+
+ int ringDuration() const;
+
+ int duration() const;
+
+ /**
+ * Sets current index of the event.
+ */
+ void setIndex(int index);
+
+ /**
+ * Returns last set index for the event.
+ */
+ int index() const;
+
+ /**
+ * Set view status of the event.
+ */
+ void setIsInView(bool isInView);
+
+ /**
+ * Set number of duplicates for this events (e.g. 2 missed calls)
+ */
+ void setDuplicates( int duplicates );
+
+ /**
+ * Set remote party name for the event.
+ */
+ void setRemoteParty( const QString& remoteParty );
+
+ /**
+ * Check if event is valid.
+ * @return true if valid, otherwise false
+ */
+ bool validate();
+
+ /**
+ * Return direction as string
+ */
+ QString directionAsString() const;
+
+ /**
+ * Return event type as string
+ */
+ QString typeAsString() const;
+
+ /**
+ *
+ */
+ QString getNumberForCalling();
+
+ private:
+
+ bool setTime( const QDateTime& time );
+
+ void setLogId( const int logId );
+
+ bool setNumber( const QString& number );
+
+ bool setDirection( LogsDirection aDirection );
+
+ void setEventUid( int uid );
+
+ void setEventType( LogsEventType aEventType );
+
+ void setLogsEventData( LogsEventData* logsEventData );
+
+ void setALS( bool aALS );
+
+ void setRingDuration( int ringDuration );
+
+ bool isEmergencyNumber( const QString& number );
+
+ void setDuration( int duration );
+
+ private: // data
+
+ int mLogId;
+ LogsDirection mDirection;
+ LogsEventType mEventType;
+ int mUid;
+ LogsEventData* mLogsEventData;
+ QString mRemoteParty;
+ QString mNumber;
+ int mDuplicates;
+ QDateTime mTime;
+ int mRingDuration;
+ bool mIsRead;
+ bool mIsALS;
+ int mDuration;
+
+ int mIndex;
+ bool mIsInView;
+ LogsEventState mEventState;
+
+ private:
+
+ friend class LogsEventParser;
+ friend class LogsReaderStateFillDetails;
+
+ private: // Testing related friend definitions
+
+#ifdef LOGSDBCONNECTOR_SIMULATION
+ friend class LogsDbConnector;
+#endif
+ friend class UT_LogsFilter;
+ friend class UT_LogsModel;
+ friend class UT_LogsEvent;
+ friend class UT_LogsDbConnector;
+ friend class UT_LogsCall;
+ friend class UT_LogsContact;
+ friend class UT_LogsEventParser;
+ friend class UT_LogsEventDataParser;
+ friend class UT_LogsReaderStates;
+ friend class UT_LogsDetailsModel;
+ friend class UT_LogsMessage;
+ };
+
+#endif // LOGSEVENT_H
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logseventdata.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,220 @@
+/*
+* 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 FILES
+#include "logseventdata.h"
+#include "logsevent.h"
+/*
+#include <QRegExp>
+#include <QRegExpValidator>
+*/
+// ----------------------------------------------------------------------------
+// LogsEventData::LogsEventData
+// ----------------------------------------------------------------------------
+//
+LogsEventData::LogsEventData() :
+ mIsCNAP( false ),
+ mIsVT( false ),
+ mIsPoC( false ),
+ mIsVoIP( false ),
+ mIsEmerg( false ),
+ mDataSent( 0 ),
+ mDataReceived( 0 ),
+ mMsgPartsNumber( 0 ),
+ mServiceId( 0 ),
+ mContactLocalId( 0 ),
+ mRemoteUrl(),
+ mLocalUrl()
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::LogsEventData
+// ----------------------------------------------------------------------------
+//
+LogsEventData::LogsEventData( const LogsEventData& data )
+{
+ mIsCNAP = data.mIsCNAP;
+ mIsVT = data.mIsVT;
+ mIsPoC = data.mIsPoC;
+ mIsVoIP = data.mIsVoIP;
+ mIsEmerg = data.mIsEmerg;
+ mDataSent = data.mDataSent;
+ mDataReceived = data.mDataReceived;
+ mMsgPartsNumber = data.mMsgPartsNumber;
+ mServiceId = data.mServiceId;
+ mContactLocalId = data.mContactLocalId;
+ mRemoteUrl = data.mRemoteUrl;
+ mLocalUrl = data.mLocalUrl;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::~LogsEventData
+// ----------------------------------------------------------------------------
+//
+LogsEventData::~LogsEventData()
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::parse
+// ----------------------------------------------------------------------------
+//
+int LogsEventData::parse( const CLogEvent& source )
+{
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::isCNAP
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isCNAP() const
+{
+ return mIsCNAP;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::isVT
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isVT() const
+{
+ return mIsVT;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::isPoC
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isPoC() const
+{
+ return mIsPoC;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::isVoIP
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isVoIP() const
+{
+ return mIsVoIP;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::dataReceived
+// ----------------------------------------------------------------------------
+//
+long long LogsEventData::dataReceived() const
+{
+ return mDataReceived;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::dataSent
+// ----------------------------------------------------------------------------
+//
+long long LogsEventData::dataSent() const
+{
+ return mDataSent;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::isEmerg
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isEmerg() const
+{
+ return mIsEmerg;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::MsgPartsNumber
+//
+// Msg parts. This info is meaningful only for sms events
+// ----------------------------------------------------------------------------
+//
+int LogsEventData::msgPartsNumber() const
+{
+ return mMsgPartsNumber;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::ServiceId
+//
+// Returns the Service ID of the log event.
+// ----------------------------------------------------------------------------
+//
+unsigned int LogsEventData::serviceId() const
+{
+ return mServiceId;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+QString LogsEventData::remoteUrl() const
+{
+ return mRemoteUrl;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+QString LogsEventData::localUrl() const
+{
+ return mLocalUrl;
+}
+
+// ----------------------------------------------------------------------------
+// Checks whether event data can be used in CS context
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isCsCompatible()
+{
+ bool compatible( true );
+/* if ( !mRemoteUrl.isEmpty() ){
+ // Url can start with plus but after that can contain only digits
+ // to be CS compatible.
+ QRegExp rx( "\\+{0,1}\\d*$" );
+ QRegExpValidator validator(rx, 0);
+ int pos( 0 );
+ compatible = ( validator.validate( mRemoteUrl, pos ) == QValidator::Acceptable );
+ }*/
+ return compatible;
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsEventData::contactLocalId
+// ----------------------------------------------------------------------------
+//
+unsigned int LogsEventData::contactLocalId() const
+{
+ return mContactLocalId;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setContactLocalId
+// ----------------------------------------------------------------------------
+//
+void LogsEventData::setContactLocalId(unsigned int id)
+{
+ mContactLocalId = id;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logseventdata.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* 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 LOGSEVENTDATA_H
+#define LOGSEVENTDATA_H
+
+// INCLUDES
+#include <QString>
+
+// FORWARD DECLARATION
+class CLogEvent;
+
+// CLASS DECLARATION
+
+/**
+ *
+ */
+class LogsEventData
+ {
+
+ public:
+
+ /**
+ * Constructor.
+ */
+ LogsEventData();
+
+ /**
+ * Copy constructor.
+ */
+ LogsEventData( const LogsEventData& data );
+
+ /**
+ * Destructor.
+ */
+ virtual ~LogsEventData();
+
+
+ public:
+
+ /**
+ * Parses event data from given data
+ * @param source data
+ * @return 0 if parsed succesfully
+ **/
+ int parse( const CLogEvent& source );
+
+ bool isCNAP() const;
+ bool isVT() const;
+ bool isPoC() const;
+ bool isVoIP() const;
+ long long dataReceived() const;
+ long long dataSent() const;
+ bool isEmerg() const;
+ int msgPartsNumber() const;
+ unsigned int serviceId() const;
+ QString remoteUrl() const;
+ QString localUrl() const;
+
+ /**
+ * Checks whether event data can be used in CS context.
+ * @return true if CS compatible.
+ */
+ bool isCsCompatible();
+
+ unsigned int contactLocalId() const;
+
+ private:
+
+ void setContactLocalId( unsigned int id );
+
+ private: // data
+
+ // Calling Name Presentation service flag
+ bool mIsCNAP;
+ bool mIsVT;
+ bool mIsPoC;
+ bool mIsVoIP;
+
+ //Flag that indicates whether this is an emergency related event (i.e emerg call)
+ bool mIsEmerg;
+
+ //Sent and received data where applicable (in bytes)
+ long long mDataSent;
+ long long mDataReceived;
+
+ //Message parts. Meaningful only for sms
+ int mMsgPartsNumber;
+
+ unsigned int mServiceId;
+ unsigned int mContactLocalId;
+
+ QString mRemoteUrl;
+ QString mLocalUrl;
+
+ private:
+
+ friend class LogsEventDataParser;
+ friend class LogsEvent;
+
+ private: // Testing related friend definitions
+
+ friend class UT_LogsEventData;
+ friend class UT_LogsEvent;
+ friend class UT_LogsEventParser;
+ friend class UT_LogsEventDataParser;
+ friend class UT_LogsCall;
+ friend class UT_LogsContact;
+ friend class UT_LogsMessage;
+ friend class UT_LogsDetailsModel;
+ friend class UT_LogsModel;
+ friend class UT_LogsCustomFilter;
+
+ };
+
+#endif // LOGSEVENTDATA_H
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsfilter.h Tue May 04 12:39:37 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 LOGSFILTER_H
+#define LOGSFILTER_H
+
+#include <QSortFilterProxyModel>
+#include "logsmodel.h"
+
+/**
+ *
+ */
+class LogsFilter : public QSortFilterProxyModel
+{
+
+public:
+
+ enum FilterType{
+ All,
+ Received,
+ Called,
+ Missed
+ };
+
+public: // The exported API
+
+ LogsFilter( FilterType type = All )
+ {
+ mFilterType = type;
+ };
+ ~LogsFilter(){};
+
+ FilterType filterType() const {return mFilterType;}
+ LogsModel::ClearType clearType() const {return LogsModel::TypeLogsClearAll;}
+
+protected: // From QSortFilterProxyModel
+
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+ {
+ Q_UNUSED(sourceRow);
+ Q_UNUSED(sourceParent);
+ return true;
+ }
+
+private: //data
+
+ FilterType mFilterType;
+
+};
+
+#endif // LOGSFILTER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsforegroundwatcher.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "logsforegroundwatcher.h"
+
+// -----------------------------------------------------------------------------
+// Currently no other way to monitor app foreground/background switches.
+// HbForegroundWatcher might become public at some point which could be then
+// used instead.
+// -----------------------------------------------------------------------------
+//
+LogsForegroundWatcher::LogsForegroundWatcher(QObject* parent) : QObject(parent)
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsForegroundWatcher::HandleGainingForeground()
+{
+ emit gainingForeground();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsForegroundWatcher::HandleLosingForeground()
+{
+ emit losingForeground();
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsforegroundwatcher.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef LOGSFOREGROUNDWATCHER_H
+#define LOGSFOREGROUNDWATCHER_H
+
+
+#include <QObject>
+
+class LogsForegroundWatcher : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ LogsForegroundWatcher(QObject* parent = 0);
+ virtual ~LogsForegroundWatcher(){}
+
+signals:
+ void gainingForeground();
+ void losingForeground();
+
+public: // from MCoeForegroundObserver
+ void HandleGainingForeground();
+ void HandleLosingForeground();
+
+};
+
+#endif //LOGSFOREGROUNDWATCHER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmatchesmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* 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 "logsmatchesmodel.h"
+#include "logslogger.h"
+#include "logsengdefs.h"
+#include "logsdbconnector.h"
+#include "logscall.h"
+#include "logsdetailsmodel.h"
+#include "logscontact.h"
+
+Q_DECLARE_METATYPE(LogsCall*)
+Q_DECLARE_METATYPE(LogsDetailsModel*)
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMatchesModel::LogsMatchesModel( LogsDbConnector& dbConnector )
+ : LogsAbstractModel()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::LogsMatchesModel()" )
+ mDbConnector = &dbConnector;
+ mLastCall = QString();
+ mTextData.append( "firstitem" );
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::LogsMatchesModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMatchesModel::~LogsMatchesModel()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::~LogsMatchesModel()" )
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::~LogsMatchesModel()" )
+}
+
+// -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+int LogsMatchesModel::rowCount(const QModelIndex & /* parent */) const
+{
+ return mTextData.count();
+}
+
+// -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+QVariant LogsMatchesModel::data(const QModelIndex &index, int role) const
+{
+ Q_UNUSED(index);
+ Q_UNUSED(role);
+ if ( role == RoleCall && mTextData.count() > 0 ) {
+ LogsCall* logsCall = new LogsCall();
+ QVariant var = qVariantFromValue(logsCall);
+ return var;
+ } else if (role == RoleDetailsModel) {
+ if (mTextData.count() > 0){
+ LogsDetailsModel* logsDetails = new LogsDetailsModel();
+ QVariant var = qVariantFromValue(logsDetails);
+ return var;
+ }
+ }
+ return QVariant();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::logsMatches( const QString& pattern )
+{
+ Q_UNUSED(pattern);
+ mLastCall = QString("logsMatches");
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsContact* LogsMatchesModel::createContact(const QString& number)
+{
+ return new LogsContact(number);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QString LogsMatchesModel::lastCall()
+{
+ return mLastCall;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::resetLastCall()
+{
+ mLastCall = QString();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmatchesmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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 LOGSMATCHESMODEL_H
+#define LOGSMATCHESMODEL_H
+
+#include <logsexport.h>
+#include <logsabstractmodel.h>
+#include <QStringList>
+#include "logsengdefs.h"
+
+class LogsEvent;
+class LogsDbConnector;
+class HbIcon;
+class LogsContact;
+
+/**
+ * Model for log event details.
+ *
+ */
+class LogsMatchesModel : public LogsAbstractModel
+{
+ //Q_OBJECT
+
+public:
+
+ explicit LogsMatchesModel( LogsDbConnector& dbConnector );
+
+public: // The exported API
+
+ ~LogsMatchesModel();
+ void logsMatches( const QString& pattern );
+
+ /**
+ * Factory method for creating a new contact object. Transfers ownership.
+ */
+ LogsContact* createContact(const QString& number);
+
+public: // From QAbstractItemModel
+
+ virtual int rowCount(const QModelIndex &parent) const;
+ virtual QVariant data(const QModelIndex &index, int role) const;
+
+public://test functions
+
+ QString lastCall();
+ void resetLastCall();
+
+public: //test data
+
+ QString mLastCall;
+ QStringList mTextData;
+
+};
+
+#endif //LOGSMATCHESMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmessage.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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 "logsmessage.h"
+//SYSTEM
+
+bool logsTestMessageSent = false;
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMessage::LogsMessage()
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMessage::~LogsMessage()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsMessage::isMessagingAllowed()
+{
+ return false;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsMessage::sendMessage()
+{
+ return false;
+
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsMessage::sendMessageToNumber(
+ const QString& number, const QString& displayName, unsigned int contactId)
+{
+ Q_UNUSED(number);
+ Q_UNUSED(displayName);
+ Q_UNUSED(contactId);
+ logsTestMessageSent = true;
+}
+
+bool LogsMessage::isMessageSent()
+{
+ return logsTestMessageSent;
+}
+
+void LogsMessage::resetTestData()
+{
+ logsTestMessageSent = false;
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmessage.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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 LOGSMESSAGE_H
+#define LOGSMESSAGE_H
+
+
+#include <QObject>
+#include <logsexport.h>
+#include "logsevent.h"
+
+/**
+ * LogsMessage can be used to send message.
+ */
+class LogsMessage
+{
+
+
+public:
+
+ explicit LogsMessage();
+ ~LogsMessage();
+
+ bool isMessagingAllowed();
+
+public slots:
+
+ /**
+ * Send message
+ * @return true if sent succesfully
+ */
+ bool sendMessage();
+ static bool sendMessageToNumber(
+ const QString& number, const QString& displayName = QString(), unsigned int contactId = 0);
+
+private: //data
+ LogsEvent mEvent;
+
+public: // test helpers
+ static bool isMessageSent();
+ static void resetTestData();
+
+private:
+ friend class UT_LogsMessage;
+
+};
+
+#endif // LOGSMESSAGE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* 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 "logsmodel.h"
+#include "logscall.h"
+#include "logsmessage.h"
+#include "logsdetailsmodel.h"
+#include "logscontact.h"
+#include "logsmatchesmodel.h"
+
+Q_DECLARE_METATYPE(LogsCall*)
+Q_DECLARE_METATYPE(LogsDetailsModel*)
+Q_DECLARE_METATYPE(LogsMessage*)
+Q_DECLARE_METATYPE(LogsContact*)
+
+
+bool mMatchesModelCreated = false;
+
+// -----------------------------------------------------------------------------
+// LogsModel::LogsModel
+// -----------------------------------------------------------------------------
+//
+LogsModel::LogsModel(LogsModelType /*modelType*/, bool /*resourceControl*/) :
+ LogsAbstractModel(), mDbConnector(0), mIsCleared(false)
+{
+ mEmptyModel = false;
+ mTestIsMarkingNeeded = false;
+ mTestEventsMarked = false;
+ mMissedCallsCounterCleared = false;
+ mRefreshCalled = false;
+ mCompressCalled = false;
+}
+
+// -----------------------------------------------------------------------------
+// LogsModel::~LogsModel
+// -----------------------------------------------------------------------------
+//
+LogsModel::~LogsModel()
+{
+ mTextData.clear();
+ mIconData.clear();
+ //delete mDbConnector; // Not created in stub, no point in deletion
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsModel::clearList
+// -----------------------------------------------------------------------------
+//
+bool LogsModel::clearList(LogsModel::ClearType /*cleartype*/)
+{
+ mIsCleared = true;
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// LogsModel::clearList
+// -----------------------------------------------------------------------------
+//
+int LogsModel::clearMissedCallsCounter()
+{
+ mMissedCallsCounterCleared = true;
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// LogsModel::logsMatchesModel
+// -----------------------------------------------------------------------------
+//
+LogsMatchesModel* LogsModel::logsMatchesModel()
+{
+ mMatchesModelCreated = true;
+ return new LogsMatchesModel(*mDbConnector);
+}
+
+// -----------------------------------------------------------------------------
+// LogsModel::markEventsSeen
+// -----------------------------------------------------------------------------
+//
+bool LogsModel::markEventsSeen(LogsModel::ClearType /*cleartype*/)
+{
+ mTestEventsMarked = true;
+ return mTestIsMarkingNeeded;
+}
+
+// -----------------------------------------------------------------------------
+// LogsModel::refreshData
+// -----------------------------------------------------------------------------
+//
+int LogsModel::refreshData()
+{
+ mRefreshCalled = true;
+}
+
+// -----------------------------------------------------------------------------
+// LogsModel::compressData
+// -----------------------------------------------------------------------------
+//
+int LogsModel::compressData()
+{
+ mCompressCalled = true;
+}
+
+// -----------------------------------------------------------------------------
+// LogsModel::rowCount
+// -----------------------------------------------------------------------------
+//
+int LogsModel::rowCount(const QModelIndex &parent) const
+{
+ Q_UNUSED(parent);
+ if ( mEmptyModel ){
+ return 0;
+ }
+ return 1;//mTextData.count();
+};
+
+// -----------------------------------------------------------------------------
+// LogsModel::data
+// -----------------------------------------------------------------------------
+//
+QVariant LogsModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid()) {
+ return QVariant();
+ }
+
+ if (role == Qt::DisplayRole) {
+ return QVariant(mTextData);
+ } else if (role == Qt::DecorationRole) {
+ return QVariant(mIconData);
+ }else if ( role == RoleCall ){
+ if (mTextData.count() > 0){
+ LogsCall* logscall = new LogsCall();
+ QVariant var = qVariantFromValue(logscall);
+ return var;
+ }
+ } else if (role == RoleDetailsModel) {
+ if (mTextData.count() > 0){
+ LogsDetailsModel* logsDetails = new LogsDetailsModel();
+ QVariant var = qVariantFromValue(logsDetails);
+ return var;
+ }
+ } else if (role == RoleMessage) {
+ if (mTextData.count() > 0){
+ LogsMessage* logsMessage = new LogsMessage();
+ QVariant var = qVariantFromValue(logsMessage);
+ return var;
+ }
+ } else if (role == RoleContact)
+ if (mTextData.count() > 0){
+ LogsContact* logsContact = new LogsContact();
+ QVariant var = qVariantFromValue(logsContact);
+ return var;
+ }
+ return QVariant();
+}
+
+// -----------------------------------------------------------------------------
+// LogsModel::addTextData
+// -----------------------------------------------------------------------------
+//
+void LogsModel::addTextData(QString text)
+{
+ mTextData.append(text);
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+// LogsModel::isMatchesModelCreated
+// -----------------------------------------------------------------------------
+//
+bool LogsModel::isMatchesModelCreated()
+{
+ return mMatchesModelCreated;
+}
+
+// -----------------------------------------------------------------------------
+// LogsModel::setMatchesModelCreated
+// -----------------------------------------------------------------------------
+//
+void LogsModel::setMatchesModelCreated(bool isCreated)
+{
+ mMatchesModelCreated = isCreated;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* 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 LOGSMODEL_H
+#define LOGSMODEL_H
+
+#include <logsexport.h>
+#include "logsabstractmodel.h"
+#include "logsengdefs.h"
+#include <QStringList>
+
+class LogsMatchesModel;
+
+/**
+ *
+ */
+class LogsModel : public LogsAbstractModel
+{
+public:
+
+ enum ClearType {
+ TypeLogsClearAll = 0,
+ TypeLogsClearReceived,
+ TypeLogsClearCalled,
+ TypeLogsClearMissed
+ };
+
+ enum LogsModelType {
+ LogsRecentModel,
+ LogsFullModel
+ };
+
+public: // The exported API
+
+ LogsModel(LogsModelType modelType = LogsRecentModel, bool resourceControl = false);
+ ~LogsModel();
+
+ bool clearList(LogsModel::ClearType cleartype);
+ int clearMissedCallsCounter();
+ LogsMatchesModel* logsMatchesModel();
+ bool markEventsSeen(LogsModel::ClearType cleartype);
+ int refreshData();
+ int compressData();
+
+public: // From QAbstractItemModel
+
+ int rowCount(const QModelIndex &parent) const;
+ QVariant data(const QModelIndex &index, int role) const;
+
+signals:
+
+ void clearingCompleted(int err);
+ void markingCompleted(int err);
+
+public: //data
+
+
+
+ void addTextData(QString text);
+ static bool isMatchesModelCreated();
+ static void setMatchesModelCreated(bool isCreated);
+
+ QStringList mTextData;
+ QList<QVariant> mIconData;
+
+ LogsDbConnector* mDbConnector;
+ bool mEmptyModel;
+ bool mIsCleared;
+ bool mTestEventsMarked;
+ bool mTestIsMarkingNeeded;
+ bool mMissedCallsCounterCleared;
+ bool mRefreshCalled;
+ bool mCompressCalled;
+};
+
+#endif //LOGSMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/main.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsmainwindow.h"
+#include "ut_logscomponentrepository.h"
+#include "ut_logsviewmanager.h"
+#include "ut_logsbaseview.h"
+#include "ut_logsrecentcallsview.h"
+#include "ut_logsdetailsview.h"
+#include "ut_logsmatchesview.h"
+#include "ut_logseffecthandler.h"
+#include "ut_logsservicehandler.h"
+#include "ut_logspageindicator.h"
+#include "ut_logspageindicatoritem.h"
+#include "testresultxmlparser.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;
+
+ UT_LogsMainWindow ut_logsMainWindow;
+ QString resultFileNameForMainWindow = "c:/ut_logsMainWindow.xml";
+ UT_ARGS( args_logsMainWindow, resultFileNameForMainWindow );
+ QTest::qExec( &ut_logsMainWindow, args_logsMainWindow );
+ parser.parseAndPrintResults(resultFileNameForMainWindow);
+
+ UT_LogsComponentRepository ut_logsRepository;
+ QString resultFileNameForComponentRepository = "c:/ut_logsRepository.xml";
+ UT_ARGS( args_logsRepository, resultFileNameForComponentRepository );
+ QTest::qExec( &ut_logsRepository, args_logsRepository );
+ parser.parseAndPrintResults(resultFileNameForComponentRepository);
+
+ UT_LogsViewManager ut_logsViewManager;
+ QString resultFileNameForViewManager = "c:/ut_logsViewManager.xml";
+ UT_ARGS( args_logsViewManager, resultFileNameForViewManager );
+ QTest::qExec( &ut_logsViewManager, args_logsViewManager );
+ parser.parseAndPrintResults(resultFileNameForViewManager);
+
+ UT_LogsBaseView ut_logsBaseView;
+ QString resultFileNameForBaseView = "c:/ut_logsBaseView.xml";
+ UT_ARGS( args_logsBaseView, resultFileNameForBaseView );
+ QTest::qExec( &ut_logsBaseView, args_logsBaseView );
+ parser.parseAndPrintResults(resultFileNameForBaseView);
+
+ UT_LogsRecentCallsView ut_logsRecentCallsView;
+ QString resultFileNameForRecentCallsView = "c:/ut_logsRecentCallsView.xml";
+ UT_ARGS( args_logsRecentCallsView, resultFileNameForRecentCallsView );
+ QTest::qExec( &ut_logsRecentCallsView, args_logsRecentCallsView );
+ parser.parseAndPrintResults(resultFileNameForRecentCallsView);
+
+ UT_LogsDetailsView ut_logsDetailsView;
+ QString resultFileNameForDetailsView = "c:/ut_logsDetailsView.xml";
+ UT_ARGS( args_logsDetailsView, resultFileNameForDetailsView );
+ QTest::qExec( &ut_logsDetailsView, args_logsDetailsView );
+ parser.parseAndPrintResults(resultFileNameForDetailsView);
+
+ UT_LogsMatchesView ut_logsMatchesView;
+ QString resultFileNameForMatchesView = "c:/ut_logsMatchesView.xml";
+ UT_ARGS( args_logsMatchesView, resultFileNameForMatchesView );
+ QTest::qExec( &ut_logsMatchesView, args_logsMatchesView );
+ parser.parseAndPrintResults(resultFileNameForMatchesView);
+
+ UT_LogsEffectHandler ut_logsEffectHandler;
+ QString resultFileNameForEffectHandler = "c:/ut_logsEffectHandler.xml";
+ UT_ARGS( args_logsEffectHandler, resultFileNameForEffectHandler );
+ QTest::qExec( &ut_logsEffectHandler, args_logsEffectHandler );
+ parser.parseAndPrintResults(resultFileNameForEffectHandler);
+
+ UT_LogsServiceHandler ut_logsServiceHandler;
+ QString resultFileNameForServiceHandler = "c:/ut_logsServiceHandler.xml";
+ UT_ARGS( args_logsServiceHandler, resultFileNameForServiceHandler );
+ QTest::qExec( &ut_logsServiceHandler, args_logsServiceHandler );
+ parser.parseAndPrintResults(resultFileNameForServiceHandler);
+
+ UT_LogsPageIndicator ut_logsPageIndicator;
+ QString resultFileNameForPageIndicator = "c:/ut_logsPageIndicator.xml";
+ UT_ARGS( args_logsPageIndicator, resultFileNameForPageIndicator );
+ QTest::qExec( &ut_logsPageIndicator, args_logsPageIndicator );
+ parser.parseAndPrintResults(resultFileNameForPageIndicator);
+
+ 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();
+ }
+ return 0;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsbaseview.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,434 @@
+/*
+* 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 "logsbaseview.h"
+#include "ut_logsbaseview.h"
+#include "logscomponentrepository.h"
+#include "qthighway_stub_helper.h"
+#include "logscall.h"
+#include "logsmessage.h"
+#include "logscontact.h"
+#include "hbstubs_helper.h"
+#include "logsrecentcallsview.h"
+
+//SYSTEM
+#include <QtTest/QtTest>
+#include <hbmainwindow.h>
+#include <hbaction.h>
+#include <hbinstance.h>
+#include <hbmenu.h>
+#include <dialpad.h>
+#include <hblineedit.h>
+#include <hblistviewitem.h>
+#include <hblistview.h>
+#include <QStringListModel>
+
+void UT_LogsBaseView::initTestCase()
+{
+ mMainWindow = new HbMainWindow();
+ mViewManager = new LogsViewManagerStub(*mMainWindow);
+}
+
+void UT_LogsBaseView::cleanupTestCase()
+{
+ delete mMainWindow;
+ delete mViewManager;
+}
+
+void UT_LogsBaseView::init()
+{
+ mRepository = new LogsComponentRepository( *mViewManager );
+ mBaseView = new LogsBaseView( LogsRecentViewId, *mRepository, *mViewManager );
+}
+
+void UT_LogsBaseView::cleanup()
+{
+ delete mBaseView;
+ mBaseView = 0;
+ delete mRepository;
+ mRepository = 0;
+}
+
+void UT_LogsBaseView::testConstructor()
+{
+ QVERIFY( mBaseView );
+ QVERIFY( mBaseView->mSoftKeyBackAction );
+ QVERIFY( !mBaseView->mShowFilterMenu );
+ QVERIFY( !mBaseView->mInitialized );
+ QVERIFY( mBaseView->mActionMap.isEmpty() );
+ QVERIFY( mBaseView->viewId() == LogsRecentViewId );
+ QVERIFY( mBaseView->mDialpad );
+ QVERIFY( !mBaseView->mCall );
+ QVERIFY( !mBaseView->mMessage );
+ QVERIFY( !mBaseView->mContact );
+ QVERIFY( !mBaseView->mCallTypeMapper );
+}
+
+void UT_LogsBaseView::testActivated()
+{
+ mBaseView->activated(false, QVariant());
+ QVERIFY( !mBaseView->mDialpad->isVisible() );
+ QVERIFY( mBaseView->mInitialized );
+ QVERIFY( !mBaseView->mShowFilterMenu );
+ QVERIFY( mBaseView->mActionMap.count() == 4 );
+
+ mBaseView->activated(true, QVariant());
+ QVERIFY( mBaseView->mDialpad->isOpen() );
+}
+
+void UT_LogsBaseView::testDeactivated()
+{
+ mBaseView->deactivated(); // NOP
+}
+
+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() == "" );
+}
+
+void UT_LogsBaseView::testShowFilterMenu()
+{
+ HbStubHelper::reset();
+ //no context menu
+ QVERIFY( !mBaseView->mShowFilterMenu );
+ mBaseView->showFilterMenu();
+ QVERIFY( !HbStubHelper::menuShown() );
+
+ //contect menu exists
+ mBaseView->mShowFilterMenu = new HbMenu();
+ QVERIFY( mBaseView->mShowFilterMenu );
+ mBaseView->showFilterMenu();
+ QVERIFY( HbStubHelper::menuShown() );
+ delete mBaseView->mShowFilterMenu;
+ mBaseView->mShowFilterMenu = 0;
+}
+
+void UT_LogsBaseView::testOpenDialpad()
+{
+ QVERIFY( !mBaseView->mDialpad->isOpen() );
+ mBaseView->openDialpad();
+ QVERIFY( mBaseView->mDialpad->isOpen() );
+}
+
+void UT_LogsBaseView::testSetDialpadPostion()
+{
+ QPointF pos = mBaseView->mDialpad->pos();
+ HbMainWindow& window = mBaseView->mViewManager.mainWindow();
+
+ window.setOrientation( Qt::Horizontal );
+ mBaseView->setDialpadPosition();
+ QVERIFY( pos != mBaseView->mDialpad->pos() );
+ pos = mBaseView->mDialpad->pos();
+
+ window.setOrientation( Qt::Vertical );
+ mBaseView->setDialpadPosition();
+ QVERIFY( pos != mBaseView->mDialpad->pos() );
+}
+
+void UT_LogsBaseView::testDialpadClosed()
+{
+ mBaseView->mDialpad->editor().setText( QString("hello") );
+ mBaseView->dialpadClosed();
+ QVERIFY( mBaseView->mDialpad->editor().text().isEmpty() );
+}
+
+
+void UT_LogsBaseView::testDialpadEditorTextChanged()
+{
+ //text editor is one character long
+ mBaseView->mDialpad->editor().setText( QString("h") );
+ mBaseView->dialpadEditorTextChanged();
+ QVERIFY( mViewManager->mViewId == LogsMatchesViewId );
+
+ mViewManager->reset();
+ mBaseView->mDialpad->mIsCallButtonEnabled = true;
+ mBaseView->mDialpad->editor().setText( QString("") );
+ mBaseView->dialpadEditorTextChanged();
+ QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
+ QVERIFY( !mBaseView->mDialpad->mIsCallButtonEnabled );
+}
+
+void UT_LogsBaseView::testChangeFilter()
+{
+ QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
+ HbAction* action = new HbAction();
+ action->setObjectName(logsShowFilterMissedMenuActionId);
+ mBaseView->changeFilter(action);
+ QVERIFY( mViewManager->mViewId == LogsRecentViewId );
+}
+
+void UT_LogsBaseView::testModel()
+{
+ QVERIFY( !mBaseView->model() );
+}
+
+void UT_LogsBaseView::testOpenContactsApp()
+{
+ QtHighwayStubHelper::reset();
+ mBaseView->openContactsApp();
+ QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.phonebookappservices.Launch" );
+ QVERIFY( QtHighwayStubHelper::message() == "launch()" );
+}
+
+
+void UT_LogsBaseView::testInitiateCallback()
+{
+ LogsCall::resetTestData();
+ //call can't be created
+ QVERIFY( !mBaseView->mCall );
+ mBaseView->initiateCallback(QModelIndex());
+ QVERIFY( LogsCall::lastCalledFuntion().isEmpty() );
+
+ //call can be created should be tested in derived class
+}
+
+void UT_LogsBaseView::testInitiateCall()
+{
+ LogsCall::resetTestData();
+ //no call
+ QVERIFY( !mBaseView->mCall );
+ mBaseView->initiateCall(LogsCall::TypeLogsVoiceCall);
+ QVERIFY( LogsCall::lastCalledFuntion().isEmpty() );
+
+ //call exists
+ mBaseView->mCall = new LogsCall();
+ mBaseView->initiateCall(LogsCall::TypeLogsVideoCall);
+ QVERIFY( LogsCall::lastCalledFuntion() == QString("call") );
+ QVERIFY( mBaseView->mCall->mTestLastCallType == LogsCall::TypeLogsVideoCall );
+}
+
+void UT_LogsBaseView::testShowListItemMenu()
+{
+ HbStubHelper::reset();
+
+ mBaseView->mDialpad->openDialpad();
+ //menu doen't have any actions
+ HbListViewItem* item = new HbListViewItem();
+ mBaseView->showListItemMenu( item, QPointF() );
+ QVERIFY( HbStubHelper::widgetActionsCount() == 0 );
+ QVERIFY( !HbStubHelper::menuShown() );
+ //check that dialpad has closed
+ QVERIFY( !mBaseView->mDialpad->isVisible() );
+
+ //menu has actions and can be executed should be tested in derived class
+ }
+
+void UT_LogsBaseView::testPopulateListItemMenu()
+{
+ HbStubHelper::reset();
+ //no call/message/contact, menu has not actions
+ HbMenu menu;
+ mBaseView->populateListItemMenu(menu);
+ QVERIFY( HbStubHelper::widgetActionsCount() == 0 );
+
+ //call, message and contact exist, menu has actions
+ mBaseView->mCall = new LogsCall();
+ mBaseView->mMessage = new LogsMessage();
+ mBaseView->mContact = new LogsContact();
+ mBaseView->populateListItemMenu(menu);
+ QVERIFY( HbStubHelper::widgetActionsCount() == 5 );
+}
+
+
+
+void UT_LogsBaseView::testCloseEmptyMenu()
+{
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+
+ //visible actions exist
+ QVERIFY( view->menu()->actions().count() > 0 );
+ HbStubHelper::setWidgetOpen(true);
+ view->closeEmptyMenu();
+ QVERIFY(HbStubHelper::isWidgetOpen());
+
+ //no visible actions
+ foreach (QAction* action, view->menu()->actions()) {
+ action->setVisible(false);
+ }
+ view->closeEmptyMenu();
+ QVERIFY(!HbStubHelper::isWidgetOpen());
+
+ //no actions
+ HbStubHelper::setWidgetOpen(true);
+ view->menu()->actions().clear();
+ view->closeEmptyMenu();
+ QVERIFY(!HbStubHelper::isWidgetOpen());
+}
+
+void UT_LogsBaseView::testSaveContact()
+{
+ //no contact, no actions
+ mBaseView->saveContact();
+
+ //contact exists, popup would be shown
+ mBaseView->mContact = new LogsContact();
+ mBaseView->saveContact();
+}
+
+void UT_LogsBaseView::testUpdateCall()
+{
+ mBaseView->mCall = new LogsCall();
+ mBaseView->updateCall( QModelIndex() );
+ QVERIFY( !mBaseView->mCall );
+}
+
+void UT_LogsBaseView::testUpdateMessage()
+{
+ mBaseView->mMessage = new LogsMessage();
+ mBaseView->updateMessage( QModelIndex() );
+ QVERIFY( !mBaseView->mMessage );
+}
+
+void UT_LogsBaseView::testUpdateContact()
+{
+ mBaseView->mContact = new LogsContact();
+ mBaseView->updateContact( QModelIndex() );
+ QVERIFY( !mBaseView->mContact );
+}
+
+void UT_LogsBaseView::testActivateEmptyListIndicator()
+{
+ QStringListModel model;
+
+ // Label not in repository
+ QVERIFY( !mBaseView->mEmptyListLabel );
+ mBaseView->activateEmptyListIndicator(&model);
+ QVERIFY( !mBaseView->mEmptyListLabel );
+
+ // Empty model, label is set visible
+ mRepository->recentCallsView();
+ QVERIFY( !mBaseView->mEmptyListLabel );
+ mBaseView->activateEmptyListIndicator(&model);
+ QVERIFY( mBaseView->mEmptyListLabel );
+
+ // Label exists already, situation does not change
+ mBaseView->activateEmptyListIndicator(&model);
+ QVERIFY( mBaseView->mEmptyListLabel );
+
+ // Null list does nothing
+ mBaseView->activateEmptyListIndicator(0);
+ QVERIFY( mBaseView->mEmptyListLabel );
+}
+
+void UT_LogsBaseView::testDeactivateEmptyListIndicator()
+{
+ QVERIFY( !mBaseView->mEmptyListLabel );
+ mBaseView->deactivateEmptyListIndicator(0);
+ HbLabel label;
+ mBaseView->mEmptyListLabel = &label;
+ mBaseView->deactivateEmptyListIndicator(0);
+ QVERIFY( mBaseView->mEmptyListLabel ); // Label not removed at deactivation
+}
+
+void UT_LogsBaseView::testUpdateEmptyListLabelVisibility()
+{
+ // Base view does not have model, nothing happens
+ mBaseView->updateEmptyListLabelVisibility();
+}
+
+void UT_LogsBaseView::testUpdateListLayoutName()
+{
+ mBaseView->mViewManager.mainWindow().setOrientation( Qt::Vertical );
+ HbListView list;
+
+ //default layout
+ list.setLayoutName("dummy");
+ mBaseView->updateListLayoutName(list);
+ QVERIFY( list.layoutName() == logsListDefaultLayout );
+
+ //same layout, not updated
+ mBaseView->updateListLayoutName(list);
+ QVERIFY( list.layoutName() == logsListDefaultLayout );
+
+ //landscape without dialpad
+ mBaseView->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
+ mBaseView->updateListLayoutName(list);
+ QVERIFY( list.layoutName() == logsListLandscapeLayout );
+
+ //landscape with dialpad
+ mBaseView->mDialpad->openDialpad();
+ mBaseView->updateListLayoutName(list);
+ QVERIFY( list.layoutName() == logsListLandscapeDialpadLayout );
+
+ //landscape with dialpad, ignoreDialpad is true
+ mBaseView->updateListLayoutName(list, true);
+ QVERIFY( list.layoutName() == logsListDefaultLayout );
+
+ //landscape without dialpad, ignoreDialpad is true
+ mBaseView->mDialpad->closeDialpad();
+ mBaseView->updateListLayoutName(list, true);
+ QVERIFY( list.layoutName() == logsListLandscapeLayout );
+}
+
+void UT_LogsBaseView::testUpdateListSize()
+{
+ mBaseView->mLayoutSectionName = "dummy";
+
+ //default section is loaded
+ mBaseView->mViewManager.mainWindow().setOrientation( Qt::Vertical );
+ mBaseView->mDialpad->closeDialpad();
+ mBaseView->updateListSize();
+ QVERIFY( mBaseView->mLayoutSectionName == logsViewDefaultSection );
+
+ //same section again, not loaded
+ mBaseView->updateListSize();
+ QVERIFY( mBaseView->mLayoutSectionName == logsViewDefaultSection );
+
+ //portrait with dialpad
+ mBaseView->mDialpad->openDialpad();
+ mBaseView->updateListSize();
+ QVERIFY( mBaseView->mLayoutSectionName == logsViewPortraitDialpadSection );
+
+ //landscape with dialpad
+ mBaseView->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
+ mBaseView->updateListSize();
+ QVERIFY( mBaseView->mLayoutSectionName == logsViewLandscapeDialpadSection );
+}
+
+void UT_LogsBaseView::testHandleOrientationChanged()
+{
+ //dialpad position recalculated
+ QPointF pos;
+ mBaseView->mDialpad->setPos(pos);
+ mBaseView->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
+ mBaseView->handleOrientationChanged();
+ QVERIFY( pos != mBaseView->mDialpad->pos() );
+}
+
+void UT_LogsBaseView::testHandleExit()
+{
+ mViewManager->reset();
+ mBaseView->handleExit();
+ QVERIFY( mViewManager->mExitCalled );
+}
+
+void UT_LogsBaseView::testIsExitAllowed()
+{
+ QVERIFY( mBaseView->isExitAllowed() );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logscomponentrepository.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* 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_logscomponentrepository.h"
+#include "logsrecentcallsview.h"
+#include "logsdetailsview.h"
+#include "logsmatchesview.h"
+#include "logscomponentrepository.h"
+#include "logsdefs.h"
+
+//SYSTEM
+#include <QtTest/QtTest>
+#include <hbmainwindow.h>
+
+void UT_LogsComponentRepository::initTestCase()
+{
+ mMainWindow = new HbMainWindow();
+ mViewManager = new LogsViewManagerStub(*mMainWindow);
+}
+
+void UT_LogsComponentRepository::cleanupTestCase()
+{
+ delete mMainWindow;
+ delete mViewManager;
+}
+
+
+void UT_LogsComponentRepository::init()
+{
+ mRepository = new LogsComponentRepository(*mViewManager);
+}
+
+void UT_LogsComponentRepository::cleanup()
+{
+ delete mRepository;
+ mRepository = 0;
+}
+
+void UT_LogsComponentRepository::testConstructor()
+{
+ QVERIFY( !mRepository->mRecentCallsView );
+ QVERIFY( !mRepository->mDetailsView );
+ QVERIFY( !mRepository->mMatchesView );
+ QVERIFY( !mRepository->mDialpad );
+ QVERIFY( !mRepository->mDialpadKeyHandler );
+ QVERIFY( mRepository->mModel );
+}
+
+void UT_LogsComponentRepository::testRecentCallsView()
+{
+ //loading view
+ QVERIFY( !mRepository->mRecentCallsView );
+ QVERIFY( mRepository->mRecentViewComponents.count() == 0 );
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ QVERIFY( view );
+ QCOMPARE( view->objectName(), QString( logsRecentCallsViewId ) );
+
+ //view already loaded
+ LogsRecentCallsView* view2 = mRepository->recentCallsView();
+ QVERIFY( view == view2 );
+ delete view;
+}
+
+void UT_LogsComponentRepository::testDetailsView()
+{
+ //loading view
+ QVERIFY( !mRepository->mDetailsView );
+ QVERIFY( mRepository->mDetailsViewComponents.count() == 0 );
+ LogsDetailsView* view = mRepository->detailsView();
+ QVERIFY( view );
+ QCOMPARE( view->objectName(), QString( logsDetailsViewId ) );
+
+ //view already loaded
+ LogsDetailsView* view2 = mRepository->detailsView();
+ QVERIFY( view == view2 );
+ delete view;
+}
+
+void UT_LogsComponentRepository::testMatchesView()
+{
+ //loading view
+ QVERIFY( !mRepository->mMatchesView );
+ QVERIFY( mRepository->mMatchesViewComponents.count() == 0 );
+ LogsMatchesView* view = mRepository->matchesView();
+ QVERIFY( view );
+ QCOMPARE( view->objectName(), QString( logsMatchesViewId ) );
+
+ //view already loaded
+ LogsMatchesView* view2 = mRepository->matchesView();
+ QVERIFY( view == view2 );
+ delete view;
+}
+
+void UT_LogsComponentRepository::testDialpad()
+{
+ //first call, dialpad and dialpadkeyhandler created as a result of the call
+ QVERIFY( !mRepository->mDialpad );
+ QVERIFY( !mRepository->mDialpadKeyHandler );
+ Dialpad* dialpad = mRepository->dialpad();
+ QVERIFY( dialpad );
+ QVERIFY( dialpad == mRepository->mDialpad );
+ QVERIFY( mRepository->mDialpadKeyHandler );
+ DialpadKeyHandler* prevKeyHandler = mRepository->mDialpadKeyHandler;
+ //all the next calls, return the same instance of the dialer
+ QVERIFY( dialpad == mRepository->dialpad() );
+ QVERIFY( prevKeyHandler == mRepository->mDialpadKeyHandler );
+}
+
+void UT_LogsComponentRepository::testLoadSection()
+{
+ //Unknow viewId, section is not loaded
+ QVERIFY( !mRepository->loadSection(LogsUnknownViewId, "default") );
+
+ //loading of non-existing section
+ QVERIFY( mRepository->loadSection(LogsDetailsViewId, "dummy") );
+
+ //loading of existing section is ok
+ mRepository->matchesView();
+ QVERIFY( mRepository->loadSection(LogsMatchesViewId, "default") );
+ mRepository->recentCallsView();
+ QVERIFY( mRepository->loadSection(LogsRecentViewId, "default") );
+}
+
+void UT_LogsComponentRepository::testAddToolbarToObjectList()
+{
+ //toolbar widget not found in docml
+ QVERIFY( mRepository->mRecentViewComponents.count() == 0 );
+ mRepository->addToolbarToObjectList( mRepository->mRecentViewComponents );
+ QVERIFY( mRepository->mRecentViewComponents.count() == 0 );
+
+ //toolbar found and added to object list
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ mRepository->mRecentViewComponents.clear();
+ mRepository->addToolbarToObjectList( mRepository->mRecentViewComponents );
+ QVERIFY( mRepository->mRecentViewComponents.count() == 1 );
+ QVERIFY( mRepository->mRecentViewComponents.at(0)->objectName() == logsToolbarId );
+ delete view;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsdetailsview.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,289 @@
+/*
+* 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 "logsdetailsview.h"
+#include "ut_logsdetailsview.h"
+#include "logscomponentrepository.h"
+#include "logsdetailsmodel.h"
+#include "logscall.h"
+#include "logsmessage.h"
+#include "logsdefs.h"
+
+//SYSTEM
+#include <QtTest/QtTest>
+#include <hbmainwindow.h>
+#include <hblistview.h>
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hblistviewitem.h>
+#include <hbmenu.h>
+#include <hblineedit.h>
+#include <hbgroupbox.h>
+#include <dialpad.h>
+#include <hbmessagebox.h>
+
+Q_DECLARE_METATYPE(LogsDetailsModel *)
+
+
+void UT_LogsDetailsView::initTestCase()
+{
+ mMainWindow = new HbMainWindow();
+ mViewManager = new LogsViewManagerStub(*mMainWindow);
+}
+
+void UT_LogsDetailsView::cleanupTestCase()
+{
+ delete mMainWindow;
+ delete mViewManager;
+}
+
+void UT_LogsDetailsView::init()
+{
+ mRepository = new LogsComponentRepository(*mViewManager);
+ mDetailsView = new LogsDetailsView( *mRepository, *mViewManager );
+}
+
+void UT_LogsDetailsView::cleanup()
+{
+ delete mDetailsView;
+ delete mRepository;
+}
+
+void UT_LogsDetailsView::testConstructor()
+{
+ QVERIFY(mDetailsView);
+ QVERIFY(mDetailsView->mSoftKeyBackAction);
+ QVERIFY(mDetailsView->viewId() == LogsDetailsViewId );
+ QVERIFY(!mDetailsView->mDetailsModel);
+}
+
+void UT_LogsDetailsView::testActivated()
+{
+ //list widget can't be found from repository
+/* //TODO: Q_ASSERT_X
+ LogsDetailsModel* model = new LogsDetailsModel;
+ QVariant arg = qVariantFromValue( model );
+ mDetailsView->activated(false, arg);
+ QVERIFY(!mDetailsView->mListView);
+*/
+ //list widget is in repository
+ LogsDetailsModel* model2 = new LogsDetailsModel;
+ QVariant arg2 = qVariantFromValue( model2 );
+ LogsDetailsView* view = mRepository->detailsView();
+ QVERIFY( !view->mInitialized );
+ view->activated(false, arg2);
+ QVERIFY( view->mInitialized );
+ QVERIFY(view->mListView);
+ QVERIFY(view->mDetailsModel == model2);
+ QVERIFY(view->mListView->model() == model2);
+ QVERIFY(view->mActionMap.count() == 4);
+
+ LogsDetailsModel* model3 = new LogsDetailsModel();
+ QVariant arg3 = qVariantFromValue( model3 );
+ mDetailsView->activated(false, arg3);
+ QVERIFY( mDetailsView->mDetailsModel == model3);
+ QVERIFY(view->mListView->model() == model3);
+ //QT_NO_DEBUG_OUTPUT
+}
+
+void UT_LogsDetailsView::testDeactivated()
+{
+ // Deactivation of not properly activated view
+ LogsDetailsView* view = mRepository->detailsView();
+ QVERIFY( !view->mListView );
+ view->deactivated();
+ QVERIFY( !view->mListView );
+ QVERIFY( !view->mDetailsModel );
+
+ // Deactivation of properly activated view
+ LogsDetailsModel* model = new LogsDetailsModel;
+ QVariant arg = qVariantFromValue( model );
+ view->activated(false, arg);
+ QVERIFY( view->mListView );
+ view->deactivated();
+ QVERIFY( view->mListView );
+ QVERIFY( !view->mDetailsModel );
+}
+
+void UT_LogsDetailsView::testHandleBackSoftkey()
+{
+ mViewManager->reset();
+ mDetailsView->handleBackSoftkey();
+ QVERIFY( mViewManager->mPreviousActivated );
+}
+
+void UT_LogsDetailsView::testCallKeyPressed()
+{
+ // No call, nothing happens
+ QVERIFY( !mDetailsView->mCall );
+ mDetailsView->callKeyPressed();
+ LogsDetailsModel* model = new LogsDetailsModel();
+
+ // Calling possible
+ delete model->mEvent;
+ model->mEvent = 0;
+ model->mEvent = new LogsEvent();
+ QVariant arg = qVariantFromValue( model );
+ mRepository->detailsView();
+ mDetailsView->activated(false, arg);
+ QVERIFY( mDetailsView->mCall );
+ mDetailsView->callKeyPressed();
+ QVERIFY( mDetailsView->mCall->mTestLastCallType != -1 );
+}
+
+void UT_LogsDetailsView::testInitiateVoiceCall()
+{
+ // No call, nothing happens
+ QVERIFY( !mDetailsView->mCall );
+ mDetailsView->initiateVoiceCall();
+
+ // Call possible
+ mDetailsView->mCall = new LogsCall;
+ mDetailsView->initiateVoiceCall();
+ QVERIFY( mDetailsView->mCall->mTestLastCallType == LogsCall::TypeLogsVoiceCall );
+}
+
+void UT_LogsDetailsView::testInitiateVideoCall()
+{
+ // No call, nothing happens
+ QVERIFY( !mDetailsView->mCall );
+ mDetailsView->initiateVideoCall();
+
+ // Call possible
+ mDetailsView->mCall = new LogsCall;
+ mDetailsView->initiateVideoCall();
+ QVERIFY( mDetailsView->mCall->mTestLastCallType == LogsCall::TypeLogsVideoCall );
+}
+
+void UT_LogsDetailsView::testUpdateMenu()
+{
+ // No model, nothing happens
+ mDetailsView->updateMenu();
+
+ // No call, call actions disabled
+ QVERIFY( !mDetailsView->mCall );
+ mRepository->detailsView(); // Set correct object tree
+ LogsDetailsModel* model = new LogsDetailsModel();
+ QVariant arg = qVariantFromValue( model );
+ mDetailsView->activated(false, arg);
+ mDetailsView->updateMenu();
+ QObject* obj = mRepository->findObject( logsDetailsViewVoiceCallMenuActionId );
+ HbAction* voiceCallAction = qobject_cast<HbAction*>( obj );
+ QObject* obj2 = mRepository->findObject( logsCommonVideoCallMenuActionId );
+ HbAction* videoCallAction = qobject_cast<HbAction*>( obj2 );
+ QObject* obj3 = mRepository->findObject( logsCommonMessageMenuActionId );
+ HbAction* messageAction = qobject_cast<HbAction*>( obj3 );
+ QVERIFY( !voiceCallAction->isVisible() );
+ QVERIFY( !videoCallAction->isVisible() );
+ QVERIFY( !messageAction->isVisible() );
+
+ // Call exists, call actions enabled
+ model->mEvent = new LogsEvent;
+ mDetailsView->updateMenu();
+ QVERIFY( voiceCallAction->isVisible() );
+ QVERIFY( videoCallAction->isVisible() );
+ QVERIFY( messageAction->isVisible() );
+}
+
+void UT_LogsDetailsView::testDeleteEvent()
+{
+ // No model, nothing happens
+ QVERIFY( LogsDetailsModel::mLastCallName.isEmpty() );
+ QVERIFY( !mDetailsView->mDetailsModel );
+ mDetailsView->deleteEvent();
+ QVERIFY( LogsDetailsModel::mLastCallName.isEmpty() );
+
+ // Model exists, call to delete event made and view is closed
+ mViewManager->reset();
+ LogsDetailsModel* model = new LogsDetailsModel();
+ mDetailsView->mDetailsModel = model;
+ //simulate "Cancel" button press of messagebox
+ HbMessageBox().setText(tr("Cancel"));
+ mDetailsView->deleteEvent();
+ QVERIFY( LogsDetailsModel::mLastCallName.isEmpty() );
+
+ //simulate "Ok" button press of messagebox
+ HbMessageBox().setText(tr("Ok"));
+ mDetailsView->deleteEvent();
+ QVERIFY( LogsDetailsModel::mLastCallName == QString("clearEvent") );
+ QVERIFY( mViewManager->mPreviousActivated );
+}
+
+void UT_LogsDetailsView::testCopyNumberToClipboard()
+{
+ LogsDetailsModel* model = new LogsDetailsModel();
+ mDetailsView->mDetailsModel = model;
+ mDetailsView->copyNumberToClipboard();
+ QVERIFY( LogsDetailsModel::mLastCallName == QString("getNumberToClipboard") );
+}
+
+void UT_LogsDetailsView::testChangeFilter()
+{
+ mViewManager->reset();
+ HbAction action;
+ action.setObjectName(logsShowFilterMissedMenuActionId);
+ mDetailsView->changeFilter(&action);
+ QVERIFY( mViewManager->mViewId == LogsRecentViewId );
+ QVERIFY( mViewManager->mArgs.toInt() == (int)LogsServices::ViewAll );
+}
+
+void UT_LogsDetailsView::testContactActionCompleted()
+{
+ // No viewname for some reason, no effect
+ HbGroupBox viewName;
+ LogsDetailsModel* model = new LogsDetailsModel();
+ mDetailsView->mDetailsModel = model;
+ mDetailsView->contactActionCompleted(true);
+
+ // Contact modified, viewname updated accordingly
+ mDetailsView->mViewName = &viewName;
+ model->mEvent = new LogsEvent;
+ model->mEvent->setRemoteParty("someparty");
+ mDetailsView->contactActionCompleted(true);
+ QVERIFY( mDetailsView->mViewName->heading().length() > 0 );
+
+ // No effect if no contact modify occurred
+ mDetailsView->mViewName->setHeading("");
+ mDetailsView->contactActionCompleted(false);
+ QVERIFY( mDetailsView->mViewName->heading().length() == 0 );
+}
+
+void UT_LogsDetailsView::testModel()
+{
+ QVERIFY( !mDetailsView->model() );
+ mDetailsView->mDetailsModel = new LogsDetailsModel();
+ QVERIFY( mDetailsView->model() );
+}
+
+void UT_LogsDetailsView::testUpdateWidgetsSizeAndLayout()
+{
+ //no listView, nothing happens
+ QVERIFY( !mDetailsView->mListView );
+ mDetailsView->updateWidgetsSizeAndLayout();
+
+ HbListView list;
+ //listView exists, layout and size updated
+ mDetailsView->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
+ mDetailsView->mDialpad->openDialpad();
+ mDetailsView->mListView = &list;
+ mDetailsView->mListView->setLayoutName("dummy");
+ mDetailsView->mLayoutSectionName = "dummy";
+ mDetailsView->updateWidgetsSizeAndLayout();
+ QVERIFY( mDetailsView->mListView->layoutName() == logsListDefaultLayout );
+ QVERIFY( mDetailsView->mLayoutSectionName == logsViewLandscapeDialpadSection );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logseffecthandler.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* 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_logseffecthandler.h"
+#include "logseffecthandler.h"
+
+//SYSTEM
+#include <QtTest/QtTest>
+#include <hblabel.h>
+#include <hbmainwindow.h>
+
+
+void UT_LogsEffectHandler::initTestCase()
+{
+}
+
+void UT_LogsEffectHandler::cleanupTestCase()
+{
+}
+
+
+void UT_LogsEffectHandler::init()
+{
+ mEffect = new LogsEffectHandler();
+ mLabel = new HbLabel();
+ mLabel2 = new HbLabel();
+}
+
+void UT_LogsEffectHandler::cleanup()
+{
+ delete mEffect;
+ mEffect = 0;
+ delete mLabel;
+ mLabel = 0;
+ delete mLabel2;
+ mLabel2 = 0;
+}
+
+void UT_LogsEffectHandler::testConstructor()
+{
+ QVERIFY( mEffect );
+}
+
+void UT_LogsEffectHandler::testStartDissappearAppearByFadingEffect()
+{
+ QVERIFY( mEffect->mFadeGroup->state() == QAbstractAnimation::Stopped );
+ mEffect->startDissappearAppearByFadingEffect(*mLabel);
+ QVERIFY( mEffect->mFadeGroup->state() == QAbstractAnimation::Running );
+
+ // Simulate animation progess, when dissappearing has completed effecthandler
+ // sends signal, other progress in anim does not cause signal to be sent
+ QSignalSpy spy(mEffect, SIGNAL(dissappearByFadingComplete()));
+ mEffect->fadeAnimationChanged(mEffect->mFadeGroup->animationAt(1));
+ QVERIFY(spy.count() == 1 );
+ mEffect->fadeAnimationChanged(0);
+ QVERIFY(spy.count() == 1 );
+
+ // When effect is running and new effect is requested, previous effect is stopped
+ mEffect->startDissappearAppearByFadingEffect(*mLabel);
+}
+
+void UT_LogsEffectHandler::testStartDissappearAppearByMovingEffect()
+{
+ QVERIFY( mEffect->mMoveGroup->state() == QAbstractAnimation::Stopped );
+ mEffect->startDissappearAppearByMovingEffect(*mLabel, *mLabel2, false, 0);
+ QVERIFY( mEffect->mMoveGroup->state() == QAbstractAnimation::Running );
+ QVERIFY( mEffect->mMoveGroup2->state() == QAbstractAnimation::Running );
+
+ // Simulate animation progess, when dissappearing has completed effecthandler
+ // sends signal, other progress in anim does not cause signal to be sent
+ QSignalSpy spy(mEffect, SIGNAL(dissappearByMovingComplete()));
+ mEffect->moveAnimationChanged(mEffect->mMoveGroup->animationAt(1));
+ QVERIFY(spy.count() == 1 );
+ mEffect->moveAnimationChanged(0);
+ QVERIFY(spy.count() == 1 );
+
+ // When effect is running and new effect is requested, previous effect is stopped
+ mEffect->startDissappearAppearByMovingEffect(*mLabel, *mLabel2, true, 0);
+}
+
+void UT_LogsEffectHandler::testStartMoveNotPossibleEffect()
+{
+ QVERIFY( mEffect->mMoveNotPossibleGroup->state() == QAbstractAnimation::Stopped );
+ mEffect->startMoveNotPossibleEffect(*mLabel, false, 0);
+ QVERIFY( mEffect->mMoveNotPossibleGroup->state() == QAbstractAnimation::Running );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmainwindow.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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_logsmainwindow.h"
+#include "logsmainwindow.h"
+#include "qthighway_stub_helper.h"
+#include "hbstubs_helper.h"
+
+//SYSTEM
+#include <QtTest/QtTest>
+#include <hbmainwindow.h>
+#include <QKeyEvent>
+
+void UT_LogsMainWindow::initTestCase()
+{
+
+}
+
+void UT_LogsMainWindow::cleanupTestCase()
+{
+
+}
+
+
+void UT_LogsMainWindow::init()
+{
+ mMainWindow = new LogsMainWindow;
+}
+
+void UT_LogsMainWindow::cleanup()
+{
+ delete mMainWindow;
+ mMainWindow = 0;
+}
+
+void UT_LogsMainWindow::testKeyPressEvent()
+{
+ QSignalSpy spy( mMainWindow, SIGNAL(callKeyPressed()) );
+ // Not handled
+ QKeyEvent event( QEvent::KeyPress, Qt::Key_Hangup, Qt::NoModifier);
+ mMainWindow->keyPressEvent( &event );
+ QVERIFY( spy.count() == 0 );
+
+ // Handled
+ QKeyEvent event2( QEvent::KeyPress, Qt::Key_Yes, Qt::NoModifier);
+ mMainWindow->keyPressEvent( &event2 );
+ QVERIFY( spy.count() == 1 );
+
+}
+
+void UT_LogsMainWindow::testSendAppToBackground()
+{
+ QtHighwayStubHelper::reset();
+ mMainWindow->sendAppToBackground();
+ QVERIFY( QtHighwayStubHelper::utilToBackground() );
+ QVERIFY( !mMainWindow->isForeground() );
+}
+
+void UT_LogsMainWindow::testBringAppToForeground()
+{
+ QtHighwayStubHelper::reset();
+ HbStubHelper::reset();
+ mMainWindow->bringAppToForeground();
+ QVERIFY( HbStubHelper::isWidgetRaised() );
+ QVERIFY( mMainWindow->isForeground() );
+
+ // Subsequent call does not raise more
+ HbStubHelper::reset();
+ mMainWindow->bringAppToForeground();
+ QVERIFY( !HbStubHelper::isWidgetRaised() );
+ QVERIFY( mMainWindow->isForeground() );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmatchesview.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,391 @@
+/*
+* 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 "logsmatchesview.h"
+#include "ut_logsmatchesview.h"
+#include "logscomponentrepository.h"
+#include "logsdefs.h"
+#include "logsmatchesmodel.h"
+#include "logscall.h"
+#include "logsmodel.h"
+#include "logscontact.h"
+#include "logsmessage.h"
+
+//SYSTEM
+#include <QtTest/QtTest>
+#include <hblistview.h>
+#include <hblabel.h>
+#include <dialpad.h>
+#include <hblineedit.h>
+#include <hbpushbutton.h>
+
+Q_DECLARE_METATYPE(LogsMatchesModel*)
+
+
+void UT_LogsMatchesView::initTestCase()
+{
+ mMainWindow = new HbMainWindow();
+ mViewManager = new LogsViewManagerStub(*mMainWindow);
+}
+
+void UT_LogsMatchesView::cleanupTestCase()
+{
+ delete mMainWindow;
+ delete mViewManager;
+}
+
+void UT_LogsMatchesView::init()
+{
+ mRepository = new LogsComponentRepository(*mViewManager);
+ mMatchesView = new LogsMatchesView( *mRepository, *mViewManager );
+}
+
+void UT_LogsMatchesView::cleanup()
+{
+ delete mMatchesView;
+ delete mRepository;
+}
+
+void UT_LogsMatchesView::testConstructor()
+{
+ QVERIFY( mMatchesView );
+ QVERIFY( mMatchesView->viewId() == LogsMatchesViewId );
+ QVERIFY( !mMatchesView->mListView );
+ QVERIFY( !mMatchesView->mModel );
+ QVERIFY( mMatchesView->mActionMap.count() == 0 );
+ QVERIFY( mMatchesView->mLayoutSectionName == "" );
+ QVERIFY( !mMatchesView->mAddToContactsButton );
+}
+
+void UT_LogsMatchesView::testActivated()
+{
+ //activate for the first time
+ mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical );
+ mRepository->matchesView();
+ QVERIFY( !mMatchesView->mInitialized );
+ QVERIFY( !mMatchesView->mListView );
+ QVERIFY( !mMatchesView->mModel );
+ QVERIFY( mMatchesView->mActionMap.count() == 0 );
+ mMatchesView->activated( false,QVariant() );
+ QVERIFY( mMatchesView->mInitialized );
+ QVERIFY( mMatchesView->mListView );
+ QVERIFY( mMatchesView->mModel );
+ QVERIFY( mMatchesView->mActionMap.count() == 4 );
+ QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout );
+ QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection );
+ QVERIFY( mMatchesView->mAddToContactsButton );
+
+ //activate once again, model recreated
+ mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
+ LogsModel::setMatchesModelCreated(false);
+ mMatchesView->activated( true,QVariant() );
+ QVERIFY( mMatchesView->mListView );
+ QVERIFY( mMatchesView->mModel );
+ QVERIFY( LogsModel::isMatchesModelCreated() ); //model recreated
+ QVERIFY( mMatchesView->mActionMap.count() == 4 );
+ QVERIFY( mMatchesView->mListView->layoutName() == logsListLandscapeDialpadLayout );
+ QVERIFY( mMatchesView->mLayoutSectionName == logsViewLandscapeDialpadSection );
+
+ //Pass model as input arg
+ LogsDbConnector* dbConnector = 0;
+ LogsMatchesModel* model1 = new LogsMatchesModel(*dbConnector);
+ QVariant arg = qVariantFromValue( model1 );
+ mMatchesView->activated( true, arg );
+ QVERIFY( mMatchesView->mListView );
+ QVERIFY( mMatchesView->mModel == model1 );
+
+ LogsMatchesModel* model2 = new LogsMatchesModel(*dbConnector);
+ QVariant arg2 = qVariantFromValue( model2 );
+ mMatchesView->activated( true, arg2 );
+ QVERIFY( mMatchesView->mListView );
+ QVERIFY( mMatchesView->mModel == model2 );
+
+ // After passing model as input arg, do not pass model
+ mMatchesView->activated( true,QVariant() );
+ QVERIFY( mMatchesView->mListView );
+ QVERIFY( mMatchesView->mModel );
+ QVERIFY( mMatchesView->mModel != model1 );
+ QVERIFY( mMatchesView->mModel != model2 );
+}
+
+
+void UT_LogsMatchesView::testDeactivated()
+{
+ LogsDbConnector* dbConnector = 0;
+ mMatchesView->mDialpad->editor().setText( "hello" );
+ mMatchesView->mModel = new LogsMatchesModel(*dbConnector);
+ mMatchesView->deactivated();
+ QVERIFY( !mMatchesView->mModel );
+}
+
+void UT_LogsMatchesView::testCallKeyPressed()
+{
+ HbListView list;
+ mMatchesView->mListView = &list;
+ mMatchesView->updateModel(0);
+
+ // No matches, no dialed string, cannot call
+ LogsCall::resetTestData();
+ mMatchesView->mModel->mTextData.clear();
+ mMatchesView->callKeyPressed();
+ QVERIFY( !LogsCall::isCallToNumberCalled() );
+
+ // No any item where to call, but dial string exists
+ QString dial("12345");
+ mMatchesView->mDialpad->editor().setText( dial );
+ mMatchesView->callKeyPressed();
+ QVERIFY( LogsCall::isCallToNumberCalled() );
+
+ // Call is still made with entered number even if matches exists
+ LogsCall::resetTestData();
+ mMatchesView->mModel->mTextData.append("testdata");
+ mMatchesView->mModel->mTextData.append("testdata2");
+ mMatchesView->callKeyPressed();
+ QVERIFY( LogsCall::isCallToNumberCalled() );
+}
+
+void UT_LogsMatchesView::testVideoCallToCurrentNum()
+{
+ LogsCall::resetTestData();
+ QString dial("12345");
+ mMatchesView->mDialpad->editor().setText( dial );
+ mMatchesView->videoCallToCurrentNum();
+ QVERIFY( LogsCall::isCallToNumberCalled() );
+}
+
+void UT_LogsMatchesView::testSendMessageToCurrentNum()
+{
+ LogsMessage::resetTestData();
+ mMatchesView->mDialpad->editor().setText( "" );
+ mMatchesView->sendMessageToCurrentNum();
+ QVERIFY( !LogsMessage::isMessageSent() );
+
+ QString dial("12345");
+ mMatchesView->mDialpad->editor().setText( dial );
+ mMatchesView->sendMessageToCurrentNum();
+ QVERIFY( LogsMessage::isMessageSent() );
+}
+
+void UT_LogsMatchesView::testSaveNumberInDialpadToContacts()
+{
+ // Nothing happens if there is no text in dialpad
+ QVERIFY(!mMatchesView->mContact);
+ QCOMPARE(mMatchesView->mDialpad->editor().text().length(), 0);
+ mMatchesView->saveNumberInDialpadToContacts();
+ QVERIFY(!mMatchesView->mContact);
+
+ // If there is a number, new contact will be created
+ mMatchesView->mDialpad->editor().setText("123");
+ mMatchesView->saveNumberInDialpadToContacts();
+ QVERIFY(mMatchesView->mContact);
+ QCOMPARE(mMatchesView->mContact->mNumber, QString("123"));
+}
+
+void UT_LogsMatchesView::testDialpadEditorTextChanged()
+{
+ //no model, call button gets enabled
+ mMatchesView->mDialpad->mIsCallButtonEnabled = false;
+ mMatchesView->mDialpad->editor().setText( QString("h") );
+ QVERIFY(!mMatchesView->mModel);
+ mMatchesView->dialpadEditorTextChanged();
+ QVERIFY( mMatchesView->mDialpad->mIsCallButtonEnabled );
+
+ //model exists
+ LogsDbConnector* dbConnector = 0;
+ mMatchesView->mModel = new LogsMatchesModel(*dbConnector);
+ mMatchesView->dialpadEditorTextChanged();
+ QVERIFY( mMatchesView->mModel->lastCall() == QString("logsMatches") );
+ QVERIFY( mMatchesView->mDialpad->mIsCallButtonEnabled );
+
+ //text erased from input, view changed to recent calls
+ mMatchesView->mDialpad->editor().setText( QString("") );
+ QVERIFY( mViewManager->mViewId == LogsRecentViewId );
+}
+
+void UT_LogsMatchesView::testDialpadClosed()
+{
+ mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
+ mMatchesView->mListView = new HbListView();
+ mMatchesView->mLayoutSectionName = QString("landscape_dialpad");
+ QString hello("hello");
+ mMatchesView->mDialpad->editor().setText( hello );
+ mMatchesView->mAddToContactsButton = new HbPushButton();
+ mMatchesView->mAddToContactsButton->setVisible(true);
+
+ mMatchesView->dialpadClosed();
+
+ QVERIFY( mMatchesView->mDialpad->editor().text() == hello );
+ QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection );
+ QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() );
+ delete mMatchesView->mListView;
+ mMatchesView->mListView = 0;
+ delete mMatchesView->mAddToContactsButton;
+ mMatchesView->mAddToContactsButton = 0;
+}
+
+void UT_LogsMatchesView::testDialpadOpened()
+{
+ //widgets size and layout updated
+ mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical );
+ mMatchesView->mListView = new HbListView();
+ mMatchesView->mLayoutSectionName = QString("dummy");
+ mMatchesView->mListView->setLayoutName("dummy");
+ mMatchesView->mDialpad->mIsOpen = true;
+ mMatchesView->mAddToContactsButton = new HbPushButton();
+ mMatchesView->mAddToContactsButton->setVisible(false);
+ mMatchesView->mDialpad->editor().setText( "hello" );
+ mMatchesView->mDialpad->mIsOpen = true;
+
+ mMatchesView->dialpadOpened();
+
+ QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout );
+ QVERIFY( mMatchesView->mLayoutSectionName == logsViewPortraitDialpadSection );
+ QVERIFY( mMatchesView->mAddToContactsButton->isVisible() );
+ delete mMatchesView->mListView;
+ mMatchesView->mListView = 0;
+ delete mMatchesView->mAddToContactsButton;
+ mMatchesView->mAddToContactsButton = 0;
+}
+
+void UT_LogsMatchesView::testModel()
+{
+ QVERIFY( !mMatchesView->model() );
+ LogsDbConnector* dbConnector = 0;
+ mMatchesView->mModel = new LogsMatchesModel(*dbConnector);
+ QVERIFY( mMatchesView->model() );
+}
+
+
+void UT_LogsMatchesView::testUpdateWidgetsSizeAndLayout()
+{
+ //no listView, nothing happens
+ QVERIFY( !mMatchesView->mListView );
+ mMatchesView->updateWidgetsSizeAndLayout();
+
+ //listView exists, layout and size updated, dialpad not visible
+ mRepository->matchesView();
+ mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical );
+ mMatchesView->mDialpad->closeDialpad();
+ mMatchesView->mListView = new HbListView();
+ mMatchesView->mListView->setLayoutName("dummy");
+ mMatchesView->updateWidgetsSizeAndLayout();
+ QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout );
+ QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection );
+ QObject* obj = mRepository->findObject( logsCommonVideoCallMenuActionId );
+ HbAction* videoCallAction = qobject_cast<HbAction*>( obj );
+ QObject* obj2 = mRepository->findObject( logsCommonMessageMenuActionId );
+ HbAction* messageAction = qobject_cast<HbAction*>( obj2 );
+ QVERIFY( !videoCallAction->isVisible() );
+ QVERIFY( !messageAction->isVisible() );
+
+ //listView exists, layout and size updated, dialpad visible
+ mMatchesView->mDialpad->openDialpad();
+ QString hello("hello");
+ mMatchesView->mDialpad->editor().setText( hello );
+ mMatchesView->mListView->setLayoutName("dummy");
+ mMatchesView->updateWidgetsSizeAndLayout();
+ QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout );
+ QVERIFY( mMatchesView->mLayoutSectionName == logsViewPortraitDialpadSection );
+ QVERIFY( videoCallAction->isVisible() );
+ QVERIFY( messageAction->isVisible() );
+
+ delete mMatchesView->mListView;
+ mMatchesView->mListView = 0;
+}
+
+void UT_LogsMatchesView::testHandleOrientationChanged()
+{
+ //dialpad position recalculated and layout/size updated
+ QPointF pos;
+ mMatchesView->mListView = new HbListView();
+ mMatchesView->mListView->setLayoutName("dummy");
+ mMatchesView->mLayoutSectionName = "dummy";
+ mMatchesView->mDialpad->setPos(pos);
+ mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
+
+ mMatchesView->handleOrientationChanged();
+
+ QVERIFY( pos != mMatchesView->mDialpad->pos() );
+ QVERIFY( mMatchesView->mListView->layoutName() == logsListLandscapeLayout );
+ QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection );
+ delete mMatchesView->mListView;
+ mMatchesView->mListView = 0;
+}
+
+void UT_LogsMatchesView::testUpdateEmptyListWidgetsVisibility()
+{
+ LogsDbConnector* dbConnector = 0;
+ mMatchesView->mModel = new LogsMatchesModel(*dbConnector);
+ mMatchesView->mModel->mTextData.clear();
+ mMatchesView->mDialpad->openDialpad();
+ mMatchesView->mDialpad->editor().setText( "hello" );
+ mMatchesView->mEmptyListLabel = new HbLabel();
+ mMatchesView->mAddToContactsButton = new HbPushButton();
+ mMatchesView->mEmptyListLabel->setVisible(false);
+ mMatchesView->mAddToContactsButton->setVisible(false);
+
+ mMatchesView->updateEmptyListWidgetsVisibility();
+
+ QVERIFY( mMatchesView->mEmptyListLabel->isVisible() );
+ QVERIFY( mMatchesView->mAddToContactsButton->isVisible() );
+ delete mMatchesView->mEmptyListLabel;
+ mMatchesView->mEmptyListLabel = 0;
+ delete mMatchesView->mAddToContactsButton;
+ mMatchesView->mAddToContactsButton = 0;
+}
+
+
+void UT_LogsMatchesView::testUpdateAddContactButton()
+{
+ //no button, nothing happens
+ QVERIFY( !mMatchesView->mAddToContactsButton );
+ mMatchesView->updateAddContactButton();
+
+ //dialpad closed => button set invisible
+ mMatchesView->mAddToContactsButton = new HbPushButton();
+ mMatchesView->mAddToContactsButton->setVisible(true);
+ QVERIFY( !mMatchesView->mDialpad->isOpen() );
+ mMatchesView->updateAddContactButton();
+ QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() );
+
+ //no matches, dialpad open and has some text => button set visible
+ QVERIFY( !mMatchesView->mModel );
+ mMatchesView->mDialpad->openDialpad();
+ mMatchesView->mDialpad->editor().setText( "hello" );
+ mMatchesView->updateAddContactButton();
+ QVERIFY( mMatchesView->mAddToContactsButton->isVisible() );
+
+ //no matches, dialpad open and no text => button set invisible
+ mMatchesView->mDialpad->editor().setText( "" );
+ QVERIFY( mMatchesView->mDialpad->isOpen() );
+ mMatchesView->updateAddContactButton();
+ QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() );
+
+ //matches found => button set invisible
+ LogsDbConnector* dbConnector = 0;
+ mMatchesView->mModel = new LogsMatchesModel(*dbConnector);
+ mMatchesView->mModel->mTextData.append("item1");
+ mMatchesView->mDialpad->editor().setText( "hello" );
+ mMatchesView->mAddToContactsButton->setVisible(true);
+ QVERIFY( mMatchesView->mDialpad->isOpen() );
+ mMatchesView->updateAddContactButton();
+ QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() );
+
+ delete mMatchesView->mAddToContactsButton;
+ mMatchesView->mAddToContactsButton = 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logspageindicator.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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_logspageindicator.h"
+#include "logspageindicator.h"
+
+//SYSTEM
+#include <QtTest/QtTest>
+
+void UT_LogsPageIndicator::initTestCase()
+{
+}
+
+void UT_LogsPageIndicator::cleanupTestCase()
+{
+}
+
+
+void UT_LogsPageIndicator::init()
+{
+ mIndicator = new LogsPageIndicator();
+}
+
+void UT_LogsPageIndicator::cleanup()
+{
+ delete mIndicator;
+}
+
+void UT_LogsPageIndicator::testInitialize()
+{
+ QVERIFY(mIndicator->mItems.count() == 0);
+ QVERIFY(mIndicator->mActiveItemIndex == -1);
+
+ //normal init
+ mIndicator->initialize(2,1);
+ QVERIFY(mIndicator->mItems.count() == 2);
+ QVERIFY(mIndicator->mActiveItemIndex == 1);
+
+ //items count is less then 1
+ mIndicator->initialize(0,1);
+ QVERIFY(mIndicator->mItems.count() == 0);
+ QVERIFY(mIndicator->mActiveItemIndex == -1);
+
+ //index is out of boundaries
+ mIndicator->initialize(2,2);
+ QVERIFY(mIndicator->mItems.count() == 0);
+ QVERIFY(mIndicator->mActiveItemIndex == -1);
+}
+
+void UT_LogsPageIndicator::testSetActiveItemIndex()
+{
+ mIndicator->initialize(3,1);
+ QVERIFY(mIndicator->mItems.count() == 3);
+ QVERIFY(mIndicator->mActiveItemIndex == 1);
+
+ //index is out of boundaries
+ mIndicator->setActiveItemIndex(3);
+ QVERIFY(mIndicator->mActiveItemIndex == 1);
+
+ //invalid index
+ mIndicator->setActiveItemIndex(-1);
+ QVERIFY(mIndicator->mActiveItemIndex == 1);
+
+ //valid index
+ mIndicator->setActiveItemIndex(0);
+ QVERIFY(mIndicator->mActiveItemIndex == 0);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logspageindicatoritem.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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_logspageindicatoritem.h"
+#include "logspageindicatoritem.h"
+
+//SYSTEM
+#include <QtTest/QtTest>
+#include <QGraphicsColorizeEffect>
+
+void UT_LogsPageIndicatorItem::initTestCase()
+{
+}
+
+void UT_LogsPageIndicatorItem::cleanupTestCase()
+{
+}
+
+
+void UT_LogsPageIndicatorItem::init()
+{
+ mIndicatorItem = new LogsPageIndicatorItem();
+}
+
+void UT_LogsPageIndicatorItem::cleanup()
+{
+ delete mIndicatorItem;
+}
+
+void UT_LogsPageIndicatorItem::testConstructorDestructor()
+{
+ QVERIFY(!mIndicatorItem->mIsActive);
+ QVERIFY(mIndicatorItem->graphicsEffect());
+
+ delete mIndicatorItem;
+ mIndicatorItem = 0;
+ mIndicatorItem = new LogsPageIndicatorItem(true);
+ QVERIFY(mIndicatorItem->mIsActive);
+}
+
+void UT_LogsPageIndicatorItem::testSetActive()
+{
+ //active state not changed, nothing to do
+ QVERIFY(!mIndicatorItem->mIsActive);
+ mIndicatorItem->setActive(false);
+ QVERIFY(!mIndicatorItem->mIsActive);
+
+ //setting active, animation started
+ mIndicatorItem->setActive(true);
+ QVERIFY(mIndicatorItem->mIsActive);
+ QVERIFY(mIndicatorItem->graphicsEffect());
+ QVERIFY(mIndicatorItem->graphicsEffect()->isEnabled());
+
+ //setting inactive
+ mIndicatorItem->setActive(false);
+ QVERIFY(!mIndicatorItem->mIsActive);
+ QVERIFY(mIndicatorItem->graphicsEffect());
+ QVERIFY(mIndicatorItem->graphicsEffect()->isEnabled());
+}
+
+void UT_LogsPageIndicatorItem::testAnimationFinnished()
+{
+ QVERIFY(mIndicatorItem->graphicsEffect());
+ mIndicatorItem->graphicsEffect()->setEnabled(true);
+ mIndicatorItem->animationFinished();
+ QVERIFY(!mIndicatorItem->graphicsEffect()->isEnabled());
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsrecentcallsview.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,773 @@
+/*
+* 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 "logsrecentcallsview.h"
+#include "ut_logsrecentcallsview.h"
+#include "logscomponentrepository.h"
+#include "logsmodel.h"
+#include "logsfilter.h"
+#include "logsdetailsmodel.h"
+#include "logsdefs.h"
+#include "logseffecthandler.h"
+#include "hbstubs_helper.h"
+#include "logscall.h"
+#include "logsmessage.h"
+#include "logscontact.h"
+#include "logsmatchesmodel.h"
+
+//SYSTEM
+#include <QtTest/QtTest>
+#include <QGesture>
+#include <hbmainwindow.h>
+#include <hblistview.h>
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hblistviewitem.h>
+#include <hbmenu.h>
+#include <dialpad.h>
+#include <hbgroupbox.h>
+#include <hbmessagebox.h>
+
+
+#define VERIFY_CHECKED_ACTION( v, actionName ) { \
+QVERIFY( v->mShowFilterMenu );\
+QVERIFY( v->mShowFilterMenu->actions().count() > 0 );\
+QAction* action = 0;\
+foreach ( action, v->mShowFilterMenu->actions() ){ \
+ if ( action->objectName() == actionName ){ \
+ QVERIFY( action->isChecked() ); \
+ } else { \
+ QVERIFY( !action->isChecked() ); \
+ } \
+}}
+
+
+void UT_LogsRecentCallsView::initTestCase()
+{
+ mMainWindow = new HbMainWindow();
+ mViewManager = new LogsViewManagerStub(*mMainWindow);
+}
+
+void UT_LogsRecentCallsView::cleanupTestCase()
+{
+ delete mMainWindow;
+ delete mViewManager;
+}
+
+void UT_LogsRecentCallsView::init()
+{
+ mRepository = new LogsComponentRepository(*mViewManager);
+ mRecentCallsView = new LogsRecentCallsView( *mRepository, *mViewManager );
+}
+
+void UT_LogsRecentCallsView::cleanup()
+{
+ delete mRecentCallsView;
+ mRecentCallsView = 0;
+ delete mRepository;
+ mRepository = 0;
+}
+
+void UT_LogsRecentCallsView::testConstructor()
+{
+ QVERIFY( mRecentCallsView );
+ QVERIFY( !mRecentCallsView->mViewName );
+ QVERIFY( !mRecentCallsView->mListView );
+ QVERIFY( !mRecentCallsView->mFilter );
+ QVERIFY( mRecentCallsView->mModel );
+ QVERIFY( !mRecentCallsView->mShowFilterMenu );
+ QVERIFY( mRecentCallsView->mCurrentView == LogsServices::ViewAll );
+ QVERIFY( mRecentCallsView->viewId() == LogsRecentViewId );
+ QVERIFY( mRecentCallsView->mLayoutSectionName == "" );
+}
+
+void UT_LogsRecentCallsView::testInitView()
+{
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ QVERIFY( view );
+ QVERIFY( !view->mInitialized );
+ QVERIFY( !view->mFilter );
+ QVERIFY( !view->mShowFilterMenu );
+ QVERIFY( view->mTitleMap.isEmpty() );
+ QVERIFY( view->mActionMap.isEmpty() );
+ view->initView();
+ QVERIFY( view->mInitialized );
+ QVERIFY( !view->mFilter );
+ QVERIFY( view->mShowFilterMenu );
+ QVERIFY( view->mTitleMap.count() == 4 );
+ QVERIFY( view->mActionMap.count() == 4 );
+
+ //TODO: Init twice not allowed
+}
+
+void UT_LogsRecentCallsView::testActivated()
+{
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ QVERIFY( view );
+ // Change for uninitialized causes initialization
+ QVERIFY( !view->mInitialized );
+ QVERIFY( !view->mFilter );
+ QVERIFY( !view->mEmptyListLabel );
+ view->activated(false, QVariant(LogsServices::ViewAll));
+ QVERIFY( view->mInitialized );
+ QVERIFY( view->mFilter );
+ QVERIFY( view->mEmptyListLabel );
+ VERIFY_CHECKED_ACTION( view, logsShowFilterRecentMenuActionId )
+
+ // Change views
+ view->activated(false, QVariant(LogsServices::ViewReceived));
+ QVERIFY( view->mFilter );
+ QVERIFY( view->mFilter->filterType() == LogsFilter::Received );
+ VERIFY_CHECKED_ACTION( view, logsShowFilterReceivedMenuActionId )
+
+ view->activated(false, QVariant(LogsServices::ViewMissed));
+ QVERIFY( view->mFilter->filterType() == LogsFilter::Missed );
+ VERIFY_CHECKED_ACTION( view, logsShowFilterMissedMenuActionId )
+
+ view->activated(false, QVariant(LogsServices::ViewCalled));
+ QVERIFY( view->mFilter->filterType() == LogsFilter::Called );
+ VERIFY_CHECKED_ACTION( view, logsShowFilterDialledMenuActionId )
+
+ view->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
+ view->mDialpad->editor().setText( QString("hello") );
+ view->mResetted = true;
+ view->activated(false, QVariant(LogsServices::ViewAll));
+ QVERIFY( view->mFilter->filterType() == LogsFilter::All );
+ VERIFY_CHECKED_ACTION( view, logsShowFilterRecentMenuActionId )
+ QVERIFY( view->mDialpad->editor().text().isEmpty() );
+ QVERIFY( view->mListView->layoutName() == logsListLandscapeLayout );
+ QVERIFY( view->mLayoutSectionName == logsViewDefaultSection );
+ QVERIFY( !view->mResetted );
+}
+
+void UT_LogsRecentCallsView::testDeactivated()
+{
+ mRecentCallsView->deactivated();
+}
+
+void UT_LogsRecentCallsView::testResetView()
+{
+ // Opened dialpad is closed and text in it is cleared
+ QVERIFY( !mRecentCallsView->mResetted );
+ mRecentCallsView->resetView();
+ QVERIFY( mRecentCallsView->mResetted );
+}
+
+void UT_LogsRecentCallsView::testInitListWidget()
+{
+ //TODO:Q_ASSERT_X
+/* //list widget can't be found from repository
+ QVERIFY( !mRecentCallsView->mListView );
+ mRecentCallsView->initListWidget();
+ QVERIFY( !mRecentCallsView->mListView );
+ */
+ //list widget is in repository
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ QVERIFY( !view->mListView );
+ view->initListWidget();
+ QVERIFY( view->mListView );
+ view = 0;
+}
+
+void UT_LogsRecentCallsView::testUpdateFilter()
+{
+ //no list view
+ QVERIFY( !mRecentCallsView->mListView );
+ QVERIFY( !mRecentCallsView->mFilter );
+ mRecentCallsView->updateFilter(LogsFilter::All);
+ QVERIFY( !mRecentCallsView->mFilter );
+
+ //first filter created with update
+ HbStubHelper::reset();
+ QVERIFY( !mRecentCallsView->mFilter );
+ mRecentCallsView->mListView = new HbListView();
+ mRecentCallsView->updateFilter(LogsFilter::All);
+ QVERIFY( mRecentCallsView->mFilter );
+ QVERIFY( mRecentCallsView->mFilter->filterType() == LogsFilter::All );
+ QVERIFY( !HbStubHelper::singleShotTimerActive() );
+ delete mRecentCallsView->mListView;
+ mRecentCallsView->mListView = 0;
+
+ //filter is updated with a new one, missed calls marking as seen is started (by timer)
+ QVERIFY( mRecentCallsView->mFilter );
+ mRecentCallsView->mListView = new HbListView();
+ mRecentCallsView->updateFilter(LogsFilter::Missed);
+ QVERIFY( mRecentCallsView->mFilter );
+ QVERIFY( mRecentCallsView->mFilter->filterType() == LogsFilter::Missed );
+ QVERIFY( HbStubHelper::singleShotTimerActive() );
+ delete mRecentCallsView->mListView;
+ mRecentCallsView->mListView = 0;
+
+ //filter is updated with a new one, missed calls marking as seen is not started
+ //as view was resetted
+ HbStubHelper::reset();
+ mRecentCallsView->mResetted = true;
+ mRecentCallsView->mListView = new HbListView();
+ mRecentCallsView->updateFilter(LogsFilter::Missed);
+ QVERIFY( mRecentCallsView->mFilter );
+ QVERIFY( mRecentCallsView->mFilter->filterType() == LogsFilter::Missed );
+ QVERIFY( !HbStubHelper::singleShotTimerActive() );
+}
+
+void UT_LogsRecentCallsView::testUpdateViewName()
+{
+ //no view name label
+ QVERIFY( !mRecentCallsView->mViewName );
+ mRecentCallsView->updateViewName();
+ QVERIFY( !mRecentCallsView->mViewName );
+
+ //view name label exists
+ mRecentCallsView->mCurrentView = LogsServices::ViewMissed;
+ mRecentCallsView->addStringsToMap();
+ mRecentCallsView->mViewName = new HbGroupBox();
+ mRecentCallsView->updateViewName();
+ QVERIFY( mRecentCallsView->mViewName->heading()
+ == mRecentCallsView->mTitleMap.value(
+ mRecentCallsView->mConversionMap.value(LogsServices::ViewMissed)));
+ delete mRecentCallsView->mViewName;
+ mRecentCallsView->mViewName = 0;
+}
+
+void UT_LogsRecentCallsView::testChangeFilter()
+{
+ mRepository->recentCallsView();
+ mRecentCallsView->activated( false, QVariant(LogsServices::ViewAll) );
+ QVERIFY( mRecentCallsView->mFilter );
+ QVERIFY( mRecentCallsView->mFilter->filterType() == LogsFilter::All );
+
+ HbAction* action = new HbAction();
+ action->setObjectName(logsShowFilterMissedMenuActionId);
+ mRecentCallsView->changeFilter(action);
+
+ // Because of effects, filter is not changed immediately, simulate effect completion
+ QVERIFY( mRecentCallsView->mAppearingView == LogsServices::ViewMissed );
+ mRecentCallsView->dissappearByMovingComplete();
+ QVERIFY( mRecentCallsView->mFilter->filterType() == LogsFilter::Missed );
+
+ delete action;
+ delete mRecentCallsView->mListView;
+ mRecentCallsView->mListView = 0;
+ delete mRecentCallsView->mViewName;
+ mRecentCallsView->mViewName = 0;
+}
+
+void UT_LogsRecentCallsView::testInitiateCallback()
+{
+ LogsCall::resetTestData();
+ // Call cannot be constructed in model
+ QModelIndex filterIndex;
+ mRecentCallsView->initiateCallback(filterIndex);
+ QVERIFY( LogsCall::lastCalledFuntion().isEmpty() );
+
+ // Call can be constructed in model
+ filterIndex = makeValidFilterIndex(*mRecentCallsView);
+ mRecentCallsView->initiateCallback(filterIndex);
+ QVERIFY( LogsCall::lastCalledFuntion() == QString("initiateCallback") );
+}
+
+void UT_LogsRecentCallsView::testCallKeyPressed()
+{ LogsRecentCallsView* view = mRepository->recentCallsView();
+
+ // Not ready for calling
+ view->callKeyPressed();
+
+ // No any item where to call
+ view->activated( false, QVariant(LogsServices::ViewAll) );
+ view->callKeyPressed();
+
+ // Calling possible
+ mRepository->model()->mTextData.append("testdata");
+ mRepository->model()->mTextData.append("testdata2");
+ view->mListView->setCurrentIndex(
+ mRepository->model()->index( 1, 0 ), QItemSelectionModel::Select );
+ view->callKeyPressed();
+ QVERIFY( view->mListView->currentIndex().row() == 0 );
+}
+
+void UT_LogsRecentCallsView::testShowCallDetails()
+{
+ // No details model, nothing to show
+ QVERIFY( mRecentCallsView->mDetailsModel == 0 );
+ mRecentCallsView->showCallDetails();
+ QVERIFY( mViewManager->mViewId != LogsDetailsViewId );
+
+ // Details model shown
+ mRecentCallsView->mDetailsModel = new LogsDetailsModel;
+ mRecentCallsView->showCallDetails();
+ QVERIFY( mViewManager->mViewId == LogsDetailsViewId );
+}
+
+void UT_LogsRecentCallsView::testOpenDialpad()
+{
+ QVERIFY( !mRecentCallsView->mFilter );
+ QVERIFY( !mRecentCallsView->mDialpad->isOpen() );
+ mRecentCallsView->openDialpad();
+ QVERIFY( mRecentCallsView->mMatchesModel );
+ QVERIFY( mRecentCallsView->mDialpad->isOpen() );
+
+
+ mRecentCallsView->mFilter = new LogsFilter( LogsFilter::Missed );
+ LogsMatchesModel* oldmatchesModel = mRecentCallsView->mMatchesModel;
+ mRecentCallsView->openDialpad();
+ QVERIFY( mRecentCallsView->mMatchesModel == oldmatchesModel );
+ QVERIFY( mRecentCallsView->mDialpad->isOpen() );
+}
+
+void UT_LogsRecentCallsView::testDialpadEditorTextChanged()
+{
+ // Matches view is opened and matches model is passed as arg
+ // text editor is one character long
+ LogsDbConnector* dbConnector = 0;
+ delete mRecentCallsView->mMatchesModel;
+ mRecentCallsView->mMatchesModel = 0;
+ mRecentCallsView->mMatchesModel = new LogsMatchesModel(*dbConnector);
+ mRecentCallsView->mDialpad->editor().setText( QString("h") );
+ mRecentCallsView->dialpadEditorTextChanged();
+ QVERIFY( mViewManager->mViewId == LogsMatchesViewId );
+ QVERIFY( mRecentCallsView->mMatchesModel == 0 );
+
+ // No text in editor, no view change, no lines in model, call button
+ // gets disabled
+ mViewManager->reset();
+ mRecentCallsView->mDialpad->mIsCallButtonEnabled = true;
+ delete mRecentCallsView->mFilter;
+ mRecentCallsView->mFilter = new LogsFilter();
+ mRecentCallsView->mDialpad->editor().setText( QString("") );
+ mRecentCallsView->dialpadEditorTextChanged();
+ QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
+ QVERIFY( !mRecentCallsView->mDialpad->mIsCallButtonEnabled );
+
+ // No text in editor but items in list, call button is enabled
+ mRecentCallsView->mDialpad->mIsCallButtonEnabled = false;
+ mRecentCallsView->mFilter->setSourceModel(mRecentCallsView->mModel);
+ mRecentCallsView->mDialpad->editor().setText( QString("") );
+ mRecentCallsView->dialpadEditorTextChanged();
+ QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
+ QVERIFY( mRecentCallsView->mDialpad->mIsCallButtonEnabled );
+}
+
+void UT_LogsRecentCallsView::testGestureEvent()
+{
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ view->activated( false, QVariant(LogsServices::ViewCalled) );
+ view->mCurrentView = LogsServices::ViewCalled;
+ view->mAppearingView = LogsServices::ViewCalled;
+ mRecentCallsView->mViewManager.mainWindow().setOrientation( Qt::Vertical );
+
+ QSwipeGesture* swipe = new QSwipeGesture();
+ QList<QGesture*> list;
+ QGestureEvent event(list);
+ event.ignore(Qt::SwipeGesture);
+
+ //no swipe gesture in event
+ QVERIFY(!event.isAccepted(Qt::SwipeGesture));
+ view->gestureEvent(&event);
+ QVERIFY(!event.isAccepted(Qt::SwipeGesture));
+ QVERIFY(view->mAppearingView == LogsServices::ViewCalled);
+
+ //swipe gesture in event, but gesture isn't finished
+ list.append(swipe);
+ QGestureEvent event2(list);
+ event2.ignore(Qt::SwipeGesture);
+ QVERIFY(!event2.isAccepted(Qt::SwipeGesture));
+ QVERIFY(swipe->state() != Qt::GestureFinished);
+ view->gestureEvent(&event2);
+ QVERIFY(!event2.isAccepted(Qt::SwipeGesture));
+ QVERIFY(view->mAppearingView == LogsServices::ViewCalled);
+
+ //vertical orientation swipe right up
+ HbStubHelper::setGestureState(Qt::GestureFinished);
+ event2.setAccepted(Qt::SwipeGesture, false);
+ swipe->setSwipeAngle(10);
+ view->gestureEvent(&event2);
+ QVERIFY( view->mAppearingView == LogsServices::ViewAll );
+ QVERIFY( event2.isAccepted(Qt::SwipeGesture) );
+
+ //vertical orientation swipe left up
+ event2.setAccepted(Qt::SwipeGesture, false);
+ swipe->setSwipeAngle(170);
+ view->gestureEvent(&event2);
+ QVERIFY(view->mAppearingView == LogsServices::ViewReceived);
+ QVERIFY(event2.isAccepted(Qt::SwipeGesture));
+
+ //vertical orientation swipe down, nothing happens
+ event2.setAccepted(Qt::SwipeGesture, false);
+ swipe->setSwipeAngle(70);
+ view->mAppearingView = view->mCurrentView;
+ view->gestureEvent(&event2);
+ QVERIFY(view->mAppearingView == LogsServices::ViewCalled);
+ QVERIFY(!event2.isAccepted(Qt::SwipeGesture));
+
+ //horizontal orientation swipe right up
+ mRecentCallsView->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
+ event2.setAccepted(Qt::SwipeGesture, false);
+ swipe->setSwipeAngle(80);
+ view->gestureEvent(&event2);
+ QVERIFY(view->mAppearingView == LogsServices::ViewReceived);
+ QVERIFY(event2.isAccepted(Qt::SwipeGesture));
+
+ //horizontal orientation swipe right down
+ event2.setAccepted(Qt::SwipeGesture, false);
+ swipe->setSwipeAngle(280);
+ view->gestureEvent(&event2);
+ QVERIFY(view->mAppearingView == LogsServices::ViewAll);
+ QVERIFY(event2.isAccepted(Qt::SwipeGesture));
+
+ //horizontal orientation swipe left, nothing happens
+ event2.setAccepted(Qt::SwipeGesture, false);
+ swipe->setSwipeAngle(200);
+ view->mAppearingView = view->mCurrentView;
+ view->gestureEvent(&event2);
+ QVERIFY(view->mAppearingView == LogsServices::ViewCalled);
+ QVERIFY(!event2.isAccepted(Qt::SwipeGesture));
+}
+
+void UT_LogsRecentCallsView::testSwipeAngleToDirection()
+{
+ int delta = 30;
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(61, delta), QSwipeGesture::Up);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(119, delta), QSwipeGesture::Up);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(90, delta), QSwipeGesture::Up);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(60, delta), QSwipeGesture::NoDirection);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(120, delta), QSwipeGesture::NoDirection);
+
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(241, delta), QSwipeGesture::Down);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(299, delta), QSwipeGesture::Down);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(270, delta), QSwipeGesture::Down);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(300, delta), QSwipeGesture::NoDirection);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(240, delta), QSwipeGesture::NoDirection);
+
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(29, delta), QSwipeGesture::Right);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(331, delta), QSwipeGesture::Right);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(0, delta), QSwipeGesture::Right);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(360, delta), QSwipeGesture::Right);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(30, delta), QSwipeGesture::NoDirection);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(330, delta), QSwipeGesture::NoDirection);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(361, delta), QSwipeGesture::NoDirection);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(-1, delta), QSwipeGesture::NoDirection);
+
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(151, delta), QSwipeGesture::Left);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(209, delta), QSwipeGesture::Left);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(180, delta), QSwipeGesture::Left);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(150, delta), QSwipeGesture::NoDirection);
+ QCOMPARE(mRecentCallsView->swipeAngleToDirection(210, delta), QSwipeGesture::NoDirection);
+}
+
+void UT_LogsRecentCallsView::testViewChangeByFlicking()
+{
+ // At leftmost list, moving to left not possible
+ // List not empty, starting list animation
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ view->activated( false, QVariant(LogsServices::ViewAll) );
+ view->mCurrentView = LogsServices::ViewAll;
+ QVERIFY(view->model() && view->model()->rowCount()>0);
+ view->rightFlick();
+ QVERIFY(view->mCurrentView == LogsServices::ViewAll);
+ QVERIFY(view->mAppearingView == LogsServices::ViewAll);
+ QVERIFY(view->mEffectHandler->mItemMoveNotPossibleAnimationStart->targetObject()
+ == view->mListView);
+
+ // Moving left not possible, list empty, starting empty label animation
+ delete view->mFilter;
+ view->mFilter = 0;
+ QVERIFY(!view->model());
+ view->rightFlick();
+ QVERIFY(view->mCurrentView == LogsServices::ViewAll);
+ QVERIFY(view->mAppearingView == LogsServices::ViewAll);
+ QVERIFY(view->mEffectHandler->mItemMoveNotPossibleAnimationStart->targetObject()
+ == view->mEmptyListLabel);
+
+ // Moving to right possible
+ view->leftFlick();
+ QVERIFY(view->mCurrentView == LogsServices::ViewAll);
+ QVERIFY(view->mAppearingView == LogsServices::ViewCalled);
+
+ // At rightmost list, moving further not possible
+ // List empty, starting empty label animation
+ view->mCurrentView = LogsServices::ViewMissed;
+ QVERIFY(!view->model());
+ view->leftFlick();
+ QVERIFY(view->mCurrentView == LogsServices::ViewMissed);
+ QVERIFY(view->mAppearingView == LogsServices::ViewCalled);
+ QVERIFY(view->mEffectHandler->mItemMoveNotPossibleAnimationStart->targetObject()
+ == view->mEmptyListLabel);
+
+ // Moving right not possible, list not empty, starting list animation
+ LogsModel model;
+ view->mFilter = new LogsFilter();
+ view->mFilter->setSourceModel(&model);
+ view->leftFlick();
+ QVERIFY(view->mCurrentView == LogsServices::ViewMissed);
+ QVERIFY(view->mAppearingView == LogsServices::ViewCalled);
+ QVERIFY(view->mEffectHandler->mItemMoveNotPossibleAnimationStart->targetObject()
+ == view->mListView);
+
+ // Now moving to left is possible
+ view->rightFlick();
+ QVERIFY(view->mCurrentView == LogsServices::ViewMissed);
+ QVERIFY(view->mAppearingView == LogsServices::ViewReceived);
+
+ // Simulate effect completion which activates new view
+ view->dissappearByFadingComplete();
+ QVERIFY( view->mViewName->heading()
+ == view->mTitleMap.value(view->mConversionMap.value(LogsServices::ViewReceived)) );
+
+ view->dissappearByMovingComplete();
+ QVERIFY(view->mCurrentView == LogsServices::ViewReceived);
+ QVERIFY(view->mAppearingView == LogsServices::ViewReceived);
+
+ // If view would be already what expected, nothing happens
+ view->dissappearByMovingComplete();
+ QVERIFY(view->mCurrentView == LogsServices::ViewReceived);
+ QVERIFY(view->mAppearingView == LogsServices::ViewReceived);
+}
+
+
+void UT_LogsRecentCallsView::testModel()
+{
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ view->activated(false, QVariant(LogsServices::ViewAll));
+ QVERIFY( view->mFilter );
+ QVERIFY( view->model() == view->mFilter );
+}
+
+void UT_LogsRecentCallsView::testShowListItemMenu()
+{
+ HbStubHelper::reset();
+ QModelIndex filterIndex = makeValidFilterIndex(*mRecentCallsView);
+ HbListViewItem* item = new HbListViewItem;
+ item->setModelIndex(filterIndex);//mRecentCallsView->mFilter->index( 0, 0 ));
+
+ mRecentCallsView->showListItemMenu(item, QPointF());
+
+ //can't test, showed only if itemContextMenu.actions().count() > 0
+ //if we stub actions(), then testActivated() will fail
+// QVERIFY( HbStubHelper::menuShown() );
+ QVERIFY( HbStubHelper::widgetActionsCount() == 7 );
+ delete item;
+}
+
+void UT_LogsRecentCallsView::testUpdateListItemData()
+{
+ QModelIndex filterIndex = makeValidFilterIndex(*mRecentCallsView);
+ QVERIFY( !mRecentCallsView->mCall );
+ QVERIFY( !mRecentCallsView->mContact );
+ QVERIFY( !mRecentCallsView->mMessage );
+ QVERIFY( !mRecentCallsView->mDetailsModel );
+
+ mRecentCallsView->updateListItemData( filterIndex );
+
+ QVERIFY( mRecentCallsView->mCall );
+ QVERIFY( mRecentCallsView->mContact );
+ QVERIFY( mRecentCallsView->mMessage );
+ QVERIFY( mRecentCallsView->mDetailsModel );
+}
+
+void UT_LogsRecentCallsView::testPopulateListItemMenu()
+{
+ //call, message and contact exist, menu has actions
+ HbStubHelper::reset();
+ mRecentCallsView->mCall = new LogsCall();
+ mRecentCallsView->mMessage = new LogsMessage();
+ mRecentCallsView->mContact = new LogsContact();
+ mRecentCallsView->mDetailsModel = new LogsDetailsModel();
+ HbMenu menu;
+ mRecentCallsView->populateListItemMenu(menu);
+ QVERIFY( HbStubHelper::widgetActionsCount() == 7 );
+}
+
+void UT_LogsRecentCallsView::testUpdateCall()
+{
+ //call can be created
+ QModelIndex filterIndex = makeValidFilterIndex(*mRecentCallsView);
+ QVERIFY( !mRecentCallsView->mCall );
+ mRecentCallsView->updateCall( filterIndex );
+ QVERIFY( mRecentCallsView->mCall );
+
+ //call can't be created
+ mRecentCallsView->updateCall( QModelIndex() );
+ QVERIFY( !mRecentCallsView->mCall );
+}
+
+void UT_LogsRecentCallsView::testUpdateMessage()
+{
+ //message can be created
+ QModelIndex filterIndex = makeValidFilterIndex(*mRecentCallsView);
+ QVERIFY( !mRecentCallsView->mMessage );
+ mRecentCallsView->updateMessage( filterIndex );
+ QVERIFY( mRecentCallsView->mMessage );
+
+ //message can't be created
+ mRecentCallsView->updateMessage( QModelIndex() );
+ QVERIFY( !mRecentCallsView->mMessage );
+}
+
+void UT_LogsRecentCallsView::testUpdateContact()
+{
+ //contact can be created
+ QModelIndex filterIndex = makeValidFilterIndex(*mRecentCallsView);
+ QVERIFY( !mRecentCallsView->mContact );
+ mRecentCallsView->updateContact( filterIndex );
+ QVERIFY( mRecentCallsView->mContact );
+
+ //contact can't be created
+ mRecentCallsView->updateContact( QModelIndex() );
+ QVERIFY( !mRecentCallsView->mContact );
+}
+
+void UT_LogsRecentCallsView::testActivateEmptyListIndicator()
+{
+ // Empty model, label is set visible
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ QObject* obj = mRepository->findObject( logsRecentViewClearListMenuActionId );
+ HbAction* action = qobject_cast<HbAction*>( obj );
+ delete view->mFilter;
+ view->mFilter = 0;
+ view->mFilter = new LogsFilter();
+ QVERIFY( !view->mEmptyListLabel );
+ view->activateEmptyListIndicator(view->mFilter);
+ QVERIFY( view->mEmptyListLabel );
+ QVERIFY( view->mEmptyListLabel->isVisible() );
+ QVERIFY(action && !action->isVisible());
+
+ // Model has items, label is set invisible
+ LogsModel model;
+ view->mFilter->setSourceModel(&model);
+ view->activateEmptyListIndicator(view->mFilter);
+ QVERIFY( view->mEmptyListLabel );
+ QVERIFY( !view->mEmptyListLabel->isVisible() );
+ QVERIFY(action && action->isVisible());
+}
+
+void UT_LogsRecentCallsView::testUpdateMenu()
+{
+ //menu is not in repository
+ mRecentCallsView->updateMenu();
+
+ //menu is in repository, empty model => "Clear list" is not visible
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ QObject* obj = mRepository->findObject( logsRecentViewClearListMenuActionId );
+ HbAction* action = qobject_cast<HbAction*>( obj );
+ QVERIFY(action && action->isVisible());
+ delete view->mFilter;
+ view->mFilter = 0;
+ view->mFilter = new LogsFilter();
+ view->updateMenu();
+ QVERIFY(action && !action->isVisible());
+
+ //menu is in repository, non-empty model => "Clear list" is visible
+ makeValidFilterIndex(*view);
+ view->updateMenu();
+ QVERIFY(action && action->isVisible());
+}
+
+
+QModelIndex UT_LogsRecentCallsView::makeValidFilterIndex(LogsRecentCallsView& view)
+{
+ if ( !view.mModel ) {
+ return QModelIndex();
+ }
+ view.mModel->mTextData.append("testdata");
+ delete view.mFilter;
+ view.mFilter = 0;
+ view.mFilter = new LogsFilter( LogsFilter::All );
+ view.mFilter->setSourceModel( view.mModel );
+ return view.mFilter->index(0,0);
+}
+
+void UT_LogsRecentCallsView::testUpdateWidgetsSizeAndLayout()
+{
+ //no listView, nothing happens
+ QVERIFY( !mRecentCallsView->mListView );
+ mRecentCallsView->updateWidgetsSizeAndLayout();
+
+ HbListView list;
+ //listView exists, layout and size updated
+ mRecentCallsView->mViewManager.mainWindow().setOrientation( Qt::Vertical );
+ mRecentCallsView->mDialpad->closeDialpad();
+ mRecentCallsView->mListView = &list;
+ mRecentCallsView->mListView->setLayoutName("dummy");
+ mRecentCallsView->mLayoutSectionName = "dummy";
+ mRecentCallsView->updateWidgetsSizeAndLayout();
+ QVERIFY( mRecentCallsView->mListView->layoutName() == logsListDefaultLayout );
+ QVERIFY( mRecentCallsView->mLayoutSectionName == logsViewDefaultSection );
+}
+
+void UT_LogsRecentCallsView::testDialpadClosed()
+{
+ HbListView list;
+ mRecentCallsView->mListView = &list;
+
+ mRecentCallsView->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
+ mRecentCallsView->mDialpad->closeDialpad();
+ mRecentCallsView->mLayoutSectionName = QString(logsViewLandscapeDialpadSection);
+ QString hello("hello");
+ mRecentCallsView->mDialpad->editor().setText( hello );
+ mRecentCallsView->dialpadClosed();
+ QVERIFY( mRecentCallsView->mDialpad->editor().text().isEmpty() );
+ QVERIFY( mRecentCallsView->mLayoutSectionName == logsViewDefaultSection );
+}
+
+void UT_LogsRecentCallsView::testClearList()
+{
+
+ //check that without filter list is not cleared
+ mRecentCallsView->mModel->mIsCleared = false;
+ HbMessageBox().setText(tr("Ok"));
+ mRecentCallsView->clearList();
+ QVERIFY( !mRecentCallsView->mModel->mIsCleared );
+
+ mRecentCallsView->mFilter = new LogsFilter( LogsFilter::Missed );
+
+ //simulate "Ok" button press of messagebox
+ HbMessageBox().setText(tr("Ok"));
+ mRecentCallsView->clearList();
+ QVERIFY( mRecentCallsView->mModel->mIsCleared );
+
+ //simulate "Cancel" button press of messagebox
+ mRecentCallsView->mModel->mIsCleared = false;
+ HbMessageBox().setText(tr("Cancel"));
+ mRecentCallsView->clearList();
+ QVERIFY( !mRecentCallsView->mModel->mIsCleared );
+}
+
+void UT_LogsRecentCallsView::testIsExitAllowed()
+{
+ // Exit allowed, nothing to mark as seen
+ mRecentCallsView->handleExit();
+ QVERIFY( mRecentCallsView->isExitAllowed() );
+ QVERIFY( !mRecentCallsView->mMarkingMissedAsSeen );
+
+ // Exit not allowed, marking started
+ mRecentCallsView->mModel->mTestIsMarkingNeeded = true;
+ mRecentCallsView->handleExit();
+ QVERIFY( !mRecentCallsView->isExitAllowed() );
+ QVERIFY( mRecentCallsView->mMarkingMissedAsSeen );
+
+ // Exit not allowed marking still ongoing
+ QVERIFY( !mRecentCallsView->isExitAllowed() );
+ QVERIFY( mRecentCallsView->mMarkingMissedAsSeen );
+
+ // Complete marking, exit allowed
+ QSignalSpy spy( mRecentCallsView, SIGNAL(exitAllowed()) );
+ mRecentCallsView->mModel->mTestIsMarkingNeeded = false;
+ mRecentCallsView->markingCompleted(0);
+ QVERIFY( !mRecentCallsView->mMarkingMissedAsSeen );
+ QVERIFY( spy.count() == 1 );
+ QVERIFY( mRecentCallsView->isExitAllowed() );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsservicehandler.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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_logsservicehandler.h"
+#include "logsservicehandler.h"
+#include "qthighway_stub_helper.h"
+#include "ut_logsviewmanager.h"
+#include "logsviewmanager.h"
+#include "logsmainwindow.h"
+#include "logscomponentrepository.h"
+#include "logsmatchesview.h"
+
+//SYSTEM
+#include <QtTest/QtTest>
+
+Q_DECLARE_METATYPE(LogsServices::LogsView)
+
+void UT_LogsServiceHandler::initTestCase()
+{
+}
+
+void UT_LogsServiceHandler::cleanupTestCase()
+{
+}
+
+
+void UT_LogsServiceHandler::init()
+{
+ mMainWindow = new LogsMainWindow();
+ mService = new LogsServiceHandler(*mMainWindow);
+
+ mLogsViewManager = new LogsViewManager(*mMainWindow, *mService);
+
+}
+
+void UT_LogsServiceHandler::cleanup()
+{
+ delete mService;
+ mService = 0;
+ delete mMainWindow;
+ mMainWindow = 0;
+ delete mLogsViewManager;
+ mLogsViewManager = 0;
+
+ QtHighwayStubHelper::reset();
+}
+
+void UT_LogsServiceHandler::testConstructor()
+{
+ QVERIFY( mService );
+ QVERIFY( !mService->mIsAppStartedUsingService );
+ QVERIFY( !mService->isStartedUsingService() );
+
+ QtHighwayStubHelper::setIsService(true);
+ LogsServiceHandler serviceHandler(*mMainWindow);
+ QVERIFY( serviceHandler.mIsAppStartedUsingService );
+ QVERIFY( serviceHandler.isStartedUsingService() );
+
+}
+
+void UT_LogsServiceHandler::testStart()
+{
+ qRegisterMetaType< LogsServices::LogsView >("LogsServices::LogsView");
+ QSignalSpy spy(mService, SIGNAL(activateView(LogsServices::LogsView, bool)));
+
+ // Wrong view
+ QVERIFY( mService->start( 9999, true ) != 0 );
+ QVERIFY( spy.count() == 0 );
+
+ // Correct view
+ mService->mMainWindow.mForeground = false;
+ QVERIFY( mService->start( (int)LogsServices::ViewReceived, true ) == 0 );
+ QVERIFY( spy.count() == 1 );
+ LogsServices::LogsView view =
+ qvariant_cast< LogsServices::LogsView >(spy.at(0).at(0));
+ QVERIFY( view == LogsServices::ViewReceived );
+ QVERIFY( mService->currentlyActivatedView() == LogsServices::ViewReceived );
+ QVERIFY( mService->mMainWindow.mForeground );
+}
+
+void UT_LogsServiceHandler::testStartWithNum()
+{
+ qRegisterMetaType< LogsServices::LogsView >("LogsServices::LogsView");
+ QSignalSpy spy2(mService, SIGNAL(activateView(QString)));
+
+ mService->mMainWindow.mForeground = false;
+ QVERIFY( mService->startWithNum( (int)LogsServices::ViewReceived, true,
+ QString("+123456") ) == 0 );
+ QVERIFY( spy2.count() == 1 );
+ QVERIFY( spy2.at(0).at(0).toString() == QString("+123456"));
+ QVERIFY( mService->mMainWindow.mForeground );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsviewmanager.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* 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_logsviewmanager.h"
+#include "logsviewmanager.h"
+#include "logsservicehandler.h"
+#include "logsmainwindow.h"
+#include "logscomponentrepository.h"
+#include "logsrecentcallsview.h"
+#include "logsmatchesview.h"
+#include "logsdetailsview.h"
+#include "hbstubs_helper.h"
+
+//SYSTEM
+#include <HbMainWindow.h>
+#include <QtTest/QtTest>
+#include <HbView.h>
+#include <hbapplication.h>
+
+void UT_LogsViewManager::initTestCase()
+{
+ //mMainWindow = new LogsMainWindow();
+}
+
+void UT_LogsViewManager::cleanupTestCase()
+{
+}
+
+
+void UT_LogsViewManager::init()
+{
+ mMainWindow = new LogsMainWindow();
+ LogsServiceHandler* service = new LogsServiceHandler(*mMainWindow);
+ mLogsViewManager = new LogsViewManager(*mMainWindow, *service);
+}
+
+void UT_LogsViewManager::cleanup()
+{
+ delete mLogsViewManager;
+ mLogsViewManager = 0;
+ delete mMainWindow;
+ mMainWindow = 0;
+}
+
+void UT_LogsViewManager::testConstructorDestructor()
+{
+ QVERIFY( mLogsViewManager );
+ QVERIFY( mLogsViewManager->mComponentsRepository );
+ QVERIFY( mLogsViewManager->mMainWindow.viewCount() == 3 );
+ QVERIFY( mLogsViewManager->mMainWindow.currentView() == 0 );
+ QVERIFY( mLogsViewManager->mViewStack.count() == 3 );
+
+ delete mLogsViewManager;
+ mLogsViewManager = 0;
+ //TODO: removeView deprecated => this will fail
+ //QVERIFY( mMainWindow->viewCount() == 0 );
+}
+
+void UT_LogsViewManager::testActivateView()
+{
+ // Activate already active view
+ QVERIFY( mLogsViewManager->activateView(LogsRecentViewId) );
+ QVERIFY( mLogsViewManager->activateView(LogsRecentViewId) );
+ QVERIFY( mLogsViewManager->mMainWindow.viewCount() == 3 );
+ QVERIFY( mLogsViewManager->mMainWindow.currentView() ==
+ mLogsViewManager->mComponentsRepository->recentCallsView() );
+
+ // Activate other view
+ QVERIFY( mLogsViewManager->activateView(LogsDetailsViewId) );
+ QVERIFY( mLogsViewManager->mMainWindow.viewCount() == 3 );
+ QVERIFY( mLogsViewManager->mMainWindow.currentView() ==
+ mLogsViewManager->mComponentsRepository->detailsView() );
+ QVERIFY( mLogsViewManager->mViewStack.at(0) ==
+ mLogsViewManager->mComponentsRepository->detailsView() );
+
+ // Try to activate unknown view
+ QVERIFY( !mLogsViewManager->activateView(LogsUnknownViewId) );
+ QVERIFY( mLogsViewManager->mMainWindow.viewCount() == 3 );
+ QVERIFY( mLogsViewManager->mMainWindow.currentView() ==
+ mLogsViewManager->mComponentsRepository->detailsView() );
+ QVERIFY( mLogsViewManager->mViewStack.at(0) ==
+ mLogsViewManager->mComponentsRepository->detailsView() );
+
+ // Go back to previous view
+ QVERIFY( mLogsViewManager->activatePreviousView() );
+ QVERIFY( mLogsViewManager->mMainWindow.viewCount() == 3 );
+ QVERIFY( mLogsViewManager->mMainWindow.currentView() ==
+ mLogsViewManager->mComponentsRepository->recentCallsView() );
+ QVERIFY( mLogsViewManager->mViewStack.at(0) ==
+ mLogsViewManager->mComponentsRepository->recentCallsView() );
+}
+
+void UT_LogsViewManager::testchangeMatchesView()
+{
+ //Open Matches view, dialpad visible with predefined number
+ mLogsViewManager->changeMatchesView(QString("+123456"));
+ QVERIFY( mLogsViewManager->mMainWindow.currentView() ==
+ mLogsViewManager->mComponentsRepository->matchesView() );
+}
+
+void UT_LogsViewManager::testExitApplication()
+{
+ // Exit immediately possible, app sent to bg and data is compressed
+ HbStubHelper::reset();
+ mLogsViewManager->mComponentsRepository->model()->mCompressCalled = false;
+ mLogsViewManager->mMainWindow.mForeground = true;
+ mLogsViewManager->exitApplication();
+ QVERIFY( mLogsViewManager->mComponentsRepository->model()->mCompressCalled );
+ QVERIFY( !mLogsViewManager->mMainWindow.isForeground() );
+
+ // Exit not yet possible, app sent only to bg
+ mLogsViewManager->mComponentsRepository->model()->mCompressCalled = false;
+ mLogsViewManager->mMainWindow.mForeground = true;
+ mLogsViewManager->mComponentsRepository->recentCallsView()->mMarkingMissedAsSeen = true;
+ HbStubHelper::reset();
+ mLogsViewManager->exitApplication();
+ QVERIFY( !mLogsViewManager->mComponentsRepository->model()->mCompressCalled );
+ QVERIFY( !mLogsViewManager->mMainWindow.isForeground() );
+
+ // Simulate view allowing exit after denying it first
+ mLogsViewManager->mComponentsRepository->recentCallsView()->mMarkingMissedAsSeen = false;
+ mLogsViewManager->proceedExit();
+ QVERIFY( mLogsViewManager->mComponentsRepository->model()->mCompressCalled );
+}
+
+void UT_LogsViewManager::testAppFocusGained()
+{
+ mLogsViewManager->appFocusGained();
+ // Nothing to verify
+}
+
+void UT_LogsViewManager::testStartingWithService()
+{
+ // If app is started with highway service, view is not activated
+ // before service method call comes.
+ LogsMainWindow window;
+ window.setCurrentView(0); // clear stub static data
+ LogsServiceHandler service(*mMainWindow);
+ service.mIsAppStartedUsingService = true;
+ LogsViewManager vm(window, service);
+ QVERIFY( vm.mComponentsRepository );
+ QVERIFY( vm.mMainWindow.viewCount() == 3 );
+ QVERIFY( vm.mMainWindow.currentView() == 0 );
+ QVERIFY( vm.mViewStack.count() == 3 );
+}
+
+void UT_LogsViewManager::testHandleOrientationChanged()
+{
+ mLogsViewManager->handleOrientationChanged();
+}
+
+void UT_LogsViewManager::testCompleteViewActivation()
+{
+ // On first activation, wait that view has painted itself once
+ // before completing activation
+ QVERIFY(mLogsViewManager->mFirstActivation);
+ 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);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/dialpad.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,62 @@
+/*!
+* 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: Dialpad popup
+*
+*/
+
+#ifndef DIALPAD_H
+#define DIALPAD_H
+
+#include <hbwidget.h>
+
+#include <QTime>
+#include <QTimeLine>
+
+class HbLineEdit;
+
+const int DialpadButtonCount = 13;
+
+class Dialpad : public HbWidget
+{
+ Q_OBJECT
+
+public:
+ explicit Dialpad();
+ explicit Dialpad(const HbMainWindow& mainWindow);
+
+ virtual ~Dialpad();
+
+ HbLineEdit& editor() const;
+
+ bool isOpen() const {return mIsOpen;}
+
+public slots:
+
+ void openDialpad() { mIsOpen = true; }
+
+ void closeDialpad() { mIsOpen = false; }
+
+ void setCallButtonEnabled(bool enabled);
+
+signals:
+ void aboutToClose();
+ void aboutToOpen();
+
+public:
+ HbLineEdit* mLineEdit;
+ bool mIsCallButtonEnabled;
+ bool mIsOpen;
+};
+
+#endif // DIALPAD_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/dialpad_stub.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2008-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 <hblineedit.h>
+#include "dialpad.h"
+
+Dialpad::Dialpad()
+{
+ mLineEdit = new HbLineEdit();
+ setVisible(false);
+ mIsCallButtonEnabled = false;
+ mIsOpen = false;
+}
+
+Dialpad::Dialpad(const HbMainWindow& mainWindow)
+{
+ Q_UNUSED(mainWindow);
+ mLineEdit = new HbLineEdit();
+ setVisible(false);
+ mIsCallButtonEnabled = false;
+ mIsOpen = false;
+}
+
+Dialpad::~Dialpad()
+{
+ delete mLineEdit;
+}
+
+HbLineEdit& Dialpad::editor() const
+{
+ return *mLineEdit;
+}
+
+void Dialpad::setCallButtonEnabled(bool enabled)
+{
+ mIsCallButtonEnabled = enabled;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/dialpadkeyhandler.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,49 @@
+/*!
+* Copyright (c) 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: Dialpad key handler.
+*
+*/
+
+#ifndef DIALPADKEYHANDLER_H
+#define DIALPADKEYHANDLER_H
+
+#include <QObject>
+
+class Dialpad;
+class DialpadVoiceMailboxEventFilter;
+class DialpadBluetoothEventFilter;
+class HbMainWindow;
+
+/*!
+ DialpadKeyHandler
+ Class provides key handling for dialpad component.
+
+ @code
+ Dialpad *dialpad = new Dialpad();
+ DialpadKeyHandler *keyhandler = new DialpadKeyHandler(dialpad, this);
+ @endcode
+
+*/
+class DialpadKeyHandler : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit DialpadKeyHandler(Dialpad *dialPad, HbMainWindow& mainWindow, QObject *parent = 0);
+ virtual ~DialpadKeyHandler();
+
+private:
+};
+
+#endif // DIALPADKEYHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/dialpadkeyhandler_stub.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2008-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 "dialpadkeyhandler.h"
+
+DialpadKeyHandler::DialpadKeyHandler(Dialpad *dialPad, HbMainWindow& mainWindow, QObject *parent)
+{
+ Q_UNUSED(dialPad);
+ Q_UNUSED(mainWindow);
+ Q_UNUSED(parent);
+}
+
+DialpadKeyHandler::~DialpadKeyHandler()
+{
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbapplication.h Tue May 04 12:39:37 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 HBAPPLICATION_H
+#define HBAPPLICATION_H
+
+#include <qobject.h>
+#include <qglobal.h>
+
+class HbApplication : public QObject
+{
+public:
+ HbApplication(int &/*argc*/, char */*argv*/[]);
+ ~HbApplication();
+
+ static void quit();
+};
+
+#endif//HBAPPLICATION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,289 @@
+/*
+* Copyright (c) 2008-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: HbMenu2 implementation.
+*
+*/
+
+
+#include <hbmenu.h>
+#include <hbmainwindow.h>
+#include <hbinstance.h>
+#include "hbstubs_helper.h"
+#include <hbmessagebox.h>
+#include <hbapplication.h>
+#include <QCoreApplication>
+#include <QTimer>
+#include <QGesture>
+
+int actionCount = 0;
+Qt::Orientation windowOrientation = Qt::Vertical;
+bool logsMenuShown = false;
+HbMainWindow* testWindow = 0;
+HbView* testView = 0;
+int testViewCount = 0;
+HbAction* testSoftkeyAction = 0;
+QString selectedActionString = "none";
+bool testSingleShotTimer = false;
+bool testQuitCalled = false;
+Qt::GestureState testState = Qt::NoGesture;
+bool testIsWidgetOpen = false;
+bool testIsWidgetRaised = false;
+
+void HbStubHelper::reset()
+{
+ actionCount = 0;
+ logsMenuShown = false;
+ testSingleShotTimer = false;
+ testQuitCalled = false;
+ testIsWidgetRaised = false;
+}
+
+
+
+int HbStubHelper::widgetActionsCount()
+{
+ return actionCount;
+}
+
+bool HbStubHelper::menuShown()
+{
+ return logsMenuShown;
+}
+
+bool HbStubHelper::singleShotTimerActive()
+{
+ return testSingleShotTimer;
+}
+
+bool HbStubHelper::quitCalled()
+{
+ return testQuitCalled;
+}
+
+void HbStubHelper::setGestureState(int state)
+{
+ testState = static_cast<Qt::GestureState> (state);
+}
+
+
+Qt::GestureState QGesture::state() const
+{
+ return testState;
+}
+
+
+bool HbStubHelper::isWidgetOpen()
+{
+ return testIsWidgetOpen;
+}
+
+bool HbStubHelper::isWidgetRaised()
+{
+ return testIsWidgetRaised;
+}
+
+void HbStubHelper::setWidgetOpen(bool isOpen)
+{
+ testIsWidgetOpen = isOpen;
+}
+
+bool QGraphicsWidget::close()
+{
+ testIsWidgetOpen = false;
+}
+
+void QWidget::setVisible(bool visible)
+{
+ Q_UNUSED(visible);
+}
+
+void QWidget::raise()
+{
+ testIsWidgetRaised = true;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+HbApplication::HbApplication(int &/*argc*/, char */*argv*/[])
+{
+}
+
+HbApplication::~HbApplication()
+{
+}
+
+void HbApplication::quit()
+{
+ testQuitCalled = true;
+}
+
+void QCoreApplication::quit()
+{
+ testQuitCalled = true;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+HbAction *HbMenu::exec(const QPointF &pos, HbAction *action )
+{
+ Q_UNUSED(action)
+ Q_UNUSED(pos)
+ logsMenuShown = true;
+ return 0;
+}
+
+HbAction *HbMenu::exec(HbAction *action)
+{
+ Q_UNUSED(action)
+ logsMenuShown = true;
+ return 0;
+}
+
+void QGraphicsWidget::addAction(QAction *action)
+{
+ Q_UNUSED(action)
+ actionCount++;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+HbMainWindow::HbMainWindow(QWidget *parent, Hb::WindowFlags windowFlags) : d_ptr(0)
+{
+ Q_UNUSED(parent)
+ Q_UNUSED(windowFlags)
+ testViewCount = 0;
+ testWindow = this;
+}
+
+HbMainWindow::~HbMainWindow()
+{
+ testWindow = 0;
+}
+
+void HbMainWindow::setOrientation(Qt::Orientation orientation, bool animate)
+{
+ Q_UNUSED(animate)
+ windowOrientation = orientation;
+}
+
+Qt::Orientation HbMainWindow::orientation() const
+{
+ return windowOrientation;
+}
+
+QRectF HbMainWindow::layoutRect() const
+{
+ return QRectF(0, 0, 100,100);
+}
+
+HbAction* HbMainWindow::softKeyAction(Hb::SoftKeyId key) const
+{
+ Q_UNUSED(key)
+ return testSoftkeyAction;
+}
+
+void HbMainWindow::addSoftKeyAction(Hb::SoftKeyId key, HbAction *action)
+{
+ Q_UNUSED(key)
+ Q_UNUSED(action)
+ testSoftkeyAction = action;
+}
+
+void HbMainWindow::removeSoftKeyAction(Hb::SoftKeyId key, HbAction *action)
+{
+ Q_UNUSED(key)
+ Q_UNUSED(action)
+ testSoftkeyAction = 0;
+}
+
+HbView *HbMainWindow::addView(QGraphicsWidget *widget)
+{
+ Q_UNUSED(widget)
+ testViewCount++;
+}
+
+void HbMainWindow::setCurrentView(HbView *view, bool animate, Hb::ViewSwitchFlags flags)
+{
+ Q_UNUSED(animate)
+ Q_UNUSED(flags)
+ testView = view;
+}
+
+int HbMainWindow::viewCount() const
+{
+ return testViewCount;
+}
+HbView *HbMainWindow::currentView() const
+{
+ return testView;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+HbInstance::HbInstance() : d(0)
+{
+
+}
+
+HbInstance::~HbInstance()
+{
+
+}
+
+HbInstance* HbInstance::instance()
+{
+ static HbInstance hbTestInstance;
+ return &hbTestInstance;
+}
+
+QList<HbMainWindow *> HbInstance::allMainWindows() const
+{
+ QList<HbMainWindow *> list;
+ list.append(testWindow);
+ return list;
+}
+
+void HbMessageBox::setText(const QString &string)
+{
+
+ if (string == "Ok") {
+ selectedActionString = "primary";
+ } else if (string == "Cancel") {
+ selectedActionString = "secondary";
+ }
+
+}
+
+
+HbAction *HbDialog::exec()
+{
+ if (selectedActionString == "primary") {
+ return primaryAction();
+ } else {
+ return 0;
+ }
+}
+
+void QTimer::singleShot(int msec, QObject *receiver, const char *member)
+{
+ testSingleShotTimer = true;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs_helper.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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 HBSTUB_HELPER_H
+#define HBSTUB_HELPER_H
+/**
+* Helper class to control logsdbconnector stub behavior
+*
+*/
+class HbStubHelper
+{
+ public:
+ static void reset();
+ static int widgetActionsCount();
+ static bool menuShown();
+ static bool singleShotTimerActive();
+ static bool quitCalled();
+ static void setGestureState(int state);
+ static void setWidgetOpen(bool isOpen);
+ static bool isWidgetOpen();
+ static bool isWidgetRaised();
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/qthighway_stub.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2008-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 <qglobal.h>
+#include <xqserviceprovider.h>
+#include <xqservicerequest.h>
+#include <xqserviceutil.h>
+#include "qthighway_stub_helper.h"
+
+QString qtHighwayStubService;
+QString qtHighwayStubMessage;
+bool qtHighwayStubToBackground = false;
+bool qtHighwayStubIsService = false;
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+
+void QtHighwayStubHelper::reset()
+{
+ qtHighwayStubService.clear();
+ qtHighwayStubMessage.clear();
+ qtHighwayStubToBackground = false;
+ qtHighwayStubIsService = false;
+}
+
+QString QtHighwayStubHelper::service()
+{
+ return qtHighwayStubService;
+}
+
+QString QtHighwayStubHelper::message()
+{
+ return qtHighwayStubMessage;
+}
+
+bool QtHighwayStubHelper::utilToBackground()
+{
+ return qtHighwayStubToBackground;
+}
+
+void QtHighwayStubHelper::setIsService(bool isService)
+{
+ qtHighwayStubIsService = isService;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+XQServiceProvider::XQServiceProvider( const QString& service, QObject *parent )
+{
+ Q_UNUSED(service);
+ Q_UNUSED(parent);
+}
+
+XQServiceProvider::~XQServiceProvider()
+{
+
+}
+
+void XQServiceProvider::SetPlugin(QObject* impl_plugin)
+{
+ Q_UNUSED(impl_plugin);
+}
+
+void XQServiceProvider::publishAll()
+{
+
+}
+
+int XQServiceProvider::setCurrentRequestAsync()
+{
+ return 0;
+}
+
+bool XQServiceProvider::completeRequest(int index, const QVariant& retValue)
+{
+ Q_UNUSED(index);
+ Q_UNUSED(retValue);
+ return true;
+}
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+XQServiceRequest::XQServiceRequest(
+ const QString& service, const QString& message, const bool& synchronous)
+{
+ qtHighwayStubService = service;
+ qtHighwayStubMessage = message;
+}
+
+XQServiceRequest::~XQServiceRequest()
+{
+
+}
+
+
+void XQServiceRequest::setArguments(const QList<QVariant> &arguments)
+{
+ Q_UNUSED(arguments)
+}
+
+QString XQServiceRequest::service() const
+{
+ return qtHighwayStubService;
+}
+
+QString XQServiceRequest::message() const
+{
+ return qtHighwayStubMessage;
+}
+
+bool XQServiceRequest::send(QVariant& retValue)
+{
+ return true;
+}
+void XQServiceRequest::addArg(const QVariant& v)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void XQServiceUtil::toBackground(bool value)
+{
+ qtHighwayStubToBackground = value;
+}
+
+bool XQServiceUtil::isService()
+{
+ return qtHighwayStubIsService;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/qthighway_stub_helper.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* 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:
+*
+*/
+
+/**
+* Helper class to control logcli stub behavior
+*
+*/
+class QtHighwayStubHelper{
+ public:
+ static void reset();
+ static QString service();
+ static QString message();
+ static bool utilToBackground();
+ static void setIsService(bool isService);
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/tsrc/ut_logsapp/ut_logsapp.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,113 @@
+#
+# 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 = app
+TARGET =
+
+QT += testlib xml
+CONFIG += hb
+RESOURCES += ../../logsapp.qrc
+
+INCLUDEPATH += .
+INCLUDEPATH += stubs #must be before orbit includes
+INCLUDEPATH += ../../
+INCLUDEPATH += ../../inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += logsengine_stub
+INCLUDEPATH += ../../../logsengine/inc
+INCLUDEPATH += ../../../logsengine/logssymbianos
+INCLUDEPATH += ../../../logsengine/logssymbianos/inc
+INCLUDEPATH += /orbit/include
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+INCLUDEPATH += ../../../tsrc/qtestutils/inc
+
+DEFINES += QT_NO_DEBUG_OUTPUT
+
+# Input
+HEADERS += inc/ut_logsmainwindow.h
+HEADERS += inc/ut_logscomponentrepository.h
+HEADERS += inc/ut_logsviewmanager.h
+HEADERS += inc/ut_logsbaseview.h
+HEADERS += inc/ut_logsrecentcallsview.h
+HEADERS += inc/ut_logsdetailsview.h
+HEADERS += inc/ut_logsmatchesview.h
+HEADERS += inc/ut_logseffecthandler.h
+HEADERS += inc/ut_logspageindicator.h
+HEADERS += inc/ut_logspageindicatoritem.h
+HEADERS += ../../inc/logsmainwindow.h
+HEADERS += ../../inc/logsviewmanager.h
+HEADERS += ../../inc/logsrecentcallsview.h
+HEADERS += ../../inc/logsbaseview.h
+HEADERS += ../../inc/logsdetailsview.h
+HEADERS += ../../inc/logsmatchesview.h
+HEADERS += ../../inc/logsservicehandler.h
+HEADERS += ../../inc/logseffecthandler.h
+HEADERS += ../../inc/logspageindicator.h
+HEADERS += ../../inc/logspageindicatoritem.h
+HEADERS += inc/ut_logsservicehandler.h
+HEADERS += logsengine_stub/logscontact.h
+HEADERS += logsengine_stub/logsforegroundwatcher.h
+HEADERS += ./stubs/dialpad.h
+HEADERS += ./stubs/dialpadkeyhandler.h
+
+SOURCES += src/main.cpp
+SOURCES += src/ut_logsmainwindow.cpp
+SOURCES += ../../src/logsmainwindow.cpp
+SOURCES += src/ut_logscomponentrepository.cpp
+SOURCES += ../../src/logscomponentrepository.cpp
+SOURCES += src/ut_logsviewmanager.cpp
+SOURCES += ../../src/logsviewmanager.cpp
+SOURCES += logsengine_stub/logsabstractmodel.cpp
+SOURCES += logsengine_stub/logsmodel.cpp
+SOURCES += logsengine_stub/logsdetailsmodel.cpp
+SOURCES += logsengine_stub/logscall.cpp
+SOURCES += logsengine_stub/logsmessage.cpp
+SOURCES += logsengine_stub/logsevent.cpp
+SOURCES += logsengine_stub/logseventdata.cpp
+SOURCES += logsengine_stub/logscontact.cpp
+SOURCES += logsengine_stub/logsmatchesmodel.cpp
+SOURCES += logsengine_stub/logsforegroundwatcher.cpp
+SOURCES += src/ut_logsbaseview.cpp
+SOURCES += src/ut_logsrecentcallsview.cpp
+SOURCES += src/ut_logsdetailsview.cpp
+SOURCES += src/ut_logsmatchesview.cpp
+SOURCES += src/ut_logseffecthandler.cpp
+SOURCES += src/ut_logsservicehandler.cpp
+SOURCES += src/ut_logspageindicator.cpp
+SOURCES += src/ut_logspageindicatoritem.cpp
+SOURCES += ../../src/logsbaseview.cpp
+SOURCES += ../../src/logsrecentcallsview.cpp
+SOURCES += ../../src/logsdetailsview.cpp
+SOURCES += ../../src/logsmatchesview.cpp
+SOURCES += ../../src/logsservicehandler.cpp
+SOURCES += ../../src/logseffecthandler.cpp
+SOURCES += ../../src/logspageindicator.cpp
+SOURCES += ../../src/logspageindicatoritem.cpp
+SOURCES += ../../../tsrc/qtestutils/src/testresultxmlparser.cpp
+SOURCES += ./stubs/hbstubs.cpp
+SOURCES += ./stubs/qthighway_stub.cpp
+SOURCES += ./stubs/dialpad_stub.cpp
+SOURCES += ./stubs/dialpadkeyhandler_stub.cpp
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xEb768cbc
+ TARGET.CAPABILITY = ALL -TCB
+ TARGET.EPOCALLOWDLLDATA = 1
+ LIBS += -lxqservice -lxqserviceutil
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/bwins/logscntfinderu.def Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,25 @@
+EXPORTS
+ ?getEntry@LogsCntFinder@@QBEPAVLogsCntEntry@@ABVQObject@@@Z @ 1 NONAME ; class LogsCntEntry * LogsCntFinder::getEntry(class QObject const &) const
+ ?deleteEntry@LogsCntFinder@@QAEXABVQObject@@@Z @ 2 NONAME ; void LogsCntFinder::deleteEntry(class QObject const &)
+ ?contactId@LogsCntEntry@@QBEIXZ @ 3 NONAME ; unsigned int LogsCntEntry::contactId(void) const
+ ?setFirstName@LogsCntEntry@@QAEXABVQString@@@Z @ 4 NONAME ; void LogsCntEntry::setFirstName(class QString const &)
+ ??0LogsCntEntry@@QAE@AAVQObject@@I@Z @ 5 NONAME ; LogsCntEntry::LogsCntEntry(class QObject &, unsigned int)
+ ?speedDial@LogsCntEntry@@QBEABVQString@@XZ @ 6 NONAME ; class QString const & LogsCntEntry::speedDial(void) const
+ ?predictiveSearchQuery@LogsCntFinder@@QAEXABVQString@@@Z @ 7 NONAME ; void LogsCntFinder::predictiveSearchQuery(class QString const &)
+ ?richText@LogsCntText@@QBE?AVQString@@V2@0@Z @ 8 NONAME ; class QString LogsCntText::richText(class QString, class QString) const
+ ?setLastName@LogsCntEntry@@QAEXABVQString@@@Z @ 9 NONAME ; void LogsCntEntry::setLastName(class QString const &)
+ ??0LogsCntFinder@@QAE@XZ @ 10 NONAME ; LogsCntFinder::LogsCntFinder(void)
+ ?insertEntry@LogsCntFinder@@QAEXHPAVLogsCntEntry@@@Z @ 11 NONAME ; void LogsCntFinder::insertEntry(int, class LogsCntEntry *)
+ ?resultsCount@LogsCntFinder@@QBEHXZ @ 12 NONAME ; int LogsCntFinder::resultsCount(void) const
+ ?phoneNumber@LogsCntEntry@@QBEABVLogsCntText@@XZ @ 13 NONAME ; class LogsCntText const & LogsCntEntry::phoneNumber(void) const
+ ?type@LogsCntEntry@@QBE?AW4EntryType@1@XZ @ 14 NONAME ; enum LogsCntEntry::EntryType LogsCntEntry::type(void) const
+ ?resultAt@LogsCntFinder@@QAEABVLogsCntEntry@@H@Z @ 15 NONAME ; class LogsCntEntry const & LogsCntFinder::resultAt(int)
+ ?lastName@LogsCntEntry@@QBEABV?$QList@VLogsCntText@@@@XZ @ 16 NONAME ; class QList<class LogsCntText> const & LogsCntEntry::lastName(void) const
+ ?handle@LogsCntEntry@@QBEPAVQObject@@XZ @ 17 NONAME ; class QObject * LogsCntEntry::handle(void) const
+ ?firstName@LogsCntEntry@@QBEABV?$QList@VLogsCntText@@@@XZ @ 18 NONAME ; class QList<class LogsCntText> const & LogsCntEntry::firstName(void) const
+ ??1LogsCntFinder@@UAE@XZ @ 19 NONAME ; LogsCntFinder::~LogsCntFinder(void)
+ ?setPhoneNumber@LogsCntEntry@@QAEXABVQString@@@Z @ 20 NONAME ; void LogsCntEntry::setPhoneNumber(class QString const &)
+ ?setAvatarPath@LogsCntEntry@@QAEXABVQString@@@Z @ 21 NONAME ; void LogsCntEntry::setAvatarPath(class QString const &)
+ ?avatarPath@LogsCntEntry@@QBEABVQString@@XZ @ 22 NONAME ; class QString const & LogsCntEntry::avatarPath(void) const
+ ??0LogsCntFinder@@QAE@AAVQContactManager@QtMobility@@@Z @ 23 NONAME ; LogsCntFinder::LogsCntFinder(class QtMobility::QContactManager &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/eabi/logscntfinderu.def Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,30 @@
+EXPORTS
+ _ZN12LogsCntEntry11setLastNameERK7QString @ 1 NONAME
+ _ZN12LogsCntEntry12setFirstNameERK7QString @ 2 NONAME
+ _ZN12LogsCntEntry14setPhoneNumberERK7QString @ 3 NONAME
+ _ZN12LogsCntEntryC1ER7QObjectj @ 4 NONAME
+ _ZN12LogsCntEntryC2ER7QObjectj @ 5 NONAME
+ _ZN13LogsCntFinder11deleteEntryERK7QObject @ 6 NONAME
+ _ZN13LogsCntFinder11insertEntryEiP12LogsCntEntry @ 7 NONAME
+ _ZN13LogsCntFinder21predictiveSearchQueryERK7QString @ 8 NONAME
+ _ZN13LogsCntFinder8resultAtEi @ 9 NONAME
+ _ZN13LogsCntFinderC1Ev @ 10 NONAME
+ _ZN13LogsCntFinderC2Ev @ 11 NONAME
+ _ZN13LogsCntFinderD0Ev @ 12 NONAME
+ _ZN13LogsCntFinderD1Ev @ 13 NONAME
+ _ZN13LogsCntFinderD2Ev @ 14 NONAME
+ _ZNK11LogsCntText8richTextE7QStringS0_ @ 15 NONAME
+ _ZNK12LogsCntEntry11phoneNumberEv @ 16 NONAME
+ _ZNK12LogsCntEntry4typeEv @ 17 NONAME
+ _ZNK12LogsCntEntry6handleEv @ 18 NONAME
+ _ZNK12LogsCntEntry8lastNameEv @ 19 NONAME
+ _ZNK12LogsCntEntry9contactIdEv @ 20 NONAME
+ _ZNK12LogsCntEntry9firstNameEv @ 21 NONAME
+ _ZNK12LogsCntEntry9speedDialEv @ 22 NONAME
+ _ZNK13LogsCntFinder12resultsCountEv @ 23 NONAME
+ _ZNK13LogsCntFinder8getEntryERK7QObject @ 24 NONAME
+ _ZN12LogsCntEntry13setAvatarPathERK7QString @ 25 NONAME
+ _ZNK12LogsCntEntry10avatarPathEv @ 26 NONAME
+ _ZN13LogsCntFinderC1ERN10QtMobility15QContactManagerE @ 27 NONAME
+ _ZN13LogsCntFinderC2ERN10QtMobility15QContactManagerE @ 28 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/inc/logscntfinder.h Tue May 04 12:39:37 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:
+*
+*/
+
+#ifndef LOGSCNTFINDER_H
+#define LOGSCNTFINDER_H
+
+#include <logscntfinderexport.h>
+#include <QObject>
+#include <QList>
+#include <QString>
+#include <qmobilityglobal.h>
+
+
+class LogsCntEntry;
+typedef QObject LogsCntEntryHandle;
+
+QTM_BEGIN_NAMESPACE
+class QContactManager;
+QTM_END_NAMESPACE
+
+QTM_USE_NAMESPACE
+
+class LogsCntText
+{
+public:
+
+ inline LogsCntText() : mHighlights(0){}
+ inline const QString& text() const {return mText;}
+ inline int highlights() const {return mHighlights;}
+ LOGSCNTFINDER_EXPORT QString richText( QString startTag = QString("<b><u>"),
+ QString endTag = QString("</u></b>")) const;
+
+
+private:
+
+ QString mText;
+ QString mTranslatedText;
+ int mHighlights;
+
+ friend class LogsCntEntry;
+ friend class UT_LogsCntEntry;
+ friend class UT_LogsCntFinder;
+};
+
+typedef QList<LogsCntText> LogsCntTextList;
+
+class LogsCntEntry
+{
+public:
+
+ enum EntryType {
+ EntryTypeHistory,
+ EntryTypeContact
+ };
+
+ LOGSCNTFINDER_EXPORT LogsCntEntry( LogsCntEntryHandle& handle,
+ quint32 cid );
+ LogsCntEntry( quint32 cid );
+ LogsCntEntry( const LogsCntEntry& entry );
+ ~LogsCntEntry();
+ LOGSCNTFINDER_EXPORT EntryType type() const;
+ LOGSCNTFINDER_EXPORT const LogsCntTextList& firstName() const;
+ LOGSCNTFINDER_EXPORT const LogsCntTextList& lastName() const;
+ LOGSCNTFINDER_EXPORT quint32 contactId() const;
+ LOGSCNTFINDER_EXPORT LogsCntEntryHandle* handle() const;
+ LOGSCNTFINDER_EXPORT void setFirstName( const QString& name );
+ LOGSCNTFINDER_EXPORT void setLastName( const QString& name );
+ LOGSCNTFINDER_EXPORT const LogsCntText& phoneNumber() const;
+ LOGSCNTFINDER_EXPORT const QString& avatarPath() const;
+ LOGSCNTFINDER_EXPORT void setPhoneNumber( const QString& number );
+ LOGSCNTFINDER_EXPORT void setAvatarPath( const QString& avatarpath );
+ LOGSCNTFINDER_EXPORT const QString& speedDial() const;
+
+ bool isCached() const;
+ void setHighlights( const QString& pattern );
+ void setSpeedDial( const QString& number );
+ bool match( const QString& pattern ) const;
+
+private:
+
+ void doSetText( const QString& text, LogsCntTextList& textlist );
+ QStringList tokens( const QString& source, const QChar& separ = ' ' ) const;
+ void doSetHighlights( const QString& pattern, LogsCntTextList& nameArray );
+ void resetHighlights( LogsCntTextList& nameArray );
+ bool doSimpleMatch( const QString& pattern ) const;
+ bool doComplexMatch( QStringList patternArray ) const;
+ void padWithZeros( QString& token, const QString& source, int padIndex ) const;
+
+
+private:
+
+ EntryType mType;
+ quint32 mCid;
+ LogsCntTextList mFirstName;
+ LogsCntTextList mLastName;
+ bool mCached;
+ LogsCntEntryHandle* mHandle;
+ LogsCntText mPhoneNumber;
+ QString mAvatarPath;
+ QString mSpeedDial;
+
+ friend class UT_LogsCntEntry;
+ friend class UT_LogsCntFinder;
+};
+
+typedef QList<LogsCntEntry*> LogsCntEntryList;
+
+/**
+ * Log events and contacts finder
+ *
+ */
+class LogsCntFinder : public QObject
+{
+
+ Q_OBJECT
+
+public: // The exported API
+
+ LOGSCNTFINDER_EXPORT LogsCntFinder();
+ LOGSCNTFINDER_EXPORT LogsCntFinder(QContactManager& contactManager);
+ LOGSCNTFINDER_EXPORT ~LogsCntFinder();
+
+ /**
+ * Starts/continues predictive query based on pattern. If
+ * there is a previously executed query with same pattern,
+ * call is treated as continue query.
+ * @param pattern the predictive pattern, containing digit(s)
+ */
+ LOGSCNTFINDER_EXPORT
+ void predictiveSearchQuery( const QString& pattern );
+
+ /**
+ * returns number of results
+ * @return number of results
+ */
+ LOGSCNTFINDER_EXPORT
+ int resultsCount() const;
+
+ /**
+ * returns result at index
+ * @param index the index
+ */
+ LOGSCNTFINDER_EXPORT
+ const LogsCntEntry& resultAt( int index );
+
+ /**
+ * Used for adding entiries to be part of a query
+ * Ownership is transfered
+ * @param entry the entry
+ */
+ LOGSCNTFINDER_EXPORT
+ void insertEntry( int index, LogsCntEntry* entry );
+
+ /**
+ * Used for updating entiries
+ * @param handle the handle
+ */
+ LOGSCNTFINDER_EXPORT
+ LogsCntEntry* getEntry( const LogsCntEntryHandle& handle ) const;
+
+ /**
+ * Used for updating entiries
+ * @param entry the entry
+ */
+ LOGSCNTFINDER_EXPORT
+ void deleteEntry( const LogsCntEntryHandle& handle );
+
+signals:
+
+ /**
+ * emitted when query is ready
+ */
+ void queryReady();
+
+private:
+
+ void doPredictiveHistoryQuery();
+ void doPredictiveContactQuery( LogsCntEntryList& recentResults );
+ void doPredictiveCacheQuery();
+
+ LogsCntEntry* doGetEntry( const LogsCntEntryList& list,
+ const LogsCntEntryHandle& handle ) const;
+
+ void addResult( quint32 cntId, LogsCntEntryList& recentResults );
+ void addResult( LogsCntEntry* entry );
+ void updateResult( LogsCntEntry* entry );
+ bool isProgressivePattern( const QString& pattern ) const;
+
+
+
+private:
+
+ QString mCurrentPredictivePattern;
+ LogsCntEntryList mResults;
+ QContactManager* mContactManager;
+ LogsCntEntryList mHistoryEvents;
+ int mCachedCounter;
+
+ friend class UT_LogsCntFinder;
+
+};
+
+#endif //LOGSCNTFINDER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/inc/logspredictivetranslator.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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 LOGSPREDICTIVETRANSLATOR_H
+#define LOGSPREDICTIVETRANSLATOR_H
+
+#include <QObject>
+#include <QChar>
+
+class HbKeymap;
+
+/**
+ * predictive translator. Singelton
+ *
+ */
+class LogsPredictiveTranslator : public QObject
+{
+
+ Q_OBJECT
+
+public:
+
+ static LogsPredictiveTranslator* instance();
+ static void deleteInstance();
+
+ ~LogsPredictiveTranslator();
+
+ const QString translate( const QString& name, int count = -1 ) const;
+ int startsWith( const QString& text, const QString& pattern, bool optimize = true ) const;
+
+
+private:
+
+ explicit LogsPredictiveTranslator();
+ const QChar translate( const QChar character ) const;
+
+
+private:
+
+ static LogsPredictiveTranslator* mInstance;
+ const HbKeymap* mKeyMap;
+
+ friend class UT_LogsPredictiveTranslator;
+
+};
+
+#endif //LOGSPREDICTIVETRANSLATOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/logscntfinder.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,60 @@
+#
+# 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 = lib
+
+TARGET = logscntfinder
+CONFIG += dll
+CONFIG += hb
+
+INCLUDEPATH += ./
+INCLUDEPATH += ./inc
+INCLUDEPATH += ../inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+
+# Input
+HEADERS += inc/logscntfinder.h
+HEADERS += inc/logspredictivetranslator.h
+
+# Input
+SOURCES += src/logscntfinder.cpp
+SOURCES += src/logspredictivetranslator.cpp
+
+# stub Input. comment out from real lib
+#SOURCES += tsrc/stubs/qtcontacts_stubs.cpp
+
+DEFINES += LOGSCNTFINDER_LIB
+
+libFiles.sources = logscntfinder.dll
+libFiles.path = "!:/sys/bin"
+DEPLOYMENT += libFiles
+
+symbian: {
+ TARGET.UID2 = 0x1000008d
+ TARGET.UID3 = 0x10282CE3
+
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCALLOWDLLDATA = 1
+ LIBS += -lflogger -lqtcontacts
+ defFiles = "$${LITERAL_HASH}ifdef WINS" \
+ "DEFFILE bwins/logscntfinder.def" \
+ "$${LITERAL_HASH}else" \
+ "DEFFILE eabi/logscntfinder.def" \
+ "$${LITERAL_HASH}endif"
+ MMP_RULES += defFiles
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/src/logscntfinder.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,796 @@
+/*
+* 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 <QListIterator>
+
+#include <qcontactdetailfilter.h>
+#include <qcontactphonenumber.h>
+#include <qcontactname.h>
+#include <qcontactmanager.h>
+#include <qcontactavatar.h>
+#include <QVector>
+
+#include "logscntfinder.h"
+#include "logspredictivetranslator.h"
+#include "logslogger.h"
+
+const int MaxPredSearchPatternLen = 15;
+const QChar ZeroSepar('0');
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::richText()
+// -----------------------------------------------------------------------------
+//
+QString LogsCntText::richText( QString startTag,
+ QString endTag ) const
+{
+ QString str = text();
+ if ( str.length() > 0 && highlights() > 0 ) {
+ str.insert( highlights() , endTag );
+ str.insert( 0, startTag );
+ }
+
+ return str;
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::LogsCntEntry()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry::LogsCntEntry( LogsCntEntryHandle& handle,
+ quint32 cid )
+ : mType( EntryTypeHistory ), mCid( cid ),
+ mCached( true ),mHandle(&handle)
+{
+ LogsCntText empty;
+ mFirstName.append( empty );
+ mLastName.append( empty );
+ mAvatarPath = "";
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::LogsCntEntry()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry::LogsCntEntry( quint32 cid )
+ : mType( EntryTypeContact ), mCid( cid ),
+ mCached( false ),mHandle(0)
+{
+ LogsCntText empty;
+ mFirstName.append( empty );
+ mLastName.append( empty );
+ mAvatarPath = "";
+}
+
+// -----------------------------------------------------------------------------
+// copy LogsCntEntry::LogsCntEntry()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry::LogsCntEntry( const LogsCntEntry& entry )
+ : mType(entry.mType),
+ mCid(entry.mCid),
+ mFirstName(entry.mFirstName),
+ mLastName(entry.mLastName),
+ mCached(entry.mCached),
+ mHandle(entry.mHandle),
+ mPhoneNumber(entry.mPhoneNumber),
+ mAvatarPath(entry.mAvatarPath)
+{
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::~LogsCntEntry()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry::~LogsCntEntry()
+{
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::firstName()
+// -----------------------------------------------------------------------------
+//
+const LogsCntTextList& LogsCntEntry::firstName() const
+{
+ return mFirstName;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::lastName()
+// -----------------------------------------------------------------------------
+//
+const LogsCntTextList& LogsCntEntry::lastName() const
+{
+ return mLastName;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::avatarPath()
+// -----------------------------------------------------------------------------
+//
+const QString& LogsCntEntry::avatarPath() const
+{
+ return mAvatarPath;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::phoneNumber()
+// -----------------------------------------------------------------------------
+//
+const LogsCntText& LogsCntEntry::phoneNumber() const
+{
+ return mPhoneNumber;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::speedDial()
+// -----------------------------------------------------------------------------
+//
+const QString& LogsCntEntry::speedDial() const
+{
+ return mSpeedDial;
+}
+
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::contactId()
+// -----------------------------------------------------------------------------
+//
+quint32 LogsCntEntry::contactId() const
+{
+ return mCid;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::handle()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntryHandle* LogsCntEntry::handle() const
+{
+ return mHandle;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::setFirstName()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::setFirstName( const QString& name )
+{
+ mCached=true;
+ mFirstName.clear();
+ doSetText( name, mFirstName );
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::setLastName()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::setLastName( const QString& name )
+{
+ mCached=true;
+ mLastName.clear();
+ doSetText( name, mLastName );
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::setAvatarPath()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::setAvatarPath( const QString& avatarpath )
+{
+ mCached=true;
+ mAvatarPath.clear();
+ mAvatarPath = avatarpath;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::tokens()
+// -----------------------------------------------------------------------------
+//
+QStringList LogsCntEntry::tokens( const QString& source,
+ const QChar& separ ) const
+{
+ QStringList target = source.split( separ, QString::SkipEmptyParts );
+ if ( target.length() > 1 && separ == ZeroSepar ) {
+ QString& first = target[0];
+ QString& last = target[target.length()-1];
+ padWithZeros( first, source, 0 );
+ padWithZeros( last, source, last.length() );
+ }
+ return target;
+
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::padWithLeadingZeros()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::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;
+ }
+ }
+}
+
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::doSetText()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::doSetText( const QString& text, LogsCntTextList& textlist )
+{
+ QListIterator<QString> iter( tokens( text ) );
+
+ while( iter.hasNext() ) {
+ LogsCntText txt;
+ txt.mText = iter.next();
+ txt.mTranslatedText =
+ LogsPredictiveTranslator::instance()->translate( txt.mText );
+ textlist.append( txt );
+ }
+ if ( textlist.count() == 0 ) {
+ textlist.append( LogsCntText() );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::setPhoneNumber()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::setPhoneNumber( const QString& number )
+{
+ mCached=true;
+ mPhoneNumber.mText = number;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::resetHighlights()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::resetHighlights( LogsCntTextList& nameArray )
+{
+ QMutableListIterator<LogsCntText> names( nameArray );
+ while( names.hasNext() ) {
+ names.next().mHighlights = 0;
+ }
+
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::setHighlights()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::setHighlights( const QString& pattern )
+{
+ resetHighlights( mFirstName );
+ resetHighlights( mLastName );
+
+ mPhoneNumber.mHighlights =
+ mPhoneNumber.text().startsWith( pattern ) &&
+ mPhoneNumber.text().length() >= pattern.length() ?
+ pattern.length(): 0;
+
+ doSetHighlights( pattern, mFirstName );
+ doSetHighlights( pattern, mLastName );
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::doSetHighlights()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::doSetHighlights( const QString& pattern,
+ LogsCntTextList& nameArray )
+{
+
+ LogsPredictiveTranslator* translator =
+ LogsPredictiveTranslator::instance();
+ QMutableListIterator<LogsCntText> names( nameArray );
+ bool hasZeros = pattern.contains( ZeroSepar );
+
+ //simple
+ while( names.hasNext() ) {
+ LogsCntText& nameItem = names.next();
+ nameItem.mHighlights =
+ translator->startsWith( nameItem.mText, pattern, false );
+ }
+
+ //complex
+ QStringList tokenArray = tokens( pattern, ZeroSepar );
+ QListIterator<QString> patternArray( tokenArray );
+ while( hasZeros && patternArray.hasNext() ) {
+ QString patternItem = patternArray.next();
+ names.toFront();
+ while( names.hasNext() ) {
+ LogsCntText& nameItem = names.next();
+ int matchSize = translator->startsWith( nameItem.mText,
+ patternItem, !hasZeros );
+ nameItem.mHighlights = matchSize > nameItem.mHighlights ?
+ matchSize : nameItem.mHighlights;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::setSpeedDial()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::setSpeedDial( const QString& number )
+{
+ mSpeedDial = number;
+}
+
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::match()
+// -----------------------------------------------------------------------------
+//
+bool LogsCntEntry::match( const QString& pattern ) const
+{
+ bool match = false;
+
+ //direct match with phone number is enough
+ match = mPhoneNumber.text().startsWith( pattern ) ||
+ doSimpleMatch( pattern );
+
+ if ( !match && pattern.contains( ZeroSepar ) ) {
+ QStringList patternArray = tokens( pattern, ZeroSepar );
+ match = doComplexMatch( patternArray );
+ }
+
+ return match;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::doSimpleMatch()
+// -----------------------------------------------------------------------------
+//
+bool LogsCntEntry::doSimpleMatch( const QString& pattern ) const
+{
+ LogsCntTextList nameArray = mFirstName + mLastName; //with empties
+ QListIterator<LogsCntText> names( nameArray );
+ int matchCount = 0;
+
+ while( names.hasNext() && !matchCount ) {
+ matchCount = (int)names.next().mTranslatedText.startsWith( pattern );
+ }
+
+ return matchCount > 0;
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::doComplexMatch()
+// -----------------------------------------------------------------------------
+//
+bool LogsCntEntry::doComplexMatch( QStringList patternArray ) const
+{
+ const bool zero = false;
+
+ LogsCntTextList nameArray = mFirstName + mLastName; //with empties
+
+ int targetMatchCount = patternArray.count();
+ int namesCount = nameArray.count();
+
+ //if pattern has more tokens than name(s), it is a missmatch
+ if ( namesCount < targetMatchCount ) {
+ return false;
+ }
+
+ QListIterator<LogsCntText> names( nameArray );
+ QListIterator<QString> patterns( patternArray );
+ QVector<bool> matchVector(targetMatchCount, zero );
+ int currentPattern = 0;
+ int matchCount = 0;
+ bool match = false;
+
+ while( names.hasNext() && matchCount < targetMatchCount ) {
+ LogsCntText name = names.next();
+ currentPattern = 0;
+ patterns.toFront();
+ match = false;
+ while ( !name.mText.isEmpty() &&
+ patterns.hasNext() && !match ) {
+ QString pattern = patterns.next();
+ //unique match check
+ if ( !matchVector.at( currentPattern ) ) {
+ match = matchVector[ currentPattern ]
+ = name.mTranslatedText.startsWith( pattern );
+ matchCount = match ? matchCount+1 : matchCount;
+ }
+ currentPattern++;
+ }
+ }
+ return matchCount >= targetMatchCount;
+
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::isCached()
+// -----------------------------------------------------------------------------
+//
+bool LogsCntEntry::isCached() const
+{
+ return mCached;
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::type()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry::EntryType LogsCntEntry::type() const
+{
+ return mType;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::LogsCntFinder()
+// -----------------------------------------------------------------------------
+//
+LogsCntFinder::LogsCntFinder()
+ : mCachedCounter(0)
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::LogsCntFinder()" )
+
+ // Create manager ourselves, object takes care of deletion when registering
+ // as parent.
+ QMap<QString, QString> dummyParams;
+ mContactManager = new QContactManager("symbian", dummyParams, this);
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::LogsCntFinder()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::LogsCntFinder()
+// -----------------------------------------------------------------------------
+//
+LogsCntFinder::LogsCntFinder(QContactManager& contactManager)
+ : mCachedCounter(0)
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::LogsCntFinder(), cntmgr from client" )
+
+ mContactManager = &contactManager;
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::LogsCntFinder()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::~LogsCntFinder()
+// -----------------------------------------------------------------------------
+//
+LogsCntFinder::~LogsCntFinder()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::~LogsCntFinder()" )
+
+ qDeleteAll( mResults );
+ qDeleteAll( mHistoryEvents );
+ LogsPredictiveTranslator::deleteInstance();
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::~LogsCntFinder()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::isProgressivePattern
+// -----------------------------------------------------------------------------
+//
+bool LogsCntFinder::isProgressivePattern( const QString& pattern ) const
+{
+ //"" -> XXX not progressive
+ //XX -> YY not progressive
+ //XXX -> YY not progressive
+ int prevPatternLen = mCurrentPredictivePattern.length();
+ return prevPatternLen > 0 &&
+ pattern.length() - prevPatternLen > 0;
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::predictiveSearchQuery
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::predictiveSearchQuery( const QString& pattern )
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::predictiveSearchQuery()" )
+ LOGS_QDEBUG_2( "logs [FINDER] pattern= ", pattern )
+
+ if ( pattern.length() > MaxPredSearchPatternLen ) {
+ LOGS_QDEBUG( "logs [FINDER] too long pattern. Exit quietly.")
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::predictiveSearchQuery()" )
+ return;
+ }
+
+ //in this point mCurrentPredictivePattern is previous
+ bool patternIsProgressive = isProgressivePattern( pattern );
+ bool resultsAreAllCached = resultsCount() > 0 &&
+ mCachedCounter == resultsCount();
+ bool nothingToDo = resultsCount() == 0 &&
+ patternIsProgressive;
+
+ LOGS_QDEBUG_2( "logs [FINDER] patternIsProgressive = ", patternIsProgressive )
+ LOGS_QDEBUG_2( "logs [FINDER] resultsAreAllCached = ", resultsAreAllCached )
+ LOGS_QDEBUG_2( "logs [FINDER] nothingToDo = ", nothingToDo )
+ LOGS_QDEBUG_2( "logs [FINDER] cachedCounter = ", mCachedCounter )
+
+ mCurrentPredictivePattern = pattern;
+
+ if ( mCurrentPredictivePattern.isEmpty() ) {
+ qDeleteAll( mResults );
+ mResults.clear();
+ mCachedCounter = 0;
+ } else if ( ( patternIsProgressive &&
+ resultsAreAllCached ) ||
+ nothingToDo ) {
+ doPredictiveCacheQuery();
+ } else {
+ mCachedCounter = 0;
+ LogsCntEntryList recentResults = mResults;
+ mResults.clear();
+ doPredictiveHistoryQuery();
+ doPredictiveContactQuery( recentResults );
+ qDeleteAll( recentResults );
+ }
+ emit queryReady();
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::predictiveSearchQuery()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::doPredictiveHistoryQuery
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::doPredictiveHistoryQuery()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::doPredictiveHistoryQuery()" )
+
+ QListIterator<LogsCntEntry*> iter(mHistoryEvents);
+
+ while( iter.hasNext() ) {
+ LogsCntEntry* e = iter.next();
+ if ( e->match( mCurrentPredictivePattern ) ) {
+ LogsCntEntry* entry = new LogsCntEntry( *e );
+ addResult( entry );
+ }
+ }
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::doPredictiveHistoryQuery()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::doPredictiveContactQuery
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::doPredictiveContactQuery( LogsCntEntryList& recentResults )
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::doPredictiveContactQuery()" )
+ QContactDetailFilter df;
+ df.setDetailDefinitionName( QContactName::DefinitionName );
+ df.setMatchFlags( QContactFilter::MatchKeypadCollation );
+ df.setValue( mCurrentPredictivePattern );
+ QList<QContactLocalId> cntIds;
+ LOGS_QDEBUG( "logs [FINDER] about to call contacts manager" )
+
+ cntIds = mContactManager->contactIds( df );
+ LOGS_QDEBUG_2( "logs [FINDER] number of matched contacts =", cntIds.count() )
+ int index = 0;
+ while( index < cntIds.count() ) {
+ addResult( cntIds.at( index++ ), recentResults );
+ }
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::doPredictiveContactQuery()" )
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::doPredictiveCacheQuery()
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::doPredictiveCacheQuery()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::doPredictiveCacheQuery()" )
+ QMutableListIterator<LogsCntEntry*> iter(mResults);
+ while( iter.hasNext() ) {
+ LogsCntEntry* entry = iter.next();
+ if ( !entry->match( mCurrentPredictivePattern ) ) {
+ mCachedCounter =
+ entry->isCached() ? mCachedCounter-1 : mCachedCounter;
+ iter.remove();
+ delete entry;
+ } else {
+ entry->setHighlights( mCurrentPredictivePattern );
+ }
+ }
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::doPredictiveCacheQuery()" )
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::addResult()
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::addResult( quint32 cntId, LogsCntEntryList& recentResults )
+{
+ QMutableListIterator<LogsCntEntry*> iter(recentResults);
+ bool reused = false;
+ while( iter.hasNext() && !reused ) {
+ LogsCntEntry* entry = iter.next();
+ if ( entry->contactId() == cntId ) {
+ LOGS_QDEBUG_4( "logs [FINDER] LogsCntFinder::addResult() - \
+re-using entry. contact id ", cntId, "cached=", entry->isCached() );
+ iter.remove();
+ addResult( entry );
+ reused = true;
+ }
+ }
+
+ if ( !reused ) {
+ LogsCntEntry* entry = new LogsCntEntry( cntId );
+ addResult( entry );
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::addResult()
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::addResult( LogsCntEntry* entry )
+{
+ updateResult( entry );
+ mResults.append( entry );
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::updateResult()
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::updateResult( LogsCntEntry* entry )
+{
+ if ( entry->isCached() ) {
+ entry->setHighlights( mCurrentPredictivePattern );
+ mCachedCounter++;
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::resultsCount
+// -----------------------------------------------------------------------------
+//
+int LogsCntFinder::resultsCount() const
+{
+ return mResults.count();
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::resultAt
+// -----------------------------------------------------------------------------
+//
+const LogsCntEntry& LogsCntFinder::resultAt( int index )
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::resultAt()" )
+ LOGS_QDEBUG_2( "logs [FINDER] index=", index )
+
+ LogsCntEntry* entry = mResults.at( index );
+ if ( !entry->isCached() ) {
+ LOGS_QDEBUG_2( "logs [FINDER] caching from DB cid=", entry->contactId() )
+ QContact contact = mContactManager->contact( entry->contactId() );
+ QContactName contactName = contact.detail( QContactName::DefinitionName );
+ entry->setFirstName( contactName.value( QContactName::FieldFirst ) );
+ entry->setLastName( contactName.value( QContactName::FieldLast ) );
+ QContactPhoneNumber contactPhoneNumber =
+ contact.detail( QContactPhoneNumber::DefinitionName );
+ entry->setPhoneNumber(
+ contactPhoneNumber.value( QContactPhoneNumber::FieldNumber ) );
+ QContactAvatar contactAvatar = contact.detail<QContactAvatar>();
+ if (contactAvatar.subType().compare(
+ QLatin1String(QContactAvatar::SubTypeImage)) == 0 &&
+ !contactAvatar.avatar().isEmpty()) {
+ entry->setAvatarPath(contactAvatar.avatar());
+ }
+
+ updateResult( entry );
+ }
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::resultAt()" )
+ return *entry;
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::insertEntry
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::insertEntry( int index, LogsCntEntry* entry )
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::insertEntry()" )
+ LOGS_QDEBUG_4( "logs [FINDER] handle=", entry->handle()," to index ", index )
+
+ mHistoryEvents.insert( index, entry );
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::insertEntry()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::getEntry
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry* LogsCntFinder::getEntry( const LogsCntEntryHandle& handle ) const
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::getEntry()" )
+ return doGetEntry( mHistoryEvents, handle );
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::doGetEntry
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry* LogsCntFinder::doGetEntry( const LogsCntEntryList& list,
+ const LogsCntEntryHandle& handle ) const
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::doGetEntry()" )
+ LOGS_QDEBUG_2( "logs [FINDER] handle= ", &handle )
+
+ LogsCntEntry* entry = 0;
+ QListIterator<LogsCntEntry*> iter(list);
+
+ while( iter.hasNext() && !entry ) {
+ LogsCntEntry* e = iter.next();
+ entry = e->handle() == &handle ? e : 0;
+ }
+
+ LOGS_QDEBUG_2( "logs [FINDER] found=", (entry!=0) )
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::doGetEntry()" )
+ return entry;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::deleteEntry
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::deleteEntry( const LogsCntEntryHandle& handle )
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::deleteEntry()" )
+ LOGS_QDEBUG_2( "logs [FINDER] handle= ", &handle )
+
+ LogsCntEntry* toRemoveHistoryEv = doGetEntry( mHistoryEvents, handle );
+ mHistoryEvents.removeOne( toRemoveHistoryEv );
+ delete toRemoveHistoryEv;
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::deleteEntry()" )
+
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/src/logspredictivetranslator.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* 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 <QObject>
+#include <QLocale>
+#include <hbinputkeymapfactory.h>
+#include <hbinputkeymap.h>
+#include <hbinputsettingproxy.h>
+
+#include "logspredictivetranslator.h"
+#include "logslogger.h"
+
+LogsPredictiveTranslator* LogsPredictiveTranslator::mInstance = 0;
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveTranslator::instance()
+// -----------------------------------------------------------------------------
+//
+LogsPredictiveTranslator* LogsPredictiveTranslator::instance()
+{
+ if ( !mInstance ) {
+ mInstance = new LogsPredictiveTranslator();
+ }
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveTranslator::deleteInstance()
+// -----------------------------------------------------------------------------
+//
+void LogsPredictiveTranslator::deleteInstance()
+{
+ delete mInstance;
+ mInstance = 0;
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveTranslator::LogsPredictiveTranslator()
+// -----------------------------------------------------------------------------
+//
+LogsPredictiveTranslator::LogsPredictiveTranslator()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsPredictiveTranslator::\
+LogsPredictiveTranslator()" )
+ HbInputLanguage lang =
+ HbInputSettingProxy::instance()->globalInputLanguage();
+ mKeyMap = HbKeymapFactory::instance()->keymap( lang.language(),
+ lang.variant() );
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveTranslator::\
+LogsPredictiveTranslator()" )
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveTranslator::~LogsPredictiveTranslator()
+// -----------------------------------------------------------------------------
+//
+LogsPredictiveTranslator::~LogsPredictiveTranslator()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsPredictiveTranslator::\
+~LogsPredictiveTranslator()" )
+ mInstance = 0;
+ LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveTranslator::\
+~LogsPredictiveTranslator()" )
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveTranslator::translate()
+// -----------------------------------------------------------------------------
+//
+const QChar LogsPredictiveTranslator::translate( const QChar character ) const
+{
+ const HbMappedKey* mappedKey = mKeyMap->keyForCharacter( HbKeyboardVirtual12Key,
+ character );
+ if (!mappedKey) {
+ QString decomposed = character.decomposition();
+ if (decomposed.isEmpty()) {
+ return character;
+ }
+ return translate (decomposed.at(0));
+ }
+ return mappedKey->keycode;
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveTranslator::translate()
+// -----------------------------------------------------------------------------
+//
+const QString LogsPredictiveTranslator::translate( const QString& name,
+ int count ) const
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsPredictiveTranslator::translate()" )
+ LOGS_QDEBUG_2( "logs [FINDER] name ", name );
+
+ count = count == -1 ? name.length() : count;
+ QString result;
+ const QChar* content = name.data();
+ int index = 0;
+ while( index < name.length() && index < count ) {
+ result.insert( index++, translate( *content++ ) );
+ }
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveTranslator::translate()" )
+ return result;
+}
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveTranslator::startsWith()
+// -----------------------------------------------------------------------------
+//
+int LogsPredictiveTranslator::startsWith( const QString& text,
+ const QString& pattern,
+ bool optimize ) const
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsPredictiveTranslator::startsWith()" )
+ //assumed that text has found based on pattern, thus only checking with
+ //first char is enough, if mightContainZeroes eq false
+ int matchCount = pattern.length();
+ if ( text.isEmpty() || matchCount > text.length() ) {
+ matchCount = 0;
+ } else {
+ if ( !optimize ) {
+ QString translatedText = translate( text, pattern.length() );
+ matchCount = translatedText == pattern ? matchCount : 0;
+ } else {
+ matchCount = translate( *text.data() ) == *pattern.data() ?
+ matchCount : 0;
+ }
+ }
+
+ LOGS_QDEBUG_2( "logs [FINDER] matchCount=", matchCount )
+ LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveTranslator::startsWith()" )
+ return matchCount;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/inc/lcfmainwindow.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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 LCFMAINWINDOW_H
+#define LCFMAINWINDOW_H
+
+
+#include <QObject>
+#include <hbmainwindow.h>
+
+
+class LcfMainWindow : public HbMainWindow
+ {
+ Q_OBJECT
+
+public:
+
+ LcfMainWindow();
+ virtual ~LcfMainWindow();
+
+protected: // From HbMainWindow
+
+ void keyPressEvent( QKeyEvent *event );
+
+signals:
+
+ void callKeyPressed();
+
+
+ };
+
+
+#endif //LCFMAINWINDOW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/inc/lcfmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 LCFMODEL_H
+#define LCFMODEL_H
+
+#include <QAbstractListModel>
+
+class LogsCntFinder;
+
+/**
+ *
+ */
+class LcfModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+public:
+
+
+public:
+
+ LcfModel( LogsCntFinder& finder );
+ ~LcfModel();
+
+public: // From QAbstractItemModel
+
+ virtual int rowCount(const QModelIndex &parent) const;
+ virtual QVariant data(const QModelIndex &index, int role) const;
+
+public: //
+
+ void reset( bool enabled ) {mEnabled=enabled;}
+
+private: //data
+
+ LogsCntFinder& mFinder;
+ bool mEnabled;
+
+};
+
+#endif //LCFMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/inc/lcfsearchresultsview.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* 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 LCFSEARCHRESULTSVIEW_H
+#define LCFSEARCHRESULTSVIEW_H
+
+#include <hbview.h>
+#include <hbdocumentloader.h>
+#include "logslogger.h"
+
+class LcfModel;
+class HbListView;
+class HbTextEdit;
+class HbAction;
+class LcfViewLoader;
+class LogsCntFinder;
+
+const char lcfviewname[] = "logs_dialer_view";
+
+
+/**
+ *
+ */
+class LcfSearchResultsView : public HbView
+{
+ Q_OBJECT
+
+public:
+ explicit LcfSearchResultsView();
+ ~LcfSearchResultsView();
+ void init( LcfViewLoader& loader );
+
+public slots:
+
+ void callKeyPressed();
+
+private slots:
+
+ void closeView();
+ void queryReady();
+
+private:
+
+ void initListWidget();
+ void clearSoftKey();
+
+private:
+
+ HbListView* mListView;//not owned
+ QString mInput;
+ LcfModel* mModel; //owned
+ LogsCntFinder* mFinder;
+ HbAction* mSoftKeyBackAction;
+
+};
+
+
+class LcfViewLoader : public HbDocumentLoader
+{
+public:
+
+ LcfViewLoader() {}
+ inline QObject *createObject(const QString& type, const QString &name)
+ {
+ LOGS_QDEBUG( "logs [LCFPROTO] LcfViewLoader::createObject <->" )
+ LOGS_QDEBUG_2( "logs [LCFPROTO] ", name )
+
+ if ( name == lcfviewname ) {
+ return new LcfSearchResultsView();
+ } else {
+ return HbDocumentLoader::createObject( type, name );
+ }
+ }
+};
+
+
+#endif // LCFSEARCHRESULTSVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/lcfprotoui.pkg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,33 @@
+; lcfprotoui_template.pkg generated by qmake at 2009-12-01T10:45:50
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"lcfprotoui"},(0x101F4CD6),1,0,0
+
+; Localised Vendor name
+%{"Vendor"}
+
+; Unique Vendor name
+:"Vendor"
+
+; Manual PKG pre-rules from PRO files
+; Default HW/platform dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+
+; Default dependency to Qt libraries
+;(0x2001E61C), , , , {"Qt"}
+
+; Executable and default resource files
+"/epoc32/release/armv5/urel/lcfprotoui.exe" - "!:\sys\bin\lcfprotoui.exe"
+"/epoc32/data/z/resource/apps/lcfprotoui.rsc" - "!:\resource\apps\lcfprotoui.rsc"
+"/epoc32/data/z/private/10003a3f/import/apps/lcfprotoui_reg.rsc" - "!:\private\10003a3f\import\apps\lcfprotoui_reg.rsc"
+
+; Manual PKG post-rules from PRO files
+;"/epoc32/release/armv5/udeb/logscntfinder.dll" - "!:\sys\bin\logscntfinder.dll"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/lcfprotoui.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,48 @@
+#
+# 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 = app
+TARGET = lcfprotoui
+CONFIG += hb
+RESOURCES += lcfprotoui.qrc
+
+INCLUDEPATH += ./
+INCLUDEPATH += ./inc
+INCLUDEPATH += ../../inc
+INCLUDEPATH += ../../../inc
+
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+# Input
+HEADERS += inc/lcfmainwindow.h
+HEADERS += inc/lcfsearchresultsview.h
+HEADERS += inc/lcfmodel.h
+
+SOURCES += src/main.cpp
+SOURCES += src/lcfmainwindow.cpp
+SOURCES += src/lcfsearchresultsview.cpp
+SOURCES += src/lcfmodel.cpp
+
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0x101F4CD6
+ TARGET.CAPABILITY = CAP_APPLICATION
+ LIBS += -llogscntfinder
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/lcfprotoui.qrc Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/xml" >
+ <file alias="lcfSearchResultsView.xml" >resources/lcfSearchResultsView.xml</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/resources/lcfsearchResultsView.xml Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.6">
+ <object name="logs_act_exit" type="HbAction">
+ <string name="iconText" value="Exit"/>
+ <string name="text" value="Exit"/>
+ <string name="toolTip" value="Exit"/>
+ </object>
+ <widget name="logs_dialer_view" type="HbView">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <widget name="logs_label_search_results" type="HbLabel">
+ <zvalue value="1.0E-4"/>
+ <sizehint height="25" type="PREFERRED" width="127"/>
+ <sizehint height="25" type="MINIMUM" width="24"/>
+ <string name="text" value="Search results"/>
+ </widget>
+ <widget name="logs_list_view" type="HbListView">
+ <zvalue value="2.0001"/>
+ </widget>
+ <widget name="container" type="HbWidget">
+ <widget name="pushButton_5" type="HbPushButton">
+ <string name="text" value="5"/>
+ </widget>
+ <widget name="pushButton_1" type="HbPushButton">
+ <string name="text" value="1"/>
+ </widget>
+ <widget name="pushButton_2" type="HbPushButton">
+ <string name="text" value="2"/>
+ </widget>
+ <widget name="pushButton_3" type="HbPushButton">
+ <string name="text" value="3"/>
+ </widget>
+ <widget name="pushButton_4" type="HbPushButton">
+ <string name="text" value="4"/>
+ </widget>
+ <widget name="pushButton_6" type="HbPushButton">
+ <string name="text" value="6"/>
+ </widget>
+ <widget name="pushButton_8" type="HbPushButton">
+ <string name="text" value="8"/>
+ </widget>
+ <widget name="pushButton_9" type="HbPushButton">
+ <string name="text" value="9"/>
+ </widget>
+ <widget name="pushButton_7" type="HbPushButton">
+ <string name="text" value="7"/>
+ </widget>
+ <widget name="pushButton_0" type="HbPushButton">
+ <string name="text" value="0"/>
+ </widget>
+ <widget name="pushButton_10" type="HbPushButton">
+ <string name="text" value="C"/>
+ </widget>
+ <zvalue value="0.0"/>
+ <sizehint height="23.8806un" type="PREFERRED" width="23.8806un"/>
+ <layout type="grid">
+ <griditem column="0" itemname="pushButton_1" row="0"/>
+ <griditem column="1" itemname="pushButton_2" row="0"/>
+ <griditem column="2" itemname="pushButton_3" row="0"/>
+ <griditem column="0" itemname="pushButton_4" row="1"/>
+ <griditem column="1" itemname="pushButton_5" row="1"/>
+ <griditem column="2" itemname="pushButton_6" row="1"/>
+ <griditem column="0" itemname="pushButton_7" row="2"/>
+ <griditem column="1" itemname="pushButton_8" row="2"/>
+ <griditem column="2" itemname="pushButton_9" row="2"/>
+ <griditem column="1" itemname="pushButton_0" row="3"/>
+ <griditem column="2" itemname="pushButton_10" row="3"/>
+ </layout>
+ </widget>
+ <layout orientation="Vertical" type="linear">
+ <linearitem itemname="logs_label_search_results"/>
+ <linearitem itemname="logs_list_view"/>
+ <linearitem itemname="container"/>
+ </layout>
+ </widget>
+ <widget name="logs_view_menu" role="HbView:menu" type="HbMenu">
+ <sizehint height="142" type="PREFERRED" width="85"/>
+ <sizehint height="142" type="MINIMUM" width="85"/>
+ <ref object="logs_act_exit" role="HbMenu:addAction"/>
+ </widget>
+ <string name="title" value="Dialer"/>
+ </widget>
+ <connect receiver="logs_dialer_view" sender="logs_act_exit" signal="triggered(bool)" slot="closeView()"/>
+ <metadata activeUIState="Common ui state" display="QHD portrait" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ </metadata>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/src/lcfmainwindow.cpp Tue May 04 12:39:37 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:
+*
+*/
+
+#include "lcfmainwindow.h"
+#include "logslogger.h"
+#include <QKeyEvent>
+
+
+// -----------------------------------------------------------------------------
+// MainWindow::MainWindow
+// -----------------------------------------------------------------------------
+//
+LcfMainWindow::LcfMainWindow()
+ : HbMainWindow()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// LcfMainWindow::~LcfMainWindow
+// -----------------------------------------------------------------------------
+//
+LcfMainWindow::~LcfMainWindow()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// LcfMainWindow::keyPressEvent
+// -----------------------------------------------------------------------------
+//
+void LcfMainWindow::keyPressEvent( QKeyEvent *event )
+{
+ LOGS_QDEBUG_2( "LcfMainWindow::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.
+ emit callKeyPressed();
+ event->accept();
+ return;
+ }
+ HbMainWindow::keyPressEvent(event);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/src/lcfmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* 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 "lcfmodel.h"
+#include "logslogger.h"
+#include "logscntfinder.h"
+#include <QStringList>
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LcfModel::LcfModel(LogsCntFinder& finder )
+ : QAbstractListModel(),
+ mFinder( finder ),
+ mEnabled( true )
+{
+ LOGS_QDEBUG( "logs [LCFPROTO] -> LcfModel::LcfModel()" )
+ LOGS_QDEBUG( "logs [LCFPROTO] <- LcfModel::LcfModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LcfModel::~LcfModel()
+{
+ LOGS_QDEBUG( "logs [LCFPROTO] -> LcfModel::~LcfModel()" )
+ LOGS_QDEBUG( "logs [LCFPROTO] <- LcfModel::~LcfModel()" )
+}
+
+
+// -----------------------------------------------------------------------------
+// From QAbstractListModel
+// -----------------------------------------------------------------------------
+//
+int LcfModel::rowCount(const QModelIndex & /* parent */) const
+{
+ if (!mEnabled) {
+ return 0;
+ }
+ int count = mFinder.resultsCount();
+ LOGS_QDEBUG_2( "logs [LCFPROTO] <-> rowCount()=", count )
+ return count;
+}
+
+
+// -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+QVariant LcfModel::data(const QModelIndex &index, int role ) const
+{
+ LOGS_QDEBUG_2( "logs [LCFPROTO] <-> row()=", index.row() )
+ const QChar separ( ' ');
+
+ if (!mEnabled) {
+ return QVariant();
+ }
+
+ int resultCount = mFinder.resultsCount();
+ if (!index.isValid() ||
+ index.row() >= resultCount ||
+ index.row() < 0 ) {
+ return QVariant();
+ }
+ if (role == Qt::DisplayRole ){
+ const LogsCntEntry& result = mFinder.resultAt( index.row() );
+ QStringList name;
+ for( int i=0;i<result.firstName().count();i++) {
+ name << result.firstName()[i].richText();
+ }
+ for( int i=0;i<result.lastName().count();i++) {
+ name << result.lastName()[i].richText();
+ }
+
+ if ( result.phoneNumber().text().isEmpty() ) {
+ return QVariant(name.join( separ ) );
+ } else {
+ QStringList all( name.join( separ ) );
+ all.append( result.phoneNumber().richText() );
+ return QVariant( all );
+ }
+
+ } else {
+ return QVariant();
+ }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/src/lcfsearchresultsview.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* 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 "lcfsearchresultsview.h"
+#include "lcfmodel.h"
+#include "logslogger.h"
+#include "logscntfinder.h"
+
+//SYSTEM
+#include <hbview.h>
+#include <hblistview.h>
+#include <hblistviewitem.h>
+#include <hbmenu.h>
+#include <hbaction.h>
+#include <hbinstance.h>
+#include <qgraphicslayout.h>
+#include <hbtextedit.h>
+#include <hbpushbutton.h>
+
+
+void LcfSearchResultsView::init( LcfViewLoader& loader )
+{
+ LOGS_QDEBUG( "logs [LCFPROTO] -> LcfSearchResultsView::init()" );
+
+ mListView = qobject_cast<HbListView*>( loader.findWidget( "logs_list_view" ) );
+ mListView->setItemRecycling(true);
+
+ HbPushButton *buttons[11];
+ for (int i = 0; i < 11; ++i) {
+ QString text = QString::number(i);
+ QString buttonString("pushButton_");
+ buttonString.append(text);
+ buttons[i] = static_cast<HbPushButton*>(loader.findWidget(buttonString));
+ QObject::connect(buttons[i], SIGNAL(clicked()), this, SLOT(callKeyPressed()));
+ }
+
+ mListView->listItemPrototype()->setTextFormat( Qt::RichText );
+
+ LOGS_QDEBUG( "logs [LCFPROTO] <- LcfSearchResultsView::init()" );
+
+}
+
+// -----------------------------------------------------------------------------
+// LcfSearchResultsView::LcfSearchResultsView
+// -----------------------------------------------------------------------------
+//
+LcfSearchResultsView::LcfSearchResultsView()
+ : HbView(0),
+ mModel(0),
+ mFinder(0)
+{
+ LOGS_QDEBUG( "logs [LCFPROTO] -> LcfSearchResultsView::LcfSearchResultsView()" );
+ mSoftKeyBackAction = new HbAction(Hb::BackAction, this);
+ connect(mSoftKeyBackAction, SIGNAL(triggered()), this, SLOT(closeView()));
+ if ( !hbInstance->allMainWindows().isEmpty() ){
+ hbInstance->allMainWindows().at(0)->addSoftKeyAction(
+ Hb::SecondarySoftKey, mSoftKeyBackAction );
+ }
+
+ mFinder = new LogsCntFinder();
+ mModel = new LcfModel( *mFinder );
+
+ connect(mFinder, SIGNAL(queryReady()), this, SLOT(queryReady()));
+
+
+ LOGS_QDEBUG( "logs [LCFPROTO] <- LcfSearchResultsView::LcfSearchResultsView()" );
+}
+
+
+// -----------------------------------------------------------------------------
+// LcfSearchResultsView::~LcfSearchResultsView
+// -----------------------------------------------------------------------------
+//
+LcfSearchResultsView::~LcfSearchResultsView()
+{
+ LOGS_QDEBUG( "logs [LCFPROTO] -> LcfSearchResultsView::~LcfSearchResultsView()" );
+ delete mModel;
+ delete mFinder;
+ clearSoftKey();
+ delete mSoftKeyBackAction;
+
+ LOGS_QDEBUG( "logs [LCFPROTO] <- LcfSearchResultsView::~LcfSearchResultsView()" );
+}
+
+
+
+void LcfSearchResultsView::queryReady()
+{
+ LOGS_QDEBUG( "logs [LCFPROTO] -> LcfSearchResultsView::queryReady()" );
+ delete mModel;
+ mModel = new LcfModel( *mFinder );
+ mModel->reset( !mInput.isEmpty() );
+ mListView->setModel( mModel );
+
+ mListView->reset();
+ LOGS_QDEBUG( "logs [LCFPROTO] <- LcfSearchResultsView::queryReady()" );
+}
+
+
+// -----------------------------------------------------------------------------
+// LcfSearchResultsView::callKeyPressed
+// -----------------------------------------------------------------------------
+//
+void LcfSearchResultsView::callKeyPressed()
+{
+ LOGS_QDEBUG( "logs [LCFPROTO] -> LcfSearchResultsView::callKeyPressed()" );
+ HbPushButton* button = (HbPushButton *)sender();
+
+ if ( button->text() == QString("C") ) {
+ mInput.clear();
+ mModel->reset( false );
+ } else {
+ mInput += button->text();
+ mModel->reset( true );
+ }
+ setTitle( mInput );
+ mFinder->predictiveSearchQuery( mInput );
+
+ LOGS_QDEBUG( "logs [LCFPROTO] <- LcfSearchResultsView::callKeyPressed()" );
+}
+
+
+// -----------------------------------------------------------------------------
+// LcfSearchResultsView::closeView
+// -----------------------------------------------------------------------------
+//
+void LcfSearchResultsView::closeView()
+{
+ LOGS_QDEBUG( "logs [LCFPROTO] -> LcfSearchResultsView::closeView()" );
+ qApp->quit();
+ LOGS_QDEBUG( "logs [LCFPROTO] <- LcfSearchResultsView::closeView()" );
+}
+
+
+// -----------------------------------------------------------------------------
+// LcfSearchResultsView::clearSoftKey
+// -----------------------------------------------------------------------------
+//
+void LcfSearchResultsView::clearSoftKey()
+{
+ LOGS_QDEBUG( "logs [LCFPROTO] -> LcfSearchResultsView::clearSoftKey()" );
+ if ( !hbInstance->allMainWindows().isEmpty() ){
+ hbInstance->allMainWindows().at(0)->removeSoftKeyAction(
+ Hb::SecondarySoftKey, mSoftKeyBackAction );
+ }
+ LOGS_QDEBUG( "logs [LCFPROTO] <- LcfSearchResultsView::clearSoftKey()" );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/lcfprotoui/src/main.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* 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 "lcfmainwindow.h"
+#include "logslogger.h"
+#include "lcfsearchresultsview.h"
+//SYSTEM
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <QObject.h>
+
+
+int main(int argc, char *argv[])
+{
+ LOGS_QDEBUG( "logs [LCFPROTO] -> main()" )
+
+ HbApplication app(argc, argv);
+ LcfMainWindow window;
+
+ LOGS_QDEBUG( "logs [LCFPROTO] application created" )
+ LcfSearchResultsView* view = 0;
+ LcfViewLoader loader;
+ LOGS_QDEBUG( "logs [LCFPROTO] about to load view" )
+ bool ok = true;
+ loader.load( ":/xml/lcfSearchResultsView.xml", &ok);
+ LOGS_QDEBUG_2( "logs [LCFPROTO] view loaded=", ok )
+ int err = 0;
+ if ( ok ) {
+ view = qobject_cast<LcfSearchResultsView*> ( loader.findWidget( lcfviewname ) );
+ //LOGS_QDEBUG_2( "logs [LCFPROTO] view =", view );
+
+ LOGS_QDEBUG( "logs [LCFPROTO] about to init view" )
+
+ view->init( loader );
+ LOGS_QDEBUG( "logs [LCFPROTO] init view done" )
+
+ window.addView(view);
+
+ window.show();
+ err = app.exec();
+ }
+
+ LOGS_QDEBUG( "logs [LCFPROTO] <- main()" )
+ return err;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/pt_logscntfinder/inc/pt_logscntfinder.h Tue May 04 12:39:37 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 UT_CNTPREFILTERING_H
+#define UT_CNTPREFILTERING_H
+
+#include <QObject>
+#include <qcontactmanager.h>
+
+QTM_USE_NAMESPACE
+
+class LogsCntFinder;
+
+
+class pt_LogsCntFinder : public QObject
+{
+ Q_OBJECT
+public:
+
+ inline pt_LogsCntFinder( int samples ) : mSamples(samples) {}
+
+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 testPredictiveQuery();
+ void testExtendedQuery();
+ void testDiffHitQuery();
+ void statistics();
+
+private:
+ void createContacts();
+ void createContact_one_Contact(QString& firstname, QString& Lastname, QString phnumber);
+
+ QContactFilter::MatchFlags flag(int f);
+
+private:
+
+ QContactManager *m_manager;
+ LogsCntFinder *m_finder;
+ int mSamples;
+};
+
+
+#endif //UT_CNTSPREFILTERING_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/pt_logscntfinder/pt_logscntfinder.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,52 @@
+#
+# 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 = app
+TARGET =
+
+QT += testlib xml
+CONFIG += qtestlib
+
+#include(../tsrc.pri)
+
+DEFINES += PBK_UNIT_TEST
+DEPENDPATH += .
+INCLUDEPATH += ./
+INCLUDEPATH += ./inc
+INCLUDEPATH += ../inc
+
+#DEPENDPATH += .
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+INCLUDEPATH += ../../
+INCLUDEPATH += ../../inc
+INCLUDEPATH += ../../../inc
+
+# Input
+ HEADERS += inc\pt_logscntfinder.h
+
+ SOURCES += src\pt_logscntfinder.cpp
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xEfa329b3
+ TARGET.CAPABILITY = ALL -TCB
+ TARGET.EPOCALLOWDLLDATA = 1
+ LIBS += \
+ -lxqservice \
+ -lQtContacts \
+ -llogscntfinder
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/pt_logscntfinder/src/pt_logscntfinder.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,466 @@
+/*
+* 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 "pt_LogsCntFinder.h"
+#include "logscntfinder.h"
+
+#include <qtcontacts.h>
+#include <QtTest/QtTest>
+
+
+
+class PtTest
+{
+public:
+
+ PtTest( const QString& name );
+ void execute( LogsCntFinder& engine );
+ void calculateMean();
+ void calculateVariance();
+ void calculateDeviation();
+ void print();
+ static QString statHeader();
+
+public:
+
+ QString mPattern;
+ QList<int> mSamples;
+ float mMean;
+ float mVariance;
+ float mStdDeviation;
+ int mMin;
+ int mMax;
+ int mMinSample;
+ int mMaxSample;
+ int mResults;
+
+};
+
+
+PtTest::PtTest( const QString& name )
+: mPattern(name),
+ mMean(0.0),
+ mVariance(0.0),
+ mStdDeviation(0.0),
+ mMin(0),
+ mMax(0),
+ mMinSample(0),
+ mMaxSample(0),
+ mResults(0)
+{
+
+}
+
+void PtTest::execute( LogsCntFinder& engine )
+{
+ engine.predictiveSearchQuery( QString("") );
+
+ QTime t;
+ t.start();
+ engine.predictiveSearchQuery( mPattern );
+ mSamples.append( t.elapsed());
+ mResults += engine.resultsCount();
+ //mSamples.append( qrand() / 100000000 );
+ //mResults += (100 - mPattern.length() );
+
+}
+
+
+void PtTest::calculateMean()
+{
+ mMin = 0;
+ mMax = 0;
+ mMaxSample = 0;
+ mMinSample = 0;
+ int sum = 0;
+ int samplesCount = mSamples.length();
+ for( int i = 0; i < samplesCount; i++ ) {
+ int sample = mSamples[i];
+ if ( sample > mMax ) {
+ mMax = sample;
+ mMaxSample = i;
+ }
+ if ( i == 0 || sample < mMin ) {
+ mMin = sample;
+ mMinSample = i;
+ }
+ sum += mSamples[i];
+ }
+ mMean = (sum / samplesCount);
+}
+
+
+void PtTest::calculateVariance()
+{
+ int samplesCount = mSamples.length();
+ float sumdev = 0.0;
+
+ for( int i = 0; i < samplesCount; ++i ) {
+ float deviation = mSamples[i] - mMean;
+ sumdev += (deviation * deviation);
+ }
+
+ mVariance = (sumdev / (samplesCount - 1));
+
+}
+
+void PtTest::calculateDeviation()
+{
+ mStdDeviation = sqrt(mVariance);
+}
+
+const int collen = 14;
+
+
+void PtTest::print()
+{
+ int samplesCount = mSamples.length();
+
+ //test results samples mean variance deviation max min
+ qDebug() << mPattern.leftJustified( collen + 3) +
+ QString::number( mResults / samplesCount ).leftJustified( collen ) +
+ QString::number( samplesCount ).leftJustified( collen ) +
+ QString::number( mMean ).leftJustified( collen ) +
+ QString::number( mVariance ).leftJustified( collen ) +
+ QString::number( mStdDeviation ).leftJustified( collen ) +
+ QString::number( mMax ).leftJustified( collen ) +
+ QString::number( mMaxSample ).leftJustified( collen ) +
+ QString::number( mMin ).leftJustified( collen ) +
+ QString::number( mMinSample ).leftJustified( collen );
+}
+
+QString PtTest::statHeader()
+{
+ return QString( "query" ).leftJustified( collen + 3 ) +
+ QString( "results/query" ).leftJustified( collen ) +
+ QString( "samples" ).leftJustified( collen ) +
+ QString( "mean" ).leftJustified( collen ) +
+ QString( "variance" ).leftJustified( collen ) +
+ QString( "deviation" ).leftJustified( collen ) +
+ QString( "max" ).leftJustified( collen ) +
+ QString( "maxSample" ).leftJustified( collen ) +
+ QString( "min" ).leftJustified( collen ) +
+ QString( "minSample" ).leftJustified( collen );
+
+}
+
+void pt_LogsCntFinder::initTestCase()
+{
+}
+
+void pt_LogsCntFinder::cleanupTestCase()
+{
+
+}
+
+
+void pt_LogsCntFinder::init()
+{
+ qDebug() << "pt_LogsCntFinder::init start";
+ m_finder = 0;
+ //open symbian database
+ m_manager = new QContactManager("symbian");
+
+ //qDebug() << "pt_LogsCntFinder::init remove old contacts";
+ // Remove all contacts from the database
+
+ QList<QContactLocalId> cnt_ids = m_manager->contactIds();
+ qDebug() << "contacts now in db" << cnt_ids.count();
+ if ( cnt_ids.count() == 600 ) {
+ QString f("Jack");
+ QString l("Whatever");
+ createContact_one_Contact( f,l, QString("03432"));
+ }
+
+ cnt_ids = m_manager->contactIds();
+ qDebug() << "contacts now " << cnt_ids.count();
+
+
+
+ /*if ( cnt_ids.count() != 600 ) {
+ qDebug() << "contacts now before delete" << cnt_ids.count();
+ m_manager->removeContacts(&cnt_ids);
+ cnt_ids = m_manager->contactIds();
+ qDebug() << "contacts now " << cnt_ids.count();
+
+ QVERIFY(0 == cnt_ids.count());
+
+ //qDebug() << "pt_LogsCntFinder::createContacts";
+ createContacts();
+ //qDebug() << "pt_LogsCntFinder::createContacts DONE";
+ //qDebug() << "contacts now after create" << cnt_ids.count();
+ }*/
+
+
+ m_finder = new LogsCntFinder( *m_manager );
+
+ qDebug() << "pt_LogsCntFinder::init end";
+}
+
+void pt_LogsCntFinder::cleanup()
+{
+ /*m_manager = new QContactManager("symbian");
+ QList<QContactLocalId> cnt_ids = m_manager->contactIds();
+ m_manager->removeContacts(&cnt_ids);
+ cnt_ids = m_manager->contactIds();
+ qDebug() << "contacts now " << cnt_ids.count();
+
+ QVERIFY(0 == cnt_ids.count());*/
+ delete m_manager;
+ m_manager = 0;
+ delete m_finder;
+ m_finder = 0;
+}
+
+
+void pt_LogsCntFinder::createContacts()
+{
+ //qDebug() << "pt_LogsCntFinder::createContacts";
+ QList<QString> firstnamelist;
+ QList<QString> Lastnamelist;
+ firstnamelist<<"Micheal"<<"Evans"<<"Kris"<<"Xiao"<<"Una Vivi"<<"Wilda"<<"Tisha"<<"Queen"<<"Olga"<<"Maria Zola";
+ //Lastnamelist<<"Ribecca"<<"Tina"<<"Bob"<<"George"<<"Anna"<<"Yadira"<<"Lennon"<<"Jones"<<"Augustin Zi"<<"Csoma"<<"Baranik"<<"Harhai";
+ Lastnamelist<<"Ribecca"<<"Tina"<<"Bob"<<"George"<<"Anna"<<"Yadira"<<"Lennon"<<"Jones"<<"Augustin Zi"<<"Csoma";
+
+ //for( int z = 0;z<100;z++) {
+ for( int z = 0;z<5;z++) {
+ for(int i =0; i < firstnamelist.count(); i++) {
+ for(int k =0; k < Lastnamelist.count(); k++) {
+ createContact_one_Contact(firstnamelist[i], Lastnamelist[k], QString("03432"));
+ }
+ }
+ }
+
+ // Empty contact
+ //QContact empty;
+ //m_manager->saveContact(&empty);
+ /*
+ QList<QContactLocalId> cnt_ids = m_manager->contactIds();
+ cnt_ids = m_manager->contactIds();
+ int j = cnt_ids.count();
+ QVERIFY( j == 900 );
+ */
+ //qDebug() << "pt_LogsCntFinder::createContacts DONE";
+
+}
+
+
+void pt_LogsCntFinder::createContact_one_Contact(QString& firstname, QString& Lastname, QString phnumber)
+{
+ //Currenlty we can only fetch firstname,lastname,companyname and sip/email/phone from the databse
+ // so create contact with only these details
+ QContact phonecontact;
+ // Stefann Fedrernn +02644424423 ste.Fed@nokia.com
+ // Contact details
+ QContactName contactName;
+ contactName.setFirstName(firstname);
+ contactName.setLastName(Lastname);
+ phonecontact.saveDetail(&contactName);
+
+ QContactPhoneNumber number;
+ number.setContexts("Home");
+ number.setSubTypes("Mobile");
+ number.setNumber(phnumber);
+ phonecontact.saveDetail(&number);
+
+ //qDebug() << "pt_LogsCntFinder::createContact_one_Contact about to save..";
+
+ m_manager->saveContact(&phonecontact);
+ //qDebug() << "pt_LogsCntFinder::createContact_one_Contact done";
+
+}
+
+
+void pt_LogsCntFinder::testPredictiveQuery()
+{
+ const int rowsInDisplay = 10;
+ qDebug() << "=>pt_LogsCntFinder::testPredictiveQuery";
+
+ QTime t;
+ qDebug() << "--- testing query with 5 ---";
+ t.start();
+ m_finder->predictiveSearchQuery( QString("5") );
+ qDebug() << "--- query ends -----";
+ qDebug(" Time elapsed:%d ms", t.elapsed());
+ qDebug() << " found " << m_finder->resultsCount() << " matches:";
+
+ int results = m_finder->resultsCount();
+
+ qDebug() << "-- list 10 matched records start --";
+ for( int i=0;(i < rowsInDisplay && i < results);i++) {
+ QTime t1;
+ t1.start();
+ const LogsCntEntry& data = m_finder->resultAt( i );
+ //qDebug() << "First Name: ";
+ for (int j = 0; j < data.firstName().length(); j++) {
+ //qDebug() << data.firstName().at(j).text();
+ }
+ //qDebug() << "Last Name: ";
+ for (int k = 0; k < data.lastName().length(); k++) {
+ //qDebug() << data.lastName().at(k).text();
+ }
+ //qDebug() << "Phone number: " << data.phoneNumber().text();
+
+ qDebug() << "fetched one contact";
+ qDebug(" Time elapsed:%d ms", t1.elapsed());
+ }
+ qDebug() << "-- list 10 matched records end --";
+ qDebug(" Time elapsed:%d ms", t.elapsed());
+
+ qDebug() << "<=pt_LogsCntFinder::testPredictiveQuery";
+
+ }
+
+
+
+
+void pt_LogsCntFinder::testExtendedQuery()
+{
+ qDebug() << "=>pt_LogsCntFinder::testExtendedQuery";
+ qDebug() << "<=pt_LogsCntFinder::testPredictiveQuery";
+
+ }
+
+void pt_LogsCntFinder::testDiffHitQuery()
+{
+ qDebug() << "=>pt_LogsCntFinder::testDiffHitQuery";
+
+ QTime t;
+
+ qDebug() << "-- 1 query starts --";
+ t.start();
+ m_finder->predictiveSearchQuery( QString("1") );
+ qDebug() << "-- 1 query ended --";
+ qDebug(" Time elapsed:%d ms", t.elapsed());
+ int results = m_finder->resultsCount();
+ qDebug() << "found " << results << " matches:";
+
+ qDebug() << "-- 2 query starts --";
+ t.start();
+ m_finder->predictiveSearchQuery( QString("2") );
+ qDebug() << "-- 2 query ended --";
+ qDebug(" Time elapsed:%d ms", t.elapsed());
+ results = m_finder->resultsCount();
+ qDebug() << "found " << results << " matches:";
+
+ qDebug() << "-- 3 query starts --";
+ t.start();
+ m_finder->predictiveSearchQuery( QString("3") );
+ qDebug() << "-- 3 query ended --";
+ qDebug(" Time elapsed:%d ms", t.elapsed());
+ results = m_finder->resultsCount();
+ qDebug() << "found " << results << " matches:";
+
+ qDebug() << "-- 6 query starts --";
+ t.start();
+ m_finder->predictiveSearchQuery( QString("6") );
+ qDebug() << "-- 6 query ended --";
+ qDebug(" Time elapsed:%d ms", t.elapsed());
+ results = m_finder->resultsCount();
+ qDebug() << "found " << results << " matches:";
+
+ qDebug() << "-- 7 query starts --";
+ t.start();
+ m_finder->predictiveSearchQuery( QString("7") );
+ qDebug() << "-- 7 query ended --";
+ qDebug(" Time elapsed:%d ms", t.elapsed());
+ results = m_finder->resultsCount();
+ qDebug() << "found " << results << " matches:";
+
+ qDebug() << "<=pt_LogsCntFinder::testDiffHitQuery";
+
+
+}
+
+void pt_LogsCntFinder::statistics()
+{
+ qDebug() << "=> pt_LogsCntFinder::statistics";
+ int results = 0;
+ int queries = 0;
+ int ind = mSamples; //samples
+ QTime t;
+
+ QList<PtTest> tests;
+ tests.append( PtTest("5") );
+ tests.append( PtTest("52") );
+ tests.append( PtTest("522") );
+ tests.append( PtTest("5220") );
+ tests.append( PtTest("522000000000007") );
+ tests.append( PtTest("205") );
+ tests.append( PtTest("34096") );
+ tests.append( PtTest("227264583") );
+ tests.append( PtTest("404") );
+ tests.append( PtTest("4304") );
+ tests.append( PtTest("43043") );
+ tests.append( PtTest("227264583788378") );
+ tests.append( PtTest("00206") );
+ tests.append( PtTest("0705") );
+ tests.append( PtTest("12005") );
+ tests.append( PtTest("227264583") );
+
+ t.start();
+
+ while( ind > 0 ) {
+ for( int j = 0; j < tests.length(); j++ ) {
+ tests[j].execute( *m_finder );
+ queries++;
+ }
+ ind--;
+ }
+
+ int totalTime = t.elapsed();
+
+
+ for( ind = 0; ind < tests.length(); ind++ ) {
+ tests[ind].calculateMean();
+ tests[ind].calculateVariance();
+ tests[ind].calculateDeviation();
+ results += tests[ind].mResults;
+ }
+
+ qDebug("-- Statistics --");
+ qDebug("%d queries executed with %d results in %d ms.",
+ queries, results, totalTime );
+ qDebug() << PtTest::statHeader();
+ for( ind = 0; ind < tests.length(); ind++ ) {
+ tests[ind].print();
+ }
+
+ qDebug() << "<= pt_LogsCntFinder::statistics";
+}
+
+
+//QTEST_MAIN(pt_LogsCntFinder); // on Emulator
+
+int main(int argc, char *argv[]) //on HW
+{
+ int samples = 100;
+ for (int i=0; i<argc; i++) {
+ if (QString(argv[i]) == "-s") {
+ samples = QString(argv[i+1]).toInt();
+ }
+ }
+
+ QApplication app(argc, argv);
+
+ pt_LogsCntFinder pt_logscntfinder( samples );
+ QString resultFileName = "c:/data/others/pt_logscntfinder.txt";
+ QStringList args_logsCntFinder( "pt_logscntfinder");
+ args_logsCntFinder << "-o" << resultFileName;
+ QTest::qExec(&pt_logscntfinder, args_logsCntFinder);
+ return 0;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/st_logscntfinder/inc/st_logscntfinder.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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 ST_LOGSCNTFINDER_H
+#define ST_LOGSCNTFINDER_H
+
+#include <QObject>
+#include <qcontactmanager.h>
+
+QTM_USE_NAMESPACE
+
+class LogsCntFinder;
+
+
+class st_LogsCntFinder : 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 testPredictiveSearchQuery();
+ void testKeymap();
+ void testPredictiveSearchQueryZero();
+ void testPredictiveSearchQueryLimit();
+ void testPredictiveSearchQueryLogs();
+ void testPredictiveSearchQueryLogsContacts();
+ void testQueryOrder();
+
+private:
+
+
+
+ void createOneContact(
+ QString firstname,
+ QString Lastname,
+ QString phnumber);
+ QContactFilter::MatchFlags flag(int f);
+ void createContacts();
+ void createContactsForQueryOrder();
+ void createContactsForQueryZero();
+ void createHistoryEvents();
+ void createLogEvent(
+ QString firstname,
+ QString Lastname,
+ QString phnumber);
+
+private:
+ QContactManager *m_manager;
+ LogsCntFinder *m_finder;
+};
+
+
+#endif // ST_LOGSCNTFINDER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/st_logscntfinder/src/st_logscntfinder.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,571 @@
+/*
+* 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 "st_logscntfinder.h"
+#include "logscntfinder.h"
+#include "testresultxmlparser.h"
+
+#include <qtcontacts.h>
+#include <QtTest/QtTest>
+
+
+void st_LogsCntFinder::initTestCase()
+{
+}
+
+void st_LogsCntFinder::cleanupTestCase()
+{
+
+}
+
+
+void st_LogsCntFinder::init()
+{
+ m_finder = 0;
+ //open symbian database
+ m_manager = new QContactManager("symbian");
+ m_finder = new LogsCntFinder(*m_manager);
+ QVERIFY(m_finder);
+
+ // Remove all contacts from the database
+ QList<QContactLocalId> cnt_ids = m_manager->contactIds();
+ qDebug() << "contacts now before deleting" << cnt_ids.count();
+
+ QVERIFY(m_manager->removeContacts(&cnt_ids, 0));
+ cnt_ids = m_manager->contactIds();
+ QCOMPARE(cnt_ids.count(), 0);
+
+ for (int i = 0; i < 10; ++i) {
+ m_finder->predictiveSearchQuery( QString::number(i) );
+ QCOMPARE( m_finder->resultsCount(), 0 );
+ }
+}
+
+void st_LogsCntFinder::cleanup()
+{
+ delete m_manager;
+ m_manager = 0;
+ delete m_finder;
+ m_finder = 0;
+}
+
+void st_LogsCntFinder::createContacts()
+{
+ /*Create contacts in Contacts DB for keymap testing
+ Stefann Yadira
+ Jonn Ennon
+ Maria-Zola Jones
+ Levis Augustin Zi
+ Nancy Csoma
+ Olga Baraniktestteste
+ Petter Harhai
+ Queen Fesko
+ Rose Galisin
+ Sasha Dofzin
+ Tisha Iatzkovits
+ Wilda Lazar
+ Una Vivi Kantsak
+ */
+ createOneContact( QString("Stefann"), QString("Yadira "), QString("932472398") );
+ createOneContact( QString("Jonn"), QString("Ennon"), QString("932472398") );
+ createOneContact( QString("Maria-Zola"), QString("Jones"), QString("932472398") );
+ createOneContact( QString("Levis"), QString("Augustin Zi"), QString("932472398") );
+ createOneContact( QString("Nancy"), QString("Csoma"), QString("932472398") );
+ createOneContact( QString("Olga"), QString("Baraniktestteste"), QString("932472398") );
+ createOneContact( QString("Petter"), QString("Harhai"), QString("932472398") );
+ createOneContact( QString("Queen"), QString("Fesko"), QString("932472398") );
+ createOneContact( QString("Rose"), QString("Galisin"), QString("932472398") );
+ createOneContact( QString("Sasha"), QString("Dofzin"), QString("932472398") );
+ createOneContact( QString("Tisha"), QString("Iatzkovits"), QString("932472398") );
+ createOneContact( QString("Wilda"), QString("Lazar"), QString("932472398") );
+ createOneContact( QString("Una Vivi"), QString("Kantsak"), QString("932472398") );
+
+ int contactsCount = m_manager->contactIds().count();
+ QCOMPARE(contactsCount, 13);
+ qDebug() << "st_LogsCntFinder::createContacts_testKeymap. created " << contactsCount << " contacts";
+
+
+}
+
+
+void st_LogsCntFinder::createHistoryEvents()
+{
+ createLogEvent( QString("Stefann Albert"), QString("Fedrernn"), QString("932472398") );
+ createLogEvent( QString("Jonn"), QString("Lennon"), QString("932472398") );
+ createLogEvent( QString("Dim-Petter"), QString("Jones"), QString("932472398") );
+
+}
+
+void st_LogsCntFinder::createLogEvent(QString firstname, QString lastname,
+ QString phnumber)
+{
+ LogsCntEntryHandle* dummy = 0;
+
+ LogsCntEntry* logEvent = new LogsCntEntry( *dummy, 0 );
+ logEvent->setFirstName( firstname );
+ logEvent->setLastName( lastname );
+ logEvent->setPhoneNumber( phnumber );
+
+ m_finder->insertEntry(0, logEvent );
+
+
+}
+
+
+void st_LogsCntFinder::createOneContact(QString firstname, QString Lastname,
+ QString phnumber)
+{
+ //Currenlty we can only fetch firstname,lastname,companyname and sip/email/phone from the databse
+ // so create contact with only these details
+ QContact phonecontact;
+ // Stefann Fedrernn +02644424423 ste.Fed@nokia.com
+ // Contact details
+ QContactName contactName;
+ contactName.setFirstName(firstname);
+ contactName.setLastName(Lastname);
+ phonecontact.saveDetail(&contactName);
+
+ QContactPhoneNumber number;
+ number.setContexts("Home");
+ number.setSubTypes("Mobile");
+ number.setNumber(phnumber);
+ phonecontact.saveDetail(&number);
+
+ m_manager->saveContact(&phonecontact);
+ qDebug() << "st_LogsCntFinder::createOneContact done";
+}
+
+
+
+//
+// Tests
+//
+
+// Test basic predictive search, all records with names starting letters "J, K, L" are matched
+void st_LogsCntFinder::testPredictiveSearchQuery()
+{
+ createContacts();
+
+ //There is no recent call in logs UI
+ //case 1
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 5 );
+ //see half of matched results
+ //results == for(int i =0;i<f->resultCount() / 2;i++){f->resultAt(i);}
+ /*QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString("Maria-Zola"));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString("Jones"));
+ QCOMPARE(m_finder->resultAt(1).firstName().at(0).text(), QString("Jonn"));
+ QCOMPARE(m_finder->resultAt(1).lastName().at(0).text(), QString("Ennon"));*/
+
+ m_finder->predictiveSearchQuery( QString("566") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 5 );
+
+ //case 2
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 5 );
+ //see all of the matched results
+ //results == for(int i =0;i<f->resultCount();i++){f->resultAt(i);}
+ /*QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString("Maria-Zola"));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString("Jones"));
+ QCOMPARE(m_finder->resultAt(1).firstName().at(0).text(), QString("Jonn"));
+ QCOMPARE(m_finder->resultAt(1).lastName().at(0).text(), QString("Ennon"));
+ QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString("Una Vivi"));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString("Kantsak"));
+ QCOMPARE(m_finder->resultAt(1).firstName().at(0).text(), QString("Wilda"));
+ QCOMPARE(m_finder->resultAt(1).lastName().at(0).text(), QString("Lazar"));
+ QCOMPARE(m_finder->resultAt(1).firstName().at(0).text(), QString("Levis"));
+ QCOMPARE(m_finder->resultAt(1).lastName().at(0).text(), QString("Augustin Zi"));
+ */
+
+ m_finder->predictiveSearchQuery( QString("566") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 5 );
+
+ //case 3
+ m_finder->predictiveSearchQuery( QString("6") );
+ QCOMPARE( m_finder->resultsCount(), 3 );
+ //see all of matched results
+ //results == for(int i =0;i<f->resultCount();i++){f->resultAt(i);}
+ /*QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString("Maria-Zola"));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString("Jones"));
+ QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString("Nancy"));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString("Csoma"));
+ QCOMPARE(m_finder->resultAt(1).firstName().at(0).text(), QString("Olga"));
+ QCOMPARE(m_finder->resultAt(1).lastName().at(0).text(), QString("Baraniktestteste"));*/
+
+ m_finder->predictiveSearchQuery( QString("69") );
+ QCOMPARE( m_finder->resultsCount(), 0 );
+ m_finder->predictiveSearchQuery( QString("692") );
+ QCOMPARE( m_finder->resultsCount(), 0 );
+ m_finder->predictiveSearchQuery( QString("6") );
+ QCOMPARE( m_finder->resultsCount(), 3 );
+
+ //case 4
+
+ m_finder->predictiveSearchQuery( QString("2") );
+ QCOMPARE( m_finder->resultsCount(), 3 );
+ //see half of matched results
+ //results == for(int i =0;i<f->resultCount() / 2;i++){f->resultAt(i);}
+ /*QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString("Levis"));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString("Augustin Zi"));
+ QCOMPARE(m_finder->resultAt(1).firstName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(1).lastName().at(0).text(), QString(""));*/
+
+ m_finder->predictiveSearchQuery( QString("20") );
+ QCOMPARE( m_finder->resultsCount(), 3 );
+ m_finder->predictiveSearchQuery( QString("209") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ m_finder->predictiveSearchQuery( QString("20") );
+ QCOMPARE( m_finder->resultsCount(), 3 );
+ m_finder->predictiveSearchQuery( QString("2") );
+ QCOMPARE( m_finder->resultsCount(), 3 );
+
+}
+
+/* Test itut keymap predictive search, checking that press key "2", records with names starting letters "A, B, C" are matched;
+Press key "3", records with names starting letters "D,E,F" are matched;
+Press key "4", records with names starting letters "G,H,I" are matched;
+Press key "5", records with names starting letters "J,K,L" are matched;
+Press key "6", records with names starting letters "M,O,N" are matched;
+Press key "7", records with names starting letters "P,Q,R,S" are matched;
+Press key "8", records with names starting letters "T,U,V" are matched;
+Press key "9", records with names starting letters "W,X,Y,Z" are matched;
+Press key "0", records with names starting letters "space" etc. are matched;
+Press key "1", records with names starting letters "-,Ä,Ö" etc. are matched;
+*/
+void st_LogsCntFinder::testKeymap()
+{
+ createContacts();
+ const LogsCntEntry* data;
+
+ for (int i = 2; i < 10; i++)
+ {
+ m_finder->predictiveSearchQuery( QString::number(i) );
+ switch( i )
+ {
+ case 2:
+ QCOMPARE( m_finder->resultsCount(), 3 );
+ data = &m_finder->resultAt( 0 );
+ QCOMPARE( data->firstName().count(), 1 );
+ break;
+
+ case 3:
+ QCOMPARE( m_finder->resultsCount(), 3 );
+ data = &m_finder->resultAt( 0 );
+ QCOMPARE( data->firstName().count(), 1 );
+ break;
+
+ case 4:
+ QCOMPARE( m_finder->resultsCount(), 3 );
+ data = &m_finder->resultAt( 0 );
+ QCOMPARE( data->firstName().count(), 1 );
+ break;
+
+ case 5:
+ QCOMPARE( m_finder->resultsCount(), 5 );
+ data = &m_finder->resultAt( 0 );
+ QCOMPARE( data->firstName().count(), 1 );
+ break;
+
+ case 6:
+ QCOMPARE( m_finder->resultsCount(), 3 );
+ data = &m_finder->resultAt( 0 );
+ QCOMPARE( data->firstName().count(), 1 );
+ break;
+
+ case 7:
+ QCOMPARE( m_finder->resultsCount(), 5 );
+ data = &m_finder->resultAt( 0 );
+ QCOMPARE( data->firstName().count(),1 );
+ break;
+
+ case 8:
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ data = &m_finder->resultAt( 0 );
+ QCOMPARE( data->firstName().count(), 1 );
+ break;
+
+ case 9:
+ QCOMPARE( m_finder->resultsCount(), 3 );
+ data = &m_finder->resultAt( 0 );
+ QCOMPARE( data->firstName().count(), 1 );
+ break;
+ }
+ }
+}
+
+/* Test zero query search: 1. zero between "1-9" numbers, then first zero works as "AND" statement;
+2. (multiple) zero at beginning; 3. (multiple) zero at the end;
+4-5. multi-zeros between "1-9" numbers, only the first works as "AND" statement;
+6. Query limit is 15, the 16th is ignored, and first 0 works as "AND" statement */
+
+void st_LogsCntFinder::testPredictiveSearchQueryZero()
+{
+ createContactsForQueryZero();
+
+ m_finder->predictiveSearchQuery( QString("56603") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+
+ m_finder->predictiveSearchQuery( QString("00202") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+
+ m_finder->predictiveSearchQuery( QString("02010") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+
+ m_finder->predictiveSearchQuery( QString("2003") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+
+ m_finder->predictiveSearchQuery( QString("200904") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+
+ m_finder->predictiveSearchQuery( QString("2272645837883065") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+
+}
+
+void st_LogsCntFinder::createContactsForQueryZero()
+{
+ createContacts();
+ createOneContact( QString("Dlice 00202"), QString("Qwerty"), QString("45789348") );
+ createOneContact( QString("#Paula 2003"), QString("Augustin Ci"), QString("78945617") );
+ createOneContact( QString("Paula 02010"), QString("Ezerty Adam"), QString("78945617") );
+ createOneContact( QString("Ced"), QString("Y,g"), QString("78945617") );
+ createOneContact( QString("Jari-Pekka"), QString("Baraniktestteste"), QString("78945617") );
+
+ int contactsCount = m_manager->contactIds().count();
+ QCOMPARE(contactsCount, 18);
+}
+
+// Test query limit is 15, the 16th digit is ignored
+void st_LogsCntFinder::testPredictiveSearchQueryLimit()
+{
+ createContacts();
+
+ // 9 digits
+ m_finder->predictiveSearchQuery( QString("227264583") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ // 10 digits
+ m_finder->predictiveSearchQuery( QString("2272645837") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ // 11 digits
+ m_finder->predictiveSearchQuery( QString("22726458378") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ // 12 digits
+ m_finder->predictiveSearchQuery( QString("227264583788") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ // 13 digits
+ m_finder->predictiveSearchQuery( QString("2272645837883") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ // 14 digits
+ m_finder->predictiveSearchQuery( QString("22726458378837") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ // 15 digits
+ m_finder->predictiveSearchQuery( QString("227264583788378") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+
+ // 16 digits
+ m_finder->predictiveSearchQuery( QString("2272645837883783") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString("Olga"));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString("Baraniktestteste"));
+}
+
+//There is recent call in logs, no contacts DB
+void st_LogsCntFinder::testPredictiveSearchQueryLogs()
+{
+ createHistoryEvents();
+
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+
+ //case 1
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ //see half of matched results
+ //results == for(int i =0;i<f->resultCount() / 2;i++){f->resultAt(i);}
+ /*QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(1).firstName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(1).lastName().at(0).text(), QString(""));*/
+
+ m_finder->predictiveSearchQuery( QString("533") );
+ QCOMPARE( m_finder->resultsCount(), 0 );
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+
+ //case 2
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ //see half of matched results
+ //results == for(int i =0;i<f->resultCount() / 2;i++){f->resultAt(i);}
+ /*QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(1).firstName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(1).lastName().at(0).text(), QString(""));*/
+
+ m_finder->predictiveSearchQuery( QString("50") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ m_finder->predictiveSearchQuery( QString("503") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ m_finder->predictiveSearchQuery( QString("50") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+
+}
+
+//There is recent call in logs, and contacts DB
+void st_LogsCntFinder::testPredictiveSearchQueryLogsContacts()
+{
+ createHistoryEvents();
+ createContacts();
+
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+
+ //case 1
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ //see half of matched results
+ //results == for(int i =0;i<f->resultCount() / 2;i++){f->resultAt(i);}
+ /*QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(1).firstName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(1).lastName().at(0).text(), QString(""));*/
+
+ m_finder->predictiveSearchQuery( QString("533") );
+ QCOMPARE( m_finder->resultsCount(), 0 );
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+
+ //case 2
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ //see half of matched results
+ //results == for(int i =0;i<f->resultCount() / 2;i++){f->resultAt(i);}
+ /*QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(1).firstName().at(0).text(), QString(""));
+ QCOMPARE(m_finder->resultAt(1).lastName().at(0).text(), QString(""));*/
+
+ m_finder->predictiveSearchQuery( QString("50") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ m_finder->predictiveSearchQuery( QString("503") );
+ QCOMPARE( m_finder->resultsCount(), 1 );
+ m_finder->predictiveSearchQuery( QString("50") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+ m_finder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( m_finder->resultsCount(), 2 );
+
+}
+
+void st_LogsCntFinder::testQueryOrder()
+{
+ createContactsForQueryOrder();
+
+ m_finder->predictiveSearchQuery( QString("7") );
+ QCOMPARE( m_finder->resultsCount(), 8 );
+
+ QCOMPARE(m_finder->resultAt(0).firstName().at(0).text(), QString("Anna"));
+ QCOMPARE(m_finder->resultAt(0).lastName().at(0).text(), QString("Qwerty"));
+
+ QCOMPARE(m_finder->resultAt(1).firstName().at(0).text(), QString("Paula"));
+ QCOMPARE(m_finder->resultAt(1).lastName().at(0).text(), QString("Azerty"));
+
+ QCOMPARE(m_finder->resultAt(2).firstName().at(0).text(), QString("Paula"));
+ QCOMPARE(m_finder->resultAt(2).lastName().at(0).text(), QString("Qwerty"));
+
+ QCOMPARE(m_finder->resultAt(3).firstName().at(0).text(), QString("Petter"));
+ QCOMPARE(m_finder->resultAt(3).lastName().at(0).text(), QString("Harhai"));
+
+ QCOMPARE(m_finder->resultAt(4).firstName().at(0).text(), QString("Queen"));
+ QCOMPARE(m_finder->resultAt(4).lastName().at(0).text(), QString("Fesko"));
+
+ QCOMPARE(m_finder->resultAt(5).firstName().at(0).text(), QString("Rose"));
+ QCOMPARE(m_finder->resultAt(5).lastName().at(0).text(), QString("Galisin"));
+
+ QCOMPARE(m_finder->resultAt(6).firstName().at(0).text(), QString("Sasha"));
+ QCOMPARE(m_finder->resultAt(6).lastName().at(0).text(), QString("Dofzin"));
+
+ QCOMPARE(m_finder->resultAt(7).firstName().at(0).text(), QString("Stefann"));
+ QCOMPARE(m_finder->resultAt(7).lastName().at(0).text(), QString("Yadira"));
+}
+
+void st_LogsCntFinder::createContactsForQueryOrder()
+{
+ createContacts();
+ createOneContact( QString("Anna"), QString("Qwerty"), QString("45789348") );
+ createOneContact( QString("Paula"), QString("Qwerty"), QString("78945617") );
+ createOneContact( QString("Paula"), QString("Azerty"), QString("78945617") );
+
+ int contactsCount = m_manager->contactIds().count();
+ QCOMPARE(contactsCount, 16);
+}
+
+//QTEST_MAIN(st_LogsCntFinder);
+
+/*int main(int argc, char *argv[])
+{
+ bool promptOnExit(true);
+ bool xmlOutput(false);
+
+ for (int i=0; i<argc; i++) {
+ if (QString(argv[i]) == "-noprompt") {
+ promptOnExit = false;
+ }
+ if (QString(argv[i]) == "-xml") {
+ xmlOutput = true;
+ }
+ }
+ printf("Running tests...\n");
+
+ QApplication app(argc, argv);
+ st_LogsCntFinder st_logscntfinder;
+ QString resultFileName = "c:/data/others/st_LogsCntFinder";
+ resultFileName.append(xmlOutput ? ".xml" : ".txt");
+ QStringList args_logsCntFinder("st_logscntfinder");
+ if (xmlOutput)
+ args_logsCntFinder.append("-xml");
+ args_logsCntFinder << "-v1" << "-o" << resultFileName;
+ QTest::qExec(&st_logscntfinder, args_logsCntFinder);
+
+ if (xmlOutput) {
+ TestResultXmlParser parser;
+ parser.parseAndPrintResults(resultFileName);
+ }
+
+ if (promptOnExit) {
+ printf("Press any key...\n");
+ getchar();
+ }
+
+ return 0;
+}*/
+
+int main(int argc, char *argv[]) //on HW
+{
+ QApplication app(argc, argv);
+
+ st_LogsCntFinder st_logscntfinder;
+ QString resultFileName = "c:/data/others/st_logscntfinder.txt";
+ QStringList args_logsCntFinder( "st_logscntfinder");
+ args_logsCntFinder << "-o" << resultFileName;
+ QTest::qExec(&st_logscntfinder, args_logsCntFinder);
+ return 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/st_logscntfinder/st_logscntfinder.pro Tue May 04 12:39:37 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:
+#
+#
+
+TEMPLATE = app
+TARGET =
+
+QT += testlib xml
+CONFIG += qtestlib
+
+#include(../tsrc.pri)
+
+DEFINES += PBK_UNIT_TEST
+DEPENDPATH += .
+INCLUDEPATH += ./
+INCLUDEPATH += ./inc
+INCLUDEPATH += ../inc
+
+#DEPENDPATH += .
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+INCLUDEPATH += ../../
+INCLUDEPATH += ../../inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../../tsrc/qtestutils/inc
+
+# Input
+HEADERS += inc\st_logscntfinder.h
+
+SOURCES += src\st_logscntfinder.cpp
+SOURCES += ../../../tsrc/qtestutils/src/testresultxmlparser.cpp
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xEfa329b3
+ TARGET.CAPABILITY = ALL -TCB
+ TARGET.EPOCALLOWDLLDATA = 1
+ LIBS += \
+ -lxqservice \
+ -lQtContacts \
+ -llogscntfinder
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/stubs/qtcontacts_stubs.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,307 @@
+/*
+* 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 <QContactManager.h>
+#include <QContactDetailFilter.h>
+#include <QContactPhoneNumber.h>
+#include <QSharedDataPointer>
+#include <QContactName.h>
+#include <QContactDetail.h>
+
+#include <QSharedData>
+#include <QContactAvatar.h>
+
+#include "qtcontacts_stubs.h"
+
+ContactQueryResults* ContactQueryResults::mInstance = 0;
+
+// -----------------------------------------------------------------------------
+// ContactsDB::instance()
+// -----------------------------------------------------------------------------
+//
+ContactQueryResults* ContactQueryResults::instance()
+{
+ if ( !mInstance ) {
+ mInstance = new ContactQueryResults();
+ }
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// ContactsDB::deleteInstance()
+// -----------------------------------------------------------------------------
+//
+void ContactQueryResults::deleteInstance()
+{
+ delete mInstance;
+ mInstance = 0;
+}
+
+// -----------------------------------------------------------------------------
+// ContactsDB::~ContactQueryResults()
+// -----------------------------------------------------------------------------
+//
+ContactQueryResults::~ContactQueryResults()
+{
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+// ContactsDB::set()
+// -----------------------------------------------------------------------------
+//
+void ContactQueryResults::set( int count, QString fn, QString ln )
+{
+ reset();
+ for( int i=0;i<count;i++ ) {
+ mDB.append( fn + QString::number( i + 1 ) );
+ mDB.append( ln + QString::number( i + 1 ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// ContactsDB::reset()
+// -----------------------------------------------------------------------------
+//
+void ContactQueryResults::reset()
+{
+ mDB.clear();
+}
+
+
+// -----------------------------------------------------------------------------
+// ContactsDB::firstNameAt()
+// -----------------------------------------------------------------------------
+//
+const QString& ContactQueryResults::firstNameAt( int index ) const
+{
+ return mDB[ index ];
+}
+
+// -----------------------------------------------------------------------------
+// ContactsDB::lastNameAt()
+// -----------------------------------------------------------------------------
+//
+const QString& ContactQueryResults::lastNameAt( int index ) const
+{
+ return mDB[ index + 1 ];
+}
+
+// -----------------------------------------------------------------------------
+// ContactsDB::contacts()
+// -----------------------------------------------------------------------------
+//
+int ContactQueryResults::contacts() const
+{
+ return (mDB.length() ? mDB.length() / 2 : 0);
+}
+
+
+QTM_USE_NAMESPACE
+
+class QtMobility::QContactData : public QSharedData
+{
+public:
+ QContactData(): QSharedData()
+ {
+ }
+
+ ~QContactData() {}
+
+ QContactId m_id;
+
+};
+
+class QtMobility::QContactDetailPrivate : public QSharedData
+{
+public:
+ QContactDetailPrivate(): QSharedData()
+ {
+ }
+
+ ~QContactDetailPrivate() {}
+};
+
+// ----------------------------------------------------------------------------
+// QContactManager
+// ----------------------------------------------------------------------------
+//
+QContactManager::QContactManager(
+ const QString& /*managerName*/, const QMap<QString, QString>& /*parameters*/,
+ QObject* /*parent*/)
+{
+
+}
+
+QContactManager::~QContactManager()
+{
+
+}
+
+
+QList<QContactLocalId> QContactManager::contactIds(
+ const QContactFilter& filter,
+ const QList<QContactSortOrder>& /*sortOrders*/) const
+{
+ const QContactDetailFilter& df =
+ static_cast<const QContactDetailFilter&>( filter );
+
+ QList<QContactLocalId> list;
+ ContactQueryResults* resultSet = ContactQueryResults::instance();
+
+ for( int i=0;i<resultSet->contacts();i++) {
+ list.append( i + 1 );
+ }
+ resultSet->allResultsAdded();
+
+ return list;
+}
+
+QContact QContactManager::contact(
+ const QContactLocalId& contactId,
+ const QStringList& definitionRestrictions ) const
+{
+ QContact contact;
+ QContactId id;
+ id.setLocalId(contactId );
+
+ contact.setId( id );
+ return contact;
+}
+
+// ----------------------------------------------------------------------------
+// QContactDetailFilter
+// ----------------------------------------------------------------------------
+//
+QContactDetailFilter::QContactDetailFilter()
+{
+
+}
+
+void QContactDetailFilter::setDetailDefinitionName(
+ const QString& /*definition*/, const QString& /*fieldName*/)
+{
+
+}
+
+
+void QContactDetailFilter::setMatchFlags(QContactFilter::MatchFlags /*flags*/)
+{
+
+}
+void QContactDetailFilter::setValue(const QVariant& /*value*/)
+{
+}
+
+QVariant QContactDetailFilter::value() const
+{
+ return QVariant();
+}
+
+
+// ----------------------------------------------------------------------------
+// QContact
+// ----------------------------------------------------------------------------
+//
+QContact::QContact() : d(new QContactData)
+{
+
+}
+
+QContact::~QContact()
+{
+
+}
+
+
+QContact& QContact::operator=(const QContact& other)
+{
+
+}
+
+QContactDetail QContact::detail(const QString& definitionId) const
+{
+ ContactQueryResults* results = ContactQueryResults::instance();
+
+ if ( definitionId == QContactName::DefinitionName ){
+ QContactName name;
+ QContactLocalId id = localId();
+ name.setValue(QContactName::FieldFirst, results->firstNameAt( (int) id-1 ) );
+ name.setValue(QContactName::FieldLast, results->lastNameAt( (int) id-1 ) );
+ return name;
+ }
+ if ( definitionId == QContactPhoneNumber::DefinitionName ){
+ QContactPhoneNumber number;
+ QString n( "555789987" );
+ number.setValue(QContactPhoneNumber::FieldNumber, n );
+ return number;
+ }
+ if ( definitionId == QContactAvatar::DefinitionName){
+ QContactAvatar avatar;
+ avatar.setSubType(QContactAvatar::SubTypeImage);
+ avatar.setAvatar("c:\\data\\images\\logstest1.jpg");
+ QString a( "Avatar" );
+ avatar.setValue( QContactAvatar::FieldAvatar, a );
+ return avatar;
+ }
+ QContactDetail detail;
+ return detail;
+}
+
+
+// ----------------------------------------------------------------------------
+// QContactDetail
+// ----------------------------------------------------------------------------
+//
+QContactDetail::QContactDetail()
+{
+
+}
+QContactDetail::QContactDetail(const QString& definitionName) : d(new QContactDetailPrivate)
+{
+
+}
+QContactDetail::~QContactDetail()
+{
+
+}
+
+
+QContactDetail& QContactDetail::operator=(const QContactDetail& other)
+{
+
+}
+
+QString QContactDetail::definitionName() const
+{
+ return QString("");
+}
+
+bool QContactDetail::isEmpty() const
+{
+ return false;
+}
+
+
+QVariant QContactDetail::variantValue(const QString& key) const
+{
+ QString val = value(key);
+ return val;
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/stubs/qtcontacts_stubs.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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 QTCONTACTSDB_H
+#define QTCONTACTSDB_H
+
+#include <QObject>
+#include <QStringList>
+
+class ContactQueryResults : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ static ContactQueryResults* instance();
+ static void deleteInstance();
+
+ ~ContactQueryResults();
+
+ void set( int count, QString fn = QString("John"),
+ QString ln = QString("Malkovich") );
+ void reset();
+ const QString& firstNameAt( int index ) const;
+ const QString& lastNameAt( int index ) const;
+ int contacts() const;
+ inline void allResultsAdded() {emit resultsAdded();}
+
+signals:
+
+ void resultsAdded();
+
+private:
+
+ inline explicit ContactQueryResults() {}
+
+
+private:
+
+ static ContactQueryResults* mInstance;
+ QStringList mDB;
+
+
+};
+
+#endif //QTCONTACTSDB_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logscntentry.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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_LOGSCNTENTRY_H
+#define UT_LOGSCNTENTRY_H
+
+#include <QObject>
+
+class LogsCntEntry;
+
+class UT_LogsCntEntry : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testSetName();
+ void testSetHighlights();
+ void testSetAvatarPath();
+ void testRichText();
+ void testSetPhoneNumber();
+ void testSetSpeedDial();
+ void testMatch();
+
+
+private:
+
+ LogsCntEntry* mEntry;
+};
+
+
+#endif //UT_LOGSCNTENTRY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logscntfinder.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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_LOGSCNTFINDER_H
+#define UT_LOGSCNTFINDER_H
+
+#include <QObject>
+
+class LogsCntFinder;
+class ContactQueryResults;
+
+class UT_LogsCntFinder : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testPredictiveSearchQuery();
+ void testResultAt();
+ void testInsertEntry();
+ void testDeleteEntry();
+ void testGetEntry();
+
+private:
+
+ LogsCntFinder* mFinder;
+ ContactQueryResults* mCntResults;
+
+};
+
+
+#endif //UT_LOGSCNTFINDER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logspredictivetranslator.h Tue May 04 12:39:37 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_LOGSPREDICTIVETRANSLATOR_H
+#define UT_LOGSPREDICTIVETRANSLATOR_H
+
+#include <QObject>
+
+class LogsPredictiveTranslator;
+
+class UT_LogsPredictiveTranslator : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testTranslate();
+ void testTranslateChar();
+ void testStartsWith();
+
+private:
+
+ LogsPredictiveTranslator* mTranslator;
+};
+
+
+#endif //UT_LOGSPREDICTIVETRANSLATOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/main.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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 <QtTest/QtTest>
+
+#include "ut_logscntfinder.h"
+#include "ut_logspredictivetranslator.h"
+#include "ut_logscntentry.h"
+
+#include "testresultxmlparser.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 = 0;
+ if ( useQApplication )
+ app = new QApplication(argc, argv);
+
+ TestResultXmlParser parser;
+
+ UT_LogsCntFinder ut_logsCntFinder;
+ QString resultFileName = "c:/ut_logs_logsCntFinder.xml";
+ QStringList args_logsCntFinder( "ut_logsCntFinder");
+ args_logsCntFinder << "-xml" << "-o" << resultFileName;
+ QTest::qExec(&ut_logsCntFinder, args_logsCntFinder);
+ parser.parseAndPrintResults(resultFileName,true);
+
+ UT_LogsPredictiveTranslator ut_logsPredictiveTranslator;
+ resultFileName = "c:/ut_logs_logsPredictiveTranslator.xml";
+ QStringList args_logsCntFinder1( "ut_LogsPredictiveTranslator" );
+ args_logsCntFinder1 << "-xml" << "-o" << resultFileName;
+ QTest::qExec(&ut_logsPredictiveTranslator, args_logsCntFinder1);
+ parser.parseAndPrintResults(resultFileName,true);
+
+ UT_LogsCntEntry ut_logscntentry;
+ resultFileName = "c:/ut_logs_logscntentry.xml";
+ QStringList args_logsCntFinder2( "ut_logscntentry" );
+ args_logsCntFinder2 << "-xml" << "-o" << resultFileName;
+ QTest::qExec(&ut_logscntentry, args_logsCntFinder2);
+ parser.parseAndPrintResults(resultFileName,true);
+
+ if (promptOnExit) {
+ printf("Press any key...\n");
+ getchar();
+ }
+ delete app;
+ return 0;
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logscntentry.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,487 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logscntentry.h"
+#include "logscntfinder.h"
+#include "logspredictivetranslator.h"
+
+#include <QtTest/QtTest>
+
+
+void UT_LogsCntEntry::initTestCase()
+{
+}
+
+void UT_LogsCntEntry::cleanupTestCase()
+{
+}
+
+
+void UT_LogsCntEntry::init()
+{
+ mEntry = new LogsCntEntry( 0 );
+}
+
+void UT_LogsCntEntry::cleanup()
+{
+ delete mEntry;
+ mEntry = 0;
+ LogsPredictiveTranslator::deleteInstance();
+}
+
+void UT_LogsCntEntry::testConstructor()
+{
+ QVERIFY( !mEntry->isCached() );
+ QVERIFY( mEntry->contactId() == 0 );
+ QVERIFY( mEntry->type() == LogsCntEntry::EntryTypeContact );
+ QVERIFY( mEntry->firstName()[0].text() == QString("") );
+ QVERIFY( mEntry->lastName()[0].text() == QString("") );
+ QVERIFY( mEntry->phoneNumber().text() == QString("") );
+ QVERIFY( mEntry->avatarPath() == QString("") );
+ QVERIFY( mEntry->handle() == 0 );
+ QVERIFY( mEntry->speedDial() == QString("") );
+
+
+ mEntry->setFirstName( QString( "foo" ));
+ mEntry->setLastName( QString( "bar" ));
+
+ LogsCntEntry* e = new LogsCntEntry( *mEntry );
+ QVERIFY( e->isCached() );
+ QVERIFY( e->contactId() == mEntry->contactId() );
+ QVERIFY( e->type() == mEntry->type() );
+ QVERIFY( e->firstName()[0].text() == mEntry->firstName()[0].text() );
+ QVERIFY( e->lastName()[0].text() == mEntry->lastName()[0].text() );
+ QVERIFY( e->phoneNumber().text() == mEntry->phoneNumber().text() );
+ QVERIFY( e->mHandle == mEntry->mHandle );
+ QVERIFY( e->speedDial() == mEntry->speedDial() );
+
+ mEntry->setFirstName( QString( "Nokia" ));
+ QVERIFY( e->firstName()[0].text() != mEntry->firstName()[0].text() );
+
+ delete e;
+ e = 0;
+
+ LogsCntEntryHandle* foo = (LogsCntEntryHandle*)1;
+ e = new LogsCntEntry( *foo, 0 );
+ QVERIFY( e->isCached() );
+ QVERIFY( e->contactId() == 0 );
+ QVERIFY( e->type() == LogsCntEntry::EntryTypeHistory );
+ QVERIFY( e->mHandle == foo );
+
+ delete e;
+ e = 0;
+
+}
+
+
+void UT_LogsCntEntry::testSetName()
+{
+ QString empty("");
+
+ QVERIFY( !mEntry->isCached() );
+ QVERIFY( mEntry->type() == LogsCntEntry::EntryTypeContact );
+
+ mEntry->setFirstName( QString( "first" ) );
+ QVERIFY( mEntry->firstName()[0].text() == QString( "first" ) );
+ QVERIFY( !mEntry->firstName()[0].highlights());
+ QVERIFY( mEntry->firstName()[0].mTranslatedText != empty );
+
+ mEntry->setLastName( QString( "last" ) );
+ QVERIFY( mEntry->lastName()[0].text() == QString( "last" ) );
+ QVERIFY( !mEntry->lastName()[0].highlights());
+ QVERIFY( mEntry->lastName()[0].mTranslatedText != empty );
+
+ mEntry->mType = LogsCntEntry::EntryTypeHistory;
+ mEntry->setFirstName( QString( "first1" ) );
+ QVERIFY( mEntry->firstName()[0].text() == QString( "first1" ) );
+ QVERIFY( !mEntry->firstName()[0].highlights());
+ QVERIFY( mEntry->firstName()[0].mTranslatedText != empty );
+
+ mEntry->setLastName( QString( "last1" ) );
+ QVERIFY( mEntry->lastName()[0].text() == QString( "last1" ) );
+ QVERIFY( !mEntry->lastName()[0].highlights());
+ QVERIFY( mEntry->lastName()[0].mTranslatedText != empty );
+
+ mEntry->setFirstName( QString( "first last" ) );
+ QVERIFY( mEntry->firstName().count() == 2 );
+ QVERIFY( mEntry->firstName()[0].text() == QString( "first" ) );
+ QVERIFY( mEntry->firstName()[1].text() == QString( "last" ) );
+ QVERIFY( !mEntry->firstName()[0].highlights() );
+ QVERIFY( !mEntry->firstName()[1].highlights() );
+ QVERIFY( mEntry->firstName()[0].mTranslatedText != empty );
+ QVERIFY( mEntry->firstName()[1].mTranslatedText != empty );
+
+ mEntry->setFirstName( QString( "" ) );
+ QVERIFY( mEntry->firstName()[0].text() == QString("") );
+
+}
+
+void UT_LogsCntEntry::testSetHighlights()
+{
+
+ mEntry->setHighlights( QString( "665" ) );
+ QVERIFY( mEntry->firstName()[0].text() == QString("") );
+ QVERIFY( mEntry->lastName()[0].text() == QString("") );
+
+ mEntry->setFirstName( QString( "Nokia" ) );
+ mEntry->setLastName( QString( "Test" ) );
+
+ mEntry->setHighlights( QString( "665" ) );
+ QVERIFY( mEntry->firstName()[0].text() == QString( "Nokia" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 3 );
+ QVERIFY( mEntry->lastName()[0].text() == QString( "Test" ) );
+ QVERIFY( !mEntry->lastName()[0].highlights());
+
+ mEntry->mType = LogsCntEntry::EntryTypeContact;
+ mEntry->setFirstName( QString( "Jim" ) );
+ mEntry->setLastName( QString( "Johnson" ) );
+
+ mEntry->setHighlights( QString( "5" ) );
+ QVERIFY( mEntry->firstName()[0].text() == QString( "Jim" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1 );
+ QVERIFY( mEntry->lastName()[0].text() == QString( "Johnson" ) );
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);
+
+ mEntry->setFirstName( QString( "Big Jim" ) );
+ mEntry->setLastName( QString( "Johnson" ) );
+
+ mEntry->setHighlights( QString( "5" ) );
+ QVERIFY( mEntry->firstName()[0].text() == QString( "Big" ) );
+ QVERIFY( mEntry->firstName()[1].text() == QString( "Jim" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0 );
+ QVERIFY( mEntry->firstName()[1].highlights() == 1 );
+ QVERIFY( mEntry->lastName()[0].text() == QString( "Johnson" ) );
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);
+
+ mEntry->setFirstName( QString( "John" ) );
+ mEntry->setLastName( QString( "Johnson" ) );
+ mEntry->setHighlights( QString( "5646" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 4 );
+ QVERIFY( mEntry->lastName()[0].highlights() == 4);
+
+ mEntry->setHighlights( QString( "56467" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0 );
+ QVERIFY( mEntry->lastName()[0].highlights() == 5);
+
+ mEntry->setHighlights( QString( "505" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);
+
+ mEntry->setHighlights( QString( "506" ) );//entry is not a match
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);//506 means 5 or 6 in higlighting
+
+ mEntry->setFirstName( QString( "Big Jim Johnson" ) );
+ mEntry->setLastName( QString( "" ) );
+
+ mEntry->setHighlights( QString( "205" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 1);
+ QVERIFY( mEntry->firstName()[2].highlights() == 1);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( QString( "20505" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 1);
+ QVERIFY( mEntry->firstName()[2].highlights() == 1);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( QString( "50205" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 1);
+ QVERIFY( mEntry->firstName()[2].highlights() == 1);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( QString( "50502" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 1);
+ QVERIFY( mEntry->firstName()[2].highlights() == 1);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setFirstName( QString( "Big John" ) );
+ mEntry->setLastName( QString( "Johnson" ) );
+
+ mEntry->setHighlights( QString( "2056" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 2);
+
+ mEntry->setHighlights( QString( "5602" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 2);
+
+ mEntry->setHighlights( QString( "564602" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 4);
+ QVERIFY( mEntry->lastName()[0].highlights() == 4);
+
+ mEntry->setHighlights( QString( "5646702" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 5);
+
+ mEntry->setHighlights( QString( "5646" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 4);
+ QVERIFY( mEntry->lastName()[0].highlights() == 4);
+
+ mEntry->setHighlights( QString( "50" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 1);
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);
+
+ mEntry->setHighlights( QString( "05" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 1);
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);
+
+ mEntry->setFirstName( QString( "John 0John" ) );
+ mEntry->setLastName( QString( "Malkovich" ) );
+ mEntry->setHighlights( QString( "05" ) );
+
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( QString( "0506" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);
+
+ mEntry->setHighlights( QString( "506" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);
+
+ mEntry->setHighlights( QString( "5060" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( QString( "05060" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( QString( "050506" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 1);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);
+
+ mEntry->setPhoneNumber( QString( "+1234567" ) );
+ QVERIFY( mEntry->phoneNumber().text() == QString( "+1234567" ) );
+ mEntry->setHighlights( QString( "+12" ) );
+ QVERIFY( mEntry->phoneNumber().mHighlights == 3 );
+
+ mEntry->setPhoneNumber( QString( "1234567" ) );
+ QVERIFY( mEntry->phoneNumber().text() == QString( "1234567" ) );
+ mEntry->setHighlights( QString( "+12" ) );
+ QVERIFY( mEntry->phoneNumber().mHighlights == 0 );
+
+ mEntry->setHighlights( QString( "12" ) );
+ QVERIFY( mEntry->phoneNumber().mHighlights == 2 );
+
+ mEntry->setFirstName( QString( "Alice 028 Ming" ) );
+ mEntry->setHighlights( QString( "028" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 3);
+ QVERIFY( mEntry->firstName()[2].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+}
+
+void UT_LogsCntEntry::testSetPhoneNumber()
+{
+ mEntry->setPhoneNumber( QString( "1234567" ) );
+ QVERIFY( mEntry->phoneNumber().text() == QString( "1234567" ) );
+ QVERIFY( mEntry->phoneNumber().mTranslatedText == QString( "" ) );
+ QVERIFY( mEntry->phoneNumber().mHighlights == 0 );
+
+ mEntry->setPhoneNumber( QString( "+1234567" ) );
+ QVERIFY( mEntry->phoneNumber().text() == QString( "+1234567" ) );
+
+ mEntry->setPhoneNumber( QString( "#1234567" ) );
+ QVERIFY( mEntry->phoneNumber().text() == QString( "#1234567" ) );
+
+ mEntry->setPhoneNumber( QString( "*1234567" ) );
+ QVERIFY( mEntry->phoneNumber().text() == QString( "*1234567" ) );
+
+ mEntry->setPhoneNumber( QString( "*12+345#67" ) );
+ QVERIFY( mEntry->phoneNumber().text() == QString( "*12+345#67" ) );
+
+}
+
+void UT_LogsCntEntry::testSetSpeedDial()
+{
+ mEntry->setSpeedDial( QString( "1" ) );
+ QVERIFY( mEntry->speedDial() == QString( "1" ) );
+
+}
+
+void UT_LogsCntEntry::testSetAvatarPath()
+{
+ mEntry->setAvatarPath( QString( "c:\\data\\images\\logstest1.jpg" ) );
+ QVERIFY( mEntry->avatarPath() == QString( "c:\\data\\images\\logstest1.jpg" ) );
+
+}
+
+void UT_LogsCntEntry::testRichText()
+{
+
+ mEntry->setFirstName( QString( "John" ) );
+ mEntry->setHighlights( QString( "5" ) );
+ QVERIFY( mEntry->firstName()[0].richText() == QString( "<b><u>J</u></b>ohn" ) );
+ QVERIFY( mEntry->firstName()[0].richText( QString("<u>"),QString("</u>") )
+ == QString( "<u>J</u>ohn" ) );
+
+ mEntry->setFirstName( QString( "aaa" ) );
+ QVERIFY( mEntry->firstName()[0].richText() == QString( "aaa" ) );
+
+ mEntry->setFirstName( QString( "" ) );
+ QVERIFY( mEntry->firstName()[0].richText() == QString( "" ) );
+
+ mEntry->setPhoneNumber( QString( "1234567" ) );
+ mEntry->setHighlights( QString( "5" ) );
+
+ QVERIFY( mEntry->phoneNumber().mHighlights == 0 );
+ QVERIFY( mEntry->phoneNumber().text() == QString( "1234567" ) );
+ QVERIFY( mEntry->phoneNumber().richText() == QString( "1234567" ) );
+
+ mEntry->setHighlights( QString( "1" ) );
+
+ QVERIFY( mEntry->phoneNumber().mHighlights == 1 );
+ QVERIFY( mEntry->phoneNumber().text() == QString( "1234567" ) );
+ QVERIFY( mEntry->phoneNumber().richText() == QString( "<b><u>1</u></b>234567" ) );
+
+}
+
+void UT_LogsCntEntry::testMatch()
+{
+ mEntry->mType = LogsCntEntry::EntryTypeHistory;
+
+ mEntry->setFirstName( QString( "John" ) );
+ QVERIFY( mEntry->match( QString( "5" ) ) );
+ QVERIFY( !mEntry->match( QString( "6" ) ) );
+
+ mEntry->setPhoneNumber( QString( "11111111111" ) );
+ mEntry->setFirstName( QString( "John" ) );
+ mEntry->setLastName( QString( "Malkovich" ) );
+ QVERIFY( mEntry->match( QString( "6" ) ) );
+ QVERIFY( mEntry->match( QString( "5" ) ) );
+ QVERIFY( !mEntry->match( QString( "2" ) ) );
+ QVERIFY( mEntry->match( QString( "56" ) ) );
+ QVERIFY( !mEntry->match( QString( "566" ) ) );
+
+ mEntry->setPhoneNumber( QString( "5669876566" ) );
+ QVERIFY( mEntry->match( QString( "566" ) ) );
+
+// - zero cases -
+
+ mEntry->setPhoneNumber( QString( "20298457698576" ) );
+ mEntry->setFirstName( QString( "John" ) );
+ mEntry->setLastName( QString( "Malkovich" ) );
+
+ QVERIFY( mEntry->match( QString( "202" ) ) );//match not John and match not Malkovich match phone
+ QVERIFY( !mEntry->match( QString( "507" ) ) );//match John and match not Malkovich
+ QVERIFY( !mEntry->match( QString( "206" ) ) );//match not John and macth Malkovich
+ QVERIFY( mEntry->match( QString( "506" ) ) );//match John and macth Malkovich
+ QVERIFY( mEntry->match( QString( "605" ) ) );//match John and macth Malkovich
+ QVERIFY( !mEntry->match( QString( "505" ) ) );//match John "two times"
+ QVERIFY( mEntry->match( QString( "60005" ) ) );//match John and match Malkovich
+ QVERIFY( !mEntry->match( QString( "6000500" ) ) );//match John and match Malkovich
+
+ mEntry->setFirstName( QString( "John Malkovich" ) );
+ mEntry->setLastName( QString( "" ) );
+
+ QVERIFY( mEntry->match( QString( "202" ) ) );//match not John and match not Malkovich match phone
+ QVERIFY( !mEntry->match( QString( "507" ) ) );//match John and match not Malkovich
+ QVERIFY( !mEntry->match( QString( "206" ) ) );//match not John and macth Malkovich
+ QVERIFY( mEntry->match( QString( "506" ) ) );//match John and macth Malkovich
+ QVERIFY( mEntry->match( QString( "605" ) ) );//match John and macth Malkovich
+ QVERIFY( !mEntry->match( QString( "505" ) ) );//match John "two times"
+ QVERIFY( mEntry->match( QString( "60005" ) ) );//match John and match Malkovich
+ QVERIFY( !mEntry->match( QString( "6000500" ) ) );//match John and match Malkovich
+
+ mEntry->setFirstName( QString( "" ) );
+ mEntry->setLastName( QString( "John Malkovich" ) );
+
+ QVERIFY( mEntry->match( QString( "202" ) ) );//match not John and match not Malkovich match phone
+ QVERIFY( !mEntry->match( QString( "507" ) ) );//match John and match not Malkovich
+ QVERIFY( !mEntry->match( QString( "206" ) ) );//match not John and macth Malkovich
+ QVERIFY( mEntry->match( QString( "506" ) ) );//match John and macth Malkovich
+ QVERIFY( mEntry->match( QString( "605" ) ) );//match John and macth Malkovich
+ QVERIFY( !mEntry->match( QString( "505" ) ) );//match John "two times"
+ QVERIFY( mEntry->match( QString( "60005" ) ) );//match John and match Malkovich
+ QVERIFY( !mEntry->match( QString( "6000500" ) ) );//match John and match Malkovich
+
+ mEntry->setFirstName( QString( "John Peter" ) );
+ mEntry->setLastName( QString( "Malkovich" ) );
+
+ QVERIFY( mEntry->match( QString( "50607" ) ) );//match John and match Malkovich match Peter
+ QVERIFY( mEntry->match( QString( "506" ) ) );//match John and macth Malkovich match ignore Peter
+ QVERIFY( !mEntry->match( QString( "50608" ) ) );//match John and match Malkovich match not Peter
+ QVERIFY( !mEntry->match( QString( "5060702" ) ) );//match John and match Malkovich match Peter + no match extra
+ QVERIFY( !mEntry->match( QString( "5060706" ) ) );//match John and match Malkovich match Peter + macth extra
+
+ mEntry->setFirstName( QString( "John Kalkovich" ) );
+ mEntry->setLastName( QString( "" ) );
+
+ QVERIFY( mEntry->match( QString( "505" ) ) );//match John and match Kalkovich
+
+ mEntry->setFirstName( QString( "John John Malkovich" ) );
+ mEntry->setLastName( QString( "" ) );
+
+ QVERIFY( mEntry->match( QString( "50605" ) ) );//match John and match Malkovich and match John
+ QVERIFY( mEntry->match( QString( "506" ) ) );//match Johns and macth Malkovich
+ QVERIFY( !mEntry->match( QString( "50608" ) ) );//match John and match Malkovich match not Peter
+
+ mEntry->setFirstName( QString( "John 0John Malkovich" ) );
+ mEntry->setLastName( QString( "" ) );
+
+ QVERIFY( !mEntry->match( QString( "50605" ) ) );
+ QVERIFY( !mEntry->match( QString( "505" ) ) );
+ QVERIFY( mEntry->match( QString( "5" ) ) );
+ QVERIFY( mEntry->match( QString( "0" ) ) );
+ QVERIFY( mEntry->match( QString( "05" ) ) );
+ QVERIFY( mEntry->match( QString( "0505" ) ) );
+ QVERIFY( mEntry->match( QString( "0505" ) ) );
+ QVERIFY( mEntry->match( QString( "05005" ) ) );
+ QVERIFY( mEntry->match( QString( "6005" ) ) );
+ QVERIFY( !mEntry->match( QString( "05050" ) ) );
+ QVERIFY( !mEntry->match( QString( "00505" ) ) );
+ QVERIFY( !mEntry->match( QString( "005050" ) ) );
+ QVERIFY( mEntry->match( QString( "0506" ) ) );
+ QVERIFY( mEntry->match( QString( "050506" ) ) );
+
+ mEntry->setPhoneNumber( QString( "+20298457698576" ) );
+ mEntry->setFirstName( QString( "John" ) );
+ mEntry->setLastName( QString( "Malkovich" ) );
+
+ QVERIFY( mEntry->match( QString( "+202" ) ) );
+ QVERIFY( !mEntry->match( QString( "#202" ) ) );
+ QVERIFY( !mEntry->match( QString( "*202" ) ) );
+ QVERIFY( !mEntry->match( QString( "202" ) ) );
+ QVERIFY( !mEntry->match( QString( "+202#98" ) ) );
+
+ QVERIFY( mEntry->match( QString( "50" ) ) );
+ QVERIFY( mEntry->match( QString( "05" ) ) );
+ QVERIFY( mEntry->match( QString( "506" ) ) );
+
+
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logscntfinder.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,431 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logscntfinder.h"
+#include "logscntfinder.h"
+#include "qtcontacts_stubs.h"
+#include <QtTest/QtTest>
+#include <QSignalSpy>
+
+#define CACHE_ALL_RESULTS()\
+ for( int i=0;i<mFinder->resultsCount();i++) {\
+ mFinder->resultAt( i );\
+ }
+
+
+void UT_LogsCntFinder::initTestCase()
+{
+}
+
+void UT_LogsCntFinder::cleanupTestCase()
+{
+}
+
+
+void UT_LogsCntFinder::init()
+{
+ mCntResults = ContactQueryResults::instance();
+ mFinder = new LogsCntFinder();
+}
+
+void UT_LogsCntFinder::cleanup()
+{
+ delete mFinder;
+ mFinder = 0;
+ ContactQueryResults::deleteInstance();
+ mCntResults = 0;
+}
+
+void UT_LogsCntFinder::testConstructor()
+{
+ QVERIFY( mFinder );
+ QVERIFY( mFinder->mCurrentPredictivePattern == "" );
+ QVERIFY( mFinder->mResults.count() == 0 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 0 );
+ QVERIFY( mFinder->mContactManager );
+
+ LogsCntFinder finder( *mFinder->mContactManager );
+ QVERIFY( finder.mCurrentPredictivePattern == "" );
+ QVERIFY( finder.mResults.count() == 0 );
+ QVERIFY( finder.mHistoryEvents.count() == 0 );
+ QVERIFY( finder.mContactManager );
+ QVERIFY( finder.mCachedCounter == 0 );
+
+}
+
+void UT_LogsCntFinder::testPredictiveSearchQuery()
+{
+ QSignalSpy queryReadySpy(mFinder, SIGNAL(queryReady() ) );
+ QSignalSpy resultsAddedSpy(mCntResults, SIGNAL(resultsAdded() ) );
+
+ int resultsCount = 0;
+ LogsCntEntryHandle* handle1 = (LogsCntEntryHandle*)1;
+ LogsCntEntryHandle* handle2 = (LogsCntEntryHandle*)2;
+
+ LogsCntEntry* entry1 = new LogsCntEntry( *handle1,0 );
+ entry1->setFirstName( QString("Tim Roth") );
+ entry1->setAvatarPath( QString("c:\\data\\images\\logstest1.jpg") );
+ mFinder->insertEntry( 0, entry1 );
+ QCOMPARE( mFinder->mHistoryEvents.count(), 1 );
+
+ LogsCntEntry* entry2 = new LogsCntEntry( *handle2,0 );
+ entry2->setFirstName( QString("Kai") );
+ entry2->setLastName( QString("Öistämö") );
+ entry2->setAvatarPath( QString("c:\\data\\images\\logstest2.jpg") );
+ mFinder->insertEntry( 0, entry2 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 2 );
+ QCOMPARE( mFinder->mCachedCounter, 0 );
+
+ mCntResults->set( 9 );//John1 Malkovich1 ...
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QVERIFY( mFinder->mCurrentPredictivePattern == QString("5") );
+ QCOMPARE( mFinder->resultsCount(), 1 + 9 );
+ QVERIFY( mFinder->mResults[0]->isCached() );
+ QVERIFY( mFinder->mResults[0]->handle() == handle2 );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].text() == QString("Kai") );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].highlights() == 1 );
+ QVERIFY( mFinder->mResults[0]->avatarPath() == QString("c:\\data\\images\\logstest2.jpg") );
+ QVERIFY( !mFinder->mResults[1]->isCached() );
+ QVERIFY( mFinder->mResults[1]->handle() == 0 );
+ QVERIFY( mFinder->mResults[1]->contactId() == 1 );
+ QCOMPARE( mFinder->mCachedCounter, 1 );
+
+ const LogsCntEntry* firstE = &mFinder->resultAt( 1 );
+ QCOMPARE( mFinder->mCachedCounter, 2 );
+ QVERIFY( mFinder->mResults[1]->firstName()[0].text() == QString("John1") );
+ QVERIFY( mFinder->mResults[1]->firstName()[0].highlights() == 1 );
+
+
+ mCntResults->set( 9 );//John1 Malkovich1 ...
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("56") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 0 + 9 );
+ QVERIFY( mFinder->mResults[0]->isCached() );
+ QVERIFY( mFinder->mResults[0]->handle() == 0 );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].text() == QString("John1") );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].highlights() == 2 );
+ QVERIFY( &mFinder->resultAt(0) == firstE );
+ QCOMPARE( mFinder->mCachedCounter, 1 );
+
+
+ mCntResults->set( 0 );//no match
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("562") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 0 );
+ QCOMPARE( mFinder->mCachedCounter, 0 );
+
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("5627") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 0 );
+ QCOMPARE( mFinder->resultsCount(), 0 );
+ QCOMPARE( mFinder->mCachedCounter, 0 );
+
+ mCntResults->set( 9 );//John1 Malkovich1 ...
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("56") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 0 + 9 );
+ QVERIFY( !mFinder->mResults[0]->isCached() );
+ QVERIFY( mFinder->mResults[0]->handle() == 0 );
+ QVERIFY( mFinder->mResults[0]->contactId() == 1 );
+ //QVERIFY( mFinder->mResults[0] != firstE ); might be the same
+ QCOMPARE( mFinder->mCachedCounter, 0 );
+
+ mCntResults->set( 9 );//John1 Malkovich1 ...
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 1 + 9 );
+ QVERIFY( mFinder->mResults[0]->isCached() );
+ QVERIFY( mFinder->mResults[0]->handle() == handle2 );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].text() == QString("Kai") );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].highlights() == 1 );
+ QVERIFY( !mFinder->mResults[1]->isCached() );
+ QVERIFY( mFinder->mResults[1]->contactId() == 1 );
+ QCOMPARE( mFinder->mCachedCounter, 1 );
+
+ CACHE_ALL_RESULTS();
+ QCOMPARE( mFinder->mCachedCounter, mFinder->resultsCount() );
+
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("56") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 0 );
+ QCOMPARE( mFinder->resultsCount(), 0 + 9 );
+ QVERIFY( mFinder->mResults[0]->isCached() );
+ QVERIFY( mFinder->mResults[0]->handle() == 0 );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].text() == QString("John1") );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].highlights() == 2 );
+ QCOMPARE( mFinder->mCachedCounter, 9 );
+
+ mCntResults->set( 9 );//same results ( contact ids )
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("5") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 1 + 9 );
+ QVERIFY( mFinder->mResults[0]->isCached() );
+ QVERIFY( mFinder->mResults[0]->handle() == handle2 );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].text() == QString("Kai") );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].highlights() == 1 );
+ //althoug had to go to db, contact ids were reused from prev seacrh
+ QVERIFY( mFinder->mResults[1]->isCached() );
+ QVERIFY( mFinder->mResults[1]->handle() == 0 );
+ QVERIFY( mFinder->mResults[1]->firstName()[0].text() == QString("John1") );
+ QVERIFY( mFinder->mResults[1]->firstName()[0].highlights() == 1 );
+ QCOMPARE( mFinder->mCachedCounter, 10 );
+
+ //refresh
+ mCntResults->set( 9 );
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( mFinder->mCurrentPredictivePattern );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 1 + 9 );
+
+ //reset
+ mCntResults->set( 9 );
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 0 );
+ QCOMPARE( mFinder->resultsCount(),0 );
+ QCOMPARE( mFinder->mCachedCounter, 0 );
+
+ //15 digits query
+ mCntResults->set( 9 );
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("123456789112345" ) );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->mCurrentPredictivePattern.length(), 15 );
+ int resCount = mFinder->resultsCount();
+ QCOMPARE( resCount, 9 );
+
+ //15 digits query
+ mCntResults->set( 9 );
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("222222222222222" ) );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->mCurrentPredictivePattern.length(), 15 );
+ resCount = mFinder->resultsCount();
+ QCOMPARE( resCount, 9 );
+
+ //16 digits query
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("1234567891123456") );
+ QCOMPARE( queryReadySpy.count(), 0 );
+ QCOMPARE( resultsAddedSpy.count(), 0 );
+ QCOMPARE( mFinder->mCurrentPredictivePattern.length(), 15 );
+ QCOMPARE( mFinder->resultsCount(), resCount );
+
+ //20 digits query
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("12345678911234567891") );
+ QCOMPARE( queryReadySpy.count(), 0 );
+ QCOMPARE( resultsAddedSpy.count(), 0 );
+ QCOMPARE( mFinder->mCurrentPredictivePattern.length(), 15 );
+ QCOMPARE( mFinder->resultsCount(), resCount );
+
+ //step 1: if query is "20", this is matched (OK)
+ //step 2: if query is "206", this is matched (OK)
+ //Step 3: remove 6 in query and query "20", this is matched (OK)
+
+ qDeleteAll( mFinder->mHistoryEvents );
+ mFinder->mHistoryEvents.clear();
+ mFinder->predictiveSearchQuery( QString("") );
+
+ mCntResults->set( 1, QString("Alice 028"), QString("Ming") );
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("20") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 1 );
+
+ CACHE_ALL_RESULTS();
+ QCOMPARE( mFinder->mCachedCounter, mFinder->resultsCount() );
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("206") );
+ QCOMPARE( queryReadySpy.count(), 1);
+ QCOMPARE( resultsAddedSpy.count(), 0 );
+ QCOMPARE( mFinder->resultsCount(), 1 );
+
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("20") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 1 );
+
+
+}
+
+void UT_LogsCntFinder::testResultAt()
+{
+ mCntResults->set( 9 , QString( "first"), QString( "last") );
+
+ QVERIFY( mFinder->resultsCount() == 0 );
+ QString pattern( "5" );
+ mFinder->predictiveSearchQuery( pattern );
+ QVERIFY( mFinder->resultsCount() > 0 );
+
+ const LogsCntEntry& e = mFinder->resultAt( 0 );
+ QVERIFY( e.firstName()[0].text() == QString("first1") );
+ QVERIFY( e.lastName()[0].text() == QString("last1") );
+ QVERIFY( e.speedDial() == QString("") );
+ QVERIFY( e.phoneNumber().text() == QString("555789987") );//stub
+ QVERIFY( e.phoneNumber().highlights() == 1 );
+ QVERIFY( e.avatarPath() != QString("") );
+ QVERIFY( e.mType == LogsCntEntry::EntryTypeContact );
+ QVERIFY( e.isCached() );
+
+ const LogsCntEntry& f = mFinder->resultAt( 0 );
+ QVERIFY( &e == &f );
+
+ pattern = QString("2");
+ mFinder->predictiveSearchQuery( pattern );
+ QVERIFY( mFinder->resultsCount() > 0 );
+
+}
+
+void UT_LogsCntFinder::testInsertEntry()
+{
+
+ LogsCntEntryHandle* handle1 = (LogsCntEntryHandle*)1;
+ LogsCntEntryHandle* handle2 = (LogsCntEntryHandle*)2;
+ LogsCntEntryHandle* handle3 = (LogsCntEntryHandle*)3;
+
+ LogsCntEntry* entry1 = new LogsCntEntry( *handle1,0 );
+ mFinder->insertEntry( 0, entry1 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 1 );
+ LogsCntEntry* entry2 = new LogsCntEntry( *handle2,0 );
+ mFinder->insertEntry( 0, entry2 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 2 );
+ LogsCntEntry* entry3 = new LogsCntEntry( *handle3,0 );
+ mFinder->insertEntry( 1, entry3 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 3 );
+
+ QVERIFY( mFinder->getEntry( *handle1 ) == entry1 );
+ QVERIFY( mFinder->getEntry( *handle2 ) == entry2 );
+ QVERIFY( mFinder->getEntry( *handle3 ) == entry3 );
+
+
+}
+
+void UT_LogsCntFinder::testDeleteEntry()
+{
+
+ LogsCntEntryHandle* handle1 = (LogsCntEntryHandle*)1;
+ LogsCntEntryHandle* handle2 = (LogsCntEntryHandle*)2;
+ LogsCntEntryHandle* handle3 = (LogsCntEntryHandle*)3;
+
+ LogsCntEntry* entry1 = new LogsCntEntry( *handle1,0 );
+ mFinder->insertEntry( 0, entry1 );
+ LogsCntEntry* entry2 = new LogsCntEntry( *handle2,0 );
+ mFinder->insertEntry( 0, entry2 );
+ LogsCntEntry* entry3 = new LogsCntEntry( *handle3,0 );
+ mFinder->insertEntry( 1, entry3 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 3 );
+
+ mFinder->deleteEntry( *handle1 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 2 );
+ mFinder->deleteEntry( *handle2 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 1 );
+ mFinder->deleteEntry( *handle3 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 0 );
+
+ entry1 = new LogsCntEntry( *handle1,0 );
+ mFinder->insertEntry( 0, entry1 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 1 );
+ entry2 = new LogsCntEntry( *entry1 );
+ mFinder->mResults.append( entry2 );
+ mFinder->deleteEntry( *handle1 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 0 );
+ QVERIFY( mFinder->mResults.count() == 1 );
+
+}
+
+void UT_LogsCntFinder::testGetEntry()
+{
+ LogsCntEntryHandle* handle1 = (LogsCntEntryHandle*)1;
+
+ LogsCntEntry* entry1 = new LogsCntEntry( *handle1,0 );
+ QVERIFY( entry1->firstName()[0].text() == QString("") );
+ QVERIFY( entry1->lastName()[0].text() == QString("") );
+ entry1->setFirstName( QString("first") );
+ entry1->setLastName( QString("last") );
+ QVERIFY( entry1->firstName()[0].text() == QString("first") );
+ QVERIFY( entry1->lastName()[0].text() == QString("last") );
+ mFinder->insertEntry( 0, entry1 );
+
+ LogsCntEntry* entry = mFinder->getEntry( *handle1 );
+ QVERIFY( entry == entry1 );
+ entry->setFirstName( QString("foo") );
+ entry->setLastName( QString("bar") );
+
+ LogsCntEntry* entry3 = mFinder->getEntry( *handle1 );
+ QVERIFY( entry3 == entry1 );
+ QVERIFY( entry3->firstName()[0].text() == QString("foo") );
+ QVERIFY( entry3->lastName()[0].text() == QString("bar") );
+
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictivetranslator.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logspredictivetranslator.h"
+#include "logspredictivetranslator.h"
+
+#include <QtTest/QtTest>
+#include <QSignalSpy>
+
+
+void UT_LogsPredictiveTranslator::initTestCase()
+{
+}
+
+void UT_LogsPredictiveTranslator::cleanupTestCase()
+{
+}
+
+
+void UT_LogsPredictiveTranslator::init()
+{
+ mTranslator = LogsPredictiveTranslator::instance();
+}
+
+void UT_LogsPredictiveTranslator::cleanup()
+{
+ LogsPredictiveTranslator::deleteInstance();
+}
+
+void UT_LogsPredictiveTranslator::testConstructor()
+{
+ QVERIFY( mTranslator );
+ QVERIFY( mTranslator->mKeyMap );
+
+}
+
+void UT_LogsPredictiveTranslator::testTranslate()
+{
+ QVERIFY( mTranslator->translate( QString( "Nokia" ) ) == QString( "66542" ) );
+ QVERIFY( mTranslator->translate( QString( "Aarne" ) ) == QString( "22763" ) );
+ QVERIFY( mTranslator->translate( QString( "Bertta" ) ) == QString( "237882" ) );
+ QVERIFY( mTranslator->translate( QString( "Celsius" ) ) == QString( "2357487" ) );
+ QVERIFY( mTranslator->translate( QString( "Daavid" ) ) == QString( "322843" ) );
+ QVERIFY( mTranslator->translate( QString( "Eemeli" ) ) == QString( "336354" ) );
+ QVERIFY( mTranslator->translate( QString( "Faarao" ) ) == QString( "322726" ) );
+ QVERIFY( mTranslator->translate( QString( "Gideon" ) ) == QString( "443366" ) );
+ QVERIFY( mTranslator->translate( QString( "Heikki" ) ) == QString( "434554" ) );
+ QVERIFY( mTranslator->translate( QString( "Iivari" ) ) == QString( "448274" ) );
+ QVERIFY( mTranslator->translate( QString( "Jussi" ) ) == QString( "58774" ) );
+ QVERIFY( mTranslator->translate( QString( "Kalle" ) ) == QString( "52553" ) );
+ QVERIFY( mTranslator->translate( QString( "Lauri" ) ) == QString( "52874" ) );
+ QVERIFY( mTranslator->translate( QString( "Matti" ) ) == QString( "62884" ) );
+ QVERIFY( mTranslator->translate( QString( "Niilo" ) ) == QString( "64456" ) );
+ QVERIFY( mTranslator->translate( QString( "Otto" ) ) == QString( "6886" ) );
+ QVERIFY( mTranslator->translate( QString( "Paavo" ) ) == QString( "72286" ) );
+ QVERIFY( mTranslator->translate( QString( "Kuu" ) ) == QString( "588" ) );
+ QVERIFY( mTranslator->translate( QString( "Risto" ) ) == QString( "74786" ) );
+ QVERIFY( mTranslator->translate( QString( "Sakari" ) ) == QString( "725274" ) );
+ QVERIFY( mTranslator->translate( QString( "Tyyne" ) ) == QString( "89963" ) );
+ QVERIFY( mTranslator->translate( QString( "Urho" ) ) == QString( "8746" ) );
+ QVERIFY( mTranslator->translate( QString( "Vihtori" ) ) == QString( "8448674" ) );
+ QVERIFY( mTranslator->translate( QString( "Wiski" ) ) == QString( "94754" ) );
+ QVERIFY( mTranslator->translate( QString( "Yrjö" ) ) == QString( "9756" ) );
+ QVERIFY( mTranslator->translate( QString( "Tseta" ) ) == QString( "87382" ) );
+ QVERIFY( mTranslator->translate( QString( "Åke" ) ) == QString( "253" ) );
+ QVERIFY( mTranslator->translate( QString( "Äiti" ) ) == QString( "2484" ) );
+ QVERIFY( mTranslator->translate( QString( "Öljy" ) ) == QString( "6559" ) );
+ QVERIFY( mTranslator->translate( QString( "Adam" ) ) == QString( "2326" ) );
+ QVERIFY( mTranslator->translate( QString( "Bertil" ) ) == QString( "237845" ) );
+ QVERIFY( mTranslator->translate( QString( "Cesar" ) ) == QString( "23727" ) );
+ QVERIFY( mTranslator->translate( QString( "David" ) ) == QString( "32843" ) );
+ QVERIFY( mTranslator->translate( QString( "Erik" ) ) == QString( "3745" ) );
+ QVERIFY( mTranslator->translate( QString( "Filip" ) ) == QString( "34547" ) );
+ QVERIFY( mTranslator->translate( QString( "Gustav" ) ) == QString( "487828" ) );
+ QVERIFY( mTranslator->translate( QString( "Helge" ) ) == QString( "43543" ) );
+ QVERIFY( mTranslator->translate( QString( "Ivar" ) ) == QString( "4827" ) );
+ QVERIFY( mTranslator->translate( QString( "Johan" ) ) == QString( "56426" ) );
+ QVERIFY( mTranslator->translate( QString( "Kalle" ) ) == QString( "52553" ) );
+ QVERIFY( mTranslator->translate( QString( "Ludvig" ) ) == QString( "583844" ) );
+ QVERIFY( mTranslator->translate( QString( "Martin" ) ) == QString( "627846" ) );
+ QVERIFY( mTranslator->translate( QString( "Niklas" ) ) == QString( "645527" ) );
+ QVERIFY( mTranslator->translate( QString( "Olof" ) ) == QString( "6563" ) );
+ QVERIFY( mTranslator->translate( QString( "Petter" ) ) == QString( "738837" ) );
+ QVERIFY( mTranslator->translate( QString( "Quintus" ) ) == QString( "7846887" ) );
+ QVERIFY( mTranslator->translate( QString( "Rudolf" ) ) == QString( "783653" ) );
+ QVERIFY( mTranslator->translate( QString( "Sigurd" ) ) == QString( "744873" ) );
+ QVERIFY( mTranslator->translate( QString( "Tore" ) ) == QString( "8673" ) );
+ QVERIFY( mTranslator->translate( QString( "Urban" ) ) == QString( "87226" ) );
+ QVERIFY( mTranslator->translate( QString( "Viktor" ) ) == QString( "845867" ) );
+ QVERIFY( mTranslator->translate( QString( "Wilhelm" ) ) == QString( "9454356" ) );
+ QVERIFY( mTranslator->translate( QString( "Xerxes" ) ) == QString( "937937" ) );
+ QVERIFY( mTranslator->translate( QString( "Yngve" ) ) == QString( "96483" ) );
+ QVERIFY( mTranslator->translate( QString( "Zäta" ) ) == QString( "9282" ) );
+ QVERIFY( mTranslator->translate( QString( "Ärlig" ) ) == QString( "27544" ) );
+ QVERIFY( mTranslator->translate( QString( "Östen" ) ) == QString( "67836" ) );
+ QVERIFY( mTranslator->translate( QString( "Alpha" ) ) == QString( "25742" ) );
+ QVERIFY( mTranslator->translate( QString( "Bravo" ) ) == QString( "27286" ) );
+ QVERIFY( mTranslator->translate( QString( "Charlie" ) ) == QString( "2427543" ) );
+ QVERIFY( mTranslator->translate( QString( "Delta" ) ) == QString( "33582" ) );
+ QVERIFY( mTranslator->translate( QString( "Echo" ) ) == QString( "3246" ) );
+ QVERIFY( mTranslator->translate( QString( "Foxtrot" ) ) == QString( "3698768" ) );
+ QVERIFY( mTranslator->translate( QString( "Golf" ) ) == QString( "4653" ) );
+ QVERIFY( mTranslator->translate( QString( "Hotel" ) ) == QString( "46835" ) );
+ QVERIFY( mTranslator->translate( QString( "India" ) ) == QString( "46342" ) );
+ QVERIFY( mTranslator->translate( QString( "Juliet" ) ) == QString( "585438" ) );
+ QVERIFY( mTranslator->translate( QString( "Kilo" ) ) == QString( "5456" ) );
+ QVERIFY( mTranslator->translate( QString( "Lima" ) ) == QString( "5462" ) );
+ QVERIFY( mTranslator->translate( QString( "Mike" ) ) == QString( "6453" ) );
+ QVERIFY( mTranslator->translate( QString( "November" ) ) == QString( "66836237" ) );
+ QVERIFY( mTranslator->translate( QString( "Oscar" ) ) == QString( "67227" ) );
+ QVERIFY( mTranslator->translate( QString( "Papa" ) ) == QString( "7272" ) );
+ QVERIFY( mTranslator->translate( QString( "Quebec" ) ) == QString( "783232" ) );
+ QVERIFY( mTranslator->translate( QString( "Romeo" ) ) == QString( "76636" ) );
+ QVERIFY( mTranslator->translate( QString( "Sierra" ) ) == QString( "743772" ) );
+ QVERIFY( mTranslator->translate( QString( "Tanga" ) ) == QString( "82642" ) );
+ QVERIFY( mTranslator->translate( QString( "Uniform" ) ) == QString( "8643676" ) );
+ QVERIFY( mTranslator->translate( QString( "Vârlan" ) ) == QString( "827526" ) );
+ QVERIFY( mTranslator->translate( QString( "Victor" ) ) == QString( "842867" ) );
+ QVERIFY( mTranslator->translate( QString( "Whiskey" ) ) == QString( "9447539" ) );
+ QVERIFY( mTranslator->translate( QString( "Xray" ) ) == QString( "9729" ) );
+ QVERIFY( mTranslator->translate( QString( "Yankee" ) ) == QString( "926533" ) );
+ QVERIFY( mTranslator->translate( QString( "Zulu" ) ) == QString( "9858" ) );
+ QVERIFY( mTranslator->translate( QString( "1234567890" ) ) == QString( "1234567890" ) );
+ QCOMPARE( mTranslator->translate( QString( "+1234567890" ) ) ,QString( "11234567890" ) );
+ QCOMPARE( mTranslator->translate( QString( "#1234567890" ) ), QString( "11234567890" ) );
+ QCOMPARE( mTranslator->translate( QString( "++##" ) ), QString( "1111" ) );
+ QCOMPARE( mTranslator->translate( QString( "-+##" ) ), QString( "1111" ) );
+ QCOMPARE( mTranslator->translate( QString( "/+##" ) ), QString( "1111" ) );
+ QCOMPARE( mTranslator->translate( QString( "*+##" ) ), QString( "1111" ) );
+
+
+ QString uni;
+ uni.append(QChar(0x0219));
+ uni.append(QChar(0x4E0F));
+ QString result("7");
+ result.append(QChar(0x4E0F));
+ QCOMPARE(mTranslator->translate(uni), result);
+}
+
+void UT_LogsPredictiveTranslator::testTranslateChar()
+{
+ // Romanian unicode character "sh"
+ QChar rom(0x0219);
+ QCOMPARE( mTranslator->translate( rom ), QChar('7') );
+
+ // Chinese unicode character
+ QChar chn(0x4E0F);
+ QCOMPARE( mTranslator->translate( chn ), chn );
+}
+
+
+void UT_LogsPredictiveTranslator::testStartsWith()
+{
+ QVERIFY( mTranslator->startsWith( QString(""), QString("") ) == 0 );
+ QVERIFY( mTranslator->startsWith( QString(""), QString("12") ) == 0 );
+ QVERIFY( mTranslator->startsWith( QString("Nokia"), QString("") ) == 0 );
+ QVERIFY( mTranslator->startsWith( QString("Nokia"), QString("6") ) == 1 );
+ QVERIFY( mTranslator->startsWith( QString("Nokia"), QString("66") ) == 2 );
+ QVERIFY( mTranslator->startsWith( QString("Nokia"), QString("665") ) == 3 );
+ QVERIFY( mTranslator->startsWith( QString("Nokia"), QString("6654") ) == 4 );
+ QVERIFY( mTranslator->startsWith( QString("Nokia"), QString("66542") ) == 5 );
+ QVERIFY( mTranslator->startsWith( QString("Nokia"), QString("665423") ) == 0 );
+
+
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/ut_logscntfinder.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,60 @@
+#
+# 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 = app
+TARGET =
+
+QT += testlib xml
+CONFIG += qtestlib
+CONFIG += hb
+HB = hbcore hbinput
+
+DEPENDPATH += .
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+INCLUDEPATH += ../../
+INCLUDEPATH += ../../inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../../tsrc/qtestutils/inc
+INCLUDEPATH += .
+
+DEFINES += QT_NO_DEBUG_OUTPUT
+
+# Input
+HEADERS += inc/ut_logscntfinder.h
+HEADERS += ../../inc/logscntfinder.h
+HEADERS += inc/ut_logspredictivetranslator.h
+HEADERS += ../../inc/logspredictivetranslator.h
+HEADERS += inc/ut_logscntentry.h
+HEADERS += ../stubs/qtcontacts_stubs.h
+
+SOURCES += src/main.cpp
+SOURCES += src/ut_logscntfinder.cpp
+SOURCES += src/ut_logspredictivetranslator.cpp
+SOURCES += src/ut_logscntentry.cpp
+SOURCES += ../../src/logscntfinder.cpp
+SOURCES += ../../src/logspredictivetranslator.cpp
+SOURCES += ../../../tsrc/qtestutils/src/testresultxmlparser.cpp
+SOURCES += ../stubs/qtcontacts_stubs.cpp
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xEfa329b2
+ TARGET.CAPABILITY = ALL -TCB
+ TARGET.EPOCALLOWDLLDATA = 1
+ LIBS += -lflogger -lqtcontacts
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/bwins/logsengineu.def Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,59 @@
+EXPORTS
+ ?time@LogsEvent@@QBE?AVQDateTime@@XZ @ 1 NONAME ; class QDateTime LogsEvent::time(void) const
+ ??0LogsCustomFilter@@QAE@XZ @ 2 NONAME ; LogsCustomFilter::LogsCustomFilter(void)
+ ?clearEvents@LogsCustomFilter@@QAE_NXZ @ 3 NONAME ; bool LogsCustomFilter::clearEvents(void)
+ ?ALS@LogsEvent@@QBE_NXZ @ 4 NONAME ; bool LogsEvent::ALS(void) const
+ ?updateExisting@LogsContact@@QAE_NXZ @ 5 NONAME ; bool LogsContact::updateExisting(void)
+ ??0LogsModel@@QAE@W4LogsModelType@0@_N@Z @ 6 NONAME ; LogsModel::LogsModel(enum LogsModel::LogsModelType, bool)
+ ?allowedRequestType@LogsContact@@QAE?AW4RequestType@1@XZ @ 7 NONAME ; enum LogsContact::RequestType LogsContact::allowedRequestType(void)
+ ??0LogsEvent@@QAE@ABV0@@Z @ 8 NONAME ; LogsEvent::LogsEvent(class LogsEvent const &)
+ ?markEventsSeen@LogsModel@@QAE_NW4ClearType@1@@Z @ 9 NONAME ; bool LogsModel::markEventsSeen(enum LogsModel::ClearType)
+ ?getNumberToClipboard@LogsDetailsModel@@QAEXXZ @ 10 NONAME ; void LogsDetailsModel::getNumberToClipboard(void)
+ ??0LogsFilter@@QAE@W4FilterType@0@@Z @ 11 NONAME ; LogsFilter::LogsFilter(enum LogsFilter::FilterType)
+ ?sendMessage@LogsMessage@@QAE_NXZ @ 12 NONAME ; bool LogsMessage::sendMessage(void)
+ ?predictiveSearchStatus@LogsModel@@QAEHXZ @ 13 NONAME ; int LogsModel::predictiveSearchStatus(void)
+ ?duration@LogsEvent@@QBEHXZ @ 14 NONAME ; int LogsEvent::duration(void) const
+ ?contactLocalId@LogsEvent@@QBEIXZ @ 15 NONAME ; unsigned int LogsEvent::contactLocalId(void) const
+ ??1LogsMatchesModel@@UAE@XZ @ 16 NONAME ; LogsMatchesModel::~LogsMatchesModel(void)
+ ?open@LogsContact@@QAE_NXZ @ 17 NONAME ; bool LogsContact::open(void)
+ ?logId@LogsEvent@@QBEHXZ @ 18 NONAME ; int LogsEvent::logId(void) const
+ ?call@LogsCall@@QAEXW4CallType@1@@Z @ 19 NONAME ; void LogsCall::call(enum LogsCall::CallType)
+ ?allowedCallTypes@LogsCall@@QAE?AV?$QList@W4CallType@LogsCall@@@@XZ @ 20 NONAME ; class QList<enum LogsCall::CallType> LogsCall::allowedCallTypes(void)
+ ?callToNumber@LogsCall@@SAXW4CallType@1@ABVQString@@I@Z @ 21 NONAME ; void LogsCall::callToNumber(enum LogsCall::CallType, class QString const &, unsigned int)
+ ?setContactId@LogsCustomFilter@@QAEXI@Z @ 22 NONAME ; void LogsCustomFilter::setContactId(unsigned int)
+ ??1LogsModel@@UAE@XZ @ 23 NONAME ; LogsModel::~LogsModel(void)
+ ?remoteParty@LogsEvent@@QBEABVQString@@XZ @ 24 NONAME ; class QString const & LogsEvent::remoteParty(void) const
+ ?compressData@LogsModel@@QAEHXZ @ 25 NONAME ; int LogsModel::compressData(void)
+ ?addNew@LogsContact@@QAE_NXZ @ 26 NONAME ; bool LogsContact::addNew(void)
+ ?isRead@LogsEvent@@QBE_NXZ @ 27 NONAME ; bool LogsEvent::isRead(void) const
+ ?ringDuration@LogsEvent@@QBEHXZ @ 28 NONAME ; int LogsEvent::ringDuration(void) const
+ ?markEventsSeen@LogsCustomFilter@@QAE_NXZ @ 29 NONAME ; bool LogsCustomFilter::markEventsSeen(void)
+ ??1LogsDetailsModel@@UAE@XZ @ 30 NONAME ; LogsDetailsModel::~LogsDetailsModel(void)
+ ?number@LogsEvent@@QBEABVQString@@XZ @ 31 NONAME ; class QString const & LogsEvent::number(void) const
+ ?logsMatchesModel@LogsModel@@QAEPAVLogsMatchesModel@@XZ @ 32 NONAME ; class LogsMatchesModel * LogsModel::logsMatchesModel(void)
+ ??1LogsFilter@@UAE@XZ @ 33 NONAME ; LogsFilter::~LogsFilter(void)
+ ??1LogsMessage@@UAE@XZ @ 34 NONAME ; LogsMessage::~LogsMessage(void)
+ ?logsMatches@LogsMatchesModel@@QAEXABVQString@@@Z @ 35 NONAME ; void LogsMatchesModel::logsMatches(class QString const &)
+ ?setPredictiveSearch@LogsModel@@QAEH_N@Z @ 36 NONAME ; int LogsModel::setPredictiveSearch(bool)
+ ?duplicates@LogsEvent@@QBEHXZ @ 37 NONAME ; int LogsEvent::duplicates(void) const
+ ?getNumberForCalling@LogsEvent@@QAE?AVQString@@XZ @ 38 NONAME ; class QString LogsEvent::getNumberForCalling(void)
+ ?createContact@LogsMatchesModel@@QAEPAVLogsContact@@ABVQString@@@Z @ 39 NONAME ; class LogsContact * LogsMatchesModel::createContact(class QString const &)
+ ?direction@LogsEvent@@QBE?AW4LogsDirection@1@XZ @ 40 NONAME ; enum LogsEvent::LogsDirection LogsEvent::direction(void) const
+ ?refreshData@LogsModel@@QAEHXZ @ 41 NONAME ; int LogsModel::refreshData(void)
+ ?clearEvent@LogsDetailsModel@@QAEXXZ @ 42 NONAME ; void LogsDetailsModel::clearEvent(void)
+ ?clearMissedCallsCounter@LogsModel@@QAEHXZ @ 43 NONAME ; int LogsModel::clearMissedCallsCounter(void)
+ ?filterType@LogsFilter@@QBE?AW4FilterType@1@XZ @ 44 NONAME ; enum LogsFilter::FilterType LogsFilter::filterType(void) const
+ ?setPredictiveSearch@LogsMatchesModel@@QAEH_N@Z @ 45 NONAME ; int LogsMatchesModel::setPredictiveSearch(bool)
+ ??1LogsEvent@@UAE@XZ @ 46 NONAME ; LogsEvent::~LogsEvent(void)
+ ?setMaxSize@LogsFilter@@QAEXH@Z @ 47 NONAME ; void LogsFilter::setMaxSize(int)
+ ?initiateCallback@LogsCall@@QAEXXZ @ 48 NONAME ; void LogsCall::initiateCallback(void)
+ ??1LogsCustomFilter@@UAE@XZ @ 49 NONAME ; LogsCustomFilter::~LogsCustomFilter(void)
+ ?sendMessageToNumber@LogsMessage@@SA_NABVQString@@0I@Z @ 50 NONAME ; bool LogsMessage::sendMessageToNumber(class QString const &, class QString const &, unsigned int)
+ ?defaultCallType@LogsCall@@QAE?AW4CallType@1@XZ @ 51 NONAME ; enum LogsCall::CallType LogsCall::defaultCallType(void)
+ ?predictiveSearchStatus@LogsMatchesModel@@QAEHXZ @ 52 NONAME ; int LogsMatchesModel::predictiveSearchStatus(void)
+ ?eventType@LogsEvent@@QBE?AW4LogsEventType@1@XZ @ 53 NONAME ; enum LogsEvent::LogsEventType LogsEvent::eventType(void) const
+ ??1LogsCall@@UAE@XZ @ 54 NONAME ; LogsCall::~LogsCall(void)
+ ?clearList@LogsModel@@QAE_NW4ClearType@1@@Z @ 55 NONAME ; bool LogsModel::clearList(enum LogsModel::ClearType)
+ ??1LogsContact@@UAE@XZ @ 56 NONAME ; LogsContact::~LogsContact(void)
+ ?clearType@LogsFilter@@QBE?AW4ClearType@LogsModel@@XZ @ 57 NONAME ; enum LogsModel::ClearType LogsFilter::clearType(void) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/eabi/logsengineu.def Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,81 @@
+EXPORTS
+ _ZN10LogsFilter10setMaxSizeEi @ 1 NONAME
+ _ZN10LogsFilterC1ENS_10FilterTypeE @ 2 NONAME
+ _ZN10LogsFilterC2ENS_10FilterTypeE @ 3 NONAME
+ _ZN10LogsFilterD0Ev @ 4 NONAME
+ _ZN10LogsFilterD1Ev @ 5 NONAME
+ _ZN10LogsFilterD2Ev @ 6 NONAME
+ _ZN11LogsContact14updateExistingEv @ 7 NONAME
+ _ZN11LogsContact18allowedRequestTypeEv @ 8 NONAME
+ _ZN11LogsContact4openEv @ 9 NONAME
+ _ZN11LogsContact6addNewEv @ 10 NONAME
+ _ZN11LogsContactD0Ev @ 11 NONAME
+ _ZN11LogsContactD1Ev @ 12 NONAME
+ _ZN11LogsContactD2Ev @ 13 NONAME
+ _ZN11LogsMessage11sendMessageEv @ 14 NONAME
+ _ZN11LogsMessage19sendMessageToNumberERK7QStringS2_j @ 15 NONAME
+ _ZN11LogsMessageD0Ev @ 16 NONAME
+ _ZN11LogsMessageD1Ev @ 17 NONAME
+ _ZN11LogsMessageD2Ev @ 18 NONAME
+ _ZN16LogsCustomFilter11clearEventsEv @ 19 NONAME
+ _ZN16LogsCustomFilter12setContactIdEj @ 20 NONAME
+ _ZN16LogsCustomFilter14markEventsSeenEv @ 21 NONAME
+ _ZN16LogsCustomFilterC1Ev @ 22 NONAME
+ _ZN16LogsCustomFilterC2Ev @ 23 NONAME
+ _ZN16LogsCustomFilterD0Ev @ 24 NONAME
+ _ZN16LogsCustomFilterD1Ev @ 25 NONAME
+ _ZN16LogsCustomFilterD2Ev @ 26 NONAME
+ _ZN16LogsDetailsModel10clearEventEv @ 27 NONAME
+ _ZN16LogsDetailsModel20getNumberToClipboardEv @ 28 NONAME
+ _ZN16LogsDetailsModelD0Ev @ 29 NONAME
+ _ZN16LogsDetailsModelD1Ev @ 30 NONAME
+ _ZN16LogsDetailsModelD2Ev @ 31 NONAME
+ _ZN16LogsMatchesModel11logsMatchesERK7QString @ 32 NONAME
+ _ZN16LogsMatchesModel13createContactERK7QString @ 33 NONAME
+ _ZN16LogsMatchesModel19setPredictiveSearchEb @ 34 NONAME
+ _ZN16LogsMatchesModel22predictiveSearchStatusEv @ 35 NONAME
+ _ZN16LogsMatchesModelD0Ev @ 36 NONAME
+ _ZN16LogsMatchesModelD1Ev @ 37 NONAME
+ _ZN16LogsMatchesModelD2Ev @ 38 NONAME
+ _ZN8LogsCall12callToNumberENS_8CallTypeERK7QStringj @ 39 NONAME
+ _ZN8LogsCall15defaultCallTypeEv @ 40 NONAME
+ _ZN8LogsCall16allowedCallTypesEv @ 41 NONAME
+ _ZN8LogsCall16initiateCallbackEv @ 42 NONAME
+ _ZN8LogsCall4callENS_8CallTypeE @ 43 NONAME
+ _ZN8LogsCallD0Ev @ 44 NONAME
+ _ZN8LogsCallD1Ev @ 45 NONAME
+ _ZN8LogsCallD2Ev @ 46 NONAME
+ _ZN9LogsEvent19getNumberForCallingEv @ 47 NONAME
+ _ZN9LogsEventC1ERKS_ @ 48 NONAME
+ _ZN9LogsEventC2ERKS_ @ 49 NONAME
+ _ZN9LogsEventD0Ev @ 50 NONAME
+ _ZN9LogsEventD1Ev @ 51 NONAME
+ _ZN9LogsEventD2Ev @ 52 NONAME
+ _ZN9LogsModel11refreshDataEv @ 53 NONAME
+ _ZN9LogsModel12compressDataEv @ 54 NONAME
+ _ZN9LogsModel14markEventsSeenENS_9ClearTypeE @ 55 NONAME
+ _ZN9LogsModel16logsMatchesModelEv @ 56 NONAME
+ _ZN9LogsModel19setPredictiveSearchEb @ 57 NONAME
+ _ZN9LogsModel22predictiveSearchStatusEv @ 58 NONAME
+ _ZN9LogsModel23clearMissedCallsCounterEv @ 59 NONAME
+ _ZN9LogsModel9clearListENS_9ClearTypeE @ 60 NONAME
+ _ZN9LogsModelC1ENS_13LogsModelTypeEb @ 61 NONAME
+ _ZN9LogsModelC2ENS_13LogsModelTypeEb @ 62 NONAME
+ _ZN9LogsModelD0Ev @ 63 NONAME
+ _ZN9LogsModelD1Ev @ 64 NONAME
+ _ZN9LogsModelD2Ev @ 65 NONAME
+ _ZNK10LogsFilter10filterTypeEv @ 66 NONAME
+ _ZNK10LogsFilter9clearTypeEv @ 67 NONAME
+ _ZNK9LogsEvent10duplicatesEv @ 68 NONAME
+ _ZNK9LogsEvent11remotePartyEv @ 69 NONAME
+ _ZNK9LogsEvent12ringDurationEv @ 70 NONAME
+ _ZNK9LogsEvent14contactLocalIdEv @ 71 NONAME
+ _ZNK9LogsEvent3ALSEv @ 72 NONAME
+ _ZNK9LogsEvent4timeEv @ 73 NONAME
+ _ZNK9LogsEvent5logIdEv @ 74 NONAME
+ _ZNK9LogsEvent6isReadEv @ 75 NONAME
+ _ZNK9LogsEvent6numberEv @ 76 NONAME
+ _ZNK9LogsEvent8durationEv @ 77 NONAME
+ _ZNK9LogsEvent9directionEv @ 78 NONAME
+ _ZNK9LogsEvent9eventTypeEv @ 79 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/inc/logscall.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* 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 LOGSCALL_H
+#define LOGSCALL_H
+
+#include <QObject>
+#include <QList>
+#include <logsexport.h>
+
+#include "logsevent.h"
+
+
+/**
+ * LogsCall can be used to make a call
+ * from logs model.
+ */
+class LogsCall : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ enum CallType {
+ TypeLogsCallNotAvailable = 0,
+ TypeLogsVoiceCall,
+ TypeLogsVideoCall,
+ TypeLogsVoIPCall
+ };
+
+public:
+
+ explicit LogsCall(LogsEvent& aEvent);
+ explicit LogsCall(unsigned int contactId, const QString& number);
+
+ LOGSENGINE_EXPORT ~LogsCall();
+
+ LOGSENGINE_EXPORT QList<LogsCall::CallType> allowedCallTypes();
+
+ LOGSENGINE_EXPORT LogsCall::CallType defaultCallType();
+
+ LOGSENGINE_EXPORT static void callToNumber(LogsCall::CallType callType, const QString& number,
+ unsigned int serviceId = 0);
+
+ bool isAllowedCallType();
+
+public slots:
+
+ LOGSENGINE_EXPORT void call(LogsCall::CallType callType);
+ LOGSENGINE_EXPORT void initiateCallback();
+
+private:
+
+ static void createcall(QString service, QString type, QString num, bool sync);
+ static void createCallWithService(QString service, QString type, QString num,
+ bool sync, unsigned int serviceId );
+
+private: //data
+
+ QList<LogsCall::CallType> mCalls;
+ CallType mDefaultCall;
+ QString mNumber;
+ unsigned int mServiceId;
+
+private:
+ friend class UT_LogsCall;
+
+};
+
+#endif // LOGSCALL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/inc/logscommondata.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* 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 LOGSCOMMONDATA_H
+#define LOGSCOMMONDATA_H
+
+#include <qmobilityglobal.h>
+#include "logsevent.h"
+
+QTM_BEGIN_NAMESPACE
+class QContactManager;
+QTM_END_NAMESPACE
+
+QTM_USE_NAMESPACE
+
+/**
+ * Commonly shared data.
+ */
+class LogsCommonData
+{
+ private:
+ explicit LogsCommonData();
+ virtual ~LogsCommonData();
+
+ public:
+ static LogsCommonData& getInstance();
+ static void freeCommonData();
+
+ QContactManager& contactManager();
+
+ /**
+ * Configure maximum number of events. It is possible to
+ * configure that reading is stopped once defined amount
+ * of events of certain direction has been read.
+ */
+ void configureReadSize(
+ int maxSize,
+ LogsEvent::LogsDirection dir = LogsEvent::DirUndefined );
+ /**
+ * Get max read size
+ * @return max number of events, -1 if max num is not configured
+ */
+ int maxReadSize() const;
+ LogsEvent::LogsDirection maxReadSizeDirection() const;
+
+ private:
+
+ QContactManager* mContactManager;
+ int mMaxReadSize;
+ LogsEvent::LogsDirection mMaxReadSizeDir;
+
+ private:
+ friend class UT_LogsCommonData;
+
+};
+
+
+#endif // LOGSCOMMONDATA_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/inc/logscontact.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* 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 LOGSCONTACT_H
+#define LOGSCONTACT_H
+
+#include <QObject>
+#include <qtcontacts.h>
+#include <logsexport.h>
+
+//forward declarations
+class XQServiceRequest;
+class LogsDbConnector;
+class LogsEvent;
+
+QTM_USE_NAMESPACE
+
+/**
+ * LogsContact can be used to modify or create a contact in phonebook
+ *
+ */
+class LogsContact : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum RequestType {
+ TypeLogsContactOpen, //contact is in phonebook, can open it
+ TypeLogsContactSave //contact isn't in phonebook, can save it
+ };
+
+public:
+
+ explicit LogsContact(LogsEvent& event, LogsDbConnector& dbConnector);
+ explicit LogsContact(const QString& number,
+ LogsDbConnector& dbConnector,
+ unsigned int contactId = 0);
+ LOGSENGINE_EXPORT ~LogsContact();
+
+ /**
+ * Returns allowed request type
+ */
+ LOGSENGINE_EXPORT RequestType allowedRequestType();
+
+ bool isContactRequestAllowed();
+
+public slots:
+
+ /**
+ * Launch phonebook view for modification of the contact. Will proceed
+ * only if allowedRequestType() is TypeLogsContactOpen, otherwise returns false.
+ * Emits openCompleted() signal, when contact modifications are done.
+ * @return true if opening was called successfully
+ */
+ LOGSENGINE_EXPORT bool open();
+
+ /**
+ * Launch phonebook view for creation of a new contact.
+ * Emits saveCompleted() signal, when contact saving is done.
+ * @return true if adding was called successfully
+ */
+ LOGSENGINE_EXPORT bool addNew();
+
+ /**
+ * Launch phonebook view for updating of existing contact.
+ * Emits saveCompeted() signal, when contact saving is done.
+ * @return true if updating was called successfully
+ */
+ LOGSENGINE_EXPORT bool updateExisting();
+
+
+signals:
+
+ /**
+ * Indicates that contact modification completed
+ * @param modified true if contact was modified, false - otherwise
+ */
+ void openCompleted(bool modified);
+
+ /**
+ * Indicates that contact saving completed
+ * @param modified true if contact was saved, false - otherwise
+ */
+ void saveCompleted(bool modified);
+
+
+private slots:
+
+ void handleRequestCompleted(const QVariant& result);
+
+
+private:
+
+ /**
+ * Finds contact from phonebook
+ * @return contact
+ */
+ QContact contact();
+
+ /**
+ * Checks whether contact is in phonebook
+ * @return true if contact is in phonebook
+ */
+ bool isContactInPhonebook();
+
+ bool save(QString message);
+
+ bool requestFetchService(QString message,
+ const QList<QVariant> &arguments,
+ bool sync = false );
+
+
+private: //data
+
+ LogsDbConnector& mDbConnector;
+ QContact mContact;
+
+ XQServiceRequest* mService;
+ RequestType mCurrentRequest;
+ QString mNumber;
+ unsigned int mContactId;
+ bool mSaveAsOnlineAccount;
+
+private:
+
+ friend class UT_LogsContact;
+
+};
+
+#endif // LOGSCONTACT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/inc/logsdetailsmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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 LOGSDETAILSMODEL_H
+#define LOGSDETAILSMODEL_H
+
+#include <logsexport.h>
+#include <logsabstractmodel.h>
+#include <QList>
+#include "logsengdefs.h"
+
+class LogsEvent;
+class LogsDbConnector;
+class HbIcon;
+
+/**
+ * Model for log event details.
+ *
+ */
+class LogsDetailsModel : public LogsAbstractModel
+{
+ Q_OBJECT
+
+public:
+
+ explicit LogsDetailsModel( LogsDbConnector& dbConnector, LogsEvent& event );
+
+public: // The exported API
+
+ LOGSENGINE_EXPORT ~LogsDetailsModel();
+
+ LOGSENGINE_EXPORT void clearEvent();
+ LOGSENGINE_EXPORT void getNumberToClipboard();
+
+public: // From QAbstractItemModel
+
+ virtual int rowCount(const QModelIndex &parent) const;
+ virtual QVariant data(const QModelIndex &index, int role) const;
+ virtual QVariant headerData(int section, Qt::Orientation orientation,
+ int role = Qt::DisplayRole) const;
+
+protected: // From LogsAbstractModel
+
+ virtual QVariant createContact(const LogsModelItemContainer& item) const;
+
+private slots:
+
+ void contactActionCompleted(bool modified);
+ void duplicatesRead();
+
+private:
+
+ void getDecorationData(int row, QList<QVariant>& iconList) const;
+ void getDisplayData(int row, QStringList& texts) const;
+ QString getCallerId(const LogsEvent& event) const;
+ QString getHeaderData(const LogsEvent& event) const;
+ QString getRemoteUri(const LogsEvent& event) const;
+ bool isAddress(QString value) const;
+ bool isOutgoingCall() const;
+ QString getHeaderValue(QString value,bool isremote) const;
+ void initContent();
+ void initTexts();
+ void initIcons();
+ void addDateAndTimeTextRow(const LogsEvent& event, bool firstOfMultipleDates = false);
+
+private: //data
+
+ LogsEvent* mEvent;
+ QList<HbIcon*> mDetailIcons;
+ QList<QStringList> mDetailTexts;
+ QList<LogsEvent*> mDuplicates;
+
+private:
+
+ friend class UT_LogsModel;
+ friend class UT_LogsDetailsModel;
+
+
+};
+
+#endif //LOGSDETAILSMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/inc/logsengdefs.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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 LOGSENGDEFS_H
+#define LOGSENGDEFS_H
+
+#include <QString>
+
+
+// CONSTANT LITERALS
+const char logsEmergencyCall911[] = "911"; // Number in event considered to be emergency call
+const char logsEmergencyCall[] = "112"; // Number in event considered to be emergency call (in CDMA
+ // KLogsDataFldTag_Emergency is used instead
+//icons ids
+const char logsVoiceCallIconId[] = "qtg_large_voice_call";
+const char logsVideoCallIconId[] = "qtg_large_video_call";
+const char logsVoipCallIconId[] = "qtg_large_voip";
+
+const char logsRemotePartyInfoIconId[] = "qtg_large_info";
+const char logsCallDurationIconId[] = "qtg_large_callduration";
+const char logsCallDateAndTimeIconId[] = "qtg_large_calendar";
+const char logsThumbUnknownId[] = "qtg_large_avatar";
+
+const char logsDialledVoiceCallIconId[] = "qtg_large_dialled_voice_call";
+const char logsMissedVoiceCallIconId[] = "qtg_large_missed_voice_call";
+const char logsMissedVoiceCallUnseenIconId[] = "qtg_large_missed_voice_call_unseen";
+const char logsReceivedVoiceCallIconId[] = "qtg_large_received_voice_call";
+
+const char logsDialledVideoCallIconId[] = "qtg_large_video_dialled_call";
+const char logsMissedVideoCallIconId[] = "qtg_large_video_missed_call";
+const char logsMissedVideoCallUnseenIconId[] = "qtg_large_missed_video_call_unseen";
+const char logsReceivedVideoCallIconId[] = "qtg_large_video_received_call";
+
+const char logsDialledVoipCallIconId[] = "qtg_large_voip_dialled_call";
+const char logsMissedVoipCallIconId[] = "qtg_large_voip_missed_call";
+const char logsMissedVoipCallUnseenIconId[] = "qtg_large_missed_voip_call_unseen";
+const char logsReceivedVoipCallIconId[] = "qtg_large_voip_received_call";
+
+
+// CONSTANT NUMBERS
+
+const int logsEventALS = 0x4;
+const int logsDeleteCountInit = -1;
+
+const int logsReadSizeCompressEnabled = 20;
+const int logsReadSizeUndefined = -1;
+
+// MACROS
+#define DESC_TO_QSTRING( desc )\
+ QString::fromUtf16( desc.Ptr(), desc.Length() );
+
+#define LOGSENG_PANIC() User::Invariant()
+
+#define LOGSENG_ASSERT( cond )\
+if ( !(cond) ) LOGSENG_PANIC;
+
+// DATA TYPES
+
+class LogsEventStrings
+ {
+public:
+ QString iInDirection; // incoming direction text
+ QString iOutDirection; // outgoing direction text
+ QString iMissedDirection; // missed direction text
+ QString iInDirectionAlt; // Incoming alternate line
+ QString iOutDirectionAlt; // Outgoing alternate line
+ QString iFetched; // Fetched
+ QString iUnKnownRemote; // unknown remote text
+ };
+
+#endif // LOGSENGDEFS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/inc/logseventdata.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* 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 LOGSEVENTDATA_H
+#define LOGSEVENTDATA_H
+
+// INCLUDES
+#include <QString>
+
+// FORWARD DECLARATION
+class CLogEvent;
+
+// CLASS DECLARATION
+
+/**
+ *
+ */
+class LogsEventData
+ {
+
+ public:
+
+ /**
+ * Constructor.
+ */
+ LogsEventData();
+
+ /**
+ * Copy constructor.
+ */
+ LogsEventData( const LogsEventData& data );
+
+ /**
+ * Destructor.
+ */
+ virtual ~LogsEventData();
+
+
+ public:
+
+ /**
+ * Parses event data from given data
+ * @param source data
+ * @return 0 if parsed succesfully
+ **/
+ int parse( const CLogEvent& source );
+
+ bool isCNAP() const;
+ bool isVT() const;
+ bool isPoC() const;
+ bool isVoIP() const;
+ long long dataReceived() const;
+ long long dataSent() const;
+ bool isEmerg() const;
+ int msgPartsNumber() const;
+ unsigned int serviceId() const;
+ QString remoteUrl() const;
+ QString localUrl() const;
+
+ /**
+ * Checks whether event data can be used in CS context.
+ * @return true if CS compatible.
+ */
+ bool isCsCompatible();
+
+ unsigned int contactLocalId() const;
+
+ private:
+
+ void setContactLocalId( unsigned int id );
+
+ private: // data
+
+ // Calling Name Presentation service flag
+ bool mIsCNAP;
+ bool mIsVT;
+ bool mIsPoC;
+ bool mIsVoIP;
+
+ //Flag that indicates whether this is an emergency related event (i.e emerg call)
+ bool mIsEmerg;
+
+ //Sent and received data where applicable (in bytes)
+ long long mDataSent;
+ long long mDataReceived;
+
+ //Message parts. Meaningful only for sms
+ int mMsgPartsNumber;
+
+ unsigned int mServiceId;
+ unsigned int mContactLocalId;
+
+ QString mRemoteUrl;
+ QString mLocalUrl;
+
+ private:
+
+ friend class LogsEventDataParser;
+ friend class LogsEvent;
+
+ private: // Testing related friend definitions
+
+ friend class UT_LogsEventData;
+ friend class UT_LogsEvent;
+ friend class UT_LogsEventParser;
+ friend class UT_LogsEventDataParser;
+ friend class UT_LogsCall;
+ friend class UT_LogsContact;
+ friend class UT_LogsMessage;
+ friend class UT_LogsDetailsModel;
+ friend class UT_LogsModel;
+ friend class UT_LogsCustomFilter;
+ friend class UT_LogsMatchesModel;
+
+ };
+
+#endif // LOGSEVENTDATA_H
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/inc/logsmatchesmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* 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 LOGSMATCHESMODEL_H
+#define LOGSMATCHESMODEL_H
+
+#include <logsexport.h>
+#include <logsabstractmodel.h>
+#include "logsengdefs.h"
+
+class LogsEvent;
+class LogsDbConnector;
+class LogsCntFinder;
+class LogsCntEntry;
+class LogsContact;
+class LogsMatchesModelItemContainer;
+class LogsThumbIconManager;
+typedef QObject LogsCntEntryHandle;
+
+/**
+ * Model for log event details.
+ *
+ */
+class LogsMatchesModel : public LogsAbstractModel
+{
+ Q_OBJECT
+
+public:
+
+ explicit LogsMatchesModel( LogsAbstractModel& parentModel,
+ LogsDbConnector& dbConnector );
+
+public: // The exported API
+
+ LOGSENGINE_EXPORT ~LogsMatchesModel();
+ LOGSENGINE_EXPORT void logsMatches(const QString& pattern);
+
+ /**
+ * Factory method for creating a new contact object. Transfers ownership.
+ */
+ LOGSENGINE_EXPORT LogsContact* createContact(const QString& number);
+
+ /**
+ * 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
+ */
+ LOGSENGINE_EXPORT 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
+ */
+ LOGSENGINE_EXPORT int setPredictiveSearch(bool enabled);
+
+public: // From QAbstractItemModel
+
+ virtual int rowCount(const QModelIndex &parent) const;
+ virtual QVariant data(const QModelIndex &index, int role) const;
+
+public: // From LogsAbstractModel
+
+ virtual QVariant createCall(const LogsModelItemContainer& item) const;
+ virtual QVariant createMessage(const LogsModelItemContainer& item) const;
+ virtual QVariant createContact(const LogsModelItemContainer& item) const;
+
+
+private slots:
+
+ void queryReady();
+ void updateContactIcon(int index);
+
+ void eventsUpdated(const QModelIndex& first, const QModelIndex& last);
+ void eventsAdded(const QModelIndex& parent, int first, int last);
+ void eventsRemoved(const QModelIndex& parent, int first, int last);
+
+ void doSearchQuery();
+ void doModelReset();
+ void forceSearchQuery();
+
+private:
+
+ void initPredictiveSearch();
+
+ LogsMatchesModelItemContainer* addSearchResult(int resultIndex);
+ bool updateSearchResult(LogsMatchesModelItemContainer& item) const;
+ void readEvents(int first, int last);
+ void getLogsMatches( const QString& pattern, bool async = false, bool force = false );
+ void updateSearchEntry(LogsCntEntry& entry, LogsEvent& event);
+ QString stripPhoneNumber(const QString& phoneNumber) const;
+
+private: //data
+
+ LogsAbstractModel& mParentModel;
+ LogsCntFinder* mLogsCntFinder;
+
+ QList<LogsMatchesModelItemContainer*> mMatches;
+ QMap<LogsCntEntryHandle*, LogsEvent*> mSearchEvents;
+
+ QString mCurrentSearchPattern;
+ QString mPrevSearchPattern;
+ LogsThumbIconManager *mIconManager;
+ bool mSearchEnabled;
+ int mResultCount;
+
+private:
+
+ friend class UT_LogsModel;
+ friend class UT_LogsMatchesModel;
+
+};
+
+/**
+ * Contains log event or contact match
+ */
+class LogsMatchesModelItemContainer : public LogsModelItemContainer {
+public:
+ LogsMatchesModelItemContainer(LogsAbstractModel& parentModel,
+ LogsThumbIconManager& mIconManager,
+ int resultIndex);
+ virtual ~LogsMatchesModelItemContainer();
+
+ void setEvent(const LogsEvent& event);
+ void setContact(unsigned int contactId);
+ unsigned int contact() const;
+ QString number() const;
+ QString contactName() const;
+ bool isNull() const;
+ bool isEventMatch() const;
+ QStringList texts();
+ QList<QVariant> icons(int row);
+ void updateData(const LogsCntEntry& entry);
+ int resultIndex() const;
+
+private:
+
+ QString getFormattedCallerId(const LogsCntEntry& entry) const;
+ void getFormattedContactInfo(
+ const LogsCntEntry& entry, QString& contactName, QString& contactNumber ) const;
+
+private:
+
+ LogsAbstractModel& mParentModel;
+ unsigned int mContactId;
+ QString mContactName;
+ QString mContactNumber;
+ QString mAvatarPath;
+ QString mFormattedCallerId;
+ LogsThumbIconManager& mIconManager;
+ int mResultIndex;
+
+private:
+
+ friend class UT_LogsMatchesModel;
+};
+
+#endif //LOGSMATCHESMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/inc/logsmessage.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* 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 LOGSMESSAGE_H
+#define LOGSMESSAGE_H
+
+
+#include <QObject>
+#include <logsexport.h>
+
+#include "logsevent.h"
+
+class XQServiceRequest;
+
+/**
+ * LogsMessage can be used to send message.
+ */
+class LogsMessage : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ explicit LogsMessage(LogsEvent& aEvent);
+ explicit LogsMessage(unsigned int contactId, const QString& number, const QString& displayName);
+ LOGSENGINE_EXPORT ~LogsMessage();
+
+ LOGSENGINE_EXPORT static bool sendMessageToNumber(
+ const QString& number, const QString& displayName = QString(), unsigned int contactId = 0);
+
+ bool isMessagingAllowed();
+
+public slots:
+
+ /**
+ * Send message
+ * @return true if sent succesfully
+ */
+ LOGSENGINE_EXPORT bool sendMessage();
+
+protected slots:
+ void requestCompleted(const QVariant& value);
+ void requestError(int err);
+
+private:
+ static bool doSendMessageToNumber(
+ XQServiceRequest& request, const QString& number,
+ const QString& displayName, unsigned int contactId);
+
+private: //data
+
+ bool mIsAllowed;
+ QString mNumber;
+ unsigned int mContactId;
+ QString mDisplayName;
+ XQServiceRequest* mService;
+private:
+ friend class UT_LogsMessage;
+
+};
+
+#endif // LOGSMESSAGE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/inc/logsthumbnailmanager.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* 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: Music Player collection album art manager.
+*
+*/
+
+
+#ifndef LOGSTHUMBNAILMANAGER_H
+#define LOGSTHUMBNAILMANAGER_H
+
+#include <QObject>
+#include <qcache.h>
+#include <QMap>
+#include <QQueue>
+#include <QPair>
+#include <QIcon>
+#include <QTimer>
+
+class ThumbnailManager;
+class HbIcon;
+
+class LogsThumbIconManager : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ explicit LogsThumbIconManager(QObject *parent=0);
+ virtual ~LogsThumbIconManager();
+
+ QIcon& contactIcon(const QString &avatarPath, int index);
+ void cancel();
+ QIcon& defaultIcon();
+
+signals:
+ void contactIconReady(int index);
+
+public slots:
+ void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error);
+ void thumbnailLoad();
+ void timerTimeout();
+
+private:
+ ThumbnailManager *mThumbnailManager;
+ QCache<QString, QIcon> mImageCache;
+ QMap<int, QString> mTnmReqMap;
+
+ QQueue< QPair<QString, int> > mRequestQueue;
+ int mQueueCount;
+ QTimer* mTimer;
+ HbIcon* mDefaultIcon;
+
+private:
+
+ friend class UT_LogsMatchesModel;
+ friend class UT_LogsThumbnailManager;
+
+};
+
+#endif // LOGSTHUMBNAILMANAGER_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logsengine.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,96 @@
+#
+# 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 = lib
+
+TARGET = logsengine
+CONFIG += hb dll svg
+RESOURCES += logsengine.qrc
+
+INCLUDEPATH += ./
+INCLUDEPATH += ./inc
+INCLUDEPATH += ./logssymbianos
+INCLUDEPATH += ./logssymbianos/inc
+INCLUDEPATH += ../inc
+INCLUDEPATH += ../logscntfinder/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+
+# Input
+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/logsevent.h
+HEADERS += ../../recents_plat/logs_engine_api/inc/logsfilter.h
+HEADERS += ../../recents_plat/logs_engine_api/inc/logscustomfilter.h
+HEADERS += inc/logsdetailsmodel.h
+HEADERS += inc/logsmatchesmodel.h
+HEADERS += inc/logsengdefs.h
+HEADERS += inc/logscall.h
+HEADERS += inc/logscontact.h
+HEADERS += inc/logsmessage.h
+HEADERS += inc/logseventdata.h
+HEADERS += inc/logsthumbnailmanager.h
+HEADERS += inc/logscommondata.h
+HEADERS += logssymbianos/inc/logsdbconnector.h
+HEADERS += logssymbianos/inc/logsreader.h
+HEADERS += logssymbianos/inc/logsreaderstates.h
+HEADERS += logssymbianos/inc/logsreaderstatecontext.h
+HEADERS += logssymbianos/inc/logseventparser.h
+HEADERS += logssymbianos/inc/logseventdataparser.h
+HEADERS += logssymbianos/inc/logsremove.h
+
+SOURCES += src/logsfilter.cpp
+SOURCES += src/logsabstractmodel.cpp
+SOURCES += src/logsmodel.cpp
+SOURCES += src/logsdetailsmodel.cpp
+SOURCES += src/logsmatchesmodel.cpp
+SOURCES += src/logscall.cpp
+SOURCES += src/logscontact.cpp
+SOURCES += src/logsmessage.cpp
+SOURCES += src/logsevent.cpp
+SOURCES += src/logseventdata.cpp
+SOURCES += src/logscustomfilter.cpp
+SOURCES += src/logsthumbnailmanager.cpp
+SOURCES += src/logscommondata.cpp
+SOURCES += logssymbianos/src/logsdbconnector.cpp
+SOURCES += logssymbianos/src/logsreader.cpp
+SOURCES += logssymbianos/src/logsreaderstates.cpp
+SOURCES += logssymbianos/src/logseventparser.cpp
+SOURCES += logssymbianos/src/logseventdataparser.cpp
+SOURCES += logssymbianos/src/logsremove.cpp
+
+DEFINES += LOGSENGINE_LIB
+
+libFiles.sources = logsengine.dll
+libFiles.path = "!:/sys/bin"
+DEPLOYMENT += libFiles
+
+symbian: {
+ TARGET.UID2 = 0x1000008d
+ TARGET.UID3 = 0x10282CE2
+
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCALLOWDLLDATA = 1
+ LIBS += -lflogger -llogcli -llogwrap -lefsrv -lxqservice -lqtcontacts -llogscntfinder -lthumbnailmanagerqt -lcentralrepository
+
+ defFiles = "$${LITERAL_HASH}ifdef WINS" \
+ "DEFFILE bwins/logsengine.def" \
+ "$${LITERAL_HASH}else" \
+ "DEFFILE eabi/logsengine.def" \
+ "$${LITERAL_HASH}endif"
+ MMP_RULES += defFiles
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logsengine.qrc Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC><RCC version="1.0">
+ <qresource prefix="/" >
+ <file>themes/icons/hbdefault/scalable/qtg_large_missed_voice_call_unseen.svg</file>
+ <file>themes/icons/hbdefault/scalable/qtg_large_missed_video_call_unseen.svg</file>
+ <file>themes/icons/hbdefault/scalable/qtg_large_missed_voip_call_unseen.svg</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/inc/logsdbconnector.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,247 @@
+/*
+* 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 LOGSDBCONNECTOR_H
+#define LOGSDBCONNECTOR_H
+
+// INCLUDES
+#include <QObject>
+#include "logsengdefs.h"
+#include "logsreaderobserver.h"
+#include "logsremoveobserver.h"
+#include "logsmodel.h"
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CLogClient;
+class LogsReader;
+class LogsEvent;
+class LogsRemove;
+class RFs;
+class CRepository;
+
+// CLASS DECLARATIONS
+
+
+/**
+ * LogsDbConnector is used to initialize database access
+ */
+class LogsDbConnector :
+ public QObject, public LogsReaderObserver, public LogsRemoveObserver
+ {
+ Q_OBJECT
+
+ public:
+
+ /**
+ * Constructor
+ * @param events, connector fills the array with events
+ * read from database. Ownership of events is not transferred.
+ * @param checkAllEvents, true if interested in all events of the database,
+ * false if interested only in recent events
+ */
+ LogsDbConnector( QList<LogsEvent*>& events, bool checkAllEvents = false, bool resourceControl = false );
+ ~LogsDbConnector();
+
+ signals:
+
+ /**
+ * Signaled once some new data has been read from database.
+ * Added data is placed to event array already when this signal
+ * is emitted.
+ * @param addedIndexes, indexes for new events
+ */
+ void dataAdded(QList<int> addedIndexes);
+
+ /**
+ * Signaled once some data has been updated.
+ * Corresponding events have been already updated at event array
+ * when this signal is emitted.
+ * @param updatedIndexes, indexes for updated events
+ */
+ void dataUpdated(QList<int> updatedIndexes);
+
+ /**
+ * Signaled once some data has been removed.
+ * Corresponding events have been already removed from event array
+ * when this signal is emitted.
+ * @param removedIndexes, indexes for removed events
+ */
+ void dataRemoved(QList<int> removedIndexes);
+
+ /**
+ * Signaled once asycn event clearing has completed.
+ * @param err, 0 if marking completed succesfully
+ */
+ void clearingCompleted(int err);
+
+ /**
+ * Signaled once asycn event marking has completed.
+ * @param err, 0 if marking completed succesfully
+ */
+ void markingCompleted(int err);
+
+ /**
+ * Signaled once duplicate reading has completed.
+ */
+ void duplicatesRead();
+
+ public:
+
+ /**
+ * Initialize database access
+ * @return 0 if initialized succesfully
+ */
+ int init();
+
+ /**
+ * Start reading data from database
+ * @return 0 if reading started succesfully
+ */
+ int start();
+
+ /**
+ * Synchronously updates details (rematches from phonebook) for
+ * already read events
+ * @param clearCached if true, cached matches will be cleaned before
+ * rematching
+ */
+ int updateDetails(bool clearCached);
+
+ /**
+ * Clear events of defined type. Clearing is async and completion is
+ * indicated by clearingCompleted signal.
+ * @return true if async clearing started
+ */
+ bool clearList(LogsModel::ClearType cleartype);
+
+ /**
+ * Starts removing events and all their duplicates. Clearing
+ * can be sync or async. In case of async, completion is
+ * indicated by clearingCompleted signal.
+ * @param eventIds, ids of the events to be removed
+ * @return true if async clearing started
+ */
+ bool clearEvents(const QList<int>& eventIds);
+
+ /**
+ * Mark events as seen. Completion is indicated by
+ * markingCompleted signal.
+ * @param eventIds, ids of the events to be marked
+ * @return true if marking started
+ */
+ bool markEventsSeen(const QList<int>& eventIds);
+
+ /**
+ * 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
+ */
+ int readDuplicates(int eventId);
+
+ /**
+ * Take current duplicates.
+ * @return list of duplicate events, ownership is transferred
+ */
+ QList<LogsEvent*> takeDuplicates();
+
+ 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
+
+ virtual void readCompleted(int readCount);
+ virtual void errorOccurred(int err);
+ virtual void temporaryErrorOccurred(int err);
+ virtual void eventModifyingCompleted();
+ virtual void duplicatesReadingCompleted(QList<LogsEvent*> duplicates);
+
+ protected: // From LogsRemoveObserver
+ virtual void removeCompleted();
+ virtual void logsRemoveErrorOccured(int err);
+
+ private:
+ void initL();
+ void handleTemporaryError(int& error);
+ void deleteRemoved(int newEventCount);
+ int doMarkEventSeen();
+ bool handleModifyingCompletion(int err=0);
+
+ private: // data
+
+ QList<LogsEvent*>& mModelEvents;
+ bool mCheckAllEvents;
+ bool mResourceControl;
+ CLogClient* mLogClient;
+ LogsEventStrings mLogEventStrings;
+ RFs* mFsSession;
+ LogsReader* mReader;
+ LogsRemove* mLogsRemove;
+ CRepository* mRepository;
+ bool mCompressionEnabled;
+
+ QList<LogsEvent*> mEvents;
+ QList<LogsEvent*> mDuplicatedEvents;
+ QList<int> mRemovedEventIndexes;
+ QList<int> mUpdatedEventIndexes;
+ QList<int> mAddedEventIndexes;
+ QList<int> mEventsSeen;
+
+ private: // Testing related friend definitions
+
+ friend class UT_LogsDbConnector;
+ friend class UT_LogsRemove;
+ friend class UT_LogsModel;
+ friend class UT_LogsDetailsModel;
+
+ };
+
+
+#endif
+
+// End of File LOGSDBCONNECTOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/inc/logseventdataparser.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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 LOGSEVENTDATAPARSER_H
+#define LOGSEVENTDATAPARSER_H
+
+// INCLUDES
+#include <QObject>
+
+// FORWARD DECLARATION
+class LogsEventData;
+class CLogEvent;
+class TDesC8;
+
+// CLASS DECLARATION
+
+/**
+ *
+ */
+class LogsEventDataParser
+ {
+ public:
+
+ /**
+ * Parses event data from given data
+ * @param source
+ * @param dest
+ * @return 0 if parsed succesfully
+ **/
+ static int parse( const CLogEvent& source, LogsEventData& dest );
+
+ private:
+
+ static bool checkNonTaggedData( const TDesC8 &data, LogsEventData& dest );
+ static void checkTaggedData( const TDesC8 &data, LogsEventData& dest );
+ static void setMsgPartsNumber( const TDesC8 &data, LogsEventData& dest );
+
+ private: // Testing related friend class definitions
+
+ friend class UT_LogsEventDataParser;
+
+ };
+
+#endif // LOGSEVENTDATAPARSER_H
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/inc/logseventparser.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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 LOGSEVENTPARSER_H
+#define LOGSEVENTPARSER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <logwrap.h>
+
+// FORWARD DECLARATION
+class CPhCltEmergencyCall;
+class LogsEventData;
+class LogsEventStrings;
+class LogsEvent;
+
+// CLASS DECLARATION
+
+/**
+ *
+ */
+class LogsEventParser
+ {
+ public:
+
+ /**
+ * Parses the event and fills parsed data to given dest event.
+ * Event state and view status are updated automatically at
+ * this phase.
+ * @param source, source event
+ * @param dest, destination event
+ * @param strings, list of strings used for comparison
+ */
+ static void parseL( const CLogEvent& source,
+ LogsEvent& dest,
+ const LogsEventStrings& strings );
+
+ private:
+
+ /**
+ * Resolve event type based on available information.
+ */
+ static void resolveEventType(LogsEvent& dest);
+
+ static void eventTypeSpecificParsing(LogsEvent& dest);
+
+ static bool isUnknownRemoteParty(LogsEvent& dest, const QString& remoteParty);
+
+ private: // Testing related friend class definitions
+
+ friend class UT_LogsEventParser;
+ };
+
+#endif // LOGSEVENTPARSER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/inc/logsforegroundwatcher.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef LOGSFOREGROUNDWATCHER_H
+#define LOGSFOREGROUNDWATCHER_H
+
+
+#include <QObject>
+#include <coemain.h>
+
+class LogsForegroundWatcher : public QObject, public MCoeForegroundObserver
+{
+ Q_OBJECT
+
+public:
+
+ LogsForegroundWatcher(QObject* parent = 0);
+ virtual ~LogsForegroundWatcher(){}
+
+signals:
+ void gainingForeground();
+ void losingForeground();
+
+public: // from MCoeForegroundObserver
+ void HandleGainingForeground();
+ void HandleLosingForeground();
+
+};
+
+#endif //LOGSFOREGROUNDWATCHER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/inc/logsreader.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,218 @@
+/*
+* 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 LOGSREADER_H
+#define LOGSREADER_H
+
+// INCLUDES
+#include <QList>
+#include <QHash>
+#include <e32base.h>
+#include <logclientchangeobserver.h>
+#include <logviewchangeobserver.h>
+#include "logsreaderstatecontext.h"
+#include "logsreaderstates.h"
+
+// FORWARD DECLARATION
+class CLogViewRecent;
+class RFs;
+class CLogClient;
+class CLogViewEvent;
+class LogsReaderObserver;
+class LogsEvent;
+class LogsEventStrings;
+class LogsReaderStateFiltering;
+
+// CLASS DECLARATION
+
+
+
+/**
+ * LogsReader is used to read events from database
+ */
+class LogsReader : public CActive,
+ public MLogClientChangeObserver,
+ public MLogViewChangeObserver,
+ public LogsReaderStateContext
+ {
+
+ friend class UT_LogsReader;
+ friend class UT_LogsDbConnector;
+
+ public:
+
+ /**
+ * Constructor
+ * @param fsSession, connected fileserver session
+ * @param logClient
+ * @param strings, commonly used strings
+ * @param events, filled with events once reading progresses
+ * @param observer, information about read progress is notified
+ * via the interface
+ * @param readAllEvents, true if all events in db should be read,
+ * otherwise only recent events are read
+ */
+ LogsReader( RFs& fsSession,
+ CLogClient& logClient,
+ LogsEventStrings& strings,
+ QList<LogsEvent*>& events,
+ LogsReaderObserver& observer,
+ bool readAllEvents = false );
+
+ /**
+ * Destructor.
+ */
+ virtual ~LogsReader();
+
+
+
+ public:
+
+ /**
+ * Start reading
+ * @return 0 if reading started succesfully
+ */
+ int start();
+
+ /**
+ * Stop reading
+ */
+ void stop();
+
+ /**
+ * Synchronously update details (rematches from phonebook) for
+ * already read events
+ * @param clearCached if true, cached matches will be cleaned before
+ * rematching
+ */
+ void updateDetails(bool clearCached);
+
+ /**
+ * Starts modifying the event and all its duplicates as read
+ * @param eventId, id of the event to be removed
+ * @return 0 if removing started succesfully
+ */
+ int markEventSeen(int eventId);
+
+ /**
+ * Starts reading duplicates of the event
+ * @param eventId
+ * @return 0 if removing started succesfully
+ */
+ int readDuplicates(int eventId);
+
+ protected: // From CActive
+
+ void RunL();
+ void DoCancel();
+ TInt RunError(TInt error);
+
+ private: // From MLogClientChangeObserver
+
+ void HandleLogClientChangeEventL( TUid aChangeType,
+ TInt aChangeParam1,
+ TInt aChangeParam2,
+ TInt aChangeParam3 );
+ private: // From MLogViewChangeObserver
+
+ void HandleLogViewChangeEventAddedL(
+ TLogId aId, TInt aViewIndex,
+ TInt aChangeIndex, TInt aTotalChangeCount);
+
+ void HandleLogViewChangeEventChangedL(
+ TLogId aId, TInt aViewIndex,
+ TInt aChangeIndex, TInt aTotalChangeCount);
+
+ void HandleLogViewChangeEventDeletedL(
+ TLogId aId, TInt aViewIndex,
+ TInt aChangeIndex, TInt aTotalChangeCount);
+
+ private: // From LogsReaderStateContext
+
+ inline void setCurrentState(const LogsReaderStateBase& state);
+ inline CLogView& logView();
+ inline CLogViewDuplicate& duplicatesView();
+ inline QList<LogsEvent*>& events();
+ inline int& index();
+ inline LogsEventStrings& strings();
+ inline TRequestStatus& reqStatus();
+ inline LogsReaderObserver& observer();
+ inline QHash<QString, ContactCacheEntry>& contactCache();
+ inline int currentEventId();
+ inline CLogClient& logClient();
+ inline bool isRecentView();
+ inline QList<LogsEvent*>& duplicatedEvents();
+
+ private:
+
+ void startL();
+ void markEventSeenL(int eventId);
+ void readDuplicatesL(int eventId);
+
+ /**
+ * Cancel all outstanding requests if possible. In case of deleting is
+ * in progress, it will leave with error
+ */
+ void cancelCurrentRequestL();
+ LogsReaderStateBase& currentState();
+ void initializeReadStates();
+ void initializeModifyingStates();
+ void initializeDuplicateReadingStates();
+ void handleViewChange( int totalChangeCount = 1 );
+ void handleError(int error);
+ void createLogViewsL();
+ void deleteLogViews();
+ LogsReaderStateFiltering* createFilteringState();
+ void prepareReadingL();
+ void setGlobalObserver();
+ void clearGlobalObserver();
+
+ private: // data
+
+ CLogViewRecent* mLogViewRecent;
+ CLogViewEvent* mLogViewEvent;
+ CLogViewDuplicate* mDuplicatesView;
+
+ RFs& mFsSession;
+ CLogClient& mLogClient;
+ LogsEventStrings& mStrings;
+ QList<LogsEvent*>& mEvents;
+ LogsReaderObserver& mObserver;
+ bool mReadAllEvents;
+
+ int mIndex;
+ QList<LogsReaderStateBase*> mReadStates;
+ QList<LogsReaderStateBase*> mModifyingStates;
+ QList<LogsReaderStateBase*> mDuplicateReadingStates;
+ int mCurrentStateIndex;
+ QList<LogsReaderStateBase*>* mCurrentStateMachine;
+
+ QHash<QString, ContactCacheEntry> mContactCache;
+ QList<LogsEvent*> mDuplicatedEvents;
+
+ int mCurrentEventId;
+ bool mGlobalObserverSet;
+ };
+
+#endif // LOGSREADER_H
+
+
+// End of File
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/inc/logsreaderobserver.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* 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 LOGSREADEROBSERVER_H
+#define LOGSREADEROBSERVER_H
+
+// INCLUDES
+#include <QList>
+
+// FORWARD DECLARATION
+class LogsEvent;
+
+// CLASS DECLARATION
+
+/**
+ * Reader observer interface
+ */
+class LogsReaderObserver
+ {
+
+ public:
+
+ /**
+ * Reader has completed reading.
+ */
+ virtual void readCompleted(int readCount) = 0;
+
+ /**
+ * Error occured while reading.
+ * @param err
+ */
+ virtual void errorOccurred(int err) = 0;
+
+ /**
+ * Temporary error occured while reading.
+ * It should be possible to continue reading at some point.
+ * @param err
+ */
+ virtual void temporaryErrorOccurred(int err) = 0;
+
+ /**
+ * Reader has completed modifying the event.
+ */
+ virtual void eventModifyingCompleted() = 0;
+
+ /**
+ * Duplicate reading has completed
+ * @param duplicates, list of read duplicates, onwership is transferred
+ */
+ virtual void duplicatesReadingCompleted(QList<LogsEvent*> duplicates) = 0;
+ };
+
+#endif // LOGSREADER_H
+
+
+// End of File
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/inc/logsreaderstatecontext.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* 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 LOGSREADERSTATECONTEXT_H
+#define LOGSREADERSTATECONTEXT_H
+
+// INCLUDES
+#include <QList>
+#include <QHash>
+
+// FORWARD DECLARATION
+class LogsReaderStateBase;
+class CLogView;
+class CLogViewDuplicate;
+class CLogViewEvent;
+class LogsEvent;
+class LogsEventStrings;
+class TRequestStatus;
+class LogsReaderObserver;
+class CLogClient;
+
+// CLASS DECLARATION
+
+class ContactCacheEntry
+{
+public:
+ inline ContactCacheEntry() : mRemoteParty(QString()), mContactLocalId(0) {}
+ inline ContactCacheEntry( const ContactCacheEntry& entry );
+ inline ContactCacheEntry(QString remoteParty, unsigned int contactId);
+
+ QString mRemoteParty;
+ unsigned int mContactLocalId;
+};
+
+
+/**
+ * Context for reader state machine
+ */
+class LogsReaderStateContext {
+ public:
+
+ /**
+ * Change state
+ * @param state, new state
+ */
+ virtual void setCurrentState(const LogsReaderStateBase& state) = 0;
+
+ /**
+ * Get log view
+ * @return current log view
+ */
+ virtual CLogView& logView() = 0;
+
+ /**
+ * Get duplicates view
+ * @return current duplicates view
+ */
+ virtual CLogViewDuplicate& duplicatesView() = 0;
+
+ /**
+ * Get event container
+ * @return events
+ */
+ virtual QList<LogsEvent*>& events() = 0;
+
+ /**
+ * Get view index
+ * @return ref to view index
+ */
+ virtual int& index() = 0;
+
+ /**
+ * Get commonly used strings
+ * @return strings
+ */
+ virtual LogsEventStrings& strings() = 0;
+
+ /**
+ * Request status for async operations
+ * inside states
+ * @return reqstatus
+ */
+ virtual TRequestStatus& reqStatus() = 0;
+
+ /**
+ * Get observer
+ * @return observer
+ */
+ virtual LogsReaderObserver& observer() = 0;
+
+ /**
+ * Get contact cache
+ * @return cache (key:telnum, value:contactname)
+ */
+ virtual QHash<QString, ContactCacheEntry>& contactCache() = 0;
+
+ /**
+ * Get ID of the event to be handled
+ * @return ID of the event
+ */
+ virtual int currentEventId() = 0;
+
+ /**
+ * Get log client
+ * @return log client
+ */
+ virtual CLogClient& logClient() = 0;
+
+ /**
+ * Check if current view is recent view.
+ * @return true if recent view
+ */
+ virtual bool isRecentView() = 0;
+
+ /**
+ * Get event container for duplicated events
+ * @return duplicated events
+ */
+ virtual QList<LogsEvent*>& duplicatedEvents() = 0;
+};
+
+
+
+inline ContactCacheEntry::ContactCacheEntry( const ContactCacheEntry& entry )
+{
+ mRemoteParty = entry.mRemoteParty;
+ mContactLocalId = entry.mContactLocalId;
+}
+
+inline ContactCacheEntry::ContactCacheEntry(QString remoteParty, unsigned int contactId)
+{
+ mRemoteParty = remoteParty;
+ mContactLocalId = contactId;
+}
+
+#endif // LOGSREADERSTATECONTEXT_H
+
+
+// End of File
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/inc/logsreaderstates.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,372 @@
+/*
+* 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 LOGSREADERSTATES_H
+#define LOGSREADERSTATES_H
+
+// INCLUDES
+#include <e32std.h>
+#include <logclientchangeobserver.h>
+#include <logviewchangeobserver.h>
+
+// FORWARD DECLARATION
+class LogsReaderStateContext;
+class LogsEvent;
+class CLogViewEvent;
+class CLogFilterList;
+class CLogFilter;
+class CLogEvent;
+
+// CLASS DECLARATION
+
+/**
+ * Reader state base
+ */
+class LogsReaderStateBase {
+
+ friend class UT_LogsReaderStates;
+ friend class UT_LogsReader;
+
+ public:
+
+ /**
+ * Destructor
+ */
+ virtual ~LogsReaderStateBase();
+
+ /**
+ * Set next state to be used once this state has completed.
+ * @param nextState
+ */
+ void setNextState(LogsReaderStateBase& nextState);
+
+ /**
+ * Enter to the state, may proceed immediately to next state.
+ * @return true if entering started async operation, false if not
+ */
+ virtual bool enterL();
+
+ /**
+ * Continue running in the state, may proceed to next state
+ * @return true if continue started async operation, false if not
+ */
+ virtual bool continueL();
+
+ protected:
+
+ /**
+ * Constructor
+ */
+ LogsReaderStateBase(LogsReaderStateContext& context);
+
+ /**
+ * Proceed to next state if such exists.
+ * @return true if entering started async operation, false if not
+ */
+ virtual bool enterNextStateL();
+
+ /**
+ * Get number of events in view
+ * @return view count
+ */
+ int viewCountL() const;
+
+ /**
+ * Get current event
+ * @return event
+ */
+ CLogEvent& event() const;
+
+ /**
+ * Fill dest event with source event data and insert to specified
+ * place in events list.
+ * @param source event
+ * @param dest event, ownership is transferred
+ * @param index, increased if event was added
+ * @param events, event is possibly added to this list
+ * @return true if dest event was inserted, false if discarded and deleted
+ */
+ bool constructAndInsertEventL(
+ const CLogEvent& source, LogsEvent* dest, int &eventIndex, QList<LogsEvent*>& events );
+
+ /**
+ * Fill already used dest event with source event data and insert
+ * to specified place in events list.
+ * @param source event
+ * @param dest event, ownership is transferred
+ * @param index, increased if event was added
+ * @return true if dest event was inserted, false if discarded and deleted
+ */
+ bool updateAndInsertEventL(
+ const CLogEvent& source, LogsEvent* dest, int &eventIndex );
+
+ /**
+ * Reset current events
+ */
+ void resetEvents();
+
+ /**
+ * Try to find matching event and remove it from
+ * events list.
+ * @param event, symbian log event
+ * @return LogsEvent or 0 if no matching found, ownership is transferred
+ */
+ LogsEvent* takeMatchingEvent(const CLogEvent& event);
+
+ /**
+ * Finds specified event from the event list. Event not removed from the list.
+ * @param eventId, id of the event to be found
+ * @return pointer to event or 0 if not found
+ */
+ LogsEvent* eventById(int eventId);
+
+ /**
+ * Try to search duplicates for current event in the view
+ * @param aFilter, filter to be used for searching duplicates
+ * @return true, if duplicates are searched
+ */
+ bool duplicatesL(const CLogFilter* aFilter = 0);
+
+ protected:
+ LogsReaderStateContext& mContext;
+ LogsReaderStateBase* mNextState;
+ int mStateIndex;
+};
+
+/**
+ * Initialize reading state
+ */
+class LogsReaderStateInitReading : public LogsReaderStateBase {
+
+ friend class UT_LogsReaderStates;
+
+ public:
+ LogsReaderStateInitReading(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateInitReading(){}
+
+ public: // From LogsReaderStateBase
+ virtual bool enterL();
+ };
+
+/**
+ * Filtering recent state
+ */
+class LogsReaderStateFiltering : public LogsReaderStateBase {
+
+ friend class UT_LogsReaderStates;
+
+ public:
+ LogsReaderStateFiltering(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateFiltering();
+
+ public: // From LogsReaderStateBase
+ virtual bool enterL();
+ virtual bool continueL();
+
+ protected:
+ /**
+ * Setting filter for view, derived class may add special filtering
+ * at this stage.
+ */
+ virtual bool setFilterL(CLogFilterList& filterList);
+
+ protected:
+ CLogFilterList* mFilterList;
+ };
+
+/**
+ * Filtering all state
+ */
+class LogsReaderStateFilteringAll : public LogsReaderStateFiltering {
+
+ friend class UT_LogsReaderStates;
+
+ public:
+ LogsReaderStateFilteringAll(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateFilteringAll();
+
+ protected: // From LogsReaderStateFiltering
+ virtual bool setFilterL(CLogFilterList& filterList);
+ };
+
+/**
+ * Reading state
+ */
+class LogsReaderStateReading : public LogsReaderStateBase {
+
+ friend class UT_LogsReaderStates;
+
+ public:
+ LogsReaderStateReading(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateReading();
+
+ public: // From LogsReaderStateBase
+ virtual bool enterL();
+ virtual bool continueL();
+
+ protected:
+ bool handleMissedL(LogsEvent& parsedEvent);
+ void updateReadSizeCounter(LogsEvent& event);
+ bool canContinueReadingL(int index) const;
+
+ protected:
+ CLogFilter* mDuplicateMissedFilter;
+ bool mCheckingMissed;
+ int mEventIndex;
+ int mReadSizeCounter;
+};
+
+/**
+ * Fill missing information state
+ */
+class LogsReaderStateFillDetails : public LogsReaderStateBase {
+ public:
+ LogsReaderStateFillDetails(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateFillDetails();
+
+ /**
+ * Synchronously fills details from phonebook
+ */
+ void fillDetails();
+
+ public: // From LogsReaderStateBase
+ virtual bool enterL();
+};
+
+/**
+ * Completed state
+ */
+class LogsReaderStateDone : public LogsReaderStateBase {
+ public:
+ LogsReaderStateDone(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateDone();
+
+ public: // From LogsReaderStateBase
+ virtual bool enterL();
+};
+
+
+/**
+ * Searching event state
+ */
+class LogsReaderStateSearchingEvent : public LogsReaderStateBase
+{
+ friend class UT_LogsReaderStates;
+
+ public:
+ LogsReaderStateSearchingEvent(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateSearchingEvent(){}
+
+ public: // From LogsReaderStateBase
+ virtual bool enterL();
+ virtual bool continueL();
+};
+
+/**
+ * Finding duplicate events state
+ */
+class LogsReaderStateFindingDuplicates : public LogsReaderStateBase
+{
+ friend class UT_LogsReaderStates;
+
+ public:
+ LogsReaderStateFindingDuplicates(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateFindingDuplicates();
+
+ public: // From LogsReaderStateBase
+ virtual bool enterL();
+ virtual bool continueL();
+
+ protected:
+ CLogFilter* mDuplicateFilter;
+};
+
+/**
+ * Marking duplicate events state
+ */
+class LogsReaderStateMarkingDuplicates : public LogsReaderStateBase
+{
+ friend class UT_LogsReaderStates;
+
+ public:
+ LogsReaderStateMarkingDuplicates(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateMarkingDuplicates(){}
+
+ public: // From LogsReaderStateBase
+ virtual bool enterL();
+ virtual bool continueL();
+
+ protected:
+ bool mGettingDuplicates;
+};
+
+/**
+ * Marking duplicate events state
+ */
+class LogsReaderStateReadingDuplicates : public LogsReaderStateBase
+{
+ friend class UT_LogsReaderStates;
+
+ public:
+ LogsReaderStateReadingDuplicates(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateReadingDuplicates(){}
+
+ public: // From LogsReaderStateBase
+ virtual bool enterL();
+ virtual bool continueL();
+};
+
+/**
+ * Modifying done state
+ */
+class LogsReaderStateModifyingDone : public LogsReaderStateBase
+{
+ friend class UT_LogsReaderStates;
+
+ public:
+ LogsReaderStateModifyingDone(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateModifyingDone(){}
+
+ public: // From LogsReaderStateBase
+ virtual bool enterL();
+};
+
+/**
+ * Reading duplicates done state
+ */
+class LogsReaderStateReadingDuplicatesDone : public LogsReaderStateBase
+{
+ friend class UT_LogsReaderStates;
+
+ public:
+ LogsReaderStateReadingDuplicatesDone(LogsReaderStateContext& context);
+ virtual ~LogsReaderStateReadingDuplicatesDone(){}
+
+ public: // From LogsReaderStateBase
+ virtual bool enterL();
+};
+
+
+
+#endif // LOGSREADERSTATES_H
+
+
+// End of File
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/inc/logsremove.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* 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 LOGSREMOVE_H
+#define LOGSREMOVE_H
+
+#include <QObject>
+#include <e32base.h>
+#include "logsmodel.h"
+
+// FORWARDS DECLARATIONS
+class CLogClient;
+class RFs;
+class CLogViewRecent;
+
+// CLASS DECLARATION
+class LogsRemoveObserver;
+/**
+ * Clearing class.
+ */
+class LogsRemove : public CActive
+ {
+ public:
+ friend class UT_LogsRemove;
+
+ /**
+ * Destructor
+ */
+ ~LogsRemove();
+
+ LogsRemove( LogsRemoveObserver& observer, bool readingAllEvents = false );
+
+
+ /**
+ * Initialize LogsRemove
+ * @return 0 if initialized succesfully
+ */
+ int init();
+
+ bool clearList(LogsModel::ClearType cleartype);
+
+ int clearEvents(const QList<int>& eventIds, bool& async);
+
+ protected: // from CActive
+
+ void DoCancel();
+ void RunL();
+ TInt RunError(TInt aError);
+
+ private:
+
+ void initL();
+ void clearEventsL(const QList<int>& eventIds, bool& async);
+ bool DeleteNextEvent();
+
+ private: // data
+ LogsRemoveObserver& mObserver;
+ bool mReadingAllEvents;
+
+ QList<int> mRemovedEvents;
+ CLogClient* mLogClient;
+ CLogViewRecent* mRecentView;
+ RFs* mFsSession;
+ };
+
+
+#endif // LOGSREMOVE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/inc/logsremoveobserver.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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 LOGSREMOVEOBSERVER_H
+#define LOGSREMOVEOBSERVER_H
+
+// INCLUDES
+
+// FORWARD DECLARATION
+
+// CLASS DECLARATION
+
+/**
+ * Reader observer interface
+ */
+class LogsRemoveObserver
+ {
+
+ public:
+
+ /**
+ * LogsRemove has completed removing.
+ */
+ virtual void removeCompleted() = 0;
+
+ /**
+ * Error occured while removing.
+ * @param err
+ */
+ virtual void logsRemoveErrorOccured(int err) = 0;
+
+ };
+
+#endif // LOGSREMOVEOBSERVER_H
+
+
+// End of File
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/src/logsdbconnector.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,605 @@
+/*
+* 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 FILES
+#include "logsdbconnector.h"
+#include "logsevent.h"
+#include "logsengdefs.h"
+#include "logsreader.h"
+#include "logslogger.h"
+#include "logsremove.h"
+#include "logscommondata.h"
+#include <logcli.h>
+#include <f32file.h>
+#include <centralrepository.h>
+#include <LogsDomainCRKeys.h>
+
+// CONSTANTS
+
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::LogsDbConnector
+// ----------------------------------------------------------------------------
+//
+LogsDbConnector::LogsDbConnector(
+ QList<LogsEvent*>& events, bool checkAllEvents, bool resourceControl )
+: QObject(),
+ mModelEvents( events ),
+ mCheckAllEvents( checkAllEvents ),
+ mResourceControl( resourceControl ),
+ mLogClient( 0 ),
+ mReader( 0 ),
+ mLogsRemove( 0 ),
+ mRepository( 0 ),
+ mCompressionEnabled(false)
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsDbConnector::LogsDbConnector()" )
+ mFsSession = new RFs();
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::~LogsDbConnector
+// ----------------------------------------------------------------------------
+//
+LogsDbConnector::~LogsDbConnector()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::~LogsDbConnector()" )
+
+ delete mReader;
+ delete mLogsRemove;
+ delete mLogClient;
+ if ( mFsSession ){
+ mFsSession->Close();
+ }
+ delete mFsSession;
+
+ qDeleteAll( mEvents );
+ qDeleteAll( mDuplicatedEvents );
+
+ delete mRepository;
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::~LogsDbConnector()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::init
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::init()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::init()" )
+
+ TRAPD( err, initL() );
+ handleTemporaryError(err);
+
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsDbConnector::init(), err:", err )
+
+ return err;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::start
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::start()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::start()" )
+
+#ifdef LOGSDBCONNECTOR_SIMULATION
+
+ LOGS_QDEBUG( "logs [ENG] Simulation enabled" )
+ int numEvents = 16;
+ QList<int> indexes;
+ for ( int i = 0; i < numEvents; i++ ){
+ QString number = QString("1223456%1").arg(i);
+ LogsEvent* event = new LogsEvent;
+ if ( i % 3 == 0 ){
+ event->setDirection(LogsEvent::DirMissed);
+ number += QString("DirMissed");
+ }
+ else if ( i % 2 == 0 ){
+ event->setDirection(LogsEvent::DirIn);
+ number += QString("DirIn");
+ } else {
+ event->setDirection(LogsEvent::DirOut);
+ number += QString("DirOut");
+ }
+ event->setNumber(number);
+ mEvents.append(event);
+ mModelEvents.append(event);
+ indexes.append(i);
+ }
+ emit dataAdded( indexes );
+ return 0;
+
+#endif
+
+ if ( !mReader ){
+ LOGS_QDEBUG( "logs [ENG] Not initialized, failure" )
+ return -1;
+ }
+ int err = mReader->start();
+ handleTemporaryError(err);
+
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsDbConnector::start(), err:", err )
+ return err;
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::updateDetails
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::updateDetails(bool clearCached)
+{
+ if ( !mReader ){
+ LOGS_QDEBUG( "logs [ENG] Not initialized, failure" )
+ return -1;
+ }
+ mReader->updateDetails(clearCached);
+ readCompleted( mEvents.count() ); //to notify of model update
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::stateChanged
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::initL()
+{
+ if ( mReader ){
+ // Already initialized
+ return;
+ }
+ User::LeaveIfError( mFsSession->Connect() );
+ mLogClient = CLogClient::NewL( *mFsSession );
+ mLogsRemove = new LogsRemove( *this, mCheckAllEvents );
+
+ TLogString logString;
+ //Texts in LOGWRAP.RLS / LOGWRAP.RSS
+ User::LeaveIfError( mLogClient->GetString( logString, R_LOG_DIR_IN ) );
+ mLogEventStrings.iInDirection = DESC_TO_QSTRING( logString );
+ User::LeaveIfError( mLogClient->GetString( logString, R_LOG_DIR_OUT ) );
+ mLogEventStrings.iOutDirection = DESC_TO_QSTRING( logString );
+ User::LeaveIfError( mLogClient->GetString( logString, R_LOG_DIR_MISSED ) );
+ mLogEventStrings.iMissedDirection = DESC_TO_QSTRING( logString );
+ //"Unknown" (Logwrap.rls)
+ User::LeaveIfError( mLogClient->GetString( logString, R_LOG_REMOTE_UNKNOWN ) );
+ mLogEventStrings.iUnKnownRemote = DESC_TO_QSTRING( logString );
+ //"Incoming on alternate line"
+ User::LeaveIfError( mLogClient->GetString( logString, R_LOG_DIR_IN_ALT ) );
+ mLogEventStrings.iInDirectionAlt = DESC_TO_QSTRING( logString );
+ User::LeaveIfError( mLogClient->GetString( logString, R_LOG_DIR_OUT_ALT ) );
+ mLogEventStrings.iOutDirectionAlt = DESC_TO_QSTRING( logString );
+ User::LeaveIfError( mLogClient->GetString( logString, R_LOG_DIR_FETCHED) );
+ mLogEventStrings.iFetched = DESC_TO_QSTRING( logString );
+
+ 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(
+ logsReadSizeCompressEnabled, LogsEvent::DirUndefined);
+ mCompressionEnabled = true;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::clearList
+// ----------------------------------------------------------------------------
+//
+bool LogsDbConnector::clearList(LogsModel::ClearType cleartype)
+{
+ bool clearingStarted(false);
+ if ( mLogsRemove ){
+ clearingStarted = mLogsRemove->clearList(cleartype);
+ }
+ return clearingStarted;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::clearEvent
+// ----------------------------------------------------------------------------
+//
+bool LogsDbConnector::clearEvents(const QList<int>& eventIds)
+{
+ bool asyncClearingStarted(false);
+ if ( mLogsRemove ){
+ bool async(false);
+ int err = mLogsRemove->clearEvents(eventIds, async);
+ asyncClearingStarted = ( !err && async );
+ }
+ return asyncClearingStarted;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::markEventsSeen
+// ----------------------------------------------------------------------------
+//
+bool LogsDbConnector::markEventsSeen(const QList<int>& eventIds)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::markEventsSeen()" )
+
+ if ( !mReader ){
+ return false;
+ }
+
+ foreach( int currId, eventIds ){
+ if ( !mEventsSeen.contains(currId) ){
+ mEventsSeen.append(currId);
+ }
+ }
+
+ LOGS_QDEBUG_2( "logs [ENG] -> event ids:", mEventsSeen );
+
+ int err = doMarkEventSeen();
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsDbConnector::markEventsSeen(), marking err:",
+ err )
+ return ( err == 0 );
+}
+
+// ----------------------------------------------------------------------------
+// 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
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::readDuplicates(int eventId)
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsDbConnector::readDuplicates(), id", eventId )
+ if ( !mReader ){
+ return -1;
+ }
+ qDeleteAll(mDuplicatedEvents);
+ mDuplicatedEvents.clear();
+ return mReader->readDuplicates(eventId);
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::takeDuplicates
+// ----------------------------------------------------------------------------
+//
+QList<LogsEvent*> LogsDbConnector::takeDuplicates()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::takeDuplicates()" )
+ QList<LogsEvent*> duplicates = mDuplicatedEvents;
+ mDuplicatedEvents.clear();
+ LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::takeDuplicates()" )
+ return duplicates;
+}
+
+// -----------------------------------------------------------------------------
+// Do refresh only if compression has been enabled. Monitoring for database
+// changes is restored and current database contents are read.
+// -----------------------------------------------------------------------------
+//
+int LogsDbConnector::refreshData()
+{
+ if ( !mResourceControl ){
+ return -1;
+ }
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::refreshData()" )
+ int err = 0;
+ bool prevCompressionEnabled = mCompressionEnabled;
+ mCompressionEnabled = false;
+ LogsCommonData::getInstance().configureReadSize(
+ logsReadSizeUndefined, LogsEvent::DirUndefined);
+ if ( mReader ){
+ if ( prevCompressionEnabled && !mReader->IsActive() ){
+ err = mReader->start();
+ }
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::refreshData()" )
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+// Compress data, only defined amount of events are kept in memory, others
+// are deleted and read back to memory once refreshData is called. Also
+// monitoring for database changes is disabled.
+// -----------------------------------------------------------------------------
+//
+int LogsDbConnector::compressData()
+{
+ if ( !mResourceControl ){
+ return -1;
+ }
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::compressData()" )
+ mCompressionEnabled = true;
+ LogsCommonData::getInstance().configureReadSize(
+ logsReadSizeCompressEnabled, LogsEvent::DirUndefined);
+ if ( mReader ){
+ int numEventsLeftInMemory = qMin(mEvents.count(), logsReadSizeCompressEnabled );
+ // Simulate disappearing of compressed events
+ QList<int> removedIndexes;
+ for ( int i = 0; i < mEvents.count(); i++ ){
+ if ( i == 0 ){
+ mModelEvents.clear();
+ }
+ if ( i < numEventsLeftInMemory ){
+ mModelEvents.append(mEvents.at(i));
+ } else {
+ removedIndexes.append(mEvents.at(i)->index());
+ }
+ }
+ emit dataRemoved(removedIndexes);
+ deleteRemoved( numEventsLeftInMemory );
+ mReader->stop();
+ }
+ 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
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::handleTemporaryError(int& error)
+{
+ if ( error == KErrAccessDenied ){
+ LOGS_QDEBUG(
+ "logs [ENG] LogsDbConnector::handleTemporaryError, DB temp unavailable" )
+ // TODO: handle temporary error in some meaningful way
+ error = 0;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::deleteRemoved
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::deleteRemoved(int newEventCount)
+{
+ // Remove events which are not anymore in db nor in model,
+ // such events are always at end of list
+ while ( mEvents.count() > newEventCount ){
+ delete mEvents.takeLast();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::removeCompleted
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::removeCompleted()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::removeCompleted()" )
+ emit clearingCompleted(0);
+ LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::removeCompleted()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::logsRemoveErrorOccured
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::logsRemoveErrorOccured(int err)
+{
+ LOGS_QDEBUG_2( "logs [ENG] <-> LogsDbConnector::logsRemoveErrorOccured(), err:", err )
+
+ emit clearingCompleted(err);
+ // TODO: error handling
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::logsRemoveErrorOccured()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::readCompleted
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::readCompleted(int readCount)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::readCompleted()" )
+ LOGS_QDEBUG_EVENT_ARR(mEvents)
+
+ // Find out updated, added and removed events
+ mRemovedEventIndexes.clear();
+ mUpdatedEventIndexes.clear();
+ mAddedEventIndexes.clear();
+ for ( int i = 0; i < mEvents.count(); i++ ){
+ if ( !mEvents.at(i)->isInView() ){
+ mRemovedEventIndexes.append( mEvents.at(i)->index() );
+ } else if ( mEvents.at(i)->eventState() == LogsEvent::EventUpdated ) {
+ mUpdatedEventIndexes.append( mEvents.at(i)->index() );
+ } else if ( mEvents.at(i)->eventState() == LogsEvent::EventAdded ) {
+ mAddedEventIndexes.append( mEvents.at(i)->index() );
+ }
+ }
+
+ bool doModelDataReset( !mRemovedEventIndexes.isEmpty() ||
+ !mAddedEventIndexes.isEmpty() ||
+ !mUpdatedEventIndexes.isEmpty() );
+ if ( doModelDataReset ){
+ mModelEvents.clear();
+ int numValidEvents = qMin(mEvents.count(), readCount);
+ for ( int i = 0; i < numValidEvents; i++ ){
+ mModelEvents.append(mEvents.at(i));
+ }
+ }
+
+ if ( !mRemovedEventIndexes.isEmpty() ){
+ emit dataRemoved(mRemovedEventIndexes);
+ }
+ if ( !mAddedEventIndexes.isEmpty() ){
+ emit dataAdded(mAddedEventIndexes);
+ }
+ if ( !mUpdatedEventIndexes.isEmpty() ){
+ emit dataUpdated(mUpdatedEventIndexes);
+ }
+
+ deleteRemoved(readCount);
+
+ if ( mCompressionEnabled ){
+ mReader->stop();
+ }
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::readCompleted()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::errorOccurred
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::errorOccurred(int err)
+{
+ LOGS_QDEBUG_2( "logs [ENG] <-> LogsDbConnector::errorOccurred(), err:", err )
+
+ // TODO: error handling
+
+ handleModifyingCompletion(err);
+
+ Q_UNUSED(err)
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::temporaryErrorOccurred
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::temporaryErrorOccurred(int err)
+{
+ LOGS_QDEBUG_2(
+ "logs [ENG] -> LogsDbConnector::temporaryErrorOccurred(), err:", err )
+
+ handleTemporaryError(err);
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::temporaryErrorOccurred()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::eventModifyingCompleted
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::eventModifyingCompleted()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::eventModifyingCompleted()" )
+
+ if ( handleModifyingCompletion() ){
+ // Possible to continue modifying
+ int err = doMarkEventSeen();
+ if ( err != 0 ){
+ // But failed for some reason
+ LOGS_QDEBUG( "logs [ENG] Couldn't continue modifying" )
+ handleModifyingCompletion(err);
+ }
+ }
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::eventModifyingCompleted()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::duplicatesReadingCompleted
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::duplicatesReadingCompleted(QList<LogsEvent*> duplicates)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDbConnector::duplicatesReadingCompleted()" )
+ qDeleteAll( mDuplicatedEvents );
+ mDuplicatedEvents.clear();
+ mDuplicatedEvents = duplicates;
+ emit duplicatesRead();
+ LOGS_QDEBUG( "logs [ENG] <- LogsDbConnector::duplicatesReadingCompleted()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::doMarkEventSeen
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::doMarkEventSeen()
+{
+ int err = -1;
+ if ( mEventsSeen.count() > 0 ){
+ err = mReader->markEventSeen(mEventsSeen.at(0));
+ }
+ return err;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::handleModifyingCompletion
+// ----------------------------------------------------------------------------
+//
+bool LogsDbConnector::handleModifyingCompletion(int err)
+{
+ bool continueModify( false );
+ if ( err || mEventsSeen.count() == 1 ){
+ mEventsSeen.clear();
+ emit markingCompleted(err);
+ } else if ( mEventsSeen.count() > 1 ){
+ // Item was modified succesfully and more to modify, remove handled
+ // item from queue
+ mEventsSeen.takeFirst();
+ continueModify = true;
+ } else {
+
+ }
+ return continueModify;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/src/logseventdataparser.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,204 @@
+/*
+* 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 FILES
+#include "logseventdataparser.h"
+#include "logseventdata.h"
+#include <e32std.h>
+#include <logeng.h>
+#include <logsmspdudata.h>
+#include "LogsApiConsts.h"
+
+
+// Separator for gprs data (old legacy non-tagged format for sent and
+// received grps data)
+_LIT8(KDataSeparator,",");
+
+// ----------------------------------------------------------------------------
+// LogsEventDataParser::parse
+// ----------------------------------------------------------------------------
+//
+int LogsEventDataParser::parse(
+ const CLogEvent& source, LogsEventData& dest )
+{
+ // For SMS'es part data is packed into data field (by sms stack), so in
+ // this case there is no need to try to parse S60 specific data from it.
+ bool readMessageParts = (
+ source.EventType() == KLogShortMessageEventTypeUid ||
+ source.EventType() == KLogsEngMmsEventTypeUid );
+ const TDesC8& data = source.Data();
+
+ //All default values must already be set in case there is no data in the
+ //event's data field.
+ dest.mIsCNAP = false;
+ dest.mIsVT = false;
+ dest.mIsVoIP = false;
+ dest.mIsPoC = false;
+ dest.mIsEmerg = false;
+ dest.mMsgPartsNumber = 0; //Meaningful only for sms
+ dest.mServiceId = 0;
+ dest.mContactLocalId = 0;
+ dest.mDataSent = 0;
+ dest.mDataReceived = 0;
+ dest.mRemoteUrl.clear();
+ dest.mLocalUrl.clear();
+
+ // 1. Msg parts are written in different format in data field.
+ if( readMessageParts ) {
+ setMsgPartsNumber( data, dest );
+ }
+ // 2. else check if the sent & received data is in old format (this can be
+ // removed when creating log data field entries is similar to format of
+ // other data field entries (i.e is tagged))
+ else if ( !checkNonTaggedData( data, dest ) ) {
+ // 3. Otherwise check if tagged data is available.
+ checkTaggedData( data, dest );
+ }
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventDataParser::setMsgPartsNumber
+// Read msg parts. They are written in format of TLogSmsPduData in Data field
+// ----------------------------------------------------------------------------
+//
+void LogsEventDataParser::setMsgPartsNumber( const TDesC8 &data, LogsEventData& dest )
+{
+ TPckgBuf<TLogSmsPduData> packedData;
+ packedData.Copy( data.Ptr(), sizeof( TLogSmsPduData ) );
+ dest.mMsgPartsNumber = packedData().iTotal;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventDataParser::checkNonTaggedData
+// ----------------------------------------------------------------------------
+//
+bool LogsEventDataParser::checkNonTaggedData( const TDesC8 &data, LogsEventData& dest )
+{
+ if( data.Length() < 1 ) {
+ return false;
+ }
+
+ //At least 1 byte of data available. Check does it begin with number.
+ TInt v;
+ TPtrC8 ptr( data.Left(1) );
+ TLex8 lex = ptr;
+ if( lex.Val( v ) != KErrNone ) {
+ //First byte does not contain number
+ return false;
+ }
+
+ //Ok, data begins with number. Try to read a pair of comma separated numbers
+ TInt separatorOffset = data.Find( KDataSeparator );
+ if( separatorOffset + 1 > data.Length() || separatorOffset < 0 ) {
+ //No separator found.
+ return false;
+ }
+
+ ptr.Set( data.Left( separatorOffset ) );
+ lex = ptr;
+ lex.Val( dest.mDataSent );
+
+ if( (separatorOffset + 1) < data.Length() ){
+ // Parse rest
+ ptr.Set( data.Mid(separatorOffset + 1, data.Length() - separatorOffset - 1) );
+ lex = ptr;
+ lex.Val( dest.mDataReceived );
+ }
+
+ return true;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventDataParser::checkTaggedData
+// ----------------------------------------------------------------------------
+//
+void LogsEventDataParser::checkTaggedData( const TDesC8 &data, LogsEventData& dest )
+{
+ TPtrC8 dataPtr( data );
+ TInt dataLeft = dataPtr.Length();
+ while( dataLeft > 0 ){
+ TInt nextTokenStart = dataPtr.Find( KLogsDataFldNameDelimiter() );
+ if ( nextTokenStart > dataPtr.Length() || nextTokenStart < 0 ) {
+ nextTokenStart = dataPtr.Length();
+ }
+
+ TPtrC8 nameValue = dataPtr.Left( nextTokenStart );
+ TPtrC8 name;
+ TPtrC8 value;
+
+ TInt delimiterStart = nameValue.Find( KLogsDataFldValueDelimiter() );
+ if( delimiterStart > dataPtr.Length() || delimiterStart < 0 ){
+ name.Set( nameValue );
+ //No value. Initialised to null in above (TPtrC8 value)
+ } else {
+ name.Set( dataPtr.Left( delimiterStart ) );
+ TInt length = nameValue.Length() - delimiterStart - 1;
+ value.Set( dataPtr.Mid( delimiterStart + 1, length) );
+ }
+
+ // Below a minor attempt to slightly speed up the string comparisons:
+ // If value already found, no need to compare same name anymore.
+ // Most likely there is VT, VOIP or POC tag in the beginning of data
+ // field if any tags.
+ if( !dest.mIsVT && name.Compare( KLogsDataFldTag_VT ) == 0 ){
+ dest.mIsVT = true;
+ } else if( !dest.mIsCNAP && name.Compare( KLogsDataFldTag_CNAP ) == 0 ){
+ dest.mIsCNAP = true;
+ } else if( !dest.mIsEmerg && name.Compare( KLogsDataFldTag_Emergency ) == 0 ){
+ dest.mIsEmerg = true;
+ } else if( !dest.mIsPoC && name.Compare( KLogsDataFldTag_POC ) == 0 ){
+ dest.mIsPoC = true;
+ } else if( !dest.mIsVoIP && name.Compare( KLogsDataFldTag_IP ) == 0 ){
+ dest.mIsVoIP = true;
+ } else if( !dest.mServiceId && name.Compare( KLogsDataFldTag_ServiceId ) == 0 ) {
+ TLex8 lex( value );
+ TUint32 temp( 0 );
+ TInt err = lex.Val( temp , EDecimal );
+ if ( KErrNone == err ) {
+ //if an error occurred we leave the service id unchanged
+ dest.mServiceId = temp;
+ }
+ } else if ( !dest.mContactLocalId &&
+ name.Compare( KLogsDataFldTag_ContactLink ) == 0 ) {
+ HBufC8* contactLink = value.AllocLC();
+ TLex8 lex( contactLink->Des() );
+ TUint32 temp( 0 );
+ TInt err = lex.Val( temp , EDecimal );
+ if ( KErrNone == err ) {
+ dest.mContactLocalId = temp;
+ }
+ CleanupStack::PopAndDestroy(contactLink);
+
+ } else if ( dest.mRemoteUrl.isEmpty() && name.Compare( KLogsDataFldTag_URL ) == 0 ) {
+ // VoIP strips unneeded stuff from uri before writing the log
+ // event to db (it removes '<' '>', "sip:", and everything after ';',
+ // see svpsslogcall.cpp) so no need to postprocess.
+ dest.mRemoteUrl = QString::fromUtf8( (char*)value.Ptr(), value.Length() );
+ } else if ( dest.mLocalUrl.isEmpty() && name.Compare( KLogsDataFldTag_MA ) == 0 ) {
+ dest.mLocalUrl = QString::fromUtf8( (char*)value.Ptr(), value.Length() );
+ }
+
+ //Process remaining data
+ dataLeft = dataPtr.Length() - nextTokenStart - 1;
+ if ( dataLeft > 0 ) {
+ //Continue with remaining data on the right side of token
+ nameValue.Set( dataPtr.Right( dataLeft ) );
+ dataPtr.Set( nameValue );
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/src/logseventparser.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,176 @@
+/*
+* 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 FILES
+#include <logwrap.hrh>
+#include <logengdurations.h>
+#include <QDateTime>
+
+#include "logseventparser.h"
+#include "logsevent.h"
+#include "logseventdata.h"
+#include "logsengdefs.h"
+#include "LogsApiConsts.h" //Additional event UIDs
+#include "logslogger.h"
+
+
+// ----------------------------------------------------------------------------
+// LogsEventParser::parseL
+// ----------------------------------------------------------------------------
+//
+void LogsEventParser::parseL(
+ const CLogEvent& source,
+ LogsEvent& dest,
+ const LogsEventStrings& strings )
+{
+ bool dataChanged = false;
+
+ //Set remote party information
+ QString newRemoteParty =
+ QString::fromUtf16( source.RemoteParty().Ptr(), source.RemoteParty().Length() );
+ if ( !isUnknownRemoteParty(dest, newRemoteParty) &&
+ newRemoteParty != strings.iUnKnownRemote &&
+ source.RemoteParty() != KLogsPrivateText &&
+ source.RemoteParty() != KLogsPayphoneText ){
+ dest.setRemoteParty( newRemoteParty );
+ }
+
+ dataChanged |= dest.setNumber(
+ QString::fromUtf16( source.Number().Ptr(), source.Number().Length() ) );
+
+ // Set direction
+ QString sourceDirection =
+ QString::fromUtf16(
+ source.Direction().Ptr(), source.Direction().Length() );
+
+ // TODO: it would be better to have symbian descriptors in strings arr so
+ // that symbian log event direction could be compared without conversion
+ LogsEvent::LogsDirection newDirection = LogsEvent::DirUndefined;
+
+ if( sourceDirection == strings.iInDirection ||
+ sourceDirection == strings.iInDirectionAlt ){
+ newDirection = LogsEvent::DirIn;
+ } else if( sourceDirection == strings.iOutDirection ||
+ sourceDirection == strings.iOutDirectionAlt ){
+ newDirection = LogsEvent::DirOut;
+ } else if( sourceDirection == strings.iMissedDirection ){
+ newDirection = LogsEvent::DirMissed;
+ }
+ dataChanged |= dest.setDirection(newDirection);
+
+ dataChanged |= dest.setIsRead(source.Flags() & KLogEventRead);
+
+ // Set time
+ TDateTime dateTime = source.Time().DateTime();
+ QDate qDate( dateTime.Year(), dateTime.Month() + 1, dateTime.Day() + 1);
+ QTime qTime( dateTime.Hour(), dateTime.Minute(), dateTime.Second() );
+ QDateTime qDateTime(qDate, qTime, Qt::UTC );
+ dataChanged |= dest.setTime( qDateTime );
+
+ // Set duration (do not cause update even if duration changed)
+ if ( source.DurationType() == KLogDurationValid ){
+ dest.setDuration(source.Duration());
+ }
+
+ int currLogId = dest.logId();
+ int newLogId = source.Id();
+ bool logIdChanged( currLogId != newLogId );
+ if ( currLogId < 0 || logIdChanged ){
+ dest.mEventState = LogsEvent::EventAdded;
+ } else if ( !logIdChanged && dataChanged ){
+ dest.mEventState = LogsEvent::EventUpdated;
+ } else {
+ dest.mEventState = LogsEvent::EventNotUpdated;
+ }
+ dest.setLogId( newLogId ); // Store unique identifier
+
+ LogsEventData* logsEventData = new LogsEventData();
+ if ( logsEventData->parse(source) != 0 ){
+ // Parsing failed, clear event data
+ delete logsEventData;
+ dest.setLogsEventData( 0 );
+ } else {
+ dest.setLogsEventData( logsEventData ); //Ownership transferred
+ }
+
+ // Resolve event type based on current event data
+ resolveEventType(dest);
+
+ eventTypeSpecificParsing(dest);
+
+ dest.setDuplicates( 0 );
+
+ if ( dest.validate() ) {
+ dest.setIsInView(true); // Important
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventParser::resolveEventType
+// ----------------------------------------------------------------------------
+//
+void LogsEventParser::resolveEventType(LogsEvent& dest)
+{
+ LogsEvent::LogsEventType type( LogsEvent::TypeVoiceCall );
+ if ( dest.mLogsEventData ){
+ if ( dest.mLogsEventData->isVoIP() ){
+ type = LogsEvent::TypeVoIPCall;
+ } else if ( dest.mLogsEventData->isVT() ){
+ type = LogsEvent::TypeVideoCall;
+ } else if ( dest.mLogsEventData->isPoC() ){
+ // PoC not supported at the moment
+ type = LogsEvent::TypeUndefined;
+ } else if ( dest.mLogsEventData->msgPartsNumber() > 0 ){
+ // Messages not supported at the moment
+ type = LogsEvent::TypeUndefined;
+ }
+ }
+ LOGS_QDEBUG_2( "LogsEventParser::resolveEventType, type:", type )
+ dest.setEventType( type );
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void LogsEventParser::eventTypeSpecificParsing(LogsEvent& dest)
+{
+ if ( isUnknownRemoteParty(dest, dest.mRemoteParty) ) {
+ // Detect VoIP's strange unkown remote party handling
+ // and clear remote party value to treat unknown voip event
+ // same way as any other unknown event.
+ dest.mRemoteParty.clear();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// VoIP uses remote url as remote party name in case of
+// unknown remote party (probably because DB has to have some identifier
+// in number or remote party fields).
+// ----------------------------------------------------------------------------
+//
+bool LogsEventParser::isUnknownRemoteParty(LogsEvent& dest, const QString& remoteParty)
+{
+ if ( dest.mEventType == LogsEvent::TypeVoIPCall &&
+ dest.mLogsEventData && dest.mLogsEventData->remoteUrl() == remoteParty ){
+ return true;
+ }
+ return false;
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/src/logsforegroundwatcher.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "logsforegroundwatcher.h"
+#include "logslogger.h"
+
+// -----------------------------------------------------------------------------
+// Currently no other way to monitor app foreground/background switches.
+// HbForegroundWatcher might become public at some point which could be then
+// used instead.
+// -----------------------------------------------------------------------------
+//
+LogsForegroundWatcher::LogsForegroundWatcher(QObject* parent) : QObject(parent)
+{
+ CCoeEnv* env = CCoeEnv::Static();
+ if (env) {
+ TRAP_IGNORE(env->AddForegroundObserverL(*this));
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsForegroundWatcher::HandleGainingForeground()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsForegroundWatcher::HandleGainingForeground" );
+ emit gainingForeground();
+ LOGS_QDEBUG( "logs [UI] <- LogsForegroundWatcher::HandleGainingForeground" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsForegroundWatcher::HandleLosingForeground()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsForegroundWatcher::HandleLosingForeground" );
+ emit losingForeground();
+ LOGS_QDEBUG( "logs [UI] <- LogsForegroundWatcher::HandleLosingForeground" );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/src/logsreader.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,713 @@
+/*
+* 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 FILES
+#include <exception>
+#include <logview.h>
+#include "logsreader.h"
+#include "logsreaderobserver.h"
+#include "logsevent.h"
+#include "logsengdefs.h"
+#include "logslogger.h"
+
+// CONSTANTS
+
+// ----------------------------------------------------------------------------
+// LogsReader::LogsReader
+// ----------------------------------------------------------------------------
+//
+LogsReader::LogsReader(
+ RFs& fsSession,
+ CLogClient& logClient,
+ LogsEventStrings& strings,
+ QList<LogsEvent*>& events,
+ LogsReaderObserver& observer,
+ bool readAllEvents)
+ : CActive( EPriorityStandard ),
+ mLogViewRecent(0),
+ mLogViewEvent(0),
+ mDuplicatesView(0),
+ mFsSession(fsSession),
+ mLogClient(logClient),
+ mStrings(strings),
+ mEvents(events),
+ mObserver(observer),
+ mReadAllEvents(readAllEvents),
+ mIndex(0),
+ mCurrentStateIndex(0),
+ mCurrentStateMachine(0),
+ mCurrentEventId(-1),
+ mGlobalObserverSet(false)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReader::LogsReader()" )
+
+ CActiveScheduler::Add( this );
+
+ initializeReadStates();
+
+ setGlobalObserver();
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::LogsReader()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::~LogsReader
+// ----------------------------------------------------------------------------
+//
+LogsReader::~LogsReader()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReader::~LogsReader()" )
+
+ Cancel();
+ qDeleteAll( mReadStates );
+ qDeleteAll( mModifyingStates );
+ qDeleteAll( mDuplicateReadingStates );
+ delete mLogViewRecent;
+ delete mLogViewEvent;
+ delete mDuplicatesView;
+ qDeleteAll( mDuplicatedEvents );
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::~LogsReader()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::start
+// ----------------------------------------------------------------------------
+//
+int LogsReader::start()
+ {
+ LOGS_QDEBUG( "logs [ENG] -> LogsReader::start()" )
+
+ TRAPD( err, startL() );
+
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsReader::start(), err:", err )
+ return err;
+ }
+
+// ----------------------------------------------------------------------------
+// LogsReader::stop
+// ----------------------------------------------------------------------------
+//
+void LogsReader::stop()
+ {
+ LOGS_QDEBUG( "logs [ENG] -> LogsReader::stop()" )
+
+ Cancel();
+ deleteLogViews();
+ clearGlobalObserver();
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::stop()" )
+ }
+
+// ----------------------------------------------------------------------------
+// LogsReader::updateDetails
+// ----------------------------------------------------------------------------
+//
+void LogsReader::updateDetails(bool clearCached)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReader::updateDetails()" )
+ foreach (LogsEvent* event, mEvents){
+ event->prepareForContactMatching();
+ }
+ if ( clearCached ) {
+ mContactCache.clear();
+ }
+ LogsReaderStateFillDetails* fillDetailsState =
+ new LogsReaderStateFillDetails(*this);
+ fillDetailsState->fillDetails();
+ delete fillDetailsState;
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::updateDetails()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::markEventSeen
+// ----------------------------------------------------------------------------
+//
+int LogsReader::markEventSeen(int eventId)
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsReader::markEventsSeen(), ids: ", eventId )
+ TRAPD( err, markEventSeenL(eventId) );
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsReader::markEventsSeen(), err:", err )
+ return err;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::readDuplicates
+// ----------------------------------------------------------------------------
+//
+int LogsReader::readDuplicates(int eventId)
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsReader::readDuplicates(), ids: ", eventId )
+ TRAPD( err, readDuplicatesL(eventId) );
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsReader::readDuplicates(), err:", err )
+ return err;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::RunL
+// ----------------------------------------------------------------------------
+//
+void LogsReader::RunL()
+{
+ LOGS_QDEBUG_3( "logs [ENG] -> LogsReader::RunL(), (state, status):",
+ mCurrentStateIndex, iStatus.Int() )
+
+ // Error handling in RunError
+ __ASSERT_ALWAYS( iStatus.Int() == KErrNone, User::Leave( iStatus.Int() ) );
+
+ if ( currentState().continueL() ){
+ SetActive();
+ }
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::RunL()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::RunError
+// ----------------------------------------------------------------------------
+//
+TInt LogsReader::RunError(TInt error)
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsReader::RunError(), err:", error )
+
+ handleError(error);
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::RunError()" )
+ return KErrNone;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::DoCancel
+// ----------------------------------------------------------------------------
+//
+void LogsReader::DoCancel()
+{
+ logView().Cancel();
+ mDuplicatesView->Cancel();
+ mLogClient.Cancel();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::startL
+// ----------------------------------------------------------------------------
+//
+void LogsReader::startL()
+{
+ prepareReadingL();
+
+ initializeReadStates();
+
+ if ( currentState().enterL() ){
+ SetActive();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::markEventSeenL
+// ----------------------------------------------------------------------------
+//
+void LogsReader::markEventSeenL(int eventId)
+{
+ prepareReadingL();
+
+ mCurrentEventId = eventId;
+ initializeModifyingStates();
+
+ if ( currentState().enterL() ){
+ SetActive();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::readDuplicatesL
+// ----------------------------------------------------------------------------
+//
+void LogsReader::readDuplicatesL(int eventId)
+{
+ if ( IsActive() && mCurrentStateMachine != &mDuplicateReadingStates ){
+ LOGS_QDEBUG( "logs [ENG] <-> LogsReader::readDuplicatesL(), cannot interrupt" )
+ User::Leave(KErrInUse);
+ }
+ prepareReadingL();
+
+ mCurrentEventId = eventId;
+ initializeDuplicateReadingStates();
+
+ if ( currentState().enterL() ){
+ SetActive();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::cancelCurrentRequestL
+// ----------------------------------------------------------------------------
+//
+void LogsReader::cancelCurrentRequestL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReader::cancelCurrentRequestL()" )
+ if ( IsActive() ) {
+ if (mCurrentStateMachine == &mReadStates ||
+ mCurrentStateMachine == &mDuplicateReadingStates){
+ LOGS_QDEBUG( "logs [ENG] reading is in progress, cancelling" )
+ Cancel();
+ } else if (mCurrentStateMachine == &mModifyingStates) {
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::removeEvent(), modifying is in progress, can't cancel" )
+ User::Leave(KErrInUse);
+ }
+ }
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::cancelCurrentRequestL()" )
+}
+
+
+
+// ----------------------------------------------------------------------------
+// LogsReader::HandleLogClientChangeEventL
+//
+// Called by Log Database engine when it notifies a change in database (e.g.
+// Log database cleared)
+// ----------------------------------------------------------------------------
+//
+void LogsReader::HandleLogClientChangeEventL(
+TUid aChangeType,
+TInt /*aChangeParam1*/,
+TInt /*aChangeParam2*/,
+TInt /*aChangeParam3*/ )
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsReader::HandleLogClientChangeEventL()",
+ aChangeType.iUid )
+ if( aChangeType == KLogClientChangeEventLogCleared ){
+ handleViewChange();
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::HandleLogClientChangeEventL()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::HandleLogViewChangeEventAddedL
+// Called by Log Database engine when it notifies us that it has added
+// an event to database
+// ----------------------------------------------------------------------------
+//
+void LogsReader::HandleLogViewChangeEventAddedL(
+TLogId /*aId*/,
+TInt /*aViewIndex*/,
+TInt /*aChangeIndex*/,
+TInt aTotalChangeCount )
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsReader::HandleLogViewChangeEventAddedL()",
+ aTotalChangeCount )
+
+ //Comment: HandleLogViewChangeEventAddedL seems to be called only once
+ // (and aTotalChangeCount is 1) even if there are multiple entries added
+ // to database in a batch. This seems to happen at least in wins emulator
+ // in Symbian 80a_200432. If problems in this area or changed behaviour,
+ // we need to consider same kind of optimization to here as is in
+ //HandleLogViewChangeEventDeletedL
+
+ handleViewChange(aTotalChangeCount);
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::HandleLogViewChangeEventAddedL()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::HandleLogViewChangeEventChangedL
+// Called by Log Database engine when it notifies us that it has
+// changed an event in the database
+// ----------------------------------------------------------------------------
+//
+void LogsReader::HandleLogViewChangeEventChangedL(
+TLogId /*aId*/,
+TInt /*aViewIndex*/,
+TInt /*aChangeIndex*/,
+TInt aTotalChangeCount )
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsReader::HandleLogViewChangeEventChangedL()",
+ aTotalChangeCount )
+ handleViewChange(aTotalChangeCount);
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::HandleLogViewChangeEventChangedL()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::HandleLogViewChangeEventDeletedL
+// Called by Log Database engine when it notifies us that it has deleted
+// an event in the database
+// ----------------------------------------------------------------------------
+//
+void LogsReader::HandleLogViewChangeEventDeletedL(
+TLogId /*aId*/,
+TInt /*aViewIndex*/,
+TInt aChangeIndex,
+TInt aTotalChangeCount )
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsReader::HandleLogViewChangeEventDeletedL()",
+ aTotalChangeCount )
+LOGS_QDEBUG_2( "logs [ENG] -> LogsReader::HandleLogViewChangeEventDeletedL() aChangeIndex=",
+ aChangeIndex )
+ // In order to prevent to re-reading the database multiple times, we call
+ // HandleViewChangeL only once. This is because HandleLogViewChangeEventDeletedL
+ // is called as many times as is the number of entries are deleted e.g. when
+ // deleteting old entries from database happens. However, aTotalChangeCount contains
+ // total number of deletions in a batch, so we can optimize the call to
+ // HandleViewChangeL to happen only even if we're called multiple times.
+ // Value of aChangeIndex is increasing from 0 to ( aTotalChangeCount - 1 ).
+ // we call HandleViewChangeL when the last notify has arrived.
+
+if ( aChangeIndex == ( aTotalChangeCount - 1 ) )
+ {
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::HandleLogViewChangeEventDeletedL() handleViewChange" )
+ handleViewChange(aTotalChangeCount);
+ }
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::HandleLogViewChangeEventDeletedL()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::setCurrentState
+// ----------------------------------------------------------------------------
+//
+void LogsReader::setCurrentState(const LogsReaderStateBase& state)
+{
+ bool found(false);
+ for( int i = 0; i < mCurrentStateMachine->count() && !found; i++ ){
+ if ( mCurrentStateMachine->at(i) == &state ){
+ mCurrentStateIndex = i;
+ found = true;
+ LOGS_QDEBUG_2( "logs [ENG] <-> LogsReader::setCurrentState, index:",
+ mCurrentStateIndex )
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::logView
+// ----------------------------------------------------------------------------
+//
+CLogView& LogsReader::logView()
+{
+ if ( mLogViewRecent ){
+ return *mLogViewRecent;
+ }
+ return *mLogViewEvent;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::duplicatesView
+// ----------------------------------------------------------------------------
+//
+CLogViewDuplicate& LogsReader::duplicatesView()
+{
+ return *mDuplicatesView;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::events
+// ----------------------------------------------------------------------------
+//
+QList<LogsEvent*>& LogsReader::events()
+{
+ return mEvents;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::index
+// ----------------------------------------------------------------------------
+//
+int& LogsReader::index()
+{
+ return mIndex;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::strings
+// ----------------------------------------------------------------------------
+//
+LogsEventStrings& LogsReader::strings()
+{
+ return mStrings;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::reqStatus
+// ----------------------------------------------------------------------------
+//
+TRequestStatus& LogsReader::reqStatus()
+{
+ return iStatus;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::observer
+// ----------------------------------------------------------------------------
+//
+LogsReaderObserver& LogsReader::observer()
+{
+ return mObserver;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::contactCache
+// ----------------------------------------------------------------------------
+//
+QHash<QString, ContactCacheEntry>& LogsReader::contactCache()
+{
+ return mContactCache;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::currentEventId
+// ----------------------------------------------------------------------------
+//
+int LogsReader::currentEventId()
+{
+ return mCurrentEventId;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::logClient
+// ----------------------------------------------------------------------------
+//
+CLogClient& LogsReader::logClient()
+{
+ return mLogClient;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::isRecentView
+// ----------------------------------------------------------------------------
+//
+bool LogsReader::isRecentView()
+{
+ return ( mLogViewRecent != 0 );
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::duplicatedEvents
+// ----------------------------------------------------------------------------
+//
+QList<LogsEvent*>& LogsReader::duplicatedEvents()
+{
+ return mDuplicatedEvents;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::currentState
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateBase& LogsReader::currentState()
+{
+ return *(mCurrentStateMachine->at(mCurrentStateIndex));
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::initializeReadStates
+// ----------------------------------------------------------------------------
+//
+void LogsReader::initializeReadStates()
+{
+ if ( mReadStates.count() == 0 ){
+
+ LogsReaderStateInitReading* init = new LogsReaderStateInitReading(*this);
+ LogsReaderStateFiltering* filtering = createFilteringState();
+ LogsReaderStateReading* reading = new LogsReaderStateReading(*this);
+ LogsReaderStateFillDetails* fillDetails = new LogsReaderStateFillDetails(*this);
+ LogsReaderStateDone* done = new LogsReaderStateDone(*this);
+ init->setNextState(*filtering);
+ filtering->setNextState(*reading);
+ reading->setNextState(*fillDetails);
+ fillDetails->setNextState(*done);
+ mReadStates.append(init);
+ mReadStates.append(filtering);
+ mReadStates.append(reading);
+ mReadStates.append(fillDetails);
+ mReadStates.append(done);
+ }
+ mCurrentStateMachine = &mReadStates;
+ setCurrentState(*mReadStates.at(0));
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::initializeDuplicateReadingStates
+// ----------------------------------------------------------------------------
+//
+void LogsReader::initializeDuplicateReadingStates()
+{
+ if ( mDuplicateReadingStates.count() == 0 ){
+ LogsReaderStateFiltering* filtering = createFilteringState();
+ LogsReaderStateSearchingEvent* searching =
+ new LogsReaderStateSearchingEvent(*this);
+ LogsReaderStateFindingDuplicates* findingDuplicates =
+ new LogsReaderStateFindingDuplicates(*this);
+ LogsReaderStateReadingDuplicates* readingDuplicates =
+ new LogsReaderStateReadingDuplicates(*this);
+ LogsReaderStateReadingDuplicatesDone* done =
+ new LogsReaderStateReadingDuplicatesDone(*this);
+ filtering->setNextState(*searching);
+ searching->setNextState(*findingDuplicates);
+ findingDuplicates->setNextState(*readingDuplicates);
+ readingDuplicates->setNextState(*done);
+ mDuplicateReadingStates.append(filtering);
+ mDuplicateReadingStates.append(searching);
+ mDuplicateReadingStates.append(findingDuplicates);
+ mDuplicateReadingStates.append(readingDuplicates);
+ mDuplicateReadingStates.append(done);
+ }
+ mCurrentStateMachine = &mDuplicateReadingStates;
+ setCurrentState(*mDuplicateReadingStates.at(0));
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::initializeModifyingStates
+// ----------------------------------------------------------------------------
+//
+void LogsReader::initializeModifyingStates()
+{
+ if ( mModifyingStates.count() == 0 ){
+ LogsReaderStateFiltering* filtering = createFilteringState();
+ LogsReaderStateSearchingEvent* searching =
+ new LogsReaderStateSearchingEvent(*this);
+ LogsReaderStateMarkingDuplicates* duplicates =
+ new LogsReaderStateMarkingDuplicates(*this);
+ LogsReaderStateModifyingDone* done = new LogsReaderStateModifyingDone(*this);
+ filtering->setNextState(*searching);
+ searching->setNextState(*duplicates);
+ duplicates->setNextState(*done);
+ mModifyingStates.append(filtering);
+ mModifyingStates.append(searching);
+ mModifyingStates.append(duplicates);
+ mModifyingStates.append(done);
+ }
+ mCurrentStateMachine = &mModifyingStates;
+ setCurrentState(*mModifyingStates.at(0));
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::handleViewChange
+// ----------------------------------------------------------------------------
+//
+void LogsReader::handleViewChange(int totalChangeCount)
+{
+ //we do not update view untill deletion is done
+ if ( totalChangeCount > 0 ){
+ int err = start();
+ handleError( err );
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::handleError
+// ----------------------------------------------------------------------------
+//
+void LogsReader::handleError(int error)
+{
+ if ( error == KErrAccessDenied || error == KErrInUse ){
+ LOGS_QDEBUG( "logs [ENG] <-> LogsReader::handleError(), temp err" )
+ mObserver.temporaryErrorOccurred(error);
+ } else if ( error != 0 ){
+ LOGS_QDEBUG( "logs [ENG] <-> LogsReader::handleError(), fatal err" )
+ mObserver.errorOccurred(error);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::createLogViewsL
+// ----------------------------------------------------------------------------
+//
+void LogsReader::createLogViewsL()
+{
+ if ( mReadAllEvents ){
+ if ( !mLogViewEvent ){
+ mLogViewEvent = CLogViewEvent::NewL( mLogClient, *this );
+ }
+ }
+ else if ( !mLogViewRecent ) {
+ mLogViewRecent = CLogViewRecent::NewL( mLogClient, *this );
+ }
+
+ if ( !mDuplicatesView ){
+ mDuplicatesView = CLogViewDuplicate::NewL( mLogClient, *this );
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::deleteLogViews
+// ----------------------------------------------------------------------------
+//
+void LogsReader::deleteLogViews()
+{
+ delete mLogViewEvent;
+ mLogViewEvent = 0;
+ delete mLogViewRecent;
+ mLogViewRecent = 0;
+ delete mDuplicatesView;
+ mDuplicatesView = 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::createFilteringState
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateFiltering* LogsReader::createFilteringState()
+{
+ LogsReaderStateFiltering* filtering = 0;
+ if ( mReadAllEvents ) {
+ filtering = new LogsReaderStateFilteringAll(*this);
+ }
+ else {
+ filtering = new LogsReaderStateFiltering(*this);
+ }
+ return filtering;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::prepareReadingL
+// ----------------------------------------------------------------------------
+//
+void LogsReader::prepareReadingL()
+{
+ cancelCurrentRequestL();
+
+ createLogViewsL();
+
+ setGlobalObserver();
+
+ mIndex = 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::setGlobalObserver
+// ----------------------------------------------------------------------------
+//
+void LogsReader::setGlobalObserver()
+{
+ // Have to ensure that same observer is not set twice, otherwise
+ // causes crash at later point inside eventlogger
+ if ( !mGlobalObserverSet ){
+ TRAP_IGNORE( mLogClient.SetGlobalChangeObserverL( this ) )
+ mGlobalObserverSet = true;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsReader::clearGlobalObserver
+// ----------------------------------------------------------------------------
+//
+void LogsReader::clearGlobalObserver()
+{
+ if ( mGlobalObserverSet ){
+ TRAP_IGNORE( mLogClient.SetGlobalChangeObserverL( 0 ) )
+ mGlobalObserverSet = false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/src/logsreaderstates.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,831 @@
+/*
+* 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 FILES
+#include <QList>
+#include <logview.h>
+#include <logwraplimits.h>
+#include "logsreaderstates.h"
+#include "logsreaderstatecontext.h"
+#include "logsevent.h"
+#include "logseventdata.h"
+#include "logsengdefs.h"
+#include "logslogger.h"
+#include "logsreaderobserver.h"
+#include "logscommondata.h"
+
+// CONSTANTS
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::LogsReaderStateBase
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateBase::LogsReaderStateBase(
+ LogsReaderStateContext& context)
+ : mContext(context),
+ mNextState(0)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::~LogsReaderStateBase
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateBase::~LogsReaderStateBase()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFiltering::setNextState
+// ----------------------------------------------------------------------------
+//
+void LogsReaderStateBase::setNextState(LogsReaderStateBase& nextState)
+{
+ mNextState = &nextState;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFiltering::enterNextStateL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateBase::enterNextStateL()
+{
+ if ( mNextState ){
+ mContext.setCurrentState(*mNextState);
+ return mNextState->enterL();
+ }
+ return false;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateBase::enterL()
+{
+ return false;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::continueL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateBase::continueL()
+{
+ return false;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::viewCount
+// ----------------------------------------------------------------------------
+//
+int LogsReaderStateBase::viewCountL() const
+ {
+ return mContext.logView().CountL();
+ }
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::event
+// ----------------------------------------------------------------------------
+//
+CLogEvent& LogsReaderStateBase::event() const
+ {
+ //The RVCT compiler provides warnings "type qualifier on return type is meaningless"
+ //for functions that return const values. In order to avoid these numerous warnings and
+ //const cascading, the CLogEvent is const_casted here.
+ return const_cast<CLogEvent&>( mContext.logView().Event() );
+ }
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::updateAndInsertEventL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateBase::updateAndInsertEventL(
+ const CLogEvent& source, LogsEvent* dest, int& eventIndex)
+{
+ Q_ASSERT( dest );
+ dest->initializeEventL( source, mContext.strings() );
+ dest->setIndex(eventIndex);
+ mContext.events().insert(eventIndex, dest);
+ eventIndex++;
+ return true;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::constructAndInsertEventL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateBase::constructAndInsertEventL(
+ const CLogEvent& source, LogsEvent* dest, int& eventIndex, QList<LogsEvent*>& events)
+{
+ Q_ASSERT( dest );
+ dest->initializeEventL( source, mContext.strings() );
+ if ( !dest->validate() ){
+ LOGS_QDEBUG( "LogsReaderStateBase::constructAndInsertEventL, event discarded" )
+ delete dest;
+ return false;
+ }
+ dest->setIndex(eventIndex);
+ events.insert(eventIndex, dest);
+ eventIndex++;
+ return true;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::resetEvents
+// ----------------------------------------------------------------------------
+//
+void LogsReaderStateBase::resetEvents()
+{
+ QList<LogsEvent*> &events = mContext.events();
+ for ( int i = 0; i < events.count(); i++ ){
+ events.at(i)->setIsInView(false);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::takeMatchingEvent
+// ----------------------------------------------------------------------------
+//
+LogsEvent* LogsReaderStateBase::takeMatchingEvent(const CLogEvent& event)
+{
+ QList<LogsEvent*> &events = mContext.events();
+ for ( int i = 0; i < events.count(); i++ ){
+ if ( events.at(i)->logId() == event.Id() ){
+ return events.takeAt(i);
+ }
+ }
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::eventById
+// ----------------------------------------------------------------------------
+//
+LogsEvent* LogsReaderStateBase::eventById(int eventId)
+{
+ LogsEvent* event = 0;
+ QList<LogsEvent*> &events = mContext.events();
+ for ( int i = 0; i < events.count(); i++ ){
+ if ( events.at(i)->logId() == eventId ){
+ event = events.at(i);
+ break;
+ }
+ }
+ return event;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateBase::duplicatesL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateBase::duplicatesL(const CLogFilter* aFilter){
+ bool gettingDuplicates( false );
+ if ( mContext.isRecentView() ){
+ if ( aFilter ){
+ gettingDuplicates =
+ static_cast<CLogViewRecent&>( mContext.logView() ).DuplicatesL(
+ mContext.duplicatesView(), *aFilter, mContext.reqStatus() );
+ } else {
+ gettingDuplicates =
+ static_cast<CLogViewRecent&>( mContext.logView() ).DuplicatesL(
+ mContext.duplicatesView(), mContext.reqStatus() );
+ }
+ }
+ return gettingDuplicates;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateInitReading::LogsReaderStateInitReading
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateInitReading::LogsReaderStateInitReading(
+ LogsReaderStateContext& context )
+ : LogsReaderStateBase(context)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderInitReadingState::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateInitReading::enterL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateInitReading::enterL" );
+ resetEvents();
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFiltering::LogsReaderStateFiltering
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateFiltering::LogsReaderStateFiltering(
+ LogsReaderStateContext& context )
+ : LogsReaderStateBase(context),
+ mFilterList(0)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFiltering::~LogsReaderStateFiltering
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateFiltering::~LogsReaderStateFiltering()
+{
+ if ( mFilterList ){
+ mFilterList->ResetAndDestroy();
+ }
+ delete mFilterList;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFiltering::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateFiltering::enterL()
+{
+ // Filtering all recent calls (max number of recent events is configurable,
+ // see TLogConfig in logcli.h
+ //
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateFiltering::enterL" );
+
+ CLogFilterList* filterList = new ( ELeave ) CLogFilterList;
+ CleanupStack::PushL(filterList);
+ CLogFilter* filter = CLogFilter::NewL();
+ CleanupStack::PushL( filter );
+ filter->SetEventType( KLogCallEventTypeUid );
+ filterList->AppendL( filter );
+ CleanupStack::Pop( filter );
+
+ if ( mFilterList ){
+ mFilterList->ResetAndDestroy();
+ delete mFilterList;
+ mFilterList = 0;
+ }
+ mFilterList = filterList;
+ CleanupStack::Pop(filterList);
+
+ if ( setFilterL( *filterList ) ) {
+ return true;
+ }
+
+ // Not possible to continue with filtering
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFiltering::continueL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateFiltering::continueL()
+{
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFiltering::setFilterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateFiltering::setFilterL(CLogFilterList& filterList){
+ __ASSERT_ALWAYS( mContext.isRecentView(), User::Leave( KErrNotFound ) );
+ return static_cast<CLogViewRecent&>( mContext.logView() ).SetRecentListL(
+ KLogNullRecentList, filterList, mContext.reqStatus() );
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFiltering::LogsReaderStateFiltering
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateFilteringAll::LogsReaderStateFilteringAll(
+ LogsReaderStateContext& context )
+ : LogsReaderStateFiltering(context)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFilteringAll::~LogsReaderStateFilteringAll
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateFilteringAll::~LogsReaderStateFilteringAll()
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFilteringAll::setFilterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateFilteringAll::setFilterL(CLogFilterList& filterList){
+ __ASSERT_ALWAYS( !mContext.isRecentView(), User::Leave( KErrNotFound ) );
+ return static_cast<CLogViewEvent&>( mContext.logView() ).SetFilterL(
+ filterList, mContext.reqStatus() );
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReading::LogsReaderStateReading
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateReading::LogsReaderStateReading(
+ LogsReaderStateContext& context )
+ : LogsReaderStateBase(context),
+ mDuplicateMissedFilter(0),
+ mCheckingMissed(false),
+ mEventIndex(0),
+ mReadSizeCounter(0)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReading::~LogsReaderStateReading
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateReading::~LogsReaderStateReading()
+{
+ delete mDuplicateMissedFilter;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReading::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateReading::enterL()
+{
+ mCheckingMissed = false;
+ mEventIndex = 0;
+ mReadSizeCounter = 0;
+
+ if ( !mDuplicateMissedFilter ){
+ // Interested only about duplicates which are not marked as read
+ mDuplicateMissedFilter = CLogFilter::NewL();
+ mDuplicateMissedFilter->SetFlags(KLogEventRead);
+ mDuplicateMissedFilter->SetNullFields(ELogFlagsField);
+ }
+
+ if ( viewCountL() > 0 && mContext.logView().FirstL( mContext.reqStatus() ) ){
+ return true;
+ }
+
+ // Not possible to continue with reading
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReading::continueL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateReading::continueL()
+{
+ int& index = mContext.index();
+ QList<LogsEvent*> &events = mContext.events();
+
+ if ( mCheckingMissed ) {
+ events.at(mEventIndex-1)->setDuplicates(
+ mContext.duplicatesView().CountL() );
+ mCheckingMissed = false;
+ }
+ else {
+ const CLogEvent& sourceEvent = event();
+ LogsEvent* event = takeMatchingEvent(sourceEvent);
+ bool inserted = false;
+ if ( event ){
+ // Matching event is updated and put to new position
+ inserted = updateAndInsertEventL( sourceEvent, event, mEventIndex );
+ }
+ else {
+ // Create new entry
+ event = new LogsEvent;
+ inserted = constructAndInsertEventL(
+ sourceEvent, event, mEventIndex, mContext.events() );
+ }
+
+ if ( inserted ){
+ updateReadSizeCounter(*event);
+ if ( handleMissedL(*event) ){
+ mCheckingMissed = true;
+ return true;
+ }
+ }
+ }
+
+ index++;
+ if ( canContinueReadingL(index) ){
+ return mContext.logView().NextL( mContext.reqStatus() );
+ }
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReading::handleMissedL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateReading::handleMissedL(LogsEvent& parsedEvent)
+{
+ bool handled = false;
+ if ( parsedEvent.direction() == LogsEvent::DirMissed ){
+ handled = duplicatesL(mDuplicateMissedFilter);
+ }
+ return handled;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReading::updateReadSizeCounter
+// ----------------------------------------------------------------------------
+//
+void LogsReaderStateReading::updateReadSizeCounter(LogsEvent& event)
+{
+ if ( LogsCommonData::getInstance().maxReadSize() >= 0 ){
+ LogsEvent::LogsDirection dir =
+ LogsCommonData::getInstance().maxReadSizeDirection();
+ if ( dir == LogsEvent::DirUndefined || dir == event.direction() ){
+ mReadSizeCounter++;
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReading::canContinueReadingL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateReading::canContinueReadingL(int index) const
+{
+ bool canContinue( index < viewCountL() );
+ int maxReadSize = LogsCommonData::getInstance().maxReadSize();
+ if ( canContinue && maxReadSize >= 0 ){
+ canContinue = ( mReadSizeCounter < maxReadSize );
+ }
+ return canContinue;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFillDetails::LogsReaderStateFillDetails
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateFillDetails::LogsReaderStateFillDetails(
+ LogsReaderStateContext& context)
+ : LogsReaderStateBase(context)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFillDetails::~LogsReaderStateFillDetails
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateFillDetails::~LogsReaderStateFillDetails()
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFillDetails::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateFillDetails::enterL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateFillDetails::enterL()" )
+ fillDetails();
+ LOGS_QDEBUG( "logs [ENG] <- LogsReaderStateFillDetails::enterL()" )
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFillDetails::fillDetails
+// ----------------------------------------------------------------------------
+//
+void LogsReaderStateFillDetails::fillDetails()
+{
+ QHash<QString, ContactCacheEntry>& contactMappings = mContext.contactCache();
+ QList<LogsEvent*> &events = mContext.events();
+ foreach ( LogsEvent* event, events ){
+ const QString& num = event->getNumberForCalling();
+ if ( !event->isInView() ){
+ // Not interested about to be removed event
+ } else 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 );
+ 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
+ ContactCacheEntry contactEntry(contactNameStr, event->contactLocalId());
+ contactMappings.insert( num, contactEntry );
+ }
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateDone::LogsReaderStateDone
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateDone::LogsReaderStateDone(
+ LogsReaderStateContext& context )
+ : LogsReaderStateBase(context)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateDone::~LogsReaderStateDone
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateDone::~LogsReaderStateDone()
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateDone::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateDone::enterL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateDone::enterL" );
+
+ int numRead = qMin(mContext.index(),viewCountL());
+ mContext.observer().readCompleted(numRead);
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReaderStateDone::enterL" );
+
+ return false;
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateSearchingEvent::LogsReaderStateSearchingEvent
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateSearchingEvent::LogsReaderStateSearchingEvent(
+ LogsReaderStateContext& context )
+ : LogsReaderStateBase(context)
+{
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateSearchingEvent::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateSearchingEvent::enterL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateSearchingEvent::enterL" );
+ if ( viewCountL() > 0 && mContext.logView().FirstL( mContext.reqStatus() ) ){
+ return true;
+ }
+ return enterNextStateL();
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateSearchingEvent::continueL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateSearchingEvent::continueL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateSearchingEvent::continueL" );
+ int& index = mContext.index();
+ if ( event().Id() != mContext.currentEventId() ) {
+ index++;
+ if ( index < viewCountL() ){
+ return mContext.logView().NextL( mContext.reqStatus() );
+ }
+ }
+
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFindingDuplicates::LogsReaderStateFindingDuplicates
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateFindingDuplicates::LogsReaderStateFindingDuplicates(
+ LogsReaderStateContext& context )
+ : LogsReaderStateBase(context),
+ mDuplicateFilter(0)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFindingDuplicates::~LogsReaderStateFindingDuplicates
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateFindingDuplicates::~LogsReaderStateFindingDuplicates()
+{
+ delete mDuplicateFilter;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFindingDuplicates::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateFindingDuplicates::enterL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateFindingDuplicates::enterL" );
+
+ if ( !mDuplicateFilter ){
+ // Interested only about duplicates which are not marked as read
+ mDuplicateFilter = CLogFilter::NewL();
+ mDuplicateFilter->SetFlags(KLogEventRead);
+ mDuplicateFilter->SetNullFields(ELogFlagsField);
+ }
+
+ if ( duplicatesL(mDuplicateFilter) ) {
+ LOGS_QDEBUG( "logs [ENG] duplicates exist!");
+ return true;
+ }
+
+ // Not possible to continue with finding
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateFindingDuplicates::continueL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateFindingDuplicates::continueL()
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsReaderStateFindingDuplicates::continueL" );
+
+ return enterNextStateL();
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateMarkingDuplicates::LogsReaderStateMarkingDuplicates
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateMarkingDuplicates::LogsReaderStateMarkingDuplicates(
+ LogsReaderStateContext& context )
+ : LogsReaderStateBase(context)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateMarkingDuplicates::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateMarkingDuplicates::enterL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateMarkingDuplicates::enterL" );
+
+ mGettingDuplicates = false;
+ if ( event().Id() == mContext.currentEventId() ) {
+ // Mark event read
+ event().SetFlags( event().Flags() | KLogEventRead );
+ mContext.logClient().ChangeEvent(event(), mContext.reqStatus());
+ return true;
+ }
+
+ // Not possible to continue with marking
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateMarkingDuplicates::continueL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateMarkingDuplicates::continueL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateMarkingDuplicates::continueL" );
+
+ if ( !mGettingDuplicates ){
+ if ( duplicatesL() ) {
+ LOGS_QDEBUG( "logs [ENG] duplicates exist!");
+ mGettingDuplicates = true;
+ return true;
+ }
+ } else {
+ // Mark duplicate events read
+ mContext.duplicatesView().SetFlagsL(
+ mContext.duplicatesView().Event().Flags() | KLogEventRead );
+ }
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReaderStateMarkingDuplicates::continueL" );
+
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReadingDuplicates::LogsReaderStateReadingDuplicates
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateReadingDuplicates::LogsReaderStateReadingDuplicates(
+ LogsReaderStateContext& context )
+ : LogsReaderStateBase(context)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReadingDuplicates::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateReadingDuplicates::enterL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateReadingDuplicates::enterL" );
+ if ( mContext.duplicatesView().CountL() > 0 &&
+ mContext.duplicatesView().FirstL(mContext.reqStatus()) ){
+ LOGS_QDEBUG( "logs [ENG] duplicates exist!");
+ return true;
+ }
+
+ // Not possible to continue with deletion
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReadingDuplicates::continueL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateReadingDuplicates::continueL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateReadingDuplicates::continueL" );
+
+ int nextIndex = mContext.duplicatedEvents().count();
+ const CLogEvent& sourceEvent = mContext.duplicatesView().Event();
+ LogsEvent* event = new LogsEvent;
+ constructAndInsertEventL(
+ sourceEvent, event, nextIndex, mContext.duplicatedEvents() );
+ if ( mContext.duplicatesView().NextL(mContext.reqStatus()) ) {
+ return true;
+ }
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReaderStateReadingDuplicates::continueL" );
+
+ return enterNextStateL();
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateModifyingDone::LogsReaderStateModifyingDone
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateModifyingDone::LogsReaderStateModifyingDone(
+ LogsReaderStateContext& context) : LogsReaderStateBase(context)
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateModifyingDone::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateModifyingDone::enterL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateModifyingDone::enterL" );
+
+ LogsEvent* modifiedEvent = eventById(mContext.currentEventId());
+ if ( modifiedEvent ){
+ // Update modified event to know that it has been marked. Real
+ // update of the event happens soon when db notifies the change.
+ modifiedEvent->markedAsSeenLocally(true);
+ }
+ mContext.observer().eventModifyingCompleted();
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReaderStateModifyingDone::enterL" );
+
+ return false;
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReadingDuplicatesDone::LogsReaderStateReadingDuplicatesDone
+// ----------------------------------------------------------------------------
+//
+LogsReaderStateReadingDuplicatesDone::LogsReaderStateReadingDuplicatesDone(
+ LogsReaderStateContext& context) : LogsReaderStateBase(context)
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// LogsReaderStateReadingDuplicatesDone::enterL
+// ----------------------------------------------------------------------------
+//
+bool LogsReaderStateReadingDuplicatesDone::enterL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsReaderStateReadingDuplicatesDone::enterL" );
+
+ QList<LogsEvent*> duplicates = mContext.duplicatedEvents();
+ mContext.duplicatedEvents().clear();
+ mContext.observer().duplicatesReadingCompleted(duplicates);
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsReaderStateReadingDuplicatesDone::enterL" );
+
+ return false;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/src/logsremove.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,220 @@
+/*
+* 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 "logsremove.h"
+#include "logsmodel.h"
+#include "logslogger.h"
+#include "logsremoveobserver.h"
+#include <logcli.h>
+#include <f32file.h>
+#include <logview.h>
+//SYSTEM
+
+// CONSTANTS
+_LIT( KMaxLogsTime, "99991130:235959.999999");
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsRemove::LogsRemove( LogsRemoveObserver& observer, bool readingAllEvents )
+: CActive(EPriorityStandard),
+ mObserver(observer),
+ mReadingAllEvents(readingAllEvents),
+ mLogClient(0),
+ mRecentView(0)
+{
+ CActiveScheduler::Add( this );
+ mFsSession = new RFs();
+}
+
+// -----------------------------------------------------------------------------
+// LogsRemove::~LogsRemove
+// -----------------------------------------------------------------------------
+//
+LogsRemove::~LogsRemove()
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsRemove::~LogsRemove()" )
+ Cancel();
+ delete mRecentView;
+ delete mLogClient;
+ if ( mFsSession ){
+ mFsSession->Close();
+ }
+ delete mFsSession;
+}
+
+// ----------------------------------------------------------------------------
+// LogsRemove::RunL
+// ----------------------------------------------------------------------------
+//
+void LogsRemove::RunL()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsRemove::RunL()->" )
+ if (iStatus.Int() == KErrNone){
+ LOGS_QDEBUG( "logs [ENG] -> LogsRemove::RunL() KErrNone" )
+ if ( !DeleteNextEvent() ){
+ mObserver.removeCompleted();
+ }
+ }
+ else {
+ User::Leave( iStatus.Int() );
+ LOGS_QDEBUG( "logs [ENG] -> LogsRemove::RunL() !KErrNone" )
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsRemove::RunL()<-" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsRemove::DoCancel
+// ----------------------------------------------------------------------------
+//
+void LogsRemove::DoCancel()
+{
+ if ( mLogClient ){
+ mLogClient->Cancel();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsRemove::RunError
+// ----------------------------------------------------------------------------
+//
+TInt LogsRemove::RunError(TInt aError)
+{
+ mObserver.logsRemoveErrorOccured(aError);
+ return KErrNone;
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsRemove::init
+// ----------------------------------------------------------------------------
+//
+int LogsRemove::init()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsRemove::init()" )
+ TRAPD( err, initL() );
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsRemove::init(), err:", err )
+ return err;
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsRemove::clearList
+// ----------------------------------------------------------------------------
+//
+bool LogsRemove::clearList(LogsModel::ClearType cleartype)
+{
+ LOGS_QDEBUG( "logs [ENG] <- LogsRemove::clearList->" )
+ if ( init() != KErrNone ) {
+ return false;
+ }
+ bool clearingStarted(false);
+ TTime time( KMaxLogsTime );
+ if ( !IsActive() ){
+ if (cleartype == LogsModel::TypeLogsClearAll){
+ mLogClient->ClearLog( time, iStatus );
+ }
+ else{
+ mLogClient->ClearLog( cleartype, iStatus );
+ }
+ SetActive();
+ clearingStarted = true;
+ } else {
+ }
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsRemove::clearList, started", clearingStarted )
+ return clearingStarted;
+}
+
+// ----------------------------------------------------------------------------
+// LogsRemove::initL
+// ----------------------------------------------------------------------------
+//
+void LogsRemove::initL()
+{
+ if ( mLogClient ){
+ // Already initialized
+ return;
+ }
+ User::LeaveIfError( mFsSession->Connect() );
+ mLogClient = CLogClient::NewL( *mFsSession );
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsRemove::clearEvents
+// ----------------------------------------------------------------------------
+//
+int LogsRemove::clearEvents(const QList<int>& eventIds, bool& async)
+{
+ TRAPD( err, clearEventsL(eventIds, async) );
+ return err;
+}
+
+// ----------------------------------------------------------------------------
+// LogsRemove::clearEventsL
+// ----------------------------------------------------------------------------
+//
+void LogsRemove::clearEventsL(const QList<int>& eventIds, bool& async)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsRemove::clearEventL()")
+
+ async = false;
+
+ initL();
+
+ if ( mReadingAllEvents ){
+ // When all events are read, recent view cannot be used for
+ // event removal.
+ Cancel();
+ mRemovedEvents = eventIds;
+ async = DeleteNextEvent();
+ } else {
+ if ( !mRecentView ) {
+ mRecentView = CLogViewRecent::NewL( *mLogClient );
+ }
+ foreach( int currId, eventIds ){
+ LOGS_QDEBUG_2( "logs [ENG] Removing, currid: ", currId )
+ mRecentView->RemoveL( currId );
+ }
+ delete mRecentView;
+ mRecentView = NULL;
+ }
+
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsRemove::clearEventL(): async", async )
+}
+
+// ----------------------------------------------------------------------------
+// LogsRemove::DeleteNextEvent
+// ----------------------------------------------------------------------------
+//
+bool LogsRemove::DeleteNextEvent()
+{
+ bool deleting(false);
+ if ( !mRemovedEvents.isEmpty() ){
+ int currId = mRemovedEvents.takeFirst();
+ LOGS_QDEBUG_2( "logs [ENG] LogsRemove::DeleteNextEvent, id: ", currId )
+ mLogClient->DeleteEvent( currId, iStatus );
+ SetActive();
+ deleting = true;
+ }
+ return deleting;
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/stubs/centralrepository_stub.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* 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;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/stubs/centralrepository_stub_helper.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* 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/logclient_stubs.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,475 @@
+/*
+* 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 <logcli.h>
+#include <logview.h>
+#include <logclientchangeobserver.h>
+
+#include "logclient_stubs_helper.h"
+
+bool stubAsyncCallPossible = true;
+int stubViewCount = 1;
+int stubLeaveWithError = KErrNone;
+int stubViewFlagsValue = 0;
+
+// ----------------------------------------------------------------------------
+// LogClientStubsHelper
+// ----------------------------------------------------------------------------
+//
+void LogClientStubsHelper::reset()
+{
+ stubAsyncCallPossible = true;
+ stubLeaveWithError = KErrNone;
+ stubViewFlagsValue = 0;
+}
+
+void LogClientStubsHelper::createEvents(int numEvents)
+{
+
+}
+
+void LogClientStubsHelper::setStubAsyncCallPossible(bool asyncPossible)
+{
+ stubAsyncCallPossible = asyncPossible;
+}
+
+void LogClientStubsHelper::setViewCount(int viewCount)
+{
+ stubViewCount = viewCount;
+}
+
+void LogClientStubsHelper::setLeaveWithError(int error)
+{
+ stubLeaveWithError = error;
+}
+
+int LogClientStubsHelper::stubViewFlags()
+{
+ return stubViewFlagsValue;
+}
+
+// ----------------------------------------------------------------------------
+// CLogActive
+// ----------------------------------------------------------------------------
+//
+CLogActive::~CLogActive()
+{
+}
+
+CLogActive::CLogActive(TInt aPriority) : CActive( aPriority )
+{
+
+}
+void CLogActive::DoCancel()
+{
+
+}
+void CLogActive::RunL()
+{
+
+}
+void CLogActive::DoComplete(TInt&)
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// CLogBase
+// ----------------------------------------------------------------------------
+//
+CLogBase::CLogBase(TInt aPriority) : CLogActive( aPriority )
+{
+
+}
+CLogBase::~CLogBase()
+{
+
+}
+
+TInt CLogBase::GetString(TDes& aString, TInt /*aId*/) const
+{
+ aString.Copy( _L("dummy_stub_string") );
+ return KErrNone;
+}
+
+void CLogBase::GetEvent(CLogEvent& /*aEvent*/, TRequestStatus& /*aStatus*/)
+{
+
+}
+void CLogBase::AddEvent(CLogEvent& /*aEvent*/, TRequestStatus& /*aStatus*/)
+{
+
+}
+void CLogBase::ChangeEvent(const CLogEvent& /*aEvent*/, TRequestStatus& /*aStatus*/)
+{
+
+}
+void CLogBase::DeleteEvent(TLogId /*aId*/, TRequestStatus& /*aStatus*/)
+{
+
+}
+void CLogBase::DoRunL()
+{
+
+}
+void CLogBase::CLogBase_Reserved1()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// CLogClient
+// ----------------------------------------------------------------------------
+//
+CLogClient* CLogClient::NewL(RFs& aFs, TInt aPriority)
+{
+ User::LeaveIfError(stubLeaveWithError);
+ CLogClient* self = new ( ELeave ) CLogClient(aFs, aPriority);
+ return self;
+}
+
+CLogClient::CLogClient(RFs& aFs, TInt aPriority) : CLogBase(aPriority), iFs( aFs )
+{
+}
+CLogClient::~CLogClient()
+{
+
+}
+
+void CLogClient::SetGlobalChangeObserverL(MLogClientChangeObserver* /*aObserver*/)
+{
+
+}
+
+TInt CLogClient::GetString(TDes& aString, TInt /*aId*/) const
+{
+ aString.Copy( _L("dummy_stub") );
+ return KErrNone;
+}
+
+void CLogClient::AddEvent(CLogEvent& /*aEvent*/, TRequestStatus& /*aStatus*/)
+{
+
+}
+void CLogClient::GetEvent(CLogEvent& /*aEvent*/, TRequestStatus& /*aStatus*/)
+{
+
+}
+void CLogClient::ChangeEvent(const CLogEvent& /*aEvent*/, TRequestStatus& /*aStatus*/)
+{
+
+}
+void CLogClient::DeleteEvent(TLogId /*aId*/, TRequestStatus& aStatus)
+{
+ aStatus = KRequestPending;
+ User::RequestComplete( &aStatus, KErrNone );
+}
+
+void CLogClient::DoRunL()
+{
+
+}
+void CLogClient::DoCancel()
+{
+
+}
+
+void CLogClient::ClearLog(const TTime& /*aDate*/, TRequestStatus& aStatus)
+{
+ aStatus = KRequestPending;
+ User::RequestComplete( &aStatus, KErrNone );
+}
+
+void CLogClient::ClearLog(TInt /*aRecentList*/, TRequestStatus& aStatus)
+{
+ aStatus = KRequestPending;
+ User::RequestComplete( &aStatus, KErrNone );
+}
+
+void CLogClient::CLogBase_Reserved1()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// CLogFilterList
+// ----------------------------------------------------------------------------
+//
+CLogFilterList::CLogFilterList() : CArrayPtrFlat( 4 )
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// CLogFilter
+// ----------------------------------------------------------------------------
+//
+CLogFilter* CLogFilter::NewL()
+{
+ return new ( ELeave ) CLogFilter;
+}
+CLogFilter::~CLogFilter()
+{
+
+}
+
+CLogFilter::CLogFilter()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// CLogView
+// ----------------------------------------------------------------------------
+//
+CLogView::~CLogView()
+{
+ delete iEvent;
+}
+
+TBool CLogView::FirstL(TRequestStatus& aStatus)
+{
+ aStatus = KRequestPending;
+ User::RequestComplete( &aStatus, KErrNone );
+ return ETrue;
+}
+
+TBool CLogView::NextL(TRequestStatus& aStatus)
+{
+ if ( stubAsyncCallPossible ){
+ aStatus = KRequestPending;
+ User::RequestComplete( &aStatus, KErrNone );
+ }
+ return stubAsyncCallPossible;
+}
+
+TInt CLogView::CountL()
+{
+ return stubViewCount;
+}
+
+CLogView::CLogView(CLogClient& aClient, TInt aPriority)
+ : CLogActive( aPriority ), iClient( aClient )
+{
+ TRAP_IGNORE( iEvent = CLogEvent::NewL() )
+}
+
+void CLogView::DoRunL()
+{
+
+}
+
+void CLogView::DoCancel()
+{
+
+}
+
+void CLogView::SetFlagsL(TLogFlags aFlags)
+{
+ stubViewFlagsValue = aFlags;
+}
+
+// ----------------------------------------------------------------------------
+// CLogViewRecent
+// ----------------------------------------------------------------------------
+//
+CLogViewRecent* CLogViewRecent::NewL(CLogClient& aClient, TInt aPriority)
+{
+return new ( ELeave ) CLogViewRecent(aClient, aPriority );
+}
+CLogViewRecent* CLogViewRecent::NewL(
+ CLogClient& aClient, MLogViewChangeObserver& /*aObserver*/, TInt aPriority)
+{
+ return new ( ELeave ) CLogViewRecent(aClient, aPriority );
+}
+CLogViewRecent::~CLogViewRecent()
+{
+
+}
+
+CLogViewRecent::CLogViewRecent(CLogClient& aClient, TInt aPriority)
+ : CLogView( aClient, aPriority )
+{
+
+}
+TBool CLogViewRecent::SetRecentListL(TLogRecentList aList, TRequestStatus& aStatus)
+{
+ iRecentList = aList;
+ if ( stubAsyncCallPossible ){
+ aStatus = KRequestPending;
+ User::RequestComplete( &aStatus, KErrNone );
+ }
+ return stubAsyncCallPossible;
+}
+TBool CLogViewRecent::SetRecentListL(
+ TLogRecentList aList, const CLogFilter& /*aFilter*/, TRequestStatus& aStatus)
+{
+ iRecentList = aList;
+ if ( stubAsyncCallPossible ){
+ aStatus = KRequestPending;
+ User::RequestComplete( &aStatus, KErrNone );
+ }
+ return stubAsyncCallPossible;
+}
+TBool CLogViewRecent::SetRecentListL(
+ TLogRecentList aList, const CLogFilterList& /*aFilterList*/, TRequestStatus& aStatus)
+{
+ iRecentList = aList;
+ if ( stubAsyncCallPossible ){
+ aStatus = KRequestPending;
+ User::RequestComplete( &aStatus, KErrNone );
+ }
+ return stubAsyncCallPossible;
+}
+
+void CLogViewRecent::DoRunL()
+{
+
+}
+
+TBool CLogViewRecent::DuplicatesL(CLogViewDuplicate& /*aView*/, TRequestStatus& aStatus)
+{
+ if ( stubAsyncCallPossible ){
+ aStatus = KRequestPending;
+ User::RequestComplete( &aStatus, KErrNone );
+ }
+ return stubAsyncCallPossible;
+}
+
+TBool CLogViewRecent::DuplicatesL(CLogViewDuplicate &/*aView*/, const CLogFilter &/*aFilter*/, TRequestStatus &aStatus)
+{
+ if ( stubAsyncCallPossible ){
+ aStatus = KRequestPending;
+ User::RequestComplete( &aStatus, KErrNone );
+ }
+ return stubAsyncCallPossible;
+}
+
+void CLogViewRecent::RemoveL(TLogId /*aId*/)
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// CLogViewEvent
+// ----------------------------------------------------------------------------
+//
+CLogViewEvent* CLogViewEvent::NewL(CLogClient& aClient, TInt aPriority)
+{
+ CLogViewEvent* self = new (ELeave) CLogViewEvent(aClient, aPriority);
+ return self;
+}
+CLogViewEvent* CLogViewEvent::NewL(
+ CLogClient& aClient, MLogViewChangeObserver& /*aObserver*/, TInt aPriority)
+{
+ CLogViewEvent* self = new (ELeave) CLogViewEvent(aClient, aPriority);
+ return self;
+}
+CLogViewEvent::~CLogViewEvent()
+{
+
+}
+TBool CLogViewEvent::SetFilterL(const CLogFilterList& /*aFilterList*/, TRequestStatus& aStatus)
+{
+ if ( stubAsyncCallPossible ){
+ aStatus = KRequestPending;
+ User::RequestComplete( &aStatus, KErrNone );
+ }
+ return stubAsyncCallPossible;
+}
+CLogViewEvent::CLogViewEvent(CLogClient& aClient, TInt aPriority) :
+ CLogView(aClient, aPriority)
+{
+}
+
+// ----------------------------------------------------------------------------
+// CLogViewDuplicate
+// ----------------------------------------------------------------------------
+//
+CLogViewDuplicate* CLogViewDuplicate::NewL(
+ CLogClient& aClient, TInt aPriority)
+{
+ return new ( ELeave ) CLogViewDuplicate(aClient, aPriority );
+}
+
+CLogViewDuplicate* CLogViewDuplicate::NewL(
+ CLogClient& aClient, MLogViewChangeObserver& /*aObserver*/, TInt aPriority)
+{
+ return new ( ELeave ) CLogViewDuplicate(aClient, aPriority );
+}
+
+CLogViewDuplicate::~CLogViewDuplicate()
+{
+
+}
+
+CLogViewDuplicate::CLogViewDuplicate(CLogClient& aClient, TInt aPriority) :
+ CLogView(aClient, aPriority)
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// CLogEvent
+// ----------------------------------------------------------------------------
+//
+CLogEvent* CLogEvent::NewL()
+{
+ CLogEvent* self = new ( ELeave ) CLogEvent;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+}
+
+void CLogEvent::ConstructL()
+{
+ iNumber = HBufC::NewL( 200 );
+ iDirection = HBufC::NewL( 200 );
+ iRemoteParty = HBufC::NewL( 200 );
+}
+CLogEvent::~CLogEvent()
+{
+ delete iNumber;
+ delete iDirection;
+ delete iData;
+ delete iRemoteParty;
+}
+CLogEvent::CLogEvent()
+{
+
+}
+
+void CLogEvent::SetDataL(const TDesC8& aData)
+{
+ HBufC8* data = aData.AllocL();
+ delete iData;
+ iData = data;
+}
+
+// ----------------------------------------------------------------------------
+// MLogClientChangeObserver
+// ----------------------------------------------------------------------------
+//
+void MLogClientChangeObserver::MLogClientChangeObserver_Reserved1()
+{
+
+}
+void MLogClientChangeObserver::MLogClientChangeObserver_Reserved2()
+{
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/stubs/logclient_stubs_helper.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* 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:
+*
+*/
+
+/**
+* Helper class to control logcli stub behavior
+*
+*/
+class LogClientStubsHelper{
+ public:
+ static void reset();
+ static void createEvents(int numEvents);
+ static void setStubAsyncCallPossible(bool asyncPossible);
+ static void setViewCount(int viewCount);
+ static void setLeaveWithError(int error);
+ static int stubViewFlags();
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/stubs/qtcontacts_stubs.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,267 @@
+/*
+* 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 <qcontactmanager.h>
+#include <qcontactdetailfilter.h>
+#include <qcontactphonenumber.h>
+#include <QSharedDataPointer>
+#include <qcontactname.h>
+#include <qcontactdetail.h>
+#include <QSharedData>
+#include <qcontactavatar.h>
+#include "qtcontacts_stubs_helper.h"
+
+QTM_USE_NAMESPACE
+
+QString logsTestNumber = "";
+QContactLocalId logsTestContactId = 0;
+QContactLocalId logsTestContactLocalId = 0;
+QString logsTestAvatar = "";
+QString logsFirstName = "";
+QString logsLastName = "";
+Q_DECLARE_METATYPE(QContactAvatar *)
+
+void QtContactsStubsHelper::reset()
+{
+ logsTestNumber = "";
+ logsTestContactId = 0;
+ logsTestContactLocalId = 0;
+ logsFirstName = "";
+ logsLastName = "";
+}
+
+void QtContactsStubsHelper::setContactId(int id)
+{
+ logsTestContactId = id;
+}
+
+void QtContactsStubsHelper::setContactNames(const QString& first, const QString& last)
+{
+ logsFirstName = first;
+ logsLastName = last;
+}
+
+// ----------------------------------------------------------------------------
+// QContactData
+// ----------------------------------------------------------------------------
+//
+
+class QtMobility::QContactData : public QSharedData
+{
+public:
+ QContactData(): QSharedData()
+ {
+ }
+
+ ~QContactData() {}
+};
+
+class QtMobility::QContactDetailPrivate : public QSharedData
+{
+public:
+ QContactDetailPrivate(): QSharedData()
+ {
+ }
+
+ ~QContactDetailPrivate() {}
+};
+
+// ----------------------------------------------------------------------------
+// QContactManager
+// ----------------------------------------------------------------------------
+//
+QContactManager::QContactManager(
+ const QString& managerName, const QMap<QString, QString>& parameters, QObject* parent)
+{
+ Q_UNUSED(managerName)
+ Q_UNUSED(parameters)
+ Q_UNUSED(parent)
+}
+
+QContactManager::~QContactManager()
+{
+
+}
+
+QList<QContactLocalId> QContactManager::contacts(
+ const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders) const
+{
+ Q_UNUSED(filter)
+ Q_UNUSED(sortOrders)
+ QList<QContactLocalId> list;
+ if ( QString("11112222").endsWith(logsTestNumber) ){
+ list.append( logsTestContactId );
+ }
+ return list;
+}
+
+QList<QContactLocalId> QContactManager::contactIds(
+ const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders) const
+{
+ Q_UNUSED(filter)
+ Q_UNUSED(sortOrders)
+ QList<QContactLocalId> list;
+ if ( QString("11112222").endsWith(logsTestNumber) ){
+ list.append( logsTestContactId );
+ }
+ return list;
+}
+
+QContact QContactManager::contact(const QContactLocalId& contactId, const QStringList& definitionRestrictions) const
+{
+ Q_UNUSED(definitionRestrictions)
+ QContact contact;
+ if ( contactId == logsTestContactId ) {
+ logsTestContactLocalId = logsTestContactId;
+ }
+ return contact;
+}
+
+
+// ----------------------------------------------------------------------------
+// QContactDetailFilter
+// ----------------------------------------------------------------------------
+//
+QContactDetailFilter::QContactDetailFilter()
+{
+
+}
+
+void QContactDetailFilter::setDetailDefinitionName(
+ const QString& definition, const QString& fieldName)
+{
+
+}
+void QContactDetailFilter::setMatchFlags(QContactFilter::MatchFlags flags)
+{
+ Q_UNUSED(flags)
+}
+void QContactDetailFilter::setValue(const QVariant& value)
+{
+ logsTestNumber = value.toString();
+}
+
+// ----------------------------------------------------------------------------
+// QContact
+// ----------------------------------------------------------------------------
+//
+QContact::QContact() : d(new QContactData)
+{
+
+}
+
+QContact::~QContact()
+{
+
+}
+
+
+QContact& QContact::operator=(const QContact& other)
+{
+ Q_UNUSED(other)
+}
+
+QContactDetail QContact::detail(const QString& definitionId) const
+{
+ if ( definitionId == QContactName::DefinitionName ){
+ QContactName name;
+ return name;
+ } else if ( definitionId == QContactPhoneNumber::DefinitionName ){
+ QContactPhoneNumber number;
+ return number;
+ }
+ else if ( definitionId == QContactAvatar::DefinitionName){
+ QContactAvatar avatar;
+ avatar.setSubType(QContactAvatar::SubTypeImage);
+ avatar.setAvatar("c:\\data\\images\\logstest1.jpg");
+ return avatar;
+ }
+ QContactDetail detail;
+ return detail;
+}
+
+bool QContact::saveDetail(QContactDetail* detail)
+ {
+ return true;
+ }
+
+bool QContact::removeDetail(QContactDetail* detail)
+ {
+ return true;
+ }
+
+
+QContactLocalId QContact::localId() const
+{
+ return logsTestContactLocalId;
+}
+
+
+// ----------------------------------------------------------------------------
+// QContactDetail
+// ----------------------------------------------------------------------------
+//
+QContactDetail::QContactDetail()
+{
+
+}
+QContactDetail::QContactDetail(const QString& definitionName) : d(new QContactDetailPrivate)
+{
+ Q_UNUSED(definitionName)
+}
+QContactDetail::~QContactDetail()
+{
+
+}
+
+
+QContactDetail& QContactDetail::operator=(const QContactDetail& other)
+{
+ Q_UNUSED(other)
+}
+
+QString QContactDetail::definitionName() const
+{
+ return QString("");
+}
+
+bool QContactDetail::isEmpty() const
+{
+ return false;
+}
+
+
+QVariant QContactDetail::variantValue(const QString& key) const
+{
+ QString val = value(key);
+ return val;
+}
+
+QString QContactDetail::value(const QString& key) const
+{
+ if ( key == QContactName::FieldFirst ){
+ return logsFirstName;
+ } else if ( key == QContactName::FieldLast ) {
+ return logsLastName;
+ } else if ( key == QContactPhoneNumber::FieldNumber ) {
+ return QString( "12345" );
+ }
+ else if ( key == QContactAvatar::FieldAvatar){
+ return QString( "Avatar" );
+ }
+ return QString("");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/stubs/qtcontacts_stubs_helper.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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:
+*
+*/
+
+/**
+* Helper class to control qtcontacts stub behavior
+*
+*/
+class QtContactsStubsHelper{
+ public:
+ static void reset();
+ static void setContactId(int id);
+ static void setContactNames(const QString& first, const QString& last);
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logsdbconnector.h Tue May 04 12:39:37 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 UT_LOGSDBCONNECTOR_H
+#define UT_LOGSDBCONNECTOR_H
+
+#include <QObject>
+#include <QList>
+
+class LogsDbConnector;
+class LogsEvent;
+
+class UT_LogsDbConnector : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testInit();
+ void testClearList();
+ void testClearEvents();
+ void testMarkEventsSeen();
+ void testReadDuplicates();
+ void testStart();
+ void testReadCompleted();
+ void testErrorOccurred();
+ void testUpdateDetails();
+ void testClearMissedCallsCounter();
+ void testRefreshData();
+ void testCompressData();
+ void testPredictiveSearchStatus();
+ void testSetPredictiveSearch();
+
+private:
+
+ LogsDbConnector* mDbConnector;
+ QList<LogsEvent*> mEvents;
+
+};
+
+
+#endif //UT_LOGSDBCONNECTOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logseventdataparser.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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_LOGSEVENTDATAPARSER_H
+#define UT_LOGSEVENTDATAPARSER_H
+
+#include <QObject>
+
+class LogsEventData;
+class CLogEvent;
+
+class UT_LogsEventDataParser : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testParseMessageParts();
+ void testParseNonTagged();
+ void testParseTagged();
+
+private:
+
+ LogsEventData* mEventData;
+ CLogEvent* mEvent;
+
+};
+
+
+#endif //UT_LOGSEVENTDATAPARSER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logseventparser.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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_LOGSEVENTPARSER_H
+#define UT_LOGSEVENTPARSER_H
+
+#include <QObject>
+#include "logsengdefs.h"
+
+class LogsEvent;
+
+class UT_LogsEventParser : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testInitializeEventL();
+ void eventTypeSpecificParsing();
+ void testResolveEventType();
+
+private:
+
+ LogsEvent* mEvent;
+ LogsEventStrings mStrings;
+
+};
+
+
+#endif //UT_LOGSEVENTPARSER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logsforegroundwatcher.h Tue May 04 12:39:37 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_LOGSFOREGROUNDWATCHER_H
+#define UT_LOGSFOREGROUNDWATCHER_H
+
+#include <QObject>
+
+class LogsForegroundWatcher;
+
+class UT_LogsForegroundWatcher : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+ void testConstructor();
+ void testHandleLosingForeground();
+ void testHandleGainingForeground();
+
+
+private:
+
+ LogsForegroundWatcher* mWatcher;
+
+};
+
+
+#endif //UT_LOGSFOREGROUNDWATCHER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logsreader.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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_LOGSREADER_H
+#define UT_LOGSREADER_H
+
+#include <QObject>
+#include <f32file.h>
+#include "logsengdefs.h"
+#include "logsreaderobserver.h"
+
+class LogsDbConnector;
+class LogsEvent;
+class CLogClient;
+class LogsReader;
+
+class UT_LogsReader : public QObject, public LogsReaderObserver
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testStart();
+ void testStart2();
+ void testStop();
+ void testMarkEventSeen();
+ void testReadDuplicates();
+ void testRunL();
+ void testRunError();
+ void testStateContext();
+ void testViewChange();
+ void testUpdateDetails();
+
+protected: // From LogsReaderObserver
+
+ void readCompleted(int readCount);
+ void errorOccurred(int err);
+ void temporaryErrorOccurred(int err);
+ void eventModifyingCompleted();
+ void duplicatesReadingCompleted(QList<LogsEvent*> duplicates);
+
+private:
+
+ LogsReader* mReader;
+
+ bool mErrorOccurred;
+ int mError;
+
+ QList<LogsEvent*> mEvents;
+ RFs mFs;
+ CLogClient* mLogClient;
+ LogsEventStrings mStrings;
+
+};
+
+
+#endif //UT_LOGSREADER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logsreaderstates.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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_LOGSREADERSTATES_H
+#define UT_LOGSREADERSTATES_H
+
+#include <QObject>
+#include <QList>
+#include <e32base.h>
+#include "logsengdefs.h"
+#include "logsreaderstatecontext.h"
+#include "logsreaderobserver.h"
+
+class CLogClient;
+class LogsEvent;
+class CLogViewRecent;
+class CLogViewEvent;
+class LogsReaderStateBase;
+
+class UT_LogsReaderStates : public QObject,
+ public LogsReaderStateContext,
+ public LogsReaderObserver
+{
+ 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 testStateBase();
+ void testStateInitReading();
+ void testStateFiltering();
+ void testStateFilteringAll();
+ void testStateReading();
+ void testStateReading2();
+ void testStateFillDetails();
+ void testStateDone();
+ void testStateSearchingEvent();
+ void testStateFindingDuplicates();
+ void testStateMarkingDuplicates();
+ void testStateReadingDuplicates();
+ void testStateReadingDuplicatesDone();
+ void testStateModifyingDone();
+
+protected: // From LogsReaderStateContext
+
+ void setCurrentState(const LogsReaderStateBase& state);
+ CLogView& logView();
+ CLogViewDuplicate& duplicatesView();
+ QList<LogsEvent*>& events();
+ int& index();
+ LogsEventStrings& strings();
+ TRequestStatus& reqStatus();
+ LogsReaderObserver& observer();
+ QHash<QString, ContactCacheEntry>& contactCache();
+ int currentEventId();
+ CLogClient& logClient();
+ bool isRecentView();
+ QList<LogsEvent*>& duplicatedEvents();
+
+
+protected: // From LogsReaderObserver
+
+ void readCompleted(int readCount);
+ void errorOccurred(int err);
+ void temporaryErrorOccurred(int err);
+ void eventModifyingCompleted();
+ void duplicatesReadingCompleted(QList<LogsEvent*> duplicates);
+
+
+private:
+
+ void reset();
+
+
+private:
+
+ CLogClient* mLogClient;
+ const LogsReaderStateBase* mCurrentState;
+ CLogViewRecent* mLogView;
+ CLogViewEvent* mLogViewEvent;
+ CLogViewDuplicate* mDuplicatesView;
+ QList<LogsEvent*> mEvents;
+ int mIndex;
+ LogsEventStrings mStrings;
+ TRequestStatus mReqStatus;
+ bool mIsRecentView;
+
+ int mError;
+ int mTemporaryError;
+ bool mReadCompleted;
+ bool mModifyCompleted;
+ int mReadCount;
+ int mDuplicatesReadingCompletedCount;
+
+ QHash<QString, ContactCacheEntry> mContactCache;
+
+ int mCurrentEventId;
+ QList<LogsEvent*> mDuplicatedEvents;
+};
+
+
+#endif //UT_LOGSREADERSTATES_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/inc/ut_logsremove.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* 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_LOGSREMOVE_H
+#define UT_LOGSREMOVE_H
+
+#include <QObject>
+#include <f32file.h>
+#include "logsengdefs.h"
+#include "logsremoveobserver.h"
+#include <logcli.h>
+#include <e32base.h>
+#include <f32file.h>
+
+class LogsDbConnector;
+class LogsEvent;
+class CLogClient;
+class LogsRemove;
+
+class UT_LogsRemove : public QObject, public LogsRemoveObserver
+{
+ Q_OBJECT
+
+public:
+
+ virtual void removeCompleted();
+ virtual void logsRemoveErrorOccured(int err);
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+ void testConstructor();
+ void testclearList();
+ void testClearEvents();
+ void testDoCancel();
+ void testRunL();
+ void testRunError();
+ void testInit();
+
+private:
+
+ LogsRemove* mLogsRemove;
+
+ bool mErrorOccurred;
+ int mError;
+ bool mRemoveCompleted;
+
+};
+
+
+#endif //UT_LOGSREMOVE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/main.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* 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 <QtTest/QtTest>
+
+#include "ut_logsdbconnector.h"
+#include "ut_logsreader.h"
+#include "ut_logsreaderstates.h"
+#include "ut_logseventparser.h"
+#include "ut_logseventdataparser.h"
+#include "ut_logsforegroundwatcher.h"
+#include "testresultxmlparser.h"
+#include "ut_logsremove.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);
+ TestResultXmlParser parser;
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ UT_LogsForegroundWatcher ut_logsForegroundWatcher;
+ resultFileName = "c:/ut_logs_logsForegroundWatcher.xml";
+ QStringList args_logsForegroundWatcher( "ut_logsForegroundWatcher");
+ args_logsForegroundWatcher << "-xml" << "-o" << resultFileName;
+ QT_TRAP_THROWING( QTest::qExec(&ut_logsForegroundWatcher, args_logsForegroundWatcher); )
+ parser.parseAndPrintResults(resultFileName,true);
+
+
+
+ if (promptOnExit) {
+ printf("Press any key...\n");
+ getchar();
+ }
+ return 0;
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsdbconnector.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,456 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsdbconnector.h"
+#include "logsdbconnector.h"
+#include "logsevent.h"
+#include "logsmodel.h"
+#include "logsreader.h"
+#include "logscommondata.h"
+#include "centralrepository_stub_helper.h"
+
+#include <QtTest/QtTest>
+
+Q_DECLARE_METATYPE(QList<int>)
+
+#define LOGS_TEST_CREATE_EVENT(eventName, index, eventState ) \
+LogsEvent* eventName = new LogsEvent; \
+eventName->setIndex(index); \
+eventName->setLogId(index);\
+eventName->setIsInView(true); \
+eventName->mEventState = eventState; \
+mDbConnector->mEvents.insert(index, eventName)
+
+void UT_LogsDbConnector::initTestCase()
+{
+
+}
+
+void UT_LogsDbConnector::cleanupTestCase()
+{
+}
+
+
+void UT_LogsDbConnector::init()
+{
+ mDbConnector = new LogsDbConnector(mEvents);
+}
+
+void UT_LogsDbConnector::cleanup()
+{
+ delete mDbConnector;
+ mDbConnector = 0;
+}
+
+void UT_LogsDbConnector::testConstructor()
+{
+ QVERIFY( mDbConnector );
+}
+
+void UT_LogsDbConnector::testInit()
+{
+ QVERIFY( !mDbConnector->mLogsRemove );
+ QVERIFY( mDbConnector->init() == 0 );
+ QVERIFY( mDbConnector->mReader );
+ QVERIFY( mDbConnector->mLogsRemove );
+ QVERIFY( mDbConnector->mLogEventStrings.iFetched.length() > 0 );
+ QVERIFY( !mDbConnector->mCompressionEnabled );
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeUndefined );
+
+ // Resource control enabled
+ LogsDbConnector* connector = new LogsDbConnector(mEvents, false, true);
+ QVERIFY( connector->init() == 0 );
+ QVERIFY( connector->mReader );
+ QVERIFY( connector->mLogsRemove );
+ QVERIFY( connector->mCompressionEnabled );
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeCompressEnabled );
+ delete connector;
+}
+
+void UT_LogsDbConnector::testClearList()
+{
+ QVERIFY( !mDbConnector->mLogsRemove );
+ QVERIFY( !mDbConnector->clearList(LogsModel::TypeLogsClearAll) );
+
+ mDbConnector->init();
+ QVERIFY( mDbConnector->mLogsRemove );
+ QVERIFY( mDbConnector->clearList(LogsModel::TypeLogsClearAll) );
+}
+
+void UT_LogsDbConnector::testClearEvents()
+{
+ QVERIFY( !mDbConnector->mLogsRemove );
+ QList<int> events;
+ events.append(1);
+ QVERIFY( !mDbConnector->clearEvents(events) ); // sync
+
+ mDbConnector->init();
+ QVERIFY( mDbConnector->mLogsRemove );
+ mDbConnector->clearEvents(events);
+ QVERIFY( !mDbConnector->clearEvents(events) ); // sync
+}
+
+void UT_LogsDbConnector::testMarkEventsSeen()
+{
+ QList<int> events;
+ QSignalSpy spy( mDbConnector, SIGNAL(markingCompleted(int)) );
+
+ // Not ready
+ mDbConnector->mEventsSeen.clear();
+ mDbConnector->markEventsSeen(events);
+ QVERIFY( mDbConnector->mEventsSeen.count() == 0 );
+
+ // No events
+ mDbConnector->init();
+ mDbConnector->markEventsSeen(events);
+ QVERIFY( mDbConnector->mEventsSeen.count() == 0 );
+
+ // Marking missed as seen (one is already seen)
+ LOGS_TEST_CREATE_EVENT(event, 0, LogsEvent::EventAdded );
+ event->setDirection(LogsEvent::DirMissed);
+ LOGS_TEST_CREATE_EVENT(event2, 1, LogsEvent::EventAdded );
+ event2->setDirection(LogsEvent::DirMissed);
+ LOGS_TEST_CREATE_EVENT(event3, 2, LogsEvent::EventAdded );
+ event3->setDirection(LogsEvent::DirMissed);
+ events.append(0);
+ events.append(1);
+ QVERIFY( mDbConnector->markEventsSeen(events) );
+ QVERIFY( mDbConnector->mEventsSeen.count() == 2 );
+ QVERIFY( mDbConnector->mReader->mCurrentEventId == 0 ); // Started modifying
+
+ // Trying to clear missed again, id is appended to mark list, old modifying process in ongoing
+ // and is not interrupted
+ events.append(2);
+ QVERIFY( !mDbConnector->markEventsSeen(events) );
+ QVERIFY( mDbConnector->mEventsSeen.count() == 3 );
+ QVERIFY( mDbConnector->mReader->mCurrentEventId == 0 ); // Modifying still previous
+
+ // Completed previous modifying, next one in queue is modified
+ mDbConnector->mReader->Cancel();
+ mDbConnector->eventModifyingCompleted();
+ QVERIFY( mDbConnector->mEventsSeen.count() == 2 );
+ QVERIFY( mDbConnector->mReader->mCurrentEventId == 1 ); // Started modifying next one
+ QVERIFY( spy.count() == 0 ); // Not yet totally completed
+
+ // Last pending gets completed
+ mDbConnector->mEventsSeen.takeLast(); // Now only one pending left
+ mDbConnector->eventModifyingCompleted();
+ QVERIFY( mDbConnector->mEventsSeen.count() == 0 );
+ QVERIFY( spy.count() == 1 ); // Completion was signaled with err 0
+ QVERIFY( spy.takeFirst().at(0).toInt() == 0 );
+
+ // Clearing all, ids are not appended as those are already in modification list
+ mDbConnector->mEventsSeen.clear();
+ mDbConnector->mEventsSeen.append(0);
+ mDbConnector->mEventsSeen.append(1);
+ mDbConnector->mEventsSeen.append(2);
+ QVERIFY( !mDbConnector->markEventsSeen(events) );
+ QVERIFY( mDbConnector->mEventsSeen.count() == 3 );
+}
+
+void UT_LogsDbConnector::testReadDuplicates()
+{
+ QSignalSpy spy( mDbConnector, SIGNAL(duplicatesRead()) );
+
+ // Not ready
+ QVERIFY( mDbConnector->readDuplicates(2) != 0 );
+
+ // Previous results are cleared when starting ok
+ LogsEvent* event = new LogsEvent;
+ mDbConnector->mDuplicatedEvents.append(event);
+ mDbConnector->init();
+ mDbConnector->readDuplicates(2);
+ QVERIFY( mDbConnector->mDuplicatedEvents.count() == 0 );
+
+ // Completes
+ LogsEvent* event2 = new LogsEvent;
+ LogsEvent* event3 = new LogsEvent;
+ QList<LogsEvent*> duplicates;
+ duplicates.append(event2);
+ duplicates.append(event3);
+ mDbConnector->duplicatesReadingCompleted(duplicates);
+ QVERIFY( mDbConnector->mDuplicatedEvents.count() == 2 );
+ QVERIFY( spy.count() == 1 );
+
+ // Client reads those events
+ QList<LogsEvent*> takenEvents = mDbConnector->takeDuplicates();
+ QVERIFY( mDbConnector->mDuplicatedEvents.count() == 0 );
+ QVERIFY( takenEvents.count() == 2 );
+
+}
+
+void UT_LogsDbConnector::testStart()
+{
+ // No reader, starting fails
+ QVERIFY( mDbConnector->start() == -1 );
+
+ // Starting ok
+ mDbConnector->init();
+ QVERIFY( mDbConnector->start() == 0 );
+}
+
+void UT_LogsDbConnector::testReadCompleted()
+{
+ qRegisterMetaType< QList<int> >("QList<int>");
+ QSignalSpy spyAdded(mDbConnector, SIGNAL(dataAdded(QList<int>)));
+ QSignalSpy spyRemoved(mDbConnector, SIGNAL(dataRemoved(QList<int>)));
+ QSignalSpy spyUpdated(mDbConnector, SIGNAL(dataUpdated(QList<int>)));
+
+ // No events, no signal
+ mDbConnector->readCompleted(0);
+ QVERIFY( spyAdded.count() == 0 );
+ QVERIFY( spyRemoved.count() == 0 );
+ QVERIFY( spyUpdated.count() == 0 );
+
+ // Events exists, their indexes are signaled
+ LOGS_TEST_CREATE_EVENT(event, 0, LogsEvent::EventAdded );
+ mDbConnector->readCompleted(1);
+ QVERIFY( spyAdded.count() == 1 );
+ QList<int> addedIndexes = qvariant_cast< QList<int> >(spyAdded.at(0).at(0));
+ QVERIFY( addedIndexes.count() == 1 );
+ QVERIFY( addedIndexes.at(0) == 0 );
+ QVERIFY( spyRemoved.count() == 0 );
+ QVERIFY( spyUpdated.count() == 0 );
+ QVERIFY( mDbConnector->mEvents.count() == 1 );
+ QVERIFY( mEvents.count() == 1 );
+
+ // 2 more events added, their indexes are signaled
+ event->mEventState = LogsEvent::EventNotUpdated;
+ event->setIndex(2);
+ LOGS_TEST_CREATE_EVENT(event2, 0, LogsEvent::EventAdded );
+ LOGS_TEST_CREATE_EVENT(event3, 1, LogsEvent::EventAdded );
+ mDbConnector->readCompleted(3);
+ QVERIFY( spyAdded.count() == 2 );
+ QList<int> addedIndexes2 = qvariant_cast< QList<int> >(spyAdded.at(1).at(0));
+ QVERIFY( addedIndexes2.count() == 2 );
+ QVERIFY( addedIndexes2.at(0) == 0 );
+ QVERIFY( addedIndexes2.at(1) == 1 );
+ QVERIFY( spyRemoved.count() == 0 );
+ QVERIFY( spyUpdated.count() == 0 );
+ QVERIFY( mDbConnector->mEvents.count() == 3 );
+ QVERIFY( mEvents.count() == 3 );
+
+ // One of the events updated (index 1)
+ event->mEventState = LogsEvent::EventNotUpdated;
+ event2->mEventState = LogsEvent::EventNotUpdated;
+ event3->mEventState = LogsEvent::EventUpdated;
+ mDbConnector->readCompleted(3);
+ QVERIFY( spyAdded.count() == 2 );
+ QVERIFY( spyRemoved.count() == 0 );
+ QVERIFY( spyUpdated.count() == 1 );
+ QList<int> updatedIndexes = qvariant_cast< QList<int> >(spyUpdated.at(0).at(0));
+ QVERIFY( updatedIndexes.count() == 1 );
+ QVERIFY( updatedIndexes.at(0) == 1 );
+ QVERIFY( mDbConnector->mEvents.count() == 3 );
+ QVERIFY( mEvents.count() == 3 );
+
+ // One of the events removed (index 2)
+ event->setIsInView(false);
+ event3->mEventState = LogsEvent::EventNotUpdated;
+ mDbConnector->readCompleted(2);
+ QVERIFY( spyAdded.count() == 2 );
+ QVERIFY( spyRemoved.count() == 1 );
+ QVERIFY( spyUpdated.count() == 1 );
+ QList<int> removedIndexes = qvariant_cast< QList<int> >(spyRemoved.at(0).at(0));
+ QVERIFY( removedIndexes.count() == 1 );
+ QVERIFY( removedIndexes.at(0) == 2 ); // index 2
+ QVERIFY( mDbConnector->mEvents.count() == 2 );
+ QVERIFY( mEvents.count() == 2 );
+
+ // 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(0);
+ QVERIFY( mDbConnector->mReader->mLogViewRecent == 0 );
+}
+
+void UT_LogsDbConnector::testErrorOccurred()
+{
+ // If pending event modifying, completion is signaled
+ QSignalSpy spy( mDbConnector, SIGNAL(markingCompleted(int)) );
+ mDbConnector->mEventsSeen.append(0);
+ mDbConnector->mEventsSeen.append(1);
+ mDbConnector->errorOccurred(-3);
+ QVERIFY( spy.count() == 1 ); // Completion was signaled with err -3
+ QVERIFY( spy.takeFirst().at(0).toInt() == -3 );
+ QVERIFY( mDbConnector->mEventsSeen.count() == 0 );
+}
+
+void UT_LogsDbConnector::testUpdateDetails()
+{
+ QSignalSpy spyUpdated(mDbConnector, SIGNAL(dataUpdated(QList<int>)));
+ QVERIFY( !mDbConnector->mReader );
+ QVERIFY( mDbConnector->updateDetails(false) == -1 );
+ QVERIFY( spyUpdated.count() == 0 );
+
+ mDbConnector->init();
+ QVERIFY( mDbConnector->mReader );
+ LOGS_TEST_CREATE_EVENT(event, 0, LogsEvent::EventUpdated );
+ QVERIFY( mDbConnector->updateDetails(false) == 0 );
+ QVERIFY( spyUpdated.count() == 1 );
+}
+
+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 );
+
+ // Resource control enabled, no reader
+ mDbConnector->mResourceControl = true;
+ QVERIFY( mDbConnector->refreshData() == 0 );
+
+ // Reader exists, not compressed before, nothing done
+ mDbConnector->init();
+ mDbConnector->mCompressionEnabled = false;
+ QVERIFY( mDbConnector->refreshData() == 0 );
+ QVERIFY( !mDbConnector->mReader->IsActive() );
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeUndefined );
+
+ // Reader exists, compressed before, reading started
+ mDbConnector->mCompressionEnabled = true;
+ QVERIFY( mDbConnector->refreshData() == 0 );
+ QVERIFY( mDbConnector->mReader->IsActive() );
+ QVERIFY( !mDbConnector->mCompressionEnabled );
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeUndefined );
+
+ // Reading not started again as already active
+ LogsCommonData::getInstance().configureReadSize(30, LogsEvent::DirUndefined);
+ mDbConnector->mCompressionEnabled = true;
+ QVERIFY( mDbConnector->refreshData() == 0 );
+ QVERIFY( mDbConnector->mReader->IsActive() );
+ QVERIFY( !mDbConnector->mCompressionEnabled );
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeUndefined );
+}
+
+void UT_LogsDbConnector::testCompressData()
+{
+ qRegisterMetaType< QList<int> >("QList<int>");
+ QSignalSpy spyRemoved(mDbConnector, SIGNAL(dataRemoved(QList<int>)));
+
+ QVERIFY( mDbConnector->compressData() != 0 );
+
+ // Reader exists, zero events, nothing really done
+ mDbConnector->mResourceControl = true;
+ mDbConnector->init();
+ mDbConnector->mCompressionEnabled = false;
+ QVERIFY( mDbConnector->compressData() == 0 );
+ QVERIFY( mDbConnector->mCompressionEnabled );
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeCompressEnabled );
+ QVERIFY( spyRemoved.count() == 1 );
+ QList<int> removedIndexes = qvariant_cast< QList<int> >(spyRemoved.at(0).at(0));
+ QVERIFY( removedIndexes.count() == 0 );
+
+ // Less events than compression limit is, nothing really done
+ int numEvents = 3;
+ for ( int i = 0; i < numEvents; i++ ){
+ LOGS_TEST_CREATE_EVENT(event, i, LogsEvent::EventAdded );
+ }
+ mDbConnector->mCompressionEnabled = false;
+ QVERIFY( mDbConnector->compressData() == 0 );
+ QVERIFY( mDbConnector->mCompressionEnabled );
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeCompressEnabled );
+ QVERIFY( spyRemoved.count() == 2 );
+ QList<int> removedIndexes2 = qvariant_cast< QList<int> >(spyRemoved.at(1).at(0));
+ QVERIFY( removedIndexes2.count() == 0 );
+ QVERIFY( mDbConnector->mModelEvents.count() == numEvents );
+
+ // More events than compression limit is, extra events removed
+ int numEventsMoreThanCompressLimit = ( numEvents + logsReadSizeCompressEnabled );
+ for ( int i = numEvents; i < numEventsMoreThanCompressLimit; i++ ){
+ LOGS_TEST_CREATE_EVENT(event, i, LogsEvent::EventAdded );
+ }
+ mDbConnector->mCompressionEnabled = false;
+ QVERIFY( mDbConnector->compressData() == 0 );
+ QVERIFY( mDbConnector->mCompressionEnabled );
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == logsReadSizeCompressEnabled );
+ QVERIFY( spyRemoved.count() == 3 );
+ QList<int> removedIndexes3 = qvariant_cast< QList<int> >(spyRemoved.at(2).at(0));
+ QVERIFY( removedIndexes3.count() == numEvents );
+ // Check indexes of those removed events (3 oldest events)
+ QVERIFY( removedIndexes3.at(0) == ( numEventsMoreThanCompressLimit - 3 ) );
+ QVERIFY( removedIndexes3.at(1) == ( numEventsMoreThanCompressLimit - 2) );
+ 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 );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logseventdataparser.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,191 @@
+/*
+* 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 <e32base.h>
+#include <logeng.h>
+#include <logsmspdudata.h>
+#include <QtTest/QtTest>
+
+#include "ut_logseventdataparser.h"
+#include "logseventdataparser.h"
+#include "logseventdata.h"
+#include "logsapiconsts.h"
+
+
+void UT_LogsEventDataParser::initTestCase()
+{
+
+}
+
+void UT_LogsEventDataParser::cleanupTestCase()
+{
+}
+
+
+void UT_LogsEventDataParser::init()
+{
+ mEvent = CLogEvent::NewL();
+ mEventData = new LogsEventData();
+}
+
+void UT_LogsEventDataParser::cleanup()
+{
+ delete mEvent;
+ mEvent = 0;
+ delete mEventData;
+ mEventData = 0;
+}
+
+void UT_LogsEventDataParser::testConstructor()
+{
+ QVERIFY( mEventData );
+}
+
+void UT_LogsEventDataParser::testParseMessageParts()
+{
+ TPckgBuf<TLogSmsPduData> packedData;
+ packedData().iTotal = 2;
+ mEvent->SetDataL(packedData);
+ mEvent->SetEventType(KLogShortMessageEventTypeUid);
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->msgPartsNumber() == 2 );
+}
+
+void UT_LogsEventDataParser::testParseNonTagged()
+{
+ // No data
+ mEvent->SetDataL(KNullDesC8);
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->mDataReceived == 0 );
+ QVERIFY( mEventData->mDataSent == 0 );
+
+ // No numeric in beginning
+ mEvent->SetDataL(_L8("abcdef"));
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->mDataReceived == 0 );
+ QVERIFY( mEventData->mDataSent == 0 );
+
+ // No separator
+ mEvent->SetDataL(_L8("123"));
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->mDataReceived == 0 );
+ QVERIFY( mEventData->mDataSent == 0 );
+
+ // No received part
+ mEvent->SetDataL(_L8("123,"));
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->mDataReceived == 0 );
+ QVERIFY( mEventData->mDataSent == 123 );
+
+ // Both parts
+ mEvent->SetDataL(_L8("2234,5567889"));
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->mDataReceived == 5567889 );
+ QVERIFY( mEventData->mDataSent == 2234 );
+}
+
+void UT_LogsEventDataParser::testParseTagged()
+{
+ // No data
+ mEvent->SetDataL(KNullDesC8);
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( !mEventData->isVT() );
+
+ // No field delim, VT
+ mEvent->SetDataL(KLogsDataFldTag_VT);
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->isVT() );
+
+ // Field name delim, CNAP
+ TBuf8<100> testData;
+ testData.Copy(KLogsDataFldTag_CNAP);
+ testData.Append(KLogsDataFldNameDelimiter);
+ mEvent->SetDataL(testData);
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->isCNAP() );
+
+ // Field name delim, value delim, emergency
+ testData.Copy(KLogsDataFldTag_Emergency);
+ testData.Append(KLogsDataFldValueDelimiter);
+ testData.Append(_L8("dummy val"));
+ testData.Append(KLogsDataFldNameDelimiter);
+ mEvent->SetDataL(testData);
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->isEmerg() );
+
+ // Voip, contact link and service id
+ testData.Copy(KLogsDataFldTag_IP);
+ testData.Append(KLogsDataFldNameDelimiter);
+ testData.Append(KLogsDataFldTag_ServiceId);
+ testData.Append(KLogsDataFldValueDelimiter);
+ testData.Append(_L8("2"));
+ testData.Append(KLogsDataFldNameDelimiter);
+ testData.Append(KLogsDataFldTag_ContactLink);
+ testData.Append(KLogsDataFldValueDelimiter);
+ testData.Append(_L8("1"));
+ mEvent->SetDataL(testData);
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->isVoIP() );
+ QVERIFY( mEventData->contactLocalId() == 1 );
+ QVERIFY( mEventData->serviceId() == 2 );
+
+ // Voip and incorrect contact link and service id
+ testData.Copy(KLogsDataFldTag_IP);
+ testData.Append(KLogsDataFldNameDelimiter);
+ testData.Append(KLogsDataFldTag_ServiceId);
+ testData.Append(KLogsDataFldValueDelimiter);
+ testData.Append(_L8("a"));
+ testData.Append(KLogsDataFldNameDelimiter);
+ testData.Append(KLogsDataFldTag_ContactLink);
+ testData.Append(KLogsDataFldValueDelimiter);
+ testData.Append(_L8("a"));
+ mEvent->SetDataL(testData);
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->isVoIP() );
+ QVERIFY( mEventData->contactLocalId() == 0 );
+ QVERIFY( mEventData->serviceId() == 0 );
+
+ // Voip and remote url
+ testData.Copy(KLogsDataFldTag_IP);
+ testData.Append(KLogsDataFldNameDelimiter);
+ testData.Append(KLogsDataFldTag_URL);
+ testData.Append(KLogsDataFldValueDelimiter);
+ testData.Append(_L8("test@1.2.3.4"));
+ testData.Append(KLogsDataFldNameDelimiter);
+ testData.Append(KLogsDataFldTag_MA);
+ mEvent->SetDataL(testData);
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->isVoIP() );
+ QVERIFY( mEventData->remoteUrl() == "test@1.2.3.4" );
+ QVERIFY( mEventData->localUrl().isEmpty() );
+
+ // Voip and remote url and local url
+ testData.Append(KLogsDataFldValueDelimiter);
+ testData.Append(_L8("test2@222.23.3.4"));
+ testData.Append(KLogsDataFldNameDelimiter);
+ mEvent->SetDataL(testData);
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->isVoIP() );
+ QVERIFY( mEventData->remoteUrl() == "test@1.2.3.4" );
+ QVERIFY( mEventData->localUrl() == "test2@222.23.3.4" );
+
+ // PoC
+ testData.Copy(KLogsDataFldTag_POC);
+ mEvent->SetDataL(testData);
+ QVERIFY( mEventData->parse(*mEvent) == 0 );
+ QVERIFY( mEventData->isPoC() );
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logseventparser.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logseventparser.h"
+#include "logseventparser.h"
+#include "logsevent.h"
+#include "logseventdata.h"
+#include <logcli.h>
+
+#include <QtTest/QtTest>
+
+void UT_LogsEventParser::initTestCase()
+{
+
+}
+
+void UT_LogsEventParser::cleanupTestCase()
+{
+}
+
+
+void UT_LogsEventParser::init()
+{
+ mEvent = new LogsEvent();
+}
+
+void UT_LogsEventParser::cleanup()
+{
+ delete mEvent;
+ mEvent = 0;
+}
+
+void UT_LogsEventParser::testConstructor()
+{
+ QVERIFY( mEvent );
+}
+
+void UT_LogsEventParser::testInitializeEventL()
+{
+ CLogEvent* logEvent = CLogEvent::NewL();
+ CleanupStack::PushL( logEvent );
+
+ // Test number
+ _LIT( eventTestNumber, "123444555" );
+ QString strEventTestNumber = DESC_TO_QSTRING( eventTestNumber() );
+ logEvent->SetNumber( eventTestNumber() );
+ mEvent->initializeEventL(*logEvent, mStrings);
+ QVERIFY( mEvent->mNumber == strEventTestNumber );
+
+ // Test direction
+ mStrings.iInDirection = "dir_in";
+ logEvent->SetDirection( _L("dir_in") );
+ mEvent->initializeEventL(*logEvent, mStrings);
+ QVERIFY( mEvent->mDirection == LogsEvent::DirIn );
+
+ mStrings.iOutDirection = "dir_out";
+ logEvent->SetDirection( _L("dir_out") );
+ mEvent->initializeEventL(*logEvent, mStrings);
+ QVERIFY( mEvent->mDirection == LogsEvent::DirOut );
+
+ mStrings.iMissedDirection = "dir_missed";
+ logEvent->SetDirection( _L("dir_missed") );
+ mEvent->initializeEventL(*logEvent, mStrings);
+ QVERIFY( mEvent->mDirection == LogsEvent::DirMissed );
+
+ logEvent->SetDirection( _L("not_known") );
+ mEvent->initializeEventL(*logEvent, mStrings);
+ QVERIFY( mEvent->mDirection == LogsEvent::DirUndefined );
+
+ // Test event states
+ //
+ LogsEvent event;
+ logEvent->SetId(100);
+
+ // If no log id, event state is "added"
+ event.initializeEventL(*logEvent, mStrings);
+ QVERIFY( event.eventState() == LogsEvent::EventAdded );
+
+ // If log id has changed, event state is "added"
+ logEvent->SetId(101);
+ event.initializeEventL(*logEvent, mStrings);
+ QVERIFY( event.eventState() == LogsEvent::EventAdded );
+
+ // If log id is same and data has changed, event state is "updated"
+ _LIT( eventTestNumber2, "223444555" );
+ logEvent->SetNumber( eventTestNumber2() );
+ event.initializeEventL(*logEvent, mStrings);
+ QVERIFY( event.eventState() == LogsEvent::EventUpdated );
+
+ // If log id is same but no data has change, event state is "not updated"
+ event.initializeEventL(*logEvent, mStrings);
+ QVERIFY( event.eventState() == LogsEvent::EventNotUpdated );
+
+ CleanupStack::PopAndDestroy( logEvent );
+}
+
+void UT_LogsEventParser::eventTypeSpecificParsing()
+{
+ // Voip event
+ LogsEvent event;
+ event.setEventType(LogsEvent::TypeVoIPCall);
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "jep@1.2.3.4";
+ event.setLogsEventData(eventData);
+ event.setRemoteParty("Jep");
+ LogsEventParser::eventTypeSpecificParsing(event);
+ QVERIFY( event.remoteParty() == "Jep" );
+
+ // Voip event with unknown remote party, remote party is cleared
+ event.setRemoteParty(eventData->mRemoteUrl);
+ LogsEventParser::eventTypeSpecificParsing(event);
+ QVERIFY( event.remoteParty().isEmpty() );
+
+ // Voice call event, nop
+ event.setEventType(LogsEvent::TypeVoIPCall);
+ LogsEventParser::eventTypeSpecificParsing(event);
+ QVERIFY( event.remoteParty().isEmpty() );
+}
+
+void UT_LogsEventParser::testResolveEventType()
+{
+ // No event data
+ LogsEventParser::resolveEventType(*mEvent);
+ QVERIFY( mEvent->eventType() == LogsEvent::TypeVoiceCall );
+
+ // Event data
+ LogsEventData* eventData = new LogsEventData();
+ mEvent->setLogsEventData(eventData);
+ LogsEventParser::resolveEventType(*mEvent);
+ QVERIFY( mEvent->eventType() == LogsEvent::TypeVoiceCall );
+
+ eventData->mIsVoIP = true;
+ LogsEventParser::resolveEventType(*mEvent);
+ QVERIFY( mEvent->eventType() == LogsEvent::TypeVoIPCall );
+
+ eventData->mIsVoIP = false;
+ eventData->mIsVT = true;
+ LogsEventParser::resolveEventType(*mEvent);
+ QVERIFY( mEvent->eventType() == LogsEvent::TypeVideoCall );
+
+ // PoC not supported
+ eventData->mIsVoIP = false;
+ eventData->mIsVT = false;
+ eventData->mIsPoC = true;
+ LogsEventParser::resolveEventType(*mEvent);
+ QVERIFY( mEvent->eventType() == LogsEvent::TypeUndefined );
+
+ // Msgs not supported
+ eventData->mIsVoIP = false;
+ eventData->mIsVT = false;
+ eventData->mIsPoC = false;
+ eventData->mMsgPartsNumber = 2;
+ LogsEventParser::resolveEventType(*mEvent);
+ QVERIFY( mEvent->eventType() == LogsEvent::TypeUndefined );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsforegroundwatcher.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsforegroundwatcher.h"
+#include "logsforegroundwatcher.h"
+
+#include <QtTest/QtTest>
+#include <coemain.h>
+
+CCoeEnv* testEnv = 0;
+
+CCoeEnv* CCoeEnv::Static()
+{
+ testEnv = new CCoeEnv();
+ return testEnv;
+}
+
+CCoeEnv::CCoeEnv() : CActive(EPriorityNormal)
+{
+
+}
+
+CCoeEnv::~CCoeEnv()
+{
+}
+
+void CCoeEnv::AddForegroundObserverL(MCoeForegroundObserver& /*aForegroundObserver*/)
+{
+
+}
+
+void UT_LogsForegroundWatcher::initTestCase()
+{
+}
+
+void UT_LogsForegroundWatcher::cleanupTestCase()
+{
+ delete testEnv;
+ testEnv = 0;
+}
+
+void UT_LogsForegroundWatcher::init()
+{
+ mWatcher = new LogsForegroundWatcher();
+}
+
+void UT_LogsForegroundWatcher::cleanup()
+{
+ delete mWatcher;
+}
+
+void UT_LogsForegroundWatcher::testConstructor()
+{
+ QVERIFY( mWatcher );
+}
+
+void UT_LogsForegroundWatcher::testHandleLosingForeground()
+{
+ QSignalSpy spyGaining( mWatcher, SIGNAL(gainingForeground()) );
+ QSignalSpy spyLosing( mWatcher, SIGNAL(losingForeground()) );
+ mWatcher->HandleLosingForeground();
+ QVERIFY( spyGaining.count() == 0 );
+ QVERIFY( spyLosing.count() == 1 );
+}
+
+void UT_LogsForegroundWatcher::testHandleGainingForeground()
+{
+ QSignalSpy spyGaining( mWatcher, SIGNAL(gainingForeground()) );
+ QSignalSpy spyLosing( mWatcher, SIGNAL(losingForeground()) );
+ mWatcher->HandleGainingForeground();
+ QVERIFY( spyGaining.count() == 1 );
+ QVERIFY( spyLosing.count() == 0 );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsreader.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsreader.h"
+#include "logsreader.h"
+#include "logsevent.h"
+#include <logcli.h>
+
+#include <QtTest/QtTest>
+
+void UT_LogsReader::initTestCase()
+{
+ QT_TRAP_THROWING( mLogClient = CLogClient::NewL(mFs); )
+}
+
+void UT_LogsReader::cleanupTestCase()
+{
+ delete mLogClient;
+}
+
+
+void UT_LogsReader::init()
+{
+ mErrorOccurred = false;
+ mError = 0;
+ mReader = new LogsReader(mFs, *mLogClient, mStrings, mEvents, *this );
+}
+
+void UT_LogsReader::cleanup()
+{
+ delete mReader;
+ while (!mEvents.isEmpty()){
+ delete mEvents.takeFirst();
+ }
+
+}
+
+void UT_LogsReader::testConstructor()
+{
+ QVERIFY( mReader );
+ QVERIFY( mReader->mReadStates.count() > 0 );
+ QVERIFY( mReader->mModifyingStates.count() == 0 );
+ QVERIFY( mReader->mCurrentStateMachine == &mReader->mReadStates );
+}
+
+
+void UT_LogsReader::testStart()
+{
+ QVERIFY( !mReader->mLogViewRecent );
+ QVERIFY( !mReader->mDuplicatesView );
+ QVERIFY( mReader->start() == 0 );
+ QVERIFY( mReader->IsActive() );
+ QVERIFY( mReader->mLogViewRecent );
+ QVERIFY( mReader->mDuplicatesView );
+ QVERIFY( mReader->mCurrentStateMachine == &mReader->mReadStates );
+ QVERIFY( mReader->isRecentView() );
+
+ // Starting second time should go ok
+ QVERIFY( mReader->start() == 0 );
+ QVERIFY( mReader->IsActive() );
+ QVERIFY( mReader->mLogViewRecent );
+
+ // Starting when deleting is in progress should fail
+ mReader->mCurrentStateMachine = &mReader->mModifyingStates;
+ QVERIFY( mReader->start() == KErrInUse );
+}
+
+void UT_LogsReader::testStart2()
+{
+ qDeleteAll( mReader->mReadStates );
+ mReader->mReadStates.clear();
+ mReader->mReadAllEvents = true;
+
+ QVERIFY( !mReader->mLogViewEvent );
+ QVERIFY( !mReader->mDuplicatesView );
+ QVERIFY( mReader->start() == 0 );
+ QVERIFY( mReader->IsActive() );
+ QVERIFY( mReader->mLogViewEvent );
+ QVERIFY( mReader->mDuplicatesView );
+ QVERIFY( mReader->mCurrentStateMachine == &mReader->mReadStates );
+ QVERIFY( !mReader->isRecentView() );
+
+ // Starting second time should go ok
+ QVERIFY( mReader->start() == 0 );
+ QVERIFY( mReader->IsActive() );
+ QVERIFY( mReader->mLogViewEvent );
+}
+
+void UT_LogsReader::testStop()
+{
+ mReader->stop();
+ QVERIFY( mReader->start() == 0 );
+ QVERIFY( mReader->IsActive() );
+ mReader->stop();
+ QVERIFY( !mReader->IsActive() );
+ QVERIFY( !mReader->mLogViewEvent );
+ QVERIFY( !mReader->mDuplicatesView );
+}
+
+void UT_LogsReader::testMarkEventSeen()
+{
+ QVERIFY( !mReader->mLogViewRecent );
+ QVERIFY( !mReader->mDuplicatesView );
+ QVERIFY( mReader->markEventSeen(1) == 0 );
+ QVERIFY( mReader->IsActive() );
+ QVERIFY( mReader->mLogViewRecent );
+ QVERIFY( mReader->mDuplicatesView );
+ QVERIFY( mReader->mCurrentStateMachine == &mReader->mModifyingStates );
+ QVERIFY( mReader->mModifyingStates.count() > 0 );
+
+ //starting second time should fail
+ QVERIFY( mReader->markEventSeen(1) == KErrInUse );
+
+ //starting when reading is in progress should be ok
+ mReader->mCurrentStateMachine = &mReader->mReadStates;
+ QVERIFY( mReader->markEventSeen(1) == 0 );
+}
+
+void UT_LogsReader::testReadDuplicates()
+{
+ QVERIFY( !mReader->mLogViewRecent );
+ QVERIFY( !mReader->mDuplicatesView );
+ QVERIFY( mReader->readDuplicates(1) == 0 );
+ QVERIFY( mReader->IsActive() );
+ QVERIFY( mReader->mLogViewRecent );
+ QVERIFY( mReader->mDuplicatesView );
+ QVERIFY( mReader->mCurrentStateMachine == &mReader->mDuplicateReadingStates );
+ QVERIFY( mReader->mDuplicateReadingStates.count() > 0 );
+
+ //starting second time is ok
+ QVERIFY( mReader->readDuplicates(1) == 0 );
+
+ //starting when reading is in progress is not allowed
+ mReader->mCurrentStateMachine = &mReader->mReadStates;
+ QVERIFY( mReader->readDuplicates(1) != 0 );
+}
+
+void UT_LogsReader::testRunL()
+{
+ mReader->start();
+
+ // Test ok scenario
+ mReader->Cancel();
+ mReader->iStatus = KErrNone;
+ mReader->RunL();
+ QVERIFY( !mErrorOccurred );
+ QVERIFY( mError == 0 );
+ QVERIFY( mReader->IsActive() );
+
+ // Test failure
+ mReader->Cancel();
+ mReader->iStatus = KErrNotFound;
+ TRAPD( err, mReader->RunL() );
+ QVERIFY( err == KErrNotFound );
+
+}
+
+void UT_LogsReader::testRunError()
+{
+ // No fatal callback for access denied or in use errors
+ TInt err = KErrAccessDenied;
+ QVERIFY( mReader->RunError(err) == KErrNone );
+ QVERIFY( !mErrorOccurred );
+ QVERIFY( mError == KErrAccessDenied );
+
+ err = KErrInUse;
+ QVERIFY( mReader->RunError(err) == KErrNone );
+ QVERIFY( !mErrorOccurred );
+ QVERIFY( mError == KErrInUse );
+
+ err = KErrNotFound;
+ QVERIFY( mReader->RunError(err) == KErrNone );
+ QVERIFY( mErrorOccurred );
+ QVERIFY( mError == KErrNotFound );
+}
+
+void UT_LogsReader::testStateContext()
+{
+ mReader->mCurrentStateIndex = 0;
+ QVERIFY( mReader->mCurrentStateMachine == &mReader->mReadStates );
+ mReader->setCurrentState(*mReader->mReadStates[1]);
+ QVERIFY( mReader->mCurrentStateIndex == 1 );
+
+ //wrong state machine is set as current, state isn't changed
+ LogsReaderStateBase* unknownState = new LogsReaderStateBase( *mReader );
+ mReader->mModifyingStates.append(unknownState);
+ QVERIFY( mReader->mCurrentStateMachine == &mReader->mReadStates );
+ mReader->setCurrentState(*mReader->mModifyingStates[0]);
+ QVERIFY( mReader->mCurrentStateIndex == 1 );
+
+ //once again with the correct state machine, state changed
+ mReader->mCurrentStateMachine = &mReader->mModifyingStates;
+ mReader->setCurrentState(*mReader->mModifyingStates[0]);
+ QVERIFY( mReader->mCurrentStateIndex == 0 );
+
+ mReader->mIndex = 1;
+ int& index = mReader->index();
+ QVERIFY( index == 1 );
+ index++;
+ QVERIFY( mReader->index() = index );
+
+ QVERIFY( &mReader->events() == &mEvents );
+ QVERIFY( &mReader->strings() == &mStrings );
+ QVERIFY( &mReader->reqStatus() == &mReader->iStatus );
+
+}
+
+void UT_LogsReader::testViewChange()
+{
+ mReader->Cancel();
+ mReader->HandleLogClientChangeEventL(KLogClientChangeEventLogCleared, 0, 0, 0);
+ QVERIFY( mReader->IsActive() );
+
+ mReader->Cancel();
+ mReader->HandleLogClientChangeEventL(KNullUid, 0, 0, 0);
+ QVERIFY( !mReader->IsActive() );
+
+ mReader->Cancel();
+ mReader->HandleLogViewChangeEventAddedL(0, 0, 0, 2);
+ QVERIFY( mReader->IsActive() );
+
+ mReader->Cancel();
+ mReader->HandleLogViewChangeEventChangedL(0, 0, 0, 1);
+ QVERIFY( mReader->IsActive() );
+
+ // Deletion has optimization to reduce multiple actions for same deletion
+ // patch
+ mReader->Cancel();
+ mReader->HandleLogViewChangeEventDeletedL(0, 0, 1, 2);
+ QVERIFY( mReader->IsActive() );
+
+ mReader->Cancel();
+ mReader->HandleLogViewChangeEventDeletedL(0, 0, 0, 2);
+ QVERIFY( !mReader->IsActive() );
+
+ mReader->Cancel();
+ mReader->HandleLogViewChangeEventDeletedL(0, 0, 0, 1);
+ QVERIFY( mReader->IsActive() );
+
+}
+
+void UT_LogsReader::testUpdateDetails()
+{
+ QVERIFY( !mReader->IsActive() );
+ ContactCacheEntry contactEntry("name", 1);
+ mReader->mContactCache.insert("12345", contactEntry);
+ mReader->updateDetails(false);
+ QVERIFY( !mReader->IsActive() );
+ QVERIFY( mReader->mContactCache.count() == 1 );
+
+ mReader->updateDetails(true);
+ QVERIFY( !mReader->IsActive() );
+ QVERIFY( mReader->mContactCache.count() == 0 );
+}
+
+
+// ----------------------------------------------------------------------------
+// From LogsReaderObserver
+// ----------------------------------------------------------------------------
+//
+void UT_LogsReader::readCompleted(int /*readCount*/)
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// From LogsReaderObserver
+// ----------------------------------------------------------------------------
+//
+void UT_LogsReader::errorOccurred(int err)
+{
+ mErrorOccurred = true;
+ mError = err;
+}
+
+// ----------------------------------------------------------------------------
+// From LogsReaderObserver
+// ----------------------------------------------------------------------------
+//
+void UT_LogsReader::temporaryErrorOccurred(int err)
+{
+ mError = err;
+}
+
+// ----------------------------------------------------------------------------
+// From LogsReaderObserver
+// ----------------------------------------------------------------------------
+//
+void UT_LogsReader::eventModifyingCompleted()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// From LogsReaderObserver
+// ----------------------------------------------------------------------------
+//
+void UT_LogsReader::duplicatesReadingCompleted(QList<LogsEvent*> duplicates)
+{
+ qDeleteAll(duplicates);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsreaderstates.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,685 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsreaderstates.h"
+#include "logsreaderstates.h"
+#include "logsevent.h"
+#include "logscommondata.h"
+#include "logclient_stubs_helper.h"
+#include "qtcontacts_stubs_helper.h"
+#include <logcli.h>
+#include <logview.h>
+
+#include <QtTest/QtTest>
+
+_LIT( KTestInDirection, "Incoming" );
+_LIT( KTestOutDirection, "Outgoing" );
+_LIT( KTestMissedDirection, "Missed call" );
+
+void UT_LogsReaderStates::initTestCase()
+{
+ int rfsDummy = 0;
+ mLogClient = CLogClient::NewL( *((RFs*)&rfsDummy) );
+ mStrings.iInDirection = DESC_TO_QSTRING( KTestInDirection() );
+ mStrings.iOutDirection = DESC_TO_QSTRING( KTestOutDirection() );
+ mStrings.iMissedDirection = DESC_TO_QSTRING( KTestMissedDirection() );
+}
+
+void UT_LogsReaderStates::cleanupTestCase()
+{
+ delete mLogClient;
+}
+
+
+void UT_LogsReaderStates::init()
+{
+ reset();
+
+ mCurrentState = 0;
+ mIndex = 0;
+ mLogView = 0;
+ mLogViewEvent = 0;
+ mIsRecentView = true;
+
+ mLogView = CLogViewRecent::NewL(*mLogClient);
+ mLogViewEvent = CLogViewEvent::NewL(*mLogClient);
+ mDuplicatesView = CLogViewDuplicate::NewL(*mLogClient);
+
+ const_cast<CLogEvent&>( mLogView->Event() ).SetDirection( KTestInDirection );
+}
+
+void UT_LogsReaderStates::cleanup()
+{
+ delete mLogView;
+ mLogView = 0;
+ delete mLogViewEvent;
+ mLogViewEvent = 0;
+ delete mDuplicatesView;
+ mDuplicatesView = 0;
+ while (!mEvents.isEmpty()){
+ delete mEvents.takeFirst();
+ }
+ mContactCache.clear();
+ qDeleteAll(mDuplicatedEvents);
+ mDuplicatedEvents.clear();
+
+}
+
+void UT_LogsReaderStates::reset()
+{
+ mError = 0;
+ mTemporaryError = 0;
+ mReadCompleted = false;
+ mModifyCompleted = false;
+ mReadCount = 0;
+ mDuplicatesReadingCompletedCount = 0;
+}
+
+void UT_LogsReaderStates::testStateBase()
+{
+ LogsReaderStateBase state(*this);
+ LogsReaderStateBase state2(*this);
+ QVERIFY( state.mNextState == 0 );
+ QVERIFY( state2.mNextState == 0 );
+
+ state.setNextState(state2);
+ QVERIFY( state.mNextState == &state2 );
+ QVERIFY( state2.mNextState == 0 );
+
+ QVERIFY( !state.enterL() );
+ QVERIFY( !state2.enterL() );
+
+ QVERIFY( !state.continueL() );
+ QVERIFY( !state2.continueL() );
+
+ QVERIFY( !state2.enterNextStateL() );
+ QVERIFY( mCurrentState == 0 );
+
+ QVERIFY( !state.enterNextStateL() );
+ QVERIFY( mCurrentState == &state2 );
+
+ CLogEvent* logEvent = CLogEvent::NewL();
+ CleanupStack::PushL(logEvent);
+ logEvent->SetNumber( _L("1234") );
+ logEvent->SetId( 100 );
+ LogsEvent* logsEvent = new LogsEvent;
+ int index( 0 );
+ QVERIFY( state.constructAndInsertEventL(*logEvent, logsEvent, index, mEvents ) );
+ logsEvent = 0;
+ QVERIFY( mEvents.count() == 1 );
+ QVERIFY( mEvents.at(0)->number() == "1234" );
+ QVERIFY( mEvents.at(0)->isInView() );
+ QVERIFY( index == 1 );
+
+ logEvent->SetNumber( _L("2234") );
+ logEvent->SetId( 101 );
+ logsEvent = new LogsEvent;
+ QVERIFY( state.constructAndInsertEventL(*logEvent, logsEvent, index, mEvents ) );
+ logsEvent = 0;
+ QVERIFY( mEvents.count() == 2 );
+ QVERIFY( mEvents.at(1)->number() == "2234" );
+ QVERIFY( mEvents.at(1)->index() == 1 );
+ QVERIFY( mEvents.at(1)->isInView() );
+ QVERIFY( index == 2 );
+
+ // Invalid event discarded
+ logEvent->SetNumber( _L("") );
+ logEvent->SetId( 102 );
+ logsEvent = new LogsEvent;
+ QVERIFY( !state.constructAndInsertEventL(*logEvent, logsEvent, index, mEvents ) );
+ QVERIFY( mEvents.count() == 2 );
+ QVERIFY( index == 2 );
+
+ logEvent->SetNumber( _L("2234") );
+ logEvent->SetId( 101 );
+ logsEvent = new LogsEvent;
+ index = 0;
+ QVERIFY( state.updateAndInsertEventL( *logEvent, logsEvent, index ) );
+ QVERIFY( mEvents.count() == 3 );
+ QVERIFY( index == 1 );
+
+ state.resetEvents();
+ QVERIFY( !mEvents.at(0)->isInView() );
+ QVERIFY( !mEvents.at(1)->isInView() );
+
+ LogsEvent* event = state.takeMatchingEvent(*logEvent);
+ QVERIFY( event );
+ QVERIFY( mEvents.count() == 2 );
+ delete event;
+ logEvent->SetId( 200 );
+ LogsEvent* event2 = state.takeMatchingEvent(*logEvent);
+ QVERIFY( !event2 );
+ QVERIFY( mEvents.count() == 2 );
+
+ CleanupStack::PopAndDestroy( logEvent );
+
+ //event with Id not found
+ QVERIFY( !mEvents.isEmpty() );
+ QVERIFY( !state.eventById(0) );
+
+ //event list is empty
+ while ( !mEvents.isEmpty() ) {
+ delete mEvents.takeFirst();
+ }
+ QVERIFY( !state.eventById(0) );
+
+ //event with Id found
+ LogsEvent* event3 = new LogsEvent;
+ event3->setLogId( 300 );
+ mEvents.append(event3);
+ QVERIFY( state.eventById(300) == event3 );
+ QVERIFY( !mEvents.isEmpty() );
+
+}
+
+void UT_LogsReaderStates::testStateInitReading()
+{
+ LogsReaderStateInitReading init(*this);
+ CLogEvent* logEvent = CLogEvent::NewL();
+ CleanupStack::PushL(logEvent);
+ logEvent->SetNumber( _L("1234") );
+ logEvent->SetId( 100 );
+ LogsEvent* logsEvent = new LogsEvent;
+ logsEvent->setIsInView(true);
+ int index( 0 );
+ QVERIFY( init.constructAndInsertEventL(*logEvent, logsEvent, index, mEvents ) );
+ init.enterL();
+ QVERIFY( !logsEvent->isInView() );
+ CleanupStack::PopAndDestroy( logEvent );
+}
+
+void UT_LogsReaderStates::testStateFiltering()
+{
+ LogsReaderStateFiltering state(*this);
+ QVERIFY( !state.mFilterList );
+
+ // State can be used only with recent view
+ mIsRecentView = false;
+ TRAPD( err, state.enterL() );
+ QVERIFY( err == KErrNotFound );
+ mIsRecentView = true;
+
+ // Recent list fetching starts ok
+ QVERIFY( state.enterL() );
+ QVERIFY( state.mFilterList );
+ QVERIFY( state.mFilterList->Count() == 1 );
+
+ // Recent list fetching does not start
+ LogClientStubsHelper::setStubAsyncCallPossible(false);
+ QVERIFY( !state.enterL() );
+ LogClientStubsHelper::setStubAsyncCallPossible(true);
+
+ // Doesn't continue as no next state
+ QVERIFY( !state.continueL() );
+
+ // Continues as there's next state
+ LogsReaderStateFiltering state2(*this);
+ state.setNextState(state2);
+ QVERIFY( state.continueL() );
+}
+
+void UT_LogsReaderStates::testStateFilteringAll()
+{
+ LogsReaderStateFilteringAll state(*this);
+ QVERIFY( !state.mFilterList );
+
+ // State can be used only with full event view
+ mIsRecentView = true;
+ TRAPD( err, state.enterL() );
+ QVERIFY( err == KErrNotFound );
+ mIsRecentView = false;
+
+ // Fetching starts ok
+ QVERIFY( state.enterL() );
+ QVERIFY( state.mFilterList );
+ QVERIFY( state.mFilterList->Count() == 1 );
+
+ // Recent list fetching does not start
+ LogClientStubsHelper::setStubAsyncCallPossible(false);
+ QVERIFY( !state.enterL() );
+ LogClientStubsHelper::setStubAsyncCallPossible(true);
+}
+
+void UT_LogsReaderStates::testStateReading()
+{
+ LogsReaderStateReading state(*this);
+
+ // Reading starts ok
+ QVERIFY( state.enterL() );
+
+ // Reading doesn't start ok as no items in view
+ LogClientStubsHelper::setViewCount(0);
+ QVERIFY( !state.enterL() );
+
+ // Reading continues as more events in view exist, new event is added
+ QVERIFY( mEvents.count() == 0 );
+ const_cast<CLogEvent&>( mLogView->Event() ).SetNumber( _L("12345") );
+ const_cast<CLogEvent&>( mLogView->Event() ).SetId( 100 );
+ LogClientStubsHelper::setViewCount(2);
+ QVERIFY( state.continueL() );
+ QVERIFY( mEvents.count() == 1 );
+ QVERIFY( mIndex == 1 );
+
+ // Reading does not continue as no more events in view
+ const_cast<CLogEvent&>( mLogView->Event() ).SetId( 101 );
+ QVERIFY( !state.continueL() );
+ QVERIFY( mEvents.count() == 2 );
+ QVERIFY( mIndex == 2 );
+
+ // Test where view is re-read and mathing event is updated
+ mIndex = 0;
+ state.mEventIndex = 0;
+ LogClientStubsHelper::setViewCount(1);
+ QVERIFY( !state.continueL() );
+ QVERIFY( mEvents.count() == 2 );
+ QVERIFY( mIndex == 1 );
+
+ // Test where searching duplicates for missed call event
+ mIndex = 0;
+ state.mEventIndex = 0;
+ const_cast<CLogEvent&>( mLogView->Event() ).SetDirection( KTestMissedDirection );
+ LogClientStubsHelper::setViewCount(1); // effective also for duplicates view
+
+ // Duplicate finding activation fails
+ LogClientStubsHelper::setStubAsyncCallPossible(false);
+ QVERIFY( !state.continueL() );
+ QVERIFY( !state.mCheckingMissed );
+ QVERIFY( mEvents.count() > 0 );
+ QVERIFY( mEvents.at(0)->duplicates() == 0 );
+
+ // Duplicate finding activation ok
+ mIndex = 0;
+ state.mEventIndex = 0;
+ LogClientStubsHelper::setStubAsyncCallPossible(true);
+ QVERIFY( state.continueL() );
+ QVERIFY( state.mCheckingMissed );
+ QVERIFY( !state.continueL() );
+ QVERIFY( !state.mCheckingMissed );
+ QVERIFY( mEvents.count() > 0 );
+ QVERIFY( mEvents.at(0)->duplicates() == 1 );
+
+ // Duplicate finding not done for full event view
+ qDeleteAll(mEvents);
+ mEvents.clear();
+ mIsRecentView = false;
+ mIndex = 0;
+ state.mEventIndex = 0;
+ state.mCheckingMissed = false;
+ LogClientStubsHelper::setStubAsyncCallPossible(true);
+ QVERIFY( !state.continueL() ); // No next state
+ QVERIFY( !state.mCheckingMissed );
+}
+
+void UT_LogsReaderStates::testStateReading2()
+{
+ // Test reading when max size has been defined
+ mIndex = 0;
+ LogsCommonData::getInstance().configureReadSize(3);
+ LogClientStubsHelper::setViewCount(5);
+
+ LogsReaderStateReading state(*this);
+
+ // Reading starts ok
+ QVERIFY( state.enterL() );
+ QVERIFY( state.mReadSizeCounter == 0 );
+
+ // Reading continues as more events in view exist, new event is added
+ QVERIFY( mEvents.count() == 0 );
+ const_cast<CLogEvent&>( mLogView->Event() ).SetNumber( _L("12345") );
+ const_cast<CLogEvent&>( mLogView->Event() ).SetId( 100 );
+ QVERIFY( state.continueL() );
+ QVERIFY( mEvents.count() == 1 );
+ QVERIFY( mIndex == 1 );
+
+ // Reading continues as max size has not been reached
+ const_cast<CLogEvent&>( mLogView->Event() ).SetId( 101 );
+ QVERIFY( state.continueL() );
+ QVERIFY( mEvents.count() == 2 );
+ QVERIFY( mIndex == 2 );
+
+ // Reading does not continue as max size has been reached
+ const_cast<CLogEvent&>( mLogView->Event() ).SetId( 102 );
+ QVERIFY( !state.continueL() );
+ QVERIFY( mEvents.count() == 3 );
+ QVERIFY( mIndex == 3 );
+ LogsCommonData::getInstance().configureReadSize(-1);
+}
+
+void UT_LogsReaderStates::testStateFillDetails()
+{
+ LogsReaderStateFillDetails state(*this);
+ int contactId = 2;
+
+ // No events, nothing to check
+ QVERIFY( !state.enterL() );
+ QVERIFY( mContactCache.count() == 0 );
+
+ // Remote name exists already
+ LogsEvent* logsEvent = new LogsEvent;
+ logsEvent->setIsInView(true);
+ logsEvent->setRemoteParty( "remote" );
+ LogsEvent* logsEvent2 = new LogsEvent;
+ logsEvent2->setRemoteParty( "remote2" );
+ logsEvent2->setIsInView(true);
+ mEvents.append( logsEvent );
+ mEvents.append( logsEvent2 );
+ QVERIFY( !state.enterL() );
+ QVERIFY( mContactCache.count() == 0 );
+
+ // Some events, nothing yet in cache, match from phonebook not found
+ QtContactsStubsHelper::setContactId( contactId );
+ logsEvent->setRemoteParty( "" );
+ logsEvent->setNumber( "99999999" );
+ QVERIFY( !state.enterL() );
+ QVERIFY( mContactCache.count() == 0 );
+ QVERIFY( !logsEvent->contactLocalId() );
+
+ // Some events, nothing yet in cache, match from phonebook found (international format)
+ QtContactsStubsHelper::setContactNames("first", "last");
+ logsEvent->setNumber( "+3581112222" );
+ QVERIFY( !state.enterL() );
+ QVERIFY( mContactCache.count() == 1 );
+ QVERIFY( logsEvent->contactLocalId() == contactId );
+
+ // Some events, nothing yet in cache, match from phonebook found (local format)
+ mContactCache.clear();
+ logsEvent->setRemoteParty( "" );
+ logsEvent->setNumber( "11112222" );
+ logsEvent->setLogsEventData(NULL);
+ QVERIFY( !state.enterL() );
+ QVERIFY( mContactCache.count() == 1 );
+ QVERIFY( logsEvent->contactLocalId() == contactId );
+
+ // Some events, matching info found from cache
+ logsEvent->setLogsEventData(NULL);
+ logsEvent->setRemoteParty( "" );
+ QVERIFY( !logsEvent->contactLocalId() );
+ QVERIFY( !state.enterL() );
+ QVERIFY( mContactCache.count() == 1 );
+ QVERIFY( logsEvent->remoteParty().length() > 0 );
+ QVERIFY( logsEvent->contactLocalId() == contactId );
+}
+
+void UT_LogsReaderStates::testStateDone()
+{
+ LogsReaderStateDone state(*this);
+ mIndex = 3;
+ LogClientStubsHelper::setViewCount(3);
+ QVERIFY( !state.enterL() );
+ QVERIFY( mReadCompleted );
+ QVERIFY( mReadCount == 3 );
+
+ // Reading hasn't gone through whole db view (e.g. maxsize has been defined)
+ reset();
+ mIndex = 2;
+ QVERIFY( !state.enterL() );
+ QVERIFY( mReadCompleted );
+ QVERIFY( mReadCount == 2 );
+}
+
+void UT_LogsReaderStates::testStateSearchingEvent()
+{
+ // Searching starts ok
+ LogsReaderStateSearchingEvent state(*this);
+ mCurrentEventId = 10;
+ QVERIFY( state.enterL() );
+
+ // Searching doesn't start ok as no items in view
+ LogClientStubsHelper::setViewCount(0);
+ QVERIFY( !state.enterL() );
+
+ // Searching event continues
+ mIndex = 0;
+ mCurrentEventId = -1;
+ const_cast<CLogEvent&>( mLogView->Event() ).SetId( 100 );
+ LogClientStubsHelper::setViewCount(2);
+ QVERIFY( state.continueL() );
+
+ // Last event handled, no target event found, entering next state
+ mIndex = 2;
+ QVERIFY( !state.continueL() );
+
+ // Target event found, entering next state
+ mIndex = 0;
+ mCurrentEventId = 100;
+ QVERIFY( !state.continueL() );
+}
+
+
+void UT_LogsReaderStates::testStateFindingDuplicates()
+{
+ // Finding starts ok
+ LogsReaderStateFindingDuplicates state(*this);
+ QVERIFY( state.enterL() );
+
+ // Duplicates cannot be searched for some reason
+ LogClientStubsHelper::reset();
+ LogClientStubsHelper::setStubAsyncCallPossible(false);
+ QVERIFY( !state.enterL() );
+ LogClientStubsHelper::setStubAsyncCallPossible(true);
+
+ // Duplicates can be searched
+ QVERIFY( state.enterL() );
+
+ // Searching completes, no next state to enter
+ QVERIFY( !state.continueL() );
+}
+
+void UT_LogsReaderStates::testStateMarkingDuplicates()
+{
+ // Marking does not start as no matching event in view
+ LogsReaderStateMarkingDuplicates state(*this);
+ mCurrentEventId = 5;
+ const_cast<CLogEvent&>( mLogView->Event() ).SetId( 100 );
+ QVERIFY( !state.enterL() );
+ QVERIFY( !state.mGettingDuplicates );
+ QVERIFY( !(mLogView->Event().Flags() & KLogEventRead) );
+
+ // Marking can start ok
+ mCurrentEventId = 100;
+ QVERIFY( state.enterL() );
+ QVERIFY( !state.mGettingDuplicates );
+ QVERIFY( mLogView->Event().Flags() & KLogEventRead );
+
+ // Duplicates cannot be searched for some reason
+ LogClientStubsHelper::reset();
+ LogClientStubsHelper::setStubAsyncCallPossible(false);
+ QVERIFY( !(LogClientStubsHelper::stubViewFlags() & KLogEventRead) );
+ QVERIFY( !state.continueL() );
+ QVERIFY( !(LogClientStubsHelper::stubViewFlags() & KLogEventRead) );
+ QVERIFY( !state.mGettingDuplicates );
+ LogClientStubsHelper::setStubAsyncCallPossible(true);
+
+ // Duplicates searching starts ok
+ QVERIFY( state.continueL() );
+ QVERIFY( !(LogClientStubsHelper::stubViewFlags() & KLogEventRead) );
+ QVERIFY( state.mGettingDuplicates );
+
+ // Duplicates searching completes, view flags are set, no next state to enter
+ QVERIFY( !state.continueL() );
+ QVERIFY( LogClientStubsHelper::stubViewFlags() & KLogEventRead );
+}
+
+void UT_LogsReaderStates::testStateReadingDuplicates()
+{
+ // Duplicates view empty, cannot start
+ LogClientStubsHelper::setViewCount(0);
+ LogsReaderStateReadingDuplicates state(*this);
+
+ QVERIFY( !state.enterL() );
+
+ // Starting ok
+ LogClientStubsHelper::setViewCount(2);
+ const_cast<CLogEvent&>( mDuplicatesView->Event() ).SetNumber( _L("12345") );
+ const_cast<CLogEvent&>( mDuplicatesView->Event() ).SetId( 100 );
+
+ QVERIFY( state.enterL() );
+ QVERIFY( mDuplicatedEvents.count() == 0 );
+
+ // Continue reading as more events in view
+ QVERIFY( state.continueL() );
+ QVERIFY( mDuplicatedEvents.count() == 1 );
+
+ // Don't continue reading as no more events in view
+ LogClientStubsHelper::setStubAsyncCallPossible(false);
+ QVERIFY( !state.continueL() );
+ QVERIFY( mDuplicatedEvents.count() == 2 );
+
+}
+
+void UT_LogsReaderStates::testStateReadingDuplicatesDone()
+{
+ LogsReaderStateReadingDuplicatesDone state(*this);
+
+ // No duplicates was found
+ QVERIFY( !state.enterL() );
+ QVERIFY( mDuplicatesReadingCompletedCount == 0 );
+
+ // Duplicates were found, ownership transferred to observer
+ LogsEvent* event = new LogsEvent;
+ mDuplicatedEvents.append(event);
+ LogsEvent* event2 = new LogsEvent;
+ mDuplicatedEvents.append(event2);
+ QVERIFY( !state.enterL() );
+ QVERIFY( mDuplicatesReadingCompletedCount == 2 );
+ QVERIFY( mDuplicatedEvents.count() == 0 );
+}
+
+void UT_LogsReaderStates::testStateModifyingDone()
+{
+ LogsReaderStateModifyingDone state(*this);
+
+ // Modified event not found for some reason
+ LogsEvent* logsEvent = new LogsEvent;
+ logsEvent->setIsInView(true);
+ mCurrentEventId = 100;
+ mEvents.append( logsEvent );
+ QVERIFY( !mModifyCompleted );
+ QVERIFY( !state.enterL() );
+ QVERIFY( mModifyCompleted );
+ QVERIFY( !logsEvent->isSeenLocally() );
+
+ // Modified event found and is set to locally read
+ mModifyCompleted = false;
+ logsEvent->setLogId(100);
+ QVERIFY( !state.enterL() );
+ QVERIFY( mModifyCompleted );
+ QVERIFY( logsEvent->isSeenLocally() );
+}
+
+// ----------------------------------------------------------------------------
+// From LogsReaderStateContext
+// ----------------------------------------------------------------------------
+//
+void UT_LogsReaderStates::setCurrentState(const LogsReaderStateBase& state)
+{
+ mCurrentState = &state;
+}
+
+// ----------------------------------------------------------------------------
+// From LogsReaderStateContext
+// ----------------------------------------------------------------------------
+//
+CLogView& UT_LogsReaderStates::logView()
+{
+ if ( mIsRecentView ){
+ return *mLogView;
+ }
+ return *mLogViewEvent;
+}
+
+CLogViewDuplicate& UT_LogsReaderStates::duplicatesView()
+{
+ return *mDuplicatesView;
+}
+
+QList<LogsEvent*>& UT_LogsReaderStates::events()
+{
+ return mEvents;
+}
+
+int& UT_LogsReaderStates::index()
+{
+ return mIndex;
+}
+
+LogsEventStrings& UT_LogsReaderStates::strings()
+{
+ return mStrings;
+}
+
+TRequestStatus& UT_LogsReaderStates::reqStatus()
+{
+ return mReqStatus;
+}
+
+LogsReaderObserver& UT_LogsReaderStates::observer()
+{
+ return *this;
+}
+
+QHash<QString, ContactCacheEntry>& UT_LogsReaderStates::contactCache()
+{
+ return mContactCache;
+}
+
+int UT_LogsReaderStates::currentEventId()
+{
+ return mCurrentEventId;
+}
+
+CLogClient& UT_LogsReaderStates::logClient()
+{
+ return *mLogClient;
+}
+
+bool UT_LogsReaderStates::isRecentView()
+{
+ return mIsRecentView;
+}
+
+QList<LogsEvent*>& UT_LogsReaderStates::duplicatedEvents()
+{
+ return mDuplicatedEvents;
+}
+
+// ----------------------------------------------------------------------------
+// From LogsReaderObserver
+// ----------------------------------------------------------------------------
+//
+void UT_LogsReaderStates::readCompleted(int readCount)
+{
+ mReadCompleted = true;
+ mReadCount = readCount;
+}
+void UT_LogsReaderStates::errorOccurred(int err)
+{
+ mError = err;
+}
+void UT_LogsReaderStates::temporaryErrorOccurred(int err)
+{
+ mTemporaryError = err;
+}
+void UT_LogsReaderStates::eventModifyingCompleted()
+{
+ mModifyCompleted = true;
+}
+
+void UT_LogsReaderStates::duplicatesReadingCompleted(QList<LogsEvent*> duplicates)
+{
+ mDuplicatesReadingCompletedCount = duplicates.count();
+ qDeleteAll(duplicates);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsremove.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsremove.h"
+#include "logsremove.h"
+#include "logsremoveobserver.h"
+#include "logclient_stubs_helper.h"
+#include <logcli.h>
+
+#include <QtTest/QtTest>
+
+void UT_LogsRemove::initTestCase()
+{
+}
+
+void UT_LogsRemove::cleanupTestCase()
+{
+}
+
+// ----------------------------------------------------------------------------
+// UT_LogsRemove::removeCompleted
+// ----------------------------------------------------------------------------
+//
+void UT_LogsRemove::removeCompleted()
+{
+ mRemoveCompleted = true;
+}
+
+// ----------------------------------------------------------------------------
+// UT_LogsRemove::logsRemoveErrorOccured
+// ----------------------------------------------------------------------------
+//
+void UT_LogsRemove::logsRemoveErrorOccured(int err)
+{
+ Q_UNUSED(err)
+}
+
+void UT_LogsRemove::init()
+{
+ mRemoveCompleted = false;
+ mErrorOccurred = false;
+ mError = 0;
+ mLogsRemove = new LogsRemove(*this, false);
+}
+
+void UT_LogsRemove::cleanup()
+{
+ delete mLogsRemove;
+}
+
+void UT_LogsRemove::testConstructor()
+{
+ QVERIFY( mLogsRemove );
+ QVERIFY( mLogsRemove->mFsSession );
+ QVERIFY( !mLogsRemove->mLogClient );
+}
+
+void UT_LogsRemove::testclearList()
+{
+ //clearing doesn't start, since initialization failed
+ LogClientStubsHelper::setLeaveWithError(KErrNoMemory);
+ QVERIFY( !mLogsRemove->IsActive() );
+ QVERIFY( !mLogsRemove->clearList(LogsModel::TypeLogsClearAll) );
+ QVERIFY( !mLogsRemove->IsActive() );
+
+ //clearing is ok
+ LogClientStubsHelper::setLeaveWithError(KErrNone);
+ QVERIFY( mLogsRemove->clearList(LogsModel::TypeLogsClearMissed) );
+ QVERIFY( mLogsRemove->IsActive() );
+
+ //clearing doesn't start, since already active
+ QVERIFY( !mLogsRemove->clearList(LogsModel::TypeLogsClearAll) );
+}
+
+void UT_LogsRemove::testClearEvents()
+{
+ // Clearing with recent view (no ids)
+ QList<int> events;
+ bool async( false );
+ QVERIFY( mLogsRemove->clearEvents(events, async) == 0 );
+ QVERIFY( !async );
+ QVERIFY( mLogsRemove->mRemovedEvents.count() == 0 );
+
+ // Clearing with recent view (ids)
+ events.append(2);
+ events.append(100);
+ QVERIFY( mLogsRemove->clearEvents(events, async) == 0 );
+ QVERIFY( !async );
+ QVERIFY( mLogsRemove->mRemovedEvents.count() == 0 );
+
+ // Clearing with all events (no ids)
+ events.clear();
+ LogsRemove removeWithAllEvents(*this, true);
+ QVERIFY( removeWithAllEvents.clearEvents(events, async) == 0 );
+ QVERIFY( !async );
+ QVERIFY( removeWithAllEvents.mRemovedEvents.count() == 0 );
+
+ // Clearing with all events (ids)
+ events.append(99);
+ events.append(100);
+ QVERIFY( removeWithAllEvents.clearEvents(events, async) == 0 );
+ QVERIFY( async );
+ QVERIFY( removeWithAllEvents.mRemovedEvents.count() == 1 );
+ QVERIFY( removeWithAllEvents.mRemovedEvents.at(0) == 100 );
+
+}
+
+void UT_LogsRemove::testDoCancel()
+{
+ mLogsRemove->DoCancel();
+}
+
+void UT_LogsRemove::testRunL()
+{
+ // Test ok scenario
+ mLogsRemove->init();
+ mLogsRemove->Cancel();
+ mLogsRemove->iStatus = KErrNone;
+ mLogsRemove->RunL();
+ QVERIFY( mRemoveCompleted );
+
+ // Ok scenario when more events to delete
+ mRemoveCompleted = false;
+ mLogsRemove->mRemovedEvents.append(2);
+ mLogsRemove->mRemovedEvents.append(4);
+ mLogsRemove->Cancel();
+ mLogsRemove->RunL();
+ QVERIFY( !mRemoveCompleted );
+ QVERIFY( mLogsRemove->mRemovedEvents.count() == 1 );
+
+ mLogsRemove->Cancel();
+ mLogsRemove->RunL();
+ QVERIFY( !mRemoveCompleted );
+ QVERIFY( mLogsRemove->mRemovedEvents.count() == 0 );
+
+ // Ok scenario when no more events to delete
+ mLogsRemove->Cancel();
+ mLogsRemove->RunL();
+ QVERIFY( mRemoveCompleted );
+ QVERIFY( mLogsRemove->mRemovedEvents.count() == 0 );
+
+ // Test failure
+ mLogsRemove->Cancel();
+ mLogsRemove->iStatus = KErrNotFound;
+ TRAPD( err, mLogsRemove->RunL() );
+ QVERIFY( err == KErrNotFound );
+}
+
+void UT_LogsRemove::testRunError()
+{
+ // No fatal callback for access denied error
+ TInt err = KErrAccessDenied;
+ QVERIFY( mLogsRemove->RunError(err) == KErrNone );
+}
+
+void UT_LogsRemove::testInit()
+{
+ //initialization failes
+ LogClientStubsHelper::setLeaveWithError(KErrNoMemory);
+ QVERIFY( mLogsRemove->init() == KErrNoMemory );
+ QVERIFY( !mLogsRemove->mLogClient );
+ LogClientStubsHelper::setLeaveWithError(KErrNone);
+
+ //initializing for the first time
+ QVERIFY( mLogsRemove->init() == KErrNone );
+ QVERIFY( mLogsRemove->mLogClient );
+ CLogClient* oldClient = mLogsRemove->mLogClient;
+
+ //2d time should be also ok
+ QVERIFY( mLogsRemove->init() == KErrNone );
+ QVERIFY( mLogsRemove->mLogClient );
+ QVERIFY( oldClient == mLogsRemove->mLogClient );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/ut_logssymbianos.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,90 @@
+#
+# 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 = app
+TARGET =
+
+QT += testlib xml
+CONFIG += qtestlib
+CONFIG += hb
+
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += ../stubs/
+INCLUDEPATH += /orbit/include # This must be included after the HB stubs
+INCLUDEPATH += /epoc32/include
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+INCLUDEPATH += /epoc32/include/ecom
+INCLUDEPATH += ../../
+INCLUDEPATH += ../../inc
+INCLUDEPATH += ../../../
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../../../inc
+INCLUDEPATH += ../../../../tsrc/qtestutils/inc
+
+DEFINES += QT_NO_DEBUG_OUTPUT
+
+# Input
+HEADERS += inc/ut_logsdbconnector.h
+HEADERS += inc/ut_logsreader.h
+HEADERS += inc/ut_logsreaderstates.h
+HEADERS += inc/ut_logseventparser.h
+HEADERS += inc/ut_logseventdataparser.h
+HEADERS += inc/ut_logsremove.h
+HEADERS += inc/ut_logsforegroundwatcher.h
+HEADERS += ../../inc/logsdbconnector.h
+HEADERS += ../../inc/logsreader.h
+HEADERS += ../../inc/logsreaderstates.h
+HEADERS += ../../inc/logsreaderobserver.h
+HEADERS += ../../inc/logsremove.h
+HEADERS += ../../inc/logsforegroundwatcher.h
+HEADERS += ../../../../../recents_plat/logs_engine_api/inc/logsevent.h
+HEADERS += ../../../inc/logseventdata.h
+HEADERS += ../../../inc/logscommondata.h
+
+HEADERS += ../stubs/logclient_stubs_helper.h
+
+SOURCES += src/main.cpp
+SOURCES += src/ut_logsdbconnector.cpp
+SOURCES += src/ut_logsreader.cpp
+SOURCES += src/ut_logsreaderstates.cpp
+SOURCES += src/ut_logseventparser.cpp
+SOURCES += src/ut_logseventdataparser.cpp
+SOURCES += src/ut_logsremove.cpp
+SOURCES += src/ut_logsforegroundwatcher.cpp
+SOURCES += ../../src/logsdbconnector.cpp
+SOURCES += ../../src/logsreader.cpp
+SOURCES += ../../src/logsreaderstates.cpp
+SOURCES += ../../src/logseventparser.cpp
+SOURCES += ../../src/logseventdataparser.cpp
+SOURCES += ../../src/logsremove.cpp
+SOURCES += ../../src/logsforegroundwatcher.cpp
+SOURCES += ../../../src/logsevent.cpp
+SOURCES += ../../../src/logseventdata.cpp
+SOURCES += ../../../src/logscommondata.cpp
+SOURCES += ../../../../tsrc/qtestutils/src/testresultxmlparser.cpp
+SOURCES += ../stubs/logclient_stubs.cpp
+SOURCES += ../stubs/qtcontacts_stubs.cpp
+SOURCES += ../stubs/centralrepository_stub.cpp
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xEfaaa9b2
+ TARGET.CAPABILITY = ALL -TCB
+ LIBS += -lecom -lflogger -lws32 -lbafl -lqtcontacts
+ TARGET.EPOCALLOWDLLDATA = 1
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logsabstractmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,255 @@
+/*
+* 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 "logsabstractmodel.h"
+#include "logsdbconnector.h"
+#include "logsevent.h"
+#include "logslogger.h"
+#include "logscall.h"
+#include "logscontact.h"
+#include "logsengdefs.h"
+#include "logsmessage.h"
+#include <hbicon.h>
+
+Q_DECLARE_METATYPE(LogsEvent *)
+Q_DECLARE_METATYPE(LogsCall *)
+Q_DECLARE_METATYPE(LogsMessage *)
+Q_DECLARE_METATYPE(LogsContact *)
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsAbstractModel::LogsAbstractModel() : QAbstractListModel(), mDbConnector(0)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsAbstractModel::LogsAbstractModel()" )
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsAbstractModel::LogsAbstractModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsAbstractModel::~LogsAbstractModel()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsAbstractModel::~LogsAbstractModel()" )
+
+ qDeleteAll( mIcons );
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsAbstractModel::~LogsAbstractModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariant LogsAbstractModel::doGetData(int role, const LogsModelItemContainer& item) const
+{
+ if ( role == RoleFullEvent ) {
+ QVariant var = qVariantFromValue(item.event());
+ return var;
+ } else if ( role == RoleCall ) {
+ return createCall(item);
+ } else if ( role == RoleMessage ) {
+ return createMessage(item);
+ } else if ( role == RoleContact ) {
+ return createContact(item);
+ }
+ return QVariant();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariant LogsAbstractModel::createCall(const LogsModelItemContainer& item) const
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsAbstractModel::createCall()" )
+ LogsEvent* event = item.event();
+ if ( !event ){
+ return QVariant();
+ }
+ LogsCall* logscall = new LogsCall(*event);
+ if (!logscall->isAllowedCallType()) {
+ delete logscall;
+ logscall = 0;
+ }
+ QVariant var = qVariantFromValue(logscall);
+ return var;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariant LogsAbstractModel::createMessage(const LogsModelItemContainer& item) const
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsAbstractModel::createMessage()" )
+ LogsEvent* event = item.event();
+ if ( !event ){
+ return QVariant();
+ }
+ LogsMessage* logsMessage = new LogsMessage(*event);
+ if (!logsMessage->isMessagingAllowed()) {
+ delete logsMessage;
+ logsMessage = 0;
+ }
+ QVariant var = qVariantFromValue(logsMessage);
+ return var;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariant LogsAbstractModel::createContact(const LogsModelItemContainer& item) const
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsAbstractModel::createContact()" )
+ LogsEvent* event = item.event();
+ if ( !event ){
+ return QVariant();
+ }
+ Q_ASSERT(mDbConnector);
+ LogsContact* logsContact = new LogsContact(*event, *mDbConnector);
+ if ( !logsContact->isContactRequestAllowed() ) {
+ delete logsContact;
+ logsContact = 0;
+ }
+ QVariant var = qVariantFromValue(logsContact);
+ return var;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QString LogsAbstractModel::directionIconName(const LogsEvent& event)
+{
+ QString direction;
+
+ if ( event.direction() == LogsEvent::DirIn ) {
+ if ( event.eventType() == LogsEvent::TypeVoiceCall ) {
+ direction = logsReceivedVoiceCallIconId;
+ } else if ( event.eventType() == LogsEvent::TypeVideoCall ) {
+ direction = logsReceivedVideoCallIconId;
+ } else if ( event.eventType() == LogsEvent::TypeVoIPCall ) {
+ direction = logsReceivedVoipCallIconId;
+ }
+ } else if ( event.direction() == LogsEvent::DirOut ) {
+ if ( event.eventType() == LogsEvent::TypeVoiceCall ) {
+ direction = logsDialledVoiceCallIconId;
+ } else if ( event.eventType() == LogsEvent::TypeVideoCall ) {
+ direction = logsDialledVideoCallIconId;
+ } else if ( event.eventType() == LogsEvent::TypeVoIPCall ) {
+ direction = logsDialledVoipCallIconId;
+ }
+ } else if ( event.direction() == LogsEvent::DirMissed ) {
+ if ( event.eventType() == LogsEvent::TypeVoiceCall ) {
+ if (!event.isSeenLocally() ){
+ direction = logsMissedVoiceCallUnseenIconId;
+ }
+ else {
+ direction = logsMissedVoiceCallIconId;
+ }
+
+ } else if ( event.eventType() == LogsEvent::TypeVideoCall ) {
+ if (!event.isSeenLocally() ){
+ direction = logsMissedVideoCallUnseenIconId;
+ }
+ else {
+ direction = logsMissedVideoCallIconId;
+ }
+ } else if ( event.eventType() == LogsEvent::TypeVoIPCall ) {
+ if (!event.isSeenLocally() ){
+ direction = logsMissedVoipCallUnseenIconId;
+ }
+ else {
+ direction = logsMissedVoipCallIconId;
+ }
+ }
+ }
+
+ return direction;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QString LogsAbstractModel::typeIconName(const LogsEvent& event)
+{
+ QString brand;
+ if ( event.eventType() == LogsEvent::TypeVoiceCall ) {
+ brand = QString(logsVoiceCallIconId);
+ } else if ( event.eventType() == LogsEvent::TypeVideoCall ) {
+ brand = QString(logsVideoCallIconId);
+ } else if ( event.eventType() == LogsEvent::TypeVoIPCall ) {
+ brand = QString(logsVoipCallIconId);
+ }
+ return brand;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsAbstractModel::getDecorationData(const LogsEvent& event,
+ QList<QVariant>& iconList) const
+{
+ HbIcon emptyIcon;
+ iconList.append( *mIcons.value(directionIconName(event), &emptyIcon) );
+
+ // TODO: alternative service icon
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsDbConnector* LogsAbstractModel::dbConnector()
+{
+ return mDbConnector;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsModelItemContainer::LogsModelItemContainer(LogsEvent* event) : mEvent(event)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsModelItemContainer::~LogsModelItemContainer()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsEvent* LogsModelItemContainer::event() const
+{
+ return mEvent;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logscall.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,215 @@
+/*
+* 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 "logscall.h"
+#include "logsmodel.h"
+#include "logsevent.h"
+#include "logslogger.h"
+#include "logseventdata.h"
+
+//SYSTEM
+#include <QVariant>
+#include <xqservicerequest.h>
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsCall::LogsCall(LogsEvent& event)
+ : QObject(), mDefaultCall( TypeLogsCallNotAvailable )
+{
+ if ( event.logsEventData() ) {
+ mServiceId = event.logsEventData()->serviceId();
+ }
+
+ if (event.eventType() == LogsEvent::TypeVoIPCall ) {
+ mCalls.append(LogsCall::TypeLogsVoIPCall);
+ if ( event.logsEventData() && event.logsEventData()->isCsCompatible()){
+ mCalls.append(LogsCall::TypeLogsVoiceCall);
+ mCalls.append(LogsCall::TypeLogsVideoCall);
+ }
+ } else if (event.eventType() == LogsEvent::TypeVoiceCall ||
+ event.eventType() == LogsEvent::TypeVideoCall ) {
+ mCalls.append(LogsCall::TypeLogsVoiceCall);
+ mCalls.append(LogsCall::TypeLogsVideoCall);
+ }
+
+ if (event.eventType() == LogsEvent::TypeVoiceCall){
+ mDefaultCall = TypeLogsVoiceCall;
+ } else if (event.eventType() == LogsEvent::TypeVideoCall) {
+ mDefaultCall = TypeLogsVideoCall;
+ } else if (event.eventType() == LogsEvent::TypeVoIPCall) {
+ mDefaultCall = TypeLogsVoIPCall;
+ }
+ mNumber = event.getNumberForCalling();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsCall::LogsCall(unsigned int contactId, const QString& number)
+ : QObject(), mDefaultCall( TypeLogsCallNotAvailable ), mServiceId(0)
+{
+ Q_UNUSED(contactId);
+ mNumber = number;
+
+ if ( mNumber.length() > 0 ) {
+ mCalls.append(LogsCall::TypeLogsVoiceCall);
+ mCalls.append(LogsCall::TypeLogsVideoCall);
+ mDefaultCall = TypeLogsVoiceCall;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LogsCall::~LogsCall
+// -----------------------------------------------------------------------------
+//
+LogsCall::~LogsCall()
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsCall::~LogsCall()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsCall::isAllowedCallType
+// ----------------------------------------------------------------------------
+//
+bool LogsCall::isAllowedCallType()
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsCall::isAllowedCallType()" )
+ return (mCalls.count() > 0);
+}
+
+// ----------------------------------------------------------------------------
+// LogsCall::allowedCallTypes
+// Voip call not possible at the moment. However, if voip event is CS
+// compatible, voice and video call are allowed.
+// ----------------------------------------------------------------------------
+//
+QList<LogsCall::CallType> LogsCall::allowedCallTypes()
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsCall::allowedCallTypes()" )
+
+ return mCalls;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+LogsCall::CallType LogsCall::defaultCallType()
+{
+ return mDefaultCall;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void LogsCall::callToNumber(LogsCall::CallType callType, const QString& number,
+ unsigned int serviceId)
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::callToNumber(), type", callType )
+
+ if (callType == TypeLogsVoiceCall) {
+ createcall("com.nokia.services.telephony", "dial(QString)", number, false);
+ } else if (callType == TypeLogsVideoCall) {
+ createcall("com.nokia.services.telephony", "dialVideo(QString)", number, false);
+ } else if (callType == TypeLogsVoIPCall){
+ if ( serviceId ){
+
+ // Service id should(?) be used with every call type. If logs entry
+ // is from xsp with video call support, then the executed
+ // video call should be mapped to the right xsp?
+ // also contact must be passed if available if change service is
+ // provided (no point change service and try to call service specific
+ // uri with another service)?
+ createCallWithService("com.nokia.services.telephony",
+ "dialVoipService(QString,int)", number, false, serviceId);
+ }
+ else {
+ // This is likely to fail as long as telephony does not
+ // offer any kind of service selection. Normally voip call
+ // should always have service id set but if it's missing
+ // for some reason, then this provides call failure UI.
+ createcall("com.nokia.services.telephony",
+ "dialVoip(QString)", number, false);
+ }
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsCall::callToNumber()" )
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void LogsCall::call(LogsCall::CallType callType)
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::call(), type", callType )
+
+ callToNumber(callType, mNumber, mServiceId);
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsCall::call()" )
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void LogsCall::initiateCallback()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsCall::initiateCallback()" )
+
+ if (mDefaultCall != TypeLogsCallNotAvailable ){
+ call(mDefaultCall);
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsCall::initiateCallback()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsCall::createcall
+// ----------------------------------------------------------------------------
+//
+void LogsCall::createcall(QString service, QString type, QString num, bool sync)
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createcall(), num", num )
+ XQServiceRequest snd(service, type, sync);
+ snd << num;
+ QVariant retValue;
+ snd.send(retValue);
+ LOGS_QDEBUG( "logs [ENG] <- LogsCall::createcall()" )
+}
+
+// ----------------------------------------------------------------------------
+// LogsCall::createCallWithService
+// ----------------------------------------------------------------------------
+//
+void LogsCall::createCallWithService(QString service, QString type, QString num,
+ bool sync, unsigned int serviceId )
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createCallWithService(), num", num )
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createCallWithService(), num", serviceId )
+ XQServiceRequest snd(service, type, sync);
+ snd << num << serviceId;
+ QVariant retValue;
+ snd.send(retValue);
+ LOGS_QDEBUG( "logs [ENG] <- LogsCall::createCallWithService()" )
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logscommondata.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* 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 "logscommondata.h"
+#include "logslogger.h"
+
+//SYSTEM
+#include <qcontactmanager.h>
+
+
+static LogsCommonData* mLogsCommonInstance = 0;
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsCommonData::LogsCommonData() :
+ mContactManager(0), mMaxReadSize(-1), mMaxReadSizeDir(LogsEvent::DirUndefined)
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsCommonData::LogsCommonData()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsCommonData::~LogsCommonData()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsCommonData::~LogsCommonData()" )
+ delete mContactManager;
+ LOGS_QDEBUG( "logs [ENG] <- LogsCommonData::~LogsCommonData()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsCommonData& LogsCommonData::getInstance()
+{
+ if ( !mLogsCommonInstance ){
+ mLogsCommonInstance = new LogsCommonData;
+ }
+ return *mLogsCommonInstance;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsCommonData::freeCommonData()
+{
+ delete mLogsCommonInstance;
+ mLogsCommonInstance = 0;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QContactManager& LogsCommonData::contactManager()
+{
+ if (!mContactManager){
+ LOGS_QDEBUG( "logs [ENG] -> LogsCommonData::contactManager(), create mgr" )
+ mContactManager = new QContactManager("symbian");
+ LOGS_QDEBUG( "logs [ENG] <- LogsCommonData::contactManager()" )
+ }
+ return *mContactManager;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsCommonData::configureReadSize(int maxSize, LogsEvent::LogsDirection dir)
+{
+ mMaxReadSize = maxSize;
+ mMaxReadSizeDir = dir;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsCommonData::maxReadSize() const
+{
+ return mMaxReadSize;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsEvent::LogsDirection LogsCommonData::maxReadSizeDirection() const
+{
+ return mMaxReadSizeDir;
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logscontact.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,266 @@
+/*
+* 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 "logscontact.h"
+#include "logsmodel.h"
+#include "logsevent.h"
+#include "logslogger.h"
+#include "logseventdata.h"
+#include "logsdbconnector.h"
+#include "logscommondata.h"
+
+//SYSTEM
+#include <QVariant>
+#include <xqservicerequest.h>
+#include <qcontactmanager.h>
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsContact::LogsContact(LogsEvent& event, LogsDbConnector& dbConnector)
+ : QObject(),
+ mDbConnector(dbConnector),
+ mService(0),
+ mCurrentRequest(TypeLogsContactSave),
+ mContactId(0),
+ mSaveAsOnlineAccount(false)
+{
+ mNumber = event.getNumberForCalling();
+ mContactId = event.contactLocalId();
+ mContact = contact();
+ if ( event.eventType() == LogsEvent::TypeVoIPCall &&
+ event.logsEventData() &&
+ !event.logsEventData()->remoteUrl().isEmpty() ) {
+ mSaveAsOnlineAccount = true;
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsContact::LogsContact(const QString& number,
+ LogsDbConnector& dbConnector,
+ unsigned int contactId)
+ : QObject(),
+ mDbConnector(dbConnector),
+ mService(0),
+ mCurrentRequest(TypeLogsContactSave),
+ mNumber(number),
+ mContactId(contactId),
+ mSaveAsOnlineAccount(false)
+{
+ mContact = contact();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsContact::~LogsContact()
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsContact::~LogsContact()" )
+ delete mService;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+LogsContact::RequestType LogsContact::allowedRequestType()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsContact::allowedRequestType()" )
+ LogsContact::RequestType type = TypeLogsContactSave;
+
+ if ( isContactInPhonebook() ) {
+ type = TypeLogsContactOpen;
+ }
+
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsContact::allowedRequestType(): ", type )
+ return type;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsContact::isContactRequestAllowed()
+{
+ return ( isContactInPhonebook() || !mNumber.isEmpty() );
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsContact::open()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsContact::open()")
+ bool ret = false;
+ if ( allowedRequestType() == TypeLogsContactOpen ) {
+ mCurrentRequest = TypeLogsContactOpen;
+
+ QList<QVariant> arguments;
+ arguments.append( QVariant(mContactId) );
+ ret = requestFetchService( "open(int)", arguments );
+ }
+
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsContact::open(): ", ret )
+ return ret;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsContact::addNew()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsContact::save()" )
+
+ bool ret = save("editCreateNew(QString,QString)");
+
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsContact::save(): ", ret )
+ return ret;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsContact::updateExisting()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsContact::updateExisting()" )
+
+ bool ret = save("editUpdateExisting(QString,QString)");
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsContact::updateExisting()" )
+ return ret;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsContact::save(QString message)
+{
+ QList<QVariant> arguments;
+
+ if ( !mNumber.isEmpty() ) {
+ if ( mSaveAsOnlineAccount ){
+ QString type = QContactOnlineAccount::DefinitionName;
+ arguments.append( QVariant(type) );
+ } else {
+ QString type = QContactPhoneNumber::DefinitionName;
+ arguments.append( QVariant(type) );
+ }
+ arguments.append( QVariant(mNumber) );
+ }
+
+ bool ret(false);
+
+ if ( arguments.count() == 2 ) {
+ mCurrentRequest = TypeLogsContactSave;
+ ret = requestFetchService( message, arguments );
+ } else {
+ LOGS_QDEBUG( "logs [ENG] !No Caller ID, not saving the contact..")
+ }
+
+ return ret;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsContact::requestFetchService( QString message,
+ const QList<QVariant> &arguments, bool sync )
+{
+ QString service("com.nokia.services.phonebookservices.Fetch");
+
+ delete mService;
+ mService = 0;
+ mService = new XQServiceRequest(service, message, sync);
+ connect(mService, SIGNAL(requestCompleted(QVariant)), this,
+ SLOT(handleRequestCompleted(QVariant)));
+
+ mService->setArguments(arguments);
+
+ QVariant retValue;
+ return mService->send(retValue);
+}
+
+// ----------------------------------------------------------------------------
+// Phonebookservices define following return values:
+// - contact wasn't modified (-2)
+// - was deleted (-1)
+// - was saved (1)
+// - saving failed (0)
+// ----------------------------------------------------------------------------
+//
+void LogsContact::handleRequestCompleted(const QVariant& result)
+{
+ bool retValOk = false;
+ int serviceRetVal = result.toInt(&retValOk);
+ LOGS_QDEBUG_3( "logs [ENG] -> LogsContact::handleRequestCompleted(), (retval, is_ok)",
+ serviceRetVal, retValOk )
+
+ bool modified = ( retValOk && serviceRetVal == 1 );
+
+ //If existing contact was modified, cached match for the contact should be
+ //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 );
+ if ( modified ) {
+ mContact = contact();
+ mDbConnector.updateDetails(clearCached);
+ }
+
+ if ( mCurrentRequest == TypeLogsContactOpen ) {
+ emit openCompleted(modified);
+ } else if ( mCurrentRequest == TypeLogsContactSave ) {
+ emit saveCompleted(modified);
+ }
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+QContact LogsContact::contact()
+{
+ if ( mContactId ) {
+ return LogsCommonData::getInstance().contactManager().contact( mContactId );
+ } else {
+ return QContact();
+ }
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsContact::isContactInPhonebook()
+{
+ QContactLocalId localId = mContactId;
+ return ( localId && localId == mContact.localId() );
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logscustomfilter.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* 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 "logscustomfilter.h"
+#include "logsevent.h"
+#include "logseventdata.h"
+#include "logsdbconnector.h"
+#include "logslogger.h"
+
+Q_DECLARE_METATYPE(LogsEvent *)
+
+// -----------------------------------------------------------------------------
+// LogsCustomFilter::LogsCustomFilter
+// -----------------------------------------------------------------------------
+//
+LogsCustomFilter::LogsCustomFilter()
+: QSortFilterProxyModel(),
+ mContactId(0)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsCustomFilter::LogsCustomFilter()" )
+
+ // Enable filter check for dataChanged phase
+ setDynamicSortFilter( true );
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsCustomFilter::LogsCustomFilter()" )
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCustomFilter::~LogsCustomFilter
+// -----------------------------------------------------------------------------
+//
+LogsCustomFilter::~LogsCustomFilter()
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsCustomFilter::~LogsCustomFilter()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsCustomFilter::setContactId
+// -----------------------------------------------------------------------------
+//
+void LogsCustomFilter::setContactId(quint32 contactId)
+{
+ mContactId = contactId;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCustomFilter::clearEvents
+// -----------------------------------------------------------------------------
+//
+bool LogsCustomFilter::clearEvents()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsCustomFilter::clearEvents()" )
+ bool clearingStarted(false);
+ LogsAbstractModel* model = qobject_cast<LogsAbstractModel*>( sourceModel() );
+ if ( model && model->dbConnector() ){
+ connect( model->dbConnector(), SIGNAL(clearingCompleted(int)),
+ this, SIGNAL(clearingCompleted(int)) );
+ QList<int> eventIds = getEventIds();
+ if ( !eventIds.isEmpty() ){
+ clearingStarted = model->dbConnector()->clearEvents(eventIds);
+ }
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsCustomFilter::clearEvents()" )
+ return clearingStarted;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCustomFilter::markEventsSeen
+// -----------------------------------------------------------------------------
+//
+bool LogsCustomFilter::markEventsSeen()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsCustomFilter::markEventsSeen()" )
+ bool markingStarted(false);
+ LogsAbstractModel* model = qobject_cast<LogsAbstractModel*>( sourceModel() );
+ if ( model && model->dbConnector() ){
+ connect( model->dbConnector(), SIGNAL(markingCompleted(int)),
+ this, SIGNAL(markingCompleted(int)) );
+ QList<int> eventIds = getEventIds(true);
+ if ( !eventIds.isEmpty() ){
+ markingStarted = model->dbConnector()->markEventsSeen(eventIds);
+ }
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsCustomFilter::markEventsSeen()" )
+ return markingStarted;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCustomFilter::filterAcceptsRow
+// From QSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+bool LogsCustomFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+{
+ if ( !sourceModel() ){
+ return false;
+ }
+ bool accept = false;
+ QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
+ const LogsEvent *event = qVariantValue<LogsEvent *>( sourceModel()->data(
+ index0, LogsModel::RoleFullEvent) );
+
+ if ( event && mContactId && event->logsEventData() ){
+ accept = ( event->logsEventData()->contactLocalId() == mContactId );
+ }
+
+ return accept;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCustomFilter::getEventIds
+// -----------------------------------------------------------------------------
+//
+QList<int> LogsCustomFilter::getEventIds(bool onlyUnseen) const
+{
+ QList<int> ids;
+ for ( int i = 0; i < rowCount(); i++ ){
+ const LogsEvent* event = qVariantValue<LogsEvent *>(
+ data(index(i, 0), LogsModel::RoleFullEvent ) );
+ if ( event ){
+ if ( !onlyUnseen || !event->isSeenLocally() ){
+ ids.append( event->logId() );
+ }
+ }
+ }
+ return ids;
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logsdetailsmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,438 @@
+/*
+* 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 "logsdetailsmodel.h"
+#include "logsevent.h"
+#include "logslogger.h"
+#include "logsengdefs.h"
+#include "logsdbconnector.h"
+#include "logseventdata.h"
+#include "logscontact.h"
+#include "logscommondata.h"
+#include <hbglobal.h>
+#include <hblineedit.h>
+#include <hbicon.h>
+#include <QStringList>
+
+Q_DECLARE_METATYPE(LogsContact*)
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsDetailsModel::LogsDetailsModel( LogsDbConnector& dbConnector, LogsEvent& event )
+ : LogsAbstractModel(),
+ mEvent( 0 )
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::LogsDetailsModel()" )
+
+ mDbConnector = &dbConnector;
+
+ mEvent = new LogsEvent( event );
+
+ initContent();
+
+ if ( mEvent->direction() == LogsEvent::DirMissed &&
+ !mEvent->isSeenLocally() && mEvent->duplicates() > 0 ){
+ // Read duplicates to get all occurences
+ connect( mDbConnector, SIGNAL(duplicatesRead()), this, SLOT(duplicatesRead()) );
+ mDbConnector->readDuplicates(mEvent->logId());
+ }
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsDetailsModel::LogsDetailsModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsDetailsModel::~LogsDetailsModel()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::~LogsDetailsModel()" )
+
+ delete mEvent;
+ qDeleteAll(mDetailIcons);
+ qDeleteAll(mDuplicates);
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsDetailsModel::~LogsDetailsModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::clearEvent()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::clearEvent()" )
+ QList<int> eventIds;
+ eventIds.append(mEvent->logId());
+ mDbConnector->clearEvents(eventIds);
+ LOGS_QDEBUG( "logs [ENG] <- LogsDetailsModel::clearEvent()" )
+}
+
+// -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+int LogsDetailsModel::rowCount(const QModelIndex & /* parent */) const
+{
+ return mDetailTexts.count();
+}
+
+// -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+QVariant LogsDetailsModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid() || index.row() >= mDetailTexts.count() || index.row() < 0 ) {
+ return QVariant();
+ }
+
+ if (role == Qt::DisplayRole){
+ QStringList text;
+ getDisplayData(index.row(), text);
+ return QVariant(text);
+ } else if (role == Qt::DecorationRole) {
+ QList<QVariant> icons;
+ getDecorationData(index.row(), icons);
+ return QVariant(icons);
+ }
+ LogsModelItemContainer item(mEvent);
+ return doGetData(role, item);
+}
+
+// -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+QVariant LogsDetailsModel::headerData(int section, Qt::Orientation orientation,
+ int role) const
+{
+ Q_UNUSED(section);
+ Q_UNUSED(orientation);
+
+ if (role == Qt::DisplayRole){
+ return QVariant(getHeaderData(*mEvent));
+ }
+
+ return QVariant();
+}
+
+// -----------------------------------------------------------------------------
+// From LogsAbstractModel
+// -----------------------------------------------------------------------------
+//
+QVariant LogsDetailsModel::createContact(const LogsModelItemContainer& item) const
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::createContact()" )
+
+ QVariant var = LogsAbstractModel::createContact(item);
+ LogsContact* contact = qVariantValue<LogsContact*>(var);
+ if (contact){
+ QObject::connect(contact, SIGNAL(openCompleted(bool)),
+ this, SLOT(contactActionCompleted(bool)));
+ QObject::connect(contact, SIGNAL(saveCompleted(bool)),
+ this, SLOT(contactActionCompleted(bool)));
+ }
+ return var;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::contactActionCompleted(bool modified)
+{
+ if ( modified ){
+ mEvent->prepareForContactMatching();
+ if ( mEvent->updateRemotePartyFromContacts(
+ LogsCommonData::getInstance().contactManager() ).length() > 0 ) {
+ initContent();
+ reset();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::duplicatesRead()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsDetailsModel::duplicatesRead()" )
+
+ qDeleteAll( mDuplicates );
+ mDuplicates.clear();
+ mDuplicates = mDbConnector->takeDuplicates();
+
+ initContent();
+ reset();
+
+ // Someone else might be reading duplicates as well, don't interfere with them.
+ disconnect( mDbConnector, SIGNAL(duplicatesRead()), this, SLOT(duplicatesRead()) );
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsDetailsModel::duplicatesRead()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::getDecorationData(int row, QList<QVariant>& iconList) const
+{
+ if ( row < mDetailIcons.count() ){
+ iconList << *mDetailIcons.at(row);
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::getDisplayData(int row, QStringList& texts) const
+{
+ if ( row < mDetailTexts.count() ){
+ texts << mDetailTexts.at(row);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// Caller id:
+// num
+// or remote url
+// or no num
+// -----------------------------------------------------------------------------
+//
+QString LogsDetailsModel::getCallerId(const LogsEvent& event) const
+{
+ QString callerId("");
+ if (event.remoteParty().length() > 0 && event.number().length() > 0){
+ callerId = event.number();
+ }
+
+ if (event.remoteParty().length() > 0 && getRemoteUri(event).length() > 0){
+ callerId = getRemoteUri(event);
+ }
+ return callerId;
+}
+
+// -----------------------------------------------------------------------------
+// Caller id:
+// name
+// or num
+// or remote url
+// or no num
+// -----------------------------------------------------------------------------
+//
+QString LogsDetailsModel::getHeaderData(const LogsEvent& event) const
+{
+ QString headerdata(event.remoteParty());
+ if ( headerdata.length() == 0 && event.number().length() > 0 ){
+ headerdata = event.number();
+ }
+
+ if ( headerdata.length() == 0 ){
+ headerdata = getRemoteUri(event);
+ }
+
+ if ( headerdata.length() == 0 ){
+ headerdata = hbTrId("txt_dial_dblist_call_id_val_unknown_number");
+ }
+ return headerdata;
+}
+
+// -----------------------------------------------------------------------------
+// VoIP remote Uri :
+// -----------------------------------------------------------------------------
+//
+QString LogsDetailsModel::getRemoteUri(const LogsEvent& event) const
+{
+ QString remoteUri((""));
+ if (event.logsEventData()){
+ remoteUri = event.logsEventData()->remoteUrl();
+ }
+ return remoteUri;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::getNumberToClipboard()
+{
+ HbLineEdit *cliptmp = new HbLineEdit("");
+
+ QString num = mEvent->getNumberForCalling();
+ cliptmp->setText(num);
+ cliptmp->setSelection(0, num.length());
+ cliptmp->copy();
+ delete cliptmp;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsDetailsModel::isAddress(QString value) const
+{
+ QChar c('@');
+ return value.contains(c);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsDetailsModel::isOutgoingCall() const
+{
+ return (mEvent->direction() == LogsEvent::DirOut);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QString LogsDetailsModel::getHeaderValue(QString value,bool isRemote) const
+{
+ QString headervalue("");
+ if (isAddress(value)){
+ if ((isOutgoingCall() && isRemote)|| (!isOutgoingCall() && !isRemote)){
+ headervalue = hbTrId("txt_dial_dblist_callee_id");
+ }
+ else{
+ headervalue = hbTrId("txt_dialer_ui_dblist_call_id");
+ }
+ }
+ else {
+ if ((isOutgoingCall() && isRemote)|| (!isOutgoingCall() && !isRemote)) {
+ headervalue = hbTrId("txt_dial_dblist_callee_id");
+ }
+ else {
+ headervalue = hbTrId("txt_dialer_ui_dblist_call_id");
+ }
+ }
+
+ return headervalue;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::initContent()
+{
+ qDeleteAll(mDetailIcons);
+ mDetailIcons.clear();
+ mDetailTexts.clear();
+ initTexts();
+ initIcons();
+
+ Q_ASSERT( mDetailIcons.count() == mDetailTexts.count() );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::initTexts()
+{
+ if (getCallerId(*mEvent).length()!= 0){
+ QStringList remotePartyRow;
+ remotePartyRow << getHeaderValue(getCallerId(*mEvent),true);
+ remotePartyRow << getCallerId(*mEvent);
+ mDetailTexts.append(remotePartyRow);
+ }
+
+ // TODO: if more than one date and time rows, first row has text "Last call event"
+ // but there's no localization string for that yet
+ bool firstOfMultipleDates( mDuplicates.count() > 0 );
+ addDateAndTimeTextRow(*mEvent, firstOfMultipleDates);
+
+ QStringList callDirectionRow;
+ callDirectionRow << hbTrId("txt_dialer_ui_dblist_call_direction");
+ callDirectionRow << mEvent->directionAsString();
+ mDetailTexts.append(callDirectionRow);
+
+ QStringList callTypeRow;
+ callTypeRow << hbTrId("txt_dialer_ui_dblist_call_type");
+ callTypeRow << mEvent->typeAsString();
+ mDetailTexts.append(callTypeRow);
+
+ if ( mEvent->direction() != LogsEvent::DirMissed ){
+ QStringList callDurationRow;
+ callDurationRow << hbTrId("txt_dialer_ui_dblist_call_duration");
+ QTime n(0, 0, 0);
+ QTime t = n.addSecs(mEvent->duration());
+ callDurationRow << t.toString("hh:mm:ss");
+ mDetailTexts.append(callDurationRow);
+ }
+
+ foreach ( LogsEvent* event, mDuplicates ){
+ addDateAndTimeTextRow(*event);
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::initIcons()
+{
+ if (getCallerId(*mEvent).length()!= 0){
+ HbIcon* remotePartyIcon = new HbIcon(logsRemotePartyInfoIconId);
+ mDetailIcons.append(remotePartyIcon);
+ }
+
+ HbIcon* dateAndTimeIcon = new HbIcon(logsCallDateAndTimeIconId);
+ mDetailIcons.append(dateAndTimeIcon);
+
+ HbIcon* directionIcon = new HbIcon( LogsAbstractModel::directionIconName(*mEvent) );
+ mDetailIcons.append(directionIcon);
+
+ HbIcon* typeIcon = new HbIcon( LogsAbstractModel::typeIconName(*mEvent) );
+ mDetailIcons.append(typeIcon);
+
+ if ( mEvent->direction() != LogsEvent::DirMissed ){
+ HbIcon* durationIcon = new HbIcon(logsCallDurationIconId);
+ mDetailIcons.append(durationIcon);
+ }
+
+ foreach ( LogsEvent* event, mDuplicates ){
+ // Having multiple date and time icon instances has no performance
+ // penalty due resource sharing inside HbIcon impl
+ HbIcon* dateAndTimeIcon = new HbIcon(logsCallDateAndTimeIconId);
+ mDetailIcons.append(dateAndTimeIcon);
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsModel::addDateAndTimeTextRow(
+ const LogsEvent& event, bool firstOfMultipleDates)
+{
+ QStringList dateAndTimeRow;
+ if ( firstOfMultipleDates ){
+ dateAndTimeRow << hbTrId("txt_dial_dblist_last_call_event");
+ } else {
+ dateAndTimeRow << hbTrId("txt_dialer_ui_dblist_date_and_time");
+ }
+ dateAndTimeRow << event.time().toTimeSpec(Qt::LocalTime).toString();
+ mDetailTexts.append(dateAndTimeRow);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logsevent.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,641 @@
+/*
+* 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 FILES
+
+#include <QObject>
+#include <qcontactmanager.h>
+#include <qcontactdetailfilter.h>
+#include <qcontactphonenumber.h>
+#include <qcontactname.h>
+#include <qcontactonlineaccount.h>
+#include <hbglobal.h>
+#include "logsevent.h"
+#include "logseventparser.h"
+#include "logseventdata.h"
+#include "logsengdefs.h"
+#include "logslogger.h"
+
+// CONSTANTS
+
+// ----------------------------------------------------------------------------
+// logsEvent::logsEvent
+// ----------------------------------------------------------------------------
+//
+LogsEvent::LogsEvent()
+ : mLogId(-1),
+ mDirection(DirUndefined),
+ mEventType(TypeUndefined),
+ mUid(0),
+ mLogsEventData(0),
+ mDuplicates(0),
+ mRingDuration(0),
+ mIsRead(false),
+ mIsALS(false),
+ mDuration(0),
+ mIndex(0),
+ mIsInView(false),
+ mEventState(EventAdded),
+ mIsLocallySeen(false)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::LogsEvent
+// ----------------------------------------------------------------------------
+//
+LogsEvent::LogsEvent( const LogsEvent& event )
+{
+ mLogId = event.mLogId;
+ mDirection = event.mDirection;
+ mEventType = event.mEventType;
+ mUid = event.mUid;
+ if ( event.mLogsEventData ){
+ mLogsEventData = new LogsEventData( *event.mLogsEventData );
+ } else {
+ mLogsEventData = 0;
+ }
+ mRemoteParty = event.mRemoteParty;
+ mNumber = event.mNumber;
+ mDuplicates = event.mDuplicates;
+ mTime = event.mTime;
+ mRingDuration = event.mRingDuration;
+ mIsRead = event.mIsRead;
+ mIsALS = event.mIsALS;
+ mDuration = event.mDuration;
+
+ mIndex = event.mIndex;
+ mIsInView = event.mIsInView;
+ mEventState = event.mEventState;
+ mIsLocallySeen = event.mIsLocallySeen;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::~LogsEvent
+// ----------------------------------------------------------------------------
+//
+LogsEvent::~LogsEvent()
+{
+ delete mLogsEventData;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::initializeEventL
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::initializeEventL(
+ const CLogEvent& source,
+ const LogsEventStrings& strings )
+{
+ LogsEventParser::parseL(source, *this, strings);
+ LOGS_QDEBUG_5( "LogsEvent::initializeEvent (num,dir,logid,state):",
+ mNumber, mDirection, mLogId, mEventState )
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsEvent::isEmergencyNumber
+// Checks wether the number is an emergency number
+// ----------------------------------------------------------------------------
+
+bool LogsEvent::isEmergencyNumber(const QString& number)
+{
+ return ( number == logsEmergencyCall911 || number == logsEmergencyCall );
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setDuration()
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setDuration( int duration )
+{
+ mDuration = duration;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setALS()
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setALS( bool isALS )
+{
+ mIsALS = isALS;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setLogId
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setLogId( int logId )
+{
+ mLogId = logId;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setNumber
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::setNumber( const QString& number )
+ {
+ bool changed( mNumber != number );
+ mNumber = number;
+ return changed;
+ }
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setRemoteParty
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setRemoteParty( const QString& remoteParty )
+{
+ if ( mEventState == EventNotUpdated && mRemoteParty != remoteParty ){
+ LOGS_QDEBUG( "logs [ENG] <-> LogsEvent::setRemoteParty, event updated")
+ mEventState = LogsEvent::EventUpdated;
+ }
+ mRemoteParty = remoteParty;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::validate
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::validate()
+{
+ return ( !mNumber.isEmpty() || !mRemoteParty.isEmpty() ||
+ ( mLogsEventData && !mLogsEventData->remoteUrl().isEmpty() ) );
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::directionAsString
+// ----------------------------------------------------------------------------
+//
+QString LogsEvent::directionAsString() const
+{
+ QString dir;
+ if ( mDirection == DirIn ) {
+ dir = hbTrId("txt_dialer_ui_dblist_call_direction_val_received");
+ } else if ( mDirection == DirOut ) {
+ dir = hbTrId("txt_dialer_ui_dblist_call_direction_val_dialled");
+ } else if ( mDirection == DirMissed ) {
+ dir = hbTrId("txt_dialer_ui_dblist_call_direction_val_missed");
+ } else {
+ dir = QObject::tr("Direction unknown");
+ }
+ return dir;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::typeAsString
+// ----------------------------------------------------------------------------
+//
+QString LogsEvent::typeAsString() const
+{
+ QString type;
+ if ( mEventType == TypeVoiceCall ) {
+ type = hbTrId("txt_dialer_ui_dblist_call_type_val_voice_call");
+ } else if ( mEventType == TypeVideoCall ) {
+ type = hbTrId("txt_dialer_ui_dblist_call_type_val_video_call");
+ } else if ( mEventType == TypeVoIPCall ) {
+ type = hbTrId("txt_dialer_ui_dblist_call_type_val_voip_call");
+ } else {
+ type = QObject::tr("Type unknown");
+ }
+ return type;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::getNumberForCalling
+// ----------------------------------------------------------------------------
+//
+QString LogsEvent::getNumberForCalling()
+{
+ if (mNumber.isEmpty() && mEventType == TypeVoIPCall && mLogsEventData ) {
+ return mLogsEventData->remoteUrl();
+ }
+ return mNumber;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setDirection
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::setDirection( LogsDirection direction )
+{
+ bool changed( mDirection != direction );
+ mDirection = direction;
+ return changed;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setEventUid
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setEventUid( int uid )
+{
+ mUid = uid;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setEventType
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setEventType( LogsEventType eventType )
+{
+ mEventType = eventType;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::ALS()
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::ALS() const
+{
+ return mIsALS;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::logId
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::logId() const
+{
+ return mLogId;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setIsRead
+// ----------------------------------------------------------------------------
+bool LogsEvent::setIsRead(bool isRead)
+{
+ bool changed( mIsRead != isRead );
+ mIsRead = isRead;
+ return changed;
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsEvent::Number
+// ----------------------------------------------------------------------------
+//
+const QString& LogsEvent::number() const
+{
+ return mNumber;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::RemoteParty
+// ----------------------------------------------------------------------------
+//
+const QString& LogsEvent::remoteParty() const
+{
+ return mRemoteParty;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::Direction
+// ----------------------------------------------------------------------------
+//
+LogsEvent::LogsDirection LogsEvent::direction() const
+{
+ return mDirection;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::eventUid
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::eventUid() const
+{
+ return mUid;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::eventType
+// ----------------------------------------------------------------------------
+//
+LogsEvent::LogsEventType LogsEvent::eventType() const
+{
+ return mEventType;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::isRead
+// ----------------------------------------------------------------------------
+ bool LogsEvent::isRead() const
+{
+ return mIsRead;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::RingDuration
+//
+// For ring duation feature
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::ringDuration() const
+{
+ return mRingDuration;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::duration
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::duration() const
+{
+ return mDuration;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::SetRingDuration
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setRingDuration( int ringDuration )
+{
+ mRingDuration = ringDuration;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::LogsEventData
+// ----------------------------------------------------------------------------
+//
+LogsEventData* LogsEvent::logsEventData() const
+{
+ return mLogsEventData;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setLogsEventData
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setLogsEventData( LogsEventData* logsEventData )
+{
+ delete mLogsEventData;
+ mLogsEventData = logsEventData;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setTime
+//
+// Time needed in recent views and in detail view (not needed in event view)
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::setTime( const QDateTime& time )
+{
+ bool changed( mTime != time );
+ mTime = time;
+ return changed;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::time
+// ----------------------------------------------------------------------------
+//
+QDateTime LogsEvent::time() const
+{
+ return mTime;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setDuplicates
+//
+// Duplicates needed only in missed calls view
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setDuplicates( int duplicates )
+{
+ mDuplicates = duplicates;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::duplicates
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::duplicates() const
+{
+ return mDuplicates;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setIndex
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setIndex(int index)
+{
+ mIndex = index;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::index
+// ----------------------------------------------------------------------------
+//
+int LogsEvent::index() const
+{
+ return mIndex;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setIsInView
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setIsInView(bool isInView)
+{
+ mIsInView = isInView;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::isInView
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::isInView() const
+{
+ return mIsInView;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::eventState
+// ----------------------------------------------------------------------------
+//
+LogsEvent::LogsEventState LogsEvent::eventState() const
+{
+ return mEventState;
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setContactLocalId
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::setContactLocalId( unsigned int id )
+{
+ if ( !mLogsEventData ) {
+ mLogsEventData = new LogsEventData;
+ }
+ mLogsEventData->setContactLocalId(id);
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsEvent::contactLocalId
+// ----------------------------------------------------------------------------
+//
+unsigned int LogsEvent::contactLocalId() const
+{
+ unsigned int id = 0;
+ if ( mLogsEventData ) {
+ id = mLogsEventData->contactLocalId();
+ }
+ return id;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+QString LogsEvent::updateRemotePartyFromContacts(QContactManager& manager)
+{
+ QContactDetailFilter phoneFilter;
+ if ( mEventType == TypeVoIPCall && mLogsEventData && !mLogsEventData->remoteUrl().isEmpty() ) {
+ phoneFilter.setDetailDefinitionName( QContactOnlineAccount::DefinitionName,
+ QContactOnlineAccount::FieldAccountUri);
+ phoneFilter.setValue(mLogsEventData->remoteUrl());
+ phoneFilter.setMatchFlags(QContactFilter::MatchExactly);
+ } else if ( !mNumber.isEmpty() ){
+ // remove non-significant parts from number for better matching
+ phoneFilter.setDetailDefinitionName( QContactPhoneNumber::DefinitionName,
+ QContactPhoneNumber::FieldNumber);
+ phoneFilter.setValue(stripPhoneNumber(mNumber));
+ phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
+ } else {
+ // Searching not possible
+ return QString();
+ }
+
+ 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) {
+ // If multiple matches, don't dare to use any
+ QContact match = manager.contact(matchingContacts.at(0));
+ // QContactManager::synthesiseDisplayLabel would be more clean but
+ // it returns currently "Unnamed" in case of missing name which we
+ // 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) );
+ }
+ }
+ return contactNameStr;
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsEvent::stripPhoneNumber
+// ----------------------------------------------------------------------------
+//
+QString LogsEvent::stripPhoneNumber(const QString& num)
+{
+ // Remove international part from beginning if starts with '+'
+ // and leading digit can be removed if doesn't start with '+'
+ // NOTE: since international part is not fixed length, this
+ // approach is not bulletproof (i.e. if international part is
+ // only one digit long, part of group identification code is ignored
+ // which might lead to incorrect matching in case where user
+ // would have two contacts with same subscriber number part but for
+ // different operator (quite unlikely).
+
+ if ( num.length() == 0 ){
+ return num;
+ }
+ QString modifiedNum( num );
+ if ( modifiedNum.at(0) == '+' ) {
+ // QString handles automatically case of removing too much
+ const int removePlusAndInternationalPart = 4;
+ modifiedNum.remove( 0, removePlusAndInternationalPart );
+ }
+ else {
+ const int removeFirstDigit = 1;
+ modifiedNum.remove( 0, removeFirstDigit );
+ }
+
+ return modifiedNum;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::parseContactName
+// ----------------------------------------------------------------------------
+//
+QString LogsEvent::parseContactName(const QContactName& name)
+{
+ QString firstName = name.value(QContactName::FieldFirst);
+ QString lastName = name.value(QContactName::FieldLast);
+ QString parsedName;
+ if (!lastName.isEmpty()) {
+ if (!firstName.isEmpty()) {
+ parsedName =
+ QString(QLatin1String("%1 %2")).arg(firstName).arg(lastName);
+ }
+ else {
+ parsedName = lastName;
+ }
+ } else if (!firstName.isEmpty()) {
+ parsedName = firstName;
+ }
+ return parsedName;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+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;
+ }
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void LogsEvent::markedAsSeenLocally(bool markedAsSeen)
+{
+ mIsLocallySeen = markedAsSeen;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsEvent::isSeenLocally() const
+{
+ return ( mIsLocallySeen || mIsRead );
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logseventdata.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,221 @@
+/*
+* 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 FILES
+#include "logseventdata.h"
+#include "logsevent.h"
+#include "logseventdataparser.h"
+
+#include <QRegExp>
+#include <QRegExpValidator>
+
+// ----------------------------------------------------------------------------
+// LogsEventData::LogsEventData
+// ----------------------------------------------------------------------------
+//
+LogsEventData::LogsEventData() :
+ mIsCNAP( false ),
+ mIsVT( false ),
+ mIsPoC( false ),
+ mIsVoIP( false ),
+ mIsEmerg( false ),
+ mDataSent( 0 ),
+ mDataReceived( 0 ),
+ mMsgPartsNumber( 0 ),
+ mServiceId( 0 ),
+ mContactLocalId( 0 ),
+ mRemoteUrl(),
+ mLocalUrl()
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::LogsEventData
+// ----------------------------------------------------------------------------
+//
+LogsEventData::LogsEventData( const LogsEventData& data )
+{
+ mIsCNAP = data.mIsCNAP;
+ mIsVT = data.mIsVT;
+ mIsPoC = data.mIsPoC;
+ mIsVoIP = data.mIsVoIP;
+ mIsEmerg = data.mIsEmerg;
+ mDataSent = data.mDataSent;
+ mDataReceived = data.mDataReceived;
+ mMsgPartsNumber = data.mMsgPartsNumber;
+ mServiceId = data.mServiceId;
+ mContactLocalId = data.mContactLocalId;
+ mRemoteUrl = data.mRemoteUrl;
+ mLocalUrl = data.mLocalUrl;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::~LogsEventData
+// ----------------------------------------------------------------------------
+//
+LogsEventData::~LogsEventData()
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::parse
+// ----------------------------------------------------------------------------
+//
+int LogsEventData::parse( const CLogEvent& source )
+{
+ return LogsEventDataParser::parse(source, *this);
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::isCNAP
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isCNAP() const
+{
+ return mIsCNAP;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::isVT
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isVT() const
+{
+ return mIsVT;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::isPoC
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isPoC() const
+{
+ return mIsPoC;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::isVoIP
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isVoIP() const
+{
+ return mIsVoIP;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::dataReceived
+// ----------------------------------------------------------------------------
+//
+long long LogsEventData::dataReceived() const
+{
+ return mDataReceived;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::dataSent
+// ----------------------------------------------------------------------------
+//
+long long LogsEventData::dataSent() const
+{
+ return mDataSent;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::isEmerg
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isEmerg() const
+{
+ return mIsEmerg;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::MsgPartsNumber
+//
+// Msg parts. This info is meaningful only for sms events
+// ----------------------------------------------------------------------------
+//
+int LogsEventData::msgPartsNumber() const
+{
+ return mMsgPartsNumber;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventData::ServiceId
+//
+// Returns the Service ID of the log event.
+// ----------------------------------------------------------------------------
+//
+unsigned int LogsEventData::serviceId() const
+{
+ return mServiceId;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+QString LogsEventData::remoteUrl() const
+{
+ return mRemoteUrl;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+QString LogsEventData::localUrl() const
+{
+ return mLocalUrl;
+}
+
+// ----------------------------------------------------------------------------
+// Checks whether event data can be used in CS context
+// ----------------------------------------------------------------------------
+//
+bool LogsEventData::isCsCompatible()
+{
+ bool compatible( true );
+ if ( !mRemoteUrl.isEmpty() ){
+ // Url can start with plus but after that can contain only digits
+ // to be CS compatible.
+ QRegExp rx( "\\+{0,1}\\d*$" );
+ QRegExpValidator validator(rx, 0);
+ int pos( 0 );
+ compatible = ( validator.validate( mRemoteUrl, pos ) == QValidator::Acceptable );
+ }
+ return compatible;
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsEventData::contactLocalId
+// ----------------------------------------------------------------------------
+//
+unsigned int LogsEventData::contactLocalId() const
+{
+ return mContactLocalId;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEvent::setContactLocalId
+// ----------------------------------------------------------------------------
+//
+void LogsEventData::setContactLocalId(unsigned int id)
+{
+ mContactLocalId = id;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logsfilter.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* 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 "logsfilter.h"
+#include "logsevent.h"
+#include "logslogger.h"
+#include "logscommondata.h"
+
+Q_DECLARE_METATYPE(LogsEvent *)
+
+// -----------------------------------------------------------------------------
+// LogsFilter::LogsFilter
+// -----------------------------------------------------------------------------
+//
+LogsFilter::LogsFilter( FilterType type )
+: QSortFilterProxyModel(), mFilterType( type )
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsFilter::LogsFilter(), type:", mFilterType )
+
+ // Enable filter check for dataChanged phase
+ setDynamicSortFilter( true );
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsFilter::LogsFilter()" )
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsFilter::~LogsFilter
+// -----------------------------------------------------------------------------
+//
+LogsFilter::~LogsFilter()
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsFilter::~LogsFilter()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsFilter::filterType
+// -----------------------------------------------------------------------------
+//
+LogsFilter::FilterType LogsFilter::filterType() const
+{
+ return mFilterType;
+}
+
+// -----------------------------------------------------------------------------
+// LogsFilter::clearType
+// -----------------------------------------------------------------------------
+//
+LogsModel::ClearType LogsFilter::clearType() const
+{
+ LogsModel::ClearType cleartype(LogsModel::TypeLogsClearAll);
+ switch (mFilterType){
+ case All:
+ cleartype = LogsModel::TypeLogsClearAll;
+ break;
+ case Received:
+ cleartype = LogsModel::TypeLogsClearReceived;
+ break;
+ case Called:
+ cleartype = LogsModel::TypeLogsClearCalled;
+ break;
+ case Missed:
+ cleartype = LogsModel::TypeLogsClearMissed;
+ break;
+ default:
+ break;
+ }
+ return cleartype;
+}
+
+// -----------------------------------------------------------------------------
+// LogsFilter::setMaxSize
+// -----------------------------------------------------------------------------
+//
+void LogsFilter::setMaxSize(int maxSize)
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsFilter::LogsFilter(), maxSize", maxSize )
+
+ LogsEvent::LogsDirection dir( LogsEvent::DirUndefined );
+ if ( mFilterType == Missed ){
+ dir = LogsEvent::DirMissed;
+ } else if ( mFilterType == Received ){
+ dir = LogsEvent::DirIn;
+ } else if ( mFilterType == Called ){
+ dir = LogsEvent::DirOut;
+ }
+ LogsCommonData::getInstance().configureReadSize(maxSize, dir);
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsFilter::setMaxSize()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsFilter::filterAcceptsRow
+// From QSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+bool LogsFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+{
+ if ( !sourceModel() ){
+ return false;
+ }
+ bool accept = false;
+ QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
+ const LogsEvent *event = qVariantValue<LogsEvent *>( sourceModel()->data(
+ index0, LogsModel::RoleFullEvent) );
+
+ if ( event ){
+ switch (mFilterType){
+ case All:
+ accept = true;
+ break;
+ case Received:
+ accept = ( event->direction() == LogsEvent::DirIn );
+ break;
+ case Called:
+ accept = ( event->direction() == LogsEvent::DirOut );
+ break;
+ case Missed:
+ accept = ( event->direction() == LogsEvent::DirMissed );
+ break;
+ default:
+ break;
+ }
+ }
+ return accept;
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logsmatchesmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,734 @@
+/*
+* 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 "logsmatchesmodel.h"
+#include "logsmodel.h"
+
+#include "logsevent.h"
+#include "logslogger.h"
+#include "logsengdefs.h"
+#include "logsdbconnector.h"
+#include "logscntfinder.h"
+#include "logsdetailsmodel.h"
+#include "logscall.h"
+#include "logsmessage.h"
+#include "logscontact.h"
+#include "logseventdata.h"
+#include "logsthumbnailmanager.h"
+#include "logscommondata.h"
+#include <hblineedit.h>
+#include <QStringList>
+#include <qcontactphonenumber.h>
+#include <qcontactmanager.h>
+
+Q_DECLARE_METATYPE(LogsEvent *)
+Q_DECLARE_METATYPE(LogsCall *)
+Q_DECLARE_METATYPE(LogsMessage *)
+Q_DECLARE_METATYPE(LogsContact *)
+Q_DECLARE_METATYPE(LogsDetailsModel *)
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMatchesModel::LogsMatchesModel(
+ LogsAbstractModel& parentModel, LogsDbConnector& dbConnector )
+ : LogsAbstractModel(),
+ mParentModel(parentModel),
+ mLogsCntFinder(0),
+ mIconManager(0),
+ mSearchEnabled(false),
+ mResultCount(0)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::LogsMatchesModel()" )
+
+ mDbConnector = &dbConnector;
+ initPredictiveSearch();
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::LogsMatchesModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMatchesModel::~LogsMatchesModel()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::~LogsMatchesModel()" )
+
+ delete mLogsCntFinder;
+ qDeleteAll(mMatches);
+ delete mIconManager;
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::~LogsMatchesModel()" )
+}
+
+// -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+int LogsMatchesModel::rowCount(const QModelIndex & /* parent */) const
+{
+ return mResultCount;
+}
+
+// -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+QVariant LogsMatchesModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid() || index.row() >= mResultCount || index.row() < 0 ) {
+ return QVariant();
+ }
+
+ LogsMatchesModelItemContainer* item = 0;
+ if ( index.row() < mMatches.count() ){
+ item = mMatches.at(index.row());
+ } else {
+ item = const_cast<LogsMatchesModel*>(this)->addSearchResult(index.row());
+ }
+
+ updateSearchResult(*item);
+ if (role == Qt::DisplayRole){
+ return( QVariant( item->texts() ) );
+ } else if (role == Qt::DecorationRole) {
+ return( QVariant( item->icons(index.row()) ) );
+ } else if ( role == RoleDetailsModel ) {
+ LOGS_QDEBUG( "logs [ENG] LogsMatchesModel::data() RoleDetailsModel" )
+ LogsDetailsModel* detailsModel = 0;
+ LogsEvent* event = item->event();
+ if ( event ) {
+ detailsModel = new LogsDetailsModel( *mDbConnector, *event );
+ }
+ QVariant var = qVariantFromValue( detailsModel );
+ return var;
+ }
+ return doGetData(role, *item);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariant LogsMatchesModel::createCall(const LogsModelItemContainer& item) const
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::createCall()" )
+ LogsEvent* event = item.event();
+ if ( event ){
+ return LogsAbstractModel::createCall(item);
+ }
+ const LogsMatchesModelItemContainer& matchItem =
+ static_cast<const LogsMatchesModelItemContainer&>( item );
+ LogsCall* logscall = new LogsCall(matchItem.contact(), matchItem.number());
+ if (!logscall->isAllowedCallType()) {
+ delete logscall;
+ logscall = 0;
+ }
+ QVariant var = qVariantFromValue(logscall);
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::createCall()" )
+ return var;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariant LogsMatchesModel::createMessage(const LogsModelItemContainer& item) const
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::createMessage()" )
+ LogsEvent* event = item.event();
+ if ( event ){
+ return LogsAbstractModel::createMessage(item);
+ }
+ const LogsMatchesModelItemContainer& matchItem =
+ static_cast<const LogsMatchesModelItemContainer&>( item );
+ LogsMessage* logsMessage = new LogsMessage(matchItem.contact(), matchItem.number(),matchItem.contactName());
+ if (!logsMessage->isMessagingAllowed()) {
+ delete logsMessage;
+ logsMessage = 0;
+ }
+ QVariant var = qVariantFromValue(logsMessage);
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::createMessage()" )
+ return var;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QVariant LogsMatchesModel::createContact(const LogsModelItemContainer& item) const
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::createContact()" )
+ LogsEvent* event = item.event();
+ if ( event ){
+ return LogsAbstractModel::createContact(item);
+ }
+ const LogsMatchesModelItemContainer& matchItem =
+ static_cast<const LogsMatchesModelItemContainer&>( item );
+ LogsContact* logsContact =
+ new LogsContact(matchItem.number(), *mDbConnector, matchItem.contact());
+ if ( !logsContact->isContactRequestAllowed() ) {
+ delete logsContact;
+ logsContact = 0;
+ } else {
+ connect( logsContact, SIGNAL(saveCompleted(bool)), this, SLOT(forceSearchQuery()) );
+ }
+ QVariant var = qVariantFromValue(logsContact);
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::createContact()" )
+ return var;
+}
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsMatchesModel::predictiveSearchStatus()
+{
+ return mDbConnector->predictiveSearchStatus();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsMatchesModel::setPredictiveSearch(bool enabled)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::setPredictiveSearch()" )
+ int err = mDbConnector->setPredictiveSearch(enabled);
+ if (!err) {
+ if ((mSearchEnabled && !enabled) || (!mSearchEnabled && enabled)) {
+ //in case of search is turned off, getLogMatches will only reset
+ //previous search results
+ mSearchEnabled = enabled;
+ forceSearchQuery();
+ }
+ }
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsMatchesModel::setPredictiveSearch(), err: ", err )
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::queryReady()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::queryReady()" );
+
+ qDeleteAll(mMatches);
+ mMatches.clear();
+ // Just store number of matches at this point, real data is read only
+ // once it is asked first time from model.
+ mResultCount = mLogsCntFinder->resultsCount();
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::eventsUpdated(const QModelIndex& first, const QModelIndex& last)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::eventsUpdated()" );
+ bool updated( false );
+ QMap<LogsCntEntryHandle*, LogsEvent*>::const_iterator i;
+ for (i = mSearchEvents.constBegin(); i != mSearchEvents.constEnd(); ++i){
+ if ( i.value()->index() >= first.row() && i.value()->index() <= last.row() ){
+ LogsCntEntry* entry = mLogsCntFinder->getEntry(*i.key());
+ if ( entry ){
+ updateSearchEntry(*entry, *i.value());
+ updated = true;
+ }
+ }
+ }
+
+ if ( updated ){
+ forceSearchQuery();
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::eventsUpdated()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::eventsAdded(const QModelIndex& parent, int first, int last)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::eventsAdded()" );
+ Q_UNUSED(parent);
+ readEvents(first, last);
+ forceSearchQuery();
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::eventsAdded()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::eventsRemoved(const QModelIndex& parent, int first, int last)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::eventsRemoved()" );
+ Q_UNUSED(parent);
+ bool removed( false );
+ QMap<LogsCntEntryHandle*, LogsEvent*>::iterator i;
+ for (i = mSearchEvents.begin(); i != mSearchEvents.end(); ++i){
+ if ( i.value()->index() >= first && i.value()->index() <= last &&
+ !i.value()->isInView() ){
+ mLogsCntFinder->deleteEntry(*i.key());
+ i = mSearchEvents.erase(i);
+ removed = true;
+ }
+ }
+
+ if ( removed ){
+ forceSearchQuery();
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::eventsRemoved()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::initPredictiveSearch()
+{
+ int searchStatus = mDbConnector->predictiveSearchStatus();
+ //searchStatus equal to 0 means that search should be permanently disabled
+ if (searchStatus != 0) {
+ mSearchEnabled = (searchStatus == 1 || searchStatus < 0);
+
+ mLogsCntFinder = new LogsCntFinder(LogsCommonData::getInstance().contactManager());
+ connect(mLogsCntFinder, SIGNAL(queryReady()),this, SLOT(queryReady()));
+
+ connect( &mParentModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)),
+ this, SLOT(eventsUpdated(const QModelIndex&,const QModelIndex&)));
+ connect( &mParentModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)),
+ this, SLOT(eventsAdded(const QModelIndex&,int,int)));
+ connect( &mParentModel, SIGNAL(rowsRemoved(const QModelIndex&,int,int)),
+ this, SLOT(eventsRemoved(const QModelIndex&,int,int)));
+ connect( &mParentModel, SIGNAL(modelReset()), this, SLOT(doModelReset()));
+ readEvents(0, mParentModel.rowCount());
+ mIconManager = new LogsThumbIconManager();
+ connect(mIconManager, SIGNAL(contactIconReady(int)),
+ this, SLOT(updateContactIcon(int)));
+ }
+}
+
+// -----------------------------------------------------------------------------
+// Add result container but don't get real data yet. Get data once it is
+// really needed.
+// -----------------------------------------------------------------------------
+//
+LogsMatchesModelItemContainer* LogsMatchesModel::addSearchResult(int resultIndex)
+{
+ LogsMatchesModelItemContainer* item = new LogsMatchesModelItemContainer(
+ mParentModel, *mIconManager, resultIndex);
+ mMatches.append(item);
+ return item;
+}
+
+// -----------------------------------------------------------------------------
+// Fill result container with real data if it does not yet contain it
+// -----------------------------------------------------------------------------
+//
+bool LogsMatchesModel::updateSearchResult(LogsMatchesModelItemContainer& item) const
+{
+ bool updated( false );
+ int resIndex = item.resultIndex();
+ if ( item.isNull() && resIndex >= 0 && mLogsCntFinder
+ && resIndex < mLogsCntFinder->resultsCount() ){
+ const LogsCntEntry& result = mLogsCntFinder->resultAt(resIndex);
+ if ( result.type() == LogsCntEntry::EntryTypeHistory ){
+ LogsEvent* event = mSearchEvents.value(result.handle());
+ if ( event ){
+ item.setEvent(*event);
+ item.updateData(result);
+ updated = true;
+ }
+ } else {
+ item.setContact(result.contactId());
+ item.updateData(result);
+ updated = true;
+ }
+ }
+ return updated;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::readEvents(int first, int last)
+{
+ for ( int i = first; i < mParentModel.rowCount() && i <= last; ++i ){
+ LogsEvent* event = qVariantValue<LogsEvent*>(
+ mParentModel.data( mParentModel.index(i, 0), LogsModel::RoleFullEvent ) );
+ if ( event ){
+ QObject* entryHandle = new QObject(this);
+ LogsCntEntry* entry = new LogsCntEntry(*entryHandle, 0);
+ updateSearchEntry(*entry, *event);
+ mLogsCntFinder->insertEntry(i, entry);
+ mSearchEvents.insert(entryHandle, event);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::logsMatches(const QString& pattern)
+{
+ // Do user inputted searches in async manner to avoid from
+ // blocking next input. This also decreases amount of queries when
+ // user types fast.
+ getLogsMatches(pattern, true);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsContact* LogsMatchesModel::createContact(const QString& number)
+{
+ LogsContact* contact = new LogsContact(number, *mDbConnector);
+ connect( contact, SIGNAL(saveCompleted(bool)), this, SLOT(forceSearchQuery()) );
+ return contact;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::getLogsMatches(const QString& pattern,
+ bool async,
+ bool force )
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsMatchesModel::getLogsMatches(), pattern:", pattern );
+ mCurrentSearchPattern = pattern;
+ if ( force ){
+ // Clear previous results immeditely as some data associated with results
+ // might be already gone.
+ doModelReset();
+ mPrevSearchPattern.clear();
+ }
+ if ( async ){
+ QMetaObject::invokeMethod(this, "doSearchQuery", Qt::QueuedConnection );
+ } else {
+ doSearchQuery();
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::getLogsMatches()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::doSearchQuery()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::doSearchQuery()" );
+ if (mCurrentSearchPattern != mPrevSearchPattern && mSearchEnabled){
+ mPrevSearchPattern = mCurrentSearchPattern;
+ if (mCurrentSearchPattern.length() > 0) {
+ LOGS_QDEBUG( "logs [ENG] do search" );
+ mLogsCntFinder->predictiveSearchQuery( mCurrentSearchPattern );
+ } else {
+ // Clear old results for empty search pattern
+ doModelReset();
+ }
+ } else {
+ LOGS_QDEBUG( "logs [ENG] pattern hasn't changed or search is OFF" );
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::doSearchQuery()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::doModelReset()
+{
+ qDeleteAll(mMatches);
+ mMatches.clear();
+ mResultCount = 0;
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::forceSearchQuery()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::forceSearchQuery()" );
+ getLogsMatches( mCurrentSearchPattern, true, true );
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::forceSearchQuery()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::updateSearchEntry(LogsCntEntry& entry, LogsEvent& event)
+{
+ if ( event.remoteParty().length() > 0 ) {
+ entry.setFirstName(event.remoteParty());
+ } else if ( event.number().length() > 0 ) {
+ entry.setPhoneNumber(stripPhoneNumber(event.number()));
+ } else if ( event.eventType() == LogsEvent::TypeVoIPCall && event.logsEventData() ){
+ if ( event.logsEventData()->isCsCompatible() ){
+ entry.setPhoneNumber(stripPhoneNumber(event.logsEventData()->remoteUrl()));
+ } else {
+ entry.setFirstName(event.logsEventData()->remoteUrl());
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+//Update the icon for the contact with the given index (row)
+//param index of the contact
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModel::updateContactIcon(int index)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::updateContactIcon()" );
+ QModelIndex modelIndex = createIndex(index, 0);
+ emit dataChanged(modelIndex, modelIndex);
+ LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::updateContactIcon()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QString LogsMatchesModel::stripPhoneNumber(const QString& phoneNumber) const
+{
+ if ( phoneNumber.startsWith(QLatin1Char('+')) ){
+ return phoneNumber.mid(1);
+ }
+ return phoneNumber;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMatchesModelItemContainer::LogsMatchesModelItemContainer(
+ LogsAbstractModel& parentModel,
+ LogsThumbIconManager& thumbIconManager,
+ int resultIndex) :
+ LogsModelItemContainer(),
+ mParentModel(parentModel),
+ mContactId( 0 ),
+ mIconManager(thumbIconManager),
+ mResultIndex(resultIndex)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMatchesModelItemContainer::~LogsMatchesModelItemContainer()
+{
+ delete mEvent;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModelItemContainer::setEvent(const LogsEvent& event)
+{
+ delete mEvent;
+ mEvent = 0;
+ mEvent = new LogsEvent(event);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModelItemContainer::setContact(unsigned int contactId)
+{
+ mContactId = contactId;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+unsigned int LogsMatchesModelItemContainer::contact() const
+{
+ return mContactId;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QString LogsMatchesModelItemContainer::number() const
+{
+ QString num;
+ if ( mEvent ){
+ num = mEvent->getNumberForCalling();
+ } else if ( mContactId > 0 ) {
+ QContact contact = LogsCommonData::getInstance().contactManager().contact( mContactId );
+ QContactPhoneNumber contactNum =
+ contact.detail( QContactPhoneNumber::DefinitionName );
+ num = contactNum.value(QContactPhoneNumber::FieldNumber);
+ }
+ return num;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QString LogsMatchesModelItemContainer::contactName() const
+{
+ return mContactName;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsMatchesModelItemContainer::isNull() const
+{
+ return ( !mEvent && !mContactId );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsMatchesModelItemContainer::isEventMatch() const
+{
+ return ( mEvent != 0 );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QStringList LogsMatchesModelItemContainer::texts()
+{
+ QStringList list;
+ if ( mEvent ){
+ list << mFormattedCallerId;
+ list << mEvent->time().toTimeSpec(Qt::LocalTime).toString();
+ } else if ( mContactId > 0 ) {
+ list << mContactName;
+ list << mContactNumber;
+ }
+ return list;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QList<QVariant> LogsMatchesModelItemContainer::icons(int row)
+{
+ QList<QVariant> icons;
+ if ( mEvent ) {
+ mParentModel.getDecorationData(*mEvent, icons);
+ } else if ( mContactId > 0 ) {
+ QIcon& icon = mIconManager.contactIcon( mAvatarPath, row );
+ icons.append(icon);
+ }
+ return icons;
+
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModelItemContainer::updateData(const LogsCntEntry& entry)
+{
+ if ( mEvent ){
+ mFormattedCallerId = getFormattedCallerId(entry);
+ } else if ( mContactId > 0 ){
+ getFormattedContactInfo(entry, mContactName, mContactNumber);
+ mAvatarPath.clear();
+ mAvatarPath = entry.avatarPath();
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsMatchesModelItemContainer::resultIndex() const
+{
+ return mResultIndex;
+}
+
+// -----------------------------------------------------------------------------
+// Note: Mapping of search result entry into caller ID is depended on
+// updateSearchEntry() implemention.
+// -----------------------------------------------------------------------------
+//
+QString LogsMatchesModelItemContainer::getFormattedCallerId(
+ const LogsCntEntry& entry) const
+{
+ QString callerId;
+ foreach( LogsCntText name, entry.firstName() ) {
+ callerId.append( name.richText() );
+ if ( name.text().length() > 0 ) {
+ callerId.append(" ");
+ }
+ }
+
+ if ( callerId.length() == 0 ) {
+ callerId = entry.phoneNumber().richText();
+ }
+
+ return callerId.trimmed();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesModelItemContainer::getFormattedContactInfo(
+ const LogsCntEntry& entry,
+ QString& contactName,
+ QString& contactNumber ) const
+{
+ contactName.clear();
+ foreach( LogsCntText name, entry.firstName() ) {
+ contactName.append( name.richText() );
+ if ( name.text().length() > 0 ) {
+ contactName.append(" ");
+ }
+ }
+
+ foreach( LogsCntText lastname, entry.lastName() ) {
+ contactName.append( lastname.richText() );
+ if ( lastname.text().length() > 0 ) {
+ contactName.append(" ");
+ }
+ }
+ contactName = contactName.trimmed();
+
+ contactNumber = entry.phoneNumber().richText();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logsmessage.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* 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 "logsmessage.h"
+#include "logslogger.h"
+#include "logseventdata.h"
+#include <xqservicerequest.h>
+
+//SYSTEM
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMessage::LogsMessage(LogsEvent& event)
+ :QObject(), mIsAllowed( false ), mContactId( 0 ), mService( 0 )
+{
+ if ( event.logsEventData() && !event.logsEventData()->isCsCompatible() ){
+ LOGS_QDEBUG( "logs [ENG] LogsMessage::LogsMessage, not CS compatible" )
+ mIsAllowed = false;
+ } else {
+ mIsAllowed = true;
+ mNumber = event.getNumberForCalling();
+ mContactId = event.contactLocalId();
+ mDisplayName = event.remoteParty();
+ }
+
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMessage::LogsMessage(unsigned int contactId, const QString& number,
+ const QString& displayName)
+ :QObject(), mIsAllowed( false ), mContactId( 0 ), mService( 0 )
+{
+ if ( number.length() == 0 ){
+ LOGS_QDEBUG( "logs [ENG] LogsMessage::LogsMessage, not CS compatible" )
+ mIsAllowed = false;
+ } else {
+ mIsAllowed = true;
+ mNumber = number;
+ mContactId = contactId;
+ mDisplayName = displayName;
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMessage::~LogsMessage()
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsMessage::~LogsMessage()" )
+ delete mService;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsMessage::isMessagingAllowed()
+{
+ return mIsAllowed;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsMessage::sendMessage()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMessage::sendMessage()" )
+
+ delete mService;
+ mService = 0;
+ mService = new XQServiceRequest("com.nokia.services.hbserviceprovider.conversationview",
+ "send(QString,qint32,QString)", false);
+ bool sending = doSendMessageToNumber(*mService, mNumber, mDisplayName, mContactId);
+ connect(mService, SIGNAL(requestCompleted(QVariant)), this, SLOT(requestCompleted(QVariant)));
+ connect(mService, SIGNAL(requestError(int)), this, SLOT(requestError(int)));
+ return sending;
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsMessage::sendMessageToNumber(
+ const QString& number, const QString& displayName, unsigned int contactId)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMessage::sendMessageToNumber()" )
+
+ XQServiceRequest req("com.nokia.services.hbserviceprovider.conversationview",
+ "send(QString,qint32,QString)", false);
+ return doSendMessageToNumber(req, number, displayName, contactId);
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void LogsMessage::requestCompleted(const QVariant& /*value*/)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMessage::requestCompleted()" )
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void LogsMessage::requestError(int /*err*/)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsMessage::requestError()" )
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsMessage::doSendMessageToNumber(
+ XQServiceRequest& request, const QString& number,
+ const QString& displayName, unsigned int contactId)
+{
+ LOGS_QDEBUG_4( "logs [ENG] -> LogsMessage::doSendMessageToNumber(), (num, name, id)",
+ number, displayName, contactId )
+
+ QList<QVariant> arguments;
+ arguments.append(QVariant(number));
+ arguments.append(QVariant(contactId));
+ arguments.append(QVariant(displayName));
+ request.setArguments(arguments);
+ QVariant retValue;
+ bool ret = request.send(retValue);
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsMessage::doSendMessageToNumber()", ret )
+
+ return ret;
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logsmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,398 @@
+/*
+* 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 "logsmodel.h"
+#include "logsdbconnector.h"
+#include "logsevent.h"
+#include "logslogger.h"
+#include "logscall.h"
+#include "logscontact.h"
+#include "logsengdefs.h"
+#include "logsdetailsmodel.h"
+#include "logsmatchesmodel.h"
+#include "logsmessage.h"
+#include "logseventdata.h"
+#include "logscommondata.h"
+#include <hbicon.h>
+#include <QStringList>
+
+Q_DECLARE_METATYPE(LogsEvent *)
+Q_DECLARE_METATYPE(LogsCall *)
+Q_DECLARE_METATYPE(LogsDetailsModel *)
+Q_DECLARE_METATYPE(LogsMessage *)
+Q_DECLARE_METATYPE(LogsContact *)
+Q_DECLARE_METATYPE(LogsMatchesModel *)
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsModel::LogsModel(LogsModelType modelType, bool resourceControl) :
+ LogsAbstractModel(), mModelType(modelType)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsModel::LogsModel()" )
+
+ initIcons();
+
+ bool allEvents( mModelType == LogsFullModel );
+ mDbConnector = new LogsDbConnector( mEvents, allEvents, resourceControl );
+ connect( mDbConnector, SIGNAL( dataAdded(QList<int>) ),
+ this, SLOT( dataAdded(QList<int>) ));
+ connect( mDbConnector, SIGNAL( dataUpdated(QList<int>) ),
+ this, SLOT( dataUpdated(QList<int>) ));
+ connect( mDbConnector, SIGNAL( dataRemoved(QList<int>) ),
+ this, SLOT( dataRemoved(QList<int>) ));
+ mDbConnector->init();
+ mDbConnector->start();
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsModel::LogsModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsModel::~LogsModel()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsModel::~LogsModel()" )
+
+ delete mDbConnector;
+
+ LogsCommonData::freeCommonData();
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsModel::~LogsModel()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsModel::clearList(LogsModel::ClearType cleartype)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsModel::clearList()" )
+
+ connect( mDbConnector, SIGNAL(clearingCompleted(int)),
+ this, SIGNAL(clearingCompleted(int)) );
+ return mDbConnector->clearList(cleartype);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsModel::markEventsSeen(LogsModel::ClearType cleartype)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsModel::markEventsSeen()" )
+
+ QList<int> markedEvents;
+ foreach ( LogsEvent* event, mEvents ){
+ if ( matchEventWithClearType(*event, cleartype) && !event->isSeenLocally() ){
+ markedEvents.append(event->logId());
+ }
+ }
+ connect( mDbConnector, SIGNAL(markingCompleted(int)),
+ this, SIGNAL(markingCompleted(int)) );
+ bool retVal = mDbConnector->markEventsSeen(markedEvents);
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsModel::markEventsSeen()", retVal )
+ return retVal;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsModel::clearMissedCallsCounter()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsModel::clearMissedCallsCounter()" )
+ int err = mDbConnector->clearMissedCallsCounter();
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsModel::clearMissedCallsCounter(), err", err )
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsModel::refreshData()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsModel::refreshData()" )
+ int err = mDbConnector->refreshData();
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsModel::refreshData(), err", err )
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsModel::compressData()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsModel::compressData()" )
+ int err = mDbConnector->compressData();
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsModel::compressData(), err", err )
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsModel::predictiveSearchStatus()
+{
+ return mDbConnector->predictiveSearchStatus();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsModel::setPredictiveSearch(bool enabled)
+{
+ return mDbConnector->setPredictiveSearch(enabled);
+}
+
+
+// -----------------------------------------------------------------------------
+// From QAbstractListModel
+// -----------------------------------------------------------------------------
+//
+int LogsModel::rowCount(const QModelIndex & /* parent */) const
+{
+ return mEvents.count();
+}
+
+// -----------------------------------------------------------------------------
+// From QAbstractItemModel
+// -----------------------------------------------------------------------------
+//
+QVariant LogsModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid() ||
+ index.row() >= mEvents.count() ||
+ index.row() < 0 ) {
+ return QVariant();
+ }
+
+ LogsEvent* event = mEvents.at(index.row());
+ if (role == Qt::DisplayRole){
+ QStringList list;
+ list << getCallerId( *event );
+ list << event->time().toTimeSpec(Qt::LocalTime).toString();
+ return QVariant(list);
+ } else if (role == Qt::DecorationRole) {
+ QList<QVariant> icons;
+ getDecorationData(*event, icons);
+ return QVariant(icons);
+ } else if ( role == RoleDetailsModel ) {
+ LOGS_QDEBUG( "logs [ENG] LogsModel::data() RoleDetailsModel" )
+ LogsDetailsModel* detailsModel =
+ new LogsDetailsModel( *mDbConnector, *event );
+ QVariant var = qVariantFromValue( detailsModel );
+ return var;
+ }
+ LogsModelItemContainer item(event);
+ return doGetData(role, item);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsMatchesModel* LogsModel::logsMatchesModel()
+{
+ LOGS_QDEBUG( "logs [ENG] LogsModel::logsMatchesModel()" )
+ return new LogsMatchesModel( *this, *mDbConnector );
+}
+
+// -----------------------------------------------------------------------------
+// NOTE: documentation mentions that beginInsertRows should be called
+// before adding data to the model. We are not conforming to that at
+// the moment and still everything works fine. If there is problems
+// in future, dbconnector should give prenotification about data addition.
+// Same applies for dataUpdated and dataRemoved.
+// -----------------------------------------------------------------------------
+//
+void LogsModel::dataAdded(QList<int> addedIndexes)
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsModel::dataAdded(), idxs:", addedIndexes );
+ LOGS_QDEBUG_EVENT_ARR(mEvents)
+
+ QList< QList<int> > sequences = findSequentialIndexes(addedIndexes);
+ for ( int i = 0; i < sequences.count(); i++ ) {
+ beginInsertRows(QModelIndex(), sequences.at(i).first(), sequences.at(i).last());
+ endInsertRows();
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsModel::dataAdded()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsModel::dataUpdated(QList<int> updatedIndexes)
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsModel::dataUpdated(), idxs:", updatedIndexes );
+ LOGS_QDEBUG_EVENT_ARR(mEvents)
+
+ QList< QList<int> > sequences = findSequentialIndexes(updatedIndexes);
+ for ( int i = 0; i < sequences.count(); i++ ) {
+ QModelIndex top = index(sequences.at(i).first());
+ QModelIndex bottom = index(sequences.at(i).last());
+ emit dataChanged(top, bottom);
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsModel::dataUpdated()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsModel::dataRemoved(QList<int> removedIndexes)
+{
+ LOGS_QDEBUG_2( "logs [ENG] -> LogsModel::dataRemoved(), idxs:", removedIndexes );
+ LOGS_QDEBUG_EVENT_ARR(mEvents)
+
+ QList< QList<int> > sequences = findSequentialIndexes(removedIndexes);
+ for ( int i = ( sequences.count() - 1 ); i >= 0; i-- ) {
+ beginRemoveRows(QModelIndex(), sequences.at(i).first(), sequences.at(i).last());
+ endRemoveRows();
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsModel::dataRemoved()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QList< QList<int> > LogsModel::findSequentialIndexes(const QList<int>& indexes)
+{
+ QList< QList<int> > sequences;
+ QList<int> currSequence;
+ int prevIndex = indexes.at(0) - 1;
+ for ( int i = 0; i < indexes.count(); i++ ){
+ int currIndex = indexes.at(i);
+ if ( prevIndex+1 != currIndex ){
+
+ sequences.append(currSequence);
+ currSequence.clear();
+ }
+ currSequence.append(currIndex);
+ prevIndex = currIndex;
+ }
+
+ if ( !currSequence.isEmpty() ){
+ // Add last sequence if such exist
+ sequences.append(currSequence);
+ }
+ return sequences;
+}
+
+// -----------------------------------------------------------------------------
+// Caller id:
+// name
+// or num
+// or remote url
+// or no num
+// -----------------------------------------------------------------------------
+//
+QString LogsModel::getCallerId(const LogsEvent& event) const
+{
+ QString callerId(event.remoteParty());
+ if ( callerId.length() == 0 ){
+ callerId = event.number();
+ }
+ if ( callerId.length() == 0 && event.logsEventData() ){
+ callerId = event.logsEventData()->remoteUrl();
+ }
+ if ( callerId.length() == 0 ){
+ callerId = tr("No number");
+ }
+ int duplicates = event.duplicates();
+ if ( duplicates > 0 && !event.isSeenLocally() ){
+ callerId.append( "(" );
+ callerId.append( QString::number(duplicates + 1) );
+ callerId.append( ")");
+ }
+ return callerId;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsModel::initIcons()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsModel::LogsModel()" )
+
+ HbIcon* icon = new HbIcon(logsDialledVoiceCallIconId);
+ mIcons.insert(logsDialledVoiceCallIconId, icon);
+ icon = new HbIcon(logsMissedVoiceCallIconId);
+ mIcons.insert(logsMissedVoiceCallIconId, icon);
+ icon = new HbIcon(logsMissedVoiceCallUnseenIconId);
+ mIcons.insert(logsMissedVoiceCallUnseenIconId, icon);
+ icon = new HbIcon(logsReceivedVoiceCallIconId);
+ mIcons.insert(logsReceivedVoiceCallIconId, icon);
+
+ icon = new HbIcon(logsDialledVideoCallIconId);
+ mIcons.insert(logsDialledVideoCallIconId, icon);
+ icon = new HbIcon(logsMissedVideoCallIconId);
+ mIcons.insert(logsMissedVideoCallIconId, icon);
+ icon = new HbIcon(logsMissedVideoCallUnseenIconId);
+ mIcons.insert(logsMissedVideoCallUnseenIconId, icon);
+ icon = new HbIcon(logsReceivedVideoCallIconId);
+ mIcons.insert(logsReceivedVideoCallIconId, icon);
+
+ icon = new HbIcon(logsDialledVoipCallIconId);
+ mIcons.insert(logsDialledVoipCallIconId, icon);
+ icon = new HbIcon(logsMissedVoipCallIconId);
+ mIcons.insert(logsMissedVoipCallIconId, icon);
+ icon = new HbIcon(logsMissedVoipCallUnseenIconId);
+ mIcons.insert(logsMissedVoipCallUnseenIconId, icon);
+ icon = new HbIcon(logsReceivedVoipCallIconId);
+ mIcons.insert(logsReceivedVoipCallIconId, icon);
+
+ LOGS_QDEBUG( "logs [ENG] <- LogsModel::LogsModel()" )
+}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+bool LogsModel::matchEventWithClearType(
+ const LogsEvent& event, LogsModel::ClearType clearType)
+{
+ bool match( false );
+ LogsEvent::LogsDirection dir = event.direction();
+ switch (clearType){
+ case LogsModel::TypeLogsClearAll:
+ match = true;
+ break;
+ case LogsModel::TypeLogsClearReceived:
+ match = ( dir == LogsEvent::DirIn );
+ break;
+ case LogsModel::TypeLogsClearCalled:
+ match = ( dir == LogsEvent::DirOut );
+ break;
+ case LogsModel::TypeLogsClearMissed:
+ match = ( dir == LogsEvent::DirMissed );
+ break;
+ default:
+ break;
+ }
+ return match;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logsthumbnailmanager.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,189 @@
+/*
+* 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 "logsthumbnailmanager.h"
+#include "logslogger.h"
+#include "logsengdefs.h"
+#include <thumbnailmanager_qt.h>
+#include <hbicon.h>
+
+const int KMaxQueueSize = 25;
+const int KContactFetchTimer1 = 400;
+const int KContactFetchTimer2 = 20;
+const int KLogsMaxCacheSize = 50;
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsThumbIconManager::LogsThumbIconManager(QObject *parent)
+ : QObject(parent),
+ mQueueCount(0),
+ mDefaultIcon(0)
+{
+ mThumbnailManager = new ThumbnailManager(this);
+ mThumbnailManager->setMode(ThumbnailManager::Default);
+ mThumbnailManager->setQualityPreference(ThumbnailManager::OptimizeForPerformance);
+ mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailSmall);
+
+ connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void *, int, int)),
+ this, SLOT(thumbnailReady(QPixmap, void *, int, int)));
+
+ mTimer = new QTimer();
+ connect( mTimer, SIGNAL(timeout()), this, SLOT(timerTimeout()) );
+ mDefaultIcon = new HbIcon(logsThumbUnknownId);
+ mImageCache.setMaxCost(KLogsMaxCacheSize);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsThumbIconManager::~LogsThumbIconManager()
+{
+ cancel();
+ mImageCache.clear();
+ delete mTimer;
+ delete mDefaultIcon;
+}
+
+// -----------------------------------------------------------------------------
+// Get the icon for the requested avatarPath or send a new request
+// to the thumbnailmanager if it doesn't exist yet, default icon is returned
+// if cached icon does not exist
+// -----------------------------------------------------------------------------
+//
+QIcon& LogsThumbIconManager::contactIcon(const QString &avatarPath, int index)
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsThumbIconManager::contactIcon()" )
+ QIcon* icon = 0;
+ if ( avatarPath.isEmpty() ){
+ icon = &defaultIcon();
+ } else if ( mImageCache.contains(avatarPath) ) {
+ icon = mImageCache.object(avatarPath);
+ LOGS_QDEBUG( "logs [ENG] -> LogsThumbIconManager::contactIcon() image was cached" )
+ }
+ else
+ {
+ icon = &defaultIcon();
+ mTimer->stop();
+ mTimer->start(KContactFetchTimer1);
+ mQueueCount++;
+ mRequestQueue.enqueue(qMakePair(avatarPath, index));
+ if( mQueueCount > KMaxQueueSize ){
+ LOGS_QDEBUG( "logs [ENG] -> LogsThumbIconManager::contactIcon() image was not cached" )
+ mRequestQueue.dequeue();
+ mQueueCount--;
+ }
+ }
+ return *icon;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QIcon& LogsThumbIconManager::defaultIcon()
+{
+ return mDefaultIcon->qicon();
+}
+
+// -----------------------------------------------------------------------------
+// Cancel all requests
+// -----------------------------------------------------------------------------
+//
+void LogsThumbIconManager::cancel()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsThumbIconManager::cancel()" )
+ if (!mTnmReqMap.empty()){
+ QMapIterator<int, QString> iter(mTnmReqMap);
+ while (iter.hasNext()){
+ iter.next();
+ bool result = mThumbnailManager->cancelRequest(iter.key());
+ }
+ }
+ mTnmReqMap.clear();
+ mRequestQueue.clear();
+ mQueueCount = 0;
+ mImageCache.clear();
+}
+
+
+// -----------------------------------------------------------------------------
+// Called when thumbnailmanager finishes creating a thumbnail,
+// emits a signal for LogsMatchesModelModel to update icon for a contact
+// -----------------------------------------------------------------------------
+//
+void LogsThumbIconManager::thumbnailReady(const QPixmap& pixmap, void *data, int id, int error)
+{
+ LOGS_QDEBUG_2("LogsThumbIconManager::thumbnailReady:: error:", error );
+ // Find the index
+ if (mTnmReqMap.contains(id)){
+ QString avatarPath = mTnmReqMap[id];
+ LOGS_QDEBUG_3( "LogsThumbIconManager::thumbnailReady (avatarPath, error):", avatarPath, error );
+ mTnmReqMap.remove(id);
+ if ( error == 0 ){
+ int *clientData = (int *)data;
+ int index = *clientData;
+ QIcon* icon = new QIcon(pixmap);
+ LOGS_QDEBUG_3( "LogsThumbIconManager::thumbnailReady (avatarPath, mImageCache.count()):", avatarPath, mImageCache.count() );
+ mImageCache.insert(avatarPath, icon);
+ LOGS_QDEBUG_3( "LogsThumbIconManager::thumbnailReady (avatarPath, mImageCache.count()):", avatarPath, mImageCache.count() );
+ emit contactIconReady(index);
+ LOGS_QDEBUG("LogsThumbIconManager::thumbnailReady - signal emitted");
+ if (!mRequestQueue.isEmpty()){
+ mTimer->start(KContactFetchTimer2);
+ }
+ delete clientData;
+ } else {
+ thumbnailLoad();
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsThumbIconManager::thumbnailLoad()
+{
+ LOGS_QDEBUG( "logs [ENG] -> LogsThumbIconManager::thumbnailLoad()->" )
+ mTimer->stop();
+ if (!mRequestQueue.isEmpty()){
+ mQueueCount--;
+ QPair<QString, int> req = mRequestQueue.dequeue();
+ QString avatarPath = req.first;
+ int index = req.second;
+ int *clientData = new int(index);
+ LOGS_QDEBUG_2("LogsThumbIconManager::thumbnailLoad clientData is ", clientData );
+ int reqId = mThumbnailManager->getThumbnail(avatarPath, clientData, 0);
+ LOGS_QDEBUG_2("LogsThumbIconManager::thumbnailLoad reqId is ", reqId );
+ mTnmReqMap.insert(reqId, avatarPath);
+ }
+ LOGS_QDEBUG( "logs [ENG] -> LogsThumbIconManager::thumbnailLoad()<-" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsThumbIconManager::timerTimeout()
+{
+ thumbnailLoad();
+
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/themes/icons/hbdefault/scalable/qtg_large_missed_video_call_unseen.svg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="60" viewBox="0 0 60 60" width="60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<linearGradient gradientTransform="matrix(0.2118 0.9773 -0.9773 0.2118 -634.5609 -270.4865)" gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="422.2207" x2="428.7761" y1="-578.2104" y2="-582.472">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.1333" style="stop-color:#FFBE82"/>
+<stop offset="0.6303" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#FFBE82"/>
+</linearGradient>
+<path d="M18.469,33.146c2.09-3.596,4.591-6.497,7.281-9.19c2.594-2.589,6.72-5.299,8.562-6.254L43.916,7.42 c-0.846-0.3-3.693-0.465-7.279,0.616c-3.588,1.083-11.736,6.302-16.979,11.547C14.416,24.83,9.932,31.93,9.077,34.178 c-1.343,3.541-1.222,7.445-0.929,8.58c0,0,0.34,1.035,1.145,2.377C9.636,45.711,18.469,33.146,18.469,33.146z" fill="url(#SVGID_1_)"/>
+<path d="M30.573,20.037c1.488-1.037,2.869-1.883,3.74-2.335l9.346-10.006 c-0.131-0.057-0.209-0.088-0.209-0.088c-0.246-0.088-0.641-0.162-1.123-0.218c-0.793,0.005-1.596,0.093-2.402,0.27 C34.23,8.909,30.409,14.194,30.573,20.037z" fill="#020202" fill-opacity="0.05" stroke-opacity="0.05"/>
+<path d="M31.295,19.542c1.205-0.809,2.291-1.462,3.018-1.84l9.377-10.04 c-0.146-0.063-0.234-0.098-0.234-0.098c-0.232-0.08-0.604-0.152-1.061-0.203c-0.75,0.006-1.508,0.087-2.27,0.253 C34.664,8.813,31.023,13.932,31.295,19.542z" fill="#020202" fill-opacity="0.1" stroke-opacity="0.1"/>
+<path d="M43.467,7.499c-0.209-0.073-0.549-0.137-0.963-0.186c-0.68,0.006-1.369,0.08-2.059,0.231 c-5.088,1.116-8.426,5.984-7.977,11.233c0.725-0.455,1.363-0.826,1.844-1.076l9.422-10.088C43.566,7.538,43.467,7.499,43.467,7.499z " fill="#020202" fill-opacity="0.1" stroke-opacity="0.1"/>
+<radialGradient cx="46.6523" cy="-5.2056" gradientTransform="matrix(0.6122 0 0 0.6122 11.7943 11.6322)" gradientUnits="userSpaceOnUse" id="SVGID_2_" r="20.0698">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.6242" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#FFBE82"/>
+</radialGradient>
+<path d="M34.313,17.702l0.928,1.55c0,0,15.102-6.784,14.084-8.039c-0.514-0.631-0.576-0.656-1.238-1.262 c-1.984-1.815-4.17-2.531-4.17-2.531C43.73,7.357,43.434,7.3,43.07,7.258c-0.596,0.005-1.199,0.069-1.805,0.202 c-4.592,1.008-7.572,5.5-6.965,10.256C34.305,17.713,34.309,17.706,34.313,17.702z" fill="url(#SVGID_2_)"/>
+<path d="M16.873,33.344c-0.989-0.141-2.008-0.121-3.028,0.104c-2.417,0.531-4.375,2.066-5.646,4.131 c-0.367,2.35-0.25,4.408-0.05,5.18c0,0,0.34,1.035,1.145,2.377c0.289,0.484,6.539-8.264,8.555-11.107L16.873,33.344z" fill="#020202" fill-opacity="0.1" stroke-opacity="0.1"/>
+<path d="M17.755,33.373c-0.989-0.141-2.008-0.119-3.029,0.104c-3.313,0.727-5.776,3.332-6.76,6.623 C7.94,41.125,8,41.973,8.093,42.498c0.002,0.012,0.005,0.033,0.01,0.047c0,0,0.339,1.033,1.143,2.379 c0.3,0.498,6.981-8.887,8.75-11.383L17.755,33.373z" fill="#020202" fill-opacity="0.1" stroke-opacity="0.1"/>
+<radialGradient cx="437.749" cy="-560.2109" gradientTransform="matrix(0.1283 0.5992 -0.5928 0.13 -373.5847 -154.0506)" gradientUnits="userSpaceOnUse" id="SVGID_3_" r="23.8799">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.6242" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#FFBE82"/>
+</radialGradient>
+<path d="M10.591,46.975c0.616,0.74,0.646,0.955,1.294,1.525c1.195,1.055,9.301-13.613,9.301-13.613 l-2.683-1.719c-0.941-0.111-1.913-0.08-2.889,0.135c-4.777,1.049-7.806,5.869-6.87,10.832C9.138,44.922,9.736,45.947,10.591,46.975z " fill="url(#SVGID_3_)"/>
+<path d="M49.324,11.213c-0.178-0.219-0.381-0.445-0.578-0.669l-13.943,7.958l0.438,0.749 C35.24,19.252,50.342,12.468,49.324,11.213z" fill="#020202" fill-opacity="0.4" stroke-opacity="0.4"/>
+<linearGradient gradientTransform="matrix(0.2118 0.9773 -0.9773 0.2118 -634.5599 -270.4865)" gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="421.4131" x2="426.6039" y1="-610.4937" y2="-594.0048">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.6788" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#FFBE82"/>
+</linearGradient>
+<path d="M35.24,19.252l1.178,1.98c0.301,0.515,0.973,0.673,1.57,0.423l4.09-2.335l8.043-4.667 c0.631-0.363,0.877-1.12,0.549-1.685c0,0-0.334-0.501-1.35-1.752L35.24,19.252z" fill="url(#SVGID_4_)"/>
+<path d="M21.186,34.887l-0.725-0.473l-9.214,13.488c0.215,0.203,0.429,0.412,0.638,0.598 C13.081,49.555,21.186,34.887,21.186,34.887z" fill="#020202" fill-opacity="0.4" stroke-opacity="0.4"/>
+<linearGradient gradientTransform="matrix(0.2118 0.9773 -0.9773 0.2118 -634.5599 -270.4865)" gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="438.8232" x2="450.6482" y1="-577.3184" y2="-564.2958">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.6788" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#FFBE82"/>
+</linearGradient>
+<path d="M11.887,48.498c1.193,1.051,1.685,1.371,1.685,1.371c0.568,0.367,1.363,0.168,1.781-0.443 l7.901-11.605c0.418-0.615,0.307-1.412-0.261-1.777l-1.808-1.156L11.887,48.498z" fill="url(#SVGID_5_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_6_" x1="39.1182" x2="44.145" y1="48.6309" y2="48.6309">
+<stop offset="0" style="stop-color:#878A8C"/>
+<stop offset="0.2606" style="stop-color:#BDC2C4"/>
+<stop offset="0.6606" style="stop-color:#5B6163"/>
+<stop offset="1" style="stop-color:#959A9C"/>
+</linearGradient>
+<rect fill="url(#SVGID_6_)" height="7.535" width="4.896" x="39.184" y="44.863"/>
+<path d="M39.184,49.596c0.787,0.189,1.604,0.303,2.449,0.303c0.844,0,1.662-0.113,2.447-0.303v-4.121 h-4.896V49.596z" fill="#020202" fill-opacity="0.2" stroke-opacity="0.2"/>
+<path d="M39.184,48.982c0.787,0.191,1.604,0.303,2.449,0.303c0.844,0,1.662-0.111,2.447-0.303v-4.119 h-4.896V48.982z" fill="#020202" fill-opacity="0.2" stroke-opacity="0.2"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_7_" x1="41.6328" x2="41.6328" y1="27.8325" y2="48.6499">
+<stop offset="0" style="stop-color:#F2F2F2"/>
+<stop offset="0.3212" style="stop-color:#E6E6E6"/>
+<stop offset="1" style="stop-color:#666666"/>
+</linearGradient>
+<path d="M41.633,48.674c-5.74,0-10.408-4.67-10.408-10.408c0-5.74,4.668-10.409,10.408-10.409 c5.738,0,10.408,4.668,10.408,10.409C52.041,44.004,47.371,48.674,41.633,48.674L41.633,48.674z" fill="url(#SVGID_7_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_8_" x1="41.6318" x2="41.6318" y1="28.4473" y2="48.0381">
+<stop offset="0" style="stop-color:#D1D7D9"/>
+<stop offset="0.0667" style="stop-color:#D1D7D9"/>
+<stop offset="0.2606" style="stop-color:#BDC2C4"/>
+<stop offset="0.6606" style="stop-color:#7C8487"/>
+<stop offset="1" style="stop-color:#ADB3B5"/>
+</linearGradient>
+<circle cx="41.632" cy="38.266" fill="url(#SVGID_8_)" r="9.796"/>
+<path d="M41.633,47.037c-5.102,0-9.268-4.059-9.445-9.115c-0.004,0.111-0.008,0.223-0.008,0.334 c0,5.211,4.24,9.451,9.453,9.451c5.211,0,9.451-4.24,9.451-9.451c0-0.111-0.004-0.223-0.008-0.334 C50.898,42.979,46.732,47.037,41.633,47.037z" fill="#FFFFFF" fill-opacity="0.1" stroke-opacity="0.1"/>
+<path d="M49.592,37.848c0,4.516-3.564,8.969-7.963,8.967c-4.395-0.002-7.957-4.457-7.957-8.971 c0.004-4.516,3.568-8.172,7.963-8.172C46.029,29.675,49.594,33.334,49.592,37.848z" fill="#231F20" fill-opacity="0.3" stroke-opacity="0.3"/>
+<path d="M41.629,46.15c-2.291,0-4.443-0.893-6.061-2.512c-1.619-1.619-2.51-3.773-2.508-6.063 c0-4.725,3.846-8.567,8.572-8.567c2.291,0,4.443,0.893,6.063,2.512c1.619,1.619,2.51,3.771,2.508,6.063 c0,4.725-3.846,8.566-8.57,8.566H41.629z" fill="#231F20" fill-opacity="0.2" stroke-opacity="0.2"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_9_" x1="41.6318" x2="41.6318" y1="29.5093" y2="45.4663">
+<stop offset="0" style="stop-color:#CFCFCF"/>
+<stop offset="0.1091" style="stop-color:#CFCFCF"/>
+<stop offset="0.6848" style="stop-color:#121212"/>
+<stop offset="1" style="stop-color:#A6A6A6"/>
+</linearGradient>
+<path d="M41.629,45.539c-2.127-0.002-4.125-0.83-5.629-2.334c-1.502-1.502-2.328-3.502-2.328-5.629 c0-4.387,3.572-7.956,7.961-7.956c2.127,0,4.125,0.83,5.629,2.333c1.504,1.504,2.33,3.504,2.33,5.631 c-0.002,4.387-3.572,7.955-7.959,7.955H41.629z" fill="url(#SVGID_9_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_10_" x1="41.6318" x2="41.6318" y1="30.1289" y2="44.8584">
+<stop offset="0" style="stop-color:#F2F2F2"/>
+<stop offset="1" style="stop-color:#606769"/>
+</linearGradient>
+<circle cx="41.632" cy="37.58" fill="url(#SVGID_10_)" r="7.347"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_11_" x1="41.6318" x2="41.6318" y1="31.4756" y2="43.6433">
+<stop offset="0" style="stop-color:#1A1A1A"/>
+<stop offset="0.503" style="stop-color:#343434"/>
+<stop offset="0.7515" style="stop-color:#9E9E9E"/>
+<stop offset="1" style="stop-color:#CFCFCF"/>
+</linearGradient>
+<path d="M41.633,43.701c-1.639,0-3.176-0.639-4.332-1.795c-1.154-1.156-1.791-2.693-1.791-4.33 c0-3.373,2.746-6.119,6.123-6.119c1.637,0,3.174,0.637,4.33,1.795c1.156,1.156,1.793,2.693,1.791,4.33 C47.754,40.957,45.008,43.701,41.633,43.701L41.633,43.701z" fill="url(#SVGID_11_)"/>
+<radialGradient cx="59.5957" cy="40.5771" gradientTransform="matrix(0.621 1.836735e-004 -1.836735e-004 0.6209 5.2261 12.8455)" gradientUnits="userSpaceOnUse" id="SVGID_12_" r="10.1859">
+<stop offset="0" style="stop-color:#000000"/>
+<stop offset="0.5917" style="stop-color:#000000"/>
+<stop offset="0.627" style="stop-color:#050505"/>
+<stop offset="0.7652" style="stop-color:#121212"/>
+<stop offset="0.8876" style="stop-color:#171717"/>
+<stop offset="1" style="stop-color:#171717"/>
+</radialGradient>
+<circle cx="41.632" cy="37.579" fill="url(#SVGID_12_)" r="5.511"/>
+<radialGradient cx="53.6738" cy="32.9404" gradientTransform="matrix(0.621 0 0 0.6209 5.811 13.4188)" gradientUnits="userSpaceOnUse" id="SVGID_13_" r="16.2221">
+<stop offset="0" style="stop-color:#242424"/>
+<stop offset="0.4303" style="stop-color:#242424"/>
+<stop offset="0.7818" style="stop-color:#000000"/>
+<stop offset="1" style="stop-color:#000000"/>
+</radialGradient>
+<circle cx="41.633" cy="37.58" fill="url(#SVGID_13_)" r="4.521"/>
+<radialGradient cx="56.7607" cy="30.0415" gradientTransform="matrix(0.621 1.836735e-004 -1.836735e-004 0.6209 5.2261 12.8455)" gradientUnits="userSpaceOnUse" id="SVGID_14_" r="17.797">
+<stop offset="0" style="stop-color:#A700F5"/>
+<stop offset="0.3091" style="stop-color:#A700F5"/>
+<stop offset="0.4364" style="stop-color:#5E008A"/>
+<stop offset="0.8061" style="stop-color:#0E1402"/>
+<stop offset="1" style="stop-color:#0E1402"/>
+</radialGradient>
+<path d="M45.672,37.58c0,2.232-1.809,4.041-4.041,4.039c-2.232,0-4.041-1.811-4.041-4.041 c0.002-2.232,1.813-4.039,4.041-4.039C43.865,33.541,45.676,35.35,45.672,37.58z" fill="url(#SVGID_14_)"/>
+<radialGradient cx="58.6514" cy="45.2432" gradientTransform="matrix(0.621 1.836735e-004 -1.836735e-004 0.6209 5.2261 12.8455)" gradientUnits="userSpaceOnUse" id="SVGID_15_" r="7.2256">
+<stop offset="0" style="stop-color:#48630C"/>
+<stop offset="0.7879" style="stop-color:#000000"/>
+<stop offset="1" style="stop-color:#000000"/>
+</radialGradient>
+<path d="M45.672,37.58c0,2.232-1.809,4.041-4.041,4.039c-2.232,0-4.041-1.811-4.041-4.041 c0,0,1.385,2.465,4.041,2.465S45.672,37.58,45.672,37.58z" fill="url(#SVGID_15_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_16_" x1="41.6123" x2="41.6123" y1="32.7168" y2="37.5411">
+<stop offset="0" style="stop-color:#F8FBFF"/>
+<stop offset="1" style="stop-color:#808080"/>
+</linearGradient>
+<path d="M41.611,37.518c1.754,0,3.404-0.264,4.863-0.732 c-0.414-2.313-2.432-4.068-4.863-4.068c-2.43,0-4.445,1.756-4.861,4.068C38.207,37.254,39.859,37.518,41.611,37.518z" fill="url(#SVGID_16_)" fill-opacity="0.35" stroke-opacity="0.35"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_17_" x1="32.7676" x2="50.541" y1="51.5801" y2="51.5801">
+<stop offset="0" style="stop-color:#878A8C"/>
+<stop offset="0.2606" style="stop-color:#BDC2C4"/>
+<stop offset="0.6606" style="stop-color:#5B6163"/>
+<stop offset="1" style="stop-color:#959A9C"/>
+</linearGradient>
+<path d="M50.502,52.805c0.025-0.609,0.039-0.486,0.039-0.613v-0.033c0-0.996-0.816-1.803-1.824-1.803H34.592 c-1.008,0-1.824,0.807-1.824,1.803v0.033c0,0.127,0.014,0.004,0.039,0.613H50.502z" fill="url(#SVGID_17_)"/>
+<path d="M32.881,51.557H50.43c-0.08-0.225-0.203-0.426-0.361-0.6H33.242 C33.084,51.131,32.961,51.332,32.881,51.557z" fill="#FFFFFF" fill-opacity="0.2" stroke-opacity="0.2"/>
+<path d="M32.777,52.191c0.008,0.125,0.016,0.309,0.029,0.613h17.695 c0.012-0.305,0.021-0.488,0.027-0.613H32.777z" fill="#020202" fill-opacity="0.2" stroke-opacity="0.2"/>
+<path d="M33.24,50.957h16.826c-0.332-0.367-0.811-0.602-1.35-0.602H34.592 C34.053,50.355,33.574,50.59,33.24,50.957z" fill="#FFFFFF" fill-opacity="0.4" stroke-opacity="0.4"/>
+<rect fill="none" height="60" width="60"/>
+</g>
+<g>
+<rect fill="none" height="30" width="30"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1__" x1="15.0005" x2="15.0005" y1="4.5283" y2="27.0492">
+<stop offset="0" style="stop-color:#FF7042"/>
+<stop offset="1" style="stop-color:#991B23"/>
+</linearGradient>
+<path d="M19.018,16.846v-4.316h4.535l-8.512-8.844l-8.592,8.844h4.631v4.316 c0,7.293,6.068,9.467,11.908,9.467v-6.422C21.189,19.891,19.018,19.002,19.018,16.846z" fill="url(#SVGID_1__)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2__" x1="15.0005" x2="15.0005" y1="4.0146" y2="12.8168">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#991B23"/>
+</linearGradient>
+<polygon fill="url(#SVGID_2__)" points="15.041,4.508 22.762,12.529 23.553,12.529 15.041,3.686 6.449,12.529 7.248,12.529 "/>
+</g>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/themes/icons/hbdefault/scalable/qtg_large_missed_voice_call_unseen.svg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="60" viewBox="0 0 60 60" width="60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<linearGradient gradientTransform="matrix(0.2118 0.9773 -0.9773 0.2118 -634.5609 -270.4865)" gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="423.0967" x2="429.6527" y1="-578.646" y2="-582.908">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.6061" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#991B23"/>
+</linearGradient>
+<path d="M19.081,33.911c2.089-3.597,4.591-6.497,7.281-9.189c2.593-2.591,6.72-5.3,8.562-6.256l9.604-10.282 c-0.845-0.3-3.693-0.464-7.279,0.616c-3.586,1.083-11.736,6.303-16.979,11.547c-5.242,5.246-9.727,12.347-10.581,14.595 c-1.343,3.541-1.221,7.445-0.929,8.581c0,0,0.34,1.034,1.144,2.377C10.248,46.476,19.081,33.911,19.081,33.911z" fill="url(#SVGID_1_)"/>
+<path d="M31.184,20.8c1.488-1.036,2.87-1.882,3.74-2.334L44.271,8.46 c-0.132-0.058-0.209-0.088-0.209-0.088c-0.247-0.088-0.642-0.162-1.124-0.219c-0.793,0.006-1.596,0.093-2.401,0.27 C34.843,9.673,31.019,14.958,31.184,20.8z" fill="#020202" fill-opacity="0.05" stroke-opacity="0.05"/>
+<path d="M31.906,20.306c1.205-0.809,2.291-1.462,3.018-1.84l9.377-10.04 c-0.146-0.063-0.233-0.098-0.233-0.098c-0.231-0.08-0.604-0.152-1.06-0.203c-0.751,0.006-1.51,0.087-2.27,0.253 C35.275,9.576,31.636,14.695,31.906,20.306z" fill="#020202" fill-opacity="0.1" stroke-opacity="0.1"/>
+<path d="M44.079,8.263c-0.21-0.073-0.55-0.137-0.962-0.186c-0.681,0.006-1.369,0.08-2.06,0.231 c-5.087,1.116-8.426,5.984-7.978,11.233c0.725-0.455,1.363-0.826,1.844-1.076l9.424-10.088C44.178,8.302,44.079,8.263,44.079,8.263z " fill="#020202" fill-opacity="0.1" stroke-opacity="0.1"/>
+<radialGradient cx="43.3906" cy="8.9175" gradientUnits="userSpaceOnUse" id="SVGID_2_" r="18.5073">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.6061" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#991B23"/>
+</radialGradient>
+<path d="M34.924,18.466l0.929,1.55c0,0,15.101-6.784,14.084-8.038c-0.513-0.631-0.577-0.656-1.237-1.263 c-1.985-1.815-4.172-2.531-4.172-2.531c-0.186-0.063-0.481-0.12-0.845-0.161c-0.596,0.004-1.2,0.068-1.806,0.201 c-4.591,1.009-7.57,5.501-6.963,10.257C34.916,18.477,34.921,18.47,34.924,18.466z" fill="url(#SVGID_2_)"/>
+<path d="M17.483,34.106c-0.988-0.14-2.007-0.119-3.027,0.105c-2.418,0.53-4.376,2.066-5.646,4.131 c-0.367,2.35-0.25,4.407-0.05,5.18c0,0,0.34,1.034,1.144,2.377c0.29,0.482,6.54-8.264,8.556-11.107L17.483,34.106z" fill="#020202" fill-opacity="0.1" stroke-opacity="0.1"/>
+<path d="M18.366,34.136c-0.989-0.14-2.008-0.118-3.029,0.105c-3.313,0.727-5.775,3.332-6.76,6.623 c-0.026,1.025,0.034,1.872,0.127,2.397c0.003,0.013,0.005,0.034,0.01,0.048c0,0,0.34,1.033,1.144,2.379 c0.3,0.498,6.981-8.888,8.75-11.384L18.366,34.136z" fill="#020202" fill-opacity="0.1" stroke-opacity="0.1"/>
+<radialGradient cx="437.4258" cy="-571.231" gradientTransform="matrix(0.2095 0.9787 -0.9682 0.2124 -629.4526 -270.6148)" gradientUnits="userSpaceOnUse" id="SVGID_3_" r="14.6198">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.6061" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#991B23"/>
+</radialGradient>
+<path d="M11.202,47.738c0.616,0.74,0.646,0.954,1.295,1.524c1.194,1.055,9.301-13.612,9.301-13.612 l-2.683-1.719c-0.941-0.111-1.914-0.079-2.89,0.136c-4.777,1.048-7.806,5.868-6.87,10.832C9.749,45.686,10.349,46.71,11.202,47.738z " fill="url(#SVGID_3_)"/>
+<path d="M49.937,11.978c-0.179-0.22-0.381-0.446-0.578-0.67l-13.944,7.959l0.438,0.749 C35.853,20.016,50.953,13.231,49.937,11.978z" fill="#020202" fill-opacity="0.4" stroke-opacity="0.4"/>
+<linearGradient gradientTransform="matrix(0.2118 0.9773 -0.9773 0.2118 -634.5599 -270.4865)" gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="422.2881" x2="427.4786" y1="-610.9287" y2="-594.4409">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.8121" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#991B23"/>
+</linearGradient>
+<path d="M35.853,20.016l1.178,1.981c0.302,0.515,0.972,0.674,1.569,0.422l4.09-2.334l8.043-4.668 c0.632-0.363,0.878-1.119,0.549-1.686c0,0-0.333-0.501-1.349-1.751L35.853,20.016z" fill="url(#SVGID_4_)"/>
+<path d="M21.798,35.65l-0.725-0.472l-9.215,13.486c0.216,0.204,0.43,0.414,0.639,0.598 C13.691,50.317,21.798,35.65,21.798,35.65z" fill="#020202" fill-opacity="0.4" stroke-opacity="0.4"/>
+<linearGradient gradientTransform="matrix(0.2118 0.9773 -0.9773 0.2118 -634.5599 -270.4865)" gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="439.6982" x2="451.5232" y1="-577.7549" y2="-564.7323">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.8121" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#991B23"/>
+</linearGradient>
+<path d="M12.498,49.262c1.193,1.05,1.686,1.37,1.686,1.37c0.567,0.367,1.363,0.169,1.781-0.442l7.9-11.605 c0.419-0.614,0.307-1.411-0.26-1.777l-1.808-1.156L12.498,49.262z" fill="url(#SVGID_5_)"/>
+<rect fill="none" height="60" width="60"/>
+</g>
+<g>
+<rect fill="none" height="30" width="30"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1__" x1="15.0005" x2="15.0005" y1="4.5283" y2="27.0492">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#991B23"/>
+</linearGradient>
+<path d="M19.018,16.846v-4.316h4.535l-8.512-8.844l-8.592,8.844h4.631v4.316 c0,7.293,6.068,9.467,11.908,9.467v-6.422C21.189,19.891,19.018,19.002,19.018,16.846z" fill="url(#SVGID_1__)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2__" x1="15.0005" x2="15.0005" y1="4.0146" y2="12.8168">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#991B23"/>
+</linearGradient>
+<polygon fill="url(#SVGID_2__)" points="15.041,4.508 22.762,12.529 23.553,12.529 15.041,3.686 6.449,12.529 7.248,12.529 "/>
+</g>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/themes/icons/hbdefault/scalable/qtg_large_missed_voip_call_unseen.svg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="60" viewBox="0 0 60 60" width="60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<rect fill="none" height="60" width="60"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="31.3823" x2="31.3823" y1="49.3193" y2="6.7675">
+<stop offset="0" style="stop-color:#004E8C"/>
+<stop offset="1" style="stop-color:#1B66D8"/>
+</linearGradient>
+<circle cx="31.382" cy="28.137" fill="url(#SVGID_1_)" r="21.429"/>
+<radialGradient cx="23.8237" cy="17.7847" gradientTransform="matrix(0.9953 0 0 0.9952 7.3664 3.0238)" gradientUnits="userSpaceOnUse" id="SVGID_2_" r="25.9191">
+<stop offset="0" style="stop-color:#94FFFF"/>
+<stop offset="0.5" style="stop-color:#36B5FF"/>
+<stop offset="1" style="stop-color:#1B66D8"/>
+</radialGradient>
+<path d="M52.262,28.137c0,11.533-9.346,20.877-20.879,20.877c-11.533,0-20.882-9.344-20.882-20.877 c0-11.53,9.35-20.88,20.882-20.88C42.917,7.257,52.262,16.607,52.262,28.137z" fill="url(#SVGID_2_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="31.3823" x2="31.3823" y1="7.0732" y2="49.1199">
+<stop offset="0" style="stop-color:#31A7F8"/>
+<stop offset="0.497" style="stop-color:#1E74DC"/>
+<stop offset="1" style="stop-color:#88D6EB"/>
+</linearGradient>
+<path d="M31.383,7.257c-11.533,0-20.882,9.35-20.882,20.88c0,11.533,9.35,20.877,20.882,20.877 c11.533,0,20.879-9.344,20.879-20.877C52.262,16.607,42.917,7.257,31.383,7.257z M31.383,47.188 c-10.843,0-19.664-8.818-19.664-19.659c0-10.843,8.82-19.663,19.664-19.663c10.841,0,19.66,8.82,19.66,19.663 C51.043,38.369,42.224,47.188,31.383,47.188z" fill="url(#SVGID_3_)" fill-opacity="0.3" stroke-opacity="0.3"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="10.8428" x2="14.1621" y1="30.9775" y2="30.9775">
+<stop offset="0" style="stop-color:#58595B"/>
+<stop offset="1" style="stop-color:#000000"/>
+</linearGradient>
+<path d="M12.462,27.796C12.239,27.5,11.737,27.5,11.516,27.5c-0.437,0-0.669,0.312-0.673,0.616 v0.021l0.001,0.031c-0.001,0.537,0.029,1.14,0.094,1.872c0.013,0.138,0.03,0.276,0.047,0.414l0.024,0.201 c0.056,0.434,0.121,0.86,0.195,1.274l0.034,0.182c0.032,0.164,0.063,0.324,0.098,0.484c0.089,0.406,0.198,0.826,0.332,1.291 c0.02,0.066,0.037,0.133,0.055,0.199c0.028,0.109,0.058,0.217,0.091,0.322l0.005,0.014l0.012,0.033 c-0.003-0.01-0.008-0.023-0.01-0.037l1.198-0.08c0.019-0.188,0.024-0.383,0.019-0.576c-0.01-0.303-0.021-0.676-0.107-0.99 l1.112-1.494l0.12-0.162v-0.203v-1.165v-0.252l-0.179-0.178L12.462,27.796z" fill="url(#SVGID_4_)" fill-opacity="0.3" stroke-opacity="0.3"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="17.2432" x2="51.9731" y1="24.897" y2="24.897">
+<stop offset="0" style="stop-color:#58595B"/>
+<stop offset="1" style="stop-color:#000000"/>
+</linearGradient>
+<path d="M51.966,24.045c-0.016-0.079-0.029-0.136-0.043-0.191 c-0.011-0.042-0.021-0.084-0.029-0.125c-0.106-0.495-0.237-1.005-0.392-1.525l-0.017-0.058c-0.033-0.117-0.068-0.234-0.105-0.349 c-0.188-0.588-0.393-1.148-0.608-1.666c-0.027-0.066-0.056-0.125-0.084-0.188l-0.045-0.1c-0.206-0.474-0.436-0.947-0.677-1.403 l-0.03-0.059c-0.047-0.09-0.093-0.181-0.142-0.269c-0.295-0.532-0.604-1.041-0.918-1.512c-0.032-0.049-0.069-0.102-0.106-0.154 c-0.023-0.031-0.045-0.061-0.066-0.092c-0.302-0.437-0.618-0.862-0.946-1.268l-0.064-0.082c-0.044-0.055-0.088-0.111-0.134-0.167 c-0.381-0.456-0.783-0.898-1.199-1.317c-0.056-0.056-0.115-0.115-0.176-0.172l-0.049-0.047c-0.375-0.368-0.774-0.732-1.183-1.074 l-0.081-0.069c-0.041-0.037-0.083-0.073-0.125-0.106c-0.446-0.367-0.931-0.728-1.435-1.075c-0.063-0.042-0.126-0.083-0.19-0.124 l-0.077-0.05c-0.454-0.301-0.928-0.59-1.404-0.853l-0.072-0.042c-0.04-0.023-0.079-0.045-0.119-0.068 c-0.529-0.283-1.081-0.55-1.643-0.792l-0.142-0.057l-0.153-0.063c-0.148-0.061-0.297-0.114-0.443-0.165 c-0.077-0.026-0.152-0.053-0.228-0.08l-0.282-0.105L38.303,8.74c-0.17,0.107-0.84,0.49-1.235,0.715 c-0.438-0.059-1.499-0.192-2.57-0.295c0.33-0.032,0.787-0.069,1.43-0.111l0.09-1.204L35.97,7.832 c-0.039-0.011-0.077-0.021-0.116-0.029l-0.092-0.018l-0.075-0.015c-0.655-0.131-1.271-0.227-1.882-0.291l-0.004-0.001l-0.085-0.009 c-0.698-0.07-1.409-0.106-2.112-0.106c-0.62,0-1.262,0.033-1.964,0.101c-0.109,0.01-0.214,0.021-0.321,0.032 c-0.693,0.078-1.3,0.17-1.873,0.286l-0.02,0.003l-0.015,0.002c-0.604,0.125-1.211,0.281-1.856,0.477 c-0.058,0.018-0.116,0.037-0.173,0.055l-0.131,0.043c-0.547,0.176-1.082,0.371-1.596,0.582c-0.042,0.018-0.071,0.029-0.1,0.04 l-0.078,0.031c-0.564,0.24-1.128,0.512-1.688,0.812c-0.06,0.031-0.118,0.066-0.177,0.099L21.542,9.97 c-0.157,0.087-0.315,0.185-0.473,0.283l-0.203,0.127l-1.118,0.684l1.242,0.415c0.186,0.063,0.385,0.093,0.592,0.093 c0.67,0,1.317-0.329,1.838-0.593c0.209-0.105,0.521-0.264,0.648-0.288c0.152,0.045,0.306,0.068,0.458,0.068 c0.569,0,1.035-0.306,1.446-0.578l0.111-0.072c0.134-0.043,0.362-0.128,0.818-0.299c0.465-0.174,1.314-0.493,1.54-0.546 c0.44-0.005,0.966-0.068,1.339-0.3c0.352,0.058,0.977,0.157,1.619,0.24c-0.047,0.029-0.093,0.059-0.132,0.097 c-0.209,0.192-1.335,0.533-1.68,0.578c-0.647,0.081-0.908,0.408-1.012,0.666c-0.135,0.336-0.054,0.672,0.078,0.946 c-0.245,0.162-0.545,0.342-0.804,0.479c0.001-0.006,0.003-0.012,0.004-0.02c0.093-0.517,0.16-0.89-0.091-1.189 c-0.128-0.153-0.317-0.241-0.519-0.241c-0.295,0-0.525,0.183-0.711,0.362c-0.52,0.502-0.834,1.129-0.952,1.365l-0.022,0.044 l-0.019,0.035c-0.225,0.431-0.317,0.737-0.192,1.688c-0.055,0.04-0.219,0.102-0.445,0.102c-0.03,0-0.058-0.002-0.079-0.003 c-0.146-0.158-0.349-0.248-0.576-0.248l0,0c-0.524,0-1.238,0.589-2.123,1.754l-0.284,0.374l0.289,0.371l0.27,0.343 c-4.216,3.259-4.248,3.444-4.292,3.717c-0.007,0.024-0.044,0.137-0.095,0.293c-0.628,1.952-0.977,3.413-0.637,4.194 c0.784,1.813,1.669,3.505,2.815,3.599c0.101,0.008,0.212,0.012,0.332,0.012c1.051,0,2.753-0.318,3.572-0.485 c0.151,0.283,0.335,0.614,0.438,0.795l0.181,0.323l0.37-0.012c0.004,0,0.199-0.006,0.448-0.006c0.286,0,0.478,0.008,0.602,0.017 c0.446,1.307,1.3,4.317,1.142,4.944L27.272,34.1c-1.441,2.16,0.306,4.975,1.145,6.328c0.066,0.107,0.126,0.203,0.177,0.287 c0.324,0.922,0.716,1.531,1.545,1.531c0.062,0,0.124-0.004,0.188-0.008c0.047-0.002,0.096-0.004,0.146-0.004 c0.092,0,0.157,0.01,0.226,0.035l0.075,0.027l0.08,0.006c0.155,0.014,0.306,0.035,0.453,0.057c0.255,0.035,0.519,0.07,0.788,0.07 c0.721,0,1.293-0.271,1.787-0.855c0.019-0.002,0.036-0.004,0.055-0.006c0.518-0.072,0.712-0.332,0.778-0.564 c0.038-0.039,0.089-0.086,0.131-0.125c0.204-0.188,0.447-0.41,0.615-0.674c0.075-0.045,0.161-0.096,0.258-0.152 c0.167-0.104,0.355-0.217,0.504-0.293c0.131-0.041,0.247-0.117,0.334-0.225c0.209-0.258,0.166-0.549,0.131-0.783 c-0.035-0.242-0.071-0.492,0.06-0.758c0.738-0.355,2.051-1.23,2.263-1.375l-0.001,0.018c-0.014,0.117-0.048,0.43-0.1,0.629 c-0.279,0.279-0.513,0.703-0.586,0.846l-0.049,0.094l-0.015,0.104c-0.019,0.137-0.094,0.85,0.306,1.311 c0.202,0.23,0.49,0.359,0.813,0.359c0.103,0,0.21-0.014,0.319-0.039c1.027-0.232,2.85-2.703,2.998-4.066 c0.072-0.656-0.185-1.172-0.704-1.416l-0.387-0.184l-0.304,0.303l-1.125,1.125c-0.38,0.035-0.678,0.148-0.879,0.326 c0.012-0.48-0.035-0.973-0.086-1.451c-0.155-1.447-0.185-2.369,0.703-2.996l0.045-0.033l0.038-0.039 c0.321-0.326,0.676-0.611,1.052-0.914c0.88-0.707,1.79-1.438,2.332-2.759l0.022-0.056c0.174-0.451,0.437-1.132,0.081-1.651 c-0.089-0.128-0.275-0.327-0.624-0.397c0.462-0.186,0.816-0.332,0.851-0.346l0.107-0.044l0.083-0.08l1.898-1.822l0.278-0.268 l-0.122-0.366c-0.017-0.047-0.12-0.335-0.411-0.747c0.554,0.075,1.029,0.208,1.185,0.326c0.057,0.124,0.171,0.396,0.292,0.683 c2.089,4.924,2.382,5.178,2.926,5.187c0.021,0,0.037,0.002,0.051,0.003c0.044,0.003,0.083,0.005,0.119,0.005 c0.31,0,0.486-0.157,0.564-0.252c0.227-0.274,0.163-0.608,0.14-0.734l-0.009-0.043c-0.025-0.294-0.008-1.618,0.034-2.706 c0.003,0.002,0.004,0.006,0.006,0.01l1.12-0.445L51.966,24.045z M35.508,18.021c-0.087,0.003-0.181,0.008-0.282,0.012 c-0.322,0.015-0.688,0.031-1.053,0.031c-0.955,0-1.174-0.118-1.196-0.131c-0.113-0.082-0.229-0.144-0.35-0.188 c0.216-0.048,0.464-0.214,0.719-0.708c0.251,0.487,0.592,0.917,1.115,0.917c0.142,0,0.277-0.034,0.406-0.101 C35.043,17.856,35.333,17.957,35.508,18.021z M35.133,15.357c-0.072,0-0.131-0.003-0.176-0.007c0.049-0.128,0.107-0.202,0.154-0.244 c0.06,0.093,0.14,0.175,0.232,0.245C35.27,15.355,35.2,15.357,35.133,15.357z M31.331,16.635c0.327,0.641,0.569,0.917,0.762,1.037 c-0.475,0.038-0.833,0.339-1.126,0.625c-0.206-0.068-0.565-0.286-0.672-0.438c-0.063-0.089-0.138-0.166-0.221-0.232 C30.593,17.479,31.049,16.998,31.331,16.635z M29.523,16.163l-0.679-0.033l-2.278-0.111c0.278-0.229,0.541-0.444,0.697-0.57 c0.042-0.015,0.205-0.06,0.605-0.06c0.242,0,0.474,0.017,0.62,0.029L29.523,16.163z" fill="url(#SVGID_5_)" fill-opacity="0.3" stroke-opacity="0.3"/>
+<radialGradient cx="24.4912" cy="10.4414" gradientTransform="matrix(0.9953 0 0 0.9952 7.3664 3.0238)" gradientUnits="userSpaceOnUse" id="SVGID_6_" r="23.6744">
+<stop offset="0" style="stop-color:#7AF200"/>
+<stop offset="0.3152" style="stop-color:#7AF200"/>
+<stop offset="0.7273" style="stop-color:#1CAD0F"/>
+<stop offset="1" style="stop-color:#007A3A"/>
+</radialGradient>
+<path d="M11.451,28.125C11.451,28.125,11.451,28.125,11.451,28.125c0,0.008,0.001,0.012,0.001,0.018 c0,0.622,0.039,1.236,0.093,1.844c0.018,0.198,0.047,0.398,0.069,0.598c0.053,0.417,0.116,0.83,0.19,1.238 c0.042,0.215,0.081,0.434,0.127,0.646c0.094,0.422,0.203,0.838,0.321,1.248c0.05,0.17,0.089,0.342,0.141,0.508 c0.007,0.018,0.015,0.033,0.019,0.051c0.017-0.16,0.021-0.326,0.017-0.496c-0.04-1.199-0.232-1.045-0.232-1.045l1.356-1.822v-1.165 l-1.589-1.589C11.964,28.159,11.452,28.079,11.451,28.125z" fill="url(#SVGID_6_)"/>
+<radialGradient cx="24.4868" cy="10.4395" gradientTransform="matrix(0.9953 0 0 0.9952 7.3664 3.0238)" gradientUnits="userSpaceOnUse" id="SVGID_7_" r="23.6775">
+<stop offset="0" style="stop-color:#7AF200"/>
+<stop offset="0.3152" style="stop-color:#7AF200"/>
+<stop offset="0.7273" style="stop-color:#1CAD0F"/>
+<stop offset="1" style="stop-color:#007A3A"/>
+</radialGradient>
+<path d="M24.212,10.099c0.587,0.193,1.066-0.2,1.613-0.549c0.193-0.04,2.338-0.896,2.57-0.896 c0.231,0,1.011-0.03,1.204-0.34c0,0,3.357,0.584,3.863,0.389c0.275-0.107,1.433-0.2,2.425-0.264 c-0.056-0.012-0.106-0.029-0.162-0.041c-0.054-0.011-0.105-0.019-0.161-0.03c-0.623-0.126-1.252-0.226-1.894-0.29 c-0.006,0-0.01,0-0.016-0.002c-0.674-0.068-1.358-0.104-2.052-0.104c-0.644,0-1.277,0.038-1.906,0.098 c-0.11,0.011-0.221,0.022-0.331,0.035c-0.608,0.067-1.211,0.155-1.801,0.274c-0.01,0.003-0.021,0.004-0.031,0.006 c-0.612,0.127-1.213,0.283-1.802,0.464c-0.102,0.03-0.199,0.064-0.302,0.096c-0.522,0.168-1.038,0.356-1.544,0.564 c-0.06,0.026-0.12,0.048-0.18,0.072c-0.557,0.238-1.1,0.501-1.63,0.784c-0.08,0.043-0.156,0.089-0.234,0.134 c-0.227,0.125-0.44,0.267-0.66,0.402C22.273,11.265,23.635,9.904,24.212,10.099z" fill="url(#SVGID_7_)"/>
+<radialGradient cx="24.4863" cy="10.437" gradientTransform="matrix(0.9953 0 0 0.9952 7.3664 3.0238)" gradientUnits="userSpaceOnUse" id="SVGID_8_" r="23.6745">
+<stop offset="0" style="stop-color:#B2F56E"/>
+<stop offset="0.3152" style="stop-color:#B2F56E"/>
+<stop offset="0.7273" style="stop-color:#5CBF1B"/>
+<stop offset="1" style="stop-color:#227A00"/>
+</radialGradient>
+<path d="M51.366,24.146c-0.021-0.102-0.049-0.197-0.069-0.297c-0.106-0.499-0.233-0.99-0.378-1.474 c-0.038-0.13-0.076-0.264-0.118-0.395c-0.176-0.549-0.371-1.09-0.59-1.616c-0.04-0.093-0.085-0.184-0.125-0.275 c-0.202-0.464-0.421-0.918-0.657-1.363c-0.056-0.106-0.109-0.215-0.166-0.319c-0.279-0.502-0.575-0.993-0.893-1.469 c-0.054-0.083-0.114-0.161-0.17-0.243c-0.291-0.422-0.596-0.831-0.916-1.228c-0.064-0.079-0.127-0.16-0.194-0.24 c-0.368-0.442-0.756-0.868-1.161-1.277c-0.069-0.07-0.143-0.14-0.215-0.208c-0.369-0.363-0.755-0.714-1.153-1.047 c-0.067-0.056-0.131-0.116-0.198-0.171c-0.448-0.366-0.915-0.714-1.395-1.043c-0.084-0.057-0.17-0.112-0.256-0.167 c-0.442-0.294-0.898-0.571-1.366-0.83c-0.063-0.035-0.123-0.073-0.187-0.108c-0.52-0.278-1.05-0.533-1.594-0.768 c-0.097-0.041-0.194-0.079-0.29-0.12c-0.211-0.087-0.432-0.156-0.646-0.235c-0.255,0.163-1.438,0.832-1.438,0.832 s-5.141-0.702-5.491-0.353c-0.352,0.353-1.721,0.71-2.033,0.751c-0.311,0.04-0.956,0.206-0.182,1.161 c-0.116,0.118-2.325,1.657-2.325,0.957s0.494-1.953-0.2-1.282c-0.498,0.482-0.796,1.135-0.86,1.257 c-0.163,0.312-0.263,0.461-0.145,1.357s-1.43,0.891-1.534,0.659c-0.276-0.622-1.809,1.394-1.809,1.394l0.646,0.828 c0,0-4.51,3.474-4.548,3.707c-0.04,0.234-1.164,3.25-0.775,4.147c0.39,0.897,1.376,3.158,2.307,3.233 c1.222,0.101,4.186-0.559,4.186-0.559c0.08,0.196,0.638,1.189,0.638,1.189s1.453-0.048,1.534,0.11 c0.026,0.053,1.75,5.122,1.182,5.794c-1.357,2.033,0.775,5.012,1.369,6.02c0.594,1.73,0.977,0.955,1.758,1.238 c0.962,0.084,1.772,0.439,2.589-0.611c0.237-0.195,0.641-0.041,0.641-0.313c0-0.152,0.698-0.598,0.878-1.018 c0.188-0.088,0.674-0.414,1.003-0.572c0.299-0.02-0.283-0.82,0.309-1.666c0.64-0.252,2.364-1.414,2.364-1.414 c0.078-1.705-0.839-3.811,0.873-5.02c1.104-1.126,2.553-1.767,3.255-3.479c0.194-0.506,0.628-1.542-0.619-1.231 c-1.173,0.295-2.48,0.362-1.861-0.154c-0.071-0.634-0.85-0.932-1.55-1.552c-0.361-0.854-0.93-2.378-0.93-2.378l-1.24-1.885 l0.155-0.389l1.474,2.171l1.474,1.781c0.542,1.783,1.007,1.939,1.007,1.939c0.815-0.288,2.753-1.086,2.753-1.086l1.898-1.822 c0,0-0.195-0.581-0.967-1.316l-0.584-0.349c-0.126,0.357-0.802,0.491-0.802,0.491l-1.641-1.964l0.61-0.123l0.471,0.896l1.128,0.39 c0,0,0.313-0.229,0.893,0.371c0.473-0.039,2.318,0.09,2.749,0.636c0.085,0.109,2.287,5.607,2.721,5.614 c0.19,0.002,0.329,0.077,0.267-0.256c-0.078-0.156,0-3.609,0.116-4.349c0.295-0.628,0.343-0.003,1.04,1.188 C51.374,24.204,51.372,24.175,51.366,24.146z M31.993,10.823c0.154-0.459,1.047-0.615,1.047-0.615s-0.256,0.473-0.197,0.716 c0.06,0.247-0.407,0.402-0.46,0.982c-0.051,0.578-1.117,0.239-1.204,0.036C31.09,11.74,31.835,11.281,31.993,10.823z M35.816,18.624 c-0.661,0-2.645,0.196-3.19-0.194c-0.546-0.389-0.97,0.04-1.362,0.43c-0.258,0.253-1.193-0.26-1.468-0.649 c-0.271-0.39-1.188-0.361-1.188-0.361l0.208-1.111l-2.637-0.128l-1.499,0.439l-1.41,0.041l0.79-0.376l0.983-0.232 c0,0,1.431-1.176,1.859-1.526c0.363-0.297,1.811-0.129,1.811-0.129l1.589,1.146c0,0-0.353,0.898-0.508,1.091 c0.583-0.039,1.269-1.099,1.269-1.099c-1.239-1.138-1.188-1.524-1.188-1.524l1.633,1.146l0.016,0.01c0,0,0.661,1.558,0.937,1.558 c0.271,0,0.619-1.073,0.619-1.073l0.465-0.117c0.207,0.492,0.595,1.603,1.059,1.343c0.269-0.147,0.71-0.013,1.215,0.181 c0.509,0.195,0.854-0.104,1.267,0.258C37.03,19.349,36.089,18.702,35.816,18.624z M36.853,15.943 c-0.681-0.259-2.984,0.586-2.47-0.796c0.275-0.746,0.981-0.901,1.223-0.405c0.063,0.204,0.83,0.519,0.824,0.09 c-0.006-0.431,0.771-0.659,0.883-0.338C36.899,14.791,38.932,16.341,36.853,15.943z M41.192,17.252 c-0.377-0.304,0.169-0.564-0.387-1.041c-0.798-0.684-1.421-0.978-0.334-1.532c1.341-0.168,0.218,0.428,0.44,0.786 c0.119,0.19,0.796,0.828,1.325,1.61C42.676,17.725,41.567,17.555,41.192,17.252z" fill="url(#SVGID_8_)"/>
+<radialGradient cx="24.4839" cy="10.4453" gradientTransform="matrix(0.9953 0 0 0.9952 7.3664 3.0238)" gradientUnits="userSpaceOnUse" id="SVGID_9_" r="23.6688">
+<stop offset="0" style="stop-color:#7AF200"/>
+<stop offset="0.3152" style="stop-color:#7AF200"/>
+<stop offset="0.7273" style="stop-color:#1CAD0F"/>
+<stop offset="1" style="stop-color:#007A3A"/>
+</radialGradient>
+<path d="M41.733,35.008l-1.293,1.291c0,0-0.778,0-0.815,0.313c-0.017,0.133-0.063,0.709-0.192,1.006 c-0.258,0.18-0.569,0.775-0.569,0.775s-0.158,1.15,0.699,0.953C40.42,39.152,43.059,35.633,41.733,35.008z" fill="url(#SVGID_9_)"/>
+<path d="M31.68,48.668c1.546,0,3.049-0.174,4.499-0.49c-0.039-0.049-0.071-0.1-0.114-0.145 l-7.534-7.756c-0.434-0.447-1.031-0.705-1.638-0.705c-0.57,0-1.102,0.221-1.5,0.625l-1.144,1.18l-0.472,0.477l-0.436,0.447 c-1.654-1.605-3.133-3.443-4.739-5.873c-0.888-1.348-1.653-2.988-2.138-4.123l-0.178-0.424c-0.001,0-0.242-0.598-0.324-0.811 l-0.027-0.068c-0.067-0.176-0.127-0.341-0.184-0.5l-0.025-0.069l1.843-0.641c1.017-0.344,1.593-1.403,1.363-2.555l-0.007-0.036 l-1.154-3.523l-2.274-6.787c-0.162-0.486-0.47-0.886-0.858-1.16c-2.416,3.407-3.841,7.565-3.841,12.059 C10.797,39.322,20.147,48.668,31.68,48.668z" fill="#020202" fill-opacity="0.1" stroke-opacity="0.1"/>
+<path d="M31.68,48.668c1.301,0,2.57-0.125,3.806-0.352l-7.394-7.613c-0.32-0.33-0.758-0.52-1.199-0.52 c-0.404,0-0.779,0.156-1.061,0.441l-1.148,1.182l-0.467,0.473l-0.424,0.436l0.003,0.004l-0.435,0.445 c-1.866-1.736-3.509-3.734-5.269-6.4c-0.91-1.381-1.694-3.059-2.192-4.221l-0.158-0.375l-0.024-0.059c0,0-0.243-0.602-0.327-0.816 l-0.029-0.072c-0.068-0.18-0.129-0.347-0.19-0.513c0,0-0.12-0.337-0.145-0.41l0.071-0.295l2.272-0.791 c0.721-0.244,1.127-1.009,0.966-1.819l-0.007-0.036l-1.142-3.485l-2.274-6.789c-0.119-0.357-0.343-0.65-0.626-0.851 c-2.204,3.31-3.492,7.283-3.492,11.557C10.797,39.322,20.147,48.668,31.68,48.668z" fill="#020202" fill-opacity="0.2" stroke-opacity="0.2"/>
+<radialGradient cx="-859.7427" cy="-265.1074" gradientTransform="matrix(0.9999 -0.0111 0.0111 0.9999 905.1068 277.0371)" gradientUnits="userSpaceOnUse" id="SVGID_10_" r="34.2211">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.8364" style="stop-color:#FFBE82"/>
+<stop offset="0.8909" style="stop-color:#FFBE82"/>
+<stop offset="0.9515" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#FFBE82"/>
+</radialGradient>
+<path d="M23.387,44.016c-2.39-2.133-4.191-4.469-5.806-6.914c-1.552-2.357-2.958-5.889-3.393-7.428 l-6.272-8.836c-0.357,0.592-0.921,2.715-0.661,5.588c0.262,2.872,2.939,9.828,6.083,14.596c3.146,4.766,7.81,9.248,9.374,10.24 c2.462,1.561,5.427,2.074,6.329,2.029c0,0,0.833-0.098,1.97-0.496C31.5,52.625,23.387,44.016,23.387,44.016z" fill="url(#SVGID_10_)"/>
+<path d="M15.369,32.857c-0.55-1.283-0.976-2.456-1.18-3.184l-6.104-8.599c-0.064,0.09-0.099,0.144-0.099,0.144 c-0.104,0.172-0.22,0.458-0.338,0.813c-0.118,0.599-0.177,1.219-0.167,1.854C7.541,28.374,10.936,32.078,15.369,32.857z" fill-opacity="0.05" stroke-opacity="0.05"/>
+<path d="M15.108,32.234c-0.423-1.033-0.749-1.953-0.919-2.561l-6.125-8.627c-0.069,0.101-0.109,0.161-0.109,0.161 c-0.097,0.162-0.208,0.434-0.318,0.769c-0.111,0.567-0.168,1.151-0.159,1.751C7.536,28.033,10.834,31.572,15.108,32.234z" fill-opacity="0.05" stroke-opacity="0.05"/>
+<path d="M7.907,21.188c-0.088,0.148-0.188,0.394-0.289,0.698c-0.102,0.514-0.152,1.046-0.144,1.59 c0.054,4.01,3.21,7.283,7.24,7.757c-0.232-0.618-0.412-1.157-0.526-1.559l-6.154-8.67C7.951,21.121,7.907,21.188,7.907,21.188z" fill-opacity="0.1" stroke-opacity="0.1"/>
+<radialGradient cx="-891.105" cy="-262.4795" gradientTransform="matrix(1.0009 -0.0086 0.0135 0.9911 906.6143 271.6763)" gradientUnits="userSpaceOnUse" id="SVGID_11_" r="11.8382">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.0424" style="stop-color:#FFBE82"/>
+<stop offset="0.4" style="stop-color:#FFBE82"/>
+<stop offset="0.7333" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#FFBE82"/>
+</radialGradient>
+<path d="M14.188,29.674l1.312-0.461c0,0-2.781-12.441-3.885-11.868c-0.555,0.29-0.549,0.448-1.11,0.853 c-1.676,1.219-2.589,2.641-2.589,2.641c-0.077,0.13-0.165,0.345-0.252,0.613c-0.088,0.45-0.134,0.916-0.128,1.392 c0.05,3.62,2.979,6.563,6.661,6.841C14.194,29.681,14.189,29.677,14.188,29.674z" fill="url(#SVGID_11_)"/>
+<path d="M23.289,45.25c-0.259,0.727-0.4,1.498-0.39,2.303c0.025,1.906,0.882,3.621,2.242,4.898 c1.716,0.641,3.287,0.871,3.9,0.84c0,0,0.833-0.098,1.97-0.496c0.409-0.143-5.222-6.213-7.055-8.172L23.289,45.25z" fill-opacity="0.05" stroke-opacity="0.05"/>
+<path d="M23.448,44.59c-0.261,0.725-0.401,1.496-0.391,2.301c0.036,2.613,1.621,4.875,3.95,6.125 c0.771,0.18,1.418,0.264,1.829,0.275c0.011,0,0.026,0.002,0.037,0c0,0,0.832-0.096,1.972-0.494c0.422-0.148-5.624-6.641-7.233-8.363 L23.448,44.59z" fill-opacity="0.1" stroke-opacity="0.1"/>
+<radialGradient cx="-877.4263" cy="-238.3691" gradientTransform="matrix(1.0009 -0.0086 0.0135 0.9911 906.6143 271.6763)" gradientUnits="userSpaceOnUse" id="SVGID_12_" r="12.0474">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.0424" style="stop-color:#FFBE82"/>
+<stop offset="0.4" style="stop-color:#FFBE82"/>
+<stop offset="0.7333" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#FFBE82"/>
+</radialGradient>
+<path d="M32.6,52.1c0.653-0.35,0.819-0.34,1.351-0.74c0.98-0.74-8.83-9.123-8.83-9.123l-1.712,1.756 c-0.229,0.695-0.355,1.434-0.345,2.203c0.051,3.766,3.219,6.797,7.107,6.857C30.828,52.877,31.693,52.584,32.6,52.1z" fill="url(#SVGID_12_)"/>
+<path d="M14.866,29.428l0.634-0.215c0,0-2.781-12.441-3.885-11.868 c-0.291,0.151-0.427,0.268-0.573,0.401L14.866,29.428z" fill="#020202" fill-opacity="0.1" stroke-opacity="0.1"/>
+<linearGradient gradientTransform="matrix(0.9999 -0.0111 0.0111 0.9999 905.1068 277.0361)" gradientUnits="userSpaceOnUse" id="SVGID_13_" x1="-889.625" x2="-885.2537" y1="-270.9771" y2="-257.0911">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.0424" style="stop-color:#FFBE82"/>
+<stop offset="0.4" style="stop-color:#FFBE82"/>
+<stop offset="0.7333" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#FFBE82"/>
+</linearGradient>
+<path d="M15.5,29.214l1.677-0.583c0.435-0.147,0.659-0.629,0.562-1.119l-1.129-3.446l-2.275-6.79 c-0.177-0.533-0.71-0.836-1.188-0.676c0,0-0.429,0.175-1.529,0.747L15.5,29.214z" fill="url(#SVGID_13_)"/>
+<path d="M25.121,42.236l-0.468,0.473l8.748,9.039c0.188-0.131,0.379-0.26,0.55-0.389 C34.931,50.619,25.121,42.236,25.121,42.236z" fill="#020202" fill-opacity="0.1" stroke-opacity="0.1"/>
+<linearGradient gradientTransform="matrix(0.9999 -0.0111 0.0111 0.9999 905.1068 277.0366)" gradientUnits="userSpaceOnUse" id="SVGID_14_" x1="-876.2178" x2="-867.1104" y1="-245.4277" y2="-235.398">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="0.0424" style="stop-color:#FFBE82"/>
+<stop offset="0.4" style="stop-color:#FFBE82"/>
+<stop offset="0.7333" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#FFBE82"/>
+</linearGradient>
+<path d="M33.95,51.357c0.978-0.738,1.295-1.059,1.295-1.059c0.364-0.373,0.338-1.002-0.059-1.412 l-7.534-7.756c-0.397-0.412-1.016-0.451-1.38-0.08l-1.151,1.186L33.95,51.357z" fill="url(#SVGID_14_)"/>
+</g>
+<g>
+<rect fill="none" height="30" width="30"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1__" x1="15.0005" x2="15.0005" y1="4.5283" y2="27.0492">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#991B23"/>
+</linearGradient>
+<path d="M19.018,16.846v-4.316h4.535l-8.512-8.844l-8.592,8.844h4.631v4.316 c0,7.293,6.068,9.467,11.908,9.467v-6.422C21.189,19.891,19.018,19.002,19.018,16.846z" fill="url(#SVGID_1__)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2__" x1="15.0005" x2="15.0005" y1="4.0146" y2="12.8168">
+<stop offset="0" style="stop-color:#FFBE82"/>
+<stop offset="1" style="stop-color:#991B23"/>
+</linearGradient>
+<polygon fill="url(#SVGID_2__)" points="15.041,4.508 22.762,12.529 23.553,12.529 15.041,3.686 6.449,12.529 7.248,12.529 "/>
+</g>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/at_logsengine/at_logsengine.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,51 @@
+#
+# 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 = app
+TARGET =
+
+QT += testlib xml
+CONFIG += qtestlib
+CONFIG += hb
+
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += /orbit/include # This must be included after the HB stubs
+INCLUDEPATH += /epoc32/include
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+INCLUDEPATH += /epoc32/include/ecom
+INCLUDEPATH += ../../../tsrc/qtestutils/inc
+
+# Input
+HEADERS += inc/at_logsengine.h
+
+SOURCES += src/main.cpp
+SOURCES += src/at_logsengine.cpp
+SOURCES += ../../../tsrc/qtestutils/src/testresultxmlparser.cpp
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xEfa559b2
+ TARGET.CAPABILITY = ALL -TCB
+ TARGET.EPOCALLOWDLLDATA = 1
+ LIBS += -llogsengine
+}
+
+BLD_INF_RULES.prj_mmpfiles = "../../../tsrc/logdbmodifier/addeventtest/group/logclienttest.mmp"\
+ "../../../tsrc/logdbmodifier/clearlisttest/group/clearlisttest.mmp"
+
+BLD_INF_RULES.prj_exports += "../../../tsrc/logdbmodifier/addeventtest/data/testlogclients.dat /epoc32/winscw/c/system/testlogclients.dat"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/at_logsengine/inc/at_logsengine.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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 AT_LOGSENGINE_H
+#define AT_LOGSENGINE_H
+
+#include <QObject>
+#include <e32base.h>
+
+class LogsModel;
+class LogsCustomFilter;
+
+class AT_LogsEngine : 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 testAllEvents();
+ void testFilteredEvents();
+ void testHomeScreenUsecase();
+ void testMarkEventsSeen();
+ void testClearEvents();
+private:
+ void clearEventsL();
+ void writeEventsL();
+ void executeL(const TDesC& exeName, const TDesC& commandLine);
+
+private:
+
+ LogsModel* mModel;
+
+};
+
+
+#endif //AT_LOGSENGINE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/at_logsengine/src/at_logsengine.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,223 @@
+/*
+* 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 "at_logsengine.h"
+#include <logsmodel.h>
+#include <logsevent.h>
+#include <logsfilter.h>
+#include <logscustomfilter.h>
+#include <apacmdln.h>
+#include <apgtask.h>
+#include <apgcli.h>
+#include <hbicon.h>
+
+#include <QtTest/QtTest>
+
+_LIT( KLogTestEvents, "at_logsengine" );
+_LIT( KLogTestClientWriter, "logclienttest.exe" );
+_LIT( KLogTestClientClearer, "clearlisttest.exe" );
+
+const int logsTestAllEventsCount = 20;
+const int logsTestMissedCallsCount = 10;
+const int logsTestOtherThanMissedEventsCount = 10;
+const int logsTestContact2EventsCount = 2;
+const int logsTestContact3EventsCount = 3;
+
+// Note, events are written from .dat file in order where last event is going to
+// be first event at db
+const QString logsTestAllEvent1Name = "deeppu";
+const LogsEvent::LogsDirection logsTestAllEvent1Dir = LogsEvent::DirIn;
+
+const QString logsTestContact2Event2Name = "Jeppis";
+const LogsEvent::LogsDirection logsTestContact2Event2Dir = LogsEvent::DirIn;
+const QString logsTestContact2Event1Name = "Jeppa";
+const LogsEvent::LogsDirection logsTestContact2Event1Dir = LogsEvent::DirMissed;
+
+const QString logsTestContact3Event3Name = "aeppu";
+const LogsEvent::LogsDirection logsTestContact3Event3Dir = LogsEvent::DirOut;
+const QString logsTestContact3Event2Name = "beppu";
+const LogsEvent::LogsDirection logsTestContact3Event2Dir = LogsEvent::DirIn;
+const QString logsTestContact3Event1Name = "deppu";
+const LogsEvent::LogsDirection logsTestContact3Event1Dir = LogsEvent::DirOut;
+
+const QString logsTestHomeScreenMissedCallerName = "Jeppa";
+
+Q_DECLARE_METATYPE(LogsEvent *)
+
+#define AT_LOGSENG_VERIFY(m, idx, remote, dir) { \
+LogsEvent* event = qVariantValue<LogsEvent*>( m.data( m.index(idx, 0), LogsModel::RoleFullEvent ) ); \
+QVERIFY( event && event->remoteParty() == remote && event->direction() == dir ); }
+
+void AT_LogsEngine::initTestCase()
+{
+ TRAPD( err, clearEventsL() );
+ Q_ASSERT( err == KErrNone );
+ QTest::qWait(2000);
+ TRAP( err, writeEventsL() );
+ Q_ASSERT( err == KErrNone );
+ QTest::qWait(2000);
+ mModel = new LogsModel(LogsModel::LogsFullModel);
+ QTest::qWait(5000); // wait model to be populated from db
+}
+
+void AT_LogsEngine::cleanupTestCase()
+{
+ delete mModel;
+ mModel = 0;
+}
+
+
+void AT_LogsEngine::init()
+{
+}
+
+void AT_LogsEngine::cleanup()
+{
+
+}
+
+void AT_LogsEngine::testAllEvents()
+{
+ QVERIFY( mModel->rowCount(QModelIndex()) == logsTestAllEventsCount );
+ AT_LOGSENG_VERIFY( (*mModel), 0, logsTestAllEvent1Name, logsTestAllEvent1Dir )
+}
+
+void AT_LogsEngine::testFilteredEvents()
+{
+ LogsCustomFilter filter;
+ filter.setContactId(2);
+ filter.setSourceModel(mModel);
+ QVERIFY( filter.rowCount() == logsTestContact2EventsCount );
+ AT_LOGSENG_VERIFY( filter, 0, logsTestContact2Event1Name, logsTestContact2Event1Dir )
+ AT_LOGSENG_VERIFY( filter, 1, logsTestContact2Event2Name, logsTestContact2Event2Dir )
+
+ filter.setContactId(3);
+ filter.setSourceModel(0);
+ filter.setSourceModel(mModel);
+ QVERIFY( filter.rowCount() == logsTestContact3EventsCount );
+ AT_LOGSENG_VERIFY( filter, 0, logsTestContact3Event1Name, logsTestContact3Event1Dir )
+ AT_LOGSENG_VERIFY( filter, 1, logsTestContact3Event2Name, logsTestContact3Event2Dir )
+ AT_LOGSENG_VERIFY( filter, 2, logsTestContact3Event3Name, logsTestContact3Event3Dir )
+
+ filter.setContactId(10345624);
+ filter.setSourceModel(0);
+ filter.setSourceModel(mModel);
+ QVERIFY( filter.rowCount() == 0 );
+}
+
+void AT_LogsEngine::testMarkEventsSeen()
+{
+ LogsCustomFilter filter;
+ filter.setContactId(2);
+ filter.setSourceModel(mModel);
+ int unseenCount = 0;
+ QVERIFY( filter.rowCount() == 2 );
+ for ( int i = 0; i < filter.rowCount(); i++ ){
+ LogsEvent* event = qVariantValue<LogsEvent*>(
+ filter.data( filter.index(i, 0), LogsModel::RoleFullEvent ) );
+ if ( event && !event->isRead() ){
+ unseenCount++;
+ }
+ }
+ QVERIFY( unseenCount == 2 );
+ QSignalSpy spy( &filter, SIGNAL( markingCompleted(int)));
+ QVERIFY( filter.markEventsSeen() );
+ QTest::qWait(1000); // wait marking completion
+
+ QVERIFY( spy.count() == 1 );
+ int seenCount = 0;
+ for ( int i = 0; i < filter.rowCount(); i++ ){
+ LogsEvent* event = qVariantValue<LogsEvent*>(
+ filter.data( filter.index(i, 0), LogsModel::RoleFullEvent ) );
+ if ( event && event->isRead() ){
+ seenCount++;
+ }
+ }
+ QVERIFY( seenCount == 2 );
+
+}
+
+void AT_LogsEngine::testClearEvents()
+{
+ LogsCustomFilter filter;
+ filter.setContactId(2);
+ filter.setSourceModel(mModel);
+ QVERIFY( filter.rowCount() == 2 );
+ int unseenCount = 0;
+ QSignalSpy spy( &filter, SIGNAL( clearingCompleted(int)));
+ QVERIFY( filter.clearEvents() );
+ QTest::qWait(1000); // wait clearing completion
+ QVERIFY( filter.rowCount() == 0 );
+ QVERIFY( spy.count() == 1 );
+}
+
+void AT_LogsEngine::testHomeScreenUsecase()
+{
+ // Homescreen missed calls notification plugin uses full model with
+ // missed calls filter to find out how many sequential events was
+ // received from one caller. If number of them is the same as missed call
+ // counter, name of the caller is shown at HS.
+
+
+ LogsFilter filter(LogsFilter::Missed);
+ const int maxNumMissedCalls = 2;
+ filter.setMaxSize(maxNumMissedCalls);
+ LogsModel optimizedModel(LogsModel::LogsFullModel);
+ QTest::qWait(5000); // wait model to be populated from db
+ filter.setSourceModel(&optimizedModel);
+
+ // Test data has 10 missed calls from Jeppa but readsize has been configured to 2 so
+ // reading stops when 2 missed calls has been read
+ QCOMPARE( filter.rowCount(), maxNumMissedCalls );
+ AT_LOGSENG_VERIFY( filter, 0, logsTestHomeScreenMissedCallerName, LogsEvent::DirMissed )
+ AT_LOGSENG_VERIFY( filter, 1, logsTestHomeScreenMissedCallerName, LogsEvent::DirMissed )
+
+ // Filter assigned to full model without read size has all those 10 missed calls
+ LogsFilter filter2(LogsFilter::Missed);
+ filter2.setSourceModel(mModel);
+ QVERIFY( filter2.rowCount() == logsTestMissedCallsCount );
+
+ // Verify decoration and display data
+ QStringList displayData = filter.data( filter.index(0, 0), Qt::DisplayRole ).toStringList();
+ QVERIFY( displayData.count() == 2 );
+ QVERIFY( displayData.at(0) == logsTestHomeScreenMissedCallerName );
+ HbIcon icon = qVariantValue<HbIcon>( filter.data( filter.index(0, 0), Qt::DecorationRole ).toList().at(0) );
+ QVERIFY( !icon.isNull() );
+
+ // Cenrep missed calls counter is not tested here
+}
+
+void AT_LogsEngine::clearEventsL()
+{
+ executeL(KLogTestClientClearer, KNullDesC);
+}
+
+void AT_LogsEngine::writeEventsL()
+{
+ TBuf<100> commandLine;
+ // Run and write events named at_logsengine in the .dat
+ commandLine.Append( KLogTestEvents );
+ executeL(KLogTestClientWriter, commandLine);
+}
+
+void AT_LogsEngine::executeL(const TDesC& exeName, const TDesC& commandLine)
+{
+ RProcess process;
+ CleanupClosePushL( process );
+ User::LeaveIfError( process.Create( exeName, commandLine ) );
+ process.Resume();
+ CleanupStack::PopAndDestroy( &process );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/at_logsengine/src/main.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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 <QtTest/QtTest>
+
+#include "at_logsengine.h"
+#include "testresultxmlparser.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);
+ TestResultXmlParser parser;
+
+ AT_LogsEngine test;
+ QString resultFileName = "c:/at_logs_logsEngine.xml";
+ QStringList args_test( "at_logsEngine");
+ args_test << "-xml" << "-o" << resultFileName;
+ QTest::qExec(&test, args_test);
+ parser.parseAndPrintResults(resultFileName,true);
+
+ if (promptOnExit) {
+ printf("Press any key...\n");
+ getchar();
+ }
+ return 0;
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/hbstubs/hbicon.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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: Orbit stubs for Live Comms UI unit tests
+*
+*/
+#ifndef HBICON_H
+#define HBICON_H
+
+#include <QMetaType>
+#include <qicon.h> //krazy:exclude=qclasses
+class HbIcon
+{
+public:
+ HbIcon();
+ HbIcon(const QString &iconName);
+ HbIcon(const QIcon &icon);
+ HbIcon(const HbIcon &other);
+ ~HbIcon();
+ bool isNull() const;
+ QIcon &qicon() const;
+ bool operator==(const HbIcon &other) const;
+
+ operator QVariant() const;
+
+public: // Data added for the unit testing stub
+ QString mName;
+ QIcon* mTestIcon;
+};
+
+Q_DECLARE_METATYPE(HbIcon)
+
+#endif // HBICON_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/hbstubs/hblineedit.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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: Orbit stubs for Live Comms UI unit tests
+*
+*/
+#ifndef HBLINEEDIT_H
+#define HBLINEEDIT_H
+
+#include <QMetaType>
+
+
+class HbLineEdit
+{
+public:
+ HbLineEdit();
+ HbLineEdit(const QString &lineEditText);
+ ~HbLineEdit();
+
+ void setText(const QString &text);
+ void paste();
+ void copy();
+ void selectAll();
+ void setSelection(int start, int length);
+ QString text() const;
+
+
+public: // Data added for the unit testing stub
+ QString mName;
+ QString mText;
+
+};
+
+Q_DECLARE_METATYPE(HbLineEdit)
+
+#endif // HBLINEEDIT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/hbstubs/hbstubs.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,185 @@
+/*
+* 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:
+*
+*/
+
+// Orbit classes
+#include <hbicon.h>
+#include <hblineedit.h>
+#include <QVariant>
+
+
+QString mUTClipboard;
+
+// -----------------------------------------------------------------------------
+// HbIcon::HbIcon
+// -----------------------------------------------------------------------------
+//
+HbIcon::HbIcon()
+{
+ mName = QString();
+ mTestIcon = new QIcon;
+}
+
+// -----------------------------------------------------------------------------
+// HbIcon::HbIcon
+// -----------------------------------------------------------------------------
+//
+HbIcon::HbIcon(const QString &iconName)
+{
+ mName = iconName;
+ mTestIcon = new QIcon;
+}
+
+// -----------------------------------------------------------------------------
+// HbIcon::HbIcon
+// -----------------------------------------------------------------------------
+//
+HbIcon::HbIcon(const QIcon &icon)
+{
+ mName = "c:\\data\\images\\designer.png";
+ mTestIcon = new QIcon;
+}
+
+// -----------------------------------------------------------------------------
+// HbIcon::HbIcon
+// -----------------------------------------------------------------------------
+//
+HbIcon::HbIcon(const HbIcon &icon)
+{
+ mName = "c:\\data\\images\\designer.png";
+ mTestIcon = new QIcon;
+}
+
+// -----------------------------------------------------------------------------
+// HbIcon::~HbIcon
+// -----------------------------------------------------------------------------
+//
+HbIcon::~HbIcon()
+{
+ delete mTestIcon;
+}
+
+// -----------------------------------------------------------------------------
+// HbIcon::isNull
+// -----------------------------------------------------------------------------
+//
+bool HbIcon::isNull() const
+{
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// HbIcon::qicon
+// -----------------------------------------------------------------------------
+//
+QIcon &HbIcon::qicon() const
+{
+ return *mTestIcon;
+}
+
+// -----------------------------------------------------------------------------
+// HbIcon::operator==
+// -----------------------------------------------------------------------------
+//
+bool HbIcon::operator==(const HbIcon &other) const
+{
+ return (other.mName == mName);
+}
+
+// -----------------------------------------------------------------------------
+// HbIcon::operator QVariant
+// Returns the icon as a QVariant.
+// -----------------------------------------------------------------------------
+//
+HbIcon::operator QVariant() const
+{
+ return QVariant::fromValue(*this);
+}
+
+// -----------------------------------------------------------------------------
+// HbLineEdit::HbLineEdit
+// -----------------------------------------------------------------------------
+//
+HbLineEdit::HbLineEdit()
+{
+ //mName = QString();
+}
+
+// -----------------------------------------------------------------------------
+// HbLineEdit::HbLineEdit
+// -----------------------------------------------------------------------------
+//
+HbLineEdit::HbLineEdit(const QString &lineEditText)
+{
+ //mName = iconName;
+}
+
+// -----------------------------------------------------------------------------
+// HbLineEdit::~HbLineEdit
+// -----------------------------------------------------------------------------
+//
+HbLineEdit::~HbLineEdit()
+{
+}
+
+// -----------------------------------------------------------------------------
+// HbLineEdit::setText
+// -----------------------------------------------------------------------------
+//
+void HbLineEdit::setText(const QString &text)
+{
+ mText = text;
+}
+// -----------------------------------------------------------------------------
+// HbLineEdit::selectAll
+// -----------------------------------------------------------------------------
+//
+void HbLineEdit::selectAll()
+{
+}
+// -----------------------------------------------------------------------------
+// HbLineEdit::selectAll
+// -----------------------------------------------------------------------------
+//
+void HbLineEdit::setSelection(int start, int length)
+{
+ Q_UNUSED(start);
+ Q_UNUSED(length);
+}
+// -----------------------------------------------------------------------------
+// HbLineEdit::copy
+// -----------------------------------------------------------------------------
+//
+void HbLineEdit::copy()
+{
+ mUTClipboard = mText;
+}
+// -----------------------------------------------------------------------------
+// HbLineEdit::paste
+// -----------------------------------------------------------------------------
+//
+void HbLineEdit::paste()
+{
+ mText = mUTClipboard;
+}
+// -----------------------------------------------------------------------------
+// HbLineEdit::text
+// -----------------------------------------------------------------------------
+//
+QString HbLineEdit::text() const
+{
+ return mText;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/hbstubs/qicon.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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: Orbit stubs for Live Comms UI unit tests
+*
+*/
+#ifndef QICON_H
+#define QICON_H
+
+#include <QMetaType>
+class QIcon
+{
+public:
+ QIcon();
+ QIcon(const QString &iconName);
+ QIcon(const QIcon &icon);
+ QIcon(const QPixmap &pixmap);
+ ~QIcon();
+ bool isNull() const;
+ bool operator==(const QIcon &other) const;
+
+ operator QVariant() const;
+
+public: // Data added for the unit testing stub
+ QString mName;
+};
+
+Q_DECLARE_METATYPE(QIcon)
+
+#endif // QICON_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/hbstubs/qiconstubs.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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:
+*
+*/
+
+// Orbit classes
+#include <qicon.h>
+#include <QVariant>
+#include <QPixmap>
+
+
+// -----------------------------------------------------------------------------
+// QIcon::QIcon
+// -----------------------------------------------------------------------------
+//
+QIcon::QIcon()
+{
+ mName = QString();
+}
+
+// -----------------------------------------------------------------------------
+// QIcon::QIcon
+// -----------------------------------------------------------------------------
+//
+QIcon::QIcon(const QString &iconName)
+{
+ mName = iconName;
+}
+
+// -----------------------------------------------------------------------------
+// QIcon::QIcon
+// -----------------------------------------------------------------------------
+//
+QIcon::QIcon(const QPixmap &pixmap)
+{
+ mName = "c:\\data\\images\\bg_1.png";
+}
+
+// -----------------------------------------------------------------------------
+// QIcon::QIcon
+// -----------------------------------------------------------------------------
+//
+QIcon::QIcon(const QIcon &icon)
+{
+ mName = "c:\\data\\images\\bg_1.png";
+}
+
+// -----------------------------------------------------------------------------
+// QIcon::~QIcon
+// -----------------------------------------------------------------------------
+//
+QIcon::~QIcon()
+{
+}
+
+// -----------------------------------------------------------------------------
+// QIcon::isNull
+// -----------------------------------------------------------------------------
+//
+bool QIcon::isNull() const
+{
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// QIcon::operator==
+// -----------------------------------------------------------------------------
+//
+bool QIcon::operator==(const QIcon &other) const
+{
+ return (other.mName == mName);
+}
+
+// -----------------------------------------------------------------------------
+// QIcon::operator QVariant
+// Returns the icon as a QVariant.
+// -----------------------------------------------------------------------------
+//
+QIcon::operator QVariant() const
+{
+ return QVariant::fromValue(*this);
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/stubs/logscntfinder.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,188 @@
+/*
+* 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 LOGSCNTFINDER_H
+#define LOGSCNTFINDER_H
+
+#include <QObject>
+#include <QList>
+#include <QString>
+#include <qtcontacts.h>
+
+QTM_USE_NAMESPACE
+
+class LogsCntEntry;
+typedef QObject LogsCntEntryHandle;
+
+
+class LogsCntText
+{
+public:
+
+ inline LogsCntText() : mHighlights(0){}
+ inline const QString& text() const {return mText;}
+ inline int highlights() const {return mHighlights;}
+ QString richText( QString startTag = QString("<b><u>"),
+ QString endTag = QString("</u></b>")) const;
+
+private:
+
+ QString mText;
+ QString mTranslatedText;
+ int mHighlights;
+
+ friend class LogsCntEntry;
+ friend class UT_LogsCntEntry;
+ friend class UT_LogsCntFinder;
+};
+
+typedef QList<LogsCntText> LogsCntTextList;
+
+class LogsCntEntry
+{
+public:
+
+ enum EntryType {
+ EntryTypeHistory,
+ EntryTypeContact
+ };
+
+ LogsCntEntry( LogsCntEntryHandle& handle,
+ quint32 cid );
+ LogsCntEntry( quint32 cid );
+ LogsCntEntry( const LogsCntEntry& entry );
+ ~LogsCntEntry();
+ EntryType type() const;
+ const LogsCntTextList& firstName() const;
+ const LogsCntTextList& lastName() const;
+ const QString& avatarPath() const;
+ quint32 contactId() const;
+ LogsCntEntryHandle* handle() const;
+ void setFirstName( const QString& name );
+ void setLastName( const QString& name );
+ const LogsCntText& phoneNumber() const;
+ void setPhoneNumber( const QString& number );
+
+ bool isCached() const;
+ void setHighlights( const QString& pattern );
+ bool match( const QString& pattern ) const;
+
+private:
+
+ void doSetText( const QString& text, LogsCntTextList& textlist );
+ bool doMatch( const QString& pattern,
+ const LogsCntTextList& textlist ) const;
+
+private:
+
+ EntryType mType;
+ quint32 mCid;
+ LogsCntTextList mFirstName;
+ LogsCntTextList mLastName;
+ bool mCached;
+ LogsCntEntryHandle* mHandle;
+ LogsCntText mPhoneNumber;
+ QString mAvatarPath;
+
+ friend class UT_LogsCntEntry;
+ friend class UT_LogsCntFinder;
+};
+
+typedef QList<LogsCntEntry*> LogsCntEntryList;
+
+/**
+ * Log events and contacts finder
+ *
+ */
+class LogsCntFinder : public QObject
+{
+
+ Q_OBJECT
+
+public: // The exported API
+
+ LogsCntFinder();
+ LogsCntFinder(QContactManager& contactManager);
+ ~LogsCntFinder();
+
+ /**
+ * Starts/continues predictive query based on pattern. If
+ * there is a previously executed query with same pattern,
+ * call is treated as continue query.
+ * @param pattern the predictive pattern, containing digit(s)
+ */
+ void predictiveSearchQuery( const QString& pattern );
+
+ /**
+ * returns number of results
+ * @return number of results
+ */
+ int resultsCount() const;
+
+ /**
+ * returns result at index
+ * @param index the index
+ */
+ const LogsCntEntry& resultAt( int index );
+
+ /**
+ * Used for adding entiries to be part of a query
+ * Ownership is transfered
+ * @param entry the entry
+ */
+ void insertEntry( int index, LogsCntEntry* entry );
+
+ /**
+ * Used for updating entiries
+ * @param handle the handle
+ */
+ LogsCntEntry* getEntry( const LogsCntEntryHandle& handle ) const;
+
+ /**
+ * Used for updating entiries
+ * @param entry the entry
+ */
+ void deleteEntry( const LogsCntEntryHandle& handle );
+
+signals:
+
+ /**
+ * emitted when query is ready
+ */
+ void queryReady();
+
+private:
+
+ void doPredictiveHistoryQuery();
+ void doPredictiveContactQuery();
+
+ LogsCntEntry* doGetEntry( const LogsCntEntryList& list,
+ const LogsCntEntryHandle& handle ) const;
+
+
+private:
+
+ QString mCurrentPredictivePattern;
+ LogsCntEntryList mResults;
+ QContactManager* mContactManager;
+ LogsCntEntryList mHistoryEvents;
+
+ friend class UT_LogsMatchesModel;
+
+};
+
+#endif //LOGSCNTFINDER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/stubs/logscntfinder_stub.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,469 @@
+/*
+* 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 "logscntfinder.h"
+#include "logslogger.h"
+
+#include <QStringList>
+#include <QContactManager.h>
+#include <QContact.h>
+#include <QContactName.h>
+#include <QContactPhoneNumber.h>
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::richText()
+// -----------------------------------------------------------------------------
+//
+QString LogsCntText::richText( QString startTag,
+ QString endTag ) const
+{
+ QString str = text();
+ if ( str.length() > 0 && highlights() > 0 ) {
+ str.insert( highlights() , endTag );
+ str.insert( 0, startTag );
+ }
+
+ return str;
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::LogsCntEntry()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry::LogsCntEntry( LogsCntEntryHandle& handle,
+ quint32 cid )
+ : mType( EntryTypeHistory ), mCid( cid ),
+ mCached( false ),mHandle(&handle)
+{
+ LogsCntText empty;
+ mFirstName.append( empty );
+ mLastName.append( empty );
+ mAvatarPath = "c:\\data\\images\\bg_1.png";
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::LogsCntEntry()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry::LogsCntEntry( quint32 cid )
+ : mType( EntryTypeContact ), mCid( cid ),
+ mCached( false ),mHandle(0)
+{
+ LogsCntText empty;
+ mFirstName.append( empty );
+ mLastName.append( empty );
+}
+
+// -----------------------------------------------------------------------------
+// copy LogsCntEntry::LogsCntEntry()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry::LogsCntEntry( const LogsCntEntry& entry )
+ : mType(entry.mType),
+ mCid(entry.mCid),
+ mFirstName(entry.mFirstName),
+ mLastName(entry.mLastName),
+ mCached(entry.mCached),
+ mHandle(entry.mHandle),
+ mPhoneNumber(entry.mPhoneNumber)
+{
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::~LogsCntEntry()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry::~LogsCntEntry()
+{
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::LogsCntEntry()
+// -----------------------------------------------------------------------------
+//
+const LogsCntTextList& LogsCntEntry::firstName() const
+{
+ return mFirstName;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::lastName()
+// -----------------------------------------------------------------------------
+//
+const LogsCntTextList& LogsCntEntry::lastName() const
+{
+ return mLastName;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::avatarPath()
+// -----------------------------------------------------------------------------
+//
+const QString& LogsCntEntry::avatarPath() const
+{
+ return mAvatarPath;
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::phoneNumber()
+// -----------------------------------------------------------------------------
+//
+const LogsCntText& LogsCntEntry::phoneNumber() const
+{
+ return mPhoneNumber;
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::contactId()
+// -----------------------------------------------------------------------------
+//
+quint32 LogsCntEntry::contactId() const
+{
+ return mCid;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::handle()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntryHandle* LogsCntEntry::handle() const
+{
+ return mHandle;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::setFirstName()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::setFirstName( const QString& name )
+{
+ mCached=true;
+ mFirstName.clear();
+ doSetText( name, mFirstName );
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::setLastName()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::setLastName( const QString& name )
+{
+ mCached=true;
+ mLastName.clear();
+ doSetText( name, mLastName );
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::setPhoneNumber()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::setPhoneNumber( const QString& number )
+{
+ mPhoneNumber.mText = number;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::doSetText()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::doSetText( const QString& text, LogsCntTextList& textlist )
+{
+ const QChar separ(' ');
+ QStringList parts = text.split( separ, QString::SkipEmptyParts );
+ for( int i=0;i<parts.count();i++) {
+ LogsCntText txt;
+ txt.mText = parts[i];
+ if ( type() == EntryTypeHistory ) {
+ txt.mTranslatedText = txt.mText;
+ }
+ textlist.append( txt );
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::setHighlights()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::setHighlights( const QString& pattern )
+{
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::match()
+// -----------------------------------------------------------------------------
+//
+bool LogsCntEntry::match( const QString& pattern ) const
+{
+ return doMatch( pattern, mFirstName ) ||
+ doMatch( pattern, mLastName );
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::doMatch()
+// -----------------------------------------------------------------------------
+//
+bool LogsCntEntry::doMatch( const QString& pattern,
+ const LogsCntTextList& textlist ) const
+{
+ //direct match with phone number is enough
+ if ( mPhoneNumber.text().startsWith( pattern ) ) {
+ return true;
+ }
+
+ bool found = false;
+ int index=0;
+ while( index < textlist.count() && !found ) {
+ found = textlist.at( index++ ).mTranslatedText.startsWith( pattern );
+ }
+ return found;
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::isCached()
+// -----------------------------------------------------------------------------
+//
+bool LogsCntEntry::isCached() const
+{
+ return mCached;
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::type()
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry::EntryType LogsCntEntry::type() const
+{
+ return mType;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::LogsCntFinder()
+// -----------------------------------------------------------------------------
+//
+LogsCntFinder::LogsCntFinder()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::LogsCntFinder()" )
+
+ // Create manager ourselves, object takes care of deletion when registering
+ // as parent.
+ QMap<QString, QString> dummyParams;
+ mContactManager = new QContactManager("symbian", dummyParams, this);
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::LogsCntFinder()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::LogsCntFinder()
+// -----------------------------------------------------------------------------
+//
+LogsCntFinder::LogsCntFinder(QContactManager& contactManager)
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::LogsCntFinder(), cntmgr from client" )
+
+ mContactManager = &contactManager;
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::LogsCntFinder()" )
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::~LogsCntFinder()
+// -----------------------------------------------------------------------------
+//
+LogsCntFinder::~LogsCntFinder()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::~LogsCntFinder()" )
+
+ qDeleteAll( mResults );
+ qDeleteAll( mHistoryEvents );
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::~LogsCntFinder()" )
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::predictiveSearchQuery
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::predictiveSearchQuery( const QString& pattern )
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::predictiveSearchQuery()" )
+ LOGS_QDEBUG_2( "logs [FINDER] pattern= ", pattern )
+
+ bool patternChanged = pattern != mCurrentPredictivePattern;
+ mCurrentPredictivePattern = pattern;
+
+ if ( !mCurrentPredictivePattern.isEmpty() && patternChanged ) {
+ qDeleteAll( mResults );
+ mResults.clear();
+ doPredictiveHistoryQuery();
+ doPredictiveContactQuery();
+ }
+ //emit queryReady(); // commented off to ease testing
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::predictiveSearchQuery()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::doPredictiveHistoryQuery
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::doPredictiveHistoryQuery()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::doPredictiveHistoryQuery()" )
+
+ QListIterator<LogsCntEntry*> iter(mHistoryEvents);
+
+ while( iter.hasNext() ) {
+ LogsCntEntry* e = iter.next();
+ if ( e->match( mCurrentPredictivePattern ) ) {
+ LogsCntEntry* entry = new LogsCntEntry( *e );
+ mResults.append( entry );
+ }
+ }
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::doPredictiveHistoryQuery()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::doPredictiveContactQuery
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::doPredictiveContactQuery()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::doPredictiveContactQuery()" )
+/*
+ int index = 0;
+ while( index < cntIds.count() ) {
+ LogsCntEntry* entry = new LogsCntEntry( cntIds.at( index++ ) );
+ mResults.append( entry );
+ }
+ */
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::doPredictiveContactQuery()" )
+
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::resultsCount
+// -----------------------------------------------------------------------------
+//
+int LogsCntFinder::resultsCount() const
+{
+ return mResults.count();
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::resultAt
+// -----------------------------------------------------------------------------
+//
+const LogsCntEntry& LogsCntFinder::resultAt( int index )
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::resultAt()" )
+ LOGS_QDEBUG_2( "logs [FINDER] index=", index )
+
+ LogsCntEntry* entry = mResults.at( index );
+ if ( !entry->isCached() ) {
+ QContact contact = mContactManager->contact( entry->contactId() );
+ QContactName contactName = contact.detail( QContactName::DefinitionName );
+ entry->setFirstName( contactName.value( QContactName::FieldFirst ) );
+ entry->setLastName( contactName.value( QContactName::FieldLast ) );
+ QContactPhoneNumber contactPhoneNumber =
+ contact.detail( QContactPhoneNumber::DefinitionName );
+ entry->setPhoneNumber(
+ contactPhoneNumber.value( QContactPhoneNumber::FieldNumber ) );
+
+ entry->setHighlights( mCurrentPredictivePattern );
+ }
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::resultAt()" )
+ return *entry;
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::insertEntry
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::insertEntry( int index, LogsCntEntry* entry )
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::insertEntry()" )
+ LOGS_QDEBUG_4( "logs [FINDER] handle=", entry->handle()," to index ", index )
+
+ mHistoryEvents.insert( index, entry );
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::insertEntry()" )
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::getEntry
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry* LogsCntFinder::getEntry( const LogsCntEntryHandle& handle ) const
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::getEntry()" )
+ return doGetEntry( mHistoryEvents, handle );
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::doGetEntry
+// -----------------------------------------------------------------------------
+//
+LogsCntEntry* LogsCntFinder::doGetEntry( const LogsCntEntryList& list,
+ const LogsCntEntryHandle& handle ) const
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::doGetEntry()" )
+ LOGS_QDEBUG_2( "logs [FINDER] handle= ", &handle )
+
+ LogsCntEntry* entry = 0;
+ QListIterator<LogsCntEntry*> iter(list);
+
+ while( iter.hasNext() && !entry ) {
+ LogsCntEntry* e = iter.next();
+ entry = e->handle() == &handle ? e : 0;
+ }
+
+ LOGS_QDEBUG_2( "logs [FINDER] found=", (entry!=0) )
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::doGetEntry()" )
+ return entry;
+}
+
+// -----------------------------------------------------------------------------
+// LogsCntFinder::deleteEntry
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::deleteEntry( const LogsCntEntryHandle& handle )
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::deleteEntry()" )
+ LOGS_QDEBUG_2( "logs [FINDER] handle= ", &handle )
+
+ LogsCntEntry* toRemoveHistoryEv = doGetEntry( mHistoryEvents, handle );
+ mHistoryEvents.removeOne( toRemoveHistoryEv );
+ delete toRemoveHistoryEv;
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsCntFinder::deleteEntry()" )
+
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/stubs/qthighway_stub.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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 <xqservicerequest.h>
+
+#include "qthighway_stub_helper.h"
+
+QString qtHighwayStubService;
+QString qtHighwayStubMessage;
+
+void QtHighwayStubHelper::reset()
+{
+ qtHighwayStubService.clear();
+ qtHighwayStubMessage.clear();
+}
+
+QString QtHighwayStubHelper::service()
+{
+ return qtHighwayStubService;
+}
+
+QString QtHighwayStubHelper::message()
+{
+ return qtHighwayStubMessage;
+}
+
+XQServiceRequest::XQServiceRequest(
+ const QString& service, const QString& message, const bool& synchronous)
+{
+ qtHighwayStubService = service;
+ qtHighwayStubMessage = message;
+}
+
+XQServiceRequest::~XQServiceRequest()
+{
+
+}
+
+
+void XQServiceRequest::setArguments(const QList<QVariant> &arguments)
+{
+ Q_UNUSED(arguments)
+}
+
+QString XQServiceRequest::service() const
+{
+ return qtHighwayStubService;
+}
+
+QString XQServiceRequest::message() const
+{
+ return qtHighwayStubMessage;
+}
+
+bool XQServiceRequest::send(QVariant& retValue)
+{
+ return true;
+}
+void XQServiceRequest::addArg(const QVariant& v)
+{
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/stubs/qthighway_stub_helper.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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:
+*
+*/
+
+/**
+* Helper class to control logcli stub behavior
+*
+*/
+class QtHighwayStubHelper{
+ public:
+ static void reset();
+ static QString service();
+ static QString message();
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/symbianos_stub/logsdbconnector_stub.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,279 @@
+/*
+* 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 FILES
+#include "logsdbconnector.h"
+#include "logsdbconnector_stub_helper.h"
+#include "logsevent.h"
+
+// CONSTANTS
+
+QString logsLastCalledFunction = "";
+int logsPredictiveSearchStatus = 0;
+
+void LogsDbConnectorStubHelper::reset()
+{
+ logsLastCalledFunction = "";
+ logsPredictiveSearchStatus = 0;
+}
+
+QString LogsDbConnectorStubHelper::lastCalledFunction()
+{
+ return logsLastCalledFunction;
+}
+
+void LogsDbConnectorStubHelper::setPredictiveSearch(int status)
+{
+ logsPredictiveSearchStatus = status;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::LogsDbConnector
+// ----------------------------------------------------------------------------
+//
+LogsDbConnector::LogsDbConnector(
+ QList<LogsEvent*>& events, bool checkAllEvents, bool resourceControl )
+: QObject(), mModelEvents( events ), mCheckAllEvents( checkAllEvents ),
+ mResourceControl( resourceControl )
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::~LogsDbConnector
+// ----------------------------------------------------------------------------
+//
+LogsDbConnector::~LogsDbConnector()
+{
+ while ( !mEvents.isEmpty() ){
+ delete mEvents.takeFirst();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::init
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::init()
+{
+ logsLastCalledFunction = "init";
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::start
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::start()
+{
+ logsLastCalledFunction = "start";
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::updateDetails
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::updateDetails(bool /*clearCached*/)
+{
+ logsLastCalledFunction = "updateDetails";
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::clearList
+// ----------------------------------------------------------------------------
+//
+bool LogsDbConnector::clearList(LogsModel::ClearType /*cleartype*/)
+{
+ logsLastCalledFunction = "clearList";
+ return true;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::clearMissedCallsCounter
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::clearMissedCallsCounter()
+{
+ logsLastCalledFunction = "clearMissedCallsCounter";
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::clearEvents
+// ----------------------------------------------------------------------------
+//
+bool LogsDbConnector::clearEvents(const QList<int>& /*ids*/)
+{
+ logsLastCalledFunction = "clearEvents";
+ return true;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::markEventsSeen
+// ----------------------------------------------------------------------------
+//
+bool LogsDbConnector::markEventsSeen(const QList<int>& ids)
+{
+ bool started(false);
+ logsLastCalledFunction = "markEventsSeen";
+ foreach( int currId, ids ){
+ if ( !mEventsSeen.contains(currId) ){
+ mEventsSeen.append(currId);
+ started = true;
+ }
+ }
+ return started;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::readDuplicates
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::readDuplicates(int eventId)
+{
+ Q_UNUSED(eventId);
+ logsLastCalledFunction = "readDuplicates";
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::takeDuplicates
+// ----------------------------------------------------------------------------
+//
+QList<LogsEvent*> LogsDbConnector::takeDuplicates()
+{
+ QList<LogsEvent*> events;
+ events = mDuplicatedEvents;
+ mDuplicatedEvents.clear();
+ return events;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::refreshData
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::refreshData()
+{
+ logsLastCalledFunction = "refreshData";
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::compressData
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::compressData()
+{
+ logsLastCalledFunction = "compressData";
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::readCompleted
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::readCompleted(int /*numRead*/)
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::errorOccurred
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::errorOccurred(int err)
+{
+ Q_UNUSED(err)
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::readCompleted
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::removeCompleted()
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::errorOccurred
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::logsRemoveErrorOccured(int err)
+{
+ Q_UNUSED(err)
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::temporaryErrorOccurred
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::temporaryErrorOccurred(int err)
+{
+ Q_UNUSED(err)
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::eventModifyingCompleted
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::eventModifyingCompleted()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::duplicatesReadingCompleted
+// ----------------------------------------------------------------------------
+//
+void LogsDbConnector::duplicatesReadingCompleted(QList<LogsEvent*> duplicates)
+{
+ Q_UNUSED(duplicates);
+}
+
+// ----------------------------------------------------------------------------
+// LogsDbConnector::doMarkEventSeen
+// ----------------------------------------------------------------------------
+//
+int LogsDbConnector::doMarkEventSeen()
+{
+ 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;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/symbianos_stub/logsdbconnector_stub_helper.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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:
+*
+*/
+
+/**
+* Helper class to control logsdbconnector stub behavior
+*
+*/
+class LogsDbConnectorStubHelper
+{
+ public:
+ static void reset();
+ static QString lastCalledFunction();
+ static void setPredictiveSearch(int);
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/symbianos_stub/logseventdataparser_stub.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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 FILES
+#include <e32base.h>
+#include <logeng.h>
+
+#include "logseventdataparser.h"
+#include "logseventdata.h"
+#include "LogsApiConsts.h"
+
+// Separator for gprs data (old legacy non-tagged format for sent and
+// received grps data)
+_LIT8(KDataSeparator,",");
+
+// ----------------------------------------------------------------------------
+// LogsEventDataParser::parse
+// ----------------------------------------------------------------------------
+//
+int LogsEventDataParser::parse(
+ const CLogEvent& /*source*/, LogsEventData& dest )
+{
+ dest.mIsVT = true;
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventDataParser::setMsgPartsNumber
+// Read msg parts. They are written in format of TLogSmsPduData in Data field
+// ----------------------------------------------------------------------------
+//
+void LogsEventDataParser::setMsgPartsNumber( const TDesC8 &/*data*/, LogsEventData& /*dest*/ )
+{
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventDataParser::checkNonTaggedData
+// ----------------------------------------------------------------------------
+//
+bool LogsEventDataParser::checkNonTaggedData( const TDesC8 &/*data*/, LogsEventData& /*dest*/ )
+{
+return true;
+}
+
+
+// ----------------------------------------------------------------------------
+// LogsEventDataParser::checkTaggedData
+// ----------------------------------------------------------------------------
+//
+void LogsEventDataParser::checkTaggedData( const TDesC8 &/*data*/, LogsEventData& /*dest*/ )
+{
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/symbianos_stub/logseventparser_stub.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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 FILES
+#include <e32base.h>
+#include <logwrap.hrh>
+#include <QDateTime>
+
+#include "logseventparser.h"
+#include "logsevent.h"
+#include "logseventdata.h"
+#include "logsengdefs.h"
+#include "LogsApiConsts.h" //Additional event UIDs
+#include "logslogger.h"
+
+
+// ----------------------------------------------------------------------------
+// LogsEventParser::parseL
+// ----------------------------------------------------------------------------
+//
+void LogsEventParser::parseL(
+ const CLogEvent& source,
+ LogsEvent& dest,
+ const LogsEventStrings& /*strings*/ )
+{
+ dest.mNumber = DESC_TO_QSTRING( source.Number() );
+}
+
+// ----------------------------------------------------------------------------
+// LogsEventParser::resolveEventType
+// ----------------------------------------------------------------------------
+//
+void LogsEventParser::resolveEventType(LogsEvent& /*dest*/)
+{
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logscall.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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_LOGSCALL_H
+#define UT_LOGSCALL_H
+
+#include <QObject>
+
+class LogsCall;
+class LogsEvent;
+
+class UT_LogsCall : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testCall();
+ void testInitiateCallback();
+ void testallowedCallTypes();
+ void testisAllowedCallType();
+
+private:
+
+ LogsCall* mLogsCall;
+ LogsEvent* mLogsEvent;
+
+};
+
+
+#endif //UT_LOGSCALL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logscommondata.h Tue May 04 12:39:37 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 UT_LOGSCOMMONDATA_H
+#define UT_LOGSCOMMONDATA_H
+
+#include <QObject>
+
+class UT_LogsCommonData : 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 testGetInstance();
+ void testGetContactManager();
+ void testFreeCommonData();
+
+private:
+
+};
+
+
+#endif //UT_LOGSCOMMONDATA_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logscontact.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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_LOGSCONTACT_H
+#define UT_LOGSCONTACT_H
+
+#include <QObject>
+#include <QList>
+
+class LogsContact;
+class LogsEvent;
+class LogsDbConnector;
+
+class UT_LogsContact : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testAllowedRequestType();
+ void testOpen();
+ void testAddNew();
+ void testUpdateExisting();
+ void testIsContactInPhonebook();
+ void testIsContactRequestAllowed();
+ void testHandleRequestCompeted();
+
+private:
+
+ LogsContact* mLogsContact;
+ LogsEvent* mLogsEvent;
+
+ QList<LogsEvent*> mEvents;
+ LogsDbConnector* mDbConnector;
+};
+
+
+#endif //UT_LOGSCALL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logscustomfilter.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* 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_LOGSCUSTOMFILTER_H
+#define UT_LOGSCUSTOMFILTER_H
+
+#include <QObject>
+
+class LogsCustomFilter;
+
+class UT_LogsCustomFilter : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testFilterAcceptsRow();
+ void testClearEvents();
+ void testMarkEventsSeen();
+
+private:
+
+ LogsCustomFilter* mFilter;
+
+};
+
+
+#endif //UT_LOGSCUSTOMFILTER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsdetailsmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* 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_LOGSDETAILSMODEL_H
+#define UT_LOGSDETAILSMODEL_H
+
+#include <QObject>
+
+class LogsDetailsModel;
+class LogsDbConnector;
+class LogsEvent;
+
+
+class UT_LogsDetailsModel : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testRowCount();
+ void testData();
+ void testHeaderData();
+ void testgetRemoteUri();
+ void testInitTextsAndIcons();
+ void testInitUnseenMissed();
+ void testGetHeaderData();
+ void testGetCallerId();
+ void testgetNumberToClipboard();
+ void testCreateContact();
+ void testContactActionCompleted();
+
+private:
+
+ QList<LogsEvent*> mEvents;
+ LogsDbConnector* mDbConnector;
+ LogsDetailsModel* mModel;
+
+};
+
+
+#endif //UT_LOGSDETAILSMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsevent.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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_LOGSEVENT_H
+#define UT_LOGSEVENT_H
+
+#include <QObject>
+#include "logsengdefs.h"
+
+class LogsEvent;
+
+class UT_LogsEvent : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testInitializeEventL();
+ void testSetters();
+ void testGetters();
+ void testValidate();
+ void testGetNumberForCalling();
+ void testSetContactLocalId();
+ void testUpdateRemotePartyFromContacts();
+ void testParseContactName();
+
+private:
+
+ LogsEvent* mEvent;
+ LogsEventStrings mStrings;
+
+};
+
+
+#endif //UT_LOGSEVENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logseventdata.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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_LOGSEVENTDATA_H
+#define UT_LOGSEVENTDATA_H
+
+#include <QObject>
+
+class LogsEventData;
+
+class UT_LogsEventData : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testParse();
+ void testSetters();
+ void testGetters();
+ void testIsCsCompatible();
+
+private:
+
+ LogsEventData* mEventData;
+
+};
+
+
+#endif //UT_LOGSEVENTDATA_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsfilter.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* 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_LOGSFILTER_H
+#define UT_LOGSFILTER_H
+
+#include <QObject>
+
+class LogsFilter;
+
+class UT_LogsFilter : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testFilterAcceptsRow();
+ void testClearType();
+ void testSetMaxSize();
+
+private:
+
+ LogsFilter* mFilter;
+
+};
+
+
+#endif //UT_LOGSFILTER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsmatchesmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* 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_LOGSMATCHESMODEL_H
+#define UT_LOGSMATCHESMODEL_H
+
+#include <QObject>
+
+class LogsModel;
+class LogsMatchesModel;
+
+
+class UT_LogsMatchesModel : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testRowCount();
+ void testData();
+ void testDataAdded();
+ void testDataUpdated();
+ void testDataRemoved();
+ void testLogsMatches();
+ void testCreateContactWithNumber();
+ void testCreateCall();
+ void testCreateMessage();
+ void testCreateContact();
+ void testUpdateSearchEntry();
+ void testGetFormattedCallerId();
+ void testGetFormattedContactInfo();
+ void testPredictiveSearchStatus();
+ void testSetPredictiveSearch();
+
+private:
+
+ LogsModel* mModel;
+ LogsMatchesModel* mMatchesModel;
+
+};
+
+
+#endif //UT_LOGSMATCHESMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsmessage.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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_LOGSMESSAGE_H
+#define UT_LOGSMESSAGE_H
+
+#include <QObject>
+
+class LogsMessage;
+class LogsEvent;
+
+class UT_LogsMessage : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testIsMessagingAllowed();
+ void testSendMessage();
+ void testSendMessageToNumber();
+
+private:
+
+ LogsMessage* mLogsMessage;
+ LogsEvent* mLogsEvent;
+
+};
+
+
+#endif //UT_LOGSMESSAGE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* 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_LOGSMODEL_H
+#define UT_LOGSMODEL_H
+
+#include <QObject>
+
+class LogsModel;
+
+
+class UT_LogsModel : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+/*
+ * In addition, there are four private slots that are not treated as testfunctions.
+ * They will be executed by the testing framework and can be used to initialize and clean up
+ * either the entire test or the current test function.
+ *
+ * initTestCase() will be called before the first testfunction is executed.
+ * cleanupTestCase() will be called after the last testfunction was executed.
+ * init() will be called before each testfunction is executed.
+ * cleanup() will be called after every testfunction.
+*/
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+
+ void testConstructor();
+ void testRowCount();
+ void testData();
+ void testDataAdded();
+ void testDataUpdated();
+ void testDataRemoved();
+ void testGetDecorationData();
+ void testIconName();
+ void testGetCallerId();
+ void testClearList();
+ void testMarkEventsSeen();
+ void testClearMissedCallsCounter();
+ void testRefreshData();
+ void testCompressData();
+ void testPredictiveSearchStatus();
+ void testSetPredictiveSearch();
+
+private:
+
+ LogsModel* mModel;
+
+};
+
+
+#endif //UT_LOGSMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsthumbnailmanager.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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_LOGSTHUMBNAILMANAGER_H
+#define UT_LOGSTHUMBNAILMANAGER_H
+
+#include <QObject>
+#include <QIcon>
+
+class LogsThumbIconManager;
+
+
+class UT_LogsThumbnailManager : public QObject
+{
+Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots: //test methods
+ void testConstructor();
+ void testNonExistingIcon();
+ void testOneExistingIcon();
+ void testCancel();
+
+
+private:
+
+ LogsThumbIconManager* mIconMgr; // SUT
+ QIcon mIcon;
+
+};
+
+#endif //UT_LOGSTHUMBNAILMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/main.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* 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 <QtTest/QtTest>
+
+#include "ut_logsmodel.h"
+#include "ut_logsdetailsmodel.h"
+#include "ut_logsmatchesmodel.h"
+#include "ut_logsfilter.h"
+#include "ut_logscustomfilter.h"
+#include "ut_logscall.h"
+#include "ut_logscontact.h"
+#include "ut_logsmessage.h"
+#include "ut_logsevent.h"
+#include "ut_logseventdata.h"
+#include "ut_logsthumbnailmanager.h"
+#include "ut_logscommondata.h"
+#include "testresultxmlparser.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);
+ TestResultXmlParser parser;
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ if (promptOnExit) {
+ printf("Press any key...\n");
+ getchar();
+ }
+ return 0;
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscall.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logscall.h"
+#include "logscall.h"
+#include "logsmodel.h"
+#include "logsevent.h"
+#include "logseventdata.h"
+#include "qthighway_stub_helper.h"
+
+#include <QtTest/QtTest>
+
+void UT_LogsCall::initTestCase()
+{
+}
+
+void UT_LogsCall::cleanupTestCase()
+{
+}
+
+
+void UT_LogsCall::init()
+{
+ mLogsEvent = new LogsEvent();
+ mLogsEvent->setNumber(QString::number(12345));
+ mLogsEvent->setEventType(LogsEvent::TypeVoiceCall);
+ mLogsCall = new LogsCall(*mLogsEvent);
+}
+
+void UT_LogsCall::cleanup()
+{
+ delete mLogsCall;
+ mLogsCall = 0;
+ delete mLogsEvent;
+ mLogsEvent = 0;
+}
+
+void UT_LogsCall::testConstructor()
+{
+ QVERIFY( mLogsCall );
+ QVERIFY( mLogsCall->mDefaultCall == LogsCall::TypeLogsVoiceCall );
+ QVERIFY( mLogsCall->mNumber == QString::number(12345) );
+
+ LogsCall callWithContact(2, "2222" );
+ QVERIFY( callWithContact.mDefaultCall == LogsCall::TypeLogsVoiceCall );
+ QVERIFY( callWithContact.mNumber == "2222" );
+
+ LogsCall callWithContact2(2, "user@server.com" );
+ QVERIFY( callWithContact2.mDefaultCall == LogsCall::TypeLogsVoiceCall );
+ QVERIFY( callWithContact2.mNumber == "user@server.com" );
+
+ LogsCall callWithContact3(2, "" );
+ QVERIFY( callWithContact3.mDefaultCall == LogsCall::TypeLogsCallNotAvailable );
+ QVERIFY( callWithContact3.mNumber.isEmpty() );
+}
+
+void UT_LogsCall::testallowedCallTypes()
+{
+ LogsEvent event;
+ event.setNumber(QString::number(12345));
+ event.setEventType(LogsEvent::TypeVoiceCall);
+ LogsCall call1(event);
+ QVERIFY(call1.allowedCallTypes().count() == 2);
+
+ event.setEventType(LogsEvent::TypeVideoCall);
+ LogsCall call2(event);
+ QVERIFY(call2.allowedCallTypes().count() == 2);
+
+ // CS compatible Voip event
+ event.setEventType(LogsEvent::TypeVoIPCall);
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "23456667";
+ event.setLogsEventData( eventData );
+ LogsCall call3(event);
+ QVERIFY(call3.allowedCallTypes().count() == 3);
+
+ // Not CS compatible Voip event
+ LogsEventData* eventData2 = new LogsEventData;
+ eventData2->mRemoteUrl = "test@1.2.3.4";
+ event.setLogsEventData( eventData2 );
+ LogsCall call4(event);
+ QVERIFY(call4.allowedCallTypes().count() == 1);
+}
+
+void UT_LogsCall::testisAllowedCallType()
+{
+ QVERIFY(mLogsCall->isAllowedCallType());
+ delete mLogsCall;
+ mLogsCall = 0;
+ mLogsEvent->setEventType(LogsEvent::TypeVoIPCall);
+ mLogsCall = new LogsCall(*mLogsEvent);
+ QVERIFY(mLogsCall->isAllowedCallType());
+
+ // Calling with voip event possible if having remote tel uri
+ delete mLogsCall;
+ mLogsCall = 0;
+ mLogsEvent->setEventType(LogsEvent::TypeVoIPCall);
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "+22233344555";
+ mLogsEvent->setLogsEventData( eventData );
+ mLogsCall = new LogsCall(*mLogsEvent);
+ QVERIFY(mLogsCall->isAllowedCallType());
+}
+
+void UT_LogsCall::testCall()
+{
+ QtHighwayStubHelper::reset();
+ mLogsCall->call(LogsCall::TypeLogsVoiceCall);
+ QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
+ QVERIFY( QtHighwayStubHelper::message() == "dial(QString)" );
+
+ // Video call message is longer than voice call
+ QtHighwayStubHelper::reset();
+ mLogsCall->call(LogsCall::TypeLogsVideoCall);
+ QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
+ QVERIFY( QtHighwayStubHelper::message() == "dialVideo(QString)" );
+
+ QtHighwayStubHelper::reset();
+ mLogsCall->mServiceId = 3;
+ mLogsCall->call(LogsCall::TypeLogsVoIPCall);
+ QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
+ QVERIFY( QtHighwayStubHelper::message() == "dialVoipService(QString,int)" );
+
+ // Not supported calltype
+ QtHighwayStubHelper::reset();
+ mLogsCall->call(static_cast<LogsCall::CallType>(9999));
+ QVERIFY( QtHighwayStubHelper::service().isEmpty() );
+ QVERIFY( QtHighwayStubHelper::message().isEmpty() );
+}
+
+void UT_LogsCall::testInitiateCallback()
+{
+ QtHighwayStubHelper::reset();
+ mLogsCall->initiateCallback();
+ QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
+ QVERIFY( QtHighwayStubHelper::message() == "dial(QString)" );
+
+ // Video call message is longer than voice call
+ mLogsCall->mDefaultCall = LogsCall::TypeLogsVideoCall;
+ QtHighwayStubHelper::reset();
+ mLogsCall->initiateCallback();
+ QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
+ QVERIFY( QtHighwayStubHelper::message() == "dialVideo(QString)" );
+
+ mLogsCall->mDefaultCall = LogsCall::TypeLogsVoIPCall;
+ QtHighwayStubHelper::reset();
+ mLogsCall->mServiceId = 3;
+ mLogsCall->initiateCallback();
+ QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
+ QVERIFY( QtHighwayStubHelper::message() == "dialVoipService(QString,int)" );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscommondata.cpp Tue May 04 12:39:37 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:
+*
+*/
+#include "ut_logscommondata.h"
+#include "logscommondata.h"
+
+#include <QtTest/QtTest>
+
+void UT_LogsCommonData::initTestCase()
+{
+}
+
+void UT_LogsCommonData::cleanupTestCase()
+{
+}
+
+
+void UT_LogsCommonData::init()
+{
+}
+
+void UT_LogsCommonData::cleanup()
+{
+}
+
+void UT_LogsCommonData::testGetInstance()
+{
+ QVERIFY( &LogsCommonData::getInstance() != 0 );
+ QVERIFY( &LogsCommonData::getInstance() == &LogsCommonData::getInstance() );
+}
+
+void UT_LogsCommonData::testGetContactManager()
+{
+ QVERIFY( &LogsCommonData::getInstance().contactManager() != 0 );
+ QVERIFY( &LogsCommonData::getInstance().contactManager() == &LogsCommonData::getInstance().contactManager() );
+}
+
+void UT_LogsCommonData::testFreeCommonData()
+{
+ LogsCommonData* comData = &LogsCommonData::getInstance();
+ QVERIFY( comData != 0 );
+ LogsCommonData::freeCommonData();
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscontact.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,277 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logscontact.h"
+#include "logscontact.h"
+#include "logsevent.h"
+#include "logseventdata.h"
+#include "logsdbconnector.h"
+#include "logsdbconnector_stub_helper.h"
+#include "qtcontacts_stubs_helper.h"
+
+#include <xqservicerequest.h>
+#include <QtTest/QtTest>
+
+const int logsContactsLocalIdTest1 = 1;
+const QString logsFetchService = "com.nokia.services.phonebookservices.Fetch";
+
+void UT_LogsContact::initTestCase()
+{
+ mDbConnector = new LogsDbConnector(mEvents);
+ mLogsContact = 0;
+}
+
+void UT_LogsContact::cleanupTestCase()
+{
+ delete mDbConnector;
+}
+
+void UT_LogsContact::init()
+{
+ QtContactsStubsHelper::reset();
+ mLogsEvent = new LogsEvent();
+ LogsEventData* eventData = new LogsEventData;
+ mLogsEvent->setLogsEventData(eventData);
+ mLogsEvent->logsEventData()->setContactLocalId(logsContactsLocalIdTest1);
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+}
+
+void UT_LogsContact::cleanup()
+{
+ delete mLogsContact;
+ mLogsContact = 0;
+ delete mLogsEvent;
+ mLogsEvent = 0;
+}
+
+void UT_LogsContact::testConstructor()
+{
+ QVERIFY( mLogsContact );
+ QVERIFY( !mLogsContact->mService );
+ QVERIFY( mLogsContact->mCurrentRequest == LogsContact::TypeLogsContactSave );
+
+ LogsContact contactWithoutEvent("2345", *mDbConnector, 2);
+ QVERIFY( contactWithoutEvent.mContactId == 2 );
+ QVERIFY( contactWithoutEvent.mNumber == "2345" );
+}
+
+void UT_LogsContact::testAllowedRequestType()
+{
+ //Empty event with no matching contact
+ QVERIFY( mLogsContact );
+ QVERIFY( mLogsContact->allowedRequestType() == LogsContact::TypeLogsContactSave );
+
+ //contact is in phonebook, but matching of contact is done only during
+ //construction of mLogsContact, later changes not reflected
+ mLogsEvent->logsEventData()->setContactLocalId(1);
+ QtContactsStubsHelper::setContactId(1);
+ QVERIFY( mLogsContact->allowedRequestType() == LogsContact::TypeLogsContactSave );
+
+ //contact is in phonebook => open is allowed
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( mLogsEvent->logsEventData()->contactLocalId() );
+ QVERIFY( mLogsContact->allowedRequestType() == LogsContact::TypeLogsContactOpen );
+
+ //contact not in phonebook, but caller ID present => save allowed
+ QtContactsStubsHelper::reset();
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( mLogsEvent->logsEventData()->contactLocalId() );
+ mLogsEvent->setNumber( "123" );
+ QVERIFY( mLogsContact->allowedRequestType() == LogsContact::TypeLogsContactSave );
+}
+
+void UT_LogsContact::testOpen()
+{
+ //contact not in phonebook, can't open
+ QVERIFY( !mLogsContact->mService );
+ QVERIFY( !mLogsContact->open() );
+ QVERIFY( !mLogsContact->mService );
+ QVERIFY( mLogsContact->mCurrentRequest == LogsContact::TypeLogsContactSave );
+
+ //contact is in phonebook, open is ok
+ mLogsEvent->logsEventData()->setContactLocalId(2);
+ QtContactsStubsHelper::setContactId(2);
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( mLogsContact->open() );
+ QVERIFY( mLogsContact->mService );
+ QVERIFY( mLogsContact->mCurrentRequest == LogsContact::TypeLogsContactOpen );
+ QVERIFY( mLogsContact->mService->service() == logsFetchService );
+ QVERIFY( mLogsContact->mService->message() == "open(int)" );
+
+ // Same but without using logsevent at construction
+ LogsContact contactWithoutEvent("2345", *mDbConnector, 2);
+ QVERIFY( contactWithoutEvent.open() );
+ QVERIFY( contactWithoutEvent.mService );
+ QVERIFY( contactWithoutEvent.mCurrentRequest == LogsContact::TypeLogsContactOpen );
+ QVERIFY( contactWithoutEvent.mService->service() == logsFetchService );
+ QVERIFY( contactWithoutEvent.mService->message() == "open(int)" );
+
+}
+
+void UT_LogsContact::testAddNew()
+{
+ //no caller ID, contact won't be saved
+ mLogsEvent->setEventType(LogsEvent::TypeVoiceCall);
+ QVERIFY( mLogsEvent->getNumberForCalling().isEmpty() );
+ QVERIFY( !mLogsContact->addNew() );
+ QVERIFY( !mLogsContact->mService );
+ QVERIFY( mLogsContact->mCurrentRequest == LogsContact::TypeLogsContactSave );
+
+ //called ID present, contact not in phonebook => save is ok
+ mLogsEvent->setNumber(QString::number(12345));
+ mLogsEvent->setEventType(LogsEvent::TypeVoiceCall);
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( !mLogsEvent->getNumberForCalling().isEmpty() );
+ QVERIFY( !mLogsContact->isContactInPhonebook() );
+ QVERIFY( mLogsContact->addNew() );
+ QVERIFY( mLogsContact->mService );
+ QVERIFY( mLogsContact->mCurrentRequest == LogsContact::TypeLogsContactSave );
+ QVERIFY( mLogsContact->mService->service() == logsFetchService );
+ QVERIFY( mLogsContact->mService->message() == "editCreateNew(QString,QString)" );
+
+ //caller ID present, contact is in phonebook => save is ok
+ mLogsEvent->setEventType(LogsEvent::TypeVoIPCall);
+ mLogsEvent->setNumber("");
+ mLogsEvent->logsEventData()->mRemoteUrl = "someurl@blah";
+ mLogsEvent->logsEventData()->setContactLocalId(2);
+ QtContactsStubsHelper::setContactId(2);
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( mLogsContact->isContactInPhonebook() );
+ QVERIFY( mLogsContact->addNew() );
+ QVERIFY( mLogsContact->mService );
+ QVERIFY( mLogsContact->mCurrentRequest == LogsContact::TypeLogsContactSave );
+ QVERIFY( mLogsContact->mService->service() == logsFetchService );
+ QVERIFY( mLogsContact->mService->message() == "editCreateNew(QString,QString)" );
+}
+
+void UT_LogsContact::testUpdateExisting()
+{
+ //caller ID present, contact is in phonebook => update is ok
+ mLogsEvent->setNumber(QString::number(12345));
+ mLogsEvent->setEventType(LogsEvent::TypeVoiceCall);
+ mLogsEvent->logsEventData()->setContactLocalId(2);
+ QtContactsStubsHelper::setContactId(2);
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( mLogsContact->isContactInPhonebook() );
+ QVERIFY( mLogsContact->updateExisting() );
+ QVERIFY( mLogsContact->mService );
+ QVERIFY( mLogsContact->mCurrentRequest == LogsContact::TypeLogsContactSave );
+ QVERIFY( mLogsContact->mService->service() == logsFetchService );
+ QVERIFY( mLogsContact->mService->message() == "editUpdateExisting(QString,QString)" );
+}
+
+void UT_LogsContact::testIsContactInPhonebook()
+{
+ QVERIFY( !mLogsContact->isContactInPhonebook() );
+
+ //any changes in phonebook after mLogsContact creation are not reflected
+ mLogsEvent->logsEventData()->setContactLocalId(2);
+ QtContactsStubsHelper::setContactId(2);
+ QVERIFY( !mLogsContact->isContactInPhonebook() );
+
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( mLogsContact->isContactInPhonebook() );
+
+ // 0 is not valid contact ID
+ mLogsEvent->logsEventData()->setContactLocalId(0);
+ QtContactsStubsHelper::setContactId(0);
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( !mLogsContact->isContactInPhonebook() );
+}
+
+void UT_LogsContact::testIsContactRequestAllowed()
+{
+ // contact not in phonebook, caller ID not defined
+ QVERIFY( !mLogsContact->isContactInPhonebook() );
+ QVERIFY( mLogsEvent->number().isEmpty() );
+ QVERIFY( mLogsEvent->logsEventData()->remoteUrl().isEmpty() );
+ QVERIFY( !mLogsContact->isContactRequestAllowed() );
+
+ // caller ID is defined, number
+ mLogsEvent->setNumber( "1234" );
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( mLogsContact->isContactRequestAllowed() );
+
+ // caller ID is defined, voip url
+ mLogsEvent->setNumber( "" );
+ mLogsEvent->logsEventData()->mRemoteUrl = "blah";
+ mLogsEvent->setEventType( LogsEvent::TypeVoIPCall );
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( mLogsContact->isContactRequestAllowed() );
+
+ // No caller ID, but contact is in phonebook
+ mLogsEvent->logsEventData()->mRemoteUrl = "";
+ mLogsEvent->logsEventData()->setContactLocalId(1);
+ QtContactsStubsHelper::setContactId(1);
+ delete mLogsContact;
+ mLogsContact = 0;
+ mLogsContact = new LogsContact(*mLogsEvent, *mDbConnector);
+ QVERIFY( mLogsContact->isContactRequestAllowed() );
+}
+
+void UT_LogsContact::testHandleRequestCompeted()
+{
+ QSignalSpy spyOpened( mLogsContact, SIGNAL(openCompleted(bool)) );
+ QSignalSpy spySaved( mLogsContact, SIGNAL(saveCompleted(bool)) );
+
+ //open operation finished
+ LogsDbConnectorStubHelper::reset();
+ mLogsContact->mCurrentRequest = LogsContact::TypeLogsContactOpen;
+ mLogsContact->handleRequestCompleted( QVariant(1) );
+ QVERIFY( spyOpened.count() == 1 );
+ QVERIFY( spySaved.count() == 0 );
+ QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "updateDetails" );
+
+ //save operation finished successfully
+ LogsDbConnectorStubHelper::reset();
+ spyOpened.clear();
+ spySaved.clear();
+ mLogsContact->mCurrentRequest = LogsContact::TypeLogsContactSave;
+ mLogsContact->handleRequestCompleted( QVariant(1) );
+ QVERIFY( spyOpened.count() == 0 );
+ QVERIFY( spySaved.count() == 1 );
+ QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "updateDetails" );
+
+ //save operation finished unsuccessfully
+ LogsDbConnectorStubHelper::reset();
+ spyOpened.clear();
+ spySaved.clear();
+ mLogsContact->mCurrentRequest = LogsContact::TypeLogsContactSave;
+ mLogsContact->handleRequestCompleted( QVariant(0) );
+ QVERIFY( spyOpened.count() == 0 );
+ QVERIFY( spySaved.count() == 1 );
+ QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction().isEmpty() );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscustomfilter.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logscustomfilter.h"
+#include "logscustomfilter.h"
+#include "logsmodel.h"
+#include "logsevent.h"
+#include "logseventdata.h"
+#include <QStringListModel>
+
+#include <QtTest/QtTest>
+
+void UT_LogsCustomFilter::initTestCase()
+{
+ mFilter = new LogsCustomFilter;
+}
+
+void UT_LogsCustomFilter::cleanupTestCase()
+{
+ delete mFilter;
+ mFilter = 0;
+}
+
+
+void UT_LogsCustomFilter::init()
+{
+
+}
+
+void UT_LogsCustomFilter::cleanup()
+{
+
+}
+
+void UT_LogsCustomFilter::testConstructor()
+{
+ QVERIFY( mFilter );
+}
+
+void UT_LogsCustomFilter::testFilterAcceptsRow()
+{
+ // No source model
+ QVERIFY( mFilter->filterAcceptsRow(0, QModelIndex()) == false );
+
+ LogsModel* logsModel = new LogsModel(LogsModel::LogsFullModel);
+ mFilter->setSourceModel(logsModel);
+
+ // No any events
+ QVERIFY( mFilter->filterAcceptsRow(0, QModelIndex()) == false );
+
+ // No search term
+ LogsEvent* event = new LogsEvent;
+ logsModel->mEvents.append(event);
+ QVERIFY( mFilter->filterAcceptsRow(0, QModelIndex()) == false );
+
+ // Search term but no matching event
+ mFilter->setContactId(50);
+ QVERIFY( mFilter->filterAcceptsRow(0, QModelIndex()) == false );
+
+ // Search term and matching event
+ LogsEvent* event2 = new LogsEvent;
+ LogsEventData* eventData = new LogsEventData;
+ eventData->setContactLocalId(50);
+ event2->setLogsEventData(eventData);
+ logsModel->mEvents.append(event2);
+ QVERIFY( mFilter->filterAcceptsRow(0, QModelIndex()) == false );
+ QVERIFY( mFilter->filterAcceptsRow(1, QModelIndex()) == true );
+
+ mFilter->setSourceModel(0);
+ delete logsModel;
+}
+
+void UT_LogsCustomFilter::testClearEvents()
+{
+ // No source model
+ mFilter->setSourceModel(0);
+ QVERIFY( !mFilter->clearEvents() );
+
+ // Wrong type of source model
+ QStringListModel wrongModel;
+ mFilter->setSourceModel(&wrongModel);
+ QVERIFY( !mFilter->clearEvents() );
+
+ // Nothing to clear
+ LogsModel* logsModel = new LogsModel(LogsModel::LogsFullModel);
+ mFilter->setSourceModel(logsModel);
+ QVERIFY( !mFilter->clearEvents() );
+
+ // Something to clear
+ LogsEvent* event2 = new LogsEvent;
+ LogsEventData* eventData = new LogsEventData;
+ eventData->setContactLocalId(50);
+ event2->setLogsEventData(eventData);
+ logsModel->mEvents.append(event2);
+ mFilter->setSourceModel(0);
+ mFilter->setSourceModel(logsModel);
+ QVERIFY( mFilter->clearEvents() );
+}
+
+void UT_LogsCustomFilter::testMarkEventsSeen()
+{
+ // No source model
+ mFilter->setSourceModel(0);
+ QVERIFY( !mFilter->markEventsSeen() );
+
+ // Wrong type of source model
+ QStringListModel wrongModel;
+ mFilter->setSourceModel(&wrongModel);
+ QVERIFY( !mFilter->markEventsSeen() );
+
+ // Nothing to clear
+ LogsModel* logsModel = new LogsModel(LogsModel::LogsFullModel);
+ mFilter->setSourceModel(logsModel);
+ QVERIFY( !mFilter->markEventsSeen() );
+
+ // Something to clear
+ LogsEvent* event2 = new LogsEvent;
+ LogsEventData* eventData = new LogsEventData;
+ eventData->setContactLocalId(50);
+ event2->setLogsEventData(eventData);
+ logsModel->mEvents.append(event2);
+ mFilter->setSourceModel(0);
+ mFilter->setSourceModel(logsModel);
+ QVERIFY( mFilter->markEventsSeen() );
+
+ // Clearing for the event already ongoing, don't try again
+ event2->markedAsSeenLocally(true);
+ QVERIFY( !mFilter->markEventsSeen() );
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsdetailsmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,454 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsdetailsmodel.h"
+#include "logsdetailsmodel.h"
+#include "logsevent.h"
+#include "logsdbconnector.h"
+#include "logscall.h"
+#include "logscontact.h"
+#include "logsmessage.h"
+#include "logseventdata.h"
+#include "qtcontacts_stubs_helper.h"
+#include "logsdbconnector_stub_helper.h"
+#include <hblineedit.h>
+#include <hbglobal.h>
+#include <QtTest/QtTest>
+
+Q_DECLARE_METATYPE(LogsCall *)
+Q_DECLARE_METATYPE(LogsMessage *)
+Q_DECLARE_METATYPE(LogsContact *)
+
+const QString testEmpty = "";
+const QString testDetailsRemoteParty = "Remoteman";
+const QString testDetailsRemoteNum = "12345566";
+const QString testDetailsRemoteInfo = "Remoteman";
+QDateTime testDetailsDateAndTime;
+const LogsEvent::LogsDirection testDetailsDirection = LogsEvent::DirIn;
+const LogsEvent::LogsEventType testDetailsEventType = LogsEvent::TypeVoiceCall;
+const int testDetailsDuration = 2000;
+const QString testDetailsNumber = "+4152800";
+
+void UT_LogsDetailsModel::initTestCase()
+{
+
+ mDbConnector = new LogsDbConnector(mEvents);
+}
+
+void UT_LogsDetailsModel::cleanupTestCase()
+{
+ delete mDbConnector;
+}
+
+
+void UT_LogsDetailsModel::init()
+{
+ testDetailsDateAndTime.setTime_t( 3000 );
+
+ LogsEvent event;
+ event.setRemoteParty( testDetailsRemoteParty );
+ event.setNumber( testDetailsRemoteNum );
+ event.setTime( testDetailsDateAndTime );
+ event.setDirection( testDetailsDirection );
+ event.setEventType( testDetailsEventType );
+ event.setDuration( testDetailsDuration );
+ mModel = new LogsDetailsModel(*mDbConnector, event);
+}
+
+void UT_LogsDetailsModel::cleanup()
+{
+ delete mModel;
+ mModel = 0;
+}
+
+void UT_LogsDetailsModel::testConstructor()
+{
+ QVERIFY( mModel );
+}
+
+void UT_LogsDetailsModel::testRowCount()
+{
+ QVERIFY( mModel->rowCount(QModelIndex()) == 5 );
+}
+
+void UT_LogsDetailsModel::testgetNumberToClipboard()
+{
+ HbLineEdit *cliptmp2 = new HbLineEdit(" ");
+
+ cliptmp2->setText(" ");
+ cliptmp2->selectAll();
+ cliptmp2->copy();
+
+ mModel->getNumberToClipboard();
+
+ cliptmp2->setText(" ");
+ cliptmp2->paste();
+
+ QVERIFY( cliptmp2->text() == testDetailsRemoteNum );
+ delete cliptmp2;
+}
+
+void UT_LogsDetailsModel::testData()
+{
+ QVERIFY( mModel->data(QModelIndex(), Qt::DisplayRole).isNull() );
+
+ // Test remote party info
+ QStringList display = mModel->data(mModel->index(0), Qt::DisplayRole).toStringList();
+ QVERIFY( display.count() == 2 );
+ QVERIFY( display.at(1) == testDetailsRemoteNum );
+ QList<QVariant> decoration = mModel->data(mModel->index(0), Qt::DecorationRole).toList();
+ QVERIFY( decoration.count() == 1 );
+
+ // Test date and time
+ display = mModel->data(mModel->index(1), Qt::DisplayRole).toStringList();
+ QVERIFY( display.count() == 2 );
+ QVERIFY( display.at(1) == testDetailsDateAndTime.toTimeSpec(Qt::LocalTime).toString() );
+ decoration = mModel->data(mModel->index(1), Qt::DecorationRole).toList();
+ QVERIFY( decoration.count() == 1 );
+
+ // Test call direction
+ display = mModel->data(mModel->index(2), Qt::DisplayRole).toStringList();
+ QVERIFY( display.count() == 2 );
+ QVERIFY( display.at(1) == mModel->mEvent->directionAsString() );
+ decoration = mModel->data(mModel->index(2), Qt::DecorationRole).toList();
+ QVERIFY( decoration.count() == 1 );
+
+ // Test call type
+ display = mModel->data(mModel->index(3), Qt::DisplayRole).toStringList();
+ QVERIFY( display.count() == 2 );
+ QVERIFY( display.at(1) == mModel->mEvent->typeAsString() );
+ decoration = mModel->data(mModel->index(3), Qt::DecorationRole).toList();
+ QVERIFY( decoration.count() == 1 );
+
+ // Test call duration
+ display = mModel->data(mModel->index(4), Qt::DisplayRole).toStringList();
+ QVERIFY( display.count() == 2 );
+ QTime n(0,0,0);
+ QTime t = n.addSecs(testDetailsDuration);
+ QVERIFY( display.at(1) == t.toString("hh:mm:ss") );
+ decoration = mModel->data(mModel->index(4), Qt::DecorationRole).toList();
+ QVERIFY( decoration.count() == 1 );
+
+ // Test call, event type supports call
+ QVariant callData = mModel->data(mModel->index(0), LogsDetailsModel::RoleCall);
+ LogsCall *call = qVariantValue<LogsCall *>( callData );
+ QVERIFY( call );
+ delete call;
+
+ // Test call, event type does not support call
+ mModel->mEvent->setEventType(LogsEvent::TypeUndefined);
+ QVariant callData2 = mModel->data(mModel->index(0), LogsDetailsModel::RoleCall);
+ LogsCall *call2 = qVariantValue<LogsCall *>( callData2 );
+ QVERIFY( !call2 );
+
+ // Test message
+ QVariant messageData = mModel->data(mModel->index(0), LogsDetailsModel::RoleMessage);
+ LogsMessage* message = qVariantValue<LogsMessage *>( messageData );
+ QVERIFY( message != 0 );
+ delete message;
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "test@1.2.3.4";
+ mModel->mEvent->setLogsEventData( eventData );
+ QVariant messageData2 = mModel->data(mModel->index(0), LogsDetailsModel::RoleMessage);
+ LogsMessage* message2 = qVariantValue<LogsMessage *>( messageData2 );
+ QVERIFY( message2 == 0 );
+
+ // Contact supported
+ QVERIFY( mModel->mEvent->getNumberForCalling().length() > 0 );
+ QVariant contactData = mModel->data(mModel->index(0), LogsDetailsModel::RoleContact);
+ LogsContact *contact = qVariantValue<LogsContact *>( contactData );
+ QVERIFY( contact );
+ delete contact;
+
+ // Contact not supported
+ mModel->mEvent->setNumber("");
+ mModel->mEvent->setLogsEventData( 0 );
+ contactData = mModel->data(mModel->index(0), LogsModel::RoleContact);
+ contact = qVariantValue<LogsContact *>( contactData );
+ QVERIFY( !contact );
+}
+
+void UT_LogsDetailsModel::testHeaderData()
+{
+ QCOMPARE(mModel->headerData(0, Qt::Vertical).toString(),
+ testDetailsRemoteInfo);
+ QVERIFY(mModel->headerData(0, Qt::Vertical, Qt::DecorationRole).isNull());
+}
+
+void UT_LogsDetailsModel::testgetRemoteUri()
+{
+ LogsEvent event;
+ QVERIFY( mModel->getRemoteUri(event) == QString("") );
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "test@1.2.3.4";
+ mModel->mEvent->setLogsEventData( eventData );
+ QVERIFY( mModel->getRemoteUri(*mModel->mEvent) == QString("test@1.2.3.4") );
+}
+
+void UT_LogsDetailsModel::testInitTextsAndIcons()
+{
+ //No VoIP call,no remote url or local url and contactname
+ testDetailsDateAndTime.setTime_t( 3000 );
+ LogsEvent event;
+ event.setRemoteParty( testDetailsRemoteParty );
+ event.setNumber( testDetailsRemoteNum );
+ event.setTime( testDetailsDateAndTime );
+ event.setDirection( testDetailsDirection );
+ event.setEventType( testDetailsEventType );
+ event.setDuration( testDetailsDuration );
+ LogsDetailsModel* model = new LogsDetailsModel(*mDbConnector, event);
+ QVERIFY(model->mDetailIcons.count() == 5);
+ QVERIFY(model->mDetailTexts.count() == 5);
+ delete model;
+ model = 0;
+
+ //No VoIP call,no remote url or local url and no contactname
+ testDetailsDateAndTime.setTime_t( 3000 );
+ event.setRemoteParty( testEmpty );
+ event.setNumber( testDetailsRemoteNum );
+ event.setTime( testDetailsDateAndTime );
+ event.setDirection( testDetailsDirection );
+ event.setEventType( testDetailsEventType );
+ event.setDuration( testDetailsDuration );
+ model = new LogsDetailsModel(*mDbConnector, event);
+ QVERIFY(model->mDetailIcons.count() == 4);
+ QVERIFY(model->mDetailTexts.count() == 4);
+ delete model;
+ model = 0;
+
+ //VoIP call,only remote url,no contact name
+ testDetailsDateAndTime.setTime_t( 3000 );
+ event.setRemoteParty( testEmpty );
+ event.setNumber( testEmpty );
+ event.setTime( testDetailsDateAndTime );
+ event.setDirection( testDetailsDirection );
+ event.setEventType( testDetailsEventType );
+ event.setDuration( testDetailsDuration );
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "tester@100.200.300.400";
+ event.setLogsEventData( eventData );
+ model = new LogsDetailsModel(*mDbConnector, event);
+ QVERIFY(model->mDetailIcons.count() == 4);
+ QVERIFY(model->mDetailTexts.count() == 4);
+ delete model;
+ model = 0;
+
+ //VoIP call,only remote url, contact name
+ testDetailsDateAndTime.setTime_t( 3000 );
+ event.setRemoteParty( testDetailsRemoteParty );
+ event.setNumber( testEmpty );
+ event.setTime( testDetailsDateAndTime );
+ event.setDirection( testDetailsDirection );
+ event.setEventType( testDetailsEventType );
+ event.setDuration( testDetailsDuration );
+ eventData = new LogsEventData;
+ eventData->mRemoteUrl = "tester@100.200.300.400";
+ event.setLogsEventData( eventData );
+ model = new LogsDetailsModel(*mDbConnector, event);
+ QVERIFY(model->mDetailIcons.count() == 5);
+ QVERIFY(model->mDetailTexts.count() == 5);
+ delete model;
+ model = 0;
+
+ //VoIP call,remote uri and local uri, contact name
+ testDetailsDateAndTime.setTime_t( 3000 );
+ event.setRemoteParty( testDetailsRemoteParty );
+ event.setNumber( testEmpty );
+ event.setTime( testDetailsDateAndTime );
+ event.setDirection( testDetailsDirection );
+ event.setEventType( testDetailsEventType );
+ event.setDuration( testDetailsDuration );
+ eventData = new LogsEventData;
+ eventData->mRemoteUrl = "tester@100.200.300.400";
+ eventData->mLocalUrl = "caller@100.200.300.400";
+ event.setLogsEventData( eventData );
+ model = new LogsDetailsModel(*mDbConnector, event);
+ QVERIFY(model->mDetailIcons.count() == 5);
+ QVERIFY(model->mDetailTexts.count() == 5);
+ delete model;
+ model = 0;
+
+ // Missed call, duration is not shown
+ // No VoIP call,no remote url or local url and contactname
+ event.setRemoteParty( testDetailsRemoteParty );
+ event.setNumber( testDetailsRemoteNum );
+ event.setTime( testDetailsDateAndTime );
+ event.setEventType( testDetailsEventType );
+ event.setDirection( LogsEvent::DirMissed );
+ model = new LogsDetailsModel(*mDbConnector, event);
+ QVERIFY(model->mDetailIcons.count() == 4);
+ QVERIFY(model->mDetailTexts.count() == 4);
+ delete model;
+ model = 0;
+}
+
+void UT_LogsDetailsModel::testInitUnseenMissed()
+{
+ LogsDbConnectorStubHelper::reset();
+ testDetailsDateAndTime.setTime_t( 3000 );
+ QString dateAndTimeRowHeading;
+
+ // No duplicates
+ LogsEvent event;
+ event.setRemoteParty( testDetailsRemoteParty );
+ event.setNumber( testDetailsRemoteNum );
+ event.setTime( testDetailsDateAndTime );
+ event.setDirection( LogsEvent::DirMissed );
+ event.setEventType( testDetailsEventType );
+ event.setDuration( testDetailsDuration );
+ LogsDetailsModel* model = new LogsDetailsModel(*mDbConnector, event);
+ QVERIFY(model->mDetailIcons.count() == 4);
+ QVERIFY(model->mDetailTexts.count() == 4);
+ QVERIFY(LogsDbConnectorStubHelper::lastCalledFunction().isEmpty());
+ dateAndTimeRowHeading = model->mDetailTexts.at(1).at(0);
+ delete model;
+ model = 0;
+
+ // Already read
+ event.setIsRead(true);
+ model = new LogsDetailsModel(*mDbConnector, event);
+ QVERIFY(model->mDetailIcons.count() == 4);
+ QVERIFY(model->mDetailTexts.count() == 4);
+ QVERIFY(LogsDbConnectorStubHelper::lastCalledFunction().isEmpty());
+ delete model;
+ model = 0;
+
+ // Not read and duplicates exist
+ event.setIsRead(false);
+ event.setDuplicates(3);
+ model = new LogsDetailsModel(*mDbConnector, event);
+ QVERIFY(model->mDetailIcons.count() == 4);
+ QVERIFY(model->mDetailTexts.count() == 4);
+ QVERIFY(LogsDbConnectorStubHelper::lastCalledFunction() == "readDuplicates" );
+
+ // Reading duplicates completes
+ QSignalSpy spy( model, SIGNAL(modelReset()) );
+ LogsEvent* dup1 = new LogsEvent;
+ model->mDbConnector->mDuplicatedEvents.append(dup1);
+ LogsEvent* dup2 = new LogsEvent;
+ model->mDbConnector->mDuplicatedEvents.append(dup2);
+ model->duplicatesRead();
+ QVERIFY(model->mDetailIcons.count() == 6);
+ QVERIFY(model->mDetailTexts.count() == 6);
+ // When having multiple date and time items, first item has different heading than others
+ QVERIFY( model->mDetailTexts.at(1).at(0) != dateAndTimeRowHeading );
+ QVERIFY( model->mDetailTexts.at(5).at(0) == dateAndTimeRowHeading );
+ delete model;
+ model = 0;
+
+}
+
+void UT_LogsDetailsModel::testGetHeaderData()
+{
+ // No name or number
+ LogsEvent event;
+ QVERIFY( mModel->getHeaderData(event) == hbTrId("txt_dial_dblist_call_id_val_unknown_number") );
+
+ // No name
+ QString num("+12345555");
+ event.setNumber(num);
+ QVERIFY( mModel->getHeaderData(event) == num );
+
+ // No number
+ QString remote("Souuu");
+ event.setRemoteParty(remote);
+ event.setNumber("");
+ QVERIFY( mModel->getHeaderData(event) == remote );
+
+ // Both
+ event.setNumber(num);
+ QVERIFY( mModel->getHeaderData(event) == remote );
+
+ // Only remote url
+ event.setNumber("");
+ event.setRemoteParty("");
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "test@1.2.3.4";
+ event.setLogsEventData( eventData );
+ QVERIFY( mModel->getHeaderData(event) == eventData->mRemoteUrl );
+}
+
+
+void UT_LogsDetailsModel::testGetCallerId()
+{
+ // No name or number
+ LogsEvent event;
+ QVERIFY( mModel->getCallerId(event) == QString("") );
+
+ // No name
+ QString num("+12345555");
+ event.setNumber(num);
+ QVERIFY( mModel->getCallerId(event) == QString("") );
+
+ // No number
+ QString remote("Souuu");
+ event.setRemoteParty(remote);
+ event.setNumber("");
+ QVERIFY( mModel->getCallerId(event) == QString("") );
+
+ // Both
+ event.setNumber(num);
+ QVERIFY( mModel->getCallerId(event) == num );
+
+ //Only number
+ event.setRemoteParty("");
+ QVERIFY( mModel->getCallerId(event) == QString("") );
+
+ // Only remote url
+ event.setNumber("");
+ event.setRemoteParty("contactname");
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "test@1.2.3.4";
+ event.setLogsEventData( eventData );
+ QVERIFY( mModel->getCallerId(event) == eventData->mRemoteUrl );
+}
+
+void UT_LogsDetailsModel::testCreateContact()
+{
+ LogsEvent event;
+ LogsModelItemContainer item(&event);
+ LogsContact* contact = qVariantValue<LogsContact*>(mModel->createContact(item));
+ QVERIFY( !contact );
+
+ LogsEvent event2;
+ event2.setNumber("2145");
+ LogsModelItemContainer item2(&event2);
+ contact = qVariantValue<LogsContact*>(mModel->createContact(item2));
+ QVERIFY( contact );
+ delete contact;
+}
+
+void UT_LogsDetailsModel::testContactActionCompleted()
+{
+ mModel->mDetailTexts.clear();
+ mModel->contactActionCompleted(false);
+ QVERIFY( mModel->mDetailTexts.count() == 0 );
+
+ // No match
+ mModel->mEvent->setRemoteParty( "" );
+ mModel->mEvent->setNumber( "123445" );
+ mModel->contactActionCompleted(true);
+ QVERIFY( mModel->mDetailTexts.count() == 0 );
+ QVERIFY( mModel->mEvent->remoteParty().length() == 0 );
+
+ // Match
+ QtContactsStubsHelper::setContactNames("first", "last");
+ mModel->mEvent->setRemoteParty( "" );
+ mModel->mEvent->setNumber( "11112222" );
+ mModel->contactActionCompleted(true);
+ QVERIFY( mModel->mDetailTexts.count() > 0 );
+ QVERIFY( mModel->mEvent->remoteParty().length() > 0 );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsevent.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsevent.h"
+#include "logsevent.h"
+#include "logseventdata.h"
+#include "qtcontacts_stubs_helper.h"
+#include <logcli.h>
+#include <qcontactmanager.h>
+#include <qcontactname.h>
+
+#include <QtTest/QtTest>
+
+void UT_LogsEvent::initTestCase()
+{
+
+}
+
+void UT_LogsEvent::cleanupTestCase()
+{
+}
+
+
+void UT_LogsEvent::init()
+{
+ mEvent = new LogsEvent();
+}
+
+void UT_LogsEvent::cleanup()
+{
+ delete mEvent;
+ mEvent = 0;
+}
+
+void UT_LogsEvent::testConstructor()
+{
+ QVERIFY( mEvent );
+}
+
+void UT_LogsEvent::testInitializeEventL()
+{
+ CLogEvent* logEvent = 0;
+ QT_TRAP_THROWING( logEvent = CLogEvent::NewL(); )
+
+ // Test number
+ _LIT( eventTestNumber, "123444555" );
+ QString strEventTestNumber = DESC_TO_QSTRING( eventTestNumber() );
+ logEvent->SetNumber( eventTestNumber() );
+ QT_TRAP_THROWING( mEvent->initializeEventL(*logEvent, mStrings); )
+ QVERIFY( mEvent->mNumber == strEventTestNumber );
+}
+
+void UT_LogsEvent::testSetters()
+{
+}
+
+void UT_LogsEvent::testGetters()
+{
+}
+
+void UT_LogsEvent::testValidate()
+{
+ // No num, remote party nor remote url, not valid
+ QVERIFY( !mEvent->validate() );
+
+ // Num, valid
+ mEvent->mNumber = "123454555";
+ QVERIFY( mEvent->validate() );
+
+ // Remote party, valid
+ mEvent->mNumber.clear();
+ mEvent->mRemoteParty = "remotePart";
+ QVERIFY( mEvent->validate() );
+
+ // Remote url, valid
+ mEvent->mRemoteParty.clear();
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "2343425";
+ mEvent->setLogsEventData(eventData);
+ QVERIFY( mEvent->validate() );
+}
+
+void UT_LogsEvent::testGetNumberForCalling()
+{
+ mEvent->mNumber = "123454555";
+ QVERIFY( mEvent->getNumberForCalling() == "123454555" );
+ mEvent->mNumber.clear();
+ QVERIFY( mEvent->getNumberForCalling() == "" );
+ mEvent->mEventType = LogsEvent::TypeVoIPCall;
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "2343425";
+ mEvent->setLogsEventData(eventData);
+ QVERIFY( mEvent->getNumberForCalling() == "2343425" );
+ LogsEventData* eventData2 = new LogsEventData;
+ eventData2->mRemoteUrl = "test@pr.fi";
+ mEvent->setLogsEventData(eventData2);
+ QVERIFY( mEvent->getNumberForCalling() == "test@pr.fi" );
+}
+
+void UT_LogsEvent::testSetContactLocalId()
+{
+ //event data hasn't been created yet
+ QVERIFY( !mEvent->logsEventData() );
+ mEvent->setContactLocalId( 2 );
+ QVERIFY( mEvent->logsEventData() );
+ QVERIFY( mEvent->logsEventData()->contactLocalId() == 2 );
+ QVERIFY( mEvent->contactLocalId() == 2 );
+
+ //event data exists
+ mEvent->setContactLocalId( 3 );
+ QVERIFY( mEvent->logsEventData()->contactLocalId() == 3 );
+ QVERIFY( mEvent->contactLocalId() == 3 );
+
+ //getting contact id with no event data
+ mEvent->setLogsEventData(NULL);
+ QVERIFY( mEvent->contactLocalId() == 0 );
+ QVERIFY( !mEvent->logsEventData() );
+}
+
+void UT_LogsEvent::testUpdateRemotePartyFromContacts()
+{
+ // No search term
+ QContactManager manager;
+ LogsEvent event;
+ QVERIFY( event.updateRemotePartyFromContacts(manager).length() == 0 );
+ QVERIFY( event.remoteParty().length() == 0 );
+
+ // Number as search term, no match
+ event.setNumber("12345");
+ QVERIFY( event.updateRemotePartyFromContacts(manager).length() == 0 );
+ QVERIFY( event.remoteParty().length() == 0 );
+
+ // Number as search term, match
+ QtContactsStubsHelper::setContactNames("first", "last");
+ event.setNumber("11112222");
+ QString newRemoteParty = event.updateRemotePartyFromContacts(manager);
+ QVERIFY( newRemoteParty.length() > 0 );
+ QVERIFY( newRemoteParty == event.remoteParty() );
+
+ // Voip address as search term, no match
+ 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.remoteParty().length() == 0 );
+
+ // Voip address as search term, match
+ eventData->mRemoteUrl = "11112222";
+ newRemoteParty = event2.updateRemotePartyFromContacts(manager);
+ QVERIFY( newRemoteParty.length() > 0 );
+ QVERIFY( newRemoteParty == event.remoteParty() );
+}
+
+void UT_LogsEvent::testParseContactName()
+{
+ LogsEvent event;
+ QtContactsStubsHelper::reset();
+ QContactName name;
+ QtContactsStubsHelper::setContactNames("firstname", "");
+ QVERIFY(event.parseContactName(name) == "firstname");
+
+ QtContactsStubsHelper::setContactNames("firstname", "lastname");
+ QVERIFY(event.parseContactName(name) == "firstname lastname");
+
+ QtContactsStubsHelper::setContactNames("", "lastname");
+ QVERIFY(event.parseContactName(name) == "lastname");
+
+ QtContactsStubsHelper::setContactNames("", "");
+ QVERIFY(event.parseContactName(name) == "");
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logseventdata.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* 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 <logeng.h>
+#include <QtTest/QtTest>
+
+#include "ut_logseventdata.h"
+#include "logseventdata.h"
+#include "logsapiconsts.h"
+
+
+void UT_LogsEventData::initTestCase()
+{
+
+}
+
+void UT_LogsEventData::cleanupTestCase()
+{
+}
+
+
+void UT_LogsEventData::init()
+{
+ mEventData = new LogsEventData();
+}
+
+void UT_LogsEventData::cleanup()
+{
+ delete mEventData;
+ mEventData = 0;
+}
+
+void UT_LogsEventData::testConstructor()
+{
+ QVERIFY( mEventData );
+}
+
+void UT_LogsEventData::testParse()
+{
+
+}
+
+void UT_LogsEventData::testSetters()
+{
+
+}
+
+void UT_LogsEventData::testGetters()
+{
+ QVERIFY( mEventData->remoteUrl().isEmpty() );
+ QString remote( "te@1.2.3.4" );
+ mEventData->mRemoteUrl = remote;
+ QVERIFY( mEventData->remoteUrl() == remote );
+
+ QVERIFY( mEventData->localUrl().isEmpty() );
+ QString local( "tetetetet@2.2.3.4" );
+ mEventData->mLocalUrl = local;
+ QVERIFY( mEventData->localUrl() == local );
+}
+
+void UT_LogsEventData::testIsCsCompatible()
+{
+ // No url, compatible
+ QVERIFY( mEventData->isCsCompatible() );
+
+ // Url has only digits, compatible
+ mEventData->mRemoteUrl = "1234555662";
+ QVERIFY( mEventData->isCsCompatible() );
+
+ // Url has only digits and + at beginning, compatible
+ mEventData->mRemoteUrl = "+00634555662";
+ QVERIFY( mEventData->isCsCompatible() );
+
+ // Url has non-digit, not compatible
+ mEventData->mRemoteUrl = "006345+55662";
+ QVERIFY( !mEventData->isCsCompatible() );
+
+ mEventData->mRemoteUrl = "006345@55662";
+ QVERIFY( !mEventData->isCsCompatible() );
+
+ mEventData->mRemoteUrl = "test";
+ QVERIFY( !mEventData->isCsCompatible() );
+
+ mEventData->mRemoteUrl = "test@1.2.3.4";
+ QVERIFY( !mEventData->isCsCompatible() );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsfilter.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsfilter.h"
+#include "logsfilter.h"
+#include "logsmodel.h"
+#include "logsevent.h"
+#include "logscommondata.h"
+
+#include <QtTest/QtTest>
+
+void UT_LogsFilter::initTestCase()
+{
+ mFilter = new LogsFilter();
+}
+
+void UT_LogsFilter::cleanupTestCase()
+{
+ delete mFilter;
+ mFilter = 0;
+}
+
+
+void UT_LogsFilter::init()
+{
+
+}
+
+void UT_LogsFilter::cleanup()
+{
+
+}
+
+void UT_LogsFilter::testConstructor()
+{
+ QVERIFY( mFilter );
+ LogsFilter* filt = new LogsFilter( LogsFilter::Received );
+ QVERIFY( filt->filterType() == LogsFilter::Received );
+ delete filt;
+}
+
+void UT_LogsFilter::testFilterAcceptsRow()
+{
+ // No source model
+ QVERIFY( mFilter->filterAcceptsRow(0, QModelIndex()) == false );
+
+ LogsModel* logsModel = new LogsModel();
+ mFilter->setSourceModel(logsModel);
+
+ // No any events
+ QVERIFY( mFilter->filterAcceptsRow(0, QModelIndex()) == false );
+
+ // Matching event ("accept all" filter)
+ LogsEvent* event = new LogsEvent;
+ logsModel->mEvents.append(event);
+ QVERIFY( mFilter->filterAcceptsRow(0, QModelIndex()) == true );
+
+ // Matching event ("accept received" filter)
+ mFilter->mFilterType = LogsFilter::Received;
+ LogsEvent* event2 = new LogsEvent();
+ event2->setDirection(LogsEvent::DirIn);
+ logsModel->mEvents.append(event2);
+ QVERIFY( mFilter->filterAcceptsRow(1, QModelIndex()) == true );
+
+ // Not mathing event ("accept received" filter)
+ QVERIFY( mFilter->filterAcceptsRow(0, QModelIndex()) == false );
+
+ // Called filter
+ mFilter->mFilterType = LogsFilter::Called;
+ QVERIFY( mFilter->filterAcceptsRow(1, QModelIndex()) == false );
+ event2->setDirection(LogsEvent::DirOut);
+ QVERIFY( mFilter->filterAcceptsRow(1, QModelIndex()) == true );
+
+ // Missed filter
+ mFilter->mFilterType = LogsFilter::Missed;
+ QVERIFY( mFilter->filterAcceptsRow(1, QModelIndex()) == false );
+ event2->setDirection(LogsEvent::DirMissed);
+ QVERIFY( mFilter->filterAcceptsRow(1, QModelIndex()) == true );
+
+ // Unknown filter
+ mFilter->mFilterType = (LogsFilter::FilterType)999;
+ QVERIFY( mFilter->filterAcceptsRow(1, QModelIndex()) == false );
+}
+
+void UT_LogsFilter::testClearType()
+{
+
+ LogsModel* logsModel = new LogsModel();
+ mFilter->setSourceModel(logsModel);
+
+ // No any events
+ QVERIFY( mFilter->clearType() == LogsModel::TypeLogsClearAll );
+
+ // Matching event ("accept all" filter)
+ LogsEvent* event = new LogsEvent;
+ logsModel->mEvents.append(event);
+ QVERIFY( mFilter->clearType() == LogsModel::TypeLogsClearAll );
+
+ // Matching event ("accept received" filter)
+ mFilter->mFilterType = LogsFilter::Received;
+ LogsEvent* event2 = new LogsEvent();
+ event2->setDirection(LogsEvent::DirIn);
+ logsModel->mEvents.append(event2);
+ QVERIFY( mFilter->clearType() == LogsModel::TypeLogsClearReceived );
+
+ // Not mathing event ("accept received" filter)
+ QVERIFY( mFilter->filterAcceptsRow(0, QModelIndex()) == false );
+
+ // Called filter
+ mFilter->mFilterType = LogsFilter::Called;
+ QVERIFY( mFilter->filterAcceptsRow(1, QModelIndex()) == false );
+ event2->setDirection(LogsEvent::DirOut);
+ QVERIFY( mFilter->clearType() == LogsModel::TypeLogsClearCalled );
+
+ // Missed filter
+ mFilter->mFilterType = LogsFilter::Missed;
+ QVERIFY( mFilter->filterAcceptsRow(1, QModelIndex()) == false );
+ event2->setDirection(LogsEvent::DirMissed);
+ QVERIFY( mFilter->clearType() == LogsModel::TypeLogsClearMissed );
+
+ // Unknown filter
+ mFilter->mFilterType = (LogsFilter::FilterType)999;
+ QVERIFY( mFilter->clearType() == LogsModel::TypeLogsClearAll );
+}
+
+void UT_LogsFilter::testSetMaxSize()
+{
+ // Max size for all
+ mFilter->mFilterType = LogsFilter::All;
+ mFilter->setMaxSize(10);
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == 10 );
+ QVERIFY( LogsCommonData::getInstance().maxReadSizeDirection() == LogsEvent::DirUndefined );
+
+ // Max size for missed
+ mFilter->mFilterType = LogsFilter::Missed;
+ mFilter->setMaxSize(5);
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == 5 );
+ QVERIFY( LogsCommonData::getInstance().maxReadSizeDirection() == LogsEvent::DirMissed );
+
+ // Max size for called
+ mFilter->mFilterType = LogsFilter::Called;
+ mFilter->setMaxSize(100);
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == 100 );
+ QVERIFY( LogsCommonData::getInstance().maxReadSizeDirection() == LogsEvent::DirOut );
+
+ // Max size for received
+ mFilter->mFilterType = LogsFilter::Received;
+ mFilter->setMaxSize(8);
+ QVERIFY( LogsCommonData::getInstance().maxReadSize() == 8 );
+ QVERIFY( LogsCommonData::getInstance().maxReadSizeDirection() == LogsEvent::DirIn );
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmatchesmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,687 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsmatchesmodel.h"
+#include "logsmodel.h"
+#include "logsmatchesmodel.h"
+#include "logsevent.h"
+#include "logscall.h"
+#include "logscontact.h"
+#include "logsdetailsmodel.h"
+#include "logsmessage.h"
+#include "logseventdata.h"
+#include "qtcontacts_stubs_helper.h"
+#include "logscntfinder.h"
+#include "logsdbconnector_stub_helper.h"
+
+#include <QtTest/QtTest>
+
+Q_DECLARE_METATYPE(LogsEvent *)
+Q_DECLARE_METATYPE(LogsCall *)
+Q_DECLARE_METATYPE(LogsDetailsModel *)
+Q_DECLARE_METATYPE(LogsMessage *)
+Q_DECLARE_METATYPE(LogsContact *)
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::initTestCase()
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::cleanupTestCase()
+{
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::init()
+{
+ mModel = new LogsModel();
+ LogsDbConnectorStubHelper::setPredictiveSearch(1);
+ mMatchesModel = mModel->logsMatchesModel();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::cleanup()
+{
+ delete mMatchesModel;
+ mMatchesModel = 0;
+ delete mModel;
+ mModel = 0;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testConstructor()
+{
+ // Predictive search is on
+ QVERIFY( mMatchesModel );
+ QVERIFY( mMatchesModel->mSearchEnabled );
+ QVERIFY( mMatchesModel->mIconManager );
+ QVERIFY( mMatchesModel->mLogsCntFinder );
+
+ // Predictive search is off
+ delete mMatchesModel;
+ mMatchesModel = 0;
+ LogsDbConnectorStubHelper::setPredictiveSearch(2);
+ mMatchesModel = mModel->logsMatchesModel();
+ QVERIFY( mMatchesModel );
+ QVERIFY( !mMatchesModel->mSearchEnabled );
+ QVERIFY( mMatchesModel->mIconManager );
+ QVERIFY( mMatchesModel->mLogsCntFinder );
+
+ // Predictive search status fetching failure=> assume that search is on
+ delete mMatchesModel;
+ mMatchesModel = 0;
+ LogsDbConnectorStubHelper::setPredictiveSearch(-1);
+ mMatchesModel = mModel->logsMatchesModel();
+ QVERIFY( mMatchesModel );
+ QVERIFY( mMatchesModel->mSearchEnabled );
+ QVERIFY( mMatchesModel->mIconManager );
+ QVERIFY( mMatchesModel->mLogsCntFinder );
+
+ // Predictive search is permanently disabled
+ delete mMatchesModel;
+ mMatchesModel = 0;
+ LogsDbConnectorStubHelper::setPredictiveSearch(0);
+ mMatchesModel = mModel->logsMatchesModel();
+ QVERIFY( mMatchesModel );
+ QVERIFY( !mMatchesModel->mIconManager );
+ QVERIFY( !mMatchesModel->mLogsCntFinder );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testRowCount()
+{
+ QVERIFY( mMatchesModel->mIconManager );
+ QVERIFY( mMatchesModel->rowCount(QModelIndex()) == 0 );
+ LogsMatchesModelItemContainer* item = new LogsMatchesModelItemContainer(
+ *mModel, *mMatchesModel->mIconManager, 0);
+ mMatchesModel->mMatches.append(item);
+ QVERIFY( mMatchesModel->rowCount(QModelIndex()) == 0 );
+
+ mMatchesModel->mResultCount = 1;
+ QVERIFY( mMatchesModel->rowCount(QModelIndex()) == 1 );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testData()
+{
+ QVERIFY( mMatchesModel->mLogsCntFinder );
+ QVERIFY( mMatchesModel->mIconManager );
+ QVERIFY( mModel->data(QModelIndex(), Qt::DisplayRole).isNull() );
+
+ // Setup search results
+ LogsCntEntry* entry = new LogsCntEntry(*this, 0);
+ entry->setFirstName("Testing");
+ mMatchesModel->mLogsCntFinder->mResults.append(entry);
+ quint32 contactId = 2;
+ entry = new LogsCntEntry(contactId);
+ mMatchesModel->mLogsCntFinder->mResults.append(entry);
+ quint32 contactId2 = 3;
+ entry = new LogsCntEntry(contactId2);
+ mMatchesModel->mLogsCntFinder->mResults.append(entry);
+
+ LogsMatchesModelItemContainer* item = new LogsMatchesModelItemContainer(
+ *mModel, *mMatchesModel->mIconManager, 0);
+ LogsEvent event;
+ event.setRemoteParty( "Testing" );
+ item->setEvent(event);
+ item->mFormattedCallerId = "formattedCallerId";
+ mMatchesModel->mMatches.append(item);
+
+ QtContactsStubsHelper::setContactId(contactId);
+ LogsMatchesModelItemContainer* item2 = new LogsMatchesModelItemContainer(
+ *mModel, *mMatchesModel->mIconManager, 1);
+ mMatchesModel->mMatches.append(item2);
+
+ mMatchesModel->mResultCount = 2;
+
+ // Display data for event match
+ QVariant displayData = mMatchesModel->data(mMatchesModel->index(0), Qt::DisplayRole);
+ QVERIFY ( displayData.type() == QVariant::StringList );
+ QStringList list = displayData.toStringList();
+ QVERIFY( list.count() == 2 );
+ QVERIFY( list.at(0) == "formattedCallerId" );
+
+ // Display data for contact match, getting it first time which causes
+ // that data is fetched from contact
+ QtContactsStubsHelper::setContactNames("first", "last");
+ QVERIFY( mMatchesModel->mMatches.at(1)->mContactId == 0 );
+ displayData = mMatchesModel->data(mMatchesModel->index(1), Qt::DisplayRole);
+ QVERIFY ( displayData.type() == QVariant::StringList );
+ list = displayData.toStringList();
+ QVERIFY( list.count() == 2 );
+ QVERIFY( list.at(0).length() > 0 && list.at(0) != "Testing" );
+ QVERIFY( mMatchesModel->mMatches.at(1)->mContactId == contactId );
+
+ // Data asked again for same item, optimized
+ item2->mContactName = "formattedName";
+ item2->mContactNumber = "formattedNumber";
+ displayData = mMatchesModel->data(mMatchesModel->index(1), Qt::DisplayRole);
+ QVERIFY ( displayData.type() == QVariant::StringList );
+ QStringList list2 = displayData.toStringList();
+ QVERIFY( list2.count() == 2 );
+ QVERIFY( list2.at(0) == "formattedName" );
+ QVERIFY( list2.at(1) == "formattedNumber" );
+
+ // Decoration data for event match
+ QVariant decorationData = mMatchesModel->data(mMatchesModel->index(0), Qt::DecorationRole);
+ QVERIFY ( decorationData.canConvert< QList<QVariant> >() );
+
+ //create and save contact
+ QContact c;
+ QVariant ret;
+ QtContactsStubsHelper::setContactId(contactId2);
+ LogsMatchesModelItemContainer* item3 = new LogsMatchesModelItemContainer(
+ *mModel, *mMatchesModel->mIconManager, 2);
+ item3->setContact(contactId2);
+ mMatchesModel->mMatches.append(item3);
+
+ mMatchesModel->mResultCount = 3;
+
+ ret = mMatchesModel->data(mMatchesModel->index(2), Qt::DecorationRole);
+ QVERIFY(ret.type() == QVariant::List);
+
+ //
+ ret = mMatchesModel->data(mMatchesModel->index(2), Qt::DecorationRole);
+ QVERIFY(ret.type() == QVariant::List);
+ //
+ ret = mMatchesModel->data(mMatchesModel->index(2), Qt::DecorationRole);
+ QVERIFY(ret.type() == QVariant::List);
+
+ ret = mMatchesModel->data(mMatchesModel->index(2), Qt::DecorationRole);
+ QVERIFY(ret.type() == QVariant::List);
+
+ // Details model for logs event
+ QVariant details = mMatchesModel->data(mMatchesModel->index(0), LogsMatchesModel::RoleDetailsModel);
+ LogsDetailsModel *detailsModel = qVariantValue<LogsDetailsModel *>( details );
+ QVERIFY( detailsModel );
+ delete detailsModel;
+ detailsModel = 0;
+
+ //Details model for contact match is null
+ details = mMatchesModel->data(mMatchesModel->index(1), LogsMatchesModel::RoleDetailsModel);
+ detailsModel = qVariantValue<LogsDetailsModel *>( details );
+ QVERIFY( !detailsModel );
+ delete detailsModel;
+
+ // Data asked first time for event, no result container exist yet -> it will be created
+ qDeleteAll( mMatchesModel->mMatches );
+ mMatchesModel->mMatches.clear();
+ displayData = mMatchesModel->data(mMatchesModel->index(0), Qt::DisplayRole);
+ QVERIFY ( displayData.type() == QVariant::StringList );
+ QCOMPARE( mMatchesModel->mMatches.count(), 1 );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testDataAdded()
+{
+ QVERIFY( mMatchesModel->mLogsCntFinder );
+ QVERIFY( mMatchesModel->mIconManager );
+ // One event added
+ LogsMatchesModelItemContainer* item = new LogsMatchesModelItemContainer(
+ *mModel, *mMatchesModel->mIconManager, 0);
+ mMatchesModel->mMatches.append(item);
+ LogsEvent* event = new LogsEvent();
+ mModel->mEvents.append(event);
+ mMatchesModel->eventsAdded(QModelIndex(), 0, 0);
+ QVERIFY( mMatchesModel->mSearchEvents.count() == 1 );
+ QVERIFY( mMatchesModel->mMatches.count() == 0 ); // cleared because of new events
+ QVERIFY( mMatchesModel->mPrevSearchPattern.isEmpty() ); // Must be emptied, otherwise requery would not occur
+
+ // Two more sequnetial events added
+ item = new LogsMatchesModelItemContainer(
+ *mModel, *mMatchesModel->mIconManager, 1);
+ mMatchesModel->mMatches.append(item);
+ LogsEvent* event2 = new LogsEvent();
+ LogsEvent* event3 = new LogsEvent();
+ mModel->mEvents.insert(0, event2);
+ mModel->mEvents.insert(0, event3);
+ mMatchesModel->eventsAdded(QModelIndex(), 0, 1);
+ QVERIFY( mMatchesModel->mSearchEvents.count() == 3 );
+ QVERIFY( mMatchesModel->mMatches.count() == 0 ); // cleared because of new events
+ QVERIFY( mMatchesModel->mPrevSearchPattern.isEmpty() ); // Must be emptied, otherwise requery would not occur
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testDataUpdated()
+{
+ QVERIFY( mMatchesModel->mLogsCntFinder );
+ QVERIFY( mMatchesModel->mIconManager );
+ // Nothing to update
+ LogsMatchesModelItemContainer* item = new LogsMatchesModelItemContainer(
+ *mModel, *mMatchesModel->mIconManager, 0);
+ mMatchesModel->mMatches.append(item);
+ mMatchesModel->eventsUpdated(mModel->index(0), mModel->index(0));
+ QVERIFY( mMatchesModel->mMatches.count() == 1 ); // not cleared because nothing was updated
+
+ // Search event to update
+ LogsEvent* event = new LogsEvent();
+ mModel->mEvents.append(event);
+ mMatchesModel->eventsAdded(QModelIndex(), 0, 0);
+ mMatchesModel->eventsUpdated(mModel->index(0), mModel->index(0));
+ QVERIFY( mMatchesModel->mSearchEvents.count() == 1 );
+ QVERIFY( mMatchesModel->mMatches.count() == 0 ); // cleared because of updated events
+ QVERIFY( mMatchesModel->mPrevSearchPattern.isEmpty() ); // Must be emptied, otherwise requery would not occur
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testDataRemoved()
+{
+ QVERIFY( mMatchesModel->mLogsCntFinder );
+ QVERIFY( mMatchesModel->mIconManager );
+ // Nothing to remove
+ LogsMatchesModelItemContainer* item = new LogsMatchesModelItemContainer(
+ *mModel, *mMatchesModel->mIconManager, 1);
+ mMatchesModel->mMatches.append(item);
+ mMatchesModel->eventsRemoved(QModelIndex(), 0, 0);
+ QVERIFY( mMatchesModel->mMatches.count() == 1 ); // not cleared because nothing was removed
+
+ // Existing search event removed
+ LogsEvent* event = new LogsEvent();
+ mModel->mEvents.append(event);
+ mMatchesModel->eventsAdded(QModelIndex(), 0, 0);
+ mMatchesModel->eventsRemoved(QModelIndex(), 0, 0);
+ QVERIFY( mMatchesModel->mSearchEvents.count() == 0 ); // cleared because of removed events
+ QVERIFY( mMatchesModel->mMatches.count() == 0 ); // cleared because of removed events
+ QVERIFY( mMatchesModel->mPrevSearchPattern.isEmpty() ); // Must be emptied, otherwise requery would not occur
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testLogsMatches()
+{
+ QVERIFY( mMatchesModel->mLogsCntFinder );
+ QVERIFY( mMatchesModel->mIconManager );
+ QVERIFY( mMatchesModel->mSearchEnabled );
+ // Query ready when no matching search events
+ QSignalSpy spy(mMatchesModel, SIGNAL(modelReset()));
+
+ mMatchesModel->logsMatches( "3" );
+ mMatchesModel->doSearchQuery(); // simulate async completion
+ LogsCntEntry* entry = new LogsCntEntry(*this, 0);
+ mMatchesModel->mLogsCntFinder->mResults.append(entry);
+ mMatchesModel->queryReady();
+ QVERIFY( mMatchesModel->mPrevSearchPattern == "3" );
+ QVERIFY( mMatchesModel->mCurrentSearchPattern == "3" );
+ QVERIFY( spy.count() == 1 );
+ QVERIFY( mMatchesModel->mResultCount == 1 );
+
+ // Query ready when matching search events
+ LogsEvent* event = new LogsEvent();
+ mModel->mEvents.append(event);
+ mMatchesModel->eventsAdded(QModelIndex(), 0, 0); // Causes immediate reset
+ mMatchesModel->logsMatches( "4" );
+ mMatchesModel->doSearchQuery(); // simulate async completion
+ mMatchesModel->mLogsCntFinder->mResults.append(
+ new LogsCntEntry(*mMatchesModel->mLogsCntFinder->mHistoryEvents.at(0)));
+ mMatchesModel->queryReady();
+ QVERIFY( spy.count() == 3 );
+ QVERIFY( mMatchesModel->mMatches.count() == 0 ); // Matches not added until data is asked
+ QVERIFY( mMatchesModel->mResultCount == 1 );
+
+ // Query ready with both event and contact matches
+ mMatchesModel->logsMatches( "5" );
+ mMatchesModel->doSearchQuery(); // simulate async completion
+ mMatchesModel->mLogsCntFinder->mResults.append(
+ new LogsCntEntry(*mMatchesModel->mLogsCntFinder->mHistoryEvents.at(0)));
+ mMatchesModel->mLogsCntFinder->mResults.append( new LogsCntEntry(2) );
+ mMatchesModel->queryReady();
+ QVERIFY( spy.count() == 4 );
+ QVERIFY( mMatchesModel->mMatches.count() == 0 ); // Matches not added until data is asked
+ QVERIFY( mMatchesModel->mResultCount == 2 );
+
+ // Query ready without any matches
+ mMatchesModel->logsMatches( "377778877" );
+ mMatchesModel->doSearchQuery(); // simulate async completion
+ qDeleteAll(mMatchesModel->mLogsCntFinder->mResults);
+ mMatchesModel->mLogsCntFinder->mResults.clear();
+ mMatchesModel->queryReady();
+ QVERIFY( spy.count() == 5 );
+ QVERIFY( mMatchesModel->mMatches.count() == 0 );
+ QVERIFY( mMatchesModel->mResultCount == 0 );
+
+ // Test rapid queries, only last one should be done once async calls complete
+ mMatchesModel->logsMatches( "1" );
+ QVERIFY( mMatchesModel->mCurrentSearchPattern == "1" );
+ QVERIFY( mMatchesModel->mPrevSearchPattern != "1" );
+ mMatchesModel->logsMatches( "12" );
+ QVERIFY( mMatchesModel->mCurrentSearchPattern == "12" );
+ QVERIFY( mMatchesModel->mPrevSearchPattern != "12" );
+ mMatchesModel->logsMatches( "123" );
+ QVERIFY( mMatchesModel->mCurrentSearchPattern == "123" );
+ QVERIFY( mMatchesModel->mPrevSearchPattern != "123" );
+
+ mMatchesModel->doSearchQuery(); // simulate async completion
+ QVERIFY( mMatchesModel->mPrevSearchPattern == "123" );
+ QVERIFY( mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern == "123" );
+
+ mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern.clear(); // Check that same query is not made many times
+ mMatchesModel->doSearchQuery(); // simulate async completion
+ QVERIFY( mMatchesModel->mPrevSearchPattern == "123" );
+ QVERIFY( mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern.isEmpty() );
+
+ mMatchesModel->doSearchQuery(); // simulate async completion
+ QVERIFY( mMatchesModel->mPrevSearchPattern == "123" );
+ QVERIFY( mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern.isEmpty() );
+
+ // Search is Off, current pattern updated, but no search happens
+ mMatchesModel->mSearchEnabled = false;
+ mMatchesModel->mPrevSearchPattern = "1";
+ mMatchesModel->mCurrentSearchPattern = "2";
+ mMatchesModel->logsMatches( "199" );
+ QVERIFY( mMatchesModel->mPrevSearchPattern == "1" );
+ QVERIFY( mMatchesModel->mCurrentSearchPattern == "199" );
+ QVERIFY( mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern.isEmpty() );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testCreateContactWithNumber()
+{
+ LogsContact* contact = 0;
+ contact = mMatchesModel->createContact("123");
+ QVERIFY(contact);
+ QVERIFY(contact->isContactRequestAllowed());
+ delete contact;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testCreateCall()
+{
+ // With event
+ LogsMatchesModelItemContainer item(*mModel, *mMatchesModel->mIconManager, 0);
+ LogsEvent event;
+ event.setEventType(LogsEvent::TypeVoiceCall);
+ event.setNumber( "1234" );
+ item.setEvent(event);
+ QVariant var = mMatchesModel->createCall(item);
+ LogsCall *call = qVariantValue<LogsCall *>( var );
+ QVERIFY( call );
+ delete call;
+
+ // With contact, calling not supported
+ LogsMatchesModelItemContainer item2(*mModel, *mMatchesModel->mIconManager, 1);
+ var = mMatchesModel->createCall(item2);
+ call = qVariantValue<LogsCall *>( var );
+ QVERIFY( !call );
+
+ // With contact, calling supported
+ LogsMatchesModelItemContainer item3(*mModel, *mMatchesModel->mIconManager, 2);
+ item3.setContact(2);
+ var = mMatchesModel->createCall(item3);
+ call = qVariantValue<LogsCall *>( var );
+ QVERIFY( call );
+ delete call;
+
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testCreateMessage()
+{
+ // With event
+ LogsMatchesModelItemContainer item(*mModel, *mMatchesModel->mIconManager, 0);
+ LogsEvent event;
+ event.setNumber( "1234" );
+ item.setEvent(event);
+ QVariant var = mMatchesModel->createMessage(item);
+ LogsMessage *message = qVariantValue<LogsMessage *>( var );
+ QVERIFY( message );
+ delete message;
+
+ // With contact, messaging not supported
+ LogsMatchesModelItemContainer item2(*mModel, *mMatchesModel->mIconManager, 1);
+ var = mMatchesModel->createMessage(item2);
+ message = qVariantValue<LogsMessage *>( var );
+ QVERIFY( !message );
+
+ // With contact, messaging supported
+ LogsMatchesModelItemContainer item3(*mModel, *mMatchesModel->mIconManager, 2);
+ item3.setContact(2);
+ var = mMatchesModel->createMessage(item3);
+ message = qVariantValue<LogsMessage *>( var );
+ QVERIFY( message );
+ delete message;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testCreateContact()
+{
+ // With event
+ LogsMatchesModelItemContainer item(*mModel, *mMatchesModel->mIconManager, 0);
+ LogsEvent event;
+ event.setEventType(LogsEvent::TypeVoiceCall);
+ event.setNumber( "1234" );
+ item.setEvent(event);
+ QVariant var = mMatchesModel->createContact(item);
+ LogsContact *contact = qVariantValue<LogsContact *>( var );
+ QVERIFY( contact );
+ delete contact;
+ contact = 0;
+
+ // With contact
+ LogsMatchesModelItemContainer item2(*mModel, *mMatchesModel->mIconManager, 1);
+ item2.setContact(2);
+ var = mMatchesModel->createContact(item2);
+ contact = qVariantValue<LogsContact *>( var );
+ QVERIFY( contact );
+ delete contact;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testUpdateSearchEntry()
+{
+ // Remote name exists
+ LogsEvent event1;
+ event1.setRemoteParty("someparty");
+ LogsCntEntry entry1(0);
+ mMatchesModel->updateSearchEntry(entry1, event1);
+ QVERIFY( entry1.firstName().at(0).text() == "someparty" );
+ QVERIFY( entry1.phoneNumber().text() == "" );
+
+ // Only number exists
+ LogsEvent event2;
+ event2.setNumber("55556666");
+ LogsCntEntry entry2(0);
+ mMatchesModel->updateSearchEntry(entry2, event2);
+ QVERIFY( entry2.firstName().at(0).text() == "" );
+ QVERIFY( entry2.phoneNumber().text() == "55556666" );
+
+ // Only number starting with '+' exists
+ LogsEvent event3;
+ event3.setNumber("+77776666");
+ LogsCntEntry entry3(0);
+ mMatchesModel->updateSearchEntry(entry3, event3);
+ QVERIFY( entry3.firstName().at(0).text() == "" );
+ QVERIFY( entry3.phoneNumber().text() == "77776666" );
+
+ // VoIP event with CS compatible url
+ LogsEvent event4;
+ event4.setEventType(LogsEvent::TypeVoIPCall);
+ LogsEventData* eventData1 = new LogsEventData();
+ eventData1->mRemoteUrl = "444222111";
+ event4.setLogsEventData(eventData1);
+ LogsCntEntry entry4(0);
+ mMatchesModel->updateSearchEntry(entry4, event4);
+ QVERIFY( entry4.firstName().at(0).text() == "" );
+ QVERIFY( entry4.phoneNumber().text() == "444222111" );
+
+ // VoIP event without CS compatible url
+ LogsEvent event5;
+ event5.setEventType(LogsEvent::TypeVoIPCall);
+ LogsEventData* eventData2 = new LogsEventData();
+ eventData2->mRemoteUrl = "testing@test.com";
+ event5.setLogsEventData(eventData2);
+ LogsCntEntry entry5(0);
+ mMatchesModel->updateSearchEntry(entry5, event5);
+ QVERIFY( entry5.firstName().at(0).text() == "testing@test.com" );
+ QVERIFY( entry5.phoneNumber().text() == "" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testGetFormattedCallerId()
+{
+ QVERIFY( mMatchesModel->mIconManager );
+ // Entry is not initialized, caller Id is empty
+ LogsCntEntry entry(0);
+ LogsMatchesModelItemContainer item(*mModel, *mMatchesModel->mIconManager, 0);
+ QVERIFY( item.getFormattedCallerId(entry).length() == 0 );
+
+ // Entry is initialized, firstname is preffered over other data
+ entry.setFirstName(" long firstname");
+ entry.setLastName("verylong lastname");
+ entry.setPhoneNumber(" number");
+ QString callerId = item.getFormattedCallerId(entry);
+ QVERIFY( callerId == "long firstname" );
+
+ // Firstname is missing, phone number is used
+ entry.setFirstName("");
+ callerId = item.getFormattedCallerId(entry);
+ QVERIFY( callerId == "number" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testGetFormattedContactInfo()
+{
+ QString name;
+ QString number;
+ QVERIFY( mMatchesModel->mIconManager );
+
+ // Entry is not initialized, name and number are empty
+ LogsCntEntry entry(0);
+ LogsMatchesModelItemContainer item(*mModel, *mMatchesModel->mIconManager, 0);
+ item.getFormattedContactInfo(entry, name, number);
+ QVERIFY( name.length() == 0 && number.length() == 0 );
+
+ // Entry is initialized, name and number are not empty
+ entry.setFirstName("long firstname");
+ entry.setLastName("long lastname");
+ entry.setPhoneNumber("number");
+ item.getFormattedContactInfo(entry, name, number);
+ QVERIFY( name == "long firstname long lastname" );
+ QVERIFY( number == "number" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testPredictiveSearchStatus()
+{
+ LogsDbConnectorStubHelper::reset();
+ QVERIFY( mMatchesModel->predictiveSearchStatus() == 0 );
+ QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "predictiveSearchStatus" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_LogsMatchesModel::testSetPredictiveSearch()
+{
+ QVERIFY( mMatchesModel->mLogsCntFinder );
+ QVERIFY( mMatchesModel->mIconManager );
+ QVERIFY( mMatchesModel->mSearchEnabled );
+ // Predictive search is permanently off in cenrep, setting the value fails
+ LogsDbConnectorStubHelper::reset();
+ QVERIFY( mMatchesModel->setPredictiveSearch(false) != 0 );
+ QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "setPredictiveSearch" );
+ QVERIFY( mMatchesModel->mSearchEnabled );
+
+ // Turning off is ok, search results are reset
+ mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern = "9";
+ LogsMatchesModelItemContainer* item = new LogsMatchesModelItemContainer(
+ *mModel, *mMatchesModel->mIconManager, 0);
+ mMatchesModel->mMatches.append(item);
+ mMatchesModel->mPrevSearchPattern = "123";
+ mMatchesModel->mCurrentSearchPattern = "567";
+ LogsDbConnectorStubHelper::setPredictiveSearch(1);
+ QVERIFY( mMatchesModel->setPredictiveSearch(false) == 0 );
+ QVERIFY( !mMatchesModel->mSearchEnabled );
+ QVERIFY( mMatchesModel->mMatches.count() == 0 );
+ QVERIFY( mMatchesModel->mPrevSearchPattern.isEmpty() );
+ QVERIFY( mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern == "9" );
+
+ // Turning search on, search results are updated
+ mMatchesModel->mPrevSearchPattern = "123";
+ mMatchesModel->mCurrentSearchPattern = "567";
+ QVERIFY( mMatchesModel->setPredictiveSearch(true) == 0 );
+ QVERIFY( mMatchesModel->mPrevSearchPattern.isEmpty() );
+ QVERIFY( mMatchesModel->mSearchEnabled );
+ mMatchesModel->doSearchQuery(); // simulate async completion
+ QVERIFY( mMatchesModel->mPrevSearchPattern == "567" );
+ QVERIFY( mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern == "567" );
+
+
+ // Turning search on, when it is already on => nothing happens
+ mMatchesModel->mCurrentSearchPattern = "777";
+ QVERIFY( mMatchesModel->setPredictiveSearch(true) == 0 );
+ QVERIFY( mMatchesModel->mSearchEnabled );
+ QVERIFY( mMatchesModel->mPrevSearchPattern == "567" );
+ QVERIFY( mMatchesModel->mLogsCntFinder->mCurrentPredictivePattern == "567" );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmessage.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsmessage.h"
+#include "logsmessage.h"
+#include "logsevent.h"
+#include "logseventdata.h"
+#include "qthighway_stub_helper.h"
+
+#include <QtTest/QtTest>
+
+void UT_LogsMessage::initTestCase()
+{
+}
+
+void UT_LogsMessage::cleanupTestCase()
+{
+}
+
+
+void UT_LogsMessage::init()
+{
+ mLogsEvent = new LogsEvent();
+ mLogsEvent->setNumber(QString::number(12345));
+ mLogsEvent->setEventType(LogsEvent::TypeVoiceCall);
+ mLogsMessage = new LogsMessage(*mLogsEvent);
+}
+
+void UT_LogsMessage::cleanup()
+{
+ delete mLogsMessage;
+ mLogsMessage = 0;
+ delete mLogsEvent;
+ mLogsEvent = 0;
+}
+
+void UT_LogsMessage::testConstructor()
+{
+ QVERIFY( mLogsMessage );
+
+ LogsMessage messageWithoutEvent( 2, "1234", "firstname" );
+ QVERIFY( messageWithoutEvent.mContactId == 2 );
+ QVERIFY( messageWithoutEvent.mNumber == "1234" );
+ QVERIFY( messageWithoutEvent.mIsAllowed );
+
+ LogsMessage messageWithoutEvent2( 2, "","" );
+ QVERIFY( messageWithoutEvent2.mContactId == 0 );
+ QVERIFY( messageWithoutEvent2.mNumber == "" );
+ QVERIFY( !messageWithoutEvent2.mIsAllowed );
+}
+
+void UT_LogsMessage::testIsMessagingAllowed()
+{
+ QVERIFY( mLogsMessage->isMessagingAllowed() );
+
+ // Not allowed as event not CS compatible
+ LogsEvent event;
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "test@1.2.3.4";
+ event.setLogsEventData( eventData );
+ LogsMessage message(event);
+ QVERIFY( !message.isMessagingAllowed() );
+}
+
+void UT_LogsMessage::testSendMessage()
+{
+ QtHighwayStubHelper::reset();
+ QVERIFY( mLogsMessage->sendMessage() );
+ QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.hbserviceprovider.conversationview" );
+ QVERIFY( QtHighwayStubHelper::message() == "send(QString,qint32,QString)" );
+
+}
+
+void UT_LogsMessage::testSendMessageToNumber()
+{
+ QtHighwayStubHelper::reset();
+ QVERIFY( mLogsMessage->sendMessageToNumber( "1234567" ) );
+ QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.hbserviceprovider.conversationview" );
+ QVERIFY( QtHighwayStubHelper::message() == "send(QString,qint32,QString)" );
+ QtHighwayStubHelper::reset();
+ QVERIFY( mLogsMessage->sendMessageToNumber( "1234567", "name" ) );
+ QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.hbserviceprovider.conversationview" );
+ QVERIFY( QtHighwayStubHelper::message() == "send(QString,qint32,QString)" );
+ QtHighwayStubHelper::reset();
+ QVERIFY( mLogsMessage->sendMessageToNumber( "4234567", "namef", 3 ) );
+ QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.hbserviceprovider.conversationview" );
+ QVERIFY( QtHighwayStubHelper::message() == "send(QString,qint32,QString)" );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmodel.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,498 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "ut_logsmodel.h"
+#include "logsmodel.h"
+#include "logsevent.h"
+#include "logscall.h"
+#include "logscontact.h"
+#include "logsdetailsmodel.h"
+#include "logsmessage.h"
+#include "logseventdata.h"
+#include "logsdbconnector.h"
+#include "logsdbconnector_stub_helper.h"
+
+#include <hbicon.h>
+#include <QtTest/QtTest>
+
+Q_DECLARE_METATYPE(LogsEvent *)
+Q_DECLARE_METATYPE(LogsCall *)
+Q_DECLARE_METATYPE(LogsDetailsModel *)
+Q_DECLARE_METATYPE(LogsMessage *)
+Q_DECLARE_METATYPE(LogsContact *)
+
+#define LOGS_TEST_CMP_ICONS( var, icon ){ \
+ const HbIcon& tempIcon = qVariantValue<HbIcon>( var );\
+ QVERIFY( &tempIcon = icon ); }
+
+#define LOGS_TEST_CREATE_EVENT(eventName, index, eventState ) \
+LogsEvent* eventName = new LogsEvent; \
+eventName->setIndex(index); \
+eventName->setLogId(index);\
+eventName->setIsInView(true); \
+eventName->mEventState = eventState; \
+mModel->mEvents.insert(index, eventName)
+
+void UT_LogsModel::initTestCase()
+{
+}
+
+void UT_LogsModel::cleanupTestCase()
+{
+}
+
+
+void UT_LogsModel::init()
+{
+ mModel = new LogsModel();
+}
+
+void UT_LogsModel::cleanup()
+{
+ delete mModel;
+ mModel = 0;
+}
+
+void UT_LogsModel::testConstructor()
+{
+ QVERIFY( mModel );
+}
+
+void UT_LogsModel::testRowCount()
+{
+ QVERIFY( mModel->rowCount(QModelIndex()) == 0 );
+ LogsEvent* event = new LogsEvent();
+ mModel->mEvents.append(event);
+ QVERIFY( mModel->rowCount(QModelIndex()) == 1 );
+}
+
+void UT_LogsModel::testData()
+{
+ QVERIFY( mModel->data(QModelIndex(), Qt::DisplayRole).isNull() );
+
+ QString number("123");
+ LogsEvent* event = new LogsEvent();
+ event->setNumber(number);
+
+ mModel->mEvents.append(event);
+
+ //display data, no duplicate items
+ QVariant displayData = mModel->data(mModel->index(0), Qt::DisplayRole);
+ QVERIFY ( displayData.type() == QVariant::StringList );
+ QStringList list = displayData.toStringList();
+ QVERIFY( list.count() == 2 );
+ QVERIFY( list.at(0) == number );
+
+ //display data with duplicates
+ event->setDuplicates(1);
+ displayData = mModel->data(mModel->index(0), Qt::DisplayRole);
+ list = displayData.toStringList();
+ QVERIFY( list.count() == 2 );
+ QVERIFY( list.at(0) == QString("123(2)") );
+
+ QVariant decorationData = mModel->data(mModel->index(0), Qt::DecorationRole);
+ QVERIFY ( decorationData.canConvert< QList<QVariant> >() );
+
+ // Full event
+ QVariant fullEventdata = mModel->data(mModel->index(0), LogsModel::RoleFullEvent);
+ const LogsEvent *fetchedEvent = qVariantValue<LogsEvent *>( fullEventdata );
+ QVERIFY ( fetchedEvent );
+
+ // Call not supported for this event
+ mModel->mEvents.at(0)->setEventType(LogsEvent::TypeUndefined);
+ QVariant callData = mModel->data(mModel->index(0), LogsModel::RoleCall);
+ LogsCall *call = qVariantValue<LogsCall *>( callData );
+ QVERIFY ( !call );
+
+ // Call supported
+ mModel->mEvents.at(0)->setEventType(LogsEvent::TypeVoiceCall);
+ QVariant callData2 = mModel->data(mModel->index(0), LogsModel::RoleCall);
+ LogsCall *call2 = qVariantValue<LogsCall *>( callData2 );
+ QVERIFY ( call2 );
+ delete call2;
+
+ // Details model
+ QVariant details = mModel->data(mModel->index(0), LogsModel::RoleDetailsModel);
+ LogsDetailsModel *detailsModel = qVariantValue<LogsDetailsModel *>( details );
+ QVERIFY( detailsModel );
+ delete detailsModel;
+
+ // Test message
+ QVariant messageData = mModel->data(mModel->index(0), LogsModel::RoleMessage);
+ LogsMessage* message = qVariantValue<LogsMessage *>( messageData );
+ QVERIFY( message != 0 );
+ delete message;
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "test@1.2.3.4";
+ mModel->mEvents.at(0)->setLogsEventData( eventData );
+ QVariant messageData2 = mModel->data(mModel->index(0), LogsModel::RoleMessage);
+ LogsMessage* message2 = qVariantValue<LogsMessage *>( messageData2 );
+ QVERIFY( message2 == 0 );
+
+ // Contact supported
+ QVariant contactData = mModel->data(mModel->index(0), LogsModel::RoleContact);
+ LogsContact *contact = qVariantValue<LogsContact *>( contactData );
+ QVERIFY( contact );
+ delete contact;
+
+ //contact not supported
+ mModel->mEvents.at(0)->setNumber("");
+ mModel->mEvents.at(0)->setLogsEventData( 0 );
+ contactData = mModel->data(mModel->index(0), LogsModel::RoleContact);
+ contact = qVariantValue<LogsContact *>( contactData );
+ QVERIFY( !contact );
+}
+
+void UT_LogsModel::testDataAdded()
+{
+ // One event added
+ LogsEvent* event = new LogsEvent();
+ mModel->mEvents.append(event);
+ QList<int> addedIndexes;
+ addedIndexes.append( 0 );
+ QSignalSpy spy(mModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)));
+ mModel->dataAdded(addedIndexes);
+ QVERIFY( spy.count() == 1 );
+
+ // Two more sequnetial events added
+ LogsEvent* event2 = new LogsEvent();
+ LogsEvent* event3 = new LogsEvent();
+ mModel->mEvents.insert(0, event2);
+ mModel->mEvents.insert(0, event3);
+ addedIndexes.clear();
+ addedIndexes.append( 0 );
+ addedIndexes.append( 1 );
+ mModel->dataAdded(addedIndexes);
+ QVERIFY( spy.count() == 2 ); // +one addition sequence
+
+ // Three events added, one is non-sequential with other two
+ LogsEvent* event4 = new LogsEvent();
+ LogsEvent* event5 = new LogsEvent();
+ LogsEvent* event6 = new LogsEvent();
+ mModel->mEvents.insert(0, event4);
+ mModel->mEvents.insert(0, event5);
+ mModel->mEvents.append(event6);
+ addedIndexes.clear();
+ addedIndexes.append( 0 );
+ addedIndexes.append( 1 );
+ addedIndexes.append( mModel->mEvents.count() - 1 ); // Added to end
+ mModel->dataAdded(addedIndexes);
+ QVERIFY( spy.count() == 4 ); // +two addition sequences
+}
+
+void UT_LogsModel::testDataUpdated()
+{
+ LogsEvent* event = new LogsEvent();
+ mModel->mEvents.append(event);
+ QList<int> updatedIndexes;
+ updatedIndexes.append( 0 );
+ QSignalSpy spy(mModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)));
+ mModel->dataUpdated(updatedIndexes);
+ QVERIFY( spy.count() == 1 );
+}
+
+void UT_LogsModel::testDataRemoved()
+{
+ QList<int> removedIndexes;
+ removedIndexes.append( 0 );
+ QSignalSpy spy(mModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)));
+ mModel->dataRemoved(removedIndexes);
+ QVERIFY( spy.count() == 1 );
+}
+
+void UT_LogsModel::testGetDecorationData()
+{
+ LogsEvent* event = new LogsEvent();
+ mModel->mEvents.append(event);
+ QList<QVariant> icons;
+
+ //no direction/call type
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ QVERIFY( qVariantValue<QIcon>( icons.at(0) ).isNull() );
+
+ icons.clear();
+ event->setDirection(LogsEvent::DirIn);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ QVERIFY( qVariantValue<QIcon>( icons.at(0) ).isNull() );
+
+ icons.clear();
+ event->setDirection(LogsEvent::DirOut);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ QVERIFY( qVariantValue<QIcon>( icons.at(0) ).isNull() );
+
+ icons.clear();
+ event->setDirection(LogsEvent::DirMissed);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ QVERIFY( qVariantValue<QIcon>( icons.at(0) ).isNull() );
+
+ //different directions/call types to get coverage
+ icons.clear();
+ event->setDirection(LogsEvent::DirIn);
+ event->setEventType(LogsEvent::TypeVideoCall);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsReceivedVideoCallIconId ));
+
+ icons.clear();
+ event->setEventType(LogsEvent::TypeVoIPCall);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsReceivedVoipCallIconId ));
+
+ icons.clear();
+ event->setEventType(LogsEvent::TypeVoiceCall);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsReceivedVoiceCallIconId ));
+
+ icons.clear();
+ event->setDirection(LogsEvent::DirOut);
+ event->setEventType(LogsEvent::TypeVideoCall);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsDialledVideoCallIconId ));
+
+ icons.clear();
+ event->setEventType(LogsEvent::TypeVoIPCall);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsDialledVoipCallIconId ));
+
+ icons.clear();
+ event->setEventType(LogsEvent::TypeVoiceCall);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsDialledVoiceCallIconId ));
+
+ icons.clear();
+ event->setDirection(LogsEvent::DirMissed);
+ event->setEventType(LogsEvent::TypeVideoCall);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsMissedVideoCallIconId ));
+
+ icons.clear();
+ event->setEventType(LogsEvent::TypeVoIPCall);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsMissedVoipCallIconId ));
+
+ icons.clear();
+ event->setEventType(LogsEvent::TypeVoiceCall);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsMissedVoiceCallIconId ));
+
+ icons.clear();
+ event->setDirection(LogsEvent::DirMissed);
+ event->setEventType(LogsEvent::TypeVideoCall);
+ event->setIsRead(false);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsMissedVideoCallUnseenIconId ));
+
+ icons.clear();
+ event->setEventType(LogsEvent::TypeVoIPCall);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsMissedVoipCallUnseenIconId ));
+
+ icons.clear();
+ event->setEventType(LogsEvent::TypeVoiceCall);
+ mModel->getDecorationData(*event, icons);
+ QVERIFY(icons.count() == 1);
+ LOGS_TEST_CMP_ICONS(icons.at(0), mModel->mIcons.value( logsMissedVoiceCallUnseenIconId ));
+}
+
+void UT_LogsModel::testIconName()
+{
+ LogsEvent event;
+ QVERIFY( LogsModel::typeIconName(event) == "" );
+ event.setEventType( LogsEvent::TypeVideoCall );
+ QVERIFY( LogsModel::typeIconName(event) == logsVideoCallIconId );
+ event.setEventType( LogsEvent::TypeVoIPCall );
+ QVERIFY( LogsModel::typeIconName(event) == logsVoipCallIconId );
+ event.setEventType( LogsEvent::TypeVoiceCall );
+ QVERIFY( LogsModel::typeIconName(event) == logsVoiceCallIconId );
+
+ QVERIFY( LogsModel::directionIconName(event) == "" );
+ event.setDirection(LogsEvent::DirIn);
+ event.setEventType( LogsEvent::TypeUndefined );
+ QVERIFY( LogsModel::directionIconName(event) == "" );
+ event.setEventType( LogsEvent::TypeVoiceCall );
+ QVERIFY( LogsModel::directionIconName(event) == logsReceivedVoiceCallIconId );
+ event.setEventType( LogsEvent::TypeVoIPCall );
+ QVERIFY( LogsModel::directionIconName(event) == logsReceivedVoipCallIconId );
+ event.setEventType( LogsEvent::TypeVideoCall );
+ QVERIFY( LogsModel::directionIconName(event) == logsReceivedVideoCallIconId );
+
+ event.setDirection(LogsEvent::DirOut);
+ event.setEventType( LogsEvent::TypeUndefined );
+ QVERIFY( LogsModel::directionIconName(event) == "" );
+ QVERIFY( LogsModel::directionIconName(event) == "" );
+ event.setEventType( LogsEvent::TypeVoiceCall );
+ QVERIFY( LogsModel::directionIconName(event) == logsDialledVoiceCallIconId );
+ event.setEventType( LogsEvent::TypeVoIPCall );
+ QVERIFY( LogsModel::directionIconName(event) == logsDialledVoipCallIconId );
+ event.setEventType( LogsEvent::TypeVideoCall );
+ QVERIFY( LogsModel::directionIconName(event) == logsDialledVideoCallIconId );
+
+ event.setDirection(LogsEvent::DirMissed);
+ event.setEventType( LogsEvent::TypeUndefined );
+ QVERIFY( LogsModel::directionIconName(event) == "" );
+ QVERIFY( LogsModel::directionIconName(event) == "" );
+ event.setEventType( LogsEvent::TypeVoiceCall );
+ event.setIsRead(true);
+ QVERIFY( LogsModel::directionIconName(event) == logsMissedVoiceCallIconId );
+ event.setEventType( LogsEvent::TypeVoIPCall );
+ QVERIFY( LogsModel::directionIconName(event) == logsMissedVoipCallIconId );
+ event.setEventType( LogsEvent::TypeVideoCall );
+ QVERIFY( LogsModel::directionIconName(event) == logsMissedVideoCallIconId );
+
+ event.setDirection(LogsEvent::DirMissed);
+ event.setEventType( LogsEvent::TypeUndefined );
+ QVERIFY( LogsModel::directionIconName(event) == "" );
+ QVERIFY( LogsModel::directionIconName(event) == "" );
+ event.setEventType( LogsEvent::TypeVoiceCall );
+ event.setIsRead(false);
+ QVERIFY( LogsModel::directionIconName(event) == logsMissedVoiceCallUnseenIconId );
+ event.setEventType( LogsEvent::TypeVoIPCall );
+ QVERIFY( LogsModel::directionIconName(event) == logsMissedVoipCallUnseenIconId );
+ event.setEventType( LogsEvent::TypeVideoCall );
+ QVERIFY( LogsModel::directionIconName(event) == logsMissedVideoCallUnseenIconId );
+
+}
+
+void UT_LogsModel::testGetCallerId()
+{
+ // No name or number
+ LogsEvent event;
+ QVERIFY( mModel->getCallerId(event) == QString("No number") );
+
+ // No name
+ QString num("+12345555");
+ event.setNumber(num);
+ QVERIFY( mModel->getCallerId(event) == num );
+
+ // No number
+ QString remote("Souuu");
+ event.setRemoteParty(remote);
+ event.setNumber("");
+ QVERIFY( mModel->getCallerId(event) == remote );
+
+ // Both, still use remote
+ event.setNumber(num);
+ QVERIFY( mModel->getCallerId(event) == remote );
+
+ // Only remote url
+ event.setNumber("");
+ event.setRemoteParty("");
+ LogsEventData* eventData = new LogsEventData;
+ eventData->mRemoteUrl = "test@1.2.3.4";
+ event.setLogsEventData( eventData );
+ QVERIFY( mModel->getCallerId(event) == eventData->mRemoteUrl );
+
+ // Duplicates
+ event.setDuplicates(3);
+ QVERIFY( mModel->getCallerId(event) == "test@1.2.3.4(4)" );
+
+ // Duplicates for already read event
+ event.setIsRead(true);
+ QVERIFY( mModel->getCallerId(event) == "test@1.2.3.4" );
+}
+
+void UT_LogsModel::testClearList()
+{
+ mModel->clearList(LogsModel::TypeLogsClearAll);
+ QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "clearList" );
+}
+
+void UT_LogsModel::testMarkEventsSeen()
+{
+ // No events
+ mModel->markEventsSeen(LogsModel::TypeLogsClearMissed);
+
+ // No missed events
+ LOGS_TEST_CREATE_EVENT(event, 0, LogsEvent::EventAdded );
+ event->setDirection(LogsEvent::DirIn);
+ QVERIFY( !mModel->markEventsSeen(LogsModel::TypeLogsClearMissed) );
+ QVERIFY( mModel->mDbConnector->mEventsSeen.count() == 0 );
+
+ // Marking missed as seen (one is already seen)
+ event->setDirection(LogsEvent::DirMissed);
+ LOGS_TEST_CREATE_EVENT(event2, 1, LogsEvent::EventAdded );
+ event2->setDirection(LogsEvent::DirMissed);
+ LOGS_TEST_CREATE_EVENT(event3, 2, LogsEvent::EventAdded );
+ event3->setDirection(LogsEvent::DirMissed);
+ event3->setIsRead(true);
+ QVERIFY( mModel->markEventsSeen(LogsModel::TypeLogsClearMissed) );
+ QVERIFY( mModel->mDbConnector->mEventsSeen.count() == 2 );
+
+ // Trying to clear missed again, id is appended to mark list
+ event3->setIsRead(false);
+ QVERIFY( mModel->markEventsSeen(LogsModel::TypeLogsClearMissed) );
+ QVERIFY( mModel->mDbConnector->mEventsSeen.count() == 3 );
+
+ // Clearing for the events already ongoing, don't try again
+ event->markedAsSeenLocally(true);
+ event2->markedAsSeenLocally(true);
+ event3->markedAsSeenLocally(true);
+ QVERIFY( !mModel->markEventsSeen(LogsModel::TypeLogsClearMissed) );
+
+ // Clearing received, does not find such
+ mModel->mDbConnector->mEventsSeen.clear();
+ QVERIFY( !mModel->markEventsSeen(LogsModel::TypeLogsClearReceived) );
+ QVERIFY( mModel->mDbConnector->mEventsSeen.count() == 0 );
+
+ // Clearing called, does not find such
+ QVERIFY( !mModel->markEventsSeen(LogsModel::TypeLogsClearCalled) );
+ QVERIFY( mModel->mDbConnector->mEventsSeen.count() == 0 );
+}
+
+void UT_LogsModel::testClearMissedCallsCounter()
+{
+ QVERIFY( mModel->clearMissedCallsCounter() == 0 );
+}
+
+void UT_LogsModel::testRefreshData()
+{
+ QVERIFY( mModel->refreshData() == 0 );
+ QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "refreshData" );
+}
+
+void UT_LogsModel::testCompressData()
+{
+ QVERIFY( mModel->compressData() == 0 );
+ QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "compressData" );
+}
+
+void UT_LogsModel::testPredictiveSearchStatus()
+{
+ LogsDbConnectorStubHelper::setPredictiveSearch(1);
+ QVERIFY( mModel->predictiveSearchStatus() == 1 );
+ QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "predictiveSearchStatus" );
+}
+
+void UT_LogsModel::testSetPredictiveSearch()
+{
+ LogsDbConnectorStubHelper::setPredictiveSearch(2);
+ QVERIFY( mModel->setPredictiveSearch(true) == 0 );
+ QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "setPredictiveSearch" );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsthumbnailmanager.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "ut_logsthumbnailmanager.h"
+#include "logsthumbnailmanager.h"
+#include <e32cmn.h> //KNullDesC
+#include <QIcon>
+#include <QSignalSpy>
+#include <QtTest/QtTest>
+#include <thumbnailmanager_qt.h>
+
+
+ const QString path1 = "c:\\data\\images\\bg_1.png";
+ const QString path3 = "e:\\images\\non.jpeg";
+
+
+
+void UT_LogsThumbnailManager::initTestCase()
+ {
+ mIconMgr = new LogsThumbIconManager();
+
+ }
+
+void UT_LogsThumbnailManager::cleanupTestCase()
+ {
+ delete mIconMgr;
+ mIconMgr = NULL;
+ }
+
+void UT_LogsThumbnailManager::init()
+ {
+ initTestCase();
+ }
+
+void UT_LogsThumbnailManager::cleanup()
+ {
+ cleanupTestCase();
+ }
+
+void UT_LogsThumbnailManager::testConstructor()
+{
+}
+
+void UT_LogsThumbnailManager::testNonExistingIcon()
+ {
+ QSignalSpy spy(mIconMgr, SIGNAL(contactIconReady(int)));
+ Q_ASSERT(spy.isValid());
+ QCOMPARE( spy.count(), 0 );
+ mIcon = mIconMgr->contactIcon(path3, 0);
+ Q_ASSERT(mIcon.isNull());
+ mIconMgr->cancel();
+
+ // No avatarpath, use defaul icon, note that defaul icon is null
+ // because svg config is not enabled in .pro file
+ mIcon = mIconMgr->contactIcon(QString(), 0);
+ Q_ASSERT(mIcon.isNull());
+
+ }
+
+void UT_LogsThumbnailManager::testOneExistingIcon()
+ {
+ QSignalSpy spy(mIconMgr, SIGNAL(contactIconReady(int)));
+ Q_ASSERT(spy.isValid());
+ QCOMPARE( spy.count(), 0 );
+ mIcon = mIconMgr->contactIcon(path1, 10);
+ Q_ASSERT(mIcon.isNull());
+
+ QPixmap pixmap(path1);
+ int index = 10;
+ int *clientData = new int(index);
+ int reqId = mIconMgr->mThumbnailManager->getThumbnail(path1, clientData, 0);
+ mIconMgr->mTnmReqMap.insert(reqId, path1);
+ mIconMgr->thumbnailReady(pixmap, clientData, 1, 0);
+ //
+ mIcon = mIconMgr->contactIcon(path1, 10);
+ Q_ASSERT(!mIcon.isNull());
+ //
+ mIconMgr->cancel();
+ //
+ mIcon = mIconMgr->contactIcon(path1, 10);
+ Q_ASSERT(mIcon.isNull());
+ reqId = mIconMgr->mThumbnailManager->getThumbnail(path1, clientData, 0);
+ mIconMgr->mTnmReqMap.insert(reqId, path1);
+ mIconMgr->thumbnailReady(pixmap, clientData, 2, -1);
+ mIconMgr->cancel();
+
+ QCOMPARE(spy.count(), 1);
+ QList<QVariant> arguments = spy.takeFirst();
+ QVERIFY(arguments.at(0).toInt() == 10);
+ mIcon = mIconMgr->contactIcon(path1, 10);
+ Q_ASSERT(!mIcon.isNull());
+ }
+
+void UT_LogsThumbnailManager::testCancel()
+ {
+ QSignalSpy spy(mIconMgr, SIGNAL(contactIconReady(int)));
+ Q_ASSERT(spy.isValid());
+ QCOMPARE( spy.count(), 0 );
+ mIcon = mIconMgr->contactIcon(path1, 10);
+ Q_ASSERT(mIcon.isNull());
+ mIcon = mIconMgr->contactIcon(path1, 11);
+ Q_ASSERT(mIcon.isNull());
+ mIcon = mIconMgr->contactIcon(path3, 0);
+ Q_ASSERT(mIcon.isNull());
+ mIconMgr->thumbnailLoad();
+ mIconMgr->cancel();
+ QCOMPARE(spy.count(), 0);
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/ut_logsengine.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,117 @@
+#
+# 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 = app
+TARGET =
+
+QT += testlib xml
+CONFIG += qtestlib
+CONFIG += hb
+
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += ../symbianos_stub
+INCLUDEPATH += ../hbstubs
+INCLUDEPATH += ../stubs
+INCLUDEPATH += /orbit/include # This must be included after the HB stubs
+INCLUDEPATH += /epoc32/include
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+INCLUDEPATH += /epoc32/include/ecom
+INCLUDEPATH += ../../inc
+INCLUDEPATH += ../../logssymbianos/inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../../tsrc/qtestutils/inc
+#INCLUDEPATH += ../../logssymbianos/tsrc/stubs
+
+DEFINES += QT_NO_DEBUG_OUTPUT
+
+# Input
+HEADERS += inc/ut_logsmodel.h
+HEADERS += inc/ut_logsdetailsmodel.h
+HEADERS += inc/ut_logsmatchesmodel.h
+HEADERS += inc/ut_logsfilter.h
+HEADERS += inc/ut_logscustomfilter.h
+HEADERS += inc/ut_logscall.h
+HEADERS += inc/ut_logscontact.h
+HEADERS += inc/ut_logsmessage.h
+HEADERS += inc/ut_logsevent.h
+HEADERS += inc/ut_logseventdata.h
+HEADERS += inc/ut_logsthumbnailmanager.h
+HEADERS += inc/ut_logscommondata.h
+HEADERS += ../../../../recents_plat/logs_engine_api/inc/logsabstractmodel.h
+HEADERS += ../../../../recents_plat/logs_engine_api/inc/logsmodel.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
+HEADERS += ../../logssymbianos/inc/logseventparser.h
+HEADERS += ../../logssymbianos/inc/logseventdataparser.h
+HEADERS += ../../logssymbianos/inc/logsdbconnector.h
+HEADERS += ../../logssymbianos/inc/logsremove.h
+HEADERS += ../stubs/logscntfinder.h
+
+SOURCES += src/main.cpp
+SOURCES += src/ut_logsmodel.cpp
+SOURCES += src/ut_logsdetailsmodel.cpp
+SOURCES += src/ut_logsmatchesmodel.cpp
+SOURCES += src/ut_logsfilter.cpp
+SOURCES += src/ut_logscustomfilter.cpp
+SOURCES += src/ut_logscall.cpp
+SOURCES += src/ut_logscontact.cpp
+SOURCES += src/ut_logsmessage.cpp
+SOURCES += src/ut_logsevent.cpp
+SOURCES += src/ut_logseventdata.cpp
+SOURCES += src/ut_logsthumbnailmanager.cpp
+SOURCES += src/ut_logscommondata.cpp
+SOURCES += ../../src/logsabstractmodel.cpp
+SOURCES += ../../src/logsmodel.cpp
+SOURCES += ../../src/logsdetailsmodel.cpp
+SOURCES += ../../src/logsmatchesmodel.cpp
+SOURCES += ../../src/logsfilter.cpp
+SOURCES += ../../src/logscustomfilter.cpp
+SOURCES += ../../src/logscall.cpp
+SOURCES += ../../src/logscontact.cpp
+SOURCES += ../../src/logsmessage.cpp
+SOURCES += ../../src/logsevent.cpp
+SOURCES += ../../src/logseventdata.cpp
+SOURCES += ../../src/logsthumbnailmanager.cpp
+SOURCES += ../../src/logscommondata.cpp
+SOURCES += ../hbstubs/hbstubs.cpp
+SOURCES += ../hbstubs/qiconstubs.cpp
+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 += ../stubs/qthighway_stub.cpp
+SOURCES += ../stubs/logscntfinder_stub.cpp
+SOURCES += ../../logssymbianos/tsrc/stubs/logclient_stubs.cpp
+SOURCES += ../../logssymbianos/tsrc/stubs/qtcontacts_stubs.cpp
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xEfa329b2
+ TARGET.CAPABILITY = ALL -TCB
+ TARGET.EPOCALLOWDLLDATA = 1
+ LIBS += -lxqservice -lqtcontacts -lthumbnailmanagerqt
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsservices/bwins/logsservicesu.def Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?start@LogsServices@@SAHW4LogsView@1@_NABVQString@@@Z @ 1 NONAME ; int LogsServices::start(enum LogsServices::LogsView, bool, class QString const &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsservices/eabi/logsservicesu.def Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _ZN12LogsServices5startENS_8LogsViewEbRK7QString @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsservices/logsservices.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,51 @@
+#
+# 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 = lib
+
+TARGET = logsservices
+CONFIG += dll
+
+INCLUDEPATH += ./
+INCLUDEPATH += ../inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+# Input
+
+SOURCES += src/logsservices.cpp
+
+DEFINES += LOGSSERVICES_LIB
+
+libFiles.sources = logsservices.dll
+libFiles.path = "!:/sys/bin"
+DEPLOYMENT += libFiles
+
+symbian: {
+ TARGET.UID2 = 0x1000008d
+ TARGET.UID3 = 0x10282EBB
+
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCALLOWDLLDATA = 1
+ LIBS += -lxqservice -lxqserviceutil
+
+ defFiles = "$${LITERAL_HASH}ifdef WINS" \
+ "DEFFILE bwins/logsservices.def" \
+ "$${LITERAL_HASH}else" \
+ "DEFFILE eabi/logsservices.def" \
+ "$${LITERAL_HASH}endif"
+ MMP_RULES += defFiles
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsservices/src/logsservices.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 <xqservicerequest.h>
+#include <logsservices.h>
+#include "logslogger.h"
+
+// --------------------------------------------------------------------------
+// LogsServices::start
+// --------------------------------------------------------------------------
+//
+int LogsServices::start(LogsView activatedView, bool showDialpad, const QString& number)
+{
+ LOGS_QDEBUG_2( "LogsServices::start ->", activatedView )
+ // Need to do request in async manner, otherwise new logs ui process
+ // will be started due bug(?) in highway.
+
+ bool res( false );
+ int retValue = -1;
+ if ( number.isEmpty() ){
+ XQServiceRequest snd("com.nokia.services.logsservices.starter",
+ "start(int,bool)", false);
+ snd << (int)activatedView;
+ snd << showDialpad;
+ res=snd.send(retValue);
+ LOGS_QDEBUG_3( "LogsServices::start <-", activatedView, retValue )
+ } else {
+ XQServiceRequest snd("com.nokia.services.logsservices.starter",
+ "startWithNum(int,bool,QString)", false);
+ snd << (int)activatedView;
+ snd << showDialpad;
+ snd << number;
+ res=snd.send(retValue);
+ LOGS_QDEBUG_3( "LogsServices::start <-", activatedView, retValue )
+ }
+ return res ? retValue : -1;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsservices/tsrc/at_logsservices/at_logsservices.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,47 @@
+#
+# 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 = app
+TARGET =
+
+QT += testlib xml
+CONFIG += qtestlib
+
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += ./inc
+INCLUDEPATH += /orbit/include # This must be included after the HB stubs
+INCLUDEPATH += /epoc32/include
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+INCLUDEPATH += /epoc32/include/ecom
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../../tsrc/qtestutils/inc
+
+# Input
+HEADERS += inc/at_logsservices.h
+
+SOURCES += src/main.cpp
+SOURCES += src/at_logsservices.cpp
+SOURCES += ../../../tsrc/qtestutils/src/testresultxmlparser.cpp
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xEf1af9b2
+ TARGET.CAPABILITY = ALL -TCB
+ LIBS += -lecom -lflogger -lws32 -lbafl -llogsservices
+ TARGET.EPOCALLOWDLLDATA = 1
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsservices/tsrc/at_logsservices/inc/at_logsservices.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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 AT_LOGSSERVICES_H
+#define AT_LOGSSERVICES_H
+
+#include <QObject>
+
+class AT_LogsServices : 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 testStart();
+
+private:
+
+};
+
+
+#endif //AT_LOGSSERVICES_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsservices/tsrc/at_logsservices/src/at_logsservices.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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 "at_logsservices.h"
+#include <logsservices.h>
+
+#include <QtTest/QtTest>
+
+void AT_LogsServices::initTestCase()
+{
+}
+
+void AT_LogsServices::cleanupTestCase()
+{
+}
+
+
+void AT_LogsServices::init()
+{
+}
+
+void AT_LogsServices::cleanup()
+{
+}
+
+void AT_LogsServices::testStart()
+{
+ LogsServices::start( LogsServices::ViewAll );
+ LogsServices::start( LogsServices::ViewReceived );
+ LogsServices::start( LogsServices::ViewCalled );
+ LogsServices::start( LogsServices::ViewMissed );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsservices/tsrc/at_logsservices/src/main.cpp Tue May 04 12:39:37 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:
+*
+*/
+
+
+#include <QtTest/QtTest>
+
+#include "at_logsservices.h"
+#include "testresultxmlparser.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);
+ TestResultXmlParser parser;
+
+ AT_LogsServices at_services;
+ QString resultFileName = "c:/at_logs_LogsServices.xml";
+ QStringList args( "at_logsservices");
+ args << "-xml" << "-o" << resultFileName;
+ QTest::qExec(&at_services, args);
+ parser.parseAndPrintResults(resultFileName,true);
+
+
+ if (promptOnExit) {
+ printf("Press any key...\n");
+ getchar();
+ }
+ return 0;
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsui.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,48 @@
+#
+# 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
+
+symbian: {
+ :BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
+ :BLD_INF_RULES.prj_exports += "rom/logs.iby CORE_APP_LAYER_IBY_EXPORT_PATH(logs.iby)"
+ :BLD_INF_RULES.prj_exports += "rom/logsresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(logsresources.iby)"
+ :BLD_INF_RULES.prj_exports += "rom/logs_stub.sis /epoc32/data/z/system/install/logs_stub.sis"
+ :BLD_INF_RULES.prj_exports += "cenrep/backup_registration.xml /epoc32/data/z/private/101F4CD5/backup_registration.xml"
+ :BLD_INF_RULES.prj_exports += "conf/logs.confml APP_LAYER_CONFML(logs.confml)"
+ :BLD_INF_RULES.prj_exports += "conf/logs_101F874E.crml APP_LAYER_CRML(logs_101F874E.crml)"
+ :BLD_INF_RULES.prj_exports += "conf/logs_102750C6.crml APP_LAYER_CRML(logs_102750C6.crml)"
+ :BLD_INF_RULES.prj_exports += "inc/logsexport.h /epoc32/include/logsexport.h"
+ :BLD_INF_RULES.prj_exports += "../recents_plat/logs_services_api/inc/logsservices.h APP_LAYER_PLATFORM_EXPORT_PATH(logsservices.h)"
+ :BLD_INF_RULES.prj_exports += "../recents_plat/logs_engine_api_extensions/inc/LogsApiConsts.h APP_LAYER_PLATFORM_EXPORT_PATH(LogsApiConsts.h)"
+ :BLD_INF_RULES.prj_exports += "../recents_plat/logs_timers_api/inc/LogsDomainCRKeys.h APP_LAYER_PLATFORM_EXPORT_PATH(LogsDomainCRKeys.h)"
+ :BLD_INF_RULES.prj_exports += "../recents_plat/logs_engine_api/inc/logsmodel.h APP_LAYER_PLATFORM_EXPORT_PATH(logsmodel.h)"
+ :BLD_INF_RULES.prj_exports += "../recents_plat/logs_engine_api/inc/logsabstractmodel.h APP_LAYER_PLATFORM_EXPORT_PATH(logsabstractmodel.h)"
+ :BLD_INF_RULES.prj_exports += "../recents_plat/logs_engine_api/inc/logsfilter.h APP_LAYER_PLATFORM_EXPORT_PATH(logsfilter.h)"
+ :BLD_INF_RULES.prj_exports += "../recents_plat/logs_engine_api/inc/logscustomfilter.h APP_LAYER_PLATFORM_EXPORT_PATH(logscustomfilter.h)"
+ :BLD_INF_RULES.prj_exports += "../recents_plat/logs_engine_api/inc/logsevent.h APP_LAYER_PLATFORM_EXPORT_PATH(logsevent.h)"
+ exists(confml/logsuda.confml) :BLD_INF_RULES.prj_exports += "confml/logsuda.confml CONFML_EXPORT_PATH(logsuda.confml,uda_content)"
+ exists(implml/logsuda.implml) :BLD_INF_RULES.prj_exports += "implml/logsuda.implml CRML_EXPORT_PATH(logsuda.implml,uda_content)"
+ exists(content/LOGDBU.zip) :BLD_INF_RULES.prj_exports += "content/LOGDBU.zip CRML_EXPORT_PATH(../content/zip/,uda_content)"
+
+}
+
+SUBDIRS += logsservices
+SUBDIRS += logscntfinder
+SUBDIRS += logsengine
+SUBDIRS += logsapp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/rom/logs.iby Tue May 04 12:39:37 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 __LOGS_IBY__
+#define __LOGS_IBY__
+
+// Backup registration
+data=DATAZ_\private\101F4CD5\backup_registration.xml private\101F4CD5\backup_registration.xml
+
+// Sis stub
+data=DATAZ_\system\install\logs_stub.sis system\install\logs_stub.sis
+
+file=ABI_DIR\UREL\logsservices.dll SHARED_LIB_DIR\logsservices.dll
+file=ABI_DIR\UREL\logsengine.dll SHARED_LIB_DIR\logsengine.dll
+file=ABI_DIR\UREL\logscntfinder.dll SHARED_LIB_DIR\logscntfinder.dll
+file=ABI_DIR\UREL\logs.exe PROGRAMS_DIR\logs.exe
+data=DATAZ_\private\10003a3f\import\apps\logs_reg.rsc \private\10003a3f\import\apps\logs_reg.rsc
+
+#endif
Binary file logsui/rom/logs_stub.sis has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/rom/logsresources.iby Tue May 04 12:39:37 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:
+*
+*/
+#ifndef __LOGS_RESOURCES_IBY__
+#define __LOGS_RESOURCES_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+//Resource files for Logs application
+data=DATAZ_\resource\apps\logs.rsc \resource\apps\logs.rsc
+data=DATAZ_\QT_TRANSLATIONS_DIR\dialer.qm QT_TRANSLATIONS_DIR\dialer.qm
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/MATTItests/ApplicationControl.rb Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,85 @@
+
+
+class ApplicationControl
+ # Run when the class is intialized. Takes logging file and MATTI sut in.
+ def initialize(log, my_sut)
+ @log = log
+ @my_sut = my_sut
+ end
+
+ # Starts Logs application
+ def startApplication()
+ puts "starting application"
+ @log.debug("Starting logs.exe application")
+ @my_app = @my_sut.run(:name=>'logs.exe')
+ sleep 4
+ # @my_sut.capture_screen(:Filename => 'c:/temp/live.png')
+ # puts @my_sut.application.attribute("FullName")
+ # f = File.new('c:\temp\decorator.xml', "w")
+ # xml = @my_sut.get_ui_dump()
+ # f.puts xml
+
+ return @my_app
+ end
+
+ # Closes Logs application
+ def closeApplication()
+ puts "closing application"
+ @log.debug("Closing logs.exe application")
+ @my_app.close()
+ end
+
+ # Clears the database.
+ # An external test application is called that clears the database used by Logs application
+ def clearList
+ begin
+ @my_sut.run(:name=>'clearlisttest.exe')
+ rescue
+ # Expected, as the exe does not stay running
+ end
+ end
+
+ # Adds events to database.
+ # An external test application is called that adds events to database used by Logs application.
+ # The test application takes in an argument that specifies which events should be added, e.g. case1.
+ def addEvents(caseName)
+ begin
+ puts caseName
+ @my_sut.run(:name=>"logclienttest.exe #{caseName}")
+ rescue
+ # Expected, as the exe does not stay running
+ end
+ end
+
+ # Starts the call service monitor test application
+ def startCallService()
+ begin
+ puts caseName
+ @serviceApp = @my_sut.run(:name=>"servicepp2.exe")
+ rescue
+ # Some crashes my occure during startup
+ end
+ end
+
+
+ # Start application by pressing Send key. Currently a test application is used as the Send key does not work
+ def pressSendKey()
+ @log.debug("running logsservicestester.exe 2")
+ ## matti does not support pressing keys in QT side at the moment. IT will be added in maybe 0.6 version.
+ #MATTI.disconnect_sut(:Id => 'sut_s60_qt')
+ #sut = MATTI.sut(:Id => 's60')
+ #sut.press_key(:kEnd)
+ #sleep 4
+ sut.press_key(:kSend)
+ #MATTI.disconnect_sut(:Id => 's60')
+ #@my_sut = MATTI.sut(:Id => 'sut_s60_qt')
+ #begin
+ #@my_sut.run(:name=>'logsservicestester.exe 2')
+ #rescue
+ # Expected, as the exe does not stay running
+ #end
+ end
+
+
+end
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/MATTItests/CommonFunctions.rb Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,172 @@
+require 'matti'
+
+### Constants
+
+VoiceIcon_Const = ':/callVoice.svg'
+VideoIcon_Const = ':/callVideo.svg'
+DirInIcon_Const = ':/dirIn.svg'
+DirOutIcon_Const = ':/dirOut.svg'
+DirMissedIcon_Const = ':/dirMissed.svg'
+DataAndTimeIcon_Const = ':/callDateAndTime.svg'
+RemoteInfoIcon_Const = ':/remoteInfo.svg'
+CallDurationIcon_Const = ':/callDuration.svg'
+
+
+## Parent class for all TC_ classes. Contains common functionality related to intializing and running the cases,
+## and other functionality that can be re-used by different tests
+class CommonFunctions
+ # Run when the class is intialized. Takes logging file and MATTI sut in.
+ def initialize(log, my_sut)
+ @log = log
+ @my_sut = my_sut
+ end
+
+ # Running test case logic. The case name is taken in from the test list file and then a function that has the
+ # same name is called.
+ def run(testName)
+ begin
+ result = send(testName)
+ rescue Exception => e
+ @log.fatal("Error, case execution terminated.")
+ @log.fatal("Error code: #{e.message}")
+ @log.fatal("Error line: #{e.backtrace.inspect}")
+ if(@my_sut.application.attribute("FullName") == 'Z:\sys\bin\logs.exe')
+ @appControl.closeApplication()
+ end
+ result = -2
+ end
+ return result
+ end
+
+ # Initializes the test by generating the log events
+ def initializeTest(caseName)
+ @appControl = ApplicationControl.new(@log, @my_sut)
+ @appControl.clearList()
+ @appControl.addEvents(caseName)
+ @my_app = @appControl.startApplication()
+ sleep 3
+ # Note! Use only these in the test cases so that maintenance is easier.
+ @mainWindow = @my_app.LogsMainWindow
+ @recentCallsView = @mainWindow.HbContentWidget.LogsRecentCallsView.HbWidget
+ @eventContainer = @recentCallsView.HbListView.HbAbstractItemContainer
+ end
+
+ # Initializes the test by generating the log events and starting application by pressing send Key
+ def initializeTestSendKey(caseName)
+ @appControl = ApplicationControl.new(@log, @my_sut)
+ @appControl.clearList()
+ @appControl.addEvents(caseName)
+ @appControl.pressSendKey
+
+ sleep 4
+ puts @my_sut.application.attribute("FullName")
+ @mainWindow = @my_app.LogsMainWindow
+ @recentCallsView = @mainWindow.HbContentWidget.LogsRecentCallsView.HbWidget
+ @eventContainer = @recentCallsView.HbListView.HbAbstractItemContainer
+
+ end
+
+
+ # Selects a wanted view. First it verifies the current view and then the next view is selected.
+ def selectView(currentView, nextView)
+ @log.debug("Tapping on Show button")
+ showButton = @mainWindow.HbToolBar(:name=>'logs_toolbar').HbToolButton(:toolTipText=>'Show')
+ showButton.tap
+ sleep 1
+ sort_menu = @mainWindow.HbMenu.HbMenuListView.HbAbstractItemContainer
+ @log.debug("Verifying the current view in sort menu. Menu should be: #{currentView}")
+
+ if(currentView == "Recent")
+ sort_menu.HbMenuItem(:row=>'0').HbTextItem(:text=>'Recent calls')
+ sort_menu.HbMenuItem(:row=>'0').HbIconItem(:iconName => 'qtg_indi_list_selected')
+ elsif(currentView == "Dialled")
+ sort_menu.HbMenuItem(:row=>'2').HbTextItem(:text=>'Dialled calls')
+ sort_menu.HbMenuItem(:row=>'2').HbIconItem(:iconName => 'qtg_indi_list_selected')
+ elsif(currentView == "Received")
+ sort_menu.HbMenuItem(:row=>'1').HbTextItem(:text=>'Received calls')
+ sort_menu.HbMenuItem(:row=>'1').HbIconItem(:iconName => 'qtg_indi_list_selected')
+ elsif(currentView == "Missed")
+ sort_menu.HbMenuItem(:row=>'3').HbTextItem(:text=>'Missed calls')
+ sort_menu.HbMenuItem(:row=>'3').HbIconItem(:iconName => 'qtg_indi_list_selected')
+ end
+ @log.debug("Selecting the next view in sort menu. Selection: #{nextView}")
+
+ if(nextView == "Recent")
+ sort_menu.HbMenuItem(:row=>'0').tap
+ @currentView = "Recent"
+ elsif(nextView == "Dialled")
+ sort_menu.HbMenuItem(:row=>'2').tap
+ @currentView = "Dialled"
+ elsif(nextView == "Received")
+ sort_menu.HbMenuItem(:row=>'1').tap
+ @currentView = "Received"
+ elsif(nextView == "Missed")
+ sort_menu.HbMenuItem(:row=>'3').tap
+ @currentView = "Missed"
+ end
+ end
+
+ # Intiates a call to the event that is in specified row passed in as a parameter.
+ # Verifies the call is made to correct number
+ def initiate_call(row, phoneNumber)
+ @log.debug("Initiating call. Row: #{row} Phone number: #{phoneNumber}")
+ firstDialledEvent = @eventContainer.HbListViewItem(:row=>"#{row}").HbTextItem(:text=>"#{phoneNumber}")
+ firstDialledEvent.tap
+ sleep 2
+ # Verify that the Telephone is calling to the correct number!! Currently no environment for that!!!!
+ puts @serviceApp.attribute("FullName")
+ return 0
+
+ end
+
+ # Intiates a call to the first event in the current view by pressing Send key
+ # Verifies the call is made to correct number
+ def initiate_call_with_send_key
+ @log.debug("Initiating call by pressing Send key")
+ #recentCallsView = @my_app.HbMainWindow.HbContentWidget.LogsRecentCallsView.HbWidget
+ firstEvent = @eventContainer.HbAbstractViewItem(:row=>"0")#.HbTextItem(:text=>"#{phoneNumber}")
+ @appControl.pressSendKey()
+ # Verify that the Telephone is calling to the correct number!! Currently no environment for that!!!!
+ return 0
+ end
+
+ ## Common functionality for testing the that the last call is dislplayed correctly in
+ ## selected view.
+ ## Check the Call type (voice / video) and call direction
+ def last_call(caseName, phoneNumber, direction, type)
+ initializeTest(caseName)
+ @log.debug('Verifying the first recent calls item.')
+ verify_event(0, phoneNumber, direction, type)
+ @log.debug('Changing the view from Recent to Dialled and verifying the event')
+ if(direction == DirMissedIcon_Const)
+ selectView("Recent", "Missed")
+ elsif(direction == DirOutIcon_Const)
+ selectView("Recent", "Dialled")
+ else
+ selectView("Recent", "Received")
+ end
+ verify_event(0, phoneNumber, direction, type)
+ @log.debug('Add one event')
+ @appControl.addEvents(caseName + "b")
+ verify_event(0, phoneNumber + '1', direction, type)
+ verify_event(1, phoneNumber, direction, type)
+ result = 0
+ @appControl.closeApplication()
+ return result
+ end
+
+ ## Function for verifying that the event is correct in the selected row.
+ ## Check the Call type (voice / video), call direction and phone number
+ def verify_event(row, contact, direction, type)
+ puts "Verifying that row: #{row} has a contact/phone number: #{contact}"
+ @log.debug("Verifying that row: #{row} contact/phone number: #{contact}")
+ @eventContainer.HbListViewItem(:row=>"#{row}").HbTextItem(:text=>"#{contact}")
+ @log.debug("Verifying the call type: #{type} by checking the icon")
+ @eventContainer.HbListViewItem(:row=>"#{row}").HbIconItem(:iconName=>"#{type}")
+ @log.debug("Verifying the call direction: #{direction} by checking the icon")
+ ## CHANGE THIS BACK, CURRENTLY 2 ICONS
+ #@recentCallsView.HbAbstractItemContainer.HbAbstractViewItem(:row=>"#{row}").HbIconItem(:iconName=>"#{direction}")
+ end
+
+
+end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/MATTItests/RunTests.rb Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,128 @@
+#!/usr/bin/env ruby
+###################################################################
+# Environment constants. Change these according to your environment
+# Path to your script directory
+@scriptdir = "C:/matti/script/QTLogs/"
+# Path to your test case list
+@testlist = "C:/matti/script/QTLogs/testlist.txt"
+# Path to your log directory file
+@logfile = "C:/matti/script/QTLogs/logs/log.txt"
+# Path to test result file used by ATS3
+@results = "C:/matti/script/QTLogs/logs/testresults.txt"
+###################################################################
+
+require 'logger'
+require 'socket'
+require 'ftools'
+require 'matti'
+require @scriptdir + 'TC_RecentCalls'
+require @scriptdir + 'TC_DialledCalls'
+require @scriptdir + 'TC_Toolbar'
+require @scriptdir + 'TC_MissedCalls'
+require @scriptdir + 'TC_ReceivedCalls'
+require @scriptdir + 'TC_OptionsMenu'
+require @scriptdir + 'TC_EventDetails'
+
+# create Log file
+#time = Time.now.strftime("%d-%m-%Y_%H-%M-%S")
+#logname = time + ".log"
+if(File.exists?(@logfile))
+ File.delete(@logfile)
+end
+file = open(@logfile, File::WRONLY | File::CREAT)
+log = Logger.new(file)
+#log = Logger.new(@logdir + logname)
+log.debug("Establishing HTI connection to the Phone")
+
+#fileresults = open(@results, File::WRONLY | File::CREAT)
+logResults = File.new(@results, File::WRONLY | File::CREAT)
+
+
+begin
+ @my_sut = MATTI.sut(:Id => 'sut_s60_qt')
+ log.debug("Connection established")
+rescue
+ log.fatal("Error: HTI connection establishment failed")
+ exit()
+end
+
+
+if(File.exists?(@testlist) == true)
+ f = File.new(@testlist, "r")
+ begin
+ while (line = f.readline)
+ line.chomp
+ if(!line.include? "//")
+ puts "Starting to run Test case: " + line[0..(line.index('-')-2)]
+ log.debug("- - - - - - - - - - ")
+ log.debug("- - - - - - - - - - ")
+
+ #testname = line[(line.index('.')+1)..line.length].chomp
+ testname = line[(line.index('.')+1)..(line.index('-')-2)].chomp
+ logResults.puts("Title:[#{testname}]")
+
+ if(line.include? "RecentCalls")
+ log.debug("Set:[RecentCalls]")
+ log.debug("Title:[#{testname}]")
+ testSet = TC_RecentCalls.new(log, @my_sut)
+ end
+ if(line.include? "Toolbar")
+ log.debug("Set:[Toolbar]")
+ log.debug("Title:[#{testname}]")
+ testSet = TC_Toolbar.new(log, @my_sut)
+ end
+ if(line.include? "DialledCalls")
+ log.debug("Set:[DialledCalls]")
+ log.debug("Title:[#{testname}]")
+ testSet = TC_DialledCalls.new(log, @my_sut)
+ end
+ if(line.include? "MissedCalls")
+ log.debug("Set:[MissedCalls]")
+ log.debug("Title:[#{testname}]")
+ testSet = TC_MissedCalls.new(log, @my_sut)
+ end
+ if(line.include? "ReceivedCalls")
+ log.debug("Set:[ReceivedCalls]")
+ log.debug("Title:[#{testname}]")
+ testSet = TC_ReceivedCalls.new(log, @my_sut)
+ end
+ if(line.include? "OptionsMenu")
+ log.debug("Set:[OptionsMenu]")
+ log.debug("Title:[#{testname}]")
+ testSet = TC_OptionsMenu.new(log, @my_sut)
+ end
+ if(line.include? "EventDetails")
+ log.debug("Set:[EventDetails]")
+ log.debug("Title:[#{testname}]")
+ testSet = TC_EventDetails.new(log, @my_sut)
+ end
+ result = testSet.run(testname)
+
+ if result == 0
+ puts 'Result: 0 [] ==> PASSED'
+ log.debug('### Result: 0 [] ==> PASSED ###')
+ logResults.puts('Result: 0 [] ==> PASSED')
+ else
+ puts "Result: #{result} [Case failed, check log] ==> FAILED"
+ log.debug("### Result: #{result} [Case failed, check log] ==> FAILED ### ")
+ logResults.puts("Result: #{result} [Case failed, check log] ==> FAILED")
+ end
+ end
+
+ end
+ rescue EOFError
+ f.close
+ end
+else
+ log.error('Test list not found')
+end
+
+
+
+
+
+ #@my_sut.capture_screen(:Filename => 'c:/temp/live.png')
+ #puts @my_sut.application.attribute("FullName")
+ #f = File.new('c:\temp\decorator.xml', "w")
+ #xml = @my_sut.get_ui_dump()
+ #f.puts xml
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/MATTItests/TC_DialledCalls.rb Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,102 @@
+require 'CommonFunctions.rb'
+
+class TC_DialledCalls < CommonFunctions
+
+ ## Initializes the Dialled view. Log events are created and application is started.
+ ## Calls are sorted by Dialled option
+ def initializeDialledView(caseName)
+ initializeTest(caseName)
+ selectView("Recent", "Dialled")
+ end
+
+ ## Initializes the Dialled view. Log events are created and application is started by pressing Send key
+ ## Calls are sorted by Dialled option
+ def intializeDialledViewSendKey(caseName)
+ initializeTestSendKey(caseName)
+ selectView("Recent", "Dialled")
+ end
+
+ ## Test that last dialled CS call is shown in dialled view
+ def last_dialled_CS_call_in_dialled_view
+ result = last_call("case1", "+35812345790", DirOutIcon_Const, VoiceIcon_Const)
+ return result
+ end
+
+ ## Test that last dialled video call is shown in dialled view
+ def last_dialled_video_call_in_dialled_view
+ result = last_call("case2", "+358123457918888", DirOutIcon_Const, VideoIcon_Const)
+ return result
+ end
+
+ ## Test initiating a quick CS callback in dialled calls view
+ def initiate_CS_callback_in_dialled_view
+ intializeDialledViewSendKey("case7")
+ # call to function in CommonFunctions.rb
+ initiate_call_with_send_key()
+ end
+
+ ## Test initiating a quick video callback in dialled calls view
+ def initiate_video_callback_in_dialled_view
+ intializeDialledViewSendKey("case9")
+ # call to function in CommonFunctions.rb
+ initiate_call_with_send_key()
+ end
+
+ ## Test initiating a quick video callback in dialled calls view once the
+ ## list is scrolled down
+ def initiate_video_callback_in_dialled_view_scrolling
+ intializeDialledViewSendKey("case9")
+ # call to function in CommonFunctions.rb
+ # Scroll down the list!! IMPLEMENT THIS
+ initiate_call_with_send_key()
+ end
+
+ ## Test initiating CS call to first event in dialled calls view
+ def initiate_CS_call_to_first_event_in_dialled_view
+ initializeDialledView("case8")
+ # call to function in CommonFunctions.rb
+ initiate_call("0", "+3580123456789")
+ end
+
+ ## Test initiating CS call to last event in dialled calls view
+ def initiate_CS_call_to_last_event_in_dialled_view
+ initializeDialledView("case8")
+ # call to function in CommonFunctions.rb
+ initiate_call("1", "+358012345678910")
+ end
+
+ ## Test that contact name is displyed correctly in dialled view
+ def matching_contact_name_dialled_CS_call
+ initializeDialledView("case10")
+ #match_conctact("2", "Test")
+ verify_event(1, "Test", DirOutIcon_Const, VoiceIcon_Const)
+ @appControl.closeApplication()
+ return 0
+ end
+
+ ## Test that contact name is displyed correctly in dialled view
+ def matching_contact_name_dialled_video_call
+ initializeDialledView("case10")
+ verify_event(0, "Testing The Test", DirOutIcon_Const, VideoIcon_Const)
+ @appControl.closeApplication()
+ return 0
+ end
+
+
+ ## Test pressing Send key in Idle mode and verify that dialled calls view is opened
+ def pressing_send_key_in_idle_mode
+ intializeDialledViewSendKey("case8")
+ sleep 5
+ #my_app = @my_sut.application.attribute("FullName")
+ #puts my_app
+ #@my_sut.application.close
+ #my_app = @my_sut.application.attribute("FullName")
+ #puts my_app
+ # Verfiy that the application is logs and the menu is dialled
+ # case is not finished
+ # Check the UI components that must be there. If not there, case fails
+ #dialledCallsView = my_app.HbMainWindow.HbContentWidget.LogsDialledCallsView.HbWidget
+ #@log.debug('Verifying that the view name is "Recent calls"')
+ #dialledCallsView.HbLabel(:text=>'Dialed calls')
+ end
+end
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/MATTItests/TC_EventDetails.rb Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,64 @@
+require 'CommonFunctions.rb'
+
+class TC_EventDetails < CommonFunctions
+
+ ## Test that dialled call event can be deleted from event specifc view
+ def deleting_dialled_call_event_in_the_event_specific_view
+ initializeTest("case8")
+ delete_event_from_event_specific_view(4, "Dialled", "+358012345678910", DirOutIcon_Const)
+ end
+
+ ## Test that missed call event can be deleted from event specifc view
+ def deleting_missed_call_event_in_the_event_specific_view
+ initializeTest("case8")
+ delete_event_from_event_specific_view(0, "Missed", "088012345678910", DirMissedIcon_Const)
+ end
+
+ ## Test that dialled call event can be deleted from event specifc view
+ def deleting_received_call_event_in_the_event_specific_view
+ initializeTest("case8")
+ delete_event_from_event_specific_view(2, "Received", "88012345678910", DirInIcon_Const)
+ end
+
+ ## Test that event specific data is displayed correclty for dialled call. Contact has contact name
+ def displaying_event_specific_data_dialled_CS_call_contact_name_assigned
+ initializeTest("case11")
+ @log.debug('Long tapping the dialled event')
+ @eventContainer.HbListViewItem(:row=>"7").long_tap
+ @mainWindow.HbMenu.HbMenuListView.HbAbstractItemContainer.HbMenuItem(:row=>'2').tap
+ sleep 2
+
+
+ end
+
+
+
+
+ def delete_event_from_event_specific_view(row, view, verificationPhoneNumber, direction)
+ @log.debug('Long tapping the dialled event')
+ @eventContainer.HbListViewItem(:row=>"#{row}").long_tap
+ @mainWindow.HbMenu.HbMenuListView.HbAbstractItemContainer.HbMenuItem(:row=>'2').tap
+ sleep 2
+ puts "tapping finished"
+ @log.debug('Tapping the options menu')
+ @mainWindow.HbTitlePane.tap
+ @log.debug('Selecting Delete Event from the options menu')
+ @mainWindow.HbMenu.HbMenuListView.HbAbstractItemContainer.HbMenuItem(:row=>'4').HbTextItem(:text=>'Delete event').tap
+
+ verify_event("#{row}", verificationPhoneNumber, direction, VoiceIcon_Const)
+ selectView("Recent", view)
+ verify_event("0", verificationPhoneNumber, direction, VoiceIcon_Const)
+ begin
+ @eventContainer.HbListViewItem(:row=>"1")
+ rescue
+ #Expected, as there should be only one event left
+ @appControl.closeApplication()
+ return 0
+ end
+ @appControl.closeApplication()
+ return -2
+ end
+
+
+
+end
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/MATTItests/TC_MissedCalls.rb Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,60 @@
+require 'CommonFunctions.rb'
+
+class TC_MissedCalls < CommonFunctions
+
+ ## Initializes the Missed view. Log events are created and application is started.
+ ## Calls are sorted by Missed option
+ def initializeMissedView(caseName)
+ initializeTest(caseName)
+ selectView("Recent", "Missed")
+ end
+
+ ## Initializes the Missed view. Log events are created and application is started by pressing Send ky
+ ## Calls are sorted by Missed option
+ def initializeMissedViewSendKey(caseName)
+ initializeTestSendKey(caseName)
+ selectView("Recent", "Missed")
+ end
+
+ ## Test that last missed CS call is shown in missed view
+ def last_missed_CS_call_in_missed_view
+ result = last_call("case5", "358123461", DirMissedIcon_Const, VoiceIcon_Const)
+ return result
+ end
+
+ ## Test that last missed video call is shown in missed view
+ def last_missed_video_call_in_missed_view
+ result = last_call("case6", "558123461", DirMissedIcon_Const, VideoIcon_Const)
+ return result
+ end
+
+ ## Test initiating CS call to first event in missed calls view
+ def initiate_CS_call_to_first_event_in_missed_view
+ initializeMissedView("case8")
+ # call to function in CommonFunctions.rb
+ initiate_call("0", "088012345678911")
+ end
+
+ ## Test initiating CS call to last event in missed calls view
+ def initiate_CS_call_to_last_event_in_missed_view
+ initializeMissedView("case8")
+ # call to function in CommonFunctions.rb
+ initiate_call("1", "088012345678910")
+ end
+
+ ## Test initiating a quick CS callback in missed calls view
+ def initiate_CS_callback_in_missed_view
+ initializeMissedViewSendKey("case7")
+ # call to function in CommonFunctions.rb
+ initiate_call_with_send_key()
+ end
+
+ ## Test that contact name is displyed correctly in missed view
+ def matching_contact_name_missed_CS_call
+ initializeMissedView("case10")
+ verify_event(0, "Keke Rosberg", DirMissedIcon_Const, VoiceIcon_Const)
+ @appControl.closeApplication()
+ return 0
+ end
+
+end
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/MATTItests/TC_OptionsMenu.rb Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,123 @@
+require 'CommonFunctions.rb'
+
+class TC_OptionsMenu < CommonFunctions
+
+ ## Initializes the Application. Log events are created and application is started.
+ def initializeOptionsMenu(caseName)
+ initializeTest(caseName)
+ end
+
+ ## Test that event list can be cleaned in recent view
+ def clear_event_list_recent_view
+ initializeOptionsMenu("case8")
+ @log.debug('Tapping the options menu')
+ @mainWindow.HbTitlePane.tap
+ @log.debug('Selecting "Clear list" options menu')
+ @optionsMenu = @mainWindow.HbMenu.HbMenuListView.HbAbstractItemContainer
+ @optionsMenu.HbMenuItem(:row=>'1').HbTextItem(:text=>'Clear list').tap
+ begin
+ @log.debug('Verify that there are no event items anymore left')
+ @eventContainer.HbListViewItem(:row=>"0")
+ rescue
+ #Expected, case passed as no items left anymore
+ result = 0
+ @appControl.closeApplication()
+ return result
+ end
+ @log.fatal('There are still event items left!')
+ return -2
+ end
+
+ ## Test that event list can be cleaned in recent view
+ def clear_event_list_missed_view
+ return clear_event_list("Missed")
+ end
+
+ ## Test that event list can be cleaned in recent view
+ def clear_event_list_dialled_view
+ return clear_event_list("Dialled")
+ end
+
+ ## Test that event list can be cleaned in recent view
+ def clear_event_list_received_view
+ return clear_event_list("Received")
+ end
+
+ def clear_event_list(view)
+ initializeOptionsMenu("case8")
+ selectView("Recent", view)
+ @log.debug('Tapping the options menu')
+ @mainWindow.HbTitlePane.tap
+ @log.debug('Selecting "Clear list" options menu')
+ @optionsMenu = @mainWindow.HbMenu.HbMenuListView.HbAbstractItemContainer
+ @optionsMenu.HbMenuItem(:row=>'1').HbTextItem(:text=>'Clear list').tap
+ begin
+ @log.debug('Verify that there are no event items anymore left')
+ @eventContainer.HbListViewItem(:row=>"0")
+ rescue
+ #Expected, no items left in selected view view
+ @log.debug("No event items anymore left in #{view} view")
+ @log.debug('Verify Recent view, all other event items should be still there')
+ if(view == "Missed")
+ selectView("Missed", "Recent")
+ verify_event("0", "880123456789", DirInIcon_Const, VoiceIcon_Const)
+ verify_event("3", "+358012345678910", DirOutIcon_Const, VoiceIcon_Const)
+ elsif(view == "Dialled")
+ selectView("Dialled", "Recent")
+ verify_event("0", "088012345678911", DirMissedIcon_Const, VoiceIcon_Const)
+ verify_event("3", "88012345678910", DirInIcon_Const, VoiceIcon_Const)
+ else
+ selectView("Received", "Recent")
+ verify_event("0", "088012345678911", DirMissedIcon_Const, VoiceIcon_Const)
+ verify_event("3", "+358012345678910", DirOutIcon_Const, VoiceIcon_Const)
+ end
+ result = 0
+ @appControl.closeApplication()
+ return result
+ end
+ @log.fatal('There are still event items left in #{view} view!')
+ return -2
+ end
+
+ ## Test that logs application is closed when tapping on back
+ def exit_logs_by_selecting_back
+ initializeOptionsMenu("case8")
+ @log.debug('Tapping the Back button')
+ @my_app.LogsMainWindow.HbSoftKey({:visibleOnScreen => 'true'}).tap
+ if(@my_sut.application.attribute("FullName") == "Z:\sys\bin\logs.exe")
+ log.fatal("Error in closing logs application from Exit options menu. Logs still running!")
+ appControl.closeApplication()
+ result = -2
+ else
+ result = 0
+ end
+ return result
+ end
+
+ ## Test that logs application is closed when selecting exit from options menu
+ def exit_logs_by_selecting_exit_from_options_menu
+ initializeOptionsMenu("case8")
+ @log.debug('Tapping the options menu')
+ @my_app.LogsMainWindow.HbTitlePane.tap
+ @log.debug('Selecting "Exit" options menu')
+ @my_app.LogsMainWindow.HbMenu.HbMenuListView.HbAbstractItemContainer.HbMenuItem(:row=>'3').HbTextItem(:text=>'Exit').tap
+ if(@my_sut.application.attribute("FullName") == "Z:\sys\bin\logs.exe")
+ log.fatal("Error in closing logs application from Exit options menu. Logs still running!")
+ appControl.closeApplication()
+ result = -2
+ else
+ result = 0
+ end
+ return result
+ end
+
+
+
+end
+
+
+ #@my_sut.capture_screen(:Filename => 'c:/temp/live.png')
+ #puts @my_sut.application.attribute("FullName")
+ #f = File.new('c:\temp\decorator.xml', "w")
+ #xml = @my_sut.get_ui_dump()
+ #f.puts xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/MATTItests/TC_ReceivedCalls.rb Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,60 @@
+require 'CommonFunctions.rb'
+
+class TC_ReceivedCalls < CommonFunctions
+
+ ## Initializes the Received view. Log events are created and application is started.
+ ## Calls are sorted by Received option
+ def initializeReceivedView(caseName)
+ initializeTest(caseName)
+ selectView("Recent", "Received")
+ end
+
+ ## Initializes the Received view. Log events are created and application is started by pressing Send key
+ ## Calls are sorted by Received option
+ def initializeReceivedViewSendKey(caseName)
+ initializeTestSendKey(caseName)
+ selectView("Recent", "Received")
+ end
+
+ ## Test that last received CS call is shown in received view
+ def last_received_CS_call_in_received_view
+ result = last_call("case3", "358123457918889", DirInIcon_Const, VoiceIcon_Const)
+ return result
+ end
+
+ ## Test that last received video call is shown in received view
+ def last_received_video_call_in_received_view
+ result = last_call("case4", "358123457918810", DirInIcon_Const, VideoIcon_Const)
+ return result
+ end
+
+ ## Test initiating CS call to first event in received calls view
+ def initiate_CS_call_to_first_event_in_received_view
+ initializeReceivedView("case8")
+ # call to function in CommonFunctions.rb
+ initiate_call("0", "880123456789")
+ end
+
+ ## Test initiating CS call to last event in received calls view
+ def initiate_CS_call_to_last_event_in_received_view
+ initializeReceivedView("case8")
+ # call to function in CommonFunctions.rb
+ initiate_call("1", "88012345678910")
+ end
+
+ ## Test initiating a quick CS callback in received calls view
+ def initiate_CS_callback_in_received_view
+ initializeReceivedViewSendKey("case7")
+ # call to function in CommonFunctions.rb
+ initiate_call_with_send_key()
+ end
+
+ ## Test that contact name is displyed correctly in received view
+ def matching_contact_name_received_CS_call
+ initializeReceivedView("case10")
+ verify_event(0, "Testing1 050", DirInIcon_Const, VoiceIcon_Const)
+ @appControl.closeApplication()
+ return 0
+ end
+
+end
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/MATTItests/TC_RecentCalls.rb Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,42 @@
+require 'CommonFunctions.rb'
+
+class TC_RecentCalls < CommonFunctions
+
+ ## Initializes the Recent view. Log events are created and application is started
+ def initializeRecentView(caseName)
+ initializeTest(caseName)
+ @log.debug('Verifying that the view name is "Recent calls"')
+ @recentCallsView.HbLabel(:text=>'Recent calls')
+ #@appControl.startCallService()
+ end
+
+ ## Test initiating CS call to first dialled event in recent calls view
+ def initiate_CS_call_to_first_dialled_event_in_recent_view
+ # call to function in CommonFunctions.rb
+ initializeRecentView("case8")
+ initiate_call("4", "+3580123456789")
+ end
+
+ ## Test initiating CS call to first missed event in recent calls view
+ def initiate_CS_call_to_first_missed_event_in_recent_view
+ # call to function in CommonFunctions.rb
+ initializeRecentView("case8")
+ initiate_call("0", "088012345678911")
+ end
+
+ ## Test initiating CS call to first received event in recent calls view
+ def initiate_CS_call_to_first_received_event_in_recent_view
+ # call to function in CommonFunctions.rb
+ initializeRecentView("case8")
+ initiate_call("2", "880123456789")
+ end
+
+ ## Test initiating a quick video callback by pressing Send key in recent calls view
+ def initiate_CS_callback_in_recent_view
+ initializeRecentView("case9")
+ # call to function in CommonFunctions.rb
+ initiate_call_with_send_key()
+ end
+
+
+end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/MATTItests/TC_Toolbar.rb Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,56 @@
+require 'ApplicationControl.rb'
+require 'CommonFunctions.rb'
+
+class TC_Toolbar < CommonFunctions
+
+ ## Test that log is sorted to contain only dialled calls.
+ def sort_call_log_dialled_calls
+ return sort_call_log("Dialled", DirOutIcon_Const)
+ end
+
+ ## Test that log is sorted to contain only received calls.
+ def sort_call_log_received_calls
+ return sort_call_log("Received", DirInIcon_Const)
+ end
+
+ ## Test that log is sorted to contain only missed calls.
+ def sort_call_log_missed_calls
+ return sort_call_log("Missed", DirMissedIcon_Const)
+ end
+
+ ## Common functionality for sorting the calls
+ ## It sorts the log according to criteria passed in and verfies that the list is sorted
+ ## Finally it switches back to Recent view and verifies the list again
+ def sort_call_log(criteria, icon)
+ initializeTest("case8")
+ selectView("Recent", criteria)
+
+ @log.debug("Verify that only #{criteria} calls are displayed and they are in correct order")
+
+ if(criteria == "Dialled")
+ verify_event("1", "+358012345678910", DirOutIcon_Const, VoiceIcon_Const)
+ verify_event("0", "+3580123456789", DirOutIcon_Const, VoiceIcon_Const)
+ elsif(criteria == "Received")
+ verify_event("1", "88012345678910", DirInIcon_Const, VoiceIcon_Const)
+ verify_event("0", "880123456789", DirInIcon_Const, VoiceIcon_Const)
+ else
+ verify_event("1", "088012345678910", DirMissedIcon_Const, VoiceIcon_Const)
+ verify_event("0", "088012345678911", DirMissedIcon_Const, VoiceIcon_Const)
+ end
+
+ @log.debug("Change back to Recent view and verify that all events are displayed")
+ selectView(criteria, "Recent")
+
+ verify_event("5", "+358012345678910", DirOutIcon_Const, VoiceIcon_Const)
+ verify_event("4", "+3580123456789", DirOutIcon_Const, VoiceIcon_Const)
+ verify_event("3", "88012345678910", DirInIcon_Const, VoiceIcon_Const)
+ verify_event("2", "880123456789", DirInIcon_Const, VoiceIcon_Const)
+ verify_event("1", "088012345678910", DirMissedIcon_Const, VoiceIcon_Const)
+ verify_event("0", "088012345678911", DirMissedIcon_Const, VoiceIcon_Const)
+
+ result = 0
+ @appControl.closeApplication()
+ return result
+
+ end
+end
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/MATTItests/testlist.txt Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,40 @@
+//RecentCalls.initiate_CS_call_to_first_dialled_event_in_recent_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//RecentCalls.initiate_CS_call_to_first_missed_event_in_recent_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//RecentCalls.initiate_CS_call_to_first_received_event_in_recent_view - Comments:Blocked, cannot have 2 applications in MATTI at the same time
+//RecentCalls.initiate_CS_callback_in_recent_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//MissedCalls.last_missed_CS_call_in_missed_view - Comments: PASSED
+//MissedCalls.last_missed_video_call_in_missed_view - Comments: PASSED
+//MissedCalls.initiate_CS_call_to_first_event_in_missed_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//MissedCalls.initiate_CS_call_to_last_event_in_missed_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//MissedCalls.initiate_CS_callback_in_missed_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//MissedCalls.matching_contact_name_missed_CS_call - Comments: PASSED
+//ReceivedCalls.last_received_CS_call_in_received_view - Comments: PASSED
+//ReceivedCalls.last_received_video_call_in_received_view - Comments: PASSED
+//ReceivedCalls.initiate_CS_call_to_first_event_in_received_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//ReceivedCalls.initiate_CS_call_to_last_event_in_received_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//ReceivedCalls.initiate_CS_callback_in_received_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//ReceivedCalls.matching_contact_name_received_CS_call - Comments: PASSED
+//DialledCalls.last_dialled_CS_call_in_dialled_view - Comments: PASSED
+//DialledCalls.last_dialled_video_call_in_dialled_view - Comments: PASSED
+//DialledCalls.initiate_CS_call_to_first_event_in_dialled_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//DialledCalls.initiate_CS_call_to_last_event_in_dialled_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//DialledCalls.initiate_CS_callback_in_dialled_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//DialledCalls.initiate_video_callback_in_dialled_view - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//DialledCalls.initiate_video_callback_in_dialled_view_scrolling - Comments: Blocked, cannot have 2 applications in MATTI at the same time
+//DialledCalls.pressing_send_key_in_idle_mode - Comments: Blocked, pressind Send key in QT does not work, should work soon
+//DialledCalls.matching_contact_name_dialled_CS_call - Comments: PASSED
+//DialledCalls.matching_contact_name_dialled_video_call - Comments: PASSED
+//Toolbar.sort_call_log_dialled_calls - Comments: PASSED
+//Toolbar.sort_call_log_received_calls - Comments: PASSED
+//Toolbar.sort_call_log_missed_calls - Comments: PASSED
+//OptionsMenu.exit_logs_by_selecting_exit_from_options_menu - Comments: PASSED
+//OptionsMenu.exit_logs_by_selecting_back - Comments: PASSED
+//OptionsMenu.clear_event_list_recent_view - Comments: PASSED
+//OptionsMenu.clear_event_list_missed_view - Comments: PASSED
+//OptionsMenu.clear_event_list_received_view - Comments: PASSED
+//OptionsMenu.clear_event_list_dialled_view - Comments: PASSED
+//EventDetails.deleting_dialled_call_event_in_the_event_specific_view - Comments: PASSED
+//EventDetails.deleting_missed_call_event_in_the_event_specific_view - Comments: PASSED
+//EventDetails.deleting_received_call_event_in_the_event_specific_view - Comments: PASSED
+//EventDetails.displaying_event_specific_data_dialled_CS_call_contact_name_assigned - Comments: UNFINISHED
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation/install/serviceapp.pkg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,39 @@
+;
+; 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:
+;
+; Language
+
+&EN
+
+; SIS header: name, uid, version
+#{"serviceapp"},(0xE0022E73),1,0,0
+
+; Localised Vendor name
+%{"Nokia, Qt Software"}
+
+; Unique Vendor name
+:"Nokia, Qt Software"
+
+; Dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+(0x2001E61C), 4, 5, 0, {"QtLibs pre-release"}
+
+; Executable and default resource files
+"\epoc32\release\armv5\urel\serviceapp.exe" - "!:\sys\bin\serviceapp.exe"
+"\epoc32\data\z\resource\apps\serviceapp.rsc" - "!:\resource\apps\serviceapp.rsc"
+"\epoc32\data\z\private\10003a3f\import\apps\serviceapp_reg.rsc" - "!:\private\10003a3f\import\apps\serviceapp_reg.rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation/service_conf.xml Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<service name="com.nokia.services" filepath="must-not-be-empty" >
+ <description>Telephony service</description>
+ <interface name="telephony" version="1.0" capabilities="">
+ <description>Dial interface</description>
+ </interface>
+</service>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation/serviceapp.pro Tue May 04 12:39:37 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:
+#
+
+SERVICEAPP=app
+TARGET=serviceapp
+
+CONFIG += service
+
+symbian:TARGET.UID3 = 0xE0022E73
+
+XQSERVICE_ROOT=../../../qthighway
+include(../../../qthighway/xqservicebase.pri)
+include(src/serviceapp.pri)
+
+LIBS+=-lxqservice -lxqserviceutil
+
+SERVICE.FILE = service_conf.xml
+SERVICE.OPTIONS = embeddable
+
+libFiles.sources = serviceapp.exe
+libFiles.path = "!:\sys\bin"
+DEPLOYMENT += libFiles
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation/src/main.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* 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 <QApplication>
+#include "serviceapp.h"
+
+int main(int argc, char **argv)
+{
+ QApplication a( argc, argv );
+
+ ServiceApp *cl = new ServiceApp();
+ cl->show();
+ int rv = a.exec();
+ delete cl;
+ return rv;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation/src/serviceapp.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,176 @@
+/*
+* 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 <QApplication>
+#include <QKeyEvent>
+#include <QLabel>
+#include <QVBoxLayout>
+#include <QStackedWidget>
+#include <QImageReader>
+#include <QDebug>
+#include <QTimer>
+#include <QPushButton>
+#include <QLineEdit>
+#include <QListView>
+
+
+#include "serviceapp.h"
+#include <xqserviceutil.h>
+
+ServiceApp::ServiceApp(QWidget *parent, Qt::WFlags f)
+ : QWidget(parent, f)
+{
+
+ mService = new DialerService(this);
+ /* Adjust the palette */
+#if defined(Q_WS_S60)
+ QPalette p = qApp->palette();
+ QColor color(80,20,20);
+ QColor bg(20,20,20);
+ p.setColor(QPalette::Highlight, color.lighter(200));
+ p.setColor(QPalette::Text, Qt::white);
+ p.setColor(QPalette::Base, bg);
+ p.setColor(QPalette::WindowText, Qt::white);
+ p.setColor(QPalette::Window, bg);
+ p.setColor(QPalette::ButtonText, Qt::white);
+ p.setColor(QPalette::Button, color.lighter(150));
+ p.setColor(QPalette::Link, QColor(240,40,40));
+
+ qApp->setPalette(p);
+#endif
+
+ QPushButton *quitButton = new QPushButton(tr("Quit"));
+ connect(quitButton, SIGNAL(clicked()), this, SLOT(quit()));
+
+ /*
+ mEndCallButton = new QPushButton(tr("End Call"));
+ mEndCallButton->setEnabled(false);
+ connect(mEndCallButton, SIGNAL(clicked()), this, SLOT(endCall()));
+ */
+ QString t = "SERVICE DIAL -> ";
+ t = t + (XQServiceUtil::isEmbedded() ? " EMBEDDED" : " NOT EMBEDDED");
+ QLabel *title = new QLabel(t);
+
+ mLabel = new QLabel(tr("PHONE"));
+ mNumber = new QLabel(tr("******"));
+
+ QVBoxLayout *vl = new QVBoxLayout;
+ vl->setMargin(0);
+ vl->setSpacing(0);
+
+ vl->addWidget(title);
+ vl->addWidget(mLabel);
+ vl->addWidget(mNumber);
+ vl->addWidget(quitButton);
+
+ setLayout(vl);
+#if defined(Q_WS_X11) || defined(Q_WS_WIN)
+ setFixedSize(QSize(360,640)); // nHD
+#elif defined(Q_WS_S60)
+ showMaximized();
+ showFullScreen();
+#endif
+// new DialerService(this);
+}
+
+
+ServiceApp::~ServiceApp()
+{
+}
+
+void ServiceApp::quit()
+{
+ if (mService->asyncAnswer()) {
+ connect(mService, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
+ mService->complete(mNumber->text());
+ }
+ else {
+ qApp->quit();
+ }
+}
+
+void ServiceApp::endCall()
+{
+ //QVBoxLayout *vl = qobject_cast<QVBoxLayout *>(layout()) ;
+ //vl->removeWidget(mEndCallButton);
+
+ //XQServiceUtil::toBackground(true);
+}
+
+void ServiceApp::setLabelNumber(QString label,QString number)
+{
+ //QVBoxLayout *vl = qobject_cast<QVBoxLayout *>(layout()) ;
+ //vl->insertWidget(1,mEndCallButton);
+ mLabel->setText(label);
+ mNumber->setText(number);
+}
+
+
+DialerService::DialerService(ServiceApp* parent)
+: XQServiceProvider(QLatin1String("com.nokia.services.telephony"),parent),mServiceApp(parent)
+{
+publishAll();
+}
+
+DialerService::~DialerService()
+{
+}
+
+void DialerService::complete(QString number)
+{
+ completeRequest(0,number.toInt());
+}
+
+void DialerService::dial(const QString& number)
+{
+ qDebug() << "DialerService::dial (number):" << number;
+ QString label = "PHONE dialing (number):" ;
+ mServiceApp->setLabelNumber(label,number);
+}
+
+void DialerService::dial(const QString& number, int contactId)
+{
+ qDebug() << "DialerService::dial to num:" << number << "contactId:" << contactId;
+ QString label = "PHONE dialing (number+contact):" ;
+ QString num;
+ num.append( number );
+ num.append(" ");
+ QString contactStr;
+ contactStr.setNum(contactId);
+ num.append( contactStr );
+ mServiceApp->setLabelNumber(label,num);
+}
+
+void DialerService::dialVideo(const QString& number)
+{
+ qDebug() << "DialerService::dialVideo (number):" << number;
+ QString label = "PHONE dialing video (number):" ;
+ mServiceApp->setLabelNumber(label,number);
+}
+
+void DialerService::dialVideo(const QString& number, int contactId)
+{
+ qDebug() << "DialerService::dialVideo to num:" << number << "contactId:" << contactId;
+ QString label = "PHONE dialing video (number+contact):" ;
+ QString num;
+ num.append( number );
+ num.append(" ");
+ QString contactStr;
+ contactStr.setNum(contactId);
+ num.append( contactStr );
+ mServiceApp->setLabelNumber(label,num);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation/src/serviceapp.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* 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 PHONESERVICE_H
+#define PHONESERVICE_H
+
+#include <QWidget>
+#include <QModelIndex>
+#include <QMap>
+#include <QStringList>
+#include <xqserviceprovider.h>
+
+class QLineEdit;
+class QPushButton;
+class DialerService;
+class QLabel;
+
+class ServiceApp : public QWidget
+{
+ Q_OBJECT
+public:
+ ServiceApp( QWidget *parent = 0, Qt::WFlags f = 0 );
+ ~ServiceApp();
+
+ void setLabelNumber(QString label,QString number);
+
+public slots:
+ void endCall();
+
+private slots:
+ void quit();
+private:
+ QLabel *mLabel;
+ QLabel *mNumber;
+ //QPushButton *mEndCallButton;
+ DialerService* mService;
+};
+
+class DialerService : public XQServiceProvider
+{
+ Q_OBJECT
+public:
+ DialerService( ServiceApp *parent = 0 );
+ ~DialerService();
+
+ void complete(QString number);
+ bool asyncAnswer() {return mAsyncAnswer;}
+public slots:
+ void dial(const QString& number);
+ void dial(const QString& number,int contactId);
+ void dialVideo(const QString& number);
+ void dialVideo(const QString& number,int contactId);
+
+private:
+ ServiceApp* mServiceApp;
+ QString mNumber;
+ bool mAsyncAnswer;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation/src/serviceapp.pri Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,23 @@
+#
+# 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:
+#
+
+SOURCES=\
+ src/main.cpp\
+ src/serviceapp.cpp
+
+HEADERS=\
+ src/serviceapp.h
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation2/install/serviceapp2.pkg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,39 @@
+;
+; 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:
+;
+; Language
+
+&EN
+
+; SIS header: name, uid, version
+#{"serviceapp2"},(0xE0011E73),1,0,0
+
+; Localised Vendor name
+%{"Nokia, Qt Software"}
+
+; Unique Vendor name
+:"Nokia, Qt Software"
+
+; Dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+(0x2001E61C), 4, 5, 0, {"QtLibs pre-release"}
+
+; Executable and default resource files
+"\epoc32\release\armv5\urel\serviceapp2.exe" - "!:\sys\bin\serviceapp2.exe"
+"\epoc32\data\z\resource\apps\serviceapp2.rsc" - "!:\resource\apps\serviceapp2.rsc"
+"\epoc32\data\z\private\10003a3f\import\apps\serviceapp2_reg.rsc" - "!:\private\10003a3f\import\apps\serviceapp2_reg.rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation2/service_conf.xml Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<service name="com.nokia.services" filepath="must-not-be-empty" >
+ <description>Telephony service</description>
+ <interface name="telephony" version="1.0" capabilities="">
+ <description>Dial interface</description>
+ </interface>
+</service>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation2/serviceapp2.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,41 @@
+#
+# 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:
+#
+
+SERVICEAPP=app
+TARGET=serviceapp2
+
+CONFIG += hb
+CONFIG += service
+
+#XQSERVICE_ROOT=../../../qthighway
+#include(../../../qthighway/xqservicebase.pri)
+include(src/serviceapp.pri)
+
+LIBS+=-lxqservice -lxqserviceutil
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xE0011E73
+ TARGET.CAPABILITY = CAP_APPLICATION
+}
+
+SERVICE.FILE = service_conf.xml
+SERVICE.OPTIONS = embeddable
+
+libFiles.sources = serviceapp2.exe
+libFiles.path = "!:\sys\bin"
+DEPLOYMENT += libFiles
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation2/src/main.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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 <hbapplication.h>
+#include <hblineedit.h>
+#include <hbmainwindow.h>
+#include <QDebug>
+#include "serviceapp.h"
+
+int main(int argc, char **argv)
+{
+
+ qDebug() << "ServiceApp::main ->";
+
+
+ HbApplication app(argc, argv);
+
+ HbMainWindow mainWindow;
+
+ DialerService* dialer = new DialerService();
+ ServiceApp serviceApp(dialer);
+ mainWindow.addView(&serviceApp);
+
+ // Show widget
+ mainWindow.show();
+
+ // Enter event loop
+ int err = app.exec();
+ qDebug() << "ServiceApp::main <-";
+ return err;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation2/src/serviceapp.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* 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 <QGraphicsLinearLayout>
+#include <QDebug>
+#include <hblineedit.h>
+
+#include "serviceapp.h"
+#include <xqserviceutil.h>
+
+ServiceApp::ServiceApp( DialerService* service )
+ : QGraphicsWidget(), mService( service )
+{
+ qDebug() << "ServiceApp::ServiceApp ->";
+ mMainLayout = new QGraphicsLinearLayout(Qt::Vertical);
+ mLabel = new HbLineEdit("Callservice simulation");
+ mNumber = new HbLineEdit("");
+ mMainLayout->addItem(mLabel);
+ mMainLayout->addItem(mNumber);
+ setLayout(mMainLayout);
+ if ( mService ){
+ setLabelNumber( mService->label(), mService->number() );
+ connect( mService, SIGNAL(labelChanged(QString)),
+ mLabel, SLOT(setText(const QString &)) );
+ connect( mService, SIGNAL(numberChanged(QString)),
+ mNumber, SLOT(setText(const QString &)) );
+ }
+ qDebug() << "ServiceApp::ServiceApp <-";
+
+}
+
+
+ServiceApp::~ServiceApp()
+{
+ qDebug() << "ServiceApp::~ServiceApp ->";
+ delete mMainLayout;
+ delete mLabel;
+ delete mNumber;
+ delete mService;
+ qDebug() << "ServiceApp::~ServiceApp <-";
+}
+
+void ServiceApp::setLabelNumber(QString label,QString number)
+{
+ mLabel->setText(label);
+ mNumber->setText(number);
+}
+
+
+DialerService::DialerService()
+: XQServiceProvider(QLatin1String("com.nokia.services.telephony"),0)
+{
+ publishAll();
+}
+
+DialerService::~DialerService()
+{
+ qDebug() << "DialerService::~DialerService <->";
+}
+
+void DialerService::dial(const QString& number)
+{
+ qDebug() << "DialerService::dial (number):" << number;
+ QString label = "PHONE dialing (number):" ;
+ mLabel = label;
+ mNumber = number;
+ emit labelChanged(mLabel);
+ emit numberChanged(mNumber);
+}
+
+void DialerService::dial(const QString& number, int contactId)
+{
+ qDebug() << "DialerService::dial to num:" << number << "contactId:" << contactId;
+ QString label = "PHONE dialing (number+contact):" ;
+ QString num;
+ num.append( number );
+ num.append(" ");
+ QString contactStr;
+ contactStr.setNum(contactId);
+ num.append( contactStr );
+ mLabel = label;
+ mNumber = number;
+ emit labelChanged(mLabel);
+ emit numberChanged(mNumber);
+}
+
+void DialerService::dialVideo(const QString& number)
+{
+ qDebug() << "DialerService::dialVideo (number):" << number;
+ QString label = "PHONE dialing video (number):" ;
+ mLabel = label;
+ mNumber = number;
+ emit labelChanged(mLabel);
+ emit numberChanged(mNumber);
+}
+
+void DialerService::dialVideo(const QString& number, int contactId)
+{
+ qDebug() << "DialerService::dialVideo to num:" << number << "contactId:" << contactId;
+ QString label = "PHONE dialing video (number+contact):" ;
+ QString num;
+ num.append( number );
+ num.append(" ");
+ QString contactStr;
+ contactStr.setNum(contactId);
+ num.append( contactStr );
+ mLabel = label;
+ mNumber = number;
+ emit labelChanged(mLabel);
+ emit numberChanged(mNumber);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation2/src/serviceapp.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* 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 PHONESERVICE_H
+#define PHONESERVICE_H
+
+#include <QObject>
+#include <QModelIndex>
+#include <QMap>
+#include <QStringList>
+#include <xqserviceprovider.h>
+#include <QGraphicsWidget>
+
+class DialerService;
+class HbLineEdit;
+class QGraphicsLinearLayout;
+class DialerService;
+
+class ServiceApp : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ ServiceApp(DialerService* service);
+ ~ServiceApp();
+
+ void setLabelNumber(QString label,QString number);
+
+private:
+ QGraphicsLinearLayout *mMainLayout;
+ HbLineEdit* mLabel;
+ HbLineEdit* mNumber;
+ DialerService* mService;
+};
+
+class DialerService : public XQServiceProvider
+{
+ Q_OBJECT
+public:
+ DialerService();
+ ~DialerService();
+
+ QString label(){
+ return mLabel;
+ }
+ QString number(){
+ return mNumber;
+ }
+
+signals:
+
+ void labelChanged(QString label);
+ void numberChanged(QString number);
+
+public slots:
+ void dial(const QString& number);
+ void dial(const QString& number,int contactId);
+ void dialVideo(const QString& number);
+ void dialVideo(const QString& number,int contactId);
+
+private:
+ QString mLabel;
+ QString mNumber;
+ bool mAsyncAnswer;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/callservicesimulation2/src/serviceapp.pri Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,23 @@
+#
+# 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:
+#
+
+SOURCES=\
+ src/main.cpp\
+ src/serviceapp.cpp
+
+HEADERS=\
+ src/serviceapp.h
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/install/logs_stub.pkg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,40 @@
+;
+; 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 SIS stub for Logs
+
+; Supported languages
+&EN
+
+; Header
+#{"Logs"},(0x101F4CD5),1,0,0,TYPE=SA
+
+; Localised Vendor name
+%{"Symbian"}
+
+; Unique Vendor name
+:"Symbian"
+
+
+; Backup registration and restore
+""-"z:\private\101F4CD5\backup_registration.xml"
+
+; User interface
+""-"z:\sys\bin\logs.exe"
+""-"z:\sys\bin\logsengine.dll"
+""-"z:\sys\bin\logsservices.dll"
+""-"z:\sys\bin\logscntfinder.dll"
+""-"z:\resource\apps\logs.rsc"
+""-"z:\private\10003a3f\import\apps\logs_reg.rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/install/logs_update_udeb.pkg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,41 @@
+;
+; 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
+#{"LogsApp"},(0x101F4CD5),1,0,0,TYPE=SP
+
+; Localised Vendor name
+%{"Symbian"}
+
+; Unique Vendor name
+:"Symbian"
+
+
+; -----------------------------------------------------------------------------------
+
+; Backup registration and restore
+"\epoc32\data\z\private\101F4CD5\backup_registration.xml"-"!:\private\101F4CD5\backup_registration.xml"
+
+"\epoc32\release\armv5\udeb\logs.exe"-"!:\sys\bin\logs.exe"
+"\epoc32\release\armv5\udeb\logsengine.dll"-"!:\sys\bin\logsengine.dll"
+"\epoc32\release\armv5\udeb\logsservices.dll"-"!:\sys\bin\logsservices.dll"
+"\epoc32\data\z\resource\apps\logs.rsc"-"!:\resource\apps\logs.rsc"
+"\epoc32\data\z\private\10003a3f\import\apps\logs_reg.rsc"-"!:\private\10003a3f\import\apps\logs_reg.rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/install/logs_update_urel.pkg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,41 @@
+;
+; 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
+#{"LogsApp"},(0x101F4CD5),1,0,0,TYPE=SA,RU
+
+; Localised Vendor name
+%{"Symbian"}
+
+; Unique Vendor name
+:"Symbian"
+
+
+; -----------------------------------------------------------------------------------
+
+; Backup registration and restore
+"\epoc32\data\z\private\101F4CD5\backup_registration.xml"-"!:\private\101F4CD5\backup_registration.xml"
+
+"\epoc32\release\armv5\urel\logs.exe"-"!:\sys\bin\logs.exe"
+"\epoc32\release\armv5\urel\logsengine.dll"-"!:\sys\bin\logsengine.dll"
+"\epoc32\release\armv5\urel\logsservices.dll"-"!:\sys\bin\logsservices.dll"
+"\epoc32\data\z\resource\apps\logs.rsc"-"!:\resource\apps\logs.rsc"
+"\epoc32\data\z\private\10003a3f\import\apps\logs_reg.rsc"-"!:\private\10003a3f\import\apps\logs_reg.rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/addeventtest/data/testlogclients.dat Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,152 @@
+//The unique event ID TLogId
+//EventType TUid KLogCallEventTypeUid defined in logwrap.hrh
+// KLogCallEventType 0x1000550D
+// KLogDataEventType 0x10005566
+// KLogFaxEventType 0x10005567
+// KLogShortMessageEventType 0x10005568
+// KLogMailEventType 0x10005569
+// KLogTaskSchedulerEventType 0x1000585E
+//
+//
+//RemoteParty const TDesC&
+//Direction const TDesC& incoming, outgoing
+//R_LOG_DIR_IN R_LOG_DIR_OUT R_LOG_DIR_IN_ALT R_LOG_DIR_OUT_ALT R_LOG_DIR_FETCHED R_LOG_DIR_MISSED
+//Time TTime& UTC time
+//DurationType TLogDurationType KLogDurationNone, KLogDurationValid,KLogDurationData
+//Duration TLogDuration expressed as the number of seconds since
+//Status const TDesC& R_LOG_DEL_PENDING, R_LOG_DEL_SENT, R_LOG_DEL_FAILED,
+//R_LOG_DEL_NONE,R_LOG_DEL_DONE and R_LOG_DEL_NOT_SENT
+//Subject const TDesC&
+//Number const TDesC&
+//Contact TLogContactItemId
+//Description const TDesC& Note that this is set automatically by the Log Engine??
+//Data const TDesC8& "", if there is no data. Data can contain multiple name value pairs
+// for which value separator is "=" and pair separator is "\t". Value can be empty.
+// E.g. "dummyparam=value1\tdummyparam2=value3\tdummyparam4="
+//Flags TLogFlags
+//iId (0)iEventType (0)iRemoteParty ("Unknown")iDirection ("R_LOG_DIR_OUT")iTime (0)iDurationType (0)iDuration (0)iStatus ("R_LOG_DEL_NONE")iSubject ("Unknown")iNumber ("+358123456")iContact (0)iDescription ("Voice call")iData ("")iFlags (0)
+//logevent (1, 0x12345678, "Unknown", "R_LOG_DIR_OUT", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 358123456, 0, "Voice call", "", 0)
+case1 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +35812345790, 0, "Voice call", "", 0)
+case1b (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +358123457901, 0, "Voice call", "", 0)
+case2 (3, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +358123457918888, 0, "Voice call", "VT", 0)
+case2b (3, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +3581234579188881, 0, "Voice call", "VT", 0)
+case3 (4, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 358123457918889, 0, "Voice call", "", 0)
+case3b (4, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 3581234579188891, 0, "Voice call", "", 0)
+case4 (5, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 358123457918810, 0, "Voice call", "VT", 0)
+case4b (5, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 3581234579188101, 0, "Voice call", "VT", 0)
+case5 (6, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 358123461, 0, "Voice call", "", 0)
+case5b (6, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 3581234611, 0, "Voice call", "", 0)
+case6 (6, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 558123461, 0, "Voice call", "VT", 0)
+case6b (6, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 5581234611, 0, "Voice call", "VT", 0)
+case7 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +358012345678910, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +3580123456789, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +358012345678, 0, "Voice call", "", 0)
+case7 (3, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +35801234567, 0, "Voice call", "VT", 0)
+case7 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +3580123456, 0, "Voice call", "", 0)
+case7 (3, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +358012345, 0, "Voice call", "VT", 0)
+case7 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +35801234, 0, "Voice call", "", 0)
+case7 (3, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +3580123, 0, "Voice call", "VT", 0)
+case7 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +358012, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +35801, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +3580, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 88012345678910, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 880123456789, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 88012345678, 0, "Voice call", "", 0)
+case7 (3, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 8801234567, 0, "Voice call", "VT", 0)
+case7 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 880123456, 0, "Voice call", "", 0)
+case7 (3, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 88012345, 0, "Voice call", "VT", 0)
+case7 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 8801234, 0, "Voice call", "", 0)
+case7 (3, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 880123, 0, "Voice call", "VT", 0)
+case7 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 88012, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 8801, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 880, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 088012345678910, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 0880123456789, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 088012345678, 0, "Voice call", "", 0)
+case7 (3, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 08801234567, 0, "Voice call", "VT", 0)
+case7 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 0880123456, 0, "Voice call", "", 0)
+case7 (3, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 088012345, 0, "Voice call", "VT", 0)
+case7 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 08801234, 0, "Voice call", "", 0)
+case7 (3, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 0880123, 0, "Voice call", "VT", 0)
+case7 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 088012, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 08801, 0, "Voice call", "", 0)
+case7 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 0880, 0, "Voice call", "", 0)
+case8 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +358012345678910, 0, "Voice call", "", 0)
+case8 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +3580123456789, 0, "Voice call", "", 0)
+case8 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 88012345678910, 0, "Voice call", "", 0)
+case8 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 880123456789, 0, "Voice call", "", 0)
+case8 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 088012345678910, 0, "Voice call", "", 0)
+case8 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 088012345678911, 0, "Voice call", "", 0)
+case9 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +358012345678910, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +3580123456789, 0, "Voice call", "", 0)
+case9 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +358012345678, 0, "Voice call", "", 0)
+case9 (3, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +35801234567, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +3580123456, 0, "Voice call", "", 0)
+case9 (3, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +358012345, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +35801234, 0, "Voice call", "", 0)
+case9 (3, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +3580123, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +358012, 0, "Voice call", "", 0)
+case9 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +35801, 0, "Voice call", "", 0)
+case9 (2, 0x12345678, "", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", +3580, 0, "Voice call", "", 0)
+case9 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 88012345678910, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 880123456789, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 88012345678, 0, "Voice call", "", 0)
+case9 (3, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 8801234567, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 880123456, 0, "Voice call", "", 0)
+case9 (3, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 88012345, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 8801234, 0, "Voice call", "", 0)
+case9 (3, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 880123, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 88012, 0, "Voice call", "", 0)
+case9 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 8801, 0, "Voice call", "", 0)
+case9 (2, 0x12345678, "", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 880, 0, "Voice call", "", 0)
+case9 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 088012345678910, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 0880123456789, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 088012345678, 0, "Voice call", "", 0)
+case9 (3, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 08801234567, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 0880123456, 0, "Voice call", "", 0)
+case9 (3, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 088012345, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 08801234, 0, "Voice call", "", 0)
+case9 (3, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 0880123, 0, "Voice call", "VT", 0)
+case9 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 088012, 0, "Voice call", "", 0)
+case9 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 08801, 0, "Voice call", "", 0)
+case9 (2, 0x12345678, "", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 0880, 0, "Voice call", "", 0)
+case10 (2, 0x12345678, "Keke Rosberg", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 088089899, 0, "Voice call", "", 0)
+case10 (2, 0x12345678, "Test", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 0506666, 0, "Voice call", "", 0)
+case10 (2, 0x12345678, "Testing The Test", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 777, 0, "Voice call", "VT", 0)
+case10 (2, 0x12345678, "Testing1 050", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 3333333333333333333, 0, "Voice call", "", 0)
+case11 (2, 0x12345678, "Test", "Outgoing", 10, 1, 120, "R_LOG_DEL_NONE", "Unknown", 0506666, 0, "Voice call", "", 0)
+case11 (2, 0x12345678, "", "Outgoing", 10000, 1, 20, "R_LOG_DEL_NONE", "Unknown", 0506666, 0, "Voice call", "", 0)
+case11 (2, 0x12345678, "Testing The Test", "Outgoing", 600000, 1, 600, "R_LOG_DEL_NONE", "Unknown", 777, 0, "Voice call", "VT", 0)
+case11 (2, 0x12345678, "", "Outgoing", 444, 1, 600, "R_LOG_DEL_NONE", "Unknown", 777, 0, "Voice call", "VT", 0)
+case11 (2, 0x12345678, "Keke Rosberg", "Missed call", 90, 1, 455, "R_LOG_DEL_NONE", "Unknown", 088089899, 0, "Voice call", "", 0)
+case11 (2, 0x12345678, "Contact is of type missed", "Missed call", 1, 1, 2, "R_LOG_DEL_NONE", "Unknown", 088089899, 0, "Voice call", "VT", 0)
+case11 (2, 0x12345678, "Testing1 050", "Incoming", 2, 1, 77, "R_LOG_DEL_NONE", "Unknown", 3333333333333333333, 0, "Voice call", "", 0)
+case11 (2, 0x12345678, "Testing1 050 Jes", "Incoming", 22, 1, 232, "R_LOG_DEL_NONE", "Unknown", 3333333333333333333, 0, "Voice call", "VT", 0)
+case (7, 0x12345678, "Unknown", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 558123462, 0, "Voice call", "VT=\tdummy=3", 0)
+case (8, 0x12345678, "Unknown", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 558123463, 0, "Voice call", "VT=", 0)
+at_logsengine (3, 0x12345678, "Jeppa", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (3, 0x12345678, "Jeppa", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (3, 0x12345678, "Jeppa", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (3, 0x12345678, "Jeppa", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (3, 0x12345678, "Jeppa", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (3, 0x12345678, "Jeppa", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (3, 0x12345678, "Jeppa", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (3, 0x12345678, "Jeppa", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (1, 0x12345678, "Jeppy", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "CL=999", 0)
+at_logsengine (2, 0x12345678, "Jeppis", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "CL=2", 0)
+at_logsengine (3, 0x12345678, "Jeppa", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "CL=2", 0)
+at_logsengine (3, 0x12345678, "Jeppa", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (4, 0x12345678, "Jeppu", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (5, 0x12345678, "Jeppu", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (6, 0x12345678, "Jeppu", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (7, 0x12345678, "aeppu", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "CL=3", 0)
+at_logsengine (8, 0x12345678, "beppu", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "CL=3", 0)
+at_logsengine (9, 0x12345678, "ceppu", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+at_logsengine (10, 0x12345678, "deppu", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "CL=3", 0)
+at_logsengine (11, 0x12345678, "deeppu", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "", 0)
+logevent (7, 0x12345678, "Unknown", "Missed call", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 358123462, 0, "Voice call", "", 0)
+logevent (8, 0x12345678, "Unknown", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 358123463, 0, "Voice call", "", 0)
+logevent (9, 0x12345678, "Unknown", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 358123464, 0, "Voice call", "", 0)
+logevent (10, 0x12345678, "Unknown", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 358123465, 0, "Voice call", "", 0)
+logevent (11, 0x12345678, "Unknown", "Outgoing", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", 358123466, 0, "Voice call", "", 0)
+logevent (12, 0x12345678, "Jeppis", "Incoming", 0, 0, 0, "R_LOG_DEL_NONE", "Unknown", "", 0, "Voice call", "VOIP\tURL=+23456677\tMA=te@172.21.10.191", 0)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/addeventtest/group/bld.inf Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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:
+*
+*/
+PRJ_EXPORTS
+
+..\data\testlogclients.dat \epoc32\winscw\c\system\testlogclients.dat
+
+
+// Project files
+prj_mmpfiles
+logclienttest.mmp
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/addeventtest/group/logclienttest.mmp Tue May 04 12:39:37 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:
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET logclienttest.exe
+TARGETTYPE exe
+UID 0x100039CE 0x20026F62
+SECUREID 0x20026F62
+SOURCEPATH ..\src
+SOURCE clientlogstest.cpp
+SOURCE argstest.cpp
+
+EPOCSTACKSIZE 0x5000
+
+USERINCLUDE ..\inc
+USERINCLUDE ..\data
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE \epoc32\include\ecom
+
+
+LIBRARY apparc.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY cone.lib
+LIBRARY ecom.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikcore.lib
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+LIBRARY efsrv.lib
+LIBRARY CdlEngine.lib // for scalable ui
+LIBRARY flogger.lib
+LIBRARY charconv.lib
+LIBRARY customapi.lib
+LIBRARY logcli.lib
+LIBRARY logwrap.lib
+LIBRARY estor.lib
+LIBRARY inetprotutil.lib
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/addeventtest/inc/argstest.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2002 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: Argument parser
+*
+*/
+
+
+
+#ifndef CARGS_H
+#define CARGS_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+const TInt KMaxArgs = 100;
+
+// MACROS
+// none
+
+// DATA TYPES
+enum TParseType
+ {
+ // class.method (arg1, arg2, ...)
+ // functionname (arg1, arg2, ...)
+ //
+ // classname is always found from StrArg(1) (if only funcname provided, "")
+ // method/functonname is always found from StrArg(2)
+ //
+ EParseFunction,
+
+ // // comment here
+ //
+ EParseComment
+ };
+
+enum TArgType
+ {
+ EArgNotSpecified,
+ EArgNum,
+ EArgStr
+ };
+
+// FUNCTION PROTOTYPES
+// none
+
+// FORWARD DECLARATIONS
+// none
+
+// CLASS DECLARATION
+
+/**
+* CArgs is used to parse parameters from a data file
+*
+* @lib commonutils.lib
+* @since
+*/
+class CArgs : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * C++ default constructor.
+ */
+ IMPORT_C CArgs();
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C ~CArgs();
+
+ public: // New functions
+
+ /**
+ * Returns count of parsed arguments.
+ * @since
+ * @return Count of parsed arguments
+ */
+ IMPORT_C TInt ArgCount() const;
+
+ /**
+ * Returns type of argument (string/numeric).
+ * @since
+ * @param aArgIndex Index of argument
+ * @return Type of argument
+ */
+ IMPORT_C TArgType ArgType( const TInt aArgIndex ) const;
+
+ /**
+ * Returns argument value as TInt
+ * @since
+ * @param aArgIndex Index of argument
+ * @return Integer value of argument
+ */
+ IMPORT_C TInt NumArg( const TInt aArgIndex ) const;
+
+ /**
+ * Returns argument value as String
+ * @since
+ * @param aArgIndex Index of argument
+ * @return Argument as String
+ */
+ IMPORT_C const TDesC& StrArg( const TInt aArgIndex ) const;
+
+ /**
+ * Parses arguments from a string
+ * @since
+ * @param aType Type of argument
+ * @param aLine Line to parse
+ * @return Errorcode
+ */
+ IMPORT_C TInt ParseLineL( const TParseType aType, const TDes& aLine );
+
+ public: // Functions from base classes
+ // none
+
+ protected: // New functions
+ // none
+
+ protected: // Functions from base classes
+ // none
+
+ private:
+
+ /**
+ * Clears all parsed arguments and frees allocated memory
+ * @since
+ */
+ void ClearArgs();
+
+ public: // Data
+ // none
+
+ protected: // Data
+ // none
+
+ private: // Data
+
+ // Argument count
+ TInt iArgCount;
+
+ // Array for arguments revealing the type of argument
+ TArgType iArgType[KMaxArgs];
+
+ // Array for numeric arguments
+ TInt iNumArg[KMaxArgs];
+
+ // Array for string arguments
+ HBufC* iStrArg[KMaxArgs];
+
+ public: // Friend classes
+ // none
+
+ protected: // Friend classes
+ // none
+
+ private: // Friend classes
+ // none
+
+ };
+
+#endif // CARGS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/addeventtest/inc/clientlogstest.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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:
+*
+*/
+
+
+// INCLUDES
+#ifndef __CCLIENTLOGSTEST_H__
+#define __CCLIENTLOGSTEST_H__
+#include <E32Base.h>
+#include <badesca.h>
+#include "argstest.h"
+#include <logwrap.h>
+#include <logcli.h>
+
+
+class CClientlogstest : public CActive
+{
+
+ public: // Constructors and destructor
+ /**
+ * Two-phased constructor.
+ */
+ static CClientlogstest* NewL();
+ // static CClientlogstest* NewLC();
+ /**
+ * Destructor.
+ */
+ ~CClientlogstest();
+
+public: // From CActive
+
+ void RunL ();
+ void DoCancel ();
+
+ public: // New functions
+
+ /**
+ * ReadParametersL
+ * @since
+ * @param fileName
+ */
+ void ReadParametersL( const TDes & fileName );
+
+ private:
+
+ CClientlogstest();
+ void ConstructL();
+ TInt AddEvent();
+ void DeleteReadDataMembers();
+
+ private: // data
+ HBufC* iDllName;
+ TLogId iId;
+ TUid iEventType;
+ TTime iTime;
+ TLogDurationType iDurationType;
+ TLogDuration iDuration;
+ TLogContactItemId iContact;
+ TLogLink iLink;
+ TLogFlags iFlags;
+ HBufC* iDescription;
+ HBufC* iRemoteParty;
+ HBufC* iDirection;
+ HBufC* iCallStatus;
+ HBufC* iSubject;
+ HBufC* iNumber;
+ HBufC8* iData;
+ TInt iCompleteError;
+ //
+ CLogClient* iLogClient;
+ RFs iFsSession;
+ CLogEvent* iLogEvent;
+ RPointerArray<CLogEvent> iLogEvents;
+ HBufC* ikeyword;
+ CArgs* iArgs;
+ TPtrC8 iDataPtr;
+ private: // Friend classes
+ // none
+
+};
+
+// End of File __CCLIENTLOGSTEST_H__
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/addeventtest/install/clientlogstest.pkg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,43 @@
+;
+; 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:
+;
+;
+; Installtion file for Cenrep Editor
+;
+;Languages
+&EN
+;
+; UID is the app's UID
+;
+#{"clientlogstest"},(0x20026F62),2,0,0
+;
+; List of localised vendor names
+%{"Vendor-EN"}
+
+; The non-localised, globally unique vendor name (mandatory)
+:"Nokia OY"
+;Supports Series 60 v 3.x
+;This line indicates that this installation is for the Series 60 platform v3.x
+;This line must appear _exactly_ as shown below in the sis file
+;If this line is missing or incorrect, the sis file will not be able
+;to be installed on Series 60 v3.x platforms
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+;
+; Three files to install
+;
+"\epoc32\release\armv5\udeb\logclienttest.exe" -"!:\sys\bin\logclienttest.exe"
+"\epoc32\winscw\c\system\testlogclients.dat" -"!:\system\testlogclients.dat"
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/addeventtest/install/sis_udeb.bat Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,17 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+makesis clientlogstest.pkg clientlogstest.sis
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/addeventtest/src/argstest.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,400 @@
+/*
+* Copyright (c) 2002 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: Argument parser
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "argstest.h"
+
+// EXTERNAL DATA STRUCTURES
+// none
+
+// EXTERNAL FUNCTION PROTOTYPES
+// none
+
+// CONSTANTS
+// none
+
+// MACROS
+// none
+
+// LOCAL CONSTANTS AND MACROS
+// none
+
+// MODULE DATA STRUCTURES
+// none
+
+// LOCAL FUNCTION PROTOTYPES
+// none
+
+// FORWARD DECLARATIONS
+// none
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// none
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CArgs::CArgs
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CArgs::CArgs()
+ {
+ }
+
+// Destructor
+EXPORT_C CArgs::~CArgs()
+ {
+
+ ClearArgs();
+
+ }
+
+// -----------------------------------------------------------------------------
+// CArgs::ArgCount
+// Returns count of parsed arguments
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CArgs::ArgCount() const
+ {
+
+ return iArgCount;
+
+ }
+
+// -----------------------------------------------------------------------------
+// CArgs::ArgType
+// Returns type of argument (string/numeric)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TArgType CArgs::ArgType( const TInt aArgIndex ) const
+ {
+
+ if ( aArgIndex < 1 || aArgIndex > iArgCount )
+ {
+ return EArgNotSpecified;
+ }
+ else
+ {
+ return iArgType[aArgIndex - 1];
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CArgs::NumArg
+// Returns argument value as TInt
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CArgs::NumArg( const TInt aArgIndex ) const
+ {
+
+ if ( aArgIndex < 1 ||
+ aArgIndex > iArgCount ||
+ iArgType[aArgIndex - 1] != EArgNum )
+ {
+ return 0;
+ }
+ else
+ {
+ return iNumArg[aArgIndex - 1];
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CArgs::StrArg
+// Returns argument value as string
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CArgs::StrArg( const TInt aArgIndex ) const
+ {
+
+ if ( aArgIndex < 1 || aArgIndex > iArgCount )
+ {
+ return KNullDesC;
+ }
+ else
+ {
+ return *iStrArg[aArgIndex - 1];
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CArgs::ParseLineL
+// Parses arguments from a string
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CArgs::ParseLineL(
+ const TParseType aType,
+ const TDes& aLine )
+ {
+
+ TBuf<1024> line;
+ line.Append( aLine );
+
+ ClearArgs();
+
+ switch ( aType )
+ {
+ case EParseComment:
+
+ line.Trim();
+
+ // if line starts with "//"
+ //
+ if ( line.Length() >= 2 &&
+ line[0] == static_cast< TInt >( TChar( '/' ) ) &&
+ line[1] == static_cast< TInt >( TChar( '/' ) ) )
+ {
+ return KErrNone;
+ }
+ break;
+
+ case EParseFunction:
+
+ TInt posDot = line.Locate( '.' );
+ posDot = -1; // Messes stuff in case of ip addresses
+ TInt posBraceOpen = line.Locate( '(' );
+
+ if ( posBraceOpen == -1 )
+ {
+ return KErrArgument;
+ }
+
+ iArgType[0] = EArgStr;
+ iArgType[1] = EArgStr;
+
+ // read classname and methodname: "class.method("
+ //
+ if ( posDot != -1 && posDot < posBraceOpen )
+ {
+ iStrArg[0] = HBufC::NewL( posDot );
+ iStrArg[0]->Des().Append( line.Ptr(), posDot );
+ iStrArg[0]->Des().Trim();
+ iStrArg[1] = HBufC::NewL( posBraceOpen - posDot );
+ iStrArg[1]->Des().Append( line.Ptr() + posDot + 1,
+ posBraceOpen - ( posDot + 1 ) );
+ iStrArg[1]->Des().Trim();
+ }
+ else // only methodname: "method("
+ {
+ iStrArg[0] = HBufC::NewL( 0 );
+ iStrArg[1] = HBufC::NewL( posBraceOpen );
+ iStrArg[1]->Des().Append( line.Ptr(), posBraceOpen );
+ iStrArg[1]->Des().Trim();
+ }
+
+ iArgCount = 2;
+
+ // remove "class.method(" or "method(" from line
+ //
+ line.Delete( 0, posBraceOpen + 1 );
+ line.Trim();
+
+ // parse arguments
+ //
+ while ( line.Length() > 0 )
+ {
+ line.Trim();
+ TInt pos = line.Locate( '"' );
+
+ // string
+ //
+ if ( pos == 0 )
+ {
+ line.Delete( 0, 1 );
+ pos = line.Locate( '"' );
+ if ( pos == -1 )
+ {
+ return KErrArgument;
+ }
+
+ iArgType[iArgCount] = EArgStr;
+ iStrArg[iArgCount] = HBufC::NewL( pos );
+ iStrArg[iArgCount]->Des().Append( line.Ptr(), pos );
+ iArgCount++;
+ line.Delete( 0, pos + 1 );
+ line.Trim();
+
+ // remove possible comma
+ //
+ if ( line.Locate( ',' ) == 0 )
+ {
+ line.Delete( 0, 1 );
+ line.Trim();
+ }
+ }
+
+ else // numeric? or enum value
+ {
+ pos = line.Locate( ',' );
+ if ( pos == -1 )
+ {
+ pos = line.Locate( ')' );
+ if ( pos == -1 )
+ {
+ return KErrArgument;
+ }
+ else if ( pos == 0 )
+ {
+ break;
+ }
+ }
+
+ iArgType[iArgCount] = EArgStr;
+ iStrArg[iArgCount] = HBufC::NewL( pos );
+ iStrArg[iArgCount]->Des().Append( line.Ptr(), pos );
+ iStrArg[iArgCount]->Des().Trim();
+ iArgCount++;
+ line.Delete( 0, pos + 1 );
+ line.Trim();
+
+ // len must be > 0
+ //
+ if ( iStrArg[iArgCount-1]->Length() == 0 )
+ {
+ return KErrArgument;
+ }
+
+ TBool isNum = ETrue;
+ TBool isNegative = EFalse;
+ TInt numVal = 0;
+
+ // check if argument is numeric -> [-]n(0-9)
+ //
+ for ( pos=0; pos < iStrArg[iArgCount - 1]->Length(); pos++ )
+ {
+ if ( pos == 0 &&
+ iStrArg[iArgCount - 1]->Locate( '-' ) == 0 )
+ {
+ isNegative = ETrue;
+ // if number is negative, len must be >= 2
+ //
+ if ( iStrArg[iArgCount - 1]->Length() < 2 )
+ {
+ isNum = EFalse;
+ break;
+ }
+ }
+ else
+ {
+ TInt number;
+
+ if ( (*iStrArg[iArgCount - 1])[pos] ==
+ static_cast< TInt >( TChar( '0' ) ) ) number = 0;
+ else if ( (*iStrArg[iArgCount - 1])[pos] ==
+ static_cast< TInt >( TChar( '1' ) ) ) number = 1;
+ else if ( (*iStrArg[iArgCount - 1])[pos] ==
+ static_cast< TInt >( TChar( '2' ) ) ) number = 2;
+ else if ( (*iStrArg[iArgCount - 1])[pos] ==
+ static_cast< TInt >( TChar( '3' ) ) ) number = 3;
+ else if ( (*iStrArg[iArgCount - 1])[pos] ==
+ static_cast< TInt >( TChar( '4' ) ) ) number = 4;
+ else if ( (*iStrArg[iArgCount - 1])[pos] ==
+ static_cast< TInt >( TChar( '5' ) ) ) number = 5;
+ else if ( (*iStrArg[iArgCount - 1])[pos] ==
+ static_cast< TInt >( TChar( '6' ) ) ) number = 6;
+ else if ( (*iStrArg[iArgCount - 1])[pos] ==
+ static_cast< TInt >( TChar( '7' ) ) ) number = 7;
+ else if ( (*iStrArg[iArgCount - 1])[pos] ==
+ static_cast< TInt >( TChar( '8' ) ) ) number = 8;
+ else if ( (*iStrArg[iArgCount - 1])[pos] ==
+ static_cast< TInt >( TChar( '9' ) ) ) number = 9;
+ else
+ {
+ isNum = EFalse;
+ break;
+ }
+ numVal = (numVal * 10) + number;
+ }
+ }
+
+ // argument is numeric
+ //
+ if ( isNum )
+ {
+ if ( isNegative )
+ {
+ numVal = -numVal;
+ }
+
+ iNumArg[iArgCount - 1] = numVal;
+ iArgType[iArgCount - 1] = EArgNum;
+ }
+
+ } // else
+
+ } // while
+
+ return KErrNone;
+
+ } // switch
+
+ return KErrArgument;
+
+ }
+
+// -----------------------------------------------------------------------------
+// CArgs::ClearArgs
+// Clears all parsed arguments and frees allocated memory
+// -----------------------------------------------------------------------------
+//
+void CArgs::ClearArgs()
+ {
+
+ for ( TInt i = 0; i < iArgCount; i++ )
+ {
+ delete iStrArg[i];
+ }
+
+ iArgCount = 0;
+
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+#if defined(__WINS__) && !defined(EKA2)
+
+// -----------------------------------------------------------------------------
+// E32Dll
+//
+// DLL entry point function. In a MARM implementation, the
+// entry point is called when a thread is attached to or detached from the
+// DLL.?description
+//
+// Returns: TInt: For DLLs which do not set up thread-local storage,
+// the function can ignore the TDllReason type
+// parameter passed to it and simply return KErrNone;
+// -----------------------------------------------------------------------------
+//
+
+GLDEF_C TInt E32Dll( TDllReason /*aReason*/ )
+ {
+
+ return KErrNone;
+
+ }
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/addeventtest/src/clientlogstest.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,404 @@
+/*
+* 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 "clientlogstest.h"
+#include <f32file.h>
+#include <s32file.h>
+#include <utf.h>
+#include <bacline.h>
+#include <EscapeUtils.h>
+
+
+#ifdef EKA2 //RD_APPS_TO_EXES
+#include <eikstart.h>
+#endif
+_LIT(KtestlogclientsFileName,"C:\\System\\testlogclients.dat");
+
+
+#include <e32std.h>
+#include <eikstart.h>
+
+_LIT(KClientlogstestPanic,"Clientlogstest creation");
+
+LOCAL_C void MainL();
+
+// main function called by E32
+GLDEF_C TInt E32Main()
+ {
+ CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
+ TRAPD(error,MainL());
+ __ASSERT_ALWAYS(error == KErrNone,User::Panic(KClientlogstestPanic,error));
+ delete cleanup; // destroy clean-up stack
+ User::Heap().Reset();
+ return 0; // and return
+ }
+
+LOCAL_C void MainL()
+ {RDebug::Print(_L("CClientlogstest MainL"));
+ RThread().SetPriority(EPriorityAbsoluteForeground);
+ // install an active scheduler
+ CActiveScheduler* scheduler = new(ELeave)CActiveScheduler;
+ CActiveScheduler::Install(scheduler);
+ //CleanupStack::PushL(scheduler);
+ //CleanupStack::Pop(scheduler);
+
+ CClientlogstest* main = 0;
+ TRAPD (err, main = CClientlogstest::NewL());
+ if (err == KErrNone)
+ {RDebug::Print(_L("CClientlogstest CActiveScheduler::Start()"));
+ CActiveScheduler::Start();
+ }
+ RDebug::Print(_L("CClientlogstestafter CActiveScheduler::Start()"));
+ delete main;
+ delete scheduler;
+
+ }
+
+CClientlogstest::~CClientlogstest()
+ {
+ RDebug::Print(_L("CClientlogstest deleted"));
+ RDebug::Print(_L("CClientlogstest Cancel()"));
+ CActive::Cancel();
+ RDebug::Print(_L("CClientlogstest delete iLogEvent"));
+ delete iLogEvent;
+ iLogEvent = NULL;
+ RDebug::Print(_L("CClientlogstest delete iLogClient"));
+ delete iLogClient;
+ iLogClient = NULL;
+ RDebug::Print(_L("CClientlogstest iLogEvents.ResetAndDestroy()"));
+ iLogEvents.ResetAndDestroy();
+ RDebug::Print(_L("CClientlogstest iFsSession.Close()"));
+ iFsSession.Close();
+ RDebug::Print(_L("CClientlogstest delete iDescription"));
+ delete iDescription;
+ iDescription = NULL;
+ RDebug::Print(_L("CClientlogstest delete iRemoteParty"));
+ delete iRemoteParty;
+ iRemoteParty = NULL;
+ RDebug::Print(_L("CClientlogstest delete iDirection"));
+ delete iDirection;
+ iDirection = NULL;
+ RDebug::Print(_L("CClientlogstest delete iCallStatus"));
+ delete iCallStatus;
+ iCallStatus = NULL;
+ RDebug::Print(_L("CClientlogstest delete iSubject"));
+ delete iSubject;
+ iSubject = NULL;
+ RDebug::Print(_L("CClientlogstest delete iNumber"));
+ delete iNumber;
+ iNumber = NULL;
+ RDebug::Print(_L("CClientlogstest delete iData"));
+ delete iData;
+ iData = NULL;
+ delete ikeyword;
+ ikeyword = NULL;
+ delete iArgs;
+ iArgs = NULL;
+ RDebug::Print(_L("CClientlogstest deleted <-"));
+ //CActiveScheduler::Install (NULL);
+ //CActiveScheduler::Stop();
+ }
+// From CActive
+void CClientlogstest::RunL ()
+ {
+ RDebug::Print(_L("CClientlogstest::RunL->"));
+ if (iStatus.Int() == KErrNone)
+ {RDebug::Print(_L("CClientlogstest::RunL iStatus.Int() == KErrNone"));
+ if (iLogEvents.Count() > 0)
+ {RDebug::Print(_L("CClientlogstest::RunL if (iLogEvents.Count() > 0)"));
+ delete iLogEvent;
+ iLogEvent = NULL;
+ RDebug::Print(_L("CClientlogstest::RunL iStatus.Int() == KErrNone"));
+ User::LeaveIfError(AddEvent());
+ }
+ else
+ {
+ RDebug::Print(_L("CClientlogstest::RunL <-"));
+ CActiveScheduler::Stop();
+ }
+ }
+ else
+ {
+ if (iStatus.Int() == KErrNotFound)
+ {
+ //if the event type is not registered with the Log Engine
+ RDebug::Print(_L("CClientlogstest::RunL event type is not registered with the Log Engine"));
+ }
+
+ RDebug::Print(_L("CClientlogstest::RunL iStatus.Int() != KErrNone"));
+ CActiveScheduler::Stop();
+ }
+ }
+
+// From CActive
+void CClientlogstest::DoCancel ()
+ {
+ RDebug::Print(_L("CClientlogstest::DoCancel"));
+
+ }
+
+
+
+CClientlogstest* CClientlogstest::NewL()
+ {RDebug::Print(_L("CClientlogstest NewL"));
+ CClientlogstest* self = new (ELeave) CClientlogstest();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+CClientlogstest::CClientlogstest()
+: CActive(EPriorityStandard)
+{
+}
+
+void CClientlogstest::ConstructL()
+ {RDebug::Print(_L("CClientlogstest ConstructL->"));
+ CActiveScheduler::Add (this);
+ //TRequestStatus *status=&iStatus;
+ User::LeaveIfError(iFsSession.Connect());
+ iLogClient = CLogClient::NewL( iFsSession );
+ iLogEvent = CLogEvent::NewL();
+ TBuf<100> fileName;
+ fileName.Append( KtestlogclientsFileName );
+ CCommandLineArguments* args = CCommandLineArguments::NewLC();
+ //ikeyword = HBufC::NewL(0);
+ _LIT(Kkeywordlogs,"logevent");
+ TBufC<16> buf1(Kkeywordlogs);
+
+ ikeyword = buf1.AllocL();
+ if (args->Count() > 1)
+ {
+ delete ikeyword;
+ ikeyword = NULL;
+ ikeyword = args->Arg(1).AllocL();
+ RDebug::Print(*ikeyword);
+ }
+ CleanupStack::PopAndDestroy(args);
+ ReadParametersL( fileName );
+ User::LeaveIfError(AddEvent());
+ RDebug::Print(_L("CClientlogstest ConstructL<-"));
+ }
+
+TInt CClientlogstest::AddEvent()
+ {RDebug::Print(_L("CClientlogstest::AddEvent()->"));
+ TInt errorCode ( KErrNone );
+ iLogEvent = iLogEvents[0];
+ iLogEvents.Remove(0);
+ iLogEvents.Compress();
+ if ( !IsActive( ) )
+ {
+ RDebug::Print(_L("CClientlogstest::AddEvent() CLogClient::AddEvent()"));
+ iLogClient->AddEvent( *iLogEvent, iStatus );
+ errorCode = KErrNone;
+ SetActive( );
+ }
+ else
+ {
+ RDebug::Print(_L("CClientlogstest::AddEvent() Event NOT added"));
+ errorCode = KErrInUse;
+ }
+ RDebug::Print(_L("CClientlogstest::AddEvent()<-"));
+ return errorCode;
+ }
+
+
+void CClientlogstest::ReadParametersL( const TDes& fileName )
+ {RDebug::Print(_L("CClientlogstest ReadParametersL ->"));
+ iArgs = new ( ELeave ) CArgs();
+ RFileReadStream readStream;
+ TBuf8<256> asciiLine;
+ TBuf16<256> unicodeLine;
+ TInt findPos;
+ TInt leaveCode( KErrNone );
+ iCompleteError = KErrNone;
+ iId = 0;
+ iEventType.Null();
+ iRemoteParty = NULL;
+ iDirection = NULL;
+ iTime = 0;
+ iDurationType = 0;
+ iDuration = 0;
+ iCallStatus = NULL;
+ iSubject = NULL;
+ iNumber = NULL;
+ iContact = 0;
+ iDescription = NULL;
+ iData = NULL;
+ iFlags = 0;
+ if ( KErrNone != readStream.Open( iFsSession, fileName, EFileRead ) )
+ {RDebug::Print(_L("CClientlogstest ReadParametersL KErrNone != readStream.Open "));
+ CleanupStack::PopAndDestroy();
+ return;
+ }
+
+ CleanupClosePushL( readStream );
+ while ( KErrEof != leaveCode )
+ {RDebug::Print(_L("CClientlogstest ReadParametersL while "));
+ TRAP( leaveCode, readStream.ReadL( asciiLine, TChar(10)) )
+ if ( KErrNone == leaveCode )
+ {
+ // Delete leading spaces and tabs
+ asciiLine.TrimLeft();
+ // Delete trailing (CR)+LF if any
+ findPos = asciiLine.Locate( TChar(10) );
+ if ( KErrNotFound != findPos )
+ {
+ if ( KErrNotFound != asciiLine.Locate( TChar(13) ) )
+ {
+ // Dos style text file(CR+LF)
+ asciiLine.Delete(
+ findPos - 1, asciiLine.Length() - (findPos + 1) );
+ }
+ else
+ {
+ // Unix style text file(LF)
+ asciiLine.Delete(
+ findPos , asciiLine.Length() - findPos );
+ }
+ }
+
+ // Skip empty lines and lines that start with '//'
+ if ( asciiLine.Length() == 0 ||
+ (findPos = asciiLine.Find(_L8("//"))) == 0 )
+ {
+ continue;
+ }
+
+ if ( KErrNotFound != findPos )
+ {
+ asciiLine.Delete( findPos, asciiLine.Length() - findPos );
+ asciiLine.TrimRight();
+ }
+
+ // Unicode format is used internally
+ TInt ret =
+ CnvUtfConverter::ConvertToUnicodeFromUtf8(
+ unicodeLine, asciiLine );
+
+ if ( KErrNone != ret )
+ {
+ //Unicode conversion failed. Skip this line and go on
+ continue;
+ }
+
+ if ( KErrNone != iArgs->ParseLineL( EParseFunction, unicodeLine ) )
+ {
+ continue;
+ }
+ // Long lines maintained for clarity
+ if ( iArgs->StrArg(1) == _L("") )
+ {
+ // if ( iArgs->StrArg(2) == _L("logevent") )
+ if (iArgs->StrArg(2) == *ikeyword )
+ {
+ iId = iArgs->NumArg(3);
+ iEventType.iUid = iArgs->NumArg(4);
+ iRemoteParty = iArgs->StrArg(5).AllocL();
+
+ iDirection = iArgs->StrArg(6).AllocL();
+ RDebug::RawPrint(*iDirection);
+ iTime = iArgs->NumArg(7);
+ iDurationType = iArgs->NumArg(8);
+ iDuration = iArgs->NumArg(9);
+ iCallStatus = iArgs->StrArg(10).AllocL();
+ iSubject = iArgs->StrArg(11).AllocL();
+ iNumber = iArgs->StrArg(12).AllocL();
+ iContact = iArgs->NumArg(13);
+ iDescription = iArgs->StrArg(14).AllocL();
+ RDebug::Print(_L("CClientlogstest data:"));
+ RDebug::RawPrint(iArgs->StrArg(15));
+ iData = HBufC8::NewL( iArgs->StrArg(15).Length() * 2 );
+ TPtr8 ptrData( iData->Des() );
+ ptrData.Copy( iArgs->StrArg(15) );
+ _LIT8( KLogClientFieldDelim, "\\t" );
+ int delimPos = ptrData.Find( KLogClientFieldDelim );
+ while ( delimPos >= 0 ){
+ ptrData.Replace( delimPos, KLogClientFieldDelim().Length(), _L8("\t") );
+ int newDelimPos = ptrData.Mid( delimPos + 1 ).Find( KLogClientFieldDelim );
+ delimPos = ( newDelimPos >= 0 ) ? delimPos + newDelimPos + 1 : -1;
+ }
+ iFlags = iArgs->NumArg(16);
+
+ delete iLogEvent;
+ iLogEvent = CLogEvent::NewL();
+ RDebug::Print(_L("CClientlogstest ReadParametersL while iLogEvent->SetId(iId)"));
+ iLogEvent->SetId(iId);
+ //iLogEvent->SetEventType(iEventType);
+ iLogEvent->SetEventType( KLogCallEventTypeUid );
+ iLogEvent->SetRemoteParty(*iRemoteParty);
+ iLogEvent->SetDirection(*iDirection);
+ iLogEvent->SetTime(iTime);
+ iLogEvent->SetDurationType(iDurationType);
+ iLogEvent->SetDuration(iDuration);
+ iLogEvent->SetStatus(*iCallStatus);
+ iLogEvent->SetSubject(*iSubject);
+ iLogEvent->SetNumber(*iNumber);
+ iLogEvent->SetContact(iContact);
+ iLogEvent->SetDescription(*iDescription);
+ iLogEvent->SetFlags(iFlags);
+ RDebug::Print(_L("CClientlogstest ReadParametersL while After set logevent parameters"));
+ iDataPtr.Set( iData->Des() );
+ iLogEvent->SetDataL(iDataPtr);
+ //own the objects
+ RDebug::Print(_L("CClientlogstest ReadParametersL while append LogEvent obj to array"));
+ iLogEvents.AppendL(iLogEvent);
+ iLogEvent = NULL;
+ DeleteReadDataMembers();
+
+ RDebug::Print(_L("CClientlogstest ReadParametersL while After deleting all member parameters"));
+ }
+ }
+ else
+ {
+ // not a valid line
+ }
+ }
+ }//while
+
+ CleanupStack::PopAndDestroy();//readStream
+ RDebug::Print(_L("CClientlogstest ReadParametersL <-"));
+ }
+
+void CClientlogstest::DeleteReadDataMembers()
+ {
+ RDebug::RawPrint(*iDescription);
+ delete iDescription;
+ iDescription = NULL;
+ RDebug::RawPrint(*iRemoteParty);
+ delete iRemoteParty;
+ iRemoteParty = NULL;
+ RDebug::RawPrint(*iDirection);
+ delete iDirection;
+ iDirection = NULL;
+ RDebug::RawPrint(*iCallStatus);
+ delete iCallStatus;
+ iCallStatus = NULL;
+ RDebug::RawPrint(*iSubject);
+ delete iSubject;
+ iSubject = NULL;
+ RDebug::RawPrint(*iNumber);
+ delete iNumber;
+ iNumber = NULL;
+ //RDebug::RawPrint(*iData);
+ delete iData;
+ iData = NULL;
+ }
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/clearlisttest/group/bld.inf Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* 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:
+*
+*/
+PRJ_EXPORTS
+
+// Project files
+prj_mmpfiles
+clearlisttest.mmp
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/clearlisttest/group/clearlisttest.mmp Tue May 04 12:39:37 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:
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET clearlisttest.exe
+TARGETTYPE exe
+UID 0x100039CE 0x20026F63
+SECUREID 0x20026F63
+
+SOURCEPATH ..\src
+SOURCE clearlisttest.cpp
+
+EPOCSTACKSIZE 0x5000
+
+USERINCLUDE ..\inc
+
+APP_LAYER_SYSTEMINCLUDE // Application layer domain APIs
+
+SYSTEMINCLUDE \epoc32\include\ecom
+
+LIBRARY apparc.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY cone.lib
+LIBRARY ecom.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikcore.lib
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+LIBRARY efsrv.lib
+LIBRARY aknskins.lib // for skin background
+LIBRARY CdlEngine.lib // for scalable ui
+LIBRARY flogger.lib
+LIBRARY charconv.lib
+LIBRARY customapi.lib
+LIBRARY logcli.lib
+LIBRARY logwrap.lib
+LIBRARY estor.lib
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/clearlisttest/inc/clearlisttest.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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:
+*
+*/
+
+
+// INCLUDES
+#ifndef __CLEARLISTTEST_H__
+#define __CLEARLISTTEST_H__
+#include <E32Base.h>
+#include <badesca.h>
+#include <logwrap.h>
+#include <logcli.h>
+
+// CLASS DECLARATION
+
+
+class CClearlisttest : public CActive
+{
+ public: // Constructors and destructor
+
+ static CClearlisttest* NewL();
+
+ ~CClearlisttest();
+
+public: // From CActive
+ void RunL ();
+ void DoCancel ();
+
+ private:
+
+ CClearlisttest();
+ void ConstructL();
+ TInt ClearList();
+
+ private: // data
+ HBufC* iDllName;
+ TLogId iId;
+ TUid iEventType;
+ TTime iTime;
+ TLogDurationType iDurationType;
+ TLogDuration iDuration;
+ TLogContactItemId iContact;
+ TLogLink iLink;
+ TLogFlags iFlags;
+ HBufC* iDescription;
+ HBufC* iRemoteParty;
+ HBufC* iDirection;
+ HBufC* iCallStatus;
+ HBufC* iSubject;
+ HBufC* iNumber;
+ HBufC8* iData;
+ TInt iCompleteError;
+ //
+ CLogClient* iLogClient;
+ RFs iFsSession;
+ CLogEvent* iLogEvent;
+ RPointerArray<CLogEvent> iLogEvents;
+ private: // Friend classes
+ // none
+
+};
+
+// End of File __CLEARLISTTEST_H__
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/clearlisttest/install/clearlisttest.pkg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,43 @@
+;
+; 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:
+;
+;
+; Installtion file
+;
+;Languages
+&EN
+;
+; UID is the app's UID
+;
+#{"clearlisttest"},(0x20026F63),2,0,0
+;
+; List of localised vendor names
+%{"Vendor-EN"}
+
+; The non-localised, globally unique vendor name (mandatory)
+:"Nokia OY"
+;Supports Series 60 v 3.x
+;This line indicates that this installation is for the Series 60 platform v3.x
+;This line must appear _exactly_ as shown below in the sis file
+;If this line is missing or incorrect, the sis file will not be able
+;to be installed on Series 60 v3.x platforms
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+;
+; Three files to install
+;
+"\epoc32\release\armv5\udeb\clearlisttest.exe" -"!:\sys\bin\clearlisttest.exe"
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/clearlisttest/install/sis_udeb.bat Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,17 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+makesis clearlisttest.pkg clearlisttest.sis
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logdbmodifier/clearlisttest/src/clearlisttest.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* 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 "clearlisttest.h"
+#include <f32file.h>
+#include <s32file.h>
+#include <utf.h>
+
+#ifdef EKA2 //RD_APPS_TO_EXES
+#include <eikstart.h>
+#endif
+
+
+#include <e32std.h>
+#include <eikstart.h>
+
+_LIT(KClearlisttestPanic,"Clearlisttest creation");
+_LIT( KMaxTime, "99991130:235959.999999");
+
+LOCAL_C void MainL();
+
+// main function called by E32
+GLDEF_C TInt E32Main()
+ {
+ CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
+ TRAPD(error,MainL());
+ __ASSERT_ALWAYS(error == KErrNone,User::Panic(KClearlisttestPanic,error));
+ delete cleanup; // destroy clean-up stack
+ User::Heap().Reset();
+ return 0; // and return
+ }
+
+LOCAL_C void MainL()
+ {RDebug::Print(_L("CClearlisttest MainL"));
+ RThread().SetPriority(EPriorityAbsoluteForeground);
+ // install an active scheduler
+ CActiveScheduler* scheduler = new(ELeave)CActiveScheduler;
+ CActiveScheduler::Install(scheduler);
+
+ CClearlisttest* main = 0;
+ TRAPD (err, main = CClearlisttest::NewL());
+ if (err == KErrNone)
+ {RDebug::Print(_L("CClearlisttest CActiveScheduler::Start()"));
+ CActiveScheduler::Start();
+ }
+ RDebug::Print(_L("CClearlisttest after CActiveScheduler::Start()"));
+ delete main;
+ delete scheduler;
+ CActiveScheduler::Install(NULL);
+ }
+
+CClearlisttest::~CClearlisttest()
+ {
+ RDebug::Print(_L("CClearlisttest deleted"));
+ RDebug::Print(_L("CClearlisttest Cancel()"));
+ CActive::Cancel();
+ RDebug::Print(_L("CClearlisttest delete iLogEvent"));
+ delete iLogEvent;
+ RDebug::Print(_L("CClearlisttest delete iLogClient"));
+ delete iLogClient;
+ RDebug::Print(_L("CClearlisttest ~CClearlisttest<-"));
+ iFsSession.Close();
+ }
+// From CActive
+void CClearlisttest::RunL ()
+ {
+ RDebug::Print(_L("CClearlisttest::RunL->"));
+ if (iStatus.Int() == KErrNone)
+ {
+ RDebug::Print(_L("CClearlisttest::RunL iStatus.Int() == KErrNone"));
+ }
+ else
+ {
+ RDebug::Print(_L("CClearlisttest::RunL iStatus.Int() != KErrNone<-"));
+ }
+ RDebug::Print(_L("CClearlisttest::RunL<-"));
+ CActiveScheduler::Stop();
+ }
+
+// From CActive
+void CClearlisttest::DoCancel ()
+ {
+ RDebug::Print(_L("CClearlisttest::DoCancel"));
+ }
+
+CClearlisttest* CClearlisttest::NewL()
+ {RDebug::Print(_L("CClearlisttest NewL"));
+ CClearlisttest* self = new (ELeave) CClearlisttest();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+CClearlisttest::CClearlisttest()
+: CActive(EPriorityStandard)
+{
+}
+
+void CClearlisttest::ConstructL()
+ {RDebug::Print(_L("CClearlisttest ConstructL->"));
+ CActiveScheduler::Add (this);
+
+ User::LeaveIfError(iFsSession.Connect());
+ iLogClient = CLogClient::NewL( iFsSession );
+ iLogEvent = CLogEvent::NewL();
+ User::LeaveIfError(ClearList());
+ RDebug::Print(_L("CClearlisttest ConstructL<-"));
+ }
+
+TInt CClearlisttest::ClearList()
+ {RDebug::Print(_L("CClearlisttest::ClearList()->"));
+ TTime time( KMaxTime );
+ TInt errorCode ( KErrNone );
+ if ( !IsActive( ) )
+ {
+ //const TLogRecentList KLogNullRecentList = -1;
+ RDebug::Print(_L("CClearlisttest::ClearList()"));
+ //iLogClient->ClearLog( KLogNullRecentList, iStatus );
+ iLogClient->ClearLog( time, iStatus );
+ SetActive( );
+ }
+ else
+ {
+ RDebug::Print(_L("CClearlisttest::ClearList()() Clear failed"));
+ errorCode = KErrInUse;
+ }
+ RDebug::Print(_L("CClearlisttest::ClearList()<-"));
+ return errorCode;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logscenrepeditor/install/logscenrepeditor.pkg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,40 @@
+;
+; 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:
+;
+; Language
+
+&EN
+
+; SIS header: name, uid, version
+#{"logscenrepeditor"},(0xE8316BDD),1,0,0
+
+; Localised Vendor name
+%{"Vendor"}
+
+; Unique Vendor name
+:"Vendor"
+
+; Manual PKG pre-rules from PRO files
+; Default HW/platform dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+
+
+; Executable and default resource files
+"\epoc32\release\armv5\urel\logscenrepeditor.exe" - "!:\sys\bin\logscenrepeditor.exe"
+"\epoc32\data\z\resource\apps\logscenrepeditor.rsc" - "!:\resource\apps\logscenrepeditor.rsc"
+"\epoc32\data\z\private\10003a3f\import\apps\logscenrepeditor_reg.rsc" - "!:\private\10003a3f\import\apps\logscenrepeditor_reg.rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logscenrepeditor/logscenrepeditor.pro Tue May 04 12:39:37 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:
+#
+#
+
+TEMPLATE = app
+TARGET =
+CONFIG += hb
+DEPENDPATH += .
+
+INCLUDEPATH += .
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+# Input
+HEADERS += src/logscenrepeditorview.h
+SOURCES += src/main.cpp
+SOURCES += src/logscenrepeditorview.cpp
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xE8316BDD
+ TARGET.CAPABILITY = CAP_APPLICATION AllFiles
+ LIBS += -lcentralrepository
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logscenrepeditor/src/logscenrepeditorview.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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 <QGraphicsLinearLayout>
+#include <QDebug>
+#include <centralrepository.h>
+#include <hbradiobuttonlist.h>
+#include <hbpushbutton.h>
+#include <hbaction.h>
+#include <hblabel.h>
+#include <hbapplication.h>
+#include <LogsDomainCRKeys.h>
+#include "logscenrepeditorview.h"
+
+const QStringList KPredictiveSearchList = (QStringList()
+ << "Permanently Off"
+ << "On"
+ << "Temporarily Off"
+ << "Not defined");
+
+LogsCenrepEditorView::LogsCenrepEditorView()
+ : HbView(0),
+ mList(0),
+ mRepository(0)
+{
+ qDebug() << "[LOGS_CENREP]-> LogsCenrepEditorView::LogsCenrepEditorView()";
+ this->setTitle("Logs cenrep editor");
+
+ QT_TRAP_THROWING( mRepository = CRepository::NewL( KCRUidLogs ) );
+
+ TInt value(-1);
+ TInt err = mRepository->Get( KLogsPredictiveSearch, value );
+ qDebug() << "[LOGS_CENREP]-> mRepository->Get(KLogsPredictiveSearch) value: " << value
+ << ", err: " << err;
+
+ mList = new HbRadioButtonList(this);
+ mList->setItems(KPredictiveSearchList);
+ int listCurrentIndex = (err == 0) ? value : KPredictiveSearchList.count()-1;
+ mList->setSelected(listCurrentIndex);
+
+ HbPushButton* buttonSave = new HbPushButton("Save and Exit", this);
+ buttonSave->setMinimumHeight(60);
+ connect(buttonSave, SIGNAL(clicked()), this, SLOT(saveSettings()));
+ connect(buttonSave, SIGNAL(clicked()), qApp, SLOT(quit()));
+
+ HbPushButton* buttonExit = new HbPushButton("Exit without saving", this);
+ buttonExit->setMinimumHeight(60);
+ connect(buttonExit, SIGNAL(clicked()), qApp, SLOT(quit()));
+
+ HbLabel* label = new HbLabel("Predictive search feature", this);
+
+ QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
+ layout->addItem(label);
+ layout->addItem(mList);
+ layout->addItem(buttonSave);
+ layout->addItem(buttonExit);
+ setLayout(layout);
+}
+
+
+LogsCenrepEditorView::~LogsCenrepEditorView()
+{
+ qDebug() << "[LOGS_CENREP]-> LogsCenrepEditorView::~LogsCenrepEditorView()";
+ delete mRepository;
+ qDebug() << "[LOGS_CENREP]<- LogsCenrepEditorView::~LogsCenrepEditorView()";
+}
+
+void LogsCenrepEditorView::saveSettings()
+{
+ qDebug() << "[LOGS_CENREP]-> LogsCenrepEditorView::saveSettings()";
+ if (mList->selected() < KPredictiveSearchList.count()) {
+ int err = mRepository->Set( KLogsPredictiveSearch, mList->selected() );
+ qDebug() << "[LOGS_CENREP]-> mRepository->Set(KLogsPredictiveSearch), value:"
+ << mList->selected() << ", err: " << err;
+ } else {
+ qDebug() << "[LOGS_CENREP]-> not saving!!";
+ }
+
+ qDebug() << "[LOGS_CENREP]<- LogsCenrepEditorView::saveSettings()";
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logscenrepeditor/src/logscenrepeditorview.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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 LOGSCENREPEDITORVIEW_H
+#define LOGSCENREPEDITORVIEW_H
+
+#include <hbview.h>
+
+class HbRadioButtonList;
+class CRepository;
+
+class LogsCenrepEditorView : public HbView
+{
+ Q_OBJECT
+
+public:
+ LogsCenrepEditorView ();
+ virtual ~LogsCenrepEditorView ();
+
+private slots:
+
+ void saveSettings();
+
+private:
+
+
+private:
+ HbRadioButtonList* mList;
+ CRepository* mRepository;
+};
+
+#endif // LOGSCENREPEDITORVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logscenrepeditor/src/main.cpp Tue May 04 12:39:37 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:
+*
+*/
+
+#include <hbapplication.h>
+#include <hbmainwindow.h>
+#include "logscenrepeditorview.h"
+
+int main(int argc, char *argv[])
+{
+
+ HbApplication app(argc, argv);
+ HbMainWindow mainWindow;
+ LogsCenrepEditorView *view = new LogsCenrepEditorView();
+ mainWindow.addView(view);
+ mainWindow.show();
+
+ return app.exec();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logsengineapitester/install/logsengineapitester.pkg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,39 @@
+;
+; 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:
+;
+; Language
+
+&EN
+
+; SIS header: name, uid, version
+#{"logsengineapitester"},(0xE0014E73),1,0,0
+
+; Localised Vendor name
+%{"Nokia, Qt Software"}
+
+; Unique Vendor name
+:"Nokia, Qt Software"
+
+; Dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+(0x2001E61C), 4, 5, 0, {"QtLibs pre-release"}
+
+; Executable and default resource files
+"\epoc32\release\armv5\urel\logsengineapitester.exe" - "!:\sys\bin\logsengineapitester.exe"
+"\epoc32\data\z\resource\apps\logsengineapitester.rsc" - "!:\resource\apps\logsengineapitester.rsc"
+"\epoc32\data\z\private\10003a3f\import\apps\logsengineapitester_reg.rsc" - "!:\private\10003a3f\import\apps\logsengineapitester_reg.rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logsengineapitester/logsengineapitester.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,38 @@
+#
+# 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:
+#
+
+SERVICEAPP=app
+TARGET=logsengineapitester
+
+CONFIG += hb
+
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+include(src/logsengineapitester.pri)
+
+LIBS+=-llogsengine -lcentralrepository
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xE0014E73
+ TARGET.CAPABILITY = CAP_APPLICATION
+}
+
+
+libFiles.sources = logsengineapitester.exe
+libFiles.path = "!:\sys\bin"
+DEPLOYMENT += libFiles
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logsengineapitester/src/logsengineapitester.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,301 @@
+/*
+* 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 <QDebug>
+#include <HbListView.h>
+#include <HbMenu.h>
+#include <HbAction.h>
+#include <HbLabel.h>
+#include <HbMessageBox.h>
+#include <QGraphicsLinearLayout>
+#include <logsmodel.h>
+#include <logsevent.h>
+#include <logscustomfilter.h>
+#include <centralrepository.h>
+#include <logsdomaincrkeys.h>
+#include <logsfilter.h>
+#include "logsengineapitester.h"
+
+Q_DECLARE_METATYPE(LogsEvent *)
+
+#define LOGSAPITEST_PRINT_ALLOC_SIZE { \
+ User::CompressAllHeaps(); \
+ TInt allocsize; \
+ User::AllocSize(allocsize); \
+ qDebug() << "LogsApiTest alloc size:" << allocsize; } \
+
+TestView::TestView() : HbView(), mList(0), mModel(0), mLogsModel(0), mFilter(0), mShowAll(true)
+{
+ qDebug() << "LogsApiTest::LogsApiTest ->";
+
+ LOGSAPITEST_PRINT_ALLOC_SIZE
+
+ mRepository = CRepository::NewL( KCRUidLogs );
+
+ mLabel = new HbLabel(this);
+ mList = new HbListView(this);
+ mList->setItemRecycling(true);
+ mList->setUniformItemSizes(true);
+ mLogsModel = new LogsModel(LogsModel::LogsFullModel);
+ mModel = new TestModel(*mLogsModel);
+ mList->setModel(mModel);
+ QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
+ layout->addItem(mLabel);
+ layout->addItem(mList);
+ setLayout(layout);
+
+ mMissedCallsFilter = new LogsFilter(LogsFilter::Missed);
+ mMissedCallsFilter->setMaxSize(5);
+ mMissedCallsFilter->setSourceModel(mLogsModel);
+ connect(mMissedCallsFilter, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
+ this, SLOT(updateMissedCallsLabel()));
+
+ HbAction* filterAction = new HbAction;
+ filterAction->setText("Change filter");
+ connect(filterAction, SIGNAL(triggered()), this, SLOT(changeFilter()) );
+ menu()->addAction(filterAction);
+
+ HbAction* addMissedCallAction = new HbAction;
+ addMissedCallAction->setText("Add missed call");
+ connect(addMissedCallAction, SIGNAL(triggered()), this, SLOT(addMissedCall()) );
+ menu()->addAction(addMissedCallAction);
+
+ HbAction* clearMissedCallsAction = new HbAction;
+ clearMissedCallsAction->setText("Clear missed calls");
+ connect(clearMissedCallsAction, SIGNAL(triggered()), this, SLOT(clearMissedCalls()) );
+ menu()->addAction(clearMissedCallsAction);
+
+ HbAction* deleteAction = new HbAction;
+ deleteAction->setText("Delete events");
+ connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteEvents()) );
+ menu()->addAction(deleteAction);
+
+ updateMissedCallsLabel();
+
+ qDebug() << "LogsApiTest::LogsApiTest <-";
+
+}
+
+
+TestView::~TestView()
+{
+ qDebug() << "LogsApiTest::~LogsApiTest ->";
+
+ delete mMissedCallsFilter;
+ mList->setModel(0);
+ delete mModel;
+ delete mLogsModel;
+
+ delete mRepository;
+
+ qDebug() << "LogsApiTest::~LogsApiTest <-";
+}
+
+void TestView::changeFilter()
+{
+ quint32 contactId = 2;
+ if ( mShowAll ){
+ if ( mFilter ){
+ delete mFilter;
+ mFilter = 0;
+ }
+ mFilter = new LogsCustomFilter;
+ mFilter->setContactId(contactId);
+ mFilter->setSourceModel(mLogsModel);
+ connect( mFilter, SIGNAL(markingCompleted(int)), this, SLOT(markingCompleted(int)) );
+ connect( mFilter, SIGNAL(clearingCompleted(int)), this, SLOT(clearingCompleted(int)) );
+ mList->setModel(0);
+ delete mModel;
+ mModel = 0;
+ mModel = new TestModel(*mFilter);
+ mList->setModel(mModel);
+ mShowAll = false;
+ }
+ else {
+ mList->setModel(0);
+ delete mFilter;
+ mFilter = 0;
+ delete mModel;
+ mModel = 0;
+ mModel = new TestModel(*mLogsModel);
+ mList->setModel(mModel);
+ mShowAll = true;
+ }
+}
+
+void TestView::addMissedCall()
+{
+ TInt errorCode( KErrNone );
+ TInt value;
+
+ errorCode = mRepository->Get( KLogsNewMissedCalls, value );
+
+ if ( errorCode == KErrNone ){
+ ++value;
+ errorCode = mRepository->Set( KLogsNewMissedCalls, value );
+ }
+
+ // Do here what some API user might do when it gets
+ // notification about missed call counter increase
+ updateMissedCallsLabel();
+}
+
+void TestView::clearMissedCalls()
+{
+ mRepository->Set( KLogsNewMissedCalls, 0 );
+ if ( mFilter ){
+ mFilter->markEventsSeen();
+ }
+ updateMissedCallsLabel();
+}
+
+void TestView::deleteEvents()
+{
+ if ( mFilter ){
+ mFilter->clearEvents();
+ } else {
+ mLogsModel->clearList(LogsModel::TypeLogsClearAll);
+ }
+}
+
+void TestView::updateMissedCallsLabel()
+{
+ qDebug() << "LogsApiTest::updateMissedCallsLabel ->";
+
+ LOGSAPITEST_PRINT_ALLOC_SIZE
+
+ QString lastMissedCallFrom;
+ int repeatedMissedCalls = 0;
+ TInt value(0);
+ mRepository->Get( KLogsNewMissedCalls, value );
+ if ( mMissedCallsFilter->rowCount() > 0 ){
+ lastMissedCallFrom = mMissedCallsFilter->data(mMissedCallsFilter->index(0,0), Qt::DisplayRole).toStringList().at(0);
+ repeatedMissedCalls = 1;
+ }
+ for( int i = 1; i < value && i < mMissedCallsFilter->rowCount(); i++ ){
+ QStringList displayData = mMissedCallsFilter->data(mMissedCallsFilter->index(i,0), Qt::DisplayRole).toStringList();
+ if ( lastMissedCallFrom == displayData.at(0) ){
+ repeatedMissedCalls++;
+ } else {
+ i = value; // Break
+ }
+ }
+
+ if ( value == 0 ){
+ mLabel->setPlainText( "No missed calls" );
+ } else if ( repeatedMissedCalls >= value ){
+ mLabel->setPlainText(
+ QString("%1 missed call(s) from %2").arg(value).arg(lastMissedCallFrom) );
+ } else {
+ mLabel->setPlainText( QString("%1 missed call(s)").arg(value) );
+ }
+ qDebug() << "LogsApiTest::updateMissedCallsLabel <-";
+}
+
+void TestView::markingCompleted(int err)
+{
+ HbMessageBox box(HbMessageBox::MessageTypeInformation);
+ box.setText( QString("Marking completed, err:%1").arg(err) );
+ box.exec();
+}
+
+void TestView::clearingCompleted(int err)
+{
+ HbMessageBox box(HbMessageBox::MessageTypeInformation);
+ box.setText( QString("Clearing completed, err:%1").arg(err) );
+ box.exec();
+}
+
+TestModel::TestModel(QAbstractItemModel& logsModel) : mLogsModel(logsModel)
+{
+ readEvents();
+ connect( &mLogsModel, SIGNAL( dataChanged(const QModelIndex&,const QModelIndex&)),
+ this, SLOT(handleModelUpdated()));
+ connect( &mLogsModel, SIGNAL( rowsInserted(const QModelIndex&,int,int)),
+ this, SLOT(handleModelUpdated()));
+ connect( &mLogsModel, SIGNAL( rowsRemoved(const QModelIndex&,int,int)),
+ this, SLOT(handleModelUpdated()));
+ connect( &mLogsModel, SIGNAL(modelReset()),
+ this, SLOT(handleModelUpdated()));
+}
+TestModel::~TestModel()
+{
+}
+int TestModel::rowCount(const QModelIndex &parent) const
+{
+ return mEvents.count();
+}
+QVariant TestModel::data(const QModelIndex &index, int role) const
+{
+ if ( role == Qt::DisplayRole && index.row() >= 0 && index.row() < mEvents.count() ){
+ return mEvents.at(index.row());
+ }
+ return QVariant();
+}
+void TestModel::handleModelUpdated()
+{
+ LOGSAPITEST_PRINT_ALLOC_SIZE
+
+ // Do it in simple but unefficient way
+ readEvents();
+ reset();
+}
+
+void TestModel::readEvents()
+{
+ mEvents.clear();
+ for ( int i = 0; i < mLogsModel.rowCount(); ++i ){
+ LogsEvent* event = qVariantValue<LogsEvent*>(
+ mLogsModel.data( mLogsModel.index(i, 0), LogsModel::RoleFullEvent ) );
+ if ( event ){
+
+ mEvents.append( directionText(*event) );
+ // Can check occurence time etc.
+ }
+ }
+}
+
+QString TestModel::directionText(const LogsEvent& event)
+{
+ QString direction;
+ if ( event.direction() == LogsEvent::DirIn ) {
+ direction = QString("Received call from ");
+ } else if ( event.direction() == LogsEvent::DirOut ) {
+ direction = QString("Called to ");
+ } else if ( event.direction() == LogsEvent::DirMissed ) {
+ direction = QString("Missed call from ");
+ }
+ if ( event.remoteParty().length() > 0 ){
+ direction.append( event.remoteParty() );
+ }
+ else {
+ direction.append( event.number() );
+ }
+
+ if ( event.direction() == LogsEvent::DirMissed ){
+ if ( event.isRead() ){
+ direction.append( " Seen");
+ } else {
+ direction.append( " Unseen");
+ }
+ }
+
+ return direction;
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logsengineapitester/src/logsengineapitester.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* 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 LOGSENGINEAPITESTER_H
+#define LOGSENGINEAPITESTER_H
+
+#include <HbView.h>
+
+class HbListView;
+class HbLabel;
+class LogsModel;
+class LogsCustomFilter;
+class QAbstractItemModel;
+class TestModel;
+class LogsEvent;
+class CRepository;
+class LogsFilter;
+
+class TestView : public HbView
+{
+ Q_OBJECT
+public:
+ TestView();
+ ~TestView();
+
+public slots:
+ void changeFilter();
+ void addMissedCall();
+ void clearMissedCalls();
+ void updateMissedCallsLabel();
+ void deleteEvents();
+ void markingCompleted(int err);
+ void clearingCompleted(int err);
+
+private:
+ HbListView* mList;
+ HbLabel* mLabel;
+ TestModel* mModel;
+ LogsModel* mLogsModel;
+ LogsCustomFilter* mFilter;
+ bool mShowAll;
+ CRepository* mRepository;
+ LogsFilter* mMissedCallsFilter;
+
+};
+
+class TestModel : public QAbstractListModel
+ {
+ Q_OBJECT
+
+public:
+ TestModel(QAbstractItemModel& logsModel);
+ ~TestModel();
+
+public: // From QAbstractListModel
+ virtual int rowCount(const QModelIndex &parent) const;
+ virtual QVariant data(const QModelIndex &index, int role) const;
+
+public slots:
+ void handleModelUpdated();
+
+private:
+ void readEvents();
+ QString directionText(const LogsEvent& event);
+
+private:
+ QStringList mEvents;
+ QAbstractItemModel& mLogsModel;
+
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logsengineapitester/src/logsengineapitester.pri Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,23 @@
+#
+# 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:
+#
+
+SOURCES=\
+ src/main.cpp\
+ src/logsengineapitester.cpp
+
+HEADERS=\
+ src/logsengineapitester.h
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logsengineapitester/src/main.cpp Tue May 04 12:39:37 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:
+*
+*/
+
+#include <hbapplication.h>
+#include <hbmainwindow.h>
+#include <QDebug>
+#include "logsengineapitester.h"
+
+int main(int argc, char **argv)
+{
+
+ qDebug() << "LogsEngineApiTester::main ->";
+
+
+ HbApplication app(argc, argv);
+
+ HbMainWindow mainWindow;
+
+ TestView testView;
+ mainWindow.addView(&testView);
+
+ // Show widget
+ mainWindow.show();
+
+ // Enter event loop
+ int err = app.exec();
+ qDebug() << "LogsEngineApiTester::main <-";
+ return err;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logsservicestester/install/logsservicestester.pkg Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,42 @@
+;
+; 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:
+;
+;
+; Installtion file for Cenrep Editor
+;
+;Languages
+&EN
+;
+; UID is the app's UID
+;
+#{"logsservicestester"},(0xEC209DCF),2,0,0
+;
+; List of localised vendor names
+%{"Vendor-EN"}
+
+; The non-localised, globally unique vendor name (mandatory)
+:"Nokia OY"
+;Supports Series 60 v 3.x
+;This line indicates that this installation is for the Series 60 platform v3.x
+;This line must appear _exactly_ as shown below in the sis file
+;If this line is missing or incorrect, the sis file will not be able
+;to be installed on Series 60 v3.x platforms
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+;
+; Three files to install
+;
+"\epoc32\release\armv5\udeb\logsservicestester.exe" - "!:\sys\bin\logsservicestester.exe"
+"\epoc32\data\z\resource\apps\logsservicestester.rsc" - "!:\resource\apps\logsservicestester.rsc"
+"\epoc32\data\z\private\10003a3f\import\apps\logsservicestester_reg.rsc" - "!:\private\10003a3f\import\apps\logsservicestester_reg.rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logsservicestester/logsservicestester.pro Tue May 04 12:39:37 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:
+#
+#
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+CONFIG += hb
+
+# Input
+SOURCES += main.cpp
+
+symbian: {
+ TARGET.UID2 = 0x100039CE
+ TARGET.UID3 = 0xEC209DCF
+ TARGET.CAPABILITY = CAP_APPLICATION AllFiles
+ LIBS += -llogsservices
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/logsservicestester/main.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 <QString>
+#include <QStringList>
+#include <QDebug>
+#include <hbapplication.h>
+#include <hbmainwindow.h>
+#include <logsservices.h>
+
+int main(int argc, char *argv[])
+{
+ qDebug() << "LogsServicesTester entry";
+ LogsServices::LogsView viewIndex = LogsServices::ViewAll;
+ bool showDialpad = false;
+ for ( int i = 0; i< argc; i++ ){
+ qDebug() << "Arg" << ( i + 1 ) << argv[i];
+ QString argStr( argv[i] );
+ if ( argStr.length() == 1 ){
+ viewIndex = (LogsServices::LogsView)argStr.toInt();
+ }
+ if ( argStr == QString("-dialpad") ){
+ showDialpad = true;
+ }
+ }
+
+ HbApplication app(argc, argv);
+ HbMainWindow mainWindow;
+ mainWindow.show();
+
+ qDebug() << "LogsServicesTester start logs";
+ LogsServices::start( viewIndex, showDialpad );
+
+ int ret = app.exec();
+ qDebug() << "LogsServicesTester exit";
+ return ret;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/qtestutils/inc/testresultxmlparser.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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 TESTRESULTXMLPARSER_H
+#define TESTRESULTXMLPARSER_H
+
+#include <QXmlDefaultHandler>
+
+
+class TestResultXmlParser : public QXmlDefaultHandler
+{
+public: // Constructors and destructor
+ TestResultXmlParser();
+ ~TestResultXmlParser();
+
+public: // 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);
+
+public: // New functions
+
+ int parse(const QString& fileName);
+
+ int parseAndPrintResults(
+ const QString& fileName,
+ bool printDetails=false);
+
+ int testCount();
+
+ QStringList errors();
+
+private: // Data
+ int mTestCount;
+ QStringList* mErrors;
+ bool mParsingIncidentElement;
+ bool mParsingDescriptionElement;
+ bool mCurrentTestFailed;
+ QString mCurrentTestName;
+ QString mCurrentTestFile;
+ int mCurrentTestFailureLine;
+};
+
+
+#endif // TESTRESULTXMLPARSER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/qtestutils/src/testresultxmlparser.cpp Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* 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 "testresultxmlparser.h"
+#include <stdio.h>
+
+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";
+
+
+// -----------------------------------------------------------------------------
+// TestResultXmlParser::TestResultXmlParser
+// -----------------------------------------------------------------------------
+//
+TestResultXmlParser::TestResultXmlParser()
+: mTestCount(0),
+ mParsingIncidentElement(false),
+ mParsingDescriptionElement(false),
+ mCurrentTestFailed(false),
+ mCurrentTestFailureLine(0)
+{
+ mErrors = new QStringList;
+}
+
+// -----------------------------------------------------------------------------
+// TestResultXmlParser::TestResultXmlParser
+// -----------------------------------------------------------------------------
+//
+TestResultXmlParser::~TestResultXmlParser()
+{
+ delete mErrors;
+}
+
+// -----------------------------------------------------------------------------
+// TestResultXmlParser::startElement
+// -----------------------------------------------------------------------------
+//
+bool TestResultXmlParser::startElement(
+ const QString& /*namespaceURI*/,
+ const QString& /*localName*/,
+ const QString& qName,
+ const QXmlAttributes& atts)
+{
+ if (qName == testFunctionElement) {
+ mTestCount++;
+ mCurrentTestName = atts.value(nameAttr);
+ return true;
+ }
+ if (qName == incidentElement) {
+ mParsingIncidentElement = true;
+ if (atts.value(typeAttr) == attrValueFail) {
+ mCurrentTestFailed = true;
+ mCurrentTestFile = atts.value(fileAttr);
+ mCurrentTestFailureLine = atts.value(lineAttr).toInt();
+ }
+ return true;
+ }
+ mParsingDescriptionElement = (qName == descriptionElement);
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// TestResultXmlParser::endElement
+// -----------------------------------------------------------------------------
+//
+bool TestResultXmlParser::endElement(
+ const QString& /*namespaceURI*/,
+ const QString& /*localName*/,
+ const QString& qName)
+{
+ if (qName == incidentElement) {
+ mParsingIncidentElement = false;
+ mCurrentTestFailed = false;
+ return true;
+ }
+ if (qName == descriptionElement) {
+ mParsingDescriptionElement = false;
+ }
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// TestResultXmlParser::characters
+// -----------------------------------------------------------------------------
+//
+bool TestResultXmlParser::characters(const QString& ch)
+{
+ if (mParsingIncidentElement &&
+ mParsingDescriptionElement &&
+ mCurrentTestFailed) {
+ QString testResult = mCurrentTestName + " failed:\n";
+ testResult += "File: ";
+ testResult += mCurrentTestFile;
+ testResult += "\n";
+ testResult += "Line: ";
+ testResult += QString::number(mCurrentTestFailureLine);
+ testResult += "\n";
+ testResult += "Reason: ";
+ testResult += ch;
+ testResult += "\n";
+ mErrors->append(testResult);
+ }
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// TestResultXmlParser::parse
+// -----------------------------------------------------------------------------
+//
+int TestResultXmlParser::parse(const QString& fileName)
+{
+ QFile file(fileName);
+ QXmlInputSource inputSource(&file);
+ QXmlSimpleReader reader;
+ reader.setContentHandler(this);
+ return reader.parse(inputSource);
+}
+
+// -----------------------------------------------------------------------------
+// TestResultXmlParser::parseAndPrintResults
+// -----------------------------------------------------------------------------
+//
+int TestResultXmlParser::parseAndPrintResults(
+ const QString& fileName,
+ bool printDetails)
+{
+ printf("Parsing: %s\n", fileName.toUtf8().data());
+ int error = parse(fileName);
+ printf("%d tests executed. Failed total: %d\n", mTestCount, mErrors->count());
+ if (printDetails) {
+ printf("\n");
+ foreach(QString error, *mErrors) {
+ printf(error.toUtf8().data());
+ printf("\n");
+ }
+ }
+ return error;
+}
+
+// -----------------------------------------------------------------------------
+// TestResultXmlParser::testCount
+// -----------------------------------------------------------------------------
+//
+int TestResultXmlParser::testCount()
+{
+ return mTestCount;
+}
+
+// -----------------------------------------------------------------------------
+// TestResultXmlParser::errors
+// -----------------------------------------------------------------------------
+//
+QStringList TestResultXmlParser::errors()
+{
+ return *mErrors;
+}
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/unittestrunner/tsrc.pro Tue May 04 12:39:37 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
+
+SUBDIRS= \
+ ..\..\logsengine\tsrc\ut_logsengine\
+ ..\..\logsengine\logssymbianos\tsrc\ut_logssymbianos\
+ ..\..\logscntfinder\tsrc\ut_logscntfinder\
+ ..\..\logsapp\tsrc\ut_logsapp\
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/unittestrunner/unittest_qt.pl Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,442 @@
+#
+# 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:
+#
+#!/usr/bin/perl
+
+use File::Copy;
+use Cwd;
+use Getopt::Long;
+use XML::Parser::Expat;
+use Data::Dumper;
+
+#---------------------------------------Initialization------------------------------------------------------#
+
+$projectrootname = "/"; #is set to correct at run-time
+$projectdrive = "z:"; #is set to correct at run-time
+
+$unitTestRunner = "unittest_qt.pl";
+$scriptLocation = "logsui/tsrc/unittestrunner";
+$coverageResultsDirDefault = "logsui/tsrc/unittestrunner/qtresults/";
+$testConfigDefault = "unittest_qt_config.txt";
+$qtProFileDefault = "tsrc.pro";
+$buildResults = "BuildResults.txt";
+$coverageDat = "MON.dat";
+$coverageSymbols = "MON.sym";
+$coverageProfile = "profile.txt";
+
+$coverageResultsFile = "CTCHTML/index.html";
+$finalResultsFile = "AllResults.html";
+$cssFile = "CTCHTML/ctc.css";
+$cssLink = "<link rel=\"stylesheet\"";
+
+$xmlDllLine = "TestCase";
+$xmlResultLine = "Incident";
+$xmlCaseFailed = "failed";
+$xmlCasePassed = "pass";
+$outputString = "";
+$outputFileBodyStart = "<body";
+
+$totalCount = 0;
+$passedCount = 0;
+$failedCount = 0;
+
+$qtestOutputString = "";
+
+my @testNamesAndLogFiles = ( [""],[""] ); # two dimensional array e.g. [name, log1, log2], [name2, log3, log5, log6]
+
+# from command line
+my ($param_noclean,
+ $testConfig,
+ $qtProFile,
+ $coverageResultsDir);
+
+#---------------------------------------Main Start----------------------------------------------------------#
+
+# read command line parameters
+my $result = GetOptions("noclean" => \$param_noclean,
+ "config:s" => \$testConfig,
+ "pro:s" => \$qtProFile,
+ "results:s" => \$coverageResultsDir,
+ "help" => \$help);
+
+$startdir = cwd;
+
+if (defined $help){
+ print_help();
+ exit;
+}
+
+findProjectDriveAndRoot();
+
+createResultsDir();
+
+# set target for intrumentation result
+$ENV{'CTC_DATA_PATH'}= "$coverageResultsDir";
+
+doClean();
+
+parseConfigFile();
+
+buildTests();
+
+runTests();
+
+chdir($startdir);
+
+# create textual output
+chdir("$coverageResultsDir");
+doSystemCall("ctcpost $coverageSymbols $coverageDat -p $coverageProfile -T 70");
+doSystemCall("ctc2html -i $coverageProfile -t 70");
+
+# clear target for intrumentation result
+$ENV{'CTC_DATA_PATH'}= "";
+
+combineResults();
+
+chdir($startdir);
+
+#---------------------------------------Main Ends-------------------------------------------------------------#
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub findProjectDriveAndRoot()
+{
+ $tempStartDir = $startdir;
+ if ($tempStartDir =~ m/$scriptLocation/){
+ # extract project root
+ for ($tempStartDir) {
+ s/$scriptLocation+$//;
+ }
+ # divide it to drive and root
+ if ($tempStartDir =~ /^(.:)(.*)/){
+ $projectdrive = $1;
+ $projectrootname = $2;
+ }
+ print "project drive: $projectdrive \n";
+ print "project root: $projectrootname \n";
+ }
+ else{
+ print "cannot determine project drive and root, use defaults!\n";
+ }
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub createResultsDir()
+{
+ # create directory for results
+ if ( defined $coverageResultsDir ){
+ if ($coverageResultsDir =~ /^(.:)/){
+ print("Drive name given in results dir arg\n");
+ }
+ else{
+ $coverageResultsDir = "$projectdrive" . "/" . "$coverageResultsDir";
+ }
+ }
+ else{
+ $coverageResultsDir = "$projectdrive$projectrootname$coverageResultsDirDefault";
+ }
+ print ("Writing results to $coverageResultsDir \n\n");
+ if (mkdir("$coverageResultsDir", 0755)){
+ print("The results directory was created successfully! \n");
+ }
+ else {
+ print("The results directory already exists. \n");
+ }
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub doClean()
+{
+ if (!defined $param_noclean)
+ {
+ # clear previous results
+ print("Cleaning previous results. \n");
+ unlink("$coverageResultsDir$buildResults");
+ unlink("$coverageResultsDir$coverageDat");
+ unlink("$coverageResultsDir$coverageSymbols");
+ unlink("$coverageResultsDir$coverageProfile");
+ unlink("$coverageResultsDir$finalResultsFile");
+ }
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub parseConfigFile()
+{
+ if ( !defined $testConfig ){
+ print("Config file not defined, using default. \n");
+ $testConfig = $testConfigDefault;
+ }
+
+ open(CONFIG, $testConfig) or die("file $testConfig not found!\n");
+
+ @config_file_content = <CONFIG>;
+
+
+ for ($j = 0; $j <= $#config_file_content; $j++)
+ {
+ # remove \n from each line
+ $currline = @config_file_content[$j];
+ for ($currline) {
+ s/\n+$//;
+ }
+ @{ $testNamesAndLogFiles [$j] } = split( ",", $currline );
+ }
+
+ print Dumper( @testNamesAndLogFiles );
+
+ close(CONFIG);
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub buildTests()
+{
+ if ( !defined $qtProFile ){
+ print("Pro file not defined, using default. \n");
+ $qtProFile = $qtProFileDefault;
+ }
+ doSystemCall( "qmake $qtProFile" );
+ doSystemCall( "sbs reallyclean" );
+ doSystemCall( "qmake $qtProFile" );
+
+ $exclude = "-C \"EXCLUDE+*\tsrc\*\" -C \"EXCLUDE+*/*/tsrc/*\" -C \"EXCLUDE+*/*/*/tsrc/*\" -C \"EXCLUDE+moc_*\"";
+
+ doSystemCall( "call ctcwrap -i d -n $coverageResultsDir$coverageSymbols $exclude -2comp sbs.bat -c winscw_udeb" );
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub runTests()
+{
+ for $i ( 0 .. $#testNamesAndLogFiles ) {
+ $testName = $testNamesAndLogFiles[$i][0];
+ print("Running tests for: $testName\n");
+
+ $testCall = "\\epoc32\\release\\winscw\\udeb\\" . $testName . " -xml";
+ doSystemCall( $testCall );
+
+ for $j ( 1 .. $#{ $testNamesAndLogFiles [$i] } ) {
+ $logFile = $projectdrive . "\\epoc32\\winscw\\c\\" . $testNamesAndLogFiles[$i][$j];
+ print("Copying log file: $logFile\n");
+ copy( $logFile, "$coverageResultsDir" );
+ }
+ }
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub combineResults()
+{
+ open(COVERAGE, "$coverageResultsDir$coverageResultsFile") or die("file $coverageResultsFile not found!\n");
+ @coverageFileContent = <COVERAGE>;
+
+ # append coverage information after eunit results
+
+ for ($j = 0; $j <= $#coverageFileContent; $j++){
+ $currentLine = @coverageFileContent[$j];
+
+ if ($currentLine =~ /$cssLink/){
+ if ( open(CSSFILE, "$coverageResultsDir$cssFile") ){
+ # append css styles to results html
+ $outputString .= "<style type=\"text/css\"> body {";
+ @cssFileContent = <CSSFILE>;
+ my($line);
+ foreach $line (@cssFileContent){
+ $outputString .= $line;
+ }
+ $outputString .= "}</style>\n";
+ close(CSSFILE);
+ }
+ }
+ else{
+ $outputString .= $currentLine;
+
+ if ($currentLine =~ /$outputFileBodyStart/){
+ $outputString .= parseXmlResults();
+ $outputString .= "<br><br>"
+ }
+ }
+ }
+
+ open(NEWRESULTSFILE, "> $coverageResultsDir$finalResultsFile") or die "Cannot open final results file\n";
+ print NEWRESULTSFILE "$outputString";
+ close(NEWRESULTSFILE);
+ close(OUTPUT);
+ close(COVERAGE);
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub parseXmlResults()
+{
+ $qtestOutputString = "<span class=\"head1\">QTestLib Results</span><br><br>\n";
+
+
+ for $i ( 0 .. $#testNamesAndLogFiles ) {
+ $testName = $testNamesAndLogFiles[$i][0];
+
+ for $j ( 1 .. $#{ $testNamesAndLogFiles [$i] } ) {
+ $logFile = $testNamesAndLogFiles[$i][$j];
+ if ( -e "$coverageResultsDir$logFile" ){
+ print("Parsing: $logFile\n");
+ open(TESTRESULTS, "$coverageResultsDir$logFile");
+ $parser = new XML::Parser::Expat;
+ $parser->setHandlers('Start' => \&sh,
+ 'End' => \&eh,
+ 'Char' => \&ch);
+
+ $totalCount = 0;
+ $passedCount = 0;
+ $failedCount = 0;
+ eval{
+ ### try block
+ $parser->parse(*TESTRESULTS);
+ };
+ if ($@){
+ ### catch block
+ print("$logFile, parsing failed\n");
+ $qtestOutputString .= "<span class=\"red\">$logFile parsing failed, testcase execution might have failed </span><br>\n";
+ };
+ close(TESTRESULTS);
+
+ }
+ else{
+
+ print("$logFile, not found\n");
+ $qtestOutputString .= "<span class=\"head3\">";
+ $qtestOutputString .= "$testName => </span>";
+ $qtestOutputString .= "<span class=\"red\">$logFile not found, testcase building might have failed </span><br>\n";
+ }
+ }
+ }
+
+ return $qtestOutputString;
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub sh
+{
+ my ($p, $el, %atts) = @_;
+ if ( $el eq $xmlDllLine )
+ {
+ $qtestOutputString .= "<span class=\"head3\">";
+ $dllName = %atts->{name};
+ @dllNameParts = split m!(\\)!, $dllName;
+ $dllName = $dllNameParts[$#dllNameParts];
+ $qtestOutputString .= "$dllName => </span>";
+ }
+
+ if ( $el eq $xmlResultLine )
+ {
+ $status = %atts->{type};
+ if ( $status eq $xmlCasePassed )
+ {
+ $passedCount++;
+ }
+ else
+ {
+ $failedCount++;
+ }
+ }
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub eh
+{
+ my ($p, $el) = @_;
+ if ( $el eq $xmlDllLine )
+ {
+ $totalCount = $passedCount + $failedCount;
+ if ( $failedCount > 0 || $totalCount == 0 )
+ {
+ $qtestOutputString .= "<span class=\"red\">Testcases passed/run: $passedCount/$totalCount </span><br>\n";
+ }
+ else
+ {
+ $qtestOutputString .= "<span class=\"blue\">Testcases passed/run: $passedCount/$totalCount </span><br>\n";
+ }
+ $passedCount = 0;
+ $failedCount = 0;
+ }
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub ch
+{
+ my ($p, $el) = @_;
+ #print ("$el\n");
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub doSystemCall
+{
+ #print("\nDoing system call: $_[0]\n");
+ #system($_[0]);
+ system("echo Doing system call: $_[0] >> $coverageResultsDir$buildResults");
+ system("$_[0] >> $coverageResultsDir$buildResults 2>&1");
+}
+
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+#
+sub print_help
+{
+ print("\n*************************************************************\n\n");
+ print("Script runs by default all multimediasharing qt tests\n");
+ print("and creates build, test and coverage results to:\n\n");
+ print(" mmsharing/src/internal/unittestrunner/qtresults/\n\n");
+ print("Own configuration file (list of components to be processed)\n");
+ print("can be used as well:\n\n");
+ print(" >unittest_ctc.pl -config=myowntestcomponents.txt\n\n");
+ print("The text file should follow the syntax of default configuration file\n");
+ print("mmsharing/src/internal/unittestrunner/unittest_qt_config.txt\n\n");
+ print("When running just some set of components you might want to \"merge\" the results");
+ print("with existing coverage results.\n");
+ print("That is possible with command:\n\n");
+ print(" >unittest_ctc.pl -eunitdlls=myowneunitcomponents.txt -noclean\n");
+ print("\n*************************************************************\n");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/tsrc/unittestrunner/unittest_qt_config.txt Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,4 @@
+ut_logsengine -noprompt,ut_logs_logsModel.xml,ut_logs_logsDetailsModel.xml,ut_logs_logsMatchesModel.xml,ut_logs_logsFilter.xml,ut_logs_logsCustomFilter.xml,ut_logs_logsCall.xml,ut_logs_logsContact.xml,ut_logs_logsMessage.xml,ut_logs_logsEvent.xml,ut_logs_logsEventData.xml
+ut_logssymbianos -noprompt,ut_logs_logsDbConnector.xml,ut_logs_logsRemove.xml,ut_logs_logsReader.xml,ut_logs_logsReaderStates.xml,ut_logs_logsEventParser.xml,ut_logs_logsEventDataParser.xml,ut_logs_logsForegroundWatcher.xml
+ut_logscntfinder -noprompt,ut_logs_logsCntFinder.xml,ut_logs_logsPredictiveTranslator.xml,ut_logs_logscntentry.xml
+ut_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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/recents.pro Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,19 @@
+#
+# 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
+SUBDIRS = logsui
+CONFIG += ordered
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/recents_plat/logs_engine_api/inc/logsabstractmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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 LOGSABSTRACTMODEL_H
+#define LOGSABSTRACTMODEL_H
+
+#include <QAbstractListModel>
+#include <logsexport.h>
+
+class LogsEvent;
+class LogsDbConnector;
+class LogsModelItemContainer;
+class HbIcon;
+
+/**
+ * Abstract logs model.
+ *
+ */
+class LogsAbstractModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Additional data role types.
+ */
+ enum LogsModelRole {
+ RoleFullEvent = Qt::UserRole + 1, // LogsEvent
+ RoleCall, // LogsCall
+ RoleMessage, // LogsMessage
+ RoleContact, // LogsContact
+ RoleDetailsModel, // LogsDetailsModel
+ RoleBaseLast // Child classes may define roles above this val
+ };
+
+public:
+
+ ~LogsAbstractModel();
+
+public:
+
+ static QString directionIconName(const LogsEvent& event);
+ static QString typeIconName(const LogsEvent& event);
+
+ /**
+ * Fills iconList based on the event.
+ * @param event,
+ * @param iconList, on return contains list of icons
+ */
+ void getDecorationData(const LogsEvent& event, QList<QVariant>& iconList) const;
+
+ LogsDbConnector* dbConnector();
+
+protected:
+
+ QVariant doGetData(int role, const LogsModelItemContainer& item) const;
+
+ virtual QVariant createCall(const LogsModelItemContainer& item) const;
+ virtual QVariant createMessage(const LogsModelItemContainer& item) const;
+ virtual QVariant createContact(const LogsModelItemContainer& item) const;
+
+ explicit LogsAbstractModel();
+
+protected: //data
+
+ LogsDbConnector* mDbConnector;
+ QMap<QString, HbIcon*> mIcons;
+
+private: // Testing related friend definitions
+
+ friend class UT_LogsModel;
+ friend class UT_LogsDetailsModel;
+ friend class UT_LogsFilter;
+ friend class UT_LogsCustomFilter;
+
+};
+
+
+/**
+ * Specialized model may contain other model items than log events.
+ */
+class LogsModelItemContainer {
+public:
+ LogsModelItemContainer(LogsEvent* event = 0);
+ virtual ~LogsModelItemContainer();
+ LogsEvent* event() const;
+
+protected:
+ LogsEvent* mEvent; // not owned
+};
+
+#endif //LOGSABSTRACTMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/recents_plat/logs_engine_api/inc/logscustomfilter.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* 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 LOGSCUSTOMFILTER_H
+#define LOGSCUSTOMFILTER_H
+
+#include <QSortFilterProxyModel>
+#include <logsexport.h>
+#include <logsmodel.h>
+
+/**
+ * LogsCustomFilter can be used to filter events
+ * from logs model based on more detailed search terms.
+ */
+class LogsCustomFilter : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public: // The exported API
+
+ LOGSENGINE_EXPORT LogsCustomFilter();
+ LOGSENGINE_EXPORT ~LogsCustomFilter();
+
+ /**
+ * Filter events based on contact id of event.
+ * @param contactId
+ */
+ LOGSENGINE_EXPORT void setContactId(quint32 contactId);
+
+ /**
+ * Starts removing events. Clearing can be sync or async.
+ * In case of async, completion is indicated by clearingCompleted signal.
+ * @return true if async clearing started
+ */
+ LOGSENGINE_EXPORT bool clearEvents();
+
+ /**
+ * Mark events as seen. Completion is indicated by
+ * markingCompleted signal.
+ * @param eventIds, ids of the events to be marked
+ * @return true if marking started
+ */
+ LOGSENGINE_EXPORT bool markEventsSeen();
+
+protected: // From QSortFilterProxyModel
+
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+
+signals:
+ /**
+ * Signaled once asycn event clearing has completed.
+ * @param err, 0 if marking completed succesfully
+ */
+ void clearingCompleted(int err);
+
+ /**
+ * Signaled once asycn event marking has completed.
+ * @param err, 0 if marking completed succesfully
+ */
+ void markingCompleted(int err);
+
+private:
+
+ QList<int> getEventIds(bool onlyUnseen = false) const;
+
+private: //data
+
+ quint32 mContactId;
+
+private: // Testing related friend definitions
+
+ friend class UT_LogsCustomFilter;
+ friend class UT_LogsModel;
+};
+
+#endif // LOGSCUSTOMFILTER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/recents_plat/logs_engine_api/inc/logsevent.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,348 @@
+/*
+* 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 LOGSEVENT_H
+#define LOGSEVENT_H
+
+// INCLUDES
+#include <logsexport.h>
+#include <QDateTime>
+#include <qmobilityglobal.h>
+
+// FORWARD DECLARATION
+class LogsEventData;
+class LogsEventStrings;
+class CLogEvent;
+
+QTM_BEGIN_NAMESPACE
+class QContactName;
+class QContactManager;
+QTM_END_NAMESPACE
+
+QTM_USE_NAMESPACE
+
+// CLASS DECLARATION
+
+/**
+ * Logs event information.
+ */
+class LogsEvent
+ {
+public:
+
+ // direction of the event
+ enum LogsDirection
+ {
+ DirUndefined = -1, // undefined
+ DirIn = 0, // incoming
+ DirOut = 1, // outgoing
+ DirMissed = 2 // missed
+ };
+
+ // type of the event
+ enum LogsEventType
+ {
+ TypeUndefined = -1,
+ TypeVoiceCall,
+ TypeVideoCall,
+ TypeVoIPCall
+ };
+
+ enum LogsEventState
+ {
+ EventAdded,
+ EventUpdated,
+ EventNotUpdated
+ };
+
+ public:
+
+ /**
+ * Constructor.
+ */
+ LogsEvent();
+
+ public: // Exported API
+
+ /**
+ * Copy constructor.
+ */
+ LOGSENGINE_EXPORT LogsEvent( const LogsEvent& event );
+
+ /**
+ * Destructor.
+ */
+ LOGSENGINE_EXPORT virtual ~LogsEvent();
+
+ /**
+ * Get time when event occurred.
+ * @return date time
+ */
+ LOGSENGINE_EXPORT QDateTime time() const;
+
+ /**
+ * Get unique id of the event
+ * @return id
+ */
+ LOGSENGINE_EXPORT int logId() const;
+
+ /**
+ * Get phone number associated with the event.
+ * @return number
+ */
+ LOGSENGINE_EXPORT const QString& number() const;
+
+ /**
+ * Get remote party information.
+ * @return remote party name
+ */
+ LOGSENGINE_EXPORT const QString& remoteParty() const;
+
+ /**
+ * Get direction of the event
+ * @return direction
+ */
+ LOGSENGINE_EXPORT LogsDirection direction() const;
+
+ /**
+ * Get event type
+ * @return event type
+ */
+ LOGSENGINE_EXPORT LogsEventType eventType() const;
+
+ /**
+ * Get number of duplicated events (e.g. 5 missing calls from x)
+ * @return number of duplicates
+ */
+ LOGSENGINE_EXPORT int duplicates() const;
+
+ /**
+ * Check whether event was generated when using alternative line service
+ * @return true if ALS was used
+ */
+ LOGSENGINE_EXPORT bool ALS() const;
+
+ /**
+ * Get ringing duration
+ * return rinding duration is seconds
+ */
+ LOGSENGINE_EXPORT int ringDuration() const;
+
+ /**
+ * Get duration of event
+ * @return duration in seconds
+ */
+ LOGSENGINE_EXPORT int duration() const;
+
+ /**
+ * Number for calling to remote party of the event
+ * @return number
+ */
+ LOGSENGINE_EXPORT QString getNumberForCalling();
+
+ /**
+ * Get contact id of associated contact
+ * @return contact id, zero if no associated contact exist.
+ */
+ LOGSENGINE_EXPORT unsigned int contactLocalId() const;
+
+ /**
+ * Check whether event has been read already
+ * @return true if event has been marked as read
+ */
+ LOGSENGINE_EXPORT bool isRead() const;
+
+ public:
+
+ /**
+ * Initialized the event with contents of given source event.
+ * Event state and view status are updated automatically at
+ * this phase.
+ * @param source, source event
+ * @param strings, list of strings used for comparison
+ */
+ void initializeEventL( const CLogEvent& source,
+ const LogsEventStrings& strings );
+
+ /**
+ * Check event's view status which tells whether the event is
+ * still valid or not. If event is not anymore in view, it
+ * is not probably needed anymore.
+ */
+ bool isInView() const;
+
+ /**
+ * Get state of the event. Event state is updated
+ * always at initialization phase. See initializeEventL.
+ */
+ LogsEventState eventState() const;
+
+ bool setIsRead(bool isRead);
+
+ int eventUid() const;
+
+ LogsEventData* logsEventData() const;
+
+ bool CNAP() const { return false; };
+
+ /**
+ * Sets current index of the event.
+ */
+ void setIndex(int index);
+
+ /**
+ * Returns last set index for the event.
+ */
+ int index() const;
+
+ /**
+ * Set view status of the event.
+ */
+ void setIsInView(bool isInView);
+
+ /**
+ * Set number of duplicates for this events (e.g. 2 missed calls)
+ */
+ void setDuplicates( int duplicates );
+
+ /**
+ * Set remote party name for the event.
+ */
+ void setRemoteParty( const QString& remoteParty );
+
+ /**
+ * Check if event is valid.
+ * @return true if valid, otherwise false
+ */
+ bool validate();
+
+ /**
+ * Return direction as string
+ */
+ QString directionAsString() const;
+
+ /**
+ * Return event type as string
+ */
+ QString typeAsString() const;
+
+ /**
+ * 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.
+ */
+ QString updateRemotePartyFromContacts(QContactManager& manager);
+
+ /**
+ * Prepares the event for contact matching.
+ */
+ void prepareForContactMatching();
+
+ /**
+ * Event has been marked as seen but database might not yet contain the change
+ */
+ void markedAsSeenLocally(bool markedAsSeen);
+
+ /**
+ * Check whether event is locally seen.
+ */
+ bool isSeenLocally() const;
+
+
+ private:
+
+ bool setTime( const QDateTime& time );
+
+ void setLogId( const int logId );
+
+ bool setNumber( const QString& number );
+
+ bool setDirection( LogsDirection aDirection );
+
+ void setEventUid( int uid );
+
+ void setEventType( LogsEventType aEventType );
+
+ void setLogsEventData( LogsEventData* logsEventData );
+
+ void setALS( bool aALS );
+
+ void setRingDuration( int ringDuration );
+
+ bool isEmergencyNumber( const QString& number );
+
+ void setDuration( int duration );
+
+ void setContactLocalId( unsigned int id );
+
+ QString stripPhoneNumber(const QString& num);
+
+ QString parseContactName(const QContactName& name);
+
+
+ private: // data
+
+ int mLogId;
+ LogsDirection mDirection;
+ LogsEventType mEventType;
+ int mUid;
+ LogsEventData* mLogsEventData;
+ QString mRemoteParty;
+ QString mNumber;
+ int mDuplicates;
+ QDateTime mTime;
+ int mRingDuration;
+ bool mIsRead;
+ bool mIsALS;
+ int mDuration;
+
+ int mIndex;
+ bool mIsInView;
+ LogsEventState mEventState;
+ bool mIsLocallySeen;
+
+ private:
+
+ friend class LogsEventParser;
+ friend class LogsReaderStateFillDetails;
+
+ private: // Testing related friend definitions
+
+#ifdef LOGSDBCONNECTOR_SIMULATION
+ friend class LogsDbConnector;
+#endif
+ friend class UT_LogsFilter;
+ friend class UT_LogsModel;
+ friend class UT_LogsEvent;
+ friend class UT_LogsDbConnector;
+ friend class UT_LogsCall;
+ friend class UT_LogsContact;
+ friend class UT_LogsEventParser;
+ friend class UT_LogsEventDataParser;
+ friend class UT_LogsReaderStates;
+ friend class UT_LogsDetailsModel;
+ friend class UT_LogsMessage;
+ friend class UT_LogsCustomFilter;
+ friend class UT_LogsMatchesModel;
+ };
+
+#endif // LOGSEVENT_H
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/recents_plat/logs_engine_api/inc/logsfilter.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* 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 LOGSFILTER_H
+#define LOGSFILTER_H
+
+#include <QSortFilterProxyModel>
+#include <logsexport.h>
+#include <logsmodel.h>
+
+/**
+ * LogsFilter can be used to filter certain events
+ * from logs model.
+ */
+class LogsFilter : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+
+ enum FilterType{
+ All,
+ Received,
+ Called,
+ Missed
+ };
+
+public: // The exported API
+
+ /**
+ * Constructor
+ * @param type, filter type defining which events are shown
+ */
+ LOGSENGINE_EXPORT LogsFilter( FilterType type = All );
+
+ /**
+ * Destructor
+ */
+ LOGSENGINE_EXPORT ~LogsFilter();
+
+ /**
+ * Get current filter type
+ * @return filtertype
+ */
+ LOGSENGINE_EXPORT FilterType filterType() const;
+
+ /**
+ * Get current clear type
+ * @return cleartype
+ */
+ LOGSENGINE_EXPORT LogsModel::ClearType clearType() const;
+
+ /**
+ * Set maximum number of events.
+ * @param max size
+ */
+ LOGSENGINE_EXPORT void setMaxSize(int maxSize);
+
+protected: // From QSortFilterProxyModel
+
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+
+private: //data
+
+ FilterType mFilterType;
+
+private: // Testing related friend definitions
+
+ friend class UT_LogsFilter;
+ friend class UT_LogsModel;
+};
+
+#endif // LOGSFILTER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/recents_plat/logs_engine_api/inc/logsmodel.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,190 @@
+/*
+* 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 LOGSMODEL_H
+#define LOGSMODEL_H
+
+#include <logsexport.h>
+#include <logsabstractmodel.h>
+
+class LogsEvent;
+class LogsDbConnector;
+class LogsMatchesModel;
+
+/**
+ * Model for log events.
+ *
+ */
+class LogsModel : public LogsAbstractModel
+{
+ Q_OBJECT
+
+public:
+
+ enum ClearType {
+ TypeLogsClearAll = 0,
+ TypeLogsClearReceived,
+ TypeLogsClearCalled,
+ TypeLogsClearMissed
+ };
+
+ enum LogsModelType {
+ LogsRecentModel, // Model handles recent events
+ LogsFullModel // Model handles all events
+ };
+public: // The exported API
+
+ /**
+ * Constructor
+ * @param modelType
+ * @param resourceControl, true will start model in compressed data mode
+ * where memory usage is minimized and refreshData call is required
+ * to get all available data
+ */
+ LOGSENGINE_EXPORT explicit LogsModel(
+ LogsModelType modelType = LogsRecentModel, bool resourceControl = false);
+
+ /**
+ * Destructor
+ */
+ LOGSENGINE_EXPORT ~LogsModel();
+
+ /**
+ * Clear events. Clearing is async operation and completion is indicated
+ * by clearingCompleted signal.
+ * @param cleartype, type of events to be cleared
+ * @return true if async clearing started
+ */
+ LOGSENGINE_EXPORT bool clearList(LogsModel::ClearType cleartype);
+
+ /**
+ * Get matches model.
+ * @return matches model
+ */
+ LOGSENGINE_EXPORT LogsMatchesModel* logsMatchesModel();
+
+ /**
+ * Mark events as seen. Operation is asycn and completion is indicated
+ * by markingCompleted signal.
+ * @param cleartype, type of events to be marked as seen
+ * @return true if async marking started, false if marking did not start
+ */
+ LOGSENGINE_EXPORT bool markEventsSeen(LogsModel::ClearType cleartype);
+
+ /**
+ * Clear missed calls counter
+ * @return 0 if clearing was success
+ */
+ LOGSENGINE_EXPORT int clearMissedCallsCounter();
+
+ /**
+ * Refresh data if it was compressed, can be used only if resourceControl
+ * is enabled.
+ * @return 0 if refreshed
+ */
+ LOGSENGINE_EXPORT int refreshData();
+
+ /**
+ * Compress data, minimizes memory usage, can be used only if resourceControl
+ * is enabled.
+ * @return 0 if compressed
+ */
+ LOGSENGINE_EXPORT 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
+ */
+ LOGSENGINE_EXPORT 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
+ */
+ LOGSENGINE_EXPORT int setPredictiveSearch(bool enabled);
+
+public: // From QAbstractItemModel
+
+ /**
+ * Get number of events currently in the model.
+ * @return number of events
+ */
+ virtual int rowCount(const QModelIndex &parent) const;
+
+ /**
+ * Get various data from the model. Fetched data type is defined
+ * by role input parameter. Besides standard Qt::DisplayRole and
+ * Qt::DecorationRole, LogsAbstractModel::LogsModelRole defines
+ * additional data types.
+ */
+ virtual QVariant data(const QModelIndex &index, int role) const;
+
+signals:
+
+ /**
+ * Signaled once clearing has completed.
+ * @param err, 0 if clearing was success
+ */
+ void clearingCompleted(int err);
+
+ /**
+ * Signaled once marking has completed.
+ * @param err, 0 if marking was success
+ */
+ void markingCompleted(int err);
+
+
+public slots:
+
+ void dataAdded(QList<int> addedIndexes);
+ void dataUpdated(QList<int> updatedIndexes);
+ void dataRemoved(QList<int> removedIndexes);
+
+private:
+
+ /**
+ * Find sequential indexes and place each sequence to own list.
+ * @param indexes, index list
+ * @return list of index sequence lists
+ */
+ QList< QList<int> > findSequentialIndexes(const QList<int>& indexes);
+ QString getCallerId(const LogsEvent& event) const;
+ void initIcons();
+ bool matchEventWithClearType(const LogsEvent& event, LogsModel::ClearType clearType);
+
+private: //data
+
+ LogsModelType mModelType;
+ QList<LogsEvent*> mEvents;
+
+private: // Testing related friend definitions
+
+ friend class UT_LogsModel;
+ friend class UT_LogsFilter;
+ friend class UT_LogsCustomFilter;
+ friend class UT_LogsMatchesModel;
+
+};
+
+#endif //LOGSMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/recents_plat/logs_engine_api_extensions/inc/LogsApiConsts.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 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:
+* Contains extension constants used in Logs Engine
+*
+*/
+
+
+#ifndef __LogsApiConsts_H__
+#define __LogsApiConsts_H__
+
+//Symbian phone caller type strings are defined in LOGWRAP.RLS (Z:\src\common\generic\syslibs\logeng\ongoing\LogWrap).
+//Below are additional strings for caller type strings handling.
+_LIT( KLogsPrivateText, "Private" ); //Text in remote party in case of private number
+_LIT( KLogsPayphoneText, "Payphone" ); //Text in remote party in case of payphone number
+
+// Strings for ClogEvent Data field tagging
+_LIT8( KLogsDataFldNameDelimiter, "\t" ); //Name=value pairs separated by tabs
+_LIT8( KLogsDataFldValueDelimiter, "=" ); //Names and values separated by =
+_LIT8( KLogsDataFldTag_CNAP, "CNAP" ); //Caller name presentation
+_LIT8( KLogsDataFldTag_Emergency, "EMERG" ); //Emergency calls
+_LIT8( KLogsDataFldTag_MA, "MA" ); //My address
+_LIT8( KLogsDataFldTag_POC, "POC" ); //Push-to-talk
+_LIT8( KLogsDataFldTag_Type, "TYPE" ); //Internal type information for Poc
+_LIT8( KLogsDataFldTag_IP, "VOIP" ); //Voice over ip
+_LIT8( KLogsDataFldTag_VT, "VT" ); //Video telephony
+_LIT8( KLogsDataFldTag_URL, "URL" ); //For sip-uri etc
+_LIT8( KLogsDataFldTag_ServiceId, "SI"); //ServiceId
+_LIT8( KLogsDataFldTag_ContactLink, "CL"); //ContactLink
+// _LIT8( KLogsDataFldTag_DataSent, "DS" );
+// _LIT8( KLogsDataFldTag_DataReceived, "DR" );
+
+
+//Symbian messaging delivery status strings are defined in LOGWRAP.RLS (Z:\src\common\generic\syslibs\logeng\ongoing\LogWrap).
+//Below are additional strings for delivery status handling.
+_LIT(KLogsMsgReadText, "MsgRead");
+
+
+//Symbian LogDB event types are defined in LOGENG.H / LOGWRAP.HRH. Additional event types that not provided
+//by Symbian LogEngine yet, are provided here.
+//Additional event UIDs:
+//The range 0x100058B3 to 0x10005C9A has been assigned to Series 60 by Symbian, i.e.
+//new event UID values can be allocated within this range if not (yet) available by Symbian Log engine.
+
+#define KLogsEngMmsEventType 0x1000595e
+#define KLogsEngWlanEventType 0x1000595f //KLogsEngMmsEventType+1 for WLAN Instead of 0x101F8EB7
+#define KLogsEngPocInfoEventType 0x10005960
+
+const TUid KLogsEngMmsEventTypeUid = {KLogsEngMmsEventType};
+const TUid KLogsEngWlanEventTypeUid = {KLogsEngWlanEventType};
+const TUid KLogsEngPocInfoEventTypeUid= {KLogsEngPocInfoEventType};
+
+#endif // __LogsApiConsts_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/recents_plat/logs_services_api/inc/logsservices.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 LOGSSERVICES_H
+#define LOGSSERVICES_H
+
+#include <QString>
+#include <logsexport.h>
+
+/**
+* Logs application services
+*/
+class LogsServices
+{
+ public:
+
+ enum LogsView{
+ ViewAll,
+ ViewReceived,
+ ViewCalled,
+ ViewMissed
+ };
+ /**
+ * Requests to start Logs application. If Logs is already running,
+ * activates the requested view.
+ *
+ * @param activatedView The view to be activated in Logs.
+ * @param showDialpad Specifies whether dialpad should be shown on top
+ * of the activated view
+ * @param number Predefined number for dialpad
+ * @return 0 if started/activated succesfully
+ */
+ LOGSSERVICES_EXPORT static int start(
+ LogsView activatedView, bool showDialpad, const QString& number = QString());
+
+};
+
+#endif //LOGSSERVICES_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/recents_plat/logs_timers_api/inc/LogsDomainCRKeys.h Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 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: Logs domain Central Repository keys
+*
+*/
+
+
+
+#ifndef LOGSDOMAINCRKEYS_H
+#define LOGSDOMAINCRKEYS_H
+
+/**************************************************************************/
+/** Logs Timers API */
+/** Provides access to the timers/counters related to Logs processing */
+
+const TUid KCRUidLogs = {0x101F874E};
+
+
+/**
+* Actual last call timer
+* This timer must be updated every time a call is ended.
+* Integer type
+**/
+const TUint32 KLogsActualLastCallTimer = 0x00000000;
+
+/**
+* Dialled calls timer to ALS Line 1
+* This is incremented every time when call on Line 1 is ended
+* Integer type
+**/
+const TUint32 KLogsDialledCallsTimerLine1 = 0x00000001;
+
+/**
+* Dialled calls timer to ALS Line 2
+* This is incremented every time when call on Line 2 is ended
+* Integer type
+**/
+const TUint32 KLogsDialledCallsTimerLine2 = 0x00000002;
+
+/**
+* Last call timer to ALS Line 1
+* This timer must be updated every time a call is ended in Line 1.
+* Integer type
+**/
+const TUint32 KLogsLastCallTimerLine1 = 0x00000003;
+
+/**
+* Last call timer to ALS Line 2
+* This timer must be updated every time a call is ended in Line 2.
+* Integer type
+**/
+const TUint32 KLogsLastCallTimerLine2 = 0x00000004;
+
+/**
+* Informs other applications that is the Logs application's
+* logging enabled.
+* Note! If this has been set OFF, it does not mean that you
+* will not log. If your application is meant to log, it will
+* log always.
+* Integer type
+* 0 (OFF)
+* 1 (ON)
+*
+* Default value: 1
+**/
+const TUint32 KLogsLoggingEnabled = 0x00000005;
+
+/**
+* Informs the Logs application about the amount of new missed calls.
+* Integer type
+**/
+const TUint32 KLogsNewMissedCalls = 0x00000006;
+
+/**
+* Received calls timer to ALS Line 1
+* This is incremented every time when received call on Line 1
+* is ended
+* Integer type
+**/
+const TUint32 KLogsReceivedCallsTimerLine1 = 0x00000007;
+
+/**
+* Received calls timer to ALS Line 2
+* This is incremented every time when received call on Line 2
+* is ended
+* Integer type
+**/
+const TUint32 KLogsReceivedCallsTimerLine2 = 0x00000008;
+
+
+//FIXME: THIS IS NOT ANYMORE PART OF LOGS APPLICATION, SO IT SHOULD BE MOVED TO
+//DEVICEMANAGEMENT DOMAIN
+/**
+* Inidicates whether call duration is shown or not in Phone Application
+*
+* Integer, possible values are:
+*
+* 0 (call duration not shown in Phone application)
+* 1 (call duration shown Phone application)
+*
+* Default value: 0
+**/
+const TUint32 KLogsShowCallDuration = 0x00000009;
+
+
+/**
+* This key is required for VoIP Last Call Timer
+*/
+const TUint32 KLogsLastCallTimerVoIP = 0x0000000A;
+
+/**
+* This key is required for VoIP Received Calls Timer
+*/
+const TUint32 KLogsReceivedCallsTimerVoIP = 0x0000000B;
+
+/**
+* This key is required for VoIP Dialled Calls Timer
+*/
+const TUint32 KLogsDialledCallsTimerVoIP = 0x0000000C;
+
+/**
+* KLogsPredictiveSearch
+* Controls the feature of predictive search in Logs matches view
+* 0 - Predictive search is permanently Off, can't be switched on from Logs
+* 1 - Predictive search is On
+* 2 - Predicitve search is temporarily Off, can be switched on from Logs
+*/
+const TUint32 KLogsPredictiveSearch = 0x0000000D;
+
+
+/**************************************************************************/
+
+
+#endif // LOGSDOMAINCRKEYS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_5_0.dtd Tue May 04 12:39:37 2010 +0300
@@ -0,0 +1,87 @@
+ <!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>