added timer to suppress viewing values(passwords) for micasa store after a preset time in seconds.
This commit is contained in:
parent
22fb775d99
commit
64cfa770fc
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 4 14:24:10 MST 2006 - jnorman@novell.com
|
||||
- added timer to suppress viewing values(passwords) for micasa store
|
||||
after a preset time in seconds.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 3 8:45:10 MST 2006 - cmashayekhi@novell.com
|
||||
- micasad is set to be off on install and be turned on from YAST
|
||||
|
127
c_gui/MiCasa.cs
127
c_gui/MiCasa.cs
@ -25,7 +25,9 @@ namespace Novell.CASA.GUI {
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Specialized;
|
||||
using System.Threading;
|
||||
|
||||
using Gtk;
|
||||
using Glade;
|
||||
using Novell.CASA.MiCasa.Common;
|
||||
@ -45,7 +47,11 @@ public class MiCasa : Store
|
||||
|
||||
ArrayList arrDeletedKeys = null;
|
||||
|
||||
private SecretStore m_store = null;
|
||||
private SecretStore m_store = null;
|
||||
private String m_sRememberFor = "5";
|
||||
private DateTime m_dtRememberMPUntil = DateTime.Now;
|
||||
private Thread m_tRememberTimer = null;
|
||||
private int m_iRememberSeconds = 5;
|
||||
|
||||
#region Glade Widgets
|
||||
|
||||
@ -98,7 +104,12 @@ public class MiCasa : Store
|
||||
Gtk.Label labelLinkSecretID,
|
||||
labelLinkKeyID,
|
||||
label86,
|
||||
label88;
|
||||
label88,
|
||||
labelRememberFor,
|
||||
labelSeconds;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.SpinButton spinbuttonRememberFor;
|
||||
#endregion
|
||||
|
||||
|
||||
@ -469,32 +480,46 @@ public class MiCasa : Store
|
||||
/// SHOW PASSWORD CHECK BUTTON CLICKED
|
||||
/// </summary>
|
||||
public void on_cbuttonShowPassword_toggled(object obj, EventArgs args)
|
||||
{
|
||||
TreeViewColumn tvCol;
|
||||
|
||||
if( tvKeyValue.Model.IterNChildren() > 0 )
|
||||
if( true == cbuttonShowPassword.Active)
|
||||
{
|
||||
// prompt user for MasterPassword
|
||||
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogLogin.TransientFor = dialogManageSecret;
|
||||
|
||||
label86.Text = "Enter your Master Password to view values";
|
||||
entryMasterPassword3.Text="";
|
||||
entryMasterPassword3.HasFocus = true;
|
||||
label88.Hide();
|
||||
entryMasterPassword4.Hide();
|
||||
dialogLogin.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
}
|
||||
|
||||
{
|
||||
TreeViewColumn tvCol;
|
||||
|
||||
if (tvKeyValue.Model.IterNChildren() > 0)
|
||||
{
|
||||
|
||||
if ((true == cbuttonShowPassword.Active) && (m_dtRememberMPUntil.CompareTo(DateTime.Now) > 0))
|
||||
{
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
}
|
||||
else if (true == cbuttonShowPassword.Active)
|
||||
{
|
||||
// prompt user for MasterPassword
|
||||
|
||||
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
|
||||
gxmlTemp.Autoconnect(this);
|
||||
dialogLogin.TransientFor = dialogManageSecret;
|
||||
|
||||
label86.Text = "Enter your Master Password to view values";
|
||||
entryMasterPassword3.Text = "";
|
||||
entryMasterPassword3.HasFocus = true;
|
||||
label88.Hide();
|
||||
entryMasterPassword4.Hide();
|
||||
|
||||
labelRememberFor.Visible = true;
|
||||
labelSeconds.Visible = true;
|
||||
spinbuttonRememberFor.Visible = true;
|
||||
spinbuttonRememberFor.Text = m_sRememberFor;
|
||||
|
||||
dialogLogin.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void okbuttonLogin_clicked(object abj, EventArgs args)
|
||||
@ -508,7 +533,18 @@ public class MiCasa : Store
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
dialogLogin.Destroy();
|
||||
|
||||
// get seconds to remember
|
||||
m_sRememberFor = spinbuttonRememberFor.Text;
|
||||
if (m_sRememberFor != null)
|
||||
{
|
||||
DateTime dtNow = DateTime.Now;
|
||||
m_iRememberSeconds = int.Parse(m_sRememberFor);
|
||||
m_dtRememberMPUntil = dtNow.AddSeconds(m_iRememberSeconds);
|
||||
}
|
||||
dialogLogin.Destroy();
|
||||
if (m_iRememberSeconds > 0)
|
||||
StartRememberTimer();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -537,7 +573,36 @@ public class MiCasa : Store
|
||||
cbuttonShowPassword.Active = false;
|
||||
dialogLogin.Destroy();
|
||||
args.RetVal = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void StartRememberTimer()
|
||||
{
|
||||
//if (m_tRememberTimer == null)
|
||||
{
|
||||
m_tRememberTimer = new Thread(new ThreadStart(ResetTimerThreadFn));
|
||||
m_tRememberTimer.Start();
|
||||
}
|
||||
|
||||
}
|
||||
internal void ResetTimerThreadFn()
|
||||
{
|
||||
TreeViewColumn tvCol;
|
||||
Thread.Sleep(m_iRememberSeconds * 1000);
|
||||
if (tvKeyValue != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
cbuttonShowPassword.Active = false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void on_entryMasterPassword3_activate(object obj, EventArgs args)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user