@@ -164,6 +164,9 @@ Ext.define("conjoon.cn_mail.app.PackageController", {
164
164
} ,
165
165
166
166
control : {
167
+ "cn_mail-mailaccountwizard" : {
168
+ "show" : "onMailAccountWizardShownOrClosed"
169
+ } ,
167
170
"cn_mail-maildesktopview" : {
168
171
tabchange : "onMailDesktopViewTabChange"
169
172
} ,
@@ -233,6 +236,9 @@ Ext.define("conjoon.cn_mail.app.PackageController", {
233
236
} , {
234
237
ref : "toggleGridListButton" ,
235
238
selector : "cn_navport-tbar > #cn_mail-nodeNavToggleList"
239
+ } , {
240
+ ref : "toggleMailFolderButton" ,
241
+ selector : "cn_navport-tbar > #cn_mail-nodeNavToggleFolder"
236
242
} , {
237
243
ref : "switchReadingPaneButton" ,
238
244
selector : "cn_navport-tbar > #cn_mail-nodeNavReadingPane"
@@ -254,6 +260,9 @@ Ext.define("conjoon.cn_mail.app.PackageController", {
254
260
} , {
255
261
ref : "deleteButton" ,
256
262
selector : "cn_navport-tbar > #cn_mail-nodeNavDeleteMessage"
263
+ } , {
264
+ ref : "addMailAccountButton" ,
265
+ selector : "cn_navport-tbar > #cn_mail-addMailAccountBtn"
257
266
} ] ,
258
267
259
268
@@ -327,9 +336,7 @@ Ext.define("conjoon.cn_mail.app.PackageController", {
327
336
// we have not an inbox view. By default, disable all buttons.
328
337
// they will either be re-activated instantly or once any of the
329
338
// view's or editor's item/draft was loaded
330
- me . disableEmailActionButtons ( true ) ;
331
- me . disableEmailEditButtons ( true ) ;
332
-
339
+ me . disableMessageItemContextButtons ( true ) ;
333
340
334
341
if ( activatedPanel . isCnMessageEditor ) {
335
342
@@ -418,8 +425,7 @@ Ext.define("conjoon.cn_mail.app.PackageController", {
418
425
if ( selection . length ) {
419
426
me . activateButtonsForMessageItem ( selection [ 0 ] ) ;
420
427
} else {
421
- me . disableEmailActionButtons ( true ) ;
422
- me . disableEmailEditButtons ( true ) ;
428
+ me . disableMessageItemContextButtons ( true ) ;
423
429
}
424
430
} ,
425
431
@@ -474,8 +480,7 @@ Ext.define("conjoon.cn_mail.app.PackageController", {
474
480
toggleDisabled = true ;
475
481
476
482
if ( accountSelected ) {
477
- me . disableEmailActionButtons ( true ) ;
478
- me . disableEmailEditButtons ( true ) ;
483
+ me . disableMessageItemContextButtons ( true ) ;
479
484
}
480
485
} else if ( me . getMailMessageGrid ( ) . getStore ( ) . isLoading ( ) ) {
481
486
toggleDisabled = true ;
@@ -634,8 +639,7 @@ Ext.define("conjoon.cn_mail.app.PackageController", {
634
639
me . getToggleGridListButton ( ) . setDisabled ( accountSelected ) ;
635
640
636
641
if ( accountSelected ) {
637
- me . disableEmailActionButtons ( true ) ;
638
- me . disableEmailEditButtons ( true ) ;
642
+ me . disableMessageItemContextButtons ( true ) ;
639
643
} else {
640
644
me . activateButtonsForMessageGrid ( ) ;
641
645
}
@@ -657,8 +661,14 @@ Ext.define("conjoon.cn_mail.app.PackageController", {
657
661
return ;
658
662
}
659
663
660
- me . disableEmailActionButtons ( true ) ;
661
- me . disableEmailEditButtons ( true ) ;
664
+ me . disableMessageItemContextButtons ( true ) ;
665
+ } ,
666
+
667
+
668
+ disableMessageItemContextButtons ( disable ) {
669
+ const me = this ;
670
+ me . disableEmailActionButtons ( disable ) ;
671
+ me . disableEmailEditButtons ( disable ) ;
662
672
} ,
663
673
664
674
@@ -909,20 +919,55 @@ Ext.define("conjoon.cn_mail.app.PackageController", {
909
919
/**
910
920
* Callback for the node navigation's "add mail account"-button.
911
921
*
912
- * @param {Ext.Button } btn
913
- *
914
922
* @return {Boolean }
915
923
*/
916
- onAddMailAccountBtnClick ( btn ) {
917
-
924
+ onAddMailAccountBtnClick ( ) {
918
925
const me = this ;
926
+ me . getMainPackageView ( ) . showMailAccountWizard ( ) ;
927
+ } ,
919
928
920
- if ( ! me . mailAccountHandler . enabled ( ) ) {
921
- return false ;
929
+
930
+ /**
931
+ * Callback for the show/close event of the MailAccountWizard.
932
+ * Will enable/disable toolbar buttons based on the visibiliyt state and the state
933
+ * of available MailAccounts.
934
+ *
935
+ * @param {conjoon.cn_mail.view.mail.account.MailAccountWizard } wizard
936
+ */
937
+ onMailAccountWizardShownOrClosed ( wizard ) {
938
+ const
939
+ me = this ,
940
+ btn = me . getAddMailAccountButton ( ) ,
941
+ isVisible = wizard . isVisible ( ) ,
942
+ activeAccount = conjoon . cn_mail . store . mail . folder . MailFolderTreeStore . getInstance ( ) . findFirstActiveMailAccount ( ) ;
943
+
944
+ if ( isVisible ) {
945
+ wizard . on ( "close" , me . onMailAccountWizardShownOrClosed , me , { single : true } ) ;
922
946
}
923
947
924
- me . mailAccountHandler . invoke ( btn ) ;
925
- return true ;
948
+ if ( btn ) {
949
+ btn . setDisabled ( isVisible ) ;
950
+ }
951
+ me . disableUiControlButtons ( isVisible ) ;
952
+
953
+ me . getCreateMessageButton ( ) . setDisabled (
954
+ isVisible || ! activeAccount
955
+ ) ;
956
+
957
+ if ( isVisible ) {
958
+ me . disableMessageItemContextButtons ( true ) ;
959
+ } else {
960
+ me . activateButtonsForMessageGrid ( ) ;
961
+ }
962
+ } ,
963
+
964
+
965
+ disableUiControlButtons ( disable ) {
966
+ const me = this ;
967
+
968
+ me . getSwitchReadingPaneButton ( ) . setDisabled ( disable ) ;
969
+ me . getToggleGridListButton ( ) . setDisabled ( disable ) ;
970
+ me . getToggleMailFolderButton ( ) . setDisabled ( disable ) ;
926
971
} ,
927
972
928
973
0 commit comments