# HG changeset patch
# User hgs
# Date 1279889833 -10800
# Node ID 9e2a905b887f5be5ab040f9f8646d1ffca9440dd
# Parent b0aebde9b1fb46a1e0b255a352a014302d1fd6cc
201029_02
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btindicator/inc/btindicatorconstants.h
--- 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 */
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btindicator/rom/btindicator.iby
--- 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"
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btindicator/src/btindicatorplugin.cpp
--- 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;
}
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro
--- 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
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc
--- 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 @@
icons/qtg_large_bluetooth.svg
docml/bt-receive-auth-dialog.docml
docml/bt-recv-progress-dialog.docml
+ docml/bt-receive-done-dialog.docml
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml
--- 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 @@
+
-
+
+
+
+
@@ -40,15 +46,16 @@
-
+
+
-
+
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml
--- 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 @@
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-receive-done-dialog.docml
--- /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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-send-dialog.docml
--- 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 @@
+
-
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogrecvquerywidget.h
--- 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
#include
@@ -74,4 +74,4 @@
Q_DISABLE_COPY(BTRecvQueryDialogWidget)
};
-#endif /* BTDEVICEDIALOGRECVQUERYWIDGET_H_ */
+#endif /* BTDEVICEDIALOGRECVQUERYWIDGET_H */
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogutils.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
+#include
+#include
+
+// 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*/
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.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
#include
#include
+#include
+#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 ¶meters);
- 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 mDeviceTypeList;
- QList mDeviceList;
+
+ HbSelectionDialog *mQuery;
+// QList mDeviceTypeList;
+ QStringList mDevTypeList;
+// QList mDeviceList;
HbListView* mListView;
HbLabel* mSearchLabel;
HbLabel* mSearchIconLabel;
HbLabel* mSearchDoneLabel;
- bool mViewByChosen;
- QList mDeviceLstOfType;
- int mDeviceLstIdx;
- int mSelectedType;
- int mDeviceDialogData;
+// bool mViewByChosen;
+// QList 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)
};
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h
--- 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
#include
#include
@@ -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)
};
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvcompleteddialogwidget.h
--- /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
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+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 ¶meters);
+ ~BTRecvcompletedDialogWidget();
+
+public: // from HbDeviceDialogInterface
+ bool setDeviceDialogParameters(const QVariantMap ¶meters);
+ 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 ¶meters);
+
+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_ */
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvprgrsdialogwidget.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
#include
@@ -73,4 +73,4 @@
Q_DISABLE_COPY(BTRecvPrgrsDialogWidget)
};
-#endif /* BTRECVPRGRSDIALOGWIDGET_H_ */
+#endif /* BTRECVPRGRSDIALOGWIDGET_H */
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp
--- 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
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;
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp
--- 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
}
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp
--- 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
#include
-#include
+
#include
#include
#include
#include
#include
+#include
+#include
+#include
const char* DOCML_BTDEV_SEARCH_DIALOG = ":/docml/bt-device-search-dialog.docml";
@@ -39,13 +42,19 @@
BTDeviceSearchDialogWidget::BTDeviceSearchDialogWidget(const QVariantMap ¶meters)
{
- 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(mLoader->findWidget("iconLabel"));
- mSearchIconLabel->setIcon(icon());
+ mSearchIconLabel->setIcon(QIcon(QString(":/icons/qtg_large_bluetooth.svg")));
mSearchDoneLabel = qobject_cast(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( mLoader->findObject( "viewaction" ) );
- mViewByAction->disconnect(mSearchDevicesDialog);
+ mShowAction = static_cast( mLoader->findObject( "viewaction" ) );
+ mShowAction->disconnect(mSearchDevicesDialog);
mStopRetryAction = static_cast( mLoader->findObject( "stopretryaction" ) );
mStopRetryAction->disconnect(mSearchDevicesDialog);
- connect(mViewByAction, SIGNAL(triggered()), this, SLOT(viewByClicked()));
+// mCancelAction = static_cast( 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 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 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 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;isetData(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"));
- }
-
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp
--- 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
#include
#include
#include
#include
#include
-#include "btmoredevicesdialogwidget.h"
+#include
+#include
+#include
+
const char* DOCML_BT_MORE_DEV_DIALOG = ":/docml/bt-more-devices-dialog.docml";
@@ -55,21 +58,46 @@
bool BTMoreDevicesDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters)
{
- 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();
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvcompleteddialogwidget.cpp
--- /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
+#include
+#include
+#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 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 ¶meters)
+{
+ mLoader = 0;
+ constructDialog(parameters);
+}
+
+BTRecvcompletedDialogWidget::~BTRecvcompletedDialogWidget()
+{
+ if(mLoader)
+ {
+ delete mLoader;
+ mLoader = NULL;
+ }
+}
+
+bool BTRecvcompletedDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters)
+{
+ 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(this);
+}
+
+bool BTRecvcompletedDialogWidget::constructDialog(const QVariantMap ¶meters)
+{
+ mLoader = new HbDocumentLoader();
+ bool ok = false;
+
+ mLoader->load(DOCML_BT_RECV_CMPLTD_DIALOG, &ok);
+ if(ok)
+ {
+ mDialog = qobject_cast(mLoader->findWidget("recvCompleteddialog"));
+ mHeading = qobject_cast(mLoader->findWidget("heading"));
+
+ mFileName = qobject_cast(mLoader->findWidget("fileName"));
+ mFileSize = qobject_cast(mLoader->findWidget("fileSize"));
+ mFileCount = qobject_cast(mLoader->findWidget("fileCount_label"));
+ mFileCount->setVisible(false);
+
+ //TODO - set icon based on the file icon.
+
+ mShow = qobject_cast(mLoader->findObject("showaction"));
+ mCancel = qobject_cast(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();
+}
+
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp
--- 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();
}
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp
--- 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
#include
#include
#include
#include
#include
-#include "btsenddialogwidget.h"
#define LOC_SENDING_FILES_TO_DEVICE hbTrId("txt_bt_title_sending_file_l1l2_to_3")
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btnotifsrv/inc/btnotifdeviceselector.h
--- 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
#include "bluetoothnotification.h"
#include
+#include
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 iDevices;
+ RDevExtensionArray iDevices;
/**
* The message for a pending device selection request from a RNotifier client.
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btnotifsrv/inc/btnotifoutgoingpairinghandler.h
--- 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
#include "btnotifclientserver.h"
#include "btnotifBasePairingHandler.h"
+#include
+#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;
};
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btnotifsrv/src/btnotifbasepairinghandler.cpp
--- 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);
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp
--- 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
#include
#include
-#include
#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(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 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 keyStr;
+/* TBuf 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 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 keyStr;
- CHbSymbianVariant* devEntry;
+ // TBuf 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(aData.Get(_L("deviceaddress"))->Data()))));
+ devParams().SetDeviceAddress( address );
+ devParams().SetDeviceClass(*(static_cast(aData.Get(_L("deviceclass"))->Data())));
+ devParams().SetDeviceName(*(static_cast(aData.Get(_L("devicename"))->Data())));
+ User::LeaveIfError(iMessage.Write( EBTNotifSrvReplySlot, devParams ));
+ }
+
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp
--- 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
#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 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 );
+ }
+
+
+
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp
--- 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)
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btnotifsrv/src/btnotifsecuritymanager.cpp
--- 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;
}
}
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/btnotifsrv/src/btnotifserviceauthorizer.cpp
--- 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"
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btnotif/inc/bluetoothdevicedialogs.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();
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btsap/src/BTSapSniffHandler.cpp
--- 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);
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/btcpplugin.cpp
--- 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
-#include "btcpplugin.h"
#include "btcpuisettingitem.h"
/*!
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/btcpuidevicedetail.cpp
--- 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
#include
+
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::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::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::const_iterator i;
@@ -156,7 +176,6 @@
mDeviceDetailView->addItem((*i).mSettingForm);
}
}
-
}
void BtCpUiDeviceDetail::loadDeviceDetailsView()
@@ -203,4 +222,9 @@
}
+void BtCpUiDeviceDetail::sendCloseEvent()
+{
+ notifyViewStatusToPlugins(AboutToClose);
+}
+
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/btcpuidevicedetail.h
--- 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:
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.cpp
--- 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
#include
#include
@@ -23,7 +24,6 @@
#include
#include
#include
-#include "btcpuidevicedetailsview.h"
// docml to load
const char* BTUI_DEVICEDETAILSVIEW_DOCML = ":/docml/bt-device-details-view.docml";
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.h
--- 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
#include
@@ -50,4 +50,4 @@
Q_DISABLE_COPY(BtCpUiDeviceDetailsView)
};
-#endif /* BTCPUIDEVICEDETAILSVIEW_H_ */
+#endif /* BTCPUIDEVICEDETAILSVIEW_H */
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp
--- 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();
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)
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/btcpuideviceview.h
--- 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;
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/btcpuimainview.cpp
--- 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
#include
#include
+#include
#include "btcpuisearchview.h"
#include "btcpuideviceview.h"
#include
@@ -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( mLoader->findWidget( "groupBox" ) );
- BTUI_ASSERT_X( mGroupBox != 0, "bt-main-view", "Group Box not found" );
+ mDataForm = qobject_cast( mLoader->findWidget( "dataForm" ) );
+ BTUI_ASSERT_X( mDataForm != 0, "bt-main-view", "dataForm not found" );
- //*********************Testing device view START****************************//
- HbAction *removePairedDevices = static_cast( 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(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(
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/btcpuimainview.h
--- 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
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/btcpuisearchview.cpp
--- 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
#include
#include
+#include
#include
#include
#include
@@ -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( 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( 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( 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( 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( 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( 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( 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( 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(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( 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( 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)
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/btcpuisearchview.h
--- 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;
diff -r b0aebde9b1fb -r 9e2a905b887f bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml
--- 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 @@
-