|
From: <jgr...@us...> - 2003-06-29 21:00:05
|
Update of /cvsroot/popfile/engine/Platform
In directory sc8-pr-cvs1:/tmp/cvs-serv402
Modified Files:
MSWin32.pm
Log Message:
Handle new option to hide the system tray icon from the menu, and add configuration item that makes the tray icon configurable from the web interface
Index: MSWin32.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Platform/MSWin32.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** MSWin32.pm 8 May 2003 00:53:45 -0000 1.7
--- MSWin32.pm 29 Jun 2003 20:59:59 -0000 1.8
***************
*** 50,53 ****
--- 50,57 ----
$self->config_( 'trayicon', 1 );
+ $self->register_configuration_item_( 'configuration',
+ 'windows_trayicon',
+ $self );
+
return 1;
}
***************
*** 55,58 ****
--- 59,135 ----
# ---------------------------------------------------------------------------------------------
#
+ # configure_item
+ #
+ # $name The name of the item being configured, was passed in by the call
+ # to register_configuration_item
+ # $language Reference to the hash holding the current language
+ # $session_key The current session key
+ #
+ # Must return the HTML for this item
+ # ---------------------------------------------------------------------------------------------
+
+ sub configure_item
+ {
+ my ( $self, $name, $language, $session_key ) = @_;
+
+ my $body;
+
+ # POP3 Listen Port widget
+ if ( $name eq 'windows_trayicon' ) {
+ $body .= "<span class=\"configurationLabel\">$$language{Windows_TrayIcon}:</span><br />\n";
+ $body .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\"><tr><td nowrap=\"nowrap\">\n";
+
+ if ( $self->config_( 'trayicon' ) == 0 ) {
+ $body .= "<form action=\"/configuration\">\n";
+ $body .= "<span class=\"securityWidgetStateOff\">$$language{No}</span>\n";
+ $body .= "<input type=\"submit\" class=\"toggleOn\" id=\"windowTrayIconOn\" name=\"toggle\" value=\"$$language{ChangeToYes}\" />\n";
+ $body .= "<input type=\"hidden\" name=\"windows_trayicon\" value=\"1\" />\n";
+ $body .= "<input type=\"hidden\" name=\"session\" value=\"$session_key\" />\n</form>\n";
+ } else {
+ $body .= "<form action=\"/configuration\">\n";
+ $body .= "<span class=\"securityWidgetStateOn\">$$language{Yes}</span>\n";
+ $body .= "<input type=\"submit\" class=\"toggleOn\" id=\"windowTrayIconOff\" name=\"toggle\" value=\"$$language{ChangeToNo}\" />\n";
+ $body .= "<input type=\"hidden\" name=\"windows_trayicon\" value=\"0\" />\n";
+ $body .= "<input type=\"hidden\" name=\"session\" value=\"$session_key\" />\n</form>\n";
+ }
+ $body .= "</td></tr></table>\n";
+ }
+
+ return $body;
+ }
+
+ # ---------------------------------------------------------------------------------------------
+ #
+ # validate_item
+ #
+ # $name The name of the item being configured, was passed in by the call
+ # to register_configuration_item
+ # $language Reference to the hash holding the current language
+ # $form Hash containing all form items
+ #
+ # Must return the HTML for this item
+ # ---------------------------------------------------------------------------------------------
+
+ sub validate_item
+ {
+ my ( $self, $name, $language, $form ) = @_;
+
+ if ( $name eq 'windows_trayicon' ) {
+ if ( defined($$form{windows_trayicon}) ) {
+ $self->config_( 'trayicon', $$form{windows_trayicon} );
+
+ if ( $$form{windows_trayicon} == 0 ) {
+ $self->{hideicon__} = Win32::API->new( "Platform/POPFileIcon.dll", "HideIcon", "", "N" );
+ $self->{hideicon__}->Call();
+ undef $self->{hideicon__};
+ }
+ }
+ }
+
+ return '';
+ }
+
+ # ---------------------------------------------------------------------------------------------
+ #
# prefork
#
***************
*** 92,95 ****
--- 169,184 ----
my $event = $self->{getmessage__}->Call();
+
+ # User wants the icon hidden
+
+ if ( $event == 3 ) {
+ $self->config_( 'trayicon', 0 );
+
+ $self->{hideicon__} = Win32::API->new( "Platform/POPFileIcon.dll", "HideIcon", "", "N" );
+ $self->{hideicon__}->Call();
+ undef $self->{hideicon__};
+
+ return 1;
+ }
# Double click icon, or select Open option in menu results in
|