Index: /trunk/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- /trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 1751)
+++ /trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 1752)
@@ -90,6 +90,9 @@
 			{
 				$temp = $this->get_info_head_msg($msg_number);
+				$temp['msg_sample'] = $this->get_msg_sample($msg_number,$folder);
 				if(!$temp)
+				{
 					return false;
+				}
 
 				$return[$i] = $temp;
@@ -704,4 +707,65 @@
 		$return['login'] = $_SESSION['phpgw_info']['expressomail']['user']['account_id'];//$GLOBALS['phpgw_info']['user']['account_id'];
 		$return['reply_toaddress'] = $header->reply_toaddress;
+		return $return;
+	}
+
+	function get_msg_sample($msg_number,$folder)
+	{
+
+
+		include_once("class.message_components.inc.php");
+		$msg = &new message_components($this->mbox);
+		$msg->fetch_structure($msg_number);
+		$return = "";
+
+		if( (isset($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['preview_msg_subject']) && ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['preview_msg_subject'] == "0")) && (isset($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['preview_msg_tip']) && ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['preview_msg_tip'] == "0")) )
+		{
+		//	$return['preview_msg_subject'] = "";
+		//	$return['preview_msg_tip'] = "";
+			$return['body'] = "";
+			return $return;
+		/*} else{
+			if( isset($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['preview_msg_subject']) && ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['preview_msg_subject'] == "0") )
+			{
+				$return['preview_msg_subject'] = "";
+			}
+
+			if( isset($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['preview_msg_tip']) && ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['preview_msg_tip'] == "0") )
+			{
+				$return['preview_msg_tip'] = "";
+			}
+*/
+		}
+
+
+
+		if(!$msg->structure[$msg_number]->parts)
+		{
+			$content = '';
+			if (strtolower($msg->structure[$msg_number]->subtype) == "plain" || strtolower($msg->structure[$msg_number]->subtype) == "html")
+			{
+				$content = $this->decodeBody(imap_body($this->mbox, $msg_number, FT_UID|FT_PEEK), $msg->encoding[$msg_number][0], $msg->charset[$msg_number][0]);
+			}
+		}
+		else
+		{
+			foreach($msg->pid[$msg_number] as $values => $msg_part)
+			{
+
+				$file_type = strtolower($msg->file_type[$msg_number][$values]);
+				if($file_type == "text/plain" || $file_type == "text/html") {
+					$content = $this->decodeBody(imap_fetchbody($this->mbox, $msg_number, $msg_part, FT_UID|FT_PEEK), $msg->encoding[$msg_number][$values], $msg->charset[$msg_number][$values]);
+					break;
+				}
+			}
+		}
+		$content = $this->replace_special_characters($content);
+		$tags_replace = array("<br>","<br/>","<br />");
+		$content = str_replace($tags_replace," ", $content);
+		$content = strip_tags($content);
+		$content = str_replace(array("{","}","&nbsp;"), " ", $content);
+		$content = trim($content);
+		$content = substr($content,0,300);
+		$content != "" ? $return['body'] = " - " . $content: $return['body'] = "";
 		return $return;
 	}
@@ -1374,4 +1438,7 @@
 			$flag = preg_match('/importance *: *(.*)\r/i', $tempHeader, $importance);
 			$return[$i]['Importance'] = $flag==0?"Normal":$importance[1];
+
+			$msg_sample = $this->get_msg_sample($msg_number);
+			$return[$i]['msg_sample'] = $msg_sample;
 
 			$header = $this->get_header($msg_number);
Index: /trunk/expressoMail1_2/inc/hook_settings.inc.php
===================================================================
--- /trunk/expressoMail1_2/inc/hook_settings.inc.php	(revision 1747)
+++ /trunk/expressoMail1_2/inc/hook_settings.inc.php	(revision 1752)
@@ -73,4 +73,12 @@
 
 create_select_box('What is the maximum number of messages per page?','max_email_per_page',$default,'This is the number of messages shown in your mailbox per page');
