201029_02
authorhgs
Fri, 23 Jul 2010 15:57:13 +0300
changeset 47 9e2a905b887f
parent 45 b0aebde9b1fb
child 48 3aeaa0c5c8c1
201029_02
bluetoothengine/btindicator/inc/btindicatorconstants.h
bluetoothengine/btindicator/rom/btindicator.iby
bluetoothengine/btindicator/src/btindicatorplugin.cpp
bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro
bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc
bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml
bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml
bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-receive-done-dialog.docml
bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-send-dialog.docml
bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogrecvquerywidget.h
bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogutils.h
bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h
bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h
bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvcompleteddialogwidget.h
bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvprgrsdialogwidget.h
bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp
bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp
bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp
bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp
bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvcompleteddialogwidget.cpp
bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp
bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp
bluetoothengine/btnotif/btnotifsrv/inc/btnotifdeviceselector.h
bluetoothengine/btnotif/btnotifsrv/inc/btnotifoutgoingpairinghandler.h
bluetoothengine/btnotif/btnotifsrv/src/btnotifbasepairinghandler.cpp
bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp
bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp
bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp
bluetoothengine/btnotif/btnotifsrv/src/btnotifsecuritymanager.cpp
bluetoothengine/btnotif/btnotifsrv/src/btnotifserviceauthorizer.cpp
bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h
bluetoothengine/btsap/src/BTSapSniffHandler.cpp
bluetoothengine/btui/btcpplugin/btcpplugin.cpp
bluetoothengine/btui/btcpplugin/btcpuidevicedetail.cpp
bluetoothengine/btui/btcpplugin/btcpuidevicedetail.h
bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.cpp
bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.h
bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp
bluetoothengine/btui/btcpplugin/btcpuideviceview.h
bluetoothengine/btui/btcpplugin/btcpuimainview.cpp
bluetoothengine/btui/btcpplugin/btcpuimainview.h
bluetoothengine/btui/btcpplugin/btcpuisearchview.cpp
bluetoothengine/btui/btcpplugin/btcpuisearchview.h
bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml
bluetoothengine/btui/btcpplugin/docml/bt-main-view.docml
bluetoothengine/btui/btcpplugin/docml/bt-search-view.docml
bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.cpp
bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.h
bluetoothengine/btui/btuidelegate/btdelegateinquiry.h
bluetoothengine/btui/btuidelegate/btdelegateremotedevname.cpp
bluetoothengine/btui/btuidelegate/btdelegateremotedevname.h
bluetoothengine/btui/btuimodel/btdevicemodel_p.h
bluetoothengine/btui/inc/btuiiconutil.h
btobexprofiles/inc/BTServiceParameterList.h
btobexprofiles/inc/btserviceapi.h
btobexprofiles/inc/obexutilsdialog.h
btobexprofiles/inc/obexutilspropertynotifier.h
btobexprofiles/obexreceiveservices/bip/inc/BIPController.h
btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp
btobexprofiles/obexreceiveservices/btmsgviewer/btmsgviewer.pro
btobexprofiles/obexreceiveservices/btmsgviewer/inc/btmsgviewer.h
btobexprofiles/obexreceiveservices/btmsgviewer/inc/btmsgviewerutils.h
btobexprofiles/obexreceiveservices/btmsgviewer/src/btmsgviewer.cpp
btobexprofiles/obexreceiveservices/btmsgviewer/src/btmsgviewerutils.cpp
btobexprofiles/obexreceiveservices/btmsgviewer/src/main.cpp
btobexprofiles/obexreceiveservices/opp/inc/oppcontroller.h
btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp
btobexprofiles/obexserviceman/rom/obex.iby
btobexprofiles/obexserviceman/utils/inc/obexutilsentryhandler.h
btobexprofiles/obexserviceman/utils/src/obexutilsentryhandler.cpp
btobexprofiles/obexserviceman/utils/src/obexutilsmessagehandler.cpp
cbsatplugin/atmisccmdplugin/data/2002C3BA_TDSCDMA.rss
cbsatplugin/atmisccmdplugin/group/atmisccmdplugin.mmp
cbsatplugin/atmisccmdplugin/inc/atcommandparser.h
cbsatplugin/atmisccmdplugin/inc/atmisccmdplugin.h
cbsatplugin/atmisccmdplugin/inc/atmisccmdpluginconsts.h
cbsatplugin/atmisccmdplugin/inc/cgmicommandhandler.h
cbsatplugin/atmisccmdplugin/inc/cgmmcommandhandler.h
cbsatplugin/atmisccmdplugin/inc/cgsncommandhandler.h
cbsatplugin/atmisccmdplugin/inc/hvercommandhandler.h
cbsatplugin/atmisccmdplugin/inc/scpbrcommandhandler.h
cbsatplugin/atmisccmdplugin/inc/scpbwcommandhandler.h
cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp
cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp
cbsatplugin/atmisccmdplugin/src/cgmmcommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/cmgdcommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/scpbrcommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/scpbwcommandhandler.cpp
package_definition.xml
package_map.xml
--- a/bluetoothengine/btindicator/inc/btindicatorconstants.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btindicator/inc/btindicatorconstants.h	Fri Jul 23 15:57:13 2010 +0300
@@ -15,8 +15,8 @@
  *
  */
 
-#ifndef BTINDCONSTANTS_H
-#define BTINDCONSTANTS_H
+#ifndef BTINDICATORCONSTANTS_H
+#define BTINDICATORCONSTANTS_H
 
 
 
@@ -36,7 +36,7 @@
     EBTIndicatorHiddenConnected
     };
 
-#endif /* BTINDCONSTANTS_H */
+#endif /* BTINDICATORCONSTANTS_H */
 
 
 
--- a/bluetoothengine/btindicator/rom/btindicator.iby	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btindicator/rom/btindicator.iby	Fri Jul 23 15:57:13 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/bluetoothengine/btindicator/src/btindicatorplugin.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btindicator/src/btindicatorplugin.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -34,9 +34,9 @@
 // BTIndicatorPlugin::~BTIndicatorPlugin
 // ----------------------------------------------------------------------------
 BTIndicatorPlugin::~BTIndicatorPlugin()
-    {
+{
     delete mIndicatorTranslator;
-    }
+}
 
 // ----------------------------------------------------------------------------
 // BTIndicatorPlugin::indicatorTypes
@@ -70,10 +70,9 @@
 // ----------------------------------------------------------------------------
 HbIndicatorInterface* BTIndicatorPlugin::createIndicator(const QString &indicatorType)
 {
-    if(!mIndicatorTranslator)
-        {
+    if(!mIndicatorTranslator) {
         mIndicatorTranslator = new HbTranslator(BTINDICATOR_TRANSLATION);
-        }
+    }
     HbIndicatorInterface *indicator = new BTIndicator(indicatorType);
     return indicator;
 }
--- a/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro	Fri Jul 23 15:57:13 2010 +0300
@@ -35,7 +35,8 @@
     inc/btsenddialogwidget.h \
     inc/btdevicedialogplugintrace.h \
     inc/btdevicedialogrecvquerywidget.h \
-    inc/btrecvprgrsdialogwidget.h
+    inc/btrecvprgrsdialogwidget.h \
+    inc/btrecvcompleteddialogwidget.h
 
     
 SOURCES += src/btdevicedialogplugin.cpp \
@@ -46,7 +47,8 @@
     src/btmoredevicesdialogwidget.cpp \
     src/btsenddialogwidget.cpp \
     src/btdevicedialogrecvquerywidget.cpp \
-    src/btrecvprgrsdialogwidget.cpp
+    src/btrecvprgrsdialogwidget.cpp \
+    src/btrecvcompleteddialogwidget.cpp
 
 RESOURCES += btdevicedialogplugin.qrc
     
@@ -56,7 +58,10 @@
     TARGET.CAPABILITY = CAP_GENERAL_DLL
     TARGET.UID3 = 0x2002E6DF
     
-    LIBS += -lbtdevice
+    LIBS += -lbtdevice \
+    		-lhbcore \
+	       	-lxqservice \
+    		-lxqserviceutil \
     
     hblib.sources = Hb.dll
     hblib.path = \sys\bin
--- a/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc	Fri Jul 23 15:57:13 2010 +0300
@@ -7,5 +7,6 @@
         <file>icons/qtg_large_bluetooth.svg</file>
         <file>docml/bt-receive-auth-dialog.docml</file>
         <file>docml/bt-recv-progress-dialog.docml</file>
+        <file>docml/bt-receive-done-dialog.docml</file>
     </qresource>
 </RCC>
--- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml	Fri Jul 23 15:57:13 2010 +0300
@@ -1,13 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <hbdocument version="1.1">
     <object name="viewaction" type="HbAction">
-        <string locid="txt_common_button_show" name="text"/>
+        <string locid="txt_common_button_show" name="text" value="Show"/>
     </object>
     <object name="stopretryaction" type="HbAction">
-        <string locid="txt_common_button_stop" name="text"/>
+        <string locid="txt_common_button_stop" name="text" value="Retry"/>
+    </object>
+    <object name="cancelaction" type="HbAction">
+        <string locid="txt_common_button_cancel" name="text" value="Cancel"/>
     </object>
     <widget name="searchdialog" type="HbDialog">
-        <rect height="72.07463un" name="geometry" width="49.73134un" x="1.73134un" y="11.64179un"/>
+        <rect height="96un" name="geometry" width="60.73134un" x="1.2un" y="4.1791un"/>
+        <sizehint type="PREFERRED" width="49.73134un"/>
+        <sizehint type="MAXIMUM" width="50.73134un"/>
+        <size height="91.52239un" name="size" width="50.73134un"/>
         <widget name="heading" role="HbDialog:headingWidget" type="HbLabel">
             <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
             <string locid="txt_bt_subhead_bluetooth_found_devices" name="plainText"/>
@@ -40,15 +46,16 @@
             <widget name="listView" type="HbListView">
                 <widget name="listItemPrototype" role="HbAbstractView:prototype" type="HbListViewItem"/>
                 <enums name="verticalScrollBarPolicy" value="ScrollBarAsNeeded"/>
-                <sizehint height="47.7612un" type="PREFERRED" width="35.8209un"/>
+                <sizehint height="65.7612un" type="PREFERRED" width="35.8209un"/>
             </widget>
             <layout type="grid">
                 <griditem column="0" itemname="container_1" row="0"/>
                 <griditem column="0" itemname="listView" row="1"/>
             </layout>
         </widget>
+        <ref object="viewaction" role="HbWidget:addAction"/>
         <ref object="stopretryaction" role="HbWidget:addAction"/>
-        <ref object="viewaction" role="HbWidget:addAction"/>
+        <ref object="cancelaction" role="HbWidget:addAction"/>
     </widget>
     <metadata activeUIState="Common ui state" display="NHD-3.2-inch_portrait" unit="un">
         <uistate name="Common ui state" sections="#common"/>
--- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml	Fri Jul 23 15:57:13 2010 +0300
@@ -3,10 +3,11 @@
     <object name="moreaction" type="HbAction">
         <enums name="softKeyRole" value="NoSoftKey"/>
         <string locid="txt_bt_button_more_devices" name="text"/>
-        <string name="toolTip" value="txt_bt_button_more_devices"/>
+        <string locid="txt_bt_button_more_devices" name="toolTip"/>
     </object>
     <object name="cancelaction" type="HbAction">
         <string locid="txt_common_button_cancel" name="text"/>
+        <string locid="txt_common_button_cancel" name="toolTip"/>
     </object>
     <widget name="lastuseddialog" type="HbDialog">
         <rect height="68.20896un" name="geometry" width="49.73134un" x="1.73134un" y="11.64179un"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-receive-done-dialog.docml	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="1.1">
+    <object name="showaction" type="HbAction">
+        <string locid="txt_common_button_show" name="iconText"/>
+        <string locid="txt_common_button_show" name="text"/>
+        <string locid="txt_common_button_show" name="toolTip"/>
+    </object>
+    <object name="cancelaction" type="HbAction">
+        <string locid="txt_common_button_cancel" name="iconText"/>
+        <string locid="txt_common_button_cancel" name="text"/>
+        <string locid="txt_common_button_cancel" name="toolTip"/>
+    </object>
+    <widget name="recvCompleteddialog" type="HbDialog">
+        <rect height="37.46269un" name="geometry" width="49.73134un" x="1.49254un" y="36.26866un"/>
+        <widget name="heading" role="HbDialog:headingWidget" type="HbLabel">
+            <real name="z" value="1"/>
+            <string name="plainText"/>
+        </widget>
+        <widget name="container" role="HbDialog:contentWidget" type="HbWidget">
+            <widget name="filecontainer" type="HbWidget">
+                <widget name="fileiconlabel" type="HbLabel">
+                    <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+                    <icon iconName="qtg_small_smiley_very_cool" name="icon"/>
+                    <real name="z" value="1"/>
+                </widget>
+                <widget name="fileSize" type="HbLabel">
+                    <real name="z" value="3"/>
+                    <sizehint height="4.02985un" type="PREFERRED" width="24.32836un"/>
+                    <string name="plainText"/>
+                </widget>
+                <widget name="fileName" type="HbLabel">
+                    <real name="z" value="4"/>
+                    <sizehint height="4.1791un" type="PREFERRED" width="35.07463un"/>
+                    <string name="plainText"/>
+                </widget>
+                <real name="z" value="0"/>
+                <sizehint height="9.8806un" type="PREFERRED" width="23.8806un"/>
+                <layout type="anchor">
+                    <anchoritem dst="fileiconlabel" dstEdge="LEFT" spacing="1.04478un" src="" srcEdge="LEFT"/>
+                    <anchoritem dst="fileiconlabel" dstEdge="BOTTOM" spacing="-0.71767un" src="" srcEdge="BOTTOM"/>
+                    <anchoritem dst="fileSize" dstEdge="LEFT" spacing="9.30448un" src="" srcEdge="LEFT"/>
+                    <anchoritem dst="fileSize" dstEdge="BOTTOM" spacing="-0.26991un" src="" srcEdge="BOTTOM"/>
+                    <anchoritem dst="fileName" dstEdge="LEFT" spacing="9.30448un" src="" srcEdge="LEFT"/>
+                    <anchoritem dst="fileName" dstEdge="TOP" spacing="0.44776un" src="" srcEdge="TOP"/>
+                </layout>
+            </widget>
+            <widget name="fileCount_label" type="HbLabel">
+                <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+                <string name="plainText"/>
+            </widget>
+            <real name="z" value="2"/>
+            <layout orientation="Vertical" type="linear">
+                <linearitem itemname="filecontainer"/>
+                <linearitem itemname="fileCount_label"/>
+            </layout>
+        </widget>
+        <ref object="showaction" role="HbWidget:addAction"/>
+        <ref object="cancelaction" role="HbWidget:addAction"/>
+    </widget>
+    <metadata activeUIState="Common ui state" display="NHD-3.2-inch_portrait" unit="un">
+        <uistate name="Common ui state" sections="#common"/>
+    </metadata>
+</hbdocument>
--- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-send-dialog.docml	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-send-dialog.docml	Fri Jul 23 15:57:13 2010 +0300
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <hbdocument version="1.1">
     <object name="hideaction" type="HbAction">
+        <bool name="enabled" value="FALSE"/>
         <string locid="txt_common_button_hide" name="text"/>
     </object>
     <object name="cancelaction" type="HbAction">
@@ -12,8 +13,8 @@
             <real name="z" value="1"/>
             <string name="plainText" value="Sending File x/y to Device"/>
         </widget>
+        <ref object="hideaction" role="HbWidget:addAction"/>
         <ref object="cancelaction" role="HbWidget:addAction"/>
-        <ref object="hideaction" role="HbWidget:addAction"/>
         <widget name="container" role="HbDialog:contentWidget" type="HbWidget">
             <widget name="filecontainer" type="HbWidget">
                 <widget name="fileiconlabel" type="HbLabel">
--- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogrecvquerywidget.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogrecvquerywidget.h	Fri Jul 23 15:57:13 2010 +0300
@@ -16,8 +16,8 @@
 */
 
 
-#ifndef BTDEVICEDIALOGRECVQUERYWIDGET_H_
-#define BTDEVICEDIALOGRECVQUERYWIDGET_H_
+#ifndef BTDEVICEDIALOGRECVQUERYWIDGET_H
+#define BTDEVICEDIALOGRECVQUERYWIDGET_H
 
 #include <QObject>
 #include <QVariantMap>
@@ -74,4 +74,4 @@
     Q_DISABLE_COPY(BTRecvQueryDialogWidget)
     };
 
-#endif /* BTDEVICEDIALOGRECVQUERYWIDGET_H_ */
+#endif /* BTDEVICEDIALOGRECVQUERYWIDGET_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogutils.h	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  
+ *
+ */
+
+#ifndef BTDEVICESDIALOGUTILS_H
+#define BTDEVICESDIALOGUTILS_H
+
+#include <QMap>
+#include <QList>
+#include <QVariant>
+
+// A data item in this model DLL. For example, power state item consists 
+// of the information regarding the current Bluetooth power state.
+typedef QMap< int, QVariant > BtSendDataItem;
+
+// A category of the model data for specific group
+typedef QList< BtSendDataItem > BtSendDataSource;
+
+
+Q_DECLARE_METATYPE(BtSendDataItem)
+Q_DECLARE_METATYPE(BtSendDataSource)
+
+enum DevDataRole {
+    NameAliasRole = Qt::DisplayRole, // QVariant::String, the name showing in UI
+    ReadableBdaddrRole = Qt::UserRole, // QString, the readable format of a BD_ADDR (BT Device address)
+    MajorPropertyRole,  // QVariant::Int, bits of DevMajorProperty
+    MinorPropertyRole,  // QVariant::Int, bits of DevMinorProperty
+    CoDRole,  // QVariant::Int, the value of Class of Device
+    DeviceTypeRole //QVairant::Int, the value of Device Type
+};
+
+
+inline void setMajorProperty(
+        BtSendDataItem& qtdev, int prop, bool addto)
+{
+    if ( addto ) {
+         qtdev[MajorPropertyRole] = 
+            QVariant( qtdev[MajorPropertyRole].toInt() | prop);
+    }
+    else {
+         qtdev[MajorPropertyRole] = 
+            QVariant( qtdev[MajorPropertyRole].toInt() & ~prop);
+    }
+}
+
+
+#endif /*BTDEVICESDIALOGUTILS_H*/
--- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h	Fri Jul 23 15:57:13 2010 +0300
@@ -30,14 +30,17 @@
 #include <hblistwidget.h>
 #include <hblabel.h>
 #include <hbaction.h>
+#include <hbselectiondialog.h>
+#include "btdevicedialogutils.h"
 
 
-struct device
+
+/*struct device
     {
     QString mDeviceName;
     QString mDeviceType;
     int     mDeviceIdx;
-    };
+    };*/
 
 
 class BTDeviceSearchDialogWidget : public QObject,
@@ -67,11 +70,15 @@
     
 private:
     bool constructDialog(const QVariantMap &parameters);
-    void hideEvent(QHideEvent *event);
-    void showEvent(QShowEvent *event);
-    void appendToDeviceList(const QString deviceName);
-    bool appendToDeviceTypeList(const QString deviceType);
-    QIcon icon();
+    
+private:
+    enum devTypeSelectionList {
+        BtUiDevAudioDevice = 0,
+        BtUiDevComputer,
+        BtUiDevInputDevice,
+        BtUiDevPhone,
+        BtUiDevOtherDevice
+    };    
     
 signals:
     void deviceDialogClosed();
@@ -86,25 +93,30 @@
      */
     
     QStandardItemModel* mContentItemModel;
-    HbDialog*           mViewByDialog;
-    HbRadioButtonList*  mRbl;
-    QList<QString>      mDeviceTypeList;
-    QList<device>       mDeviceList;
+    
+    HbSelectionDialog *mQuery;
+//    QList<QString>      mDeviceTypeList;
+    QStringList mDevTypeList;
+//    QList<device>       mDeviceList;
     HbListView*         mListView;
     HbLabel*            mSearchLabel; 
     HbLabel*            mSearchIconLabel;
     HbLabel*            mSearchDoneLabel;
-    bool                mViewByChosen;
-    QList<device>       mDeviceLstOfType;
-    int                 mDeviceLstIdx;
-    int                 mSelectedType;
-    int                 mDeviceDialogData;
+//    bool                mViewByChosen;
+//    QList<device>       mDeviceLstOfType;
+//    int                 mDeviceLstIdx;
+    int                 mSelectedDeviceType;
+//    int                 mDeviceDialogData;
     HbDialog *mSearchDevicesDialog;
     HbAction *mStopRetryAction;
-    HbAction *mViewByAction;
+    HbAction *mShowAction;
+    HbAction *mCancelAction;
 
     int mStopRetryFlag;
     
+    BtSendDataSource mData;
+    BtSendDataSource mSelectedData;
+    
     Q_DISABLE_COPY(BTDeviceSearchDialogWidget)
     };
 
--- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h	Fri Jul 23 15:57:13 2010 +0300
@@ -19,6 +19,7 @@
 #ifndef BTMOREDEVICESDIALOGWIDGET_H
 #define BTMOREDEVICESDIALOGWIDGET_H
 
+#include "btdevicedialogutils.h"
 #include <QObject>
 #include <QVariantMap>
 #include <hbdialog.h>
@@ -54,6 +55,8 @@
  //   void hideEvent(QHideEvent *event);
  //   void showEvent(QShowEvent *event);
     QIcon icon(/*QString deviceType*/);
+ //   void setMajorProperty(
+//           BtSendDataItem& qtdev, int prop, bool addto);
     
 signals:
     void deviceDialogClosed();
@@ -73,6 +76,8 @@
     
     QStandardItemModel* mContentItemModel;
     
+    BtSendDataSource mData;
+    
     Q_DISABLE_COPY(BTMoreDevicesDialogWidget)
     };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvcompleteddialogwidget.h	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  BtDeviceDialogWidget class declaration.
+*
+*/
+
+
+#ifndef BTRECVCOMPLETEDDIALOGWIDGET_H_
+#define BTRECVCOMPLETEDDIALOGWIDGET_H_
+
+#include <QObject>
+#include <QVariantMap>
+#include <hbdialog.h>
+#include <hbdevicedialoginterface.h>
+#include <hbpopup.h>
+#include <hbdocumentloader.h>
+#include <qstandarditemmodel.h>
+#include <hblabel.h>
+#include <hbaction.h>
+#include <QRunnable>
+
+
+class CoversationViewServiceStarter : public QRunnable
+    {
+public:
+    CoversationViewServiceStarter(qint64 conversationId);
+    ~CoversationViewServiceStarter();
+    void run();
+private:
+    qint64 mCnvId;
+    };
+
+
+class BTRecvcompletedDialogWidget : public QObject, 
+                                public HbDeviceDialogInterface
+    {
+    Q_OBJECT
+    
+public:
+    BTRecvcompletedDialogWidget(const QVariantMap &parameters);
+    ~BTRecvcompletedDialogWidget();
+    
+public: // from HbDeviceDialogInterface
+    bool setDeviceDialogParameters(const QVariantMap &parameters);
+    int deviceDialogError() const;
+    void closeDeviceDialog(bool byClient);
+    HbPopup *deviceDialogWidget() const;
+    virtual QObject *signalSender() const;
+    
+public slots:
+    void showClicked();
+    void cancelClicked();
+
+private:
+    bool constructDialog(const QVariantMap &parameters);
+    
+signals:
+    void deviceDialogClosed();
+    void deviceDialogData(QVariantMap data);
+    
+private:
+    HbDocumentLoader    *mLoader;
+    QStandardItemModel  *mContentItemModel;
+    HbLabel             *mHeading;
+    HbLabel             *mFileName;
+    HbLabel             *mFileSize;
+    HbLabel             *mFileCount;
+    HbAction            *mShow;
+    HbAction            *mCancel;
+    HbDialog            *mDialog;
+    int                 mFileSz;
+    
+    Q_DISABLE_COPY(BTRecvcompletedDialogWidget)
+    };
+
+
+
+#endif /* BTRECVCOMPLETEDDIALOGWIDGET_H_ */
--- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvprgrsdialogwidget.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvprgrsdialogwidget.h	Fri Jul 23 15:57:13 2010 +0300
@@ -15,8 +15,8 @@
 *
 */
 
-#ifndef BTRECVPRGRSDIALOGWIDGET_H_
-#define BTRECVPRGRSDIALOGWIDGET_H_
+#ifndef BTRECVPRGRSDIALOGWIDGET_H
+#define BTRECVPRGRSDIALOGWIDGET_H
 
 #include <QObject>
 #include <QVariantMap>
@@ -73,4 +73,4 @@
     Q_DISABLE_COPY(BTRecvPrgrsDialogWidget)
     };
 
-#endif /* BTRECVPRGRSDIALOGWIDGET_H_ */
+#endif /* BTRECVPRGRSDIALOGWIDGET_H */
--- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -31,6 +31,7 @@
 #include "btmoredevicesdialogwidget.h"
 #include "btsenddialogwidget.h"
 #include "btdevicedialogrecvquerywidget.h"
+#include "btrecvcompleteddialogwidget.h"
 #include <hbtranslator.h>
 
 Q_EXPORT_PLUGIN2(btdevicedialogplugin, BtDeviceDialogPlugin)
@@ -206,7 +207,7 @@
             break;
         case TBluetoothDialogParams::EQuery:
             deviceDialog =
-                new BtDeviceDialogQueryWidget(HbMessageBox::MessageTypeQuestion, parameters);
+                new BtDeviceDialogQueryWidget(HbMessageBox::MessageTypeWarning,parameters);
             break;
         case TBluetoothDialogParams::EInput:
             deviceDialog = new BtDeviceDialogInputWidget(parameters);
@@ -229,6 +230,9 @@
         case TBluetoothDialogParams::EReceiveProgress:
             deviceDialog = new BTRecvPrgrsDialogWidget(parameters);
             break;
+        case TBluetoothDialogParams::EReceiveDone:
+            deviceDialog = new BTRecvcompletedDialogWidget(parameters);
+            break;
         default:
             d->mError = UnknownDeviceDialogError;
             break;
--- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -35,7 +35,6 @@
     mLastError = NoError;
     mShowEventReceived = false;
     mMessageBox = new HbMessageBox(type);
-    
     resetProperties();
     constructQueryDialog(parameters);
     TRACE_EXIT
@@ -129,7 +128,7 @@
         mLastError = UnknownDeviceDialogError;
         return;
     }
-    title = QString(hbTrId("txt_bt_title_pairing_with_1"));
+
     param = parameters.value( keyStr );
     int key = param.toInt();
     switch ( key ) {
@@ -139,7 +138,12 @@
         case EPasskeyDisplay:
             prompt = QString( hbTrId( "txt_bt_info_enter_the_following_code_to_the_1" ) );
             break;
-        // Note dialogs, but not Notification dialogs
+        case EPairingFailureRetry:
+            prompt = QString( hbTrId( "txt_bt_info_pairing_with_1_failed_either_the_pas" ) );
+            break;
+        case EPairingFailureOk:
+            prompt = QString( hbTrId( "txt_bt_info_unable_to_pair_with_1" ) );
+            break;
         // Input dialogs
         case EPinInput:
         case EObexPasskeyInput:
@@ -154,18 +158,41 @@
     if ( repls > 0 ) {
         name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) );
         prompt = prompt.arg( name.toString() );
-        addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) );
-        // todo: Formating the prompt need to be discussed with UI designer
-        // The passcode could be displayed on a separate row if it the label did support
-        // the use of newline escape character.
-        prompt.append(tr(" "));
-        prompt.append(addval.toString());
+        if(key != EPairingFailureRetry && key != EPairingFailureOk)
+            {
+            addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) );
+            // todo: Formating the prompt need to be discussed with UI designer
+            // The passcode could be displayed on a separate row if it the label did support
+            // the use of newline escape character.
+            prompt.append(tr("\n\n")); // insert 2 newlines for clarity
+            prompt.append(addval.toString());
+            if(key == EPasskeyDisplay)
+                {
+                prompt.append("\n");   
+                }
+            }
     }
-    title = title.arg(name.toString());
     // set property value to this dialog widget
-    mMessageBox->setHeadingWidget(new HbLabel(title));
+    if(key != EPairingFailureRetry && key != EPairingFailureOk)
+        {
+        title = QString(hbTrId("txt_bt_title_pairing_with_1"));
+        title = title.arg(name.toString());
+        mMessageBox->setHeadingWidget(new HbLabel(title));
+        mMessageBox->setIconVisible(false);
+        mMessageBox->setStandardButtons( HbMessageBox::Yes | HbMessageBox::No);
+        }
+    else
+        {
+        if(key == EPairingFailureRetry)
+            {
+            mMessageBox->setStandardButtons( HbMessageBox::Retry | HbMessageBox::Cancel);
+            }
+        else
+            {
+            mMessageBox->setStandardButtons( HbMessageBox::Ok);
+            }
+        }
     mMessageBox->setText( prompt );
-    mMessageBox->setIconVisible(false);
     TRACE_EXIT
 }
 
--- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -20,13 +20,16 @@
 
 #include <hblistview.h>
 #include <hbtoolbar.h>
-#include <hbselectiondialog.h>
+
 
 #include <qstandarditemmodel.h>
 #include <hbaction.h>
 #include <xqconversions.h>
 #include <qtranslator.h>
 #include <qcoreapplication.h>
+#include <bluetoothdevicedialogs.h>
+#include <btuidevtypemap.h>
+#include <btuiiconutil.h>
 
 const char* DOCML_BTDEV_SEARCH_DIALOG = ":/docml/bt-device-search-dialog.docml";
 
@@ -39,13 +42,19 @@
 
 BTDeviceSearchDialogWidget::BTDeviceSearchDialogWidget(const QVariantMap &parameters)
     {
-    mDeviceLstIdx = 0;
-    mViewByChosen = false;
-    mSelectedType = 0;
-    mDeviceDialogData = 0;
+//    mDeviceLstIdx = 0;
+//    mViewByChosen = false;
+    mSelectedDeviceType = 0;
+ //   mDeviceDialogData = 0;
     mLoader = 0;
     mContentItemModel = 0;
     mStopRetryFlag = 0; // Stop 
+    mQuery = 0;
+    mSelectedDeviceType |= (BtuiDevProperty::AVDev | BtuiDevProperty::Computer |
+            BtuiDevProperty::Phone | BtuiDevProperty::Peripheral |
+            BtuiDevProperty::LANAccessDev | BtuiDevProperty::Toy |
+            BtuiDevProperty::WearableDev | BtuiDevProperty::ImagingDev |
+            BtuiDevProperty::HealthDev | BtuiDevProperty::UncategorizedDev);       
     constructDialog(parameters);
     }
 
@@ -53,6 +62,9 @@
     {
     delete mLoader;
     delete mContentItemModel;
+    if ( mQuery ) {
+        delete mQuery;
+    }
     
  //   delete mRbl;
  //   delete mViewByDialog;
@@ -62,6 +74,7 @@
     {
     if(parameters.keys().at(0).compare("Search Completed")==0)
         {
+        mStopRetryFlag = 1; // Retry 
         mSearchLabel->hide();
         
         mSearchIconLabel->hide();
@@ -75,43 +88,40 @@
         }
     else
         {
-        device newDevice;
+        double cod  = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)).toDouble();
+        int uiMajorDevice;
+        int uiMinorDevice;
     
-       // newDevice.mDeviceName = parameters.value("deviceName").toString();
-        newDevice.mDeviceName = parameters.value(parameters.keys().at(0)).toString();
-        
-     //   newDevice.mDeviceType = parameters.value("deviceType").toString();
-        newDevice.mDeviceIdx = mDeviceLstIdx;
-        
-        mDeviceList.append(newDevice);
-        mDeviceLstIdx++;
-    
-        QStringList info;
-     //   if(!mViewByChosen)
-            {
-            info.append(newDevice.mDeviceName);
-       //     info.append(newDevice.mDeviceType);
-            QStandardItem* listitem = new QStandardItem();
-            listitem->setData(info, Qt::DisplayRole);
+        BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod);
+
+        BtSendDataItem devData;
+        devData[NameAliasRole] = QVariant(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString());
+        devData[ReadableBdaddrRole] = QVariant(parameters.value(QString::number(TBluetoothDialogParams::EAddress)).toString());
+        devData[CoDRole] = QVariant(cod);
+        devData[DeviceTypeRole] = QVariant(uiMajorDevice);
+        setMajorProperty(devData,BtuiDevProperty::Bonded,
+                parameters.value("Bonded").toBool());
+        setMajorProperty(devData,BtuiDevProperty::Blocked,
+                parameters.value("Blocked").toBool());
+        setMajorProperty(devData,BtuiDevProperty::Trusted,
+                parameters.value("Trusted").toBool());
+        setMajorProperty(devData,BtuiDevProperty::Connected,
+                parameters.value("Connected").toBool());
+        mData.append(devData);
         
-            listitem->setIcon(icon());
-        
-            mContentItemModel->appendRow(listitem);
-            }
-     /*   else
+        if(mSelectedDeviceType & devData[DeviceTypeRole].toInt())
             {
-            if(mDeviceTypeList[mSelectedType] == newDevice.mDeviceType)
-                {
-                info.append(newDevice.mDeviceName);
-                info.append(newDevice.mDeviceType);
-                QStandardItem* listitem = new QStandardItem();
-                listitem->setData(info, Qt::DisplayRole);
-    
-                listitem->setIcon(icon(newDevice.mDeviceType));
-    
-                mContentItemModel->appendRow(listitem);
-                }
-            }*/
+            QStandardItem* listitem = new QStandardItem();
+            QStringList info;
+            info.append(devData[NameAliasRole].toString());
+            listitem->setData(info, Qt::DisplayRole);
+            HbIcon icon =  getBadgedDeviceTypeIcon(devData[CoDRole].toDouble(),
+                    devData[MajorPropertyRole].toInt(),
+                    BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight);
+            listitem->setIcon(icon.qicon());
+            mContentItemModel->appendRow(listitem);    
+            mSelectedData.append(devData);
+            }
         }
                 
     return true;
@@ -168,7 +178,7 @@
         mSearchLabel->setPlainText(LOC_SEARCHING_DEVICE);
  
         mSearchIconLabel = qobject_cast<HbLabel*>(mLoader->findWidget("iconLabel"));
-        mSearchIconLabel->setIcon(icon());
+        mSearchIconLabel->setIcon(QIcon(QString(":/icons/qtg_large_bluetooth.svg")));
 
         mSearchDoneLabel = qobject_cast<HbLabel*>(mLoader->findWidget("searchDoneLabel"));
         mSearchDoneLabel->hide();
@@ -190,13 +200,16 @@
  //       connect(mStopRetryBtn, SIGNAL(clicked()), this, SLOT(stopRetryClicked()));
  //       connect(mViewByBtn, SIGNAL(clicked()), this, SLOT(viewByClicked()));
         
