Esempio n. 1
0
        /// <summary>
        /// Event Handler for Remove iFolders Toggled event
        /// </summary>
        private void OnRemoveiFoldersToggled(object obj, EventArgs args)
        {
            // If the button is being toggled for the first time since this
            // dialog has been opened, warn the user about what this action
            // will do.
            if (cbutton.Active)
            {
                iFolderMsgDialog dialog = new iFolderMsgDialog(
                    this,
                    iFolderMsgDialog.DialogType.Warning,
                    iFolderMsgDialog.ButtonSet.OkCancel,
                    "",
                    Util.GS("Removing iFolders from Server"),
                    Util.GS("Removing iFolders from the server will delete the files stored on the server.  Your files will remain intact on this computer.\n\nIf you've shared any iFolders with other users, they will no longer be able to synchronize them with the server.  Additionally, you will no longer be able to access these iFolders from any other computer."));
                int rc = dialog.Run();
                dialog.Hide();
                dialog.Destroy();

                if ((ResponseType)rc == ResponseType.Cancel)
                {
                    // Uncheck the Remove iFolders from Server checkbox
                    cbutton.Active = false;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Event Handler for On realiz widget event
        /// </summary>
        protected void OnRealizeWidget(object o, EventArgs args)
        {
            // Select the first item in the TreeView
            if (ConflictTreeView.Selection != null)
            {
                ConflictTreeView.Selection.SelectPath(new TreePath("0"));
            }

            // If the user is a read-only member of this iFolder, let them know
            // that the	only way they can resolve conflicts is by saving the
            // server version.
            if (ifolder.CurrentUserRights == "ReadOnly")
            {
                iFolderMsgDialog dg = new iFolderMsgDialog(
                    this,
                    iFolderMsgDialog.DialogType.Warning,
                    iFolderMsgDialog.ButtonSet.Ok,
                    "",
                    Util.GS("You have read only access"),
                    Util.GS("Your ability to resolve conflicts is limited because you have read-only access to this iFolder.  Name conflicts must be renamed locally.  File conflicts will be overwritten by the version of the file on the server."));
                dg.Run();
                dg.Hide();
                dg.Destroy();
            }
        }
 public void OnDefaultAccountToggled(object o, EventArgs args)
 {
     if (DefaultAccountButton.HasFocus)
        {
     if (!DefaultAccountButton.Active) return;
     try
     {
      domainController.SetDefaultDomain(domain.ID);
     }
     catch (Exception e)
     {
      iFolderMsgDialog dg = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("Could not make this account the default"),
       Util.GS("There was an error making this account the default."),
       e.Message);
      dg.Run();
      dg.Hide();
      dg.Destroy();
      DefaultAccountButton.Toggled -= new EventHandler(OnDefaultAccountToggled);
      DefaultAccountButton.Active = !DefaultAccountButton.Active;
      DefaultAccountButton.Toggled -= new EventHandler(OnDefaultAccountToggled);
     }
        }
 }
Esempio n. 4
0
        //never used
        /// <summary>
        /// Event Handler for Cancel Button Clicked Event
        /// </summary>

/*        private void OnCancelClicked(object o, EventArgs args)
 *              {
 *                      this.Destroy();
 *                      this.MergePath = null;
 *                      this.Cancelled = true;
 *              }*/

        /// <summary>
        /// Event Handler on MIgrate Account event
        /// </summary>
        private void OnMigrateAccount(object o, EventArgs args)
        {
            TreeSelection tSelect = AccTreeView.Selection;

            if (tSelect.CountSelectedRows() == 1)
            {
                TreeModel tModel;
                TreeIter  iter;

                tSelect.GetSelected(out tModel, out iter);
                string id = (string)tModel.GetValue(iter, 0);

/*				string status = GetEncryptionStatus(id);
 *                              bool stat = false;;
 *                              if( status == null)
 *                                      stat = false;
 *                              else if( status == "BLWF")
 *                                      stat = true;
 *                              else
 *                                      stat = false;*/
                String Location = GetHomeLocation(id);
                this.UserName = GetName(id);
                DirectoryInfo dir = new DirectoryInfo(Location);
                if (dir.Exists == true && dir.Name != this.iFolderName)
                {
                    // Prompt for renaming...
                    iFolderMsgDialog dlg = new iFolderMsgDialog(null, iFolderMsgDialog.DialogType.Info, iFolderMsgDialog.ButtonSet.YesNo,
                                                                Util.GS("Migration Alert"), Util.GS("The name of the iFolder on the server and on your local machine are different."), Util.GS("Do you want to rename the iFolder on the server to the name of iFolder on your local machine?"));
                    int res = dlg.Run();
                    dlg.Hide();
                    dlg.Destroy();
                    if (res == (int)ResponseType.No)
                    {
                        this.MergePath = null;
                        this.Cancelled = true;
                    }
                    else
                    {
                        // Move this to the name as that on the server...
                        this.MergePath = System.IO.Path.Combine(dir.Parent.FullName, this.iFolderName);
                        try
                        {
                            dir.MoveTo(this.MergePath);
                        }
                        catch (Exception ex)
                        {
                            iFolderMsgDialog dlg1 = new iFolderMsgDialog(null, iFolderMsgDialog.DialogType.Error, iFolderMsgDialog.ButtonSet.Ok, Util.GS("Migration Alert"), Util.GS("The folder cannot be renamed"), Util.GS("Error: " + ex.Message));
                            dlg1.Run();
                            dlg1.Hide();
                            dlg1.Destroy();
                            this.MergePath = null;
                        }
                    }
                }
                else
                {
                    this.MergePath = GetHomeLocation(id);
                }
            }
        }
Esempio n. 5
0
        public void OnEnableAccountToggled(object o, EventArgs args)
        {
            if (EnableAccountButton.HasFocus)
            {
                if (EnableAccountButton.Active != domain.Active)
                {
                    try
                    {
                        if (EnableAccountButton.Active)
                        {
                            domainController.ActivateDomain(domain.ID);
                        }
                        else
                        {
                            domainController.InactivateDomain(domain.ID);

                            // Also cause this account to be logged out
//							domainController.LogoutDomain(domain.ID);
//							domain.Authenticated = false;
                        }
                    }
                    catch (Exception e)
                    {
                        string header;
                        string message;

                        if (EnableAccountButton.Active)
                        {
                            header  = Util.GS("Could not enable this account");
                            message = Util.GS("There was an error enabling this account.");
                        }
                        else
                        {
                            header  = Util.GS("Could not disable this account");
                            message = Util.GS("There was an error disabling this account.");
                        }

                        // FIXME: Register this as a modal window
                        iFolderMsgDialog dg = new iFolderMsgDialog(
                            this,
                            iFolderMsgDialog.DialogType.Error,
                            iFolderMsgDialog.ButtonSet.Ok,
                            "",
                            header,
                            message,
                            e.Message);
                        dg.Run();
                        dg.Hide();
                        dg.Destroy();

                        // Change the toggle button back to its original value
                        EnableAccountButton.Toggled -= new EventHandler(OnEnableAccountToggled);
                        EnableAccountButton.Active   = !EnableAccountButton.Active;
                        EnableAccountButton.Toggled -= new EventHandler(OnEnableAccountToggled);
                    }
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Default constructor for iFolderAccountsPage
        /// </summary>
        public PrefsAccountsPage(Gtk.Window topWindow)
            : base()
        {
            this.topLevelWindow = topWindow;
            this.simiasManager  = Util.GetSimiasManager();
            string localServiceUrl = simiasManager.WebServiceUri.ToString();

            ifws     = new iFolderWebService();
            ifws.Url = localServiceUrl + "/iFolder.asmx";
            LocalService.Start(ifws, simiasManager.WebServiceUri, simiasManager.DataPath);

            this.simws = new SimiasWebService();
            simws.Url  = simiasManager.WebServiceUri.ToString() +
                         "/Simias.asmx";
            LocalService.Start(simws, simiasManager.WebServiceUri, simiasManager.DataPath);
            ClientUpgradeDialog = null;

            this.ClientUpgradeStatus = null;
            this.NewClientVersion    = null;
            this.NewClientDomainID   = null;

            curDomains = new Hashtable();

            removedDomains = new Hashtable();

            InitializeWidgets();

            domainProviderUI = DomainProviderUI.GetDomainProviderUI();

            domainController = DomainController.GetDomainController();
            if (domainController != null)
            {
                domainController.DomainAdded +=
                    new DomainAddedEventHandler(OnDomainAddedEvent);
                domainController.DomainDeleted +=
                    new DomainDeletedEventHandler(OnDomainDeletedEvent);
                domainController.DomainLoggedIn +=
                    new DomainLoggedInEventHandler(OnDomainLoggedInEvent);
                domainController.DomainLoggedOut +=
                    new DomainLoggedOutEventHandler(OnDomainLoggedOutEvent);
                domainController.DomainActivated +=
                    new DomainActivatedEventHandler(OnDomainActivatedEvent);
                domainController.DomainInactivated +=
                    new DomainInactivatedEventHandler(OnDomainInactivatedEvent);
                domainController.NewDefaultDomain +=
                    new DomainNewDefaultEventHandler(OnNewDefaultDomainEvent);
                domainController.DomainInGraceLoginPeriod +=
                    new DomainInGraceLoginPeriodEventHandler(OnDomainInGraceLoginPeriodEvent);
                domainController.DomainClientUpgradeAvailable +=
                    new DomainClientUpgradeAvailableEventHandler(OnClientUpgradeAvailableEvent);
            }

            detailsDialogs = new Hashtable();

            this.Realized += new EventHandler(OnRealizeWidget);
        }
Esempio n. 7
0
        /// <summary>
        /// Display RA List
        /// </summary>
        private void DisplayRAList()
        {
            bool IsComboBoxEmpty = true;

            try
            { string domainID = this.Domain;
              if (RAList != null)
              {
                  for (int i = RAList.Length; i >= 0; i--)
                  {
                      recoveryAgentCombo.RemoveText(i);
                  }
              }
              DomainController domController = DomainController.GetDomainController();
              Debug.PrintLine(string.Format("domain id is: {0}", domainID));
              RAList = domController.GetRAList(domainID);
              try{
                  this.ifws.ChangePassword(domainID, null, null);
                  recoveryAgentCombo.AppendText(Util.GS("Server_Default"));
                  IsComboBoxEmpty = false;
              }
              catch { }

              if (RAList != null)
              {
                  foreach (string raagent in RAList)
                  {
                      recoveryAgentCombo.AppendText(raagent);
                      IsComboBoxEmpty = false;
                  }
              }
              else
              {
                  Debug.PrintLine("No recovery agent present");
              }

              if (!IsComboBoxEmpty)
              {
                  recoveryAgentCombo.Active = 0;
              }
            }
            catch (Exception e)
            {
                Debug.PrintLine(String.Format("Server went down : {0},{1}", e.Message, e.StackTrace));
                iFolderMsgDialog dialog = new iFolderMsgDialog(null, iFolderMsgDialog.DialogType.Error,
                                                               iFolderMsgDialog.ButtonSet.None,
                                                               Util.GS("Change Passphrase"),
                                                               Util.GS("Unable to change the Passphrase"),
                                                               Util.GS("Please try again"));
                dialog.Run();
                dialog.Hide();
                dialog.Destroy();
                dialog = null;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Show the enter password dialog box
        /// </summary>
        /// <param name="acct"></param>
        /// <returns>true if password matches</returns>
        static public bool ShowEnterPasswordDialog(UserAccount acct)
        {
            int  result;
            bool status = false;

            EnterPasswordDialog epd = new EnterPasswordDialog(acct);

            if (!Util.RegisterModalWindow(epd))
            {
                epd.Destroy();
                epd = null;
                return(false);
            }
            do
            {
                result = epd.Run();
                if (result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent)
                {
                    iFolderMsgDialog dg = new iFolderMsgDialog(
                        epd,
                        iFolderMsgDialog.DialogType.Warning,
                        iFolderMsgDialog.ButtonSet.YesNo,
                        Util.GS("No Password"),
                        Util.GS("Entering password is cancelled"),
                        Util.GS("If password is not provided, Automatic Account creation will fail. Do you want to continue?"));
                    int rc = dg.Run();
                    dg.Hide();
                    dg.Destroy();
                    if ((ResponseType)rc == ResponseType.Yes)
                    {
                        break;
                    }
                }
            }while(result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent);

            if (result == (int)ResponseType.Ok)
            {
                acct.Password         = epd.PasswordText;
                acct.RememberPassword = epd.SavePassword;
                status = true;
            }
            else
            {
                status = false;
            }
            epd.Hide();
            epd.Destroy();
            return(status);
        }
Esempio n. 9
0
        public void OnDomainInGraceLoginPeriodEvent(object sender, DomainInGraceLoginPeriodEventArgs args)
        {
            DomainInformation dom = domainController.GetDomain(args.DomainID);
            iFolderMsgDialog  dg  =
                new iFolderMsgDialog(
                    topLevelWindow,
                    iFolderMsgDialog.DialogType.Error,
                    iFolderMsgDialog.ButtonSet.Ok,
                    dom != null ? dom.Name : "",
                    Util.GS("Your password has expired"),
                    string.Format(Util.GS("You have {0} grace logins remaining."), args.RemainingGraceLogins));

            dg.Run();
            dg.Hide();
            dg.Destroy();
        }
Esempio n. 10
0
 public PrefsAccountsPage( Gtk.Window topWindow )
     : base()
 {
     this.topLevelWindow = topWindow;
        this.simiasManager = Util.GetSimiasManager();
        string localServiceUrl = simiasManager.WebServiceUri.ToString();
        ifws = new iFolderWebService();
        ifws.Url = localServiceUrl + "/iFolder.asmx";
        LocalService.Start(ifws, simiasManager.WebServiceUri, simiasManager.DataPath);
        this.simws = new SimiasWebService();
        simws.Url = simiasManager.WebServiceUri.ToString() +
      "/Simias.asmx";
        LocalService.Start(simws, simiasManager.WebServiceUri, simiasManager.DataPath);
        ClientUpgradeDialog = null;
        this.ClientUpgradeStatus = null;
        this.NewClientVersion = null;
        this.NewClientDomainID = null;
        curDomains = new Hashtable();
        removedDomains = new Hashtable();
        InitializeWidgets();
        domainProviderUI = DomainProviderUI.GetDomainProviderUI();
        domainController = DomainController.GetDomainController();
        if (domainController != null)
        {
     domainController.DomainAdded +=
      new DomainAddedEventHandler(OnDomainAddedEvent);
     domainController.DomainDeleted +=
      new DomainDeletedEventHandler(OnDomainDeletedEvent);
     domainController.DomainLoggedIn +=
      new DomainLoggedInEventHandler(OnDomainLoggedInEvent);
     domainController.DomainLoggedOut +=
      new DomainLoggedOutEventHandler(OnDomainLoggedOutEvent);
     domainController.DomainActivated +=
      new DomainActivatedEventHandler(OnDomainActivatedEvent);
     domainController.DomainInactivated +=
      new DomainInactivatedEventHandler(OnDomainInactivatedEvent);
     domainController.NewDefaultDomain +=
      new DomainNewDefaultEventHandler(OnNewDefaultDomainEvent);
     domainController.DomainInGraceLoginPeriod +=
      new DomainInGraceLoginPeriodEventHandler(OnDomainInGraceLoginPeriodEvent);
     domainController.DomainClientUpgradeAvailable +=
      new DomainClientUpgradeAvailableEventHandler(OnClientUpgradeAvailableEvent);
        }
        detailsDialogs = new Hashtable();
        this.Realized += new EventHandler(OnRealizeWidget);
 }
Esempio n. 11
0
        /// <summary>
        /// Save Password
        /// </summary>
        /// <returns>true on success</returns>
        private bool SavePassword()
        {
            string password = PasswordEntry.Text;

            bPasswordChanged = false;

            password = password.Trim();

            try
            {
                if (password.Length > 0)
                {
                    domainController.SetDomainPassword(domain.ID, password);
                }
                else
                {
                    domainController.ClearDomainPassword(domain.ID);
                }
            }
            catch (Exception e)
            {
                // FIXME: Register this as a modal window
                iFolderMsgDialog dg = new iFolderMsgDialog(
                    this,
                    iFolderMsgDialog.DialogType.Error,
                    iFolderMsgDialog.ButtonSet.Ok,
                    "",
                    Util.GS("Unable to modify the password"),
                    Util.GS("An error was encountered while attempting to modify the password."),
                    e.Message);
                dg.Run();
                dg.Hide();
                dg.Destroy();

                // Reset the password to its original value
                PasswordEntry.Changed -= new EventHandler(OnPasswordChanged);
                PasswordEntry.Text     = domainController.GetDomainPassword(domain.ID);
                PasswordEntry.Changed += new EventHandler(OnPasswordChanged);

                return(false);
            }

            return(true);
        }
Esempio n. 12
0
        private void OnResetClicked(object o, EventArgs args)
        {
            if (newPassword.Text == oldPassword.Text)
            {
                string           Message = Util.GS("Old password and new password should not be same.");
                iFolderMsgDialog dialog  = new iFolderMsgDialog(
                    null,
                    iFolderMsgDialog.DialogType.Error,
                    iFolderMsgDialog.ButtonSet.None,
                    Util.GS("Error changing password"),
                    Message, null);
                dialog.Run();
                dialog.Hide();
                dialog.Destroy();
                dialog = null;
                return;
            }
            else if (newPassword.Text != confirmPassword.Text)
            {
                string           Message = Util.GS("New password and confirm password do not match.");
                iFolderMsgDialog dialog  = new iFolderMsgDialog(
                    null,
                    iFolderMsgDialog.DialogType.Error,
                    iFolderMsgDialog.ButtonSet.None,
                    Util.GS("Error changing password"),
                    Message, null);
                dialog.Run();
                dialog.Hide();
                dialog.Destroy();
                dialog = null;

                return;
            }
            if (this.GdkWindow != null)
            {
                this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Watch);
            }
            ResetPassword(this.Domain, this.OldPassword, this.NewPassword);
            if (this.GdkWindow != null)
            {
                this.GdkWindow.Cursor = null;
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Event handler for Add User
        /// </summary>
        private void OnAddUser(object o, EventArgs args)
        {
            bool SharingIsDisabled = ifws.GetDisableSharingPolicy(ifolder.CurrentUserID, ifolder.ID, ifolder.OwnerID, ifolder.DomainID);

            if (SharingIsDisabled == true)
            {
                UserSelector = new iFolderUserSelector(topLevelWindow,
                                                       simws,
                                                       ifolder.DomainID);
                if (!Util.RegisterModalWindow(UserSelector))
                {
                    try
                    {
                        Util.CurrentModalWindow.Present();
                    }
                    catch {}
                    UserSelector.Destroy();
                    return;
                }

                UserSelector.Response +=
                    new ResponseHandler(OnUserSelectorResponse);

                UserSelector.ShowAll();
            }
            else
            {
                iFolderMsgDialog dialog = new iFolderMsgDialog(
                    null,
                    iFolderMsgDialog.DialogType.Info,
                    iFolderMsgDialog.ButtonSet.Ok,
                    Util.GS("Policy Violation"),
                    Util.GS("Sharing is disabled so this iFolder can not be shared."), Util.GS(" "));
                dialog.Run();
                dialog.Hide();
                dialog.Destroy();
                return;
            }
        }
Esempio n. 14
0
        public void OnDefaultAccountToggled(object o, EventArgs args)
        {
            if (DefaultAccountButton.HasFocus)
            {
                // The DefaultAccountButton is not sensitive (enabled) if this
                // is the default account, so the only state that needs to be
                // handled here is when a user activates the check button.
                if (!DefaultAccountButton.Active)
                {
                    return;                                                     // This condition should never be hit
                }
                try
                {
                    domainController.SetDefaultDomain(domain.ID);
                }
                catch (Exception e)
                {
                    // FIXME: Register this as a modal window
                    iFolderMsgDialog dg = new iFolderMsgDialog(
                        this,
                        iFolderMsgDialog.DialogType.Error,
                        iFolderMsgDialog.ButtonSet.Ok,
                        "",
                        Util.GS("Could not make this account the default"),
                        Util.GS("There was an error making this account the default."),
                        e.Message);
                    dg.Run();
                    dg.Hide();
                    dg.Destroy();

                    // Change the toggle button back to its original value
                    DefaultAccountButton.Toggled -= new EventHandler(OnDefaultAccountToggled);
                    DefaultAccountButton.Active   = !DefaultAccountButton.Active;
                    DefaultAccountButton.Toggled -= new EventHandler(OnDefaultAccountToggled);
                }
            }
        }
Esempio n. 15
0
        /// <summary>
        /// Logout
        /// </summary>
        /// <param name="dom">Domain Information</param>
        public void LogoutDomain(DomainInformation dom)
        {
            try
            {
                domainController.LogoutDomain(dom.ID);

                dom.Authenticated = false;

                // In the new accounts model, when a user makes an
                // account go offline, we should also disable the account.
//				if (dom.Active)
//				{
//					domainController.InactivateDomain(dom.ID);
//					UpdateDomainStatus(dom.ID);
//				}
//				else
//				{
                //UpdateDomainStatus(dom.ID);
                iFolderData ifdata = iFolderData.GetData();
                ifdata.Refresh();
//				}
            }
            catch (Exception)
            {
                iFolderMsgDialog dg = new iFolderMsgDialog(
                    topLevelWindow,
                    iFolderMsgDialog.DialogType.Error,
                    iFolderMsgDialog.ButtonSet.Ok,
                    "",
                    Util.GS("Unable to log out of the iFolder Server"),
                    Util.GS("An error was encountered while logging out of the iFolder Server.  If the problem persists, please contact your network administrator."));
                dg.Run();
                dg.Hide();
                dg.Destroy();
            }
        }
Esempio n. 16
0
 private void RemoveSelectedFolderHandler()
 {
     iFolderHolder holder = iFoldersIconView.SelectedFolder;
        if (holder != null)
        {
     iFolderMsgDialog dialog = new iFolderMsgDialog(
      this,
      iFolderMsgDialog.DialogType.Question,
      iFolderMsgDialog.ButtonSet.YesNo,
      "",
      Util.GS("Revert this iFolder back to a normal folder?"),
      Util.GS("The folder will still be on your computer, but it will no longer synchronize with the iFolder Server."));
     CheckButton deleteFromServerCB;
     DomainInformation domain =
      domainController.GetDomain(holder.iFolder.DomainID);
     if (domain == null || domain.MemberUserID == holder.iFolder.OwnerID)
      deleteFromServerCB = new CheckButton(Util.GS("Also _delete this iFolder from the server"));
     else
      deleteFromServerCB = new CheckButton(Util.GS("Also _remove my membership from this iFolder"));
     dialog.ExtraWidget = deleteFromServerCB;
     int rc = dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     if(rc == -8)
     {
      try
      {
       iFolderHolder subHolder =
        ifdata.RevertiFolder(holder.iFolder.ID);
       if (deleteFromServerCB.Active)
       {
        if (subHolder == null)
     ifdata.DeleteiFolder(holder.iFolder.ID);
        else
     ifdata.DeleteiFolder(subHolder.iFolder.ID);
       }
       iFoldersIconView.UnselectAll();
      }
      catch(Exception e)
      {
       iFolderExceptionDialog ied =
        new iFolderExceptionDialog(
     this,
     e);
       ied.Run();
       ied.Hide();
       ied.Destroy();
      }
      UpdateSensitivity();
     }
        }
 }
 private bool SaveServerAddress()
 {
     string serverAddress = ServerAddressEntry.Text;
        string username = domain.MemberName;
        string password = domainController.GetDomainPassword(domain.ID);
        bServerAddressChanged = false;
        bool bHostAddressUpdated = false;
        if (serverAddress == null || serverAddress.Trim().Length == 0)
        {
     iFolderMsgDialog dg =
      new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("Server address cannot be empty"),
       Util.GS("Please enter an address for the server."));
     dg.Run();
     dg.Hide();
     dg.Destroy();
     ServerAddressEntry.Changed -= new EventHandler(OnServerAddressChanged);
     ServerAddressEntry.Text = GetHostUrl(domain.HostUrl);
     ServerAddressEntry.Changed += new EventHandler(OnServerAddressChanged);
     return bHostAddressUpdated;
        }
        if (password == null || password.Trim().Length == 0)
        {
     Entry tempPasswordEntry = new Entry();
     tempPasswordEntry.Visibility = false;
     iFolderMsgDialog dg =
      new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Info,
       iFolderMsgDialog.ButtonSet.OkCancel,
       "",
       Util.GS("Please enter your password"),
       Util.GS("Your password is required to change the address of the server."));
     dg.ExtraWidget = tempPasswordEntry;
     tempPasswordEntry.GrabFocus();
     tempPasswordEntry.ActivatesDefault = true;
     dg.TransientFor = this;
     int rc = dg.Run();
     password = tempPasswordEntry.Text;
     dg.Hide();
     dg.Destroy();
     if ((ResponseType)rc == ResponseType.Cancel)
     {
      ServerAddressEntry.Changed -= new EventHandler(OnServerAddressChanged);
      ServerAddressEntry.Text = GetHostUrl(domain.HostUrl);
      ServerAddressEntry.Changed += new EventHandler(OnServerAddressChanged);
      return bHostAddressUpdated;
     }
     if (password == null || password.Trim().Length == 0)
     {
      ServerAddressEntry.Changed -= new EventHandler(OnServerAddressChanged);
      ServerAddressEntry.Text = GetHostUrl(domain.HostUrl);
      ServerAddressEntry.Changed += new EventHandler(OnServerAddressChanged);
      return bHostAddressUpdated;
     }
        }
        serverAddress = serverAddress.Trim();
        Exception hostAddressUpdateException = null;
        try
        {
     if (domainController.UpdateDomainHostAddress(domain.ID, serverAddress, username, password) != null)
     {
      bHostAddressUpdated = true;
     }
        }
        catch(Exception e)
        {
     hostAddressUpdateException = e;
        }
        if (!bHostAddressUpdated)
        {
     iFolderMsgDialog dg = new iFolderMsgDialog(
      this,
      iFolderMsgDialog.DialogType.Error,
      iFolderMsgDialog.ButtonSet.Ok,
      "",
      Util.GS("Unable to modify the server address"),
      Util.GS("An error was encountered while attempting to modify the server address.  Please verify the address and your password are correct."),
      hostAddressUpdateException == null ? null : hostAddressUpdateException.Message);
     dg.Run();
     dg.Hide();
     dg.Destroy();
     ServerAddressEntry.Changed -= new EventHandler(OnServerAddressChanged);
     ServerAddressEntry.Text = GetHostUrl(domain.HostUrl);
     ServerAddressEntry.Changed += new EventHandler(OnServerAddressChanged);
        }
        return bHostAddressUpdated;
 }
Esempio n. 18
0
 private void OnIconViewDragDataReceived(object o, DragDataReceivedArgs args)
 {
     Console.WriteLine("OnIconViewDragDataReceived: {0}", (DragTargetType)args.Info);
        bool bFolderCreated = false;
        switch (args.Info)
        {
     case (uint) DragTargetType.iFolderID:
      string ifolderID =
       System.Text.Encoding.UTF8.GetString(args.SelectionData.Data);
      iFolderHolder holder = ifdata.GetAvailableiFolder(ifolderID);
      if (holder != null)
       DownloadiFolder(holder);
      break;
     case (uint) DragTargetType.UriList:
      UriList uriList = new UriList(args.SelectionData);
      if (uriList.Count == 1)
      {
       string path = uriList.ToLocalPaths()[0];
        DomainInformation[] domains = domainController.GetDomains();
        if (domains.Length <= 0) return;
        string domainID = domains[0].ID;
        DomainInformation defaultDomain = domainController.GetDefaultDomain();
        if (defaultDomain != null)
     domainID = defaultDomain.ID;
        DragCreateDialog cd = new DragCreateDialog(this, domains, domainID, path);
        cd.TransientFor = this;
        int rc = 0;
        do
        {
     rc = cd.Run();
     cd.Hide();
     if (rc == (int)ResponseType.Ok)
     {
      try
      {
       string selectedFolder = cd.iFolderPath.Trim();
       string selectedDomain = cd.DomainID;
       string parentDir = System.IO.Path.GetDirectoryName( selectedFolder );
       if ( ( parentDir == null ) || ( parentDir == String.Empty ) )
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("An invalid folder was specified"));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       iFolderHolder ifHolder = null;
       try
       {
        ifHolder =
     ifdata.CreateiFolder(selectedFolder,
       selectedDomain);
       }
       catch(Exception e)
       {
        if (DisplayCreateOrSetupException(e))
        {
     continue;
        }
       }
       if(ifHolder == null)
        throw new Exception("Simias returned null");
       rc = 0;
       Util.LastCreatedPath = ifHolder.iFolder.UnManagedPath;
       if(ClientConfig.Get(ClientConfig.KEY_SHOW_CREATION,
       "true") == "true")
       {
        iFolderCreationDialog dlg =
     new iFolderCreationDialog(ifHolder.iFolder);
        dlg.TransientFor = this;
        int createRC;
        do
        {
     createRC = dlg.Run();
     if(createRC == (int)Gtk.ResponseType.Help)
     {
      Util.ShowHelp("myifolders.html", this);
     }
        }while(createRC != (int)Gtk.ResponseType.Ok);
        dlg.Hide();
        if(dlg.HideDialog)
        {
     ClientConfig.Set(
      ClientConfig.KEY_SHOW_CREATION, "false");
        }
        cd.Destroy();
        cd = null;
       }
      }
      catch (Exception e)
      {
       Console.WriteLine(e.Message);
       continue;
      }
     }
        }
        while(rc == (int)ResponseType.Ok);
      }
      break;
     default:
      break;
        }
        Gtk.Drag.Finish (args.Context, bFolderCreated, false, args.Time);
 }
 private void OnRemoveUser(object o, EventArgs args)
 {
     TreeModel tModel;
        TreeSelection tSelect = UserTreeView.Selection;
        if(tSelect.CountSelectedRows() > 0)
        {
     iFolderMsgDialog dialog = new iFolderMsgDialog(
      topLevelWindow,
      iFolderMsgDialog.DialogType.Question,
      iFolderMsgDialog.ButtonSet.YesNo,
      "",
      Util.GS("Remove the selected users?"),
      Util.GS("This will remove the selected users from this iFolder.  They will no longer be able to synchronize files with this iFolder."));
     int rc = dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     if(rc == -8)
     {
      Queue iterQueue;
      Array treePaths = tSelect.GetSelectedRows(out tModel);
      iterQueue = new Queue();
      foreach(TreePath tPath in treePaths)
      {
       TreeIter iter;
       if(UserTreeStore.GetIter(out iter, tPath))
       {
        iterQueue.Enqueue(iter);
       }
      }
      while(iterQueue.Count > 0)
      {
       TreeIter iter = (TreeIter) iterQueue.Dequeue();
       iFolderUser user =
     (iFolderUser) tModel.GetValue(iter, 0);
       try
       {
        ifws.RemoveiFolderUser(ifolder.ID,
      user.UserID);
        UserTreeStore.Remove(ref iter);
        curUsers.Remove(user.UserID);
       }
       catch(Exception e)
       {
        iFolderExceptionDialog ied =
      new iFolderExceptionDialog(
        topLevelWindow, e);
        ied.Run();
        ied.Hide();
        ied.Destroy();
        ied = null;
       }
      }
     }
        }
 }
Esempio n. 20
0
        private void ResetPassword(string domainid, string oldpassword, string newpassword)
        {
            try{
                this.passwordChangeStatus = this.ifws.ChangePassword(domainid, oldpassword, newpassword);
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                if (ex.Message.IndexOf("Server did not recognize the value of HTTP header SOAPAction") != -1)
                {
                    this.passwordChangeStatus = (int)ResetPasswordStatus.NotSupportedServerOld;
                }
            }
            catch { }

            if (this.passwordChangeStatus == 0)
            {
                try
                {
                    DomainController domainController = DomainController.GetDomainController();
                    domainController.LogoutDomain(domainid);
                }
                catch { }
                this.status = true;
            }

            if (this.passwordChangeStatus != 0)
            {
                string Message = Util.GS("Could not change password, ");
                switch (this.passwordChangeStatus)
                {
                case (int)ResetPasswordStatus.IncorrectOldPassword:
                    Message += Util.GS("Incorrect old password.");
                    break;

                case (int)ResetPasswordStatus.FailedToResetPassword:
                    Message += Util.GS("Failed to reset password.");
                    break;

                case (int)ResetPasswordStatus.LoginDisabled:
                    Message += Util.GS("Login disabled.");
                    break;

                case (int)ResetPasswordStatus.UserAccountExpired:
                    Message += Util.GS("User account expired.");
                    break;

                case (int)ResetPasswordStatus.UserCannotChangePassword:
                    Message += Util.GS("User can not change password.");
                    break;

                case (int)ResetPasswordStatus.UserPasswordExpired:
                    Message += Util.GS("User password expired.");
                    break;

                case (int)ResetPasswordStatus.MinimumPasswordLengthExcceded:
                    Message += Util.GS("Minimum password length restriction not met.");
                    break;

                case (int)ResetPasswordStatus.UserNotFoundInSimias:
                    Message += Util.GS("User not found in simias.");
                    break;

                case (int)ResetPasswordStatus.NoLoggedInDomainsPasswordText:
                    Message += Util.GS("For changing password the domain should be connected. Log on to the domain and try.");
                    break;

                case (int)ResetPasswordStatus.NotSupportedServerOld:
                    Message += Util.GS("This operation is not supported on the current version of the iFolder server. To perform this operation, you must upgrade to the latest version of iFolder server.");
                    break;

                default:
                    Message = "Error while changing the password.";
                    break;
                }
                iFolderMsgDialog dialog = new iFolderMsgDialog(
                    null,
                    iFolderMsgDialog.DialogType.Error,
                    iFolderMsgDialog.ButtonSet.None,
                    Util.GS("Change password"),
                    Message, null);
                dialog.Run();
                dialog.Hide();
                dialog.Destroy();
                dialog = null;
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Event Handler for Reset Clicked
        /// </summary>
        private void OnResetClicked(object o, EventArgs args)
        {
            Debug.PrintLine("Reset clicked");
            string publicKey = null;
            bool   reset     = false;

            try
            {
                if (this.GdkWindow != null)
                {
                    this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Watch);
                }
                DomainController domainController = DomainController.GetDomainController();

                Status passphraseStatus = simws.ValidatePassPhrase(this.Domain, this.OldPassphrase);
                if (passphraseStatus != null)
                {
                    iFolderMsgDialog dialog = null;
                    if (passphraseStatus.statusCode == StatusCodes.PassPhraseInvalid)                      // check for invalid passphrase
                    {
                        dialog = new iFolderMsgDialog(
                            null,
                            iFolderMsgDialog.DialogType.Error,
                            iFolderMsgDialog.ButtonSet.None,
                            Util.GS("Invalid PassPhrase"),
                            Util.GS("The Current PassPhrase entered is not valid"),
                            Util.GS("Please enter the passphrase again"));
                    }
                    else if (passphraseStatus.statusCode == StatusCodes.ServerUnAvailable)
                    {
                        dialog = new iFolderMsgDialog(
                            null,
                            iFolderMsgDialog.DialogType.Info,
                            iFolderMsgDialog.ButtonSet.None,
                            Util.GS("No Logged-In domains"),
                            Util.GS("There are no logged-in domains for changing the passphrase."),
                            Util.GS("For changing passphrase the domain should be connected. Log on to the domain and try."));
                    }

                    if (dialog != null)
                    {
                        dialog.Run();
                        dialog.Hide();
                        dialog.Destroy();
                        dialog = null;
                        return;
                    }
                }
                if (this.RAName != "DEFAULT")
                {
                    byte [] RACertificateObj = domainController.GetRACertificate(this.Domain, this.RAName);
                    if (RACertificateObj != null && RACertificateObj.Length != 0)
                    {
                        System.Security.Cryptography.X509Certificates.X509Certificate Cert =
                            new System.Security.Cryptography.X509Certificates.X509Certificate(RACertificateObj);
                        CertificateDialog dlg = new CertificateDialog(Cert.ToString(true));
                        if (!Util.RegisterModalWindow(dlg))
                        {
                            dlg.Destroy();
                            dlg = null;
                            return;
                        }
                        int res = dlg.Run();
                        dlg.Hide();
                        dlg.Destroy();
                        dlg = null;
                        if (res == (int)ResponseType.Ok)
                        {
                            publicKey = Convert.ToBase64String(Cert.GetPublicKey());
                            Debug.PrintLine(String.Format(" The public key is: {0}", publicKey));
                            reset = true;
                        }
                        else
                        {
                            reset = false;
                            Debug.PrintLine("Response type is not ok");
                            return;
                        }
                    }
                }
                else
                {
                    DomainInformation domainInfo = (DomainInformation)this.simws.GetDomainInformation(this.Domain);

                    string memberUID = domainInfo.MemberUserID;

                    publicKey = this.ifws.GetDefaultServerPublicKey(this.Domain, memberUID);
                    reset     = true;
                }
                if (reset == true)
                {
                    try
                    {
                        status = domainController.ReSetPassphrase(this.Domain,
                                                                  this.OldPassphrase,
                                                                  this.NewPassphrase,
                                                                  this.RAName, publicKey);

                        //clear the values
                        simws.StorePassPhrase(this.Domain, "", CredentialType.None, false);
                        //set the values

                        simws.StorePassPhrase(this.Domain, this.NewPassphrase, CredentialType.Basic, this.SavePassphrase);
                    }
                    catch (Exception ex)
                    {
                        //add client debug log here
                        throw ex;
                    }
                }
                if (status == false)
                {
                    iFolderMsgDialog dialog = new iFolderMsgDialog(
                        null,
                        iFolderMsgDialog.DialogType.Error,
                        iFolderMsgDialog.ButtonSet.None,
                        Util.GS("Change Passphrase"),
                        Util.GS("Unable to change the Passphrase"),
                        Util.GS("Please try again"));
                    dialog.Run();
                    dialog.Hide();
                    dialog.Destroy();
                    dialog = null;
                }
            }
            catch (Exception e)
            {
                Debug.PrintLine(String.Format("Exception in reset passphrase : {0}", e.Message));
            }
            if (this.GdkWindow != null)
            {
                this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Watch);
            }
        }
 protected void OnRealizeWidget(object o, EventArgs args)
 {
     if (ConflictTreeView.Selection != null)
        {
     ConflictTreeView.Selection.SelectPath(new TreePath("0"));
        }
        if (ifolder.CurrentUserRights == "ReadOnly")
        {
     iFolderMsgDialog dg = new iFolderMsgDialog(
      this,
      iFolderMsgDialog.DialogType.Warning,
      iFolderMsgDialog.ButtonSet.Ok,
      "",
      Util.GS("You have read only access"),
      Util.GS("Your ability to resolve conflicts is limited because you have read-only access to this iFolder.  Name conflicts must be renamed locally.  File conflicts will be overwritten by the version of the file on the server."));
     dg.Run();
     dg.Hide();
     dg.Destroy();
        }
 }
Esempio n. 23
0
 private void ExportClicked( object o, EventArgs args)
 {
     ExportKeysDialog export = new ExportKeysDialog(ifws, simws);
        export.TransientFor = this;
        int res = export.Run();
        string fileName = export.FileName;
        string domainID = export.Domain;
        export.Hide();
        export.Destroy();
        if( res == (int)ResponseType.Ok)
        {
     try
     {
      this.simws.ExportiFoldersCryptoKeys(domainID, fileName);
      iFolderMsgDialog dialog = new iFolderMsgDialog(
      null,
      iFolderMsgDialog.DialogType.Info,
      iFolderMsgDialog.ButtonSet.None,
      Util.GS("Export Encrypted Keys"), Util.GS("Successfully exported the keys."),
      Util.GS("File name:")+fileName);
      dialog.Run();
      dialog.Hide();
      dialog.Destroy();
      dialog = null;
     }
     catch(Exception ex)
     {
      iFolderMsgDialog dialog = new iFolderMsgDialog(
       null,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.None,
       Util.GS("Export Encrypted Keys"),
       Util.GS(ex.Message),
       Util.GS(""));
       dialog.Run();
       dialog.Hide();
       dialog.Destroy();
       dialog = null;
     }
        }
        else if( res == (int)ResponseType.Help)
        {
     Util.ShowHelp("managingpassphrse.html", this);
        }
 }
Esempio n. 24
0
 private void ImportClicked( object o, EventArgs args)
 {
     DomainInformation[] domains = this.domainController.GetLoggedInDomains();
        if( domains == null)
        {
     iFolderMsgDialog dialog = new iFolderMsgDialog(
                                                                                                         null,
                                                                                                         iFolderMsgDialog.DialogType.Error,
                                                                                                         iFolderMsgDialog.ButtonSet.None,
                                                                                                         Util.GS("No Logged-In domains"),
                                                                                                         Util.GS("There are no logged-in domains for importing keys."),
                                                                                                         Util.GS("For importing keys the domain should be connected. Log on to the domain and try."));
      dialog.Run();
                          dialog.Hide();
                          dialog.Destroy();
                          dialog = null;
      return;
     }
        ImportKeysDialog import = new ImportKeysDialog(ifws, simws);
        import.TransientFor = this;
        int result = import.Run();
        string fileName = import.FileName;
        string domainID = import.Domain;
        string OneTimePassphrase = import.OneTimePP;
        string NewPassphrase = import.PassPhrase;
        import.Hide();
        import.Destroy();
        if( result == (int)ResponseType.Ok)
        {
     try
     {
      this.simws.ImportiFoldersCryptoKeys( domainID, NewPassphrase, OneTimePassphrase, fileName);
      bool rememberOption = this.simws.GetRememberOption(domainID);
      simws.StorePassPhrase(domainID, "", CredentialType.None, false);
      simws.StorePassPhrase(domainID, NewPassphrase, CredentialType.Basic, rememberOption);
      iFolderMsgDialog dialog = new iFolderMsgDialog(
      null,
      iFolderMsgDialog.DialogType.Info,
      iFolderMsgDialog.ButtonSet.None,
      Util.GS("Import Decrypted Keys"),
      Util.GS("Successfully imported the keys and changed the passphrase"),
      Util.GS("Use your new passphrase from now"));
      dialog.Run();
      dialog.Hide();
      dialog.Destroy();
      dialog = null;
     }
     catch(Exception)
     {
      iFolderMsgDialog dialog = new iFolderMsgDialog(
       null,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.None,
       Util.GS("Import Decrypted Keys"),
       Util.GS("Error importing the keys."),
       Util.GS(""));
       dialog.Run();
       dialog.Hide();
       dialog.Destroy();
       dialog = null;
     }
        }
        else if( result == (int)ResponseType.Help)
        {
     Util.ShowHelp("managingpassphrse.html", this);
        }
 }
Esempio n. 25
0
 private void DisplayLoginMesg()
 {
     iFolderMsgDialog dlg = new iFolderMsgDialog(null, iFolderMsgDialog.DialogType.Error, iFolderMsgDialog.ButtonSet.Ok,
      Util.GS("iFolder Error"), Util.GS("Error creating iFolder"),
      Util.GS("You should be logged-in to the domain for creating encrypted iFolders."));
        dlg.Run();
        dlg.Hide();
        dlg.Destroy();
 }
Esempio n. 26
0
 private void DownloadiFolder(iFolderHolder holder, bool merge)
 {
     if( holder.iFolder.encryptionAlgorithm != null && holder.iFolder.encryptionAlgorithm != "")
        {
     if( IsPassPhraseAvailable(holder.iFolder.DomainID) == false)
     {
      return;
     }
        }
        if (holder != null && holder.iFolder.IsSubscription)
        {
     string newPath = "";
     int rc = 0;
      if( holder.iFolder.MigratediFolder > 0 )
      {
       if( MigrationDialog.CanBeMigrated(holder.iFolder.Name) )
       {
        iFolderMsgDialog dlg = new iFolderMsgDialog( null, iFolderMsgDialog.DialogType.Info, iFolderMsgDialog.ButtonSet.OkCancel,
                                                                                         Util.GS("Migration Alert"), Util.GS("The iFolder you have selected for downloading is a migrated iFolder.") , Util.GS("There are 2.x iFolders on your local machine. Do you want to merge this iFolder with any of the 2.x iFolders?") );
        int res = dlg.Run();
        dlg.Hide();
        dlg.Destroy();
        if( res == (int)ResponseType.Ok)
        {
     bool cancelled = false;
     do
     {
      bool result = MergeWithLocaliFolder( holder, out cancelled);
      if( result == true || cancelled == true)
       return;
     }while(cancelled == false);
        }
       }
      }
     do
     {
      iFolderAcceptDialog iad =
      new iFolderAcceptDialog(holder.iFolder, Util.LastSetupPath, merge);
      iad.TransientFor = this;
      rc = iad.Run();
      newPath = ParseAndReplaceTildeInPath(iad.Path);
      iad.Hide();
      iad.Destroy();
      if(rc != -5)
      return;
      try
      {
       if(merge == true)
       {
        String folderPath = newPath;
        if( System.IO.Path.GetFileName(folderPath) != holder.iFolder.Name)
        {
     throw new Exception("FolderDoesNotExist");
        }
        if( ifws.IsiFolder(folderPath))
        {
     throw new Exception("AtOrInsideCollectionPath");
        }
       }
       if( merge )
       {
        ifdata.AcceptiFolderInvitation(
        holder.iFolder.ID,
        holder.iFolder.DomainID,
        newPath,
        merge);
       }
       else
       {
        string downloadpath = newPath;
        System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(downloadpath);
                                   if(dir.Name == holder.iFolder.Name)
        {
                                           downloadpath = System.IO.Directory.GetParent(newPath).ToString();
     dir = new System.IO.DirectoryInfo(downloadpath);
        }
                                   if( System.IO.Directory.Exists( downloadpath+"/"+holder.iFolder.Name))
                                   {
                                           iFolderMsgDialog DownloadMergeDialog = new iFolderMsgDialog(
                                           null,
                                           iFolderMsgDialog.DialogType.Info,
                                           iFolderMsgDialog.ButtonSet.OkCancel,
                                           Util.GS("A folder with the same name already exists."),
                                           string.Format(Util.GS("Click Ok to merge the folder or Cancel to select a different location")),null);
                                           int rc1 = DownloadMergeDialog.Run();
                                           DownloadMergeDialog.Hide();
                                           DownloadMergeDialog.Destroy();
                                           if ((ResponseType)rc1 == ResponseType.Ok)
                                    {
                                                   ifdata.AcceptiFolderInvitation( holder.iFolder.ID, holder.iFolder.DomainID, System.IO.Path.Combine(downloadpath,holder.iFolder.Name),true);
                                           }
     else
      continue;
        }
        else
                                           ifdata.AcceptiFolderInvitation( holder.iFolder.ID, holder.iFolder.DomainID, downloadpath);
       }
       if( ifolderlistview.Visible )
                         GLib.Idle.Add(UpdateListViewItemsMainThread); else
        iFoldersIconView.UnselectAll();
       rc = 0;
       Util.LastSetupPath = newPath;
      }
      catch(Exception e)
      {
      DisplayCreateOrSetupException(e);
      }
     }while(rc == -5);
        }
 }
Esempio n. 27
0
 private void CreateNewiFolder()
 {
     DomainInformation[] domains = domainController.GetDomains();
        if (domains.Length <= 0) return;
        string domainID = domains[0].ID;
        DomainInformation defaultDomain = domainController.GetDefaultDomain();
        if (defaultDomain != null)
     domainID = defaultDomain.ID;
        CreateDialog cd = new CreateDialog(this, domains, domainID, Util.LastCreatedPath, ifws);
        cd.TransientFor = this;
        int rc = 0;
        do
        {
     rc = cd.Run();
     cd.Hide();
     if (rc == (int)ResponseType.Ok)
     {
      try
      {
       string selectedFolder = cd.iFolderPath.Trim();
       string selectedDomain = cd.DomainID;
       bool SSL = cd.ssl;
       string algorithm = cd.EncryptionAlgorithm;
       if (selectedFolder == String.Empty)
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("An invalid folder was specified."));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       string parentDir = System.IO.Path.GetDirectoryName( selectedFolder );
       if ( ( parentDir == null ) || ( parentDir == String.Empty ) )
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("An invalid folder was specified"));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       if(ifws.GetLimitPolicyStatus(selectedDomain) != 1 )
                                         {
                                                 iFolderMsgDialog dg = new iFolderMsgDialog(
                                                         this,
                                                         iFolderMsgDialog.DialogType.Warning,
                                                         iFolderMsgDialog.ButtonSet.Ok,
                                                         "",
                                                         Util.GS("Error"),
                                                         Util.GS("Folder could not be created as you are exceeding the limit of ifolders set by your Administrator."));
                                                 dg.Run();
                                                 dg.Hide();
                                                 dg.Destroy();
                                                 continue;
                                         }
       string name = selectedFolder.Substring(parentDir.Length + 1);
       if (name == null || name == String.Empty)
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("The folder you've specified is invalid.  Please remove the trailing separator character (/) and try again."));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       selectedFolder = ParseAndReplaceTildeInPath(selectedFolder);
       iFolderHolder ifHolder = null;
       try
       {
        if( algorithm != null)
        {
     bool passPhraseStatus = false;
     bool passphraseStatus = false;
     DomainInformation domainInfo = domainController.GetDomain(selectedDomain);
     if( !domainInfo.Authenticated)
     {
      DisplayLoginMesg();
      continue;
     }
     try
     {
                       passphraseStatus = simws.IsPassPhraseSet(selectedDomain);
     }
     catch(Exception)
     {
      DisplayLoginMesg();
      continue;
     }
     if(passphraseStatus == true)
     {
      string passphrasecheck = simws.GetPassPhrase(selectedDomain);
      if( passphrasecheck == null || passphrasecheck =="")
      {
       Debug.PrintLine(" passphrase not entered at login");
       passPhraseStatus = ShowVerifyDialog(selectedDomain, simws);
      }
      else
      {
       passPhraseStatus = true;
      }
     }
     else
     {
      passPhraseStatus = ShowEnterPassPhraseDialog(selectedDomain, simws);
     }
     if( passPhraseStatus == false)
     {
      continue;
     }
        }
        ifHolder = ifdata.CreateiFolder(selectedFolder, selectedDomain, SSL, algorithm);
       }
       catch(Exception e)
       {
        if (DisplayCreateOrSetupException(e))
        {
     cd.iFolderPath = selectedFolder;
     continue;
        }
       }
       if(ifHolder == null)
        throw new Exception("Simias returned null");
       rc = 0;
       Util.LastCreatedPath = ifHolder.iFolder.UnManagedPath;
       if((bool)ClientConfig.Get(ClientConfig.KEY_SHOW_CREATION))
       {
        iFolderCreationDialog dlg =
     new iFolderCreationDialog(ifHolder.iFolder);
        dlg.TransientFor = this;
        int createRC;
        do
        {
     createRC = dlg.Run();
     if(createRC == (int)Gtk.ResponseType.Help)
     {
      Util.ShowHelp("myifolders.html", this);
     }
        }while(createRC != (int)Gtk.ResponseType.Ok);
        dlg.Hide();
        if(dlg.HideDialog)
        {
     ClientConfig.Set(
      ClientConfig.KEY_SHOW_CREATION, false);
        }
        cd.Destroy();
        cd = null;
       }
      }
      catch (Exception e)
      {
       Debug.PrintLine(e.Message);
       continue;
      }
     }
        }
        while(rc == (int)ResponseType.Ok);
     UpdateServerInfoForSelectedDomain();
 }
Esempio n. 28
0
 private static bool SetPassPhrase( EnterPassPhraseDialog epd, string DomainID, string publicKey, SimiasWebService simws )
 {
     bool status;
     Status passPhraseStatus = null;
       if(epd.RecoveryAgent != null && epd.RecoveryAgent != Util.GS("Server_Default"))
      passPhraseStatus = simws.SetPassPhrase( DomainID, epd.PassPhrase, epd.RecoveryAgent, publicKey);
      else
        passPhraseStatus = simws.SetPassPhrase( DomainID, epd.PassPhrase, "DEFAULT", publicKey);
     if(passPhraseStatus.statusCode == StatusCodes.Success)
     {
     status = true;
     simws.StorePassPhrase( DomainID, epd.PassPhrase, CredentialType.Basic, epd.ShouldSavePassPhrase);
     }
     else
     {
     status = false;
     iFolderMsgDialog dialog = new iFolderMsgDialog(
         null,
         iFolderMsgDialog.DialogType.Error,
         iFolderMsgDialog.ButtonSet.None,
         Util.GS("Error setting the PassPhrase"),
         Util.GS("Unable to set the passphrase"),
         Util.GS("Please try again"));
     dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     dialog = null;
     }
     return status;
 }
Esempio n. 29
0
        /// <summary>
        /// Event Handler for Remove User
        /// </summary>
        private void OnRemoveUser(object o, EventArgs args)
        {
            TreeModel tModel;

            TreeSelection tSelect = UserTreeView.Selection;

            if (tSelect.CountSelectedRows() > 0)
            {
                iFolderMsgDialog dialog = new iFolderMsgDialog(
                    topLevelWindow,
                    iFolderMsgDialog.DialogType.Question,
                    iFolderMsgDialog.ButtonSet.YesNo,
                    "",
                    Util.GS("Remove the selected users?"),
                    Util.GS("This will remove the selected users from this iFolder.  They will no longer be able to synchronize files with this iFolder."));
                int rc = dialog.Run();
                dialog.Hide();
                dialog.Destroy();
                if (rc == -8)
                {
                    Queue iterQueue;
                    Array treePaths = tSelect.GetSelectedRows(out tModel);

                    iterQueue = new Queue();

                    foreach (TreePath tPath in treePaths)
                    {
                        TreeIter iter;

                        if (UserTreeStore.GetIter(out iter, tPath))
                        {
                            iterQueue.Enqueue(iter);
                        }
                    }
                    // Now that we have all of the TreeIters, loop and
                    // remove them all
                    while (iterQueue.Count > 0)
                    {
                        TreeIter iter = (TreeIter)iterQueue.Dequeue();

                        iFolderUser user =
                            (iFolderUser)tModel.GetValue(iter, 0);

                        try
                        {
                            ifws.RemoveiFolderUser(ifolder.ID,
                                                   user.UserID);
                            UserTreeStore.Remove(ref iter);
                            curUsers.Remove(user.UserID);
                        }
                        catch (Exception e)
                        {
                            iFolderExceptionDialog ied =
                                new iFolderExceptionDialog(
                                    topLevelWindow, e);
                            ied.Run();
                            ied.Hide();
                            ied.Destroy();
                            ied = null;
                        }
                    }
                }
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Event handler for Access Clicked
        /// </summary>
        private void OnAccessClicked(object o, EventArgs args)
        {
            TreeModel           tModel;
            iFolderAccessDialog accDialog = null;
            string defaultRights          = "ReadWrite";
            string userName   = null;
            bool   allowOwner = false;

            TreeSelection tSelect = UserTreeView.Selection;

            // only allow the changing of the owner if the current
            // user is the owner and if the selected users are members
            if (tSelect.CountSelectedRows() == 1)
            {
                Array treePaths = tSelect.GetSelectedRows(out tModel);

                foreach (TreePath tPath in treePaths)
                {
                    TreeIter iter;

                    if (UserTreeStore.GetIter(out iter, tPath))
                    {
                        iFolderUser user =
                            (iFolderUser)tModel.GetValue(iter, 0);
                        if (user.FN != null)
                        {
                            userName = user.FN;
                        }
                        else
                        {
                            userName = user.Name;
                        }
                        defaultRights = user.Rights;

                        if ((ifolder.CurrentUserID == ifolder.OwnerID) &&
                            (user.State == "Member"))
                        {
                            allowOwner = true;
                        }
                    }
                    break;
                }
            }

            accDialog = new iFolderAccessDialog(
                topLevelWindow, userName, defaultRights, allowOwner);

            int rc = accDialog.Run();

            accDialog.Hide();
            if (rc == -5)
            {
                string newrights = accDialog.Rights;
                string oldOwnerID;

                Array treePaths = tSelect.GetSelectedRows(out tModel);

                foreach (TreePath tPath in treePaths)
                {
                    TreeIter iter;

                    if (UserTreeStore.GetIter(out iter, tPath))
                    {
                        iFolderUser user =
                            (iFolderUser)tModel.GetValue(iter, 0);

                        try
                        {
                            ifws.SetUserRights(ifolder.ID,
                                               user.UserID,
                                               newrights);
                            user.Rights = newrights;

                            // if the user selected to make this
                            // use the owner set that right now
                            if (accDialog.IsOwner)
                            {
                                if (ifws.CanOwnerBeChanged(user.UserID, ifolder.DomainID))
                                {
                                    ifws.ChangeOwner(ifolder.ID,
                                                     user.UserID,
                                                     "Admin");

                                    // update the objects here instead of
                                    // re-reading them, that's expensive!
                                    oldOwnerID      = ifolder.OwnerID;
                                    user.Rights     = "Admin";
                                    ifolder.Owner   = user.Name;
                                    ifolder.OwnerID = user.UserID;

                                    // now loop through the users, find
                                    // the current owner, and set him to
                                    // not be the owner any more
                                    TreeIter ownIter;
                                    if (UserTreeStore.GetIterFirst(out ownIter))
                                    {
                                        do
                                        {
                                            iFolderUser ownUser = (iFolderUser)
                                                                  UserTreeStore.GetValue(ownIter, 0);
                                            if (oldOwnerID == ownUser.UserID)
                                            {
                                                ownUser.Rights = "Admin";
                                                tModel.SetValue(ownIter,
                                                                0, ownUser);
                                                break;
                                            }
                                        }while(UserTreeStore.IterNext(ref ownIter));
                                    }
                                }
                                else
                                {
                                    iFolderMsgDialog messdialog = new iFolderMsgDialog(
                                        null,
                                        iFolderMsgDialog.DialogType.Error,
                                        iFolderMsgDialog.ButtonSet.Ok,
                                        Util.GS("Policy Violation"),
                                        String.Format(Util.GS("Ownership of the iFolder {0} could not be transferred to {1} as it is violating the limit of iFolders set by the Administrator."), ifolder.Name, user.Name), Util.GS(" "));
                                    messdialog.Run();
                                    messdialog.Hide();
                                    messdialog.Destroy();
                                }
                            }

                            tModel.SetValue(iter, 0, user);
                        }
                        catch (Exception e)
                        {
                            iFolderExceptionDialog ied =
                                new iFolderExceptionDialog(
                                    topLevelWindow, e);
                            ied.Run();
                            ied.Hide();
                            ied.Destroy();
                            ied = null;
                        }
                    }
                }
            }
            accDialog.Destroy();
            accDialog = null;
        }
Esempio n. 31
0
 private void Migrate2xClickedHandler(object o, EventArgs args)
 {
     bool if2Present = true;
                 string str = Mono.Unix.UnixEnvironment.EffectiveUser.HomeDirectory;
                 if(!System.IO.Directory.Exists(str+"/.novell/ifolder"))
        {
     if2Present = false;
                 }
        else
        {
                  string[] dirs;
                  dirs = System.IO.Directory.GetDirectories(str+"/.novell/ifolder");
                  str = str+"/.novell/ifolder";
     int i;
                  for(i=0;i<dirs.Length;i++)
                  {
                          if(dirs[i] != str+"/reg" && dirs[i] != str+"/Save")
                          {
       break;
                          }
     }
     if( i == dirs.Length)
      if2Present = false;
                 }
        if( if2Present == false)
        {
     iFolderMsgDialog NoiF2Dialog = new iFolderMsgDialog(
     null,
     iFolderMsgDialog.DialogType.Info,
     iFolderMsgDialog.ButtonSet.Ok,
     Util.GS("iFolder Migration"),
     Util.GS("There is no iFolder 2.x data present on this computer."),Util.GS(" "));
     NoiF2Dialog.Run();
     NoiF2Dialog.Hide();
     NoiF2Dialog.Destroy();
     return;
        }
        MigrationWindow migrationWindow = new MigrationWindow(this, ifws, simws);
        migrationWindow.ShowAll();
        return;
 }
Esempio n. 32
0
 public static bool ShowVerifyDialog(string DomainID, SimiasWebService simws)
 {
     bool status = false;
        int result;
        Status passPhraseStatus= null;
        VerifyPassPhraseDialog vpd = new VerifyPassPhraseDialog();
        if (!Util.RegisterModalWindow(vpd))
        {
     vpd.Destroy();
     vpd = null;
     return false;
        }
        try
        {
        do
        {
     result = vpd.Run();
     vpd.Hide();
     if( result == (int)ResponseType.Ok)
      passPhraseStatus = simws.ValidatePassPhrase(DomainID, vpd.PassPhrase);
     if( passPhraseStatus != null)
     {
      if( passPhraseStatus.statusCode == StatusCodes.PassPhraseInvalid)
      {
       Debug.PrintLine("Invalid Passphrase");
       iFolderMsgDialog dialog = new iFolderMsgDialog(
        null,
        iFolderMsgDialog.DialogType.Error,
        iFolderMsgDialog.ButtonSet.None,
        Util.GS("Invalid Passphrase"),
        Util.GS("The Passphrase entered is invalid"),
        Util.GS("Please enter the passphrase again"));
        dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        dialog = null;
       passPhraseStatus = null;
      }
      else if(passPhraseStatus.statusCode == StatusCodes.Success)
       break;
     }
        }while( result != (int)ResponseType.Cancel && result !=(int)ResponseType.DeleteEvent);
        if( result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent)
        {
     try
     {
      simws.StorePassPhrase(DomainID, "", CredentialType.None, false);
      status = false;
     }
     catch(Exception)
     {
      return false;
     }
        }
        else if( passPhraseStatus != null && passPhraseStatus.statusCode == StatusCodes.Success)
        {
     try
     {
      simws.StorePassPhrase( DomainID, vpd.PassPhrase, CredentialType.Basic, vpd.ShouldSavePassPhrase);
      status = true;
     }
     catch(Exception)
     {
      return false;
     }
        }
        }
        catch(Exception)
        {
     return false;
        }
        return status;
 }
Esempio n. 33
0
 private void OnIconViewDragDataReceived(object o, DragDataReceivedArgs args)
 {
     bool bFolderCreated = false;
        switch (args.Info)
        {
     case (uint) DragTargetType.iFolderID:
      string ifolderID =
       System.Text.Encoding.UTF8.GetString(args.SelectionData.Data);
      iFolderHolder holder = ifdata.GetAvailableiFolder(ifolderID);
      if (holder != null)
       DownloadiFolder(holder, true);
      break;
     case (uint) DragTargetType.UriList:
      UriList uriList = new UriList(args.SelectionData);
      if (uriList.Count == 1)
      {
       string path = null;
       try
       {
        path = uriList.ToLocalPaths()[0];
       }
       catch
       {
        return;
       }
       DomainInformation[] domains = domainController.GetDomains();
       if (domains.Length <= 0) return;
       string domainID = domains[0].ID;
       DomainInformation defaultDomain = domainController.GetDefaultDomain();
       if (defaultDomain != null)
        domainID = defaultDomain.ID;
       DragCreateDialog cd = new DragCreateDialog(this, domains, domainID, path, ifws);
       cd.TransientFor = this;
       int rc = 0;
       do
       {
        rc = cd.Run();
        cd.Hide();
        if (rc == (int)ResponseType.Ok)
        {
     try
     {
      string selectedFolder = cd.iFolderPath.Trim();
      string selectedDomain = cd.DomainID;
      bool SSL = cd.ssl;
      string algorithm = cd.EncryptionAlgorithm;
      string parentDir = System.IO.Path.GetDirectoryName( selectedFolder );
      if ( ( parentDir == null ) || ( parentDir == String.Empty ) )
      {
       iFolderMsgDialog dg = new iFolderMsgDialog(
        this,
        iFolderMsgDialog.DialogType.Warning,
        iFolderMsgDialog.ButtonSet.Ok,
        "",
        Util.GS("Invalid folder specified"),
        Util.GS("An invalid folder was specified"));
       dg.Run();
       dg.Hide();
       dg.Destroy();
       continue;
      }
      iFolderHolder ifHolder = null;
      try
      {
       if( algorithm != null)
       {
        DomainInformation domainInfo = domainController.GetDomain(selectedDomain);
        if( !domainInfo.Authenticated)
        {
     DisplayLoginMesg();
     continue;
        }
        bool passPhraseStatus = false;
        bool passphraseStatus = false;
        try
        {
                                               passphraseStatus = simws.IsPassPhraseSet(selectedDomain);
        }
        catch(Exception)
        {
     DisplayLoginMesg();
     continue;
        }
        if(passphraseStatus == true)
        {
     string passphrasecheck = simws.GetPassPhrase(selectedDomain);
     if( passphrasecheck == null || passphrasecheck =="")
     {
      Debug.PrintLine(" passphrase not entered at login");
      passPhraseStatus = ShowVerifyDialog(selectedDomain, simws);
     }
     else
     {
      passPhraseStatus = true;
     }
        }
        else
        {
     passPhraseStatus = ShowEnterPassPhraseDialog(selectedDomain, simws);
        }
        if( passPhraseStatus == false)
        {
     continue;
        }
       }
       ifHolder = ifdata.CreateiFolder(selectedFolder, selectedDomain, SSL, algorithm);
      }
      catch(Exception e)
      {
       if (DisplayCreateOrSetupException(e))
       {
        continue;
       }
      }
      if(ifHolder == null)
       throw new Exception("Simias returned null");
      rc = 0;
      Util.LastCreatedPath = ifHolder.iFolder.UnManagedPath;
      if ((bool)ClientConfig.Get(ClientConfig.KEY_SHOW_CREATION))
      {
       iFolderCreationDialog dlg =
        new iFolderCreationDialog(ifHolder.iFolder);
       dlg.TransientFor = this;
       int createRC;
       do
       {
        createRC = dlg.Run();
        if(createRC == (int)Gtk.ResponseType.Help)
        {
     Util.ShowHelp("myifolders.html", this);
        }
       }while(createRC != (int)Gtk.ResponseType.Ok);
       dlg.Hide();
       if(dlg.HideDialog)
       {
        ClientConfig.Set(
     ClientConfig.KEY_SHOW_CREATION, false);
       }
       cd.Destroy();
       cd = null;
      }
     }
     catch (Exception e)
     {
      Debug.PrintLine(e.Message);
      continue;
     }
        }
       }
       while(rc == (int)ResponseType.Ok);
      }
      break;
     default:
      break;
        }
        Gtk.Drag.Finish (args.Context, bFolderCreated, false, args.Time);
 }
Esempio n. 34
0
        /// <summary>
        /// Event Handler for Rename Event Handler
        /// </summary>
        protected void RenameFileHandler(object o, EventArgs args)
        {
            string newFileName = nameConflictEntry.Text;

            TreeModel      tModel;
            ConflictHolder ch = null;

            TreeSelection tSelect = ConflictTreeView.Selection;

            if (tSelect.CountSelectedRows() == 1)
            {
                Array    treePaths = tSelect.GetSelectedRows(out tModel);
                TreeIter iter;
                if (ConflictTreeStore.GetIter(out iter, (TreePath)treePaths.GetValue(0)))
                {
                    ch = (ConflictHolder)tModel.GetValue(iter, 0);
                    Conflict lnc = ch.LocalNameConflict;
                    Conflict snc = ch.ServerNameConflict;

                    try
                    {
                        if (snc != null && ifolder.CurrentUserRights == "ReadOnly")
                        {
                            ifws.RenameAndResolveConflict(snc.iFolderID,
                                                          snc.ConflictID,
                                                          newFileName);
                        }
                        else
                        {
                            if (lnc != null)
                            {
                                //server file rename is not certified so we are not allowing the local file renamed to same name
                                // this is a work around later we will fix the sever rename as well
                                if (newFileName == oldFileName)
                                {
                                    iFolderMsgDialog dg = new iFolderMsgDialog(
                                        this,
                                        iFolderMsgDialog.DialogType.Error,
                                        iFolderMsgDialog.ButtonSet.Ok,
                                        "",
                                        Util.GS("Name Already Exists"),
                                        Util.GS("The specified name already exists.  Please choose a different name."),
                                        null);
                                    dg.Run();
                                    dg.Hide();
                                    dg.Destroy();
                                    return;
                                }
                                Conflict[] conflictList = ifws.GetiFolderConflicts(lnc.iFolderID);

                                ifws.ResolveNameConflict(lnc.iFolderID, lnc.ConflictID, newFileName);

                                foreach (Conflict con in conflictList)
                                {
                                    if (con.IsNameConflict && con.ServerName != null)
                                    {
                                        if (String.Compare(lnc.LocalFullPath, con.ServerFullPath, true) == 0)
                                        {
                                            if (ifolder.CurrentUserRights == "ReadOnly")
                                            {
                                                ifws.RenameAndResolveConflict(con.iFolderID, con.ConflictID, con.ServerName);
                                                break;
                                            }
                                            else
                                            {
                                                ifws.ResolveNameConflict(con.iFolderID, con.ConflictID, con.ServerName);
                                                break;
                                            }
                                        }
                                    }
                                }
                                ifws.SynciFolderNow(lnc.iFolderID);
                            }
                            // If this is a name conflict because of case-sensitivity
                            // on Linux, there won't be a conflict on the server.
                            if (snc != null)
                            {
                                //server file rename is not certified so we are not allowing the server file rename, rather rename to the same name
                                // this is a work around later we will fix the sever rename as well
                                if (newFileName != oldFileName)
                                {
                                    iFolderMsgDialog dg = new iFolderMsgDialog(
                                        this,
                                        iFolderMsgDialog.DialogType.Error,
                                        iFolderMsgDialog.ButtonSet.Ok,
                                        "",
                                        Util.GS("Name Already Exists"),
                                        Util.GS("The specified name already exists.  Please choose a different name."),
                                        null);
                                    dg.Run();
                                    dg.Hide();
                                    dg.Destroy();
                                    return;
                                }

                                ifws.ResolveNameConflict(snc.iFolderID,
                                                         snc.ConflictID,
                                                         ch.Name);
                            }
                        }

                        ConflictTreeStore.Remove(ref iter);
                    }
                    catch (Exception e)
                    {
                        bool   bKnownError = true;
                        string headerText  = Util.GS("iFolder Conflict Error");
                        string errText     = Util.GS("An error was encountered while resolving the conflict.");

                        if (e.Message.IndexOf("Malformed") >= 0)
                        {
                            headerText = Util.GS("Invalid Characters in Name");
                            errText    = string.Format(Util.GS("The specified name contains invalid characters.  Please choose a different name and try again.\n\nNames must not contain any of these characters: {0}"),
                                                       simws.GetInvalidSyncFilenameChars());
                        }
                        else if (e.Message.IndexOf("already exists") >= 0)
                        {
                            headerText = Util.GS("Name Already Exists");
                            errText    = Util.GS("The specified name already exists.  Please choose a different name.");
                        }
                        else
                        {
                            //bKnownError = false;
                        }

                        iFolderMsgDialog dg = new iFolderMsgDialog(
                            this,
                            iFolderMsgDialog.DialogType.Error,
                            iFolderMsgDialog.ButtonSet.Ok,
                            "",
                            headerText,
                            errText,
                            bKnownError ? null : e.Message);
                        dg.Run();
                        dg.Hide();
                        dg.Destroy();

                        tSelect.SelectIter(iter);

                        // FIXME: Figure out why if the user clicks the "Save" button the focus doesn't return back to the entry text box.  (i.e., the next line of code isn't really doing anything)
                        this.FocusChild = nameConflictEntry;
                        return;
                    }

                    UpdateFields(null, false);
                }
            }
        }
Esempio n. 35
0
 private int AskRemoveMembership(iFolderHolder holder)
 {
     int rc = 0;
        iFolderMsgDialog dialog = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Question,
     iFolderMsgDialog.ButtonSet.YesNo,
     "",
     string.Format(Util.GS("Remove your membership from \"{0}\"?"),
      holder.iFolder.Name),
     Util.GS("This removes your membership from the iFolder and removes the iFolder from your list."));
        rc = dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        return rc;
 }
 protected void RenameFileHandler(object o, EventArgs args)
 {
     string newFileName = nameConflictEntry.Text;
        TreeModel tModel;
        ConflictHolder ch = null;
        TreeSelection tSelect = ConflictTreeView.Selection;
        if (tSelect.CountSelectedRows() == 1)
        {
     Array treePaths = tSelect.GetSelectedRows(out tModel);
     TreeIter iter;
     if (ConflictTreeStore.GetIter(out iter, (TreePath)treePaths.GetValue(0)))
     {
      ch = (ConflictHolder) tModel.GetValue(iter, 0);
      Conflict lnc = ch.LocalNameConflict;
      Conflict snc = ch.ServerNameConflict;
      try
      {
       if (snc != null && ifolder.CurrentUserRights == "ReadOnly")
       {
        ifws.RenameAndResolveConflict(snc.iFolderID,
         snc.ConflictID,
         newFileName);
       }
       else
       {
        if (lnc != null)
        {
     if(newFileName == oldFileName)
     {
      iFolderMsgDialog dg = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("Name Already Exists"),
       Util.GS("The specified name already exists.  Please choose a different name."),
       null);
      dg.Run();
      dg.Hide();
      dg.Destroy();
      return;
     }
        Conflict[] conflictList = ifws.GetiFolderConflicts(lnc.iFolderID);
        ifws.ResolveNameConflict(lnc.iFolderID,lnc.ConflictID,newFileName);
        foreach(Conflict con in conflictList)
                                                 {
                                                        if(con != null && con.IsNameConflict && con.ServerName != null)
                                                        if(String.Compare(lnc.LocalFullPath,con.ServerFullPath,true)== 0) {
       if (ifolder.CurrentUserRights == "ReadOnly")
       {
      ifws.RenameAndResolveConflict(con.iFolderID,con.ConflictID,con.ServerName);
      break;
       }
                                                     else
       {
      ifws.ResolveNameConflict(con.iFolderID,con.ConflictID,con.ServerName);
      break;
       }
                                                        }
                                            }
        ifws.SynciFolderNow(lnc.iFolderID);
        }
        if (snc != null)
        {
     if(newFileName != oldFileName)
     {
      iFolderMsgDialog dg = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("Name Already Exists"),
       Util.GS("The specified name already exists.  Please choose a different name."),
       null);
      dg.Run();
      dg.Hide();
      dg.Destroy();
      return;
     }
     ifws.ResolveNameConflict(snc.iFolderID,
        snc.ConflictID,
        ch.Name);
        }
       }
       ConflictTreeStore.Remove(ref iter);
      }
      catch (Exception e)
      {
       bool bKnownError = true;
       string headerText = Util.GS("iFolder Conflict Error");
       string errText = Util.GS("An error was encountered while resolving the conflict.");
       if (e.Message.IndexOf("Malformed") >= 0)
       {
        headerText = Util.GS("Invalid Characters in Name");
        errText = string.Format(Util.GS("The specified name contains invalid characters.  Please choose a different name and try again.\n\nNames must not contain any of these characters: {0}"),
      simws.GetInvalidSyncFilenameChars());
       }
       else if (e.Message.IndexOf("already exists") >= 0)
       {
        headerText = Util.GS("Name Already Exists");
        errText = Util.GS("The specified name already exists.  Please choose a different name.");
       }
       else
       {
       }
       iFolderMsgDialog dg = new iFolderMsgDialog(
        this,
        iFolderMsgDialog.DialogType.Error,
        iFolderMsgDialog.ButtonSet.Ok,
        "",
        headerText,
        errText,
        bKnownError ? null : e.Message);
       dg.Run();
       dg.Hide();
       dg.Destroy();
       tSelect.SelectIter(iter);
       this.FocusChild = nameConflictEntry;
       return;
      }
      UpdateFields(null, false);
     }
        }
 }
Esempio n. 37
0
        /// <summary>
        /// Save Log
        /// </summary>
        private void SaveLog()
        {
            try
            {
                int    rc       = 0;
                bool   saveFile = true;
                string filename = null;

                string initialPath = Util.LastSavedSyncLogPath;

                FileChooserDialog fcd = new FileChooserDialog(
                    Util.GS("Save as..."), this,
                    FileChooserAction.Save,
                    Stock.Cancel, ResponseType.Cancel,
                    Stock.Save, ResponseType.Ok);

                fcd.SelectMultiple = false;

                fcd.CurrentName = Util.GS("iFolder Synchronization Log.txt");

                if (initialPath != null)
                {
                    fcd.SetCurrentFolder(initialPath);
                }

                while (saveFile)
                {
                    rc = fcd.Run();
                    fcd.Hide();

                    if (rc == (int)ResponseType.Ok)
                    {
                        filename = fcd.Filename;

                        if (File.Exists(filename))
                        {
                            iFolderMsgDialog dialog = new iFolderMsgDialog(
                                this,
                                iFolderMsgDialog.DialogType.Question,
                                iFolderMsgDialog.ButtonSet.YesNo,
                                "",
                                Util.GS("Overwrite the existing file?"),
                                Util.GS("The file you selected exists.  Selecting yes will overwrite the contents of this file."));
                            rc = dialog.Run();
                            dialog.Hide();
                            dialog.Destroy();
                            if (rc != -8)
                            {
                                saveFile = false;
                            }
                        }
                    }
                    else
                    {
                        break;                          // out of the while loop
                    }
                    if (saveFile)
                    {
                        FileStream fs = null;
                        try
                        {
                            fs = File.Create(filename);
                        }
                        catch (System.UnauthorizedAccessException)
                        {
                            iFolderMsgDialog dg = new iFolderMsgDialog(
                                this,
                                iFolderMsgDialog.DialogType.Error,
                                iFolderMsgDialog.ButtonSet.Ok,
                                "",
                                Util.GS("Insufficient access"),
                                Util.GS("You do not have access to save the file in the location you specified.  Please select a different location."));
                            dg.Run();
                            dg.Hide();
                            dg.Destroy();

                            continue;                                   // To the next iteration of the while loop
                        }
                        catch (Exception e)
                        {
                            iFolderMsgDialog dg = new iFolderMsgDialog(
                                this,
                                iFolderMsgDialog.DialogType.Error,
                                iFolderMsgDialog.ButtonSet.Ok,
                                "",
                                Util.GS("Error saving the log file"),
                                string.Format(Util.GS("An exception occurred trying to save the log: {0}"), e.Message),
                                e.StackTrace);
                            dg.Run();
                            dg.Hide();
                            dg.Destroy();

                            continue;                                   // To the next iteration of the while loop
                        }

                        if (fs != null)
                        {
                            TreeIter     iter;
                            StreamWriter w = new StreamWriter(fs);

                            if (LogTreeStore.GetIterFirst(out iter))
                            {
                                string logEntry =
                                    (string)LogTreeStore.GetValue(iter, 0);

                                w.WriteLine(logEntry);

                                while (LogTreeStore.IterNext(ref iter))
                                {
                                    logEntry =
                                        (string)LogTreeStore.GetValue(iter, 0);

                                    w.WriteLine(logEntry);
                                }
                            }

                            w.Close();

                            Util.LastSavedSyncLogPath = filename;

                            break;
                        }
                        else
                        {
                            iFolderMsgDialog dg = new iFolderMsgDialog(
                                this,
                                iFolderMsgDialog.DialogType.Error,
                                iFolderMsgDialog.ButtonSet.Ok,
                                "",
                                Util.GS("Error saving the log file"),
                                Util.GS("The iFolder Client experienced an error trying to save the log.  Please report this bug."));
                            dg.Run();
                            dg.Hide();
                            dg.Destroy();
                        }
                    }
                }

                fcd.Destroy();
            }
            catch (Exception)
            {
                iFolderMsgDialog dg = new iFolderMsgDialog(
                    this,
                    iFolderMsgDialog.DialogType.Error,
                    iFolderMsgDialog.ButtonSet.Ok,
                    "",
                    Util.GS("Error saving the log file"),
                    Util.GS("The iFolder Client experienced an exception trying to save the log.  Please report this bug.")
                    + "\n\n" +
                    Util.GS("Please ensure you have the lastest updates of gtk2 and gtk-sharp2 installed on your system."));
                dg.Run();
                dg.Hide();
                dg.Destroy();
            }
        }
 public void OnEnableAccountToggled(object o, EventArgs args)
 {
     if (EnableAccountButton.HasFocus)
        {
     if (EnableAccountButton.Active != domain.Active)
     {
      try
      {
       if (EnableAccountButton.Active)
       {
        domainController.ActivateDomain(domain.ID);
       }
       else
       {
        domainController.InactivateDomain(domain.ID);
       }
      }
      catch(Exception e)
      {
       string header;
       string message;
       if (EnableAccountButton.Active)
       {
        header = Util.GS("Could not enable this account");
        message = Util.GS("There was an error enabling this account.");
       }
       else
       {
        header = Util.GS("Could not disable this account");
        message = Util.GS("There was an error disabling this account.");
       }
       iFolderMsgDialog dg = new iFolderMsgDialog(
        this,
        iFolderMsgDialog.DialogType.Error,
        iFolderMsgDialog.ButtonSet.Ok,
        "",
        header,
        message,
        e.Message);
       dg.Run();
       dg.Hide();
       dg.Destroy();
       EnableAccountButton.Toggled -= new EventHandler(OnEnableAccountToggled);
       EnableAccountButton.Active = !EnableAccountButton.Active;
       EnableAccountButton.Toggled -= new EventHandler(OnEnableAccountToggled);
      }
     }
        }
 }
Esempio n. 39
0
        /// <summary>
        /// Event handler for Domain Login COmpleted
        /// </summary>
        private void OnDomainLoginCompleted(object o, DomainLoginCompletedArgs args)
        {
            if (WaitDialog != null)
            {
                WaitDialog.Hide();
                WaitDialog.Destroy();
                WaitDialog = null;
            }

            Status authStatus = args.AuthenticationStatus;

            if (authStatus != null)
            {
                switch (authStatus.statusCode)
                {
                case StatusCodes.Success:
                case StatusCodes.SuccessInGrace:
                    if (LoginDialog != null)
                    {
                        LoginDialog.Hide();
                        LoginDialog.Destroy();
                        LoginDialog = null;
                    }
                    // Check if any recovery agent present;
                    // if( domainController.GetRAList(args.DomainID) == null)
                    // {
                    // No recovery agent present;
                    //		return;
                    // }
                    ShowClientUpgradeMessageBox();
                    iFolderWebService ifws = DomainController.GetiFolderService();
                    int policy             = ifws.GetSecurityPolicy(args.DomainID);
                    if (policy % 2 == 0)
                    {
                        break;
                    }
                    bool passphraseStatus = simws.IsPassPhraseSet(args.DomainID);
                    if (passphraseStatus == true)
                    {
                        bool rememberOption = simws.GetRememberOption(args.DomainID);
                        if (rememberOption == false)
                        {
                            ShowVerifyDialog(args.DomainID, simws);
                        }
                        else
                        {
                            Debug.PrintLine(" remember Option true. Checking for passphrase existence");
                            string passphrasecheck = simws.GetPassPhrase(args.DomainID);
                            if (passphrasecheck == null || passphrasecheck == "")
                            {
                                Debug.PrintLine("BugBug: Passphrase doesn't exist");
                                ShowVerifyDialog(args.DomainID, simws);
                            }
                        }
                    }
                    else
                    {
                        iFolderWindow.ShowEnterPassPhraseDialog(args.DomainID, simws);
                    }

//						string[] array = domainController.GetRAList( args.DomainID);
                    iFolderData ifdata = iFolderData.GetData();
                    ifdata.Refresh();
                    UpdateWidgetSensitivity();
                    break;

                case StatusCodes.InvalidCertificate:
                    DomainInformation dom = domainController.GetDomain(args.DomainID);
                    if (authStatus.UserName != null)
                    {
                        dom.Host = authStatus.UserName;
                    }
                    byte[] byteArray = simws.GetCertificate(dom.Host);
                    System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);

                    iFolderMsgDialog dialog = new iFolderMsgDialog(
                        null,
                        iFolderMsgDialog.DialogType.Question,
                        iFolderMsgDialog.ButtonSet.YesNo,
                        "",
                        Util.GS("Accept the certificate of this server?"),
                        string.Format(Util.GS("iFolder is unable to verify \"{0}\" as a trusted server.  You should examine this server's identity certificate carefully."), dom.Host),
                        cert.ToString(true));

                    Gdk.Pixbuf certPixbuf = new Gdk.Pixbuf(Util.ImagesPath("ifolder-application-x-x509-ca-cert_48.png"));
                    if (certPixbuf != null && dialog.Image != null)
                    {
                        dialog.Image.Pixbuf = certPixbuf;
                    }

                    int rc = dialog.Run();
                    dialog.Hide();
                    dialog.Destroy();
                    if (rc == -8)                            // User clicked the Yes button
                    {
                        simws.StoreCertificate(byteArray, dom.Host);
                        LoginDialog.Respond(Gtk.ResponseType.Ok);
                    }
                    else
                    {
                        LoginDialog.Respond(Gtk.ResponseType.Cancel);
                    }
                    break;

                case StatusCodes.UserAlreadyMoved:
                    LoginDialog.Respond(Gtk.ResponseType.Ok);
                    break;

                default:
                    Util.ShowLoginError(topLevelWindow, authStatus.statusCode);

                    if (LoginDialog != null)
                    {
                        LoginDialog.Present();
                    }

                    UpdateDomainStatus(args.DomainID);
                    break;
                }
                //UpdateiFolderWindowOnLoginComplete();
            }
            else
            {
                Util.ShowLoginError(topLevelWindow, StatusCodes.Unknown);

                if (LoginDialog != null)
                {
                    LoginDialog.Present();
                }

                UpdateDomainStatus(args.DomainID);
            }

            iFolderWindow ifwin = Util.GetiFolderWindow();

            ifwin.UpdateServerInfoForSelectedDomain();
            ifwin.UpdateListViewItems();
        }
 private bool SavePassword()
 {
     string password = PasswordEntry.Text;
        bPasswordChanged = false;
        password = password.Trim();
        try
        {
     if (password.Length > 0)
     {
      domainController.SetDomainPassword(domain.ID, password);
     }
     else
     {
      domainController.ClearDomainPassword(domain.ID);
     }
        }
        catch(Exception e)
        {
     iFolderMsgDialog dg = new iFolderMsgDialog(
      this,
      iFolderMsgDialog.DialogType.Error,
      iFolderMsgDialog.ButtonSet.Ok,
      "",
      Util.GS("Unable to modify the password"),
      Util.GS("An error was encountered while attempting to modify the password."),
      e.Message);
     dg.Run();
     dg.Hide();
     dg.Destroy();
     PasswordEntry.Changed -= new EventHandler(OnPasswordChanged);
     PasswordEntry.Text = domainController.GetDomainPassword(domain.ID);
     PasswordEntry.Changed += new EventHandler(OnPasswordChanged);
     return false;
        }
        return true;
 }
