private void SetSelectedUserRights(string rights)
 {
     TreeModel tModel;
        TreeSelection tSelect = UserTreeView.Selection;
        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,
        rights);
       user.Rights = rights;
       tModel.SetValue(iter, 0, user);
      }
      catch(Exception e)
      {
       iFolderExceptionDialog ied =
     new iFolderExceptionDialog(
       topLevelWindow, e);
       ied.Run();
       ied.Hide();
       ied.Destroy();
       ied = null;
      }
     }
        }
 }
 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;
       }
      }
     }
        }
 }
 private void OnUserSelectorResponse(object o, ResponseArgs args)
 {
     if(UserSelector != null)
        {
     switch(args.ResponseId)
     {
      case Gtk.ResponseType.Ok:
      {
       foreach(MemberInfo member in UserSelector.SelectedUsers)
       {
        if(!curUsers.ContainsKey(member.UserID))
        {
     try
     {
     iFolderUser newUser =
      ifws.AddAndInviteUser(
       ifolder.ID,
       member.Name,
       member.GivenName,
       member.FamilyName,
       member.UserID,
       null,
       "ReadWrite" );
      TreeIter iter =
       UserTreeStore.AppendValues(newUser);
      if (memberFullNames.Contains(newUser.FN))
      {
       duplicateMembers[newUser.FN] = 0;
      }
      else
       memberFullNames[newUser.FN] = 0;
      curUsers.Add(newUser.UserID, iter);
     }
     catch(Exception e)
     {
      iFolderExceptionDialog ied =
        new iFolderExceptionDialog(
      topLevelWindow, e);
      ied.Run();
      ied.Hide();
      ied.Destroy();
      ied = null;
      break;
     }
        }
       }
       UserSelector.Hide();
       UserSelector.Destroy();
       UserSelector = null;
       break;
      }
      case Gtk.ResponseType.Help:
      {
       Util.ShowHelp("sharewith.html#bq6lwm0", topLevelWindow);
       break;
      }
      case Gtk.ResponseType.Cancel:
      {
       UserSelector.Hide();
       UserSelector.Destroy();
       UserSelector = null;
       break;
      }
     }
        }
 }
 private void OnSyncNowClicked(object o, EventArgs args)
 {
     try
        {
     ifws.SynciFolderNow(ifolder.ID);
        }
        catch(Exception e)
        {
     iFolderExceptionDialog ied = new iFolderExceptionDialog(
     topLevelWindow, e);
     ied.Run();
     ied.Hide();
     ied.Destroy();
     return;
        }
 }
 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;
        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(accDialog.IsOwner)
        {
     ifws.ChangeOwner( ifolder.ID,
      user.UserID,
      "Admin");
     oldOwnerID = ifolder.OwnerID;
     user.Rights = "Admin";
     ifolder.Owner = user.Name;
     ifolder.OwnerID = user.UserID;
     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));
     }
        }
        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. 6
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();
     }
        }
 }
Esempio n. 7
0
 private void ShowFolderProperties(iFolderHolder ifHolder, int desiredPage)
 {
     if (ifHolder != null)
        {
     iFolderPropertiesDialog propsDialog =
      (iFolderPropertiesDialog) PropDialogs[ifHolder.iFolder.ID];
     if (propsDialog == null)
     {
      try
      {
       propsDialog =
        new iFolderPropertiesDialog(this, ifHolder.iFolder, ifws, simws, simiasManager);
       propsDialog.SetPosition(WindowPosition.Center);
       propsDialog.Response +=
     new ResponseHandler(OnPropertiesDialogResponse);
       propsDialog.CurrentPage = desiredPage;
       propsDialog.ShowAll();
       PropDialogs[ifHolder.iFolder.ID] = propsDialog;
      }
      catch(Exception e)
      {
       if(propsDialog != null)
       {
        propsDialog.Hide();
        propsDialog.Destroy();
        propsDialog = null;
       }
       iFolderExceptionDialog ied =
        new iFolderExceptionDialog(this, e);
       ied.Run();
       ied.Hide();
       ied.Destroy();
       ied = null;
      }
     }
     else
     {
      propsDialog.Present();
      propsDialog.CurrentPage = desiredPage;
     }
        }
 }