-        mViewByAction = static_cast<HbAction*>( mLoader->findObject( "viewaction" ) );
-        mViewByAction->disconnect(mSearchDevicesDialog);
+        mShowAction = static_cast<HbAction*>( mLoader->findObject( "viewaction" ) );
+        mShowAction->disconnect(mSearchDevicesDialog);
         
         mStopRetryAction = static_cast<HbAction*>( mLoader->findObject( "stopretryaction" ) );
         mStopRetryAction->disconnect(mSearchDevicesDialog);
         
-        connect(mViewByAction, SIGNAL(triggered()), this, SLOT(viewByClicked()));
+//        mCancelAction = static_cast<HbAction*>( mLoader->findObject( "cancelaction" ) );
+//        mCancelAction->disconnect(mSearchDevicesDialog);
+        
+        connect(mShowAction, SIGNAL(triggered()), this, SLOT(viewByClicked()));
         connect(mStopRetryAction, SIGNAL(triggered()), this, SLOT(stopRetryClicked()));
 
         connect(mSearchDevicesDialog, SIGNAL(aboutToClose()), this, SLOT(searchDialogClosed()));
@@ -205,10 +218,16 @@
         //setContentWidget(widget);
         }
     mSearchDevicesDialog->setBackgroundFaded(false);
-    mSearchDevicesDialog->setDismissPolicy(HbPopup::TapOutside);
+    mSearchDevicesDialog->setDismissPolicy(HbPopup::NoDismiss);
     mSearchDevicesDialog->setTimeout(HbPopup::NoTimeout);
     mSearchDevicesDialog->setAttribute(Qt::WA_DeleteOnClose);
     
+    mDevTypeList << hbTrId("txt_bt_list_audio_devices")
+            << hbTrId("txt_bt_list_computers") 
+            << hbTrId("txt_bt_list_input_devices") 
+            << hbTrId("txt_bt_list_phones") 
+            << hbTrId("txt_bt_list_other_devices");
+    
  /*   mViewByDialog = new HbDialog();
     mRbl = new HbRadioButtonList(mViewByDialog);
     connect(mRbl, SIGNAL(itemSelected(int)), this, SLOT(viewByItemSelected(int)));*/
@@ -216,20 +235,6 @@
     return true;
     }
 
-/*void BTDeviceSearchDialogWidget::hideEvent(QHideEvent *event)
-    {
- //   HbDialog::hideEvent(event);
-    QVariantMap val;
-    QVariant index(-1);
-    val.insert("selectedindex",index);
-    emit deviceDialogData(val);    
-    emit deviceDialogClosed();
-    }
-
-void BTDeviceSearchDialogWidget::showEvent(QShowEvent *event)
-    {
- //   HbDialog::showEvent(event);
-    }*/
 
 void BTDeviceSearchDialogWidget::stopRetryClicked()
     {
@@ -249,7 +254,7 @@
         mSearchLabel->setAlignment(Qt::AlignHCenter);
         mSearchLabel->setPlainText(LOC_SEARCHING_DEVICE);
         
-        mSearchIconLabel->setIcon(icon());     
+        mSearchIconLabel->setIcon(QIcon(QString(":/icons/qtg_large_bluetooth.svg")));     
         mSearchLabel->show();
         
         mSearchIconLabel->show();
@@ -292,58 +297,27 @@
 
 void BTDeviceSearchDialogWidget::viewByClicked()
     {
-    QStringList list;
-    list << "Select all" << "Audio devices" << "Computers" << "Input devices" << "Phones" << "Other devices";
-
-    HbSelectionDialog *query = new HbSelectionDialog;
-    query->setStringItems(list);
-    query->setSelectionMode(HbAbstractItemView::MultiSelection);
-
-    QList<QVariant> current;
-    current.append(QVariant(0));
-    query->setSelectedItems(current);
-
-    query->setAttribute(Qt::WA_DeleteOnClose);
-
-    query->open(this,SLOT(selectionDialogClosed(HbAction*)));
+    
+    if ( !mQuery ) {
+        mQuery = new HbSelectionDialog;
+        mQuery->setStringItems(mDevTypeList, 0);
+        mQuery->setSelectionMode(HbAbstractItemView::MultiSelection);
     
-    //connect(query, SIGNAL(finished(HbAction*)), this, SLOT(selectionDialogClosed(HbAction*)));
-    
-/*    mViewByDialog->setDismissPolicy(HbPopup::NoDismiss);
-    mViewByDialog->setTimeout(HbPopup::NoTimeout);
+        QList<QVariant> current;
+        current.append(QVariant(0));
+        mQuery->setSelectedItems(current);
+ 
+        //todo need to check whether the dialog is destroyed without setting this flag
+        //if not destoryed then set this flag in the destructor and then delete it
+        
+//        mQuery->setAttribute(Qt::WA_DeleteOnClose);
+        // Set the heading for the dialog.
+        HbLabel *headingLabel = new HbLabel(hbTrId("txt_bt_title_show"), mQuery);
+        mQuery->setHeadingWidget(headingLabel);
+    }
+    mQuery->open(this,SLOT(selectionDialogClosed(HbAction*)));
 
-    bool foundEntry = false;
-    QStringList st;
-    st << "All";
-    mDeviceTypeList.clear();
-    for(int i = 0; i < mDeviceList.count(); i++)
-        {
-        for(int j = 0; j < mDeviceTypeList.count(); j++)
-            {
-            if(mDeviceTypeList[j] == mDeviceList[i].mDeviceType)
-                {
-                foundEntry = true;
-                break;
-                }
-            }
-        if(!foundEntry)
-            {
-            mDeviceTypeList.append(mDeviceList[i].mDeviceType);
-            }
-        foundEntry = false;
-        }
-    
-    for(int k = 0; k < mDeviceTypeList.count(); k++)
-        {
-        st << mDeviceTypeList[k];
-        }
-    
-    mRbl->setItems(st);
-    mViewByDialog->setContentWidget(mRbl);
-    mViewByDialog->setMaximumHeight(300);
-    mViewByDialog->setMaximumWidth(500);
-
-    mViewByDialog->show();*/
+     
     }
 
 void BTDeviceSearchDialogWidget::searchDialogClosed() 
@@ -358,6 +332,49 @@
 void BTDeviceSearchDialogWidget::selectionDialogClosed(HbAction* action)
     {
     Q_UNUSED(action);
+    
+    disconnect( mQuery ); 
+    int devTypesWanted = 0;
+
+    if (action == mQuery->actions().first()) {  // user pressed "Ok"
+        // Get selected items.
+        QList<QVariant> selections;
+        selections = mQuery->selectedItems();
+        
+        for (int i=0; i < selections.count(); i++) {
+            switch (selections.at(i).toInt()) {
+            case BtUiDevAudioDevice:
+                devTypesWanted |= BtuiDevProperty::AVDev;
+                break;
+            case BtUiDevComputer:
+                devTypesWanted |= BtuiDevProperty::Computer;
+                break;
+            case BtUiDevInputDevice:
+                devTypesWanted |= BtuiDevProperty::Peripheral;
+                break;
+            case BtUiDevPhone:
+                devTypesWanted |= BtuiDevProperty::Phone;
+                break;
+            case BtUiDevOtherDevice:
+                devTypesWanted |= (BtuiDevProperty::LANAccessDev |
+                        BtuiDevProperty::Toy |
+                        BtuiDevProperty::WearableDev |
+                        BtuiDevProperty::ImagingDev |
+                        BtuiDevProperty::HealthDev |
+                        BtuiDevProperty::UncategorizedDev);
+                break;
+            default:
+                // should never get here
+                break;
+            }
+        }
+    }
+    else
+        {
+        devTypesWanted = mSelectedDeviceType;
+        }
+        
+    
 
  /*   HbSelectionDialog *dlg = (HbSelectionDialog*)(sender());
     if(dlg->actions().first() == action) {
@@ -365,6 +382,34 @@
      } 
     else if(dlg->actions().at(1) == action) {
      }*/
+    
+    if((devTypesWanted != mSelectedDeviceType) &&(devTypesWanted !=0))
+        {
+        mSelectedDeviceType = devTypesWanted;
+//        mViewByChosen = true;
+        delete mContentItemModel;
+        mContentItemModel = new QStandardItemModel(this);
+        mListView->setModel(mContentItemModel);
+        mSelectedData.clear();
+        for(int i=0;i<mData.count();i++)
+            {
+            const BtSendDataItem& qtdev = mData[i];
+            if(devTypesWanted & qtdev[DeviceTypeRole].toInt() )
+                {
+                QStandardItem* listitem = new QStandardItem();
+                QStringList info;
+                info.append(qtdev[NameAliasRole].toString());
+    
+                listitem->setData(info, Qt::DisplayRole);
+                HbIcon icon =  getBadgedDeviceTypeIcon(qtdev[CoDRole].toDouble(),
+                        qtdev[MajorPropertyRole].toInt(),
+                         BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight);
+                listitem->setIcon(icon.qicon());
+                mContentItemModel->appendRow(listitem);        
+                mSelectedData.append(qtdev);
+                }
+            }
+        }
     }
 
 void BTDeviceSearchDialogWidget::deviceSelected(const QModelIndex& modelIndex)
@@ -382,109 +427,19 @@
         }
     
     QVariantMap val;
-    QVariant index(row);
-    val.insert("selectedindex",index);
+//    QVariant index(row);
+//    val.insert("selectedindex",index);
+    
+    const BtSendDataItem& qtdev = mSelectedData.at(row);
+    val.insert("selectedindex",QVariant(row));
+    val.insert("devicename",QVariant(qtdev[NameAliasRole]));
+    val.insert("deviceaddress",QVariant(qtdev[ReadableBdaddrRole]));
+    val.insert("deviceclass",QVariant(qtdev[CoDRole]));
+
     emit deviceDialogData(val);
 //    mDeviceDialogData = 1;//flag is to say that device dialog data is emitted required when we cancel the dialog
     //emit deviceDialogClosed();
   //  this->close();
     }
 
-//void BTDeviceSearchDialogWidget::viewByItemSelected(int index)
-  //  {
-    //  (void) index;
- /*   if(index == 0)
-        {
-        //Option 'All' selected    
-        mViewByDialog->close();
-        delete mContentItemModel;
-        mContentItemModel = new QStandardItemModel(this);
-        mListView->setModel(mContentItemModel);
-        mViewByChosen = false;
 
-        for(int i = 0; i < mDeviceList.count(); i++)
-            {        
-            QStandardItem* listitem = new QStandardItem();
-                
-            QStringList info;
-            info << mDeviceList[i].mDeviceName << mDeviceList[i].mDeviceType ;
-            listitem->setData(info, Qt::DisplayRole);
-    
-            //listitem->setIcon(icon(mDeviceList[i].mDeviceType));
-    
-            mContentItemModel->appendRow(listitem);
-            }
-        }
-    else
-        {
-        index--;
-        mSelectedType = index;
-        mViewByDialog->close();
-        
-        delete mContentItemModel;
-        mContentItemModel = new QStandardItemModel(this);
-        mListView->setModel(mContentItemModel);
-    
-        mDeviceLstOfType.clear();
-        for(int i = 0; i < mDeviceList.count(); i++)
-            {
-            if(mDeviceList[i].mDeviceType == mDeviceTypeList[index])
-                {
-                mDeviceLstOfType.append(mDeviceList[i]);
-            
-                QStandardItem* listitem = new QStandardItem();
-                
-                QStringList info;
-                info << mDeviceList[i].mDeviceName << mDeviceTypeList[index];
-                listitem->setData(info, Qt::DisplayRole);
-        
-                //listitem->setIcon(icon(mDeviceTypeList[index]));
-        
-                mContentItemModel->appendRow(listitem);
-                }
-            }
-        mViewByChosen = true;
-        }*/
- //   }
-
-QIcon BTDeviceSearchDialogWidget::icon()
-    {
- /*   if(deviceType == "Audio")
-        {
-        return (QIcon(QString(":/icons/qgn_prop_bt_audio.svg")));
-        }
-    else if(deviceType == "Car-kit")
-        {
-        return (QIcon(QString(":/icons/qgn_prop_bt_car_kit.svg")));
-        }
-    else if(deviceType == "Computer")
-        {
-        return (QIcon(QString(":/icons/qgn_prop_bt_computer.svg")));
-        }
-    else if(deviceType == "Headset")
-        {
-        return (QIcon(QString(":/icons/qgn_prop_bt_headset.svg")));
-        }
-    else if(deviceType == "Keyboard")
-        {
-        return (QIcon(QString(":/icons/qgn_prop_bt_keyboard.svg")));
-        }
-    else if(deviceType == "Mouse")
-        {
-        return (QIcon(QString(":/icons/qgn_prop_bt_mouse.svg")));
-        }
-    else if(deviceType == "Phone")
-        {
-        return (QIcon(QString(":/icons/qgn_prop_bt_phone.svg")));
-        }
-    else if(deviceType == "Printer")
-        {
-        return (QIcon(QString(":/icons/qgn_prop_bt_printer.svg")));
-        }
-    else
-        {
-        return (QIcon(QString(":/icons/qgn_prop_bt_unknown.svg")));
-        }*/
-    return QIcon(QString(":/icons/qtg_large_bluetooth.svg"));
-    }
-
--- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -15,14 +15,17 @@
  *
  */
 
-
+#include "btmoredevicesdialogwidget.h"
 #include <hblabel.h>
 #include <hblistview.h>
 #include <hbtoolbar.h>
 #include <hbpushbutton.h>
 #include <hblistwidget.h>
 #include <qstandarditemmodel.h>
-#include "btmoredevicesdialogwidget.h"
+#include <btuidevtypemap.h>
+#include <btuiiconutil.h>
+#include <bluetoothdevicedialogs.h>
+
 
 
 const char* DOCML_BT_MORE_DEV_DIALOG = ":/docml/bt-more-devices-dialog.docml";
@@ -55,21 +58,46 @@
 
 bool BTMoreDevicesDialogWidget::setDeviceDialogParameters(const QVariantMap &parameters)
     {
-    QStandardItem* listitem = new QStandardItem();
-    QStringList info;
-   // info.append(parameters.value("deviceName").toString());
-    //info.append(parameters.value("deviceType").toString());
-    info.append(parameters.value(parameters.keys().at(0)).toString());
+    double cod  = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)).toDouble();
+    int uiMajorDevice;
+    int uiMinorDevice;
+
+    BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod);
+    if ((uiMajorDevice & BtuiDevProperty::Phone)||(uiMajorDevice & BtuiDevProperty::Computer) )
+        {
+        BtSendDataItem devData;
+        devData[NameAliasRole] = QVariant(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString());
+        devData[ReadableBdaddrRole] = QVariant(parameters.value(QString::number(TBluetoothDialogParams::EAddress)).toString());
+        devData[CoDRole] = QVariant(cod);
+        
+        setMajorProperty(devData,BtuiDevProperty::Bonded,
+                parameters.value("Bonded").toBool());
+        setMajorProperty(devData,BtuiDevProperty::Blocked,
+                parameters.value("Blocked").toBool());
+        setMajorProperty(devData,BtuiDevProperty::Trusted,
+                parameters.value("Trusted").toBool());
+        setMajorProperty(devData,BtuiDevProperty::Connected,
+                parameters.value("Connected").toBool());
+        mData.append(devData);
+        
+        QStandardItem* listitem = new QStandardItem();
+        QStringList info;
+        info.append(devData[NameAliasRole].toString());
+
+        listitem->setData(info, Qt::DisplayRole);
+        HbIcon icon =  getBadgedDeviceTypeIcon(devData[CoDRole].toDouble(),
+                devData[MajorPropertyRole].toInt(),
+                BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight);        
+        listitem->setIcon(icon.qicon());
+     //   listitem->setIcon(icon(parameters.value("deviceType").toString()));
+        
+        mContentItemModel->appendRow(listitem);        
+        }
+    return true;
+    }
 
 
-    listitem->setData(info, Qt::DisplayRole);
-    listitem->setIcon(icon());
- //   listitem->setIcon(icon(parameters.value("deviceType").toString()));
-    
-    mContentItemModel->appendRow(listitem);
 
-    return true;
-    }
 
 int BTMoreDevicesDialogWidget::deviceDialogError() const
     {
@@ -213,8 +241,12 @@
     {
     int row = modelIndex.row();
     QVariantMap val;
-    QVariant index(row);
-    val.insert("selectedindex",index);
+//    QVariant index(row);
+    const BtSendDataItem& qtdev = mData.at(row);
+    val.insert("selectedindex",QVariant(row));
+    val.insert("devicename",QVariant(qtdev[NameAliasRole]));
+    val.insert("deviceaddress",QVariant(qtdev[ReadableBdaddrRole]));
+    val.insert("deviceclass",QVariant(qtdev[CoDRole]));
     emit deviceDialogData(val);
   //  mDeviceDialogData = 1;//flag is to say that device dialog data is emitted required when we cancel the dialog    
    // this->close();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvcompleteddialogwidget.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,202 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  BTRecvcompletedDialogWidget class declaration.
+*
+*/
+
+#include <xqaiwrequest.h>
+#include <xqappmgr.h>
+#include <QThreadPool>
+#include "btrecvcompleteddialogwidget.h"
+#include "bluetoothdevicedialogs.h"
+
+const char* DOCML_BT_RECV_CMPLTD_DIALOG = ":/docml/bt-receive-done-dialog.docml";
+const qint64 KBluetoothMsgsConversationId = 0x01;
+
+
+CoversationViewServiceStarter::CoversationViewServiceStarter(qint64 conversationId)
+:mCnvId(conversationId)
+    {
+    
+    }
+
+CoversationViewServiceStarter::~CoversationViewServiceStarter()
+    {
+    
+    }
+
+void CoversationViewServiceStarter::run()
+    {
+    QList<QVariant> args;
+    QString serviceName("com.nokia.services.hbserviceprovider");
+    QString operation("open(qint64)");
+    XQAiwRequest* request;
+    XQApplicationManager appManager;
+    request = appManager.create(serviceName, "conversationview", operation, false); // not embedded
+    if ( request == NULL )
+        {
+        return;       
+        }
+    args << QVariant(mCnvId);
+    request->setArguments(args);
+    request->send();
+    delete request;
+    }
+
+
+BTRecvcompletedDialogWidget::BTRecvcompletedDialogWidget(const QVariantMap &parameters)
+{
+    mLoader = 0;
+    constructDialog(parameters);
+}
+
+BTRecvcompletedDialogWidget::~BTRecvcompletedDialogWidget()
+{
+    if(mLoader)
+    {
+        delete mLoader;
+        mLoader = NULL;
+    }
+}
+
+bool BTRecvcompletedDialogWidget::setDeviceDialogParameters(const QVariantMap &parameters)
+{
+    return true;
+}
+
+int BTRecvcompletedDialogWidget::deviceDialogError() const
+{
+    return 0;
+}
+
+void BTRecvcompletedDialogWidget::closeDeviceDialog(bool byClient)
+{
+    Q_UNUSED(byClient);
+    mDialog->close();
+}
+
+HbPopup* BTRecvcompletedDialogWidget::deviceDialogWidget() const
+{
+    return mDialog;
+}
+
+QObject* BTRecvcompletedDialogWidget::signalSender() const
+{
+    return const_cast<BTRecvcompletedDialogWidget*>(this);
+}
+
+bool BTRecvcompletedDialogWidget::constructDialog(const QVariantMap &parameters)
+{
+    mLoader = new HbDocumentLoader();
+    bool ok = false;
+    
+    mLoader->load(DOCML_BT_RECV_CMPLTD_DIALOG, &ok);
+    if(ok)
+    {
+        mDialog = qobject_cast<HbDialog*>(mLoader->findWidget("recvCompleteddialog"));
+        mHeading = qobject_cast<HbLabel*>(mLoader->findWidget("heading"));
+        
+        mFileName = qobject_cast<HbLabel*>(mLoader->findWidget("fileName"));
+        mFileSize = qobject_cast<HbLabel*>(mLoader->findWidget("fileSize"));
+        mFileCount = qobject_cast<HbLabel*>(mLoader->findWidget("fileCount_label"));
+        mFileCount->setVisible(false);
+        
+        //TODO - set icon based on the file icon.
+        
+        mShow = qobject_cast<HbAction*>(mLoader->findObject("showaction"));
+        mCancel = qobject_cast<HbAction*>(mLoader->findObject("cancelaction"));
+        
+        QString headingStr(hbTrId("txt_bt_title_received_from_1"));
+        QString senderName(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString());
+        mHeading->setPlainText(headingStr.arg(senderName));
+        mDialog->setHeadingWidget(mHeading);
+        
+        mFileName->setPlainText(parameters.value(QString::number(TBluetoothDeviceDialog::EReceivingFileName)).toString());
+        
+        mFileSz = parameters.value(QString::number(TBluetoothDeviceDialog::EReceivingFileSize)).toInt();
+        
+        //Format the file size into a more readable format
+        if ( mFileSz >> 20 )    // size in MB
+            {       
+            float sizeInMB = 0;
+            sizeInMB = ((float)mFileSz ) / (1024*1024);
+            QString fileSzMb;
+            fileSzMb.setNum(sizeInMB);
+            //TODO - check for localization
+            fileSzMb.append(QString(" Mb"));
+            mFileSize->setPlainText(fileSzMb);
+            }
+        
+        else if( mFileSz >> 10 )        // size in KB
+            {
+            TInt64 sizeInKB = 0;
+            sizeInKB = mFileSz >> 10;
+            QString fileSzKb;
+            fileSzKb.setNum(sizeInKB);
+            //TODO - check for localization
+            fileSzKb.append(QString(" Kb"));
+            mFileSize->setPlainText(fileSzKb);
+            }
+
+        else                              // size is unknown or less than 1K
+            {
+            QString fileSzB;
+            fileSzB.setNum(mFileSz);
+            //TODO - check for localization
+            fileSzB.append(QString(" Bytes"));
+            mFileSize->setPlainText(fileSzB);
+            }
+
+        //Set the received file count
+        int fCnt = parameters.value(QString::number(TBluetoothDeviceDialog::EReceivedFileCount)).toInt();
+        if(fCnt > 1)
+            {
+            mFileCount->setVisible(true);  
+            
+            QString fCntStr(hbTrId("txt_bt_info_ln_other_files_received", (fCnt-1)));
+            mFileCount->setPlainText(fCntStr);
+            }
+    }
+
+    mDialog->setBackgroundFaded(false);
+    mDialog->setDismissPolicy(HbPopup::NoDismiss);
+    mDialog->setTimeout(HbPopup::NoTimeout);
+     
+    connect(mShow, SIGNAL(triggered()), this, SLOT(showClicked()));
+    connect(mCancel, SIGNAL(triggered()), this, SLOT(cancelClicked()));
+    
+    return true;
+}
+
+void BTRecvcompletedDialogWidget::showClicked()
+{   
+    CoversationViewServiceStarter* service = new CoversationViewServiceStarter(KBluetoothMsgsConversationId);
+    service->setAutoDelete(true);
+    
+    QThreadPool::globalInstance()->start(service);
+          
+    QVariantMap data;
+    data.insert(QString("actionResult"), QVariant(TBluetoothDialogParams::EShow));
+    emit deviceDialogData(data);
+    emit deviceDialogClosed();
+}
+
+void BTRecvcompletedDialogWidget::cancelClicked()
+{
+    QVariantMap data;
+    data.insert(QString("actionResult"), QVariant(TBluetoothDialogParams::ECancelShow));
+    emit deviceDialogData(data);
+    emit deviceDialogClosed();
+}
+
--- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -118,6 +118,7 @@
             sizeInMB = ((float)mFileSz ) / (1024*1024);
             QString fileSzMb;
             fileSzMb.setNum(sizeInMB);
+            //TODO - check for localization
             fileSzMb.append(QString(" Mb"));
             mFileSize->setPlainText(fileSzMb);
             }
@@ -128,6 +129,7 @@
             sizeInKB = mFileSz >> 10;
             QString fileSzKb;
             fileSzKb.setNum(sizeInKB);
+            //TODO - check for localization
             fileSzKb.append(QString(" Kb"));
             mFileSize->setPlainText(fileSzKb);
             }
@@ -136,6 +138,7 @@
             {
             QString fileSzB;
             fileSzB.setNum(mFileSz);
+            //TODO - check for localization
             fileSzB.append(QString(" Bytes"));
             mFileSize->setPlainText(fileSzB);
             }
@@ -146,8 +149,8 @@
             {
             mFileCount->setVisible(true);  
             
-            QString fCntStr(hbTrId("txt_bt_info_ln_files_already_received"));
-            mFileCount->setPlainText(fCntStr.arg(fCnt));
+            QString fCntStr(hbTrId("txt_bt_info_ln_files_already_received", fCnt));
+            mFileCount->setPlainText(fCntStr);
             }
     }
 
@@ -164,7 +167,7 @@
 void BTRecvPrgrsDialogWidget::hideClicked()
 {
     QVariantMap data;
-    data.insert(QString("actionResult"), QVariant(true));
+    data.insert(QString("actionResult"), QVariant(TBluetoothDialogParams::EHide));
     emit deviceDialogData(data);
     emit deviceDialogClosed();
 }
@@ -172,7 +175,7 @@
 void BTRecvPrgrsDialogWidget::cancelClicked()
 {
     QVariantMap data;
-    data.insert(QString("actionResult"), QVariant(false));
+    data.insert(QString("actionResult"), QVariant(TBluetoothDialogParams::ECancelReceive));
     emit deviceDialogData(data);
     emit deviceDialogClosed();
 }
--- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -15,14 +15,13 @@
  *
  */
 
-
+#include "btsenddialogwidget.h"
 #include <hblabel.h>
 #include <hblistview.h>
 #include <hbtoolbar.h>
 #include <hblistwidget.h>
 #include <qstandarditemmodel.h>
 #include <hbaction.h>
-#include "btsenddialogwidget.h"
 
 
 #define LOC_SENDING_FILES_TO_DEVICE hbTrId("txt_bt_title_sending_file_l1l2_to_3")
--- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifdeviceselector.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifdeviceselector.h	Fri Jul 23 15:57:13 2010 +0300
@@ -30,6 +30,7 @@
 #include <btservices/devdiscoveryobserver.h>
 #include "bluetoothnotification.h"
 #include <btservices/btdevrepository.h>
+#include <hb/hbcore/hbsymbianvariant.h>
 
 class CBTNotifServer;
 class CAdvanceDevDiscoverer;
@@ -154,7 +155,18 @@
             TBluetoothDialogParams::TBTDialogType aType,
             TBTDialogResourceId aResourceId );
 			
-	void LoadUsedDevicesL();		
+	void LoadUsedDevicesL();	
+	
+	void AddDataL(CHbSymbianVariantMap* aMap, const TDesC& aKey, const TAny* aData, 
+	        CHbSymbianVariant::TType aDataType);
+	
+	void setMajorProperty(TInt aMajorProperty, TInt prop, TBool addto);
+	
+	TBool isBonded( const CBTDevice &dev );
+	
+	CBtDevExtension* GetDeviceFromRepositoryL( const TBTDevAddr& addr );
+	
+	void SendSelectedDeviceL( CHbSymbianVariantMap& aData );
     
 private: // data    
 
@@ -176,9 +188,9 @@
     CAdvanceDevDiscoverer* iDiscoverer;
     
     /**
-     * do not own the elements in the array.
+     *  own's the elements in the array.
      */
-    RPointerArray<CBtDevExtension> iDevices;
+    RDevExtensionArray iDevices;
     
     /**
      * The message for a pending device selection request from a RNotifier client.
--- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifoutgoingpairinghandler.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifoutgoingpairinghandler.h	Fri Jul 23 15:57:13 2010 +0300
@@ -23,7 +23,11 @@
 #include <e32property.h>
 #include "btnotifclientserver.h"
 #include "btnotifBasePairingHandler.h"
+#include <hb/hbcore/hbsymbianvariant.h>
+#include "btnotificationresult.h"
+#include "bluetoothdevicedialogs.h"
 
+class CBluetoothNotification;
 
 enum TBTOutgoingPairMode
     {
@@ -53,7 +57,8 @@
  *
  *  @since Symbian^4
  */
-NONSHARABLE_CLASS( CBTNotifOutgoingPairingHandler ) : public CBTNotifBasePairingHandler
+NONSHARABLE_CLASS( CBTNotifOutgoingPairingHandler ) : public CBTNotifBasePairingHandler,
+                                                      public MBTNotificationResult
     {
 
 public:
@@ -70,8 +75,36 @@
      * Destructor
      */
     ~CBTNotifOutgoingPairingHandler();
+
     
-private: // From CBTEngPairBase
+    // from base class MBTNotificationResult
+
+    /**
+     * From MBTNotificationResult.
+     * Handle an intermediate result from a user query.
+     * This function is called if the user query passes information
+     * back before it has finished i.e. is dismissed. The final acceptance/
+     * denial of a query is passed back in MBRNotificationClosed.
+     *
+     * @since Symbian^4
+     * @param aData the returned data. The actual format 
+     *              is dependent on the actual notifier.
+     */
+    virtual void MBRDataReceived( CHbSymbianVariantMap& aData );
+
+    /**
+     * From MBTNotificationResult.
+     * The notification is finished. The resulting data (e.g. user input or
+     * acceptance/denial of the query) is passed back here.
+     *
+     * @since Symbian^4
+     * @param aErr KErrNone or one of the system-wide error codes.
+     * @param aData the returned data. The actual format 
+     *              is dependent on the actual notifier.
+     */
+    virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData );
+    
+private:
     
     /**
      * Start observing the result of pairing which was originated from
@@ -153,6 +186,27 @@
     void HandleError( CBtSimpleActive* aActive, TInt aError );
 
 private:
+    /**
+     * Get a notification and configure it according to the current operation.
+     *
+     * @since Symbian^4
+     * @param aType The notification type.
+     * @param aResourceId Identifier for the resource to display.
+     */
+    void PrepareNotificationL( TBluetoothDialogParams::TBTDialogType aType,
+                TBTDialogResourceId aResourceId );
+
+    /**
+     * Handle the result from a notification that is finished.
+     *
+     * @since Symbian^4
+     * @param aErr KErrNone or one of the system-wide error codes.
+     * @param aData The returned data. The actual format 
+     *              is dependent on the actual notifier.
+     */
+    void NotificationClosedL( TInt aError, const TDesC8& aData );
+
+private:
 
     /**
      * C++ default constructor
@@ -169,6 +223,16 @@
      */
     void DoPairingL();
     
+    /**
+     * Ask the user to retry pairing.
+     */    
+    void ShowPairingRetryDialog();
+    
+    /**
+     * Tell the user the pairing failed.
+     */    
+    void ShowPairingFailureDialog();
+    
 private: // data
 	
     /**
@@ -200,6 +264,17 @@
      * the current pairing mode this class is in
      */
     TBTOutgoingPairMode iPairMode;
+
+    /**
+     * Pointer to an outstanding user interaction.
+     * Not own.
+     */
+    CBluetoothNotification* iNotification;
+
+    /**
+     * Number of pairing attempt
+     */
+    TInt iPairingAttempt;
     
     };
 
--- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifbasepairinghandler.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifbasepairinghandler.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -138,7 +138,7 @@
     TBTDialogResourceId resourceId = EPairingSuccess;
     if(KErrNone != aResult)
         {
-        resourceId = EPairingFailure;
+        resourceId = EPairingFailureOk;
         }
     notification->SetNotificationType( TBluetoothDialogParams::ENote, resourceId );
     const CBtDevExtension* dev = iParent.BTDevRepository().Device(iAddr);
--- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -20,7 +20,6 @@
 #include <btservices/advancedevdiscoverer.h>
 #include <btservices/btdevextension.h>
 #include <hb/hbcore/hbdevicedialogsymbian.h>
-#include <hb/hbcore/hbsymbianvariant.h>
 #include "btnotifdeviceselector.h"
 
 #include "btnotifserver.h"
@@ -174,7 +173,7 @@
 void CBTNotifDeviceSelector::MBRDataReceived( CHbSymbianVariantMap& aData )
     {
     TInt err = KErrCancel;
-    if(aData.Keys().MdcaPoint(0).Compare(_L("selectedindex"))==KErrNone)
+    if(aData.Keys().MdcaPoint(aData.Keys().MdcaCount()-1).Compare(_L("selectedindex"))==KErrNone)
         {
         TInt val = *(static_cast<TInt*>(aData.Get(_L("selectedindex"))->Data()));
         BOstrace1( TRACE_DEBUG, TNAME_DEVLIST_2, "MBRDataReceived, val %d", val );
@@ -185,10 +184,11 @@
             TBTDeviceResponseParamsPckg devParams;    
             if (  val > -1 && val < iDevices.Count() )
                 {
-                devParams().SetDeviceAddress( iDevices[val]->Addr() );
+                TRAP(err,SendSelectedDeviceL(aData));
+             /*   devParams().SetDeviceAddress( iDevices[val]->Addr() );
                 devParams().SetDeviceClass(iDevices[val]->Device().DeviceClass());
                 devParams().SetDeviceName(iDevices[val]->Alias());
-                err = iMessage.Write( EBTNotifSrvReplySlot, devParams );
+                err = iMessage.Write( EBTNotifSrvReplySlot, devParams );*/
                 iNotification->RemoveObserver();
                 iNotification->Close(); // Also dequeues the notification from the queue.
                 iNotification = NULL;                
@@ -242,22 +242,61 @@
         const TInquirySockAddr& aAddr, const TDesC& aName )
     {
     // Todo: look for this device in repository before creating it.
-    CBtDevExtension* devext = CBtDevExtension::NewLC( aAddr, aName );
+    TBuf<KBTDevAddrSize * 2> addr; 
+    
+    
+    
+    CBtDevExtension* devext = GetDeviceFromRepositoryL(aAddr.BTAddr());
+    
+    if(!devext)
+        {
+        devext = CBtDevExtension::NewLC( aAddr, aName );
+        }
+    else
+        {
+        CleanupStack::PushL(devext);
+        }
     iDevices.AppendL( devext );
-    CleanupStack::Pop( devext );
+    CleanupStack::Pop( devext );    
     
     if(iNotification)
         {// conditional check required as CAdvanceDevDiscoverer sends discovered devices at times
          // even after canceldiscovery is issued and notification is set to NULL
          // this causes EExcDataAbort
     CHbSymbianVariantMap* map = iNotification->Data();
-        TBuf<KMaxKeyDesCLength> keyStr;
+/*    TBuf<KMaxKeyDesCLength> keyStr;
     CHbSymbianVariant* devEntry;
 
     keyStr.Num( TBluetoothDialogParams::EDialogExt + iDevices.Count() - 1 );
     devEntry = CHbSymbianVariant::NewL( (TAny*) &(devext->Alias()), 
             CHbSymbianVariant::EDes );
-    map->Add( keyStr, devEntry );
+    map->Add( keyStr, devEntry );*/
+    
+    User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceName,
+            devext->Alias()));
+    
+    devext->Addr().GetReadable(addr);
+    User::LeaveIfError(iNotification->SetData(TBluetoothDialogParams::EAddress,addr));
+    
+    TInt classOfDevice;
+    classOfDevice =  devext->Device().DeviceClass().DeviceClass();
+    User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceClass,classOfDevice));
+
+    TBool status;
+    status = isBonded( devext->Device());
+    
+ //   setMajorProperty(majorProperty, _L("Bonded"), isBonded( devArray[i]->Device() ));
+    AddDataL(map,_L("Bonded"),&status,CHbSymbianVariant::EBool);
+    status = devext->Device().GlobalSecurity().Banned();
+    AddDataL(map,_L("Blocked"),&status,
+            CHbSymbianVariant::EBool);
+    status = devext->Device().GlobalSecurity().NoAuthorise();
+    AddDataL(map,_L("Trusted"),&status,
+            CHbSymbianVariant::EBool);
+    status = devext->ServiceConnectionStatus() == EBTEngConnected;
+    AddDataL(map,_L("Connected"),&status,
+            CHbSymbianVariant::EBool);
+ 
     iNotification->Update();
         }
     }