Esempio n. 41
0
        /// <summary>
        /// Show Verify Passphrase Dialog
        /// </summary>
        /// <param name="DomainID">Domain ID</param>
        /// <param name="simws">Simias WebService</param>
        /// <returns>true on success</returns>
        private bool ShowVerifyDialog(string DomainID, SimiasWebService simws)
        {
            bool   status = false;
            int    result;
            Status passPhraseStatus    = null;
            VerifyPassPhraseDialog vpd = new VerifyPassPhraseDialog();

            if (!Util.RegisterModalWindow(vpd))
            {
                vpd.Destroy();
                vpd = null;
                return(false);
            }
            // vpd.TransientFor = this;
            try
            {
                do
                {
                    result = vpd.Run();
                    vpd.Hide();
                    // Verify PassPhrase..  If correct store passphrase and set a local property..
                    if (result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent)
                    {
                        break;
                    }
                    if (result == (int)ResponseType.Ok)
                    {
                        passPhraseStatus = simws.ValidatePassPhrase(DomainID, vpd.PassPhrase);
                    }
                    if (passPhraseStatus != null)
                    {
                        if (passPhraseStatus.statusCode == StatusCodes.PassPhraseInvalid)                  // check for invalid passphrase
                        {
                            // Display an error Message
                            iFolderMsgDialog dialog = new iFolderMsgDialog(
                                null,
                                iFolderMsgDialog.DialogType.Error,
                                iFolderMsgDialog.ButtonSet.None,
                                Util.GS("Invalid passPhrase"),
                                Util.GS("The PassPhrase entered is invalid"),
                                Util.GS("Please re-enter the passphrase"));
                            dialog.Run();
                            dialog.Hide();
                            dialog.Destroy();
                            dialog           = null;
                            passPhraseStatus = null;
                        }
                        else if (passPhraseStatus.statusCode == StatusCodes.Success)
                        {
                            break;
                        }
                    }
                }while(result != (int)ResponseType.Cancel && result != (int)ResponseType.DeleteEvent);
                if (result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent)
                {
                    status = false;
                    simws.StorePassPhrase(DomainID, "", CredentialType.None, false);

                    /*  Testing purpose
                     * string uid, passphrasecheck;
                     * simws.GetPassPhrase(DomainID, out uid, out passphrasecheck);
                     */
                }
                else if (passPhraseStatus != null && passPhraseStatus.statusCode == StatusCodes.Success)
                {
                    try
                    {
                        simws.StorePassPhrase(DomainID, vpd.PassPhrase, CredentialType.Basic, vpd.ShouldSavePassPhrase);
                        status = true;
                    }
                    catch (Exception)
                    {
                        return(false);
                    }
                }
            }
            catch (Exception)
            {
                return(false);
            }
            return(status);
        }
