Index: /branches/2.2/mobile/setup/phpgw_pt-br.lang
===================================================================
--- /branches/2.2/mobile/setup/phpgw_pt-br.lang	(revision 3482)
+++ /branches/2.2/mobile/setup/phpgw_pt-br.lang	(revision 3564)
@@ -3,4 +3,7 @@
 contact center	mobile	pt-br	Endereços
 continue	mobile	pt-br	Continuar
+context email	mobile	pt-br	Email
+context contact	mobile	pt-br	Contato
+context commitment	mobile	pt-br	Compromisso
 Do you like to delete this message?	mobile	pt-br	Deseja excluir esta mensagem?
 download attachs	mobile	pt-br	Deseja baixar anexos em e-mails?
@@ -12,4 +15,9 @@
 Logout	mobile	pt-br	Sair
 To	mobile	pt-br	Para
+my mail	mobile	pt-br	Meus E-mails
+my commitments	mobile	pt-br	Meus Compromissos
+my folders	mobile	pt-br	Minhas Pastas
+mark as read	mobile	pt-br	marcar como lido
+new mail	mobile	pt-br	Novo
 Subject	mobile	pt-br	Assunto
 Send	mobile	pt-br	Enviar mensagem
@@ -22,4 +30,6 @@
 Logout	mobile	pt-br	Sair
 People	mobile	pt-br	Pessoal
+Search	mobile	pt-br	Procurar
+Selected	mobile	pt-br	Selecionados
 Calendar	mobile	pt-br	Agenda
 Contact Center	mobile	pt-br	Contatos
Index: /branches/2.2/mobile/inc/class.common_functions.inc.php
===================================================================
--- /branches/2.2/mobile/inc/class.common_functions.inc.php	(revision 3559)
+++ /branches/2.2/mobile/inc/class.common_functions.inc.php	(revision 3564)
@@ -25,15 +25,39 @@
 	
 			if ($size < 1024)
-				$rstring = $left . $size . 'B' . $right;
+				$rstring = $left . $size . ' B' . $right;
 			else if ($size < 1048576)
-				$rstring = $left . round($size/1024) . 'KB' . $right;
+				$rstring = $left . round($size/1024) . ' KB' . $right;
 			else if ($size < 1073741824)
-				$rstring = $left . round($size/1024/1024) . 'MB' . $right;
+				$rstring = $left . round($size/1024/1024) . ' MB' . $right;
 			else
-				$rstring = $left . round($size/1024/1024/1024) . 'GB' . $right;
+				$rstring = $left . round($size/1024/1024/1024) . ' GB' . $right;
 	
 			return $rstring;
 		}
-	} //end common class	
+		
+		function complete_string($str = "", $length = 10, $align = "R", $char = " ") {
+			if( $str == null )
+				$str = "";
+			else 
+				if( strlen($str) > $length ) {
+					return substr($str, 0, $length);
+				} else if( strlen($str) == $length ) {
+					return $str;
+				}			
+	
+			$char = substr($char, 0, 1);
+			$complete_str = "";
+	
+	        while( strlen($str) + strlen($complete_str) < $length  )
+	            $complete_str .= $char;
+	
+	        if( $align == "L" )
+	        	return $str . $complete_str;
+	        else
+	        	return $complete_str . $str;
+		}		
+		
+	} //end common class
+	
 
 ?>
Index: /branches/2.2/mobile/inc/class.mobiletemplate.inc.php
===================================================================
--- /branches/2.2/mobile/inc/class.mobiletemplate.inc.php	(revision 3554)
+++ /branches/2.2/mobile/inc/class.mobiletemplate.inc.php	(revision 3564)
@@ -47,5 +47,5 @@
 	 	*/
 		private function print_navbar(){
-			
+			$ui_mobilemail = CreateObject('mobile.ui_mobilemail');
 			$obj = createobject("expressoMail1_2.functions");
             // setting timezone preference
@@ -62,5 +62,5 @@
 			$this-> template->set_var('href_email', "index.php?menuaction=mobile.ui_mobilemail.change_folder&folder=0");
 			$this-> template->set_var('href_calendar', "index.php?menuaction=mobile.ui_mobilecalendar.index");
-			$this-> template->set_var('href_home', "...");
+			$this-> template->set_var('href_home', "index.php?menuaction=mobile.ui_home.index");
 
 		}