@@ -371,6 +410,7 @@
 void CBTNotifDeviceSelector::LoadUsedDevicesL()
     {
     const RDevExtensionArray& devArray= iServer.DevRepository().AllDevices();
+    TBuf<KBTDevAddrSize * 2> addr; 
     for(TInt i=0; i< devArray.Count(); i++ )
         {
       const TTime& usedTime = devArray[i]->Device().Used();
@@ -381,14 +421,118 @@
             {
             iDevices.AppendL( devArray[i]->CopyL() );
             CHbSymbianVariantMap* map = iNotification->Data();
-            TBuf<KMaxKeyDesCLength> keyStr;
-            CHbSymbianVariant* devEntry;
+ //           TBuf<KMaxKeyDesCLength> keyStr;
+ //           CHbSymbianVariant* devEntry;
 
-            keyStr.Num( TBluetoothDialogParams::EDialogExt + iDevices.Count() - 1 );
-            devEntry = CHbSymbianVariant::NewL( (TAny*) &(devArray[i]->Alias()), 
-                    CHbSymbianVariant::EDes );
-            map->Add( keyStr, devEntry );
+  //          keyStr.Num( TBluetoothDialogParams::EDialogExt + iDevices.Count() - 1 );
+//            devEntry = CHbSymbianVariant::NewL( (TAny*) &(devArray[i]->Alias()), 
+  //                  CHbSymbianVariant::EDes );
+  //          map->Add( keyStr, devEntry, );
+            User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceName,
+                    devArray[i]->Alias()));
+//            AddDataL(map,keyStr,&(devArray[i]->Alias()),CHbSymbianVariant::EDes);
+            devArray[i]->Addr().GetReadable(addr);
+            User::LeaveIfError(iNotification->SetData(TBluetoothDialogParams::EAddress,addr));
+            addr.Zero();
+            TInt classOfDevice;
+            classOfDevice =  devArray[i]->Device().DeviceClass().DeviceClass();
+            User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceClass,classOfDevice));
+            
+            TBool status;
+            status = isBonded( devArray[i]->Device());
+            
+         //   setMajorProperty(majorProperty, _L("Bonded"), isBonded( devArray[i]->Device() ));
+            AddDataL(map,_L("Bonded"),&status,CHbSymbianVariant::EBool);
+            status = devArray[i]->Device().GlobalSecurity().Banned();
+            AddDataL(map,_L("Blocked"),&status,
+                    CHbSymbianVariant::EBool);
+            status = devArray[i]->Device().GlobalSecurity().NoAuthorise();
+            AddDataL(map,_L("Trusted"),&status,
+                    CHbSymbianVariant::EBool);
+            status = devArray[i]->ServiceConnectionStatus() == EBTEngConnected;
+            AddDataL(map,_L("Connected"),&status,
+                    CHbSymbianVariant::EBool);
+             // set blocked status:
+/*             setMajorProperty(majorProperty, BtuiDevProperty::Blocked, 
+                     devArray[i]->Device().GlobalSecurity().Banned() );
+             // set trusted status:
+             setMajorProperty(majorProperty, BtuiDevProperty::Trusted, 
+                     devArray[i]->Device().GlobalSecurity().NoAuthorise() );
+             // set connected status:
+             // EBTEngConnecting is an intermediate state between connected and not-connected, 
+             // we do not treat it as connected:         
+             setMajorProperty(majorProperty, BtuiDevProperty::Connected, devArray[i]->ServiceConnectionStatus() == EBTEngConnected);
+
+  */          
+
+ //           AddDataL(map,keyStr,&(devArray[i]->Alias()),CHbSymbianVariant::EDes);
             iNotification->Update();
             }
         }
     }
+
+
+
+/*!
+  Tells if the given device is bonded.
+*/
+TBool CBTNotifDeviceSelector::isBonded( const CBTDevice &dev )
+{
+    // todo: this has not addresses Just Works pairing mode yet.
+    return dev.IsValidPaired() && dev.IsPaired() &&
+        dev.LinkKeyType() != ELinkKeyUnauthenticatedUpgradable;
+}
+
+void CBTNotifDeviceSelector::AddDataL(CHbSymbianVariantMap* aMap, const TDesC& aKey, 
+    const TAny* aData, CHbSymbianVariant::TType aDataType)
+    {
+    CHbSymbianVariant* value = CHbSymbianVariant::NewL(aData, aDataType);
+    CleanupStack::PushL( value );
+    User::LeaveIfError( aMap->Add( aKey, value ) ); // aMap takes the ownership of value
+    CleanupStack::Pop( value );
+    }
+
+// ---------------------------------------------------------------------------
+// Tells if these two instances are for the same remote device
+// ---------------------------------------------------------------------------
+//
+TBool MatchDeviceAddress(const TBTDevAddr* aAddr, const CBtDevExtension& aDev)
+    {
+    return *aAddr == aDev.Device().BDAddr();
+    }
+
+
+CBtDevExtension* CBTNotifDeviceSelector::GetDeviceFromRepositoryL( const TBTDevAddr& aAddr ) 
+{
+    const RDevExtensionArray& devArray= iServer.DevRepository().AllDevices();
+    
+    TInt pos = devArray.Find( aAddr, MatchDeviceAddress);
+    if(pos > -1)
+        {
+        return devArray[pos]->CopyL();
+        }
+    return NULL;
+/*    addrSymbianToReadbleString( addrStr, addr );
+    for (int i = 0; i < mData.count(); ++i ) {
+        if ( mData.at( i ).value( BtDeviceModel::ReadableBdaddrRole ) 
+                == addrStr ) {
+            return i;
+        }
+    }
+    return -1;*/
+}
+
+
+void CBTNotifDeviceSelector::SendSelectedDeviceL( CHbSymbianVariantMap& aData )
+    {
+    TInt err; 
+    TBTDeviceResponseParamsPckg devParams;
+    TBTDevAddr address; 
+    User::LeaveIfError(address.SetReadable(
+                                    *(static_cast<TDesC*>(aData.Get(_L("deviceaddress"))->Data()))));
+    devParams().SetDeviceAddress( address );
+    devParams().SetDeviceClass(*(static_cast<TUint32*>(aData.Get(_L("deviceclass"))->Data())));
+    devParams().SetDeviceName(*(static_cast<TDesC*>(aData.Get(_L("devicename"))->Data())));
+    User::LeaveIfError(iMessage.Write( EBTNotifSrvReplySlot, devParams ));
+    }
+
--- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -20,10 +20,21 @@
 #include <btservices/btdevextension.h>
 #include "btnotifsecuritymanager.h"
 #include "bluetoothtrace.h"
+#include "bluetoothnotification.h"
+#include "btnotifserver.h"
+#include "btnotifconnectiontracker.h"
+#include "btnotificationmanager.h"
 
 /**  Length of the default PIN. */
 const TInt KDefaultHeadsetPinLength = 4;
 
+/** Maximum repeated outgoing pairing attempt.
+ *  if the pairing fails the UI specs says
+ *  we can ask twice the user if he/she want 
+ *  to retry pairing. 
+ */
+const TInt KMaxRepeatedPairingAttempt = 2;
+
 enum TPairingStageId
     {
     /**
@@ -84,6 +95,7 @@
     {
     BaseConstructL();
     User::LeaveIfError( iTimer.CreateLocal() );
+    iPairingAttempt = KMaxRepeatedPairingAttempt;
     }
 
 // ---------------------------------------------------------------------------
@@ -113,14 +125,22 @@
     iBondingSession.Close();
     iSocket.Close();
     iTimer.Close();
+    if( iNotification )
+        {
+        // Clear the notification callback, we cannot receive them anymore.
+        iNotification->RemoveObserver();
+        iNotification->Close(); // Also dequeues the notification from the queue.
+        iNotification = NULL;
+        }
     }
 
 // ---------------------------------------------------------------------------
 // Simply deny the request as this is handing outgoing pairing
 // ---------------------------------------------------------------------------
 //
-TInt CBTNotifOutgoingPairingHandler::ObserveIncomingPair( const TBTDevAddr& /*aAddr*/ )
+TInt CBTNotifOutgoingPairingHandler::ObserveIncomingPair( const TBTDevAddr& aAddr )
     {
+    (void)aAddr;
     return KErrServerBusy;
     }
 
@@ -136,7 +156,6 @@
         // we don't allow another pairing request.
         User::Leave( KErrServerBusy );
         }
-    
     iAddr = aAddr;
     iCod = TBTDeviceClass( aCod );
     UnSetPairResult();
@@ -161,6 +180,14 @@
     {
     BOstraceFunctionEntry0( DUMMY_DEVLIST );
     iParent.RenewPairingHandler( NULL );
+    if( iNotification )
+        {
+        // Cancel the user query
+        // This will also unregister us from the notification.
+        TInt err = iNotification->Close();
+        NOTIF_NOTHANDLED( !err )
+        iNotification = NULL;
+        }
     }
 
 
@@ -185,7 +212,7 @@
         const TUint8 KZeroPinValue = '0';
         for (TInt i = 0; i < KDefaultHeadsetPinLength; ++i)
             {
-            aPin().iPIN[i] = KZeroPinValue;
+                aPin().iPIN[i] = KZeroPinValue;
             }
         aPin().iLength = KDefaultHeadsetPinLength;
         }
@@ -202,6 +229,14 @@
         {
         iParent.OutgoingPairCompleted( KErrCancel );
         iParent.RenewPairingHandler( NULL );
+        if( iNotification )
+            {
+            // Cancel the user query
+            // This will also unregister us from the notification.
+            TInt err = iNotification->Close();
+            NOTIF_NOTHANDLED( !err )
+            iNotification = NULL;
+            }
         }
     }
 
@@ -296,8 +331,23 @@
             }
         if ( aStatus )
             {
-            iParent.OutgoingPairCompleted( aStatus );
-            }
+            // retry pairing
+            if(aStatus && iPairingAttempt > 0)
+                {
+                if(aActive->RequestId() == EGeneralBondingRetry && iPairMode == EBTOutgoingHeadsetManualPairing)
+                    {
+                    // Headset pairing failed, reset and try again from auto pairing
+                    iActive->SetRequestId(EGeneralBonding);
+                    }
+                iPairingAttempt --;
+                ShowPairingRetryDialog();
+                }
+            else
+                {
+                iPairingAttempt --;
+                ShowPairingFailureDialog();
+                }
+             }
         }
     }
 
@@ -344,6 +394,14 @@
     (void) aActive;
     iParent.OutgoingPairCompleted( aError );
     iParent.RenewPairingHandler( NULL );
+    if( iNotification )
+        {
+        // Cancel the user query
+        // This will also unregister us from the notification.
+        TInt err = iNotification->Close();
+        NOTIF_NOTHANDLED( !err )
+        iNotification = NULL;
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -390,3 +448,106 @@
     BOstraceFunctionExit0( DUMMY_DEVLIST );
     }
 
+// ---------------------------------------------------------------------------
+// From class MBTNotificationResult.
+// Handle a result from a user query.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifOutgoingPairingHandler::MBRDataReceived( CHbSymbianVariantMap& aData )
+    {
+    BOstraceFunctionEntry0( DUMMY_DEVLIST );
+    (void) aData;
+    BOstraceFunctionExit0( DUMMY_DEVLIST );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MBTNotificationResult.
+// The notification is finished.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifOutgoingPairingHandler::MBRNotificationClosed( TInt aError, const TDesC8& aData )
+    {
+    BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError );
+    // First unregister from the notification, so we can already get the next one.
+    iNotification->RemoveObserver();
+    iNotification = NULL;
+    TRAP_IGNORE( NotificationClosedL( aError, aData ) );
+    BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+    }
+
+// ---------------------------------------------------------------------------
+// Get and configure a notification.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifOutgoingPairingHandler::PrepareNotificationL( TBluetoothDialogParams::TBTDialogType aType,
+    TBTDialogResourceId aResourceId )
+    {
+    BOstraceFunctionEntry0( DUMMY_DEVLIST );
+    iNotification = 
+            iParent.ConnectionTracker().NotificationManager()->GetNotification();
+    User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory
+    iNotification->SetObserver( this );
+    iNotification->SetNotificationType( aType, aResourceId );
+    const CBtDevExtension* dev = iParent.BTDevRepository().Device(iAddr);
+    if(dev)
+        {
+        User::LeaveIfError(iNotification->SetData( TBluetoothDeviceDialog::EDeviceName, dev->Alias()));
+        }
+    else
+        {
+        TBTDeviceName name;
+        iAddr.GetReadable(name);
+        User::LeaveIfError(iNotification->SetData( TBluetoothDeviceDialog::EDeviceName, name));
+        NOTIF_NOTHANDLED( !err )            
+        }
+    iParent.ConnectionTracker().NotificationManager()->QueueNotificationL( iNotification);
+    NOTIF_NOTHANDLED( !err )
+    BOstraceFunctionExit0( DUMMY_DEVLIST );
+    }
+
+// ---------------------------------------------------------------------------
+// The notification is finished, handle the result.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifOutgoingPairingHandler::NotificationClosedL( TInt aError, const TDesC8& aData )
+    {
+    BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError );
+    // Read the result.
+    TPckgC<TBool> result( EFalse );
+    result.Set( aData.Ptr(), result.Length() ); // Read the part containing the result
+    // Set a pointer descriptor to capture the remaining data, if any.
+    TPtrC8 dataPtr( aData.Mid( result.Length() ) );
+
+    if(result() && iPairingAttempt >= 0)
+        {
+            HandleOutgoingPairL(iAddr,iCod.DeviceClass());
+        }
+    else
+        {
+            iPairingAttempt = KMaxRepeatedPairingAttempt; // reset the counter
+            iParent.OutgoingPairCompleted( KErrCancel );
+            iParent.RenewPairingHandler( NULL );
+        }
+    BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+    }
+
+// ---------------------------------------------------------------------------
+// Show a dialog to ask the user to retry the pairing
+// ---------------------------------------------------------------------------
+//
+void CBTNotifOutgoingPairingHandler::ShowPairingRetryDialog()
+    {
+    PrepareNotificationL( TBluetoothDialogParams::EQuery, EPairingFailureRetry);
+    }
+
+// ---------------------------------------------------------------------------
+// Show a dialog to tell the user pairing retry attempt failed
+// ---------------------------------------------------------------------------
+//
+void CBTNotifOutgoingPairingHandler::ShowPairingFailureDialog()
+    {
+    PrepareNotificationL( TBluetoothDialogParams::EQuery, EPairingFailureOk );
+    }
+
+
+
--- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -196,7 +196,7 @@
                 // in pairing manager for this device:
                 iParent.GetPinCode( pinCode, iRemote, iMinPinLength );
                 }
-            if ( pinCode().iLength != 0 )        
+            if ( pinCode().iLength > 0 )        
                 {
                 // a pin is ready for this pairing.
                 // write it back to client (stack)
--- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifsecuritymanager.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifsecuritymanager.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -445,6 +445,7 @@
         {
         // make sure not to leave any text as PIN.
         aPin.Zero();
+        aPin().iLength = 0;
         }
     }
 
--- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifserviceauthorizer.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifserviceauthorizer.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -25,7 +25,6 @@
 #include "bluetoothnotification.h"
 #include "btnotifconnectiontracker.h"
 #include "btnotificationmanager.h"
-#include "bluetoothnotification.h"
 #include "btnotifserver.h"
 #include "btnotifutil.h"
 
--- a/bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h	Fri Jul 23 15:57:13 2010 +0300
@@ -39,7 +39,8 @@
     EBlockUnpairedDevice,
     EBlockPairedDevice,
     EPairingSuccess,
-    EPairingFailure,
+    EPairingFailureRetry,
+    EPairingFailureOk,
     EVisibilityTimeout,
     EUnpairedDevice,
     EUnusedResource	// The last ID
@@ -68,7 +69,9 @@
         ESend,
         EGlobalNotif,
         EUserAuthorization,
-        EReceiveProgress
+        EReceiveProgress,
+        ETransferFailed, 
+        EReceiveDone
         };
 
     /**  Enumeration for the notification parameters data type to be configured. */
@@ -88,7 +91,18 @@
         EReceive,
         EReceiveFromPairedDevice,
         EConnect,
-        EPairingRequest
+        EPairingRequest,
+        ERecvFailed,
+        ESendFailed,
+        EReceiveCompleted
+        };
+    
+    enum TDialogActionType
+        {
+        EHide,
+        EShow,
+        ECancelReceive,
+        ECancelShow
         };
 
     inline TBluetoothDialogParams();
--- a/bluetoothengine/btsap/src/BTSapSniffHandler.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btsap/src/BTSapSniffHandler.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -98,7 +98,7 @@
     if(iIsLinkAdapterOpen)
         {
         // Start the sniffer timer
-        BTSAP_TRACE_OPT(KBTSAP_TRACE_INFO, BTSapPrintTrace(_L("[BTSap]  CBTSapSniffHandler::Enable: Starting the sniff timer %d µsec"), KSniffInterval));
+        BTSAP_TRACE_OPT(KBTSAP_TRACE_INFO, BTSapPrintTrace(_L("[BTSap]  CBTSapSniffHandler::Enable: Starting the sniff timer %d microseconds"), KSniffInterval));
         Cancel();
         After(KSniffInterval);
 
--- a/bluetoothengine/btui/btcpplugin/btcpplugin.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpplugin.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -15,9 +15,8 @@
  *
  */
 
-
+#include "btcpplugin.h"
 #include <cpsettingformentryitemdataimpl.h>
-#include "btcpplugin.h"
 #include "btcpuisettingitem.h"
 
 /*!
--- a/bluetoothengine/btui/btcpplugin/btcpuidevicedetail.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpuidevicedetail.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -23,6 +23,7 @@
 #include <bluetoothuitrace.h>
 #include <HbInstance>
 
+
 BtCpUiDeviceDetail::BtCpUiDeviceDetail(QObject *parent) :
     QObject(parent), mDeviceDetailView(0)
 {
@@ -31,7 +32,6 @@
 
 BtCpUiDeviceDetail::~BtCpUiDeviceDetail()
 {
-    notifyViewStatusToPlugins(AboutToClose);
     clearDeviceDetailList();
     delete mDeviceDetailView;
 }
@@ -57,8 +57,9 @@
         delete interfaces.at(i);
     }
     
+    createDeviceDetailsView(deviceName);
     notifyDeviceDetailStatus();
-    createDeviceDetailsView(deviceName);
+    
 }
 
 void BtCpUiDeviceDetail::appendDeviceToList(BtAbstractDevSetting *devSetting)
@@ -84,6 +85,7 @@
 void BtCpUiDeviceDetail::handleSettingChange(BtAbstractDevSetting *setting, bool available)
 {
     QList<BtDeviceDetails>::iterator i;
+       
     for (i = mDeviceDetailList.begin(); i != mDeviceDetailList.end(); ++i) {
         if((setting == (*i).mSetting) && mDeviceDetailView) {
             (*i).mSettingAvailable = available;
@@ -99,10 +101,9 @@
             else {
                 if((*i).mSettingForm) {
                     //remove widget
-                    //todo: In case if no items are there close this view
-                    //and disable device settings button.
                     mDeviceDetailView->removeItem((*i).mSettingForm);
-                    (*i).mSettingForm = 0; 
+                    (*i).mSettingForm = 0;
+                    checkDeviceDetailSettings();
                 }
             }
             notifyDeviceDetailStatus();
@@ -111,6 +112,25 @@
 }
 
 
+void BtCpUiDeviceDetail::checkDeviceDetailSettings()
+{
+    QList<BtDeviceDetails>::const_iterator i;
+    bool devicedetail = false;
+    
+    for (i = mDeviceDetailList.constBegin(); i != mDeviceDetailList.constEnd(); ++i) {
+        if((*i).mSettingForm) {
+            devicedetail = true;
+            break;
+        }
+    }
+    //If no setting is available and current view is device detail 
+    //view move to previous view.
+    if((!devicedetail) && (mMainWindow->currentView() == mDeviceDetailView)) {
+        mMainWindow->removeView(mDeviceDetailView); 
+        mMainWindow->setCurrentView( mPreviousView );
+    }
+}
+
 void BtCpUiDeviceDetail::notifyDeviceDetailStatus()
 {
     QList<BtDeviceDetails>::const_iterator i;
@@ -156,7 +176,6 @@
             mDeviceDetailView->addItem((*i).mSettingForm);
         }
     }
-
 }
 
 void BtCpUiDeviceDetail::loadDeviceDetailsView()
@@ -203,4 +222,9 @@
 
 }
 
+void BtCpUiDeviceDetail::sendCloseEvent()
+{
+    notifyViewStatusToPlugins(AboutToClose);
+}
 
+
--- a/bluetoothengine/btui/btcpplugin/btcpuidevicedetail.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpuidevicedetail.h	Fri Jul 23 15:57:13 2010 +0300
@@ -46,7 +46,9 @@
     void loadDeviceDetailPlugins(QString deviceAddress, QString deviceName);
         
     void loadDeviceDetailsView();
-        
+    
+    void sendCloseEvent(); 
+    
 signals:
     void deviceSettingsChanged(bool settingAvailable);
     
@@ -66,6 +68,7 @@
     void notifyDeviceDetailStatus();
     void createDeviceDetailsView(QString deviceName);
     void notifyViewStatusToPlugins(BtCpUiDeviceDetail::NotifyType type);
+    void checkDeviceDetailSettings();
     
 private:
     
--- a/bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -14,6 +14,7 @@
 * Description:  BtCpUiDeviceDetailsView implementation
 *
 */
+#include "btcpuidevicedetailsview.h"
 #include <QtGlobal>
 #include <QGraphicsLinearLayout>
 #include <HbInstance>
@@ -23,7 +24,6 @@
 #include <hbcombobox.h>
 #include <hbgroupbox.h>
 #include <bluetoothuitrace.h>
-#include "btcpuidevicedetailsview.h"
 
 // docml to load
 const char* BTUI_DEVICEDETAILSVIEW_DOCML = ":/docml/bt-device-details-view.docml";
--- a/bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.h	Fri Jul 23 15:57:13 2010 +0300
@@ -14,8 +14,8 @@
 * Description:  BtCpUiDeviceDetailsView declaration
 */
 
-#ifndef BTCPUIDEVICEDETAILSVIEW_H_
-#define BTCPUIDEVICEDETAILSVIEW_H_
+#ifndef BTCPUIDEVICEDETAILSVIEW_H
+#define BTCPUIDEVICEDETAILSVIEW_H
 
 #include <hbview.h>
 #include <qglobal.h>
@@ -50,4 +50,4 @@
     Q_DISABLE_COPY(BtCpUiDeviceDetailsView)
 };
 
-#endif /* BTCPUIDEVICEDETAILSVIEW_H_ */
+#endif /* BTCPUIDEVICEDETAILSVIEW_H */
--- a/bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -52,8 +52,8 @@
         BtDeviceModel &deviceModel, 
         QGraphicsItem *parent) :
     BtCpUiBaseView(settingModel,deviceModel,parent),
-    mPairedStatus(false), mConnectedStatus(false), mTrustedStatus(false), mBlockedStatus(false), 
-    mConnectable(false), mAbstractDelegate(0), mDeviceDetail(0)   
+    mPairedStatus(false), mConnectedStatus(false),mPreviousConnectedStatus(false), mTrustedStatus(false), 
+    mBlockedStatus(false), mConnectable(false), mAbstractDelegate(0), mDeviceDetail(0)   
 {
     mDeviceIndex = QModelIndex();//is it needed to initialize mIndex???
     
@@ -187,16 +187,46 @@
 {
     BTUI_ASSERT_X(mMainView, "BtCpUiSearchView::switchToPreviousView", "invalid mMainView");
     mMainView->switchToPreviousView();
-    delete mDeviceDetail;
-    mDeviceDetail = 0;
+
+    if(mDeviceDetail) {
+        mDeviceDetail->sendCloseEvent();
+    }
+    unloadDeviceDetails();
+}
+
+void BtCpUiDeviceView::loadDeviceDetails()
+{
+    bool ret(false);
+    
+    unloadDeviceDetails();
+    
+    mDeviceDetail = new BtCpUiDeviceDetail();
+    
+    ret=connect(mDeviceDetail, SIGNAL(deviceSettingsChanged(bool)),
+           this, SLOT(handleDeviceSettingsChange(bool)));
+    BTUI_ASSERT_X( ret, "Btui, BtCpUiDeviceView::loadDeviceDetails", "deviceSettingsChanged() connect failed");
+
+    mDeviceDetail->loadDeviceDetailPlugins(mDeviceBdAddr.toString(), mDeviceName->text());
+}
+
+void BtCpUiDeviceView::unloadDeviceDetails()
+{
+    if(mDeviceDetail) {
+        disconnect(mDeviceDetail);
+        delete mDeviceDetail;
+        mDeviceDetail = 0;
+    }
 }
 
 void BtCpUiDeviceView::activateView( const QVariant& value, bool fromBackButton )
 {
+    
     Q_UNUSED( fromBackButton );  
     
+    mConnectedStatus = false;
     setSoftkeyBack();
     
+    
     QModelIndex index = value.value<QModelIndex>();
     mDeviceBdAddr = (mDeviceModel->data(index, BtDeviceModel::ReadableBdaddrRole));
     
@@ -205,31 +235,24 @@
     updateDeviceData();
     
     mDeviceSetting->setVisible(false);
-    
-    mDeviceDetail = new BtCpUiDeviceDetail();
-    
+        
     bool ret(false);
     ret=connect(mDeviceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
            this, SLOT(updateDeviceData()));
     BTUI_ASSERT_X( ret, "Btui, BtCpUiDeviceView::activateView", "dataChanged() connect failed");
 
-    ret=connect(mDeviceDetail, SIGNAL(deviceSettingsChanged(bool)),
-           this, SLOT(handleDeviceSettingsChange(bool)));
-    BTUI_ASSERT_X( ret, "Btui, BtCpUiDeviceView::activateView", "deviceSettingsChanged() connect failed");
-
-    
-    mDeviceDetail->loadDeviceDetailPlugins(mDeviceBdAddr.toString(), mDeviceName->text());
-    
 }
 
 void BtCpUiDeviceView::handleDeviceSettingsChange(bool status)
 {
-    mDeviceSetting->setVisible(status);        
+    mDeviceSetting->setVisible(status);
 }
 
 void BtCpUiDeviceView::handleDeviceSetting()
 {
-    mDeviceDetail->loadDeviceDetailsView();
+    if(mDeviceDetail) {
+        mDeviceDetail->loadDeviceDetailsView();
+    }
 }
 
 void BtCpUiDeviceView::deactivateView()
@@ -257,13 +280,15 @@
     mDeviceIcon->clear();
     mDeviceCategory->clear();
     mDeviceStatus->clear();
-    
+    mConnectable = false;
+    /*
     mPairedStatus = false;
     mConnectedStatus = false;
     mTrustedStatus = false;
     mBlockedStatus = false;
     
     mConnectable = false;
+    */
 }
     
 void BtCpUiDeviceView::updateDeviceData()
@@ -355,6 +380,8 @@
  */
 void BtCpUiDeviceView::updateStatusVariables(int majorRole)
 {
+    mPreviousConnectedStatus = mConnectedStatus;
+    
     if (majorRole & BtuiDevProperty::Trusted ) {
         mTrustedStatus = true;
     } 
@@ -369,6 +396,10 @@
     }
     if (majorRole & BtuiDevProperty::Connected) {
         mConnectedStatus = true;
+        if (!mPreviousConnectedStatus){
+            //Loading device detail plugins after successfull connection.
+            loadDeviceDetails();
+        }
     }
     else {
         mConnectedStatus = false;
@@ -402,6 +433,7 @@
     
     if (mConnectable)
     {
+        mConnect_Disconnect->setVisible(true);
         mConnect_Disconnect->setStretched(true);
         if (mConnectedStatus)
         {
@@ -539,8 +571,6 @@
         delete mAbstractDelegate;
         mAbstractDelegate = 0;
     }   
-    
-    
 }
 
 void BtCpUiDeviceView::disconnectDevice()
@@ -582,9 +612,14 @@
         disconnect(mAbstractDelegate);
         delete mAbstractDelegate;
         mAbstractDelegate = 0;
-    }   
-    
-    
+    }
+}
+
+void BtCpUiDeviceView::setPrevBtDeviceName()
+{
+    QString deviceName = (mDeviceModel->data(mDeviceIndex, 
+                BtDeviceModel::NameAliasRole)).toString(); 
+   mDeviceName->setText(deviceName);
 }
 
 void BtCpUiDeviceView::changeBtDeviceName(){
@@ -609,6 +644,9 @@
         connect( mAbstractDelegate, SIGNAL(commandCompleted(int, QVariant)), this, SLOT(changeDevNameDelegateCompleted(int, QVariant)) );
         mAbstractDelegate->exec(params);
     }
+    else {
+        setPrevBtDeviceName();
+    }
     
 }
 
@@ -620,7 +658,7 @@
         mDeviceName->setText(param.toString());
     }
     else {
-        //setPrevBtLocalName();
+        setPrevBtDeviceName();
     }
     //TODO:Error handling has to be done.    
     if (mAbstractDelegate)
--- a/bluetoothengine/btui/btcpplugin/btcpuideviceview.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpuideviceview.h	Fri Jul 23 15:57:13 2010 +0300
@@ -78,7 +78,10 @@
     void setConnectionCombobox();
     void setTextAndVisibilityOfButtons();
     void updateStatusVariables(int majorRole);
-
+    void loadDeviceDetails();
+    void unloadDeviceDetails();
+    void setPrevBtDeviceName();
+    
 private:
     HbDocumentLoader *mLoader;
     //HbGroupBox *mGroupBox;
@@ -113,6 +116,7 @@
     
     //true-> device is connected; false -> device is disconnected
     bool mConnectedStatus;
+    bool mPreviousConnectedStatus;
     bool mTrustedStatus;
     bool mBlockedStatus;
 
--- a/bluetoothengine/btui/btcpplugin/btcpuimainview.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpuimainview.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -34,6 +34,7 @@
 #include <hbaction.h>
 #include <hbcombobox.h>
 #include <hbgroupbox.h>
+#include <hbdataform.h>
 #include "btcpuisearchview.h"
 #include "btcpuideviceview.h"
 #include <bluetoothuitrace.h>
@@ -144,24 +145,23 @@
     ret = connect(mPairAction, SIGNAL(triggered()), this, SLOT(pairActionTriggered()));
     BTUI_ASSERT_X( ret, "bt-main-view", "pair action can't connect" ); 
 
-    mGroupBox = qobject_cast<HbGroupBox *>( mLoader->findWidget( "groupBox" ) );
-    BTUI_ASSERT_X( mGroupBox != 0, "bt-main-view", "Group Box not found" ); 
+    mDataForm = qobject_cast<HbDataForm *>( mLoader->findWidget( "dataForm" ) );
+    BTUI_ASSERT_X( mDataForm != 0, "bt-main-view", "dataForm not found" ); 
     
-    //*********************Testing device view START****************************//
-    HbAction *removePairedDevices = static_cast<HbAction*>( mLoader->findObject( "removePairedDevices" ) );
-    BTUI_ASSERT_X( removePairedDevices, "bt-main-view", "remove action missing" ); 
-    //ret = connect(removePairedDevices, SIGNAL(triggered()), this, SLOT(goToDeviceView()));
-    //BTUI_ASSERT_X( ret, "bt-main-view", "orientation toggle can't connect" ); 
-        
-    
-    
-    //*********************Testing device view END****************************//
         
     // load menu
     HbMenu *optionsMenu = qobject_cast<HbMenu *>(mLoader->findWidget("viewMenu"));
     BTUI_ASSERT_X( optionsMenu != 0, "bt-main-view", "Options menu not found" );   
     this->setMenu(optionsMenu);
     
+    HbMenu *menu = this->menu();
+    mRemovePairedDevices = menu->addAction(hbTrId("txt_bt_opt_remove_paired_devices"));
+    
+    mSubMenu = new HbMenu(hbTrId("txt_bt_opt_remove"));
+    mSubMenu->addAction(hbTrId("txt_bt_opt_remove_sub_all_devices"));
+    mSubMenu->addAction(hbTrId("txt_bt_opt_remove_sub_paired_devices"));
+    mSubMenu->addAction(hbTrId("txt_bt_opt_remove_sub_blocked_devices"));
+    
     // update display when setting data changed
     ret = connect(mSettingModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), 
             this, SLOT(updateSettingItems(QModelIndex,QModelIndex)));
@@ -183,14 +183,13 @@
     mMainFilterModel = new BtuiModelSortFilter(this);
     
     mMainFilterModel->setSourceModel( mDeviceModel );
+    mDeviceList->setModel(mMainFilterModel);
     updateDeviceListFilter(BtuiPaired);
 	    // List view item
     BtCpUiMainListViewItem *prototype = new BtCpUiMainListViewItem(mDeviceList);
     prototype->setModelSortFilter(mMainFilterModel);
     mDeviceList->setItemPrototype(prototype);
 
