Added timer for Remember Master Password.
This commit is contained in:
parent
e6cd7f2a9f
commit
bcc833a1bd
@ -115,6 +115,8 @@ namespace Novell.CASA.GUI
|
||||
[Glade.Widget]
|
||||
Gtk.MenuItem mmiNew,
|
||||
mmiNewKey,
|
||||
mmiImportSecrets,
|
||||
mmiExportSecrets,
|
||||
mmiView,
|
||||
mmiLink,
|
||||
mmiCopy,
|
||||
@ -305,7 +307,7 @@ namespace Novell.CASA.GUI
|
||||
if( Common.IS_MICASA )
|
||||
{
|
||||
Logger.DbgLog("GUI:CasaMain.new MiCasa().");
|
||||
objMiCasa = new MiCasa();
|
||||
objMiCasa = new MiCasa(config);
|
||||
}
|
||||
else
|
||||
(notebookStores.GetNthPage(Common.STORE_MICASA)).Visible = Common.IS_MICASA;
|
||||
@ -313,7 +315,7 @@ namespace Novell.CASA.GUI
|
||||
if( Common.IS_FIREFOX )
|
||||
{
|
||||
Logger.DbgLog("GUI:CasaMain.new Firefox().");
|
||||
objFirefox = new Firefox();
|
||||
objFirefox = new Firefox(config);
|
||||
}
|
||||
else
|
||||
(notebookStores.GetNthPage(Common.STORE_FIREFOX)).Visible = Common.IS_FIREFOX;
|
||||
@ -329,7 +331,7 @@ namespace Novell.CASA.GUI
|
||||
if( Common.IS_KDEWALLET )
|
||||
{
|
||||
Logger.DbgLog("GUI:CasaMain.new KdeWallet().");
|
||||
objKdeWallet = new KdeWallet();
|
||||
objKdeWallet = new KdeWallet(config);
|
||||
}
|
||||
else
|
||||
(notebookStores.GetNthPage(Common.STORE_KDEWALLET)).Visible = Common.IS_KDEWALLET;
|
||||
@ -337,7 +339,7 @@ namespace Novell.CASA.GUI
|
||||
if( Common.IS_GNOMEKEYRING )
|
||||
{
|
||||
Logger.DbgLog("GUI:CasaMain.new GnomeKeyring().");
|
||||
objGnomeKeyring = new GnomeKeyring();
|
||||
objGnomeKeyring = new GnomeKeyring(config);
|
||||
}
|
||||
else
|
||||
(notebookStores.GetNthPage(Common.STORE_GNOMEKEYRING)).Visible = Common.IS_GNOMEKEYRING;
|
||||
@ -1264,6 +1266,9 @@ namespace Novell.CASA.GUI
|
||||
mmiDebug.Sensitive = false;
|
||||
mmiOptions.Sensitive = false;
|
||||
mmiEdit.Sensitive = false;
|
||||
mmiImportSecrets.Sensitive = false;
|
||||
mmiExportSecrets.Sensitive = false;
|
||||
|
||||
m_bGuiLocked = true;
|
||||
|
||||
|
||||
@ -1280,6 +1285,10 @@ namespace Novell.CASA.GUI
|
||||
mmiDebug.Sensitive = true;
|
||||
mmiOptions.Sensitive = true;
|
||||
mmiEdit.Sensitive = true;
|
||||
mmiImportSecrets.Sensitive = true;
|
||||
mmiExportSecrets.Sensitive = true;
|
||||
|
||||
|
||||
m_bGuiLocked = false;
|
||||
|
||||
//refresh secrets
|
||||
@ -1707,7 +1716,7 @@ namespace Novell.CASA.GUI
|
||||
if(Common.IS_FIREFOX)
|
||||
{
|
||||
if( null == objFirefox )
|
||||
objFirefox = new Firefox();
|
||||
objFirefox = new Firefox(config);
|
||||
//objFirefox.AggregateStore();
|
||||
notebookStores.GetNthPage(Common.STORE_FIREFOX).Visible = true;
|
||||
StorePolicyInterface.SetAggregationPolicy(Common.STORE_FIREFOX, true, storeID, 1);
|
||||
@ -1739,7 +1748,7 @@ namespace Novell.CASA.GUI
|
||||
if(Common.IS_KDEWALLET)
|
||||
{
|
||||
if( null == objKdeWallet )
|
||||
objKdeWallet = new KdeWallet();
|
||||
objKdeWallet = new KdeWallet(config);
|
||||
//objKdeWallet.AggregateStore();
|
||||
notebookStores.GetNthPage(Common.STORE_KDEWALLET).Visible = true;
|
||||
StorePolicyInterface.SetAggregationPolicy(Common.STORE_KDEWALLET, true, storeID, 1);
|
||||
@ -1755,7 +1764,7 @@ namespace Novell.CASA.GUI
|
||||
if(Common.IS_GNOMEKEYRING)
|
||||
{
|
||||
if( null == objGnomeKeyring )
|
||||
objGnomeKeyring = new GnomeKeyring();
|
||||
objGnomeKeyring = new GnomeKeyring(config);
|
||||
//objGnomeKeyring.AggregateStore();
|
||||
notebookStores.GetNthPage(Common.STORE_GNOMEKEYRING).Visible = true;
|
||||
StorePolicyInterface.SetAggregationPolicy(Common.STORE_GNOMEKEYRING, true, storeID, 1);
|
||||
|
@ -41,6 +41,9 @@ public class Firefox : Store
|
||||
|
||||
public bool IS_STORE_AGGREGATED = false;
|
||||
|
||||
private int m_iRememberSeconds = 5;
|
||||
private String m_sRememberFor = "5";
|
||||
private Config m_config = null;
|
||||
#region Glade Widgets
|
||||
|
||||
[Glade.Widget]
|
||||
@ -89,6 +92,12 @@ public class Firefox : Store
|
||||
cmiLink,
|
||||
cmiCopy;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Label labelRememberFor,
|
||||
labelSeconds;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.SpinButton spinbuttonRememberFor;
|
||||
#endregion
|
||||
|
||||
///#######################################################################
|
||||
@ -96,10 +105,11 @@ public class Firefox : Store
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public Firefox()
|
||||
public Firefox(Config config)
|
||||
{
|
||||
Logger.DbgLog("GUI:Firefox.Firefox() - BEGIN");
|
||||
|
||||
m_config = config;
|
||||
/// SecretID TreeStore
|
||||
tvSecretIDFirefox = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvSecretIDFirefox");
|
||||
tsSecretIDFirefox = new TreeStore(typeof(string), typeof(string[]), typeof(string[]), typeof(string), typeof(string[]), typeof(string[]));
|
||||
@ -397,9 +407,23 @@ public class Firefox : Store
|
||||
{
|
||||
TreeViewColumn tvCol;
|
||||
|
||||
if( tvKeyValue.Model.IterNChildren() > 0 )
|
||||
if( true == cbuttonShowPassword.Active)
|
||||
{
|
||||
if (tvKeyValue.Model.IterNChildren() > 0)
|
||||
{
|
||||
if ((true == cbuttonShowPassword.Active)
|
||||
&& (CommonGUI.GetRememberMPUntil().CompareTo(DateTime.Now) > 0))
|
||||
{
|
||||
// set and start the timer if needed
|
||||
TimeSpan ts = CommonGUI.GetRememberMPUntil().Subtract(DateTime.Now);
|
||||
m_iRememberSeconds = ts.Seconds;
|
||||
StartRememberTimer();
|
||||
|
||||
// display the values
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
}
|
||||
else if (true == cbuttonShowPassword.Active)
|
||||
{
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogLogin.TransientFor = dialogManageSecret;
|
||||
@ -409,6 +433,10 @@ public class Firefox : Store
|
||||
entryMasterPassword3.HasFocus = true;
|
||||
label88.Hide();
|
||||
entryMasterPassword4.Hide();
|
||||
labelRememberFor.Visible = true;
|
||||
labelSeconds.Visible = true;
|
||||
spinbuttonRememberFor.Visible = true;
|
||||
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
|
||||
dialogLogin.Show();
|
||||
}
|
||||
else
|
||||
@ -417,7 +445,7 @@ public class Firefox : Store
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void okbuttonLogin_clicked(object abj, EventArgs args)
|
||||
@ -431,7 +459,25 @@ public class Firefox : Store
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
// get seconds to remember
|
||||
m_sRememberFor = spinbuttonRememberFor.Text;
|
||||
if (m_sRememberFor != null)
|
||||
{
|
||||
DateTime dtNow = DateTime.Now;
|
||||
m_iRememberSeconds = int.Parse(m_sRememberFor);
|
||||
CommonGUI.SetRememberMPUntil(dtNow.AddSeconds(m_iRememberSeconds));
|
||||
}
|
||||
|
||||
// save off remember time if user changed it
|
||||
string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5");
|
||||
if (!sSaveTimed.Equals(m_sRememberFor))
|
||||
{
|
||||
m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING,m_sRememberFor);
|
||||
m_config.WriteConfig();
|
||||
}
|
||||
dialogLogin.Destroy();
|
||||
if (m_iRememberSeconds > 0)
|
||||
StartRememberTimer();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -460,6 +506,35 @@ public class Firefox : Store
|
||||
dialogLogin.Destroy();
|
||||
args.RetVal = true;
|
||||
}
|
||||
|
||||
private bool bTimerActive = false;
|
||||
public void StartRememberTimer()
|
||||
{
|
||||
if (!bTimerActive)
|
||||
{
|
||||
GLib.Timeout.Add ((uint)(m_iRememberSeconds * 1000), new GLib.TimeoutHandler (update_gui));
|
||||
bTimerActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
private bool update_gui()
|
||||
{
|
||||
TreeViewColumn tvCol;
|
||||
try
|
||||
{
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
cbuttonShowPassword.Active = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//Console.WriteLine(e.ToString());
|
||||
}
|
||||
bTimerActive = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void on_helpbuttonAuthentication_clicked(object obj, EventArgs args)
|
||||
{
|
||||
|
@ -48,6 +48,9 @@ public class GnomeKeyring : Store
|
||||
string[] stringNetworkManagerServerType = new string[]{ "SSH",
|
||||
"FTP (with login)",
|
||||
"Windows share" };
|
||||
private int m_iRememberSeconds = 5;
|
||||
private String m_sRememberFor = "5";
|
||||
private Config m_config = null;
|
||||
|
||||
#region Glade Widgets
|
||||
|
||||
@ -107,6 +110,12 @@ public class GnomeKeyring : Store
|
||||
|
||||
[Glade.Widget]
|
||||
Combo comboNetworkManager;
|
||||
[Glade.Widget]
|
||||
Gtk.Label labelRememberFor,
|
||||
labelSeconds;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.SpinButton spinbuttonRememberFor;
|
||||
#endregion
|
||||
|
||||
|
||||
@ -117,7 +126,7 @@ public class GnomeKeyring : Store
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public GnomeKeyring()
|
||||
public GnomeKeyring(Config config)
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.GnomeKeyring() - BEGIN");
|
||||
|
||||
@ -138,6 +147,8 @@ public class GnomeKeyring : Store
|
||||
tvNativeInfoGnomeKeyring.ModifyBase(StateType.Normal,new Gdk.Color(0xff,0xff,0xe6));
|
||||
/// Aggregate the store
|
||||
//AggregateStore();
|
||||
|
||||
m_config = config;
|
||||
|
||||
Logger.DbgLog("GUI:GnomeKeyring.GnomeKeyring() - END");
|
||||
}
|
||||
@ -469,9 +480,23 @@ public class GnomeKeyring : Store
|
||||
{
|
||||
TreeViewColumn tvCol;
|
||||
|
||||
if( tvKeyValue.Model.IterNChildren() > 0 )
|
||||
if( true == cbuttonShowPassword.Active)
|
||||
{
|
||||
if (tvKeyValue.Model.IterNChildren() > 0)
|
||||
{
|
||||
if ((true == cbuttonShowPassword.Active)
|
||||
&& (CommonGUI.GetRememberMPUntil().CompareTo(DateTime.Now) > 0))
|
||||
{
|
||||
// set and start the timer if needed
|
||||
TimeSpan ts = CommonGUI.GetRememberMPUntil().Subtract(DateTime.Now);
|
||||
m_iRememberSeconds = ts.Seconds;
|
||||
StartRememberTimer();
|
||||
|
||||
// display the values
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
}
|
||||
else if (true == cbuttonShowPassword.Active)
|
||||
{
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogLogin.TransientFor = dialogManageSecret;
|
||||
@ -481,6 +506,10 @@ public class GnomeKeyring : Store
|
||||
entryMasterPassword3.HasFocus = true;
|
||||
label88.Hide();
|
||||
entryMasterPassword4.Hide();
|
||||
labelRememberFor.Visible = true;
|
||||
labelSeconds.Visible = true;
|
||||
spinbuttonRememberFor.Visible = true;
|
||||
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
|
||||
dialogLogin.Show();
|
||||
}
|
||||
else
|
||||
@ -489,7 +518,7 @@ public class GnomeKeyring : Store
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void okbuttonLogin_clicked(object abj, EventArgs args)
|
||||
@ -503,7 +532,25 @@ public class GnomeKeyring : Store
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
// get seconds to remember
|
||||
m_sRememberFor = spinbuttonRememberFor.Text;
|
||||
if (m_sRememberFor != null)
|
||||
{
|
||||
DateTime dtNow = DateTime.Now;
|
||||
m_iRememberSeconds = int.Parse(m_sRememberFor);
|
||||
CommonGUI.SetRememberMPUntil(dtNow.AddSeconds(m_iRememberSeconds));
|
||||
}
|
||||
|
||||
// save off remember time if user changed it
|
||||
string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5");
|
||||
if (!sSaveTimed.Equals(m_sRememberFor))
|
||||
{
|
||||
m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING,m_sRememberFor);
|
||||
m_config.WriteConfig();
|
||||
}
|
||||
dialogLogin.Destroy();
|
||||
if (m_iRememberSeconds > 0)
|
||||
StartRememberTimer();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -533,6 +580,35 @@ public class GnomeKeyring : Store
|
||||
dialogLogin.Destroy();
|
||||
args.RetVal = true;
|
||||
}
|
||||
|
||||
private bool bTimerActive = false;
|
||||
public void StartRememberTimer()
|
||||
{
|
||||
if (!bTimerActive)
|
||||
{
|
||||
GLib.Timeout.Add ((uint)(m_iRememberSeconds * 1000), new GLib.TimeoutHandler (update_gui));
|
||||
bTimerActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
private bool update_gui()
|
||||
{
|
||||
TreeViewColumn tvCol;
|
||||
try
|
||||
{
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
cbuttonShowPassword.Active = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//Console.WriteLine(e.ToString());
|
||||
}
|
||||
bTimerActive = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void on_entryMasterPassword3_activate(object obj, EventArgs args)
|
||||
{
|
||||
|
@ -53,6 +53,9 @@ public class KdeWallet : Store
|
||||
"Gmail (gmail.com)",
|
||||
"Yahoo! Mail (mail.yahoo.com)",
|
||||
"MSN Hotmail (hotmail.com)"};
|
||||
private int m_iRememberSeconds = 5;
|
||||
private String m_sRememberFor = "5";
|
||||
private Config m_config = null;
|
||||
|
||||
#region Glade Widgets
|
||||
|
||||
@ -104,6 +107,12 @@ public class KdeWallet : Store
|
||||
cmiView,
|
||||
cmiLink,
|
||||
cmiCopy;
|
||||
[Glade.Widget]
|
||||
Gtk.Label labelRememberFor,
|
||||
labelSeconds;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.SpinButton spinbuttonRememberFor;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Combo comboKonquererTemplates;
|
||||
@ -116,7 +125,7 @@ public class KdeWallet : Store
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public KdeWallet()
|
||||
public KdeWallet(Config config)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.KdeWallet() - BEGIN");
|
||||
|
||||
@ -137,6 +146,7 @@ public class KdeWallet : Store
|
||||
tvNativeInfoKdeWallet.ModifyBase(StateType.Normal,new Gdk.Color(0xff,0xff,0xe6));
|
||||
/// Aggregate the store
|
||||
//AggregateStore();
|
||||
m_config = config;
|
||||
|
||||
Logger.DbgLog("GUI:KdeWallet.KdeWallet() - END");
|
||||
}
|
||||
@ -470,27 +480,45 @@ public class KdeWallet : Store
|
||||
{
|
||||
TreeViewColumn tvCol;
|
||||
|
||||
if( tvKeyValue.Model.IterNChildren() > 0 )
|
||||
if( true == cbuttonShowPassword.Active)
|
||||
if (tvKeyValue.Model.IterNChildren() > 0)
|
||||
{
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogLogin.TransientFor = dialogManageSecret;
|
||||
if ((true == cbuttonShowPassword.Active)
|
||||
&& (CommonGUI.GetRememberMPUntil().CompareTo(DateTime.Now) > 0))
|
||||
{
|
||||
// set and start the timer if needed
|
||||
TimeSpan ts = CommonGUI.GetRememberMPUntil().Subtract(DateTime.Now);
|
||||
m_iRememberSeconds = ts.Seconds;
|
||||
StartRememberTimer();
|
||||
|
||||
// display the values
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
}
|
||||
else if (true == cbuttonShowPassword.Active)
|
||||
{
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogLogin.TransientFor = dialogManageSecret;
|
||||
|
||||
label86.Text = "Enter your Master Password to view passwords";
|
||||
entryMasterPassword3.Text="";
|
||||
entryMasterPassword3.HasFocus = true;
|
||||
label88.Hide();
|
||||
entryMasterPassword4.Hide();
|
||||
dialogLogin.Show();
|
||||
label86.Text = "Enter your Master Password to view passwords";
|
||||
entryMasterPassword3.Text="";
|
||||
entryMasterPassword3.HasFocus = true;
|
||||
label88.Hide();
|
||||
entryMasterPassword4.Hide();
|
||||
labelRememberFor.Visible = true;
|
||||
labelSeconds.Visible = true;
|
||||
spinbuttonRememberFor.Visible = true;
|
||||
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
|
||||
dialogLogin.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
}
|
||||
}
|
||||
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)
|
||||
@ -504,7 +532,25 @@ public class KdeWallet : Store
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
// get seconds to remember
|
||||
m_sRememberFor = spinbuttonRememberFor.Text;
|
||||
if (m_sRememberFor != null)
|
||||
{
|
||||
DateTime dtNow = DateTime.Now;
|
||||
m_iRememberSeconds = int.Parse(m_sRememberFor);
|
||||
CommonGUI.SetRememberMPUntil(dtNow.AddSeconds(m_iRememberSeconds));
|
||||
}
|
||||
|
||||
// save off remember time if user changed it
|
||||
string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5");
|
||||
if (!sSaveTimed.Equals(m_sRememberFor))
|
||||
{
|
||||
m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING,m_sRememberFor);
|
||||
m_config.WriteConfig();
|
||||
}
|
||||
dialogLogin.Destroy();
|
||||
if (m_iRememberSeconds > 0)
|
||||
StartRememberTimer();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -534,6 +580,35 @@ public class KdeWallet : Store
|
||||
dialogLogin.Destroy();
|
||||
args.RetVal = true;
|
||||
}
|
||||
|
||||
private bool bTimerActive = false;
|
||||
public void StartRememberTimer()
|
||||
{
|
||||
if (!bTimerActive)
|
||||
{
|
||||
GLib.Timeout.Add ((uint)(m_iRememberSeconds * 1000), new GLib.TimeoutHandler (update_gui));
|
||||
bTimerActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
private bool update_gui()
|
||||
{
|
||||
TreeViewColumn tvCol;
|
||||
try
|
||||
{
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
cbuttonShowPassword.Active = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//Console.WriteLine(e.ToString());
|
||||
}
|
||||
bTimerActive = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void on_entryMasterPassword3_activate(object obj, EventArgs args)
|
||||
{
|
||||
|
@ -48,11 +48,12 @@ public class MiCasa : Store
|
||||
ArrayList arrDeletedKeys = 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;
|
||||
|
||||
|
||||
private int m_iRememberSeconds = 5;
|
||||
private String m_sRememberFor = "5";
|
||||
|
||||
|
||||
private Config m_config = null;
|
||||
#region Glade Widgets
|
||||
|
||||
[Glade.Widget]
|
||||
@ -121,10 +122,12 @@ public class MiCasa : Store
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public MiCasa()
|
||||
public MiCasa(Config config)
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.MiCasa() - BEGIN");
|
||||
|
||||
m_config = config;
|
||||
|
||||
/// SecretID TreeStore
|
||||
tvSecretIDMiCasa = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvSecretIDMiCasa");
|
||||
tsSecretIDMiCasa = new TreeStore(typeof(string), typeof(string[]), typeof(string[]), typeof(string), typeof(string[]), typeof(string[]));
|
||||
@ -142,8 +145,7 @@ public class MiCasa : Store
|
||||
tvNativeInfoMiCasa.Model = tsNativeInfoMiCasa;
|
||||
tvNativeInfoMiCasa.ModifyBase(StateType.Normal,new Gdk.Color(0xff,0xff,0xe6));
|
||||
/// Aggregate the store
|
||||
AggregateStore();
|
||||
|
||||
AggregateStore();
|
||||
Logger.DbgLog("GUI:MiCasa.MiCasa() - END");
|
||||
}
|
||||
|
||||
@ -499,9 +501,15 @@ public class MiCasa : Store
|
||||
|
||||
if (tvKeyValue.Model.IterNChildren() > 0)
|
||||
{
|
||||
if ((true == cbuttonShowPassword.Active)
|
||||
&& (CommonGUI.GetRememberMPUntil().CompareTo(DateTime.Now) > 0))
|
||||
{
|
||||
// set and start the timer if needed
|
||||
TimeSpan ts = CommonGUI.GetRememberMPUntil().Subtract(DateTime.Now);
|
||||
m_iRememberSeconds = ts.Seconds;
|
||||
StartRememberTimer();
|
||||
|
||||
if ((true == cbuttonShowPassword.Active) && (m_dtRememberMPUntil.CompareTo(DateTime.Now) > 0))
|
||||
{
|
||||
// display the values
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
@ -523,8 +531,8 @@ public class MiCasa : Store
|
||||
labelRememberFor.Visible = true;
|
||||
labelSeconds.Visible = true;
|
||||
spinbuttonRememberFor.Visible = true;
|
||||
spinbuttonRememberFor.Text = m_sRememberFor;
|
||||
|
||||
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
|
||||
|
||||
dialogLogin.Show();
|
||||
}
|
||||
else
|
||||
@ -548,16 +556,23 @@ public class MiCasa : Store
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
|
||||
// get seconds to remember
|
||||
|
||||
// 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);
|
||||
CommonGUI.SetRememberMPUntil(dtNow.AddSeconds(m_iRememberSeconds));
|
||||
}
|
||||
|
||||
|
||||
// save off remember time if user changed it
|
||||
string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5");
|
||||
if (!sSaveTimed.Equals(m_sRememberFor))
|
||||
{
|
||||
m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING,m_sRememberFor);
|
||||
m_config.WriteConfig();
|
||||
}
|
||||
|
||||
dialogLogin.Destroy();
|
||||
|
||||
if (m_iRememberSeconds > 0)
|
||||
@ -592,35 +607,35 @@ public class MiCasa : Store
|
||||
args.RetVal = true;
|
||||
}
|
||||
|
||||
private bool bTimerActive = false;
|
||||
public void StartRememberTimer()
|
||||
{
|
||||
// NOTE: USE A TIMER RATHER THAN A THREAD
|
||||
if (m_tRememberTimer == null)
|
||||
{
|
||||
m_tRememberTimer = new Thread(new ThreadStart(ResetTimerThreadFn));
|
||||
m_tRememberTimer.Start();
|
||||
}
|
||||
|
||||
{
|
||||
if (!bTimerActive)
|
||||
{
|
||||
GLib.Timeout.Add ((uint)(m_iRememberSeconds * 1000), new GLib.TimeoutHandler (update_gui));
|
||||
bTimerActive = true;
|
||||
}
|
||||
}
|
||||
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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool update_gui()
|
||||
{
|
||||
TreeViewColumn tvCol;
|
||||
try
|
||||
{
|
||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.InsertColumn(tvCol, 1);
|
||||
cbuttonShowPassword.Active = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//Console.WriteLine(e.ToString());
|
||||
}
|
||||
bTimerActive = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void on_entryMasterPassword3_activate(object obj, EventArgs args)
|
||||
{
|
||||
@ -1264,7 +1279,7 @@ public class MiCasa : Store
|
||||
{
|
||||
md.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
///##################################################################
|
||||
|
@ -56,7 +56,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3902">
|
||||
<widget class="GtkImage" id="image3935">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-new</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -78,7 +78,7 @@
|
||||
<signal name="activate" handler="OnNewSecretActivated" last_modification_time="Tue, 27 Sep 2005 06:02:26 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3903">
|
||||
<widget class="GtkImage" id="image3936">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-new</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -99,7 +99,7 @@
|
||||
<signal name="activate" handler="OnNewKeyActivated" last_modification_time="Tue, 27 Sep 2005 06:02:36 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3904">
|
||||
<widget class="GtkImage" id="image3937">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-new</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -125,7 +125,7 @@
|
||||
<accelerator key="F5" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3905">
|
||||
<widget class="GtkImage" id="image3938">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-refresh</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -152,7 +152,7 @@
|
||||
<signal name="activate" handler="OnLockMiCASASecrets" last_modification_time="Mon, 10 Oct 2005 19:51:54 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3906">
|
||||
<widget class="GtkImage" id="image3939">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-authentication</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -173,7 +173,7 @@
|
||||
<signal name="activate" handler="OnUnLockMiCASASecrets" last_modification_time="Tue, 11 Oct 2005 20:12:35 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3907">
|
||||
<widget class="GtkImage" id="image3940">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -194,7 +194,7 @@
|
||||
<signal name="activate" handler="OnDestroyMiCASASecrets" last_modification_time="Tue, 11 Oct 2005 20:12:35 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3908">
|
||||
<widget class="GtkImage" id="image3941">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-delete</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -214,14 +214,14 @@
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="exportSecrets">
|
||||
<widget class="GtkImageMenuItem" id="mmiExportSecrets">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Export Secrets</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_exportSecrets_activate" last_modification_time="Mon, 07 Aug 2006 19:38:42 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3909">
|
||||
<widget class="GtkImage" id="image3942">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-floppy</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -235,14 +235,14 @@
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="importSecrets">
|
||||
<widget class="GtkImageMenuItem" id="mmiImportSecrets">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Import Secrets</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_importSecrets_activate" last_modification_time="Mon, 07 Aug 2006 19:38:42 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3910">
|
||||
<widget class="GtkImage" id="image3943">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -270,7 +270,7 @@
|
||||
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3911">
|
||||
<widget class="GtkImage" id="image3944">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-quit</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -306,7 +306,7 @@
|
||||
<accelerator key="F2" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3912">
|
||||
<widget class="GtkImage" id="image3945">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-zoom-fit</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -327,7 +327,7 @@
|
||||
<signal name="activate" handler="LinkKeyValue" last_modification_time="Fri, 19 Aug 2005 06:23:15 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3913">
|
||||
<widget class="GtkImage" id="image3946">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -348,7 +348,7 @@
|
||||
<signal name="activate" handler="CopyKeyValue" last_modification_time="Fri, 19 Aug 2005 06:23:15 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3914">
|
||||
<widget class="GtkImage" id="image3947">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-copy</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -376,7 +376,7 @@
|
||||
<accelerator key="Delete" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3915">
|
||||
<widget class="GtkImage" id="image3948">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-delete</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -410,7 +410,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3916">
|
||||
<widget class="GtkImage" id="image3949">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-execute</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -432,7 +432,7 @@
|
||||
<signal name="activate" handler="on_konquerer_activate" last_modification_time="Thu, 02 Mar 2006 07:08:06 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3917">
|
||||
<widget class="GtkImage" id="image3950">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-execute</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -453,7 +453,7 @@
|
||||
<signal name="activate" handler="on_kopete_activate" last_modification_time="Thu, 02 Mar 2006 07:08:44 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3918">
|
||||
<widget class="GtkImage" id="image3951">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-execute</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -474,7 +474,7 @@
|
||||
<signal name="activate" handler="on_networkmanager_activate" last_modification_time="Thu, 02 Mar 2006 07:07:54 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3919">
|
||||
<widget class="GtkImage" id="image3952">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-execute</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -495,7 +495,7 @@
|
||||
<signal name="activate" handler="on_gaim_activate" last_modification_time="Thu, 02 Mar 2006 07:07:29 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3920">
|
||||
<widget class="GtkImage" id="image3953">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-execute</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -520,7 +520,7 @@
|
||||
<signal name="activate" handler="ResetMasterPassword" last_modification_time="Wed, 02 Nov 2005 15:28:00 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3921">
|
||||
<widget class="GtkImage" id="image3954">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-revert-to-saved</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -547,7 +547,7 @@
|
||||
<signal name="activate" handler="Preferences" last_modification_time="Fri, 19 Aug 2005 06:40:17 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3922">
|
||||
<widget class="GtkImage" id="image3955">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -581,7 +581,7 @@
|
||||
<signal name="activate" handler="on_create_sample_secrets1_activate" last_modification_time="Fri, 30 Sep 2005 12:58:41 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3923">
|
||||
<widget class="GtkImage" id="image3956">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -602,7 +602,7 @@
|
||||
<signal name="activate" handler="on_remove_test_secrets1_activate" last_modification_time="Fri, 30 Sep 2005 12:59:05 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3924">
|
||||
<widget class="GtkImage" id="image3957">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-remove</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -653,7 +653,7 @@
|
||||
<accelerator key="F1" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3925">
|
||||
<widget class="GtkImage" id="image3958">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-help</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -680,7 +680,7 @@
|
||||
<signal name="activate" handler="About" last_modification_time="Thu, 01 Sep 2005 15:30:28 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3926">
|
||||
<widget class="GtkImage" id="image3959">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-info</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
Loading…
Reference in New Issue
Block a user