diff -r 12bc758d6a02 -r 25b8d29b7c59 telutils/dialpad/src/dialpadbluetootheventfilter.cpp --- a/telutils/dialpad/src/dialpadbluetootheventfilter.cpp Mon Oct 04 15:57:13 2010 +0300 +++ b/telutils/dialpad/src/dialpadbluetootheventfilter.cpp Fri Oct 15 13:21:28 2010 +0300 @@ -30,7 +30,7 @@ const QString BluetoothCharacter("*"); DialpadBluetoothEventFilter::DialpadBluetoothEventFilter(Dialpad* dialpad, QObject* parent) : - QObject(parent), mDialpad(dialpad) + QObject(parent), mDialpad(dialpad), mRequest(0) { PHONE_TRACE; mLongPressTimer = new QTimer(this); @@ -40,6 +40,8 @@ DialpadBluetoothEventFilter::~DialpadBluetoothEventFilter() { + delete mRequest; + mRequest = 0; } bool DialpadBluetoothEventFilter::eventFilter(QObject *watched, QEvent *event) @@ -68,12 +70,39 @@ PHONE_TRACE; mDialpad->editor().setText(QString("")); #ifdef Q_OS_SYMBIAN - XQApplicationManager appManager; - QScopedPointer request(appManager.create(BluetoothServiceName, BluetoothInterfaceTogglePower, - BluetoothTogglePower, false)); - if (request == NULL) { + if(mRequest == NULL) { + XQApplicationManager appManager; + mRequest = appManager.create(BluetoothServiceName, BluetoothInterfaceTogglePower, + BluetoothTogglePower, false); + } + + if (mRequest == NULL) { return; + } else { + connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(requestOk(const QVariant&))); + connect(mRequest, SIGNAL(requestError(int, const QString&)), this, SLOT(requestError(int, const QString&))); } - request->send(); + + mRequest->setSynchronous(false); + mRequest->send(); #endif // Q_OS_SYMBIAN } + +void DialpadBluetoothEventFilter::requestOk(const QVariant& value) +{ + PHONE_TRACE; + Q_UNUSED(value); + delete mRequest; + mRequest = 0; +} + +void DialpadBluetoothEventFilter::requestError(int errorCode, const QString& errorMessage) +{ + Q_UNUSED(errorCode); + Q_UNUSED(errorMessage); + PHONE_DEBUG2("DialpadBluetoothEventFilter::requestError - errorCode: ", errorCode); + PHONE_DEBUG2("DialpadBluetoothEventFilter::requestError - errorMessage: ", errorMessage); + delete mRequest; + mRequest = 0; +} +