-    mDeviceList->setModel(mMainFilterModel);
-
 }
 
 /*!
@@ -204,6 +203,7 @@
 	if (mAbstractDelegate) {
         delete mAbstractDelegate;
     }
+
 }
 
 /*! 
@@ -214,6 +214,9 @@
     Q_UNUSED(value);
     Q_UNUSED(fromBackButton);
     
+    //Reset the device list when returning to the view, as it may have been invalidated by the device view
+    mMainFilterModel->setSourceModel( mDeviceModel );
+    mDeviceList->setModel(mMainFilterModel);
 }
 
 /*! 
@@ -321,11 +324,18 @@
 
 void BtCpUiMainView::allActionTriggered()
 {
+    HbMenu *menu = this->menu();
+    menu->removeAction(mRemovePairedDevices);
+    mRemoveDevices = menu->addMenu( mSubMenu );
+
     updateDeviceListFilter(BtuiAll);
 }
 
 void BtCpUiMainView::pairActionTriggered()
 {
+    HbMenu *menu = this->menu();
+    menu->removeAction(mRemoveDevices);
+    mRemovePairedDevices = menu->addAction(hbTrId("txt_bt_opt_remove_paired_devices"));
     updateDeviceListFilter(BtuiPaired);
 }
 
@@ -335,7 +345,7 @@
     
     switch (filter) {
         case BtuiAll:
-            mGroupBox->setHeading(hbTrId("txt_bt_subhead_bluetooth_all_devices"));
+            mDataForm->setHeading(hbTrId("txt_bt_subhead_bluetooth_all_devices"));
             mPairAction->setEnabled(true);
             mAllAction->setEnabled(false);
             mMainFilterModel->addDeviceMajorFilter(
@@ -344,7 +354,7 @@
 
             break;
         case BtuiPaired:
-            mGroupBox->setHeading(hbTrId("txt_bt_subhead_bluetooth_paired_devices"));
+            mDataForm->setHeading(hbTrId("txt_bt_subhead_bluetooth_paired_devices"));
             mPairAction->setEnabled(false);
             mAllAction->setEnabled(true);
             mMainFilterModel->addDeviceMajorFilter(
--- a/bluetoothengine/btui/btcpplugin/btcpuimainview.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpuimainview.h	Fri Jul 23 15:57:13 2010 +0300
@@ -32,6 +32,7 @@
 class BtAbstractDelegate;
 class HbListView;
 class HbGroupBox;
+class HbDataForm;
 
 class BtCpUiMainView : public BtCpUiBaseView
 {
@@ -118,6 +119,9 @@
     
     HbAction *mAllAction;
     HbAction *mPairAction;
-    HbGroupBox *mGroupBox;
+    HbDataForm *mDataForm;
+    HbAction* mRemovePairedDevices;
+    HbAction* mRemoveDevices;
+    HbMenu* mSubMenu;
 };
 #endif // BTCPUIMAINVIEW_H 
--- a/bluetoothengine/btui/btcpplugin/btcpuisearchview.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpuisearchview.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -26,6 +26,7 @@
 #include <HbListView>
 #include <HbMenu>
 #include <HbSelectionDialog>
+#include <HbGroupBox>
 #include <QString>
 #include <QStringList>
 #include <QDebug>
@@ -49,12 +50,14 @@
     bool ret(false);
     
     mQuery = 0;
+    mLoader = 0;
+    mSoftKeyBackAction = 0;
+    
     mMainView = (BtCpUiMainView *) parent;
-    
     mMainWindow = hbInstance->allMainWindows().first();
     
     mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this);
-    BTUI_ASSERT_X(mSoftKeyBackAction, "BtCpUiBaseView::BtCpUiBaseView", "can't create back action");
+    BTUI_ASSERT_X(mSoftKeyBackAction, "BtCpUiSearchView::BtCpUiSearchView", "can't create back action");
     
     // Create view for the application.
     // Set the name for the view. The name should be same as the view's
@@ -62,6 +65,7 @@
     setObjectName("bt_search_view");
 
     mLoader = new HbDocumentLoader();
+    BTUI_ASSERT_X( mLoader != 0, "BtCpUiSearchView::BtCpUiSearchView", "can't create mLoader" );
     // Pass the view to documentloader. Document loader uses this view
     // when docml is parsed, instead of creating new view.
     QObjectList objectList;
@@ -83,21 +87,21 @@
     mDeviceIcon=0;
     // can't use qobject_cast since HbIcon is not derived from QObject!
     mDeviceIcon = qobject_cast<HbLabel *>( mLoader->findWidget( "icon" ) );  
-    BTUI_ASSERT_X( mDeviceIcon != 0, "bt-search-view", "Device Icon not found" );
+    BTUI_ASSERT_X( mDeviceIcon != 0, "BtCpUiSearchView::BtCpUiSearchView", "Device Icon not found" );
     
-    mLabelFoundDevices=0;
-    mLabelFoundDevices = qobject_cast<HbLabel *>( mLoader->findWidget( "label_found_devices" ) );
-    BTUI_ASSERT_X( mLabelFoundDevices != 0, "bt-search-view", "Found Devices not found" );
-    mLabelFoundDevices->setPlainText(hbTrId("txt_bt_subhead_bluetooth_found_devices"));
+    mDataForm=0;
+    mDataForm = qobject_cast<HbDataForm *>( mLoader->findWidget( "dataForm" ) );
+    BTUI_ASSERT_X( mDataForm != 0, "BtCpUiSearchView::BtCpUiSearchView", "dataForm not found" );
+    mDataForm->setHeading(hbTrId("txt_bt_subhead_bluetooth_found_devices"));
 
     mLabelSearching=0;
     mLabelSearching = qobject_cast<HbLabel *>( mLoader->findWidget( "label_searching" ) );
-    BTUI_ASSERT_X( mLabelSearching != 0, "bt-search-view", "Searching not found" );
+    BTUI_ASSERT_X( mLabelSearching != 0, "BtCpUiSearchView::BtCpUiSearchView", "Searching not found" );
     mLabelSearching->setPlainText(hbTrId("txt_bt_subhead_searching"));
     
     mDeviceList=0;
     mDeviceList = qobject_cast<HbListView *>( mLoader->findWidget( "deviceList" ) );
-    BTUI_ASSERT_X( mDeviceList != 0, "bt-search-view", "Device List not found" );   
+    BTUI_ASSERT_X( mDeviceList != 0, "BtCpUiSearchView::BtCpUiSearchView", "Device List not found" );   
     
     
     mDeviceList->setSelectionMode( HbAbstractItemView::SingleSelection );
@@ -107,10 +111,10 @@
     
     if (mOrientation == Qt::Horizontal) {
         mLoader->load(BTUI_SEARCHVIEW_DOCML, "landscape_ui", &ok);
-        BTUI_ASSERT_X( ok, "bt-search-view", "Invalid docml file: landscape section problem" );
+        BTUI_ASSERT_X( ok, "BtCpUiSearchView::BtCpUiSearchView", "Invalid docml file: landscape section problem" );
     } else {
         mLoader->load(BTUI_SEARCHVIEW_DOCML, "portrait_ui", &ok);
-        BTUI_ASSERT_X( ok, "bt-search-view", "Invalid docml file: portrait section problem" );        
+        BTUI_ASSERT_X( ok, "BtCpUiSearchView::BtCpUiSearchView", "Invalid docml file: portrait section problem" );        
     }
 
     // listen for orientation changes
@@ -120,38 +124,38 @@
     
     // load tool bar actions
     mViewBy = static_cast<HbAction*>( mLoader->findObject( "viewByAction" ) );
-    BTUI_ASSERT_X( mViewBy, "bt-search-view", "view by action missing" ); 
+    BTUI_ASSERT_X( mViewBy, "BtCpUiSearchView::BtCpUiSearchView", "view by action missing" ); 
     ret = connect(mViewBy, SIGNAL(triggered()), this, SLOT(viewByDeviceTypeDialog()));
-    BTUI_ASSERT_X( ret, "bt-search-view", "viewByAction can't connect" ); 
+    BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "viewByAction can't connect" ); 
 
     mStop = static_cast<HbAction*>( mLoader->findObject( "stopAction" ) );
-    BTUI_ASSERT_X( mStop, "bt-search-view", "stopAction missing" ); 
+    BTUI_ASSERT_X( mStop, "BtCpUiSearchView::BtCpUiSearchView", "stopAction missing" ); 
     ret = connect(mStop, SIGNAL(triggered()), this, SLOT(stopSearching()));
-    BTUI_ASSERT_X( ret, "bt-search-view", "stopAction can't connect" ); 
+    BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "stopAction can't connect" ); 
     mStop->setEnabled(true);
     
     mRetry = static_cast<HbAction*>( mLoader->findObject( "retryAction" ) );
-    BTUI_ASSERT_X( mRetry, "bt-search-view", "retryAction missing" ); 
+    BTUI_ASSERT_X( mRetry, "BtCpUiSearchView::BtCpUiSearchView", "retryAction missing" ); 
     ret = connect(mRetry, SIGNAL(triggered()), this, SLOT(retrySearch()));
-    BTUI_ASSERT_X( ret, "bt-search-view", "retryAction can't connect" ); 
+    BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "retryAction can't connect" ); 
     // Disable for initial search
     mRetry->setEnabled(false);
     
     // load menu
     HbMenu *optionsMenu = qobject_cast<HbMenu *>(mLoader->findWidget("viewMenu"));
-    BTUI_ASSERT_X( optionsMenu != 0, "bt-search-view", "Options menu not found" );   
+    BTUI_ASSERT_X( optionsMenu != 0, "BtCpUiSearchView::BtCpUiSearchView", "Options menu not found" );   
     this->setMenu(optionsMenu);      
     
     mExit = static_cast<HbAction*>( mLoader->findObject( "exitAction" ) );
-    BTUI_ASSERT_X( mExit, "bt-search-view", "exitAction missing" ); 
+    BTUI_ASSERT_X( mExit, "BtCpUiSearchView::BtCpUiSearchView", "exitAction missing" ); 
     mExit->setText(hbTrId("txt_common_opt_exit"));
     
     mConnect = static_cast<HbAction*>( mLoader->findObject( "connectAction" ) );
-    BTUI_ASSERT_X( mConnect, "bt-search-view", "connectAction missing" ); 
+    BTUI_ASSERT_X( mConnect, "BtCpUiSearchView::BtCpUiSearchView", "connectAction missing" ); 
     mConnect->setText(hbTrId("txt_bt_menu_connect"));
     
     ret = connect(mDeviceList, SIGNAL(activated(QModelIndex)), this, SLOT(deviceSelected(QModelIndex)));
-    BTUI_ASSERT_X( ret, "bt-search-view", "deviceSelected can't connect" ); 
+    BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "deviceSelected can't connect" ); 
     
     // initialize device type list for "view by" option
     // Note:  this list needs to be in the same order as enum devTypeSelectionList
@@ -181,13 +185,7 @@
     // Create the inquiry delegate.
     mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::Inquiry, mSettingModel, mDeviceModel );
     
-    // Connect to the signal from the BtDelegateInquiry for completion of the search request
-    ret = connect(mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(searchDelegateCompleted(int)));
-    BTUI_ASSERT_X( ret, "bt-search-view", "searchDelegateCompleted can't connect" );
-    
-    // Connect to the signal from the BtuiModel when the search has been completed.
-    ret = connect(mDeviceModel, SIGNAL(deviceSearchCompleted(int)), this, SLOT(deviceSearchCompleted(int)));
-    BTUI_ASSERT_X( ret, "bt-search-view", "deviceSearchCompleted can't connect" ); 
+
 }
 
 BtCpUiSearchView::~BtCpUiSearchView()
@@ -199,6 +197,7 @@
     delete mSoftKeyBackAction;
     
     if(mAbstractDelegate) {
+        disconnect(mAbstractDelegate);   
         delete mAbstractDelegate;
     }
     if(mBtuiModelSortFilter) {
@@ -218,11 +217,11 @@
     if( orientation == Qt::Vertical ) {
         // load "portrait" section
         mLoader->load( BTUI_SEARCHVIEW_DOCML, "portrait_ui", &ok );
-        BTUI_ASSERT_X( ok, "bt-search-view", "Invalid docml file: portrait section problem" );
+        BTUI_ASSERT_X( ok, "BtCpUiSearchView::changeOrientation", "Invalid docml file: portrait section problem" );
     } else {
         // load "landscape" section
         mLoader->load( BTUI_SEARCHVIEW_DOCML, "landscape_ui", &ok );
-        BTUI_ASSERT_X( ok, "bt-search-view", "Invalid docml file: landscape section problem" );
+        BTUI_ASSERT_X( ok, "BtCpUiSearchView::changeOrientation", "Invalid docml file: landscape section problem" );
     }
 }
 
@@ -293,26 +292,31 @@
             mBtuiModelSortFilter->addDeviceMajorFilter(devTypesWanted,
                     BtuiModelSortFilter::RoughMatch);             // device can be any one of selected ones
         }
-        mBtuiModelSortFilter->sort(0, Qt::AscendingOrder);
     }
 }
 
 void BtCpUiSearchView::stopSearching()
 {
     // Stop searching
-    
-    // Change label and buttons to reflect status
-    mLabelSearching->setPlainText(hbTrId("txt_bt_subhead_search_done"));
-    mRetry->setEnabled(true);
-    mStop->setEnabled(false);    
 
     // Stop search delegate
     mAbstractDelegate->cancel();
+    // reset view 
+    deviceSearchCompleted(KErrNone);      
 }
 
 void BtCpUiSearchView::startSearchDelegate ()
 {
+    bool ret = false;
     
+    // Connect to the signal from the BtDelegateInquiry for completion of the search request
+    ret = connect(mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(searchDelegateCompleted(int)));
+    BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "searchDelegateCompleted can't connect" );
+    
+    // Connect to the signal from the BtuiModel when the search has been completed.
+    ret = connect(mDeviceModel, SIGNAL(deviceSearchCompleted(int)), this, SLOT(deviceSearchCompleted(int)));
+    BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "deviceSearchCompleted can't connect" );     
+
     mAbstractDelegate->exec(QVariant());
 }
 
@@ -354,7 +358,8 @@
     setSoftkeyBack();
             
     if ( !fromBackButton ) {
-        startSearchDelegate();
+        // Sets the label and toolbar buttons
+        retrySearch();
     }
 }
 
@@ -374,9 +379,14 @@
 {
     //TODO - handle error.
     Q_UNUSED(error);
+    
     mLabelSearching->setPlainText(hbTrId("txt_bt_subhead_search_done"));
     mRetry->setEnabled(true);
-    mStop->setEnabled(false);    
+    mStop->setEnabled(false);
+    
+    // disconnect signals
+    disconnect(mAbstractDelegate);
+    disconnect(mDeviceModel);
 }
 
 void BtCpUiSearchView::deviceSelected(const QModelIndex& modelIndex)
--- a/bluetoothengine/btui/btcpplugin/btcpuisearchview.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpuisearchview.h	Fri Jul 23 15:57:13 2010 +0300
@@ -31,6 +31,8 @@
 class HbListView;
 class BtAbstractDelegate;
 class HbSelectionDialog;
+class HbGroupBox;
+class HbDataForm;
 
 class BtCpUiSearchView : public BtCpUiBaseView
 {
@@ -72,7 +74,7 @@
 private:
     HbDocumentLoader *mLoader;
     HbLabel *mDeviceIcon;
-    HbLabel *mLabelFoundDevices;
+    HbDataForm *mDataForm;
     HbLabel *mLabelSearching;        
     HbListView *mDeviceList;
     QStringList mDevTypeList;
--- a/bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml	Fri Jul 23 15:57:13 2010 +0300
@@ -1,15 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <hbdocument version="1.1">
-    <object name="Menu_item_exit" type="HbAction">
-        <string locid="txt_common_opt_exit" name="text" value="Exit"/>
+    <object name="menu_item_home" type="HbAction">
+        <string name="text" value="Add to home screen"/>
     </object>
     <widget name="bt_device_view" type="HbView">
         <widget name="content" role="HbView:widget" type="HbWidget">
-            <widget name="groupBox_deviceView" type="HbGroupBox">
+            <widget name="dataForm_deviceView" type="HbDataForm">
                 <real name="z" value="1"/>
                 <sizepolicy horizontalPolicy="Expanding" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
-                <sizehint height="4.92537un" type="PREFERRED" width="53.73134un"/>
-                <bool name="collapsable" value="FALSE"/>
+                <sizehint height="7.8806un" type="PREFERRED" width="53.73134un"/>
                 <string locid="txt_bt_subhead_bluetooth_device" name="heading" value="Bluetooth device"/>
             </widget>
             <widget name="deviceCategory" type="HbLabel">
@@ -43,6 +42,7 @@
                 <real name="z" value="2"/>
                 <sizehint height="16.41791un" type="PREFERRED" width="53.73134un"/>
                 <string name="description"/>
+                <string name="heading"/>
             </widget>
             <widget name="pushButton_0" type="HbPushButton">
                 <icon iconName="qtg_mono_bt_unpair" name="icon"/>
@@ -66,13 +66,13 @@
                 <string name="text" value="Settings"/>
             </widget>
             <layout type="anchor">
-                <anchoritem dst="groupBox_deviceView" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
-                <anchoritem dst="groupBox_deviceView" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
-                <anchoritem dst="groupBox_deviceView" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="dataForm_deviceView" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+                <anchoritem dst="dataForm_deviceView" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+                <anchoritem dst="dataForm_deviceView" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="deviceIcon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
-                <anchoritem dst="deviceIcon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="groupBox_deviceView" srcEdge="BOTTOM"/>
+                <anchoritem dst="deviceIcon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="dataForm_deviceView" srcEdge="BOTTOM"/>
                 <anchoritem dst="deviceName" dstEdge="LEFT" spacing="2un" src="deviceIcon" srcEdge="RIGHT"/>
-                <anchoritem dst="deviceName" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="groupBox_deviceView" srcEdge="BOTTOM"/>
+                <anchoritem dst="deviceName" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="dataForm_deviceView" srcEdge="BOTTOM"/>
                 <anchoritem dst="deviceName" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="deviceStatus" dstEdge="LEFT" spacing="12un" src="" srcEdge="LEFT"/>
                 <anchoritem dst="deviceStatus" dstEdge="TOP" spacing="var(hb-param-margin-gene-bottom)" src="deviceCategory" srcEdge="BOTTOM"/>
@@ -82,33 +82,33 @@
                 <anchoritem dst="deviceCategory" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="pushButton_2" dstEdge="LEFT" spacing="expr(var(hb-param-margin-gene-left) )" src="" srcEdge="LEFT"/>
                 <anchoritem dst="pushButton_2" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-bottom) )" src="pushButton_1" srcEdge="BOTTOM"/>
-                <anchoritem dst="pushButton_2" dstEdge="RIGHT" spacing="expr(-var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="pushButton_2" dstEdge="RIGHT" spacing="-expr(var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="connectionCombobox" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
                 <anchoritem dst="connectionCombobox" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-top) )" src="deviceStatus" srcEdge="BOTTOM"/>
                 <anchoritem dst="connectionCombobox" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="pushButton_1" dstEdge="LEFT" spacing="expr(var(hb-param-margin-gene-left) )" src="" srcEdge="LEFT"/>
                 <anchoritem dst="pushButton_1" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-middle-vertical) )" src="pushButton_0" srcEdge="BOTTOM"/>
-                <anchoritem dst="pushButton_1" dstEdge="RIGHT" spacing="expr(-var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="pushButton_1" dstEdge="RIGHT" spacing="-expr(var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="pushButton_0" dstEdge="LEFT" spacing="expr(var(hb-param-margin-gene-left) )" src="" srcEdge="LEFT"/>
                 <anchoritem dst="pushButton_0" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-top) )" src="connectionCombobox" srcEdge="BOTTOM"/>
-                <anchoritem dst="pushButton_0" dstEdge="RIGHT" spacing="expr(-var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="pushButton_0" dstEdge="RIGHT" spacing="-expr(var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
             </layout>
         </widget>
         <widget name="viewMenu" role="HbView:menu" type="HbMenu">
-            <ref object="Menu_item_exit" role="HbWidget:addAction"/>
+            <ref object="menu_item_home" role="HbWidget:addAction"/>
         </widget>
         <string locid="txt_cp_title_control_panel" name="title" value="Control Panel"/>
     </widget>
     <section name="landscape">
         <widget name="content" role="HbView:widget" type="HbWidget">
             <layout type="anchor">
-                <anchoritem dst="groupBox_deviceView" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
-                <anchoritem dst="groupBox_deviceView" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
-                <anchoritem dst="groupBox_deviceView" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="dataForm_deviceView" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+                <anchoritem dst="dataForm_deviceView" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+                <anchoritem dst="dataForm_deviceView" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="deviceIcon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
-                <anchoritem dst="deviceIcon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="groupBox_deviceView" srcEdge="BOTTOM"/>
+                <anchoritem dst="deviceIcon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="dataForm_deviceView" srcEdge="BOTTOM"/>
                 <anchoritem dst="deviceName" dstEdge="LEFT" spacing="2un" src="deviceIcon" srcEdge="RIGHT"/>
-                <anchoritem dst="deviceName" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="groupBox_deviceView" srcEdge="BOTTOM"/>
+                <anchoritem dst="deviceName" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="dataForm_deviceView" srcEdge="BOTTOM"/>
                 <anchoritem dst="deviceName" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="deviceCategory" dstEdge="LEFT" spacing="2un" src="deviceIcon" srcEdge="RIGHT"/>
                 <anchoritem dst="deviceCategory" dstEdge="TOP" spacing="var(hb-param-margin-gene-middle-vertical)" src="deviceName" srcEdge="BOTTOM"/>
@@ -123,23 +123,23 @@
                 <anchoritem dst="pushButton_0" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="CENTERH"/>
                 <anchoritem dst="pushButton_1" dstEdge="LEFT" spacing="var(hb-param-margin-gene-middle-horizontal)" src="pushButton_0" srcEdge="RIGHT"/>
                 <anchoritem dst="pushButton_1" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-top) )" src="connectionCombobox" srcEdge="BOTTOM"/>
-                <anchoritem dst="pushButton_1" dstEdge="RIGHT" spacing="expr(-var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="pushButton_1" dstEdge="RIGHT" spacing="-expr(var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="pushButton_2" dstEdge="LEFT" spacing="expr(var(hb-param-margin-gene-left) )" src="" srcEdge="LEFT"/>
                 <anchoritem dst="pushButton_2" dstEdge="TOP" spacing="var(hb-param-margin-gene-middle-vertical)" src="pushButton_1" srcEdge="BOTTOM"/>
-                <anchoritem dst="pushButton_2" dstEdge="RIGHT" spacing="expr(-var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="pushButton_2" dstEdge="RIGHT" spacing="-expr(var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
             </layout>
         </widget>
     </section>
     <section name="portrait">
-    	<widget name="content" role="HbView:widget" type="HbWidget">
-    		<layout type="anchor">
-                <anchoritem dst="groupBox_deviceView" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
-                <anchoritem dst="groupBox_deviceView" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
-                <anchoritem dst="groupBox_deviceView" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+        <widget name="content" role="HbView:widget" type="HbWidget">
+            <layout type="anchor">
+                <anchoritem dst="dataForm_deviceView" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+                <anchoritem dst="dataForm_deviceView" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+                <anchoritem dst="dataForm_deviceView" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="deviceIcon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
-                <anchoritem dst="deviceIcon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="groupBox_deviceView" srcEdge="BOTTOM"/>
+                <anchoritem dst="deviceIcon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="dataForm_deviceView" srcEdge="BOTTOM"/>
                 <anchoritem dst="deviceName" dstEdge="LEFT" spacing="2un" src="deviceIcon" srcEdge="RIGHT"/>
-                <anchoritem dst="deviceName" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="groupBox_deviceView" srcEdge="BOTTOM"/>
+                <anchoritem dst="deviceName" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="dataForm_deviceView" srcEdge="BOTTOM"/>
                 <anchoritem dst="deviceName" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="deviceStatus" dstEdge="LEFT" spacing="12un" src="" srcEdge="LEFT"/>
                 <anchoritem dst="deviceStatus" dstEdge="TOP" spacing="var(hb-param-margin-gene-bottom)" src="deviceCategory" srcEdge="BOTTOM"/>
@@ -149,18 +149,18 @@
                 <anchoritem dst="deviceCategory" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="pushButton_2" dstEdge="LEFT" spacing="expr(var(hb-param-margin-gene-left) )" src="" srcEdge="LEFT"/>
                 <anchoritem dst="pushButton_2" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-bottom) )" src="pushButton_1" srcEdge="BOTTOM"/>
-                <anchoritem dst="pushButton_2" dstEdge="RIGHT" spacing="expr(-var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="pushButton_2" dstEdge="RIGHT" spacing="-expr(var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="connectionCombobox" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
                 <anchoritem dst="connectionCombobox" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-top) )" src="deviceStatus" srcEdge="BOTTOM"/>
                 <anchoritem dst="connectionCombobox" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="pushButton_1" dstEdge="LEFT" spacing="expr(var(hb-param-margin-gene-left) )" src="" srcEdge="LEFT"/>
                 <anchoritem dst="pushButton_1" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-middle-vertical) )" src="pushButton_0" srcEdge="BOTTOM"/>
-                <anchoritem dst="pushButton_1" dstEdge="RIGHT" spacing="expr(-var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="pushButton_1" dstEdge="RIGHT" spacing="-expr(var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="pushButton_0" dstEdge="LEFT" spacing="expr(var(hb-param-margin-gene-left) )" src="" srcEdge="LEFT"/>
                 <anchoritem dst="pushButton_0" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-top) )" src="connectionCombobox" srcEdge="BOTTOM"/>
-                <anchoritem dst="pushButton_0" dstEdge="RIGHT" spacing="expr(-var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="pushButton_0" dstEdge="RIGHT" spacing="-expr(var(hb-param-margin-gene-right) )" src="" srcEdge="RIGHT"/>
             </layout>
-    	</widget>
+        </widget>
     </section>
     <metadata activeUIState="Common ui state" display="NHD-3.2-inch_portrait" unit="un">
         <uistate name="Common ui state" sections="#common"/>
--- a/bluetoothengine/btui/btcpplugin/docml/bt-main-view.docml	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/docml/bt-main-view.docml	Fri Jul 23 15:57:13 2010 +0300
@@ -15,26 +15,8 @@
     <object name="advanceSettings" type="HbAction">
         <string locid="txt_bt_opt_advanced_settings" name="text" value="Advanced Settings"/>
     </object>
-    <object name="audioDevices" type="HbAction">
-        <string locid="txt_bt_list_audio_device" name="text" value="Audio Devices"/>
-    </object>
-    <object name="computers" type="HbAction">
-        <string locid="txt_bt_list_computer" name="text" value="Computers"/>
-    </object>
-    <object name="inputDevices" type="HbAction">
-        <string locid="txt_bt_list_input_device" name="text" value="Input Devices"/>
-    </object>
-    <object name="otherDevices" type="HbAction">
-        <string locid="txt_bt_list_other" name="text" value="Other Devices"/>
-    </object>
-    <object name="removePairedDevices" type="HbAction">
-        <string locid="txt_bt_opt_remove_paired_devices" name="text" value="Remove Paired Devices"/>
-    </object>
-    <object name="exit" type="HbAction">
-        <string locid="txt_common_opt_exit" name="text" value="Exit"/>
-    </object>
-    <object name="phones" type="HbAction">
-        <string locid="txt_bt_list_phone" name="text" value="Phones"/>
+    <object name="showOnly" type="HbAction">
+        <string locid="txt_bt_opt_show" name="text" value="Show only"/>
     </object>
     <widget name="view" type="HbView">
         <widget name="content" role="HbView:widget" type="HbWidget">
@@ -45,8 +27,9 @@
                 <ref object="discoverAction" role="HbWidget:addAction"/>
             </widget>
             <widget name="container_1" type="HbWidget">
-                <widget name="groupBox" type="HbGroupBox">
-                    <bool name="collapsable" value="FALSE"/>
+                <widget name="dataForm" type="HbDataForm">
+                    <widget name="dataformviewItemPrototype" role="HbAbstractView:prototype" type="HbDataFormViewItem"/>
+                    <sizehint height="7.8806un" type="MINIMUM"/>
                     <string locid="txt_bt_subhead_bluetooth_paired_devices" name="heading" value="Bluetooth"/>
                 </widget>
                 <widget name="container" type="HbWidget">
@@ -101,13 +84,14 @@
                 <sizehint height="23.8806un" type="PREFERRED" width="11.9403un"/>
                 <layout orientation="Vertical" spacing="0un" type="linear">
                     <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
-                    <linearitem itemname="groupBox"/>
+                    <linearitem itemname="dataForm"/>
                     <linearitem itemname="container"/>
                 </layout>
             </widget>
             <widget name="listView" type="HbListView">
                 <widget name="listItemPrototype" role="HbAbstractView:prototype" type="HbListViewItem"/>
                 <enums name="selectionMode" value="NoSelection"/>
+                <sizepolicy horizontalPolicy="Expanding" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
                 <sizehint height="47.7612un" type="PREFERRED" width="35.8209un"/>
             </widget>
             <layout orientation="Vertical" spacing="var(hb-param-margin-gene-middle-vertical)" type="linear">
@@ -118,21 +102,35 @@
             </layout>
         </widget>
         <widget name="viewMenu" role="HbView:menu" type="HbMenu">
-            <widget name="subMenu" role="HbMenu:menu" type="HbMenu">
-                <ref object="audioDevices" role="HbWidget:addAction"/>
-                <ref object="computers" role="HbWidget:addAction"/>
-                <ref object="phones" role="HbWidget:addAction"/>
-                <ref object="inputDevices" role="HbWidget:addAction"/>
-                <ref object="otherDevices" role="HbWidget:addAction"/>
-                <string locid="txt_bt_opt_show" name="title" value="Show Only"/>
-            </widget>
             <ref object="advanceSettings" role="HbWidget:addAction"/>
-            <ref object="removePairedDevices" role="HbWidget:addAction"/>
-            <ref object="exit" role="HbWidget:addAction"/>
+            <ref object="showOnly" role="HbWidget:addAction"/>
         </widget>
         <string locid="txt_cp_title_control_panel" name="title" value="Control Panel"/>
     </widget>
     <section name="portrait">
+        <widget name="combobox" type="HbComboBox">
+            <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="31.34328un"/>
+        </widget>
+        <widget name="content" role="HbView:widget" type="HbWidget">
+            <layout orientation="Vertical" spacing="var(hb-param-margin-gene-middle-vertical)" type="linear">
+                <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
+                <linearitem itemname="dataForm"/>
+                <linearitem itemname="container"/>
+                <linearitem itemname="listView"/>
+                <linearitem itemname="toolBar"/>
+            </layout>
+        </widget>
+        <widget name="lineEdit" type="HbLineEdit">
+            <sizehint type="PREFERRED" width="29.25373un"/>
+        </widget>
+        <widget name="pushButton" type="HbPushButton">
+            <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
+            <sizehint height="var(hb-param-graphic-size-primary-large)" type="MAXIMUM" width="var(hb-param-graphic-size-primary-large)"/>
+        </widget>
+        <widget name="icon" type="HbLabel">
+            <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
+            <sizehint height="var(hb-param-graphic-size-primary-large)" type="MAXIMUM" width="var(hb-param-graphic-size-primary-large)"/>
+        </widget>
         <widget name="container" type="HbWidget">
             <layout type="anchor">
                 <anchoritem dst="icon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
@@ -149,30 +147,17 @@
                 <anchoritem dst="pushButton" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
             </layout>
         </widget>
-        <widget name="pushButton" type="HbPushButton">
-            <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
-            <sizehint height="var(hb-param-graphic-size-primary-large)" type="MAXIMUM" width="var(hb-param-graphic-size-primary-large)"/>
+    </section>
+    <section name="landscape">
+        <widget name="combobox" type="HbComboBox">
+            <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="34.92537un"/>
         </widget>
-        <widget name="content" role="HbView:widget" type="HbWidget">
-            <layout orientation="Vertical" spacing="var(hb-param-margin-gene-middle-vertical)" type="linear">
-                <linearitem itemname="groupBox"/>
-                <linearitem itemname="container"/>
-                <linearitem itemname="listView"/>
-                <linearitem itemname="toolBar"/>
-            </layout>
+        <widget name="lineEdit" type="HbLineEdit">
+            <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="33un"/>
         </widget>
         <widget name="icon" type="HbLabel">
             <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
-            <sizehint height="var(hb-param-graphic-size-primary-large)" type="MAXIMUM" width="var(hb-param-graphic-size-primary-large)"/>
         </widget>
-        <widget name="lineEdit" type="HbLineEdit">
-            <sizehint type="PREFERRED" width="29.25373un"/>
-        </widget>
-        <widget name="combobox" type="HbComboBox">
-            <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="31.34328un"/>
-        </widget>
-    </section>
-    <section name="landscape">
         <widget name="container" type="HbWidget">
             <layout type="anchor">
                 <anchoritem dst="icon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
@@ -186,15 +171,6 @@
                 <anchoritem dst="pushButton" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-top) )" src="" srcEdge="TOP"/>
             </layout>
         </widget>
-        <widget name="icon" type="HbLabel">
-            <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
-        </widget>
-        <widget name="lineEdit" type="HbLineEdit">
-            <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="33un"/>
-        </widget>
-        <widget name="combobox" type="HbComboBox">
-            <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="34.92537un"/>
-        </widget>
     </section>
     <metadata activeUIState="Common ui state" display="NHD-3.2-inch_portrait" unit="un">
         <uistate name="Common ui state" sections="#common"/>
--- a/bluetoothengine/btui/btcpplugin/docml/bt-search-view.docml	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/docml/bt-search-view.docml	Fri Jul 23 15:57:13 2010 +0300
@@ -25,15 +25,9 @@
     <widget name="bt_search_view" type="HbView">
         <widget name="search_view_content" role="HbView:widget" type="HbWidget">
             <widget name="search_container" type="HbWidget">
-                <widget name="label_found_devices" type="HbLabel">
-                    <real name="z" value="3"/>
-                    <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="38.20896un"/>
-                    <bool name="visible" value="TRUE"/>
-                    <string locid="txt_bt_subhead_bluetooth_found_devices" name="plainText" value="Bluetooth - Found devices"/>
-                </widget>
                 <widget name="icon" type="HbLabel">
                     <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
-                    <icon iconName="note_warning" name="icon"/>
+                    <icon iconName="qtg_anim_small_loading.axml" name="icon"/>
                     <real name="z" value="2"/>
                     <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
                     <sizehint height="var(hb-param-graphic-size-primary-large)" type="MAXIMUM" width="var(hb-param-graphic-size-primary-large)"/>
@@ -45,20 +39,29 @@
                     <bool name="visible" value="TRUE"/>
                     <string locid="txt_bt_subhead_searching" name="plainText" value="Searching..."/>
                 </widget>
+                <widget name="dataForm" type="HbDataForm">
+                    <widget name="dataformviewItemPrototype" role="HbAbstractView:prototype" type="HbDataFormViewItem"/>
+                    <real name="z" value="4"/>
+                    <sizepolicy horizontalPolicy="Expanding" horizontalStretch="0" verticalPolicy="Expanding" verticalStretch="0"/>
+                    <sizehint type="PREFERRED" width="25un"/>
+                    <string locid="txt_bt_subhead_bluetooth_found_devices" name="heading" value="Found devices"/>
+                </widget>
                 <real name="z" value="0"/>
-                <sizehint height="21un" type="PREFERRED" width="51.19403un"/>
+                <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Expanding" verticalStretch="0"/>
+                <sizehint height="12.784un" type="PREFERRED" width="51.19403un"/>
+                <sizehint height="14.784un" type="MAXIMUM"/>
                 <bool name="visible" value="TRUE"/>
                 <layout type="anchor">
-                    <anchoritem dst="label_found_devices" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
-                    <anchoritem dst="label_found_devices" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
-                    <anchoritem dst="label_found_devices" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
-                    <anchoritem dst="icon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="label_found_devices" srcEdge="BOTTOM"/>
+                    <anchoritem dst="dataForm" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+                    <anchoritem dst="dataForm" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+                    <anchoritem dst="dataForm" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+                    <anchoritem dst="label_searching" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="icon" srcEdge="RIGHT"/>
+                    <anchoritem dst="label_searching" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-middle-vertical) )" src="dataForm" srcEdge="BOTTOM"/>
+                    <anchoritem dst="label_searching" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
+                    <anchoritem dst="label_searching" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
                     <anchoritem dst="icon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
-                    <anchoritem dst="icon" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-bottom)" src="" srcEdge="BOTTOM"/>
-                    <anchoritem dst="label_searching" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="label_found_devices" srcEdge="BOTTOM"/>
-                    <anchoritem dst="label_searching" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="icon" srcEdge="RIGHT"/>
-                    <anchoritem dst="label_searching" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-bottom)" src="" srcEdge="BOTTOM"/>
-                    <anchoritem dst="label_searching" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
+                    <anchoritem dst="icon" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-top) )" src="dataForm" srcEdge="BOTTOM"/>
+                    <anchoritem dst="icon" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
                 </layout>
             </widget>
             <widget name="toolBar" type="HbToolBar">
@@ -72,7 +75,8 @@
                 <enums name="horizontalScrollBarPolicy" value="ScrollBarAsNeeded"/>
             </widget>
             <real name="z" value="0"/>
-            <layout orientation="Vertical" type="linear">
+            <layout orientation="Vertical" spacing="0un" type="linear">
+                <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
                 <linearitem itemname="search_container"/>
                 <linearitem itemname="deviceList"/>
                 <linearitem itemname="toolBar"/>
@@ -86,23 +90,37 @@
         <real name="z" value="1"/>
     </widget>
     <section name="landscape">
+        <widget name="label_searching" type="HbLabel">
+            <sizepolicy horizontalPolicy="Expanding" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+        </widget>
+        <widget name="icon" type="HbLabel">
+            <sizepolicy horizontalPolicy="Expanding" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+        </widget>
+        <widget name="dataForm" type="HbDataForm">
+            <sizepolicy horizontalPolicy="Expanding" horizontalStretch="0" verticalPolicy="Expanding" verticalStretch="0"/>
+            <sizehint type="PREFERRED" width="51.19403un"/>
+        </widget>
         <widget name="search_container" type="HbWidget">
-            <sizehint height="10un" type="PREFERRED" width="51.19403un"/>
+            <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Ignored" verticalStretch="0"/>
+            <sizehint height="12un" type="PREFERRED" width="51.19403un"/>
+            <sizehint height="12.75un" type="MAXIMUM"/>
             <layout type="anchor">
-                <anchoritem dst="label_found_devices" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
-                <anchoritem dst="label_found_devices" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
-                <anchoritem dst="label_found_devices" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-bottom)" src="" srcEdge="BOTTOM"/>
-                <anchoritem dst="icon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
-                <anchoritem dst="icon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="label_found_devices" srcEdge="RIGHT"/>
-                <anchoritem dst="icon" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-bottom)" src="" srcEdge="BOTTOM"/>
+                <anchoritem dst="icon" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+                <anchoritem dst="icon" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+                <anchoritem dst="label_searching" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-bottom)" src="" srcEdge="BOTTOM"/>
+                <anchoritem dst="label_searching" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
                 <anchoritem dst="label_searching" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
                 <anchoritem dst="label_searching" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="icon" srcEdge="RIGHT"/>
-                <anchoritem dst="label_searching" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-bottom)" src="" srcEdge="BOTTOM"/>
-                <anchoritem dst="label_searching" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="icon" dstEdge="LEFT" spacing="0un" src="dataForm" srcEdge="RIGHT"/>
+                <anchoritem dst="icon" dstEdge="RIGHT" spacing="0un" src="label_searching" srcEdge="LEFT"/>
+                <anchoritem dst="dataForm" dstEdge="RIGHT" spacing="0un" src="icon" srcEdge="LEFT"/>
+                <anchoritem dst="dataForm" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+                <anchoritem dst="dataForm" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+                <anchoritem dst="dataForm" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
             </layout>
         </widget>
     </section>
-    <metadata activeUIState="portrait_ui" display="NHD-3.2-inch_portrait" unit="un">
+    <metadata activeUIState="landscape_ui" display="NHD-3.2-inch_landscape" unit="un">
         <uistate name="Common ui state" sections="#common"/>
         <uistate name="landscape_ui" sections="#common landscape"/>
         <uistate name="portrait_ui" sections="#common"/>
--- a/bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -14,11 +14,9 @@
 * Description: 
 *
 */