Index: /branches/2.2/mobile/inc/class.ui_home.inc.php
===================================================================
--- /branches/2.2/mobile/inc/class.ui_home.inc.php	(revision 3556)
+++ /branches/2.2/mobile/inc/class.ui_home.inc.php	(revision 3564)
@@ -1,15 +1,118 @@
 <?php
     class ui_home {
+		var $imap_functions;    
+		var $db;
+		var $bocalendar;
+		var $common;
+		var $template;
     	
-	
-    	var $public_functions = array(
+		var $public_functions = array(
+			'index' => true,
 			'search' => true
 		);
 		
 		function ui_home() {
-
+			$this->template = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+			$this->common	= CreateObject('mobile.common_functions');
+			$this->imap_functions	= CreateObject('expressoMail1_2.imap_functions');
+			$this->db	= CreateObject('phpgwapi.db');
+			$this->bocalendar = CreateObject('calendar.bocalendar');
 		}
 		
-		function search($params) {
+		function index($params) {			
+			$this->template->set_file(Array('home_index' => 'home_index.tpl'));
+			$this->template->set_block('home_index','page');	
+			$this->template->set_block('home_index','folder_block');
+			$this->template->set_block('home_index','commitment_block');
+			
+			//langs
+			$this->template->set_var('lang_context_email', lang("context email"));
+			$this->template->set_var('lang_context_contact', lang("context contact"));
+			$this->template->set_var('lang_context_commitment', lang("context commitment"));
+			$this->template->set_var('lang_search', lang("search"));
+			$this->template->set_var('lang_my_mail', lang("my mail"));
+			$this->template->set_var('lang_my_folders', lang("my folders"));
+			$this->template->set_var('lang_my_commitments', lang("my commitments"));
+			$this->template->set_var('lang_new_mail', lang("new mail"));
+			$this->template->set_var('lang_mark_as_read', lang("mark as read"));
+			$this->template->set_var('lang_selected', lang("selected"));
+			
+			$accountId = $GLOBALS['phpgw_info']['user']['account_id'];
+			
+			//pegando as pastas
+			$default_folders = $this->imap_functions->get_folders_list(array('noSharedFolders' => true, 'folderType' => 'default', 'noQuotaInfo' => true));
+			$total_quota = $this->imap_functions->get_quota(array());		
+					
+			$this->set_folder_block($default_folders, "default_folders_box");
+			
+			if(isset($params["expand_folders"]) && $params["expand_folders"] == 1) 
+			{
+				$personal_folders = $this->imap_functions->get_folders_list(array('noSharedFolders' => true, 'folderType' => 'personal', 'noQuotaInfo' => true));
+				$this->set_folder_block($personal_folders, "personal_folders_box", sizeof($default_folders));
+				$this->template->set_var('expand_folders', 0);			
+			} else {
+				$this->template->set_var('expand_folders', 1);
+			}
+			
+			$this->template->set_var('quota_percent', $total_quota["quota_percent"]);
+			$this->template->set_var('quota_used', $this->common->borkb($total_quota["quota_used"]*1024));
+			$this->template->set_var('quota_limit', $this->common->borkb($total_quota["quota_limit"]*1024));
+			
+			//pegando os eventos do dia atual
+			$year = $this->bocalendar->year;
+			$month = $this->bocalendar->month;
+			$day = $this->bocalendar->day;
+			
+			$tstart = mktime(0,0,0,$month,$day,$year);
+			//$tstart = $GLOBALS['phpgw']->datetime->get_weekday_start($year, $month, $day);
+			
+			$tstop = $tstart + 86400; //(24horas*60min*60seg*1dia)			
+			$this->bocalendar->so->owner = $accountId;
+			$this->bocalendar->so->open_box($accountId);
+			$this->bocalendar->store_to_cache( array(
+				'owner'	=> $accountId,
+				'syear'  => date('Y',$tstart),
+				'smonth' => date('m',$tstart),
+				'sday'   => date('d',$tstart),
+				'eyear'  => date('Y',$tstop),
+				'emonth' => date('m',$tstop),
+				'eday'   => date('d',$tstop)
+			) );
+			
+			$events  = $this->bocalendar->cached_events;
+			
+			foreach($events[$year.$this->common->complete_string($month,2,"R","0").$this->common->complete_string($day,2,"R","0")] as $index=>$event) 
+			{
+				$this->template->set_var('dd_class', (($index%2==0) ? "par" : "") );
+				$this->template->set_var('commitment_time', $this->common->complete_string($event["start"]["hour"],2,"R","0") .":". $this->common->complete_string($event["start"]["min"],2,"R","0") );
+				$this->template->set_var('commitment_title', $event["title"] );
+				
+				$this->template->parse('commitments_box', 'commitment_block' ,True);
+			}			
+			
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out', 'page'));
+		}
+		
+		/**
+		 * 
+		 *
+		 * $index_increment utilizado para quando passar o array das pastas pessoais somar com a quantidade de pastas default.
+		 */
+		function set_folder_block($folders, $box_target, $index_increment = 0) {
+			foreach($folders as $index=>$folder) 
+			{
+				$this->template->set_var('dd_class', (($index%2==0) ? "par" : "") );
+				$this->template->set_var('folder_id', $index + $index_increment );
+				$this->template->set_var('folder_name', $folder["folder_name"] );
+				$this->template->set_var('folder_unseen', $folder["folder_unseen"] );
+				
+				$this->imap_functions->open_mbox($folder["folder_id"],true);
+				$this->template->set_var('folder_total_msg', $this->imap_functions->get_num_msgs(array('folder' => $folder["folder_id"] ) ) );
+				
+				$this->template->parse($box_target, 'folder_block' ,True);
+			}
+		}
+		
+    	function search($params) {
 			$params['name'] = 'teste';
 			$params['default_folders'] = 1;
@@ -64,7 +167,13 @@
 		
 			}
-			
+		}
 
+		/* TODO Temporário esse método */
+		function debug($var) {
+			echo "<pre>";
+			print_r($var);
+			echo "</pre>";			
 		}
-    }
+		
+	}
 ?>
