- Limit where persistent files can be saved.

This commit is contained in:
Jim Norman 2007-01-04 08:58:30 +00:00
parent d0a9891cdf
commit fbfa990210
3 changed files with 570 additions and 543 deletions

View File

@ -385,11 +385,11 @@ namespace Novell.CASA.GUI
Logger.DbgLog("GUI:CasaMain.Login() - BEGIN");
if( true == IsMasterPasswordSet() )
{
{
Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned true");
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);
@ -405,7 +405,7 @@ namespace Novell.CASA.GUI
}
}
else
{
{
Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned false");
// did the daemon get restarted before the user created a master password?
@ -713,7 +713,7 @@ namespace Novell.CASA.GUI
string MICASA_PASSCODE_BY_MASTER_PASSWD_FILE = "/.miCASAPCByMPasswd";
string fileName = Common.GetUserPersistentDir(config) + MICASA_PASSCODE_BY_MASTER_PASSWD_FILE;
Logger.DbgLog("GUI:CasaMain.IsMasterPasswordSet() - END");
Logger.DbgLog("GUI:CasaMain.IsMasterPasswordSet() - END");
return (File.Exists(fileName));
}
@ -1750,6 +1750,7 @@ namespace Novell.CASA.GUI
public void okbuttonPreferences_clicked(object abj, EventArgs args)
{
Logger.DbgLog("GUI:CasaMain.okbuttonPreferences_clicked() - BEGIN");
bool bCloseDialog = true;
string[] storeID = new string[]{""};
@ -1757,7 +1758,7 @@ namespace Novell.CASA.GUI
Common.IS_MOZILLA = checkbuttonMozilla.Active;
Common.IS_GNOMEKEYRING = checkbuttonGnomeKeyring.Active;
Common.IS_KDEWALLET = checkbuttonKdeWallet.Active;
dialogPreferences.Destroy();
/// FIREFOX
if(Common.IS_FIREFOX)
@ -1841,12 +1842,18 @@ namespace Novell.CASA.GUI
string sOldDir = Common.GetUserPersistentDir(config);
try
{
if (MoveMiCASAFiles(sOldDir, sNewDir))
{
// save off selected directory
Common.SetUserPersistentDir(config, sNewDir);
CommonGUI.DisplayMessage(Gtk.MessageType.Info, "Files moved from\r\n" + sOldDir + "\r\nto\r\n" + sNewDir);
}
string sMoveMessage = MoveMiCASAFiles(sOldDir, sNewDir);
if (sMoveMessage.Equals("Success"))
{
// save off selected directory
Common.SetUserPersistentDir(config, sNewDir);
CommonGUI.DisplayMessage(Gtk.MessageType.Info, "Files moved from\r\n" + sOldDir + "\r\nto\r\n" + sNewDir);
}
else
{
CommonGUI.DisplayMessage(Gtk.MessageType.Warning, sMoveMessage);
bCloseDialog = false;
}
}
catch (Exception e)
{
@ -1854,6 +1861,11 @@ namespace Novell.CASA.GUI
}
config.WriteConfig();
if (bCloseDialog)
{
dialogPreferences.Destroy();
}
Logger.DbgLog("GUI:CasaMain.okbuttonPreferences_clicked() - END");
}
@ -2225,8 +2237,13 @@ namespace Novell.CASA.GUI
}
}
private bool MoveMiCASAFiles(string sOldDirectory, string sNewDirectory)
private string MoveMiCASAFiles(string sOldDirectory, string sNewDirectory)
{
if (sNewDirectory == null || sNewDirectory.Length == 0)
{
return "No persistent directory entered";
}
if ((sOldDirectory != null) && (sNewDirectory != null))
{
if (!sOldDirectory.Equals(sNewDirectory))
@ -2234,11 +2251,14 @@ namespace Novell.CASA.GUI
// instruct our daemon/service to change the location
ChangePersistentDir cpd = new ChangePersistentDir(sOldDirectory, sNewDirectory);
cpd = (ChangePersistentDir)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_CHANGE_PERSIST_DIR, cpd);
if (cpd.GetErrorMessage().Equals("Success"))
return true;
if (cpd.GetErrorMessage().Equals("Success"))
return "Success";
else
return cpd.GetErrorMessage();
}
}
return false;
return null;
}
@ -2247,11 +2267,11 @@ namespace Novell.CASA.GUI
{
PersistentPolicyDialog ppd = new PersistentPolicyDialog();
ppd.ShowDialog();
}
public void on_mmiFindAndReplace_activate(object obj, EventArgs args)
{
objMiCasa.FindAndReplaceValues();
}
public void on_mmiFindAndReplace_activate(object obj, EventArgs args)
{
objMiCasa.FindAndReplaceValues();
}

View File

@ -441,8 +441,15 @@ public class Common
}
internal static string GetUserName()
{
return Environment.GetEnvironmentVariable("USERNAME");
{
if (Common.IS_LINUX)
{
return Environment.GetEnvironmentVariable("USER");
}
else
{
return Environment.GetEnvironmentVariable("USERNAME");
}
}

File diff suppressed because it is too large Load Diff