Index: trunk/prototype/modules/mail/interceptors/Helpers.php
===================================================================
--- trunk/prototype/modules/mail/interceptors/Helpers.php	(revision 5625)
+++ trunk/prototype/modules/mail/interceptors/Helpers.php	(revision 5697)
@@ -109,5 +109,6 @@
 					/**
 					 * Devido hÃ¡ inconsistencias na chamada do interceptor addDefaultElementsFilter (followupflag:before.find)
-					 * os followupflag defaults 
+					 * os followupflag defaults sÃ£o inseridos no retorno, por isso Ã© necessÃ¡rio procurar o objeto correto
+					 * atravÃ©s do id
 					 */
 					foreach ($followupflags as $followupflag) {
@@ -186,7 +187,7 @@
 	}
 
-	//followupflagged:before.create
+	//followupflagged:Imap.before.create
 	public function letFollowupflaggedKeepUnique (&$uri , &$params , &$criteria , $original ){
-	
+
 		if (isset($params['folderName']) && isset($params['messageNumber'])) {
 			$filter = array ('AND', array('=', 'folderName', $params['folderName']), array('=', 'messageNumber', $params['messageNumber']));
@@ -195,5 +196,5 @@
 			//ObtÃ©m do banco um possÃ­vel sinalizador existente
 			$imap_result = Controller::find($toClearURI, false, array('filter' => $filter));
-
+			
 			//Se existe um sinalizador nesta mensagem, deleta-o
 			foreach ($imap_result as $r) {
@@ -243,22 +244,13 @@
 	//followupflagged:PostgreSQL.before.delete
 	public function doImapDelete( &$uri , &$params , &$criteria , $original ) {
-		$toGetURI = $uri;
-		$flagged = Controller::read($toGetURI);
-
-		//assumindo que $criteria['filter'] venha sempre vazio no delete
-		$imap_criteria['filter'] = array();
-		foreach ($flagged as $key => $value) {
-			$imap_criteria['filter'][] = array('=', $key, $value); 
-		}
-		if($imap_criteria['filter']) array_unshift($imap_criteria['filter'], 'AND');
-		
-		$imap_uri = $uri;
-		$imap_uri['service'] = 'Imap';
-		if ($flagged && $flagged['id']) {
-			$flagged['id']  = $flagged['folderName'] . '/' . $flagged['messageNumber'] . '#' . $flagged['id']; 
-			$imap_uri['id'] = $flagged['id']; 
-		}
-
-		$result = Controller::delete($imap_uri, $params, $imap_criteria);		
+
+		$imap_uri = $uri;
+		$imap_uri['service'] = 'Imap';
+		list($messageId, $uri['id']) = explode('#', $uri['id']);
+
+		$result = Controller::delete($imap_uri, $params, $imap_criteria);
+
+		if (!$result)
+			return false;
 	}
 	
Index: trunk/prototype/modules/mail/js/foldertree.js
===================================================================
--- trunk/prototype/modules/mail/js/foldertree.js	(revision 5663)
+++ trunk/prototype/modules/mail/js/foldertree.js	(revision 5697)
@@ -106,5 +106,9 @@
 			selected = target.attr('id');
 			change_folder(target.attr('id'), child.attr('title'));	
+		
+		}).filter('.followup-messages').click(function(event, ui){
+			search_emails("UNDELETED KEYWORD \"$Followupflagged\"");
 		}).end();
+		
 		folders_html.find('[id="'+selected+'"]').children().addClass("selected").end().end().find("li:first").find(".folder").not(".head_folder,.inbox,.drafts,.sent,.spam,.trash").draggable({
 			// DRAG DE PASTAS
Index: trunk/prototype/modules/mail/js/followupflag.js
===================================================================
--- trunk/prototype/modules/mail/js/followupflag.js	(revision 5674)
+++ trunk/prototype/modules/mail/js/followupflag.js	(revision 5697)
@@ -271,9 +271,9 @@
 	.filter('.menu-configure-followupflag .delete').click(function(){
 		if (selectedMessageIds.length == 0) $(this).button("option", "disabled", true);
-			/** TODO Mudar quando melhorias forem implementadas na API de atualização do cache */
-			DataLayer.remove('followupflagged', false);
-			DataLayer.get('followupflagged');
-			var roles = get_selected_messages_search_role().split(',');
-			for (var i=0; i < selectedMessageIds.length; i++ ){
+		/** TODO Mudar quando melhorias forem implementadas na API de atualização do cache */
+		DataLayer.remove('followupflagged', false);
+		//DataLayer.get('followupflagged');
+		var roles = get_selected_messages_search_role().split(',');
+		for (var i=0; i < selectedMessageIds.length; i++ ){
 				if (currentTab == 0) {
 					folder_name = current_folder;
@@ -288,5 +288,18 @@
 				if(onceOpenedHeadersMessages[folder_name][messageNumber]['followupflagged'].id){
 					var flag_id = onceOpenedHeadersMessages[folder_name][messageNumber]['followupflagged'].id;
-					DataLayer.remove('followupflagged', flag_id);
+					//DataLayer.remove('followupflagged', folder_name + '/' + messageNumber + '#' + flag_id );
+					/**
+					 * TODO - corrigir o formato do ID no DataLayer, para que seja utilizado o ID composto
+					 * ao invés do ID do PostgreSQL atualmente em uso.
+					 */
+					 
+					/**
+					 * # hack necessário enquanto o DataLayer não reconhece o ID composto. Trocar o 
+					 * código abaixo pela chamada trivial de DataLayer.remove('followupflagged', idCompost)
+					 */
+					var data = {};
+					data[ 'followupflagged://' + folder_name + '/' + messageNumber + '#' + flag_id ] = false;
+					DataLayer.dispatch('Sync', data, false, true);
+					
 					if(current_folder == folder_name){
 						$('#td_message_followup_' + messageNumber + ', ' + 
Index: trunk/prototype/modules/mail/templates/detailedfoldertree.ejs
===================================================================
--- trunk/prototype/modules/mail/templates/detailedfoldertree.ejs	(revision 5533)
+++ trunk/prototype/modules/mail/templates/detailedfoldertree.ejs	(revision 5697)
@@ -52,5 +52,5 @@
   </li>
   <%}%>
-  <li><span class="folder head_folder all_accomp">Para acompanhamento</span>
+  <li><span class="folder head_folder all_accomp followup-messages">Para acompanhamento</span>
   </li>
 </ul>
