91 Device dialog framework calls this function before creating or attaching client to a |
91 Device dialog framework calls this function before creating or attaching client to a |
92 plugin if HbDeviceDialogPlugin::SecurityCheck is set. Access is denied if the |
92 plugin if HbDeviceDialogPlugin::SecurityCheck is set. Access is denied if the |
93 function returns false. In addition, HbDeviceDialogPlugin constructor has a check which |
93 function returns false. In addition, HbDeviceDialogPlugin constructor has a check which |
94 allows only device dialog service to load plugins derived from it. |
94 allows only device dialog service to load plugins derived from it. |
95 |
95 |
|
96 \section _exceptions Exception handling |
|
97 |
|
98 Device dialog service uses two strategies in exception handling: Avoidance and trapping. |
|
99 Memory allocation exceptions while a dialog is running are avoided by ensuring there is |
|
100 sufficient heap space available before allowing new dialogs. Trapping is used while |
|
101 a dialog is created. A call to createDeviceDialog() is enclosed in try/catch block. |
|
102 Memory allocation exception causes dialog creation to fail and an error is returned |
|
103 to a client. Plugin should take care there are no memory leaks if exception is thrown |
|
104 inside createDeviceDialog(). All calls to HbDeviceDialogInterface functions are trapped |
|
105 and thrown allocation exceptions are ignored. Plugins can provide more fine grained |
|
106 exception handling by trapping exceptions themselves. |
|
107 |
96 \section _checklist Checklist for well behaving device dialogs |
108 \section _checklist Checklist for well behaving device dialogs |
|
109 |
|
110 Well behaving plugin should observe following rules: |
|
111 - Delay plugin initializations until HbDeviceDialogPluginInterface::createDeviceDialog() is |
|
112 called. Plugin may be loaded/unloaded several times by different threads during plugin search. |
|
113 The search is slowed down by unnessary initializations by plugins. |
97 |
114 |
98 Well behaving dialog widget should observe following rules: |
115 Well behaving dialog widget should observe following rules: |
99 - Should not create and show other dialogs |
116 - Should not create and show other dialogs |
100 - No calls to show(), hide() or setVisible() |
117 - No calls to show(), hide() or setVisible() |
101 - Not setting popup Z-order |
118 - Not setting popup Z-order |
661 #include <hbdevicedialoginterface.h> |
678 #include <hbdevicedialoginterface.h> |
662 #ifdef Q_OS_SYMBIAN |
679 #ifdef Q_OS_SYMBIAN |
663 #include <e32base.h> |
680 #include <e32base.h> |
664 #endif // Q_OS_SYMBIAN |
681 #endif // Q_OS_SYMBIAN |
665 |
682 |
666 // Constructor |
683 /*! |
|
684 Constructs HbDeviceDialogPlugin. |
|
685 */ |
667 HbDeviceDialogPlugin::HbDeviceDialogPlugin() |
686 HbDeviceDialogPlugin::HbDeviceDialogPlugin() |
668 { |
687 { |
669 #ifdef Q_OS_SYMBIAN |
688 #ifdef Q_OS_SYMBIAN |
670 // Check loading process secure ID. Panic if not device dialog server. |
689 // Check loading process secure ID. Panic if not device dialog server. |
671 const TUint32 sid = 0x20022FC5; |
690 const TUint32 sid = 0x20022FC5; |