Index: anches/2.2/mobile/inc/common.inc.php
===================================================================
--- /branches/2.2/mobile/inc/common.inc.php	(revision 454)
+++ 	(revision )
@@ -1,21 +1,0 @@
-<?php
-	/**************************************************************************\
-	* eGroupWare                                                               *
-	* http://www.egroupware.org                                                *
-	* The file written by Mário César Kolling <mario.kolling@serpro.gov.br>    *
-	* --------------------------------------------                             *
-	*  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.                                              *
-	\**************************************************************************/
-
-
-	/*
-	 * Não é necessário
-	 */
-	function mobileExecMethod($method, $functionparams = '_UNDEF_', $loglevel = 3, $classparams = '_UNDEF_'){
-
-	}
-
-?>
Index: /branches/2.2/mobile/mobile_header.inc.php
===================================================================
--- /branches/2.2/mobile/mobile_header.inc.php	(revision 3492)
+++ /branches/2.2/mobile/mobile_header.inc.php	(revision 3564)
@@ -18,5 +18,5 @@
 
 	$GLOBALS['phpgw_info']['flags']['currentapp'] = 'mobile';
-	$GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app'] = 'mobilemail'; // mobilecalendar, mobilecc ou mobilemail
+	$GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app'] = 'home'; //home, mobilecalendar, mobilecc ou mobilemail
 
 	if ( is_null($GLOBALS['phpgw_info']['server']['template_set']) )
