- Added support for ADD/MODIFY/DELETE functionalities for Keyring and Kwallet
stores in the GUI. - Updated the Glade file with version info. ............................................................
This commit is contained in:
parent
bed0ba9d0f
commit
b8aedf332e
@ -26,7 +26,7 @@ using System.Runtime.CompilerServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.5.*")]
|
||||
[assembly: AssemblyVersion("1.6.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
|
@ -3,11 +3,11 @@
|
||||
/// FILE : CasaMain.cs
|
||||
/// DESCRIPTION : The main class for CASA application.
|
||||
/// AUTHORS : Jim Norman, CSL.Manojna
|
||||
/// UPDATED ON : 26 Sept, 05
|
||||
/// UPDATED ON : 03 Jan, 06
|
||||
///#################################################################
|
||||
|
||||
|
||||
namespace Novell.CASA.GUI
|
||||
namespace Novell.CASA.GUI
|
||||
{
|
||||
|
||||
|
||||
@ -39,36 +39,34 @@ namespace Novell.CASA.GUI
|
||||
#region Glade Widgets
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Window windowMain,
|
||||
windowLog;
|
||||
|
||||
Gtk.Window windowMain;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.TreeView tvLog;
|
||||
Gtk.TreeView tvLog;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Notebook notebookStores;
|
||||
Gtk.Notebook notebookStores;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Dialog dialogPersistentStorage,
|
||||
dialogPreferences,
|
||||
dialogAbout,
|
||||
dialogLogin,
|
||||
dialogLoginContinue,
|
||||
dialogConfirmRefresh,
|
||||
dialogSingleInstance,
|
||||
dialogLoginReprompt,
|
||||
dialogShortPassword,
|
||||
dialogResetMP;
|
||||
Gtk.Dialog dialogPersistentStorage,
|
||||
dialogPreferences,
|
||||
dialogAbout,
|
||||
dialogLogin,
|
||||
dialogLoginContinue,
|
||||
dialogConfirmRefresh,
|
||||
dialogSingleInstance,
|
||||
dialogLoginReprompt,
|
||||
dialogShortPassword,
|
||||
dialogResetMP;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Entry entryMasterPassword1,
|
||||
entryMasterPassword2,
|
||||
entryMasterPassword3,
|
||||
entryMasterPassword4,
|
||||
entryOldMP,
|
||||
entryNewMP1,
|
||||
entryNewMP2;
|
||||
Gtk.Entry entryMasterPassword1,
|
||||
entryMasterPassword2,
|
||||
entryMasterPassword3,
|
||||
entryMasterPassword4,
|
||||
entryOldMP,
|
||||
entryNewMP1,
|
||||
entryNewMP2;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.CheckButton checkbuttonFirefox,
|
||||
@ -82,9 +80,8 @@ namespace Novell.CASA.GUI
|
||||
labelLoginContinue2;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Button okbuttonPersistentStorage,
|
||||
buttonNovell;
|
||||
|
||||
Gtk.Button okbuttonPersistentStorage;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.MenuItem mmiNew,
|
||||
mmiNewKey,
|
||||
@ -99,8 +96,8 @@ namespace Novell.CASA.GUI
|
||||
mmiEdit,
|
||||
mmiOptions,
|
||||
mmiDebug;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.CheckMenuItem mmiShowTaskIcon;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -125,7 +122,7 @@ namespace Novell.CASA.GUI
|
||||
|
||||
Application.Init();
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
if (Common.IsArgSet(args, Common.ARG_DEBUG))
|
||||
m_bShowDebug = true;
|
||||
@ -142,7 +139,7 @@ namespace Novell.CASA.GUI
|
||||
catch (Exception e)
|
||||
{
|
||||
string message = "miCASA services are not available";
|
||||
|
||||
//Console.WriteLine("CasaMain: EXCEPTION= "+e.ToString());
|
||||
if (m_bShowDebug)
|
||||
message = e.ToString();
|
||||
|
||||
@ -562,7 +559,7 @@ namespace Novell.CASA.GUI
|
||||
}
|
||||
else
|
||||
{
|
||||
mmiNew.Sensitive = true;
|
||||
//mmiNew.Sensitive = true;
|
||||
mmiNewKey.Sensitive = false;
|
||||
}
|
||||
break;
|
||||
@ -576,22 +573,23 @@ namespace Novell.CASA.GUI
|
||||
case Common.STORE_KDEWALLET:
|
||||
if( 0 != objKdeWallet.tvSecretIDKdeWallet.Selection.CountSelectedRows() )
|
||||
{
|
||||
mmiNew.Sensitive = false;
|
||||
mmiNew.Sensitive = mmiNewKey.Sensitive = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mmiNew.Sensitive = false;
|
||||
mmiNewKey.Sensitive = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case Common.STORE_GNOMEKEYRING:
|
||||
if( 0 != objGnomeKeyring.tvSecretIDGnomeKeyring.Selection.CountSelectedRows() )
|
||||
{
|
||||
mmiNew.Sensitive = false;
|
||||
//mmiNew.Sensitive = mmiNewKey.Sensitive = true;
|
||||
mmiNew.Sensitive = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mmiNew.Sensitive = false;
|
||||
mmiNewKey.Sensitive = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -631,8 +629,8 @@ namespace Novell.CASA.GUI
|
||||
case Common.STORE_KDEWALLET:
|
||||
if( 0 != objKdeWallet.tvSecretIDKdeWallet.Selection.CountSelectedRows() )
|
||||
{
|
||||
mmiView.Sensitive = true;
|
||||
mmiLink.Sensitive = mmiCopy.Sensitive = mmiDelete.Sensitive = false;
|
||||
mmiView.Sensitive = mmiDelete.Sensitive = true;
|
||||
mmiLink.Sensitive = mmiCopy.Sensitive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -640,15 +638,16 @@ namespace Novell.CASA.GUI
|
||||
}
|
||||
break;
|
||||
|
||||
case Common.STORE_GNOMEKEYRING: if( 0 != objGnomeKeyring.tvSecretIDGnomeKeyring.Selection.CountSelectedRows() )
|
||||
{
|
||||
mmiView.Sensitive = true;
|
||||
mmiLink.Sensitive = mmiCopy.Sensitive = mmiDelete.Sensitive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mmiView.Sensitive = mmiLink.Sensitive = mmiCopy.Sensitive = mmiDelete.Sensitive = false;
|
||||
}
|
||||
case Common.STORE_GNOMEKEYRING:
|
||||
if( 0 != objGnomeKeyring.tvSecretIDGnomeKeyring.Selection.CountSelectedRows() )
|
||||
{
|
||||
mmiView.Sensitive = mmiDelete.Sensitive = true;
|
||||
mmiLink.Sensitive = mmiCopy.Sensitive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mmiView.Sensitive = mmiLink.Sensitive = mmiCopy.Sensitive = mmiDelete.Sensitive = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -745,9 +744,11 @@ namespace Novell.CASA.GUI
|
||||
break;
|
||||
|
||||
case Common.STORE_KDEWALLET:
|
||||
objKdeWallet.OnNewSecretActivated(obj, args);
|
||||
break;
|
||||
|
||||
case Common.STORE_GNOMEKEYRING:
|
||||
objGnomeKeyring.OnNewSecretActivated(obj, args);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -779,9 +780,11 @@ namespace Novell.CASA.GUI
|
||||
break;
|
||||
|
||||
case Common.STORE_KDEWALLET:
|
||||
objKdeWallet.OnNewKeyActivated(obj, args);
|
||||
break;
|
||||
|
||||
case Common.STORE_GNOMEKEYRING:
|
||||
objGnomeKeyring.OnNewKeyActivated(obj, args);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -862,11 +865,11 @@ namespace Novell.CASA.GUI
|
||||
break;
|
||||
|
||||
case Common.STORE_FIREFOX:
|
||||
objFirefox.ViewKeyValues();
|
||||
//objFirefox.ViewKeyValues();
|
||||
break;
|
||||
|
||||
case Common.STORE_MOZILLA:
|
||||
objMozilla.ViewKeyValues();
|
||||
//objMozilla.ViewKeyValues();
|
||||
break;
|
||||
|
||||
case Common.STORE_KDEWALLET:
|
||||
@ -958,9 +961,11 @@ namespace Novell.CASA.GUI
|
||||
break;
|
||||
|
||||
case Common.STORE_KDEWALLET:
|
||||
objKdeWallet.OnDeleteActivated(obj, args);
|
||||
break;
|
||||
|
||||
case Common.STORE_GNOMEKEYRING:
|
||||
objGnomeKeyring.OnDeleteActivated(obj, args);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1230,7 +1235,7 @@ namespace Novell.CASA.GUI
|
||||
}
|
||||
|
||||
|
||||
private void PromptUserForStartup()
|
||||
internal void PromptUserForStartup()
|
||||
{
|
||||
// prompt user
|
||||
MessageDialog md=new MessageDialog(null,Gtk.DialogFlags.Modal,
|
||||
|
@ -68,7 +68,7 @@ public class Common
|
||||
|
||||
//Limits
|
||||
public static int MAX_ARRAY_ELEMENTS = 10;
|
||||
public static int MAX_NATIVE_ELEMENTS = 5;
|
||||
public static int MAX_NATIVE_ELEMENTS = 8;
|
||||
|
||||
public static string NATIVEINFO_FOLDERNAME = "Folder Name";
|
||||
public static string NATIVEINFO_TYPEID = "Type of Secret";
|
||||
@ -80,7 +80,10 @@ public class Common
|
||||
INDEX_NATIVEINFO_TYPEID = 1,
|
||||
INDEX_NATIVEINFO_SYNC = 2,
|
||||
INDEX_NATIVEINFO_SYNCTYPE = 3,
|
||||
INDEX_NATIVEINFO_MODIFIEDTIME = 4;
|
||||
INDEX_NATIVEINFO_MODIFIEDTIME = 4,
|
||||
INDEX_NATIVEINFO_ACCESSEDTIME = 5,
|
||||
INDEX_NATIVEINFO_CREATEDTIME = 6,
|
||||
INDEX_NATIVEINFO_WALLETLASTACCESSEDTIME = 7;
|
||||
|
||||
|
||||
public static string LINUX_HELP_PATH = "file:///opt/novell/CASA/help/";
|
||||
@ -335,4 +338,4 @@ public class Common
|
||||
}
|
||||
///##################################################################
|
||||
/// END OF FILE
|
||||
///##################################################################
|
||||
///##################################################################
|
||||
|
@ -3,7 +3,7 @@
|
||||
/// FILE : GnomeKeyring.cs
|
||||
/// DESCRIPTION : GUI implementation of GNOME-Keyring store.
|
||||
/// AUTHORS : CSL.Manojna
|
||||
/// UPDATED ON : 26 Sept, 05
|
||||
/// UPDATED ON : 03 Jan, 06
|
||||
///#################################################################
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@ namespace Novell.CASA.GUI {
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using Gtk;
|
||||
using Glade;
|
||||
using Novell.CASA.MiCasa.Common;
|
||||
@ -26,19 +28,25 @@ public class GnomeKeyring : Store
|
||||
|
||||
CellRendererText cellEditable;
|
||||
|
||||
ArrayList arrDeletedKeys = null;
|
||||
|
||||
public bool IS_STORE_AGGREGATED = false;
|
||||
|
||||
#region Glade Widgets
|
||||
|
||||
[Glade.Widget]
|
||||
public Gtk.TreeView tvSecretIDGnomeKeyring;
|
||||
public Gtk.Window windowMain;
|
||||
|
||||
public Gtk.TreeView tvSecretIDGnomeKeyring;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.TreeView tvKeyValue,
|
||||
tvNativeInfoGnomeKeyring;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Dialog dialogManageSecret,
|
||||
Gtk.Dialog dialogNewSecret,
|
||||
dialogManageSecret,
|
||||
dialogConfirmDelete,
|
||||
dialogLogin;
|
||||
|
||||
[Glade.Widget]
|
||||
@ -49,7 +57,8 @@ public class GnomeKeyring : Store
|
||||
entryKey,
|
||||
entryValue,
|
||||
entryMasterPassword3,
|
||||
entryMasterPassword4;
|
||||
entryMasterPassword4,
|
||||
entryDeleteSecretID;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.CheckButton cbuttonShowPassword;
|
||||
@ -57,11 +66,11 @@ public class GnomeKeyring : Store
|
||||
[Glade.Widget]
|
||||
Gtk.Label label86,
|
||||
label88;
|
||||
|
||||
[Glade.Widget]
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Button buttonNewAdd,
|
||||
buttonNewRemove,
|
||||
buttonManageOk;
|
||||
buttonNewRemove;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.MenuItem cmiNewSecret,
|
||||
cmiNewKey,
|
||||
@ -186,10 +195,11 @@ public class GnomeKeyring : Store
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnRightClicked() - Context menu opened.");
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "menuRightClick", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
menuRightClick.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
|
||||
|
||||
if( 0 != tvSecretIDGnomeKeyring.Selection.CountSelectedRows() )
|
||||
cmiNewSecret.Sensitive = cmiNewKey.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = cmiDelete.Sensitive = false;
|
||||
cmiLink.Sensitive = cmiCopy.Sensitive = false;
|
||||
else
|
||||
cmiNewSecret.Sensitive = cmiNewKey.Sensitive = cmiView.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = cmiDelete.Sensitive = false;
|
||||
}
|
||||
@ -216,9 +226,14 @@ public class GnomeKeyring : Store
|
||||
TreeIter iter;
|
||||
string selected= null;
|
||||
string[] keys = null,
|
||||
values = null;
|
||||
values = null;
|
||||
try
|
||||
{
|
||||
{
|
||||
if( null == arrDeletedKeys )
|
||||
arrDeletedKeys = new ArrayList();
|
||||
else
|
||||
arrDeletedKeys.Clear();
|
||||
|
||||
if( tvSecretIDGnomeKeyring.Selection.GetSelected (out model, out iter) )
|
||||
{
|
||||
selected = (string) model.GetValue(iter, 0);
|
||||
@ -226,27 +241,30 @@ public class GnomeKeyring : Store
|
||||
values = (string[]) model.GetValue(iter, 2);
|
||||
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogManageSecret", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogManageSecret.TransientFor = (Gtk.Window)CasaMain.gxml.GetWidget("windowMain");
|
||||
dialogManageSecret.Title = "VIEW";
|
||||
dialogManageSecret.Title = "GnomeKeyring - Manage Secret";
|
||||
|
||||
cellEditable = new CellRendererText();
|
||||
cellEditable.Editable = false;
|
||||
//cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
|
||||
/// KEY:0 VALUE:1 VALUE-DUP:2 DIRTY-BIT:3
|
||||
tsKeyValue = new TreeStore(typeof(string),typeof(string), typeof(string), typeof(bool));
|
||||
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));
|
||||
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
|
||||
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
|
||||
|
||||
entrySecretID.Text=selected;
|
||||
tvKeyValue.AppendColumn("Linked", new CellRendererText(), "text", 4);
|
||||
|
||||
entrySecretID.Text=selected;
|
||||
|
||||
for( int i=0; i< keys.Length; i++ )
|
||||
{
|
||||
if( (null != keys[i]) && (null != values[i]) )
|
||||
tsKeyValue.AppendValues(keys[i], values[i], "********", false);
|
||||
tsKeyValue.AppendValues(keys[i], values[i], "********", false, "No");
|
||||
|
||||
}
|
||||
tvKeyValue.Model = tsKeyValue;
|
||||
entryKey.Sensitive = entryValue.Sensitive = buttonNewAdd.Sensitive = buttonNewRemove.Sensitive = buttonManageOk.Sensitive = false;
|
||||
//entryKey.HasFocus = true;
|
||||
entryKey.Sensitive = entryValue.Sensitive = buttonNewAdd.Sensitive = buttonNewRemove.Sensitive = false;
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
@ -262,16 +280,111 @@ public class GnomeKeyring : Store
|
||||
/// EDIT KEY-VALUE
|
||||
/// </summary>
|
||||
public void OnKeyValueEdited(object obj, EditedArgs args)
|
||||
{
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnKeyValueEdited() - BEGIN");
|
||||
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
object val;
|
||||
string KeyName = null,
|
||||
KeyValue = null;
|
||||
string[] Keys = null,
|
||||
Values = null;
|
||||
|
||||
try
|
||||
{
|
||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
||||
val = tsKeyValue.GetValue(iter,0);
|
||||
KeyName = val.ToString();
|
||||
if( true == cbuttonShowPassword.Active )
|
||||
val = tsKeyValue.GetValue(iter,1);
|
||||
else
|
||||
val = tsKeyValue.GetValue(iter,2);
|
||||
KeyValue = val.ToString();
|
||||
|
||||
tvSecretIDGnomeKeyring.Selection.GetSelected (out model, out iter);
|
||||
|
||||
if( false == entrySecretID.Editable )
|
||||
{
|
||||
if( ("" != args.NewText) && (KeyValue != args.NewText) )
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_GNOMEKEYRING, Common.OPERATION_MODIFY_KEY, KeyName, args.NewText, ref model, ref iter) )
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnKeyValueEdited() - StoreDataInterface.UpdateStore() succeeded");
|
||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
||||
tsKeyValue.SetValue(iter, 1, args.NewText);
|
||||
tsKeyValue.SetValue(iter, 2, "********");
|
||||
|
||||
tvSecretIDGnomeKeyring.Selection.GetSelected (out model, out iter);
|
||||
Keys = (string[]) model.GetValue(iter, 1);
|
||||
Values = (string[]) model.GetValue(iter, 2);
|
||||
for( int i=0; i< Keys.Length; i++ )
|
||||
{
|
||||
if( Keys[i] == KeyName )
|
||||
{
|
||||
Values[i] = args.NewText;
|
||||
tsSecretIDGnomeKeyring.SetValue(iter, 2, Values);
|
||||
break;
|
||||
}
|
||||
}
|
||||
AggregateStore();
|
||||
}
|
||||
else
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnKeyValueEdited() - ERROR: STATUS_STORE_UPDATEFAILED");
|
||||
}
|
||||
else
|
||||
{
|
||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
||||
tsKeyValue.SetValue(iter, 1, args.NewText);
|
||||
tsKeyValue.SetValue(iter, 2, "********");
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnKeyValueEdited() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnKeyValueEdited() - END");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ADD BUTTON CLICKED
|
||||
/// </summary>
|
||||
public void on_buttonNewAdd_clicked(object obj, EventArgs args)
|
||||
{
|
||||
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewAdd_clicked() - BEGIN");
|
||||
|
||||
if( ("" != entryKey.Text) && ("" != entryValue.Text) )
|
||||
{
|
||||
TreeIter iterKey;
|
||||
ArrayList arrKeys = null,
|
||||
arrValues = null;
|
||||
object val = null;
|
||||
arrKeys = new ArrayList();
|
||||
arrValues = new ArrayList();
|
||||
|
||||
if(tsKeyValue.GetIterFirst(out iterKey))
|
||||
{
|
||||
do
|
||||
{
|
||||
val = tsKeyValue.GetValue(iterKey,0);
|
||||
arrKeys.Add(val.ToString());
|
||||
val = tsKeyValue.GetValue(iterKey,1);
|
||||
arrValues.Add(val.ToString());
|
||||
}
|
||||
while( tsKeyValue.IterNext(ref iterKey) );
|
||||
}
|
||||
if( -1 == (arrKeys.IndexOf(entryKey.Text)) )
|
||||
iterKey = tsKeyValue.AppendValues(entryKey.Text, entryValue.Text, "********", true, "No");
|
||||
|
||||
//tvKeyValue.Selection.SelectIter(iterKey);
|
||||
entryKey.Text = entryValue.Text = "";
|
||||
entryKey.HasFocus = true;
|
||||
}
|
||||
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewAdd_clicked() - END");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -279,7 +392,26 @@ public class GnomeKeyring : Store
|
||||
/// </summary>
|
||||
public void on_buttonNewRemove_clicked(object obj, EventArgs args)
|
||||
{
|
||||
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewRemove_clicked() - BEGIN");
|
||||
|
||||
TreeModel modelKey;
|
||||
TreeIter iterKey;
|
||||
|
||||
if(tvKeyValue.Selection.GetSelected (out modelKey, out iterKey))
|
||||
if( false == (bool)tsKeyValue.GetValue(iterKey,3) )
|
||||
arrDeletedKeys.Add(tsKeyValue.GetValue(iterKey,0));
|
||||
|
||||
if( 0 != tvKeyValue.Selection.CountSelectedRows() )
|
||||
{
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
|
||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
||||
tsKeyValue.Remove(ref iter);
|
||||
tvKeyValue.ColumnsAutosize();
|
||||
}
|
||||
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewRemove_clicked() - END");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -376,12 +508,82 @@ public class GnomeKeyring : Store
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MANAGE SECRET-ID DIALOG OK-BUTTON CLICKED
|
||||
/// </summary>
|
||||
public void on_buttonManageOk_clicked(object obj, EventArgs args)
|
||||
{
|
||||
|
||||
TreeModel modelSecret;
|
||||
TreeIter iterSecret,
|
||||
iterKey;
|
||||
string NewKey = null,
|
||||
NewValue = null;
|
||||
string[] strDeletedKeys = null;
|
||||
bool dirtyBit = false;
|
||||
//ArrayList arrKeys = null,
|
||||
// arrValues = null;
|
||||
|
||||
try
|
||||
{
|
||||
if( (0 == tvKeyValue.Model.IterNChildren()) && tvSecretIDGnomeKeyring.Selection.GetSelected (out modelSecret, out iterSecret) )
|
||||
{
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_GNOMEKEYRING, Common.OPERATION_DELETE_SECRET, "", "", ref modelSecret, ref iterSecret) )
|
||||
{
|
||||
tsSecretIDGnomeKeyring.Remove(ref iterSecret);
|
||||
tvSecretIDGnomeKeyring.ColumnsAutosize();
|
||||
tsNativeInfoGnomeKeyring.Clear();
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonManageOk_clicked() - DELETE_SECRET_SUCCEEDED");
|
||||
}
|
||||
else
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonManageOk_clicked() - DELETE_SECRET_FAILED");
|
||||
AggregateStore();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (null != arrDeletedKeys) && (arrDeletedKeys.Count > 0) )
|
||||
{
|
||||
tvSecretIDGnomeKeyring.Selection.GetSelected (out modelSecret, out iterSecret);
|
||||
strDeletedKeys = (string[])arrDeletedKeys.ToArray(typeof(string));
|
||||
for( int i=0; i < strDeletedKeys.Length; i++)
|
||||
{
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_GNOMEKEYRING, Common.OPERATION_DELETE_KEY, strDeletedKeys[i], null, ref modelSecret, ref iterSecret) )
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonManageOk_clicked() - DELETE_KEY_SUCCEEDED.");
|
||||
else
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonManageOk_clicked() - DELETE_KEY_FAILED.");
|
||||
}
|
||||
arrDeletedKeys.Clear();
|
||||
AggregateStore();
|
||||
}
|
||||
|
||||
if( tsKeyValue.GetIterFirst(out iterKey) && tvSecretIDGnomeKeyring.Selection.GetSelected (out modelSecret, out iterSecret) )
|
||||
{
|
||||
do
|
||||
{
|
||||
NewKey = (string) tsKeyValue.GetValue(iterKey,0);
|
||||
NewValue = (string) tsKeyValue.GetValue(iterKey,1);
|
||||
dirtyBit = (bool) tsKeyValue.GetValue(iterKey,3);
|
||||
|
||||
if( true == dirtyBit )
|
||||
{
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_GNOMEKEYRING, Common.OPERATION_ADD_KEY, NewKey, NewValue, ref modelSecret, ref iterSecret) )
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonManageOk_clicked() - ADD_KEY_VALUE_SUCCEEDED.");
|
||||
else
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonManageOk_clicked() - ADD_KEY_VALUE_FAILED.");
|
||||
}
|
||||
}
|
||||
while( tsKeyValue.IterNext(ref iterKey) );
|
||||
AggregateStore();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonManageOk_clicked() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
|
||||
tsKeyValue.Dispose();
|
||||
dialogManageSecret.Destroy();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -399,6 +601,7 @@ public class GnomeKeyring : Store
|
||||
private void OntvSecretIDGnomeKeyringRowActivated( object obj, RowActivatedArgs args )
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OntvSecretIDGnomeKeyringRowActivated() - ViewKeyValues() called.");
|
||||
|
||||
ViewKeyValues();
|
||||
}
|
||||
|
||||
@ -408,36 +611,177 @@ public class GnomeKeyring : Store
|
||||
/// </summary>
|
||||
public void OnViewActivated(object obj, EventArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.OnViewActivated() - ViewKeyValues() called.");
|
||||
ViewKeyValues();
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnViewActivated() - ViewKeyValues() called.");
|
||||
|
||||
ViewKeyValues();
|
||||
}
|
||||
|
||||
|
||||
|
||||
///#######################################################################
|
||||
/// ADD NEW SECRET
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void OnNewSecretActivated(object obj, EventArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnNewSecretActivated() - BEGIN");
|
||||
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogNewSecret", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogNewSecret.TransientFor = (Gtk.Window)CasaMain.gxml.GetWidget("windowMain");
|
||||
dialogNewSecret.Title = "GnomeKeyring - New Secret";
|
||||
|
||||
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));
|
||||
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
|
||||
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
|
||||
tvKeyValue.AppendColumn("Linked",new CellRendererText(),"text",4);
|
||||
tvKeyValue.Model = tsKeyValue;
|
||||
tsKeyValue.Clear();
|
||||
entrySecretID.HasFocus = true;
|
||||
entrySecretID.Text = "";
|
||||
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnNewSecretActivated() - END");
|
||||
}
|
||||
|
||||
|
||||
///#######################################################################
|
||||
/// ADD NEW KEY-VALUES TO EXISTING SECRET
|
||||
/// ADD NEW KEY-VALUES TO EXISTING SECRET
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void OnNewKeyActivated(object obj, EventArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnNewKeyActivated() - BEGIN");
|
||||
|
||||
ViewKeyValues();
|
||||
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnNewKeyActivated() - END");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void on_buttonNewOk_clicked(object obj, EventArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewOk_clicked() - BEGIN");
|
||||
|
||||
TreeModel modelSecret;
|
||||
TreeIter iterSecret,
|
||||
iterKey;
|
||||
string NewKey = null,
|
||||
NewValue = null;
|
||||
string[] Keys = null,
|
||||
Values = null,
|
||||
NativeKeys = null,
|
||||
NativeValues = null;
|
||||
object val = null;
|
||||
ArrayList arrKeys = null,
|
||||
arrValues = null;
|
||||
|
||||
if ((true == entrySecretID.Editable) && (entrySecretID.Text.IndexOf("*") > -1))
|
||||
{
|
||||
// prompt user
|
||||
MessageDialog md=new MessageDialog(this.windowMain,Gtk.DialogFlags.Modal,
|
||||
Gtk.MessageType.Warning,
|
||||
Gtk.ButtonsType.Ok,
|
||||
"Secret ID may not contain \"*\"");
|
||||
|
||||
md.Response += new ResponseHandler(md_Response);
|
||||
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
||||
md.Modal = true;
|
||||
md.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
if( (true == entrySecretID.Editable) && ("" != entrySecretID.Text) && (tvKeyValue.Model.IterNChildren() > 0) )
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewOk_clicked() - Adding New Secrets and KeyValues.");
|
||||
|
||||
arrKeys = new ArrayList();
|
||||
arrValues = new ArrayList();
|
||||
|
||||
try
|
||||
{
|
||||
if(tsKeyValue.GetIterFirst(out iterKey))
|
||||
{
|
||||
do
|
||||
{
|
||||
val = tsKeyValue.GetValue(iterKey,0);
|
||||
NewKey = val.ToString();
|
||||
val = tsKeyValue.GetValue(iterKey,1);
|
||||
NewValue = val.ToString();
|
||||
|
||||
if( -1 == (arrKeys.IndexOf(NewKey)) )
|
||||
{
|
||||
arrKeys.Add(NewKey);
|
||||
arrValues.Add(NewValue);
|
||||
}
|
||||
}
|
||||
while( tsKeyValue.IterNext(ref iterKey) );
|
||||
|
||||
Keys = (string[])arrKeys.ToArray(typeof(string));
|
||||
Values = (string[])arrValues.ToArray(typeof(string));
|
||||
NativeKeys = new string[Common.MAX_NATIVE_ELEMENTS];
|
||||
NativeValues = new string[Common.MAX_NATIVE_ELEMENTS];
|
||||
NativeKeys[Common.INDEX_NATIVEINFO_FOLDERNAME] = Common.NATIVEINFO_FOLDERNAME;
|
||||
NativeKeys[Common.INDEX_NATIVEINFO_TYPEID] = Common.NATIVEINFO_TYPEID;
|
||||
NativeKeys[Common.INDEX_NATIVEINFO_SYNC] = Common.NATIVEINFO_SYNC;
|
||||
NativeKeys[Common.INDEX_NATIVEINFO_SYNCTYPE] = Common.NATIVEINFO_SYNCTYPE;
|
||||
NativeKeys[Common.INDEX_NATIVEINFO_MODIFIEDTIME] = Common.NATIVEINFO_MODIFIEDTIME;
|
||||
NativeValues[Common.INDEX_NATIVEINFO_FOLDERNAME] = null;
|
||||
NativeValues[Common.INDEX_NATIVEINFO_TYPEID] = "Network Password";
|
||||
NativeValues[Common.INDEX_NATIVEINFO_SYNC] = null;
|
||||
NativeValues[Common.INDEX_NATIVEINFO_SYNCTYPE] = null;
|
||||
NativeValues[Common.INDEX_NATIVEINFO_MODIFIEDTIME] = null;
|
||||
|
||||
iterSecret = tsSecretIDGnomeKeyring.AppendValues(entrySecretID.Text, Keys, Values, "CASAkeyring", NativeKeys, NativeValues);
|
||||
modelSecret = tvSecretIDGnomeKeyring.Model;
|
||||
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_GNOMEKEYRING, Common.OPERATION_ADD_SECRET, "", "", ref modelSecret, ref iterSecret) )
|
||||
{
|
||||
AggregateStore();
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewOk_clicked() - ADD_NEW_SECRET_SUCCEEDED.");
|
||||
}
|
||||
else
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewOk_clicked() - ERROR: ADD_NEW_SECRET_FAILED");
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewOk_clicked() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
tsKeyValue.Dispose();
|
||||
dialogNewSecret.Destroy();
|
||||
}
|
||||
|
||||
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewOk_clicked() - END");
|
||||
}
|
||||
|
||||
private void md_Response(object o, ResponseArgs args)
|
||||
{
|
||||
MessageDialog md = (MessageDialog)o;
|
||||
if (md != null)
|
||||
{
|
||||
md.Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void on_buttonNewCancel_clicked(object obj, EventArgs args)
|
||||
{
|
||||
dialogNewSecret.Destroy();
|
||||
}
|
||||
|
||||
public void on_helpbuttonNewSecret_clicked(object obj, EventArgs args)
|
||||
{
|
||||
Common.ShowHelpUrl("AddNewSecrets.htm");
|
||||
}
|
||||
|
||||
///#######################################################################
|
||||
/// LINK
|
||||
|
||||
@ -469,10 +813,66 @@ public class GnomeKeyring : Store
|
||||
/// DELETE Secret
|
||||
/// </summary>
|
||||
public void OnDeleteActivated(object obj, EventArgs args)
|
||||
{
|
||||
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnDeleteActivated() - BEGIN");
|
||||
if( 0 != tvSecretIDGnomeKeyring.Selection.CountSelectedRows() )
|
||||
{
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmDelete", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogConfirmDelete.TransientFor = (Gtk.Window)CasaMain.gxml.GetWidget("windowMain");
|
||||
dialogNewSecret.Title = "GnomeKeyring - Delete Secret";
|
||||
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
string selected = null;
|
||||
if( tvSecretIDGnomeKeyring.Selection.GetSelected (out model, out iter) )
|
||||
{
|
||||
selected = (string) model.GetValue (iter, 0);
|
||||
if( (null != selected) && (selected.Length > 0) )
|
||||
entryDeleteSecretID.Text = selected;
|
||||
}
|
||||
}
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnDeleteActivated() - END");
|
||||
}
|
||||
|
||||
public void on_buttonYes_clicked(object obj, EventArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonYes_clicked() - BEGIN");
|
||||
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
|
||||
try
|
||||
{
|
||||
if( tvSecretIDGnomeKeyring.Selection.GetSelected (out model, out iter) )
|
||||
{
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_GNOMEKEYRING, Common.OPERATION_DELETE_SECRET, "", "", ref model, ref iter) )
|
||||
{
|
||||
tsSecretIDGnomeKeyring.Remove(ref iter);
|
||||
tvSecretIDGnomeKeyring.ColumnsAutosize();
|
||||
tsNativeInfoGnomeKeyring.Clear();
|
||||
dialogConfirmDelete.Destroy();
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonYes_clicked() - DELETE_SECRET_SUCCEEDED");
|
||||
|
||||
}
|
||||
else
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonYes_clicked() - DELETE_SECRET_FAILED");
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonYes_clicked() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
|
||||
Logger.DbgLog("GUI:GnomeKeyring.on_buttonYes_clicked() - END");
|
||||
}
|
||||
|
||||
public void on_buttonNo_clicked(object obj, EventArgs args)
|
||||
{
|
||||
dialogConfirmDelete.Destroy();
|
||||
}
|
||||
|
||||
|
||||
public void on_buttonhelpEditSecret_clicked(object obj, EventArgs args)
|
||||
{
|
||||
Common.ShowHelpUrl("EditingSecrets.html");
|
||||
|
@ -3,13 +3,15 @@
|
||||
/// FILE : KdeWallet.cs
|
||||
/// DESCRIPTION : GUI implementation of KDE-Wallet store.
|
||||
/// AUTHORS : CSL.Manojna
|
||||
/// UPDATED ON : 26 Sept, 05
|
||||
/// UPDATED ON : 03 Jan, 06
|
||||
///#################################################################
|
||||
|
||||
|
||||
namespace Novell.CASA.GUI {
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using Gtk;
|
||||
using Glade;
|
||||
using Novell.CASA.MiCasa.Common;
|
||||
@ -24,19 +26,25 @@ public class KdeWallet : Store
|
||||
|
||||
CellRendererText cellEditable;
|
||||
|
||||
ArrayList arrDeletedKeys = null;
|
||||
|
||||
public bool IS_STORE_AGGREGATED = false;
|
||||
|
||||
#region Glade Widgets
|
||||
|
||||
[Glade.Widget]
|
||||
public Gtk.TreeView tvSecretIDKdeWallet;
|
||||
public Gtk.Window windowMain;
|
||||
|
||||
public Gtk.TreeView tvSecretIDKdeWallet;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.TreeView tvKeyValue,
|
||||
tvNativeInfoKdeWallet;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Dialog dialogManageSecret,
|
||||
Gtk.Dialog dialogNewSecret,
|
||||
dialogManageSecret,
|
||||
dialogConfirmDelete,
|
||||
dialogLogin;
|
||||
|
||||
[Glade.Widget]
|
||||
@ -47,7 +55,8 @@ public class KdeWallet : Store
|
||||
entryKey,
|
||||
entryValue,
|
||||
entryMasterPassword3,
|
||||
entryMasterPassword4;
|
||||
entryMasterPassword4,
|
||||
entryDeleteSecretID;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.CheckButton cbuttonShowPassword;
|
||||
@ -56,11 +65,7 @@ public class KdeWallet : Store
|
||||
Gtk.Label label86,
|
||||
label88;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Button buttonNewAdd,
|
||||
buttonNewRemove,
|
||||
buttonManageOk;
|
||||
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.MenuItem cmiNewSecret,
|
||||
cmiNewKey,
|
||||
@ -184,11 +189,11 @@ public class KdeWallet : Store
|
||||
{
|
||||
Logger.DbgLog("GUI:GnomeKeyring.OnRightClicked() - Context menu opened.");
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "menuRightClick", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
menuRightClick.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
|
||||
|
||||
if( 0 != tvSecretIDKdeWallet.Selection.CountSelectedRows() )
|
||||
cmiNewSecret.Sensitive = cmiNewKey.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = cmiDelete.Sensitive = false;
|
||||
cmiLink.Sensitive = cmiCopy.Sensitive = false;
|
||||
else
|
||||
cmiNewSecret.Sensitive = cmiNewKey.Sensitive = cmiView.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = cmiDelete.Sensitive = false;
|
||||
}
|
||||
@ -216,10 +221,15 @@ public class KdeWallet : Store
|
||||
TreeIter iter;
|
||||
string selected = null;
|
||||
string[] keys = null,
|
||||
values = null;
|
||||
values = null;
|
||||
|
||||
try
|
||||
{
|
||||
if( null == arrDeletedKeys )
|
||||
arrDeletedKeys = new ArrayList();
|
||||
else
|
||||
arrDeletedKeys.Clear();
|
||||
|
||||
if( tvSecretIDKdeWallet.Selection.GetSelected (out model, out iter) )
|
||||
{
|
||||
selected = (string) model.GetValue(iter, 0);
|
||||
@ -227,25 +237,28 @@ public class KdeWallet : Store
|
||||
values = (string[]) model.GetValue(iter, 2);
|
||||
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogManageSecret", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogManageSecret.TransientFor = (Gtk.Window)CasaMain.gxml.GetWidget("windowMain");
|
||||
dialogManageSecret.Title = "VIEW";
|
||||
dialogManageSecret.Title = "KdeWallet - Manage Secret";
|
||||
|
||||
cellEditable = new CellRendererText();
|
||||
cellEditable.Editable = false;
|
||||
//cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
|
||||
/// KEY:0 VALUE:1 VALUE-DUP:2 DIRTY-BIT:3
|
||||
tsKeyValue = new TreeStore(typeof(string),typeof(string), typeof(string), typeof(bool));
|
||||
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));
|
||||
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
|
||||
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
|
||||
entrySecretID.Text = selected;
|
||||
tvKeyValue.AppendColumn("Linked", new CellRendererText(), "text", 4);
|
||||
|
||||
entrySecretID.Text = selected;
|
||||
|
||||
for( int i=0; i< keys.Length; i++ )
|
||||
{
|
||||
if( (null != keys[i]) && (null != values[i]) )
|
||||
tsKeyValue.AppendValues(keys[i], values[i], "********", false);
|
||||
tsKeyValue.AppendValues(keys[i], values[i], "********", false, "No");
|
||||
}
|
||||
tvKeyValue.Model = tsKeyValue;
|
||||
entryKey.Sensitive = entryValue.Sensitive = buttonNewAdd.Sensitive = buttonNewRemove.Sensitive = buttonManageOk.Sensitive = false;
|
||||
entryKey.HasFocus = true;
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
@ -262,15 +275,109 @@ public class KdeWallet : Store
|
||||
/// </summary>
|
||||
public void OnKeyValueEdited(object obj, EditedArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.OnKeyValueEdited() - BEGIN");
|
||||
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
object val;
|
||||
string KeyName = null,
|
||||
KeyValue = null;
|
||||
string[] Keys = null,
|
||||
Values = null;
|
||||
|
||||
try
|
||||
{
|
||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
||||
val = tsKeyValue.GetValue(iter,0);
|
||||
KeyName = val.ToString();
|
||||
if( true == cbuttonShowPassword.Active )
|
||||
val = tsKeyValue.GetValue(iter,1);
|
||||
else
|
||||
val = tsKeyValue.GetValue(iter,2);
|
||||
KeyValue = val.ToString();
|
||||
|
||||
tvSecretIDKdeWallet.Selection.GetSelected (out model, out iter);
|
||||
|
||||
if( false == entrySecretID.Editable )
|
||||
{
|
||||
if( ("" != args.NewText) && (KeyValue != args.NewText) )
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_KDEWALLET, Common.OPERATION_MODIFY_KEY, KeyName, args.NewText, ref model, ref iter) )
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.OnKeyValueEdited() - StoreDataInterface.UpdateStore() succeeded");
|
||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
||||
tsKeyValue.SetValue(iter, 1, args.NewText);
|
||||
tsKeyValue.SetValue(iter, 2, "********");
|
||||
|
||||
tvSecretIDKdeWallet.Selection.GetSelected (out model, out iter);
|
||||
Keys = (string[]) model.GetValue(iter, 1);
|
||||
Values = (string[]) model.GetValue(iter, 2);
|
||||
for( int i=0; i< Keys.Length; i++ )
|
||||
{
|
||||
if( Keys[i] == KeyName )
|
||||
{
|
||||
Values[i] = args.NewText;
|
||||
tsSecretIDKdeWallet.SetValue(iter, 2, Values);
|
||||
break;
|
||||
}
|
||||
}
|
||||
AggregateStore();
|
||||
}
|
||||
else
|
||||
Logger.DbgLog("GUI:KdeWallet.OnKeyValueEdited() - ERROR: STATUS_STORE_UPDATEFAILED");
|
||||
}
|
||||
else
|
||||
{
|
||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
||||
tsKeyValue.SetValue(iter, 1, args.NewText);
|
||||
tsKeyValue.SetValue(iter, 2, "********");
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.OnKeyValueEdited() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
|
||||
Logger.DbgLog("GUI:KdeWallet.OnKeyValueEdited() - END");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ADD BUTTON CLICKED
|
||||
/// </summary>
|
||||
public void on_buttonNewAdd_clicked(object obj, EventArgs args)
|
||||
{
|
||||
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonNewAdd_clicked() - BEGIN");
|
||||
|
||||
if( ("" != entryKey.Text) && ("" != entryValue.Text) )
|
||||
{
|
||||
TreeIter iterKey;
|
||||
ArrayList arrKeys = null,
|
||||
arrValues = null;
|
||||
object val = null;
|
||||
arrKeys = new ArrayList();
|
||||
arrValues = new ArrayList();
|
||||
|
||||
if(tsKeyValue.GetIterFirst(out iterKey))
|
||||
{
|
||||
do
|
||||
{
|
||||
val = tsKeyValue.GetValue(iterKey,0);
|
||||
arrKeys.Add(val.ToString());
|
||||
val = tsKeyValue.GetValue(iterKey,1);
|
||||
arrValues.Add(val.ToString());
|
||||
}
|
||||
while( tsKeyValue.IterNext(ref iterKey) );
|
||||
}
|
||||
if( -1 == (arrKeys.IndexOf(entryKey.Text)) )
|
||||
iterKey = tsKeyValue.AppendValues(entryKey.Text, entryValue.Text, "********", true, "No");
|
||||
|
||||
//tvKeyValue.Selection.SelectIter(iterKey);
|
||||
entryKey.Text = entryValue.Text = "";
|
||||
entryKey.HasFocus = true;
|
||||
}
|
||||
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonNewAdd_clicked() - END");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -278,7 +385,28 @@ public class KdeWallet : Store
|
||||
/// </summary>
|
||||
public void on_buttonNewRemove_clicked(object obj, EventArgs args)
|
||||
{
|
||||
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonNewRemove_clicked() - BEGIN");
|
||||
|
||||
TreeModel modelKey;
|
||||
TreeIter iterKey;
|
||||
|
||||
if(tvKeyValue.Selection.GetSelected (out modelKey, out iterKey))
|
||||
if( false == (bool)tsKeyValue.GetValue(iterKey,3) )
|
||||
arrDeletedKeys.Add(tsKeyValue.GetValue(iterKey,0));
|
||||
|
||||
|
||||
|
||||
if( 0 != tvKeyValue.Selection.CountSelectedRows() )
|
||||
{
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
|
||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
||||
tsKeyValue.Remove(ref iter);
|
||||
tvKeyValue.ColumnsAutosize();
|
||||
}
|
||||
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonNewRemove_clicked() - END");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -374,12 +502,83 @@ public class KdeWallet : Store
|
||||
entryMasterPassword3.HasFocus = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MANAGE SECRET-ID DIALOG OK-BUTTON CLICKED
|
||||
/// </summary>
|
||||
public void on_buttonManageOk_clicked(object obj, EventArgs args)
|
||||
{
|
||||
|
||||
TreeModel modelSecret;
|
||||
TreeIter iterSecret,
|
||||
iterKey;
|
||||
string NewKey = null,
|
||||
NewValue = null;
|
||||
string[] strDeletedKeys = null;
|
||||
bool dirtyBit = false;
|
||||
//ArrayList arrKeys = null,
|
||||
// arrValues = null;
|
||||
|
||||
try
|
||||
{
|
||||
if( (0 == tvKeyValue.Model.IterNChildren()) && tvSecretIDKdeWallet.Selection.GetSelected (out modelSecret, out iterSecret) )
|
||||
{
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_KDEWALLET, Common.OPERATION_DELETE_SECRET, "", "", ref modelSecret, ref iterSecret) )
|
||||
{
|
||||
tsSecretIDKdeWallet.Remove(ref iterSecret);
|
||||
tvSecretIDKdeWallet.ColumnsAutosize();
|
||||
tsNativeInfoKdeWallet.Clear();
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonManageOk_clicked() - DELETE_SECRET_SUCCEEDED");
|
||||
}
|
||||
else
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonManageOk_clicked() - DELETE_SECRET_FAILED");
|
||||
AggregateStore();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (null != arrDeletedKeys) && (arrDeletedKeys.Count > 0) )
|
||||
{
|
||||
tvSecretIDKdeWallet.Selection.GetSelected (out modelSecret, out iterSecret);
|
||||
strDeletedKeys = (string[])arrDeletedKeys.ToArray(typeof(string));
|
||||
for( int i=0; i < strDeletedKeys.Length; i++)
|
||||
{
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_KDEWALLET, Common.OPERATION_DELETE_KEY, strDeletedKeys[i], null, ref modelSecret, ref iterSecret) )
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonManageOk_clicked() - DELETE_KEY_SUCCEEDED.");
|
||||
else
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonManageOk_clicked() - DELETE_KEY_FAILED.");
|
||||
}
|
||||
arrDeletedKeys.Clear();
|
||||
AggregateStore();
|
||||
}
|
||||
|
||||
if( tsKeyValue.GetIterFirst(out iterKey) && tvSecretIDKdeWallet.Selection.GetSelected (out modelSecret, out iterSecret) )
|
||||
{
|
||||
do
|
||||
{
|
||||
NewKey = (string) tsKeyValue.GetValue(iterKey,0);
|
||||
NewValue = (string) tsKeyValue.GetValue(iterKey,1);
|
||||
dirtyBit = (bool) tsKeyValue.GetValue(iterKey,3);
|
||||
|
||||
if( true == dirtyBit )
|
||||
{
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_KDEWALLET, Common.OPERATION_ADD_KEY, NewKey, NewValue, ref modelSecret, ref iterSecret) )
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonManageOk_clicked() - ADD_KEY_VALUE_SUCCEEDED.");
|
||||
else
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonManageOk_clicked() - ADD_KEY_VALUE_FAILED.");
|
||||
}
|
||||
}
|
||||
while( tsKeyValue.IterNext(ref iterKey) );
|
||||
AggregateStore();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonManageOk_clicked() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
|
||||
tsKeyValue.Dispose();
|
||||
dialogManageSecret.Destroy();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -407,42 +606,177 @@ public class KdeWallet : Store
|
||||
public void OnViewActivated(object obj, EventArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.OnViewActivated() - ViewKeyValues() called.");
|
||||
|
||||
ViewKeyValues();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///#######################################################################
|
||||
/// ADD NEW SECRET
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void OnNewSecretActivated(object obj, EventArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.OnNewSecretActivated() - BEGIN");
|
||||
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogNewSecret", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogNewSecret.TransientFor = (Gtk.Window)CasaMain.gxml.GetWidget("windowMain");
|
||||
dialogNewSecret.Title = "KdeWallet - New Secret";
|
||||
|
||||
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));
|
||||
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
|
||||
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
|
||||
tvKeyValue.AppendColumn("Linked",new CellRendererText(),"text",4);
|
||||
tvKeyValue.Model = tsKeyValue;
|
||||
tsKeyValue.Clear();
|
||||
entrySecretID.HasFocus = true;
|
||||
entrySecretID.Text = "";
|
||||
|
||||
Logger.DbgLog("GUI:KdeWallet.OnNewSecretActivated() - END");
|
||||
}
|
||||
|
||||
|
||||
///#######################################################################
|
||||
/// ADD NEW KEY-VALUES TO EXISTING SECRET
|
||||
/// ADD NEW KEY-VALUES TO EXISTING SECRET
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void OnNewKeyActivated(object obj, EventArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.OnNewKeyActivated() - BEGIN");
|
||||
|
||||
ViewKeyValues();
|
||||
|
||||
Logger.DbgLog("GUI:KdeWallet.OnNewKeyActivated() - END");
|
||||
}
|
||||
|
||||
public void on_buttonNewOk_clicked(object obj, EventArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonNewOk_clicked() - BEGIN");
|
||||
|
||||
TreeModel modelSecret;
|
||||
TreeIter iterSecret,
|
||||
iterKey;
|
||||
string NewKey = null,
|
||||
NewValue = null;
|
||||
string[] Keys = null,
|
||||
Values = null,
|
||||
NativeKeys = null,
|
||||
NativeValues = null;
|
||||
object val = null;
|
||||
ArrayList arrKeys = null,
|
||||
arrValues = null;
|
||||
|
||||
if ((true == entrySecretID.Editable) && (entrySecretID.Text.IndexOf("*") > -1))
|
||||
{
|
||||
// prompt user
|
||||
MessageDialog md=new MessageDialog(this.windowMain,Gtk.DialogFlags.Modal,
|
||||
Gtk.MessageType.Warning,
|
||||
Gtk.ButtonsType.Ok,
|
||||
"Secret ID may not contain \"*\"");
|
||||
|
||||
md.Response += new ResponseHandler(md_Response);
|
||||
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
||||
md.Modal = true;
|
||||
md.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
if( (true == entrySecretID.Editable) && ("" != entrySecretID.Text) && (tvKeyValue.Model.IterNChildren() > 0) )
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonNewOk_clicked() - Adding New Secrets and KeyValues.");
|
||||
|
||||
arrKeys = new ArrayList();
|
||||
arrValues = new ArrayList();
|
||||
|
||||
try
|
||||
{
|
||||
if(tsKeyValue.GetIterFirst(out iterKey))
|
||||
{
|
||||
do
|
||||
{
|
||||
val = tsKeyValue.GetValue(iterKey,0);
|
||||
NewKey = val.ToString();
|
||||
val = tsKeyValue.GetValue(iterKey,1);
|
||||
NewValue = val.ToString();
|
||||
|
||||
if( -1 == (arrKeys.IndexOf(NewKey)) )
|
||||
{
|
||||
arrKeys.Add(NewKey);
|
||||
arrValues.Add(NewValue);
|
||||
}
|
||||
}
|
||||
while( tsKeyValue.IterNext(ref iterKey) );
|
||||
|
||||
Keys = (string[])arrKeys.ToArray(typeof(string));
|
||||
Values = (string[])arrValues.ToArray(typeof(string));
|
||||
NativeKeys = new string[Common.MAX_NATIVE_ELEMENTS];
|
||||
NativeValues = new string[Common.MAX_NATIVE_ELEMENTS];
|
||||
NativeKeys[Common.INDEX_NATIVEINFO_FOLDERNAME] = Common.NATIVEINFO_FOLDERNAME;
|
||||
NativeKeys[Common.INDEX_NATIVEINFO_TYPEID] = Common.NATIVEINFO_TYPEID;
|
||||
NativeKeys[Common.INDEX_NATIVEINFO_SYNC] = Common.NATIVEINFO_SYNC;
|
||||
NativeKeys[Common.INDEX_NATIVEINFO_SYNCTYPE] = Common.NATIVEINFO_SYNCTYPE;
|
||||
NativeKeys[Common.INDEX_NATIVEINFO_MODIFIEDTIME] = Common.NATIVEINFO_MODIFIEDTIME;
|
||||
NativeValues[Common.INDEX_NATIVEINFO_FOLDERNAME] = "Passwords";
|
||||
NativeValues[Common.INDEX_NATIVEINFO_TYPEID] = "Maps";
|
||||
NativeValues[Common.INDEX_NATIVEINFO_SYNC] = null;
|
||||
NativeValues[Common.INDEX_NATIVEINFO_SYNCTYPE] = null;
|
||||
NativeValues[Common.INDEX_NATIVEINFO_MODIFIEDTIME] = null;
|
||||
|
||||
iterSecret = tsSecretIDKdeWallet.AppendValues(entrySecretID.Text, Keys, Values, "CASAwallet", NativeKeys, NativeValues);
|
||||
modelSecret = tvSecretIDKdeWallet.Model;
|
||||
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_KDEWALLET, Common.OPERATION_ADD_SECRET, "", "", ref modelSecret, ref iterSecret) )
|
||||
{
|
||||
AggregateStore();
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonNewOk_clicked() - ADD_NEW_SECRET_SUCCEEDED.");
|
||||
}
|
||||
else
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonNewOk_clicked() - ERROR: ADD_NEW_SECRET_FAILED");
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonNewOk_clicked() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
tsKeyValue.Dispose();
|
||||
dialogNewSecret.Destroy();
|
||||
}
|
||||
|
||||
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonNewOk_clicked() - END");
|
||||
}
|
||||
|
||||
private void md_Response(object o, ResponseArgs args)
|
||||
{
|
||||
MessageDialog md = (MessageDialog)o;
|
||||
if (md != null)
|
||||
{
|
||||
md.Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void on_buttonNewCancel_clicked(object obj, EventArgs args)
|
||||
{
|
||||
dialogNewSecret.Destroy();
|
||||
}
|
||||
|
||||
public void on_helpbuttonNewSecret_clicked(object obj, EventArgs args)
|
||||
{
|
||||
Common.ShowHelpUrl("AddNewSecrets.htm");
|
||||
}
|
||||
///#######################################################################
|
||||
/// LINK
|
||||
/// LINK
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// LINK Key-Values
|
||||
/// </summary>
|
||||
public void OnLinkActivated(object obj, EventArgs args)
|
||||
@ -452,9 +786,9 @@ public class KdeWallet : Store
|
||||
|
||||
|
||||
///#######################################################################
|
||||
/// COPY
|
||||
/// COPY
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// COPY Key-Values
|
||||
/// </summary>
|
||||
public void OnCopyActivated(object obj, EventArgs args)
|
||||
@ -464,14 +798,69 @@ public class KdeWallet : Store
|
||||
|
||||
|
||||
///#######################################################################
|
||||
// DELETE SECRET
|
||||
/// DELETE SECRET
|
||||
|
||||
/// <summary>
|
||||
/// DELETE Secret
|
||||
/// </summary>
|
||||
public void OnDeleteActivated(object obj, EventArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.OnDeleteActivated() - BEGIN");
|
||||
if( 0 != tvSecretIDKdeWallet.Selection.CountSelectedRows() )
|
||||
{
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmDelete", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogConfirmDelete.TransientFor = (Gtk.Window)CasaMain.gxml.GetWidget("windowMain");
|
||||
dialogConfirmDelete.Title = "KdeWallet - Delete Secret";
|
||||
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
string selected = null;
|
||||
if( tvSecretIDKdeWallet.Selection.GetSelected (out model, out iter) )
|
||||
{
|
||||
selected = (string) model.GetValue (iter, 0);
|
||||
if( (null != selected) && (selected.Length > 0) )
|
||||
entryDeleteSecretID.Text = selected;
|
||||
}
|
||||
}
|
||||
Logger.DbgLog("GUI:KdeWallet.OnDeleteActivated() - END");
|
||||
}
|
||||
|
||||
public void on_buttonYes_clicked(object obj, EventArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonYes_clicked() - BEGIN");
|
||||
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
|
||||
try
|
||||
{
|
||||
if( tvSecretIDKdeWallet.Selection.GetSelected (out model, out iter) )
|
||||
{
|
||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_KDEWALLET, Common.OPERATION_DELETE_SECRET, "", "", ref model, ref iter) )
|
||||
{
|
||||
tsSecretIDKdeWallet.Remove(ref iter);
|
||||
tvSecretIDKdeWallet.ColumnsAutosize();
|
||||
tsNativeInfoKdeWallet.Clear();
|
||||
dialogConfirmDelete.Destroy();
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonYes_clicked() - DELETE_SECRET_SUCCEEDED");
|
||||
|
||||
}
|
||||
else
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonYes_clicked() - DELETE_SECRET_FAILED");
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonYes_clicked() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
|
||||
Logger.DbgLog("GUI:KdeWallet.on_buttonYes_clicked() - END");
|
||||
}
|
||||
|
||||
public void on_buttonNo_clicked(object obj, EventArgs args)
|
||||
{
|
||||
dialogConfirmDelete.Destroy();
|
||||
}
|
||||
|
||||
public void on_buttonhelpEditSecret_clicked(object obj, EventArgs args)
|
||||
|
@ -206,7 +206,7 @@ public class MiCasa : Store
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.OnRightClicked() - Context menu opened.");
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "menuRightClick", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
menuRightClick.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
|
||||
|
||||
if( 0 != tvSecretIDMiCasa.Selection.CountSelectedRows() )
|
||||
@ -238,7 +238,7 @@ public class MiCasa : Store
|
||||
TreeIter iter;
|
||||
string selected = null;
|
||||
string[] keys = null,
|
||||
values = null;
|
||||
values = null;
|
||||
|
||||
try
|
||||
{
|
||||
@ -256,20 +256,19 @@ public class MiCasa : Store
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogManageSecret", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogManageSecret.TransientFor = (Gtk.Window)CasaMain.gxml.GetWidget("windowMain");
|
||||
dialogManageSecret.Title = "ADD / VIEW / EDIT / LINK";
|
||||
dialogManageSecret.Title = "MiCasa - Manage Secret";
|
||||
|
||||
cellEditable = new CellRendererText();
|
||||
cellEditable.Editable = true;
|
||||
cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
|
||||
/// KEY:0 VALUE:1 VALUE-DUP:2 DIRTY-BIT:3 LINK:4
|
||||
/// 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));
|
||||
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
|
||||
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
|
||||
tvKeyValue.AppendColumn("Linked", new CellRendererText(), "text", 4);
|
||||
tvKeyValue.RowActivated += new RowActivatedHandler(tvKeyValue_RowActivated);
|
||||
|
||||
entrySecretID.Text = selected;
|
||||
|
||||
entrySecretID.Text = selected;
|
||||
SecretStore ss = GetMiCasaStore();
|
||||
bool bHasLinks = false;
|
||||
|
||||
@ -560,15 +559,13 @@ public class MiCasa : Store
|
||||
{
|
||||
TreeModel modelSecret;
|
||||
TreeIter iterSecret,
|
||||
iterKey;
|
||||
iterKey;
|
||||
string NewKey = null,
|
||||
NewValue = null;
|
||||
string[] Keys = null,
|
||||
Values = null,
|
||||
strDeletedKeys = null;
|
||||
NewValue = null;
|
||||
string[] strDeletedKeys = null;
|
||||
bool dirtyBit = false;
|
||||
ArrayList arrKeys = null,
|
||||
arrValues = null;
|
||||
//ArrayList arrKeys = null,
|
||||
// arrValues = null;
|
||||
|
||||
try
|
||||
{
|
||||
@ -671,14 +668,14 @@ public class MiCasa : Store
|
||||
Logger.DbgLog("GUI:MiCasa.OnNewSecretActivated() - BEGIN");
|
||||
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogNewSecret", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogNewSecret.TransientFor = (Gtk.Window)CasaMain.gxml.GetWidget("windowMain");
|
||||
dialogNewSecret.Title = "ADD NEW SECRET";
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogNewSecret.TransientFor = (Gtk.Window)CasaMain.gxml.GetWidget("windowMain");
|
||||
dialogNewSecret.Title = "MiCasa - New Secret";
|
||||
|
||||
cellEditable = new CellRendererText();
|
||||
cellEditable = new CellRendererText();
|
||||
cellEditable.Editable = true;
|
||||
cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
|
||||
/// KEY:0 VALUE:1 VALUE-DUP:2 DIRTY-BIT:3 LINK:4
|
||||
/// 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));
|
||||
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
|
||||
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
|
||||
@ -705,7 +702,7 @@ public class MiCasa : Store
|
||||
|
||||
ViewKeyValues();
|
||||
|
||||
Logger.DbgLog("GUI:MiCasa.OnNewKeyActivated() - END");
|
||||
Logger.DbgLog("GUI:MiCasa.OnNewKeyActivated() - END");
|
||||
}
|
||||
|
||||
|
||||
@ -866,6 +863,8 @@ public class MiCasa : Store
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmDelete", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogConfirmDelete.TransientFor = (Gtk.Window)CasaMain.gxml.GetWidget("windowMain");
|
||||
dialogConfirmDelete.Title = "MiCasa - Delete Secret";
|
||||
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
string selected = null;
|
||||
@ -933,6 +932,7 @@ public class MiCasa : Store
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLinkKeyValue", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
dialogLinkKeyValue.TransientFor = (Gtk.Window)CasaMain.gxml.GetWidget("dialogNewSecret");
|
||||
dialogConfirmDelete.Title = "MiCasa - Link Keys";
|
||||
dialogLinkKeyValue.Modal = true;
|
||||
|
||||
|
||||
@ -1145,16 +1145,16 @@ public class MiCasa : Store
|
||||
}*/
|
||||
|
||||
}
|
||||
/// LINK
|
||||
|
||||
private void md_Response(object o, ResponseArgs args)
|
||||
{
|
||||
/// LINK
|
||||
|
||||
private void md_Response(object o, ResponseArgs args)
|
||||
{
|
||||
MessageDialog md = (MessageDialog)o;
|
||||
if (md != null)
|
||||
{
|
||||
md.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
///##################################################################
|
||||
|
@ -5,7 +5,7 @@
|
||||
/// Abstracts the back-end and acts as an interface
|
||||
/// to the GUI.
|
||||
/// AUTHORS : Manohar, CSL.Manojna
|
||||
/// UPDATED ON : 24 Sept, 2005
|
||||
/// UPDATED ON : 03 Jan, 06
|
||||
///#################################################################
|
||||
|
||||
|
||||
@ -22,14 +22,13 @@ namespace Novell.CASA.GUI {
|
||||
using Gtk;
|
||||
using Novell.CASA.DataEngines;
|
||||
|
||||
|
||||
public class StoreDataInterface
|
||||
{
|
||||
|
||||
private static XmlDocument ccfDoc;
|
||||
private static AD ad;
|
||||
|
||||
private static string CCFXML_ELEMENT_MICASA_KEYCHAIN = "Keychain",
|
||||
private const string CCFXML_ELEMENT_MICASA_KEYCHAIN = "Keychain",
|
||||
CCFXML_ELEMENT_GKEYRING_KEYRING = "Keyring",
|
||||
CCFXML_ELEMENT_KWALLET_WALLET = "Wallet",
|
||||
CCFXML_ELEMENT_SECRET = "Secret",
|
||||
@ -45,7 +44,8 @@ namespace Novell.CASA.GUI {
|
||||
CCFXML_ELEMENT_TIME_ACCESSED = "Accessed",
|
||||
CCFXML_ATTRIBUTE_ID = "ID",
|
||||
CCFXML_ATTRIBUTE_MICASA_SYNCH = "Synch",
|
||||
CCFXML_ATTRIBUTE_GKEYRING_TYPE = "Type";
|
||||
CCFXML_ATTRIBUTE_GKEYRING_TYPE = "Type",
|
||||
CCFXML_ATTRIBUTE_WALLETLASTACCESSEDTIME="LastAcctime";
|
||||
|
||||
|
||||
|
||||
@ -62,8 +62,11 @@ namespace Novell.CASA.GUI {
|
||||
try
|
||||
{
|
||||
ccfDoc = new XmlDocument();
|
||||
ad = new AD();
|
||||
}
|
||||
ad = new AD();
|
||||
|
||||
//Init CCF from a XML Document -FIXME: -Remove this
|
||||
//ccfDoc.Load("ccfv3.xml");
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:StoreDataInterface.Init() - EXCEPTION" + exp.ToString());
|
||||
@ -94,9 +97,8 @@ namespace Novell.CASA.GUI {
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:StoreDataInterface.AggregateStore() - EXCEPTION" + exp.ToString());
|
||||
//Common.ShowErrorDialog(exp);
|
||||
return( Common.STATUS_STORE_AGGREGATEFAILED );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -118,7 +120,6 @@ namespace Novell.CASA.GUI {
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:StoreDataInterface.RefreshAllStores() - EXCEPTION" + exp.ToString());
|
||||
//Common.ShowErrorDialog(exp);
|
||||
return( Common.STATUS_STORE_AGGREGATEFAILED );
|
||||
}
|
||||
Logger.DbgLog("GUI:StoreDataInterface.RefreshAllStores() - END");
|
||||
@ -376,7 +377,6 @@ namespace Novell.CASA.GUI {
|
||||
catch(Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:StoreDataInterface.ReadStore() - EXCEPTION" + exp.ToString());
|
||||
//Common.ShowErrorDialog( exp );
|
||||
return( Common.STATUS_STORE_READFAILED );
|
||||
}
|
||||
ShowDocOnConsole("READ STORE:");
|
||||
@ -396,15 +396,17 @@ namespace Novell.CASA.GUI {
|
||||
Logger.DbgLog("GUI:StoreDataInterface.UpdateStore()");
|
||||
|
||||
//TreeStore row elements
|
||||
string storeChainKey = null;
|
||||
string SecretID = null;
|
||||
string keyChainID = null;
|
||||
string[] strKeyArray = new string[Common.MAX_ARRAY_ELEMENTS];
|
||||
string[] strValueArray = new string[Common.MAX_ARRAY_ELEMENTS];
|
||||
string[] strNativeValueArray = new string[Common.MAX_NATIVE_ELEMENTS];
|
||||
|
||||
|
||||
//XPATH query strings
|
||||
string ccfKeyChainPath = null;
|
||||
string ccfSecretPath = null;
|
||||
string ccfRootStorePath = null;
|
||||
string ccfKeyChainPath = null;
|
||||
string ccfSecretPath = null;
|
||||
|
||||
//Intialization of New Secret\Key elements
|
||||
XmlElement newKeychainElement = ccfDoc.CreateElement(CCFXML_ELEMENT_MICASA_KEYCHAIN);
|
||||
@ -417,7 +419,8 @@ namespace Novell.CASA.GUI {
|
||||
strKeyArray = (string[]) model.GetValue (iter, 1);
|
||||
strValueArray = (string[]) model.GetValue (iter, 2);
|
||||
keyChainID = (string) model.GetValue (iter, 3);
|
||||
|
||||
strNativeValueArray = (string[]) model.GetValue (iter, 5);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
@ -425,20 +428,21 @@ namespace Novell.CASA.GUI {
|
||||
//Form the query to reach to an element for modify\delete\add
|
||||
if( Common.STORE_MICASA == storeIDentifier )
|
||||
{
|
||||
storeChainKey = CCFXML_ELEMENT_MICASA_KEYCHAIN;
|
||||
ccfRootStorePath = "//CCF/miCASA";
|
||||
if( Common.OPERATION_MODIFY_KEY == operation || Common.OPERATION_DELETE_KEY == operation )
|
||||
{
|
||||
ccfSecretPath = "//CCF/miCASA/Keychain[@ID='" + keyChainID + "']/Secret[@ID='" + SecretID + "']/Key[@ID='" + keyID + "']";
|
||||
}
|
||||
else if( Common.OPERATION_DELETE_SECRET == operation )
|
||||
{
|
||||
//ccfSecretPath="//CCF/miCASA/Keychain[@ID='"+keyChainID+"']/Secret[@ID='"+SecretID+"']";
|
||||
ccfKeyChainPath = "//CCF/miCASA/Keychain[@ID='" + keyChainID + "']";
|
||||
ccfSecretPath = "Secret[@ID='" + SecretID + "']";
|
||||
}
|
||||
else if( Common.OPERATION_ADD_SECRET == operation )
|
||||
{
|
||||
ccfKeyChainPath = "//CCF/miCASA/Keychain[@ID='" + keyChainID + "']";
|
||||
ccfSecretPath = "";
|
||||
ccfSecretPath = "//CCF/miCASA/Keychain[@ID='" + keyChainID + "']/Secret[@ID='" + SecretID + "']";
|
||||
|
||||
//Create the Secret element
|
||||
newSecretElement = ccfDoc.CreateElement(CCFXML_ELEMENT_SECRET);
|
||||
@ -471,6 +475,10 @@ namespace Novell.CASA.GUI {
|
||||
newAccessedTime.InnerText = "9012";
|
||||
newTime.AppendChild(newAccessedTime);
|
||||
newSecretElement.AppendChild(newTime);
|
||||
//Create the keychain element
|
||||
newKeychainElement = ccfDoc.CreateElement(storeChainKey);
|
||||
newKeychainElement.SetAttribute(CCFXML_ATTRIBUTE_ID,keyChainID);
|
||||
newKeychainElement.AppendChild(newSecretElement);
|
||||
}
|
||||
else if( Common.OPERATION_ADD_KEY == operation )
|
||||
{
|
||||
@ -478,7 +486,6 @@ namespace Novell.CASA.GUI {
|
||||
ccfSecretPath = "";
|
||||
|
||||
//Create the Key element
|
||||
//strKeyArray[0]-[n] -If Support needed for multiple keys at once
|
||||
newKeyElement = ccfDoc.CreateElement(CCFXML_ELEMENT_KEY);
|
||||
newKeyElement.SetAttribute(CCFXML_ATTRIBUTE_ID,keyID);
|
||||
XmlElement newValue = ccfDoc.CreateElement(CCFXML_ELEMENT_VALUE);
|
||||
@ -486,10 +493,127 @@ namespace Novell.CASA.GUI {
|
||||
newKeyElement.AppendChild(newValue);
|
||||
}
|
||||
}
|
||||
else if( Common.STORE_GNOMEKEYRING == storeIDentifier )
|
||||
{
|
||||
storeChainKey = CCFXML_ELEMENT_GKEYRING_KEYRING;
|
||||
ccfRootStorePath = "//CCF/GK";
|
||||
if( Common.OPERATION_MODIFY_KEY == operation || Common.OPERATION_DELETE_KEY == operation )
|
||||
{
|
||||
ccfSecretPath = "//CCF/GK/Keyring[@ID='" + keyChainID + "']/Secret[@ID='" + SecretID + "']/Key[@ID='" + keyID + "']";
|
||||
//Console.WriteLine("OPERATION_MODIFY_KEY-OR-OPERATION_DELETE_KEY:ccfSecretPath:"+ccfSecretPath);//FIXME:Remove this line
|
||||
}
|
||||
else if( Common.OPERATION_DELETE_SECRET == operation )
|
||||
{
|
||||
ccfKeyChainPath = "//CCF/GK/Keyring[@ID='" + keyChainID + "']";
|
||||
ccfSecretPath = "Secret[@ID='" + SecretID + "']";
|
||||
//Console.WriteLine("OPERATION_DELETE_SECRET:ccfKeyChainPath:"+ccfKeyChainPath);//FIXME:Remove this line
|
||||
//Console.WriteLine("OPERATION_DELETE_SECRET:ccfSecretPath:"+ccfSecretPath);//FIXME:Remove this line
|
||||
}
|
||||
else if( Common.OPERATION_ADD_SECRET == operation )
|
||||
{
|
||||
string typeID = strNativeValueArray[Common.INDEX_NATIVEINFO_TYPEID];
|
||||
string walletLastAccessedTime = strNativeValueArray[Common.INDEX_NATIVEINFO_WALLETLASTACCESSEDTIME];
|
||||
ccfKeyChainPath = "//CCF/GK/Keyring[@ID='" + keyChainID + "']";//Default keyChainID:CASAKeyring
|
||||
ccfSecretPath = "//CCF/GK/Keyring[@ID='" + keyChainID + "']/Secret[@ID='" + SecretID + "']";
|
||||
//Console.WriteLine("OPERATION_ADD_SECRET:ccfKeyChainPath:"+ccfKeyChainPath);//FIXME:Remove this line
|
||||
//Console.WriteLine("OPERATION_ADD_SECRET:ccfSecretPath:"+ccfSecretPath);//FIXME:Remove this line
|
||||
|
||||
//Create the Secret element
|
||||
newSecretElement = ccfDoc.CreateElement(CCFXML_ELEMENT_SECRET);
|
||||
newSecretElement.SetAttribute(CCFXML_ATTRIBUTE_ID,SecretID);
|
||||
newSecretElement.SetAttribute(CCFXML_ATTRIBUTE_GKEYRING_TYPE,typeID); //Default typeID:Password
|
||||
|
||||
//Add all keys from strKeyArray to the new secret
|
||||
for( int i=0; i< strKeyArray.Length; i++)
|
||||
{
|
||||
XmlElement newKey = ccfDoc.CreateElement(CCFXML_ELEMENT_KEY);
|
||||
newKey.SetAttribute(CCFXML_ATTRIBUTE_ID,strKeyArray[i]);
|
||||
XmlElement newValue = ccfDoc.CreateElement(CCFXML_ELEMENT_VALUE);
|
||||
newValue.InnerText = strValueArray[i];
|
||||
newKey.AppendChild(newValue);
|
||||
newSecretElement.AppendChild(newKey);
|
||||
}
|
||||
|
||||
//Create the keychain element
|
||||
newKeychainElement = ccfDoc.CreateElement(storeChainKey);
|
||||
newKeychainElement.SetAttribute(CCFXML_ATTRIBUTE_ID,keyChainID);
|
||||
//newKeychainElement.SetAttribute(CCFXML_ATTRIBUTE_WALLETLASTACCESSEDTIME,walletLastAccessedTime);
|
||||
newKeychainElement.AppendChild(newSecretElement);
|
||||
}
|
||||
else if( Common.OPERATION_ADD_KEY == operation )
|
||||
{
|
||||
ccfKeyChainPath = "//CCF/GK/Keyring[@ID='" + keyChainID + "']/Secret[@ID='" + SecretID + "']";
|
||||
ccfSecretPath = "";
|
||||
|
||||
//Create the Key element
|
||||
newKeyElement = ccfDoc.CreateElement(CCFXML_ELEMENT_KEY);
|
||||
newKeyElement.SetAttribute(CCFXML_ATTRIBUTE_ID,keyID);
|
||||
XmlElement newValue = ccfDoc.CreateElement(CCFXML_ELEMENT_VALUE);
|
||||
newValue.InnerText = valueToBeModfied;
|
||||
newKeyElement.AppendChild(newValue);
|
||||
}
|
||||
}
|
||||
else if( Common.STORE_KDEWALLET == storeIDentifier )
|
||||
{
|
||||
string folderName = strNativeValueArray[Common.INDEX_NATIVEINFO_FOLDERNAME];
|
||||
string typeID = strNativeValueArray[Common.INDEX_NATIVEINFO_TYPEID];
|
||||
storeChainKey = CCFXML_ELEMENT_KWALLET_WALLET;
|
||||
ccfRootStorePath = "//CCF/KWallet";
|
||||
|
||||
if( Common.OPERATION_MODIFY_KEY == operation || Common.OPERATION_DELETE_KEY == operation )
|
||||
{
|
||||
ccfSecretPath = "//CCF/KWallet/Wallet[@ID='" + keyChainID + "']/Folder[@Name='" + folderName + "']/Type[@ID='" + typeID + "']/Secret[@ID='" + SecretID + "']/Key[@ID='" + keyID + "']";
|
||||
//Console.WriteLine("OPERATION_MODIFY_KEY-OR-OPERATION_DELETE_KEY:ccfSecretPath:"+ccfSecretPath);//FIXME:Remove this line
|
||||
}
|
||||
else if( Common.OPERATION_DELETE_SECRET == operation )
|
||||
{
|
||||
ccfKeyChainPath = "//CCF/KWallet/Wallet[@ID='" + keyChainID + "']/Folder[@Name='" + folderName + "']/Type[@ID='" + typeID + "']";
|
||||
ccfSecretPath = "Secret[@ID='" + SecretID + "']";
|
||||
//Console.WriteLine("OPERATION_DELETE_SECRET:ccfKeyChainPath:"+ccfKeyChainPath);//FIXME:Remove this line
|
||||
//Console.WriteLine("OPERATION_DELETE_SECRET:ccfSecretPath:"+ccfSecretPath);//FIXME:Remove this line
|
||||
}
|
||||
else if( Common.OPERATION_ADD_SECRET == operation )
|
||||
{
|
||||
ccfKeyChainPath = "//CCF/KWallet/Wallet[@ID='" + keyChainID + "']/Folder[@Name='" + folderName + "']/Type[@ID='" + typeID + "']";
|
||||
ccfSecretPath = "//CCF/KWallet/Wallet[@ID='" + keyChainID + "']/Folder[@Name='" + folderName + "']/Type[@ID='" + typeID + "']/Secret[@ID='" + SecretID + "']";
|
||||
//Console.WriteLine("OPERATION_ADD_SECRET:ccfKeyChainPath:"+ccfKeyChainPath);//FIXME:Remove this line
|
||||
//Console.WriteLine("OPERATION_ADD_SECRET:ccfSecretPath:"+ccfSecretPath);//FIXME:Remove this line
|
||||
|
||||
//Create the Secret element
|
||||
newSecretElement = ccfDoc.CreateElement(CCFXML_ELEMENT_SECRET);
|
||||
newSecretElement.SetAttribute(CCFXML_ATTRIBUTE_ID,SecretID);
|
||||
|
||||
//Add all keys from strKeyArray to the new secret
|
||||
for( int i=0; i< strKeyArray.Length; i++)
|
||||
{
|
||||
XmlElement newKey = ccfDoc.CreateElement(CCFXML_ELEMENT_KEY);
|
||||
newKey.SetAttribute(CCFXML_ATTRIBUTE_ID,strKeyArray[i]);
|
||||
XmlElement newValue = ccfDoc.CreateElement(CCFXML_ELEMENT_VALUE);
|
||||
newValue.InnerText = strValueArray[i];
|
||||
newKey.AppendChild(newValue);
|
||||
newSecretElement.AppendChild(newKey);
|
||||
}
|
||||
|
||||
}
|
||||
else if( Common.OPERATION_ADD_KEY == operation )
|
||||
{
|
||||
ccfKeyChainPath = "//CCF/KWallet/Wallet[@ID='" + keyChainID + "']/Folder[@Name='" + folderName + "']/Type[@ID='" + typeID + "']/Secret[@ID='" + SecretID + "']";
|
||||
ccfSecretPath = "";
|
||||
|
||||
//Create the Key element
|
||||
newKeyElement = ccfDoc.CreateElement(CCFXML_ELEMENT_KEY);
|
||||
newKeyElement.SetAttribute(CCFXML_ATTRIBUTE_ID,keyID);
|
||||
XmlElement newValue = ccfDoc.CreateElement(CCFXML_ELEMENT_VALUE);
|
||||
newValue.InnerText = valueToBeModfied;
|
||||
newKeyElement.AppendChild(newValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
return( Common.STATUS_STORE_UNSUPPORTEDOPERATION );
|
||||
|
||||
//Execute the query for modify\delete\add
|
||||
|
||||
|
||||
//Execution of the query's
|
||||
if( Common.OPERATION_MODIFY_KEY == operation )
|
||||
{
|
||||
//For Modify operation get to the Node in the tree which needs to be modified
|
||||
@ -498,7 +622,8 @@ namespace Novell.CASA.GUI {
|
||||
foreach ( XmlNode key in keylist )
|
||||
{
|
||||
key.ChildNodes[0].InnerText=valueToBeModfied ;
|
||||
ad.SetSecret(key.ParentNode,storeIDentifier);
|
||||
//Console.WriteLine("EXECUTING OPERATION_MODIFY_KEY:Modifying"+ccfSecretPath);//FIXME:Remove this line
|
||||
ad.SetSecret(key.ParentNode,operation,storeIDentifier);
|
||||
}
|
||||
}
|
||||
else if( Common.OPERATION_DELETE_SECRET == operation )
|
||||
@ -512,6 +637,7 @@ namespace Novell.CASA.GUI {
|
||||
XmlNodeList secretNodelist = keychain.SelectNodes(ccfSecretPath);
|
||||
foreach ( XmlNode secret in secretNodelist )
|
||||
{
|
||||
//Console.WriteLine("EXECUTING OPERATION_DELETE_SECRET:Deleting"+ccfSecretPath);//FIXME:Remove this line
|
||||
ad.Remove(secret,storeIDentifier);
|
||||
}
|
||||
}
|
||||
@ -524,69 +650,169 @@ namespace Novell.CASA.GUI {
|
||||
|
||||
foreach ( XmlNode key in keylist )
|
||||
{
|
||||
//key.ChildNodes[0].InnerText=valueToBeModfied ;
|
||||
XmlNode keyParentNode = key.ParentNode;
|
||||
key.ParentNode.RemoveChild(key);
|
||||
//Console.WriteLine("EXECUTING OPERATION_DELETE_KEY:Deleting"+ccfSecretPath);//FIXME:Remove this line
|
||||
ad.SetSecret(keyParentNode,storeIDentifier);
|
||||
}
|
||||
}
|
||||
else if( Common.OPERATION_ADD_SECRET == operation )
|
||||
{
|
||||
//Add a new secret to the keychain
|
||||
XmlNode root = ccfDoc.DocumentElement;
|
||||
XmlNodeList keychainNodeList = root.SelectNodes(ccfKeyChainPath);
|
||||
//ShowDocOnConsole("BEFORE CALL TO SETSECRET");//FIXME:Remove this
|
||||
|
||||
if(( Common.STORE_MICASA == storeIDentifier )||( Common.STORE_GNOMEKEYRING == storeIDentifier ))
|
||||
{
|
||||
//Add a new secret to the keychain
|
||||
XmlNode root = ccfDoc.DocumentElement;
|
||||
XmlNodeList keychainNodeList = root.SelectNodes(ccfKeyChainPath);
|
||||
//Console.WriteLine("ADD_SECRET:ccfKeyChainPath="+ccfKeyChainPath);//FIXME:Remove this line
|
||||
|
||||
if( (null == keychainNodeList) || (0 == keychainNodeList.Count) )
|
||||
{
|
||||
newKeychainElement = ccfDoc.CreateElement(CCFXML_ELEMENT_MICASA_KEYCHAIN);
|
||||
newKeychainElement.SetAttribute(CCFXML_ATTRIBUTE_ID,keyChainID);
|
||||
ccfKeyChainPath = "//CCF/miCASA";
|
||||
keychainNodeList = root.SelectNodes(ccfKeyChainPath);
|
||||
XmlNode miCASANode = keychainNodeList.Item(0);
|
||||
if( (null == keychainNodeList) || (0 == keychainNodeList.Count) )
|
||||
{//No root keychain path for this wallet. Hence New Keychain to be created
|
||||
//Expected path to be existing in CCF is eg://CCF/miCASA
|
||||
keychainNodeList = root.SelectNodes(ccfRootStorePath);
|
||||
XmlNode miCASANode = keychainNodeList.Item(0);
|
||||
|
||||
if( null != miCASANode )
|
||||
{
|
||||
miCASANode.AppendChild(newKeychainElement);
|
||||
newKeychainElement.AppendChild(newSecretElement);
|
||||
ccfSecretPath = "//CCF/miCASA/Keychain[@ID='" + keyChainID + "']/Secret[@ID='" + SecretID + "']";
|
||||
keychainNodeList = root.SelectNodes(ccfSecretPath);
|
||||
XmlNode SecretNode = keychainNodeList.Item(0);
|
||||
ad.SetSecret(SecretNode,storeIDentifier);
|
||||
if( null != miCASANode )
|
||||
{
|
||||
//Console.WriteLine("ADD_SECRET:Appending to ccfRootStorePath="+ccfRootStorePath);//FIXME:Remove this line
|
||||
miCASANode.AppendChild(newKeychainElement);
|
||||
//ShowDocOnConsole("AFTER APENDING TO miCASANode");//FIXME:Remove this
|
||||
//Console.WriteLine("ADD_SECRET:ccfSecretPath="+ccfSecretPath);//FIXME:Remove this line
|
||||
keychainNodeList = root.SelectNodes(ccfSecretPath);
|
||||
XmlNode SecretNode = keychainNodeList.Item(0);
|
||||
//Console.WriteLine("EXECUTING OPERATION_ADD_SECRET:Adding"+ccfSecretPath);//FIXME:Remove this line
|
||||
ad.SetSecret(SecretNode,operation,storeIDentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{//Root keychain path exists for this wallet
|
||||
//Console.WriteLine("ADD_SECRET:Appending to ccfKeyChainPath="+ccfKeyChainPath);//FIXME:Remove this line
|
||||
XmlNode keychain = keychainNodeList.Item(0);
|
||||
keychain.AppendChild(newSecretElement);
|
||||
XmlNode lastChild = keychain.LastChild;
|
||||
//ShowDocOnConsole("BEFORE CALL TO SETSECRET");//FIXME:Remove this
|
||||
//Console.WriteLine("EXECUTING OPERATION_ADD_SECRET:Adding Secret to existing keychain");//FIXME:Remove this line
|
||||
int errCode=ad.SetSecret(lastChild,operation,storeIDentifier);
|
||||
//Console.WriteLine("OPERATION_ADD_SECRET Returned:errCode"+errCode);//FIXME:Remove this line
|
||||
}
|
||||
}//Common.STORE_MICASA \ STORE_GNOMEKEYRING
|
||||
else
|
||||
if( Common.STORE_KDEWALLET == storeIDentifier )
|
||||
{
|
||||
XmlNode keychain = keychainNodeList.Item(0);
|
||||
keychain.AppendChild(newSecretElement);
|
||||
XmlNode lastChild = keychain.LastChild;
|
||||
ad.SetSecret(lastChild,storeIDentifier);
|
||||
}
|
||||
string folderName = strNativeValueArray[Common.INDEX_NATIVEINFO_FOLDERNAME];
|
||||
string typeID = strNativeValueArray[Common.INDEX_NATIVEINFO_TYPEID];
|
||||
XmlNode root = ccfDoc.DocumentElement;
|
||||
ccfKeyChainPath = "//CCF/KWallet/Wallet[@ID='" + keyChainID + "']"; //CASAwallet
|
||||
XmlNodeList keychainNodeList = root.SelectNodes(ccfKeyChainPath);
|
||||
if( (null == keychainNodeList) || (0 == keychainNodeList.Count) )
|
||||
{//Wallet:CASAwallet does not exist. Hence create all
|
||||
XmlElement folder;
|
||||
XmlElement type;
|
||||
newKeychainElement = ccfDoc.CreateElement(storeChainKey);//Wallet
|
||||
newKeychainElement.SetAttribute(CCFXML_ATTRIBUTE_ID,keyChainID);
|
||||
folder = ccfDoc.CreateElement(CCFXML_ELEMENT_FOLDER);
|
||||
folder.SetAttribute(CCFXML_ATTRIBUTE_FOLDERNAME,folderName);
|
||||
type = ccfDoc.CreateElement(CCFXML_ELEMENT_TYPE);
|
||||
type.SetAttribute(CCFXML_ATTRIBUTE_ID,typeID);
|
||||
|
||||
//Join all of them
|
||||
type.AppendChild(newSecretElement);
|
||||
folder.AppendChild(type);
|
||||
newKeychainElement.AppendChild(folder);
|
||||
//Append the keychain to the root
|
||||
keychainNodeList = root.SelectNodes(ccfRootStorePath);
|
||||
XmlNode rootNode = keychainNodeList.Item(0);
|
||||
if( null != rootNode )
|
||||
rootNode.AppendChild(newKeychainElement);
|
||||
|
||||
}
|
||||
else
|
||||
{//Wallet:CASAwallet exists. Hence check for folder
|
||||
ccfKeyChainPath = "//CCF/KWallet/Wallet[@ID='" + keyChainID + "']/Folder[@Name='" + folderName + "']"; //Password
|
||||
XmlNodeList keychainFolderNodeList = root.SelectNodes(ccfKeyChainPath);
|
||||
if( (null == keychainFolderNodeList) || (0 == keychainFolderNodeList.Count) )
|
||||
{//folderName:Password does not exist. Hence create folder & type
|
||||
XmlElement folder;
|
||||
XmlElement type;
|
||||
folder = ccfDoc.CreateElement(CCFXML_ELEMENT_FOLDER);
|
||||
folder.SetAttribute(CCFXML_ATTRIBUTE_FOLDERNAME,folderName);
|
||||
type = ccfDoc.CreateElement(CCFXML_ELEMENT_TYPE);
|
||||
type.SetAttribute(CCFXML_ATTRIBUTE_ID,typeID);
|
||||
|
||||
//Append secret to type
|
||||
type.AppendChild(newSecretElement);
|
||||
//Append type to folder
|
||||
folder.AppendChild(type);
|
||||
//Append folder to the existing keychainNodeList
|
||||
XmlNode keychainNode = keychainNodeList.Item(0);
|
||||
if( null != keychainNode )
|
||||
keychainNode.AppendChild(folder);
|
||||
}
|
||||
else
|
||||
{//Wallet:CASAwallet & folder exists. Hence check for type
|
||||
ccfKeyChainPath = "//CCF/KWallet/Wallet[@ID='" + keyChainID + "']/Folder[@Name='" + folderName + "']/Type[@ID='" + typeID + "']"; //Maps
|
||||
XmlNodeList keychainTypeNodeList = root.SelectNodes(ccfKeyChainPath);
|
||||
if( (null == keychainTypeNodeList) || (0 == keychainTypeNodeList.Count) )
|
||||
{//type:Maps does not exist. Hence create folder & type
|
||||
XmlElement type;
|
||||
type = ccfDoc.CreateElement(CCFXML_ELEMENT_TYPE);
|
||||
type.SetAttribute(CCFXML_ATTRIBUTE_ID,typeID);
|
||||
//Append Secret to type
|
||||
type.AppendChild(newSecretElement);
|
||||
//Append type to the existing keychainFolderNodeList
|
||||
XmlNode keychainFolderNode = keychainFolderNodeList.Item(0);
|
||||
if( null != keychainFolderNode )
|
||||
keychainFolderNode.AppendChild(type);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Invoke setsecret
|
||||
//ShowDocOnConsole("AFTER ADD to CCF");//FIXME:Remove this
|
||||
ccfKeyChainPath = "//CCF/KWallet/Wallet[@ID='" + keyChainID + "']/Folder[@Name='" + folderName + "']/Type[@ID='" + typeID + "']";
|
||||
root = ccfDoc.DocumentElement;
|
||||
//Console.WriteLine("ADD_SECRET:ccfSecretPath="+ccfSecretPath);//FIXME:Remove this line
|
||||
//Console.WriteLine("ADD_SECRET:ccfKeyChainPath="+ccfKeyChainPath);//FIXME:Remove this line
|
||||
XmlNodeList secretNodeList = root.SelectNodes(ccfKeyChainPath);
|
||||
XmlNode SecretNode = secretNodeList.Item(0);
|
||||
XmlNode lastChild = SecretNode.LastChild; //The newly added secret
|
||||
if(lastChild!=null)
|
||||
{
|
||||
//Console.WriteLine("EXECUTING OPERATION_ADD_SECRET:Adding"+ccfSecretPath);//FIXME:Remove this line
|
||||
ad.SetSecret(lastChild,operation,storeIDentifier);
|
||||
}
|
||||
}//STORE_KDEWALLET
|
||||
|
||||
|
||||
}
|
||||
else if( Common.OPERATION_ADD_KEY == operation )
|
||||
{
|
||||
//Add a new KN\KV to the keychain-Secret
|
||||
//Console.WriteLine("EXECUTING OPERATION_ADD_KEY:Adding"+ccfKeyChainPath);//FIXME:Remove this line
|
||||
XmlNode root = ccfDoc.DocumentElement;
|
||||
XmlNodeList keyNodeList = root.SelectNodes(ccfKeyChainPath);
|
||||
XmlNode keyNode=keyNodeList.Item(0);
|
||||
XmlNode lastChild = keyNode.LastChild;
|
||||
keyNode.InsertBefore(newKeyElement,lastChild);
|
||||
ad.SetSecret(keyNode,storeIDentifier);
|
||||
//ShowDocOnConsole("JUST BEFORE CALL TO SETSECRET-ADDKEY");//FIXME:Remove this
|
||||
int errcode=ad.SetSecret(keyNode,Common.OPERATION_ADD_SECRET,storeIDentifier);
|
||||
//ShowDocOnConsole("SetSecret returned errcode="+errcode);//FIXME:Remove this
|
||||
}
|
||||
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
//Console.WriteLine("Exception"+exp.ToString());//FIXME:Remove this line
|
||||
Logger.DbgLog("GUI:StoreDataInterface.UpdateStore() - EXCEPTION" + exp.ToString());
|
||||
//Common.ShowErrorDialog( exp );
|
||||
return( Common.STATUS_STORE_UPDATEFAILED );
|
||||
}
|
||||
|
||||
ShowDocOnConsole("UPDATE STORE:");
|
||||
return( Common.STATUS_SUCCESS );
|
||||
}
|
||||
|
||||
|
||||
|
||||
///#######################################################################
|
||||
/// DUMP THE XML CCF ON CONSOLE
|
||||
|
||||
@ -603,8 +829,9 @@ namespace Novell.CASA.GUI {
|
||||
Console.WriteLine("\n#######################################################");
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
///###########################################################################
|
||||
/// END OF FILE
|
||||
///###########################################################################
|
||||
///###########################################################################
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
|
||||
|
||||
<glade-project>
|
||||
<name>Casa-1.5</name>
|
||||
<program_name>casa-1.5</program_name>
|
||||
<pixmaps_directory></pixmaps_directory>
|
||||
<gnome_support>FALSE</gnome_support>
|
||||
</glade-project>
|
||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
|
||||
|
||||
<glade-project>
|
||||
<name>Casa-1.5</name>
|
||||
<program_name>casa-1.5</program_name>
|
||||
<pixmaps_directory></pixmaps_directory>
|
||||
<gnome_support>FALSE</gnome_support>
|
||||
</glade-project>
|
||||
|
Loading…
Reference in New Issue
Block a user