3636 MuseUtils . MOD_EXCEPTION ,
3737 MuseUtils . MOD_JSPOLYFILL ,
3838 MuseUtils . MOD_JS ,
39- MuseUtils . MOD_CONFIG
39+ MuseUtils . MOD_CONFIG ,
40+ MuseUtils . MOD_QT
4041 ] ) ;
4142
4243 if ( typeof MuseSuperChar . Loader === "undefined" ) {
8182
8283 // Mutable state
8384 var scWidget = null ;
84-
85+ var isFormAlreadyStarted = false ;
8586 //--------------------------------------------------------------------
8687 // Get Object References From Screen Definitions
8788 //--------------------------------------------------------------------
@@ -150,12 +151,37 @@ try {
150151 //----------------------------------------------------------------
151152 // Connects/Disconnects
152153 //----------------------------------------------------------------
153- mywindow [ "saved(int)" ] . connect ( mySave ) ;
154+ if ( ! isFormAlreadyStarted ) {
155+ mywindow [ "saved(int)" ] . connect ( mySave ) ;
156+ }
154157 } ;
155158
156159 //--------------------------------------------------------------------
157160 // Public Interface -- Slots
158161 //--------------------------------------------------------------------
162+ pPublicApi . sModeUpdate = function ( pNewModeEnum ) {
163+ var resolvedMode = MuseUtils . getModeFromXtpEnumId ( pNewModeEnum ) ;
164+ var resolvedId = mywindow . id ( ) ;
165+
166+ if (
167+ [ "new" , "edit" , "view" ] . includes ( resolvedMode ) &&
168+ MuseUtils . isValidId ( resolvedId )
169+ ) {
170+ initSuperChar ( resolvedMode , resolvedId ) ;
171+ }
172+ } ;
173+
174+ pPublicApi . sNewId = function ( pNewId ) {
175+ var resolvedMode = MuseUtils . getModeFromXtpEnumId ( mywindow . mode ( ) ) ;
176+ var resolvedId = pNewId ;
177+
178+ if (
179+ [ "new" , "edit" , "view" ] . includes ( resolvedMode ) &&
180+ MuseUtils . isValidId ( resolvedId )
181+ ) {
182+ initSuperChar ( resolvedMode , resolvedId ) ;
183+ }
184+ } ;
159185
160186 //--------------------------------------------------------------------
161187 // Public Interface -- Functions
@@ -170,9 +196,20 @@ try {
170196
171197 if ( [ "new" , "edit" , "view" ] . includes ( myMode ) && scWidget !== null ) {
172198 initSuperChar ( myMode , mywindow . id ( ) ) ;
199+ } else if ( myMode == "releasePr" ) {
200+ initSuperChar (
201+ MuseUtils . getModeFromXtpEnumId ( mywindow . mode ( ) ) ,
202+ mywindow . id ( ) == - 1 ? null : mywindow . id ( )
203+ ) ;
173204 } else {
174205 return ;
175206 }
207+
208+ if ( ! isFormAlreadyStarted ) {
209+ mywindow [ "newMode(int)" ] . connect ( pPublicApi . sModeUpdate ) ;
210+ mywindow [ "newId(int)" ] . connect ( pPublicApi . sNewId ) ;
211+ isFormAlreadyStarted = true ;
212+ }
176213 } ;
177214
178215 //--------------------------------------------------------------------
0 commit comments