107 addDisposeListener(); |
107 addDisposeListener(); |
108 handleNetworkConfigurationChange(); |
108 handleNetworkConfigurationChange(); |
109 handleCallInformationChanged(); |
109 handleCallInformationChanged(); |
110 } |
110 } |
111 |
111 |
|
112 private static Display getDisplay() { |
|
113 Display display; |
|
114 display = Internal_PackageSupport.getInternalDisplayInstance(); |
|
115 if(display == null) { |
|
116 display = Internal_PackageSupport.getDisplayInstance(); |
|
117 } |
|
118 return display; |
|
119 } |
|
120 |
112 private static void addDisposeListener() { |
121 private static void addDisposeListener() { |
113 Display display = Internal_PackageSupport.getDisplayInstance(); |
|
114 disposeListener = new Listener() { |
122 disposeListener = new Listener() { |
115 public void handleEvent(Event event) { |
123 public void handleEvent(Event event) { |
116 destroy(); |
124 destroy(); |
117 } |
125 } |
118 }; |
126 }; |
119 display.addListener(SWT.Dispose, disposeListener); |
127 getDisplay().addListener(SWT.Dispose, disposeListener); |
120 } |
128 } |
121 |
129 |
122 private static void removeDisposeListener() { |
130 private static void removeDisposeListener() { |
123 if(disposeListener != null) { |
131 if(disposeListener != null) { |
124 Display display = Internal_PackageSupport.getDisplayInstance(); |
132 Display display = getDisplay(); |
125 if(display != null && !display.isDisposed()) { |
133 if(display != null && !display.isDisposed()) { |
126 display.removeListener(SWT.Dispose, disposeListener); |
134 display.removeListener(SWT.Dispose, disposeListener); |
127 disposeListener = null; |
135 disposeListener = null; |
128 } |
136 } |
129 } |
137 } |
130 } |
138 } |
131 |
139 |
132 private static void checkThread() { |
140 private static void checkThread() { |
133 Display display = Internal_PackageSupport.getDisplayInstance(); |
141 Display display = getDisplay(); |
134 if(display == null) { |
142 if(display == null) { |
135 throw new RuntimeException("Display doesn't exist"); |
143 throw new RuntimeException("Display doesn't exist"); |
136 } |
144 } |
137 if(!display.getThread().equals(Thread.currentThread())) { |
145 if(!display.getThread().equals(Thread.currentThread())) { |
138 throw new RuntimeException("Not the UI thread"); |
146 throw new RuntimeException("Not the UI thread"); |
205 instance(); |
213 instance(); |
206 hook(listener); |
214 hook(listener); |
207 if(notifiedStates != 0) { |
215 if(notifiedStates != 0) { |
208 final NetworkStatusListener asyncNofityListener = listener; |
216 final NetworkStatusListener asyncNofityListener = listener; |
209 final int asyncNotifyStates = notifiedStates; |
217 final int asyncNotifyStates = notifiedStates; |
210 Internal_PackageSupport.getDisplayInstance().asyncExec(new Runnable() { |
218 getDisplay().asyncExec(new Runnable() { |
211 public void run() { |
219 public void run() { |
212 asyncNofityListener.stateChanged(asyncNotifyStates); |
220 asyncNofityListener.stateChanged(asyncNotifyStates); |
213 } |
221 } |
214 }); |
222 }); |
215 } |
223 } |
253 |
261 |
254 // Connect the signals |
262 // Connect the signals |
255 private void hookEvents() { |
263 private void hookEvents() { |
256 // Packet data connections |
264 // Packet data connections |
257 if(qNetworkConfigurationManagerHandle != 0) { |
265 if(qNetworkConfigurationManagerHandle != 0) { |
258 int signalProxy = org.eclipse.swt.internal.qt.OS.SignalHandler_new( |
266 int signalProxy = org.eclipse.swt.internal.qt.OS.SignalForwarder_new( |
259 qNetworkConfigurationManagerHandle, this, OS.QSIGNAL_NETWORKCONFIGURATIONCHANGED); |
267 qNetworkConfigurationManagerHandle, this, OS.QSIGNAL_NETWORKCONFIGURATIONCHANGED); |
260 org.eclipse.swt.internal.qt.OS.QObject_connectOrThrow( |
268 org.eclipse.swt.internal.qt.OS.QObject_connectOrThrow( |
261 qNetworkConfigurationManagerHandle, |
269 qNetworkConfigurationManagerHandle, |
262 "configurationAdded(const QNetworkConfiguration&)", |
270 "configurationAdded(const QNetworkConfiguration&)", |
263 signalProxy, "widgetSignal()", |
271 signalProxy, "widgetSignal()", |
274 org.eclipse.swt.internal.qt.OS.QT_AUTOCONNECTION); |
282 org.eclipse.swt.internal.qt.OS.QT_AUTOCONNECTION); |
275 } |
283 } |
276 |
284 |
277 // Voice calls |
285 // Voice calls |
278 if(xqCallInfoHandle != 0) { |
286 if(xqCallInfoHandle != 0) { |
279 int signalProxy = org.eclipse.swt.internal.qt.OS.SignalHandler_new( |
287 int signalProxy = org.eclipse.swt.internal.qt.OS.SignalForwarder_new( |
280 xqCallInfoHandle, this, OS.QSIGNAL_CALLINFORMATIONCHANGED); |
288 xqCallInfoHandle, this, OS.QSIGNAL_CALLINFORMATIONCHANGED); |
281 org.eclipse.swt.internal.qt.OS.QObject_connectOrThrow( |
289 org.eclipse.swt.internal.qt.OS.QObject_connectOrThrow( |
282 xqCallInfoHandle, |
290 xqCallInfoHandle, |
283 "callInformationChanged()", |
291 "callInformationChanged()", |
284 signalProxy, "widgetSignal()", |
292 signalProxy, "widgetSignal()", |