Index: /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/calendar.codecs.js
===================================================================
--- /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/calendar.codecs.js	(revision 6533)
+++ /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/calendar.codecs.js	(revision 6768)
@@ -22,5 +22,6 @@
 	    fontColor: "fff",
 	    timezone: 'America/Sao_Paulo',
-	    weekStart: 'SUN'
+	    weekStart: 'SUN',
+	    useDesktopNotification: 0
 	};
 
Index: /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/load.js
===================================================================
--- /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/load.js	(revision 6444)
+++ /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/load.js	(revision 6768)
@@ -94,32 +94,3 @@
 }
 
-Alarms = {
-    load: function(){
-	var eventsDay = DataLayer.get('alarm:schedulable',['=', 'date', Date.today().getTime()]);
-	if(eventsDay)
-	for(var i = 0; i < eventsDay.length; i++){
-	    this.addAlarm( eventsDay[i] );
-	}
-    },
-	
-    addAlarm: function( eventDay ){            
-	if(!DataLayer.tasks[parseInt(eventDay.sendTime)]){
-	    DataLayer.task( parseInt(eventDay.sendTime) , function( timestamp ){
-		var path = User.moduleName == 'expressoCalendar' ? '' : '../prototype/modules/calendar/';
-		DataLayer.render(path+'templates/alarm.ejs',{
-		    event: eventDay
-		}, function( html ){                                
-		    $.Zebra_Dialog(html , {
-			'type':     'question',
-			'overlay_opacity': '0.5',
-			'buttons':  ['Fechar'],
-			'onClose':  function(clicked) {}
-		    });
-		});
-	    });
-	}
-    }
-}
-
 Calendar.load();
-Alarms.load();
Index: /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/calendar.alarms.js
===================================================================
--- /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/calendar.alarms.js	(revision 6768)
+++ /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/calendar.alarms.js	(revision 6768)
@@ -0,0 +1,49 @@
+Alarms = {
+    load: function(){
+	var eventsDay = DataLayer.get('alarm:schedulable',['=', 'date', Date.today().getTime()]);
+	if(eventsDay)
+	    for(var i = 0; i < eventsDay.length; i++){
+		this.addAlarm( eventsDay[i] );
+	    }
+    },
+
+    addAlarm: function( eventDay ){            
+	if(!DataLayer.tasks[parseInt(eventDay.sendTime)]){
+	    DataLayer.task( parseInt(eventDay.sendTime) , function( timestamp ){
+
+		if(!activePage && !!parseInt(User.preferences.useDesktopNotification) && desktopNotification.verifyComplement()){
+
+		    desktopNotification.sentNotification(
+			'../expressoCalendar/templates/default/images/navbar.png',
+			'Você possui um compromisso agendado:', 
+			eventDay.event_start + ' ' + eventDay.schedulable.startTime + ' - ' + eventDay.schedulable.summary
+			);
+
+		/* TODO
+		    var onClose = function(){
+			if(window.location.pathname.indexoOf('expressoCalendar') >= 0)
+			    window.location = url_host + '/expressoCalendar';
+		    };
+		*/
+		    desktopNotification.showNotification();
+
+		}else{
+
+		    var path = User.moduleName == 'expressoCalendar' ? '' : '../prototype/modules/calendar/';
+		    DataLayer.render(path+'templates/alarm.ejs',{
+			event: eventDay
+		    }, function( html ){                                
+			$.Zebra_Dialog(html , {
+			    'type':     'question',
+			    'overlay_opacity': '0.5',
+			    'buttons':  ['Fechar'],
+			    'onClose':  function(clicked) {}
+			});
+		    });
+		}
+
+	    });
+	}
+    }
+}
+Alarms.load();
Index: /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/desktop.notification.js
===================================================================
--- /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/desktop.notification.js	(revision 6768)
+++ /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/desktop.notification.js	(revision 6768)
@@ -0,0 +1,86 @@
+desktopNotification = {
+    
+    notification: [],
+
+    initDesktopNotificationAddon: function(){
+	if(useDesktopNotification()){
+
+	    if (!window.webkitNotifications && $.browser.mozilla)
+		this.installDektopNotificationAddon();
+
+	    if(window.webkitNotifications && window.webkitNotifications.checkPermission())
+		window.webkitNotifications.requestPermission();
+
+	}
+    },
+
+    installDektopNotificationAddon: function(){
+
+	var params = {
+	    "Foo": { 
+		URL: '../prototype/plugins/desktop.notification/html_desktop_notifications-1.0.7-fx.xpi' ,
+		IconURL:'../prototype/plugins/desktop.notification/desktop-notification.png',
+		//Hash:'sha1:28857e60d043447c5f4550853f2d40770b326a13',
+		toString: function () {
+		    return this.URL;
+		}
+	    }
+	};
+
+	InstallTrigger.install(params);
+
+	return false;
+    },
+
+    verifyComplement: function(){
+
+	if(!window.webkitNotifications)
+	    return false;
+
+	if(window.webkitNotifications.checkPermission())
+	    return false;
+
+	return true;
+
+    },
+
+    sentNotification: function(icon, title, body){
+	this.notification[this.notification.length] = window.webkitNotifications.createNotification( icon, title, body);
+    },
+
+    showNotification: function(onClose, onClick, onDisplay, onError){
+	var length = this.notification.length -1; 
+
+	this.notification[length].ondisplay = onDisplay;
+	this.notification[length].onclose = onClose;
+	this.notification[length].onclick = onClick;
+	this.notification[length].onerror = onError;
+
+	this.notification[length].show();
+    }
+}
+
+$(document).ready(function() {
+    activePage = true;
+    $(window)
+	.focus(function() { 
+	    activePage = true;  
+	    if(!desktopNotification.verifyComplement()){
+		setTimeout(function(){		    
+		    console.log(desktopNotification.notification);
+		    
+		    for(var i = 0; i < desktopNotification.notification.length; i++){
+			desktopNotification.notification[i].cancel();
+		    }		    
+		    desktopNotification.notification = [];
+
+		    console.log(desktopNotification.notification);
+		}, 60000);
+	    }
+	})
+	.blur(function() {
+	    activePage = false;
+	});
+
+    desktopNotification.initDesktopNotificationAddon();
+});
Index: /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/init.js
===================================================================
--- /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/init.js	(revision 6444)
+++ /sandbox/2.4.2-expresso1/prototype/modules/calendar/js/init.js	(revision 6768)
@@ -1,3 +1,4 @@
 $(document).ready(function() {
+
 	//Remove o icone de configuraçõe padrão antigo do expresso
 	$('#sideboxdragarea').addClass('hidden');
@@ -348,2 +349,7 @@
 	//listEvents();
 });
