diff --git a/CASA/gui/CasaTray.cs b/CASA/gui/CasaTray.cs index 040b7928..33cc98e5 100644 --- a/CASA/gui/CasaTray.cs +++ b/CASA/gui/CasaTray.cs @@ -41,6 +41,15 @@ namespace Novell.CASA.GUI private static System.Windows.Forms.NotifyIcon notifyIcon; public static System.Drawing.Icon m_iconNormal; public static System.Drawing.Icon m_iconLocked; + + private System.Windows.Forms.ToolStripMenuItem cmOpen; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem cmLock; + private System.Windows.Forms.ToolStripMenuItem cmUnlock; + private System.Windows.Forms.ToolStripMenuItem cmDestroySecrets; + private System.Windows.Forms.ToolStripMenuItem cmExit; #endif #if LINUX Egg.TrayIcon icon; @@ -143,8 +152,101 @@ namespace Novell.CASA.GUI icon.ShowAll(); #endif - } - + } + + +#if W32 + + private void ShowContextMenu() + { + + try + { + System.Windows.Forms.ContextMenuStrip cm = new System.Windows.Forms.ContextMenuStrip(); + notifyIcon.ContextMenuStrip = cm; + + toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + + cmOpen = new System.Windows.Forms.ToolStripMenuItem("Manage Secrets"); + cmLock = new System.Windows.Forms.ToolStripMenuItem("Lock Secrets"); + cmUnlock = new System.Windows.Forms.ToolStripMenuItem("Unlock Secrets"); + cmDestroySecrets = new System.Windows.Forms.ToolStripMenuItem("Destroy Secrets"); + cmExit = new System.Windows.Forms.ToolStripMenuItem("Exit"); + + cmOpen.Click += new EventHandler(cmOpen_Click); + cmLock.Click += new EventHandler(cmLock_Click); + cmUnlock.Click += new EventHandler(cmUnlock_Click); + cmDestroySecrets.Click += new EventHandler(cmDestroySecrets_Click); + cmExit.Click += new EventHandler(cmExit_Click); + + cmUnlock.Enabled = false; + + cm.Items.AddRange(new System.Windows.Forms.ToolStripItem[] + { + cmOpen, + toolStripSeparator1, + cmLock, + cmUnlock, + toolStripSeparator2, + cmDestroySecrets, + toolStripSeparator3, + cmExit}); + + cm.Name = "contextMenuStripNotify"; + cm.ShowImageMargin = false; + cm.Size = new System.Drawing.Size(143, 104); + + if (MiCASAStore.IsLocked()) + { + cmDestroySecrets.Enabled = false; + cmLock.Enabled = false; + cmUnlock.Enabled = true; + } + else + { + cmDestroySecrets.Enabled = true; + cmLock.Enabled = true; + cmUnlock.Enabled = false; + } + + + } + catch (Exception e) + { + Logger.DbgLog(e.ToString()); + } + + } + + void cmOpen_Click(object sender, EventArgs e) + { + menuLaunchGUI_Activated(null, null); + } + + void cmLock_Click(object sender, EventArgs e) + { + menuLockMiCasa_Activated(null, null); + } + + void cmUnlock_Click(object sender, EventArgs e) + { + menuLockMiCasa_Activated(null, null); + } + + void cmDestroySecrets_Click(object sender, EventArgs e) + { + menuDestroyMiCasa_Activated(null, null); + } + + void cmExit_Click(object sender, EventArgs e) + { + OnPopupClick(sender, e); + } + +#else + private void ShowContextMenu() { if (popupMenu != null && popupMenu.Visible) @@ -225,6 +327,7 @@ namespace Novell.CASA.GUI popupMenu.Popup(); } } +#endif private void OnImageClick (object o, ButtonPressEventArgs args) // handler for mouse click { diff --git a/CASA/gui/windows/NoGTKSharpForm.resx b/CASA/gui/windows/NoGTKSharpForm.resx index 09a5323a..e565060c 100644 --- a/CASA/gui/windows/NoGTKSharpForm.resx +++ b/CASA/gui/windows/NoGTKSharpForm.resx @@ -3,7 +3,7 @@ + + + + + + + + + + + + + + + + + + - + + @@ -89,60 +109,16 @@ text/microsoft-resx - 1.3 + 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - False - - - Private - - - Private - - - False - - - Private - - - Private - - - Private - - - False - - - Private - - - False - - - Private - - - Private - - - False - - - Private - - - Private - - + + iVBORw0KGgoAAAANSUhEUgAAAdYAAAA4CAYAAABAI9kcAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA @@ -220,37 +196,13 @@ qQAAAABJRU5ErkJggg== - + + 17, 17 + + True - - - (Default) - - - False - - - False - - - 8, 8 - - - True - - - 80 - - - NoGTKSharpForm - - - True - - - Private - - + + AAABAAkAMDAQAAEABABoBgAAlgAAACAgEAABAAQA6AIAAP4GAAAQEBAAAQAEACgBAADmCQAAMDAAAAEA CACoDgAADgsAACAgAAABAAgAqAgAALYZAAAQEAAAAQAIAGgFAABeIgAAMDAAAAEAIACoJQAAxicAACAg