Esempio n. 42
0
 private bool DisplayCreateOrSetupException(Exception e)
 {
     string primaryText = null;
        string secondaryText = null;
        if (e.Message.IndexOf("Path did not exist") >= 0 || e.Message.IndexOf("URI scheme was not recognized") >= 0)
        {
     primaryText = Util.GS("Invalid folder specified");
     secondaryText = Util.GS("The folder you've specified does not exist.  Please select an existing folder and try again.");
        }
        else if (e.Message.IndexOf("PathExists") >= 0)
        {
     primaryText = Util.GS("A folder with the same name already exists.");
     secondaryText = Util.GS("The location you selected already contains a folder with the same name as this iFolder.  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("RootOfDrivePath") >= 0)
        {
     primaryText = Util.GS("iFolders cannot exist at the drive level.");
     secondaryText = Util.GS("The location you selected is at the root of the drive.  Please select a location that is not at the root of a drive and try again.");
        }
        else if (e.Message.IndexOf("InvalidCharactersPath") >= 0)
        {
     primaryText = Util.GS("The selected location contains invalid characters.");
     secondaryText = Util.GS("The characters \\:*?\"<>| cannot be used in an iFolder. Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("AtOrInsideStorePath") >= 0)
        {
     primaryText = Util.GS("The selected location is inside the iFolder data folder.");
     secondaryText = Util.GS("The iFolder data folder is normally located in your home folder in the folder \".local/share\".  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("ContainsStorePath") >= 0)
        {
     primaryText = Util.GS("The selected location contains the iFolder data files.");
     secondaryText = Util.GS("The location you have selected contains the iFolder data files.  These are normally located in your home folder in the folder \".local/share\".  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("NotFixedDrivePath") >= 0)
        {
     primaryText = Util.GS("The selected location is on a network or non-physical drive.");
     secondaryText = Util.GS("iFolders must reside on a physical drive.  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("SystemDirectoryPath") >= 0)
        {
     primaryText = Util.GS("The selected location contains a system folder.");
     secondaryText = Util.GS("System folders cannot be contained in an iFolder.  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("SystemDrivePath") >= 0)
        {
     primaryText = Util.GS("The selected location is a system drive.");
     secondaryText = Util.GS("System drives cannot be contained in an iFolder.  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("IncludesWinDirPath") >= 0)
        {
     primaryText = Util.GS("The selected location includes the Windows folder.");
     secondaryText = Util.GS("The Windows folder cannot be contained in an iFolder.  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("IncludesProgFilesPath") >= 0)
        {
     primaryText = Util.GS("The selected location includes the Program Files folder.");
     secondaryText = Util.GS("The Program Files folder cannot be contained in an iFolder.  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("DoesNotExistPath") >= 0)
        {
     primaryText = Util.GS("The selected location does not exist.");
     secondaryText = Util.GS("iFolders can only be created from folders that exist.  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("NoReadRightsPath") >= 0)
        {
     primaryText = Util.GS("You do not have access to read files in the selected location.");
     secondaryText = Util.GS("iFolders can only be created from folders where you have access to read and write files.  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("NoWriteRightsPath") >= 0)
        {
     primaryText = Util.GS("You do not have access to write files in the selected location.");
     secondaryText = Util.GS("iFolders can only be created from folders where you have access to read and write files.  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("ContainsCollectionPath") >= 0)
        {
     primaryText = Util.GS("The selected location already contains an iFolder.");
     secondaryText = Util.GS("iFolders cannot exist inside other iFolders.  Please select a different location and try again.");
        }
        else if (e.Message.IndexOf("AtOrInsideCollectionPath") >= 0)
        {
     primaryText = Util.GS("The selected location is inside another iFolder.");
     secondaryText = Util.GS("iFolders cannot exist inside other iFolders.  Please select a different location and try again.");
        }
        if (primaryText != null)
        {
     iFolderMsgDialog dg = new iFolderMsgDialog(
      this,
      iFolderMsgDialog.DialogType.Warning,
      iFolderMsgDialog.ButtonSet.Ok,
      "",
      primaryText,
      secondaryText);
      dg.Run();
      dg.Hide();
      dg.Destroy();
      return true;
        }
        else
        {
     iFolderExceptionDialog ied =
      new iFolderExceptionDialog(
       this,
       e);
     ied.Run();
     ied.Hide();
     ied.Destroy();
        }
        return false;
 }
Esempio n. 43
0
 private void ShareSelectedFolder()
 {
     iFolderHolder holder = iFolderIconView.SelectedFolder;
        if (holder != null)
        {
     iFolderWeb selectedFolder = holder.iFolder;
     if(selectedFolder.encryptionAlgorithm != null && selectedFolder.encryptionAlgorithm != "")
     {
      iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Cannot share iFolder"),
     Util.GS("It is not possible to share an Encrypted iFolder. Only regular iFolders can be shared"));
      dg.Run();
      dg.Hide();
      dg.Destroy();
     }
     else
     {
      ShowFolderProperties(holder, 1);
     }
        }
 }
Esempio n. 44
0
 private void OpenSelectedFolder()
 {
     iFolderHolder holder = iFoldersIconView.SelectedFolder;
        if (holder != null)
        {
     try
     {
      Util.OpenInBrowser(holder.iFolder.UnManagedPath);
     }
     catch(Exception e)
     {
      iFolderMsgDialog dg = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       string.Format(Util.GS("Unable to open folder \"{0}\""), holder.iFolder.Name),
       Util.GS("iFolder could not open the Nautilus File Manager or the Konquerer File Manager."));
      dg.Run();
      dg.Hide();
      dg.Destroy();
     }
        }
 }
Esempio n. 45
0
 public static bool ShowEnterPassPhraseDialog(string DomainID, SimiasWebService simws)
 {
     bool status = false;
      EnterPassPhraseDialog epd = new EnterPassPhraseDialog(DomainID, simws);
       if (!Util.RegisterModalWindow(epd))
      {
       epd.Destroy();
        epd = null;
        return false;
       }
       try
       {
     status = PassphraseHelper( epd, DomainID, simws);
     if( !status )
         return status;
       }
       catch(Exception ex)
       {
     iFolderMsgDialog dialog = new iFolderMsgDialog(
         null,
         iFolderMsgDialog.DialogType.Error,
         iFolderMsgDialog.ButtonSet.None,
         Util.GS("Unable to set the passphrase"),
         Util.GS(ex.Message),
         Util.GS("Please enter the passphrase again"));
     dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     dialog = null;
        return false;
       }
       return status;
 }
Esempio n. 46
0
 private int AskDeleteiFolder(iFolderHolder holder)
 {
     int rc = 0;
        iFolderMsgDialog dialog = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Question,
     iFolderMsgDialog.ButtonSet.YesNo,
     "",
     string.Format(Util.GS("Delete \"{0}\" from the server?"),
      holder.iFolder.Name),
     Util.GS("This deletes the iFolder and its files from the server."));
        rc = dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        return rc;
 }
Esempio n. 47
0
        /// This method is called by Successful login handler, it is called before passphrase verify invocation
        /// The variable used in this method should have been captured during the ClientUpgrade Event handler
        /// This method should only be called during toggling of checkbox on prefs/account page (logout/login)
        public void ShowClientUpgradeMessageBox()
        {
            if (this.NewClientVersion == null || this.ClientUpgradeStatus == null || this.NewClientDomainID == null)
            {
                return;                 // no handler was generated/caught for ClientUpgradeAvailable
            }

            if (ClientUpgradeDialog != null)
            {
                return;                 // This dialog is already showing
            }
            if (DomainController.upgradeStatus.statusCode == StatusCodes.ServerOld)
            {
                ClientUpgradeDialog = new iFolderMsgDialog(
                    null,
                    iFolderMsgDialog.DialogType.Info,
                    iFolderMsgDialog.ButtonSet.Ok,
                    Util.GS("iFolder Server Older"),
                    Util.GS("The server is running an older version."),
                    string.Format(Util.GS("The server needs to be upgraded to be connected from this client")));
            }
            else if (DomainController.upgradeStatus.statusCode == StatusCodes.UpgradeNeeded)
            {
                ClientUpgradeDialog = new iFolderMsgDialog(
                    null,
                    iFolderMsgDialog.DialogType.Info,
                    iFolderMsgDialog.ButtonSet.AcceptDeny,
                    Util.GS("iFolder Client Upgrade"),
                    Util.GS("Would you like to download new iFolder Client?"),
                    string.Format(Util.GS("The client needs to be upgraded to be connected to the server")));
            }
            else
            {
                ClientUpgradeDialog = new iFolderMsgDialog(
                    null,
                    iFolderMsgDialog.DialogType.Info,
                    iFolderMsgDialog.ButtonSet.AcceptDeny,
                    Util.GS("iFolder Client Upgrade"),
                    Util.GS("Would you like to download new iFolder Client?"),
                    string.Format(Util.GS("A newer version \"{0}\" of the iFolder Client is available."), this.NewClientVersion));
            }

            int rc = ClientUpgradeDialog.Run();

            ClientUpgradeDialog.Hide();
            ClientUpgradeDialog.Destroy();
            ClientUpgradeDialog = null;

            if (rc == -8)
            {
                bool       bUpdateRunning = false;
                Gtk.Window win            = new Gtk.Window("");
                string     initialPath    = (string)System.IO.Path.GetTempPath();

                Debug.PrintLine(String.Format("Initial Path: {0}", initialPath));
                CopyLocation cp             = new CopyLocation(win, (string)System.IO.Path.GetTempPath());
                string       selectedFolder = "";
                int          rc1            = 0;
                do
                {
                    rc1 = cp.Run();
                    cp.Hide();
                    if (rc1 == (int)ResponseType.Ok)
                    {
                        selectedFolder = cp.iFolderPath.Trim();
                        cp.Destroy();
                        cp = null;
                        break;
                    }
                }while(rc1 == (int)ResponseType.Ok);
                if (cp != null)
                {
                    cp.Destroy();
                    cp = null;
                }
                win.Hide();
                win.Destroy();
                win = null;
                if (rc1 != (int)ResponseType.Ok)
                {
                    Debug.PrintLine("OnClientUpgradeAvailableEvent return");
                    ClientUpgradeDialog = null;
                    return;
                }
                try
                {
                    if (ifws != null)
                    {
                        Debug.PrintLine("ifws.RunClientUpdate");
                        bUpdateRunning = ifws.RunClientUpdate(this.NewClientDomainID, selectedFolder);
                    }
                }
                catch (Exception e)
                {
                    Debug.PrintLine(String.Format("ifws.RunClientUpdate exception :{0}", e.Message));
                    ClientUpgradeDialog = null;
                    return;
                }

                if (bUpdateRunning)
                {
                    ClientUpgradeDialog = new iFolderMsgDialog(
                        null,
                        iFolderMsgDialog.DialogType.Info,
                        iFolderMsgDialog.ButtonSet.Ok,
                        Util.GS("Download Complete..."),
                        Util.GS("Download Finished "),
                        string.Format(Util.GS("The new client rpm's have been downloaded.")));
                    ClientUpgradeDialog.Run();
                    ClientUpgradeDialog.Hide();
                    ClientUpgradeDialog.Destroy();
                    //	QuitiFolder();
                }
                else
                {
                    iFolderMsgDialog dialog = new iFolderMsgDialog(
                        null,
                        iFolderMsgDialog.DialogType.Error,
                        iFolderMsgDialog.ButtonSet.None,
                        Util.GS("Upgrade Failure"),
                        Util.GS("The iFolder client upgrade failed."),
                        Util.GS("Please contact your system administrator."));
                    dialog.Run();
                    dialog.Hide();
                    dialog.Destroy();
                    dialog = null;
                }

                if (DomainController.upgradeStatus.statusCode == StatusCodes.UpgradeNeeded)
                {
                    // Deny login
                    if (domainController.GetDomain(this.NewClientDomainID) != null)
                    {
                        domainController.RemoveDomain(this.NewClientDomainID, false);
                    }
                }
            }
            else             //if(rc == -9)
            {
                if (DomainController.upgradeStatus.statusCode == StatusCodes.ServerOld || DomainController.upgradeStatus.statusCode == StatusCodes.UpgradeNeeded)
                {
                    // Deny login
                    if (domainController.GetDomain(this.NewClientDomainID) != null)
                    {
                        domainController.RemoveDomain(this.NewClientDomainID, false);
                    }
                }
            }
            ClientUpgradeDialog      = null;
            this.ClientUpgradeStatus = null;
            this.NewClientVersion    = null;
            this.NewClientDomainID   = null;
        }
Esempio n. 48
0
 private void CreateNewiFolder()
 {
     DomainInformation[] domains = domainController.GetDomains();
        if (domains.Length <= 0) return;
        string domainID = domains[0].ID;
        DomainInformation defaultDomain = domainController.GetDefaultDomain();
        if (defaultDomain != null)
     domainID = defaultDomain.ID;
        CreateDialog cd = new CreateDialog(this, domains, domainID, Util.LastCreatedPath, ifws);
        cd.TransientFor = this;
        int rc = 0;
        do
        {
     rc = cd.Run();
     cd.Hide();
     if (rc == (int)ResponseType.Ok)
     {
      try
      {
       string selectedFolder = cd.iFolderPath.Trim();
       string selectedDomain = cd.DomainID;
       if (selectedFolder == String.Empty)
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("An invalid folder was specified."));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       string parentDir = System.IO.Path.GetDirectoryName( selectedFolder );
       if ( ( parentDir == null ) || ( parentDir == String.Empty ) )
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("An invalid folder was specified"));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       string name = selectedFolder.Substring(parentDir.Length + 1);
       if (name == null || name == String.Empty)
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("The folder you've specified is invalid.  Please remove the trailing separator character (/) and try again."));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       selectedFolder = ParseAndReplaceTildeInPath(selectedFolder);
       iFolderHolder ifHolder = null;
       try
       {
        ifHolder =
     ifdata.CreateiFolder(selectedFolder,
       selectedDomain);
       }
       catch(Exception e)
       {
        if (DisplayCreateOrSetupException(e))
        {
     cd.iFolderPath = selectedFolder;
     continue;
        }
       }
       if(ifHolder == null)
        throw new Exception("Simias returned null");
       rc = 0;
       Util.LastCreatedPath = ifHolder.iFolder.UnManagedPath;
       if(ClientConfig.Get(ClientConfig.KEY_SHOW_CREATION,
       "true") == "true")
       {
        iFolderCreationDialog dlg =
     new iFolderCreationDialog(ifHolder.iFolder);
        dlg.TransientFor = this;
        int createRC;
        do
        {
     createRC = dlg.Run();
     if(createRC == (int)Gtk.ResponseType.Help)
     {
      Util.ShowHelp("myifolders.html", this);
     }
        }while(createRC != (int)Gtk.ResponseType.Ok);
        dlg.Hide();
        if(dlg.HideDialog)
        {
     ClientConfig.Set(
      ClientConfig.KEY_SHOW_CREATION, "false");
        }
        cd.Destroy();
        cd = null;
       }
      }
      catch (Exception e)
      {
       Console.WriteLine(e.Message);
       continue;
      }
     }
        }
        while(rc == (int)ResponseType.Ok);
 }
Esempio n. 49
0
 private void OnResetPassMenuItem(object o, EventArgs args)
 {
     bool status = false;
        int result =0;
        do
        {
     DomainInformation[] domains = this.domainController.GetLoggedInDomains();
     if( domains == null)
     {
      iFolderMsgDialog dialog = new iFolderMsgDialog(
                                                                                                         null,
                                                                                                         iFolderMsgDialog.DialogType.Error,
                                                                                                         iFolderMsgDialog.ButtonSet.None,
                                                                                                         Util.GS("No Logged-In domains"),
                                                                                                         Util.GS("There are no logged-in domains for changing the passphrase."),
                                                                                                         Util.GS("For changing passphrase the domain should be connected. Log on to the domain and try."));
      dialog.Run();
                          dialog.Hide();
                          dialog.Destroy();
                          dialog = null;
      return;
     }
     ResetPassPhraseDialog resetDialog = new ResetPassPhraseDialog(simws,ifws);
     resetDialog.Domains = domains;
     resetDialog.TransientFor = this;
     result = resetDialog.Run();
     status = resetDialog.Status;
     resetDialog.Hide();
     resetDialog.Destroy();
     if(result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent)
      return;
     if (result == (int)ResponseType.Help)
     {
            Util.ShowHelp("managingpassphrse.html", this);
     }
     else if( status == true)
     {
      iFolderMsgDialog dialog = new iFolderMsgDialog(
                                                                                                         null,
                                                                                                         iFolderMsgDialog.DialogType.Info,
                                                                                                         iFolderMsgDialog.ButtonSet.None,
                                                                                                         Util.GS("Change Passphrase"),
                                                                                                         Util.GS("Successfully changed the passphrase"), null);
                          dialog.Run();
                          dialog.Hide();
                          dialog.Destroy();
                          dialog = null;
     }
        }while(status == false);
 }
Esempio n. 50
0
        ///
        /// Utility Methods
        ///
        private bool SaveServerAddress()
        {
            string serverAddress = ServerAddressEntry.Text;
            string username      = domain.MemberName;
            string password      = domainController.GetDomainPassword(domain.ID);

            bServerAddressChanged = false;
            bool bHostAddressUpdated = false;

            if (serverAddress == null || serverAddress.Trim().Length == 0)
            {
                // FIXME: Register this window with the Modal Controller
                iFolderMsgDialog dg =
                    new iFolderMsgDialog(
                        this,
                        iFolderMsgDialog.DialogType.Error,
                        iFolderMsgDialog.ButtonSet.Ok,
                        "",
                        Util.GS("Server address cannot be empty"),
                        Util.GS("Please enter an address for the server."));
                dg.Run();
                dg.Hide();
                dg.Destroy();

                // Set the ServerAddressEntry back to the original value
                ServerAddressEntry.Changed -= new EventHandler(OnServerAddressChanged);
                ServerAddressEntry.Text     = GetHostUrl(domain.HostUrl);
                ServerAddressEntry.Changed += new EventHandler(OnServerAddressChanged);

                return(bHostAddressUpdated);
            }

            // Make sure that we have a password for calling UpdateDomainHostAddress
            if (password == null || password.Trim().Length == 0)
            {
                Entry tempPasswordEntry = new Entry();
                tempPasswordEntry.Visibility = false;
                iFolderMsgDialog dg =
                    new iFolderMsgDialog(
                        this,
                        iFolderMsgDialog.DialogType.Info,
                        iFolderMsgDialog.ButtonSet.OkCancel,
                        "",
                        Util.GS("Please enter your password"),
                        Util.GS("Your password is required to change the address of the server."));
                dg.ExtraWidget = tempPasswordEntry;
                tempPasswordEntry.GrabFocus();
                tempPasswordEntry.ActivatesDefault = true;
                dg.TransientFor = this;
                int rc = dg.Run();
                password = tempPasswordEntry.Text;
                dg.Hide();
                dg.Destroy();
                if ((ResponseType)rc == ResponseType.Cancel)
                {
                    // Set the ServerAddressEntry back to the original value
                    ServerAddressEntry.Changed -= new EventHandler(OnServerAddressChanged);
                    ServerAddressEntry.Text     = GetHostUrl(domain.HostUrl);
                    ServerAddressEntry.Changed += new EventHandler(OnServerAddressChanged);

                    return(bHostAddressUpdated);
                }



                if (password == null || password.Trim().Length == 0)
                {
                    // Set the ServerAddressEntry back to the original value
                    ServerAddressEntry.Changed -= new EventHandler(OnServerAddressChanged);
                    ServerAddressEntry.Text     = GetHostUrl(domain.HostUrl);
                    ServerAddressEntry.Changed += new EventHandler(OnServerAddressChanged);

                    return(bHostAddressUpdated);
                }
            }

            serverAddress = serverAddress.Trim();

            Exception hostAddressUpdateException = null;

            try
            {
                if (domainController.UpdateDomainHostAddress(domain.ID, serverAddress, username, password) != null)
                {
                    bHostAddressUpdated = true;
                }
            }
            catch (Exception e)
            {
                hostAddressUpdateException = e;
            }

            if (!bHostAddressUpdated)
            {
                // FIXME: Register this as a modal window
                iFolderMsgDialog dg = new iFolderMsgDialog(
                    this,
                    iFolderMsgDialog.DialogType.Error,
                    iFolderMsgDialog.ButtonSet.Ok,
                    "",
                    Util.GS("Unable to modify the server address"),
                    Util.GS("An error was encountered while attempting to modify the server address.  Please verify the address and your password are correct."),
                    hostAddressUpdateException == null ? null : hostAddressUpdateException.Message);
                dg.Run();
                dg.Hide();
                dg.Destroy();

                // Set the ServerAddressEntry back to the original value
                ServerAddressEntry.Changed -= new EventHandler(OnServerAddressChanged);
                ServerAddressEntry.Text     = GetHostUrl(domain.HostUrl);
                ServerAddressEntry.Changed += new EventHandler(OnServerAddressChanged);
            }

            return(bHostAddressUpdated);
        }
Esempio n. 51
0
 private void OnResetPasswordMenuItem(object o, EventArgs args)
 {
     string DomainID, newPassword;
        bool rememberOption;
        bool status = false;
        int result =0;
        do
        {
     DomainInformation[] domains = this.domainController.GetLoggedInDomains();
     if( domains == null)
     {
      iFolderMsgDialog dialog = new iFolderMsgDialog(
                                                                                                         null,
                                                                                                         iFolderMsgDialog.DialogType.Error,
                                                                                                         iFolderMsgDialog.ButtonSet.None,
                                                                                                         Util.GS("No Logged-In domains"),
                                                                                                         Util.GS("There are no logged-in domains for changing the password."),
                                                                                                         Util.GS("For changing password the domain should be connected. Log on to the domain and try."));
      dialog.Run();
                          dialog.Hide();
                          dialog.Destroy();
                          dialog = null;
      return;
     }
     ResetPasswordDialog resetDialog = new ResetPasswordDialog(simws,ifws);
     resetDialog.Domains = domains;
     resetDialog.TransientFor = this;
     result = resetDialog.Run();
     DomainID = resetDialog.Domain;
     newPassword = resetDialog.NewPassword;
     rememberOption = resetDialog.SavePassword;
     status = resetDialog.Status;
     resetDialog.Hide();
     resetDialog.Destroy();
     if(result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent)
      return;
     if (result == (int)ResponseType.Help)
     {
     }
     else if( status == true)
     {
      if( rememberOption == true)
      {
       simws.SetDomainCredentials(DomainID, newPassword, CredentialType.Basic);
      }
      else
      {
       simws.SetDomainCredentials(DomainID, null, CredentialType.None);
      }
      iFolderMsgDialog dialog = new iFolderMsgDialog(
                                                                                                         null,
                                                                                                         iFolderMsgDialog.DialogType.Info,
                                                                                                         iFolderMsgDialog.ButtonSet.None,
                                                                                                         Util.GS("Change password"),
                                                                                                         Util.GS("Successfully changed the password. Log on to the domain with new password."), null);
                                 dialog.Run();
                                 dialog.Hide();
                                 dialog.Destroy();
                                 dialog = null;
     }
        }while(status == false);
 }
Esempio n. 52
0
 private void OnRecoveryMenuItem(object o, EventArgs args)
 {
     DomainInformation[] domains = this.domainController.GetLoggedInDomains();
                 if( domains == null)
                 {
                         iFolderMsgDialog dialog = new iFolderMsgDialog(
                                                                                                         null,
                                                                                                         iFolderMsgDialog.DialogType.Error,
                                                                                                         iFolderMsgDialog.ButtonSet.None,
                                                                                                         Util.GS("No Logged-In domains"),
                                                                                                         Util.GS("There are no logged-in domains for resetting keys."),
                                                                                                         Util.GS("For resetting the passphrase the domain should be connected. Log on to the domain and try."));
                                 dialog.Run();
                                 dialog.Hide();
                                 dialog.Destroy();
                                 dialog = null;
                                 return;
                         }
                 KeyRecoveryWizard krw = new KeyRecoveryWizard(simws,ifws);
                  krw.TransientFor = this;
                 if (!Util.RegisterModalWindow(krw))
                 {
                         try
                         {
                                 Util.CurrentModalWindow.Present();
                         }
                         catch{}
                         krw.Destroy();
                         return;
                 }
                 krw.ShowAll();
 }
Esempio n. 53
0
 private void RemoveSelectedFolderHandler()
 {
     iFolderHolder holder = iFolderIconView.SelectedFolder;
        DomainInformation domain = domainController.GetDomain(holder.iFolder.DomainID);
        if(domain == null) return;
        if (holder != null)
        {
     iFolderMsgDialog dialog = new iFolderMsgDialog(
      this,
      iFolderMsgDialog.DialogType.Question,
      iFolderMsgDialog.ButtonSet.YesNo,
      Util.GS("Revert to Normal Folder"),
      Util.GS("Revert this iFolder to a normal folder?"),
      Util.GS("The folder will still be on your computer, but it will no longer synchronize with the iFolder Server."));
     CheckButton deleteFromServerCB;
     if (domain.MemberUserID == holder.iFolder.OwnerID)
      deleteFromServerCB = new CheckButton(Util.GS("_Delete this iFolder from the server"));
     else
      deleteFromServerCB = new CheckButton(Util.GS("_Remove my membership from this iFolder"));
     deleteFromServerCB.Sensitive = domain.Authenticated;
     dialog.ExtraWidget = deleteFromServerCB;
     int rc = dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     if(rc == -8)
     {
      try
      {
       bool removeDefault = false;
       string domainID = holder.iFolder.DomainID;
       if( simws.GetDefaultiFolder( domainID ) == holder.iFolder.ID)
       {
        Debug.PrintLine("Removing default iFolder");
        removeDefault = true;
       }
       iFolderHolder subHolder =
        ifdata.RevertiFolder(holder.iFolder.ID);
       if (deleteFromServerCB.Active)
       {
        if (subHolder == null)
        {
     ifdata.DeleteiFolder(holder.iFolder.ID);
        }
        else
        {
     ifdata.DeleteiFolder(subHolder.iFolder.ID);
        }
        if( removeDefault )
     simws.DefaultAccount(domainID, null);
       UpdateServerInfoForSelectedDomain();
       }
       if( ifolderlistview.Visible )
                                    GLib.Idle.Add(UpdateListViewItemsMainThread);
                    else
        iFoldersIconView.UnselectAll();
      }
      catch(Exception e)
      {
       iFolderExceptionDialog ied =
        new iFolderExceptionDialog(
     this,
     e);
       ied.Run();
       ied.Hide();
       ied.Destroy();
      }
      UpdateSensitivity();
     }
        }
 }