--- a/logsui/logsapp/inc/logsbaseview.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/inc/logsbaseview.h Fri May 14 15:52:41 2010 +0300
@@ -20,6 +20,7 @@
#include <hbview.h>
#include <logsservices.h>
#include "logsdefs.h"
+#include "logscall.h"
class LogsComponentRepository;
class LogsAbstractViewManager;
@@ -33,6 +34,7 @@
class QSignalMapper;
class HbLabel;
class HbListView;
+class LogsAbstractModel;
/**
*
@@ -63,6 +65,7 @@
public slots:
virtual void handleExit();
+ virtual void callKeyPressed();
void closeEmptyMenu();
signals:
@@ -77,6 +80,7 @@
virtual void dialpadEditorTextChanged();
virtual void updateEmptyListWidgetsVisibility();
virtual void updateWidgetsSizeAndLayout();
+ virtual void contactActionCompleted(bool modified);
//slots bellow are used in *.docml
void showFilterMenu();
@@ -84,6 +88,8 @@
void openContactsApp();
void notSupported();
void changeFilter(HbAction* action);
+ void addToContacts();
+ void saveNumberInDialpadToContacts();
//other slots
void showListItemMenu(HbAbstractViewItem* item, const QPointF& coords);
@@ -93,7 +99,12 @@
void saveContact();
void updateEmptyListLabelVisibility();
void showCallDetails();
+
void deleteEvent();
+ virtual void deleteEventOkAnswer();
+
+ void videoCallToCurrentNum();
+ void sendMessageToCurrentNum();
void handleOrientationChanged();
@@ -132,6 +143,10 @@
virtual QAbstractItemModel* model() const;
+ virtual LogsAbstractModel* logsModel() const;
+
+ virtual HbListView* listView() const;
+
virtual void populateListItemMenu(HbMenu& menu);
/**
@@ -143,17 +158,31 @@
* Update call button state.
*/
virtual void updateCallButton();
+
+ /**
+ * Make call if dialpad is opened and contains inputted number.
+ * @return true if call was made
+ */
+ bool tryCallToDialpadNumber(
+ LogsCall::CallType callType = LogsCall::TypeLogsVoiceCall);
+ bool tryMessageToDialpadNumber();
void activateEmptyListIndicator(QAbstractItemModel* model);
void deactivateEmptyListIndicator(QAbstractItemModel* model);
void addViewSwitchingEffects();
void toggleActionAvailability( HbAction* action, bool available );
- /*
- *
- */
- bool askConfirmation( QString heading , QString text );
-
+
+ void askConfirmation( QString heading , QString text, QObject* receiver,
+ const char* okSlot = 0, const char* cancelSlot = 0 );
+
+ void updateContactSearchAction();
+ bool isContactSearchEnabled() const;
+ bool isContactSearchPermanentlyDisabled() const;
+ void updateDialpadCallAndMessagingActions();
+ bool tryMatchesViewTransition();
+ bool isDialpadInput() const;
+
protected:
LogsAppViewId mViewId;
--- a/logsui/logsapp/inc/logscomponentrepository.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/inc/logscomponentrepository.h Fri May 14 15:52:41 2010 +0300
@@ -34,6 +34,7 @@
class LogsComponentRepository : public HbDocumentLoader
{
friend class UT_LogsComponentRepository;
+ friend class UT_LogsViewManager;
public:
--- a/logsui/logsapp/inc/logsdefs.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/inc/logsdefs.h Fri May 14 15:52:41 2010 +0300
@@ -43,12 +43,13 @@
//action ids
const char logsCommonVideoCallMenuActionId[] = "logs_act_video_call";
const char logsCommonMessageMenuActionId[] = "logs_act_create_message";
+const char logsCommonAddToContactsMenuActionId[] = "logs_act_add_to_contacts";
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 logsRecentViewContactSearchMenuActionId[] = "logs_act_contact_search";
const char logsShowFilterReceivedMenuActionId[] = "logs_act_received";
const char logsShowFilterDialledMenuActionId[] = "logs_act_dialled";
@@ -75,4 +76,8 @@
LogsMatchesViewId
};
+const int logsContactSearchPermanentlyDisabled = 0;
+const int logsContactSearchEnabled = 1;
+const int logsContactSearchDisabled = 2;
+
#endif // LOGSDEFS_H
--- a/logsui/logsapp/inc/logsdetailsview.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/inc/logsdetailsview.h Fri May 14 15:52:41 2010 +0300
@@ -52,20 +52,20 @@
void initiateVoiceCall();
void initiateVideoCall();
- void addToContacts();
+ void sendMessage();
void openContact();
- void contactActionCompleted(bool modified);
- void deleteEvent();//overrides base class implementation
- void copyNumberToClipboard();
//from LogsBaseView
virtual void handleBackSoftkey();
+ virtual void deleteEventOkAnswer();
private: // from LogsBaseView
virtual void initView();
virtual QAbstractItemModel* model() const;
+ virtual void dialpadEditorTextChanged();
virtual void updateWidgetsSizeAndLayout();
+ virtual void contactActionCompleted(bool modified);
private:
--- a/logsui/logsapp/inc/logsmatchesview.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/inc/logsmatchesview.h Fri May 14 15:52:41 2010 +0300
@@ -18,7 +18,6 @@
#define LOGSMATCHESVIEW_H
#include "logsbaseview.h"
-#include "logscall.h"
class HbListView;
class HbAction;
@@ -44,13 +43,6 @@
virtual void activated(bool showDialer, QVariant args);
virtual void deactivated();
-
-public slots:
-
- void callKeyPressed();
- void saveNumberInDialpadToContacts();
- void videoCallToCurrentNum();
- void sendMessageToCurrentNum();
protected slots: //from LogsBaseView
@@ -60,18 +52,21 @@
virtual void dialpadClosed();
virtual void updateWidgetsSizeAndLayout();
virtual void updateEmptyListWidgetsVisibility();
+
+private slots:
+ void toggleContactSearch();
private: //from LogsBaseView
virtual void initView();
virtual QAbstractItemModel* model() const;
+ virtual HbListView* listView() const;
private:
void initListWidget();
void updateModel(LogsMatchesModel* model);
void updateMenu();
- void callToCurrentNum( LogsCall::CallType callType );
void updateAddContactButton();
private:
--- a/logsui/logsapp/inc/logsrecentcallsview.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/inc/logsrecentcallsview.h Fri May 14 15:52:41 2010 +0300
@@ -57,7 +57,6 @@
public slots:
void handleExit();
- void callKeyPressed();
void markingCompleted(int err);
protected slots: // from LogsBaseView
@@ -68,11 +67,12 @@
void changeFilter(HbAction* action);
virtual void updateEmptyListWidgetsVisibility();
virtual void updateWidgetsSizeAndLayout();
-
private slots:
void clearList();
+ void clearListOkAnswer();
+ void toggleContactSearch();
void updateView(LogsServices::LogsView view);
void leftFlick();
void rightFlick();
@@ -85,6 +85,8 @@
virtual void initView();
virtual QAbstractItemModel* model() const;
+ virtual LogsAbstractModel* logsModel() const;
+ virtual HbListView* listView() const;
virtual void updateCallButton();
private:
--- a/logsui/logsapp/logsapp.pro Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/logsapp.pro Fri May 14 15:52:41 2010 +0300
@@ -61,7 +61,7 @@
symbian: {
TARGET.UID2 = 0x100039CE
TARGET.UID3 = 0x101F4CD5
- TARGET.CAPABILITY = CAP_APPLICATION AllFiles
+ TARGET.CAPABILITY = CAP_APPLICATION
LIBS += -lxqservice -lxqserviceutil -llogsengine -ldialpad
}
--- a/logsui/logsapp/logsapp.qrc Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/logsapp.qrc Fri May 14 15:52:41 2010 +0300
@@ -7,7 +7,6 @@
<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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/resources/detailsView.docml Fri May 14 15:52:41 2010 +0300
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.7">
+ <object name="logs_act_voice_call" type="HbAction">
+ <string name="iconText" value="Voice call"/>
+ <string name="text" value="Voice call" locid="txt_common_menu_voice_call"/>
+ <string name="toolTip" value="Voice call"/>
+ </object>
+ <object name="logs_act_video_call" type="HbAction">
+ <string name="iconText" value="Video call"/>
+ <string name="text" value="Video call" locid="txt_common_opt_video_call"/>
+ <string name="toolTip" value="Video call"/>
+ </object>
+ <object name="logs_act_internet_call" type="HbAction">
+ <string name="iconText" value="Internet call"/>
+ <string name="text" value="Internet call" locid="txt_common_menu_internet_call"/>
+ <string name="toolTip" value="Internet call"/>
+ </object>
+ <object name="logs_act_create_message" type="HbAction">
+ <string name="iconText" value="Create message"/>
+ <string name="text" value="Create message" locid="txt_common_opt_send_message"/>
+ <string name="toolTip" value="Create message"/>
+ </object>
+ <object name="logs_act_add_to_contacts" type="HbAction">
+ <string name="iconText" value="Add to contacts"/>
+ <string name="text" value="Add to contacts" locid="txt_common_menu_add_to_contacts"/>
+ <string name="toolTip" value="Add to contacts"/>
+ </object>
+ <object name="logs_act_open_contact" type="HbAction">
+ <string name="iconText" value="Open contact"/>
+ <string name="text" value="Open contact" locid="txt_dialer_ui_menu_open_contact"/>
+ <string name="toolTip" value="Open contact"/>
+ </object>
+ <object name="logs_act_delete_event" type="HbAction">
+ <string name="iconText" value="Delete event"/>
+ <string name="text" value="Delete event" locid="txt_dialer_ui_title_delete_event"/>
+ <string name="toolTip" value="Delete event"/>
+ </object>
+ <object name="logs_act_dialer" type="HbAction">
+ <icon iconName="qtg_mono_dialer" name="icon"/>
+ <string name="toolTip" value="Dialer"/>
+ </object>
+ <object name="logs_act_contacts" type="HbAction">
+ <icon iconName="qtg_mono_contacts" name="icon"/>
+ <string name="toolTip" value="Contacts"/>
+ </object>
+ <object name="logs_act_show" type="HbAction">
+ <icon iconName="qtg_mono_show_view" name="icon"/>
+ <string name="toolTip" value="Show"/>
+ </object>
+ <object name="logs_act_recent" type="HbAction">
+ <string name="iconText" value="Recent calls"/>
+ <string name="text" value="Recent calls" locid="txt_dialer_subhead_recent_calls"/>
+ <string name="toolTip" value="Recent calls"/>
+ </object>
+ <object name="logs_act_received" type="HbAction">
+ <string name="iconText" value="Received calls"/>
+ <string name="text" value="Received calls" locid="txt_dial_subhead_received_calls"/>
+ <string name="toolTip" value="Received calls"/>
+ </object>
+ <object name="logs_act_dialled" type="HbAction">
+ <string name="iconText" value="Dialled calls"/>
+ <string name="text" value="Dialled calls" locid="txt_dialer_subhead_dialled_calls"/>
+ <string name="toolTip" value="Dialled calls"/>
+ </object>
+ <object name="logs_act_missed" type="HbAction">
+ <string name="iconText" value="Missed calls"/>
+ <string name="text" value="Missed calls" locid="txt_dialer_subhead_missed_calls"/>
+ <string name="toolTip" value="Missed calls"/>
+ </object>
+ <widget name="logs_details_view" type="HbView">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <widget name="logs_groupbox_remote_party_info" type="HbGroupBox">
+ <string name="heading" value=""/>
+ <bool name="collapsable" value="FALSE"/>
+ <real name="spacing" value="0un"/>
+ </widget>
+ <widget name="logs_details_list_view" type="HbListView">
+ <real name="z" value="2.0001"/>
+ <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
+ <real name="spacing" value="0un"/>
+ </widget>
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="var(hb-param-margin-view-bottom)" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="logs_groupbox_remote_party_info"/>
+ <linearitem itemname="logs_details_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <real name="z" value="2"/>
+ <enums name="orientation" value="Horizontal"/>
+ <ref object="logs_act_contacts" role="HbToolBar:addAction"/>
+ <ref object="logs_act_dialer" role="HbToolBar:addAction"/>
+ <ref object="logs_act_show" role="HbToolBar:addAction"/>
+ </widget>
+ <widget name="logs_details_view_menu" role="HbView:menu" type="HbMenu">
+ <ref object="logs_act_voice_call" role="HbMenu:addAction"/>
+ <ref object="logs_act_video_call" role="HbMenu:addAction"/>
+ <ref object="logs_act_internet_call" role="HbMenu:addAction"/>
+ <ref object="logs_act_create_message" role="HbMenu:addAction"/>
+ <ref object="logs_act_add_to_contacts" role="HbMenu:addAction"/>
+ <ref object="logs_act_open_contact" role="HbMenu:addAction"/>
+ <ref object="logs_act_delete_event" role="HbMenu:addAction"/>
+ </widget>
+ <string name="title" value="Dialer"/>
+ </widget>
+ <section name="portrait_dialpad">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="expr(var(hb-param-margin-view-bottom)+54un)" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="logs_groupbox_remote_party_info"/>
+ <linearitem itemname="logs_details_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_label_empty_list" type="HbLabel">
+ <rect height="26.12959" name="geometry" width="349.95" x="0.75un" y="8un"/>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ </section>
+ <section name="landscape_dialpad">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="var(hb-param-margin-view-bottom)" left="var(hb-param-margin-view-left)" right="expr(var(hb-param-margin-view-right)+48un)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="logs_groupbox_remote_party_info"/>
+ <linearitem itemname="logs_details_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_label_empty_list" type="HbLabel">
+ <rect height="26" name="geometry" width="312.75" x="0.75un" y="8un"/>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ </section>
+ <section name="default">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="var(hb-param-margin-view-bottom)" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="logs_groupbox_remote_party_info"/>
+ <linearitem itemname="logs_details_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_label_empty_list" type="HbLabel">
+ <rect height="26.12959" name="geometry" width="349.95" x="0.75un" y="8un"/>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <bool name="visible" value="TRUE"/>
+ </widget>
+ </section>
+
+ <!-- Context menu -->
+ <widget name="logs_show_filter_menu" type="HbMenu">
+ <integer name="timeout" value="5000000"/> <!-- 5 seconds timeout -->
+ <enums name="dismissPolicy" value="TapAnywhere"/>
+ <ref object="logs_act_recent" role="HbMenu:addAction"/>
+ <ref object="logs_act_dialled" role="HbMenu:addAction"/>
+ <ref object="logs_act_received" role="HbMenu:addAction"/>
+ <ref object="logs_act_missed" role="HbMenu:addAction"/>
+ </widget>
+ <connect receiver="logs_details_view" sender="logs_act_voice_call" signal="triggered(bool)" slot="initiateVoiceCall()"/>
+ <connect receiver="logs_details_view" sender="logs_act_video_call" signal="triggered(bool)" slot="initiateVideoCall()"/>
+ <connect receiver="logs_details_view" sender="logs_act_internet_call" signal="triggered(bool)" slot="notSupported()"/>
+ <connect receiver="logs_details_view" sender="logs_act_create_message" signal="triggered(bool)" slot="sendMessage()"/>
+ <connect receiver="logs_details_view" sender="logs_act_add_to_contacts" signal="triggered(bool)" slot="addToContacts()"/>
+ <connect receiver="logs_details_view" sender="logs_act_open_contact" signal="triggered(bool)" slot="openContact()"/>
+ <connect receiver="logs_details_view" sender="logs_act_delete_event" signal="triggered(bool)" slot="deleteEvent()"/>
+ <connect receiver="logs_details_view" sender="logs_act_dialer" signal="triggered(bool)" slot="openDialpad()"/>
+ <connect receiver="logs_details_view" sender="logs_act_contacts" signal="triggered(bool)" slot="openContactsApp()"/>
+ <connect receiver="logs_details_view" sender="logs_act_show" signal="triggered(bool)" slot="showFilterMenu()"/>
+ <connect receiver="logs_details_view" sender="logs_show_filter_menu" signal="triggered(HbAction*)" slot="changeFilter(HbAction*)"/>
+ <metadata activeUIState="Common ui state" display="QHD portrait" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ <uistate name="portrait" sections="#common portrait_dialpad"/>
+ <uistate name="landscape" sections="#common landscape_dialpad"/>
+ <uistate name="default" sections="#common default"/>
+ <dummydata objectName="logs_list_view" section="#common" value="0"/>
+ </metadata>
+</hbdocument>
\ 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/matchesView.docml Fri May 14 15:52:41 2010 +0300
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.7">
+ <object name="logs_act_video_call" type="HbAction">
+ <string name="iconText" value="Video call"/>
+ <string name="text" value="Video call" locid="txt_common_opt_video_call"/>
+ <string name="toolTip" value="Video call"/>
+ </object>
+ <object name="logs_act_create_message" type="HbAction">
+ <string name="iconText" value="Send message"/>
+ <string name="text" value="Send message" locid="txt_common_opt_create_message"/>
+ <string name="toolTip" value="Send message"/>
+ </object>
+ <object name="logs_act_contact_search" type="HbAction">
+ <string name="iconText" value="Contact search"/>
+ <string name="text" value="Contact search" locid="txt_dialer_ui_opt_contact_search"/>
+ <string name="toolTip" value="Contact search"/>
+ </object>
+ <object name="logs_act_dialer" type="HbAction">
+ <icon iconName="qtg_mono_dialer" name="icon"/>
+ <string name="toolTip" value="Dialer"/>
+ </object>
+ <object name="logs_act_contacts" type="HbAction">
+ <icon iconName="qtg_mono_contacts" name="icon"/>
+ <string name="toolTip" value="Contacts"/>
+ </object>
+ <object name="logs_act_show" type="HbAction">
+ <icon iconName="qtg_mono_show_view" name="icon"/>
+ <string name="toolTip" value="Show"/>
+ </object>
+ <object name="logs_act_recent" type="HbAction">
+ <string name="iconText" value="Recent calls"/>
+ <string name="text" value="Recent calls" locid="txt_dialer_subhead_recent_calls"/>
+ <string name="toolTip" value="Recent calls"/>
+ </object>
+ <object name="logs_act_received" type="HbAction">
+ <string name="iconText" value="Received calls"/>
+ <string name="text" value="Received calls" locid="txt_dial_subhead_received_calls"/>
+ <string name="toolTip" value="Received calls"/>
+ </object>
+ <object name="logs_act_dialled" type="HbAction">
+ <string name="iconText" value="Dialled calls"/>
+ <string name="text" value="Dialled calls" locid="txt_dialer_subhead_dialled_calls"/>
+ <string name="toolTip" value="Dialled calls"/>
+ </object>
+ <object name="logs_act_missed" type="HbAction">
+ <string name="iconText" value="Missed calls"/>
+ <string name="text" value="Missed calls" locid="txt_dialer_subhead_missed_calls"/>
+ <string name="toolTip" value="Missed calls"/>
+ </object>
+ <widget name="logs_matches_view" type="HbView">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <widget name="logs_list_view" type="HbListView">
+ <real name="z" value="2.0001"/>
+ <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
+ <real name="spacing" value="0un"/>
+ </widget>
+ <widget name="logs_label_empty_list" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <real name="z" value="3"/>
+ <rect height="26.12959" name="geometry" width="349.95" x="0.75un" y="8.25un"/>
+ <sizehint height="3.9un" type="PREFERRED" width="18.91045un"/>
+ <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
+ <bool name="visible" value="FALSE"/>
+ <string name="plainText" value="No matches found" locid="txt_dialer_ui_list_no_matches_found"/>
+ <enums name="logicalFont" value="FontPrimary"/>
+ </widget>
+ <widget name="logs_groupbox_matched_calls" type="HbGroupBox">
+ <string name="heading" value="Matches" locid="txt_dialer_ui_subhead_matches"/>
+ <bool name="collapsable" value="FALSE"/>
+ <real name="spacing" value="0un"/>
+ </widget>
+ <widget name="logs_button_addtocontacts" type="HbPushButton">
+ <icon iconName="qtg_mono_add_contact" name="icon"/>
+ <enums name="layoutDirection" value="RightToLeft"/>
+ <real name="z" value="4"/>
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
+ <sizehint height="9.0un" type="PREFERRED" width="22.0un"/>
+ <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
+ <rect height="9.0un" name="geometry" width="22.0un" x="15.86un" y="16.71642un"/>
+ </widget>
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="var(hb-param-margin-view-bottom)" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="logs_groupbox_matched_calls"/>
+ <linearitem itemname="logs_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <real name="z" value="2"/>
+ <enums name="orientation" value="Horizontal"/>
+ <ref object="logs_act_contacts" role="HbToolBar:addAction"/>
+ <ref object="logs_act_dialer" role="HbToolBar:addAction"/>
+ <ref object="logs_act_show" role="HbToolBar:addAction"/>
+ </widget>
+ <widget name="logs_view_menu2" role="HbView:menu" type="HbMenu">
+ <ref object="logs_act_video_call" role="HbMenu:addAction"/>
+ <ref object="logs_act_create_message" role="HbMenu:addAction"/>
+ <ref object="logs_act_contact_search" role="HbMenu:addAction"/>
+ </widget>
+ <string name="title" value="Dialer"/>
+ </widget>
+ <section name="portrait_dialpad">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="expr(var(hb-param-margin-view-bottom)+54un)" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="logs_groupbox_matched_calls"/>
+ <linearitem itemname="logs_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_label_empty_list" type="HbLabel">
+ <rect height="26.12959" name="geometry" width="349.95" x="0.75un" y="8un"/>
+ </widget>
+ <widget name="logs_button_addtocontacts" type="HbPushButton">
+ <rect height="9.0un" name="geometry" width="22.0un" x="15.86un" y="16.71642un"/>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ </section>
+ <section name="landscape_dialpad">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="var(hb-param-margin-view-bottom)" left="var(hb-param-margin-view-left)" right="expr(var(hb-param-margin-view-right)+48un)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="logs_groupbox_matched_calls"/>
+ <linearitem itemname="logs_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_label_empty_list" type="HbLabel">
+ <rect height="26" name="geometry" width="312.75" x="0.75un" y="8un"/>
+ </widget>
+ <widget name="logs_button_addtocontacts" type="HbPushButton">
+ <rect height="9.0un" name="geometry" width="22.0un" x="12.88un" y="16.71642un"/>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ </section>
+ <section name="default">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="var(hb-param-margin-view-bottom)" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="logs_groupbox_matched_calls"/>
+ <linearitem itemname="logs_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_label_empty_list" type="HbLabel">
+ <rect height="26.12959" name="geometry" width="349.95" x="0.75un" y="8un"/>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <bool name="visible" value="TRUE"/>
+ </widget>
+ </section>
+
+ <!-- Context menu -->
+ <widget name="logs_show_filter_menu" type="HbMenu">
+ <integer name="timeout" value="5000000"/> <!-- 5 seconds timeout -->
+ <enums name="dismissPolicy" value="TapAnywhere"/>
+ <ref object="logs_act_recent" role="HbMenu:addAction"/>
+ <ref object="logs_act_dialled" role="HbMenu:addAction"/>
+ <ref object="logs_act_received" role="HbMenu:addAction"/>
+ <ref object="logs_act_missed" role="HbMenu:addAction"/>
+ </widget>
+ <connect receiver="logs_matches_view" sender="logs_act_video_call" signal="triggered(bool)" slot="videoCallToCurrentNum()"/>
+ <connect receiver="logs_matches_view" sender="logs_act_create_message" signal="triggered(bool)" slot="sendMessageToCurrentNum()"/>
+ <connect receiver="logs_matches_view" sender="logs_act_contact_search" signal="triggered(bool)" slot="toggleContactSearch()"/>
+ <connect receiver="logs_matches_view" sender="logs_act_dialer" signal="triggered(bool)" slot="openDialpad()"/>
+ <connect receiver="logs_matches_view" sender="logs_act_contacts" signal="triggered(bool)" slot="openContactsApp()"/>
+ <connect receiver="logs_matches_view" sender="logs_button_addtocontacts" signal="clicked()" slot="saveNumberInDialpadToContacts()"/>
+ <connect receiver="logs_matches_view" sender="logs_act_show" signal="triggered(bool)" slot="showFilterMenu()"/>
+ <connect receiver="logs_matches_view" sender="logs_show_filter_menu" signal="triggered(HbAction*)" slot="changeFilter(HbAction*)"/>
+ <metadata activeUIState="Common ui state" display="QHD portrait" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ <uistate name="portrait" sections="#common portrait_dialpad"/>
+ <uistate name="landscape" sections="#common landscape_dialpad"/>
+ <uistate name="default" sections="#common default"/>
+ <dummydata objectName="logs_list_view" section="#common" value="0"/>
+ </metadata>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsapp/resources/recentCallsView.docml Fri May 14 15:52:41 2010 +0300
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.7">
+ <object name="logs_act_video_call" type="HbAction">
+ <string name="iconText" value="Video call"/>
+ <string name="text" value="Video call" locid="txt_common_opt_video_call"/>
+ <string name="toolTip" value="Video call"/>
+ </object>
+ <object name="logs_act_create_message" type="HbAction">
+ <string name="iconText" value="Send message"/>
+ <string name="text" value="Send message" locid="txt_common_opt_create_message"/>
+ <string name="toolTip" value="Send message"/>
+ </object>
+ <object name="logs_act_add_to_contacts" type="HbAction">
+ <string name="iconText" value="Add to contacts"/>
+ <string name="text" value="Add to contacts" locid="txt_common_menu_add_to_contacts"/>
+ <string name="toolTip" value="Add to contacts"/>
+ </object>
+ <object name="logs_act_clear_list" type="HbAction">
+ <string name="iconText" value="Clear list"/>
+ <string name="text" value="Clear list" locid="txt_dialer_ui_opt_clear_list"/>
+ <string name="toolTip" value="Clear list"/>
+ </object>
+ <object name="logs_act_contact_search" type="HbAction">
+ <string name="iconText" value="Contact search"/>
+ <string name="text" value="Contact search" locid="txt_dialer_ui_opt_contact_search"/>
+ <string name="toolTip" value="Contact search"/>
+ </object>
+
+ <object name="logs_act_dialer" type="HbAction">
+ <icon iconName="qtg_mono_dialer" name="icon"/>
+ <string name="toolTip" value="Dialer"/>
+ </object>
+ <object name="logs_act_contacts" type="HbAction">
+ <icon iconName="qtg_mono_contacts" name="icon"/>
+ <string name="toolTip" value="Contacts"/>
+ </object>
+ <object name="logs_act_show" type="HbAction">
+ <icon iconName="qtg_mono_show_view" name="icon"/>
+ <string name="toolTip" value="Show"/>
+ </object>
+ <object name="logs_act_recent" type="HbAction">
+ <string name="iconText" value="Recent calls"/>
+ <string name="text" value="Recent calls" locid="txt_dialer_subhead_recent_calls"/>
+ <string name="toolTip" value="Recent calls"/>
+ <string name="checkable" value="TRUE"/>
+ </object>
+ <object name="logs_act_received" type="HbAction">
+ <string name="iconText" value="Received calls"/>
+ <string name="text" value="Received calls" locid="txt_dial_subhead_received_calls"/>
+ <string name="toolTip" value="Received calls"/>
+ <string name="checkable" value="TRUE"/>
+ </object>
+ <object name="logs_act_dialled" type="HbAction">
+ <string name="iconText" value="Dialled calls"/>
+ <string name="text" value="Dialled calls" locid="txt_dialer_subhead_dialled_calls"/>
+ <string name="toolTip" value="Dialled calls"/>
+ <string name="checkable" value="TRUE"/>
+ </object>
+ <object name="logs_act_missed" type="HbAction">
+ <string name="iconText" value="Missed calls"/>
+ <string name="text" value="Missed calls" locid="txt_dialer_subhead_missed_calls"/>
+ <string name="toolTip" value="Missed calls"/>
+ <string name="checkable" value="TRUE"/>
+ </object>
+ <widget name="logs_recent_calls_view" type="HbView">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <widget name="logs_list_view" type="HbListView">
+ <real name="z" value="2.0001"/>
+ <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
+ <real name="spacing" value="0un"/>
+ </widget>
+ <widget name="logs_label_empty_list" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <real name="z" value="3"/>
+ <rect height="26.12959" name="geometry" width="349.95" x="0.75un" y="8.25un"/>
+ <sizehint height="3.9un" type="PREFERRED" width="18.91045un"/>
+ <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
+ <bool name="visible" value="FALSE"/>
+ <string name="plainText" value="No history of calls" locid="txt_dialer_ui_list_no_history_of_calls"/>
+ <enums name="logicalFont" value="FontPrimary"/>
+ </widget>
+ <widget name="qroupbox_container" type="HbWidget">
+ <widget name="logs_groupbox_recent_calls" type="HbGroupBox">
+ <string name="heading" value="Recent calls"/>
+ <bool name="collapsable" value="FALSE"/>
+ <real name="spacing" value="0un"/>
+ </widget>
+ <widget name="logs_page_indicator" type="LogsPageIndicator">
+ <real name="z" value="3"/>
+ <sizehint type="PREFERRED" height="var(hb-param-graphic-size-secondary)" width="expr(4*var(hb-param-graphic-size-secondary))"/>
+ </widget>
+ <real name="z" value="2"/>
+ <layout type="anchor" widget="qroupbox_container">
+ <anchoritem dst="logs_groupbox_recent_calls" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="logs_groupbox_recent_calls" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="logs_groupbox_recent_calls" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+ <anchoritem dst="logs_groupbox_recent_calls" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="logs_page_indicator" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="logs_page_indicator" dstEdge="CENTERV" spacing="0un" src="" srcEdge="CENTERV"/>
+ </layout>
+ </widget>
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="var(hb-param-margin-view-bottom)" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="qroupbox_container"/>
+ <linearitem itemname="logs_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <real name="z" value="2"/>
+ <enums name="orientation" value="Horizontal"/>
+ <ref object="logs_act_contacts" role="HbToolBar:addAction"/>
+ <ref object="logs_act_dialer" role="HbToolBar:addAction"/>
+ <ref object="logs_act_show" role="HbToolBar:addAction"/>
+ </widget>
+ <widget name="logs_view_menu" role="HbView:menu" type="HbMenu">
+ <ref object="logs_act_video_call" role="HbMenu:addAction"/>
+ <ref object="logs_act_create_message" role="HbMenu:addAction"/>
+ <ref object="logs_act_add_to_contacts" role="HbMenu:addAction"/>
+ <ref object="logs_act_clear_list" role="HbMenu:addAction"/>
+ <ref object="logs_act_contact_search" role="HbMenu:addAction"/>
+ </widget>
+ <string name="title" value="Dialer"/>
+ </widget>
+ <section name="portrait_dialpad">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="expr(var(hb-param-margin-view-bottom)+54un)" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="qroupbox_container"/>
+ <linearitem itemname="logs_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_label_empty_list" type="HbLabel">
+ <rect height="26.12959" name="geometry" width="349.95" x="0.75un" y="8un"/>
+ </widget>
+ <widget name="logs_page_indicator" type="LogsPageIndicator">
+ <sizehint type="PREFERRED" width="expr(4*var(hb-param-graphic-size-secondary))"/>
+ <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ </section>
+ <section name="landscape_dialpad">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="var(hb-param-margin-view-bottom)" left="var(hb-param-margin-view-left)" right="expr(var(hb-param-margin-view-right)+48un)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="qroupbox_container"/>
+ <linearitem itemname="logs_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_label_empty_list" type="HbLabel">
+ <rect height="26" name="geometry" width="312.75" x="0.75un" y="8un"/>
+ </widget>
+ <widget name="logs_page_indicator" type="LogsPageIndicator">
+ <sizehint type="PREFERRED" width="expr(4*var(hb-param-graphic-size-secondary)+0.75un)"/>
+ <contentsmargins bottom="0un" left="0un" right="0.75un" top="0un"/>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ </section>
+ <section name="default">
+ <widget name="logs_content" role="HbView:widget" type="HbWidget">
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="var(hb-param-margin-view-bottom)" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="var(hb-param-margin-view-top)"/>
+ <linearitem itemname="qroupbox_container"/>
+ <linearitem itemname="logs_list_view"/>
+ </layout>
+ </widget>
+ <widget name="logs_label_empty_list" type="HbLabel">
+ <rect height="26.12959" name="geometry" width="349.95" x="0.75un" y="8un"/>
+ </widget>
+ <widget name="logs_page_indicator" type="LogsPageIndicator">
+ <sizehint type="PREFERRED" width="expr(4*var(hb-param-graphic-size-secondary))"/>
+ <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
+ </widget>
+ <widget name="logs_toolbar" role="HbView:toolBar" type="HbToolBar">
+ <bool name="visible" value="TRUE"/>
+ </widget>
+ </section>
+
+ <!-- Context menu -->
+ <widget name="logs_show_filter_menu" type="HbMenu">
+ <integer name="timeout" value="5000000"/> <!-- 5 seconds timeout -->
+ <enums name="dismissPolicy" value="TapAnywhere"/>
+ <ref object="logs_act_recent" role="HbMenu:addAction"/>
+ <ref object="logs_act_dialled" role="HbMenu:addAction"/>
+ <ref object="logs_act_received" role="HbMenu:addAction"/>
+ <ref object="logs_act_missed" role="HbMenu:addAction"/>
+ </widget>
+ <connect receiver="logs_recent_calls_view" sender="logs_act_video_call" signal="triggered(bool)" slot="videoCallToCurrentNum()"/>
+ <connect receiver="logs_recent_calls_view" sender="logs_act_create_message" signal="triggered(bool)" slot="sendMessageToCurrentNum()"/>
+ <connect receiver="logs_recent_calls_view" sender="logs_act_add_to_contacts" signal="triggered(bool)" slot="addToContacts()"/>
+ <connect receiver="logs_recent_calls_view" sender="logs_act_clear_list" signal="triggered(bool)" slot="clearList()"/>
+ <connect receiver="logs_recent_calls_view" sender="logs_act_contact_search" signal="triggered(bool)" slot="toggleContactSearch()"/>
+ <connect receiver="logs_recent_calls_view" sender="logs_act_dialer" signal="triggered(bool)" slot="openDialpad()"/>
+ <connect receiver="logs_recent_calls_view" sender="logs_act_contacts" signal="triggered(bool)" slot="openContactsApp()"/>
+ <connect receiver="logs_recent_calls_view" sender="logs_act_show" signal="triggered(bool)" slot="showFilterMenu()"/>
+ <connect receiver="logs_recent_calls_view" sender="logs_show_filter_menu" signal="triggered(HbAction*)" slot="changeFilter(HbAction*)"/>
+ <metadata activeUIState="Common ui state" display="QHD portrait" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ <uistate name="portrait" sections="#common portrait_dialpad"/>
+ <uistate name="landscape" sections="#common landscape_dialpad"/>
+ <uistate name="default" sections="#common default"/>
+ <dummydata objectName="logs_list_view" section="#common" value="0"/>
+ </metadata>
+</hbdocument>
--- a/logsui/logsapp/src/logsbaseview.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/src/logsbaseview.cpp Fri May 14 15:52:41 2010 +0300
@@ -8,7 +8,6 @@
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
-*
* Contributors:
*
* Description:
@@ -24,6 +23,7 @@
#include "logsmessage.h"
#include "logscontact.h"
#include "logsabstractmodel.h"
+#include "logsmodel.h"
#include "logsdetailsmodel.h"
//SYSTEM
@@ -255,6 +255,25 @@
//
// -----------------------------------------------------------------------------
//
+LogsAbstractModel* LogsBaseView::logsModel() const
+{
+ return static_cast<LogsAbstractModel*>( model() );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+HbListView* LogsBaseView::listView() const
+{
+ LOGS_QDEBUG( "logs [UI] <-> LogsBaseView::listView()" );
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
void LogsBaseView::handleExit()
{
LOGS_QDEBUG( "logs [UI] -> LogsBaseView::handleExit()" );
@@ -263,6 +282,24 @@
}
// -----------------------------------------------------------------------------
+// LogsBaseView::callKeyPressed
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::callKeyPressed()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::callKeyPressed()" );
+ // Call to topmost item in current list
+ if ( !tryCallToDialpadNumber() && listView() && model() && model()->hasIndex(0,0) ) {
+ LOGS_QDEBUG( "logs [UI] Call to topmost item in list" );
+ QModelIndex topIndex = model()->index(0,0);
+ listView()->scrollTo( topIndex );
+ listView()->setCurrentIndex( topIndex, QItemSelectionModel::Select );
+ initiateCallback(topIndex);
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::callKeyPressed()" );
+}
+
+// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
@@ -282,10 +319,11 @@
mShowFilterMenu->setPreferredPos(pos,HbPopup::BottomRightCorner);
LOGS_QDEBUG_2("logs [UI] menupos:", pos)
- mShowFilterMenu->exec();
+ mShowFilterMenu->open();
}
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::showFilterMenu()" );
}
+
// -----------------------------------------------------------------------------
// LogsBaseView::closeEmptyMenu()
// -----------------------------------------------------------------------------
@@ -369,8 +407,10 @@
//
void LogsBaseView::dialpadOpened()
{
- LOGS_QDEBUG( "logs [UI] -> LogsBaseView::dialpadOpened()" );
- updateWidgetsSizeAndLayout();
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::dialpadOpened()" );
+ if ( !tryMatchesViewTransition() ){
+ updateWidgetsSizeAndLayout();
+ }
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::dialpadOpened()" );
}
@@ -381,7 +421,6 @@
void LogsBaseView::dialpadClosed()
{
LOGS_QDEBUG( "logs [UI] -> LogsBaseView::dialpadClosed()" );
- mDialpad->editor().setText(QString());
updateWidgetsSizeAndLayout();
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::dialpadClosed()" );
}
@@ -393,10 +432,8 @@
void LogsBaseView::dialpadEditorTextChanged()
{
LOGS_QDEBUG( "logs [UI] -> LogsBaseView::dialpadEditorTextChanged()" );
- if ( mDialpad->editor().text().length() > 0 ) {
- mViewManager.activateView( LogsMatchesViewId, true, QVariant() );
- } else {
- updateCallButton();
+ if ( !tryMatchesViewTransition() ) {
+ updateCallButton();
}
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::dialpadEditorTextChanged()" );
}
@@ -419,21 +456,71 @@
//
// -----------------------------------------------------------------------------
//
+void LogsBaseView::addToContacts()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::addToContacts()" );
+ if ( isDialpadInput() ){
+ saveNumberInDialpadToContacts();
+ } else 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);
+ saveContact();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::addToContacts()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::saveNumberInDialpadToContacts()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::saveNumberInDialpadToContacts()" );
+ if (mDialpad->editor().text().length() > 0){
+ delete mContact;
+ mContact = 0;
+ mContact = logsModel()->createContact(mDialpad->editor().text());
+ saveContact();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::saveNumberInDialpadToContacts()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
void LogsBaseView::showListItemMenu(
HbAbstractViewItem* item, const QPointF& coords )
{
- HbMenu itemContextMenu(0);
- itemContextMenu.setDismissPolicy(HbMenu::TapAnywhere);
- itemContextMenu.setTimeout(contextMenuTimeout);
-
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::showListItemMenu()" );
+ HbMenu* itemContextMenu = new HbMenu();
+ itemContextMenu->setDismissPolicy(HbMenu::TapAnywhere);
+ itemContextMenu->setTimeout(contextMenuTimeout);
+ itemContextMenu->setAttribute(Qt::WA_DeleteOnClose);
+
updateListItemData(item->modelIndex());
- populateListItemMenu(itemContextMenu);
+ populateListItemMenu(*itemContextMenu);
if (mDialpad->isOpen()) {
mDialpad->closeDialpad();
}
- if (itemContextMenu.actions().count() > 0) {
- itemContextMenu.exec(coords);
+ if (itemContextMenu->actions().count() > 0) {
+ itemContextMenu->setPreferredPos(coords,HbPopup::TopLeftCorner);
+ itemContextMenu->open();
+ //TODO:
+ //the hack below is needed since otherwise listbox will get mouse event
+ //and "activated" signal will be emitted (=>initiateCallback() called)
+ //Remove it, when something is done in platform code for that
+ if (scene()) {
+ QGraphicsItem *item = scene()->mouseGrabberItem();
+ if (item) {
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::showListItemMenu() ungrabbing the mouse" );
+ item->ungrabMouse();
+ }
+ }
}
}
@@ -535,6 +622,42 @@
{
mDialpad->setCallButtonEnabled( !mDialpad->editor().text().isEmpty() );
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsBaseView::tryCallToDialpadNumber( LogsCall::CallType callType )
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::tryCallToDialpadNumber()" );
+ bool called = false;
+ if ( isDialpadInput() ){
+ // Call to inputted number
+ LogsCall::callToNumber( callType, mDialpad->editor().text() );
+ called = true;
+ }
+ LOGS_QDEBUG_2( "logs [UI] <- LogsBaseView::tryCallToDialpadNumber(), called",
+ called );
+ return called;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsBaseView::tryMessageToDialpadNumber()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::tryMessageToDialpadNumber()" );
+ bool messageSent = false;
+ if ( isDialpadInput() ){
+ // Message to inputted number
+ LogsMessage::sendMessageToNumber( mDialpad->editor().text() );
+ messageSent = true;
+ }
+ LOGS_QDEBUG_2( "logs [UI] <- LogsBaseView::tryMessageToDialpadNumber(), sent",
+ messageSent );
+ return messageSent;
+}
// -----------------------------------------------------------------------------
//
@@ -599,7 +722,7 @@
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
HbPushButton* addButton = new HbPushButton(buttonWidget);
- addButton->setOrientation(Qt::Horizontal);
+ addButton->setStretched(true);
addButton->setText(hbTrId("txt_dial_list_save_as_a_new_contact"));
HbIcon plusIcon("qtg_mono_plus");
addButton->setIcon(plusIcon);
@@ -607,7 +730,7 @@
connect(addButton, SIGNAL(clicked()), mContact, SLOT(addNew()));
HbPushButton* updateButton = new HbPushButton(buttonWidget);
- updateButton->setOrientation(Qt::Horizontal);
+ updateButton->setStretched(true);
updateButton->setText(hbTrId("txt_dial_list_update_existing_contact"));
updateButton->setIcon(plusIcon);
connect(updateButton, SIGNAL(clicked()), popup, SLOT(close()));
@@ -620,7 +743,7 @@
buttonWidget->setLayout(layout);
popup->setContentWidget(buttonWidget);
- popup->exec();
+ popup->open();
}
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::saveContact()" );
@@ -780,7 +903,6 @@
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::showCallDetails()" );
}
-
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -789,10 +911,10 @@
{
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();
- }
+ askConfirmation(hbTrId("txt_dialer_ui_title_delete_event"),
+ hbTrId("txt_dialer_info_call_event_will_be_removed_from"),
+ this,
+ SLOT(deleteEventOkAnswer()));
}
LOGS_QDEBUG( "logs [UI] <- LogsBaseView::deleteEvent()" );
}
@@ -801,11 +923,55 @@
//
// -----------------------------------------------------------------------------
//
+void LogsBaseView::deleteEventOkAnswer()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::deleteEventOkAnswer()" );
+ if (mDetailsModel) {
+ mDetailsModel->clearEvent();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::deleteEventOkAnswer()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::videoCallToCurrentNum()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::videoCallToCurrentNum()" );
+ tryCallToDialpadNumber( LogsCall::TypeLogsVideoCall );
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::videoCallToCurrentNum()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::sendMessageToCurrentNum()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::sendMessageToCurrentNum()" );
+ tryMessageToDialpadNumber();
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::sendMessageToCurrentNum()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
void LogsBaseView::updateWidgetsSizeAndLayout()
{
}
// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::contactActionCompleted(bool modified)
+{
+ Q_UNUSED(modified);
+}
+
+// -----------------------------------------------------------------------------
// Sets appropriate list widget layout using listView.setLayoutName()
// -----------------------------------------------------------------------------
//
@@ -892,18 +1058,113 @@
//
// -----------------------------------------------------------------------------
//
-bool LogsBaseView::askConfirmation( QString heading , QString text )
+void LogsBaseView::askConfirmation( QString heading , QString text,
+ QObject* receiver, const char* okSlot, const char* cancelSlot )
+{
+ HbMessageBox* note = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion);
+ note->setAttribute(Qt::WA_DeleteOnClose);
+ 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));
+
+ if (receiver && okSlot) {
+ connect(note->primaryAction(), SIGNAL(triggered()), receiver, okSlot);
+ }
+ if (receiver && cancelSlot) {
+ connect(note->secondaryAction(), SIGNAL(triggered()), receiver, cancelSlot);
+ }
+ note->open();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateContactSearchAction()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::updateContactSearchAction()" );
+ HbAction* contactSearchAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsRecentViewContactSearchMenuActionId ) );
+ if ( contactSearchAction ) {
+ if ( isContactSearchPermanentlyDisabled() ){
+ contactSearchAction->setVisible(false);
+ } else if ( isContactSearchEnabled() ){
+ contactSearchAction->setIconText("Contact search off");
+ contactSearchAction->setText(hbTrId("txt_dialer_ui_opt_contact_search_off"));
+ contactSearchAction->setVisible(mDialpad->isOpen());
+ } else {
+ contactSearchAction->setIconText("Contact search on");
+ contactSearchAction->setText(hbTrId("txt_dialer_ui_opt_contact_search_on"));
+ contactSearchAction->setVisible(mDialpad->isOpen());
+ }
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::updateContactSearchAction()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsBaseView::isContactSearchEnabled
+// -----------------------------------------------------------------------------
+//
+bool LogsBaseView::isContactSearchEnabled() const
{
- 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;
+ int currSetting = logsModel() ?
+ logsModel()->predictiveSearchStatus() : -1;
+ return ( currSetting == logsContactSearchEnabled );
+}
+
+// -----------------------------------------------------------------------------
+// LogsBaseView::isContactSearchPermanentlyDisabled
+// -----------------------------------------------------------------------------
+//
+bool LogsBaseView::isContactSearchPermanentlyDisabled() const
+{
+ int currSetting = logsModel() ?
+ logsModel()->predictiveSearchStatus() : -1;
+ return ( currSetting == logsContactSearchPermanentlyDisabled ||
+ currSetting < 0 );
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsBaseView::updateDialpadCallAndMessagingActions()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::updateDialpadCallAndMessagingActions()" );
+ HbAction* videoCallAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsCommonVideoCallMenuActionId ) );
+ HbAction* sendMessageAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsCommonMessageMenuActionId ) );
+
+ bool visible( isDialpadInput() );
+
+ toggleActionAvailability( videoCallAction, visible );
+ toggleActionAvailability( sendMessageAction, visible );
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::updateDialpadCallAndMessagingActions()" );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsBaseView::tryMatchesViewTransition()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsBaseView::tryMatchesViewTransition()" );
+ bool viewChanged = false;
+ if ( mDialpad->editor().text().length() > 0 && isContactSearchEnabled() ) {
+ viewChanged = mViewManager.activateView( LogsMatchesViewId, true, QVariant() );
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsBaseView::tryMatchesViewTransition()" );
+ return viewChanged;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsBaseView::isDialpadInput() const
+{
+ return ( mDialpad->isOpen() && !mDialpad->editor().text().isEmpty() );
+}
+
--- a/logsui/logsapp/src/logsdetailsview.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/src/logsdetailsview.cpp Fri May 14 15:52:41 2010 +0300
@@ -14,7 +14,6 @@
* Description:
*
*/
-//USER
#include "logsdetailsview.h"
#include "logsdetailsmodel.h"
#include "logscall.h"
@@ -31,6 +30,8 @@
#include <hbgroupbox.h>
#include <hbmessagebox.h>
#include <hblabel.h>
+#include <dialpad.h>
+#include <hblineedit.h>
Q_DECLARE_METATYPE(LogsDetailsModel*)
@@ -118,7 +119,7 @@
void LogsDetailsView::callKeyPressed()
{
LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::callKeyPressed()" );
- if ( mCall ){
+ if ( !tryCallToDialpadNumber() && mCall ){
mCall->initiateCallback();
}
LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::callKeyPressed()" );
@@ -131,7 +132,7 @@
void LogsDetailsView::initiateVoiceCall()
{
LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::initiateVoiceCall()" );
- if ( mCall ){
+ if ( !tryCallToDialpadNumber() && mCall ){
mCall->call(LogsCall::TypeLogsVoiceCall);
}
LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::initiateVoiceCall()" );
@@ -144,7 +145,7 @@
void LogsDetailsView::initiateVideoCall()
{
LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::initiateVideoCall()" );
- if ( mCall ){
+ if ( !tryCallToDialpadNumber(LogsCall::TypeLogsVideoCall) && mCall ){
mCall->call(LogsCall::TypeLogsVideoCall);
}
LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::initiateVideoCall()" );
@@ -154,18 +155,13 @@
//
// -----------------------------------------------------------------------------
//
-void LogsDetailsView::addToContacts()
+void LogsDetailsView::sendMessage()
{
- 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::sendMessage()" );
+ if ( !tryMessageToDialpadNumber() && mMessage ){
+ mMessage->sendMessage();
}
- LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::addToContacts()" );
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::sendMessage()" );
}
// -----------------------------------------------------------------------------
@@ -206,37 +202,6 @@
}
// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-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
// -----------------------------------------------------------------------------
//
@@ -246,6 +211,20 @@
}
// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::deleteEventOkAnswer()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::deleteEventOkAnswer()" );
+ if (mDetailsModel) {
+ mDetailsModel->clearEvent();
+ handleBackSoftkey();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::deleteEventOkAnswer()" );
+}
+
+// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
@@ -311,7 +290,7 @@
HbAction* messageAction = qobject_cast<HbAction*>(
mRepository.findObject( logsCommonMessageMenuActionId ) );
HbAction* addToContactsAction = qobject_cast<HbAction*>(
- mRepository.findObject( logsDetailsAddToContactsMenuActionId ) );
+ mRepository.findObject( logsCommonAddToContactsMenuActionId ) );
HbAction* openContactAction = qobject_cast<HbAction*>(
mRepository.findObject( logsDetailsOpenContactMenuActionId ) );
@@ -330,7 +309,13 @@
bool contactCanBeAdded(false);
bool contactCanBeOpened(false);
- if (mContact){
+ if ( isDialpadInput() ){
+ // Contact addition will be done using input field number
+ contactCanBeAdded = true;
+ // No need for voice call option in options menu as voice dialling
+ // to dialpad num is possible from green button
+ voiceCallAvailable = false;
+ } else if (mContact){
if (mContact->allowedRequestType() == LogsContact::TypeLogsContactSave){
contactCanBeAdded = true;
}
@@ -350,6 +335,20 @@
}
// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsDetailsView::dialpadEditorTextChanged()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::dialpadEditorTextChanged()" );
+ if ( !tryMatchesViewTransition() ) {
+ updateMenu();
+ updateCallButton();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsDetailsView::dialpadEditorTextChanged()" );
+}
+
+// -----------------------------------------------------------------------------
// LogsDetailsView::updateWidgetsSizeAndLayout
// -----------------------------------------------------------------------------
//
@@ -357,6 +356,7 @@
{
LOGS_QDEBUG( "logs [UI] -> LogsDetailsView::updateWidgetsSizeAndLayout()" );
if ( mListView ) {
+ updateMenu();
updateListLayoutName(*mListView, true);
updateListSize();
}
--- a/logsui/logsapp/src/logseffecthandler.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/src/logseffecthandler.cpp Fri May 14 15:52:41 2010 +0300
@@ -116,7 +116,7 @@
emit dissappearByFadingComplete();
}
}
-
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -127,6 +127,7 @@
1.0, 0.0, logsEffectDissappearDurationInMs);
initOpacityEffect(*mItemAppearByFadingAnimation, &effectTarget,
0.0, 1.0, logsEffectAppearDurationInMs);
+ mFadeGroup->stop();
mFadeGroup->start();
}
@@ -158,6 +159,7 @@
initAppearByMovingEffect(
static_cast<QPropertyAnimation&>(*group.animationAt(logsAppearByMovingIndex)),
&effectTarget, !dissappearToLeft, origX);
+ group.stop();
group.start();
}
--- a/logsui/logsapp/src/logsmatchesview.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/src/logsmatchesview.cpp Fri May 14 15:52:41 2010 +0300
@@ -24,7 +24,6 @@
#include "logsmatchesmodel.h"
#include "logscall.h"
#include "logscontact.h"
-#include "logsmessage.h"
//SYSTEM
#include <hblistview.h>
@@ -121,53 +120,12 @@
}
// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
//
-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()
+HbListView* LogsMatchesView::listView() const
{
- 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();
- }
+ return mListView;
}
// -----------------------------------------------------------------------------
@@ -231,6 +189,8 @@
{
LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::::handleBackSoftkey()" );
+ mDialpad->editor().setText(QString());
+
if (mDialpad->isOpen()){
LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::::handleBackSoftkey() closeDialpad" );
// Block aboutToClose signal to interfere with layout loading
@@ -269,7 +229,7 @@
//
void LogsMatchesView::dialpadOpened()
{
- LogsBaseView::dialpadOpened();
+ updateWidgetsSizeAndLayout();
updateAddContactButton();
}
@@ -311,37 +271,36 @@
}
// -----------------------------------------------------------------------------
+// LogsMatchesView::toggleContactSearch
+// -----------------------------------------------------------------------------
+//
+void LogsMatchesView::toggleContactSearch()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsMatchesView::toggleContactSearch()" );
+
+ if ( isContactSearchEnabled() ){
+ int result = mModel->setPredictiveSearch( false );
+ LogsBaseView::handleBackSoftkey();
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::toggleContactSearch()" );
+}
+
+// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
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 ) );
+
+ updateDialpadCallAndMessagingActions();
- bool visible( mDialpad->isOpen() && !mDialpad->editor().text().isEmpty() );
-
- toggleActionAvailability( videoCallAction, visible );
- toggleActionAvailability( sendMessageAction, visible );
+ updateContactSearchAction();
+
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
// -----------------------------------------------------------------------------
//
@@ -350,8 +309,6 @@
if (mAddToContactsButton) {
LOGS_QDEBUG( "logs [UI] <-> LogsMatchesView::updateAddContactButton()" );
bool matchesFound(model() && (model()->rowCount() > 0));
- mAddToContactsButton->setVisible(!matchesFound
- && mDialpad->isOpen()
- && !mDialpad->editor().text().isEmpty());
+ mAddToContactsButton->setVisible(!matchesFound && isDialpadInput());
}
}
--- a/logsui/logsapp/src/logsrecentcallsview.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/src/logsrecentcallsview.cpp Fri May 14 15:52:41 2010 +0300
@@ -27,6 +27,7 @@
#include "logseffecthandler.h"
#include "logsmatchesmodel.h"
#include "logspageindicator.h"
+#include "logsconfigurationparams.h"
//SYSTEM
#include <hbview.h>
@@ -113,8 +114,6 @@
}
activateEmptyListIndicator(mFilter);
- mDialpad->editor().setText(QString());
-
mPageIndicator->setActiveItemIndex(mConversionMap.value(mCurrentView));
if ( mResetted ){
@@ -210,20 +209,21 @@
}
// -----------------------------------------------------------------------------
-// LogsRecentCallsView::callKeyPressed
+//
// -----------------------------------------------------------------------------
//
-void LogsRecentCallsView::callKeyPressed()
+LogsAbstractModel* LogsRecentCallsView::logsModel() const
{
- 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()" );
+ return mModel;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+HbListView* LogsRecentCallsView::listView() const
+{
+ return mListView;
}
// -----------------------------------------------------------------------------
@@ -266,12 +266,13 @@
void LogsRecentCallsView::dialpadEditorTextChanged()
{
LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::dialpadEditorTextChanged()" );
- if ( mDialpad->editor().text().length() > 0 ) {
+ if ( mDialpad->editor().text().length() > 0 && isContactSearchEnabled() ) {
QVariant arg = qVariantFromValue( mMatchesModel );
if ( mViewManager.activateView( LogsMatchesViewId, true, arg ) ){
mMatchesModel = 0; // Ownership was given to matches view
}
} else {
+ updateMenu();
updateCallButton();
}
LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::dialpadEditorTextChanged()" );
@@ -285,12 +286,50 @@
{
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() );
+ askConfirmation(hbTrId("txt_dialer_ui_title_clear_list"),
+ hbTrId("txt_dialer_ui_info_all_call_events_will_be_remo"),
+ this,
+ SLOT(clearListOkAnswer()));
+
+ }
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::clearList()<-" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::clearListOkAnswer
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::clearListOkAnswer()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::clearListOkAnswer()" );
+ if (mFilter) {
+ mModel->clearList( mFilter->clearType() );
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::clearListAnswer()" );
+}
+
+// -----------------------------------------------------------------------------
+// LogsRecentCallsView::toggleContactSearch
+// -----------------------------------------------------------------------------
+//
+void LogsRecentCallsView::toggleContactSearch()
+{
+ LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::toggleContactSearch()" );
+
+ if ( isContactSearchPermanentlyDisabled() ){
+ LOGS_QDEBUG( "logs [UI] permanently disabled" );
+ } else if ( isContactSearchEnabled() ){
+ mModel->setPredictiveSearch( false );
+ updateMenu();
+ } else {
+ mModel->setPredictiveSearch( true );
+ updateMenu();
+ if ( isDialpadInput() ){
+ LogsRecentCallsView::dialpadEditorTextChanged();
}
}
- LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::clearList()<-" );
+
+ LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::toggleContactSearch()" );
}
// -----------------------------------------------------------------------------
@@ -634,6 +673,14 @@
bool visible( model()->rowCount() > 0 );
action->setVisible( visible );
}
+
+ HbAction* addToContactsAction = qobject_cast<HbAction*>(
+ mRepository.findObject( logsCommonAddToContactsMenuActionId ) );
+ toggleActionAvailability(addToContactsAction, isDialpadInput());
+
+ updateDialpadCallAndMessagingActions();
+ updateContactSearchAction();
+
LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateMenu()" );
}
@@ -656,8 +703,20 @@
{
LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::updateWidgetsSizeAndLayout()" );
if ( mListView ) {
+ updateMenu();
updateListLayoutName(*mListView);
updateListSize();
+ HbDeviceProfile deviceProf;
+ LogsConfigurationParams param;
+ QString testString = mListView->layoutName();
+ //note: ListItemTextWidth values are currently hardcoded and
+ //they are taken from hblistviewitem.css "text-1" field
+ if (mListView->layoutName() == logsListLandscapeDialpadLayout) {
+ param.setListItemTextWidth( 38 * deviceProf.unitValue() );
+ } else {
+ param.setListItemTextWidth( 40 * deviceProf.unitValue() );
+ }
+ mModel->updateConfiguration(param);
}
LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateWidgetsSizeAndLayout()" );
}
--- a/logsui/logsapp/src/logsviewmanager.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/src/logsviewmanager.cpp Fri May 14 15:52:41 2010 +0300
@@ -128,9 +128,18 @@
//
void LogsViewManager::changeMatchesView(QString dialpadText)
{
+ LOGS_QDEBUG( "logs [UI] -> LogsViewManager::changeMatchesView()" );
Dialpad* dialpad = mComponentsRepository->dialpad();
dialpad->editor().setText(dialpadText);
- doActivateView(LogsMatchesViewId, true, QVariant());
+ LogsModel* model = mComponentsRepository->model();
+ if ( model && model->predictiveSearchStatus() == logsContactSearchEnabled ){
+ LOGS_QDEBUG( "logs [UI] contact search enabled, go to macthes view" );
+ doActivateView(LogsMatchesViewId, true, QVariant());
+ } else {
+ LOGS_QDEBUG( "logs [UI] contact search disabled, go to recent view" );
+ doActivateView(LogsRecentViewId, true, QVariant());
+ }
+ LOGS_QDEBUG( "logs [UI] <- LogsViewManager::changeMatchesView()" );
}
// -----------------------------------------------------------------------------
--- a/logsui/logsapp/src/main.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/src/main.cpp Fri May 14 15:52:41 2010 +0300
@@ -41,9 +41,9 @@
QTranslator commontranslator;
bool returncode = false;
LOGS_QDEBUG("logs [UI] loading common strings translator");
- returncode = commontranslator.load( path + "common_" + lang + ".qm");
+ returncode = commontranslator.load( path + "common_" + lang);
if (returncode==false) {
- LOGS_QDEBUG("logs [UI] unable to open file: " + path + "common_" + lang + ".qm");
+ LOGS_QDEBUG("logs [UI] unable to open file: " + path + "common_" + lang);
} else {
app.installTranslator(&commontranslator);
}
@@ -51,22 +51,15 @@
//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");
+ LOGS_QDEBUG("logs [UI] translation filename dialer_" + lang);
+ returncode = translator.load( path + "dialer_" + lang);
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);
+ LOGS_QDEBUG( "logs [UI] .qm file not found from " + path);
} else {
- LOGS_QDEBUG( "logs [UI] .qm loaded successfully from "+path);
+ LOGS_QDEBUG( "logs [UI] .qm loaded successfully from " + path);
+ app.installTranslator(&translator);
}
- app.installTranslator(&translator);
HbStyleLoader::registerFilePath(":/logslayouts");
// Create service handler asap so that services are published fast.
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsbaseview.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsbaseview.h Fri May 14 15:52:41 2010 +0300
@@ -58,6 +58,7 @@
void testOpenDialpad();
void testSetDialpadPostion();
void testDialpadClosed();
+ void testDialpadOpened();
void testDialpadEditorTextChanged();
void testChangeFilter();
void testOpenContactsApp();
@@ -79,6 +80,11 @@
void testHandleOrientationChanged();
void testHandleExit();
void testIsExitAllowed();
+ void testAddToContacts();
+ void testSendMessageToCurrentNum();
+ void testDeleteEvent();
+ void testDeleteEventOkAnswer();
+ void testAskConfirmation();
private:
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsdetailsview.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsdetailsview.h Fri May 14 15:52:41 2010 +0300
@@ -58,12 +58,13 @@
void testInitiateVoiceCall();
void testInitiateVideoCall();
void testUpdateMenu();
- void testDeleteEvent();
- void testCopyNumberToClipboard();
+ void testDeleteEventOkAnswer();
void testChangeFilter();
void testContactActionCompleted();
void testModel();
void testUpdateWidgetsSizeAndLayout();
+ void testDialpadEditorTextChanged();
+ void testSendMessage();
private:
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsmatchesview.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsmatchesview.h Fri May 14 15:52:41 2010 +0300
@@ -65,6 +65,7 @@
void testHandleOrientationChanged();
void testUpdateEmptyListWidgetsVisibility();
void testUpdateAddContactButton();
+ void testContactSearch();
private:
--- a/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsrecentcallsview.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/inc/ut_logsrecentcallsview.h Fri May 14 15:52:41 2010 +0300
@@ -79,7 +79,10 @@
void testUpdateWidgetsSizeAndLayout();
void testDialpadClosed();
void testClearList();
+ void testClearListOkAnswer();
void testIsExitAllowed();
+ void testContactSearch();
+ void testDialpadOpened();
private: //helper functions
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsabstractmodel.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsabstractmodel.cpp Fri May 14 15:52:41 2010 +0300
@@ -24,6 +24,7 @@
#include "logsengdefs.h"
#include "logsmessage.h"
+
Q_DECLARE_METATYPE(LogsEvent *)
Q_DECLARE_METATYPE(LogsCall *)
Q_DECLARE_METATYPE(LogsMessage *)
@@ -33,7 +34,8 @@
//
// -----------------------------------------------------------------------------
//
-LogsAbstractModel::LogsAbstractModel() : QAbstractListModel(), mDbConnector(0)
+LogsAbstractModel::LogsAbstractModel() :
+ QAbstractListModel(), mDbConnector(0),mPredectiveSearchStatus(1)
{
LOGS_QDEBUG( "logs [ENG] -> LogsAbstractModel::LogsAbstractModel()" )
@@ -51,6 +53,47 @@
LOGS_QDEBUG( "logs [ENG] <- LogsAbstractModel::~LogsAbstractModel()" )
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsContact* LogsAbstractModel::createContact(const QString& number)
+{
+ return new LogsContact(number);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsAbstractModel::predictiveSearchStatus()
+{
+ return mPredectiveSearchStatus;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsAbstractModel::setPredictiveSearch(bool enabled)
+{
+ int result = 0;
+ if ( mPredectiveSearchStatus == 0 ){
+ result = -5;
+ }
+ else {
+ if ( enabled ){
+ mPredectiveSearchStatus = 1;
+ }
+ else {
+ mPredectiveSearchStatus = 2;
+ }
+ }
+
+ return result;
+}
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsabstractmodel.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsabstractmodel.h Fri May 14 15:52:41 2010 +0300
@@ -25,6 +25,7 @@
class LogsEvent;
class LogsDbConnector;
class LogsModelItemContainer;
+class LogsContact;
/**
* Abstract logs model.
@@ -51,6 +52,30 @@
~LogsAbstractModel();
+
+ /**
+ * Factory method for creating a new contact object. Transfers ownership.
+ */
+ 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
+ */
+ 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);
+
public:
static QString directionIconName(const LogsEvent& event);
@@ -70,6 +95,9 @@
LogsDbConnector* mDbConnector;
+public: // test data
+ int mPredectiveSearchStatus;
+
private:
friend class UT_LogsModel;
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscall.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscall.cpp Fri May 14 15:52:41 2010 +0300
@@ -31,7 +31,7 @@
return logsCallToNumberCalled;
}
-QString LogsCall::lastCalledFuntion()
+QString LogsCall::lastCalledFunction()
{
return logsLastCalledFunction;
}
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscall.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscall.h Fri May 14 15:52:41 2010 +0300
@@ -74,7 +74,7 @@
int mTestLastCallType;
static bool isCallToNumberCalled();
- static QString lastCalledFuntion();
+ static QString lastCalledFunction();
static void resetTestData();
};
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscontact.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscontact.cpp Fri May 14 15:52:41 2010 +0300
@@ -20,6 +20,7 @@
#include "logscontact.h"
//SYSTEM
+static LogsContact::RequestType logstTestRequestType = LogsContact::TypeLogsContactSave;
// -----------------------------------------------------------------------------
//
@@ -51,7 +52,7 @@
//
LogsContact::RequestType LogsContact::allowedRequestType()
{
- return LogsContact::TypeLogsContactSave;
+ return logstTestRequestType;
}
// ----------------------------------------------------------------------------
@@ -80,3 +81,12 @@
{
return false;
}
+
+void LogsContact::setNextRequestType(LogsContact::RequestType type)
+{
+ logstTestRequestType = type;
+}
+void LogsContact::reset()
+{
+ logstTestRequestType = LogsContact::TypeLogsContactSave;
+}
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscontact.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logscontact.h Fri May 14 15:52:41 2010 +0300
@@ -80,7 +80,9 @@
public: //stub data
- //LogsEvent& mEvent;
+ static void setNextRequestType(LogsContact::RequestType type);
+ static void reset();
+
QString mNumber;
};
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsdetailsmodel.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsdetailsmodel.h Fri May 14 15:52:41 2010 +0300
@@ -62,6 +62,7 @@
static QString mLastCallName; //last called exported function name
friend class UT_LogsDetailsView;
+ friend class UT_LogsBaseView;
};
#endif //LOGSDETAILSMODEL_H
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmatchesmodel.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmatchesmodel.cpp Fri May 14 15:52:41 2010 +0300
@@ -81,10 +81,6 @@
return QVariant();
}
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
void LogsMatchesModel::logsMatches( const QString& pattern )
{
Q_UNUSED(pattern);
@@ -95,15 +91,6 @@
//
// -----------------------------------------------------------------------------
//
-LogsContact* LogsMatchesModel::createContact(const QString& number)
-{
- return new LogsContact(number);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
QString LogsMatchesModel::lastCall()
{
return mLastCall;
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmatchesmodel.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmatchesmodel.h Fri May 14 15:52:41 2010 +0300
@@ -35,6 +35,7 @@
class LogsMatchesModel : public LogsAbstractModel
{
//Q_OBJECT
+ friend class UT_LogsMatchesView;
public:
@@ -44,11 +45,7 @@
~LogsMatchesModel();
void logsMatches( const QString& pattern );
-
- /**
- * Factory method for creating a new contact object. Transfers ownership.
- */
- LogsContact* createContact(const QString& number);
+
public: // From QAbstractItemModel
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmessage.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmessage.cpp Fri May 14 15:52:41 2010 +0300
@@ -21,6 +21,7 @@
//SYSTEM
bool logsTestMessageSent = false;
+bool defaultMessageSent = false;
// -----------------------------------------------------------------------------
//
@@ -54,6 +55,7 @@
//
bool LogsMessage::sendMessage()
{
+ defaultMessageSent = true;
return false;
}
@@ -79,7 +81,13 @@
void LogsMessage::resetTestData()
{
logsTestMessageSent = false;
+ defaultMessageSent = false;
}
-
+
+bool LogsMessage::isDefaultMessageSent()
+{
+ return defaultMessageSent;
+}
+
// End of file
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmessage.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmessage.h Fri May 14 15:52:41 2010 +0300
@@ -52,6 +52,7 @@
public: // test helpers
static bool isMessageSent();
static void resetTestData();
+ static bool isDefaultMessageSent();
private:
friend class UT_LogsMessage;
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmodel.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmodel.cpp Fri May 14 15:52:41 2010 +0300
@@ -103,6 +103,7 @@
int LogsModel::refreshData()
{
mRefreshCalled = true;
+ return 0;
}
// -----------------------------------------------------------------------------
@@ -112,6 +113,7 @@
int LogsModel::compressData()
{
mCompressCalled = true;
+ return 0;
}
// -----------------------------------------------------------------------------
@@ -195,3 +197,13 @@
{
mMatchesModelCreated = isCreated;
}
+
+
+// -----------------------------------------------------------------------------
+// LogsModel::updateConfiguration
+// -----------------------------------------------------------------------------
+//
+int LogsModel::updateConfiguration(LogsConfigurationParams& /*params*/)
+{
+ return 0;
+}
--- a/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmodel.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsmodel.h Fri May 14 15:52:41 2010 +0300
@@ -23,6 +23,7 @@
#include <QStringList>
class LogsMatchesModel;
+class LogsConfigurationParams;
/**
*
@@ -31,6 +32,8 @@
{
public:
+ friend class UT_LogsRecentCallsView;
+
enum ClearType {
TypeLogsClearAll = 0,
TypeLogsClearReceived,
@@ -54,6 +57,7 @@
bool markEventsSeen(LogsModel::ClearType cleartype);
int refreshData();
int compressData();
+ int updateConfiguration(LogsConfigurationParams& params);
public: // From QAbstractItemModel
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsbaseview.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsbaseview.cpp Fri May 14 15:52:41 2010 +0300
@@ -25,6 +25,7 @@
#include "logscontact.h"
#include "hbstubs_helper.h"
#include "logsrecentcallsview.h"
+#include "logsdetailsmodel.h"
//SYSTEM
#include <QtTest/QtTest>
@@ -54,6 +55,7 @@
{
mRepository = new LogsComponentRepository( *mViewManager );
mBaseView = new LogsBaseView( LogsRecentViewId, *mRepository, *mViewManager );
+ HbStubHelper::reset();
}
void UT_LogsBaseView::cleanup()
@@ -155,23 +157,38 @@
{
mBaseView->mDialpad->editor().setText( QString("hello") );
mBaseView->dialpadClosed();
- QVERIFY( mBaseView->mDialpad->editor().text().isEmpty() );
+ QVERIFY( !mBaseView->mDialpad->editor().text().isEmpty() );
}
+void UT_LogsBaseView::testDialpadOpened()
+{
+ // Base view impl never goes to matches view as logsModel is null
+ //
+
+ mBaseView->mRepository.model()->setPredictiveSearch(false);
+ mBaseView->mDialpad->editor().setText( QString("hello") );
+ mBaseView->dialpadOpened();
+ QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
+
+ mBaseView->mRepository.model()->setPredictiveSearch(true);
+ mBaseView->dialpadOpened();
+ QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
+
+ mViewManager->reset();
+ mBaseView->mDialpad->editor().setText( "" );
+ mBaseView->dialpadOpened();
+ QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
+}
void UT_LogsBaseView::testDialpadEditorTextChanged()
-{
- //text editor is one character long
- mBaseView->mDialpad->editor().setText( QString("h") );
- mBaseView->dialpadEditorTextChanged();
- QVERIFY( mViewManager->mViewId == LogsMatchesViewId );
-
+{
+ // View does not change if contact search is off
mViewManager->reset();
- mBaseView->mDialpad->mIsCallButtonEnabled = true;
- mBaseView->mDialpad->editor().setText( QString("") );
+ mBaseView->mDialpad->editor().setText( QString("2") );
+ mBaseView->mRepository.model()->setPredictiveSearch(false);
mBaseView->dialpadEditorTextChanged();
QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
- QVERIFY( !mBaseView->mDialpad->mIsCallButtonEnabled );
+ QVERIFY( mBaseView->mDialpad->mIsCallButtonEnabled );
}
void UT_LogsBaseView::testChangeFilter()
@@ -203,7 +220,7 @@
//call can't be created
QVERIFY( !mBaseView->mCall );
mBaseView->initiateCallback(QModelIndex());
- QVERIFY( LogsCall::lastCalledFuntion().isEmpty() );
+ QVERIFY( LogsCall::lastCalledFunction().isEmpty() );
//call can be created should be tested in derived class
}
@@ -214,12 +231,12 @@
//no call
QVERIFY( !mBaseView->mCall );
mBaseView->initiateCall(LogsCall::TypeLogsVoiceCall);
- QVERIFY( LogsCall::lastCalledFuntion().isEmpty() );
+ QVERIFY( LogsCall::lastCalledFunction().isEmpty() );
//call exists
mBaseView->mCall = new LogsCall();
mBaseView->initiateCall(LogsCall::TypeLogsVideoCall);
- QVERIFY( LogsCall::lastCalledFuntion() == QString("call") );
+ QVERIFY( LogsCall::lastCalledFunction() == QString("call") );
QVERIFY( mBaseView->mCall->mTestLastCallType == LogsCall::TypeLogsVideoCall );
}
@@ -432,3 +449,86 @@
{
QVERIFY( mBaseView->isExitAllowed() );
}
+
+void UT_LogsBaseView::testAddToContacts()
+{
+ // Has dialpad input, contact is saved with that num
+ mBaseView->mDialpad->mIsOpen = true;
+ mBaseView->mDialpad->mLineEdit->setText("3344");
+ mBaseView->addToContacts();
+ QVERIFY( mBaseView->mContact->mNumber == "3344" );
+
+ // No dialpad input, contact saved using list item if such exists
+ mBaseView->mDialpad->mIsOpen = false;
+ mBaseView->mContact->mNumber = "1234";
+ mBaseView->addToContacts();
+ QVERIFY( mBaseView->mContact->mNumber == "1234" );
+
+ // No contact at all
+ delete mBaseView->mContact;
+ mBaseView->mContact = 0;
+ mBaseView->addToContacts();
+ QVERIFY( !mBaseView->mContact );
+}
+
+void UT_LogsBaseView::testSendMessageToCurrentNum()
+{
+ // No input
+ LogsMessage::resetTestData();
+ mBaseView->mDialpad->mIsOpen = false;
+ mBaseView->mDialpad->mLineEdit->setText("");
+ mBaseView->sendMessageToCurrentNum();
+ QVERIFY( !LogsMessage::isMessageSent() );
+
+ // Input
+ mBaseView->mDialpad->mIsOpen = true;
+ mBaseView->mDialpad->mLineEdit->setText("4546626262");
+ mBaseView->sendMessageToCurrentNum();
+ QVERIFY( LogsMessage::isMessageSent() );
+}
+
+void UT_LogsBaseView::testDeleteEvent()
+{
+ // No model, nothing happens
+ QVERIFY( !HbStubHelper::dialogShown() );
+ QVERIFY( !mBaseView->mDetailsModel );
+ mBaseView->deleteEvent();
+ QVERIFY( !HbStubHelper::dialogShown() );
+
+ // Model exists, confirmation dialog is shown
+ mViewManager->reset();
+ LogsDetailsModel* model = new LogsDetailsModel();
+ mBaseView->mDetailsModel = model;
+ mBaseView->deleteEvent();
+ QVERIFY( HbStubHelper::dialogShown() );
+}
+
+void UT_LogsBaseView::testDeleteEventOkAnswer()
+{
+ // No model, nothing happens
+ QVERIFY( LogsDetailsModel::mLastCallName.isEmpty() );
+ QVERIFY( !mBaseView->mDetailsModel );
+ mBaseView->deleteEventOkAnswer();
+ QVERIFY( LogsDetailsModel::mLastCallName.isEmpty() );
+
+ // Model exists, call to delete event made and view is closed
+ mViewManager->reset();
+ LogsDetailsModel* model = new LogsDetailsModel();
+ mBaseView->mDetailsModel = model;
+ mBaseView->deleteEventOkAnswer();
+ QVERIFY( LogsDetailsModel::mLastCallName == QLatin1String("clearEvent") );
+ QVERIFY( !mViewManager->mPreviousActivated );
+}
+
+void UT_LogsBaseView::testAskConfirmation()
+{
+ // No receiver and slots specified
+ mBaseView->askConfirmation(QLatin1String("heading"), QLatin1String("text"), 0);
+ QVERIFY( HbStubHelper::dialogShown() );
+
+ // Receiver and slots specified
+ HbStubHelper::reset();
+ mBaseView->askConfirmation(QLatin1String("heading"), QLatin1String("text"), this,
+ SLOT(""), SLOT(""));
+ QVERIFY( HbStubHelper::dialogShown() );
+}
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsdetailsview.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsdetailsview.cpp Fri May 14 15:52:41 2010 +0300
@@ -23,6 +23,7 @@
#include "logscall.h"
#include "logsmessage.h"
#include "logsdefs.h"
+#include "logscontact.h"
//SYSTEM
#include <QtTest/QtTest>
@@ -198,40 +199,46 @@
QVERIFY( voiceCallAction->isVisible() );
QVERIFY( videoCallAction->isVisible() );
QVERIFY( messageAction->isVisible() );
+
+ // Input in dialpad, add to contacts visible and voice call invisible
+ LogsContact::setNextRequestType(LogsContact::TypeLogsContactOpen);
+ mDetailsView->mDialpad->mIsOpen = true;
+ mDetailsView->mDialpad->editor().setText( QString("3443535") );
+ mDetailsView->updateMenu();
+ HbAction* addToContactsAction = qobject_cast<HbAction*>(
+ mRepository->findObject( logsCommonAddToContactsMenuActionId ) );
+ HbAction* openContactAction = qobject_cast<HbAction*>(
+ mRepository->findObject( logsDetailsOpenContactMenuActionId ) );
+ QVERIFY( addToContactsAction->isVisible() );
+ QVERIFY( !openContactAction->isVisible() );
+ QVERIFY( !voiceCallAction->isVisible() );
+
+ // No input in dialpad, open contact visible and voice call visible
+ mDetailsView->mDialpad->mIsOpen = false;
+ mDetailsView->updateMenu();
+ QVERIFY( !addToContactsAction->isVisible() );
+ QVERIFY( openContactAction->isVisible() );
+ QVERIFY( voiceCallAction->isVisible() );
+ LogsContact::reset();
}
-void UT_LogsDetailsView::testDeleteEvent()
+void UT_LogsDetailsView::testDeleteEventOkAnswer()
{
// No model, nothing happens
QVERIFY( LogsDetailsModel::mLastCallName.isEmpty() );
QVERIFY( !mDetailsView->mDetailsModel );
- mDetailsView->deleteEvent();
+ mDetailsView->deleteEventOkAnswer();
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") );
+ mDetailsView->deleteEventOkAnswer();
+ QVERIFY( LogsDetailsModel::mLastCallName == QLatin1String("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();
@@ -287,3 +294,48 @@
QVERIFY( mDetailsView->mListView->layoutName() == logsListDefaultLayout );
QVERIFY( mDetailsView->mLayoutSectionName == logsViewLandscapeDialpadSection );
}
+
+void UT_LogsDetailsView::testDialpadEditorTextChanged()
+{
+ //text editor is one character long
+ LogsDetailsModel* model = new LogsDetailsModel();
+ mDetailsView->mDetailsModel = model;
+ mDetailsView->mDetailsModel->setPredictiveSearch(true);
+ mDetailsView->mDialpad->editor().setText( QString("h") );
+ mDetailsView->dialpadEditorTextChanged();
+ QVERIFY( mViewManager->mViewId == LogsMatchesViewId );
+
+ mViewManager->reset();
+ mDetailsView->mDialpad->mIsCallButtonEnabled = true;
+ mDetailsView->mDialpad->editor().setText( QString("") );
+ mDetailsView->dialpadEditorTextChanged();
+ QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
+ QVERIFY( !mDetailsView->mDialpad->mIsCallButtonEnabled );
+
+ // View does not change if contact search is off
+ mViewManager->reset();
+ mDetailsView->mDialpad->editor().setText( QString("2") );
+ mDetailsView->mDetailsModel->setPredictiveSearch(false);
+ mDetailsView->dialpadEditorTextChanged();
+ QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
+ QVERIFY( mDetailsView->mDialpad->mIsCallButtonEnabled );
+}
+
+void UT_LogsDetailsView::testSendMessage()
+{
+ // No input, message sent using orig message
+ LogsMessage::resetTestData();
+ LogsMessage* message = new LogsMessage;
+ mDetailsView->mMessage = message;
+ mDetailsView->sendMessage();
+ QVERIFY( LogsMessage::isDefaultMessageSent() );
+ QVERIFY( !LogsMessage::isMessageSent() );
+
+ // Message sent using input field num
+ LogsMessage::resetTestData();
+ mDetailsView->mDialpad->mIsOpen = true;
+ mDetailsView->mDialpad->editor().setText( QString("3443535") );
+ mDetailsView->sendMessage();
+ QVERIFY( !LogsMessage::isDefaultMessageSent() );
+ QVERIFY( LogsMessage::isMessageSent() );
+}
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmatchesview.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmatchesview.cpp Fri May 14 15:52:41 2010 +0300
@@ -145,7 +145,8 @@
mMatchesView->callKeyPressed();
QVERIFY( !LogsCall::isCallToNumberCalled() );
- // No any item where to call, but dial string exists
+ // No any item where to call, but dial string exists and dialpad is open
+ mMatchesView->mDialpad->mIsOpen = true;
QString dial("12345");
mMatchesView->mDialpad->editor().setText( dial );
mMatchesView->callKeyPressed();
@@ -157,14 +158,28 @@
mMatchesView->mModel->mTextData.append("testdata2");
mMatchesView->callKeyPressed();
QVERIFY( LogsCall::isCallToNumberCalled() );
+
+ // If dialpad is closed and matches exist, call is made to first item in list
+ mMatchesView->mDialpad->mIsOpen = false;
+ LogsCall::resetTestData();
+ mMatchesView->callKeyPressed();
+ QVERIFY( !LogsCall::isCallToNumberCalled() );
+ QVERIFY( LogsCall::lastCalledFunction() == "initiateCallback" );
}
void UT_LogsMatchesView::testVideoCallToCurrentNum()
{
+ // Dialpad not open, and no matches, not calling
+ mMatchesView->mDialpad->mIsOpen = false;
LogsCall::resetTestData();
QString dial("12345");
mMatchesView->mDialpad->editor().setText( dial );
mMatchesView->videoCallToCurrentNum();
+ QVERIFY( !LogsCall::isCallToNumberCalled() );
+
+ // Dialpad open, calling video call to num
+ mMatchesView->mDialpad->mIsOpen = true;
+ mMatchesView->videoCallToCurrentNum();
QVERIFY( LogsCall::isCallToNumberCalled() );
}
@@ -175,9 +190,16 @@
mMatchesView->sendMessageToCurrentNum();
QVERIFY( !LogsMessage::isMessageSent() );
+ // Not sent as dialpad is closed
+ mMatchesView->mDialpad->mIsOpen = false;
QString dial("12345");
mMatchesView->mDialpad->editor().setText( dial );
mMatchesView->sendMessageToCurrentNum();
+ QVERIFY( !LogsMessage::isMessageSent() );
+
+ // Sent as dialpad is opened
+ mMatchesView->mDialpad->mIsOpen = true;
+ mMatchesView->sendMessageToCurrentNum();
QVERIFY( LogsMessage::isMessageSent() );
}
@@ -389,3 +411,25 @@
delete mMatchesView->mAddToContactsButton;
mMatchesView->mAddToContactsButton = 0;
}
+
+void UT_LogsMatchesView::testContactSearch()
+{
+ LogsMatchesView* view = mRepository->matchesView();
+ LogsDbConnector* dbConnector = 0;
+ LogsMatchesModel* model1 = new LogsMatchesModel(*dbConnector);
+ QVariant arg = qVariantFromValue( model1 );
+ view->activated( true, arg );
+ int status = view->mModel->predictiveSearchStatus();
+ QVERIFY( status == 1 );
+
+ //set contact search off, view changes and dialpad content is not cleared
+ mMatchesView->mDialpad->editor().setText( "1234" );
+ mViewManager->reset();
+ view->toggleContactSearch();
+ status = view->mModel->predictiveSearchStatus();
+ QVERIFY( status == 2 );
+ QVERIFY( mViewManager->mViewId == LogsRecentViewId );
+ QVERIFY( mMatchesView->mDialpad->editor().text() == "1234" );
+
+}
+
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsrecentcallsview.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsrecentcallsview.cpp Fri May 14 15:52:41 2010 +0300
@@ -149,7 +149,7 @@
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->mDialpad->editor().text().isEmpty() );
QVERIFY( view->mListView->layoutName() == logsListLandscapeLayout );
QVERIFY( view->mLayoutSectionName == logsViewDefaultSection );
QVERIFY( !view->mResetted );
@@ -272,31 +272,59 @@
// Call cannot be constructed in model
QModelIndex filterIndex;
mRecentCallsView->initiateCallback(filterIndex);
- QVERIFY( LogsCall::lastCalledFuntion().isEmpty() );
+ QVERIFY( LogsCall::lastCalledFunction().isEmpty() );
// Call can be constructed in model
filterIndex = makeValidFilterIndex(*mRecentCallsView);
mRecentCallsView->initiateCallback(filterIndex);
- QVERIFY( LogsCall::lastCalledFuntion() == QString("initiateCallback") );
+ QVERIFY( LogsCall::lastCalledFunction() == QString("initiateCallback") );
}
void UT_LogsRecentCallsView::testCallKeyPressed()
-{ LogsRecentCallsView* view = mRepository->recentCallsView();
+{
+ LogsRecentCallsView* view = mRepository->recentCallsView();
// Not ready for calling
+ LogsCall::resetTestData();
view->callKeyPressed();
+ QVERIFY( LogsCall::lastCalledFunction() != "initiateCallback" );
// No any item where to call
+ LogsCall::resetTestData();
view->activated( false, QVariant(LogsServices::ViewAll) );
view->callKeyPressed();
+ QVERIFY( LogsCall::lastCalledFunction() != "initiateCallback" );
- // Calling possible
+ // Calling possible to list item
+ LogsCall::resetTestData();
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 );
+ QVERIFY( LogsCall::lastCalledFunction() == "initiateCallback" );
+
+ // Dialpad open but no input, call to first item in list
+ LogsCall::resetTestData();
+ view->mDialpad->mIsOpen = true;
+ view->callKeyPressed();
+ QVERIFY( LogsCall::lastCalledFunction() == "initiateCallback" );
+
+ // Dialpad open and text in input, call to number in input field
+ LogsCall::resetTestData();
+ QString dial("12345");
+ view->mDialpad->editor().setText( dial );
+ view->callKeyPressed();
+ QVERIFY( LogsCall::isCallToNumberCalled() );
+ QVERIFY( LogsCall::lastCalledFunction() != "initiateCallback" );
+
+ // Dialpad closed but contains text, call to first item in the list
+ LogsCall::resetTestData();
+ view->mDialpad->mIsOpen = false;
+ view->callKeyPressed();
+ QVERIFY( !LogsCall::isCallToNumberCalled() );
+ QVERIFY( LogsCall::lastCalledFunction() == "initiateCallback" );
}
void UT_LogsRecentCallsView::testShowCallDetails()
@@ -664,16 +692,28 @@
QObject* obj = mRepository->findObject( logsRecentViewClearListMenuActionId );
HbAction* action = qobject_cast<HbAction*>( obj );
QVERIFY(action && action->isVisible());
+ HbAction* addToContactsAction = qobject_cast<HbAction*>(
+ mRepository->findObject( logsCommonAddToContactsMenuActionId ) );
+ HbAction* contactsSearchAction = qobject_cast<HbAction*>(
+ mRepository->findObject( logsRecentViewContactSearchMenuActionId ) );
+ QVERIFY(addToContactsAction && addToContactsAction->isVisible());
delete view->mFilter;
view->mFilter = 0;
view->mFilter = new LogsFilter();
view->updateMenu();
QVERIFY(action && !action->isVisible());
+ QVERIFY(addToContactsAction && !addToContactsAction->isVisible());
+ QVERIFY(contactsSearchAction && !contactsSearchAction->isVisible());
- //menu is in repository, non-empty model => "Clear list" is visible
+ //menu is in repository, non-empty model and dialpad open with content =>
+ // "Clear list", "Add to contacts", "Contact search on/off" visible
+ view->mDialpad->editor().setText("233141");
+ view->mDialpad->mIsOpen = true;
makeValidFilterIndex(*view);
view->updateMenu();
QVERIFY(action && action->isVisible());
+ QVERIFY(addToContactsAction && addToContactsAction->isVisible());
+ QVERIFY(contactsSearchAction && contactsSearchAction->isVisible());
}
@@ -696,16 +736,29 @@
QVERIFY( !mRecentCallsView->mListView );
mRecentCallsView->updateWidgetsSizeAndLayout();
+
+ //listView exists, layout and size updated, also menu is updated
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 );
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ view->mViewManager.mainWindow().setOrientation( Qt::Vertical );
+ view->mDialpad->closeDialpad();
+ view->mListView = &list;
+ view->mListView->setLayoutName("dummy");
+ view->mLayoutSectionName = "dummy";
+ view->updateWidgetsSizeAndLayout();
+ QVERIFY( view->mListView->layoutName() == logsListDefaultLayout );
+ QVERIFY( view->mLayoutSectionName == logsViewDefaultSection );
+ QVERIFY( view->mListView->layoutName() == logsListDefaultLayout );
+ QObject* obj = mRepository->findObject( logsCommonMessageMenuActionId );
+ HbAction* action = qobject_cast<HbAction*>( obj );
+ QVERIFY(action && !action->isVisible());
+
+ // When dialpad is opened and has input, menu content is different
+ view->mDialpad->openDialpad();
+ QString hello("hello");
+ view->mDialpad->editor().setText( hello );
+ view->updateWidgetsSizeAndLayout();
+ QVERIFY(action && action->isVisible());
}
void UT_LogsRecentCallsView::testDialpadClosed()
@@ -719,31 +772,36 @@
QString hello("hello");
mRecentCallsView->mDialpad->editor().setText( hello );
mRecentCallsView->dialpadClosed();
- QVERIFY( mRecentCallsView->mDialpad->editor().text().isEmpty() );
+ QVERIFY( !mRecentCallsView->mDialpad->editor().text().isEmpty() );
QVERIFY( mRecentCallsView->mLayoutSectionName == logsViewDefaultSection );
}
void UT_LogsRecentCallsView::testClearList()
{
+ // No filter, nothing happens
+ HbStubHelper::reset();
+ QVERIFY( !HbStubHelper::dialogShown() );
+ mRecentCallsView->clearList();
+ QVERIFY( !HbStubHelper::dialogShown() );
- //check that without filter list is not cleared
- mRecentCallsView->mModel->mIsCleared = false;
- HbMessageBox().setText(tr("Ok"));
- mRecentCallsView->clearList();
- QVERIFY( !mRecentCallsView->mModel->mIsCleared );
-
+ // Filter exists, confirmation dialog is shown
mRecentCallsView->mFilter = new LogsFilter( LogsFilter::Missed );
-
- //simulate "Ok" button press of messagebox
- HbMessageBox().setText(tr("Ok"));
mRecentCallsView->clearList();
- QVERIFY( mRecentCallsView->mModel->mIsCleared );
+ QVERIFY( HbStubHelper::dialogShown() );
+
+}
- //simulate "Cancel" button press of messagebox
+void UT_LogsRecentCallsView::testClearListOkAnswer()
+{
+ // No filter ,list is not cleared
mRecentCallsView->mModel->mIsCleared = false;
- HbMessageBox().setText(tr("Cancel"));
- mRecentCallsView->clearList();
+ mRecentCallsView->clearListOkAnswer();
QVERIFY( !mRecentCallsView->mModel->mIsCleared );
+
+ // Filter exists, list is cleared
+ mRecentCallsView->mFilter = new LogsFilter( LogsFilter::Missed );
+ mRecentCallsView->clearListOkAnswer();
+ QVERIFY( mRecentCallsView->mModel->mIsCleared );
}
void UT_LogsRecentCallsView::testIsExitAllowed()
@@ -771,3 +829,78 @@
QVERIFY( spy.count() == 1 );
QVERIFY( mRecentCallsView->isExitAllowed() );
}
+
+void UT_LogsRecentCallsView::testContactSearch()
+{
+ int status = mRecentCallsView->mModel->predictiveSearchStatus();
+ QVERIFY( status == 1 );
+ LogsRecentCallsView* view = mRepository->recentCallsView();
+ view->mDialpad->mIsOpen = true;
+ view->mDialpad->editor().setText( "12344" );
+ view->updateMenu();
+ status = view->mModel->predictiveSearchStatus();
+ QVERIFY( status == 1 );
+ QObject* obj = mRepository->findObject( logsRecentViewContactSearchMenuActionId );
+ HbAction* action = qobject_cast<HbAction*>( obj );
+ QVERIFY(action && action->isVisible());
+ QVERIFY(action->text()== hbTrId("txt_dialer_ui_opt_contact_search_off"));
+
+ //set contact search off
+ view->toggleContactSearch();
+ status = view->mModel->predictiveSearchStatus();
+ QVERIFY( status == 2 );
+ obj = mRepository->findObject( logsRecentViewContactSearchMenuActionId );
+ action = qobject_cast<HbAction*>( obj );
+ QVERIFY(action && action->isVisible());
+ QVERIFY(action->text()== hbTrId("txt_dialer_ui_opt_contact_search_on"));
+
+ //set contact search on
+ view->toggleContactSearch();
+ status = view->mModel->predictiveSearchStatus();
+ QVERIFY( status == 1 );
+
+ //set contact search permanently off
+ view->mModel->mPredectiveSearchStatus = 0;
+ view->toggleContactSearch();
+ status = view->mModel->predictiveSearchStatus();
+ QVERIFY( status == 0 );
+ view->updateMenu();
+ obj = mRepository->findObject( logsRecentViewContactSearchMenuActionId );
+ action = qobject_cast<HbAction*>( obj );
+ QVERIFY(action && !action->isVisible());
+
+ view->mModel->mPredectiveSearchStatus = 2;
+ //set contact search on
+ view->toggleContactSearch();
+ status = view->mModel->predictiveSearchStatus();
+ QVERIFY( status == 1 );
+
+}
+
+void UT_LogsRecentCallsView::testDialpadOpened()
+{
+ mRepository->recentCallsView();
+ mRecentCallsView->activated( false, QVariant(LogsServices::ViewAll) );
+
+ // If contact search is disabled, opening dialpad containing input
+ // does not cause going to matches view
+ mViewManager->reset();
+ mRecentCallsView->mDialpad->mIsOpen = true;
+ mRecentCallsView->mModel->setPredictiveSearch(false);
+ mRecentCallsView->mDialpad->editor().setText( QString("hello") );
+ mRecentCallsView->dialpadOpened();
+ QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
+
+ // If contact search is enabled, opening dialpad containing input
+ // causes going to matches view
+ mRecentCallsView->mModel->setPredictiveSearch(true);
+ mRecentCallsView->dialpadOpened();
+ QVERIFY( mViewManager->mViewId == LogsMatchesViewId );
+
+ // Nothing in input field, doe not cause transition to matches view
+ // causes going to matches view
+ mViewManager->reset();
+ mRecentCallsView->mDialpad->editor().setText( "" );
+ mRecentCallsView->dialpadOpened();
+ QVERIFY( mViewManager->mViewId == LogsUnknownViewId );
+}
--- a/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsviewmanager.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/src/ut_logsviewmanager.cpp Fri May 14 15:52:41 2010 +0300
@@ -111,6 +111,12 @@
mLogsViewManager->changeMatchesView(QString("+123456"));
QVERIFY( mLogsViewManager->mMainWindow.currentView() ==
mLogsViewManager->mComponentsRepository->matchesView() );
+
+ // Contact search disabled, go to recent calls view instead
+ mLogsViewManager->mComponentsRepository->mModel->mPredectiveSearchStatus = 0;
+ mLogsViewManager->changeMatchesView(QString("+123456777"));
+ QVERIFY( mLogsViewManager->mMainWindow.currentView() ==
+ mLogsViewManager->mComponentsRepository->recentCallsView() );
}
void UT_LogsViewManager::testExitApplication()
--- a/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp Fri May 14 15:52:41 2010 +0300
@@ -28,7 +28,8 @@
int actionCount = 0;
Qt::Orientation windowOrientation = Qt::Vertical;
-bool logsMenuShown = false;
+bool testMenuShown = false;
+bool testDialogShown = false;
HbMainWindow* testWindow = 0;
HbView* testView = 0;
int testViewCount = 0;
@@ -43,10 +44,11 @@
void HbStubHelper::reset()
{
actionCount = 0;
- logsMenuShown = false;
+ testMenuShown = false;
testSingleShotTimer = false;
testQuitCalled = false;
testIsWidgetRaised = false;
+ testDialogShown = false;
}
@@ -58,9 +60,15 @@
bool HbStubHelper::menuShown()
{
- return logsMenuShown;
+ return testMenuShown;
}
+bool HbStubHelper::dialogShown()
+{
+ return testDialogShown;
+}
+
+
bool HbStubHelper::singleShotTimerActive()
{
return testSingleShotTimer;
@@ -139,21 +147,25 @@
//
// -----------------------------------------------------------------------------
//
-HbAction *HbMenu::exec(const QPointF &pos, HbAction *action )
+void HbMenu::open(QObject *receiver, const char *member)
{
- Q_UNUSED(action)
- Q_UNUSED(pos)
- logsMenuShown = true;
- return 0;
+ Q_UNUSED(receiver)
+ Q_UNUSED(member)
+ testMenuShown = true;
}
-HbAction *HbMenu::exec(HbAction *action)
+void HbDialog::open(QObject *receiver, const char *member)
{
- Q_UNUSED(action)
- logsMenuShown = true;
- return 0;
+ Q_UNUSED(receiver)
+ Q_UNUSED(member)
+ testDialogShown = true;
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
void QGraphicsWidget::addAction(QAction *action)
{
Q_UNUSED(action)
@@ -193,26 +205,6 @@
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)
--- a/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs_helper.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs_helper.h Fri May 14 15:52:41 2010 +0300
@@ -27,6 +27,7 @@
static void reset();
static int widgetActionsCount();
static bool menuShown();
+ static bool dialogShown();
static bool singleShotTimerActive();
static bool quitCalled();
static void setGestureState(int state);
--- a/logsui/logsapp/tsrc/ut_logsapp/ut_logsapp.pro Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/ut_logsapp.pro Fri May 14 15:52:41 2010 +0300
@@ -58,6 +58,8 @@
HEADERS += ../../inc/logseffecthandler.h
HEADERS += ../../inc/logspageindicator.h
HEADERS += ../../inc/logspageindicatoritem.h
+#HEADERS += ../../../logsengine/inc/logscommondata.h
+HEADERS += ../../../logsengine/inc/logsconfigurationparams.h
HEADERS += inc/ut_logsservicehandler.h
HEADERS += logsengine_stub/logscontact.h
HEADERS += logsengine_stub/logsforegroundwatcher.h
@@ -81,6 +83,7 @@
SOURCES += logsengine_stub/logscontact.cpp
SOURCES += logsengine_stub/logsmatchesmodel.cpp
SOURCES += logsengine_stub/logsforegroundwatcher.cpp
+SOURCES += ../../../logsengine/src/logsconfigurationparams.cpp
SOURCES += src/ut_logsbaseview.cpp
SOURCES += src/ut_logsrecentcallsview.cpp
SOURCES += src/ut_logsdetailsview.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/inc/logscntentry.h Fri May 14 15:52:41 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef LOGSCNTENTRY_H
+#define LOGSCNTENTRY_H
+
+#include <logscntfinderexport.h>
+#include <QObject>
+#include <QList>
+#include <QString>
+
+
+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;}
+ 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 );
+ void doSetHighlights( const QString& pattern, LogsCntTextList& nameArray );
+ void resetHighlights( LogsCntTextList& nameArray );
+ bool doSimpleMatch( const QString& pattern ) const;
+ bool doComplexMatch( QStringList patternArray ) 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;
+
+
+#endif //LOGSCNTENTRY_H
--- a/logsui/logscntfinder/inc/logscntfinder.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/inc/logscntfinder.h Fri May 14 15:52:41 2010 +0300
@@ -24,100 +24,14 @@
#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:
+#include "logscntentry.h"
- 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
@@ -199,12 +113,14 @@
void addResult( LogsCntEntry* entry );
void updateResult( LogsCntEntry* entry );
bool isProgressivePattern( const QString& pattern ) const;
+ void setCurrentPattern( const QString& pattern );
private:
QString mCurrentPredictivePattern;
+ QString mCurrentInputPattern;
LogsCntEntryList mResults;
QContactManager* mContactManager;
LogsCntEntryList mHistoryEvents;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/inc/logspredictive12keytranslator.h Fri May 14 15:52:41 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 LOGSPREDICTIVE12KEYTRANSLATOR_H
+#define LOGSPREDICTIVE12KEYTRANSLATOR_H
+
+#include <QObject>
+#include <QChar>
+#include <QHash>
+
+#include "logspredictivetranslator.h"
+
+
+/**
+ * abstract translator for ITU-T 12 keys keyboard
+ *
+ */
+class LogsPredictive12KeyTranslator : public LogsPredictiveTranslator
+{
+
+public:
+
+ explicit LogsPredictive12KeyTranslator();
+ ~LogsPredictive12KeyTranslator();
+
+public: //from LogsPredictiveTranslator
+
+ QStringList patternTokens( const QString& pattern ) const;
+ int hasPatternSeparators( const QString& pattern ) const;
+ const QChar translateChar( const QChar character ) const;
+
+private:
+
+ void padWithZeros( QString& token, const QString& source, int padIndex ) const;
+
+
+private:
+
+ friend class UT_LogsPredictive12KeyTranslator;
+
+};
+
+#endif //LOGSPREDICTIVE12KEYTRANSLATOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/inc/logspredictivelatin12keytranslator.h Fri May 14 15:52:41 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 LOGSPREDICTIVELATIN12KEYTRANSLATOR_H
+#define LOGSPREDICTIVELATIN12KEYTRANSLATOR_H
+
+#include <QObject>
+#include <QChar>
+#include <QHash>
+
+#include "logspredictive12keytranslator.h"
+
+
+/**
+ * translator for Latin ITU-T 12 keys keyboard
+ *
+ */
+class LogsPredictiveLatin12KeyTranslator : public LogsPredictive12KeyTranslator
+{
+
+public:
+
+ explicit LogsPredictiveLatin12KeyTranslator();
+ ~LogsPredictiveLatin12KeyTranslator();
+
+public: //from LogsPredictiveTranslator
+
+ QStringList nameTokens( const QString& name ) const;
+
+public: //from LogsPredictive12KeyTranslator
+
+ const QChar translateChar( const QChar character ) const;
+
+
+private:
+
+ QHash<QChar,QChar> mSpecialKeyMap;
+ friend class UT_LogsPredictiveLatin12KeyTranslator;
+
+};
+
+#endif //LOGSPREDICTIVELATIN12KEYTRANSLATOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/inc/logspredictivethai12keytranslator.h Fri May 14 15:52:41 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 LOGSPREDICTIVETHAI12KEYTRANSLATOR_H
+#define LOGSPREDICTIVETHAI12KEYTRANSLATOR_H
+
+#include <QObject>
+#include <QChar>
+#include <QHash>
+
+#include "logspredictive12keytranslator.h"
+
+class HbKeymap;
+
+
+/**
+ * translator for Thai ITU-T 12 keys keyboard
+ *
+ */
+class LogsPredictiveThai12KeyTranslator : public LogsPredictive12KeyTranslator
+{
+
+public:
+
+ explicit LogsPredictiveThai12KeyTranslator();
+ ~LogsPredictiveThai12KeyTranslator();
+
+public: //from LogsPredictiveTranslator
+
+ const QChar translateChar( const QChar character ) const;
+ QStringList nameTokens( const QString& name ) const;
+
+private:
+
+ bool isIgnored( const QChar character ) const;
+
+private:
+
+ friend class UT_LogsPredictiveThai12KeyTranslator;
+
+};
+
+#endif //LOGSPREDICTIVETHAI12KEYTRANSLATOR_H
--- a/logsui/logscntfinder/inc/logspredictivetranslator.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/inc/logspredictivetranslator.h Fri May 14 15:52:41 2010 +0300
@@ -30,8 +30,6 @@
class LogsPredictiveTranslator : public QObject
{
- Q_OBJECT
-
public:
static LogsPredictiveTranslator* instance();
@@ -40,20 +38,27 @@
~LogsPredictiveTranslator();
const QString translate( const QString& name, int count = -1 ) const;
- int startsWith( const QString& text, const QString& pattern, bool optimize = true ) const;
+ int startsWith( const QString& text, const QString& pattern,
+ bool optimize = true ) const;
+public: //abstracts
-private:
-
+ virtual QStringList nameTokens( const QString& name ) const = 0;
+ virtual QStringList patternTokens( const QString& pattern ) const = 0;
+ virtual int hasPatternSeparators( const QString& pattern ) const = 0;
+ virtual const QChar translateChar( const QChar character ) const = 0;
+
+protected:
+
explicit LogsPredictiveTranslator();
- const QChar translate( const QChar character ) const;
+
+protected:
+ const HbKeymap* mKeyMap;
private:
static LogsPredictiveTranslator* mInstance;
- const HbKeymap* mKeyMap;
-
friend class UT_LogsPredictiveTranslator;
};
--- a/logsui/logscntfinder/logscntfinder.pro Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/logscntfinder.pro Fri May 14 15:52:41 2010 +0300
@@ -29,11 +29,19 @@
# Input
HEADERS += inc/logscntfinder.h
+HEADERS += inc/logscntentry.h
HEADERS += inc/logspredictivetranslator.h
+HEADERS += inc/logspredictive12keytranslator.h
+HEADERS += inc/logspredictivelatin12keytranslator.h
+HEADERS += inc/logspredictivethai12keytranslator.h
# Input
SOURCES += src/logscntfinder.cpp
+SOURCES += src/logscntentry.cpp
SOURCES += src/logspredictivetranslator.cpp
+SOURCES += src/logspredictive12keytranslator.cpp
+SOURCES += src/logspredictivelatin12keytranslator.cpp
+SOURCES += src/logspredictivethai12keytranslator.cpp
# stub Input. comment out from real lib
#SOURCES += tsrc/stubs/qtcontacts_stubs.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/src/logscntentry.cpp Fri May 14 15:52:41 2010 +0300
@@ -0,0 +1,417 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <QStringList>
+#include <QVector>
+
+#include "logscntentry.h"
+#include "logspredictivetranslator.h"
+#include "logslogger.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( 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::setPhoneNumber()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::setPhoneNumber( const QString& number )
+{
+ LogsPredictiveTranslator* translator = LogsPredictiveTranslator::instance();
+
+ mCached=true;
+ mPhoneNumber.mText = number;
+ mPhoneNumber.mTranslatedText = translator->translate( mPhoneNumber.mText );
+
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsCntEntry::doSetText()
+// -----------------------------------------------------------------------------
+//
+void LogsCntEntry::doSetText( const QString& text, LogsCntTextList& textlist )
+{
+ LogsPredictiveTranslator* translator = LogsPredictiveTranslator::instance();
+
+ QListIterator<QString> iter( translator->nameTokens( text ) );
+
+ while( iter.hasNext() ) {
+ LogsCntText txt;
+ txt.mText = iter.next();
+ txt.mTranslatedText = translator->translate( txt.mText );
+ textlist.append( txt );
+ }
+ if ( textlist.count() == 0 ) {
+ textlist.append( LogsCntText() );
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// 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.mTranslatedText.startsWith( pattern ) &&
+ mPhoneNumber.mTranslatedText.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 hasSeparators = translator->hasPatternSeparators( pattern );
+
+ //simple
+ while( names.hasNext() ) {
+ LogsCntText& nameItem = names.next();
+ nameItem.mHighlights =
+ translator->startsWith( nameItem.mText, pattern, false );
+ }
+
+ //complex
+ QListIterator<QString> patternArray( translator->patternTokens( pattern ) );
+ while( hasSeparators && patternArray.hasNext() ) {
+ QString patternItem = patternArray.next();
+ names.toFront();
+ while( names.hasNext() ) {
+ LogsCntText& nameItem = names.next();
+ int matchSize = translator->startsWith( nameItem.mText,
+ patternItem, !hasSeparators );
+ 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;
+ LogsPredictiveTranslator* translator = LogsPredictiveTranslator::instance();
+
+ //direct match with phone number is enough
+ match = ( type() == EntryTypeHistory &&
+ mPhoneNumber.mTranslatedText.startsWith( pattern ) ) ||
+ doSimpleMatch( pattern );
+
+ match = !match && translator->hasPatternSeparators( pattern ) ?
+ doComplexMatch( translator->patternTokens( pattern) ) : match;
+
+ 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;
+}
+
+
+
--- a/logsui/logscntfinder/src/logscntfinder.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/src/logscntfinder.cpp Fri May 14 15:52:41 2010 +0300
@@ -15,446 +15,20 @@
*
*/
-#include <QListIterator>
-
#include <qcontactdetailfilter.h>
#include <qcontactphonenumber.h>
#include <qcontactname.h>
#include <qcontactmanager.h>
#include <qcontactavatar.h>
-#include <QVector>
+#include "logscntentry.h"
#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()
@@ -511,7 +85,7 @@
//"" -> XXX not progressive
//XX -> YY not progressive
//XXX -> YY not progressive
- int prevPatternLen = mCurrentPredictivePattern.length();
+ int prevPatternLen = mCurrentInputPattern.length();
return prevPatternLen > 0 &&
pattern.length() - prevPatternLen > 0;
}
@@ -538,21 +112,26 @@
mCachedCounter == resultsCount();
bool nothingToDo = resultsCount() == 0 &&
patternIsProgressive;
-
+ int patternSeparators =
+ LogsPredictiveTranslator::instance()->hasPatternSeparators(
+ mCurrentInputPattern );
+ bool doCacheQuery = patternSeparators != mCurrentInputPattern.length() &&
+ ( ( patternIsProgressive && resultsAreAllCached ) || nothingToDo );
+
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 )
+ LOGS_QDEBUG_2( "logs [FINDER] patternSeparators = ", patternSeparators )
+ LOGS_QDEBUG_2( "logs [FINDER] doCacheQuery = ", doCacheQuery )
- mCurrentPredictivePattern = pattern;
+ setCurrentPattern( pattern );
if ( mCurrentPredictivePattern.isEmpty() ) {
qDeleteAll( mResults );
mResults.clear();
mCachedCounter = 0;
- } else if ( ( patternIsProgressive &&
- resultsAreAllCached ) ||
- nothingToDo ) {
+ } else if ( doCacheQuery ) {
doPredictiveCacheQuery();
} else {
mCachedCounter = 0;
@@ -598,7 +177,7 @@
QContactDetailFilter df;
df.setDetailDefinitionName( QContactName::DefinitionName );
df.setMatchFlags( QContactFilter::MatchKeypadCollation );
- df.setValue( mCurrentPredictivePattern );
+ df.setValue( mCurrentInputPattern );
QList<QContactLocalId> cntIds;
LOGS_QDEBUG( "logs [FINDER] about to call contacts manager" )
@@ -685,6 +264,20 @@
// -----------------------------------------------------------------------------
+// LogsCntFinder::setCurrentPattern()
+// -----------------------------------------------------------------------------
+//
+void LogsCntFinder::setCurrentPattern( const QString& pattern )
+{
+ LogsPredictiveTranslator* translator =
+ LogsPredictiveTranslator::instance();
+
+ mCurrentInputPattern = pattern;
+ mCurrentPredictivePattern = translator->translate( mCurrentInputPattern );
+
+}
+
+// -----------------------------------------------------------------------------
// LogsCntFinder::resultsCount
// -----------------------------------------------------------------------------
//
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/src/logspredictive12keytranslator.cpp Fri May 14 15:52:41 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 <QObject>
+#include <QLocale>
+#include <QHash>
+#include <hbinputkeymapfactory.h>
+#include <hbinputkeymap.h>
+#include <hbinputsettingproxy.h>
+
+#include "logspredictive12keytranslator.h"
+#include "logslogger.h"
+
+const QChar ZeroSepar('0');
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictive12KeyTranslator::LogsPredictive12KeyTranslator()
+// -----------------------------------------------------------------------------
+//
+LogsPredictive12KeyTranslator::LogsPredictive12KeyTranslator()
+ : LogsPredictiveTranslator()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsPredictive12KeyTranslator::\
+LogsPredictive12KeyTranslator()" )
+ LOGS_QDEBUG( "logs [FINDER] <- LogsPredictive12KeyTranslator::\
+LogsPredictive12KeyTranslator()" )
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsPredictive12KeyTranslator::~LogsPredictive12KeyTranslator()
+// -----------------------------------------------------------------------------
+//
+LogsPredictive12KeyTranslator::~LogsPredictive12KeyTranslator()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsPredictive12KeyTranslator::\
+~LogsPredictive12KeyTranslator()" )
+ LOGS_QDEBUG( "logs [FINDER] <- LogsPredictive12KeyTranslator::\
+~LogsPredictive12KeyTranslator()" )
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsPredictive12KeyTranslator::LogsPredictive12KeyTranslator()
+// -----------------------------------------------------------------------------
+//
+QStringList LogsPredictive12KeyTranslator::patternTokens( const QString& pattern ) const
+{
+ QStringList target = pattern.split( ZeroSepar, QString::SkipEmptyParts );
+ if ( target.length() > 1 ) {
+ QString& first = target[0];
+ QString& last = target[target.length()-1];
+ padWithZeros( first, pattern, 0 );
+ padWithZeros( last, pattern, last.length() );
+ } else if ( target.length() == 0 ) {
+ target.append( ZeroSepar );
+ }
+ return target;
+}
+
+// -----------------------------------------------------------------------------
+// LogsPredictive12KeyTranslator::hasPatternSeparators()
+// -----------------------------------------------------------------------------
+//
+int LogsPredictive12KeyTranslator::hasPatternSeparators(
+ const QString& pattern ) const
+{
+ return pattern.count( ZeroSepar );
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsPredictive12KeyTranslator::translateChar()
+// -----------------------------------------------------------------------------
+//
+const QChar LogsPredictive12KeyTranslator::translateChar(
+ const QChar character ) const
+{
+ const HbMappedKey* mappedKey =
+ mKeyMap->keyForCharacter( HbKeyboardVirtual12Key, character );
+ return mappedKey ? mappedKey->keycode : QChar();
+}
+
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictive12KeyTranslator::padWithLeadingZeros()
+// -----------------------------------------------------------------------------
+//
+void LogsPredictive12KeyTranslator::padWithZeros( QString& token,
+ const QString& source, int padIndex ) const
+{
+ const QChar* content = source.data();
+ int index = !padIndex ? 0 : source.length()-1;
+
+ while( index >= 0 && index < source.length() ) {
+ if ( content[ index ] == ZeroSepar ) {
+ token.insert( padIndex, ZeroSepar );
+ index = !padIndex ? index+1 : index-1;
+ } else {
+ index = -1;
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/src/logspredictivelatin12keytranslator.cpp Fri May 14 15:52:41 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <QHash>
+#include <hbinputkeymapfactory.h>
+#include <hbinputkeymap.h>
+#include <hbinputsettingproxy.h>
+
+#include "logspredictivelatin12keytranslator.h"
+#include "logslogger.h"
+
+//mapping char,key(name)
+const QChar SpecialMapping[] = {'+', '*', '*', '*','#','#'};
+const int SpecialsCount = 3;
+const QChar SpaceSepar(' ');
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveLatin12KeyTranslator::LogsPredictiveLatin12KeyTranslator()
+// -----------------------------------------------------------------------------
+//
+LogsPredictiveLatin12KeyTranslator::LogsPredictiveLatin12KeyTranslator()
+ : LogsPredictive12KeyTranslator()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsPredictiveLatin12KeyTranslator::\
+LogsPredictiveLatin12KeyTranslator()" )
+ HbInputLanguage lang =
+ HbInputSettingProxy::instance()->globalInputLanguage();
+ mKeyMap = HbKeymapFactory::instance()->keymap( lang.language(),
+ lang.variant() );
+
+ int index = 0;
+ int arraySize = SpecialsCount * 2;
+ while( index < arraySize ) {
+ QChar character = SpecialMapping[ index++ ];
+ QChar keycode = SpecialMapping[ index++ ];
+ mSpecialKeyMap[ character ] = keycode;
+ }
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveLatin12KeyTranslator::\
+LogsPredictiveLatin12KeyTranslator()" )
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveLatin12KeyTranslator::~LogsPredictiveLatin12KeyTranslator()
+// -----------------------------------------------------------------------------
+//
+LogsPredictiveLatin12KeyTranslator::~LogsPredictiveLatin12KeyTranslator()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsPredictiveLatin12KeyTranslator::\
+~LogsPredictiveLatin12KeyTranslator()" )
+ mSpecialKeyMap.clear();
+ LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveLatin12KeyTranslator::\
+~LogsPredictiveLatin12KeyTranslator()" )
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveLatin12KeyTranslator::translateChar()
+// -----------------------------------------------------------------------------
+//
+const QChar LogsPredictiveLatin12KeyTranslator::translateChar(
+ const QChar character ) const
+{
+ QChar keycode = mSpecialKeyMap[ character ];
+ if ( keycode.isNull() ) {
+ keycode = LogsPredictive12KeyTranslator::translateChar( character );
+ if ( keycode.isNull() ) {
+ QString decomposed = character.decomposition();
+ if (decomposed.isEmpty()) {
+ return keycode;
+ }
+ return translateChar (decomposed.at(0));
+ }
+ }
+ return keycode;
+}
+
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveLatin12KeyTranslator::nameTokens()
+// -----------------------------------------------------------------------------
+//
+QStringList LogsPredictiveLatin12KeyTranslator::nameTokens(
+ const QString& name ) const
+{
+ return name.split( SpaceSepar, QString::SkipEmptyParts );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/src/logspredictivethai12keytranslator.cpp Fri May 14 15:52:41 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "logspredictivethai12keytranslator.h"
+#include "logslogger.h"
+
+const QChar IgnoreList[] = {'*', '#' };
+const int IgnoreCount = 2;
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveThai12KeyTranslator::LogsPredictiveThai12KeyTranslator()
+// -----------------------------------------------------------------------------
+//
+LogsPredictiveThai12KeyTranslator::LogsPredictiveThai12KeyTranslator()
+ : LogsPredictive12KeyTranslator()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsPredictiveThai12KeyTranslator::\
+LogsPredictiveThai12KeyTranslator()" )
+ HbInputLanguage lang =
+ HbInputSettingProxy::instance()->globalInputLanguage();
+ ASSERT( lang.language() == QLocale::Thai );
+ mKeyMap = HbKeymapFactory::instance()->keymap( lang.language(),
+ lang.variant() );
+
+
+ LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveThai12KeyTranslator::\
+LogsPredictiveThai12KeyTranslator()" )
+}
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveThai12KeyTranslator::~LogsPredictiveThai12KeyTranslator()
+// -----------------------------------------------------------------------------
+//
+LogsPredictiveThai12KeyTranslator::~LogsPredictiveThai12KeyTranslator()
+{
+ LOGS_QDEBUG( "logs [FINDER] -> LogsPredictiveThai12KeyTranslator::\
+~LogsPredictiveThai12KeyTranslator()" )
+ LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveThai12KeyTranslator::\
+~LogsPredictiveThai12KeyTranslator()" )
+
+}
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveThai12KeyTranslator::translateChar()
+// -----------------------------------------------------------------------------
+//
+const QChar LogsPredictiveThai12KeyTranslator::translateChar(
+ const QChar character ) const
+{
+ QChar keycode;
+ if ( !isIgnored( character ) ) {
+ keycode = LogsPredictive12KeyTranslator::translateChar( character );
+ keycode = !keycode.isNull() && !isIgnored( keycode ) ?
+ keycode : QChar();
+ }
+ return keycode;
+}
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveThai12KeyTranslator::nameTokens()
+// -----------------------------------------------------------------------------
+//
+QStringList LogsPredictiveThai12KeyTranslator::nameTokens(
+ const QString& name ) const
+{
+ return QStringList( name );
+}
+
+
+
+// -----------------------------------------------------------------------------
+// LogsPredictiveThai12KeyTranslator::isIgnored()
+// -----------------------------------------------------------------------------
+//
+bool LogsPredictiveThai12KeyTranslator::isIgnored( const QChar character ) const
+{
+ bool found = false;
+ int index = 0;
+ while( index < IgnoreCount && !found ) {
+ found = IgnoreList[ index++ ] == character;
+ }
+ return found;
+}
+
+
+
+
+
--- a/logsui/logscntfinder/src/logspredictivetranslator.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/src/logspredictivetranslator.cpp Fri May 14 15:52:41 2010 +0300
@@ -16,11 +16,13 @@
*/
#include <QObject>
#include <QLocale>
-#include <hbinputkeymapfactory.h>
-#include <hbinputkeymap.h>
+#include <QHash>
#include <hbinputsettingproxy.h>
+#include <QStringList>
#include "logspredictivetranslator.h"
+#include "logspredictivelatin12keytranslator.h"
+#include "logspredictivethai12keytranslator.h"
#include "logslogger.h"
LogsPredictiveTranslator* LogsPredictiveTranslator::mInstance = 0;
@@ -33,7 +35,16 @@
LogsPredictiveTranslator* LogsPredictiveTranslator::instance()
{
if ( !mInstance ) {
- mInstance = new LogsPredictiveTranslator();
+ HbInputLanguage lang =
+ HbInputSettingProxy::instance()->globalInputLanguage();
+ switch( lang.language() ) {
+ case QLocale::Thai:
+ mInstance = new LogsPredictiveThai12KeyTranslator();
+ break;
+ default:
+ mInstance = new LogsPredictiveLatin12KeyTranslator();
+ break;
+ }
}
return mInstance;
}
@@ -57,11 +68,6 @@
{
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()" )
}
@@ -76,6 +82,7 @@
LOGS_QDEBUG( "logs [FINDER] -> LogsPredictiveTranslator::\
~LogsPredictiveTranslator()" )
mInstance = 0;
+ mKeyMap = 0;
LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveTranslator::\
~LogsPredictiveTranslator()" )
@@ -85,25 +92,6 @@
// 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
{
@@ -114,10 +102,13 @@
QString result;
const QChar* content = name.data();
int index = 0;
- while( index < name.length() && index < count ) {
- result.insert( index++, translate( *content++ ) );
+ while( index < count ) {
+ QChar ch = translateChar( *content++ );
+ if ( !ch.isNull() ) {
+ result.append( ch );
+ }
+ index++;
}
-
LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveTranslator::translate()" )
return result;
}
@@ -141,7 +132,7 @@
QString translatedText = translate( text, pattern.length() );
matchCount = translatedText == pattern ? matchCount : 0;
} else {
- matchCount = translate( *text.data() ) == *pattern.data() ?
+ matchCount = translateChar( *text.data() ) == *pattern.data() ?
matchCount : 0;
}
}
--- a/logsui/logscntfinder/tsrc/stubs/qtcontacts_stubs.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/tsrc/stubs/qtcontacts_stubs.cpp Fri May 14 15:52:41 2010 +0300
@@ -80,6 +80,7 @@
void ContactQueryResults::reset()
{
mDB.clear();
+ mQuery.clear();
}
@@ -203,8 +204,11 @@
{
}
-void QContactDetailFilter::setValue(const QVariant& /*value*/)
+void QContactDetailFilter::setValue(const QVariant& value )
{
+ ContactQueryResults* resultSet = ContactQueryResults::instance();
+ resultSet->filterValueSet( value.toString() );
+
}
QVariant QContactDetailFilter::value() const
--- a/logsui/logscntfinder/tsrc/stubs/qtcontacts_stubs.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/tsrc/stubs/qtcontacts_stubs.h Fri May 14 15:52:41 2010 +0300
@@ -39,6 +39,8 @@
const QString& lastNameAt( int index ) const;
int contacts() const;
inline void allResultsAdded() {emit resultsAdded();}
+ inline void filterValueSet( const QString& value ) { mQuery = value;}
+ inline const QString& query() { return mQuery; }
signals:
@@ -53,7 +55,7 @@
static ContactQueryResults* mInstance;
QStringList mDB;
-
+ QString mQuery;
};
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logscntentry.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logscntentry.h Fri May 14 15:52:41 2010 +0300
@@ -18,6 +18,7 @@
#define UT_LOGSCNTENTRY_H
#include <QObject>
+#include <hbinputlanguage.h>
class LogsCntEntry;
@@ -46,17 +47,23 @@
void testConstructor();
void testSetName();
- void testSetHighlights();
+ void testSetPhoneNumber();
void testSetAvatarPath();
- void testRichText();
- void testSetPhoneNumber();
void testSetSpeedDial();
- void testMatch();
+ //with latin 12 keys
+ void testSetHighlights_latin12k();
+ void testRichText_latin12k();
+ void testMatch_latin12k();
+ //with thai 12 keys
+ void testMatch_thai12k();
+ void testSetHighlights_thai12k();
private:
LogsCntEntry* mEntry;
+ HbInputLanguage mOrigLang;
+
};
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logscntfinder.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logscntfinder.h Fri May 14 15:52:41 2010 +0300
@@ -46,11 +46,12 @@
private slots: //test methods
void testConstructor();
- void testPredictiveSearchQuery();
- void testResultAt();
void testInsertEntry();
void testDeleteEntry();
void testGetEntry();
+ //with latin 12 keys
+ void testPredictiveSearchQuery_latin12k();
+ void testResultAt_latin12k();
private:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logspredictive12keytranslator.h Fri May 14 15:52:41 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_LOGSPREDICTIV12KEYTRANSLATOR_H
+#define UT_LOGSPREDICTIV12KEYTRANSLATOR_H
+
+#include <QObject>
+#include <hbinputlanguage.h>
+
+class LogsPredictive12KeyTranslator;
+
+class UT_LogsPredictive12KeyTranslator : 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 testPatternTokens();
+ void testHasPatternSeparators();
+ void testTranslateChar();
+
+private:
+
+ LogsPredictive12KeyTranslator* mTranslator;
+ HbInputLanguage mOrigLang;
+
+};
+
+
+#endif //UT_LOGSPREDICTIV12KEYTRANSLATOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logspredictivelatin12keytranslator.h Fri May 14 15:52:41 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_LOGSPREDICTIVELATIN12KEYTRANSLATOR_H
+#define UT_LOGSPREDICTIVELATIN12KEYTRANSLATOR_H
+
+#include <QObject>
+
+class LogsPredictiveLatin12KeyTranslator;
+
+class UT_LogsPredictiveLatin12KeyTranslator : 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();
+
+private:
+
+ LogsPredictiveLatin12KeyTranslator* mTranslator;
+};
+
+
+#endif //UT_LOGSPREDICTIVELATIN12KEYTRANSLATOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logspredictivethai12keytranslator.h Fri May 14 15:52:41 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_LOGSPREDICTIVETHAI12KEYTRANSLATOR_H
+#define UT_LOGSPREDICTIVETHAI12KEYTRANSLATOR_H
+
+#include <QObject>
+#include <hbinputlanguage.h>
+
+class LogsPredictiveThai12KeyTranslator;
+
+class UT_LogsPredictiveThai12KeyTranslator : 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();
+
+private:
+
+ HbInputLanguage mOrigLang;
+ LogsPredictiveThai12KeyTranslator* mTranslator;
+};
+
+
+#endif //UT_LOGSPREDICTIVETHAI12KEYTRANSLATOR_H
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logspredictivetranslator.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/inc/ut_logspredictivetranslator.h Fri May 14 15:52:41 2010 +0300
@@ -18,6 +18,7 @@
#define UT_LOGSPREDICTIVETRANSLATOR_H
#include <QObject>
+#include <hbinputlanguage.h>
class LogsPredictiveTranslator;
@@ -46,12 +47,12 @@
void testConstructor();
void testTranslate();
- void testTranslateChar();
- void testStartsWith();
+ void testStartsWith();
private:
- LogsPredictiveTranslator* mTranslator;
+ HbInputLanguage mOrigLang;
+ LogsPredictiveTranslator* mTranslator;
};
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/src/main.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/main.cpp Fri May 14 15:52:41 2010 +0300
@@ -20,11 +20,24 @@
#include "ut_logscntfinder.h"
#include "ut_logspredictivetranslator.h"
+#include "ut_logspredictive12keytranslator.h"
+#include "ut_logspredictivelatin12keytranslator.h"
+#include "ut_logspredictivethai12keytranslator.h"
#include "ut_logscntentry.h"
#include "testresultxmlparser.h"
+#define UTEST_CLASS( tc )\
+ tc tc##_instance;\
+ QStringList tc##_args( #tc );\
+ resultFileName = QString("c:/") + QString( #tc ) + QString(".xml");\
+ tc##_args << "-xml" << "-o" << resultFileName;\
+ QTest::qExec(&tc##_instance, tc##_args);\
+ parser.parseAndPrintResults(resultFileName,true)
+
+
+
int main(int argc, char *argv[])
{
bool promptOnExit(true);
@@ -42,27 +55,14 @@
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);
+ QString resultFileName;
- 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);
+ UTEST_CLASS( UT_LogsPredictiveTranslator );
+ UTEST_CLASS( UT_LogsPredictive12KeyTranslator );
+ UTEST_CLASS( UT_LogsPredictiveLatin12KeyTranslator );
+ UTEST_CLASS( UT_LogsPredictiveThai12KeyTranslator );
+ UTEST_CLASS( UT_LogsCntEntry );
+ UTEST_CLASS( UT_LogsCntFinder );
if (promptOnExit) {
printf("Press any key...\n");
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logscntentry.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logscntentry.cpp Fri May 14 15:52:41 2010 +0300
@@ -14,19 +14,28 @@
* Description:
*
*/
+#include <hbinputsettingproxy.h>
+
#include "ut_logscntentry.h"
-#include "logscntfinder.h"
+#include "logscntentry.h"
#include "logspredictivetranslator.h"
#include <QtTest/QtTest>
+#define PATTERN( pattern )\
+ LogsPredictiveTranslator::instance()->translate( QString( pattern ) )
+
void UT_LogsCntEntry::initTestCase()
{
+ mOrigLang = HbInputSettingProxy::instance()->globalInputLanguage();
+
}
void UT_LogsCntEntry::cleanupTestCase()
{
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( mOrigLang );
+
}
@@ -40,6 +49,8 @@
delete mEntry;
mEntry = 0;
LogsPredictiveTranslator::deleteInstance();
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( mOrigLang );
+
}
void UT_LogsCntEntry::testConstructor()
@@ -53,7 +64,7 @@
QVERIFY( mEntry->avatarPath() == QString("") );
QVERIFY( mEntry->handle() == 0 );
QVERIFY( mEntry->speedDial() == QString("") );
-
+
mEntry->setFirstName( QString( "foo" ));
mEntry->setLastName( QString( "bar" ));
@@ -65,6 +76,7 @@
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->phoneNumber().mTranslatedText == mEntry->phoneNumber().mTranslatedText );
QVERIFY( e->mHandle == mEntry->mHandle );
QVERIFY( e->speedDial() == mEntry->speedDial() );
@@ -129,17 +141,17 @@
}
-void UT_LogsCntEntry::testSetHighlights()
+void UT_LogsCntEntry::testSetHighlights_latin12k()
{
-
- mEntry->setHighlights( QString( "665" ) );
+
+ mEntry->setHighlights( PATTERN("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" ) );
+ mEntry->setHighlights( PATTERN( "665" ) );
QVERIFY( mEntry->firstName()[0].text() == QString( "Nokia" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 3 );
QVERIFY( mEntry->lastName()[0].text() == QString( "Test" ) );
@@ -149,7 +161,7 @@
mEntry->setFirstName( QString( "Jim" ) );
mEntry->setLastName( QString( "Johnson" ) );
- mEntry->setHighlights( QString( "5" ) );
+ mEntry->setHighlights( PATTERN( "5" ) );
QVERIFY( mEntry->firstName()[0].text() == QString( "Jim" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1 );
QVERIFY( mEntry->lastName()[0].text() == QString( "Johnson" ) );
@@ -158,7 +170,7 @@
mEntry->setFirstName( QString( "Big Jim" ) );
mEntry->setLastName( QString( "Johnson" ) );
- mEntry->setHighlights( QString( "5" ) );
+ mEntry->setHighlights( PATTERN( "5" ) );
QVERIFY( mEntry->firstName()[0].text() == QString( "Big" ) );
QVERIFY( mEntry->firstName()[1].text() == QString( "Jim" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 0 );
@@ -168,44 +180,44 @@
mEntry->setFirstName( QString( "John" ) );
mEntry->setLastName( QString( "Johnson" ) );
- mEntry->setHighlights( QString( "5646" ) );
+ mEntry->setHighlights( PATTERN( "5646" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 4 );
QVERIFY( mEntry->lastName()[0].highlights() == 4);
- mEntry->setHighlights( QString( "56467" ) );
+ mEntry->setHighlights( PATTERN( "56467" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 0 );
QVERIFY( mEntry->lastName()[0].highlights() == 5);
- mEntry->setHighlights( QString( "505" ) );
+ mEntry->setHighlights( PATTERN( "505" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->lastName()[0].highlights() == 1);
- mEntry->setHighlights( QString( "506" ) );//entry is not a match
+ mEntry->setHighlights( PATTERN( "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" ) );
+ mEntry->setHighlights( PATTERN( "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" ) );
+ mEntry->setHighlights( PATTERN( "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" ) );
+ mEntry->setHighlights( PATTERN( "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" ) );
+ mEntry->setHighlights( PATTERN( "50502" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 1);
QVERIFY( mEntry->firstName()[2].highlights() == 1);
@@ -214,114 +226,199 @@
mEntry->setFirstName( QString( "Big John" ) );
mEntry->setLastName( QString( "Johnson" ) );
- mEntry->setHighlights( QString( "2056" ) );
+ mEntry->setHighlights( PATTERN( "2056" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 2);
QVERIFY( mEntry->lastName()[0].highlights() == 2);
- mEntry->setHighlights( QString( "5602" ) );
+ mEntry->setHighlights( PATTERN( "5602" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 2);
QVERIFY( mEntry->lastName()[0].highlights() == 2);
- mEntry->setHighlights( QString( "564602" ) );
+ mEntry->setHighlights( PATTERN( "564602" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 4);
QVERIFY( mEntry->lastName()[0].highlights() == 4);
- mEntry->setHighlights( QString( "5646702" ) );
+ mEntry->setHighlights( PATTERN( "5646702" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 0);
QVERIFY( mEntry->lastName()[0].highlights() == 5);
- mEntry->setHighlights( QString( "5646" ) );
+ mEntry->setHighlights( PATTERN( "5646" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 0);
QVERIFY( mEntry->firstName()[1].highlights() == 4);
QVERIFY( mEntry->lastName()[0].highlights() == 4);
- mEntry->setHighlights( QString( "50" ) );
+ mEntry->setHighlights( PATTERN( "50" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 0);
QVERIFY( mEntry->firstName()[1].highlights() == 1);
QVERIFY( mEntry->lastName()[0].highlights() == 1);
- mEntry->setHighlights( QString( "05" ) );
+ mEntry->setHighlights( PATTERN( "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" ) );
+ mEntry->setHighlights( PATTERN( "05" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 2);
QVERIFY( mEntry->lastName()[0].highlights() == 0);
- mEntry->setHighlights( QString( "0506" ) );
+ mEntry->setHighlights( PATTERN( "0506" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 0);
QVERIFY( mEntry->firstName()[1].highlights() == 2);
QVERIFY( mEntry->lastName()[0].highlights() == 1);
- mEntry->setHighlights( QString( "506" ) );
+ mEntry->setHighlights( PATTERN( "506" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 0);
QVERIFY( mEntry->lastName()[0].highlights() == 1);
- mEntry->setHighlights( QString( "5060" ) );
+ mEntry->setHighlights( PATTERN( "5060" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 1);
QVERIFY( mEntry->firstName()[1].highlights() == 0);
QVERIFY( mEntry->lastName()[0].highlights() == 0);
- mEntry->setHighlights( QString( "05060" ) );
+ mEntry->setHighlights( PATTERN( "05060" ) );
QVERIFY( mEntry->firstName()[0].highlights() == 0);
QVERIFY( mEntry->firstName()[1].highlights() == 2);
QVERIFY( mEntry->lastName()[0].highlights() == 0);
- mEntry->setHighlights( QString( "050506" ) );
+ mEntry->setHighlights( PATTERN( "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" ) );
+ mEntry->setHighlights( PATTERN( "+12" ) );
QVERIFY( mEntry->phoneNumber().mHighlights == 3 );
mEntry->setPhoneNumber( QString( "1234567" ) );
QVERIFY( mEntry->phoneNumber().text() == QString( "1234567" ) );
- mEntry->setHighlights( QString( "+12" ) );
+ mEntry->setHighlights( PATTERN( "+12" ) );
QVERIFY( mEntry->phoneNumber().mHighlights == 0 );
- mEntry->setHighlights( QString( "12" ) );
+ mEntry->setHighlights( PATTERN( "12" ) );
QVERIFY( mEntry->phoneNumber().mHighlights == 2 );
mEntry->setFirstName( QString( "Alice 028 Ming" ) );
- mEntry->setHighlights( QString( "028" ) );
+ mEntry->setHighlights( PATTERN( "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);
+ mEntry->setFirstName( QString( "Alice +Ming" ) );
+
+ mEntry->setHighlights( PATTERN( "+6" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "#6" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "*6" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "16" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setFirstName( QString( "Alice M*ing" ) );
+ mEntry->setHighlights( PATTERN( "6+" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "6*" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "6#" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setFirstName( QString( "Alice M-ing" ) );
+ mEntry->setHighlights( PATTERN( "6+" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "6*" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "6#" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "61" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setFirstName( QString( "Alice M#ing" ) );
+ mEntry->setHighlights( PATTERN( "6+" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "6*" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "6#" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "61" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 0);
+ QVERIFY( mEntry->firstName()[1].highlights() == 0);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
}
void UT_LogsCntEntry::testSetPhoneNumber()
{
+ QString empty("");
+
mEntry->setPhoneNumber( QString( "1234567" ) );
QVERIFY( mEntry->phoneNumber().text() == QString( "1234567" ) );
- QVERIFY( mEntry->phoneNumber().mTranslatedText == QString( "" ) );
+ QVERIFY( mEntry->phoneNumber().mTranslatedText != empty );
QVERIFY( mEntry->phoneNumber().mHighlights == 0 );
mEntry->setPhoneNumber( QString( "+1234567" ) );
QVERIFY( mEntry->phoneNumber().text() == QString( "+1234567" ) );
+ QVERIFY( mEntry->phoneNumber().mTranslatedText != empty );
mEntry->setPhoneNumber( QString( "#1234567" ) );
QVERIFY( mEntry->phoneNumber().text() == QString( "#1234567" ) );
+ QVERIFY( mEntry->phoneNumber().mTranslatedText != empty );
mEntry->setPhoneNumber( QString( "*1234567" ) );
QVERIFY( mEntry->phoneNumber().text() == QString( "*1234567" ) );
+ QVERIFY( mEntry->phoneNumber().mTranslatedText != empty );
mEntry->setPhoneNumber( QString( "*12+345#67" ) );
QVERIFY( mEntry->phoneNumber().text() == QString( "*12+345#67" ) );
+ QVERIFY( mEntry->phoneNumber().mTranslatedText != empty );
}
@@ -339,11 +436,11 @@
}
-void UT_LogsCntEntry::testRichText()
+void UT_LogsCntEntry::testRichText_latin12k()
{
mEntry->setFirstName( QString( "John" ) );
- mEntry->setHighlights( QString( "5" ) );
+ mEntry->setHighlights( PATTERN( "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" ) );
@@ -355,13 +452,13 @@
QVERIFY( mEntry->firstName()[0].richText() == QString( "" ) );
mEntry->setPhoneNumber( QString( "1234567" ) );
- mEntry->setHighlights( QString( "5" ) );
+ mEntry->setHighlights( PATTERN( "5" ) );
QVERIFY( mEntry->phoneNumber().mHighlights == 0 );
QVERIFY( mEntry->phoneNumber().text() == QString( "1234567" ) );
QVERIFY( mEntry->phoneNumber().richText() == QString( "1234567" ) );
- mEntry->setHighlights( QString( "1" ) );
+ mEntry->setHighlights( PATTERN( "1" ) );
QVERIFY( mEntry->phoneNumber().mHighlights == 1 );
QVERIFY( mEntry->phoneNumber().text() == QString( "1234567" ) );
@@ -369,25 +466,26 @@
}
-void UT_LogsCntEntry::testMatch()
+void UT_LogsCntEntry::testMatch_latin12k()
{
+
mEntry->mType = LogsCntEntry::EntryTypeHistory;
mEntry->setFirstName( QString( "John" ) );
- QVERIFY( mEntry->match( QString( "5" ) ) );
- QVERIFY( !mEntry->match( QString( "6" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "5" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "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" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "6" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "5" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "2" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "56" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "566" ) ) );
mEntry->setPhoneNumber( QString( "5669876566" ) );
- QVERIFY( mEntry->match( QString( "566" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "566" ) ) );
// - zero cases -
@@ -395,93 +493,199 @@
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
+ QVERIFY( !mEntry->match( PATTERN( "00" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "202" ) ) );//match not John and match not Malkovich match phone
+ QVERIFY( !mEntry->match( PATTERN( "507" ) ) );//match John and match not Malkovich
+ QVERIFY( !mEntry->match( PATTERN( "206" ) ) );//match not John and macth Malkovich
+ QVERIFY( mEntry->match( PATTERN( "506" ) ) );//match John and macth Malkovich
+ QVERIFY( mEntry->match( PATTERN( "605" ) ) );//match John and macth Malkovich
+ QVERIFY( !mEntry->match( PATTERN( "505" ) ) );//match John "two times"
+ QVERIFY( mEntry->match( PATTERN( "60005" ) ) );//match John and match Malkovich
+ QVERIFY( !mEntry->match( PATTERN( "6000500" ) ) );//match John and match Malkovich
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
+ QVERIFY( mEntry->match( PATTERN( "202" ) ) );//match not John and match not Malkovich match phone
+ QVERIFY( !mEntry->match( PATTERN( "507" ) ) );//match John and match not Malkovich
+ QVERIFY( !mEntry->match( PATTERN( "206" ) ) );//match not John and macth Malkovich
+ QVERIFY( mEntry->match( PATTERN( "506" ) ) );//match John and macth Malkovich
+ QVERIFY( mEntry->match( PATTERN( "605" ) ) );//match John and macth Malkovich
+ QVERIFY( !mEntry->match( PATTERN( "505" ) ) );//match John "two times"
+ QVERIFY( mEntry->match( PATTERN( "60005" ) ) );//match John and match Malkovich
+ QVERIFY( !mEntry->match( PATTERN( "6000500" ) ) );//match John and match Malkovich
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
+ QVERIFY( mEntry->match( PATTERN( "202" ) ) );//match not John and match not Malkovich match phone
+ QVERIFY( !mEntry->match( PATTERN( "507" ) ) );//match John and match not Malkovich
+ QVERIFY( !mEntry->match( PATTERN( "206" ) ) );//match not John and macth Malkovich
+ QVERIFY( mEntry->match( PATTERN( "506" ) ) );//match John and macth Malkovich
+ QVERIFY( mEntry->match( PATTERN( "605" ) ) );//match John and macth Malkovich
+ QVERIFY( !mEntry->match( PATTERN( "505" ) ) );//match John "two times"
+ QVERIFY( mEntry->match( PATTERN( "60005" ) ) );//match John and match Malkovich
+ QVERIFY( !mEntry->match( PATTERN( "6000500" ) ) );//match John and match Malkovich
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
+ QVERIFY( mEntry->match( PATTERN( "50607" ) ) );//match John and match Malkovich match Peter
+ QVERIFY( mEntry->match( PATTERN( "506" ) ) );//match John and macth Malkovich match ignore Peter
+ QVERIFY( !mEntry->match( PATTERN( "50608" ) ) );//match John and match Malkovich match not Peter
+ QVERIFY( !mEntry->match( PATTERN( "5060702" ) ) );//match John and match Malkovich match Peter + no match extra
+ QVERIFY( !mEntry->match( PATTERN( "5060706" ) ) );//match John and match Malkovich match Peter + macth extra
mEntry->setFirstName( QString( "John Kalkovich" ) );
mEntry->setLastName( QString( "" ) );
- QVERIFY( mEntry->match( QString( "505" ) ) );//match John and match Kalkovich
+ QVERIFY( mEntry->match( PATTERN( "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
+ QVERIFY( mEntry->match( PATTERN( "50605" ) ) );//match John and match Malkovich and match John
+ QVERIFY( mEntry->match( PATTERN( "506" ) ) );//match Johns and macth Malkovich
+ QVERIFY( !mEntry->match( PATTERN( "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" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "50605" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "505" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "5" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "05" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0505" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0505" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "05005" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "6005" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "05050" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "00505" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "005050" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "0506" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "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( PATTERN( "+202" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "#202" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "*202" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "202" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "+202#98" ) ) );
+
+ QVERIFY( mEntry->match( PATTERN( "50" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "05" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "506" ) ) );
+
+ mEntry->setFirstName( QString( "John" ) );
+ mEntry->setLastName( QString( "#Malkovich" ) );
+ QVERIFY( mEntry->match( PATTERN( "5" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "6" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "506" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "#6" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "+6" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "16" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "*6" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "50#6" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "5016" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "50*6" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "50+6" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "+" ) ) );//phone
+ QVERIFY( mEntry->match( PATTERN( "*" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "#" ) ) );
+
+ mEntry->setFirstName( QString( "J*hn" ) );
+ mEntry->setLastName( QString( "#Malkovich" ) );
+ QVERIFY( mEntry->match( PATTERN( "5" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "5*" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "5+" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "51" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "5#" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "50#" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "5+0#6" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "5*0#6" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "5*0#" ) ) );
+
+ mEntry->setFirstName( QString( "J-hn" ) );
+ mEntry->setLastName( QString( "#Malkovich" ) );
+ QVERIFY( mEntry->match( PATTERN( "5" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "5*" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "5+" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "51" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "5#" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "50#" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "5+0#6" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "5*0#6" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "5*0#" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "510#" ) ) );
+
+ mEntry->setFirstName( QString("Alice 028") );
+ mEntry->setLastName( QString( "Ming" ) );
+ QVERIFY( mEntry->match( PATTERN( "02806" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "0280" ) ) );//not supported
- QVERIFY( mEntry->match( QString( "50" ) ) );
- QVERIFY( mEntry->match( QString( "05" ) ) );
- QVERIFY( mEntry->match( QString( "506" ) ) );
+ mEntry->mType = LogsCntEntry::EntryTypeContact;
+ QVERIFY( !mEntry->match( PATTERN( "+202" ) ) );
+
+ mEntry->setFirstName( QString( "0J0hn" ) );
+ mEntry->setLastName( QString( "Malkovich" ) );
+ QVERIFY( mEntry->match( PATTERN( "000" ) ) );
+
+}
+
+void UT_LogsCntEntry::testMatch_thai12k()
+{
+
+ LogsPredictiveTranslator::deleteInstance();
+ HbInputLanguage thai( QLocale::Thai );
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( thai );
+
+ mEntry->mType = LogsCntEntry::EntryTypeHistory;
+
+ mEntry->setFirstName( QString( "5643" ) );
+ QVERIFY( mEntry->match( PATTERN( "5" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "6" ) ) );
+
+ mEntry->setLastName( QString( "6787" ) );
+ QVERIFY( mEntry->match( PATTERN( "5" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "05" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "6" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "*#*#*#*5*#*#*#**#*#" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "*#*#*****#6" ) ) );
+ QVERIFY( mEntry->match( PATTERN( "06" ) ) );
+
+ QVERIFY( mEntry->match( PATTERN( "605" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "606" ) ) );
+
+ QVERIFY( mEntry->match( PATTERN( "#*#*#6*#*#**0*#*#**5*****#" ) ) );
+ QVERIFY( !mEntry->match( PATTERN( "**#*#**#*#6*#*0*#*#*6*#**#****#" ) ) );
+
+}
+
+
+void UT_LogsCntEntry::testSetHighlights_thai12k()
+{
+ LogsPredictiveTranslator::deleteInstance();
+ HbInputLanguage thai( QLocale::Thai );
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( thai );
+
+ mEntry->mType = LogsCntEntry::EntryTypeHistory;
+ mEntry->setFirstName( QString( "5643 456456" ) );
+ mEntry->setLastName( QString( "6787" ) );
+
+ mEntry->setHighlights( PATTERN( "****56#*#*#" ) );
+ QVERIFY( mEntry->firstName().length() == 1 );
+ QVERIFY( mEntry->lastName().length() == 1 );
+ QVERIFY( mEntry->firstName()[0].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 0);
+
+ mEntry->setHighlights( PATTERN( "****56#*#*#06" ) );
+ QVERIFY( mEntry->firstName()[0].highlights() == 2);
+ QVERIFY( mEntry->lastName()[0].highlights() == 1);
}
-
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logscntfinder.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logscntfinder.cpp Fri May 14 15:52:41 2010 +0300
@@ -59,6 +59,7 @@
LogsCntFinder finder( *mFinder->mContactManager );
QVERIFY( finder.mCurrentPredictivePattern == "" );
+ QVERIFY( finder.mCurrentInputPattern == "" );
QVERIFY( finder.mResults.count() == 0 );
QVERIFY( finder.mHistoryEvents.count() == 0 );
QVERIFY( finder.mContactManager );
@@ -66,7 +67,7 @@
}
-void UT_LogsCntFinder::testPredictiveSearchQuery()
+void UT_LogsCntFinder::testPredictiveSearchQuery_latin12k()
{
QSignalSpy queryReadySpy(mFinder, SIGNAL(queryReady() ) );
QSignalSpy resultsAddedSpy(mCntResults, SIGNAL(resultsAdded() ) );
@@ -74,6 +75,7 @@
int resultsCount = 0;
LogsCntEntryHandle* handle1 = (LogsCntEntryHandle*)1;
LogsCntEntryHandle* handle2 = (LogsCntEntryHandle*)2;
+ LogsCntEntryHandle* handle3 = (LogsCntEntryHandle*)3;
LogsCntEntry* entry1 = new LogsCntEntry( *handle1,0 );
entry1->setFirstName( QString("Tim Roth") );
@@ -89,6 +91,13 @@
QVERIFY( mFinder->mHistoryEvents.count() == 2 );
QCOMPARE( mFinder->mCachedCounter, 0 );
+ LogsCntEntry* entry3 = new LogsCntEntry( *handle3,0 );
+ entry3->setFirstName( QString("Kaizu") );
+ entry3->setLastName( QString("Oistamo") );
+ mFinder->insertEntry( 1, entry3 );
+ QVERIFY( mFinder->mHistoryEvents.count() == 3 );
+ QCOMPARE( mFinder->mCachedCounter, 0 );
+
mCntResults->set( 9 );//John1 Malkovich1 ...
queryReadySpy.clear();
resultsAddedSpy.clear();
@@ -97,21 +106,23 @@
QCOMPARE( queryReadySpy.count(), 1 );
QCOMPARE( resultsAddedSpy.count(), 1 );
QVERIFY( mFinder->mCurrentPredictivePattern == QString("5") );
- QCOMPARE( mFinder->resultsCount(), 1 + 9 );
+ QVERIFY( mFinder->mCurrentInputPattern == QString("5") );
+ QCOMPARE( mFinder->resultsCount(), 2 + 9 );
+ QVERIFY( mFinder->mResults[1]->isCached() );
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 );
+ QVERIFY( !mFinder->mResults[2]->isCached() );
+ QVERIFY( mFinder->mResults[2]->handle() == 0 );
+ QVERIFY( mFinder->mResults[2]->contactId() == 1 );
+ QCOMPARE( mFinder->mCachedCounter, 2 );
- 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 );
+ const LogsCntEntry* firstE = &mFinder->resultAt( 2 );
+ QCOMPARE( mFinder->mCachedCounter, 3 );
+ QVERIFY( mFinder->mResults[2]->firstName()[0].text() == QString("John1") );
+ QVERIFY( mFinder->mResults[2]->firstName()[0].highlights() == 1 );
mCntResults->set( 9 );//John1 Malkovich1 ...
@@ -170,14 +181,14 @@
mFinder->predictiveSearchQuery( QString("5") );
QCOMPARE( queryReadySpy.count(), 1 );
QCOMPARE( resultsAddedSpy.count(), 1 );
- QCOMPARE( mFinder->resultsCount(), 1 + 9 );
+ QCOMPARE( mFinder->resultsCount(), 2 + 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 );
+ QVERIFY( !mFinder->mResults[2]->isCached() );
+ QVERIFY( mFinder->mResults[2]->contactId() == 1 );
+ QCOMPARE( mFinder->mCachedCounter, 2 );
CACHE_ALL_RESULTS();
QCOMPARE( mFinder->mCachedCounter, mFinder->resultsCount() );
@@ -202,17 +213,17 @@
mFinder->predictiveSearchQuery( QString("5") );
QCOMPARE( queryReadySpy.count(), 1 );
QCOMPARE( resultsAddedSpy.count(), 1 );
- QCOMPARE( mFinder->resultsCount(), 1 + 9 );
+ QCOMPARE( mFinder->resultsCount(), 2 + 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 );
+ QVERIFY( mFinder->mResults[2]->isCached() );
+ QVERIFY( mFinder->mResults[2]->handle() == 0 );
+ QVERIFY( mFinder->mResults[2]->firstName()[0].text() == QString("John1") );
+ QVERIFY( mFinder->mResults[2]->firstName()[0].highlights() == 1 );
+ QCOMPARE( mFinder->mCachedCounter, 11 );
//refresh
mCntResults->set( 9 );
@@ -222,7 +233,7 @@
mFinder->predictiveSearchQuery( mFinder->mCurrentPredictivePattern );
QCOMPARE( queryReadySpy.count(), 1 );
QCOMPARE( resultsAddedSpy.count(), 1 );
- QCOMPARE( mFinder->resultsCount(), 1 + 9 );
+ QCOMPARE( mFinder->resultsCount(), 2 + 9 );
//reset
mCntResults->set( 9 );
@@ -314,10 +325,128 @@
QCOMPARE( resultsAddedSpy.count(), 1 );
QCOMPARE( mFinder->resultsCount(), 1 );
+// --
+
+ qDeleteAll( mFinder->mHistoryEvents );
+ mFinder->mHistoryEvents.clear();
+ mFinder->predictiveSearchQuery( QString("") );
+
+ entry1 = new LogsCntEntry( *handle1,0 );
+ entry1->setFirstName( QString("+Tim #Roth") );
+ mFinder->insertEntry( 0, entry1 );
+ QCOMPARE( mFinder->mHistoryEvents.count(), 1 );
+
+ mCntResults->reset();
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("+80#7") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 1 );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].text() == QString("+Tim") );
+ QVERIFY( mFinder->mResults[0]->firstName()[0].highlights() == 2 );
+ QVERIFY( mFinder->mResults[0]->firstName()[1].text() == QString("#Roth") );
+ QVERIFY( mFinder->mResults[0]->firstName()[1].highlights() == 2 );
+ QCOMPARE( mFinder->mCurrentInputPattern, QString("+80#7") );
+ QCOMPARE( mFinder->mCurrentPredictivePattern, QString("*80#7") );
+ QCOMPARE( mCntResults->query(), QString("+80#7") );
+
+// --
+
+ qDeleteAll( mFinder->mHistoryEvents );
+ mFinder->mHistoryEvents.clear();
+ mFinder->predictiveSearchQuery( QString("") );
+
+ entry1 = new LogsCntEntry( *handle1,0 );
+ entry1->setFirstName( QString("James Bond") );
+ entry1->setPhoneNumber( QString("0401234566") );
+ mFinder->insertEntry( 0, entry1 );
+ QCOMPARE( mFinder->mHistoryEvents.count(), 1 );
+
+ entry2 = new LogsCntEntry( *handle2,0 );
+ entry2->setFirstName( QString("Mika Häkkinen") );
+ entry2->setPhoneNumber( QString("0401234999") );
+ mFinder->insertEntry( 0, entry2 );
+ QCOMPARE( mFinder->mHistoryEvents.count(), 2 );
+
+ mCntResults->reset();
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("0") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 2 );
+
+ mCntResults->reset();
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("00") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 0 );
+
+ mCntResults->reset();
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("000") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 0 );
+
+// --
+
+ qDeleteAll( mFinder->mHistoryEvents );
+ mFinder->mHistoryEvents.clear();
+ mFinder->predictiveSearchQuery( QString("") );
+
+ mCntResults->set( 1, QString("Alice 028"), QString("Ming") );
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("0") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 1 );
+ CACHE_ALL_RESULTS();
+
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("00") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 1 );
+ CACHE_ALL_RESULTS();
+
+ mCntResults->set( 1, QString("James"), QString("Bond") );
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("005") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 1 );
+ CACHE_ALL_RESULTS();
+
+ mCntResults->set( 1, QString("Alice 028"), QString("Ming") );
+ queryReadySpy.clear();
+ resultsAddedSpy.clear();
+
+ mFinder->predictiveSearchQuery( QString("00") );
+ QCOMPARE( queryReadySpy.count(), 1 );
+ QCOMPARE( resultsAddedSpy.count(), 1 );
+ QCOMPARE( mFinder->resultsCount(), 1 );
+ CACHE_ALL_RESULTS();
+
+
}
-void UT_LogsCntFinder::testResultAt()
+void UT_LogsCntFinder::testResultAt_latin12k()
{
mCntResults->set( 9 , QString( "first"), QString( "last") );
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictive12keytranslator.cpp Fri May 14 15:52:41 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 "ut_logspredictive12keytranslator.h"
+#include "logspredictive12keytranslator.h"
+
+#include <hbinputsettingproxy.h>
+#include <hbinputkeymapfactory.h>
+
+#include <QtTest/QtTest>
+#include <QSignalSpy>
+
+class LogsPredictive12KeyTranslator_mock : public LogsPredictive12KeyTranslator
+{
+public:
+
+ inline LogsPredictive12KeyTranslator_mock()
+ :LogsPredictive12KeyTranslator()
+ { mKeyMap =
+ HbKeymapFactory::instance()->keymap( QLocale::English,
+ QLocale::AnyCountry );
+ }
+
+ inline QStringList nameTokens( const QString& /*name*/ ) const
+ {return QStringList();}
+
+};
+
+
+void UT_LogsPredictive12KeyTranslator::initTestCase()
+{
+ mOrigLang = HbInputSettingProxy::instance()->globalInputLanguage();
+
+}
+
+void UT_LogsPredictive12KeyTranslator::cleanupTestCase()
+{
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( mOrigLang );
+
+}
+
+
+void UT_LogsPredictive12KeyTranslator::init()
+{
+ mTranslator = new LogsPredictive12KeyTranslator_mock();
+}
+
+void UT_LogsPredictive12KeyTranslator::cleanup()
+{
+ delete mTranslator;
+ mTranslator = 0;
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( mOrigLang );
+
+}
+
+void UT_LogsPredictive12KeyTranslator::testConstructor()
+{
+ QVERIFY( mTranslator );
+ QVERIFY( mTranslator->mKeyMap );
+}
+
+void UT_LogsPredictive12KeyTranslator::testPatternTokens()
+{
+ QCOMPARE( mTranslator->patternTokens( QString("122" ) ).length(), 1 );
+ QCOMPARE( mTranslator->patternTokens( QString("122" ) )[0], QString("122" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("102" ) ).length(), 2 );
+ QCOMPARE( mTranslator->patternTokens( QString("102" ) )[0], QString("1" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("102" ) )[1], QString("2" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("0010200" ) ).length(), 2 );
+ QCOMPARE( mTranslator->patternTokens( QString("0010200" ) )[0], QString("001" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("0010200" ) )[1], QString("200" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("0" ) ).length(), 1 );
+ QCOMPARE( mTranslator->patternTokens( QString("0" ) )[0], QString("0" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("000" ) ).length(), 1 );
+ QCOMPARE( mTranslator->patternTokens( QString("000" ) )[0], QString("0" ) );
+ QCOMPARE( mTranslator->patternTokens( QString("001" ) ).length(), 1 );
+ QCOMPARE( mTranslator->patternTokens( QString("001" ) )[0], QString("1" ) );
+
+}
+
+void UT_LogsPredictive12KeyTranslator::testHasPatternSeparators()
+{
+ QVERIFY( !mTranslator->hasPatternSeparators( QString("122" ) ) );
+ QVERIFY( mTranslator->hasPatternSeparators( QString("1022" ) ) );
+ QCOMPARE( mTranslator->hasPatternSeparators( QString("0010200" ) ), 5 );
+ QCOMPARE( mTranslator->hasPatternSeparators( QString("0000" ) ), 4 );
+ QCOMPARE( mTranslator->hasPatternSeparators( QString("345345" ) ), 0 );
+
+}
+
+void UT_LogsPredictive12KeyTranslator::testTranslateChar()
+{
+ //latin
+ QCOMPARE( mTranslator->translateChar( QChar('0') ), QChar('0') );
+ QCOMPARE( mTranslator->translateChar( QChar(0x4E0F) ), QChar() );
+
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictivelatin12keytranslator.cpp Fri May 14 15:52:41 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_logspredictivelatin12keytranslator.h"
+#include "logspredictivelatin12keytranslator.h"
+
+#include <QtTest/QtTest>
+#include <QSignalSpy>
+
+
+void UT_LogsPredictiveLatin12KeyTranslator::initTestCase()
+{
+}
+
+void UT_LogsPredictiveLatin12KeyTranslator::cleanupTestCase()
+{
+}
+
+
+void UT_LogsPredictiveLatin12KeyTranslator::init()
+{
+ mTranslator = new LogsPredictiveLatin12KeyTranslator();
+}
+
+void UT_LogsPredictiveLatin12KeyTranslator::cleanup()
+{
+ delete mTranslator;
+ mTranslator = 0;
+}
+
+void UT_LogsPredictiveLatin12KeyTranslator::testConstructor()
+{
+ QVERIFY( mTranslator );
+ QVERIFY( !mTranslator->mSpecialKeyMap.isEmpty() );
+
+}
+
+void UT_LogsPredictiveLatin12KeyTranslator::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( "*1234567890" ) );
+ QCOMPARE( mTranslator->translate( QString( "*1234567890" ) ) ,QString( "*1234567890" ) );
+ QCOMPARE( mTranslator->translate( QString( "#1234567890" ) ), QString( "#1234567890" ) );
+ QCOMPARE( mTranslator->translate( QString( "++##" ) ), QString( "**##" ) );
+ QCOMPARE( mTranslator->translate( QString( "-+##" ) ), QString( "1*##" ) );
+ QCOMPARE( mTranslator->translate( QString( "/+##" ) ), QString( "1*##" ) );
+ QCOMPARE( mTranslator->translate( QString( "*+##" ) ), QString( "**##" ) );
+
+ QString uni;
+ uni.append(QChar(0x0219));
+ uni.append(QChar(0x4E0F));
+ QString result("7");
+
+ QCOMPARE(mTranslator->translate(uni), result);
+
+ QString uni1;
+ uni1.append(QChar(0x4E0E));
+ uni1.append(QChar(0x4E0F));
+ QString result1("");
+ QCOMPARE(mTranslator->translate(uni1), result1);
+
+ QString result2;
+ QCOMPARE(mTranslator->translate(uni1), result2);
+
+}
+
+void UT_LogsPredictiveLatin12KeyTranslator::testTranslateChar()
+{
+
+ QCOMPARE( mTranslator->translateChar( QChar('+') ), QChar('*') );
+ QCOMPARE( mTranslator->translateChar( QChar('*') ), QChar('*') );
+ QCOMPARE( mTranslator->translateChar( QChar('#') ), QChar('#') );
+ QCOMPARE( mTranslator->translateChar( QChar('0') ), QChar('0') );
+ QCOMPARE( mTranslator->translateChar( QChar('a') ), QChar('2') );
+ QCOMPARE( mTranslator->translateChar( QChar('A') ), QChar('2') );
+ QCOMPARE( mTranslator->translateChar( QChar('1') ), QChar('1') );
+ QCOMPARE( mTranslator->translateChar( QChar('ä') ), QChar('2') );
+ QCOMPARE( mTranslator->translateChar( QChar('Ä') ), QChar('2') );
+ QCOMPARE( mTranslator->translateChar( QChar('-') ), QChar('1') );
+ // Romanian unicode character "sh"
+ QCOMPARE( mTranslator->translateChar( QChar(0x0219) ), QChar('7') );
+ // Chinese unicode character
+ QChar chn(0x4E0F);
+ QCOMPARE( mTranslator->translateChar( QChar(0x4E0F) ), QChar() );
+
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictivethai12keytranslator.cpp Fri May 14 15:52:41 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_logspredictivethai12keytranslator.h"
+#include "logspredictivethai12keytranslator.h"
+
+#include <hbinputsettingproxy.h>
+
+#include <QtTest/QtTest>
+#include <QSignalSpy>
+
+
+void UT_LogsPredictiveThai12KeyTranslator::initTestCase()
+{
+ mOrigLang = HbInputSettingProxy::instance()->globalInputLanguage();
+}
+
+void UT_LogsPredictiveThai12KeyTranslator::cleanupTestCase()
+{
+
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( mOrigLang );
+
+}
+
+
+void UT_LogsPredictiveThai12KeyTranslator::init()
+{
+
+ HbInputLanguage thai( QLocale::Thai );
+
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( thai );
+ mTranslator = new LogsPredictiveThai12KeyTranslator();
+
+}
+
+void UT_LogsPredictiveThai12KeyTranslator::cleanup()
+{
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( mOrigLang );
+ delete mTranslator;
+ mTranslator = 0;
+}
+
+void UT_LogsPredictiveThai12KeyTranslator::testConstructor()
+{
+ QVERIFY( mTranslator );
+
+}
+
+void UT_LogsPredictiveThai12KeyTranslator::testTranslate()
+{
+ QCOMPARE( mTranslator->translate( QString( "0123456789" ) ), QString( "0123456789" ) );
+ QCOMPARE( mTranslator->translate( QString( "Nokia" ) ), QString( "" ) );
+ QCOMPARE( mTranslator->translate( QString( "*0123##456*789*" ) ), QString( "0123456789" ) );
+
+ const int ucsize = 9;
+ // 1 2 3 4 5 6 7 8 9
+ const QChar thaiName1[] = {0x0E01,0x0E06,0x0E0A,0x0E0E,0x0E14,0x0E19,0x0E1E,0x0E23,0x0E2A };
+ QCOMPARE( mTranslator->translate( QString( thaiName1,ucsize ) ), QString( "123456789" ) );
+
+ // 1 2 * 4 5 6 # 8 9
+ const QChar thaiName2[] = {0x0E01,0x0E06,0x0E2F,0x0E0E,0x0E14,0x0E19,0x0E30,0x0E23,0x0E2A };
+ QCOMPARE( mTranslator->translate( QString( thaiName2,ucsize ) ), QString( "1245689" ) );
+
+
+}
+
+void UT_LogsPredictiveThai12KeyTranslator::testTranslateChar()
+{
+
+ QCOMPARE( mTranslator->translateChar( QChar('0') ), QChar('0') );
+ QCOMPARE( mTranslator->translateChar( QChar('1') ), QChar('1') );
+ QCOMPARE( mTranslator->translateChar( QChar('N') ), QChar() );
+ QCOMPARE( mTranslator->translateChar( QChar('*') ), QChar() );
+ QCOMPARE( mTranslator->translateChar( QChar('#') ), QChar() );
+ QCOMPARE( mTranslator->translateChar( QChar(0x0E01) ), QChar('1') );
+ QCOMPARE( mTranslator->translateChar( QChar(0x0E06) ), QChar('2') );
+ QCOMPARE( mTranslator->translateChar( QChar(0x0E0A) ), QChar('3') );
+ QCOMPARE( mTranslator->translateChar( QChar(0x0E0E) ), QChar('4') );
+ QCOMPARE( mTranslator->translateChar( QChar(0x0E14) ), QChar('5') );
+ QCOMPARE( mTranslator->translateChar( QChar(0x0E19) ), QChar('6') );
+ QCOMPARE( mTranslator->translateChar( QChar(0x0E1E) ), QChar('7') );
+ QCOMPARE( mTranslator->translateChar( QChar(0x0E23) ), QChar('8') );
+ QCOMPARE( mTranslator->translateChar( QChar(0x0E2A) ), QChar('9') );
+ QCOMPARE( mTranslator->translateChar( QChar(0x0E2F) ), QChar() );
+ QCOMPARE( mTranslator->translateChar( QChar(0x0E30) ), QChar() );
+
+}
+
+
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictivetranslator.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/src/ut_logspredictivetranslator.cpp Fri May 14 15:52:41 2010 +0300
@@ -14,19 +14,25 @@
* Description:
*
*/
+
+#include <hbinputsettingproxy.h>
+
#include "ut_logspredictivetranslator.h"
#include "logspredictivetranslator.h"
#include <QtTest/QtTest>
-#include <QSignalSpy>
void UT_LogsPredictiveTranslator::initTestCase()
{
+ mOrigLang = HbInputSettingProxy::instance()->globalInputLanguage();
+
}
void UT_LogsPredictiveTranslator::cleanupTestCase()
{
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( mOrigLang );
+
}
@@ -38,143 +44,51 @@
void UT_LogsPredictiveTranslator::cleanup()
{
LogsPredictiveTranslator::deleteInstance();
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( mOrigLang );
+
}
void UT_LogsPredictiveTranslator::testConstructor()
{
QVERIFY( mTranslator );
QVERIFY( mTranslator->mKeyMap );
+ LogsPredictiveTranslator::deleteInstance();
-}
+ mTranslator = 0;
+ HbInputLanguage thai( QLocale::Thai );
+ HbInputSettingProxy::instance()->setGlobalInputLanguage( thai );
-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 );
-
+ mTranslator = LogsPredictiveTranslator::instance();
+ QVERIFY( mTranslator );
+ QVERIFY( mTranslator->mKeyMap );
}
+void UT_LogsPredictiveTranslator::testTranslate()
+{
+ QString test1( "12345" );
+
+ QCOMPARE( mTranslator->LogsPredictiveTranslator::translate( test1 ).length(),
+ test1.length() );
+
+ QCOMPARE( mTranslator->LogsPredictiveTranslator::translate( test1, 2 ).length(),
+ 2 );
+}
+
+void UT_LogsPredictiveTranslator::testStartsWith()
+{
+ QCOMPARE( mTranslator->startsWith( QString("" ), QString("") ), 0 );
+ QCOMPARE( mTranslator->startsWith( QString("123" ), QString("") ), 0 );
+ QCOMPARE( mTranslator->startsWith( QString("" ), QString("123") ), 0 );
+ QCOMPARE( mTranslator->startsWith( QString("123" ), QString("1234") ), 0 );
+ QCOMPARE( mTranslator->startsWith( QString("123" ), QString("1") ), 1 );
+ QCOMPARE( mTranslator->startsWith( QString("123" ), QString("123") ), 3 );
+ QCOMPARE( mTranslator->startsWith( QString("123" ), QString("12"), true ), 2 );
+ QCOMPARE( mTranslator->startsWith( QString("123" ), QString("12"), false ), 2 );
+
+}
+
+
+
+
--- a/logsui/logscntfinder/tsrc/ut_logscntfinder/ut_logscntfinder.pro Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logscntfinder/tsrc/ut_logscntfinder/ut_logscntfinder.pro Fri May 14 15:52:41 2010 +0300
@@ -35,18 +35,32 @@
# Input
HEADERS += inc/ut_logscntfinder.h
+HEADERS += inc/ut_logspredictivetranslator.h
+HEADERS += inc/ut_logspredictive12keytranslator.h
+HEADERS += inc/ut_logspredictivelatin12keytranslator.h
+HEADERS += inc/ut_logspredictivethai12keytranslator.h
+HEADERS += inc/ut_logscntentry.h
HEADERS += ../../inc/logscntfinder.h
-HEADERS += inc/ut_logspredictivetranslator.h
+HEADERS += ../../inc/logscntentry.h
HEADERS += ../../inc/logspredictivetranslator.h
-HEADERS += inc/ut_logscntentry.h
+HEADERS += ../../inc/logspredictive12keytranslator.h
+HEADERS += ../../inc/logspredictivelatin12keytranslator.h
+HEADERS += ../../inc/logspredictivethai12keytranslator.h
HEADERS += ../stubs/qtcontacts_stubs.h
SOURCES += src/main.cpp
SOURCES += src/ut_logscntfinder.cpp
SOURCES += src/ut_logspredictivetranslator.cpp
+SOURCES += src/ut_logspredictive12keytranslator.cpp
+SOURCES += src/ut_logspredictivelatin12keytranslator.cpp
+SOURCES += src/ut_logspredictivethai12keytranslator.cpp
SOURCES += src/ut_logscntentry.cpp
SOURCES += ../../src/logscntfinder.cpp
+SOURCES += ../../src/logscntentry.cpp
SOURCES += ../../src/logspredictivetranslator.cpp
+SOURCES += ../../src/logspredictive12keytranslator.cpp
+SOURCES += ../../src/logspredictivelatin12keytranslator.cpp
+SOURCES += ../../src/logspredictivethai12keytranslator.cpp
SOURCES += ../../../tsrc/qtestutils/src/testresultxmlparser.cpp
SOURCES += ../stubs/qtcontacts_stubs.cpp
--- a/logsui/logsengine/bwins/logsengineu.def Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/bwins/logsengineu.def Fri May 14 15:52:41 2010 +0300
@@ -1,59 +1,64 @@
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
+ ?setPredictiveSearch@LogsAbstractModel@@QAEH_N@Z @ 2 NONAME ; int LogsAbstractModel::setPredictiveSearch(bool)
+ ??0LogsCustomFilter@@QAE@XZ @ 3 NONAME ; LogsCustomFilter::LogsCustomFilter(void)
+ ?isCommunicationPossible@LogsAbstractModel@@QBE_NABVLogsEvent@@@Z @ 4 NONAME ; bool LogsAbstractModel::isCommunicationPossible(class LogsEvent const &) const
+ ?clearEvents@LogsCustomFilter@@QAE_NXZ @ 5 NONAME ; bool LogsCustomFilter::clearEvents(void)
+ ?predictiveSearchStatus@LogsAbstractModel@@QAEHXZ @ 6 NONAME ; int LogsAbstractModel::predictiveSearchStatus(void)
+ ?ALS@LogsEvent@@QBE_NXZ @ 7 NONAME ; bool LogsEvent::ALS(void) const
+ ?updateExisting@LogsContact@@QAE_NXZ @ 8 NONAME ; bool LogsContact::updateExisting(void)
+ ??0LogsModel@@QAE@W4LogsModelType@0@_N@Z @ 9 NONAME ; LogsModel::LogsModel(enum LogsModel::LogsModelType, bool)
+ ?allowedRequestType@LogsContact@@QAE?AW4RequestType@1@XZ @ 10 NONAME ; enum LogsContact::RequestType LogsContact::allowedRequestType(void)
+ ??0LogsEvent@@QAE@ABV0@@Z @ 11 NONAME ; LogsEvent::LogsEvent(class LogsEvent const &)
+ ?markEventsSeen@LogsModel@@QAE_NW4ClearType@1@@Z @ 12 NONAME ; bool LogsModel::markEventsSeen(enum LogsModel::ClearType)
+ ?getNumberToClipboard@LogsDetailsModel@@QAEXXZ @ 13 NONAME ; void LogsDetailsModel::getNumberToClipboard(void)
+ ??0LogsFilter@@QAE@W4FilterType@0@@Z @ 14 NONAME ; LogsFilter::LogsFilter(enum LogsFilter::FilterType)
+ ?sendMessage@LogsMessage@@QAE_NXZ @ 15 NONAME ; bool LogsMessage::sendMessage(void)
+ ?duration@LogsEvent@@QBEHXZ @ 16 NONAME ; int LogsEvent::duration(void) const
+ ?contactLocalId@LogsEvent@@QBEIXZ @ 17 NONAME ; unsigned int LogsEvent::contactLocalId(void) const
+ ??1LogsMatchesModel@@UAE@XZ @ 18 NONAME ; LogsMatchesModel::~LogsMatchesModel(void)
+ ?open@LogsContact@@QAE_NXZ @ 19 NONAME ; bool LogsContact::open(void)
+ ?logId@LogsEvent@@QBEHXZ @ 20 NONAME ; int LogsEvent::logId(void) const
+ ?updateConfiguration@LogsModel@@QAEHAAVLogsConfigurationParams@@@Z @ 21 NONAME ; int LogsModel::updateConfiguration(class LogsConfigurationParams &)
+ ?call@LogsCall@@QAEXW4CallType@1@@Z @ 22 NONAME ; void LogsCall::call(enum LogsCall::CallType)
+ ?allowedCallTypes@LogsCall@@QAE?AV?$QList@W4CallType@LogsCall@@@@XZ @ 23 NONAME ; class QList<enum LogsCall::CallType> LogsCall::allowedCallTypes(void)
+ ?callToNumber@LogsCall@@SAXW4CallType@1@ABVQString@@I@Z @ 24 NONAME ; void LogsCall::callToNumber(enum LogsCall::CallType, class QString const &, unsigned int)
+ ?setContactId@LogsCustomFilter@@QAEXI@Z @ 25 NONAME ; void LogsCustomFilter::setContactId(unsigned int)
+ ??1LogsModel@@UAE@XZ @ 26 NONAME ; LogsModel::~LogsModel(void)
+ ??1LogsConfigurationParams@@UAE@XZ @ 27 NONAME ; LogsConfigurationParams::~LogsConfigurationParams(void)
+ ?remoteParty@LogsEvent@@QBEABVQString@@XZ @ 28 NONAME ; class QString const & LogsEvent::remoteParty(void) const
+ ?compressData@LogsModel@@QAEHXZ @ 29 NONAME ; int LogsModel::compressData(void)
+ ?addNew@LogsContact@@QAE_NXZ @ 30 NONAME ; bool LogsContact::addNew(void)
+ ?setListItemTextWidth@LogsConfigurationParams@@QAEXH@Z @ 31 NONAME ; void LogsConfigurationParams::setListItemTextWidth(int)
+ ?isRead@LogsEvent@@QBE_NXZ @ 32 NONAME ; bool LogsEvent::isRead(void) const
+ ?ringDuration@LogsEvent@@QBEHXZ @ 33 NONAME ; int LogsEvent::ringDuration(void) const
+ ?markEventsSeen@LogsCustomFilter@@QAE_NXZ @ 34 NONAME ; bool LogsCustomFilter::markEventsSeen(void)
+ ??1LogsDetailsModel@@UAE@XZ @ 35 NONAME ; LogsDetailsModel::~LogsDetailsModel(void)
+ ?number@LogsEvent@@QBEABVQString@@XZ @ 36 NONAME ; class QString const & LogsEvent::number(void) const
+ ?logsMatchesModel@LogsModel@@QAEPAVLogsMatchesModel@@XZ @ 37 NONAME ; class LogsMatchesModel * LogsModel::logsMatchesModel(void)
+ ?createContact@LogsAbstractModel@@QAEPAVLogsContact@@ABVQString@@@Z @ 38 NONAME ; class LogsContact * LogsAbstractModel::createContact(class QString const &)
+ ??1LogsFilter@@UAE@XZ @ 39 NONAME ; LogsFilter::~LogsFilter(void)
+ ??1LogsMessage@@UAE@XZ @ 40 NONAME ; LogsMessage::~LogsMessage(void)
+ ?logsMatches@LogsMatchesModel@@QAEXABVQString@@@Z @ 41 NONAME ; void LogsMatchesModel::logsMatches(class QString const &)
+ ?listItemTextWidth@LogsConfigurationParams@@QBEHXZ @ 42 NONAME ; int LogsConfigurationParams::listItemTextWidth(void) const
+ ?duplicates@LogsEvent@@QBEHXZ @ 43 NONAME ; int LogsEvent::duplicates(void) const
+ ?getNumberForCalling@LogsEvent@@QAE?AVQString@@XZ @ 44 NONAME ; class QString LogsEvent::getNumberForCalling(void)
+ ?direction@LogsEvent@@QBE?AW4LogsDirection@1@XZ @ 45 NONAME ; enum LogsEvent::LogsDirection LogsEvent::direction(void) const
+ ?refreshData@LogsModel@@QAEHXZ @ 46 NONAME ; int LogsModel::refreshData(void)
+ ?clearEvent@LogsDetailsModel@@QAEXXZ @ 47 NONAME ; void LogsDetailsModel::clearEvent(void)
+ ?clearMissedCallsCounter@LogsModel@@QAEHXZ @ 48 NONAME ; int LogsModel::clearMissedCallsCounter(void)
+ ?filterType@LogsFilter@@QBE?AW4FilterType@1@XZ @ 49 NONAME ; enum LogsFilter::FilterType LogsFilter::filterType(void) const
+ ??1LogsEvent@@UAE@XZ @ 50 NONAME ; LogsEvent::~LogsEvent(void)
+ ??4LogsConfigurationParams@@QAEAAV0@ABV0@@Z @ 51 NONAME ; class LogsConfigurationParams & LogsConfigurationParams::operator=(class LogsConfigurationParams const &)
+ ?setMaxSize@LogsFilter@@QAEXH@Z @ 52 NONAME ; void LogsFilter::setMaxSize(int)
+ ?initiateCallback@LogsCall@@QAEXXZ @ 53 NONAME ; void LogsCall::initiateCallback(void)
+ ??1LogsCustomFilter@@UAE@XZ @ 54 NONAME ; LogsCustomFilter::~LogsCustomFilter(void)
+ ?sendMessageToNumber@LogsMessage@@SA_NABVQString@@0I@Z @ 55 NONAME ; bool LogsMessage::sendMessageToNumber(class QString const &, class QString const &, unsigned int)
+ ?defaultCallType@LogsCall@@QAE?AW4CallType@1@XZ @ 56 NONAME ; enum LogsCall::CallType LogsCall::defaultCallType(void)
+ ??0LogsConfigurationParams@@QAE@PAVQObject@@@Z @ 57 NONAME ; LogsConfigurationParams::LogsConfigurationParams(class QObject *)
+ ?eventType@LogsEvent@@QBE?AW4LogsEventType@1@XZ @ 58 NONAME ; enum LogsEvent::LogsEventType LogsEvent::eventType(void) const
+ ??1LogsCall@@UAE@XZ @ 59 NONAME ; LogsCall::~LogsCall(void)
+ ?clearList@LogsModel@@QAE_NW4ClearType@1@@Z @ 60 NONAME ; bool LogsModel::clearList(enum LogsModel::ClearType)
+ ??1LogsContact@@UAE@XZ @ 61 NONAME ; LogsContact::~LogsContact(void)
+ ?clearType@LogsFilter@@QBE?AW4ClearType@LogsModel@@XZ @ 62 NONAME ; enum LogsModel::ClearType LogsFilter::clearType(void) const
--- a/logsui/logsengine/eabi/logsengineu.def Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/eabi/logsengineu.def Fri May 14 15:52:41 2010 +0300
@@ -31,51 +31,59 @@
_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
+ _ZN16LogsMatchesModelD0Ev @ 33 NONAME
+ _ZN16LogsMatchesModelD1Ev @ 34 NONAME
+ _ZN16LogsMatchesModelD2Ev @ 35 NONAME
+ _ZN17LogsAbstractModel13createContactERK7QString @ 36 NONAME
+ _ZN17LogsAbstractModel19setPredictiveSearchEb @ 37 NONAME
+ _ZN17LogsAbstractModel22predictiveSearchStatusEv @ 38 NONAME
+ _ZN23LogsConfigurationParams20setListItemTextWidthEi @ 39 NONAME
+ _ZN23LogsConfigurationParamsC1EP7QObject @ 40 NONAME
+ _ZN23LogsConfigurationParamsC2EP7QObject @ 41 NONAME
+ _ZN23LogsConfigurationParamsD0Ev @ 42 NONAME
+ _ZN23LogsConfigurationParamsD1Ev @ 43 NONAME
+ _ZN23LogsConfigurationParamsD2Ev @ 44 NONAME
+ _ZN23LogsConfigurationParamsaSERKS_ @ 45 NONAME
+ _ZN8LogsCall12callToNumberENS_8CallTypeERK7QStringj @ 46 NONAME
+ _ZN8LogsCall15defaultCallTypeEv @ 47 NONAME
+ _ZN8LogsCall16allowedCallTypesEv @ 48 NONAME
+ _ZN8LogsCall16initiateCallbackEv @ 49 NONAME
+ _ZN8LogsCall4callENS_8CallTypeE @ 50 NONAME
+ _ZN8LogsCallD0Ev @ 51 NONAME
+ _ZN8LogsCallD1Ev @ 52 NONAME
+ _ZN8LogsCallD2Ev @ 53 NONAME
+ _ZN9LogsEvent19getNumberForCallingEv @ 54 NONAME
+ _ZN9LogsEventC1ERKS_ @ 55 NONAME
+ _ZN9LogsEventC2ERKS_ @ 56 NONAME
+ _ZN9LogsEventD0Ev @ 57 NONAME
+ _ZN9LogsEventD1Ev @ 58 NONAME
+ _ZN9LogsEventD2Ev @ 59 NONAME
+ _ZN9LogsModel11refreshDataEv @ 60 NONAME
+ _ZN9LogsModel12compressDataEv @ 61 NONAME
+ _ZN9LogsModel14markEventsSeenENS_9ClearTypeE @ 62 NONAME
+ _ZN9LogsModel16logsMatchesModelEv @ 63 NONAME
+ _ZN9LogsModel19updateConfigurationER23LogsConfigurationParams @ 64 NONAME
+ _ZN9LogsModel23clearMissedCallsCounterEv @ 65 NONAME
+ _ZN9LogsModel9clearListENS_9ClearTypeE @ 66 NONAME
+ _ZN9LogsModelC1ENS_13LogsModelTypeEb @ 67 NONAME
+ _ZN9LogsModelC2ENS_13LogsModelTypeEb @ 68 NONAME
+ _ZN9LogsModelD0Ev @ 69 NONAME
+ _ZN9LogsModelD1Ev @ 70 NONAME
+ _ZN9LogsModelD2Ev @ 71 NONAME
+ _ZNK10LogsFilter10filterTypeEv @ 72 NONAME
+ _ZNK10LogsFilter9clearTypeEv @ 73 NONAME
+ _ZNK17LogsAbstractModel23isCommunicationPossibleERK9LogsEvent @ 74 NONAME
+ _ZNK23LogsConfigurationParams17listItemTextWidthEv @ 75 NONAME
+ _ZNK9LogsEvent10duplicatesEv @ 76 NONAME
+ _ZNK9LogsEvent11remotePartyEv @ 77 NONAME
+ _ZNK9LogsEvent12ringDurationEv @ 78 NONAME
+ _ZNK9LogsEvent14contactLocalIdEv @ 79 NONAME
+ _ZNK9LogsEvent3ALSEv @ 80 NONAME
+ _ZNK9LogsEvent4timeEv @ 81 NONAME
+ _ZNK9LogsEvent5logIdEv @ 82 NONAME
+ _ZNK9LogsEvent6isReadEv @ 83 NONAME
+ _ZNK9LogsEvent6numberEv @ 84 NONAME
+ _ZNK9LogsEvent8durationEv @ 85 NONAME
+ _ZNK9LogsEvent9directionEv @ 86 NONAME
+ _ZNK9LogsEvent9eventTypeEv @ 87 NONAME
--- a/logsui/logsengine/inc/logscommondata.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/inc/logscommondata.h Fri May 14 15:52:41 2010 +0300
@@ -20,6 +20,7 @@
#include <qmobilityglobal.h>
#include "logsevent.h"
+#include "logsconfigurationparams.h"
QTM_BEGIN_NAMESPACE
class QContactManager;
@@ -57,14 +58,18 @@
int maxReadSize() const;
LogsEvent::LogsDirection maxReadSizeDirection() const;
+ int updateConfiguration(const LogsConfigurationParams& params);
+ LogsConfigurationParams& currentConfiguration();
private:
QContactManager* mContactManager;
int mMaxReadSize;
LogsEvent::LogsDirection mMaxReadSizeDir;
+ LogsConfigurationParams mConfiguration;
private:
friend class UT_LogsCommonData;
+ friend class UT_LogsModel;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/inc/logsconfigurationparams.h Fri May 14 15:52:41 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 LOGSCONFIGURATIONPARAMS_H
+#define LOGSCONFIGURATIONPARAMS_H
+
+#include <QObject>
+#include <logsexport.h>
+
+/**
+ *
+ */
+class LogsConfigurationParams : public QObject
+{
+ Q_OBJECT
+
+public: // The exported API
+
+ LOGSENGINE_EXPORT explicit LogsConfigurationParams(QObject* parent = 0);
+ LOGSENGINE_EXPORT ~LogsConfigurationParams();
+
+ LOGSENGINE_EXPORT void setListItemTextWidth(int width);
+ LOGSENGINE_EXPORT int listItemTextWidth() const;
+
+ LOGSENGINE_EXPORT LogsConfigurationParams& operator=(const LogsConfigurationParams& params);
+
+private:
+ int mListItemTextWidth;
+
+};
+
+#endif // LOGSCONFIGURATIONPARAMS_H
--- a/logsui/logsengine/inc/logsmatchesmodel.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/inc/logsmatchesmodel.h Fri May 14 15:52:41 2010 +0300
@@ -48,41 +48,22 @@
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
+
+protected slots:
+
+ virtual void contactSavingCompleted(bool modified);
+
+protected: // From LogsAbstractModel
virtual QVariant createCall(const LogsModelItemContainer& item) const;
virtual QVariant createMessage(const LogsModelItemContainer& item) const;
virtual QVariant createContact(const LogsModelItemContainer& item) const;
+ virtual int doSetPredictiveSearch(bool enabled);
private slots:
@@ -120,7 +101,6 @@
QString mCurrentSearchPattern;
QString mPrevSearchPattern;
LogsThumbIconManager *mIconManager;
- bool mSearchEnabled;
int mResultCount;
private:
--- a/logsui/logsengine/logsengine.pro Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/logsengine.pro Fri May 14 15:52:41 2010 +0300
@@ -45,6 +45,7 @@
HEADERS += inc/logseventdata.h
HEADERS += inc/logsthumbnailmanager.h
HEADERS += inc/logscommondata.h
+HEADERS += inc/logsconfigurationparams.h
HEADERS += logssymbianos/inc/logsdbconnector.h
HEADERS += logssymbianos/inc/logsreader.h
HEADERS += logssymbianos/inc/logsreaderstates.h
@@ -66,6 +67,7 @@
SOURCES += src/logscustomfilter.cpp
SOURCES += src/logsthumbnailmanager.cpp
SOURCES += src/logscommondata.cpp
+SOURCES += src/logsconfigurationparams.cpp
SOURCES += logssymbianos/src/logsdbconnector.cpp
SOURCES += logssymbianos/src/logsreader.cpp
SOURCES += logssymbianos/src/logsreaderstates.cpp
@@ -85,7 +87,7 @@
TARGET.CAPABILITY = CAP_GENERAL_DLL
TARGET.EPOCALLOWDLLDATA = 1
- LIBS += -lflogger -llogcli -llogwrap -lefsrv -lxqservice -lqtcontacts -llogscntfinder -lthumbnailmanagerqt -lcentralrepository
+ LIBS += -lflogger -llogcli -llogwrap -lefsrv -lxqservice -lxqserviceutil -lqtcontacts -llogscntfinder -lthumbnailmanagerqt -lcentralrepository
defFiles = "$${LITERAL_HASH}ifdef WINS" \
"DEFFILE bwins/logsengine.def" \
--- a/logsui/logsengine/logssymbianos/src/logseventparser.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/logssymbianos/src/logseventparser.cpp Fri May 14 15:52:41 2010 +0300
@@ -42,15 +42,32 @@
//Set remote party information
QString newRemoteParty =
QString::fromUtf16( source.RemoteParty().Ptr(), source.RemoteParty().Length() );
+
+ bool remotePartyUnknown( newRemoteParty == strings.iUnKnownRemote );
+ bool remotePartyPrivate( false );
+ bool remotePartyPayphone( false );
+ if ( !remotePartyUnknown ){
+ remotePartyPrivate = ( source.RemoteParty() == KLogsPrivateText );
+ }
+ if ( !remotePartyUnknown && !remotePartyPrivate ){
+ remotePartyPayphone = ( source.RemoteParty() == KLogsPayphoneText );
+ }
+
if ( !isUnknownRemoteParty(dest, newRemoteParty) &&
- newRemoteParty != strings.iUnKnownRemote &&
- source.RemoteParty() != KLogsPrivateText &&
- source.RemoteParty() != KLogsPayphoneText ){
+ !remotePartyUnknown && !remotePartyPrivate && !remotePartyPayphone ){
dest.setRemoteParty( newRemoteParty );
}
-
- dataChanged |= dest.setNumber(
- QString::fromUtf16( source.Number().Ptr(), source.Number().Length() ) );
+
+ if ( remotePartyPrivate ){
+ dest.setRemotePartyPrivate(true);
+ } else {
+ dest.setRemotePartyPrivate(false);
+ dataChanged |= dest.setNumber(
+ QString::fromUtf16( source.Number().Ptr(), source.Number().Length() ) );
+ }
+
+ //remoteparty unknown and no number -> unknown
+ dest.setRemotePartyUnknown(remotePartyUnknown && dest.number().isEmpty());
// Set direction
QString sourceDirection =
--- a/logsui/logsengine/logssymbianos/src/logsreader.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/logssymbianos/src/logsreader.cpp Fri May 14 15:52:41 2010 +0300
@@ -265,7 +265,7 @@
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" )
+ LOGS_QDEBUG( "logs [ENG] <- LogsReader::cancelCurrentRequestL(), modifying is in progress, can't cancel" )
User::Leave(KErrInUse);
}
}
--- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logseventparser.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logseventparser.cpp Fri May 14 15:52:41 2010 +0300
@@ -19,9 +19,12 @@
#include "logsevent.h"
#include "logseventdata.h"
#include <logcli.h>
+#include <LogsApiConsts.h>
#include <QtTest/QtTest>
+_LIT( KTestUnknown, "Unknown" );
+
void UT_LogsEventParser::initTestCase()
{
@@ -34,6 +37,7 @@
void UT_LogsEventParser::init()
{
+ mStrings.iUnKnownRemote = DESC_TO_QSTRING( KTestUnknown() );
mEvent = new LogsEvent();
}
@@ -104,6 +108,32 @@
event.initializeEventL(*logEvent, mStrings);
QVERIFY( event.eventState() == LogsEvent::EventNotUpdated );
+ LogsEvent unknowEvent;
+ logEvent->SetRemoteParty( KTestUnknown );
+ logEvent->SetNumber( _L("") );
+ unknowEvent.initializeEventL(*logEvent, mStrings);
+ QVERIFY( unknowEvent.isRemotePartyUnknown() );
+ QVERIFY( unknowEvent.number().isEmpty() );
+ logEvent->SetNumber( _L("1234") );
+ unknowEvent.initializeEventL(*logEvent, mStrings);
+ QVERIFY( !unknowEvent.isRemotePartyUnknown() );
+ QVERIFY( !unknowEvent.number().isEmpty() );
+
+ LogsEvent privateEvent;
+ logEvent->SetRemoteParty( KLogsPrivateText );
+ logEvent->SetNumber( _L("") );
+ privateEvent.initializeEventL(*logEvent, mStrings);
+ QVERIFY( privateEvent.isRemotePartyPrivate() );
+ QVERIFY( privateEvent.number().isEmpty() );
+
+ LogsEvent payphoneEvent;
+ logEvent->SetRemoteParty( KLogsPayphoneText );
+ logEvent->SetNumber( _L("1112222") );
+ payphoneEvent.initializeEventL(*logEvent, mStrings);
+ QVERIFY( !payphoneEvent.isRemotePartyPrivate() );
+ QVERIFY( !payphoneEvent.isRemotePartyUnknown() );
+ QVERIFY( !payphoneEvent.number().isEmpty() );
+
CleanupStack::PopAndDestroy( logEvent );
}
--- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsreaderstates.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/src/ut_logsreaderstates.cpp Fri May 14 15:52:41 2010 +0300
@@ -28,6 +28,7 @@
_LIT( KTestInDirection, "Incoming" );
_LIT( KTestOutDirection, "Outgoing" );
_LIT( KTestMissedDirection, "Missed call" );
+_LIT( KTestUnknown, "Unknown" );
void UT_LogsReaderStates::initTestCase()
{
@@ -35,7 +36,8 @@
mLogClient = CLogClient::NewL( *((RFs*)&rfsDummy) );
mStrings.iInDirection = DESC_TO_QSTRING( KTestInDirection() );
mStrings.iOutDirection = DESC_TO_QSTRING( KTestOutDirection() );
- mStrings.iMissedDirection = DESC_TO_QSTRING( KTestMissedDirection() );
+ mStrings.iMissedDirection = DESC_TO_QSTRING( KTestMissedDirection() );
+ mStrings.iUnKnownRemote = DESC_TO_QSTRING( KTestUnknown() );
}
void UT_LogsReaderStates::cleanupTestCase()
@@ -136,6 +138,7 @@
QVERIFY( index == 2 );
// Invalid event discarded
+ logEvent->SetRemoteParty( _L("") );
logEvent->SetNumber( _L("") );
logEvent->SetId( 102 );
logsEvent = new LogsEvent;
@@ -151,18 +154,61 @@
QVERIFY( mEvents.count() == 3 );
QVERIFY( index == 1 );
+ logEvent->SetRemoteParty( _L("Private") );
+ logEvent->SetNumber( _L("") );
+ logEvent->SetId( 106 );
+ logsEvent = new LogsEvent;
+ index = 0;
+ QVERIFY( state.updateAndInsertEventL( *logEvent, logsEvent, index ) );
+ QVERIFY( mEvents.count() == 4 );
+ QVERIFY( index == 1 );
+ QVERIFY( mEvents.at(0)->isRemotePartyPrivate() );
+
+ logEvent->SetRemoteParty( _L("Private") );
+ logEvent->SetNumber( _L("123") );
+ logEvent->SetId( 107 );
+ logsEvent = new LogsEvent;
+ index = 0;
+ QVERIFY( state.updateAndInsertEventL( *logEvent, logsEvent, index ) );
+ QVERIFY( mEvents.count() == 5 );
+ QVERIFY( index == 1 );
+ QVERIFY( mEvents.at(0)->isRemotePartyPrivate() );
+
+
+ logEvent->SetRemoteParty( _L("Unknown") );
+ logEvent->SetNumber( _L("123") );
+ logEvent->SetId( 108 );
+ logsEvent = new LogsEvent;
+ index = 0;
+ QVERIFY( state.updateAndInsertEventL( *logEvent, logsEvent, index ) );
+ QVERIFY( mEvents.count() == 6 );
+ QVERIFY( index == 1 );
+ QVERIFY( !mEvents.at(0)->isRemotePartyUnknown() );
+
+
+ logEvent->SetRemoteParty( _L("Unknown") );
+ logEvent->SetNumber( _L("") );
+ logEvent->SetId( 109 );
+ logsEvent = new LogsEvent;
+ index = 0;
+ QVERIFY( state.updateAndInsertEventL( *logEvent, logsEvent, index ) );
+ QVERIFY( mEvents.count() == 7 );
+ QVERIFY( index == 1 );
+ QVERIFY( mEvents.at(0)->isRemotePartyUnknown() );
+
+
state.resetEvents();
QVERIFY( !mEvents.at(0)->isInView() );
QVERIFY( !mEvents.at(1)->isInView() );
LogsEvent* event = state.takeMatchingEvent(*logEvent);
QVERIFY( event );
- QVERIFY( mEvents.count() == 2 );
+ QVERIFY( mEvents.count() == 6 );
delete event;
logEvent->SetId( 200 );
LogsEvent* event2 = state.takeMatchingEvent(*logEvent);
QVERIFY( !event2 );
- QVERIFY( mEvents.count() == 2 );
+ QVERIFY( mEvents.count() == 6 );
CleanupStack::PopAndDestroy( logEvent );
--- a/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/ut_logssymbianos.pro Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/logssymbianos/tsrc/ut_logssymbianos/ut_logssymbianos.pro Fri May 14 15:52:41 2010 +0300
@@ -55,6 +55,7 @@
HEADERS += ../../../../../recents_plat/logs_engine_api/inc/logsevent.h
HEADERS += ../../../inc/logseventdata.h
HEADERS += ../../../inc/logscommondata.h
+HEADERS += ../../../inc/logsconfigurationparams.h
HEADERS += ../stubs/logclient_stubs_helper.h
@@ -76,6 +77,8 @@
SOURCES += ../../../src/logsevent.cpp
SOURCES += ../../../src/logseventdata.cpp
SOURCES += ../../../src/logscommondata.cpp
+SOURCES += ../../../src/logsconfigurationparams.cpp
+
SOURCES += ../../../../tsrc/qtestutils/src/testresultxmlparser.cpp
SOURCES += ../stubs/logclient_stubs.cpp
SOURCES += ../stubs/qtcontacts_stubs.cpp
--- a/logsui/logsengine/src/logsabstractmodel.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/src/logsabstractmodel.cpp Fri May 14 15:52:41 2010 +0300
@@ -58,6 +58,57 @@
//
// -----------------------------------------------------------------------------
//
+LogsContact* LogsAbstractModel::createContact(const QString& number)
+{
+ LogsContact* contact = new LogsContact(number, *mDbConnector);
+ connect( contact, SIGNAL(saveCompleted(bool)), this, SLOT(contactSavingCompleted(bool)) );
+ return contact;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsAbstractModel::predictiveSearchStatus()
+{
+ if ( !mDbConnector ){
+ return -1;
+ }
+ return mDbConnector->predictiveSearchStatus();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsAbstractModel::setPredictiveSearch(bool enabled)
+{
+ return doSetPredictiveSearch(enabled);
+}
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+bool LogsAbstractModel::isCommunicationPossible(const LogsEvent& event) const
+{
+return ( !event.isRemotePartyPrivate() && !event.isRemotePartyUnknown() );
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsAbstractModel::contactSavingCompleted(bool modified)
+{
+ Q_UNUSED(modified);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
QVariant LogsAbstractModel::doGetData(int role, const LogsModelItemContainer& item) const
{
if ( role == RoleFullEvent ) {
@@ -85,7 +136,7 @@
return QVariant();
}
LogsCall* logscall = new LogsCall(*event);
- if (!logscall->isAllowedCallType()) {
+ if (!logscall->isAllowedCallType() || !isCommunicationPossible(*event)) {
delete logscall;
logscall = 0;
}
@@ -105,7 +156,7 @@
return QVariant();
}
LogsMessage* logsMessage = new LogsMessage(*event);
- if (!logsMessage->isMessagingAllowed()) {
+ if (!logsMessage->isMessagingAllowed() || !isCommunicationPossible(*event)) {
delete logsMessage;
logsMessage = 0;
}
@@ -126,7 +177,7 @@
}
Q_ASSERT(mDbConnector);
LogsContact* logsContact = new LogsContact(*event, *mDbConnector);
- if ( !logsContact->isContactRequestAllowed() ) {
+ if ( !logsContact->isContactRequestAllowed() || !isCommunicationPossible(*event) ) {
delete logsContact;
logsContact = 0;
}
@@ -138,6 +189,17 @@
//
// -----------------------------------------------------------------------------
//
+int LogsAbstractModel::doSetPredictiveSearch(bool enabled){
+ if ( !mDbConnector ){
+ return -1;
+ }
+ return mDbConnector->setPredictiveSearch(enabled);
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
QString LogsAbstractModel::directionIconName(const LogsEvent& event)
{
QString direction;
--- a/logsui/logsengine/src/logscall.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/src/logscall.cpp Fri May 14 15:52:41 2010 +0300
@@ -25,6 +25,7 @@
//SYSTEM
#include <QVariant>
#include <xqservicerequest.h>
+#include <xqrequestinfo.h>
// -----------------------------------------------------------------------------
//
@@ -190,6 +191,11 @@
LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createcall(), num", num )
XQServiceRequest snd(service, type, sync);
snd << num;
+ // Start call at bg, call UI will bring itself to foreground when ever
+ // it thinks it is good time to do it.
+ XQRequestInfo info;
+ info.setBackground(true);
+ snd.setInfo(info);
QVariant retValue;
snd.send(retValue);
LOGS_QDEBUG( "logs [ENG] <- LogsCall::createcall()" )
@@ -206,6 +212,11 @@
LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createCallWithService(), num", serviceId )
XQServiceRequest snd(service, type, sync);
snd << num << serviceId;
+ // Start call at bg, call UI will bring itself to foreground when ever
+ // it thinks it is good time to do it.
+ XQRequestInfo info;
+ info.setBackground(true);
+ snd.setInfo(info);
QVariant retValue;
snd.send(retValue);
LOGS_QDEBUG( "logs [ENG] <- LogsCall::createCallWithService()" )
--- a/logsui/logsengine/src/logscommondata.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/src/logscommondata.cpp Fri May 14 15:52:41 2010 +0300
@@ -18,6 +18,7 @@
//USER
#include "logscommondata.h"
#include "logslogger.h"
+#include "logsconfigurationparams.h"
//SYSTEM
#include <qcontactmanager.h>
@@ -110,5 +111,23 @@
return mMaxReadSizeDir;
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsCommonData::updateConfiguration(const LogsConfigurationParams& params)
+{
+ mConfiguration = params;
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsConfigurationParams& LogsCommonData::currentConfiguration()
+{
+ return mConfiguration;
+}
// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/src/logsconfigurationparams.cpp Fri May 14 15:52:41 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:
+*
+*/
+
+//USER
+#include "logsconfigurationparams.h"
+#include "logslogger.h"
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsConfigurationParams::LogsConfigurationParams( QObject* parent ) :
+ QObject(parent), mListItemTextWidth(0)
+{
+
+ LOGS_QDEBUG( "logs [ENG] <-> LogsConfigurationParams::LogsConfigurationParams()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsConfigurationParams& LogsConfigurationParams::operator=(
+ const LogsConfigurationParams& params )
+{
+
+ LOGS_QDEBUG( "logs [ENG] <-> LogsConfigurationParams::operator=()" )
+ mListItemTextWidth = params.mListItemTextWidth;
+ return *this;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+LogsConfigurationParams::~LogsConfigurationParams()
+{
+ LOGS_QDEBUG( "logs [ENG] <-> LogsConfigurationParams::~LogsConfigurationParams()" )
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsConfigurationParams::setListItemTextWidth(int width)
+{
+ mListItemTextWidth = width;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+int LogsConfigurationParams::listItemTextWidth() const
+{
+ return mListItemTextWidth;
+}
+
+// End of file
+
--- a/logsui/logsengine/src/logsdetailsmodel.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/src/logsdetailsmodel.cpp Fri May 14 15:52:41 2010 +0300
@@ -242,6 +242,10 @@
QString LogsDetailsModel::getHeaderData(const LogsEvent& event) const
{
QString headerdata(event.remoteParty());
+ if ( event.isRemotePartyPrivate() ){
+ headerdata = hbTrId("txt_dial_dblist_call_id_val_privat_number");
+ }
+
if ( headerdata.length() == 0 && event.number().length() > 0 ){
headerdata = event.number();
}
@@ -307,27 +311,16 @@
//
// -----------------------------------------------------------------------------
//
-QString LogsDetailsModel::getHeaderValue(QString value,bool isRemote) const
+QString LogsDetailsModel::getHeaderValue(QString /*value*/,bool isRemote) const
{
QString headervalue("");
- if (isAddress(value)){
- if ((isOutgoingCall() && isRemote)|| (!isOutgoingCall() && !isRemote)){
+ 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;
+ else{
+ headervalue = hbTrId("txt_dialer_ui_dblist_call_id");
+ }
+ return headervalue;
}
// -----------------------------------------------------------------------------
--- a/logsui/logsengine/src/logsevent.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/src/logsevent.cpp Fri May 14 15:52:41 2010 +0300
@@ -50,7 +50,9 @@
mIndex(0),
mIsInView(false),
mEventState(EventAdded),
- mIsLocallySeen(false)
+ mIsLocallySeen(false),
+ mIsPrivate(false),
+ mIsUnknown(false)
{
}
@@ -82,6 +84,8 @@
mIsInView = event.mIsInView;
mEventState = event.mEventState;
mIsLocallySeen = event.mIsLocallySeen;
+ mIsPrivate = event.mIsPrivate;
+ mIsUnknown = event.mIsUnknown;
}
// ----------------------------------------------------------------------------
@@ -175,6 +179,7 @@
bool LogsEvent::validate()
{
return ( !mNumber.isEmpty() || !mRemoteParty.isEmpty() ||
+ ( mRemoteParty.isEmpty() && ( mIsPrivate || mIsUnknown )) ||
( mLogsEventData && !mLogsEventData->remoteUrl().isEmpty() ) );
}
@@ -634,7 +639,28 @@
//
bool LogsEvent::isSeenLocally() const
{
- return ( mIsLocallySeen || mIsRead );
+ return ( mIsLocallySeen || mIsRead );
+}
+
+bool LogsEvent::isRemotePartyPrivate() const
+{
+ return mIsPrivate;
+}
+
+bool LogsEvent::isRemotePartyUnknown() const
+{
+ return mIsUnknown;
+}
+
+void LogsEvent::setRemotePartyPrivate(bool markedAsPrivate)
+{
+ mIsPrivate = markedAsPrivate;
+}
+
+
+void LogsEvent::setRemotePartyUnknown(bool markedAsUnknown)
+{
+ mIsUnknown = markedAsUnknown;
}
// End of file
--- a/logsui/logsengine/src/logsmatchesmodel.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/src/logsmatchesmodel.cpp Fri May 14 15:52:41 2010 +0300
@@ -50,7 +50,6 @@
mParentModel(parentModel),
mLogsCntFinder(0),
mIconManager(0),
- mSearchEnabled(false),
mResultCount(0)
{
LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::LogsMatchesModel()" )
@@ -124,6 +123,16 @@
//
// -----------------------------------------------------------------------------
//
+void LogsMatchesModel::contactSavingCompleted(bool modified)
+{
+ Q_UNUSED(modified);
+ forceSearchQuery();
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
QVariant LogsMatchesModel::createCall(const LogsModelItemContainer& item) const
{
LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::createCall()" )
@@ -192,33 +201,20 @@
return var;
}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-int LogsMatchesModel::predictiveSearchStatus()
-{
- return mDbConnector->predictiveSearchStatus();
-}
-
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
-int LogsMatchesModel::setPredictiveSearch(bool enabled)
+int LogsMatchesModel::doSetPredictiveSearch(bool enabled)
{
- LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::setPredictiveSearch()" )
+ LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::doSetPredictiveSearch()" )
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();
- }
+ //in case of search is turned off, getLogMatches will only reset
+ //previous search results
+ forceSearchQuery();
}
- LOGS_QDEBUG_2( "logs [ENG] <- LogsMatchesModel::setPredictiveSearch(), err: ", err )
+ LOGS_QDEBUG_2( "logs [ENG] <- LogsMatchesModel::doSetPredictiveSearch(), err: ", err )
return err;
}
@@ -310,8 +306,6 @@
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()));
@@ -404,17 +398,6 @@
//
// -----------------------------------------------------------------------------
//
-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 )
@@ -442,7 +425,8 @@
void LogsMatchesModel::doSearchQuery()
{
LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::doSearchQuery()" );
- if (mCurrentSearchPattern != mPrevSearchPattern && mSearchEnabled){
+ if (mCurrentSearchPattern != mPrevSearchPattern &&
+ mDbConnector->predictiveSearchStatus() == 1 ){
mPrevSearchPattern = mCurrentSearchPattern;
if (mCurrentSearchPattern.length() > 0) {
LOGS_QDEBUG( "logs [ENG] do search" );
--- a/logsui/logsengine/src/logsmodel.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/src/logsmodel.cpp Fri May 14 15:52:41 2010 +0300
@@ -29,6 +29,9 @@
#include "logscommondata.h"
#include <hbicon.h>
#include <QStringList>
+#include <QtGui>
+#include <hbfontspec.h>
+#include <hbinstance.h>
Q_DECLARE_METATYPE(LogsEvent *)
Q_DECLARE_METATYPE(LogsCall *)
@@ -56,6 +59,8 @@
this, SLOT( dataUpdated(QList<int>) ));
connect( mDbConnector, SIGNAL( dataRemoved(QList<int>) ),
this, SLOT( dataRemoved(QList<int>) ));
+ connect( hbInstance->theme(), SIGNAL ( changeFinished() ),
+ this, SLOT ( resetModel()));
mDbConnector->init();
mDbConnector->start();
@@ -151,22 +156,33 @@
//
// -----------------------------------------------------------------------------
//
-int LogsModel::predictiveSearchStatus()
+int LogsModel::updateConfiguration(LogsConfigurationParams& params)
{
- return mDbConnector->predictiveSearchStatus();
+ LOGS_QDEBUG( "logs [ENG] -> LogsModel::updateConfiguration()" )
+ int currWidth =
+ LogsCommonData::getInstance().currentConfiguration().listItemTextWidth();
+ int newWidth = params.listItemTextWidth();
+ LOGS_QDEBUG_3( "logs [ENG] Curr and new width", currWidth, newWidth )
+ int retVal = LogsCommonData::getInstance().updateConfiguration(params);
+
+ // Do model reset if list item width has changed as we need to ensure
+ // missed call's duplicate info visibility
+ bool unseenExists = false;
+ for ( int i = 0; i < mEvents.count() && !unseenExists; i++ ){
+ LogsEvent* event = mEvents.at(i);
+ if ( event->duplicates() > 0 && !event->isSeenLocally() ){
+ unseenExists = true;
+ }
+ }
+ if ( unseenExists && currWidth > 0 && currWidth != newWidth ){
+ LOGS_QDEBUG( "logs [ENG] Do model reset" )
+ resetModel();
+ }
+ LOGS_QDEBUG( "logs [ENG] <- LogsModel::updateConfiguration()" )
+ return retVal;
}
// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-int LogsModel::setPredictiveSearch(bool enabled)
-{
- return mDbConnector->setPredictiveSearch(enabled);
-}
-
-
-// -----------------------------------------------------------------------------
// From QAbstractListModel
// -----------------------------------------------------------------------------
//
@@ -282,7 +298,7 @@
{
QList< QList<int> > sequences;
QList<int> currSequence;
- int prevIndex = indexes.at(0) - 1;
+ int prevIndex = indexes.count() > 0 ? ( indexes.at(0) - 1 ) : -1;
for ( int i = 0; i < indexes.count(); i++ ){
int currIndex = indexes.at(i);
if ( prevIndex+1 != currIndex ){
@@ -319,18 +335,59 @@
callerId = event.logsEventData()->remoteUrl();
}
if ( callerId.length() == 0 ){
- callerId = tr("No number");
+ if ( event.isRemotePartyPrivate() ){
+ callerId = hbTrId("txt_dial_dblist_call_id_val_privat_number");
+ }
+ else if ( event.isRemotePartyUnknown() ){
+ callerId = hbTrId("txt_dial_dblist_call_id_val_unknown_number");
+ }
+
}
int duplicates = event.duplicates();
if ( duplicates > 0 && !event.isSeenLocally() ){
- callerId.append( "(" );
- callerId.append( QString::number(duplicates + 1) );
- callerId.append( ")");
+ QString callerIdBaseString = callerId;
+ QString callerIdDupString = "(" + QString::number(duplicates + 1) + ")";
+ int width = LogsCommonData::getInstance().currentConfiguration().listItemTextWidth();
+ callerId = SqueezedString(callerIdBaseString,callerIdDupString,width);
}
return callerId;
}
// -----------------------------------------------------------------------------
+// basestring: string to be cutted if not fited to maxwidth
+// secondarystring: string to show fully in the end of basestring
+// maxwidth: maximum width (in pixels) available for basestring + secondarystring
+//
+// -----------------------------------------------------------------------------
+//
+QString LogsModel::SqueezedString(
+ QString basestring, QString secondarystring, qreal maxwidth) const
+{
+ QFontMetricsF fontMetrics(HbFontSpec(HbFontSpec::Primary).font());
+ QString fullString = basestring + secondarystring;
+ qreal totalwidth = 0;
+ int x = 0;
+ if (fontMetrics.width(fullString) > maxwidth){
+ maxwidth = maxwidth - fontMetrics.width(tr("...")+secondarystring);
+ for (x = 0; (x < basestring.count()) && (totalwidth < maxwidth); x++){
+ totalwidth = totalwidth + fontMetrics.width(basestring[x]);
+ }
+ if ( ( totalwidth > maxwidth ) && ( x>0 ) ) x--;
+ return basestring.left(x) + tr("...") + secondarystring;
+ } else {
+ return fullString;
+ }
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void LogsModel::resetModel()
+{
+ this->reset();
+}
+// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
--- a/logsui/logsengine/tsrc/hbstubs/hbicon.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/hbstubs/hbicon.h Fri May 14 15:52:41 2010 +0300
@@ -35,7 +35,8 @@
public: // Data added for the unit testing stub
QString mName;
- QIcon* mTestIcon;
+
+ static QIcon* defaultIcon();
};
Q_DECLARE_METATYPE(HbIcon)
--- a/logsui/logsengine/tsrc/hbstubs/hbstubs.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/hbstubs/hbstubs.cpp Fri May 14 15:52:41 2010 +0300
@@ -22,6 +22,17 @@
QString mUTClipboard;
+static QIcon* logsTestIcon = 0;
+
+QIcon* HbIcon::defaultIcon()
+{
+ return logsTestIcon;
+}
+
+#define ENSURE_DEFAULT_ICON \
+if ( !logsTestIcon ){ \
+ logsTestIcon = new QIcon(); \
+}
// -----------------------------------------------------------------------------
// HbIcon::HbIcon
@@ -30,7 +41,7 @@
HbIcon::HbIcon()
{
mName = QString();
- mTestIcon = new QIcon;
+ ENSURE_DEFAULT_ICON
}
// -----------------------------------------------------------------------------
@@ -40,7 +51,7 @@
HbIcon::HbIcon(const QString &iconName)
{
mName = iconName;
- mTestIcon = new QIcon;
+ ENSURE_DEFAULT_ICON
}
// -----------------------------------------------------------------------------
@@ -50,7 +61,7 @@
HbIcon::HbIcon(const QIcon &icon)
{
mName = "c:\\data\\images\\designer.png";
- mTestIcon = new QIcon;
+ ENSURE_DEFAULT_ICON
}
// -----------------------------------------------------------------------------
@@ -60,7 +71,7 @@
HbIcon::HbIcon(const HbIcon &icon)
{
mName = "c:\\data\\images\\designer.png";
- mTestIcon = new QIcon;
+ ENSURE_DEFAULT_ICON
}
// -----------------------------------------------------------------------------
@@ -69,7 +80,6 @@
//
HbIcon::~HbIcon()
{
- delete mTestIcon;
}
// -----------------------------------------------------------------------------
@@ -87,7 +97,7 @@
//
QIcon &HbIcon::qicon() const
{
- return *mTestIcon;
+ return *logsTestIcon;
}
// -----------------------------------------------------------------------------
--- a/logsui/logsengine/tsrc/stubs/qthighway_stub.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/stubs/qthighway_stub.cpp Fri May 14 15:52:41 2010 +0300
@@ -16,16 +16,19 @@
*/
#include <xqservicerequest.h>
-
+#include <xqrequestinfo.h>
+#include <QHash>
#include "qthighway_stub_helper.h"
QString qtHighwayStubService;
QString qtHighwayStubMessage;
+bool qtHighwayStubRequestBg = false;
void QtHighwayStubHelper::reset()
{
qtHighwayStubService.clear();
qtHighwayStubMessage.clear();
+ qtHighwayStubRequestBg = false;
}
QString QtHighwayStubHelper::service()
@@ -38,6 +41,11 @@
return qtHighwayStubMessage;
}
+bool QtHighwayStubHelper::isRequestBg()
+{
+ return qtHighwayStubRequestBg;
+}
+
XQServiceRequest::XQServiceRequest(
const QString& service, const QString& message, const bool& synchronous)
{
@@ -74,3 +82,27 @@
{
}
+
+void XQServiceRequest::setInfo(const XQRequestInfo &info)
+{
+ Q_UNUSED(info);
+}
+
+XQRequestInfo::XQRequestInfo()
+{
+}
+
+XQRequestInfo::~XQRequestInfo()
+{
+
+}
+
+void XQRequestInfo::setBackground(bool on)
+{
+ qtHighwayStubRequestBg = on;
+}
+
+bool XQRequestInfo::isBackground() const
+{
+ return qtHighwayStubRequestBg;
+}
--- a/logsui/logsengine/tsrc/stubs/qthighway_stub_helper.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/stubs/qthighway_stub_helper.h Fri May 14 15:52:41 2010 +0300
@@ -24,4 +24,5 @@
static void reset();
static QString service();
static QString message();
+ static bool isRequestBg();
};
--- a/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logscommondata.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logscommondata.h Fri May 14 15:52:41 2010 +0300
@@ -45,6 +45,7 @@
void testGetInstance();
void testGetContactManager();
void testFreeCommonData();
+ void testCurrentConfiguration();
private:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsconfigurationparams.h Fri May 14 15:52:41 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 UT_LOGSCONFIGURATIONPARAMS_H
+#define UT_LOGSCONFIGURATIONPARAMS_H
+
+#include <QObject>
+
+class UT_LogsConfigurationParams : 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 testSetListItemTextWidth();
+ void testListItemTextWidth();
+
+private:
+
+};
+
+
+#endif //UT_LOGSCOMMONDATA_H
--- a/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsmodel.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsmodel.h Fri May 14 15:52:41 2010 +0300
@@ -54,6 +54,7 @@
void testGetDecorationData();
void testIconName();
void testGetCallerId();
+ void testSqueezedString();
void testClearList();
void testMarkEventsSeen();
void testClearMissedCallsCounter();
@@ -61,6 +62,7 @@
void testCompressData();
void testPredictiveSearchStatus();
void testSetPredictiveSearch();
+ void testUpdateConfiguration();
private:
--- a/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsthumbnailmanager.h Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/inc/ut_logsthumbnailmanager.h Fri May 14 15:52:41 2010 +0300
@@ -43,7 +43,7 @@
private:
LogsThumbIconManager* mIconMgr; // SUT
- QIcon mIcon;
+ QIcon* mIcon;
};
--- a/logsui/logsengine/tsrc/ut_logsengine/src/main.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/main.cpp Fri May 14 15:52:41 2010 +0300
@@ -30,6 +30,7 @@
#include "ut_logseventdata.h"
#include "ut_logsthumbnailmanager.h"
#include "ut_logscommondata.h"
+#include "ut_logsconfigurationparams.h"
#include "testresultxmlparser.h"
@@ -128,7 +129,17 @@
args_logsCommonData << "-xml" << "-o" << resultFileName;
QTest::qExec(&ut_logsCommonData, args_logsCommonData);
+ parser.parseAndPrintResults(resultFileName,true);
+
+ UT_LogsConfigurationParams ut_logsConfigurationParams;
+ resultFileName = "c:/ut_logs_logsConfigurationParams.xml";
+ QStringList args_logsConfigurationParams( "ut_logsConfigurationParams");
+ args_logsConfigurationParams << "-xml" << "-o" << resultFileName;
+ QTest::qExec(&ut_logsConfigurationParams, args_logsConfigurationParams);
+
parser.parseAndPrintResults(resultFileName,true);
+
+
if (promptOnExit) {
printf("Press any key...\n");
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscall.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscall.cpp Fri May 14 15:52:41 2010 +0300
@@ -121,24 +121,28 @@
mLogsCall->call(LogsCall::TypeLogsVoiceCall);
QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
QVERIFY( QtHighwayStubHelper::message() == "dial(QString)" );
+ QVERIFY( QtHighwayStubHelper::isRequestBg() );
// Video call message is longer than voice call
QtHighwayStubHelper::reset();
mLogsCall->call(LogsCall::TypeLogsVideoCall);
QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
QVERIFY( QtHighwayStubHelper::message() == "dialVideo(QString)" );
+ QVERIFY( QtHighwayStubHelper::isRequestBg() );
QtHighwayStubHelper::reset();
mLogsCall->mServiceId = 3;
mLogsCall->call(LogsCall::TypeLogsVoIPCall);
QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
- QVERIFY( QtHighwayStubHelper::message() == "dialVoipService(QString,int)" );
+ QVERIFY( QtHighwayStubHelper::message() == "dialVoipService(QString,int)" );
+ QVERIFY( QtHighwayStubHelper::isRequestBg() );
// Not supported calltype
QtHighwayStubHelper::reset();
mLogsCall->call(static_cast<LogsCall::CallType>(9999));
QVERIFY( QtHighwayStubHelper::service().isEmpty() );
QVERIFY( QtHighwayStubHelper::message().isEmpty() );
+ QVERIFY( !QtHighwayStubHelper::isRequestBg() );
}
void UT_LogsCall::testInitiateCallback()
@@ -147,6 +151,7 @@
mLogsCall->initiateCallback();
QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
QVERIFY( QtHighwayStubHelper::message() == "dial(QString)" );
+ QVERIFY( QtHighwayStubHelper::isRequestBg() );
// Video call message is longer than voice call
mLogsCall->mDefaultCall = LogsCall::TypeLogsVideoCall;
@@ -154,11 +159,13 @@
mLogsCall->initiateCallback();
QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
QVERIFY( QtHighwayStubHelper::message() == "dialVideo(QString)" );
+ QVERIFY( QtHighwayStubHelper::isRequestBg() );
mLogsCall->mDefaultCall = LogsCall::TypeLogsVoIPCall;
QtHighwayStubHelper::reset();
mLogsCall->mServiceId = 3;
mLogsCall->initiateCallback();
QVERIFY( QtHighwayStubHelper::service() == "com.nokia.services.telephony" );
- QVERIFY( QtHighwayStubHelper::message() == "dialVoipService(QString,int)" );
+ QVERIFY( QtHighwayStubHelper::message() == "dialVoipService(QString,int)" );
+ QVERIFY( QtHighwayStubHelper::isRequestBg() );
}
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscommondata.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logscommondata.cpp Fri May 14 15:52:41 2010 +0300
@@ -16,6 +16,7 @@
*/
#include "ut_logscommondata.h"
#include "logscommondata.h"
+#include "logsconfigurationparams.h"
#include <QtTest/QtTest>
@@ -55,4 +56,11 @@
LogsCommonData::freeCommonData();
}
-
+void UT_LogsCommonData::testCurrentConfiguration()
+{
+ LogsConfigurationParams params;
+ params.setListItemTextWidth(400);
+ LogsCommonData::getInstance().updateConfiguration(params);
+ LogsConfigurationParams& test = LogsCommonData::getInstance().currentConfiguration();
+ QVERIFY( test.listItemTextWidth() == 400 );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsconfigurationparams.cpp Fri May 14 15:52:41 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:
+*
+*/
+#include "ut_logsconfigurationparams.h"
+#include "logsconfigurationparams.h"
+
+#include <QtTest/QtTest>
+
+LogsConfigurationParams myparam;
+
+void UT_LogsConfigurationParams::initTestCase()
+{
+}
+
+void UT_LogsConfigurationParams::cleanupTestCase()
+{
+}
+
+
+void UT_LogsConfigurationParams::init()
+{
+}
+
+void UT_LogsConfigurationParams::cleanup()
+{
+}
+
+void UT_LogsConfigurationParams::testSetListItemTextWidth()
+{
+ myparam.setListItemTextWidth(200);
+}
+
+void UT_LogsConfigurationParams::testListItemTextWidth()
+{
+ QVERIFY (myparam.listItemTextWidth() == 200);
+}
+
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmatchesmodel.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmatchesmodel.cpp Fri May 14 15:52:41 2010 +0300
@@ -83,7 +83,6 @@
{
// Predictive search is on
QVERIFY( mMatchesModel );
- QVERIFY( mMatchesModel->mSearchEnabled );
QVERIFY( mMatchesModel->mIconManager );
QVERIFY( mMatchesModel->mLogsCntFinder );
@@ -93,7 +92,6 @@
LogsDbConnectorStubHelper::setPredictiveSearch(2);
mMatchesModel = mModel->logsMatchesModel();
QVERIFY( mMatchesModel );
- QVERIFY( !mMatchesModel->mSearchEnabled );
QVERIFY( mMatchesModel->mIconManager );
QVERIFY( mMatchesModel->mLogsCntFinder );
@@ -103,7 +101,6 @@
LogsDbConnectorStubHelper::setPredictiveSearch(-1);
mMatchesModel = mModel->logsMatchesModel();
QVERIFY( mMatchesModel );
- QVERIFY( mMatchesModel->mSearchEnabled );
QVERIFY( mMatchesModel->mIconManager );
QVERIFY( mMatchesModel->mLogsCntFinder );
@@ -338,7 +335,6 @@
{
QVERIFY( mMatchesModel->mLogsCntFinder );
QVERIFY( mMatchesModel->mIconManager );
- QVERIFY( mMatchesModel->mSearchEnabled );
// Query ready when no matching search events
QSignalSpy spy(mMatchesModel, SIGNAL(modelReset()));
@@ -411,7 +407,7 @@
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" );
@@ -427,7 +423,7 @@
void UT_LogsMatchesModel::testCreateContactWithNumber()
{
LogsContact* contact = 0;
- contact = mMatchesModel->createContact("123");
+ contact = mMatchesModel->LogsAbstractModel::createContact(QString("123"));
QVERIFY(contact);
QVERIFY(contact->isContactRequestAllowed());
delete contact;
@@ -646,12 +642,11 @@
{
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";
@@ -662,7 +657,6 @@
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" );
@@ -672,16 +666,8 @@
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" );
}
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmodel.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsmodel.cpp Fri May 14 15:52:41 2010 +0300
@@ -24,9 +24,12 @@
#include "logseventdata.h"
#include "logsdbconnector.h"
#include "logsdbconnector_stub_helper.h"
+#include "logscommondata.h"
+#include "logsconfigurationparams.h"
#include <hbicon.h>
#include <QtTest/QtTest>
+#include <hbfontspec.h>
Q_DECLARE_METATYPE(LogsEvent *)
Q_DECLARE_METATYPE(LogsCall *)
@@ -58,6 +61,7 @@
void UT_LogsModel::init()
{
mModel = new LogsModel();
+ LogsCommonData::getInstance().currentConfiguration().setListItemTextWidth(360);
}
void UT_LogsModel::cleanup()
@@ -158,12 +162,18 @@
void UT_LogsModel::testDataAdded()
{
+ QList<int> addedIndexes;
+ QSignalSpy spy(mModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)));
+
+ // Empty list
+ mModel->dataAdded(addedIndexes);
+ QVERIFY( spy.count() == 0 );
+
// One event added
LogsEvent* event = new LogsEvent();
- mModel->mEvents.append(event);
- QList<int> addedIndexes;
+ mModel->mEvents.append(event);
addedIndexes.append( 0 );
- QSignalSpy spy(mModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)));
+
mModel->dataAdded(addedIndexes);
QVERIFY( spy.count() == 1 );
@@ -195,11 +205,19 @@
void UT_LogsModel::testDataUpdated()
{
+ QList<int> updatedIndexes;
+ QSignalSpy spy(mModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)));
+
+ // Empty list
+ mModel->dataUpdated(updatedIndexes);
+ QVERIFY( spy.count() == 0 );
+
+ // Something updated
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 );
}
@@ -207,9 +225,12 @@
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() == 0 );
+
+ removedIndexes.append( 0 );
+ mModel->dataRemoved(removedIndexes);
QVERIFY( spy.count() == 1 );
}
@@ -382,9 +403,10 @@
void UT_LogsModel::testGetCallerId()
{
+ //add private and unknown
// No name or number
LogsEvent event;
- QVERIFY( mModel->getCallerId(event) == QString("No number") );
+ QVERIFY( mModel->getCallerId(event) == QString("") );
// No name
QString num("+12345555");
@@ -418,6 +440,28 @@
QVERIFY( mModel->getCallerId(event) == "test@1.2.3.4" );
}
+void UT_LogsModel::testSqueezedString()
+{
+ QFontMetricsF fontMetrics(HbFontSpec(HbFontSpec::Primary).font());
+ qreal maxwidth = LogsCommonData::getInstance().currentConfiguration().listItemTextWidth();
+ QString baseString = "4124";
+ QString secondaryString = "(3)";
+ qreal stringWidth = fontMetrics.width(baseString+secondaryString);
+
+ //test with string that fits
+ QVERIFY (mModel->SqueezedString(baseString,secondaryString,stringWidth + 10) == "4124(3)");
+
+ //test with string that needs to be cutted
+ QString squeezed = mModel->SqueezedString(baseString,secondaryString,stringWidth - 10);
+ QVERIFY (squeezed.endsWith("...(3)"));
+
+ //test with empty basestring
+ QVERIFY (mModel->SqueezedString("",secondaryString,stringWidth) == "(3)");
+
+ //test with empty secondarystring
+ QVERIFY (mModel->SqueezedString(baseString,"",stringWidth) == "4124");
+}
+
void UT_LogsModel::testClearList()
{
mModel->clearList(LogsModel::TypeLogsClearAll);
@@ -496,3 +540,32 @@
QVERIFY( mModel->setPredictiveSearch(true) == 0 );
QVERIFY( LogsDbConnectorStubHelper::lastCalledFunction() == "setPredictiveSearch" );
}
+
+void UT_LogsModel::testUpdateConfiguration()
+{
+ QSignalSpy spy(mModel, SIGNAL(modelReset()));
+
+ // No previous config, reset not signaled
+ LogsConfigurationParams params;
+ params.setListItemTextWidth(200);
+ mModel->updateConfiguration(params);
+ QVERIFY( spy.count() == 0 );
+
+ // Previous config but no change, reset not signaled
+ mModel->updateConfiguration(params);
+ QVERIFY( spy.count() == 0 );
+
+ // Config changed but no unseen events, reset not signaled
+ params.setListItemTextWidth(400);
+ mModel->updateConfiguration(params);
+ QVERIFY( spy.count() == 0 );
+
+ // Config changed and unseen events, reset signaled
+ LOGS_TEST_CREATE_EVENT(event, 1, LogsEvent::EventAdded );
+ event->setDirection(LogsEvent::DirMissed);
+ event->setDuplicates(10);
+ params.setListItemTextWidth(300);
+ mModel->updateConfiguration(params);
+ QVERIFY( spy.count() == 1 );
+
+}
--- a/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsthumbnailmanager.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/src/ut_logsthumbnailmanager.cpp Fri May 14 15:52:41 2010 +0300
@@ -23,6 +23,7 @@
#include <QSignalSpy>
#include <QtTest/QtTest>
#include <thumbnailmanager_qt.h>
+#include <hbicon.h>
const QString path1 = "c:\\data\\images\\bg_1.png";
@@ -59,26 +60,28 @@
void UT_LogsThumbnailManager::testNonExistingIcon()
{
QSignalSpy spy(mIconMgr, SIGNAL(contactIconReady(int)));
- Q_ASSERT(spy.isValid());
+ QVERIFY(spy.isValid());
QCOMPARE( spy.count(), 0 );
- mIcon = mIconMgr->contactIcon(path3, 0);
- Q_ASSERT(mIcon.isNull());
+ mIcon = &mIconMgr->contactIcon(path3, 0);
+ QVERIFY(mIcon->isNull()); // default icon used first
+ QVERIFY(mIcon == HbIcon::defaultIcon());
+
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());
+ mIcon = &mIconMgr->contactIcon(QString(), 0);
+ QVERIFY(mIcon->isNull());
+ QVERIFY(mIcon == HbIcon::defaultIcon());
}
void UT_LogsThumbnailManager::testOneExistingIcon()
{
QSignalSpy spy(mIconMgr, SIGNAL(contactIconReady(int)));
- Q_ASSERT(spy.isValid());
+ QVERIFY(spy.isValid());
QCOMPARE( spy.count(), 0 );
- mIcon = mIconMgr->contactIcon(path1, 10);
- Q_ASSERT(mIcon.isNull());
+ mIcon = &mIconMgr->contactIcon(path1, 10);
+ QVERIFY(mIcon->isNull());
+ QVERIFY(mIcon == HbIcon::defaultIcon());
QPixmap pixmap(path1);
int index = 10;
@@ -87,13 +90,15 @@
mIconMgr->mTnmReqMap.insert(reqId, path1);
mIconMgr->thumbnailReady(pixmap, clientData, 1, 0);
//
- mIcon = mIconMgr->contactIcon(path1, 10);
- Q_ASSERT(!mIcon.isNull());
+ mIcon = &mIconMgr->contactIcon(path1, 10);
+ QVERIFY(mIcon->isNull());
+ QVERIFY(mIcon != HbIcon::defaultIcon());
//
mIconMgr->cancel();
//
- mIcon = mIconMgr->contactIcon(path1, 10);
- Q_ASSERT(mIcon.isNull());
+ mIcon = &mIconMgr->contactIcon(path1, 10);
+ QVERIFY(mIcon->isNull());
+ QVERIFY(mIcon == HbIcon::defaultIcon());
reqId = mIconMgr->mThumbnailManager->getThumbnail(path1, clientData, 0);
mIconMgr->mTnmReqMap.insert(reqId, path1);
mIconMgr->thumbnailReady(pixmap, clientData, 2, -1);
@@ -102,21 +107,25 @@
QCOMPARE(spy.count(), 1);
QList<QVariant> arguments = spy.takeFirst();
QVERIFY(arguments.at(0).toInt() == 10);
- mIcon = mIconMgr->contactIcon(path1, 10);
- Q_ASSERT(!mIcon.isNull());
+ mIcon = &mIconMgr->contactIcon(path1, 10);
+ QVERIFY(mIcon->isNull());
+ QVERIFY(mIcon == HbIcon::defaultIcon());
}
void UT_LogsThumbnailManager::testCancel()
{
QSignalSpy spy(mIconMgr, SIGNAL(contactIconReady(int)));
- Q_ASSERT(spy.isValid());
+ QVERIFY(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());
+ mIcon = &mIconMgr->contactIcon(path1, 10);
+ QVERIFY(mIcon->isNull());
+ QVERIFY(mIcon == HbIcon::defaultIcon());
+ mIcon = &mIconMgr->contactIcon(path1, 11);
+ QVERIFY(mIcon->isNull());
+ QVERIFY(mIcon == HbIcon::defaultIcon());
+ mIcon = &mIconMgr->contactIcon(path3, 0);
+ QVERIFY(mIcon->isNull());
+ QVERIFY(mIcon == HbIcon::defaultIcon());
mIconMgr->thumbnailLoad();
mIconMgr->cancel();
QCOMPARE(spy.count(), 0);
--- a/logsui/logsengine/tsrc/ut_logsengine/ut_logsengine.pro Tue May 04 12:39:37 2010 +0300
+++ b/logsui/logsengine/tsrc/ut_logsengine/ut_logsengine.pro Fri May 14 15:52:41 2010 +0300
@@ -52,6 +52,7 @@
HEADERS += inc/ut_logseventdata.h
HEADERS += inc/ut_logsthumbnailmanager.h
HEADERS += inc/ut_logscommondata.h
+HEADERS += inc/ut_logsconfigurationparams.h
HEADERS += ../../../../recents_plat/logs_engine_api/inc/logsabstractmodel.h
HEADERS += ../../../../recents_plat/logs_engine_api/inc/logsmodel.h
HEADERS += ../../inc/logsdetailsmodel.h
@@ -65,6 +66,7 @@
HEADERS += ../../inc/logseventdata.h
HEADERS += ../../inc/logsthumbnailmanager.h
HEADERS += ../../inc/logscommondata.h
+HEADERS += ../../inc/logsconfigurationparams.h
HEADERS += ../../logssymbianos/inc/logseventparser.h
HEADERS += ../../logssymbianos/inc/logseventdataparser.h
HEADERS += ../../logssymbianos/inc/logsdbconnector.h
@@ -84,6 +86,7 @@
SOURCES += src/ut_logseventdata.cpp
SOURCES += src/ut_logsthumbnailmanager.cpp
SOURCES += src/ut_logscommondata.cpp
+SOURCES += src/ut_logsconfigurationparams.cpp
SOURCES += ../../src/logsabstractmodel.cpp
SOURCES += ../../src/logsmodel.cpp
SOURCES += ../../src/logsdetailsmodel.cpp
@@ -97,8 +100,8 @@
SOURCES += ../../src/logseventdata.cpp
SOURCES += ../../src/logsthumbnailmanager.cpp
SOURCES += ../../src/logscommondata.cpp
+SOURCES += ../../src/logsconfigurationparams.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
--- a/logsui/tsrc/install/logs_update_udeb.pkg Tue May 04 12:39:37 2010 +0300
+++ b/logsui/tsrc/install/logs_update_udeb.pkg Fri May 14 15:52:41 2010 +0300
@@ -20,7 +20,7 @@
&EN
; Header
-#{"LogsApp"},(0x101F4CD5),1,0,0,TYPE=SP
+#{"LogsApp"},(0x101F4CD5),1,0,0,TYPE=SA,RU
; Localised Vendor name
%{"Symbian"}
--- a/logsui/tsrc/logscenrepeditor/logscenrepeditor.pro Tue May 04 12:39:37 2010 +0300
+++ b/logsui/tsrc/logscenrepeditor/logscenrepeditor.pro Fri May 14 15:52:41 2010 +0300
@@ -31,6 +31,6 @@
symbian: {
TARGET.UID2 = 0x100039CE
TARGET.UID3 = 0xE8316BDD
- TARGET.CAPABILITY = CAP_APPLICATION AllFiles
+ TARGET.CAPABILITY = CAP_APPLICATION
LIBS += -lcentralrepository
}
--- a/logsui/tsrc/logsservicestester/main.cpp Tue May 04 12:39:37 2010 +0300
+++ b/logsui/tsrc/logsservicestester/main.cpp Fri May 14 15:52:41 2010 +0300
@@ -27,6 +27,7 @@
qDebug() << "LogsServicesTester entry";
LogsServices::LogsView viewIndex = LogsServices::ViewAll;
bool showDialpad = false;
+ QString number;
for ( int i = 0; i< argc; i++ ){
qDebug() << "Arg" << ( i + 1 ) << argv[i];
QString argStr( argv[i] );
@@ -36,6 +37,9 @@
if ( argStr == QString("-dialpad") ){
showDialpad = true;
}
+ if ( argStr == QString("-num") ){
+ number = "223456677";
+ }
}
HbApplication app(argc, argv);
@@ -43,7 +47,7 @@
mainWindow.show();
qDebug() << "LogsServicesTester start logs";
- LogsServices::start( viewIndex, showDialpad );
+ LogsServices::start( viewIndex, showDialpad, number );
int ret = app.exec();
qDebug() << "LogsServicesTester exit";
--- a/recents_plat/logs_engine_api/inc/logsabstractmodel.h Tue May 04 12:39:37 2010 +0300
+++ b/recents_plat/logs_engine_api/inc/logsabstractmodel.h Fri May 14 15:52:41 2010 +0300
@@ -25,6 +25,7 @@
class LogsDbConnector;
class LogsModelItemContainer;
class HbIcon;
+class LogsContact;
/**
* Abstract logs model.
@@ -51,7 +52,32 @@
public:
~LogsAbstractModel();
+
+ /**
+ * 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);
+
+ LOGSENGINE_EXPORT bool isCommunicationPossible(const LogsEvent& event) const;
public:
static QString directionIconName(const LogsEvent& event);
@@ -65,7 +91,11 @@
void getDecorationData(const LogsEvent& event, QList<QVariant>& iconList) const;
LogsDbConnector* dbConnector();
-
+
+protected slots:
+
+ virtual void contactSavingCompleted(bool modified);
+
protected:
QVariant doGetData(int role, const LogsModelItemContainer& item) const;
@@ -73,7 +103,8 @@
virtual QVariant createCall(const LogsModelItemContainer& item) const;
virtual QVariant createMessage(const LogsModelItemContainer& item) const;
virtual QVariant createContact(const LogsModelItemContainer& item) const;
-
+ virtual int doSetPredictiveSearch(bool enabled);
+
explicit LogsAbstractModel();
protected: //data
--- a/recents_plat/logs_engine_api/inc/logsevent.h Tue May 04 12:39:37 2010 +0300
+++ b/recents_plat/logs_engine_api/inc/logsevent.h Fri May 14 15:52:41 2010 +0300
@@ -263,6 +263,18 @@
*/
bool isSeenLocally() const;
+ bool isRemotePartyPrivate() const;
+ bool isRemotePartyUnknown() const;
+
+ /**
+ * Set remote party status as private of the event.
+ */
+ void setRemotePartyPrivate(bool markedAsPrivate);
+
+ /**
+ * Set remote party status as unknown of the event.
+ */
+ void setRemotePartyUnknown(bool markedAsUnknown);
private:
@@ -315,6 +327,8 @@
bool mIsInView;
LogsEventState mEventState;
bool mIsLocallySeen;
+ bool mIsPrivate;
+ bool mIsUnknown;
private:
--- a/recents_plat/logs_engine_api/inc/logsmodel.h Tue May 04 12:39:37 2010 +0300
+++ b/recents_plat/logs_engine_api/inc/logsmodel.h Fri May 14 15:52:41 2010 +0300
@@ -24,6 +24,7 @@
class LogsEvent;
class LogsDbConnector;
class LogsMatchesModel;
+class LogsConfigurationParams;
/**
* Model for log events.
@@ -104,25 +105,13 @@
* @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
+ * Configuration.
+ * @param configuration parameters
+ * @return 0 if configured succesfully
*/
- 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);
+ LOGSENGINE_EXPORT int updateConfiguration(LogsConfigurationParams& params);
public: // From QAbstractItemModel
@@ -160,6 +149,7 @@
void dataAdded(QList<int> addedIndexes);
void dataUpdated(QList<int> updatedIndexes);
void dataRemoved(QList<int> removedIndexes);
+ void resetModel();
private:
@@ -170,6 +160,7 @@
*/
QList< QList<int> > findSequentialIndexes(const QList<int>& indexes);
QString getCallerId(const LogsEvent& event) const;
+ QString SqueezedString(QString basestring, QString secondarystring, qreal maxwidth) const;
void initIcons();
bool matchEventWithClearType(const LogsEvent& event, LogsModel::ClearType clearType);