@@ -33,4 +33,7 @@
 		//TODO: Determinar qual a aplicação móvel preferida e iniciá-la.			
 		switch($GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app']){
+			case home:
+				$link = "ui_home.index";		
+				break;			
 			case mobilemail:
 				$link = "ui_mobilemail.mail_list";		
Index: /branches/2.2/mobile/templates/default/login.tpl
===================================================================
--- /branches/2.2/mobile/templates/default/login.tpl	(revision 3553)
+++ /branches/2.2/mobile/templates/default/login.tpl	(revision 3564)
@@ -19,5 +19,5 @@
 		<div class="campos-entrada">
 			<div class="posiciona-esquerda">
-				<form name="form_login" method="post" action="./login.php" autocomplete=off>
+				<form name="form_login" method="post" action="./login.php">
 					<input type="hidden" name="passwd_type" value="text">
 					<input type="hidden" name="account type" value="u">
@@ -26,5 +26,5 @@
 					<script>document.form_login.login.focus();</script>
 					<p><strong>{lang_password}:&nbsp</strong></p> 
-					<p><input name="passwd" type="password"></p>
+					<p><input name="passwd" type="password" autocomplete=off></p>
 					<p><button name="submitit" class="btn-contexto">{lang_login}</button></p>
 				</form>
Index: /branches/2.2/mobile/templates/default/template.tpl
===================================================================
--- /branches/2.2/mobile/templates/default/template.tpl	(revision 3555)
+++ /branches/2.2/mobile/templates/default/template.tpl	(revision 3564)
@@ -3,20 +3,15 @@
 
 <html xmlns="http://www.w3.org/1999/xhtml">
-
     <head>   
-    
 	    <title>Expresso Mini</title>
 		<meta content="text/html;width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0; charset=utf-8;" http-equiv="Content-Type" name="viewport" /> 
 		<meta name="format-detection" content="telephone=no" />
 		{css}
-    
 	</head>
 	
     <body>
-    			
 		<div class=topo>
-        	<h1>Expresso mini</h1>
+        	<h1>Expresso Mini</h1>
 		</div>
-		
 
 		<!-- BEGIN mobile_home_content -->
Index: /branches/2.2/mobile/templates/default/home_index.tpl
===================================================================
--- /branches/2.2/mobile/templates/default/home_index.tpl	(revision 3564)
+++ /branches/2.2/mobile/templates/default/home_index.tpl	(revision 3564)
@@ -0,0 +1,26 @@
+<!-- BEGIN page -->
+<div class="busca"> <input name="palavra_chave"> <button id="buscar" class="btn-generico" >{lang_search}</button></div>
+
+<div class="menu-contexto">
+	{lang_new_mail}:
+	<button name="email" class="btn-contexto">{lang_context_email}</button>
+	<button name="contato" class="btn-contexto">{lang_context_contact}</button>
+	<button name="compromisso" class="btn-contexto">{lang_context_commitment}</button>
+</div>
+
+<dl id="lista_miolo">
+	<dt><input type="checkbox" name="check_default_folders"></input>{lang_my_mail} | <span class="rotulo-complementar">Usados {quota_percent}% [{quota_used}/{quota_limit}]</span></dt>
+		{default_folders_box}
+	<dt><input type="checkbox" name="check_commitments">{lang_my_commitments}</dt>
+		{commitments_box}
+	<dt><input type="checkbox" name="check_personal_folders"><a href="index.php?menuaction=mobile.ui_home.index&expand_folders={expand_folders}">{lang_my_folders}</a></dt>
+		{personal_folders_box}
+</dl>
+
+<!-- END page -->
+<!-- BEGIN folder_block -->
+<dd class="{dd_class}"><div class="nome-item"><a href="index.php?menuaction=mobile.ui_mobilemail.change_folder&folder={folder_id}">{folder_name}</a></div> <span class="contagem">[{folder_unseen}/{folder_total_msg}]</span></dd> 
+<!-- END folder_block -->
+<!-- BEGIN commitment_block -->
+<dd class="{dd_class}"><strong>{commitment_time}</strong> {commitment_title}</dd>
+<!-- END commitment_block -->
Index: anches/2.2/mobile/templates/default/home.tpl
===================================================================
--- /branches/2.2/mobile/templates/default/home.tpl	(revision 3484)
+++ 	(revision )
@@ -1,33 +1,0 @@
-<!-- BEGIN mobile_home -->
-<html>
-<head>
-<meta http-equiv="Content-Language" content="pt-BR" />
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-{css}
-<title>Expresso Mobile {lang_home}</title>
-</head>
-<body style="background-color:white !important">
-<!-- BEGIN mobile_home_content -->
-{content}<br>{footer}
-<!-- END mobile_home_content -->
-<p><strong>{fullname}: [{account_lid}]</strong></p>
-<form action="index.php?menuaction=mobile.ui_mobilemail.mail_list" method="post">
-<p><input type="text" size="15" name="searchEmail"/><br/>
-<input type="submit" id="btnSearch" value="{lang_search}"/></p>
-</form>
-<hr />
-<!-- TODO: Yep! Deveria ser flexível, não hardcoded do jeito que tá -->
-<!--<p>&nbsp;&nbsp;<strong>:: Expresso Mini</strong> </p>-->
-<p>
-:: <a accesskey="1" href="{href_newmail}">{lang_newmail}</a> <br>
-:: <a accesskey="1" href="{href_email}">{lang_email}</a> <br>
-:: <a accesskey="1" href="{href_sent}">{lang_sent}</a> <br>
-:: <a accesskey="1" href="{href_more}">{lang_more_folders}</a> <br>
-:: <a accesskey="1" href="{href_calendar}">{lang_calendar}</a> <br>
-:: <a accesskey="1" href="{href_cc}">{lang_cc}</a> <br>
-:: <a accesskey="1" href="./login.php?cd=1">{lang_logout}</a>
-</p>
-<hr />
-</body>
-</html>
-<!-- END mobile_home -->
Index: /branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- /branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 3560)
+++ /branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 3564)
@@ -1764,10 +1764,14 @@
 		}
 
-		//Get quota info of current folder
-		$current_folder = "INBOX";
-		if($params && $params['folder'])
-			$current_folder = $params['folder'];
-			
-		$arr_quota_info = $this->get_quota(array('folder_id' => $current_folder));		
+		if ( $params && !$params['noQuotaInfo'] ) {
+			//Get quota info of current folder
+			$current_folder = "INBOX";
+			if($params && $params['folder'])
+				$current_folder = $params['folder'];
+				
+			$arr_quota_info = $this->get_quota(array('folder_id' => $current_folder));
+		} else {
+			$arr_quota_info = array();
+		}
 		
 		// Sorting resultMine