+
+//$default = 0;
+create_check_box('Preview message text within subject column','preview_msg_subject','this exhibits a sample of message within the message subject column');
+
+//$default = 0;
+create_check_box('Preview message text within a tool-tip box','preview_msg_tip','this exhibits a sample of message within a tool-tip box');
+
+
 create_check_box('Save deleted messages in trash folder?','save_deleted_msg','When delete message, send it automatically to trash folder');
 $default = array(
Index: /trunk/expressoMail1_2/js/messages_proxy.js
===================================================================
--- /trunk/expressoMail1_2/js/messages_proxy.js	(revision 1691)
+++ /trunk/expressoMail1_2/js/messages_proxy.js	(revision 1752)
@@ -9,8 +9,8 @@
  * Retorna os cabeçalhos das mensagens a serem desenhadas na caixa de email.
  */
-	messages_proxy.prototype.messages_list = function(folder,msg_range_begin,emails_per_page,sort_box_type,search_box_type,sort_box_reverse,call_back) {
+	messages_proxy.prototype.messages_list = function(folder,msg_range_begin,emails_per_page,sort_box_type,search_box_type,sort_box_reverse,preview_msg_subject,preview_msg_tip,call_back) {
 		if(this.is_local_folder(folder)) {
 			var real_folder = folder.substr(6);		
-			var msgs = expresso_local_messages.get_local_range_msgs(real_folder,msg_range_begin,preferences.max_email_per_page,sort_box_type,sort_box_reverse,search_box_type);
+			var msgs = expresso_local_messages.get_local_range_msgs(real_folder,msg_range_begin,preferences.max_email_per_page,sort_box_type,sort_box_reverse,search_box_type,preferences.preview_msg_subject,preferences.preview_msg_tip);
 			eval('call_back(msgs)');
 		}else {
Index: /trunk/expressoMail1_2/js/local_messages.js
===================================================================
--- /trunk/expressoMail1_2/js/local_messages.js	(revision 1747)
+++ /trunk/expressoMail1_2/js/local_messages.js	(revision 1752)
@@ -445,4 +445,7 @@
 			var head = rs.field(1);
 			var codigoMail = rs.field(0);
+
+			var msg_body = rs.field(5);//recebe o conteudo da coluna "body" do banco de dados;
+
 			var rs2 = this.dbGears.execute('select count(*) from anexo where id_mail = '+codigoMail);
 			var head_unserialized = connector.unserialize(head);
@@ -451,8 +454,25 @@
 				head_unserialized.Unseen = 'U';		
 			
+
+			head_unserialized.subject=(head_unserialized.subject==null)?"":head_unserialized.subject;
+
 			//var email_unserialized = connector.unserialize(email);
 			retorno[cont] = head_unserialized;
 			retorno[cont]['msg_number'] = codigoMail;
 			
+			//declaracao do array() para receber o body de cada mensagem encontrada na busca sql realizada;
+			msg_body=this.strip_tags(msg_body);
+			msg_body=msg_body.replace(/\&nbsp;/ig," ");
+			retorno[cont]['msg_sample'] = new Array();
+
+			if( (preview_msg_subject == 0) && (preview_msg_tip == 0) )
+			{
+				retorno[cont]['msg_sample']['body'] = "";
+			}
+			else
+			{
+				retorno[cont]['msg_sample']['body'] = " - " + msg_body.substr(3,300);
+			}
+
 			cont++;
 		  	rs.next();
@@ -1046,5 +1066,5 @@
             while(rs.isValidRow()){
                 mail = connector.unserialize(rs.field(0));
-                src = this.get_src(mail.url_export_file);
+                mail.msg_source?src = mail.msg_source:src = this.get_src(mail.url_export_file);
                 subject = rs.field(1);
                 mesgs += src;
@@ -1086,5 +1106,5 @@
               msgs_to_export[j]=rs.field(2)
               mail = connector.unserialize(rs.field(0));
-                      msg=this.get_src(mail.url_export_file);
+                      mail.msg_source?src = mail.msg_source:src = this.get_src(mail.url_export_file);
                       subject = rs.field(1);
                       mesgs += msg;
Index: /trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- /trunk/expressoMail1_2/js/draw_api.js	(revision 1747)
+++ /trunk/expressoMail1_2/js/draw_api.js	(revision 1752)
@@ -299,4 +299,19 @@
 
 		draw_paging(Element('tot_m').innerHTML);
+
+		if(document.getElementById("nINBOX/Trashtree_folders"))
+		{
+			var trash = document.createElement("SPAN");
+			trash.id = 'empty_trash';
+			trash.className = 'clean_trash';
+			trash.style.cursor = 'pointer';
+			trash.onclick = function () {empty_trash_imap();};
+			trash.innerHTML = "["+get_lang("Clean")+"]";
+			trash.title="Limpar lixeira";
+			trash.onmouseover = function() {trash.style.color="red";};
+			trash.onmouseout= function() {trash.style.color="#666666";}; //#114FA4
+			document.getElementById("nINBOX/Trashtree_folders").appendChild(trash);
+		}
+
 		// Draw right menu folders.
 		/*
@@ -417,5 +432,5 @@
 			return true;
 		}
-		proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort_box_type,search_box_type,sort_box_reverse,handler_draw_box);
+		proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort_box_type,search_box_type,sort_box_reverse,preferences.preview_msg_subject,preferences.preview_msg_tip,handler_draw_box);
 //		cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type="+sort_box_type+ "&search_box_type="+ search_box_type +"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box);
 	}
@@ -483,5 +498,5 @@
   	if(current_page != 1) {
 	  	lnk_page = document.createElement("A");
-		lnk_page.setAttribute("href", "javascript:current_page=1;kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});");
+		lnk_page.setAttribute("href", "javascript:current_page=1;kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){draw_box(data, get_current_folder());});");
   	}
   	else {
@@ -522,5 +537,5 @@
   			msg_range_begin = ((i*preferences.max_email_per_page)-(preferences.max_email_per_page-1));
 			msg_range_end = (i*preferences.max_email_per_page);
-			lnk_page.setAttribute("href", "javascript:current_page="+i+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});");
+			lnk_page.setAttribute("href", "javascript:current_page="+i+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){draw_box(data, get_current_folder());});");
   		}
   		
@@ -539,5 +554,5 @@
   		msg_range_begin = ((total_pages*preferences.max_email_per_page)-(preferences.max_email_per_page-1));
 		msg_range_end = (total_pages*preferences.max_email_per_page);  		
-		lnk_page.setAttribute("href", "javascript:current_page="+total_pages+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});");
+		lnk_page.setAttribute("href", "javascript:current_page="+total_pages+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){draw_box(data, get_current_folder());});");
 	}
 	else {
@@ -783,4 +798,17 @@
 		tr_element.id = headers_msgs.msg_number;
 
+		tr_element.msg_sample = "";
+		//if(headers_msgs.msg_sample && headers_msgs.msg_sample.preview_msg_subject != "")
+		if(headers_msgs.msg_sample && preferences.preview_msg_subject == "1")
+		{
+			tr_element.msg_sample = headers_msgs.msg_sample.body.substr(0,120) + "..."; //trecho do body que sera exibido com o assunto;
+		}
+
+		tr_element.tip = "";
+		if(headers_msgs.msg_sample && preferences.preview_msg_tip == "1")
+		{
+			tr_element.tip = headers_msgs.msg_sample.body.substr(3,300) + "..."; //trecho do body que sera exibido no tool-tip;
+		}
+
 		if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')){
 			if ((headers_msgs.Flagged == 'F') || (headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 && parseInt(preferences.use_important_flag)))
@@ -899,5 +927,5 @@
 		td_element3.className = "td_msg";
 		td_element3.id = "td_who_"+ headers_msgs.msg_number;
-		td_element3.setAttribute("width", "30%");
+		td_element3.setAttribute("width", "20%");
 		var _onclick = function(){InfoContact.hide();proxy_mensagens.get_msg(headers_msgs.msg_number, msg_folder,true, show_msg);};
 		td_element3.onclick = _onclick;
@@ -942,16 +970,22 @@
 		td_element4 = document.createElement("TD");
 		td_element4.className = "td_msg";
-		td_element4.setAttribute("width", "40%");
+		td_element4.setAttribute("width", "50%");
 		td_element4.onclick = _onclick;
-		td_element4.innerHTML = !is_ie ? "<a id='a_message_"+tr_element.id+"'>&nbsp;" : "&nbsp;";
+//		td_element4.setAttribute("style","white-space:nowrap;");
+		td_element4.innerHTML = !is_ie ? "<a nowrap id='a_message_"+tr_element.id+"'>&nbsp;" : "&nbsp;";
 		
 		if ((headers_msgs.subject)&&(headers_msgs.subject.length > 50))
-			td_element4.innerHTML += headers_msgs.subject.substring(0,50) + "...";
+		{
+//			if( (headers_msgs.subject.length+tr_element.msg_sample.length)>
+			td_element4.innerHTML += headers_msgs.subject.substring(0,50) + "..." + "<span style=\"color:#b3b3b3;\">  " + tr_element.msg_sample +"</span>";//modificacao feita para exibir o trecho do body ao lado do assunto da mensagem;
+		}
 		else
-			td_element4.innerHTML += headers_msgs.subject;
+		{
+			td_element4.innerHTML += headers_msgs.subject + "<span style=\"color:#b3b3b3;\">  " + tr_element.msg_sample + "</span>";//modificacao feita para exibir o trecho do body ao lado do assunto da mensagem;
+		}
 					
+		td_element4.title=tr_element.tip;
 		if(!is_ie){
 			td_element4.innerHTML += "</a>";
-			tr_element.onmouseover = function(){};
 		}
 		
@@ -1020,5 +1054,5 @@
 	search_box_type = search;
 
-	proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort,search,sort_box_reverse,handler_draw_box);
+	proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort,search,sort_box_reverse,preferences.preview_msg_subject,preferences.preview_msg_tip,handler_draw_box);
 	current_page = 1;
 	//Comentado para nao sobrepor o numero de msgs nao lidas ao utilizar os filtros