Esempio n. 8
0
 private void OnSyncUnitsChanged(object o, EventArgs args)
 {
     if (oneMinuteLimitNotifyWindow != null)
        {
     oneMinuteLimitNotifyWindow.Hide();
     oneMinuteLimitNotifyWindow.Destroy();
     oneMinuteLimitNotifyWindow = null;
        }
        int syncSpinValue = (int)SyncSpinButton.Value;
        currentSyncUnit = (SyncUnit)SyncUnitsComboBox.Active;
        if (currentSyncUnit == SyncUnit.Seconds)
        {
     SyncSpinButton.Adjustment.Lower = 60;
     if (syncSpinValue < 60)
     {
      oneMinuteLimitNotifyWindow =
       new NotifyWindow(
       SyncSpinButton, Util.GS("Synchronization Interval Limit"),
       Util.GS("The synchronization interval cannot be set to less than one minute.  It was automatically changed to 60 seconds."),
       Gtk.MessageType.Info, 10000);
      oneMinuteLimitNotifyWindow.ShowAll();
      SyncSpinButton.ValueChanged -=
       new EventHandler(OnSyncIntervalChanged);
      SyncSpinButton.Value = 60;
      syncSpinValue = 60;
      SyncSpinButton.ValueChanged +=
       new EventHandler(OnSyncIntervalChanged);
     }
        }
        else
        {
     SyncSpinButton.Adjustment.Lower = 1;
        }
        int syncInterval =
     CalculateActualSyncInterval(syncSpinValue,
        currentSyncUnit);
        try
        {
     lastSyncInterval = syncInterval;
     if(lastSyncInterval <= 0)
     {
      ifws.SetDefaultSyncInterval(-1);
     }
     else
     {
      ifws.SetDefaultSyncInterval(lastSyncInterval);
     }
     SaveSyncUnitConfig();
        }
        catch(Exception e)
        {
     iFolderExceptionDialog ied = new iFolderExceptionDialog(
      topLevelWindow, e);
     ied.Run();
     ied.Hide();
     ied.Destroy();
     return;
        }
 }
Esempio n. 9
0
 private void OnRemoveAccount(object o, EventArgs args)
 {
     TreeSelection tSelect = AccTreeView.Selection;
        if(tSelect.CountSelectedRows() == 1)
        {
     TreeModel tModel;
     TreeIter iter;
     tSelect.GetSelected(out tModel, out iter);
     string domainID = (string) tModel.GetValue(iter, 0);
     DomainInformation dom = domainController.GetDomain(domainID);
     RemoveAccountDialog rad = new RemoveAccountDialog(dom);
     rad.TransientFor = topLevelWindow;
     int rc = rad.Run();
     rad.Hide();
     if((ResponseType)rc == ResponseType.Yes)
     {
      try
      {
       removedDomains[dom.ID] = dom.ID;
       domainController.RemoveDomain(dom.ID, rad.RemoveiFoldersFromServer);
       RemoveDomain(dom.ID);
      }
      catch(Exception e)
      {
       if (removedDomains.ContainsKey(dom.ID))
        removedDomains.Remove(dom.ID);
       iFolderExceptionDialog ied =
        new iFolderExceptionDialog( topLevelWindow, e);
       ied.Run();
       ied.Hide();
       ied.Destroy();
       rad.Destroy();
       return;
      }
      AddButton.Sensitive = true;
      RemoveButton.Sensitive = false;
      DetailsButton.Sensitive = false;
     }
     rad.Destroy();
        }
 }
Esempio n. 10
0
 private void OnAutoSyncButton(object o, EventArgs args)
 {
     if(AutoSyncCheckButton.Active == true)
        {
     SyncSpinButton.Sensitive = true;
     SyncUnitsComboBox.Sensitive = true;
     SyncUnitsComboBox.Changed -= new EventHandler(OnSyncUnitsChanged);
     SyncUnitsComboBox.Active = (int)SyncUnit.Minutes;
     currentSyncUnit = SyncUnit.Minutes;
     SaveSyncUnitConfig();
     SyncUnitsComboBox.Changed += new EventHandler(OnSyncUnitsChanged);
     SyncSpinButton.Value = 5;
        }
        else
        {
     if (oneMinuteLimitNotifyWindow != null)
     {
      oneMinuteLimitNotifyWindow.Hide();
      oneMinuteLimitNotifyWindow.Destroy();
      oneMinuteLimitNotifyWindow = null;
     }
     try
     {
      ifws.SetDefaultSyncInterval(-1);
     }
     catch(Exception e)
     {
      iFolderExceptionDialog ied = new iFolderExceptionDialog(
       topLevelWindow, e);
      ied.Run();
      ied.Hide();
      ied.Destroy();
      return;
     }
     SyncSpinButton.Value = 0;
     SyncSpinButton.Sensitive = false;
     SyncUnitsComboBox.Sensitive = false;
        }
 }
