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-02-28 13:06:42 +01:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Specialized;
|
2005-10-11 21:51:00 +02:00
|
|
|
using Gtk;
|
|
|
|
using Glade;
|
2006-02-28 13:06:42 +01:00
|
|
|
using Novell.CASA.MiCasa.Common;
|
|
|
|
using Novell.CASA.MiCasa.Communication;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
public class Firefox : Store
|
|
|
|
{
|
2006-02-28 13:06:42 +01:00
|
|
|
Gtk.TreeStore tsSecretIDFirefox,
|
|
|
|
tsNativeInfoFirefox,
|
|
|
|
tsKeyValue;
|
|
|
|
|
|
|
|
CellRendererText cellEditable;
|
2006-03-07 14:54:44 +01:00
|
|
|
|
2006-02-28 13:06:42 +01:00
|
|
|
public bool IS_STORE_AGGREGATED = false;
|
|
|
|
|
|
|
|
#region Glade Widgets
|
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
public Gtk.Window windowMain;
|
|
|
|
|
|
|
|
public Gtk.TreeView tvSecretIDFirefox;
|
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.TreeView tvKeyValue,
|
|
|
|
tvNativeInfoFirefox;
|
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.Dialog dialogNewSecret,
|
|
|
|
dialogManageSecret,
|
2006-03-15 16:56:11 +01:00
|
|
|
dialogLogin,
|
|
|
|
dialogConfirmDelete;
|
2006-02-28 13:06:42 +01:00
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.Menu menuRightClick;
|
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.Entry entrySecretID,
|
|
|
|
entryKey,
|
|
|
|
entryValue,
|
|
|
|
entryMasterPassword3,
|
2006-03-15 16:56:11 +01:00
|
|
|
entryMasterPassword4,
|
|
|
|
entryDeleteSecretID;
|
2006-02-28 13:06:42 +01:00
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.CheckButton cbuttonShowPassword;
|
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.Label label86,
|
|
|
|
label88;
|
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.Button buttonNewAdd,
|
|
|
|
buttonNewRemove;
|
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.MenuItem cmiNewSecret,
|
|
|
|
cmiNewKey,
|
|
|
|
cmiDelete,
|
|
|
|
cmiView,
|
|
|
|
cmiLink,
|
|
|
|
cmiCopy;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// CONSTRUCTOR
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public Firefox()
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.Firefox() - BEGIN");
|
|
|
|
|
2006-03-08 11:58:28 +01:00
|
|
|
/// SecretID TreeStore
|
2006-03-07 14:54:44 +01:00
|
|
|
tvSecretIDFirefox = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvSecretIDFirefox");
|
2006-02-28 13:06:42 +01:00
|
|
|
tsSecretIDFirefox = new TreeStore(typeof(string), typeof(string[]), typeof(string[]), typeof(string), typeof(string[]), typeof(string[]));
|
|
|
|
tvSecretIDFirefox.AppendColumn("Secret ID",new CellRendererText(),"text",0);
|
|
|
|
tvSecretIDFirefox.Model = tsSecretIDFirefox;
|
|
|
|
tvSecretIDFirefox.RowActivated += new RowActivatedHandler(OntvSecretIDFirefoxRowActivated);
|
|
|
|
tvSecretIDFirefox.ButtonReleaseEvent += new ButtonReleaseEventHandler(OnRightClicked);
|
|
|
|
tvSecretIDFirefox.CursorChanged += new EventHandler(OnCursorChanged);
|
|
|
|
/// NativeInfo TreeStore
|
2006-03-07 14:54:44 +01:00
|
|
|
tvNativeInfoFirefox = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvNativeInfoFirefox");
|
2006-02-28 13:06:42 +01:00
|
|
|
tsNativeInfoFirefox = new TreeStore(typeof(string), typeof(string));
|
|
|
|
tvNativeInfoFirefox.AppendColumn("NativeKey",new CellRendererText(),"text",0);
|
|
|
|
tvNativeInfoFirefox.AppendColumn("NativeValue",new CellRendererText(),"text",1);
|
|
|
|
tvNativeInfoFirefox.Model = tsNativeInfoFirefox;
|
|
|
|
tvNativeInfoFirefox.ModifyBase(StateType.Normal,new Gdk.Color(0xff,0xff,0xe6));
|
2006-03-08 11:58:28 +01:00
|
|
|
|
|
|
|
Logger.DbgLog("GUI:Firefox.Firefox() - END");
|
2006-02-28 13:06:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// AGGREGATE STORE
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
2005-10-11 21:51:00 +02:00
|
|
|
public override void AggregateStore()
|
|
|
|
{
|
2006-02-28 13:06:42 +01:00
|
|
|
Logger.DbgLog("GUI:Firefox.AggregateStore() - BEGIN");
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2006-03-07 14:54:44 +01:00
|
|
|
tsSecretIDFirefox.Clear();
|
2006-02-28 13:06:42 +01:00
|
|
|
tsNativeInfoFirefox.Clear();
|
|
|
|
StoreDataInterface.AggregateStore(Common.STORE_FIREFOX);
|
|
|
|
StoreDataInterface.ReadStore(Common.STORE_FIREFOX,ref tsSecretIDFirefox);
|
|
|
|
}
|
|
|
|
catch(Exception exp)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.AggregateStore() - EXCEPTION" + exp.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:Firefox.AggregateStore() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-03-30 17:42:33 +02:00
|
|
|
|
|
|
|
public override void ClearViewOnStore()
|
|
|
|
{
|
|
|
|
tsSecretIDFirefox.Clear();
|
|
|
|
tsNativeInfoFirefox.Clear();
|
|
|
|
}
|
|
|
|
|
2006-02-28 13:06:42 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// DISPLAY NATIVE INFO
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
private void OnCursorChanged(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.OnCursorChanged() - BEGIN");
|
|
|
|
|
|
|
|
TreeModel model;
|
|
|
|
TreeIter iter;
|
|
|
|
string selected = null;
|
|
|
|
string[] NativeKeys = null,
|
|
|
|
NativeValues = null;
|
|
|
|
|
|
|
|
if( tvSecretIDFirefox.Selection.GetSelected (out model, out iter) )
|
|
|
|
selected = (string) model.GetValue(iter, 0);
|
|
|
|
|
|
|
|
if( (null != selected) && (selected.Length > 0) )
|
|
|
|
{
|
|
|
|
tsNativeInfoFirefox.Clear();
|
|
|
|
/// Populate NativeInfo
|
|
|
|
tsNativeInfoFirefox.AppendValues("Profile 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] != "") )
|
|
|
|
tsNativeInfoFirefox.AppendValues(NativeKeys[i], "= "+NativeValues[i]);
|
|
|
|
tvNativeInfoFirefox.ShowAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:Firefox.OnCursorChanged() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// RIGHT-CLICK CONTEXT MENU
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void OnRightClicked(object obj, ButtonReleaseEventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.OnRightClicked() - BEGIN");
|
|
|
|
|
|
|
|
if( 3 == args.Event.Button )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.OnRightClicked() - Context menu opened.");
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "menuRightClick", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
menuRightClick.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
|
|
|
|
|
|
|
|
if( 0 != tvSecretIDFirefox.Selection.CountSelectedRows() )
|
2006-03-15 16:56:11 +01:00
|
|
|
cmiNewSecret.Sensitive = cmiNewKey.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = false;
|
2006-02-28 13:06:42 +01:00
|
|
|
else
|
|
|
|
cmiNewSecret.Sensitive = cmiNewKey.Sensitive = cmiDelete.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = cmiView.Sensitive = false;
|
|
|
|
}
|
|
|
|
catch(Exception exp)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.OnRightClicked() - EXCEPTION" + exp.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:Firefox.OnRightClicked() - END");
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
|
2006-02-28 13:06:42 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// VIEW KEY-VALUES
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
2005-10-11 21:51:00 +02:00
|
|
|
public override void ViewKeyValues()
|
2006-02-28 13:06:42 +01:00
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.ViewKeyValues() - BEGIN");
|
|
|
|
|
|
|
|
TreeModel model;
|
|
|
|
TreeIter iter;
|
|
|
|
string selected= null;
|
|
|
|
string[] keys = null,
|
|
|
|
values = null;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
|
|
|
|
if( tvSecretIDFirefox.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);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
2006-03-07 14:54:44 +01:00
|
|
|
dialogManageSecret.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
2006-02-28 13:06:42 +01:00
|
|
|
dialogManageSecret.Title = "Firefox - Manage Secret";
|
|
|
|
|
|
|
|
cellEditable = new CellRendererText();
|
2006-03-15 16:56:11 +01:00
|
|
|
cellEditable.Editable = true;
|
|
|
|
cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
|
2006-02-28 13:06:42 +01:00
|
|
|
//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);
|
|
|
|
|
|
|
|
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, "No");
|
|
|
|
}
|
|
|
|
tvKeyValue.Model = tsKeyValue;
|
|
|
|
//entryKey.HasFocus = true;
|
|
|
|
entryKey.Sensitive = entryValue.Sensitive = buttonNewAdd.Sensitive = buttonNewRemove.Sensitive = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception exp)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.ViewKeyValues() - EXCEPTION" + exp.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:Firefox.ViewKeyValues() - END");
|
|
|
|
}
|
2006-03-15 16:56:11 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// EDIT KEY-VALUE
|
|
|
|
/// </summary>
|
|
|
|
public void OnKeyValueEdited(object obj, EditedArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.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();
|
|
|
|
|
|
|
|
tvSecretIDFirefox.Selection.GetSelected (out model, out iter);
|
|
|
|
|
|
|
|
if( false == entrySecretID.Editable )
|
|
|
|
{
|
|
|
|
if( ("" != args.NewText) && (KeyValue != args.NewText) )
|
|
|
|
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_FIREFOX, Common.OPERATION_MODIFY_KEY, KeyName, args.NewText, ref model, ref iter) )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.OnKeyValueEdited() - StoreDataInterface.UpdateStore() succeeded");
|
|
|
|
tvKeyValue.Selection.GetSelected (out model, out iter);
|
|
|
|
tsKeyValue.SetValue(iter, 1, args.NewText);
|
|
|
|
tsKeyValue.SetValue(iter, 2, "********");
|
|
|
|
|
|
|
|
tvSecretIDFirefox.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;
|
|
|
|
tsSecretIDFirefox.SetValue(iter, 2, Values);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-05-04 14:10:52 +02:00
|
|
|
//AggregateStore();
|
2006-03-15 16:56:11 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
Logger.DbgLog("GUI:Firefox.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:Firefox.OnKeyValueEdited() - EXCEPTION:" + exp.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:Firefox.OnKeyValueEdited() - END");
|
|
|
|
|
|
|
|
}
|
2006-02-28 13:06:42 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ADD BUTTON CLICKED
|
|
|
|
/// </summary>
|
|
|
|
public void on_buttonNewAdd_clicked(object obj, EventArgs args)
|
2005-10-11 21:51:00 +02:00
|
|
|
{
|
2006-02-28 13:06:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// REMOVE BUTTON CLICKED
|
|
|
|
/// </summary>
|
|
|
|
public void on_buttonNewRemove_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
2006-03-07 14:54:44 +01:00
|
|
|
/// MANAGE SECRET ID DIALOG OK-BUTTON CLICKED
|
2006-02-28 13:06:42 +01:00
|
|
|
/// </summary>
|
|
|
|
public void on_buttonManageOk_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
tsKeyValue.Dispose();
|
|
|
|
dialogManageSecret.Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
2006-03-07 14:54:44 +01:00
|
|
|
/// MANAGE SECRET ID DIALOG CANCEL-BUTTON CLICKED
|
2006-02-28 13:06:42 +01:00
|
|
|
/// </summary>
|
|
|
|
public void on_buttonManageCancel_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
tsKeyValue.Dispose();
|
|
|
|
dialogManageSecret.Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_buttonhelpEditSecret_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("EditingSecrets.html");
|
|
|
|
}
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// <summary>
|
|
|
|
/// SHOW PASSWORD CHECK BUTTON CLICKED
|
|
|
|
/// </summary>
|
|
|
|
public void on_cbuttonShowPassword_toggled(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
TreeViewColumn tvCol;
|
|
|
|
|
|
|
|
if( tvKeyValue.Model.IterNChildren() > 0 )
|
|
|
|
if( true == cbuttonShowPassword.Active)
|
|
|
|
{
|
|
|
|
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;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-02-28 13:06:42 +01:00
|
|
|
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_helpbuttonAuthentication_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("CASAMasterPasswordAuthentication.htm");
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2006-03-07 14:54:44 +01:00
|
|
|
/// SECRET ID DOUBLE CLICKED
|
2006-02-28 13:06:42 +01:00
|
|
|
/// </summary>
|
|
|
|
private void OntvSecretIDFirefoxRowActivated( object obj, RowActivatedArgs args )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.OntvSecretIDFirefoxRowActivated() - ViewKeyValues() called.");
|
|
|
|
|
|
|
|
ViewKeyValues();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// VIEW KEY-VALUES CALLED VIA MAIN-MENU/CONTEXT-MENU
|
|
|
|
/// </summary>
|
|
|
|
public void OnViewActivated(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.OnViewActivated() - ViewKeyValues() called.");
|
|
|
|
|
|
|
|
ViewKeyValues();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_buttonNewCancel_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogNewSecret.Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// ADD NEW SECRET
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void OnNewSecretActivated(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// ADD NEW KEY-VALUES TO EXISTING SECRET
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void OnNewKeyActivated(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// DELETE SECRET
|
|
|
|
/// <summary>
|
|
|
|
/// DELETE Secret
|
|
|
|
/// </summary>
|
|
|
|
public void OnDeleteActivated(object obj, EventArgs args)
|
|
|
|
{
|
2006-03-15 16:56:11 +01:00
|
|
|
Logger.DbgLog("GUI:Firefox.OnDeleteActivated() - BEGIN");
|
|
|
|
if( 0 != tvSecretIDFirefox.Selection.CountSelectedRows() )
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmDelete", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogConfirmDelete.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
|
|
|
dialogConfirmDelete.Title = "Firefox - Delete Secret";
|
|
|
|
|
|
|
|
TreeModel model;
|
|
|
|
TreeIter iter;
|
|
|
|
string selected = null;
|
|
|
|
if( tvSecretIDFirefox.Selection.GetSelected (out model, out iter) )
|
|
|
|
{
|
|
|
|
selected = (string) model.GetValue (iter, 0);
|
|
|
|
if( (null != selected) && (selected.Length > 0) )
|
|
|
|
entryDeleteSecretID.Text = selected;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Logger.DbgLog("GUI:Firefox.OnDeleteActivated() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_buttonYes_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.on_buttonYes_clicked() - BEGIN");
|
|
|
|
|
|
|
|
TreeModel model;
|
|
|
|
TreeIter iter;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if( tvSecretIDFirefox.Selection.GetSelected (out model, out iter) )
|
|
|
|
{
|
|
|
|
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_FIREFOX, Common.OPERATION_DELETE_SECRET, "", "", ref model, ref iter) )
|
|
|
|
{
|
|
|
|
tsSecretIDFirefox.Remove(ref iter);
|
|
|
|
tvSecretIDFirefox.ColumnsAutosize();
|
|
|
|
tsNativeInfoFirefox.Clear();
|
|
|
|
dialogConfirmDelete.Destroy();
|
|
|
|
Logger.DbgLog("GUI:Firefox.on_buttonYes_clicked() - DELETE_SECRET_SUCCEEDED");
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Logger.DbgLog("GUI:Firefox.on_buttonYes_clicked() - DELETE_SECRET_FAILED");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception exp)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:Firefox.on_buttonYes_clicked() - EXCEPTION:" + exp.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:Firefox.on_buttonYes_clicked() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_buttonNo_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogConfirmDelete.Destroy();
|
2006-02-28 13:06:42 +01: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)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
///##################################################################
|
|
|
|
/// END OF FILE
|
2006-02-28 13:06:42 +01:00
|
|
|
///##################################################################
|