From c8cfe6464efd1bb26badd06c1bb310484681d3e0 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Sat, 11 Jan 2014 14:16:36 +0000 Subject: [PATCH] Bind to nextmatch refresh event to update folder status too --- mail/inc/class.mail_ui.inc.php | 4 +--- mail/js/app.js | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 3f355fbc34..0a1ea74077 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -1334,8 +1334,6 @@ unset($query['actions']); if ($GLOBALS['egw_info']['user']['preferences']['common']['select_mode']=='EGW_SELECTMODE_TOGGLE') unset($cols[0]); $rows = $this->header2gridelements($sortResult['header'],$cols, $_folderName, $folderType=$toSchema,$previewMessage); //error_log(__METHOD__.__LINE__.array2string($rows)); - $response = egw_json_response::get(); - $response->call('app.mail.mail_refreshFolderStatus',array('_nodeID'=>$_profileID.self::$delimiter.$_folderName,'mode'=>null,'_refreshGridArea'=>false),'mail'); $endtime = microtime(true) - $starttime; //error_log(__METHOD__.__LINE__. " time used: ".$endtime.' for Folder:'.$_folderName.' Start:'.$query['start'].' NumRows:'.$query['num_rows']); @@ -3238,7 +3236,7 @@ blockquote[type=cite] { if ($oA) { $response = egw_json_response::get(); - $response->call('app.mail.mail_setFolderStatus',$oA,'mail'); + $response->call('app.mail.mail_setFolderStatus',$oA); } } } diff --git a/mail/js/app.js b/mail/js/app.js index 8caafe0750..0458950099 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -75,6 +75,12 @@ app.classes.mail = AppJS.extend( */ destroy: function() { + // Unbind from nm refresh + var nm = this.et2.getWidgetById('nm'); + if(nm != null) + { + $j(nm).off('refresh'); + } delete this.et2; delete this.et2_obj; // call parent @@ -117,20 +123,14 @@ app.classes.mail = AppJS.extend( if (isMainView) { this.mail_disablePreviewArea(true); - this.mail_startTimerFolderStatusUpdate(this.mail_refreshTimeOut); - //inital call of refresh folderstatus - var self = this; - window.setTimeout(function() { - self.mail_refreshFolderStatus.call(self,undefined,undefined,false); - },1000); - // intention was, to enable drag and drop with the tree - // and then somehow hook into the event and do the server side action - // does not work here at that time, do not know why, so we go for - // the traditional way of a rightclick action on the tree - //var tree_wdg = this.et2.getWidgetById(this.nm_index+'[foldertree]'); - //tree_wdg.enableDragAndDrop(true,false); - //tree_wdg.setDragBehavior('child',true); - //tree_wdg.enableDragAndDropScrolling(true); + + // Bind to nextmatch refresh to update folder status + var nm = this.et2.getWidgetById('nm'); + if(nm != null) + { + var self = this; + $j(nm).on('refresh',function() {self.mail_refreshFolderStatus.call(self,undefined,undefined,false);}); + } } if (isDisplay) {