2006-01-19 00:34:21 +01:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
2006-02-01 18:48:29 +01:00
|
|
|
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
|
2006-01-19 00:34:21 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; version 2.1
|
|
|
|
* of the License.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2006-01-31 23:01:47 +01:00
|
|
|
* Library Lesser General Public License for more details.
|
2006-01-19 00:34:21 +01:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2006-01-31 23:01:47 +01:00
|
|
|
* License along with this library; if not, Novell, Inc.
|
2006-01-19 00:34:21 +01:00
|
|
|
*
|
|
|
|
* To contact Novell about this file by physical or electronic mail,
|
|
|
|
* you may find current contact information at www.novell.com.
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
namespace Novell.CASA.GUI {
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2006-01-06 12:51:36 +01:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Specialized;
|
2005-10-11 21:51:00 +02:00
|
|
|
using Glade;
|
2006-03-07 14:54:44 +01:00
|
|
|
using Gtk;
|
2005-10-11 21:51:00 +02:00
|
|
|
using Novell.CASA.MiCasa.Common;
|
|
|
|
using Novell.CASA.MiCasa.Communication;
|
|
|
|
|
|
|
|
|
|
|
|
public class GnomeKeyring : Store
|
|
|
|
{
|
|
|
|
|
|
|
|
Gtk.TreeStore tsSecretIDGnomeKeyring,
|
|
|
|
tsNativeInfoGnomeKeyring,
|
|
|
|
tsKeyValue;
|
|
|
|
|
|
|
|
CellRendererText cellEditable;
|
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
ArrayList arrDeletedKeys = null;
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
public bool IS_STORE_AGGREGATED = false;
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
string[] stringNetworkManagerServerType = new string[]{ "SSH",
|
|
|
|
"FTP (with login)",
|
|
|
|
"Windows share" };
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
#region Glade Widgets
|
|
|
|
|
|
|
|
[Glade.Widget]
|
2006-01-06 12:51:36 +01:00
|
|
|
public Gtk.Window windowMain;
|
|
|
|
|
|
|
|
public Gtk.TreeView tvSecretIDGnomeKeyring;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.TreeView tvKeyValue,
|
|
|
|
tvNativeInfoGnomeKeyring;
|
|
|
|
|
|
|
|
[Glade.Widget]
|
2006-01-06 12:51:36 +01:00
|
|
|
Gtk.Dialog dialogNewSecret,
|
2006-03-07 14:54:44 +01:00
|
|
|
dialogManageSecret,
|
|
|
|
dialogConfirmDelete,
|
|
|
|
dialogLogin,
|
|
|
|
dialogNetworkManager,
|
|
|
|
dialogGaim;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.Menu menuRightClick;
|
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.Entry entrySecretID,
|
|
|
|
entryKey,
|
|
|
|
entryValue,
|
|
|
|
entryMasterPassword3,
|
2006-01-06 12:51:36 +01:00
|
|
|
entryMasterPassword4,
|
2006-03-07 14:54:44 +01:00
|
|
|
entryDeleteSecretID,
|
|
|
|
entryNetworkManagerCName,
|
|
|
|
entryNetworkManagerServer,
|
|
|
|
entryNetworkManagerUsername,
|
|
|
|
entryNetworkManagerPassword,
|
|
|
|
entryNetworkManagerFolder,
|
|
|
|
entryNetworkManagerPort,
|
|
|
|
entryNetworkManagerShare,
|
|
|
|
entryNetworkManagerDomain;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.CheckButton cbuttonShowPassword;
|
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.Label label86,
|
2006-03-07 14:54:44 +01:00
|
|
|
label88,
|
|
|
|
labelNetworkManagerPort,
|
|
|
|
labelNetworkManagerShare,
|
|
|
|
labelNetworkManagerDomain;
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
[Glade.Widget]
|
2006-03-07 14:54:44 +01:00
|
|
|
Gtk.MenuItem cmiNewKey,
|
2005-10-11 21:51:00 +02:00
|
|
|
cmiDelete,
|
|
|
|
cmiView,
|
|
|
|
cmiLink,
|
|
|
|
cmiCopy;
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Combo comboNetworkManager;
|
2005-10-11 21:51:00 +02:00
|
|
|
#endregion
|
2006-03-07 14:54:44 +01:00
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// CONSTRUCTOR
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public GnomeKeyring()
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.GnomeKeyring() - BEGIN");
|
|
|
|
|
|
|
|
/// SecretID TreeStore
|
2006-03-07 14:54:44 +01:00
|
|
|
tvSecretIDGnomeKeyring = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvSecretIDGnomeKeyring");
|
2005-10-11 21:51:00 +02:00
|
|
|
tsSecretIDGnomeKeyring = new TreeStore(typeof(string), typeof(string[]), typeof(string[]), typeof(string), typeof(string[]), typeof(string[]));
|
2006-03-07 14:54:44 +01:00
|
|
|
tvSecretIDGnomeKeyring.AppendColumn("Secret ID",new CellRendererText(),"text",0);
|
2005-10-11 21:51:00 +02:00
|
|
|
tvSecretIDGnomeKeyring.Model = tsSecretIDGnomeKeyring;
|
|
|
|
tvSecretIDGnomeKeyring.RowActivated += new RowActivatedHandler(OntvSecretIDGnomeKeyringRowActivated);
|
|
|
|
tvSecretIDGnomeKeyring.ButtonReleaseEvent += new ButtonReleaseEventHandler(OnRightClicked);
|
|
|
|
tvSecretIDGnomeKeyring.CursorChanged += new EventHandler(OnCursorChanged);
|
|
|
|
/// NativeInfo TreeStore
|
2006-03-07 14:54:44 +01:00
|
|
|
tvNativeInfoGnomeKeyring = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvNativeInfoGnomeKeyring");
|
2005-10-11 21:51:00 +02:00
|
|
|
tsNativeInfoGnomeKeyring = new TreeStore(typeof(string), typeof(string));
|
|
|
|
tvNativeInfoGnomeKeyring.AppendColumn("NativeKey",new CellRendererText(),"text",0);
|
|
|
|
tvNativeInfoGnomeKeyring.AppendColumn("NativeValue",new CellRendererText(),"text",1);
|
|
|
|
tvNativeInfoGnomeKeyring.Model = tsNativeInfoGnomeKeyring;
|
|
|
|
tvNativeInfoGnomeKeyring.ModifyBase(StateType.Normal,new Gdk.Color(0xff,0xff,0xe6));
|
|
|
|
/// Aggregate the store
|
|
|
|
//AggregateStore();
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.GnomeKeyring() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// AGGREGATE STORE
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public override void AggregateStore()
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.AggregateStore() - BEGIN");
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
tsSecretIDGnomeKeyring.Clear();
|
2005-11-16 21:46:53 +01:00
|
|
|
tsNativeInfoGnomeKeyring.Clear();
|
2005-10-11 21:51:00 +02:00
|
|
|
StoreDataInterface.AggregateStore(Common.STORE_GNOMEKEYRING);
|
|
|
|
StoreDataInterface.ReadStore(Common.STORE_GNOMEKEYRING,ref tsSecretIDGnomeKeyring);
|
|
|
|
}
|
|
|
|
catch(Exception exp)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.AggregateStore() - EXCEPTION" + exp.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.AggregateStore() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-30 17:42:33 +02:00
|
|
|
public override void ClearViewOnStore()
|
|
|
|
{
|
|
|
|
tsSecretIDGnomeKeyring.Clear();
|
|
|
|
tsNativeInfoGnomeKeyring.Clear();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// DISPLAY NATIVE INFO
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
private void OnCursorChanged(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnCursorChanged() - BEGIN");
|
|
|
|
|
|
|
|
TreeModel model;
|
|
|
|
TreeIter iter;
|
|
|
|
string selected = null;
|
|
|
|
string[] NativeKeys = null,
|
|
|
|
NativeValues = null;
|
|
|
|
|
|
|
|
if( tvSecretIDGnomeKeyring.Selection.GetSelected (out model, out iter) )
|
|
|
|
selected = (string) model.GetValue(iter, 0);
|
|
|
|
|
|
|
|
if( (null != selected) && (selected.Length > 0) )
|
|
|
|
{
|
|
|
|
tsNativeInfoGnomeKeyring.Clear();
|
|
|
|
/// Populate NativeInfo
|
|
|
|
tsNativeInfoGnomeKeyring.AppendValues("Keyring Name","= "+ model.GetValue(iter,3));
|
|
|
|
NativeKeys = (string[]) model.GetValue(iter, 4);
|
|
|
|
NativeValues= (string[]) model.GetValue(iter, 5);
|
|
|
|
for( int i=0; i< NativeKeys.Length; i++ )
|
|
|
|
if( (NativeValues[i] != null) && (NativeValues[i] != "") )
|
|
|
|
tsNativeInfoGnomeKeyring.AppendValues(NativeKeys[i], "= "+NativeValues[i]);
|
|
|
|
tvNativeInfoGnomeKeyring.ShowAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnCursorChanged() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// RIGHT-CLICK CONTEXT MENU
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void OnRightClicked(object obj, ButtonReleaseEventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnRightClicked() - BEGIN");
|
|
|
|
|
|
|
|
if( 3 == args.Event.Button )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnRightClicked() - Context menu opened.");
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "menuRightClick", null);
|
2006-01-06 12:51:36 +01:00
|
|
|
gxmlTemp.Autoconnect (this);
|
2005-10-11 21:51:00 +02:00
|
|
|
menuRightClick.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
|
2006-01-06 12:51:36 +01:00
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
if( 0 != tvSecretIDGnomeKeyring.Selection.CountSelectedRows() )
|
2006-01-10 08:39:48 +01:00
|
|
|
cmiLink.Sensitive = cmiCopy.Sensitive = false;
|
2005-10-11 21:51:00 +02:00
|
|
|
else
|
2006-01-06 15:05:07 +01:00
|
|
|
cmiNewKey.Sensitive = cmiView.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = cmiDelete.Sensitive = false;
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
catch(Exception exp)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnRightClicked() - EXCEPTION" + exp.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnRightClicked() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// VIEW KEY-VALUES
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public override void ViewKeyValues()
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.ViewKeyValues() - BEGIN");
|
|
|
|
|
|
|
|
TreeModel model;
|
|
|
|
TreeIter iter;
|
|
|
|
string selected= null;
|
|
|
|
string[] keys = null,
|
2006-01-06 12:51:36 +01:00
|
|
|
values = null;
|
2005-10-11 21:51:00 +02:00
|
|
|
try
|
2006-01-06 12:51:36 +01:00
|
|
|
{
|
|
|
|
if( null == arrDeletedKeys )
|
|
|
|
arrDeletedKeys = new ArrayList();
|
|
|
|
else
|
|
|
|
arrDeletedKeys.Clear();
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
if( tvSecretIDGnomeKeyring.Selection.GetSelected (out model, out iter) )
|
|
|
|
{
|
|
|
|
selected = (string) model.GetValue(iter, 0);
|
|
|
|
keys = (string[]) model.GetValue(iter, 1);
|
|
|
|
values = (string[]) model.GetValue(iter, 2);
|
|
|
|
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogManageSecret", null);
|
2006-01-06 12:51:36 +01:00
|
|
|
gxmlTemp.Autoconnect (this);
|
2006-03-07 14:54:44 +01:00
|
|
|
dialogManageSecret.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
2006-01-10 14:13:04 +01:00
|
|
|
dialogManageSecret.Title = "GNOME Keyring - Manage Secret";
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
cellEditable = new CellRendererText();
|
2006-01-06 12:51:36 +01:00
|
|
|
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));
|
2005-10-11 21:51:00 +02:00
|
|
|
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
|
|
|
|
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
|
2006-01-06 12:51:36 +01:00
|
|
|
tvKeyValue.AppendColumn("Linked", new CellRendererText(), "text", 4);
|
|
|
|
|
|
|
|
entrySecretID.Text=selected;
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
for( int i=0; i< keys.Length; i++ )
|
|
|
|
{
|
|
|
|
if( (null != keys[i]) && (null != values[i]) )
|
2006-01-06 12:51:36 +01:00
|
|
|
tsKeyValue.AppendValues(keys[i], values[i], "********", false, "No");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
tvKeyValue.Model = tsKeyValue;
|
2006-01-10 08:39:48 +01:00
|
|
|
entryKey.HasFocus = true;
|
|
|
|
//entryKey.Sensitive = entryValue.Sensitive = buttonNewAdd.Sensitive = buttonNewRemove.Sensitive = false;
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception exp)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.ViewKeyValues() - EXCEPTION" + exp.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.ViewKeyValues() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// EDIT KEY-VALUE
|
|
|
|
/// </summary>
|
|
|
|
public void OnKeyValueEdited(object obj, EditedArgs args)
|
2006-01-06 12:51:36 +01:00
|
|
|
{
|
|
|
|
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");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
/// <summary>
|
|
|
|
/// ADD BUTTON CLICKED
|
|
|
|
/// </summary>
|
|
|
|
public void on_buttonNewAdd_clicked(object obj, EventArgs args)
|
|
|
|
{
|
2006-01-06 12:51:36 +01:00
|
|
|
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");
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// REMOVE BUTTON CLICKED
|
|
|
|
/// </summary>
|
|
|
|
public void on_buttonNewRemove_clicked(object obj, EventArgs args)
|
|
|
|
{
|
2006-01-06 12:51:36 +01:00
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewRemove_clicked() - BEGIN");
|
|
|
|
|
|
|
|
TreeModel modelKey;
|
|
|
|
TreeIter iterKey;
|
|
|
|
|
|
|
|
if(tvKeyValue.Selection.GetSelected (out modelKey, out iterKey))
|
2006-01-25 22:24:37 +01:00
|
|
|
if( false == (bool)tsKeyValue.GetValue(iterKey,3) )
|
2006-01-06 12:51:36 +01:00
|
|
|
arrDeletedKeys.Add(tsKeyValue.GetValue(iterKey,0));
|
|
|
|
|
|
|
|
if( 0 != tvKeyValue.Selection.CountSelectedRows() )
|
|
|
|
{
|
|
|
|
TreeModel model;
|
|
|
|
TreeIter iter;
|
|
|
|
|
|
|
|
tvKeyValue.Selection.GetSelected (out model, out iter);
|
2006-01-25 22:24:37 +01:00
|
|
|
tsKeyValue.Remove(ref iter);
|
|
|
|
tvKeyValue.ColumnsAutosize();
|
2006-01-06 12:51:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewRemove_clicked() - END");
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// SHOW PASSWORD CHECK BUTTON CLICKED
|
|
|
|
/// </summary>
|
|
|
|
public void on_cbuttonShowPassword_toggled(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
TreeViewColumn tvCol;
|
2005-11-01 23:34:36 +01:00
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
if( tvKeyValue.Model.IterNChildren() > 0 )
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
TreeViewColumn tvCol;
|
|
|
|
|
|
|
|
if( tvKeyValue.Model.IterNChildren() > 0 )
|
|
|
|
|
|
|
|
if( 0 == miCASA.SetMasterPassword(0, entryMasterPassword3.Text) )
|
|
|
|
{
|
|
|
|
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
|
|
|
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
|
|
|
tvKeyValue.InsertColumn(tvCol, 1);
|
|
|
|
dialogLogin.Destroy();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// prompt user
|
|
|
|
MessageDialog md=new MessageDialog(dialogLogin,Gtk.DialogFlags.Modal,
|
|
|
|
Gtk.MessageType.Warning,
|
|
|
|
Gtk.ButtonsType.Ok,
|
|
|
|
"Master Password incorrect");
|
|
|
|
|
|
|
|
md.Response +=new ResponseHandler(md_Response2);
|
|
|
|
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
|
|
|
md.Modal = true;
|
|
|
|
md.Show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void closebuttonLogin_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
cbuttonShowPassword.Active = false;
|
|
|
|
dialogLogin.Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnDialogLoginDeleted(object obj, DeleteEventArgs args)
|
|
|
|
{
|
|
|
|
cbuttonShowPassword.Active = false;
|
|
|
|
dialogLogin.Destroy();
|
|
|
|
args.RetVal = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_entryMasterPassword3_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
if( "" != entryMasterPassword3.Text )
|
|
|
|
okbuttonLogin_clicked(obj, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_entryMasterPassword4_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
okbuttonLogin_clicked(obj, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void md_Response2(object o, ResponseArgs args)
|
|
|
|
{
|
|
|
|
MessageDialog md = (MessageDialog)o;
|
|
|
|
if (md != null)
|
|
|
|
{
|
|
|
|
md.Destroy();
|
|
|
|
entryMasterPassword3.Text="";
|
|
|
|
entryMasterPassword3.HasFocus = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
/// <summary>
|
|
|
|
/// MANAGE SECRET-ID DIALOG OK-BUTTON CLICKED
|
|
|
|
/// </summary>
|
|
|
|
public void on_buttonManageOk_clicked(object obj, EventArgs args)
|
|
|
|
{
|
2006-01-06 12:51:36 +01:00
|
|
|
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();
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// MANAGE SECRET-ID DIALOG CANCEL-BUTTON CLICKED
|
|
|
|
/// </summary>
|
|
|
|
public void on_buttonManageCancel_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
tsKeyValue.Dispose();
|
|
|
|
dialogManageSecret.Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// SECRET-ID DOUBLE CLICKED
|
|
|
|
/// </summary>
|
|
|
|
private void OntvSecretIDGnomeKeyringRowActivated( object obj, RowActivatedArgs args )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OntvSecretIDGnomeKeyringRowActivated() - ViewKeyValues() called.");
|
2006-01-06 12:51:36 +01:00
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
ViewKeyValues();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// VIEW KEY-VALUES CALLED VIA MAIN-MENU/CONTEXT-MENU
|
|
|
|
/// </summary>
|
|
|
|
public void OnViewActivated(object obj, EventArgs args)
|
|
|
|
{
|
2006-01-06 12:51:36 +01:00
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnViewActivated() - ViewKeyValues() called.");
|
|
|
|
|
|
|
|
ViewKeyValues();
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// ADD NEW SECRET
|
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
/// <summary>
|
2005-10-11 21:51:00 +02:00
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void OnNewSecretActivated(object obj, EventArgs args)
|
|
|
|
{
|
2006-01-06 12:51:36 +01:00
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnNewSecretActivated() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogNewSecret", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
2006-03-07 14:54:44 +01:00
|
|
|
dialogNewSecret.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
2006-01-10 14:13:04 +01:00
|
|
|
dialogNewSecret.Title = "GNOME Keyring - New Secret";
|
2006-01-06 12:51:36 +01:00
|
|
|
|
|
|
|
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;
|
2006-01-25 22:24:37 +01:00
|
|
|
tsKeyValue.Clear();
|
2006-01-06 12:51:36 +01:00
|
|
|
entrySecretID.HasFocus = true;
|
|
|
|
entrySecretID.Text = "";
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnNewSecretActivated() - END");
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///#######################################################################
|
2006-01-06 12:51:36 +01:00
|
|
|
/// ADD NEW KEY-VALUES TO EXISTING SECRET
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
/// <summary>
|
2005-10-11 21:51:00 +02:00
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void OnNewKeyActivated(object obj, EventArgs args)
|
|
|
|
{
|
2006-01-06 12:51:36 +01:00
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnNewKeyActivated() - BEGIN");
|
|
|
|
|
|
|
|
ViewKeyValues();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnNewKeyActivated() - END");
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2006-02-16 13:14:15 +01:00
|
|
|
iterSecret = tsSecretIDGnomeKeyring.AppendValues(entrySecretID.Text, Keys, Values, "default", NativeKeys, NativeValues);
|
2006-01-06 12:51:36 +01:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
///#######################################################################
|
|
|
|
/// LINK
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// LINK Key-Values
|
|
|
|
/// </summary>
|
|
|
|
public void OnLinkActivated(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// COPY
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// COPY Key-Values
|
|
|
|
/// </summary>
|
|
|
|
public void OnCopyActivated(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
// DELETE SECRET
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// DELETE Secret
|
|
|
|
/// </summary>
|
|
|
|
public void OnDeleteActivated(object obj, EventArgs args)
|
2006-01-06 12:51:36 +01:00
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.OnDeleteActivated() - BEGIN");
|
|
|
|
if( 0 != tvSecretIDGnomeKeyring.Selection.CountSelectedRows() )
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmDelete", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
2006-03-07 14:54:44 +01:00
|
|
|
dialogConfirmDelete.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
|
|
|
dialogConfirmDelete.Title = "GNOME Keyring - Delete Secret";
|
2006-01-06 12:51:36 +01:00
|
|
|
|
|
|
|
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");
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
2005-12-02 23:38:46 +01:00
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
public void on_buttonhelpEditSecret_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("EditingSecrets.html");
|
|
|
|
}
|
|
|
|
public void on_helpbuttonAuthentication_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("CASAMasterPasswordAuthentication.htm");
|
|
|
|
}
|
2005-12-02 23:38:46 +01:00
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// Application SSO
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// Network Manager
|
|
|
|
public void SSONetworkManager(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogNetworkManager", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogNetworkManager.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
|
|
|
comboNetworkManager.PopdownStrings = stringNetworkManagerServerType;
|
|
|
|
comboNetworkManager.DisableActivate();
|
|
|
|
//labelNetworkManagerFolder.Visible = entryNetworkManagerFolder.Visible = true;
|
|
|
|
labelNetworkManagerPort.Visible = entryNetworkManagerPort.Visible = true;
|
|
|
|
labelNetworkManagerShare.Visible = entryNetworkManagerShare.Visible = false;
|
|
|
|
labelNetworkManagerDomain.Visible = entryNetworkManagerDomain.Visible = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_okNetworkManager_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
TreeModel modelSecret;
|
|
|
|
TreeIter iterSecret;
|
|
|
|
string SecretID = null;
|
|
|
|
string[] Keys = null,
|
|
|
|
Values = null,
|
|
|
|
NativeKeys = null,
|
|
|
|
NativeValues = null;
|
|
|
|
ArrayList arrKeys = null,
|
|
|
|
arrValues = null;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if( "" != entryNetworkManagerServer.Text && "" != entryNetworkManagerUsername.Text && "" != entryNetworkManagerPassword.Text )
|
|
|
|
{
|
|
|
|
arrKeys = new ArrayList();
|
|
|
|
arrValues = new ArrayList();
|
|
|
|
|
|
|
|
if( "SSH" == comboNetworkManager.Entry.Text )
|
|
|
|
{
|
|
|
|
SecretID = String.Concat(entryNetworkManagerUsername.Text ,"@", entryNetworkManagerServer.Text);
|
|
|
|
arrKeys.Add("server"); arrValues.Add(entryNetworkManagerServer.Text);
|
|
|
|
arrKeys.Add("user"); arrValues.Add(entryNetworkManagerUsername.Text);
|
|
|
|
arrKeys.Add("password"); arrValues.Add(entryNetworkManagerPassword.Text);
|
|
|
|
arrKeys.Add("protocol"); arrValues.Add("sftp");
|
|
|
|
arrKeys.Add("authtype"); arrValues.Add("password");
|
|
|
|
}
|
|
|
|
else if( "FTP (with login)" == comboNetworkManager.Entry.Text )
|
|
|
|
{
|
|
|
|
SecretID = String.Concat(entryNetworkManagerUsername.Text ,"@", entryNetworkManagerServer.Text);
|
|
|
|
arrKeys.Add("server"); arrValues.Add(entryNetworkManagerServer.Text);
|
|
|
|
arrKeys.Add("user"); arrValues.Add(entryNetworkManagerUsername.Text);
|
|
|
|
arrKeys.Add("password"); arrValues.Add(entryNetworkManagerPassword.Text);
|
|
|
|
arrKeys.Add("protocol"); arrValues.Add("ftp");
|
|
|
|
arrKeys.Add("authtype"); arrValues.Add("password");
|
|
|
|
}
|
|
|
|
else if( "Windows share" == comboNetworkManager.Entry.Text )
|
|
|
|
{
|
|
|
|
SecretID = String.Concat(entryNetworkManagerUsername.Text ,"@", entryNetworkManagerServer.Text,"/",entryNetworkManagerShare.Text);
|
|
|
|
arrKeys.Add("server"); arrValues.Add(entryNetworkManagerServer.Text);
|
|
|
|
arrKeys.Add("user"); arrValues.Add(entryNetworkManagerUsername.Text);
|
|
|
|
arrKeys.Add("password"); arrValues.Add(entryNetworkManagerPassword.Text);
|
|
|
|
arrKeys.Add("object"); arrValues.Add(entryNetworkManagerShare.Text);
|
|
|
|
arrKeys.Add("domain"); arrValues.Add(entryNetworkManagerDomain.Text);
|
|
|
|
arrKeys.Add("protocol"); arrValues.Add("smb");
|
|
|
|
}
|
|
|
|
|
|
|
|
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(SecretID, Keys, Values, "default", 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_okNetworkManager_clicked() - ADD_NEW_SECRET_SUCCEEDED.");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.on_okNetworkManager_clicked() - ERROR: ADD_NEW_SECRET_FAILED");
|
|
|
|
|
|
|
|
dialogNetworkManager.Destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception exp)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:GnomeKeyring.on_okNetworkManager_clicked() - EXCEPTION:" + exp.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_entryNetworkManagerServerType_changed(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
if( comboNetworkManager.Entry.Text == stringNetworkManagerServerType[0] )
|
|
|
|
{
|
|
|
|
//labelNetworkManagerFolder.Visible = entryNetworkManagerFolder.Visible = true;
|
|
|
|
labelNetworkManagerPort.Visible = entryNetworkManagerPort.Visible = true;
|
|
|
|
labelNetworkManagerShare.Visible = entryNetworkManagerShare.Visible = false;
|
|
|
|
labelNetworkManagerDomain.Visible = entryNetworkManagerDomain.Visible = false;
|
|
|
|
entryNetworkManagerServer.HasFocus = true;
|
|
|
|
}
|
|
|
|
if( comboNetworkManager.Entry.Text == stringNetworkManagerServerType[1] )
|
|
|
|
{
|
|
|
|
//labelNetworkManagerFolder.Visible = entryNetworkManagerFolder.Visible = true;
|
|
|
|
labelNetworkManagerPort.Visible = entryNetworkManagerPort.Visible = true;
|
|
|
|
labelNetworkManagerShare.Visible = entryNetworkManagerShare.Visible = false;
|
|
|
|
labelNetworkManagerDomain.Visible = entryNetworkManagerDomain.Visible = false;
|
|
|
|
entryNetworkManagerServer.HasFocus = true;
|
|
|
|
}
|
|
|
|
if( comboNetworkManager.Entry.Text == stringNetworkManagerServerType[2] )
|
|
|
|
{
|
|
|
|
//labelNetworkManagerFolder.Visible = entryNetworkManagerFolder.Visible = true;
|
|
|
|
labelNetworkManagerPort.Visible = entryNetworkManagerPort.Visible = false;
|
|
|
|
labelNetworkManagerShare.Visible = entryNetworkManagerShare.Visible = true;
|
|
|
|
labelNetworkManagerDomain.Visible = entryNetworkManagerDomain.Visible = true;
|
|
|
|
entryNetworkManagerServer.HasFocus = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_cancelNetworkManager_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogNetworkManager.Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_helpNetworkManager_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Gaim
|
|
|
|
public void SSOGaim(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogGaim", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogGaim.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
|
|
|
|
|
|
|
}
|
|
|
|
public void on_okGaim_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogGaim.Destroy();
|
|
|
|
}
|
|
|
|
public void on_cancelGaim_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogGaim.Destroy();
|
|
|
|
}
|
|
|
|
public void on_helpGaim_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
///##################################################################
|
|
|
|
/// END OF FILE
|
2005-12-02 23:38:46 +01:00
|
|
|
///##################################################################
|