Esempio n. 11
0
 private void OnSyncIntervalChanged(object o, EventArgs args)
 {
     if (oneMinuteLimitNotifyWindow != null)
        {
     oneMinuteLimitNotifyWindow.Hide();
     oneMinuteLimitNotifyWindow.Destroy();
     oneMinuteLimitNotifyWindow = null;
        }
        int syncSpinValue =
     CalculateActualSyncInterval((int)SyncSpinButton.Value,
        currentSyncUnit);
        try
        {
     lastSyncInterval = syncSpinValue;
     if(lastSyncInterval <= 0)
     {
      ifws.SetDefaultSyncInterval(-1);
     }
     else
     {
      ifws.SetDefaultSyncInterval(lastSyncInterval);
     }
        }
        catch(Exception e)
        {
     iFolderExceptionDialog ied = new iFolderExceptionDialog(
      topLevelWindow, e);
     ied.Run();
     ied.Hide();
     ied.Destroy();
     return;
        }
 }
 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;
        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(accDialog.IsOwner)
        {
     if( ifws.CanOwnerBeChanged(user.UserID,ifolder.DomainID))
     {
      ifws.ChangeOwner( ifolder.ID,
      user.UserID,
      "Admin");
      oldOwnerID = ifolder.OwnerID;
      user.Rights = "Admin";
      ifolder.Owner = user.Name;
      ifolder.OwnerID = user.UserID;
      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. 13
0
 private void OnSyncIntervalChanged(object o, EventArgs args)
 {
     if ((currentSyncUnit == SyncUnit.Seconds) && (SyncSpinButton.Value < 5) )
        {
        if (oneMinuteLimitNotifyWindow != null)
        {
       oneMinuteLimitNotifyWindow.Hide();
        oneMinuteLimitNotifyWindow.Destroy();
        oneMinuteLimitNotifyWindow = null;
        }
        SyncSpinButton.Value = 5;
        oneMinuteLimitNotifyWindow =
      new NotifyWindow(
       SyncSpinButton, Util.GS("Synchronization Interval Limit"),
       Util.GS("The synchronization interval cannot be set to less than 5 Seconds.  It will automatically change to 5 seconds."), Gtk.MessageType.Info, 10000);
       oneMinuteLimitNotifyWindow.ShowAll();
        }
        int syncSpinValue =
     CalculateActualSyncInterval((int)SyncSpinButton.Value,
        currentSyncUnit);
        try
        {
     lastSyncInterval = syncSpinValue;
     if(lastSyncInterval <= 0)
     {
      ifws.SetDefaultSyncInterval(-1);
     }
     else
     {
      ifws.SetDefaultSyncInterval(lastSyncInterval);
     }
        }
        catch(Exception e)
        {
     iFolderExceptionDialog ied = new iFolderExceptionDialog(
      topLevelWindow, e);
     ied.Run();
     ied.Hide();
     ied.Destroy();
     return;
        }
 }
 private void SaveLimit()
 {
     long sizeLimit = GetCurrentLimit();
     try
        {
     ifws.SetiFolderDiskSpaceLimit(ifolder.ID, sizeLimit);
        }
        catch(Exception e)
        {
     iFolderExceptionDialog ied = new iFolderExceptionDialog(
     topLevelWindow, e);
     ied.Run();
     ied.Hide();
     ied.Destroy();
     return;
        }
 }
Esempio n. 15
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. 16
0
 private void DeleteSelectedFolderFromServer()
 {
     iFolderHolder holder = iFolderIconView.SelectedFolder;
        if (holder != null && holder.iFolder.IsSubscription)
        {
     int rc = 0;
     rc = AskDeleteiFolder(holder);
     if(rc != -8)
      return;
     try
     {
      bool removeDefault = false;
      string domainID = holder.iFolder.DomainID;
      if( simws.GetDefaultiFolder( domainID ) == holder.iFolder.ID)
      {
       Debug.PrintLine("Removing default iFolder");
       removeDefault = true;
      }
      if( removeDefault == true )
      {
       Debug.PrintLine("Removing default ifolder");
       simws.DefaultAccount(domainID, null);
      }
      else
       Debug.PrintLine("Not a default account");
      ifdata.DeleteiFolder(holder.iFolder.ID);
      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();
      return;
     }
        }
 }
Esempio n. 17
0
 private void RemoveMembershipFromSelectedFolder()
 {
     iFolderHolder holder = iFoldersIconView.SelectedFolder;
        if (holder != null && holder.iFolder.IsSubscription)
        {
     int rc = 0;
     rc = AskRemoveMembership(holder);
     if(rc != -8)
      return;
     try
     {
      ifdata.DeleteiFolder(holder.iFolder.ID);
      iFoldersIconView.UnselectAll();
     }
     catch(Exception e)
     {
      iFolderExceptionDialog ied =
       new iFolderExceptionDialog(
        this,
        e);
      ied.Run();
      ied.Hide();
      ied.Destroy();
      return;
     }
        }
 }
Esempio n. 18
0
 private void RemoveMembershipFromSelectedFolder()
 {
     iFolderHolder holder = iFolderIconView.SelectedFolder;
        if (holder != null && holder.iFolder.IsSubscription)
        {
     int rc = 0;
     rc = AskRemoveMembership(holder);
     if(rc != -8)
      return;
     try
     {
      ifdata.DeleteiFolder(holder.iFolder.ID);
      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();
      return;
     }
        UpdateServerInfoForSelectedDomain();
        }
 }
Esempio n. 19
0
 private void ResolveConflicts(iFolderHolder holder)
 {
     if (holder == null) return;
        iFolderConflictDialog conflictDialog =
     (iFolderConflictDialog) ConflictDialogs[holder.iFolder.ID];
        if (conflictDialog == null)
        {
     try
     {
      conflictDialog =
       new iFolderConflictDialog(
        this, holder.iFolder, ifws, simws);
      conflictDialog.SetPosition(WindowPosition.Center);
      conflictDialog.Response +=
       new ResponseHandler(OnConflictDialogResponse);
      conflictDialog.ShowAll();
      ConflictDialogs[holder.iFolder.ID] = conflictDialog;
     }
     catch(Exception e)
     {
      if(conflictDialog != null)
      {
       conflictDialog.Hide();
       conflictDialog.Destroy();
       conflictDialog = null;
      }
      iFolderExceptionDialog ied =
       new iFolderExceptionDialog(this, e);
      ied.Run();
      ied.Hide();
      ied.Destroy();
      ied = null;
     }
        }
        else
        {
     conflictDialog.Present();
        }
 }
Esempio n. 20
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();
     }
        }
 }
