diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties
index 450d9621a..8a6751609 100644
--- a/resources/languages/resources.properties
+++ b/resources/languages/resources.properties
@@ -694,6 +694,8 @@ service.gui.AUTO_ANSWER_FWD_CALLS=Forward Calls
service.gui.AUTO_ANSWER_FWD_CALLS_TO=Forward all calls to the following number or URI:
service.gui.AUTO_ANSWER_VIDEO=Video
service.gui.AUTO_ANSWER_VIDEO_CALLS_WITH_VIDEO=Answer video calls with video
+service.gui.LOCAL_VIDEO_ERROR_TITLE=Local video error
+service.gui.LOCAL_VIDEO_ERROR_MESSAGE=Failed to enable/disable the local video.
service.gui.security.SECURE_AUDIO=Secure audio
service.gui.security.AUDIO_NOT_SECURED=Audio not secure
diff --git a/src/net/java/sip/communicator/impl/gui/AlertUIServiceImpl.java b/src/net/java/sip/communicator/impl/gui/AlertUIServiceImpl.java
index 67d774d43..8b2a7c197 100644
--- a/src/net/java/sip/communicator/impl/gui/AlertUIServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/gui/AlertUIServiceImpl.java
@@ -6,8 +6,12 @@
*/
package net.java.sip.communicator.impl.gui;
+import java.util.*;
+
import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.notification.*;
+import net.java.sip.communicator.service.systray.event.*;
/**
* The AlertUIServiceImpl is an implementation of the
@@ -18,6 +22,23 @@
public class AlertUIServiceImpl
implements AlertUIService
{
+ /**
+ * The event type name for the notification pop-ups.
+ */
+ private static final String NOTIFICATION_EVENT_TYPE = "AlertUI";
+
+ /**
+ * A boolean used to verify that this listener registers only once to
+ * the popup message notification handler.
+ */
+ private boolean isRegisteredToPopupMessageListener = false;
+
+ /**
+ * The pop-up notification listener which handles the clicking on the
+ * pop-up notification.
+ */
+ private SystrayPopupMessageListener listener = null;
+
/**
* Shows an alert dialog with the given title and message.
*
@@ -61,4 +82,216 @@ public void showAlertDialog(String title, String message, int type)
message,
type).showDialog();
}
+
+ /**
+ * Shows an notification pop-up which can be clicked. An error dialog is
+ * shown when the notification is clicked.
+ *
+ * @param title the title of the error dialog and the notification pop-up
+ * @param message the message to be displayed in the error dialog and the
+ * pop-up
+ */
+ public void showPopUpNotification(String title, String message)
+ {
+ showPopUpNotification(title, message, title, message, null);
+ }
+
+ /**
+ * Shows an notification pop-up which can be clicked. An error dialog is
+ * shown when the notification is clicked.
+ *
+ * @param title the title of the error dialog and the notification pop-up
+ * @param message the message to be displayed in the error dialog and the
+ * pop-up
+ * @param e the exception that can be shown in the error dialog
+ */
+ public void showPopUpNotification(String title, String message, Throwable e)
+ {
+ showPopUpNotification(title, message, title, message, e);
+ }
+
+ /**
+ * Shows an notification pop-up which can be clicked. An error dialog is
+ * shown when the notification is clicked.
+ *
+ * @param title the title of the notification pop-up
+ * @param message the message of the pop-up
+ * @param errorDialogTitle the title of the error dialog
+ * @param errorDialogMessage the message of the error dialog
+ */
+ public void showPopUpNotification(String title, String message,
+ String errorDialogTitle, String errorDialogMessage)
+ {
+ showPopUpNotification(title, message, errorDialogTitle,
+ errorDialogMessage, null);
+ }
+
+ /**
+ * Shows an notification pop-up which can be clicked. An error dialog is
+ * shown when the notification is clicked.
+ *
+ * @param title the title of the notification pop-up
+ * @param message the message of the pop-up
+ * @param errorDialogTitle the title of the error dialog
+ * @param errorDialogMessage the message of the error dialog
+ * @param e the exception that can be shown in the error dialog
+ */
+ public void showPopUpNotification(String title, String message,
+ String errorDialogTitle, String errorDialogMessage, Throwable e)
+ {
+ NotificationService notificationService
+ = GuiActivator.getNotificationService();
+
+ if(notificationService == null)
+ return;
+
+ // Registers only once to the popup message notification
+ // handler.
+ if(!isRegisteredToPopupMessageListener )
+ {
+ notificationService.registerDefaultNotificationForEvent(
+ NOTIFICATION_EVENT_TYPE,
+ NotificationAction.ACTION_POPUP_MESSAGE,
+ null, null);
+ isRegisteredToPopupMessageListener = true;
+ addOrRemovePopupMessageListener(true);
+ }
+
+ // Fires the popup notification.
+ Map extras = new HashMap();
+
+ extras.put(NotificationData.POPUP_MESSAGE_HANDLER_TAG_EXTRA,
+ new ErrorDialogParams(title, message, e));
+ notificationService.fireNotification(NOTIFICATION_EVENT_TYPE, title,
+ message, null, extras);
+
+ }
+
+ /**
+ * Adds/removes the listener instance as a PopupMessageListener
+ * to/from theNotificationService in order to be able to detect
+ * when the user clicks on a pop-up notification displayed by this instance
+ *
+ * @param add true to add the listener instance as a
+ * PopupMessageListener to the NotificationService or
+ * false to remove it
+ */
+ private void addOrRemovePopupMessageListener(boolean add)
+ {
+ Iterable popupHandlers
+ = GuiActivator.getNotificationService()
+ .getActionHandlers(NotificationAction.ACTION_POPUP_MESSAGE);
+
+ for(NotificationHandler popupHandler : popupHandlers)
+ {
+ if(!(popupHandler instanceof PopupMessageNotificationHandler))
+ continue;
+
+ PopupMessageNotificationHandler popupMessageNotificationHandler
+ = (PopupMessageNotificationHandler) popupHandler;
+
+ if(listener == null)
+ {
+ listener = new SystrayPopupMessageListener()
+ {
+ public void popupMessageClicked(
+ SystrayPopupMessageEvent evt)
+ {
+ Object tag = evt.getTag();
+ if(tag instanceof ErrorDialogParams)
+ {
+ ErrorDialogParams params = (ErrorDialogParams)tag;
+ if(params.getEx() != null)
+ {
+ showAlertDialog(params.getTitle(),
+ params.getMessage(), params.getEx());
+ }
+ else
+ {
+ showAlertDialog(params.getTitle(),
+ params.getMessage());
+ }
+ }
+
+ }
+
+ };
+ }
+
+ if(add)
+ {
+ popupMessageNotificationHandler.addPopupMessageListener(
+ listener);
+ }
+ else
+ {
+ popupMessageNotificationHandler.removePopupMessageListener(
+ listener);
+ }
+
+ }
+
+ }
+
+ /**
+ * Releases the resources acquired by this instance throughout its lifetime
+ * and removes the listeners.
+ */
+ public void dispose()
+ {
+ addOrRemovePopupMessageListener(false);
+ }
+
+ /**
+ * The ErrorDialogParams class is holder for the parameters needed by the
+ * error dialog to be shown.
+ */
+ class ErrorDialogParams
+ {
+ /**
+ * The title parameter.
+ */
+ private String title;
+
+ /**
+ * The message parameter.
+ */
+ private String message;
+
+ /**
+ * The exception parameter.
+ */
+ private Throwable e;
+
+ public ErrorDialogParams(String title, String message, Throwable e)
+ {
+ this.title = title;
+ this.message = message;
+ this.e = e;
+ }
+
+ /**
+ * @return the title
+ */
+ public String getTitle()
+ {
+ return title;
+ }
+
+ /**
+ * @return the message
+ */
+ public String getMessage()
+ {
+ return message;
+ }
+
+ /**
+ * @return the exception
+ */
+ public Throwable getEx()
+ {
+ return e;
+ }
+ }
}
diff --git a/src/net/java/sip/communicator/impl/gui/GuiActivator.java b/src/net/java/sip/communicator/impl/gui/GuiActivator.java
index 802293fbf..0d6c79f1d 100644
--- a/src/net/java/sip/communicator/impl/gui/GuiActivator.java
+++ b/src/net/java/sip/communicator/impl/gui/GuiActivator.java
@@ -100,6 +100,8 @@ public class GuiActivator implements BundleActivator
private static DemuxContactSourceService demuxContactSourceService;
private static GlobalDisplayDetailsService globalDisplayDetailsService;
+
+ private static AlertUIService alertUIService;
private static final Map