-
+#include "btdelegatedevsecurity.h"
+#include "btqtconstants.h"
 #include <QModelIndex>
-
-#include "btqtconstants.h"
-#include "btdelegatedevsecurity.h"
 #include <btsettingmodel.h>
 #include <btdevicemodel.h>
 #include <btdelegatefactory.h>
--- a/bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.h	Fri Jul 23 15:57:13 2010 +0300
@@ -21,7 +21,6 @@
 #include <e32base.h>
 #include <btengconnman.h>
 #include <btengdevman.h>
-#include <btengconnman.h>
 #include "btabstractdelegate.h"
 
 class BtuiModel;
--- a/bluetoothengine/btui/btuidelegate/btdelegateinquiry.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btuidelegate/btdelegateinquiry.h	Fri Jul 23 15:57:13 2010 +0300
@@ -16,8 +16,8 @@
 */
 
 
-#ifndef BTDELEGATEINQUIRY_H_
-#define BTDELEGATEINQUIRY_H_
+#ifndef BTDELEGATEINQUIRY_H
+#define BTDELEGATEINQUIRY_H
 
 #include <e32base.h>
 #include <btengsettings.h>
@@ -53,4 +53,4 @@
     
 };
 
-#endif /* BTDELEGATEINQUIRY_H_ */
+#endif /* BTDELEGATEINQUIRY_H */
--- a/bluetoothengine/btui/btuidelegate/btdelegateremotedevname.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btuidelegate/btdelegateremotedevname.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -26,7 +26,7 @@
 
 BtDelegateRemoteDevName::BtDelegateRemoteDevName(BtSettingModel* settingModel, 
         BtDeviceModel* deviceModel,QObject *parent )
-    :BtAbstractDelegate( settingModel, deviceModel, parent ), mRegistryActive(0)
+    :BtAbstractDelegate( settingModel, deviceModel, parent ), mRegistryActive(0), mRegistryOpened(false)
 {
     
 }
@@ -35,7 +35,8 @@
 {
     delete mRegistryActive;
     mSymName.Close();
-    mBtRegistry.Close();
+    if (mRegistryOpened)
+        mBtRegistry.Close();//there is crash is close the btregistry without opening it first
     mBtRegServ.Close();
 }
 
@@ -70,11 +71,20 @@
     QVariant nameVariant = paramList.at(1); 
     QString btRemoteDevName = nameVariant.toString();
     
+    if (!validateName(btRemoteDevName)){
+            emit commandCompleted(KErrBadName);
+            return;
+    }
+    mNewName = btRemoteDevName;
+    /*
+    QModelIndex start = getDeviceModel()->index(0,0);
+    QModelIndexList indexList = getDeviceModel()->match(start,BtDeviceModel::NameAliasRole, mNewName);
+    if (indexList.size() > 1){
+        emit commandCompleted(KErrBadName, mNewName);
+        return;
+    }
+    */
     int error = KErrNone;
-            
-    validateName(btRemoteDevName);
-    mNewName = btRemoteDevName;
-    
     TPtrC ptrName(reinterpret_cast<const TText*>(btRemoteDevName.constData()));
   
     error = mSymName.Create(ptrName.Length());
@@ -105,6 +115,8 @@
         emit commandCompleted(error,mNewName);
         return;
     }
+    mRegistryOpened = true;
+    
     if (!mRegistryActive){
         RequestIdentifiers requestId = Unknown;
         TRAP(error, mRegistryActive = CBtSimpleActive::NewL(
--- a/bluetoothengine/btui/btuidelegate/btdelegateremotedevname.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btuidelegate/btdelegateremotedevname.h	Fri Jul 23 15:57:13 2010 +0300
@@ -72,6 +72,8 @@
     
     TBTDevAddr mSymaddr;
     
+    bool mRegistryOpened;
+    
 
 private:
 
--- a/bluetoothengine/btui/btuimodel/btdevicemodel_p.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/btuimodel/btdevicemodel_p.h	Fri Jul 23 15:57:13 2010 +0300
@@ -15,8 +15,8 @@
 *
 */
 
-#ifndef BTDEVICEMODE_P_H
-#define BTDEVICEMODE_P_H
+#ifndef BTDEVICEMODELPRIVATE_H
+#define BTDEVICEMODELPRIVATE_H
 
 #include "btuimodeltypes.h"
 #include <btdevicemodel.h>
@@ -137,4 +137,4 @@
 
 };
 
-#endif // BTLOCALSETTING_H
+#endif // BTDEVICEMODELPRIVATE_H
--- a/bluetoothengine/btui/inc/btuiiconutil.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/bluetoothengine/btui/inc/btuiiconutil.h	Fri Jul 23 15:57:13 2010 +0300
@@ -21,7 +21,7 @@
 #include <qglobal.h>
 #include <bt_sock.h>
 #include <HbIcon>
-#include "btdevicemodel.h"
+//#include "btdevicemodel.h"
 #include "btuidevtypemap.h"
 
 enum BtuiIconCorner {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/btobexprofiles/inc/BTServiceParameterList.h	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,239 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Parameter list
+*
+*/
+
+
+#ifndef BT_SERVICE_PARAMETER_LIST_H
+#define BT_SERVICE_PARAMETER_LIST_H
+
+// INCLUDES
+#include <e32std.h>
+#include <badesca.h>    // CDesCArray
+#include <f32file.h>
+
+// CONSTANTS
+
+// DATA TYPES
+
+struct TBTSUXhtmlParam
+    {
+    TDesC* iFileName;
+    CDesCArray* iRefObjectList;
+    };
+
+struct TBTSUImageParam
+    {    
+    RFile   iFile; 
+    TDesC*  iDisplayName;
+    TDesC8* iMimeType;
+    TSize   iPixelSize;
+    TInt    iFileSize;    
+    TBool   iSend;
+    
+    };
+    
+
+// CLASS DECLARATION
+
+/**
+*  A class holding paths to different types of files. 
+*
+*  In case of an XHTML file the list collects paths 
+*  to objects referenced in the file.
+*
+*  In case of an image the list resolves the MIME types and
+*  displayable names of the images.
+*
+*  @lib BtServiceUtils.lib
+*  @since Series 60 2.6
+*/
+class CBTServiceParameterList : public CBase
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CBTServiceParameterList* NewL();
+        IMPORT_C static CBTServiceParameterList* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CBTServiceParameterList();
+
+    public: // New functions
+
+        /**
+        * Adds an xhtml file path to the list.
+        * @since Series 60 2.6
+        * @param aFilePath A full path and file name.
+        * @return None.
+        */
+        IMPORT_C void AddXhtmlL( const TDesC& aFilePath );
+
+        /**
+        * Adds an image file path to the list.
+        * @since Series 60 2.6
+        * @param aFilePath A full path and file name.
+        * @return None.
+        */
+        IMPORT_C void AddImageL( const TDesC& aFilePath );
+        
+        /**
+        * Adds an image file path to the list.
+        * @since Series 60 2.6
+        * @param aFile file handle to be send.
+        * @return None.
+        */
+        IMPORT_C void AddImageL( RFile aFile );
+
+        /**
+        * Adds an object file path to the list.
+        * @since Series 60 2.6
+        * @param aFilePath A full path and file name.
+        * @return None.
+        */
+        IMPORT_C void AddObjectL( const TDesC& aFilePath );
+        
+        /**
+        * Adds an object file path to the list.
+        * @since Series 60 2.6
+        * @param aFile file handle to be send .
+        * @return None.
+        */
+        IMPORT_C void AddObjectL( RFile aFile );
+
+    public: // New functions (not exported)
+        
+        /**
+        * Return the number of xhtml file paths in the list.
+        * @return The count.
+        */
+        TInt XhtmlCount() const;
+
+        /**
+        * Return the number of image file paths in the list.
+        * @return The count.
+        */
+        TInt ImageCount() const;
+
+        /**
+        * Return the number of object file paths in the list.
+        * @return The count.
+        */
+        TInt ObjectCount() const;
+        
+        /**
+        * Returns a copy of an element of the list from the given index.
+        * @param aIndex The index.
+        * @return The element.
+        */
+        TBTSUXhtmlParam XhtmlAt( TInt aIndex ) const;
+
+        /**
+        * Returns a copy of an element of the list from the given index.
+        * @param aIndex The index.
+        * @return The element.
+        */
+        TBTSUImageParam ImageAtL( TInt aIndex ) const;
+
+        /**
+        * Returns a copy of an element of the list from the given index.
+        * @param aIndex The index.
+        * @return The element.
+        */
+        RFile& ObjectAtL( TInt aIndex );
+
+        /**
+        * Checks whether the list has any xhtml-files with referenced objects.
+        * @return A boolean according to result.
+        */
+        TBool HasAnyReferencedObjects() const;
+
+        /**
+        * Return the size of objects in the list.
+        * @return The count.
+        */
+        TInt ObjectListSizeL() const;
+        
+        /**
+        * Return the size of images in the list.
+        * @return The count.
+        */
+        
+        TInt ImageListSize() const;
+        
+        /**
+        * Remove image from list.
+        * @param aIndex The index.
+        * @return None.
+        */
+        void RemoveImageL(TInt aIndex);
+        
+        /**
+        * Return count of removed image        
+        * @return The count of removed images.
+        */
+        TInt RemovedImageCount();
+        
+        /**
+        * Reset image filehandle
+        * @param aIndex The index.
+        * @return None.
+        */
+        void ResetImageHandleL(TInt aIndex);
+        
+        /**
+        * Reset object filehandle
+        * @param aIndex The index.
+        * @return None.
+        */
+        void ResetObjectHandleL(TInt aIndex);  
+        
+        
+        /**
+        * Reset image filehandle
+        * @param aIndex The index.
+        * @return None.
+        */
+        void MarkAsSendL(TInt aIndex);        
+                
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CBTServiceParameterList();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        RArray<TBTSUXhtmlParam> iXhtmlList;
+        RArray<TBTSUImageParam> iImageList;
+        RArray<RFile> iObjectList;
+        RFs iFileSession;        
+        TInt iRemovedImageCount;
+    };
+
+#endif      // BT_SERVICE_PARAMETER_LIST_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/btobexprofiles/inc/btserviceapi.h	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  API for sending services
+*
+*/
+
+
+
+#ifndef BT_SERVICE_API_H
+#define BT_SERVICE_API_H
+
+//  INCLUDES
+#include "BTServiceParameterList.h"
+
+// CONSTANTS
+
+// DATA TYPES
+
+enum TBTServiceType
+    {
+    EBTSendingService,
+    EBTPrintingService,
+    EBTObjectPushService // use this if support for only OPP is wanted
+    };
+
+// FORWARD DECLARATIONS
+class CBTServiceStarter;
+
+// CLASS DECLARATION
+
+/**
+*  An API for starting Bluetooth services.
+*
+*  @lib BtServiceUtils.lib
+*  @since Series 60 2.6
+*/
+class CBTServiceAPI : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CBTServiceAPI* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CBTServiceAPI();
+
+    public: // New functions
+        
+        /**
+        * Starts the given service.
+        * Returns when service is started.
+        * @since Series 60 2.6
+        * @param aService The service to be started.
+        * @param aList Parameters for the service.
+        * @return None.
+        */
+        IMPORT_C void StartServiceL( TBTServiceType aService, 
+                                     CBTServiceParameterList* aList );
+
+        /**
+        * Starts the given service.
+        * Returns when service is completed.
+        * @since Series 60 2.6
+        * @param aService The service to be started.
+        * @param aList Parameters for the service.
+        * @return None.
+        */
+        IMPORT_C void StartSynchronousServiceL( TBTServiceType aService, 
+                                     CBTServiceParameterList* aList );
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CBTServiceAPI();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        CBTServiceStarter*      iStarter;
+        CActiveSchedulerWait    iSyncWaiter;
+    };
+
+#endif      // BT_SERVICE_API_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/btobexprofiles/inc/obexutilsdialog.h	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#ifndef COBEXUTILSDIALOG_H
+#define COBEXUTILSDIALOG_H
+
+#include    <e32base.h>
+
+#include <hbdeviceprogressdialogsymbian.h>
+#include <hbdevicedialogsymbian.h>
+#include <hbdevicemessageboxsymbian.h>
+#include <hbsymbianvariant.h>
+
+class CObexUtilsDialogTimer;
+
+enum TButtonId
+    {
+    ECancelButton = -1,
+    EYesButton,
+    ENoButton
+    };
+/**
+*  An observer interface for asking progress status of an operation using 
+*  a progress dialog.
+*/
+NONSHARABLE_CLASS(  MObexUtilsProgressObserver )
+    {
+    public:
+
+        /**
+        * Returns the progress status of the operation.
+        * @since 2.6
+        * @return A progress value relative to final value.
+        */
+        virtual TInt GetProgressStatus() = 0;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  An observer interface for informing about dialog events.
+*/
+NONSHARABLE_CLASS(  MObexUtilsDialogObserver )
+    {
+    public:
+
+        /**
+        * Informs the observer that a dialog has been dismissed.
+        * @since 2.6
+        * todo check whether the parameter is required
+        * @param aButtonId The button that was used to dismiss the dialog.
+        */
+        virtual void DialogDismissed(TInt aButtonId) = 0; //TInt aButtonId
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  A class for launching and managing dialogs.
+*/
+NONSHARABLE_CLASS( CObexUtilsDialog ) : public CBase, 
+                                        public MHbDeviceProgressDialogObserver,
+                                        public MHbDeviceDialogObserver,
+                                        public MHbDeviceMessageBoxObserver
+    {
+    public:// Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CObexUtilsDialog* NewL( 
+            MObexUtilsDialogObserver* aObserverPtr );        
+        
+        IMPORT_C static CObexUtilsDialog* NewLC( 
+            MObexUtilsDialogObserver* aObserverPtr );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CObexUtilsDialog();
+   
+    public: // New functions
+        
+        
+        /**
+        * Launches a progress dialog.
+        * @param aObserverPtr A pointer to progress observer. A NULL pointer if 
+                              the progress dialog is updated manually.
+        * @param aFileCount Total number of files to be sent.
+        * @param aDeviceName Device Name to which files to be sent.
+        * @param aTimeoutValue A value telling how often should the dialog be
+                               updated. Relevant only if observer is given.
+        */
+        IMPORT_C void LaunchProgressDialogL( 
+            MObexUtilsProgressObserver* aObserverPtr, TInt aFileCount, 
+            const TDesC& aDeviceName, TInt aTimeoutValue );
+        
+        /**
+        * Updates the progress dialog with new file information when multiples files are sent.
+        * @param aFileSize Size of the file to be sent
+        * @param aFileIndex Index of the file to be sent
+        * @param aFileName Name of the file to be sent.
+        */
+        IMPORT_C void UpdateProgressNoteL( TInt aFileSize,TInt aFileIndex, const TDesC& aFileName );    
+        
+        /**
+        * Launches a wait dialog.
+        * @param aDisplayText Text that needs to be displayed.
+        */
+        IMPORT_C void LaunchWaitDialogL( const TDesC& aDisplayText );
+        
+        /**
+        * Cancels a wait dialog if one exists.
+        * @since 2.6        
+        * @return None.
+        */
+        IMPORT_C void CancelWaitDialog();
+        
+        /**
+        * Cancels a wait progress dialog if one exists.
+        * @since 2.6       
+        * @return None.
+        */
+        IMPORT_C void CancelProgressDialog();
+        
+        /**
+        * Updates a progress dialog with the latest progress value 
+        * @param aValue A progress value relative to final value.
+        * @return None
+        */
+        IMPORT_C void UpdateProgressDialogL( TInt aProgressValue );
+        
+        /**
+        * Show a query note
+        * @param aConfirmText text for the note.
+        * @return None		
+        */
+        IMPORT_C void LaunchQueryDialogL( const TDesC& aConfirmText );
+
+        /**
+        * Shows an error note.
+        * @param aTextId A resource id for the note.
+        * @return None.
+        */
+        IMPORT_C void ShowErrorNoteL( const TDesC& aErrorText );
+
+        /**
+        * Shows an information note.
+        * @param aTextId A resource id for the note.
+        * @return None.
+        */
+        IMPORT_C void ShowInformationNoteL( const TDesC& aInfoText );
+
+    public: // New functions (not exported)
+
+        /**
+        * Updates the progress dialog.
+        * @return None.
+        */
+        void UpdateProgressDialog();
+
+    private: // Functions from base classes
+        
+        /**
+        * From MHbDeviceProgressDialogObserver called when dialog is closed by pressing the "cancel" button
+        * @param aDialog Pointer to dialog that was cancelled.
+        * @return None.
+        */
+        void ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian* aDialog);
+        
+        /**
+        * From MHbDeviceProgressDialogObserver called when a device progress dialog is has closed
+        * @param aDialog Pointer to dialog instance that has closed.
+        * @return None.
+        */
+        void ProgressDialogClosed(const CHbDeviceProgressDialogSymbian* aDialog )  ; 
+        
+        /**
+          * From MHbDeviceDialogObserver called when data is received from a device dialog
+          * @param aDialog Pointer to dialog instance that has closed.
+          * @return None.
+          */
+        void DataReceived(CHbSymbianVariantMap& aData);
+       
+        /**
+          * From MHbDeviceDialogObserver called when a device dialog is closed
+          * @param  aData contains data from the dialog plugin.
+          * @return None.
+          */
+         void DeviceDialogClosed(TInt aCompletionCode);
+        
+        /**
+        * from base class MHbDeviceMessageBoxObserver
+        * @param aMessageBox Pointer to dialog instance that has closed.
+        * @param aButton the id of the button the user pressed
+        */    
+        void  MessageBoxClosed(const CHbDeviceMessageBoxSymbian *aMessageBox, 
+                CHbDeviceMessageBoxSymbian::TButtonId aButton); 
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CObexUtilsDialog( MObexUtilsDialogObserver* aObserverPtr );
+	
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+         * Add a data item into the given CHbSymbianVariantMap.
+         * @param aMap the instance to which the data item will be added.
+         * @param aKey the key of the data item.
+         * @param aData the value of the data item
+         * @param aDataType the data-type of the data item
+         */
+        void AddDataL(CHbSymbianVariantMap* aMap, const TDesC& aKey, 
+                const TAny* aData, CHbSymbianVariant::TType aDataType);
+        
+        /**
+         * Creates and shows a message box.
+         * @param aType the type of the message box to create.
+         * @param aText the text to be shown in the message box
+         * @param aObserver the observer that receives the events from the 
+         *         message box
+         * @param aTimeout the timeout value of the message box 
+         */
+        CHbDeviceMessageBoxSymbian* CreateAndShowMessageBoxL(
+                CHbDeviceMessageBoxSymbian::TType aType,
+                const TDesC& aText, 
+                MHbDeviceMessageBoxObserver* aObserver,
+                TInt aTimeout );
+        
+    private: // Data
+
+        CHbDeviceDialogSymbian *iProgressDialog;
+        CHbDeviceProgressDialogSymbian* iWaitDialog;
+        CHbDeviceMessageBoxSymbian* iMessageBox;
+        
+        CObexUtilsDialogTimer*      iObexDialogTimer;
+        TInt                        iFileIndex;
+        TInt                        iFileCount;
+        RBuf                        iDeviceName;
+
+        // Not Owned
+        //
+        MObexUtilsProgressObserver* iProgressObserverPtr;
+        MObexUtilsDialogObserver*   iDialogObserverPtr;
+    };
+
+#endif      // COBEXUTILSDIALOG_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/btobexprofiles/inc/obexutilspropertynotifier.h	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares disk status watcher class for ObexUtils.
+*
+*/
+
+
+
+#ifndef _OBEXUTILSPROPERTYNOTIFIER_H
+#define _OBEXUTILSPROPERTYNOTIFIER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32property.h>
+#include <UikonInternalPSKeys.h>
+
+// CLASS DECLARATION
+
+	/**
+	Type of memory property check, 
+	@param  ECheckPhoneMemory, phone memory is checked, default value if not mentioned explicitly.	
+    @param  ECheckMMCMemory, MMC memory is checked.	
+	*/
+
+enum TMemoryPropertyCheckType
+	{
+	ECheckPhoneMemory,
+	ECheckMMCMemory
+	};
+
+	/**
+	A callback interface for informing content change of disk status. Client must derive 
+    from this class and implement HandleNotifyL() method. When disk space will cross warning
+    level or critical level this method will be call back.
+    */
+
+NONSHARABLE_CLASS(  MObexUtilsPropertyNotifyHandler )
+	{
+	public:
+        /**
+        * Callback method for disk status change
+        * @param aUid  UID identifying a shared data file where notify came from.
+        * @param aKey  keyword of which value was changed
+        */
+        virtual void HandleNotifyL( TMemoryPropertyCheckType aCheckType ) =0;
+	};
+
+NONSHARABLE_CLASS( CObexUtilsPropertyNotifier ) : public CActive
+	{
+public:  // NewL, Constructors and destructor
+
+    /*
+    * Two-phased constructor.
+    * @param aHandler -Pointer to the MObexUtilsPropertyNotifyHandler derived class
+    * @param aCheckType -Constant defining type of memory checking to be done (phone/MMC)
+    * @return CObexUtilsPropertyNotifier* -Initialized object.
+    */
+
+	IMPORT_C static CObexUtilsPropertyNotifier* NewL(
+	    MObexUtilsPropertyNotifyHandler* aHandler,
+	    TMemoryPropertyCheckType aCheckType=ECheckPhoneMemory );
+
+    /**
+    * Destructor.
+    */
+
+	virtual ~CObexUtilsPropertyNotifier();
+private:  // Functions from base classes
+
+    /**
+    * Constructor.
+    * @param aHandler -Pointer to the MObexUtilsPropertyNotifyHandler derived class
+    * @param aCheckType -Constant defining type of memory checking to be done (phone/MMC)
+    */
+
+	CObexUtilsPropertyNotifier(
+	    MObexUtilsPropertyNotifyHandler* aHandler,
+	    TMemoryPropertyCheckType aCheckType );
+
+	void ConstructL();
+
+	/**
+	Subscribes to a property and sets active
+	*/
+	void Subscribe();
+
+    /**
+    * From CActive Gets called when CActive::Cancel is called, 
+    *              cancels disk status watching.
+    *
+    * @param None.
+    * @return None.
+    */
+
+	void DoCancel();
+
+    /**
+    * From CActive Gets called when content of disk status is changed, 
+    *              calls MObexUtilsPropertyNotifyHandler::HandleNotify.
+    *
+    * @param None.
+    * @return None.
+    */
+
+	void RunL();
+
+private:
+	// Reference to observer
+	MObexUtilsPropertyNotifyHandler* iHandler;
+	// Type of memory check (phone/MMC)
+	TMemoryPropertyCheckType iCheckType;
+	// Database handle	
+	RProperty iProperty;
+	};
+
+#endif  // _OBEXUTILSPROPERTYNOTIFIER_H
--- a/btobexprofiles/obexreceiveservices/bip/inc/BIPController.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexreceiveservices/bip/inc/BIPController.h	Fri Jul 23 15:57:13 2010 +0300
@@ -165,6 +165,9 @@
     CHbDeviceDialogSymbian*     iProgressDialog;
     TBool                       iDialogActive;
     TInt                        iFileCount;
+    TBool                       iReceivingFailed;
+    CHbDeviceDialogSymbian*     iRecvDoneDialog;
+    TBool                       iShowRecvCompleteDialog;
     };
     
 _LIT(KBipPanicCategory, "BIP");
--- a/btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -110,6 +110,7 @@
     iFs.Close();
     delete iDialog;
     delete iProgressDialog;
+    delete iRecvDoneDialog;
     TRACE_FUNC_EXIT    
     }
 
@@ -139,7 +140,8 @@
 void CBIPController::HandleError(TBool aAbort)
     {
     TRACE_FUNC_ENTRY
-    
+    iReceivingFailed = ETrue;
+    iShowRecvCompleteDialog = EFalse;
     if( iBTTransferState == ETransferPut || (!aAbort && iBTTransferState == ETransferPutDiskError) )
         {
         if(iBTObject)
@@ -188,6 +190,7 @@
 void CBIPController::TransportUpIndication()
     {
     TRACE_FUNC
+    iReceivingFailed = EFalse;
     if (!iFs.Handle())
         {
         TRACE_INFO( (_L( "[bipreceiveservice] TransportUpIndication iFs.Connect()" )) ); 
@@ -247,7 +250,63 @@
 //
 void CBIPController::TransportDownIndication()
     {
-    TRACE_FUNC   
+    TRACE_FUNC  
+    if(!iReceivingFailed && iShowRecvCompleteDialog)
+        {
+        //Launch recevice completed dialog.
+        iRecvDoneDialog = CHbDeviceDialogSymbian::NewL();
+        iRecvDoneDialog->SetObserver(this);
+    
+        CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL();
+        CleanupStack::PushL(variantMap);
+        
+        TInt dialogIdx = TBluetoothDialogParams::EReceiveDone;
+        CHbSymbianVariant* dialogType = CHbSymbianVariant::NewL( (TAny*) &(dialogIdx), 
+                                                            CHbSymbianVariant::EInt );
+        CleanupStack::PushL(dialogType);
+        TBuf16<6> dialogTypeKey;
+        dialogTypeKey.Num(TBluetoothDialogParams::EDialogType);
+        User::LeaveIfError(variantMap->Add(dialogTypeKey, dialogType));
+        CleanupStack::Pop(dialogType);
+        
+        CHbSymbianVariant* deviceName = CHbSymbianVariant::NewL( (TAny*) (&iRemoteDeviceName), 
+                                                            CHbSymbianVariant::EDes );
+        CleanupStack::PushL(deviceName);
+        TBuf16<6> deviceNameKey;
+        deviceNameKey.Num(TBluetoothDeviceDialog::EDeviceName);
+        User::LeaveIfError(variantMap->Add(deviceNameKey, deviceName));
+        CleanupStack::Pop(deviceName);
+        
+        CHbSymbianVariant* fileName = CHbSymbianVariant::NewL( (TAny*) (&iReceivingFileName), 
+                                                            CHbSymbianVariant::EDes );
+        CleanupStack::PushL(fileName);
+        TBuf16<6> fileNameKey;
+        fileNameKey.Num(TBluetoothDeviceDialog::EReceivingFileName);
+        User::LeaveIfError(variantMap->Add(fileNameKey, fileName));
+        CleanupStack::Pop(fileName);
+        
+        CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL( (TAny*) &iTotalSizeByte, 
+                                                            CHbSymbianVariant::EInt );
+        CleanupStack::PushL(fileSz);
+        TBuf16<6> fileSzKey;
+        fileSzKey.Num(TBluetoothDeviceDialog::EReceivingFileSize);
+        User::LeaveIfError(variantMap->Add(fileSzKey, fileSz));
+        CleanupStack::Pop(fileSz);
+        
+        CHbSymbianVariant* fileCnt = CHbSymbianVariant::NewL( (TAny*) &iFileCount, 
+                                                            CHbSymbianVariant::EInt );
+        CleanupStack::PushL(fileCnt);
+        TBuf16<6> fileCntKey;
+        fileCntKey.Num(TBluetoothDeviceDialog::EReceivedFileCount);
+        User::LeaveIfError(variantMap->Add(fileCntKey, fileCnt));
+        CleanupStack::Pop(fileCnt);
+        
+        iRecvDoneDialog->Show( KBTDevDialogId(), *variantMap, this );
+        CleanupStack::PopAndDestroy(variantMap);
+        
+        iShowRecvCompleteDialog = EFalse;
+        }
+    
     // Remove receiving buffer and files used during file receiving.
     //
     delete iBTObject;
@@ -381,6 +440,7 @@
         iBTTransferState = ETransferIdle;
         CloseReceivingIndicator();
         iFileCount++;
+        iShowRecvCompleteDialog = ETrue;
         }
     TRACE_FUNC_EXIT
     return retVal;
@@ -1004,15 +1064,28 @@
      if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0)
          {
          TInt val = *(static_cast<TInt*>(aData.Get(_L("actionResult"))->Data()));
-         if(!val)
+         switch(val)
              {
-             //Cancel has been clicked
-             CancelTransfer();
-             }
-         else
-             {
-             //Hide has been clicked
-             CloseReceivingIndicator(EFalse);
+             case TBluetoothDialogParams::ECancelReceive:
+                 {
+                 //User choose to cancel receiving.
+                 CancelTransfer();
+                 }break;
+                 
+             case TBluetoothDialogParams::EHide:
+                 {
+                 //Use choose to hide the progress dialog.
+                 CloseReceivingIndicator(EFalse);
+                 }break;
+                 
+             case TBluetoothDialogParams::EShow:
+             case TBluetoothDialogParams::ECancelShow:
+                 {
+                 //In case of Show, the device dialog will handle the opening of conversation view.
+                 iRecvDoneDialog->Cancel();
+                 delete iRecvDoneDialog;
+                 iRecvDoneDialog = NULL;
+                 }break;
              }
          }
      }
--- a/btobexprofiles/obexreceiveservices/btmsgviewer/btmsgviewer.pro	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexreceiveservices/btmsgviewer/btmsgviewer.pro	Fri Jul 23 15:57:13 2010 +0300
@@ -30,7 +30,9 @@
     -lbluetooth \
     -lmsgs \
     -lapmime \
-    -lefsrv
+    -lefsrv \
+    -lapgrfx \
+    -lxqutils
 	
 SERVICE.FILE = service_conf.xml
 libFiles.sources = xqservice.dll
@@ -39,7 +41,7 @@
 libFiles.path = "!:\sys\bin"
 DEPLOYMENT += libFiles
 HEADERS += ./inc/btmsgviewer.h \
-		   ./inc/btmsgviewerutils.h
+		   ./inc/btmsgviewerutils.h 
 SOURCES += ./src/btmsgviewer.cpp \
     	   ./src/main.cpp \
     	   ./src/btmsgviewerutils.cpp
--- a/btobexprofiles/obexreceiveservices/btmsgviewer/inc/btmsgviewer.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexreceiveservices/btmsgviewer/inc/btmsgviewer.h	Fri Jul 23 15:57:13 2010 +0300
@@ -22,6 +22,7 @@
 #include <xqserviceprovider.h>
 #include <hbview.h>
 #include <xqappmgr.h>
+
 #include "btmsgviewerutils.h"
 
 
@@ -30,12 +31,19 @@
     Q_OBJECT
     
 public:
-    BTMsgViewer (QObject *parent = 0 );
-    ~BTMsgViewer ();    
+    BTMsgViewer (QObject* parent=0 );
+    ~BTMsgViewer ();
+    
 public slots:
-    int displaymsg(int messageId);
+    void displaymsg(int messageId);
+
 private:
     bool isError(int aError);
+    QString copyVCardToTemp(const QString& filepath);
+    void deleteVCardFromTemp(const QString& filepath);
+    
+private:
+    int mCurrentRequestIndex;
 };
 
 #endif // BTMSGVIEWER_H
--- a/btobexprofiles/obexreceiveservices/btmsgviewer/inc/btmsgviewerutils.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexreceiveservices/btmsgviewer/inc/btmsgviewerutils.h	Fri Jul 23 15:57:13 2010 +0300
@@ -27,12 +27,14 @@
     static CBtMsgViewerUtils* NewL();
     ~CBtMsgViewerUtils();
     HBufC* GetMessagePath(TInt aMessageId, TInt aError);
+    HBufC8* GetMimeType();
 
 private: // From MMsvSessionObserver
     void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
     
 private:
     void GetMessagePathL(TPtr aMsgPath, const TInt aMessageId);
+    void StoreMessageMimeTypeL(TPtr aMsgPath);
        
 private:
     CBtMsgViewerUtils();
@@ -40,6 +42,7 @@
     
 private:
     CMsvSession* iMsvSession;
+    HBufC8*      iMimeType;
     };
 
 #endif // BTMSGVIEWERUTILS_H_