Esempio n. 21
0
 private void SyncSelectedFolder()
 {
     iFolderHolder holder = iFoldersIconView.SelectedFolder;
        if (holder != null)
        {
     try
     {
     ifws.SynciFolderNow(holder.iFolder.ID);
     }
     catch(Exception e)
     {
      iFolderExceptionDialog ied =
       new iFolderExceptionDialog(
        this,
        e);
      ied.Run();
      ied.Hide();
      ied.Destroy();
     }
        }
 }
Esempio n. 22
0
 private void RemoveSelectedFolderHandler()
 {
     iFolderHolder holder = iFoldersIconView.SelectedFolder;
        if (holder != null)
        {
     iFolderMsgDialog dialog = new iFolderMsgDialog(
      this,
      iFolderMsgDialog.DialogType.Question,
      iFolderMsgDialog.ButtonSet.YesNo,
      "",
      Util.GS("Change 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."));
     int rc = dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     if(rc == -8)
     {
      try
      {
       ifdata.RevertiFolder(holder.iFolder.ID);
      }
      catch(Exception e)
      {
       iFolderExceptionDialog ied =
        new iFolderExceptionDialog(
     this,
     e);
       ied.Run();
       ied.Hide();
       ied.Destroy();
      }
      UpdateSensitivity();
     }
        }
 }