+
+
+function useDesktopNotification(){
+	return !!parseInt(User.preferences.useDesktopNotification);
+}
Index: /sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/index.ejs
===================================================================
--- /sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/index.ejs	(revision 6525)
+++ /sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/index.ejs	(revision 6768)
@@ -92,4 +92,5 @@
 <script type='text/javascript' src='<?= MODULESURL ?>/js/calendar.codecs.js'></script>
 <script type='text/javascript' src='<?= MODULESURL ?>/js/load.js'></script>	
+<script type='text/javascript' src='<?= MODULESURL ?>/js/calendar.alarms.js'></script>	
 
 <script type='text/javascript' src='<?= MODULESURL ?>/js/I18n.js'></script>
@@ -97,4 +98,5 @@
 <script type="text/javascript" src="<?= MODULESURL ?>/js/init.js"></script>
 <script type="text/javascript" src="<?= MODULESURL ?>/js/drag_area.js"></script>
+<script type="text/javascript" src="<?= MODULESURL ?>/js/desktop.notification.js"></script>
 
 </head>
Index: /sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/preferences_calendar.ejs
===================================================================
--- /sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/preferences_calendar.ejs	(revision 5510)
+++ /sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/preferences_calendar.ejs	(revision 6768)
@@ -72,9 +72,8 @@
 
 			<p class="input-group">
-				<label for="defaultCalendar">Agenda padrão:</label>
-				<select name="defaultCalendar" >
-					<%for(var i = 0; i < data.calendars.length; i++){%>
-						<option value="<%=data.calendars[i].id%>"> <%= data.calendars[i].name %></option>
-					<%}%>
+				<label for="useDesktopNotification">Usar alarme desktop:</label>
+				<select name="useDesktopNotification" >
+					<option value="1" <%= data.preferences.useDesktopNotification == '1' ? 'selected="selected"' : '' %>>Sim</option>
+					<option value="0" <%= data.preferences.useDesktopNotification != '1' ? 'selected="selected"' : '' %>>Não</option>
 				</select>
 			</p>
Index: /sandbox/2.4.2-expresso1/expressoMail1_2/index.php
===================================================================
--- /sandbox/2.4.2-expresso1/expressoMail1_2/index.php	(revision 6665)
+++ /sandbox/2.4.2-expresso1/expressoMail1_2/index.php	(revision 6768)
@@ -72,9 +72,11 @@
 		<script type="text/javascript" src="../prototype/plugins/contextmenu/jquery.contextMenu.js"></script>
 		<!-- <script type="text/javascript" src="../prototype/plugins/contextmenu/jquery.ui.position.js"></script> -->
-		
+
 		<script type="text/javascript" src="../prototype/modules/calendar/js/timezone.js"></script>
-        <script type="text/javascript" src="../prototype/plugins/dateFormat/dateFormat.js"></script>
+		<script type="text/javascript" src="../prototype/plugins/dateFormat/dateFormat.js"></script>
 		<script type="text/javascript" src="../prototype/modules/calendar/js/calendar.date.js"></script>
+		<script type="text/javascript" src="../prototype/modules/calendar/js/desktop.notification.js"></script>
 		<script type="text/javascript" src="../prototype/modules/calendar/js/calendar.codecs.js"></script>
+		<script type="text/javascript" src="../prototype/modules/calendar/js/calendar.alarms.js"></script>
 		<link rel="stylesheet" type="text/css" href="../prototype/plugins/freeow/style/freeow/freeow.css" >
 		<script type="text/javascript" src="../prototype/plugins/freeow/jquery.freeow.min.js"></script>
Index: /sandbox/2.4.2-expresso1/expressoMail1_2/js/common_functions.js
===================================================================
--- /sandbox/2.4.2-expresso1/expressoMail1_2/js/common_functions.js	(revision 6707)
+++ /sandbox/2.4.2-expresso1/expressoMail1_2/js/common_functions.js	(revision 6768)
@@ -1241,2 +1241,7 @@
     return folderName;
 }
+
+function useDesktopNotification(){
+    //return preferences.notifications;
+    return true;
+}
