NSL Support, expose Create and Modify Timestamp info thru miCASAWrapper.

This commit is contained in:
Jim Norman
2007-01-05 11:01:07 +00:00
parent f2b89108b9
commit d81e894996
8 changed files with 241 additions and 52 deletions

View File

@@ -148,14 +148,16 @@ public class MiCasa : Store
m_config = config;
/// SecretID TreeStore
tvSecretIDMiCasa = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvSecretIDMiCasa");
tvSecretIDMiCasa = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvSecretIDMiCasa");
tsSecretIDMiCasa = new TreeStore(typeof(string), typeof(string[]), typeof(string[]), typeof(string), typeof(string[]), typeof(string[]));
tvSecretIDMiCasa.AppendColumn("Secret ID",new CellRendererText(),"text",0);
tvSecretIDMiCasa.AppendColumn("Secret ID",new CellRendererText(),"text",0);
tvSecretIDMiCasa.Model = tsSecretIDMiCasa;
tsSecretIDMiCasa.SetSortColumnId(0, Gtk.SortType.Ascending);
tvSecretIDMiCasa.RowActivated += new RowActivatedHandler(OntvSecretIDMiCasaRowActivated);
tvSecretIDMiCasa.ButtonReleaseEvent += new ButtonReleaseEventHandler(OnRightClicked);
tvSecretIDMiCasa.CursorChanged += new EventHandler(OnCursorChanged);
/// NativeInfo TreeStore
tvNativeInfoMiCasa = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvNativeInfoMiCasa");
tsNativeInfoMiCasa = new TreeStore(typeof(string), typeof(string));
@@ -309,11 +311,14 @@ public class MiCasa : Store
cellEditable = new CellRendererText();
cellEditable.Editable = true;
cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
/// KEY:0 VALUE:1 VALUE-DUP:2 DIRTY-BIT:3 LINK:4
tsKeyValue = new TreeStore(typeof(string),typeof(string), typeof(string), typeof(bool), typeof(string));
/// KEY:0 VALUE:1 VALUE-DUP:2 DIRTY-BIT:3 LINK:4
tsKeyValue = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(bool), typeof(string), typeof(string), typeof(string));
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
tvKeyValue.AppendColumn("Linked", new CellRendererText(), "text", 4);
tvKeyValue.AppendColumn("Linked", new CellRendererText(), "text", 4);
tvKeyValue.AppendColumn("Created", new CellRendererText(), "text", 5);
tvKeyValue.AppendColumn("Modified", new CellRendererText(), "text", 6);
tvKeyValue.RowActivated += new RowActivatedHandler(tvKeyValue_RowActivated);
@@ -325,8 +330,13 @@ public class MiCasa : Store
for( int i=0; i< keys.Length; i++ )
{
Secret secret = ss.getSecret(selected);
Hashtable ht = secret.GetLinkedKeys(keys[i]);
Secret secret = ss.getSecret(selected);
Hashtable ht = secret.GetLinkedKeys(keys[i]);
DateTime dtCreated = secret.GetCreateTimeForKey(keys[i]);
DateTime dtModified = secret.GetModifiedTimeForKey(keys[i]);
if (ht != null && ht.Count > 0)
bHasLinks = true;
else
@@ -335,12 +345,23 @@ public class MiCasa : Store
if( (null != keys[i]) && (null != values[i]) )
if( bHasLinks )
{
tsKeyValue.AppendValues(keys[i], values[i], "********", false, "Yes");
tsKeyValue.AppendValues(keys[i],
values[i],
"********",
false,
"Yes",
dtCreated.ToShortDateString() + " " + dtCreated.ToShortTimeString(),
dtModified.ToShortDateString() + " " + dtModified.ToShortTimeString());
}
else
{
tsKeyValue.AppendValues(keys[i], values[i], "********", false, "No");
{
tsKeyValue.AppendValues(keys[i],
values[i],
"********",
false,
"No",
dtCreated.ToShortDateString() + " " + dtCreated.ToShortTimeString(),
dtModified.ToShortDateString() + " " + dtModified.ToShortTimeString());
}
}

View File

@@ -316,11 +316,21 @@ namespace Novell.CASA.GUI {
{
while( secIter.MoveNext() )
{//Enumerate the Time Nodes of this secret
if( secIter.Current.Name.Equals(CCFXML_ELEMENT_TIME_MODIFIED) )
{//miCASA-KeyChain-Secret-Key-Value-Time-modified
modifiedTime = secIter.Current.Value;
if( secIter.Current.Name.Equals(CCFXML_ELEMENT_TIME_MODIFIED) )
//miCASA-KeyChain-Secret-Key-Value-Time-modified
{
string sTicks = secIter.Current.Value;
try
{
DateTime dt = new DateTime(long.Parse(sTicks));
modifiedTime = secIter.Current.Value;
}
catch (Exception)
{
modifiedTime = "unknown";
}
}
}
}
@@ -402,11 +412,32 @@ namespace Novell.CASA.GUI {
strNativeValueArray[Common.INDEX_NATIVEINFO_SYNC] = synch;
strNativeValueArray[Common.INDEX_NATIVEINFO_SYNCTYPE] = synchType;
strNativeValueArray[Common.INDEX_NATIVEINFO_MODIFIEDTIME] = modifiedTime;
//Console.WriteLine("folderName="+folderName+"\n"+"typeID="+typeID+"\n"+"synch="+synch+"\n"+"synchType="+synchType+"\n"+"modifiedTime="+modifiedTime);
if ( storeIDentifier == Common.STORE_FIREFOX)
ls.AppendValues(secretID,strKeyArray,strValueArray,storeID,strNativeKeyArray,strNativeValueArray,boolIsPassArray);
else
ls.AppendValues(secretID,strKeyArray,strValueArray,storeID,strNativeKeyArray,strNativeValueArray);
//Console.WriteLine("folderName="+folderName+"\n"+"typeID="+typeID+"\n"+"synch="+synch+"\n"+"synchType="+synchType+"\n"+"modifiedTime="+modifiedTime);
if (storeIDentifier == Common.STORE_FIREFOX)
{
ls.AppendValues(secretID, strKeyArray, strValueArray, storeID, strNativeKeyArray, strNativeValueArray, boolIsPassArray);
}
else if (storeIDentifier == Common.STORE_MICASA)
{
// convert modifiedTime to human readable
DateTime dt;
try
{
dt = new DateTime(long.Parse(modifiedTime));
strNativeValueArray[Common.INDEX_NATIVEINFO_MODIFIEDTIME] = dt.ToShortDateString() + " " + dt.ToShortTimeString();
}
catch
{
strNativeValueArray[Common.INDEX_NATIVEINFO_MODIFIEDTIME] = modifiedTime;
}
ls.AppendValues(secretID, strKeyArray, strValueArray, storeID, strNativeKeyArray, strNativeValueArray);
}
else
{
ls.AppendValues(secretID, strKeyArray, strValueArray, storeID, strNativeKeyArray, strNativeValueArray);
}
//Re-Initialize for next iteration
secretID = "";