--- a/btobexprofiles/obexreceiveservices/btmsgviewer/src/btmsgviewer.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexreceiveservices/btmsgviewer/src/btmsgviewer.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -19,23 +19,31 @@
 #include "btmsgviewer.h"
 #include "apmstd.h"
 #include <xqaiwrequest.h>
-#include <f32file.h>
-//#include <documenthandler.h>
+#include <xqconversions.h>
+#include <apgcli.h>
+#include <QFileInfo>
+#include <QDir>
+#include <QFile>
+#include <hbapplication.h>
+
+const QString KMimeTypeVCard("text/X-vCard");
 
 
 BTMsgViewer::BTMsgViewer(QObject* parent)
-: XQServiceProvider("com.nokia.services.btmsgdispservices.displaymsg",parent)
+: XQServiceProvider("com.nokia.services.btmsgdispservices.displaymsg", parent), mCurrentRequestIndex(0)
     {    
     publishAll();
+    connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
     }
 
 BTMsgViewer::~BTMsgViewer ()
     {
-    
+
     }
 
-int BTMsgViewer::displaymsg( int messageId )
-    {    
+void BTMsgViewer::displaymsg( int messageId )
+    { 
+    mCurrentRequestIndex = setCurrentRequestAsync(); 
     CBtMsgViewerUtils* btViewerUtils = 0;
     
     TRAPD(error, btViewerUtils = CBtMsgViewerUtils::NewL());  
@@ -44,7 +52,9 @@
         if(btViewerUtils)
             delete btViewerUtils;
         
-        return error;   
+        QVariant retVal(error); 
+        completeRequest(mCurrentRequestIndex, retVal);
+        return;
         }
         
     HBufC* fileName = 0;
@@ -55,19 +65,65 @@
             delete fileName;
         
         delete btViewerUtils;
-        return error;
+        
+        QVariant retVal(error); 
+        completeRequest(mCurrentRequestIndex, retVal);
+        return;
         }
     
-    QString attachmentFName = QString::fromUtf16(fileName->Ptr(),fileName->Length());    
-    
+    QString attachmentFName = XQConversions::s60DescToQString(fileName->Des());
+    QString mimeType = XQConversions::s60Desc8ToQString(btViewerUtils->GetMimeType()->Des());
     delete fileName;
     delete btViewerUtils;
+    
+    if(mimeType == KMimeTypeVCard)
+        {
+        int error = KErrGeneral;
+        
+        /*todo: copyVCardToTemp() has to be removed when phonebook updates it's capabilites to
+                access messages from private folder*/
+        QString newfilepath = copyVCardToTemp(attachmentFName);
+    
+        QString service("com.nokia.services.phonebookservices");
+        QString interface("Fetch");
+        QString operation("editCreateNew(QString)");
+        XQApplicationManager appManager;
+        XQAiwRequest* request = appManager.create(service, interface, operation, true); //embedded
+        if(request)
+        {
+            QList<QVariant> args;
+            args << newfilepath;
+            request->setArguments(args);
+            QVariant retValue;
+            bool res = request->send(retValue);
+            if  (!res) 
+                {
+                error = request->lastError();
+                }
+            else
+                {
+                error = retValue.toInt();
+                }
+            
+            delete request;
+        }
 
+        /*todo: copyVCardToTemp() has to be removed when phonebook updates it's capabilites to
+                access messages from private folder*/        
+        deleteVCardFromTemp(newfilepath);
+        
+        QVariant retVal(error); 
+        completeRequest(mCurrentRequestIndex, retVal);
+        return;
+        }
+    
     XQSharableFile sf;
     XQAiwRequest* request = 0;
 
     if (!sf.open(attachmentFName)) {
-        return KErrNotFound;
+    QVariant retVal(KErrGeneral); 
+    completeRequest(mCurrentRequestIndex, retVal);
+    return;
     }
 
     // Get handlers
@@ -79,12 +135,18 @@
 
         if (!request) {
             sf.close();
-            return KErrGeneral;
+            
+            QVariant retVal(KErrGeneral); 
+            completeRequest(mCurrentRequestIndex, retVal);
+            return;
         }
     }
     else {
         sf.close();
-        return KErrGeneral;
+        
+        QVariant retVal(KErrGeneral); 
+        completeRequest(mCurrentRequestIndex, retVal);
+        return;
     }
 
     request->setEmbedded(true);
@@ -95,23 +157,39 @@
     args << qVariantFromValue(sf);
     request->setArguments(args);
 
+    int err = KErrNone;
     bool res = request->send();
     if  (!res) 
         {
-        QString errMsg = request->lastErrorMessage();
+        err = request->lastError();
         }
 
     // Cleanup
     sf.close();
     delete request;
     
-    if(!res)
-        return request->lastError();
-    else
-        return KErrNone;
+    QVariant retVal(err); 
+    completeRequest(mCurrentRequestIndex, retVal);
+    return;
     }
 
 bool BTMsgViewer::isError(int aError)
     {
     return ((aError < KErrNone)?true:false);
     }
+
+QString BTMsgViewer::copyVCardToTemp(const QString& filepath)
+{
+    QDir tempDir;
+    QString tempFilePath(QDir::toNativeSeparators(tempDir.tempPath()));
+    tempFilePath.append(QDir::separator());
+    QFileInfo fInfo(filepath);
+    tempFilePath.append(fInfo.fileName());
+    QFile::copy(filepath, tempFilePath);
+    return tempFilePath;
+}
+
+void BTMsgViewer::deleteVCardFromTemp(const QString& filepath)
+{
+    QFile::remove(filepath);
+}
--- a/btobexprofiles/obexreceiveservices/btmsgviewer/src/btmsgviewerutils.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexreceiveservices/btmsgviewer/src/btmsgviewerutils.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -16,9 +16,12 @@
  */
 
 #include <mmsvattachmentmanager.h>
+#include <apgcli.h>
 #include "btmsgviewerutils.h"
 
+const TInt32 KUidMsgTypeBtTInt32 = 0x10009ED5;
 
+    
 CBtMsgViewerUtils* CBtMsgViewerUtils::NewL()
     {
     CBtMsgViewerUtils* me = new (ELeave) CBtMsgViewerUtils();
@@ -42,8 +45,9 @@
     {
     if ( iMsvSession )
         {
-		 delete iMsvSession;
+        delete iMsvSession;
         }
+    delete iMimeType;
     }
 
 HBufC* CBtMsgViewerUtils::GetMessagePath(TInt aMessageId, TInt aError)
@@ -62,28 +66,55 @@
 void CBtMsgViewerUtils::GetMessagePathL(TPtr aMsgPath, const TInt aMessageId)
     {
     CMsvEntry* messageEntry = iMsvSession->GetEntryL(aMessageId);
-    CleanupStack::PushL(messageEntry);
-    
-    CMsvEntry* attachmentEntry = iMsvSession->GetEntryL((*messageEntry)[0].Id());
-    CleanupStack::PushL(attachmentEntry);
-    
-    CMsvStore* store = attachmentEntry->EditStoreL();
-    CleanupStack::PushL(store); 
+    CleanupStack::PushL(messageEntry); //1st push
     
-    //get file handle for the attachment & the complete path of the file
-    RFile attachmentFile;
-    attachmentFile = store->AttachmentManagerL().GetAttachmentFileL(0);
-    attachmentFile.FullName(aMsgPath);
-    attachmentFile.Close();
-    
-    //mark attachment as Read
-    TMsvEntry attachEntry = attachmentEntry->Entry();
-    attachEntry.SetUnread(EFalse);
-    attachmentEntry->ChangeL(attachEntry);
-    
-    CleanupStack::PopAndDestroy(store);
-    CleanupStack::PopAndDestroy(attachmentEntry);
-    CleanupStack::PopAndDestroy(messageEntry);
+    TMsvEntry entry = messageEntry->Entry();
+    if(entry.MtmData1() == KUidMsgTypeBtTInt32)
+        {
+        CMsvStore* store = messageEntry->ReadStoreL();
+        CleanupStack::PushL(store); //2nd push
+
+        //get file handle for the attachment & the complete path of the file
+        RFile attachmentFile;
+        attachmentFile = store->AttachmentManagerL().GetAttachmentFileL(0);
+        CleanupClosePushL(attachmentFile); //3rd push
+        User::LeaveIfError(attachmentFile.FullName(aMsgPath));
+        CleanupStack::PopAndDestroy(&attachmentFile);
+        StoreMessageMimeTypeL(aMsgPath);
+        
+        //mark attachment as Read
+        TMsvEntry attachEntry = messageEntry->Entry();
+        attachEntry.SetUnread(EFalse);
+        messageEntry->ChangeL(attachEntry);
+        
+        CleanupStack::PopAndDestroy(store);
+        CleanupStack::PopAndDestroy(messageEntry);
+        }
+    else
+        {
+        CMsvEntry* attachmentEntry = iMsvSession->GetEntryL((*messageEntry)[0].Id());
+        CleanupStack::PushL(attachmentEntry); //2nd push
+            
+        CMsvStore* store = attachmentEntry->ReadStoreL();
+        CleanupStack::PushL(store);  //3rd push
+        
+        //get file handle for the attachment & the complete path of the file
+        RFile attachmentFile;
+        attachmentFile = store->AttachmentManagerL().GetAttachmentFileL(0);
+        CleanupClosePushL(attachmentFile);
+        User::LeaveIfError(attachmentFile.FullName(aMsgPath));
+        CleanupStack::PopAndDestroy(&attachmentFile);
+        StoreMessageMimeTypeL(aMsgPath);
+        
+        //mark attachment as Read
+        TMsvEntry attachEntry = attachmentEntry->Entry();
+        attachEntry.SetUnread(EFalse);
+        attachmentEntry->ChangeL(attachEntry);
+        
+        CleanupStack::PopAndDestroy(store);
+        CleanupStack::PopAndDestroy(attachmentEntry);
+        CleanupStack::PopAndDestroy(messageEntry);
+        }
     }
 
 void CBtMsgViewerUtils::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, 
@@ -95,5 +126,41 @@
     (void) aArg3;
     }
 
+void CBtMsgViewerUtils::StoreMessageMimeTypeL(TPtr aMsgPath)
+    {
+    RFs rfs;
+    RFile file;
+    
+    User::LeaveIfError(rfs.Connect());
+    
+    User::LeaveIfError(rfs.ShareProtected());
+    
+    User::LeaveIfError(file.Open(rfs, aMsgPath, EFileShareReadersOrWriters | EFileRead));
+    
+    TDataRecognitionResult dataType;
+    RApaLsSession apaSession;
+    
+    if(apaSession.Connect() == KErrNone)
+        {
+        if (apaSession.RecognizeData(file, dataType) == KErrNone)
+            {
+            if(iMimeType)
+                {
+                delete iMimeType;
+                iMimeType = NULL;
+                }
+        
+            iMimeType = dataType.iDataType.Des8().AllocL();
+            
+            rfs.Close();
+            apaSession.Close();
+            }
+        }
 
+    rfs.Close();
+    }
 
+HBufC8* CBtMsgViewerUtils::GetMimeType()
+    {
+    return iMimeType;
+    }
--- a/btobexprofiles/obexreceiveservices/btmsgviewer/src/main.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexreceiveservices/btmsgviewer/src/main.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -26,6 +26,7 @@
     HbApplication a( argc, argv );
     
     BTMsgViewer* btmsgviewer = new BTMsgViewer();
+    
     int retVal = a.exec();
     delete btmsgviewer;
     return retVal;
--- a/btobexprofiles/obexreceiveservices/opp/inc/oppcontroller.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexreceiveservices/opp/inc/oppcontroller.h	Fri Jul 23 15:57:13 2010 +0300
@@ -157,6 +157,9 @@
     CHbDeviceDialogSymbian*     iProgressDialog;
     TBool                       iDialogActive;
     TInt                        iFileCount;
+    TBool                       iReceivingFailed;
+    CHbDeviceDialogSymbian*     iRecvDoneDialog;
+    TBool                       iShowRecvCompleteDialog;
     };
 
 #endif      // OPPCONTROLLER_H
--- a/btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -93,6 +93,7 @@
     iFs.Close();
     delete iDialog;
     delete iProgressDialog;
+    delete iRecvDoneDialog;
     }
 
 // ---------------------------------------------------------
@@ -119,6 +120,8 @@
 void COPPController::HandleError(TBool aAbort)
     {
     TRACE_ERROR((_L( "[oppreceiveservice] COPPController:HandleError" )));
+    iReceivingFailed = ETrue;
+    iShowRecvCompleteDialog = EFalse;
     if( iObexTransferState == ETransferPut || iObexTransferState == ETransferPutDiskError )
         {        
         if(iObexObject)
@@ -153,6 +156,7 @@
 void COPPController::TransportUpIndication()
 	{
 	TRACE_FUNC    
+	iReceivingFailed = EFalse;
     iObexTransferState = ETransferIdle;	
  
 	if ( !iFs.Handle() )
@@ -218,6 +222,61 @@
 void COPPController::TransportDownIndication()
     {
     TRACE_FUNC
+    if(!iReceivingFailed && iShowRecvCompleteDialog)
+        {
+        //Launch recevice completed dialog.
+        iRecvDoneDialog = CHbDeviceDialogSymbian::NewL();
+        iRecvDoneDialog->SetObserver(this);
+    
+        CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL();
+        CleanupStack::PushL(variantMap);
+        
+        TInt dialogIdx = TBluetoothDialogParams::EReceiveDone;
+        CHbSymbianVariant* dialogType = CHbSymbianVariant::NewL( (TAny*) &(dialogIdx), 
+                                                            CHbSymbianVariant::EInt );
+        CleanupStack::PushL(dialogType);
+        TBuf16<6> dialogTypeKey;
+        dialogTypeKey.Num(TBluetoothDialogParams::EDialogType);
+        User::LeaveIfError(variantMap->Add(dialogTypeKey, dialogType));
+        CleanupStack::Pop(dialogType);
+        
+        CHbSymbianVariant* deviceName = CHbSymbianVariant::NewL( (TAny*) (&iRemoteDeviceName), 
+                                                            CHbSymbianVariant::EDes );
+        CleanupStack::PushL(deviceName);
+        TBuf16<6> deviceNameKey;
+        deviceNameKey.Num(TBluetoothDeviceDialog::EDeviceName);
+        User::LeaveIfError(variantMap->Add(deviceNameKey, deviceName));
+        CleanupStack::Pop(deviceName);
+        
+        CHbSymbianVariant* fileName = CHbSymbianVariant::NewL( (TAny*) (&iReceivingFileName), 
+                                                            CHbSymbianVariant::EDes );
+        CleanupStack::PushL(fileName);
+        TBuf16<6> fileNameKey;
+        fileNameKey.Num(TBluetoothDeviceDialog::EReceivingFileName);
+        User::LeaveIfError(variantMap->Add(fileNameKey, fileName));
+        CleanupStack::Pop(fileName);
+        
+        CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL( (TAny*) &iTotalSizeByte, 
+                                                            CHbSymbianVariant::EInt );
+        CleanupStack::PushL(fileSz);
+        TBuf16<6> fileSzKey;
+        fileSzKey.Num(TBluetoothDeviceDialog::EReceivingFileSize);
+        User::LeaveIfError(variantMap->Add(fileSzKey, fileSz));
+        CleanupStack::Pop(fileSz);
+        
+        CHbSymbianVariant* fileCnt = CHbSymbianVariant::NewL( (TAny*) &iFileCount, 
+                                                            CHbSymbianVariant::EInt );
+        CleanupStack::PushL(fileCnt);
+        TBuf16<6> fileCntKey;
+        fileCntKey.Num(TBluetoothDeviceDialog::EReceivedFileCount);
+        User::LeaveIfError(variantMap->Add(fileCntKey, fileCnt));
+        CleanupStack::Pop(fileCnt);
+        
+        iRecvDoneDialog->Show( KBTDevDialogId(), *variantMap, this );
+        CleanupStack::PopAndDestroy(variantMap);
+        iShowRecvCompleteDialog = EFalse;
+        }
+    
     // Remove receiving buffer and files used during file receiving.
     //
     delete iObexObject;
@@ -347,6 +406,7 @@
         iObexTransferState = ETransferIdle;
         CloseReceivingIndicator();
         iFileCount++;
+        iShowRecvCompleteDialog = ETrue;
         }
     TRACE_FUNC_EXIT
     return retVal;
@@ -969,15 +1029,28 @@
      if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0)
          {
          TInt val = *(static_cast<TInt*>(aData.Get(_L("actionResult"))->Data()));
-         if(!val)
+         switch(val)
              {
-             //Cancel has been clicked
-             CancelTransfer();
-             }
-         else
-             {
-             //Hide has been clicked
-             CloseReceivingIndicator(EFalse);
+             case TBluetoothDialogParams::ECancelReceive:
+                 {
+                 //User choose to cancel receiving.
+                 CancelTransfer();
+                 }break;
+                 
+             case TBluetoothDialogParams::EHide:
+                 {
+                 //Use choose to hide the progress dialog.
+                 CloseReceivingIndicator(EFalse);
+                 }break;
+                 
+             case TBluetoothDialogParams::EShow:
+             case TBluetoothDialogParams::ECancelShow:
+                 {
+                 //In case of Show, the device dialog will handle the opening of conversation view.
+                 iRecvDoneDialog->Cancel();
+                 delete iRecvDoneDialog;
+                 iRecvDoneDialog = NULL;
+                 }break;
              }
          }
      }
--- a/btobexprofiles/obexserviceman/rom/obex.iby	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexserviceman/rom/obex.iby	Fri Jul 23 15:57:13 2010 +0300
@@ -19,6 +19,8 @@
 #ifndef __OBEX_IBY__
 #define __OBEX_IBY__
 
+#include <obexprotocol.iby>
+
 #ifdef SYMBIAN_EXCLUDE_OBEX
 REM Messaging OBEX MTM is not included in this ROM, because it depends on excluded OBEX
 #else
--- a/btobexprofiles/obexserviceman/utils/inc/obexutilsentryhandler.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexserviceman/utils/inc/obexutilsentryhandler.h	Fri Jul 23 15:57:13 2010 +0300
@@ -54,19 +54,7 @@
      */
     TInt AddEntryAttachment(const TDesC &aFilePath, CMsvAttachment* anAttachInfo, CMsvStore* aStore );
     
-    /**
-     * Update an entry attachment
-     * @since S60 v5.0
-     * @param aFilePath the absolute file path of the linked attachment file.
-     * @param anAttachInfo the attachment info associated with the file.
-     * @param aStore An interface ove the message store that is associated with a message entry.
-     * @return error code
-     */
-    TInt UpdateEntryAttachment(TFileName& aFileName,
-                              CMsvAttachment* anOldAttachInfo,
-                              CMsvAttachment* aNewAttachInfo,
-                              CMsvStore* aStore );
-    
+   
     // from base class CActive
          
     /**
@@ -97,23 +85,6 @@
      */ 
     void ConstructL();
 
-    /**
-     * Add link attachment 
-     * 
-     * @since S60 v5.0
-     */
-    void DoAddEntryAttachmentL(const TDesC &aFilePath, CMsvAttachment* anAttachInfo, CMsvStore* aStore);
-    
-   
-    /**
-     * Update link attachment 
-     * 
-     * @since S60 v5.0
-     */
-    void DoUpdateEntryAttachmentL(TFileName& aFileName,
-                                 CMsvAttachment* anOldAttachInfo,
-                                 CMsvAttachment* aNewAttachInfo,
-                                 CMsvStore* aStore);
     
 private: // member data
 
--- a/btobexprofiles/obexserviceman/utils/src/obexutilsentryhandler.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexserviceman/utils/src/obexutilsentryhandler.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -81,7 +81,8 @@
     
     iStatus = KRequestPending;
   
-    TRAPD(error, DoAddEntryAttachmentL(aFilePath, anAttachInfo, aStore));
+    TRAPD(error, aStore->AttachmentManagerL().AddLinkedAttachmentL(aFilePath,anAttachInfo, iStatus););
+    
     if (error != KErrNone )
         {        
         //Complete request
@@ -98,76 +99,6 @@
 
 
 // ---------------------------------------------------------------------------
-// DoAddLinkAttachmentL()
-// ---------------------------------------------------------------------------
-//
-void CObexutilsEntryhandler::DoAddEntryAttachmentL(
-    const TDesC &aFilePath, 
-    CMsvAttachment* anAttachInfo, 
-    CMsvStore* aStore)
-    {
-    FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoAddEntryAttachmentL()"));   
-        
-    aStore->AttachmentManagerL().AddLinkedAttachmentL(aFilePath,anAttachInfo, iStatus);
-    
-    //Complete request
-    TRequestStatus* status = &iStatus;
-    User::RequestComplete(status, KErrNone);
-        
-    FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoAddEntryAttachmentL() completed"));  
-    }
-
-// ---------------------------------------------------------------------------
-// UpdateLinkAttachment()
-// ---------------------------------------------------------------------------
-//
-TInt CObexutilsEntryhandler::UpdateEntryAttachment(
-    TFileName& aFileName,
-    CMsvAttachment* anOldAttachInfo,
-    CMsvAttachment* aNewAttachInfo,
-    CMsvStore* aStore)
-    {
-    FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::UpdateEntryAttachment()"));       
-    
-    iStatus = KRequestPending;
-  
-    TRAPD(error, DoUpdateEntryAttachmentL(aFileName,anOldAttachInfo, aNewAttachInfo, aStore));
-    if (error != KErrNone )
-        {        
-        //Complete request
-        TRequestStatus* status = &iStatus;
-        User::RequestComplete(status, error);
-        }
-       
-    SetActive();
-    iSyncWaiter.Start();
-          
-    FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::UpdateEntryAttachment() Done"));
-    return iStatus.Int();
-    }
-
-// ---------------------------------------------------------------------------
-// DoUpdateEntryAttachmentL()
-// ---------------------------------------------------------------------------
-//
-void CObexutilsEntryhandler::DoUpdateEntryAttachmentL(
-    TFileName& aFileName,
-    CMsvAttachment* anOldAttachInfo,
-    CMsvAttachment* aNewAttachInfo,
-    CMsvStore* aStore)
-    {
-    FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoUpdateEntryAttachmentL()"));   
-    aStore->AttachmentManagerL().RemoveAttachmentL(anOldAttachInfo->Id(), iStatus);
-    aStore->AttachmentManagerL().AddLinkedAttachmentL(aFileName,aNewAttachInfo, iStatus);
-   
-    //Complete request
-    TRequestStatus* status = &iStatus;
-    User::RequestComplete(status, KErrNone);
-        
-    FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoUpdateEntryAttachmentL() completed"));  
-    }
-
-// ---------------------------------------------------------------------------
 // From class CActive.
 // RunL()
 // ---------------------------------------------------------------------------
--- a/btobexprofiles/obexserviceman/utils/src/obexutilsmessagehandler.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/btobexprofiles/obexserviceman/utils/src/obexutilsmessagehandler.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -342,11 +342,13 @@
     TPtrC mimeType16(buf16->Des());
     CleanupStack::PopAndDestroy();   //   buf16
     
-    CUpdateMusicCollection* updateMusicCollection = CUpdateMusicCollection::NewL() ;
+    CUpdateMusicCollection* updateMusicCollection = CUpdateMusicCollection::NewL();
+    CleanupStack::PushL(updateMusicCollection);    
     if (updateMusicCollection->isSupported(mimeType16))
         {
         updateMusicCollection->addToCollectionL(aFileName);
         }
+    CleanupStack::PopAndDestroy();  // updateMusicCollection
     
     aAttachInfo->SetMimeTypeL( mimeType );
     
--- a/cbsatplugin/atmisccmdplugin/data/2002C3BA_TDSCDMA.rss	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/data/2002C3BA_TDSCDMA.rss	Fri Jul 23 15:57:13 2010 +0300
@@ -31,7 +31,7 @@
 	                implementation_uid = 0x2002DC6B;// KUidATMiscCmdEcomImpl;
 	                version_no = 1;
 	                display_name = "Miscellaneous AT commands Implementation";
-	                default_data = "MAT+CLCK|MAT+CPWD|MAT+CUSD|MAT+CPIN|MAT+CNUM|MAT+CFUN|MAT+CBC|OAT+CMEE|MAT^HVER|MAT+CGSN|MAT+CGMR|MAT+CGMI|MAT+CMGD|OAT+CMGF";
+	                default_data = "MAT+CLCK|MAT+CPWD|MAT+CUSD|MAT+CPIN|MAT+CNUM|MAT+CFUN|MAT+CBC|OAT+CMEE|MAT^HVER|MAT+CGSN|MAT+CGMR|MAT+CGMI|MAT+CMGD|OAT+CMGF|MAT+GMI|MAT+GMR|MAT+GSN|MAT+CGMM|MAT+GMM|MATI|MATI0|MATI1|MATI2|MATI3|MATI4|MAT^SCPBR|MAT^SCPBW";
 	                opaque_data = "";
 	                }
 				};
--- a/cbsatplugin/atmisccmdplugin/group/atmisccmdplugin.mmp	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/group/atmisccmdplugin.mmp	Fri Jul 23 15:57:13 2010 +0300
@@ -56,6 +56,9 @@
 SOURCE          cgmicommandhandler.cpp
 SOURCE			cmgdcommandhandler.cpp
 SOURCE			telephonywrapper.cpp
+SOURCE			cgmmcommandhandler.cpp 
+SOURCE			scpbrcommandhandler.cpp
+SOURCE			scpbwcommandhandler.cpp
 #endif
 
 USERINCLUDE     ../inc
@@ -86,6 +89,10 @@
 LIBRARY			etel3rdparty.lib
 LIBRARY			sysutil.lib 
 
+#ifdef PROTOCOL_TDSCDMA
+LIBRARY			customapi.lib
+#endif
+
 DEBUGLIBRARY	flogger.lib
 
 // End of File
--- a/cbsatplugin/atmisccmdplugin/inc/atcommandparser.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/atcommandparser.h	Fri Jul 23 15:57:13 2010 +0300
@@ -56,11 +56,24 @@
 		ECmdAtCmee,
         ECmdAtHver,
         ECmdAtCgsn,
+        ECmdAtGsn,
         ECmdAtCgmr,
+        ECmdAtGmr,
         ECmdAtCgmi,
+        ECmdAtGmi,
         ECmdAtCmgw,
-		ECmdAtCmgd,
-		ECmdAtCmgf
+        ECmdAtCmgd,
+        ECmdAtCmgf,
+        ECmdAtCgmm,
+        ECmdAtGmm,
+        ECmdAtI,
+        ECmdAtI0,
+        ECmdAtI1,
+        ECmdAtI2,
+        ECmdAtI3,
+        ECmdAtI4,
+		ECmdAtScpbr,
+		ECmdAtScpbw
         };
 public:
     TAtCommandParser();
--- a/cbsatplugin/atmisccmdplugin/inc/atmisccmdplugin.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/atmisccmdplugin.h	Fri Jul 23 15:57:13 2010 +0300
@@ -195,6 +195,9 @@
     CATCmdSyncBase* iCGMIHandler;
     CATCmdAsyncBase* iCMGWHandler;
     CATCmdAsyncBase* iCMGDHandler;
+    CATCmdSyncBase* iCGMMHandler;
+	CATCmdAsyncBase* iSCPBRHandler;
+    CATCmdAsyncBase* iSCPBWHandler;
  
     /**
      * Buffer for handle command's command
--- a/cbsatplugin/atmisccmdplugin/inc/atmisccmdpluginconsts.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/atmisccmdpluginconsts.h	Fri Jul 23 15:57:13 2010 +0300
@@ -26,12 +26,15 @@
 _LIT8(KAtCBC, "+CBC: ");
 _LIT8(KAtCUSD, "+CUSD: ");
 _LIT8(KAtCMGW, "+CMGW: ");
-
+_LIT8(KSCPBR, "\r\n^SCPBR: ");
 _LIT8(KCLCKSupportedCmdsList, "\r\n+CLCK: (\"PS\",\"SC\",\"AO\",\"OI\",\"OX\",\"AI\",\"IR\",\"AB\",\"AG\",\"AC\")\r\n\r\nOK\r\n");
 _LIT8(KCFUNSupportedCmdsList, "\r\n+CFUN: (0,1,4),(0,1)\r\n\r\nOK\r\n");
 _LIT8(KCBCSupportedCmdsList, "\r\n+CBC: (0,1,2,3),(1...100)\r\n\r\nOK\r\n");
 _LIT8(KCUSDSupportedCmdsList, "+CUSD: (0,1)\r\n\r\nOK\r\n");
 _LIT8(KCMGDSupportedCmdsList, "\r\n+CMGD: (%S), (0,1,2,3,4)\r\n");
+_LIT8(KSCPBRSupportedEntriesIndexList,"\r\n^SCPBR:(1-%d),%d,%d,%d \r\n"); 
+_LIT8(KSCPBRReplyOneEntry,"%d,\"%S\",,\"%S\",,\"%S\",,\"%S\",,\"%S\",,\"%S\"");
+_LIT8(KSCPBWSupportedCmdsList, "\r\n^SCPBW: (1-%d),%d,(),%d,%d\r\n");
 
 _LIT8(KATCLCKPS, "PS");
 _LIT8(KATCLCKSC, "SC");
@@ -51,5 +54,12 @@
 // Max buffer length for an MD5 digest - originally defined in SCPServerInterface.h
 const TInt KSCPMaxHashLength( 32 );
 
+const TInt KSCPBRDefaultSizeOfOneEntry( 320 );
+const TInt KSCPBRMaxNameLength( 64 );
+const TInt KSCPBRMaxNumberLength( 32 );
+const TInt KSCPBRMaxEmailLength( 64 );
+const TInt KSCPBRMaxNumberCount( 4 );
+const TInt KSCPBRMaxEntryCount( 1000 );
 
+const TInt KBufBlockSize (1024);
 #endif // ATMISCCMDPLUGINCONSTS_H
--- a/cbsatplugin/atmisccmdplugin/inc/cgmicommandhandler.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/cgmicommandhandler.h	Fri Jul 23 15:57:13 2010 +0300
@@ -21,7 +21,7 @@
 
 #include "atcmdsyncbase.h"
 
-#include <Etel3rdParty.h>
+#include <etel3rdparty.h>
 
 /**
  *  AT+CGMI command handler implementation class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/inc/cgmmcommandhandler.h	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * 
+ * Description :
+ * 
+ * CGMMCommandHandler class declaration for AT+CGMM command
+ * 
+ */
+
+#ifndef CGMMCOMMANDHANDLER_H
+#define CGMMCOMMANDHANDLER_H
+
+#include "atcmdsyncbase.h"
+
+#include <etel3rdparty.h>
+
+/**
+ *  AT+CGMM command handler implementation class
+ */
+NONSHARABLE_CLASS( CCGMMCommandHandler ) : public CATCmdSyncBase
+    {
+public:
+    static CCGMMCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+    ~CCGMMCommandHandler();
+    
+public:
+    void SetManufacturer(const TDesC8& aManufacturer);
+    void SetModelID(const TDesC8& aModelID);
+    void SetTelephonyError(TInt aTelError); 
+
+private: // methods from CATCmdSyncBase    
+    virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+    
+private:
+    CCGMMCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+    void ConstructL();
+    
+private:
+    TInt    iTelError;
+    TBuf8<CTelephony::KPhoneManufacturerIdSize> iManufacturer;
+    TBuf8<CTelephony::KPhoneModelIdSize> iModel;
+    
+    RBuf8 iReply;
+    };
+
+#endif /* CGMMCOMMANDHANDLER_H */
--- a/cbsatplugin/atmisccmdplugin/inc/cgsncommandhandler.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/cgsncommandhandler.h	Fri Jul 23 15:57:13 2010 +0300
@@ -21,7 +21,7 @@
 
 #include "atcmdsyncbase.h"
 
