Index: trunk/mobile/setup/phpgw_pt-br.lang
===================================================================
--- trunk/mobile/setup/phpgw_pt-br.lang	(revision 611)
+++ trunk/mobile/setup/phpgw_pt-br.lang	(revision 691)
@@ -1,4 +1,6 @@
 Calendar	mobile	pt-br	Agenda
 contact center	mobile	pt-br	Endereços
+download attachs	mobile	pt-br	Deseja baixar anexos em e-mails?
+Download	mobile	pt-br	Baixar
 E-mail	mobile	pt-br	Caixa de Entrada
 From	mobile	pt-br	De
@@ -56,2 +58,5 @@
 alarm	mobile	pt-br	Alarme
 To Delegate	mobile	pt-br	Delegar
+What is the maximum number of messages per page?	mobile	pt-br	Qual o número máximo de mensagens por página?
+Option	mobile	pt-br	Opção
+Value	mobile	pt-br	Valor
Index: trunk/mobile/setup/setup.inc.php
===================================================================
--- trunk/mobile/setup/setup.inc.php	(revision 686)
+++ trunk/mobile/setup/setup.inc.php	(revision 691)
@@ -30,5 +30,5 @@
 	/* The hooks this app includes, needed for hooks registration */
 	//$setup_info['mobile']['hooks'][] = 'admin';
-	//$setup_info['mobile']['hooks'][] = 'preferences';
+	$setup_info['mobile']['hooks'][] = 'preferences';
 	//$setup_info['mobile']['hooks'][] = 'config_validate';
 
Index: trunk/mobile/inc/hook_preferences.inc.php
===================================================================
--- trunk/mobile/inc/hook_preferences.inc.php	(revision 691)
+++ trunk/mobile/inc/hook_preferences.inc.php	(revision 691)
@@ -0,0 +1,26 @@
+<?php
+  /***************************************************************************\
+  * eGroupWare - Contacts Center                                              *
+  * http://www.egroupware.org                                                 *
+  * Written by:                                                               *
+  *  - Raphael Derosso Pereira <raphaelpereira@users.sourceforge.net>         *
+  *  sponsored by Thyamad - http://www.thyamad.com
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+{
+// Only Modify the $file and $title variables.....
+	$title = $appname;
+	$file = Array(
+		'Preferences'   => $GLOBALS['phpgw']->link('/index.php','menuaction=mobile.ui_preferences.index'),
+		//'Grant Access'  => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs2.index&acl_app='.$appname),
+		//'Edit Categories' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app='.$appname . '&cats_level=True&global_cats=True')
+	);
+//Do not modify below this line
+	display_section($appname,$title,$file);
+}
+?>
Index: trunk/mobile/inc/class.ui_preferences.inc.php
===================================================================
--- trunk/mobile/inc/class.ui_preferences.inc.php	(revision 691)
+++ trunk/mobile/inc/class.ui_preferences.inc.php	(revision 691)
@@ -0,0 +1,90 @@
+<?php
+  /***************************************************************************\
+  * eGroupWare - Contacts Center                                              *
+  * http://www.egroupware.org                                                 *
+  * Written by:                                                               *
+  *  - Raphael Derosso Pereira <raphaelpereira@users.sourceforge.net>         *
+  *  sponsored by Thyamad - http://www.thyamad.com
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+
+	class ui_preferences
+	{
+		var $public_functions = array(
+			'index'           => true,
+			'set_preferences' => true,
+		);
+		
+		function index()
+		{
+			$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Preferences').' - '.lang('Mobile');
+			$GLOBALS['phpgw']->common->phpgw_header();
+			echo parse_navbar();
+
+			$GLOBALS['phpgw']->template->set_file(array('pref' => 'preferences.tpl'));
+
+			/* Get Saved Preferences */
+			$prefs = $GLOBALS['phpgw']->preferences->read();
+			
+			if($prefs['mobile']['download_attach']==1)
+				$GLOBALS['phpgw']->template->set_var('download_attach_option_Yes_selected', 'selected');
+			else
+				$GLOBALS['phpgw']->template->set_var('download_attach_option_No_selected', 'selected');
+			
+			$max_page = isset($prefs['mobile']['max_message_per_page'])?
+					$prefs['mobile']['max_message_per_page']:10;
+			
+			$max_page = "max_message_per_page_".$max_page."_selected";
+
+			
+			$GLOBALS['phpgw']->template->set_var($max_page,"selected");
+			
+			/* Translate the fields */
+			$this->translate('pref');
+
+			$GLOBALS['phpgw']->template->set_var('form_action', $GLOBALS['phpgw']->link('/index.php', 'menuaction=mobile.ui_preferences.set_preferences'));
+
+			$GLOBALS['phpgw']->template->pparse('out', 'pref');
+		}
+			
+		function translate($handle)
+		{
+			$vars = $GLOBALS['phpgw']->template->get_undefined($handle);
+			foreach($vars as $name => $value)
+			{
+				if (ereg('^lang_', $name) !== false)
+				{
+					$GLOBALS['phpgw']->template->set_var($name, lang(str_replace('_',' ',substr($name, 5))));
+				}
+				else {
+					$GLOBALS['phpgw']->template->set_var($name, " ");
+				}
+			}
+		}
+		
+		function set_preferences()
+		{
+			if ($_POST['save'])
+			{
+				$GLOBALS['phpgw']->preferences->read();
+				
+				if($_POST['download_attach']==0)
+					$GLOBALS['phpgw']->preferences->delete('mobile', 'download_attach');
+				else
+					$GLOBALS['phpgw']->preferences->add('mobile', 'download_attach', '1');
+				
+				$GLOBALS['phpgw']->preferences->add('mobile', 'max_message_per_page', $_POST['max_message_per_page']);
+				
+				$GLOBALS['phpgw']->preferences->save_repository();
+			}
+
+			header('Location: '.$GLOBALS['phpgw']->link('/preferences/index.php'));
+		}
+
+	}
+?>
Index: trunk/mobile/inc/class.ui_mobilemail.inc.php
===================================================================
--- trunk/mobile/inc/class.ui_mobilemail.inc.php	(revision 623)
+++ trunk/mobile/inc/class.ui_mobilemail.inc.php	(revision 691)
@@ -44,6 +44,7 @@
 		function ui_mobilemail()
 		{
-			
+
 			$this-> load_session();						
+
 			// Recupera atributos da classe gravados na sessão
 			$folders = $GLOBALS['phpgw']->session->appsession('mobilemail.folders','mobile');
@@ -191,5 +192,19 @@
 			if (!empty($msg['attachments']) && !empty($msg['attachments']['names']))
 			{
-				$p->set_var('attachment_message', lang('This message have attachment(s)'));
+				$attachs = "<br>".lang("This message has the follow attachments:")."<br>";
+				foreach($msg['attachments'] as $key => $attach) {
+					if(is_array($attach)) {
+						$attachs.=$attach['name']."&nbsp;&nbsp;&nbsp;&nbsp;";
+						if($GLOBALS['phpgw_info']['user']['preferences']['mobile']['download_attach']==1)
+							$attachs.="<a href='../expressoMail1_2/inc/gotodownload.php?msg_folder=".
+									$msg_folder."&msg_number=".$msg_number."&idx_file=".$key.
+									"&msg_part=".$attach['pid']."&encoding=".$attach['encoding']."'>".
+									lang('Download')."</a><br>";
+						else
+							$attachs.="<br>";
+					}
+					$p->set_var('attachment_message', $attachs);
+				}
+				//$p->set_var('attachment_message', lang('This message have attachment(s)'));
 			}
 			else
@@ -262,5 +277,7 @@
 		    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_spam'] = $current_config['expressoMail_command_for_spam'];
 		    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_use_spam_filter'] = $current_config['expressoMail_use_spam_filter'];
-		    echo '<script> var array_lang = new Array();var use_spam_filter = \''.$current_config['expressoMail_use_spam_filter'].'\' </script>';
+
+			echo '<script> var array_lang = new Array();var use_spam_filter = \''.$current_config['expressoMail_use_spam_filter'].'\' </script>';
+
 			// End Set Anti-Spam options.
 		
@@ -270,5 +287,7 @@
 		    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'] 	= $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']	? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']		: "Spam";
 		    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']	= $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'] 	? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'] 		: "Sent";
