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
|
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2006-03-07 14:54:44 +01:00
|
|
|
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
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
public static Glade.XML gxmlMain = null;
|
|
|
|
public static CasaTray mCasaTray = null;
|
|
|
|
|
|
|
|
public static bool m_bShowDebug = false;
|
|
|
|
public static bool m_bNotifyUser = true;
|
|
|
|
public static bool m_bGuiLocked = false;
|
|
|
|
|
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-03-07 14:54:44 +01:00
|
|
|
Gtk.Window windowMain;
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-03-07 14:54:44 +01:00
|
|
|
Gtk.TreeView tvLog;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-03-07 14:54:44 +01:00
|
|
|
Gtk.Notebook notebookStores;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-03-07 14:54:44 +01:00
|
|
|
Gtk.Dialog dialogPersistentStorage,
|
|
|
|
dialogPreferences,
|
|
|
|
dialogAbout,
|
|
|
|
dialogLogin,
|
|
|
|
dialogLoginContinue,
|
|
|
|
dialogDesktopPassword,
|
|
|
|
dialogConfirmRefresh,
|
|
|
|
dialogSingleInstance,
|
|
|
|
dialogLoginReprompt,
|
|
|
|
dialogShortPassword,
|
|
|
|
dialogResetMP,
|
2006-03-08 11:58:28 +01:00
|
|
|
dialogStillRunning,
|
|
|
|
dialogFirefoxMP;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-03-07 14:54:44 +01:00
|
|
|
Gtk.Entry entryMasterPassword1,
|
|
|
|
entryMasterPassword2,
|
|
|
|
entryMasterPassword3,
|
|
|
|
entryMasterPassword4,
|
|
|
|
entryDesktopPassword1,
|
|
|
|
entryDesktopPassword2,
|
|
|
|
entryOldMP,
|
|
|
|
entryNewMP1,
|
2006-03-08 11:58:28 +01:00
|
|
|
entryNewMP2,
|
|
|
|
entryFirefoxMP;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-03-31 21:52:25 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-03-07 14:54:44 +01:00
|
|
|
Gtk.CheckButton checkbuttonFirefox,
|
|
|
|
checkbuttonMozilla,
|
|
|
|
checkbuttonGnomeKeyring,
|
|
|
|
checkbuttonKdeWallet,
|
|
|
|
checkbuttonCloseMessage;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-03-07 14:54:44 +01:00
|
|
|
Gtk.Label label88,
|
|
|
|
labelLoginContinue1,
|
|
|
|
labelLoginContinue2,
|
|
|
|
labelDesktopPasswordMessage;
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-03-07 14:54:44 +01:00
|
|
|
Gtk.Button okbuttonPersistentStorage;
|
2006-01-06 12:51:36 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
[Glade.Widget]
|
2006-03-07 14:54:44 +01:00
|
|
|
Gtk.MenuItem mmiNew,
|
|
|
|
mmiNewKey,
|
|
|
|
mmiView,
|
|
|
|
mmiLink,
|
|
|
|
mmiCopy,
|
|
|
|
mmiDelete,
|
|
|
|
mmiRefresh,
|
|
|
|
mmiLockSecrets,
|
|
|
|
mmiUnlockSecrets,
|
|
|
|
mmiDestroySecrets,
|
|
|
|
mmiEdit,
|
|
|
|
mmiOptions,
|
|
|
|
mmiDebug,
|
|
|
|
mmiApplicationSSO,
|
|
|
|
mmiKonquerer,
|
|
|
|
mmiKopete,
|
|
|
|
mmiNetworkManager,
|
|
|
|
mmiGaim;
|
2006-03-31 21:52:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Glade.Widget]
|
|
|
|
Gtk.DrawingArea drawingarea1;
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public static void Main(string[] args)
|
|
|
|
///
|
|
|
|
/// MAIN
|
|
|
|
/// The main entry point for the CASA application.
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </summary>
|
|
|
|
[STAThread]
|
|
|
|
public static void Main(string[] args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.Main() - BEGIN");
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
Common.ReadPlatform();
|
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;
|
2006-03-07 14:54:44 +01: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)
|
|
|
|
{
|
2006-03-07 14:54:44 +01:00
|
|
|
//Console.WriteLine("CasaMain: EXCEPTION \n"+e.ToString());
|
|
|
|
|
|
|
|
string message = "miCASA services are not available";
|
2005-11-11 16:38:05 +01:00
|
|
|
if (m_bShowDebug)
|
|
|
|
message = e.ToString();
|
|
|
|
MessageDialog md=new MessageDialog(null,Gtk.DialogFlags.Modal,
|
2006-03-07 14:54:44 +01:00
|
|
|
Gtk.MessageType.Error,
|
|
|
|
Gtk.ButtonsType.Close,
|
|
|
|
message);
|
2005-11-11 16:38:05 +01:00
|
|
|
md.Response+=new ResponseHandler(md_ResponseCloseWindow);
|
|
|
|
md.SetPosition(Gtk.WindowPosition.CenterAlways);
|
2006-03-07 14:54:44 +01:00
|
|
|
md.Show();
|
2005-11-11 16:38:05 +01:00
|
|
|
Application.Run();
|
|
|
|
}
|
2006-03-07 14:54:44 +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-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
2006-03-07 14:54:44 +01:00
|
|
|
/// *******************************************************************
|
|
|
|
/// public CasaMain(string[] args)
|
|
|
|
///
|
|
|
|
/// MAIN CONSTRUCTOR
|
|
|
|
/// CasaMain constructor funtion.
|
|
|
|
/// *******************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </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() )
|
|
|
|
{
|
2006-03-07 14:54:44 +01:00
|
|
|
MasterPasswordAuthentication();
|
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
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("CasaMain:EXCEPTION"+e.ToString());
|
|
|
|
}
|
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-01-19 00:03:35 +01:00
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogSingleInstance", null);
|
|
|
|
gxmlTemp.Autoconnect(this);
|
2006-03-07 14:54:44 +01: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
|
|
|
Logger.DbgLog("GUI:CasaMain.CasaMain() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
2006-03-07 14:54:44 +01:00
|
|
|
/// ********************************************************************
|
|
|
|
/// public void InitializeGUI()
|
|
|
|
///
|
|
|
|
/// INITIALIZE MAIN GUI
|
|
|
|
/// Main GUI initializing routine. This routine builds the Main
|
|
|
|
/// window of CASA.
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </summary>
|
|
|
|
public void InitializeGUI()
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.InitializeGUI() - BEGIN");
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
gxmlMain = new Glade.XML(Common.GladeFile, "windowMain", null);
|
|
|
|
gxmlMain.Autoconnect(this);
|
|
|
|
windowMain.DeleteEvent += new DeleteEventHandler(OnWindowMainDeleted);
|
|
|
|
|
|
|
|
// DEBUG
|
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
|
|
|
/// PLATFORM SPECIFIC GUI CHANGES
|
2006-03-07 14:54:44 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// POLICY INIT
|
|
|
|
StorePolicyInterface.Init();
|
2006-03-07 14:54:44 +01: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();
|
2006-03-07 14:54:44 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( Common.IS_MICASA )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.new MiCasa().");
|
|
|
|
objMiCasa = new MiCasa();
|
|
|
|
}
|
|
|
|
else
|
2006-03-07 14:54:44 +01:00
|
|
|
(notebookStores.GetNthPage(Common.STORE_MICASA)).Visible = Common.IS_MICASA;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( Common.IS_FIREFOX )
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.new Firefox().");
|
2006-03-07 14:54:44 +01:00
|
|
|
objFirefox = new Firefox();
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
|
|
|
else
|
2006-03-07 14:54:44 +01:00
|
|
|
(notebookStores.GetNthPage(Common.STORE_FIREFOX)).Visible = Common.IS_FIREFOX;
|
|
|
|
|
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;
|
2006-03-07 14:54:44 +01: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;
|
2006-03-07 14:54:44 +01: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;
|
2006-03-07 14:54:44 +01: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
|
|
|
|
2006-03-31 21:52:25 +02:00
|
|
|
|
|
|
|
Gdk.Color color = new Gdk.Color(90, 77, 189);
|
|
|
|
drawingarea1.ModifyBg(Gtk.StateType.Normal, color);
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
windowMain.Show();
|
2006-03-07 14:54:44 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.InitializeGUI() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
2006-03-07 14:54:44 +01:00
|
|
|
/// ********************************************************************
|
|
|
|
/// public void MasterPasswordAuthentication()
|
|
|
|
///
|
|
|
|
/// INITIAL MASTER PASSWORD AUTHENTICATION
|
|
|
|
/// This routine implements the MasterPassword authentication.
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </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");
|
2006-02-21 20:07:18 +01:00
|
|
|
|
|
|
|
// did the daemon get restarted before the user created a master password?
|
2006-02-28 13:06:42 +01:00
|
|
|
// if so, let's ask the user for there desktop password and set it if there's a cache file
|
|
|
|
if (true == DoPersistentFilesExist())
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogDesktopPassword", null);
|
|
|
|
gxmlTemp.Autoconnect(this);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
|
|
|
|
gxmlTemp.Autoconnect(this);
|
|
|
|
entryMasterPassword3.Text = "";
|
|
|
|
entryMasterPassword4.Text = "";
|
2006-02-21 20:07:18 +01: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
|
|
|
Logger.DbgLog("GUI:CasaMain.Login() - END");
|
2006-02-28 13:06:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void on_entryDesktopPassword1_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
on_buttonPasswordOk_clicked(obj, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_entryDesktopPassword2_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
on_buttonPasswordOk_clicked(obj, args);
|
|
|
|
}
|
|
|
|
|
2006-02-21 20:07:18 +01:00
|
|
|
public void on_buttonPasswordOk_clicked(object obj, EventArgs args)
|
2006-02-28 13:06:42 +01:00
|
|
|
{
|
|
|
|
object o = obj;
|
|
|
|
if (entryDesktopPassword1 != null && entryDesktopPassword2.Text != null)
|
|
|
|
{
|
|
|
|
if (entryDesktopPassword1.Text.Length < 1)
|
|
|
|
{
|
|
|
|
labelDesktopPasswordMessage.Text = "Please enter your desktop password";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entryDesktopPassword1.Text.Equals(entryDesktopPassword2.Text))
|
|
|
|
{
|
|
|
|
// set the desktop password in micasa
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Novell.CASA.miCASA.SetCredential(0,
|
2006-03-07 14:54:44 +01:00
|
|
|
"Desktop",
|
|
|
|
null,
|
|
|
|
Novell.CASA.miCASA.USERNAME_TYPE_CN_F,
|
|
|
|
GetLocalUsername(),
|
|
|
|
entryDesktopPassword1.Text);
|
2006-02-28 13:06:42 +01:00
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Logger.DbgLog(e.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dialogDesktopPassword != null)
|
|
|
|
dialogDesktopPassword.Destroy();
|
|
|
|
|
|
|
|
MasterPasswordAuthentication();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
labelDesktopPasswordMessage.Text = "Passwords do not match";
|
|
|
|
entryDesktopPassword1.Text = "";
|
|
|
|
entryDesktopPassword2.Text = "";
|
|
|
|
}
|
2006-02-21 20:07:18 +01:00
|
|
|
}
|
2006-02-28 13:06:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void on_helpbuttonDesktopPassword_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("CASADesktopPassword.htm");
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_buttonPasswordClose_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
if (dialogDesktopPassword != null)
|
|
|
|
dialogDesktopPassword.Destroy();
|
|
|
|
|
|
|
|
closebuttonLogin_clicked(obj, args);
|
2006-02-21 20:07:18 +01:00
|
|
|
}
|
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);
|
2006-03-07 14:54:44 +01:00
|
|
|
gxmlTemp.Autoconnect (this);
|
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)
|
|
|
|
{
|
2006-02-21 20:07:18 +01:00
|
|
|
if (dialogLogin != null)
|
|
|
|
dialogLogin.Destroy();
|
|
|
|
|
2006-01-29 04:16:33 +01:00
|
|
|
// close tray too
|
|
|
|
if (mCasaTray != null)
|
|
|
|
{
|
|
|
|
mCasaTray.Destroy();
|
|
|
|
mCasaTray = null;
|
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
HandleQuit();
|
2006-03-07 14:54:44 +01:00
|
|
|
}
|
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
|
|
|
|
2006-01-29 04:16:33 +01:00
|
|
|
// close tray too
|
|
|
|
if (mCasaTray != null)
|
|
|
|
{
|
|
|
|
mCasaTray.Destroy();
|
|
|
|
mCasaTray = null;
|
|
|
|
}
|
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));
|
2006-02-28 13:06:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public bool DoPersistentFilesExist()
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.DoesPersistentFilesExist() - BEGIN");
|
|
|
|
|
|
|
|
// is the desktop password set already?
|
|
|
|
try
|
|
|
|
{
|
|
|
|
BasicCredential bc = Novell.CASA.miCASA.GetCredential(0,
|
2006-03-07 14:54:44 +01:00
|
|
|
"Desktop",
|
|
|
|
null,
|
|
|
|
Novell.CASA.miCASA.USERNAME_TYPE_CN_F);
|
2006-02-28 13:06:42 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
catch
|
|
|
|
{
|
|
|
|
// check for existence of persistent files
|
|
|
|
string MICASA_PASSCODE_BY_DESKTOP_FILE = "/.miCASAPCByDesktop";
|
|
|
|
string MICASA_KEY_FILE = "/.miCASAKey";
|
|
|
|
string MICASA_PERSISTENCE_FILE = "/.miCASA";
|
|
|
|
string MICASA_VALIDATION_FILE = "/.miCASAValidate";
|
|
|
|
string sHomeDir = GetUserHomeDir();
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:CasaMain.DoesPersistentFilesExist() - END");
|
|
|
|
return (File.Exists(sHomeDir + MICASA_PERSISTENCE_FILE)
|
|
|
|
&& File.Exists(sHomeDir + MICASA_KEY_FILE)
|
|
|
|
&& File.Exists(sHomeDir + MICASA_PASSCODE_BY_DESKTOP_FILE)
|
|
|
|
&& File.Exists(sHomeDir + MICASA_VALIDATION_FILE));
|
|
|
|
}
|
2006-02-21 20:07:18 +01:00
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
private string GetUserHomeDir()
|
|
|
|
{
|
|
|
|
if (Common.IS_LINUX)
|
|
|
|
return Environment.GetEnvironmentVariable("HOME");
|
|
|
|
else
|
2006-03-07 14:54:44 +01:00
|
|
|
return Environment.GetEnvironmentVariable("USERPROFILE");
|
2006-02-28 13:06:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private string GetLocalUsername()
|
|
|
|
{
|
|
|
|
return Environment.GetEnvironmentVariable("USERNAME");
|
2006-02-21 20:07:18 +01:00
|
|
|
}
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
2006-03-07 14:54:44 +01:00
|
|
|
/// ********************************************************************
|
|
|
|
/// public void LoginContinue(string LabelMain, string LabelTips)
|
|
|
|
///
|
|
|
|
/// LOGIN WARNING DIALOG
|
2005-11-11 16:38:05 +01:00
|
|
|
/// Error dialog prompt for MasterPassword authentication
|
2006-03-07 14:54:44 +01:00
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </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
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// internal void on_notebookStores_switch_page(object obj, SwitchPageArgs args)
|
|
|
|
///
|
|
|
|
/// NOTEBOOK SWITCH PAGE HANDLER
|
|
|
|
/// To perform only on the click of the respective store tab/page.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
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
|
|
|
|
2006-03-09 05:45:36 +01:00
|
|
|
case Common.STORE_FIREFOX:
|
2006-02-28 13:06:42 +01:00
|
|
|
if( false == objFirefox.IS_STORE_AGGREGATED )
|
|
|
|
{
|
2006-03-08 11:58:28 +01:00
|
|
|
if( StoreDataInterface.IsMasterPasswordSet(Common.STORE_FIREFOX) )
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogFirefoxMP", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogFirefoxMP.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
|
|
|
dialogFirefoxMP.TransientFor = windowMain;
|
2006-03-09 06:22:49 +01:00
|
|
|
dialogFirefoxMP.DeleteEvent += new DeleteEventHandler(on_dialogFirefoxMP_deleted);
|
2006-03-08 11:58:28 +01:00
|
|
|
}
|
2006-03-08 13:59:15 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
objFirefox.AggregateStore();
|
|
|
|
objFirefox.IS_STORE_AGGREGATED = true;
|
|
|
|
}
|
2006-02-28 13:06:42 +01: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_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;
|
2006-03-07 14:54:44 +01:00
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2006-03-09 05:45:36 +01:00
|
|
|
|
|
|
|
public void on_entryFirefoxMP_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
on_buttonFirefoxMPok_clicked(obj, args);
|
|
|
|
}
|
|
|
|
|
2006-03-08 11:58:28 +01:00
|
|
|
public void on_buttonFirefoxMPok_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
if( "" != entryFirefoxMP.Text )
|
|
|
|
if( StoreDataInterface.VerifyMasterPassword(entryFirefoxMP.Text, Common.STORE_FIREFOX) )
|
|
|
|
{
|
|
|
|
dialogFirefoxMP.Destroy();
|
|
|
|
objFirefox.AggregateStore();
|
|
|
|
objFirefox.IS_STORE_AGGREGATED = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
entryFirefoxMP.Text = "";
|
2006-03-08 12:08:13 +01:00
|
|
|
entryFirefoxMP.HasFocus = true;
|
2006-03-08 11:58:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_buttonFirefoxMPclose_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
dialogFirefoxMP.Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_buttonFirefoxMPhelp_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2006-03-09 06:22:49 +01:00
|
|
|
|
|
|
|
public void on_dialogFirefoxMP_deleted(object obj, DeleteEventArgs args)
|
|
|
|
{
|
|
|
|
dialogFirefoxMP.Destroy();
|
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
/// <summary>
|
2006-03-07 14:54:44 +01:00
|
|
|
/// ********************************************************************
|
|
|
|
/// internal void FileMenuActivated(object obj, EventArgs args)
|
2005-11-11 16:38:05 +01:00
|
|
|
///
|
2006-03-07 14:54:44 +01:00
|
|
|
/// FILE MENU ACTIVATION HANDLER
|
|
|
|
/// To highlight/de-highlight menuitems in the file menu.
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </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())
|
2006-03-07 14:54:44 +01:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
LockGUI();
|
|
|
|
Logger.DbgLog("GUI:CasaMain.FileMenuActivated() Store is locked - END");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
2006-03-07 14:54:44 +01:00
|
|
|
{
|
2006-01-19 19:02:47 +01:00
|
|
|
if (m_bGuiLocked)
|
2006-03-07 14:54:44 +01:00
|
|
|
UnlockGUI();
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
switch(notebookStores.CurrentPage)
|
2005-11-11 16:38:05 +01:00
|
|
|
{
|
2006-04-13 16:46:10 +02:00
|
|
|
case Common.STORE_MICASA:
|
|
|
|
|
|
|
|
mmiNew.Sensitive = true;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
if( 0 != objMiCasa.tvSecretIDMiCasa.Selection.CountSelectedRows() )
|
|
|
|
{
|
|
|
|
mmiNew.Sensitive = mmiNewKey.Sensitive = true;
|
|
|
|
}
|
|
|
|
else
|
2006-01-06 15:05:07 +01:00
|
|
|
{
|
2006-03-07 14:54:44 +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
|
|
|
case Common.STORE_FIREFOX:
|
2006-02-28 13:06:42 +01:00
|
|
|
if( 0 != objFirefox.tvSecretIDFirefox.Selection.CountSelectedRows() )
|
|
|
|
{
|
|
|
|
mmiNew.Sensitive = mmiNewKey.Sensitive = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mmiNew.Sensitive = 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
|
|
|
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:
|
2006-04-13 16:46:10 +02:00
|
|
|
|
|
|
|
mmiNew.Sensitive = true;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
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:
|
2006-04-13 16:46:10 +02:00
|
|
|
|
|
|
|
mmiNew.Sensitive = true;
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
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;
|
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.FileMenuActivated() - END");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// internal void EditMenuActivated(object obj, EventArgs args)
|
2005-11-11 16:38:05 +01:00
|
|
|
///
|
2006-03-07 14:54:44 +01:00
|
|
|
/// EDIT MENU ACTIVATION HANDLER
|
|
|
|
/// To highlight/de-highlight menuitems in the edit menu.
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </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:
|
2006-02-28 13:06:42 +01:00
|
|
|
if( 0 != objFirefox.tvSecretIDFirefox.Selection.CountSelectedRows() )
|
|
|
|
{
|
2006-03-15 16:56:11 +01:00
|
|
|
mmiView.Sensitive = mmiDelete.Sensitive = true;
|
|
|
|
mmiLink.Sensitive = mmiCopy.Sensitive = false;
|
2006-02-28 13:06:42 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mmiView.Sensitive = mmiLink.Sensitive = mmiCopy.Sensitive = mmiDelete.Sensitive = false;
|
|
|
|
}
|
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");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// internal void OptionsMenuActivated(object obj, EventArgs args)
|
|
|
|
///
|
|
|
|
/// OPTIONS MENU ACTIVATION HANDLER
|
|
|
|
/// To highlight/de-highlight menuitems in the options menu.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
|
|
|
internal void OptionsMenuActivated(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.OptionsMenuActivated() - BEGIN");
|
|
|
|
|
|
|
|
if( Common.IS_WINDOWS )
|
|
|
|
{
|
|
|
|
//mmiApplicationSSO.Sensitive = false;
|
|
|
|
mmiKonquerer.Sensitive = false;
|
|
|
|
mmiKopete.Sensitive = false;
|
|
|
|
mmiNetworkManager.Sensitive = false;
|
|
|
|
mmiGaim.Sensitive = false;
|
|
|
|
mmiKopete.Visible = mmiGaim.Visible = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( Common.IS_KDEWALLET )
|
|
|
|
mmiKonquerer.Sensitive = mmiKopete.Sensitive = true;
|
|
|
|
else
|
|
|
|
mmiKonquerer.Sensitive = mmiKopete.Sensitive = false;
|
|
|
|
|
|
|
|
if( Common.IS_GNOMEKEYRING )
|
|
|
|
mmiNetworkManager.Sensitive = mmiGaim.Sensitive = true;
|
|
|
|
else
|
|
|
|
mmiNetworkManager.Sensitive = mmiGaim.Sensitive = false;
|
|
|
|
mmiKopete.Visible = mmiGaim.Visible = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:CasaMain.OptionsMenuActivated() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
|
|
|
|
/// <summary>
|
2006-03-07 14:54:44 +01:00
|
|
|
/// ********************************************************************
|
|
|
|
/// public void RefreshAllStores(object obj, EventArgs args)
|
2005-11-11 16:38:05 +01:00
|
|
|
///
|
2006-03-07 14:54:44 +01:00
|
|
|
/// REFRESH ALL STORES
|
|
|
|
/// Re-aggregate all stores based on the aggregation policy.
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </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-03-07 14:54:44 +01:00
|
|
|
RefreshStores();
|
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");
|
|
|
|
}
|
|
|
|
|
2006-03-30 17:42:33 +02:00
|
|
|
internal void RefreshStores()
|
2005-11-11 16:38:05 +01:00
|
|
|
{
|
2006-03-07 14:54:44 +01:00
|
|
|
if( Common.IS_MICASA )
|
|
|
|
objMiCasa.AggregateStore();
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
if( Common.IS_FIREFOX )
|
2006-03-08 11:58:28 +01:00
|
|
|
{
|
2006-03-09 05:45:36 +01:00
|
|
|
if( false == objFirefox.IS_STORE_AGGREGATED && notebookStores.CurrentPage == Common.STORE_FIREFOX )
|
2006-03-08 11:58:28 +01:00
|
|
|
{
|
|
|
|
if( StoreDataInterface.IsMasterPasswordSet(Common.STORE_FIREFOX) )
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogFirefoxMP", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogFirefoxMP.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
|
|
|
dialogFirefoxMP.TransientFor = windowMain;
|
2006-03-09 06:22:49 +01:00
|
|
|
dialogFirefoxMP.DeleteEvent += new DeleteEventHandler(on_dialogFirefoxMP_deleted);
|
2006-03-08 11:58:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
objFirefox.AggregateStore();
|
2006-03-09 05:45:36 +01:00
|
|
|
//if( true == objFirefox.IS_STORE_AGGREGATED )
|
|
|
|
// objFirefox.AggregateStore();
|
2006-03-08 11:58:28 +01:00
|
|
|
}
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
if( Common.IS_MOZILLA )
|
|
|
|
objMozilla.AggregateStore();
|
|
|
|
|
|
|
|
if( Common.IS_KDEWALLET )
|
|
|
|
objKdeWallet.AggregateStore();
|
|
|
|
|
|
|
|
if( Common.IS_GNOMEKEYRING )
|
2006-03-30 17:42:33 +02:00
|
|
|
objGnomeKeyring.AggregateStore();
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
|
2006-03-30 17:42:33 +02:00
|
|
|
|
|
|
|
internal void ClearViewOnStores()
|
|
|
|
{
|
|
|
|
if( Common.IS_MICASA )
|
|
|
|
objMiCasa.ClearViewOnStore();
|
|
|
|
|
|
|
|
if( Common.IS_FIREFOX )
|
|
|
|
{
|
|
|
|
objFirefox.ClearViewOnStore();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Common.IS_MOZILLA )
|
|
|
|
objMozilla.ClearViewOnStore();
|
|
|
|
|
|
|
|
if( Common.IS_KDEWALLET )
|
|
|
|
objKdeWallet.ClearViewOnStore();
|
2006-03-07 14:54:44 +01:00
|
|
|
|
2006-03-30 17:42:33 +02:00
|
|
|
if( Common.IS_GNOMEKEYRING )
|
|
|
|
objGnomeKeyring.ClearViewOnStore();
|
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void OnNewSecretActivated(object obj, EventArgs args)
|
2005-11-11 16:38:05 +01:00
|
|
|
///
|
2006-03-07 14:54:44 +01:00
|
|
|
/// MAIN-MENU: NEW SECRET
|
|
|
|
/// Add a new secret.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
2005-11-11 16:38:05 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void OnNewKeyActivated(object obj, EventArgs args)s)
|
2005-11-11 16:38:05 +01:00
|
|
|
///
|
2006-03-07 14:54:44 +01:00
|
|
|
/// MAIN-MENU: NEW KEY
|
|
|
|
/// Add new key-value pairs to an existing secret.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
2005-11-11 16:38:05 +01:00
|
|
|
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
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
|
2005-10-12 17:27:21 +02:00
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void OnLockMiCASASecrets(object sender, EventArgs args)
|
|
|
|
/// public void OnUnLockMiCASASecrets(object sender, EventArgs args)
|
|
|
|
///
|
|
|
|
/// MAIN-MENU: LOCK/UNLOCK STORE, DESTROY SECRETS
|
|
|
|
/// Handlers for locking/unlocking the store, and destroying secrets.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
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);
|
2006-01-20 19:44:28 +01:00
|
|
|
RefreshStores();
|
2005-11-11 16:38:05 +01:00
|
|
|
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
|
|
|
internal void LockGUI()
|
|
|
|
{
|
2006-03-30 17:42:33 +02:00
|
|
|
ClearViewOnStores();
|
2006-03-07 14:54:44 +01:00
|
|
|
notebookStores.Sensitive = false;
|
2005-11-11 16:38:05 +01:00
|
|
|
mmiLockSecrets.Sensitive = false;
|
|
|
|
mmiUnlockSecrets.Sensitive = true;
|
2006-03-07 14:54:44 +01:00
|
|
|
mmiDestroySecrets.Sensitive = false;
|
2005-11-11 16:38:05 +01:00
|
|
|
mmiNew.Sensitive = false;
|
|
|
|
mmiRefresh.Sensitive = false;
|
|
|
|
mmiDebug.Sensitive = false;
|
|
|
|
mmiOptions.Sensitive = false;
|
|
|
|
mmiEdit.Sensitive = false;
|
2006-01-20 19:44:28 +01:00
|
|
|
m_bGuiLocked = true;
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
internal void UnlockGUI()
|
|
|
|
{
|
2006-03-07 14:54:44 +01:00
|
|
|
notebookStores.Sensitive = true;
|
2005-11-11 16:38:05 +01:00
|
|
|
mmiLockSecrets.Sensitive = true;
|
|
|
|
mmiUnlockSecrets.Sensitive = false;
|
|
|
|
mmiDestroySecrets.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-19 19:02:47 +01:00
|
|
|
m_bGuiLocked = false;
|
2006-01-09 19:55:50 +01:00
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
//refresh secrets
|
|
|
|
RefreshStores();
|
|
|
|
}
|
|
|
|
|
|
|
|
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-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void LinkKeyValue(object obj, EventArgs args)
|
|
|
|
///
|
|
|
|
/// MAIN-MENU: VIEW
|
|
|
|
/// View the key-value pairs of the selected secret. Calls store
|
|
|
|
/// specific handlers.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
2005-11-11 16:38:05 +01:00
|
|
|
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-02-28 13:06:42 +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:
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void LinkKeyValue(object obj, EventArgs args)
|
|
|
|
///
|
|
|
|
/// MAIN-MENU: LINK
|
|
|
|
/// Link selected miCASA key-value pairs.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
2005-11-11 16:38:05 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void CopyKeyValue(object obj, EventArgs args)
|
|
|
|
///
|
|
|
|
/// MAIN-MENU: COPY
|
|
|
|
/// Not at impletemented.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
2005-11-11 16:38:05 +01:00
|
|
|
public void CopyKeyValue(object obj, EventArgs args)
|
2006-03-07 14:54:44 +01:00
|
|
|
{
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void DeleteSecret(object obj, EventArgs args)
|
|
|
|
///
|
|
|
|
/// MAIN-MENU: DELETE SECRET
|
|
|
|
/// Call store specific delete-secret handler.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
2005-11-11 16:38:05 +01:00
|
|
|
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:
|
2006-03-15 16:56:11 +01:00
|
|
|
objFirefox.OnDeleteActivated(obj, args);
|
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");
|
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// KONQUERER, KOPETE
|
|
|
|
/// NETWORK-MANAGER, GAIM
|
|
|
|
///
|
|
|
|
/// APPLICATION SSO
|
|
|
|
/// Call respective application sso handlers.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
|
|
|
public void on_konquerer_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
if(null != objKdeWallet)
|
|
|
|
objKdeWallet.SSOKonquerer(obj, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_kopete_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
if(null != objKdeWallet)
|
|
|
|
objKdeWallet.SSOKopete(obj, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_networkmanager_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
if(null != objGnomeKeyring)
|
|
|
|
objGnomeKeyring.SSONetworkManager(obj, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void on_gaim_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
if(null != objGnomeKeyring)
|
|
|
|
objGnomeKeyring.SSOGaim(obj, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void ResetMasterPassword(object obj, EventArgs args)
|
|
|
|
///
|
|
|
|
/// CHANGE MASTER PASSWORD
|
|
|
|
/// Change the previously set Master Password.
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </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="";
|
2006-03-07 14:54:44 +01:00
|
|
|
entryNewMP2.Text="";
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
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
|
|
|
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
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
public void on_helpbuttonResetMP_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("CASAMasterPasswordAuthentication.htm");
|
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void PersistentStorage(object obj, EventArgs args)
|
|
|
|
///
|
|
|
|
/// PERSISTENT STORAGE
|
|
|
|
/// As of now, We are not using this routine.
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </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
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
if(("" != entryMasterPassword1.Text && "" != entryMasterPassword2.Text) && (entryMasterPassword1.Text == entryMasterPassword2.Text))
|
2005-11-11 16:38:05 +01:00
|
|
|
{
|
|
|
|
//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
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void Preferences(object obj, EventArgs args)
|
|
|
|
///
|
2005-11-11 16:38:05 +01:00
|
|
|
/// PREFERENCES
|
2006-03-07 14:54:44 +01:00
|
|
|
/// Handle Preferences dialog to set the store aggregation policy.
|
|
|
|
/// (Main Menu: Options > Preferences).
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </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;
|
2006-03-07 14:54:44 +01:00
|
|
|
checkbuttonFirefox.Active = Common.IS_FIREFOX;
|
|
|
|
checkbuttonMozilla.Active = Common.IS_MOZILLA;
|
|
|
|
checkbuttonGnomeKeyring.Active = Common.IS_GNOMEKEYRING;
|
|
|
|
checkbuttonKdeWallet.Active = Common.IS_KDEWALLET;
|
|
|
|
checkbuttonFirefox.Sensitive = Common.IS_FIREFOX_AVAILABLE;
|
|
|
|
checkbuttonKdeWallet.Sensitive = Common.IS_KDEWALLET_AVAILABLE;
|
|
|
|
checkbuttonGnomeKeyring.Sensitive = Common.IS_GNOMEKEYRING_AVAILABLE;
|
2006-02-14 13:46:09 +01:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
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
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
Common.IS_FIREFOX = checkbuttonFirefox.Active;
|
|
|
|
Common.IS_MOZILLA = checkbuttonMozilla.Active;
|
|
|
|
Common.IS_GNOMEKEYRING = checkbuttonGnomeKeyring.Active;
|
|
|
|
Common.IS_KDEWALLET = checkbuttonKdeWallet.Active;
|
|
|
|
dialogPreferences.Destroy();
|
|
|
|
|
|
|
|
/// FIREFOX
|
2005-11-11 16:38:05 +01:00
|
|
|
if(Common.IS_FIREFOX)
|
|
|
|
{
|
|
|
|
if( null == objFirefox )
|
2006-03-08 13:59:15 +01:00
|
|
|
objFirefox = new Firefox();
|
2006-03-08 11:58:28 +01:00
|
|
|
//objFirefox.AggregateStore();
|
2006-03-07 14:54:44 +01:00
|
|
|
notebookStores.GetNthPage(Common.STORE_FIREFOX).Visible = true;
|
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_FIREFOX, true, storeID, 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-08 11:58:28 +01:00
|
|
|
//objFirefox = null;
|
2006-03-07 14:54:44 +01:00
|
|
|
notebookStores.GetNthPage(Common.STORE_FIREFOX).Visible = false;
|
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_FIREFOX, false, storeID, 1);
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
/// MOZILLA
|
2005-11-11 16:38:05 +01:00
|
|
|
if(Common.IS_MOZILLA)
|
|
|
|
{
|
|
|
|
if( null == objMozilla )
|
2006-03-07 14:54:44 +01:00
|
|
|
objMozilla = new Mozilla();
|
2006-03-08 11:58:28 +01:00
|
|
|
//objMozilla.AggregateStore();
|
2006-03-07 14:54:44 +01:00
|
|
|
notebookStores.GetNthPage(Common.STORE_MOZILLA).Visible = true;
|
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_MOZILLA, true, storeID, 1);
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
else
|
|
|
|
{
|
2006-03-08 11:58:28 +01:00
|
|
|
//objMozilla = null;
|
2006-03-07 14:54:44 +01:00
|
|
|
notebookStores.GetNthPage(Common.STORE_MOZILLA).Visible = false;
|
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_MOZILLA, false, storeID, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// KDEWALLET
|
2005-11-11 16:38:05 +01:00
|
|
|
if(Common.IS_KDEWALLET)
|
|
|
|
{
|
|
|
|
if( null == objKdeWallet )
|
2006-03-07 14:54:44 +01:00
|
|
|
objKdeWallet = new KdeWallet();
|
2006-03-08 11:58:28 +01:00
|
|
|
//objKdeWallet.AggregateStore();
|
2006-03-07 14:54:44 +01:00
|
|
|
notebookStores.GetNthPage(Common.STORE_KDEWALLET).Visible = true;
|
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_KDEWALLET, true, storeID, 1);
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
else
|
|
|
|
{
|
2006-03-08 11:58:28 +01:00
|
|
|
//objKdeWallet = null;
|
2006-03-07 14:54:44 +01:00
|
|
|
notebookStores.GetNthPage(Common.STORE_KDEWALLET).Visible = false;
|
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_KDEWALLET, false, storeID, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// GNOMEKEYRING
|
2005-11-11 16:38:05 +01:00
|
|
|
if(Common.IS_GNOMEKEYRING)
|
|
|
|
{
|
|
|
|
if( null == objGnomeKeyring )
|
2006-03-07 14:54:44 +01:00
|
|
|
objGnomeKeyring = new GnomeKeyring();
|
2006-03-08 11:58:28 +01:00
|
|
|
//objGnomeKeyring.AggregateStore();
|
2006-03-07 14:54:44 +01:00
|
|
|
notebookStores.GetNthPage(Common.STORE_GNOMEKEYRING).Visible = true;
|
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_GNOMEKEYRING, true, storeID, 1);
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
else
|
|
|
|
{
|
2006-03-08 11:58:28 +01:00
|
|
|
//objGnomeKeyring = null;
|
2006-03-07 14:54:44 +01:00
|
|
|
notebookStores.GetNthPage(Common.STORE_GNOMEKEYRING).Visible = false;
|
|
|
|
StorePolicyInterface.SetAggregationPolicy(Common.STORE_GNOMEKEYRING, false, storeID, 1);
|
|
|
|
}
|
|
|
|
StorePolicyInterface.SaveAggregationPolicy();
|
|
|
|
|
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-11-11 16:38:05 +01:00
|
|
|
public void on_helpbuttonPreferences_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("Preferences.htm");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
/*
|
|
|
|
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-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-03-07 14:54:44 +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,
|
2006-03-07 14:54:44 +01:00
|
|
|
Gtk.MessageType.Question,
|
|
|
|
Gtk.ButtonsType.YesNo,
|
|
|
|
"Show the Tray Icon at startup?");
|
2005-11-11 16:38:05 +01:00
|
|
|
|
|
|
|
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")+
|
2006-03-07 14:54:44 +01:00
|
|
|
"\\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,
|
2006-03-07 14:54:44 +01:00
|
|
|
"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
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void on_create_sample_secrets1_activate(object obj, EventArgs arg)
|
|
|
|
/// public void on_remove_test_secrets1_activate(object obj, EventArgs args)
|
|
|
|
///
|
|
|
|
/// DEBUG LOGGING
|
|
|
|
/// Create and delete miCASA test secrets.
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </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
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void About(object obj, EventArgs args)
|
|
|
|
///
|
|
|
|
/// ABOUT
|
|
|
|
/// Display the About dialog box.
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </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
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// SINGLE INSTANCE OF CASAMANAGER
|
|
|
|
/// Check for single instance of CASAManager.exe.
|
|
|
|
/// ********************************************************************
|
2005-11-11 16:38:05 +01:00
|
|
|
/// </summary>
|
|
|
|
public void on_dialogSingleInstance_delete_event(object obj, DeleteEventArgs args)
|
|
|
|
{
|
|
|
|
dialogSingleInstance.Destroy();
|
2006-03-07 14:54:44 +01:00
|
|
|
HandleQuit();
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
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();
|
2006-03-07 14:54:44 +01:00
|
|
|
HandleQuit();
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
|
2005-11-11 16:38:05 +01:00
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void StillRunning(object obj, EventArgs args)
|
|
|
|
///
|
|
|
|
/// GO TO TRAY
|
|
|
|
/// Inform that CASAManager will continue to run in the tray.
|
|
|
|
/// ********************************************************************
|
2006-01-20 19:44:28 +01:00
|
|
|
/// </summary>
|
|
|
|
public void StillRunning(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Logger.DbgLog("GUI:CasaMain.StillRunning() - BEGIN");
|
|
|
|
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogStillRunning", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
dialogStillRunning.TransientFor = windowMain;
|
|
|
|
Logger.DbgLog("GUI:CasaMain.StillRunning() - END");
|
|
|
|
}
|
|
|
|
|
|
|
|
public void btnStillRunning_clicked(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
if (checkbuttonCloseMessage.Active)
|
|
|
|
{
|
|
|
|
m_bNotifyUser = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
dialogStillRunning.Destroy();
|
|
|
|
}
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void on_view_log_file1_activate(object obj, EventArgs args)
|
|
|
|
///
|
|
|
|
/// LOGGING
|
|
|
|
/// Logging window operations.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
|
|
|
public void on_view_log_file1_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
}
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
public void on_enable_logging1_activate(object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Gtk.CheckMenuItem miLog = (Gtk.CheckMenuItem)obj;
|
|
|
|
if (miLog.Active)
|
|
|
|
OpenLogWindow();
|
|
|
|
else
|
|
|
|
CloseLogWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
internal void OpenLogWindow()
|
|
|
|
{
|
|
|
|
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLog", null);
|
|
|
|
gxmlTemp.Autoconnect (this);
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// public void OnMenuHelpActivate(object sender, EventArgs args)
|
|
|
|
///
|
|
|
|
/// HELP
|
|
|
|
/// Opens help contents for CASAManager.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
|
|
|
public void OnMenuHelpActivate(object sender, EventArgs args)
|
|
|
|
{
|
|
|
|
Common.ShowHelpUrl("Contents.htm");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// internal void Focus()
|
|
|
|
///
|
|
|
|
/// MAIN WINDOW FOCUS
|
|
|
|
/// Handling Hocus-Focus of Main window.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
2005-11-11 16:38:05 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
/// <summary>
|
|
|
|
/// ********************************************************************
|
|
|
|
/// private void HandleQuit()
|
|
|
|
///
|
|
|
|
/// QUIT CASAMANAGER
|
|
|
|
/// Quit CASAManager.exe, also handle the closing the trayicon.
|
|
|
|
/// ********************************************************************
|
|
|
|
/// </summary>
|
|
|
|
private void HandleQuit()
|
2005-11-11 16:38:05 +01:00
|
|
|
{
|
2006-03-07 14:54:44 +01:00
|
|
|
if (mCasaTray != null)
|
|
|
|
{
|
|
|
|
if (m_bNotifyUser)
|
|
|
|
{
|
|
|
|
// StillRunning(null, null);
|
|
|
|
// 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.");
|
2005-10-31 21:24:36 +01:00
|
|
|
|
2006-03-07 14:54:44 +01:00
|
|
|
md.SetPosition(Gtk.WindowPosition.Center);
|
|
|
|
md.Response +=new ResponseHandler(md_Response);
|
|
|
|
md.Modal = true;
|
|
|
|
md.SetIconFromFile(Common.CASAICONS);
|
|
|
|
md.Show();
|
|
|
|
m_bNotifyUser = false;
|
|
|
|
}
|
|
|
|
mCasaTray.CasaManagerQuit();
|
|
|
|
return;
|
|
|
|
}
|
2005-11-11 16:38:05 +01:00
|
|
|
else
|
2006-03-07 14:54:44 +01:00
|
|
|
Application.Quit();
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
public void QuitApplication(object obj, EventArgs args)
|
2005-11-11 16:38:05 +01:00
|
|
|
{
|
2006-03-07 14:54:44 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.QuitApplication() - BEGIN");
|
|
|
|
|
|
|
|
HandleQuit();
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:CasaMain.QuitApplication() - END");
|
2005-11-11 16:38:05 +01:00
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
public void OnWindowMainDeleted(object obj, DeleteEventArgs args)
|
2005-11-11 16:38:05 +01:00
|
|
|
{
|
2006-03-07 14:54:44 +01:00
|
|
|
Logger.DbgLog("GUI:CasaMain.OnWindowMainDeleted() - BEGIN");
|
|
|
|
|
|
|
|
HandleQuit();
|
|
|
|
args.RetVal = true;
|
|
|
|
|
|
|
|
Logger.DbgLog("GUI:CasaMain.OnWindowMainDeleted() - END");
|
|
|
|
}
|
|
|
|
|
2005-10-31 21:24:36 +01:00
|
|
|
}
|
2005-10-11 21:51:00 +02:00
|
|
|
}
|
2006-03-07 14:54:44 +01:00
|
|
|
|
|
|
|
/// ********************************************************************
|
|
|
|
/// END OF FILE
|
|
|
|
/// ********************************************************************
|