-#include <Etel3rdParty.h>
+#include <etel3rdparty.h>
 
 /**
  *  AT+CGSN command handler implementation class
--- a/cbsatplugin/atmisccmdplugin/inc/hvercommandhandler.h	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/hvercommandhandler.h	Fri Jul 23 15:57:13 2010 +0300
@@ -22,7 +22,7 @@
 #include "atcmdsyncbase.h"
 #include "debug.h"
 
-#include <Etel3rdParty.h>
+#include <etel3rdparty.h>
 
 /**
  *  AT^HVER command handler implementation class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/inc/scpbrcommandhandler.h	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * 
+ * Description :
+ * 
+ * CSCPBRCommandHandler class declaration for AT^SCPBR command
+ * 
+ */
+
+#ifndef SCPBRCOMMANDHANDLER_H_
+#define SCPBRCOMMANDHANDLER_H_
+
+#include <e32base.h>
+#include <etelmm.h>
+#include <e32cmn.h>
+#include <rmmcustomapi.h>
+
+#include "atcmdasyncbase.h"
+#include "atmisccmdpluginconsts.h"
+
+class CPhoneBookBuffer;
+
+/**
+ *  AT^SCPBR command handler implementation class
+ */
+NONSHARABLE_CLASS( CSCPBRCommandHandler ) : public CATCmdAsyncBase
+	{
+private:
+
+	/**
+	 * SCPBR States
+	 */
+	enum TSCPBRState
+	    {
+        ESCPBRStateIdle,                  // Idle
+        ESCPBRStateRead,                  // Read
+        ESCPBRStateGetPhoneBookInfo,      // Get phone book info.
+        ESCPBRStateGet3GPBInfo,           // Get 3G phone book info.
+        ESCPBRStateNotSupported           // phone book store not supported
+	    };
+private:
+	/**
+	 *  The data structure of phone book entry.
+	 *  Inner class used by CSCPBRCommandHandler only.
+	 */
+	class TPhoneBookEntry
+	    {
+    public:
+	    TPhoneBookEntry(): iIndex(-1)
+            {
+            }
+	    
+	    void Externalize( TDes8& aDes ) const;
+
+        TInt iIndex;
+
+        TBuf8<KSCPBRMaxNumberLength> iNumber1;
+        TBuf8<KSCPBRMaxNumberLength> iNumber2;
+        TBuf8<KSCPBRMaxNumberLength> iNumber3;
+        TBuf8<KSCPBRMaxNumberLength> iNumber4;
+
+        TBuf8<KSCPBRMaxNameLength> iName;
+
+        TBuf8<KSCPBRMaxEmailLength> iEmail;
+	    };
+	
+public:
+	static CSCPBRCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone );
+	
+	virtual ~CSCPBRCommandHandler();
+
+private: // from CATCmdAsyncBase
+	virtual void HandleCommand(const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded);
+	
+private: // from CActive
+	virtual void RunL();
+	virtual void DoCancel();
+	virtual TInt RunError(TInt aError);
+	
+private:	
+	CSCPBRCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone );
+	void ConstructL();
+
+	void ExtractEntriesL();
+	void CopyToPhonebookEntryField(TDes8& aDest, const TDesC16& aSrc);
+	void FormatReplyL();
+	TInt ParseParameters();
+	void AppendEntryL(const TPhoneBookEntry& aEntry);
+	
+private:
+	/**
+	 * The first index to be read from phonebook store.
+	 */
+    TInt iIndex1;
+
+	/**
+	 * The last index to be read from phonebook store.
+	 */
+    TInt iIndex2;
+
+	/**
+	 * The reply
+	 */
+    RBuf8 iReply;
+
+	/**
+	 * The phone book store. used to get entries information and entries.
+	 */
+    RMobilePhoneBookStore iPhoneBookStore;
+    
+	/**
+	 * used to save the entries information.
+	 */
+    RArray<TPhoneBookEntry> iEntries;
+
+	/**
+	 * Used to parse the content get from PhoneBookStore.
+	 */
+    CPhoneBookBuffer* iPhoneBookBuffer;
+    
+	/**
+	 * The buffer to get phonebookstore entries content.
+	 */
+    RBuf8 iContactsBuf; 
+    
+	/**
+	 * Current state
+	 */
+    TSCPBRState iState;
+    
+	/**
+	 * The PhonebookInfo, used to get phone book entries information.
+	 */
+    RMobilePhoneBookStore::TMobilePhoneBookInfoV1 iPhoneBookInfo;
+    
+    /**
+     * Total entries supported by phonebook store.
+     */
+    TInt iTotalEntries;
+	/**
+	 * The max number length supported
+	 */
+    TInt iNLength;
+
+	/**
+	 * The max email length supported.
+	 */
+    TInt iMLength;
+
+	/**
+	 * The max text length supported.
+	 */
+    TInt iTLength;
+    
+	/**
+	 * Used to get 3GPBInfo.
+	 */ 
+    RMmCustomAPI iCustomApi;
+    
+	/**
+	 * Used to get 3GPBInfo.
+	 */
+    RMmCustomAPI::T3GPBInfo i3GPBInfo;
+
+    };
+
+#endif /* SCPBRCOMMANDHANDLER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/inc/scpbwcommandhandler.h	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * 
+ * Description :
+ * 
+ * SCPBWCommandHandler class declaration for AT^SCPBW command
+ * 
+ */
+
+#ifndef SCPBWCOMMANDHANDLER_H
+#define SCPBWCOMMANDHANDLER_H
+
+#include "atcmdasyncbase.h"
+
+#include <etelmm.h>
+#include <rmmcustomapi.h>
+
+class CPhoneBookBuffer;
+
+/**
+ *  AT^SCPBW command handler implementation class
+ */
+NONSHARABLE_CLASS( CSCPBWCommandHandler ) : public CATCmdAsyncBase
+    {
+private:
+    enum TSCPBWState
+        {
+        ESCPBWStateIdle,
+        ESCPBWStateGetPhonebookInfo,
+        ESCPBWStateGet3GPBInfo,
+        ESCPBWStateWrite,
+        ESCPBWStateDelete,
+        ESCPBWStateSimStoreNotSupported 
+        };
+    
+public:
+    static CSCPBWCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+    ~CSCPBWCommandHandler();
+        
+private: // methods from CActive
+    virtual void RunL();
+    virtual void DoCancel();
+
+private: // methods from CATCmdAsyncBase    
+    virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+    
+private:
+    CSCPBWCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
+    void ConstructL();
+
+    TInt ParseParameters( TBool& aIsDeleteRequest );
+    TInt CreateContactEntry();
+    void ResetParameters();    
+    void SetBuffer(TDes& aDest, const TDesC8& aSource);
+    
+private:
+
+    RMobilePhoneBookStore   iPhoneBookStore;
+    CPhoneBookBuffer*       iPhoneBookBuffer;
+    RMobilePhoneBookStore::TMobilePhoneBookInfoV1 iPhoneBookStoreInfo;
+    RMmCustomAPI    iMmCustomAPI;
+    RMmCustomAPI::T3GPBInfo i3GPBInfo;
+    
+    TInt    iIndex;
+    RBuf    iNum1;
+    TInt    iType1;
+    RBuf    iNum2;
+    TInt    iType2;
+    RBuf    iNum3;
+    TInt    iType3;
+    RBuf    iNum4;
+    TInt    iType4;
+    RBuf    iText;
+    TInt    iCoding;
+    RBuf    iEmail;
+    
+    TInt    iNumLength;
+    TInt    iTextLength;
+    TInt    iEmailLength;
+    TInt    iMaxEntries;
+
+    RBuf8   iPbData;
+    
+    TSCPBWState iState;
+    
+    RBuf8 iReply;
+    
+    };
+
+#endif /* SCPBWCOMMANDHANDLER_H */
--- a/cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -67,6 +67,19 @@
     _LIT8(KAtCmgw, "AT+CMGW");
 	_LIT8(KAtCmgd, "AT+CMGD");
 	_LIT8(KAtCmgf, "AT+CMGF");
+	_LIT8(KAtiBase, "ATI");
+	_LIT8(KAti0, "ATI0");
+	_LIT8(KAti1, "ATI1");
+	_LIT8(KAti2, "ATI2");
+	_LIT8(KAti3, "ATI3");
+	_LIT8(KAti4, "ATI4");
+	_LIT8(KAtGmr, "AT+GMR");
+	_LIT8(KAtGmi, "AT+GMI");
+	_LIT8(KAtGsn, "AT+GSN");
+	_LIT8(KAtCgmm, "AT+CGMM");
+	_LIT8(KAtGmm, "AT+GMM");
+	_LIT8(KAtScpbr, "AT^SCPBR");
+	_LIT8(KAtScpbw, "AT^SCPBW");
 #endif
     
     Trace(KDebugPrintS, "token: ", &token);
@@ -99,7 +112,7 @@
         {
         iCmdType = ECmdAtCnum;
         }
-    else if(!token.Compare(KAtCmee))
+    else if(!token.CompareF(KAtCmee))
         {
         iCmdType = ECmdAtCmee;
 		}
@@ -112,14 +125,26 @@
         {
         iCmdType = ECmdAtCgsn;
         }
+    else if(!token.CompareF(KAtGsn))
+        {
+        iCmdType = ECmdAtGsn;
+        }
     else if(!token.CompareF(KAtCgmr))
         {
         iCmdType = ECmdAtCgmr;
         }
+    else if(!token.CompareF(KAtGmr))
+        {
+        iCmdType = ECmdAtGmr;
+        }
     else if(!token.CompareF(KAtCgmi))
         {
         iCmdType = ECmdAtCgmi;
-        }       
+        }    
+    else if(!token.CompareF(KAtGmi))
+        {
+        iCmdType = ECmdAtGmi;
+        } 
     else if(!token.CompareF(KAtCmgw))
         {
         iCmdType = ECmdAtCmgw;
@@ -132,6 +157,46 @@
         {
         iCmdType = ECmdAtCmgf;
         }
+    else if(!token.CompareF(KAtCgmm))
+        {
+        iCmdType = ECmdAtCgmm;
+        }
+    else if(!token.CompareF(KAtGmm))
+        {
+        iCmdType = ECmdAtGmm;
+        }
+    else if(!token.CompareF(KAtiBase))
+        {
+        iCmdType = ECmdAtI;
+        }
+    else if(!token.CompareF(KAti0))
+        {
+        iCmdType = ECmdAtI0;
+        }
+    else if(!token.CompareF(KAti1))
+        {
+        iCmdType = ECmdAtI1;
+        }
+    else if(!token.CompareF(KAti2))
+        {
+        iCmdType = ECmdAtI2;
+        }
+    else if(!token.CompareF(KAti3))
+        {
+        iCmdType = ECmdAtI3;
+        }
+    else if(!token.CompareF(KAti4))
+        {
+        iCmdType = ECmdAtI4;
+        }
+	else if(!token.CompareF(KAtScpbr))
+        {
+        iCmdType = ECmdAtScpbr;
+        } 
+    else if(!token.CompareF(KAtScpbw))
+        {
+        iCmdType = ECmdAtScpbw;
+        }
 #endif    
     else
         {
--- a/cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -32,6 +32,9 @@
 #include "cmgwcommandhandler.h"
 #include "cmgdcommandhandler.h"
 #include "telephonywrapper.h"
+#include "cgmmcommandhandler.h"
+#include "scpbrcommandhandler.h"
+#include "scpbwcommandhandler.h"
 #endif
 
 
@@ -40,6 +43,8 @@
 #include "debug.h"
 
 #include <exterror.h>           // Additional RMobilePhone error code
+#include <etelmmerr.h>          // ETelMM error code
+#include <gsmerror.h>           // GSM error code
 
 // +CME error code
 _LIT8(KCMEMemoryFailure, "+CME ERROR: 23\r\n"); // Memory failure.\r\n
@@ -48,6 +53,15 @@
 _LIT8(KCMENotAllowed, "+CME ERROR: 3\r\n"); // Operation not allowed.\r\n
 _LIT8(KCMEPhoneError, "+CME ERROR: 0\r\n"); // Phone failure.\r\n
 _LIT8(KCMEPhoneUnknown, "+CME ERROR: 100\r\n"); // unknown error
+_LIT8(KCMESimNotInserted, "+CME ERROR: 10\r\n"); // SIM not inserted 
+_LIT8(KCMEMemoryFull, "+CME ERROR: 20\r\n"); // Memory full
+_LIT8(KCMEInvalidIndex, "+CME ERROR: 21\r\n"); // Invalid index 
+_LIT8(KCMENotFound, "+CME ERROR: 22\r\n"); // Not found 
+_LIT8(KCMEDialStringTooLong, "+CME ERROR: 26\r\n"); // Dial string too long 
+_LIT8(KCMETextStringTooLong, "+CME ERROR: 24\r\n"); // Text string too long 
+_LIT8(KCMEInvalidCharacters, "+CME ERROR: 27\r\n"); // Invalid characters in dial string
+
+
 
 const TInt KErrorReplyLength = 9;  // CR+LF+"ERROR"+CR+LF
 const TInt KEditorReplyLength = 4;  // CR+LF+'>'+' '
@@ -79,6 +93,9 @@
     delete iCGMIHandler;
     delete iCMGWHandler;
     delete iCMGDHandler;
+    delete iCGMMHandler;
+	delete iSCPBRHandler;
+    delete iSCPBWHandler;
 #endif    
 	
     iPhone.Close();
@@ -110,6 +127,10 @@
     iCGMIHandler = CCGMICommandHandler::NewL(this, iCommandParser, iPhone);
     iCMGWHandler = CCMGWCommandHandler::NewL(this, iCommandParser, iPhone);
     iCMGDHandler = CCMGDCommandHandler::NewL(this, iCommandParser, iPhone); 
+    iCGMMHandler = CCGMMCommandHandler::NewL(this, iCommandParser, iPhone);
+	iSCPBRHandler = CSCPBRCommandHandler::NewL(this, iCommandParser, iPhone);
+    iSCPBWHandler = CSCPBWCommandHandler::NewL(this, iCommandParser, iPhone);
+    
    
     // Get telephony information - Model, IMEI, Manufacturer
     CTelephonyWrapper* telephonyWrapper = CTelephonyWrapper::NewL();
@@ -120,12 +141,15 @@
         static_cast<CHVERCommandHandler*>(iHVERHandler)->SetHWVersion(telephonyWrapper->GetPhoneModel());
         static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetSerialNum(telephonyWrapper->GetPhoneSerialNum());
         static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetManufacturer(telephonyWrapper->GetPhoneManufacturer());
+        static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetManufacturer(telephonyWrapper->GetPhoneManufacturer());
+        static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetModelID(telephonyWrapper->GetPhoneModel());
         }
     else // The result is used to determine whether to display CME error or not
         {
         static_cast<CHVERCommandHandler*>(iHVERHandler)->SetTelephonyError(result);
         static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetTelephonyError(result);
         static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetTelephonyError(result);
+        static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetTelephonyError(result);
         }
     delete telephonyWrapper;
 #endif    
@@ -208,17 +232,25 @@
             iCurrentHandler = iHVERHandler;
             break;
             }
-        case (TAtCommandParser::ECmdAtCgsn):
+        case (TAtCommandParser::ECmdAtCgsn): // intentional fall through
+        case (TAtCommandParser::ECmdAtGsn):
+        case (TAtCommandParser::ECmdAtI1):
             {
             iCurrentHandler = iCGSNHandler;
             break;
             }
-        case (TAtCommandParser::ECmdAtCgmr):
+        case (TAtCommandParser::ECmdAtCgmr): // intentional fall through
+        case (TAtCommandParser::ECmdAtGmr):
+        case (TAtCommandParser::ECmdAtI2):
+        case (TAtCommandParser::ECmdAtI4):
             {
             iCurrentHandler = iCGMRHandler;
             break;
             }
-        case (TAtCommandParser::ECmdAtCgmi):
+        case (TAtCommandParser::ECmdAtCgmi): // intentional fall through
+        case (TAtCommandParser::ECmdAtGmi):
+        case (TAtCommandParser::ECmdAtI):
+        case (TAtCommandParser::ECmdAtI0):
             {
             iCurrentHandler = iCGMIHandler;
             break;
@@ -238,6 +270,23 @@
             iCurrentHandler = NULL;
             break;
             }
+		case (TAtCommandParser::ECmdAtCgmm): // intentional fall through
+		case (TAtCommandParser::ECmdAtGmm):
+		case (TAtCommandParser::ECmdAtI3):
+            {
+            iCurrentHandler = iCGMMHandler;
+            break;
+            }
+		case (TAtCommandParser::ECmdAtScpbr):
+            {
+            iCurrentHandler = iSCPBRHandler;
+            break;
+            }    
+		case (TAtCommandParser::ECmdAtScpbw):
+            {
+            iCurrentHandler = iSCPBWHandler;
+            break;
+            }
 #endif
         case (TAtCommandParser::EUnknown):
         default:
@@ -630,11 +679,57 @@
 	            break;
 	            }
             case KErrUnknown:
+            case KErrGsmSimServAnrFull:
                 {
                 // unknown error
                 response.Append(KCMEPhoneUnknown);
                 break;
                 }
+            case KErrNotFound:
+                {
+                response.Append(KCMENotFound);
+                break;
+                }
+            case KErrInUse:
+            case KErrGsmMMServiceOptionTemporaryOutOfOrder:
+                {
+                // SIM not inserted
+                response.Append(KCMESimNotInserted);
+                break;
+                }
+            case KErrArgument:
+            case KErrGsm0707InvalidIndex:
+            case KErrGsm0707NotFound:
+                {
+                // Invalid index
+                response.Append(KCMEInvalidIndex);
+                break;
+                }
+            case KErrGsm0707TextStringTooLong:
+                {
+                // Text string too long
+                response.Append(KCMETextStringTooLong);
+                break;
+                }
+            case KErrGsm0707DialStringTooLong:
+                {
+                // Dial string too long
+                response.Append(KCMEDialStringTooLong);
+                break;
+                }
+            case KErrGsmCCUnassignedNumber:
+            case KErrGsm0707InvalidCharsInDialString:
+                {
+                // Invalid characters in dial string
+                response.Append(KCMEInvalidCharacters);
+                break;
+                }
+            case KErrMMEtelMaxReached:
+                {
+                // Memory full
+                response.Append(KCMEMemoryFull);
+                break;
+                }
             default:
                 {
                 response.Append(KCMEPhoneError);
@@ -688,9 +783,8 @@
                 response.AppendNum(EATCMSErr304);
                 break;
                 }
-            case KErrNotReady:
-            case KErrNotFound:
-            case KErrGsmSMSSimNotInserted:
+            case KErrGsm0707SimFailure:
+            case KErrGsmMMServiceOptionTemporaryOutOfOrder:
                 {    
                 // SIM card not inserted
                 response.AppendNum(EATCMSErr310);
@@ -736,7 +830,7 @@
                 }
             default:
 				{
-                response.AppendNum(EATCmsErrGeneral);
+				response.AppendNum(EATCmsErrGeneral);
 				break;
 				}
             }
@@ -817,6 +911,12 @@
         }
     User::LeaveIfError(aTelServer.GetPhoneInfo(0, info));
     User::LeaveIfError(aPhone.Open(aTelServer, info.iName));
+    
+    if (iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)!=KErrNone)
+        {
+        User::LeaveIfError(iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorBasic));
+        }
+
     TRACE_FUNC_EXIT
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/src/cgmmcommandhandler.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * Description :
+ *
+ */
+
+#include "cgmmcommandhandler.h"
+
+#include "atmisccmdpluginconsts.h"
+#include "debug.h"
+
+CCGMMCommandHandler* CCGMMCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
+    {
+    TRACE_FUNC_ENTRY
+    CCGMMCommandHandler* self = new (ELeave) CCGMMCommandHandler(aCallback, aATCmdParser, aPhone);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    TRACE_FUNC_EXIT
+    return self;
+    }
+
+CCGMMCommandHandler::CCGMMCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
+    CATCmdSyncBase(aCallback, aATCmdParser, aPhone)
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+void CCGMMCommandHandler::ConstructL()
+    {
+    TRACE_FUNC_ENTRY
+    iReply.CreateL(KDefaultCmdBufLength);
+    TRACE_FUNC_EXIT
+    }
+
+CCGMMCommandHandler::~CCGMMCommandHandler()
+    {
+    TRACE_FUNC_ENTRY
+    iReply.Close();
+    TRACE_FUNC_EXIT
+    }
+
+void CCGMMCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
+    {
+    TRACE_FUNC_ENTRY
+    
+    TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
+    
+    switch (cmdHandlerType)
+        {
+        case (TAtCommandParser::ECmdHandlerTypeTest):
+            {
+            iCallback->CreateReplyAndComplete( EReplyTypeOk );
+            break;
+            }
+        case (TAtCommandParser::ECmdHandlerTypeBase):
+            {
+            if(iTelError == KErrNone)
+                {
+                if (iReply.Length() == 0)
+                    {
+                    _LIT8( KSpace, " " );
+                
+                    iReply.Append( KCRLF );
+                    iReply.Append( iManufacturer );
+                    iReply.Append( KSpace );
+                    iReply.Append( iModel );    
+                    iReply.Append( KCRLF );
+                    }
+              
+                iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply);
+                }
+            else
+                {
+                iCallback->CreateCMEReplyAndComplete(iTelError);
+                }
+            break;
+            }
+        default:
+            {
+            iCallback->CreateReplyAndComplete(EReplyTypeError);
+            break;
+            }
+        }
+      
+    TRACE_FUNC_EXIT
+    }
+
+void CCGMMCommandHandler::SetManufacturer(const TDesC8& aManufacturer)
+    {
+    TRACE_FUNC_ENTRY
+    iManufacturer.Zero();
+    if (aManufacturer.Length() <= CTelephony::KPhoneManufacturerIdSize)
+        {
+        iManufacturer.Copy(aManufacturer);
+        }
+    else
+        {
+        iManufacturer.Copy(aManufacturer.Left(CTelephony::KPhoneManufacturerIdSize));
+        }   
+    TRACE_FUNC_EXIT
+    }
+
+void CCGMMCommandHandler::SetModelID(const TDesC8& aModelID)
+    {
+    TRACE_FUNC_ENTRY
+    iModel.Zero();
+    if (aModelID.Length() <= CTelephony::KPhoneModelIdSize)
+        {
+        iModel.Copy(aModelID);
+        }
+    else
+        {
+        iModel.Copy(aModelID.Left(CTelephony::KPhoneModelIdSize));
+        }    
+    TRACE_FUNC_EXIT
+    }
+
+
+void CCGMMCommandHandler::SetTelephonyError(TInt aTelError)
+    {
+    TRACE_FUNC_ENTRY
+    iTelError = aTelError;
+    TRACE_FUNC_EXIT
+    }
+
+
--- a/cbsatplugin/atmisccmdplugin/src/cmgdcommandhandler.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/cmgdcommandhandler.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -136,6 +136,9 @@
     {
     TRACE_FUNC_ENTRY
     
+    Trace(_L("Error = %d"), iStatus.Int());
+    Trace(_L("State = %d"), iHandlerState);
+    
     iReply.Zero();
     
     TInt err = iStatus.Int();
@@ -195,6 +198,13 @@
                 iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
                 break;
                 }
+            case ECMGDStateDeleteFilteredEntries:
+                {
+                iMobileSmsStore.DeleteAll(iStatus);
+                iHandlerState = ECMGDStateDeleteAllEntries;
+                SetActive();
+                break;
+                }
             default:
                 iHandlerState = ECMGDStateIdle;
                 iCallback->CreateCMSReplyAndComplete(err);
--- a/cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp	Mon Jul 12 19:25:26 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -18,7 +18,7 @@
 #include "cpincommandhandler.h"
 
 #include <mmretrieve.h>         // define AO wrapper
-#include <EXTERROR.H>           // Additional RMobilePhone error code
+#include <exterror.h>           // Additional RMobilePhone error code
 
 #include "debug.h"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/src/scpbrcommandhandler.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,451 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * Description :