+
 			include("../expressoMail1_2/inc/load_lang.php");		    
+
 		}
 
@@ -365,5 +384,7 @@
 		{
 
-			$this->messages_per_page = 10; //TODO: Pegar esse valor de preferences
+			$this->messages_per_page = 
+					isset($GLOBALS['phpgw_info']['user']['preferences']['mobile']['max_message_per_page'])?
+					$GLOBALS['phpgw_info']['user']['preferences']['mobile']['max_message_per_page']:10; 
 //		var $pages;
 //		var $actual_page;
Index: trunk/mobile/templates/default/preferences.tpl
===================================================================
--- trunk/mobile/templates/default/preferences.tpl	(revision 691)
+++ trunk/mobile/templates/default/preferences.tpl	(revision 691)
@@ -0,0 +1,37 @@
+<form method="POST" action="{form_action}">
+<div id="cc_pref_cards" style="width: 100%; border: 0px solid black">
+	<table align="center" style="width: 400px">
+		<tr class="th">
+			<td style="text-align: center; font-weight: bold">{lang_Option}</td>
+			<td style="text-align: center; font-weight: bold">{lang_Value}</td>
+		</tr>
+		<tr class="row_off">
+			<td width="70%">{lang_download_attachs}</td>
+			<td>
+				<select name="download_attach" style="width: 100px">
+				<option {download_attach_option_No_selected} value="0">{lang_No}</option>
+				<option {download_attach_option_Yes_selected} value="1">{lang_Yes}</option>
+				</select>
+			</td>
+		</tr>
+		<tr class="row_on">
+			<td width="70%">{lang_What_is_the_maximum_number_of_messages_per_page?}</td>
+			<td>
+				<select name="max_message_per_page" style="width: 100px">
+				<option {max_message_per_page_5_selected} value="5">5</option>
+				<option {max_message_per_page_10_selected} value="10">10</option>
+				<option {max_message_per_page_15_selected} value="15">15</option>
+				</select>
+			</td>
+		</tr>
+				<tr>
+			<td></td>
+			<td style="text-align: right;">
+				<input type="submit" name="save" value="{lang_Save}">
+				<input type="button" name="cancel" value="{lang_Cancel}" onclick="window.back()">
+			</td>
+		</tr>
+	</table>
+	<br>
+</div>
+</form>
