2005-10-11 21:51:00 +02:00
|
|
|
///#################################################################
|
|
|
|
/// PROJECT : CASA - Common Authentication Services Adapter
|
|
|
|
/// FILE : CasaMain.cs
|
|
|
|
/// DESCRIPTION : The main class for CASA application.
|
|
|
|
/// AUTHORS : Jim Norman, CSL.Manojna
|
2006-01-06 12:51:36 +01:00
|
|
|
/// UPDATED ON : 03 Jan, 06
|
2005-10-11 21:51:00 +02:00
|
|
|
///#################################################################
|
|
|
|
|
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
namespace Novell.CASA.GUI
|
2005-11-11 16:38:05 +01:00
|
|
|
{
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using System.Diagnostics;
|
|
|
|
using Gtk;
|
|
|
|
using Glade;
|
|
|
|
using Novell.CASA;
|
|
|
|
using Novell.CASA.MiCasa.Common;
|
|
|
|
using Novell.CASA.MiCasa.Communication;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-10-13 21:56:58 +02:00
|
|
|
#if W32
|
2005-11-11 16:38:05 +01:00
|
|
|
using Microsoft.Win32;
|
2005-10-13 21:56:58 +02:00
|
|
|
#endif
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public class CasaMain
|
|
|
|
{
|
|
|
|
public MiCasa objMiCasa = null;
|
|
|
|
public Firefox objFirefox = null;
|
|
|
|
public Mozilla objMozilla = null;
|
|
|
|
public KdeWallet objKdeWallet = null;
|
|
|
|
public GnomeKeyring objGnomeKeyring = null;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public static Glade.XML gxml;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
int loginPromptCount = 3;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
#region Glade Widgets
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-01-06 12:51:36 +01:00
|
|
|
Gtk.Window windowMain;
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-01-06 12:51:36 +01:00
|
|
|
Gtk.TreeView tvLog;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-01-06 12:51:36 +01:00
|
|
|
Gtk.Notebook notebookStores;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-01-06 12:51:36 +01:00
|
|
|
Gtk.Dialog dialogPersistentStorage,
|
2006-01-09 19:55:50 +01:00
|
|
|
dialogPreferences,
|
|
|
|
dialogAbout,
|
|
|
|
dialogLogin,
|
|
|
|
dialogLoginContinue,
|
|
|
|
dialogConfirmRefresh,
|
|
|
|
dialogSingleInstance,
|
|
|
|
dialogLoginReprompt,
|
|
|
|
dialogShortPassword,
|
|
|
|
dialogResetMP;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-01-06 12:51:36 +01:00
|
|
|
Gtk.Entry entryMasterPassword1,
|
2006-01-09 19:55:50 +01:00
|
|
|
entryMasterPassword2,
|
|
|
|
entryMasterPassword3,
|
|
|
|
entryMasterPassword4,
|
|
|
|
entryOldMP,
|
|
|
|
entryNewMP1,
|
|
|
|
entryNewMP2;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.CheckButton checkbuttonFirefox,
|
|
|
|
checkbuttonMozilla,
|
|
|
|
checkbuttonGnomeKeyring,
|
|
|
|
checkbuttonKdeWallet;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.Label label88,
|
|
|
|
labelLoginContinue1,
|
|
|
|
labelLoginContinue2;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-01-06 12:51:36 +01:00
|
|
|
Gtk.Button okbuttonPersistentStorage;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.MenuItem mmiNew,
|
|
|
|
mmiNewKey,
|
|
|
|
mmiView,
|
|
|
|
mmiLink,
|
|
|
|
mmiCopy,
|
|
|
|
mmiDelete,
|
|
|
|
mmiRefresh,
|
|
|
|
mmiLockSecrets,
|
|
|
|
mmiUnlockSecrets,
|
|
|
|
mmiDestroySecrets,
|
|
|
|
mmiEdit,
|
|
|
|
mmiOptions,
|
|
|
|
mmiDebug;
|
2006-01-06 12:51:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-01-09 19:55:50 +01:00
|
|
|
#endregion
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public static CasaTray mCasaTray = null;
|
|
|
|
public static bool m_bShowDebug = false;
|
|
|
|
public static bool m_bNotifyUser = true;
|
2005-10-12 17:27:21 +02:00
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// MAIN
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
/// The main entry point for the CASA application.
|
|
|
|
/// </summary>
|
|
|
|
[STAThread]
|
|
|
|
public static void Main(string[] args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.Main() - BEGIN");
|
|
|
|
|
|
|
|
Common.ReadPlatform();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Application.Init();
|
2005-10-12 17:27:21 +02:00
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
try
|
2005-11-11 16:38:05 +01:00
|
|
|
{
|
|
|
|
if (Common.IsArgSet(args, Common.ARG_DEBUG))
|
|
|
|
m_bShowDebug = true;
|
2005-10-21 01:57:26 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
// ping micasad
|
|
|
|
Ping ping = new Ping();
|
|
|
|
ping.clientmessage = "Hello micasad";
|
|
|
|
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_PING_MICASAD,ping);
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
new CasaMain(args);
|
|
|
|
Application.Run();
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
string message = "miCASA services are not available";
|
2006-01-06 12:51:36 +01:00
|
|
|
//Console.WriteLine("CasaMain: EXCEPTION= "+e.ToString());
|
2005-11-11 16:38:05 +01:00
|
|
|
if (m_bShowDebug)
|
|
|
|
message = e.ToString();
|
2005-10-21 01:57:26 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
MessageDialog md=new MessageDialog(null,Gtk.DialogFlags.Modal,
|
|
|
|
Gtk.MessageType.Error,
|
|
|
|
Gtk.ButtonsType.Close,
|
|
|
|
message);
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
md.Response+=new ResponseHandler(md_ResponseCloseWindow);
|
|
|
|
md.SetPosition(Gtk.WindowPosition.CenterAlways);
|
|
|
|
md.Show();
|
|
|
|
Application.Run();
|
|
|
|
}
|
2005-10-31 21:24:36 +01:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.Main() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-10-31 21:24:36 +01:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// CONSTRUCTOR
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
/// CasaMain constructor funtion.
|
|
|
|
/// </summary>
|
|
|
|
public CasaMain(string[] args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.CasaMain() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( false == Common.CheckForSingleInstance() )
|
|
|
|
{
|
|
|
|
MasterPasswordAuthentication();
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-03 21:25:34 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if (Common.IsTrayAvailable()) // && Common.IsArgSet(args, Common.ARG_SHOW_TRAY_ICON))
|
2005-10-31 21:24:36 +01:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if (mCasaTray == null)
|
2006-01-09 19:55:50 +01:00
|
|
|
mCasaTray = new CasaTray(this);
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
|
|
|
catch{}
|
2005-10-31 21:24:36 +01:00
|
|
|
}
|
2005-11-03 21:25:34 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-01-19 00:03:35 +01:00
|
|
|
//if (Common.IS_LINUX)
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogSingleInstance", null);
|
|
|
|
gxmlTemp.Autoconnect(this);
|
|
|
|
}
|
|
|
|
//else
|
|
|
|
//{
|
|
|
|
// Common.FocusExistingApp();
|
|
|
|
//}
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.CasaMain() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// INITIALIZE MAIN GUI
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Main GUI initializing routine. This routine builds the Main window of CASA.
|
|
|
|
/// </summary>
|
|
|
|
public void InitializeGUI()
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.InitializeGUI() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
gxml = new Glade.XML(Common.GladeFile, "windowMain", null);
|
|
|
|
gxml.Autoconnect(this);
|
2005-10-21 01:57:26 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if (!m_bShowDebug)
|
|
|
|
mmiDebug.Hide();
|
2005-10-21 01:57:26 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
windowMain.DeleteEvent += new DeleteEventHandler(OnWindowMainDeleted);
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// PLATFORM SPECIFIC GUI CHANGES
|
|
|
|
//ConfigureGUI();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// POLICY INIT
|
|
|
|
StorePolicyInterface.Init();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.InitializeGUI() - miCASA policy = " + Common.IS_MICASA);
|
|
|
|
Logger.DbgLog("GUI:CasaMain.InitializeGUI() - Firefox policy = " + Common.IS_FIREFOX);
|
|
|
|
Logger.DbgLog("GUI:CasaMain.InitializeGUI() - Mozilla policy = " + Common.IS_MOZILLA);
|
|
|
|
Logger.DbgLog("GUI:CasaMain.InitializeGUI() - KdeWallet policy = " + Common.IS_KDEWALLET);
|
|
|
|
Logger.DbgLog("GUI:CasaMain.InitializeGUI() - GNOME Keyring policy = " + Common.IS_GNOMEKEYRING);
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// STOREDATA INIT
|
|
|
|
StoreDataInterface.Init();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( Common.IS_MICASA )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.new MiCasa().");
|
|
|
|
objMiCasa = new MiCasa();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
(notebookStores.GetNthPage(Common.STORE_MICASA)).Visible = Common.IS_MICASA;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( Common.IS_FIREFOX )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.new Firefox().");
|
|
|
|
objFirefox = new Firefox();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
(notebookStores.GetNthPage(Common.STORE_FIREFOX)).Visible = Common.IS_FIREFOX;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( Common.IS_MOZILLA )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.new Mozilla().");
|
|
|
|
objMozilla = new Mozilla();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
(notebookStores.GetNthPage(Common.STORE_MOZILLA)).Visible = Common.IS_MOZILLA;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( Common.IS_KDEWALLET )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.new KdeWallet().");
|
|
|
|
objKdeWallet = new KdeWallet();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
(notebookStores.GetNthPage(Common.STORE_KDEWALLET)).Visible = Common.IS_KDEWALLET;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( Common.IS_GNOMEKEYRING )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.new GnomeKeyring().");
|
|
|
|
objGnomeKeyring = new GnomeKeyring();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
(notebookStores.GetNthPage(Common.STORE_GNOMEKEYRING)).Visible = Common.IS_GNOMEKEYRING;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
notebookStores.CurrentPage = Common.STORE_MICASA;
|
2005-10-12 17:27:21 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if (MiCASAStore.IsLocked())
|
|
|
|
LockGUI();
|
|
|
|
else
|
|
|
|
UnlockGUI();
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
windowMain.Show();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.InitializeGUI() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// MASTER PASSWORD AUTHENTICATION
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
/// This routine implements the MasterPassword authentication.
|
|
|
|
/// </summary>
|
|
|
|
public void MasterPasswordAuthentication()
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.Login() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( true == IsMasterPasswordSet() )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned true");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( false == miCASA.IsSecretPersistent(1,"") )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned false");
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogLogin.TransientFor = windowMain;
|
|
|
|
entryMasterPassword3.Text="";
|
|
|
|
label88.Hide();
|
|
|
|
entryMasterPassword4.Hide();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned true");
|
|
|
|
InitializeGUI();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned false");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
|
|
|
|
gxmlTemp.Autoconnect(this);
|
|
|
|
entryMasterPassword3.Text="";
|
|
|
|
entryMasterPassword4.Text="";
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.Login() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void okbuttonLogin_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.okbuttonLogin_clicked() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( true == entryMasterPassword4.Visible )
|
|
|
|
{
|
|
|
|
if( entryMasterPassword3.Text.Length < 8 )
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogShortPassword", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
2005-10-20 18:10:43 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
|
|
|
else if(entryMasterPassword3.Text != "" && (entryMasterPassword3.Text == entryMasterPassword4.Text) && entryMasterPassword3.Text.Length >= 8)
|
|
|
|
{
|
|
|
|
miCASA.SetMasterPassword(0, entryMasterPassword3.Text);
|
|
|
|
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_UNLOCK_STORE, entryMasterPassword3.Text);
|
|
|
|
dialogLogin.Destroy();
|
|
|
|
InitializeGUI();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
entryMasterPassword3.Text="";
|
|
|
|
entryMasterPassword4.Text="";
|
|
|
|
entryMasterPassword3.HasFocus=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( 0 == miCASA.SetMasterPassword(0, entryMasterPassword3.Text) )
|
|
|
|
{
|
|
|
|
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_UNLOCK_STORE, entryMasterPassword3.Text);
|
|
|
|
dialogLogin.Destroy();
|
|
|
|
InitializeGUI();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.okbuttonLogin_clicked() - MasterPassword verification failed.");
|
|
|
|
//dialogLogin.Destroy();
|
|
|
|
//LoginContinue("<b>Master Password verfication failed</b>", "The store will not be persistent");
|
|
|
|
loginPromptCount--;
|
|
|
|
dialogLogin.Hide();
|
|
|
|
|
|
|
|
if( loginPromptCount > 0 )
|
|
|
|
{
|
|
|
|
dialogLogin.Show();
|
|
|
|
entryMasterPassword3.Text="";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLoginReprompt", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:CasaMain.okbuttonLogin_clicked() - END");
|
2005-10-20 18:10:43 +02:00
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
|
|
|
|
public void on_helpbuttonAuthentication_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("CASAMasterPasswordAuthentication.htm");
|
2005-10-20 18:10:43 +02:00
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
|
|
|
|
internal void on_buttonRetryRepropmt_clicked(object obj, EventArgs args)
|
2005-10-20 18:10:43 +02:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
dialogLoginReprompt.Destroy();
|
|
|
|
dialogLogin.Show();
|
2005-10-20 18:10:43 +02:00
|
|
|
entryMasterPassword3.Text="";
|
2005-11-11 16:38:05 +01:00
|
|
|
loginPromptCount = 3;
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
|
|
|
|
internal void on_buttonRetryShortPassword_clicked(object obj, EventArgs args)
|
2005-10-11 21:51:00 +02:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
dialogShortPassword.Destroy();
|
|
|
|
entryMasterPassword3.Text = "";
|
|
|
|
entryMasterPassword4.Text = "";
|
|
|
|
entryMasterPassword3.HasFocus = true;
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
2005-10-20 18:10:43 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
internal void on_buttonCloseReprompt_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogLoginReprompt.Destroy();
|
|
|
|
dialogLogin.Destroy();
|
|
|
|
HandleQuit();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void closebuttonLogin_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogLogin.Destroy();
|
|
|
|
HandleQuit();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void OnDialogLoginDeleted(object obj, DeleteEventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.OnDialogLoginDeleted() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
HandleQuit();
|
|
|
|
args.RetVal = true;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.OnDialogLoginDeleted() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_entryMasterPassword3_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
if( true == entryMasterPassword4.Visible )
|
|
|
|
entryMasterPassword4.HasFocus = true;
|
|
|
|
else if( "" != entryMasterPassword3.Text )
|
|
|
|
okbuttonLogin_clicked(obj, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_entryMasterPassword4_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
okbuttonLogin_clicked(obj, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsMasterPasswordSet()
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.IsMasterPasswordSet() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
string MICASA_PASSCODE_BY_MASTER_PASSWD_FILE = "/.miCASAPCByMPasswd";
|
|
|
|
string fileName = GetUserHomeDir() + MICASA_PASSCODE_BY_MASTER_PASSWD_FILE;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.IsMasterPasswordSet() - END");
|
|
|
|
return (File.Exists(fileName));
|
|
|
|
}
|
|
|
|
|
|
|
|
private string GetUserHomeDir()
|
|
|
|
{
|
|
|
|
if (Common.IS_LINUX)
|
|
|
|
return Environment.GetEnvironmentVariable("HOME");
|
|
|
|
else
|
|
|
|
return Environment.GetEnvironmentVariable("USERPROFILE");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// LOGIN WARNING DIALOG
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Error dialog prompt for MasterPassword authentication
|
|
|
|
/// </summary>
|
|
|
|
public void LoginContinue(string LabelMain, string LabelTips)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.LoginContinue() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLoginContinue", null);
|
|
|
|
gxmlTemp.Autoconnect(this);
|
|
|
|
dialogLoginContinue.TransientFor = windowMain;
|
|
|
|
labelLoginContinue1.LabelProp = LabelMain;
|
|
|
|
labelLoginContinue2.LabelProp = LabelTips;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.LoginContinue() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void on_buttonLoginContinue_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogLoginContinue.Destroy();
|
|
|
|
InitializeGUI();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// ON MAIN MENU ACTIVATED HANDLERS
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
internal void on_notebookStores_switch_page(object obj, SwitchPageArgs args)
|
|
|
|
{
|
|
|
|
switch(args.PageNum)
|
|
|
|
{
|
|
|
|
case Common.STORE_MICASA:
|
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_FIREFOX:
|
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_MOZILLA:
|
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_KDEWALLET:
|
|
|
|
if( false == objKdeWallet.IS_STORE_AGGREGATED )
|
2005-10-11 21:51:00 +02:00
|
|
|
{
|
|
|
|
objKdeWallet.AggregateStore();
|
|
|
|
objKdeWallet.IS_STORE_AGGREGATED = true;
|
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_GNOMEKEYRING:
|
|
|
|
if( false == objGnomeKeyring.IS_STORE_AGGREGATED )
|
2005-10-11 21:51:00 +02:00
|
|
|
{
|
|
|
|
objGnomeKeyring.AggregateStore();
|
|
|
|
objGnomeKeyring.IS_STORE_AGGREGATED = true;
|
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
internal void FileMenuActivated(object obj, EventArgs args)
|
2005-10-11 21:51:00 +02:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.FileMenuActivated() - BEGIN");
|
|
|
|
|
|
|
|
if (MiCASAStore.IsLocked())
|
|
|
|
{
|
|
|
|
LockGUI();
|
|
|
|
Logger.DbgLog("GUI:CasaMain.FileMenuActivated() Store is locked - END");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
UnlockGUI();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
switch(notebookStores.CurrentPage)
|
|
|
|
{
|
|
|
|
case Common.STORE_MICASA:
|
|
|
|
if( 0 != objMiCasa.tvSecretIDMiCasa.Selection.CountSelectedRows() )
|
|
|
|
{
|
|
|
|
mmiNew.Sensitive = mmiNewKey.Sensitive = true;
|
|
|
|
}
|
|
|
|
else
|
2006-01-06 15:05:07 +01:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
mmiNewKey.Sensitive = false;
|
|
|
|
}
|
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_FIREFOX:
|
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_MOZILLA:
|
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_KDEWALLET:
|
|
|
|
if( 0 != objKdeWallet.tvSecretIDKdeWallet.Selection.CountSelectedRows() )
|
2005-10-11 21:51:00 +02:00
|
|
|
{
|
2006-01-06 12:51:36 +01:00
|
|
|
mmiNew.Sensitive = mmiNewKey.Sensitive = true;
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-01-06 12:51:36 +01:00
|
|
|
mmiNewKey.Sensitive = false;
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_GNOMEKEYRING:
|
|
|
|
if( 0 != objGnomeKeyring.tvSecretIDGnomeKeyring.Selection.CountSelectedRows() )
|
|
|
|
{
|
2006-01-10 08:39:48 +01:00
|
|
|
mmiNew.Sensitive = mmiNewKey.Sensitive = true;
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-01-06 12:51:36 +01:00
|
|
|
mmiNewKey.Sensitive = false;
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.FileMenuActivated() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
internal void EditMenuActivated(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.EditMenuActivated() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
switch(notebookStores.CurrentPage)
|
|
|
|
{
|
|
|
|
case Common.STORE_MICASA:
|
2005-10-11 21:51:00 +02:00
|
|
|
if( 0 != objMiCasa.tvSecretIDMiCasa.Selection.CountSelectedRows() )
|
|
|
|
{
|
2006-01-09 22:48:12 +01:00
|
|
|
mmiView.Sensitive = mmiLink.Sensitive = mmiDelete.Sensitive = true;
|
2005-10-11 21:51:00 +02:00
|
|
|
mmiCopy.Sensitive = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mmiView.Sensitive = mmiLink.Sensitive = mmiCopy.Sensitive = mmiDelete.Sensitive = false;
|
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_FIREFOX:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_MOZILLA:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_KDEWALLET:
|
2005-10-11 21:51:00 +02:00
|
|
|
if( 0 != objKdeWallet.tvSecretIDKdeWallet.Selection.CountSelectedRows() )
|
|
|
|
{
|
2006-01-06 12:51:36 +01:00
|
|
|
mmiView.Sensitive = mmiDelete.Sensitive = true;
|
|
|
|
mmiLink.Sensitive = mmiCopy.Sensitive = false;
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mmiView.Sensitive = mmiLink.Sensitive = mmiCopy.Sensitive = mmiDelete.Sensitive = false;
|
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
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;
|
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.EditMenuActivated() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///#######################################################################
|
|
|
|
/// REFRESH ALL STORES
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void RefreshAllStores(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmRefresh", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogConfirmRefresh.TransientFor = windowMain;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_buttonRefreshYes_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.on_buttonRefreshYes_clicked() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-01-09 19:55:50 +01:00
|
|
|
RefreshStores();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
dialogConfirmRefresh.Destroy();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.on_buttonRefreshYes_clicked() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void on_buttonRefreshNo_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogConfirmRefresh.Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_helpbuttonRefresh_clicked(object obj, EventArgs Args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("RefreshStore.htm");
|
|
|
|
}
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// QUIT APPLICATION
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void QuitApplication(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.QuitApplication() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-01-09 19:55:50 +01:00
|
|
|
//windowMain.Destroy();
|
2005-11-11 16:38:05 +01:00
|
|
|
HandleQuit();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.QuitApplication() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// ADD NEW SECRET
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void OnNewSecretActivated(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.NewSecret() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
switch(notebookStores.CurrentPage)
|
|
|
|
{
|
|
|
|
case Common.STORE_MICASA:
|
2005-10-11 21:51:00 +02:00
|
|
|
objMiCasa.OnNewSecretActivated(obj, args);
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_FIREFOX:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_MOZILLA:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_KDEWALLET:
|
2006-01-06 12:51:36 +01:00
|
|
|
objKdeWallet.OnNewSecretActivated(obj, args);
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_GNOMEKEYRING:
|
2006-01-06 12:51:36 +01:00
|
|
|
objGnomeKeyring.OnNewSecretActivated(obj, args);
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.NewSecret() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// ADD NEW KEY
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void OnNewKeyActivated(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.NewKeyValue() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
switch(notebookStores.CurrentPage)
|
|
|
|
{
|
|
|
|
case Common.STORE_MICASA:
|
2005-10-11 21:51:00 +02:00
|
|
|
objMiCasa.OnNewKeyActivated(obj, args);
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_FIREFOX:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_MOZILLA:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_KDEWALLET:
|
2006-01-06 12:51:36 +01:00
|
|
|
objKdeWallet.OnNewKeyActivated(obj, args);
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_GNOMEKEYRING:
|
2006-01-06 12:51:36 +01:00
|
|
|
objGnomeKeyring.OnNewKeyActivated(obj, args);
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.NewKeyValue() - END");
|
|
|
|
}
|
2005-10-12 17:27:21 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// UI handling
|
2005-10-12 17:27:21 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void OnLockMiCASASecrets(object sender, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.OnLockMiCASASecrets() - START");
|
|
|
|
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_LOCK_STORE);
|
|
|
|
LockGUI();
|
|
|
|
if (mCasaTray != null)
|
|
|
|
mCasaTray.UpdateTrayIcon(true);
|
|
|
|
Logger.DbgLog("GUI:CasaMain.OnLockMiCASASecrets() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void OnUnLockMiCASASecrets(object sender, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.OnUnLockMiCASASecrets() - START");
|
|
|
|
CommonGUI cg = new CommonGUI();
|
|
|
|
cg.HandleUnlock(this, mCasaTray);
|
|
|
|
Logger.DbgLog("GUI:CasaMain.OnUnLockMiCASASecrets() - END");
|
|
|
|
}
|
2005-10-12 17:27:21 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void OnDestroyMiCASASecrets(object sender, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.OnDestroyMiCASASecrets() - START");
|
|
|
|
CommonGUI temp = new CommonGUI();
|
|
|
|
temp.menuDestroyMiCasa_Activated(this, mCasaTray);
|
|
|
|
Logger.DbgLog("GUI:CasaMain.OnDestroyMiCASASecrets() - END");
|
|
|
|
}
|
2005-10-12 17:27:21 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
internal void LockGUI()
|
|
|
|
{
|
|
|
|
mmiLockSecrets.Sensitive = false;
|
|
|
|
mmiUnlockSecrets.Sensitive = true;
|
|
|
|
mmiDestroySecrets.Sensitive = false;
|
|
|
|
notebookStores.Sensitive = false;
|
2006-01-09 19:55:50 +01:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
mmiNew.Sensitive = false;
|
|
|
|
mmiRefresh.Sensitive = false;
|
|
|
|
mmiDebug.Sensitive = false;
|
|
|
|
mmiOptions.Sensitive = false;
|
|
|
|
mmiEdit.Sensitive = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
internal void UnlockGUI()
|
|
|
|
{
|
|
|
|
mmiLockSecrets.Sensitive = true;
|
|
|
|
mmiUnlockSecrets.Sensitive = false;
|
|
|
|
mmiDestroySecrets.Sensitive = true;
|
2006-01-09 19:55:50 +01:00
|
|
|
notebookStores.Sensitive = true;
|
2006-01-13 23:29:15 +01:00
|
|
|
|
|
|
|
mmiNew.Sensitive = true;
|
2005-11-11 16:38:05 +01:00
|
|
|
mmiRefresh.Sensitive = true;
|
|
|
|
mmiDebug.Sensitive = true;
|
|
|
|
mmiOptions.Sensitive = true;
|
|
|
|
mmiEdit.Sensitive = true;
|
2006-01-09 19:55:50 +01:00
|
|
|
|
|
|
|
//refresh secrets
|
|
|
|
RefreshStores();
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// VIEW KEY-VALUES
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
/// VIEW Key-Values
|
|
|
|
/// </summary>
|
|
|
|
public void ViewKeyValue(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.ViewKeyValue() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
switch(notebookStores.CurrentPage)
|
|
|
|
{
|
|
|
|
case Common.STORE_MICASA:
|
2005-10-11 21:51:00 +02:00
|
|
|
objMiCasa.ViewKeyValues();
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_FIREFOX:
|
2006-01-06 12:51:36 +01:00
|
|
|
//objFirefox.ViewKeyValues();
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_MOZILLA:
|
2006-01-06 12:51:36 +01:00
|
|
|
//objMozilla.ViewKeyValues();
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_KDEWALLET:
|
2005-10-11 21:51:00 +02:00
|
|
|
objKdeWallet.ViewKeyValues();
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_GNOMEKEYRING:
|
2005-10-11 21:51:00 +02:00
|
|
|
objGnomeKeyring.ViewKeyValues();
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.ViewKeyValue() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// LINK KEY-VALUE
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
/// LINK Key-Values
|
|
|
|
/// </summary>
|
|
|
|
public void LinkKeyValue(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.LinkKeyValue() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
switch(notebookStores.CurrentPage)
|
|
|
|
{
|
|
|
|
case Common.STORE_MICASA:
|
2005-10-11 21:51:00 +02:00
|
|
|
objMiCasa.ViewKeyValues();
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_FIREFOX:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_MOZILLA:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_KDEWALLET:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_GNOMEKEYRING:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.LinkKeyValue() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// COPY KEY-VALUE
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
/// COPY Key-Values
|
|
|
|
/// </summary>
|
|
|
|
public void CopyKeyValue(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.CopyKeyValue() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
//Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogCopyKeyValue", null);
|
|
|
|
//gxmlTemp.Autoconnect (this);
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.CopyKeyValue() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// DELETE SECRET
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
/// DELETE Secret
|
|
|
|
/// </summary>
|
|
|
|
public void DeleteSecret(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.DeleteSecret() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
switch(notebookStores.CurrentPage)
|
|
|
|
{
|
|
|
|
case Common.STORE_MICASA:
|
2005-10-11 21:51:00 +02:00
|
|
|
objMiCasa.OnDeleteActivated(obj, args);
|
2005-11-11 16:38:05 +01:00
|
|
|
break;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_FIREFOX:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_MOZILLA:
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_KDEWALLET:
|
2006-01-06 12:51:36 +01:00
|
|
|
objKdeWallet.OnDeleteActivated(obj, args);
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
case Common.STORE_GNOMEKEYRING:
|
2006-01-06 12:51:36 +01:00
|
|
|
objGnomeKeyring.OnDeleteActivated(obj, args);
|
2005-10-11 21:51:00 +02:00
|
|
|
break;
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.DeleteSecret() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-03 21:25:34 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// Reset Master Password CALLED VIA MAIN MENU
|
2005-11-03 21:25:34 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void ResetMasterPassword(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.ResetMasterPassword() - BEGIN");
|
2005-11-03 21:25:34 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogResetMP", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogResetMP.TransientFor = windowMain;
|
|
|
|
entryOldMP.Text="";
|
|
|
|
entryNewMP1.Text="";
|
|
|
|
entryNewMP2.Text="";
|
|
|
|
Logger.DbgLog("GUI:CasaMain.ResetMasterPassword() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
public void okbuttonResetMasterPWD_clicked(object abj, EventArgs args)
|
2005-11-03 21:25:34 +01:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.okbuttonResetMasterPWD_clicked() - BEGIN");
|
|
|
|
|
|
|
|
if (entryOldMP.Text == "")
|
|
|
|
{
|
|
|
|
DisplayError("You must enter you current Master Password");
|
|
|
|
return;
|
|
|
|
}
|
2005-11-03 21:25:34 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
// check Current MP
|
|
|
|
if (entryOldMP.Text != "")
|
2005-11-03 21:25:34 +01:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
int rcode = miCASA.SetMasterPassword(1, entryOldMP.Text);
|
|
|
|
if (rcode != 0)
|
|
|
|
{
|
|
|
|
DisplayError("Current Master Password is not correct");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entryNewMP1.Text.Length < 8)
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogShortPassword", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
2005-11-03 21:25:34 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if (entryNewMP1.Text != entryNewMP2.Text)
|
|
|
|
{
|
|
|
|
DisplayError("New Master Passwords do not match");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (miCASA.ChangeMasterPassword(entryOldMP.Text, entryNewMP1.Text))
|
|
|
|
dialogResetMP.Destroy();
|
|
|
|
else
|
|
|
|
DisplayError("Change failed");
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:CasaMain.okbuttonResetMasterPWD_clicked() - END");
|
2005-11-03 21:25:34 +01:00
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
|
|
|
|
public void cancelbuttonResetMasterPWD_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogResetMP.Destroy();
|
|
|
|
}
|
2005-11-03 21:25:34 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void on_helpbuttonResetMP_clicked(object obj, EventArgs args)
|
2005-11-03 21:25:34 +01:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
Common.ShowHelpUrl("CASAMasterPasswordAuthentication.htm");
|
2005-11-03 21:25:34 +01:00
|
|
|
}
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
private void DisplayError(String sErrorMessage)
|
|
|
|
{
|
|
|
|
MessageDialog md = new MessageDialog(windowMain,
|
|
|
|
Gtk.DialogFlags.Modal,
|
|
|
|
Gtk.MessageType.Warning,
|
|
|
|
Gtk.ButtonsType.Close,
|
|
|
|
sErrorMessage);
|
2005-11-03 21:25:34 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
md.Response +=new ResponseHandler(md_Response);
|
|
|
|
//md_ResponseCloseWindow
|
|
|
|
md.Show();
|
2005-11-03 21:25:34 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-11-03 21:25:34 +01:00
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// PERSISTENT STORAGE CALLED VIA MAIN MENU
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void PersistentStorage(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.PersistentStorage() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogPersistentStorage", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogPersistentStorage.TransientFor = windowMain;
|
|
|
|
entryMasterPassword1.Text="";
|
|
|
|
entryMasterPassword2.Text="";
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if(IsMasterPasswordSet() == true)
|
|
|
|
{
|
|
|
|
entryMasterPassword1.Sensitive=false;
|
|
|
|
entryMasterPassword2.Sensitive=false;
|
|
|
|
okbuttonPersistentStorage.Sensitive=false;
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.PersistentStorage() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void okbuttonPersistentStorage_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.okbuttonPersistentStorage_clicked() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if((entryMasterPassword1.Text != "" && entryMasterPassword2.Text != "") && (entryMasterPassword1.Text == entryMasterPassword2.Text))
|
|
|
|
{
|
|
|
|
//StorePolicyInterface.SetMasterPassword(entryMasterPassword1.Text);
|
|
|
|
miCASA.SetMasterPassword(0, entryMasterPassword1.Text);
|
|
|
|
dialogPersistentStorage.Destroy();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.okbuttonPersistentStorage_clicked() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void cancelbuttonPersistentStorage_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogPersistentStorage.Destroy();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// PREFERENCES
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void Preferences(object obj, EventArgs args)
|
2005-10-17 21:39:01 +02:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.Preferences() - BEGIN");
|
|
|
|
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogPreferences", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogPreferences.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
|
|
|
dialogPreferences.TransientFor = windowMain;
|
|
|
|
checkbuttonFirefox.Active=Common.IS_FIREFOX;
|
|
|
|
checkbuttonMozilla.Active=Common.IS_MOZILLA;
|
|
|
|
checkbuttonGnomeKeyring.Active=Common.IS_GNOMEKEYRING;
|
|
|
|
checkbuttonKdeWallet.Active=Common.IS_KDEWALLET;
|
|
|
|
|
|
|
|
if (Common.IS_WINDOWS)
|
|
|
|
{
|
|
|
|
checkbuttonGnomeKeyring.Sensitive = false;
|
|
|
|
checkbuttonKdeWallet.Sensitive = false;
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.Preferences() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void okbuttonPreferences_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.okbuttonPreferences_clicked() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
string[] storeID = new string[]{""};
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
notebookStores.GetNthPage(Common.STORE_FIREFOX).Visible = Common.IS_FIREFOX = checkbuttonFirefox.Active;
|
|
|
|
notebookStores.GetNthPage(Common.STORE_MOZILLA).Visible = Common.IS_MOZILLA = checkbuttonMozilla.Active;
|
|
|
|
notebookStores.GetNthPage(Common.STORE_GNOMEKEYRING).Visible = Common.IS_GNOMEKEYRING = checkbuttonGnomeKeyring.Active;
|
|
|
|
notebookStores.GetNthPage(Common.STORE_KDEWALLET).Visible = Common.IS_KDEWALLET = checkbuttonKdeWallet.Active;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_FIREFOX, Common.IS_FIREFOX, storeID, 1);
|
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_MOZILLA, Common.IS_MOZILLA, storeID, 1);
|
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_KDEWALLET, Common.IS_KDEWALLET, storeID, 1);
|
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_GNOMEKEYRING, Common.IS_GNOMEKEYRING, storeID, 1);
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
StorePolicyInterface.SaveAggregationPolicy();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if(Common.IS_FIREFOX)
|
|
|
|
{
|
|
|
|
if( null == objFirefox )
|
|
|
|
objFirefox = new Firefox();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
objFirefox.AggregateStore();
|
|
|
|
}
|
|
|
|
if(Common.IS_MOZILLA)
|
|
|
|
{
|
|
|
|
if( null == objMozilla )
|
|
|
|
objMozilla = new Mozilla();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
objMozilla.AggregateStore();
|
|
|
|
}
|
|
|
|
if(Common.IS_KDEWALLET)
|
|
|
|
{
|
|
|
|
if( null == objKdeWallet )
|
|
|
|
objKdeWallet = new KdeWallet();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
objKdeWallet.AggregateStore();
|
|
|
|
}
|
|
|
|
if(Common.IS_GNOMEKEYRING)
|
|
|
|
{
|
|
|
|
if( null == objGnomeKeyring )
|
|
|
|
objGnomeKeyring = new GnomeKeyring();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
objGnomeKeyring.AggregateStore();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
dialogPreferences.Destroy();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.okbuttonPreferences_clicked() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void cancelbuttonPreferences_clicked(object abj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogPreferences.Destroy();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-10-13 21:56:58 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void on_helpbuttonPreferences_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("Preferences.htm");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
private bool IsTraySetForStartup()
|
|
|
|
{
|
2005-10-13 21:56:58 +02:00
|
|
|
#if W32
|
2005-11-11 16:38:05 +01:00
|
|
|
string sStartup = CommonGUI.ReadRegKey(
|
|
|
|
Registry.CurrentUser,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
|
|
|
|
"CASA Tray");
|
2005-10-13 21:56:58 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if (sStartup == null || sStartup.Length < 1)
|
|
|
|
return false;
|
|
|
|
else
|
|
|
|
return true;
|
2005-10-13 21:56:58 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if LINUX
|
|
|
|
// TODO check startup script for the user.
|
2005-10-21 01:57:26 +02:00
|
|
|
return true;
|
2005-10-13 21:56:58 +02:00
|
|
|
#endif
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
|
|
|
*/
|
2005-10-13 21:56:58 +02:00
|
|
|
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
private static void md_ResponseCloseWindow(object o, ResponseArgs args)
|
|
|
|
{
|
|
|
|
MessageDialog md = (MessageDialog)o;
|
|
|
|
if (md != null)
|
|
|
|
{
|
|
|
|
md.Destroy();
|
|
|
|
Application.Quit();
|
|
|
|
}
|
2005-10-31 21:24:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-06 12:51:36 +01:00
|
|
|
internal void PromptUserForStartup()
|
2005-11-11 16:38:05 +01:00
|
|
|
{
|
|
|
|
// prompt user
|
|
|
|
MessageDialog md=new MessageDialog(null,Gtk.DialogFlags.Modal,
|
|
|
|
Gtk.MessageType.Question,
|
|
|
|
Gtk.ButtonsType.YesNo,
|
|
|
|
"Show the Tray Icon at startup?");
|
|
|
|
|
|
|
|
md.SetPosition(Gtk.WindowPosition.Center);
|
|
|
|
md.Response +=new ResponseHandler(md_Response);
|
|
|
|
md.Modal = true;
|
|
|
|
md.SetIconFromFile(Common.CASAICONS);
|
|
|
|
md.Show();
|
|
|
|
}
|
2005-10-13 21:56:58 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
private void md_Response(object o, ResponseArgs args)
|
2005-10-13 21:56:58 +02:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
if (args.ResponseId.Equals(Gtk.ResponseType.Yes))
|
|
|
|
{
|
2005-10-13 21:56:58 +02:00
|
|
|
|
|
|
|
#if W32
|
2005-11-11 16:38:05 +01:00
|
|
|
// get our program path
|
|
|
|
String sPath = "\"" +Environment.GetEnvironmentVariable("ProgramFiles")+
|
|
|
|
"\\Novell\\CASA\\bin\\CASAManager.exe\" -tray";
|
2005-10-13 21:56:58 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
CommonGUI.WriteRegKey(Registry.CurrentUser,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
|
|
|
|
"CASA Tray",
|
|
|
|
sPath);
|
2005-10-13 21:56:58 +02:00
|
|
|
#endif
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
// TODO: Set startup script for the user
|
|
|
|
}
|
2005-10-13 21:56:58 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
MessageDialog md = (MessageDialog)o;
|
|
|
|
if (md != null)
|
|
|
|
{
|
|
|
|
md.Destroy();
|
|
|
|
}
|
2005-10-20 14:58:19 +02:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// DEBUG
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void on_create_sample_secrets1_activate(object obj, EventArgs arg)
|
|
|
|
{
|
|
|
|
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_CREATE_TEST_SECRETS, null, null, null, null);
|
|
|
|
//StoreDataInterface.RefreshAllStores();
|
|
|
|
objMiCasa.AggregateStore();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void on_remove_test_secrets1_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_REMOVE_TEST_SECRETS, null, null, null, null);
|
|
|
|
//StoreDataInterface.RefreshAllStores();
|
|
|
|
objMiCasa.AggregateStore();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// ABOUT
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
public void About(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.About() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogAbout", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogAbout.TransientFor = windowMain;
|
|
|
|
Logger.DbgLog("GUI:CasaMain.About() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void closebuttonAbout_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogAbout.Destroy();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
|
|
|
|
public void on_buttonNovell_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowUrl("http://www.novell.com");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// SINGLE INSTANCE DIALOG CLOSE HANDLER
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// dislogSingleInstance delete window handler
|
|
|
|
/// </summary>
|
|
|
|
public void on_dialogSingleInstance_delete_event(object obj, DeleteEventArgs args)
|
|
|
|
{
|
|
|
|
dialogSingleInstance.Destroy();
|
|
|
|
HandleQuit();
|
|
|
|
//Application.Quit();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void on_buttonSIClose_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogSingleInstance.Destroy();
|
|
|
|
HandleQuit();
|
|
|
|
//Application.Quit();
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// WINDOW MAIN CLOSE HANDLER
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
|
|
|
/// MainWindow delete window handler
|
|
|
|
/// </summary>
|
|
|
|
public void OnWindowMainDeleted(object obj, DeleteEventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.OnWindowMainDeleted() - BEGIN");
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-01-09 19:55:50 +01:00
|
|
|
//windowMain.Destroy();
|
2005-11-11 16:38:05 +01:00
|
|
|
HandleQuit();
|
2006-01-09 19:55:50 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
//Gtk.Application.Quit ();
|
|
|
|
args.RetVal = true;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.OnWindowMainDeleted() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
private void HandleQuit()
|
2005-10-12 17:27:21 +02:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
if (mCasaTray != null)
|
2005-10-31 21:24:36 +01:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
if (m_bNotifyUser)
|
|
|
|
{
|
|
|
|
// prompt user
|
|
|
|
MessageDialog md=new MessageDialog(null,Gtk.DialogFlags.Modal,
|
|
|
|
Gtk.MessageType.Info,
|
|
|
|
Gtk.ButtonsType.Close,
|
|
|
|
"CASA Manager will continue to run in the task bar");
|
|
|
|
|
|
|
|
md.SetPosition(Gtk.WindowPosition.Center);
|
|
|
|
md.Response +=new ResponseHandler(md_Response);
|
|
|
|
md.Modal = true;
|
|
|
|
md.SetIconFromFile(Common.CASAICONS);
|
|
|
|
md.Show();
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
m_bNotifyUser = false;
|
|
|
|
}
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
mCasaTray.CasaManagerQuit();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Application.Quit();
|
2005-10-12 17:27:21 +02:00
|
|
|
}
|
|
|
|
|
2005-10-31 21:24:36 +01:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// WINDOW MAIN FOCUS
|
|
|
|
///
|
|
|
|
internal void Focus()
|
|
|
|
{
|
2006-01-19 00:03:35 +01:00
|
|
|
if (windowMain != null)
|
|
|
|
windowMain.Present();
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2006-01-09 19:55:50 +01:00
|
|
|
internal void Hide()
|
|
|
|
{
|
2006-01-19 00:03:35 +01:00
|
|
|
if (windowMain != null)
|
|
|
|
windowMain.Visible = false;
|
2006-01-09 19:55:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
internal void Show()
|
|
|
|
{
|
2006-01-19 00:03:35 +01:00
|
|
|
if (windowMain == null)
|
|
|
|
MasterPasswordAuthentication();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RefreshStores();
|
|
|
|
windowMain.Visible = true;
|
|
|
|
}
|
2006-01-09 19:55:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
internal void Dispose()
|
2006-01-19 00:03:35 +01:00
|
|
|
{
|
|
|
|
if (windowMain != null)
|
|
|
|
windowMain.Destroy();
|
2006-01-09 19:55:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
internal void RefreshStores()
|
|
|
|
{
|
|
|
|
if( Common.IS_MICASA )
|
|
|
|
objMiCasa.AggregateStore();
|
|
|
|
|
|
|
|
if( Common.IS_FIREFOX )
|
|
|
|
objFirefox.AggregateStore();
|
|
|
|
|
|
|
|
if( Common.IS_MOZILLA )
|
|
|
|
objMozilla.AggregateStore();
|
|
|
|
|
|
|
|
if( Common.IS_KDEWALLET )
|
|
|
|
objKdeWallet.AggregateStore();
|
|
|
|
|
|
|
|
if( Common.IS_GNOMEKEYRING )
|
|
|
|
objGnomeKeyring.AggregateStore();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
///#######################################################################
|
|
|
|
/// LOGGING WINDOW operations
|
|
|
|
///
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void on_view_log_file1_activate(object obj, EventArgs args)
|
|
|
|
{
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
public void on_enable_logging1_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Gtk.CheckMenuItem miLog = (Gtk.CheckMenuItem)obj;
|
|
|
|
if (miLog.Active)
|
|
|
|
OpenLogWindow();
|
|
|
|
else
|
|
|
|
CloseLogWindow();
|
|
|
|
}
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
internal void OpenLogWindow()
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLog", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Gtk.TreeViewColumn col1 = new Gtk.TreeViewColumn("", new Gtk.CellRendererText(), "text", 0);
|
|
|
|
tvLog.AppendColumn(col1);
|
|
|
|
Logger.ActivateLogWindow(tvLog);
|
|
|
|
}
|
|
|
|
|
|
|
|
internal void CloseLogWindow()
|
|
|
|
{
|
|
|
|
Logger.StopLogWindow();
|
|
|
|
dialogLogin.Dispose();
|
|
|
|
dialogLogin.Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///###########################################################################
|
|
|
|
/// Help Handlers
|
|
|
|
///###########################################################################
|
|
|
|
public void OnMenuHelpActivate(object sender, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("Contents.htm");
|
|
|
|
}
|
|
|
|
|
2005-10-31 21:24:36 +01:00
|
|
|
}
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
|
|
|
///###########################################################################
|
|
|
|
/// END OF FILE
|
|
|
|
///###########################################################################
|