+ *
+ */
+
+#include "scpbrcommandhandler.h"
+
+#include <mpbutil.h>
+#include "debug.h"
+#include "atmisccmdpluginconsts.h"
+
+CSCPBRCommandHandler::CSCPBRCommandHandler( 
+		MATMiscCmdPlugin* aCallback, 
+		TAtCommandParser& aATCmdParser, 
+		RMobilePhone& aPhone) 
+		: CATCmdAsyncBase( aCallback, aATCmdParser, aPhone )
+	{
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+	}
+
+CSCPBRCommandHandler::~CSCPBRCommandHandler()
+	{
+    TRACE_FUNC_ENTRY
+    Cancel();
+    iPhoneBookStore.Close();
+    iCustomApi.Close();
+    iReply.Close();
+    delete iPhoneBookBuffer;
+    iEntries.Close();
+    iContactsBuf.Close();
+    TRACE_FUNC_EXIT
+	}
+
+void CSCPBRCommandHandler::ConstructL()
+	{
+    TRACE_FUNC_ENTRY
+    TInt err = iPhoneBookStore.Open( iPhone, KETelIccAdnPhoneBook);
+    if( err != KErrNone )  // if the phonebookstore can't be opened or error occurs when try to open it.
+        {
+        iState = ESCPBRStateNotSupported;
+        TRACE_FUNC_EXIT
+        return;
+        }
+    err = iCustomApi.Open( iPhone );
+    if( err != KErrNone )  // If the custom api can't be opened.
+        {
+        iPhoneBookStore.Close();
+        iState = ESCPBRStateNotSupported;
+        TRACE_FUNC_EXIT
+        return;
+        }
+    iReply.CreateL( KBufBlockSize );
+	iPhoneBookBuffer = new ( ELeave ) CPhoneBookBuffer();	
+    TRACE_FUNC_EXIT
+	}
+
+CSCPBRCommandHandler* CSCPBRCommandHandler::NewL( 
+		MATMiscCmdPlugin* aCallback, 
+		TAtCommandParser& aATCmdParser, 
+		RMobilePhone& aPhone )
+	{
+    TRACE_FUNC_ENTRY
+	CSCPBRCommandHandler * self = new ( ELeave ) CSCPBRCommandHandler( aCallback, aATCmdParser, aPhone );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+    TRACE_FUNC_EXIT
+	return self;
+	}
+
+void CSCPBRCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/ )
+	{
+    TRACE_FUNC_ENTRY
+    if( iState == ESCPBRStateIdle )  // Not supported or have unfinished task.
+        {
+        iReply.Zero();  
+        TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
+        switch( cmdHandlerType )
+            {
+            case TAtCommandParser::ECmdHandlerTypeTest: // command: AT^SCPBR=?
+                {
+                if( iTotalEntries == 0 )
+                    {
+                    iState = ESCPBRStateGetPhoneBookInfo;
+                    RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg pkg( iPhoneBookInfo );
+                    iPhoneBookStore.GetInfo( iStatus, pkg );
+                    SetActive();
+                    }
+                else if ( iMLength ==0 )
+                    {
+                    iState = ESCPBRStateGet3GPBInfo;
+                    iCustomApi.Get3GPBInfo( iStatus, i3GPBInfo );
+                    SetActive();
+                    }
+                else
+                    {
+                    iReply.Format( KSCPBRSupportedEntriesIndexList, 
+                            iTotalEntries, iNLength, iTLength, iMLength );
+                    iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply );
+                    }
+                break;
+                }
+            case TAtCommandParser::ECmdHandlerTypeSet:  // command: AT^SCPBR=<index1>[,<index2>]
+                {
+                if( ParseParameters() == KErrNone )
+                    {
+                    iEntries.Reset();
+                    TInt amountOfEntries = iIndex2 - iIndex1 + 1;  // the amount of entries.
+                    Trace( _L8("The amount of entries: %d "), amountOfEntries );
+                    iContactsBuf.Zero();
+                    TInt bufSize;
+                    if( amountOfEntries >= KSCPBRMaxEntryCount )
+                        {
+                        bufSize= KSCPBRMaxEntryCount * KSCPBRDefaultSizeOfOneEntry;
+                        amountOfEntries = KSCPBRMaxEntryCount;
+                        }
+                    else
+                        {
+                        bufSize = amountOfEntries * KSCPBRDefaultSizeOfOneEntry;
+                        }
+                    
+                    if( bufSize >= iContactsBuf.MaxLength() )
+                        {
+                        TInt err = iContactsBuf.ReAlloc( bufSize );
+                        Trace( _L8("The error code of the realloc: %d "), err );
+                        if( err != KErrNone )
+                            {
+                            iState = ESCPBRStateIdle;
+                            iCallback->CreateReplyAndComplete( EReplyTypeError );
+                            break;
+                            }
+                        }
+                    iState = ESCPBRStateRead;
+                    iPhoneBookStore.Read( iStatus,  iIndex1, amountOfEntries, iContactsBuf );
+                    SetActive();
+                    }
+                else
+                    {
+                    iCallback->CreateReplyAndComplete( EReplyTypeError );
+                    }
+                break;
+                }
+            default:
+                {
+                iCallback->CreateReplyAndComplete( EReplyTypeError );
+                break;
+                }
+            }
+        }
+    else
+        {
+        iCallback->CreateReplyAndComplete( EReplyTypeError );
+        } 
+       TRACE_FUNC_EXIT
+	}
+
+TInt CSCPBRCommandHandler::ParseParameters()
+    {
+    TRACE_FUNC_ENTRY
+    iIndex1 = 0; 
+    iIndex2 = 0;
+    TInt index3;
+    TInt ret1 = iATCmdParser.NextIntParam( iIndex1 );
+    TInt ret2 = iATCmdParser.NextIntParam( iIndex2 );
+    TInt ret3 = iATCmdParser.NextIntParam( index3 );
+    
+    if( ret1 != KErrNone 
+            || ( ret2 != KErrNone && ret2 != KErrNotFound )
+            || ret3 != KErrNotFound )
+        {
+        TRACE_FUNC_EXIT
+        return KErrArgument;
+        }
+    if( ret2 == KErrNotFound )
+        {
+        iIndex2 = iIndex1;
+        }
+    if (iIndex2 < iIndex1)
+        {
+        TRACE_FUNC_EXIT
+        return KErrArgument;
+        }
+    TRACE_FUNC_EXIT
+    return KErrNone;
+    }
+
+void CSCPBRCommandHandler::RunL()
+	{
+    TRACE_FUNC_ENTRY
+    iReply.Zero();
+    TInt result = iStatus.Int();
+    if( result == KErrNone )
+        {
+        switch( iState )
+            {
+            case ESCPBRStateRead:
+                {
+                ExtractEntriesL();
+                FormatReplyL();
+                iState = ESCPBRStateIdle;
+                iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
+                break;
+                }
+            case ESCPBRStateGetPhoneBookInfo:
+                {
+                iTotalEntries = iPhoneBookInfo.iTotalEntries;
+                iNLength = iPhoneBookInfo.iMaxNumLength;
+                iTLength = iPhoneBookInfo.iMaxTextLength;
+                if (iMLength == 0)
+                    {
+                    iState = ESCPBRStateGet3GPBInfo;
+                    iCustomApi.Get3GPBInfo( iStatus, i3GPBInfo );
+                    SetActive();
+                    }
+                else 
+                    {
+                    iReply.Format( KSCPBRSupportedEntriesIndexList, 
+                            iTotalEntries, iNLength, iTLength, iMLength );
+                    iState = ESCPBRStateIdle;
+                    iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply );
+                    }
+                break;
+                }
+            case ESCPBRStateGet3GPBInfo:
+                {
+                iMLength = i3GPBInfo.iMaxLenEmail;
+                iReply.Format( KSCPBRSupportedEntriesIndexList, 
+                        iTotalEntries, iNLength, iTLength, iMLength );
+                iState = ESCPBRStateIdle;
+                iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply );
+                break;
+                }
+            default: 
+                {
+                iState = ESCPBRStateIdle;
+                iCallback->CreateReplyAndComplete( EReplyTypeError );
+                break;
+                }
+            }
+        }
+    else
+        {
+        iState = ESCPBRStateIdle;
+        iCallback->CreateCMEReplyAndComplete( result );
+        }
+    TRACE_FUNC_EXIT
+	}
+
+TInt CSCPBRCommandHandler::RunError(TInt aError)
+    {
+    TRACE_FUNC_ENTRY
+    iState = ESCPBRStateIdle;
+    iCallback->CreateReplyAndComplete( EReplyTypeError );
+    TRACE_FUNC_EXIT
+    return KErrNone;
+    }
+
+void CSCPBRCommandHandler::ExtractEntriesL()
+    {
+    TRACE_FUNC_ENTRY
+    iPhoneBookBuffer->Set( &iContactsBuf );
+    iPhoneBookBuffer->StartRead();
+    TUint8 fieldTag;
+    CPhoneBookBuffer::TPhBkTagType dataType;
+    TInt numCount = 0;
+	// clear entry arry for use.
+    iEntries.Reset();
+    User::LeaveIfError(iPhoneBookBuffer->GetTagAndType( fieldTag, dataType ));
+    if( fieldTag != RMobilePhoneBookStore::ETagPBNewEntry )
+        {
+        // Buffer corrupt
+        User::Leave(KErrCorrupt);
+        }
+    TInt ret = KErrNone;
+    TInt index = -1; // at least one entry
+    while (ret != KErrNotFound) // if reach the buffer end.
+        {
+        switch (fieldTag)
+            {
+            case RMobilePhoneBookStore::ETagPBNewEntry:
+                {
+                TPhoneBookEntry entry;
+                iEntries.AppendL(entry);
+                ++index;
+                numCount = 0; // set the number count of new entry to 0. 
+                break;
+                }
+            case RMobilePhoneBookStore::ETagPBAdnIndex:
+                {
+                TUint16 simIndex = 0;
+                if (dataType != CPhoneBookBuffer::EPhBkTypeInt16)
+                    {
+                    User::Leave(KErrCorrupt);
+                    }
+                User::LeaveIfError( iPhoneBookBuffer->GetValue(simIndex) );
+
+                iEntries[index].iIndex = simIndex;
+                break;
+                }
+            case RMobilePhoneBookStore::ETagPBText:
+                {
+                TPtrC16 text;
+                if (dataType != CPhoneBookBuffer::EPhBkTypeDes16)
+                    {
+                    User::Leave(KErrCorrupt);
+                    }
+                User::LeaveIfError( iPhoneBookBuffer->GetValue(text) );
+                CopyToPhonebookEntryField(iEntries[index].iName, text);
+                break;
+                }
+            case RMobilePhoneBookStore::ETagPBNumber:
+                {
+                TPtrC16 number;
+                if (dataType != CPhoneBookBuffer::EPhBkTypeDes16)
+                    {
+                    User::Leave(KErrCorrupt);
+                    }
+                User::LeaveIfError( iPhoneBookBuffer->GetValue(number) );
+                ++numCount;
+                switch (numCount)
+                    {
+                    case 1: // The first number
+                        CopyToPhonebookEntryField(iEntries[index].iNumber1, number);
+                        break;
+                    case 2: // The Second number
+                        CopyToPhonebookEntryField(iEntries[index].iNumber2, number);
+                        break;
+                    case 3: // the Third number
+                        CopyToPhonebookEntryField(iEntries[index].iNumber3, number);
+                        break;
+                    case 4: // the fourth number.
+                        CopyToPhonebookEntryField(iEntries[index].iNumber4, number);
+                        break;
+                    }
+                break;
+                }
+            case RMobilePhoneBookStore::ETagPBEmailAddress:
+                {
+                TPtrC16 email;
+                if (dataType != CPhoneBookBuffer::EPhBkTypeDes16)
+                    {
+                    User::Leave(KErrCorrupt);
+                    }
+                User::LeaveIfError( iPhoneBookBuffer->GetValue(email) );
+                CopyToPhonebookEntryField(iEntries[index].iEmail, email);
+                break;
+                }
+            default:
+                {
+                iPhoneBookBuffer->SkipValue(dataType);
+                break;
+                }
+            }
+        ret = iPhoneBookBuffer->GetTagAndType(fieldTag, dataType);
+        }
+ 
+    TRACE_FUNC_EXIT
+    }
+
+void CSCPBRCommandHandler::CopyToPhonebookEntryField(TDes8& aDest, const TDesC16& aSrc)
+    {
+    TRACE_FUNC_ENTRY
+    TInt maxLength = aDest.MaxLength();
+    if ( aSrc.Length() <= maxLength )
+        {
+        aDest.Copy(aSrc);
+        }
+    else
+        {
+        aDest.Copy( aSrc.Left(maxLength) );
+        }
+    TRACE_FUNC_EXIT    
+    }
+
+void CSCPBRCommandHandler::FormatReplyL()
+    {
+    TRACE_FUNC_ENTRY
+
+    TInt count = iEntries.Count();
+    for (TInt i = 0; i < count; ++i)
+        {
+        AppendEntryL(iEntries[i]);
+        }
+
+    TRACE_FUNC_EXIT
+    }
+
+void CSCPBRCommandHandler::AppendEntryL(const TPhoneBookEntry& aEntry)
+    {
+    TRACE_FUNC_ENTRY
+    TBuf8<KSCPBRDefaultSizeOfOneEntry> entryBuffer;
+    aEntry.Externalize(entryBuffer);
+    
+    TInt length = entryBuffer.Length() + KSCPBR().Length(); 
+    if (length + iReply.Length() > iReply.MaxLength())
+        {
+        iReply.ReAllocL(iReply.MaxLength()+KBufBlockSize);
+        }
+    
+    iReply.Append(KSCPBR);
+    iReply.Append(entryBuffer);
+    TRACE_FUNC_EXIT
+    }
+
+void CSCPBRCommandHandler::DoCancel()
+	{
+    TRACE_FUNC_ENTRY
+    switch( iState )
+        {
+        case ESCPBRStateRead:
+            {
+            iPhoneBookStore.CancelAsyncRequest( EMobilePhoneStoreRead );
+            break;
+            }
+        case ESCPBRStateGetPhoneBookInfo:
+            {
+            iPhoneBookStore.CancelAsyncRequest( EMobilePhoneStoreGetInfo );
+            break;
+            }
+        case ESCPBRStateGet3GPBInfo:
+            {
+            iPhoneBookStore.CancelAsyncRequest( EGet3GPBInfoIPC );
+            break;
+            }
+        default:
+            break;
+        }
+    iState = ESCPBRStateIdle;
+    TRACE_FUNC_EXIT
+	}
+
+
+void CSCPBRCommandHandler::TPhoneBookEntry::Externalize(TDes8& aDes) const
+    {
+    TRACE_FUNC_ENTRY
+    
+    aDes.Format(KSCPBRReplyOneEntry, iIndex, &iNumber1, &iNumber2, &iNumber3, &iNumber4, &iName, &iEmail);
+    
+    TRACE_FUNC_EXIT
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsatplugin/atmisccmdplugin/src/scpbwcommandhandler.cpp	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,616 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * Description :
+ *
+ */
+
+#include "scpbwcommandhandler.h"
+#include <mpbutil.h> 
+#include <exterror.h>
+#include <etelmmerr.h>
+
+#include "atmisccmdpluginconsts.h"
+#include "debug.h"
+
+const TInt KMaxContactEntrySize = 512;
+const TInt KMaxTextLength = 64;
+const TInt KMaxNumberLength = 64;
+const TInt KMaxEmailLength = 64;
+
+CSCPBWCommandHandler* CSCPBWCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
+    {
+    TRACE_FUNC_ENTRY
+    CSCPBWCommandHandler* self = new (ELeave) CSCPBWCommandHandler(aCallback, aATCmdParser, aPhone);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    TRACE_FUNC_EXIT
+    return self;
+    }
+
+CSCPBWCommandHandler::CSCPBWCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
+    CATCmdAsyncBase(aCallback, aATCmdParser, aPhone)
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+void CSCPBWCommandHandler::ConstructL()
+    {
+    TRACE_FUNC_ENTRY
+    
+    TInt err = iPhoneBookStore.Open(iPhone, KETelIccAdnPhoneBook);
+    if (err != KErrNone)
+        {
+        iState = ESCPBWStateSimStoreNotSupported;
+        TRACE_FUNC_EXIT
+        return;
+        }
+    err = iMmCustomAPI.Open(iPhone);
+    if (err != KErrNone)
+        {
+        iPhoneBookStore.Close();
+        iState = ESCPBWStateSimStoreNotSupported;
+        TRACE_FUNC_EXIT
+        return;
+        }
+    iPhoneBookBuffer = new (ELeave) CPhoneBookBuffer;
+    
+    iReply.CreateL(KDefaultCmdBufLength);
+    iNum1.CreateL(KMaxNumberLength);
+    iNum2.CreateL(KMaxNumberLength);
+    iNum3.CreateL(KMaxNumberLength);
+    iNum4.CreateL(KMaxNumberLength);
+    iText.CreateL(KMaxTextLength);
+    iEmail.CreateL(KMaxEmailLength);
+    iPbData.CreateL(KMaxContactEntrySize);
+    
+    TRACE_FUNC_EXIT
+    }
+
+CSCPBWCommandHandler::~CSCPBWCommandHandler()
+    {
+    TRACE_FUNC_ENTRY
+    Cancel();
+    delete iPhoneBookBuffer;
+    iPhoneBookStore.Close();
+    iMmCustomAPI.Close();
+    iPbData.Close();
+    iReply.Close();
+    iNum1.Close();
+    iNum2.Close();
+    iNum3.Close();
+    iNum4.Close();
+    iText.Close();
+    iEmail.Close();
+    TRACE_FUNC_EXIT
+    }
+
+void CSCPBWCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
+    {
+    TRACE_FUNC_ENTRY
+    
+    if (iState != ESCPBWStateIdle)
+        {
+        // Reply "ERROR" if handler is not in idle
+        iCallback->CreateReplyAndComplete(EReplyTypeError);
+        TRACE_FUNC_EXIT
+        return;
+        }
+    TInt err = KErrNone;
+    
+    TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
+    
+    switch (cmdHandlerType)
+        {
+        case (TAtCommandParser::ECmdHandlerTypeTest):
+            {
+            if (iMaxEntries == 0)
+                {
+                RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg pckg(iPhoneBookStoreInfo);
+                iPhoneBookStore.GetInfo(iStatus, pckg);
+                iState = ESCPBWStateGetPhonebookInfo;
+                SetActive();
+                }
+            else if (iEmailLength == 0)
+                {
+                iState = ESCPBWStateGet3GPBInfo;
+                iMmCustomAPI.Get3GPBInfo(iStatus, i3GPBInfo);
+                SetActive();
+                }
+            else
+                {
+                // Phonebook info has been obtained
+                iReply.Zero();
+                iReply.Format(KSCPBWSupportedCmdsList, iMaxEntries, iNumLength, iTextLength, iEmailLength);
+                iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply );
+                }
+            }
+            break;
+        case (TAtCommandParser::ECmdHandlerTypeSet): 
+            {
+            ResetParameters();
+            TBool isDeleteRequest = EFalse;
+            err = ParseParameters(isDeleteRequest);
+            Trace(_L("Parse completed, err = %d"), err);
+            if (isDeleteRequest)
+                {
+                // Delete entry at iIndex
+                iState = ESCPBWStateDelete;
+                iPhoneBookStore.Delete(iStatus, iIndex);
+                SetActive();
+                }
+            else if (err == KErrNone)
+                {
+                // Create an entry
+                err = CreateContactEntry();
+                if (err == KErrNone)
+                    {
+                    iPhoneBookStore.Write(iStatus, iPbData, iIndex);
+                    iState = ESCPBWStateWrite;
+                    SetActive();
+                    }
+                else
+                    {
+                    iCallback->CreateReplyAndComplete( EReplyTypeError );
+                    }
+                }
+            else
+                {
+                iCallback->CreateReplyAndComplete( EReplyTypeError );
+                }
+            break;
+            }
+        default:
+            {
+            iCallback->CreateReplyAndComplete( EReplyTypeError );
+            break;
+            }
+        }
+    
+    TRACE_FUNC_EXIT
+    }
+
+void CSCPBWCommandHandler::RunL()
+    {
+    TRACE_FUNC_ENTRY
+    
+    iReply.Zero();
+    TInt err = iStatus.Int();
+    Trace(_L("State = %d, err = %d"), iState, err);
+    
+    if (err == KErrNone)
+        {
+        switch (iState)
+            {
+            case ESCPBWStateGetPhonebookInfo:
+                {
+                Trace(_L("Get info successful."));
+                iNumLength = iPhoneBookStoreInfo.iMaxNumLength;
+                iTextLength = iPhoneBookStoreInfo.iMaxTextLength;
+                iMaxEntries = iPhoneBookStoreInfo.iTotalEntries;
+                if (iEmailLength == 0)
+                    {
+                    iMmCustomAPI.Get3GPBInfo(iStatus, i3GPBInfo);
+                    iState = ESCPBWStateGet3GPBInfo;
+                    SetActive();
+                    }
+                else
+                    {
+                    iReply.Format(KSCPBWSupportedCmdsList, iMaxEntries, iNumLength, iTextLength, iEmailLength);
+                    iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
+                    iState = ESCPBWStateIdle;
+                    }
+                }
+                break;
+            case ESCPBWStateGet3GPBInfo:
+                {
+                Trace(_L("Get 3GPB info successful."));
+                iEmailLength = i3GPBInfo.iMaxLenEmail;
+                iReply.Format(KSCPBWSupportedCmdsList, iMaxEntries, iNumLength, iTextLength, iEmailLength);
+                iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
+                iState = ESCPBWStateIdle;
+                }
+                break;
+            case ESCPBWStateWrite:
+                {
+                Trace(_L("Write successful. Index = %d"), iIndex);
+                iCallback->CreateReplyAndComplete(EReplyTypeOk);
+                iState = ESCPBWStateIdle;
+                }
+                break;
+            case ESCPBWStateDelete:
+                {
+                Trace(_L("Delete successful."));
+                iCallback->CreateReplyAndComplete(EReplyTypeOk);
+                iState = ESCPBWStateIdle;
+                }
+                break;
+            default:
+                {
+                iState = ESCPBWStateIdle;
+                iCallback->CreateReplyAndComplete(EReplyTypeError);
+                break;
+                }
+            }
+        }
+    else
+        {
+        iState = ESCPBWStateIdle; 
+        iCallback->CreateCMEReplyAndComplete(err);
+        }
+    
+    TRACE_FUNC_EXIT
+    }
+
+void CSCPBWCommandHandler::DoCancel() 
+    {
+    TRACE_FUNC_ENTRY
+    
+    switch (iState)
+        {
+        case ESCPBWStateGetPhonebookInfo:
+            {
+            iPhoneBookStore.CancelAsyncRequest(EMobilePhoneStoreGetInfo);
+            }
+            break;
+        case ESCPBWStateGet3GPBInfo:
+            {
+            iMmCustomAPI.CancelAsyncRequest(EGet3GPBInfoIPC);
+            }
+            break;
+        case ESCPBWStateDelete:
+            {
+            iPhoneBookStore.CancelAsyncRequest(EMobilePhoneStoreDelete);
+            }
+            break;
+        case ESCPBWStateWrite:
+            {
+            iPhoneBookStore.CancelAsyncRequest(EMobilePhoneStoreWrite);
+            }
+            break;
+        }
+    iState = ESCPBWStateIdle;
+    
+    TRACE_FUNC_EXIT
+    }
+
+TInt CSCPBWCommandHandler::ParseParameters( TBool& aIsDeleteRequest )
+    {
+    TRACE_FUNC_ENTRY
+    
+    TInt ret = KErrNone;
+    // Paese index
+    ret = iATCmdParser.NextIntParam(iIndex); 
+    Trace(_L("Parse index err: %d"), ret);
+    Trace(_L("index: %d"), iIndex);
+    if (ret != KErrNone && ret != KErrNotFound)
+        {
+        // Bad index
+        TRACE_FUNC_EXIT
+        return KErrArgument;
+        }
+    
+    TPtrC8 ptrc;
+    // Parse num1
+    ptrc.Set(iATCmdParser.NextParam());
+    if (ptrc.Length() != 0)
+        {
+        Trace(_L("Parse num1 OK: %S"), &ptrc);
+        SetBuffer(iNum1, ptrc);
+        }
+    else if (ret == KErrNone )
+        {
+        // Only index given
+        Trace(_L("Only index given."));
+        aIsDeleteRequest = ETrue;
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    else 
+        {
+        // no num1 found
+        TRACE_FUNC_EXIT
+        return KErrArgument;
+        }
+    ret = iATCmdParser.NextIntParam(iType1);
+    if (ret == KErrNotFound)
+        {
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    else if (ret != KErrNone)
+        {
+        TRACE_FUNC_EXIT
+        return KErrArgument;
+        }
+    
+    // Parse num2
+    ptrc.Set(iATCmdParser.NextParam());
+    if (ptrc.Length() != 0)
+        {
+        Trace(_L("Parse num2 OK: %S"), &ptrc);
+        SetBuffer(iNum2, ptrc);
+        }
+    else 
+        {
+        // no num2 found
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    ret = iATCmdParser.NextIntParam(iType2);
+    if (ret == KErrNotFound)
+        {
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    else if (ret != KErrNone)
+        {
+        TRACE_FUNC_EXIT
+        return KErrArgument;
+        }
+    
+    // Parse num3
+    ptrc.Set(iATCmdParser.NextParam());
+    if (ptrc.Length() != 0)
+        {
+        Trace(_L("Parse num3 OK: %S"), &ptrc);
+        SetBuffer(iNum3, ptrc);
+        }
+    else
+        {
+        // no num3 found
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    ret = iATCmdParser.NextIntParam(iType3);
+    if (ret == KErrNotFound)
+        {
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    else if (ret != KErrNone)
+        {
+        TRACE_FUNC_EXIT
+        return KErrArgument;
+        }
+    
+    // Parse num4
+    ptrc.Set(iATCmdParser.NextParam());
+    if (ptrc.Length() != 0)
+        {
+        Trace(_L("Parse num4 OK: %S"), &ptrc);
+        SetBuffer(iNum4, ptrc);
+        }
+    else
+        {
+        // no num4 found
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    ret = iATCmdParser.NextIntParam(iType4);
+    if (ret == KErrNotFound)
+        {
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    else if (ret != KErrNone)
+        {
+        TRACE_FUNC_EXIT
+        return KErrArgument;
+        }
+    
+    // Parse text
+    ptrc.Set(iATCmdParser.NextParam());
+    if (ptrc.Length() != 0)
+        {
+        Trace(_L("Parse text OK: %S"), &ptrc);
+        SetBuffer(iText, ptrc);
+        }
+    else
+        {
+        // no text found
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    ret = iATCmdParser.NextIntParam(iCoding);
+    if (ret == KErrNotFound)
+        {
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    else if (ret != KErrNone)
+        {
+        TRACE_FUNC_EXIT
+        return KErrArgument;
+        }
+    
+    // Parse email
+    ptrc.Set(iATCmdParser.NextParam());
+    if (ptrc.Length() != 0)
+        {
+        Trace(_L("Parse email OK: %S"), &ptrc);
+        SetBuffer(iEmail, ptrc);
+        }
+    else
+        {
+        // no email found
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    
+    if (iATCmdParser.NextParam().Length() != 0)
+        {
+        // too many parameters
+        Trace(_L("Too many parameters."));
+        TRACE_FUNC_EXIT
+        return KErrArgument;
+        }
+    
+    TRACE_FUNC_EXIT
+    return KErrNone;
+    }
+
+TInt CSCPBWCommandHandler::CreateContactEntry()
+    {
+    TRACE_FUNC_ENTRY
+    
+    TInt err = KErrNone;
+    iPhoneBookBuffer->Set(&iPbData);
+    // Add new entry tag
+    err = iPhoneBookBuffer->AddNewEntryTag();
+    Trace(_L("New entry tag added, err = %d"), err);
+    if (err != KErrNone)
+        {
+        TRACE_FUNC_EXIT
+        return err;
+        }
+    // Put index into the entry
+    err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBAdnIndex, (TUint16)iIndex);
+    Trace(_L("Index added, err = %d"), err);
+    if (err != KErrNone)
+        {
+        TRACE_FUNC_EXIT
+        return err;
+        }
+    // Put text into the entry
+    if (iText.Length() != 0)
+        {
+        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBText, iText);
+        Trace(_L("Text added, err = %d"), err);
+        if (err != KErrNone)
+            {
+            TRACE_FUNC_EXIT
+            return err;
+            }
+        }
+    // Put num1 into the entry
+    if (iNum1.Length() != 0)
+        {
+        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, iNum1);
+        Trace(_L("Number 1 added, err = %d"), err);
+        if (err != KErrNone)
+            {
+            TRACE_FUNC_EXIT
+            return err;
+            }
+        }
+    // Put num2 into the entry
+    if (iNum2.Length() != 0)
+        {
+        // Add anr tag 
+        err = iPhoneBookBuffer->AddNewNumberTag();
+        Trace(_L("New number tag added, err = %d"), err);
+        if (err != KErrNone)
+            {
+            TRACE_FUNC_EXIT
+            return err;
+            }
+        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, iNum2);
+        Trace(_L("Number 2 added, err = %d"), err);
+        if (err != KErrNone)
+            {
+            TRACE_FUNC_EXIT
+            return err;
+            }
+        }
+    // Put num3 into the entry
+    if (iNum3.Length() != 0)
+        {
+        // Add anr tag 
+        err = iPhoneBookBuffer->AddNewNumberTag();
+        Trace(_L("New number tag added, err = %d"), err);
+        if (err != KErrNone)
+            {
+            TRACE_FUNC_EXIT
+            return err;
+            }
+        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, iNum3);
+        Trace(_L("Number 3 added, err = %d"), err);
+        if (err != KErrNone)
+            {
+            TRACE_FUNC_EXIT
+            return err;
+            }
+        }
+    // Put num4 into the entry
+    if (iNum4.Length() != 0)
+        {
+        // Add anr tag 
+        err = iPhoneBookBuffer->AddNewNumberTag();
+        Trace(_L("New number tag added, err = %d"), err);
+        if (err != KErrNone)
+            {
+            TRACE_FUNC_EXIT
+            return err;
+            }
+        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, iNum4);
+        Trace(_L("Number 4 added, err = %d"), err);
+        if (err != KErrNone)
+            {
+            TRACE_FUNC_EXIT
+            return err;
+            }
+        }    
+    // Put email address into the entry
+    if (iEmail.Length() != 0)
+        {
+        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBEmailAddress, iEmail);
+        Trace(_L("Email added, err = %d"), err);
+        if (err != KErrNone)
+            {
+            TRACE_FUNC_EXIT
+            return err;
+            }
+        }
+    
+    TRACE_FUNC_EXIT
+    return KErrNone;
+    }
+
+void CSCPBWCommandHandler::ResetParameters()
+    {
+    TRACE_FUNC_ENTRY
+    
+    iPbData.Zero();
+    iIndex = -1;
+    iNum1.Zero();
+    iType1 = 0x91; // International & ISDN
+    iNum2.Zero();
+    iType2 = 0x91;
+    iNum3.Zero();
+    iType3 = 0x91;
+    iNum4.Zero();
+    iType4 = 0x91;
+    iText.Zero();
+    iCoding = 0; // GSM 7 bit
+    iEmail.Zero();
+    
+    TRACE_FUNC_EXIT
+    }
+
+void CSCPBWCommandHandler::SetBuffer(TDes& aDest, const TDesC8& aSource)
+    {
+    TRACE_FUNC_ENTRY
+    TInt maxLength = aDest.MaxLength();
+    if (aSource.Length() <= maxLength)
+        {
+        aDest.Copy(aSource);
+        }
+    else
+        {
+        aDest.Copy(aSource.Left(maxLength));
+        }
+    TRACE_FUNC_EXIT
+    }
+
+
--- a/package_definition.xml	Mon Jul 12 19:25:26 2010 +0300
+++ b/package_definition.xml	Fri Jul 23 15:57:13 2010 +0300
@@ -1,56 +1,188 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<SystemDefinition schema="3.0.0">
-  <package id="btservices" name="Bluetooth Services" levels="framework server generic specific plugin">
-    <collection id="bluetoothengine" name="Bluetooth Engine" level="framework">
-      <component id="bteng" filter="s60" name="Bluetooth Engine">
-        <unit bldFile="bluetoothengine/bteng/group"/>
-      </component>
-      <component id="btserviceutil" filter="s60" name="Bluetooth Service Utility">
-        <unit bldFile="bluetoothengine/btserviceutil/group"/>
-      </component>
-      <component id="btnotif" filter="s60" name="Bluetooth Notifier">
-      	<!-- client is separated for breaking cyclic compiling dependencies -->
-        <unit bldFile="bluetoothengine/btnotif/btnotifclient/group"/>
-        <unit bldFile="bluetoothengine/btnotif/group"/>
-          <!-- is this test needed as unit? -->
-        <!-- <unit bldFile="bluetoothengine/btnotif/tsrc/btnotifapitest/group"/> -->
-      </component>
-      <component id="btaudioman" filter="s60" name="Bluetooth Audio Manager">
-        <unit bldFile="bluetoothengine/btaudioman/group"/>
-      </component>
-      <component id="btmac" filter="s60" name="Bluetooth Mono Audio Controller" class="plugin">
-        <unit bldFile="bluetoothengine/btmac/group"/>
-      </component>
-      <component id="btsac" filter="s60" name="Bluetooth Stereo Audio Controller" class="plugin">
-        <unit bldFile="bluetoothengine/btsac/group"/>
-      </component>
-      <component id="btaudiostreamer" filter="s60" name="Bluetooth Audio Streamer">
-        <unit bldFile="bluetoothengine/btaudiostreamer/group"/>
-        <!-- <unit bldFile="bluetoothengine/btaudiostreamer/tsrc/btaudiostreamerapitest/group"/> -->
-      </component>
-      <component id="btsap" filter="s60" name="Bluetooth SIM Access Profile" class="plugin">
-        <unit bldFile="bluetoothengine/btsap/group"/>
-      </component>
-      <component id="btui" filter="s60" name="Bluetooth UI">
-        <!-- <unit bldFile="bluetoothengine/btui/ecom/group"/> -->
-        <unit bldFile="bluetoothengine/btui/group"/>
-      </component>
-      <component id="btpbap" filter="s60" name="Bluetooth Phonebook Access Profile" class="plugin">
-        <unit bldFile="bluetoothengine/btpbap/group"/>
-      </component>
-      <component id="bthid" filter="s60" name="Bluetooth HID">
-        <unit bldFile="bluetoothengine/bthid/group"/>
-      </component>
-    </collection>
-    <collection id="bluetoothappprofiles" name="Bluetooth Application Profiles" level="plugin">
-      <component id="avrcp" name="Bluetooth AVRCP" introduced="9.1" purpose="optional">
-        <unit bldFile="bluetoothappprofiles/avrcp" mrp="bluetoothappprofiles/avrcp/bluetooth_avrcp.mrp"/>
-      </component>
-    </collection>
-    <collection id="btservices_info" name="BT Services Info" level="plugin">
-      <component id="btservices_metadata" name="BT Services Metadata" class="config" introduced="^3" purpose="development" target="desktop">
-        <unit mrp="btservices_info/btservices_metadata/btservices_metadata.mrp"/>
-      </component>
-    </collection>
-  </package>
+<SystemDefinition schema="3.0.0" xmlns:qt="http://www.nokia.com/qt">
+ <package id="btservices" name="Bluetooth Services" levels="framework server generic specific plugin">
+  <collection id="btservices_pub" name="BT Services Public Interfaces" level="plugin">
+   <component id="bluetooth_power_state_api" name="Bluetooth Power State API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_pub/bluetooth_power_state_api/bluetooth_power_state_api.metaxml"/>
+    <unit bldFile="btservices_pub/bluetooth_power_state_api/group"/>
+   </component>
+   <component id="bluetooth_notifier_api" name="Bluetooth Notifier API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_pub/bluetooth_notifier_api/bluetooth_notifier_api.metaxml"/>
+    <unit bldFile="btservices_pub/bluetooth_notifier_api/group"/>
+   </component>
+  </collection>
+  <collection id="btservices_plat" name="BT Services Platform Interfaces" level="plugin">
+   <!-- Turn the device setting pri file into a pro and rephrase this entry accordingly and get rid of btservices_plat.pro -->
+   <component id="bt_remote_device_setting_api" name="Bluetooth Remote Device Setting API" class="api" filter="s60" introduced="^4">
+    <meta rel="Api" href="btservices_plat/bt_remote_device_setting_api/bt_remote_device_setting_api.metaxml"/>
+    <unit bldFile="btservices_plat" qt:proFile="btservices_plat.pro"/>
+   </component>
+   <component id="bluetooth_dosserver_audio_api" name="Bluetooth DOS Server Audio API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_dosserver_audio_api/bluetooth_dosserver_audio_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_dosserver_audio_api/group"/>
+   </component>
+   <component id="bluetooth_dut_mode_api" name="Bluetooth DUT Mode API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_dut_mode_api/bluetooth_dut_mode_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_dut_mode_api/group"/>
+   </component>
+   <component id="bluetooth_engine_api" name="Bluetooth Engine API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_engine_api/bluetooth_engine_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_engine_api/group"/>
+   </component>
+   <component id="bluetooth_engine_connection_management_api" name="Bluetooth Engine Connection Management API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_engine_connection_management_api/bluetooth_engine_connection_management_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_engine_connection_management_api/group" filter="!test"/>
+    <unit bldFile="btservices_plat/bluetooth_engine_connection_management_api/tsrc/group"  filter="test,api_test"/>
+   </component>
+   <component id="bluetooth_engine_device_management_api" name="Bluetooth Engine Device Management API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_engine_device_management_api/bluetooth_engine_device_management_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_engine_device_management_api/group" filter="!test"/>
+    <unit bldFile="btservices_plat/bluetooth_engine_device_management_api/tsrc/group"  filter="test,api_test"/>
+   </component>
+   <component id="bluetooth_engine_discovery_api" name="Bluetooth Engine Discovery API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_engine_discovery_api/bluetooth_engine_discovery_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_engine_discovery_api/group" filter="!test"/>
+    <unit bldFile="btservices_plat/bluetooth_engine_discovery_api/tsrc/group"  filter="test,api_test"/>
+   </component>
+   <component id="bluetooth_engine_features_api" name="Bluetooth Engine Features API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_engine_features_api/bluetooth_engine_features_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_engine_features_api/group"/>
+   </component>
+   <component id="bluetooth_engine_settings_api" name="Bluetooth Engine Settings API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_engine_settings_api/bluetooth_engine_settings_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_engine_settings_api/group" filter="!test"/>
+    <unit bldFile="btservices_plat/bluetooth_engine_settings_api/tsrc/group"  filter="test,api_test"/>
+   </component>
+   <component id="bluetooth_engine_plugin_api" name="Bluetooth Engine Plugin API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_engine_plugin_api/bluetooth_engine_plugin_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_engine_plugin_api/group"/>
+   </component>
+   <component id="bluetooth_local_variation_api" name="Bluetooth Local Variation API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_local_variation_api/bluetooth_local_variation_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_local_variation_api/group"/>
+   </component>
+   <component id="bluetooth_notifier_internal_api" name="Bluetooth Notifier internal API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_notifier_internal_api/bluetooth_notifier_internal_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_notifier_internal_api/group"/>
+   </component>
+   <component id="bluetooth_sap_connection_state_api" name="Bluetooth SAP Connection State API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_sap_connection_state_api/bluetooth_sap_connection_state_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_sap_connection_state_api/group"/>
+   </component>
+   <component id="bluetooth_secondary_display_notification_api" name="Bluetooth Secondary Display Notification API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/bluetooth_secondary_display_notification_api/bluetooth_secondary_display_notification_api.metaxml"/>
+    <unit bldFile="btservices_plat/bluetooth_secondary_display_notification_api/group"/>
+   </component>
+   <component id="obex_secondary_display_notification_api" name="OBEX Secondary Display Notification API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/obex_secondary_display_notification_api/obex_secondary_display_notification_api.metaxml"/>
+    <unit bldFile="btservices_plat/obex_secondary_display_notification_api/group"/>
+   </component>
+   <component id="obex_service_plugin_api" name="OBEX Service Plugin API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/obex_service_plugin_api/obex_service_plugin_api.metaxml"/>
+    <unit bldFile="btservices_plat/obex_service_plugin_api/group"/>
+   </component>
+   <component id="obex_service_utils_api" name="OBEX Service Utils API" class="api" filter="s60">
+    <meta rel="Api" href="btservices_plat/obex_service_utils_api/obex_service_utils_api.metaxml"/>
+    <unit bldFile="btservices_plat/obex_service_utils_api/group"/>
+   </component>
+   <component id="usb_obexservicemanager_client_api" name="OBEX Service Manager Client API" class="api" filter="s60">
+    <unit bldFile="btservices_plat/usb_obexservicemanager_client_api/group"/>
+   </component>
+  </collection>
+  <collection id="bluetoothengine" name="Bluetooth Engine" level="framework">
+   <component id="btnotifclient" filter="s60" name="Bluetooth Notification Client" introduced="^4">
+	<!-- cannot put a component under another component. Move up a directory -->
+    <unit bldFile="bluetoothengine/btnotif/btnotifclient/group"/>
+   </component>
+   <component id="bteng" filter="s60" name="Bluetooth Engine">
+    <unit bldFile="bluetoothengine/bteng/group"/>
+   </component>
+   <component id="btserviceutil" filter="s60" name="Bluetooth Service Utils" introduced="^4">
+    <unit bldFile="bluetoothengine/btserviceutil/group" filter="!test"/>
+    <unit bldFile="bluetoothengine/btserviceutil/tsrc/btserviceutiltest/group"  filter="test,api_test"/>
+   </component>
+   <component id="btnotif" filter="s60" name="Bluetooth Notifier">
+    <unit bldFile="bluetoothengine/btnotif/group"/>
+   </component>
+   <!-- btdevicedialogplugin is a component, under another component (btnotif)- this is a coding standards violation -->
+   <component id="btdevicedialogplugin" filter="s60" name="Bluetooth Device Dialog Plugin" class="plugin" introduced="^4">
+    <unit bldFile="bluetoothengine/btnotif/btdevicedialogplugin" qt:proFile="btdevicedialogplugin.pro"/>
+   </component>
+   <component id="btaudioman" filter="s60" name="Bluetooth Audio Manager">
+    <unit bldFile="bluetoothengine/btaudioman/group" filter="!test"/>
+    <unit bldFile="bluetoothengine/btaudioman/tsrc/btAudioManApiTest/group"  filter="test,api_test"/>
+   </component>
+   <component id="btmac" filter="s60" name="Bluetooth Mono Audio Controller" class="plugin">
+    <unit bldFile="bluetoothengine/btmac/group"/>
+   </component>
+   <component id="btsac" filter="s60" name="Bluetooth Stereo Audio Controller" class="plugin">
+    <unit bldFile="bluetoothengine/btsac/group"/>
+   </component>
+   <component id="btaudiostreamer" filter="s60" name="Bluetooth Audio Streamer">
+    <unit bldFile="bluetoothengine/btaudiostreamer/group" filter="!test"/>
+    <unit bldFile="bluetoothengine/btaudiostreamer/tsrc/BtAudioStreamerApiTest/group" filter="test,api_test"/>
+   </component>
+   <component id="btsap" filter="s60" name="Bluetooth SIM Access Profile" class="plugin">
+    <unit bldFile="bluetoothengine/btsap/group"/>
+   </component>
+   <component id="btui" filter="s60" name="Bluetooth UI">
+	 <unit  bldFile="bluetoothengine/btui" qt:proFile="btui.pro" />
+   </component>
+   <component id="btpbap" filter="s60" name="Bluetooth Phonebook Access Profile" class="plugin">
+    <unit bldFile="bluetoothengine/btpbap/group"/>
+   </component>
+   <component id="bthid" filter="s60" name="Bluetooth HID">
+    <unit bldFile="bluetoothengine/bthid/group"/>
+   </component>
+   <component id="btindicator" filter="s60" name="Bluetooth Indicator" introduced="^4">
+    <unit bldFile="bluetoothengine/btindicator" qt:proFile="btindicator.pro"/>
+   </component>
+   <component id="btctrldcmoadapter" filter="s60" name="Bluetooth Control DCMO Adapter" class="plugin" introduced="^3">
+    <unit bldFile="bluetoothengine/btctrldcmoadapter/group"/>
+   </component>
+  </collection>
+  <collection id="bluetoothappprofiles" name="Bluetooth Application Profiles" level="plugin">
+   <component id="avrcp" name="Bluetooth AVRCP" introduced="9.1" purpose="optional">
+    <unit bldFile="bluetoothappprofiles/avrcp" mrp="bluetoothappprofiles/avrcp/bluetooth_avrcp.mrp"/>
+   </component>
+  </collection>
+  <collection id="atcommands" name="AT Commands" level="generic">
+   <component id="modematplugin" name="Modem AT Plugin" filter="s60" class="plugin" introduced="^4">
+    <unit bldFile="atcommands/modematplugin/group"/>
+   </component>
+   <component id="lccustomplugin" name="LC Custom Plugin" filter="s60" class="plugin" introduced="^4">
+    <unit bldFile="atcommands/lccustomplugin/group"/>
+   </component>
+  </collection>
+  <collection id="cbsatplugin" name="CBS AT Plugin" level="plugin">
+     <component id="atmisccmdplugin" name="AT Misc Commands Plugin"  filter="s60" class="plugin" introduced="^4">
+      <unit bldFile="cbsatplugin/atmisccmdplugin/group"/>
+     </component>
+  </collection>
+  <collection id="btobexprofiles" name="BT OBEX Profiles" level="generic">
+     <component id="obexreceiveservices" name="OBEX Receive Services"  filter="s60">
+      <unit bldFile="btobexprofiles/obexreceiveservices/group"/>
+     </component>
+     <!-- Move this up to btobexprofiles/btmsgviewer, because obexreceiveservices is already a cpt and you can't have components inside components -->
+     <component id="btmsgviewer" name="BT message viewer"  filter="s60" introduced="^4">
+      <unit bldFile="btobexprofiles/obexreceiveservices/btmsgviewer" qt:proFile="btmsgviewer.pro"/>
+     </component>
+     <component id="obexsendservices" name="OBEX Send Services"  filter="s60">
+      <unit bldFile="btobexprofiles/obexsendservices/group"/>
+     </component>
+     <component id="obexhighway" name="OBEX Highway"  filter="s60" introduced="^4">
+		<!-- should be moved out from under obexsendservices into own component dir -->
+        <unit bldFile="btobexprofiles/obexsendservices/obexhighway" qt:proFile="obexhighway.pro"/>
+     </component>
+     <component id="obexserviceman" name="OBEX Service Manager"  filter="s60">
+      <unit bldFile="btobexprofiles/obexserviceman/group"/>
+     </component>
+  </collection>
+  <collection id="btservices_info" name="BT Services Info" level="plugin">
+   <component id="btservices_metadata" name="BT Services Metadata" class="config" introduced="^3" purpose="development" target="desktop">
+    <unit mrp="btservices_info/btservices_metadata/btservices_metadata.mrp"/>
+   </component>
+  </collection>
+ </package>
 </SystemDefinition>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml	Fri Jul 23 15:57:13 2010 +0300
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<PackageMap root="sf" layer="mw" />
\ No newline at end of file