equal
deleted
inserted
replaced
106 } else { |
106 } else { |
107 TRACE_EXIT_ARGS("error " << KErrNoMemory) |
107 TRACE_EXIT_ARGS("error " << KErrNoMemory) |
108 return KErrNoMemory; |
108 return KErrNoMemory; |
109 } |
109 } |
110 } |
110 } |
|
111 |
111 int error = mHbSession.Connect(); |
112 int error = mHbSession.Connect(); |
|
113 |
|
114 TRACE_EXIT_ARGS("error" << error) |
|
115 return error; |
|
116 } |
|
117 |
|
118 /*! |
|
119 \internal |
|
120 |
|
121 Connects to server asynchronously. |
|
122 */ |
|
123 |
|
124 int HbDeviceDialogPrivate::connect() |
|
125 { |
|
126 if (!iBuffer) { |
|
127 TRAP_IGNORE(iBuffer = HBufC8::NewL(64)); |
|
128 if (iBuffer) { |
|
129 iDataPtr.Set(iBuffer->Des()); |
|
130 } else { |
|
131 TRACE_EXIT_ARGS("error " << KErrNoMemory) |
|
132 return KErrNoMemory; |
|
133 } |
|
134 } |
|
135 |
|
136 int error(HbDeviceDialogNoError); |
|
137 |
|
138 if (!IsActive() && !iConnecting) { |
|
139 bool connected = mHbSession.Handle() != 0; |
|
140 error = mHbSession.Connect(&iStatus); |
|
141 |
|
142 // If not connected yet, connect and wait for eventloop to stop. Eventloop is |
|
143 // stopped in the RunL funtion. |
|
144 if (error == KErrNone && !connected && !mEventLoop) { |
|
145 iConnecting = ETrue; |
|
146 SetActive(); |
|
147 QPointer<HbDeviceDialog> guard = q_ptr; |
|
148 QEventLoop eventLoop; |
|
149 mEventLoop = &eventLoop; |
|
150 error = eventLoop.exec(QEventLoop::AllEvents); |
|
151 error = symToDeviceDialogError(error); |
|
152 if (guard.isNull()) { |
|
153 return false; |
|
154 } |
|
155 mEventLoop = 0; |
|
156 } |
|
157 } |
112 TRACE_EXIT_ARGS("error" << error) |
158 TRACE_EXIT_ARGS("error" << error) |
113 return error; |
159 return error; |
114 } |
160 } |
115 |
161 |
116 /*! |
162 /*! |
297 void HbDeviceDialogPrivate::RunL() |
343 void HbDeviceDialogPrivate::RunL() |
298 { |
344 { |
299 TRACE_ENTRY |
345 TRACE_ENTRY |
300 TInt completionCode = iStatus.Int(); |
346 TInt completionCode = iStatus.Int(); |
301 int errorCode = symToDeviceDialogError(completionCode); |
347 int errorCode = symToDeviceDialogError(completionCode); |
|
348 if (iConnecting) { |
|
349 iConnecting = EFalse; |
|
350 if (mEventLoop && mEventLoop->isRunning()) { |
|
351 mEventLoop->exit(errorCode); |
|
352 } |
|
353 return; |
|
354 } |
302 |
355 |
303 if (completionCode < KErrNone) { |
356 if (completionCode < KErrNone) { |
304 // Any Symbian error, stop requesting |
357 // Any Symbian error, stop requesting |
305 iRequesting = EFalse; |
358 iRequesting = EFalse; |
306 setError(errorCode); |
359 setError(errorCode); |