Ejemplo n.º 1
0
        /// <summary>
        /// Event Handler for Selection Changed event
        /// </summary>
        private void SelectionChangedHandler(object o, EventArgs args)
        {
//Debug.PrintLine("iFolderIconView.SelectionChangedHandler()");
            iFolderViewGroupSelection gSelect = (iFolderViewGroupSelection)o;
            iFolderViewGroup          group   = gSelect.ViewGroup;

            // Deselect all other items from other groups
            foreach (iFolderViewGroup tempGroup in viewGroups)
            {
                if (group != tempGroup)
                {
                    tempGroup.Selection.SelectionChanged -= new EventHandler(SelectionChangedHandler);
                    tempGroup.Selection.UnselectAll();
                    tempGroup.Selection.SelectionChanged += new EventHandler(SelectionChangedHandler);
                }
            }

            if (SelectionChanged != null)
            {
                iFolderViewItem selectedItem = null;
                if (group.Selection.GetSelected(out selectedItem))
                {
                    currentSelection = selectedItem.Holder;
                    SelectionChanged(selectedItem.Holder, EventArgs.Empty);
                }
                else
                {
                    currentSelection = null;
                    SelectionChanged(null, EventArgs.Empty);
                }
            }
        }
Ejemplo n.º 2
0
 public iFolderViewItem(iFolderHolder holder, iFolderViewGroup group, TreeIter iter, int maxWidth)
 {
     this.holder = holder;
        this.group = group;
        this.iter = iter;
        this.maxWidth = maxWidth;
        this.CanFocus = true;
        this.bSelected = false;
        this.bMouseIsHovering = false;
        this.ModifyBg(StateType.Normal, this.Style.Base(StateType.Normal));
        this.ModifyBase(StateType.Normal, this.Style.Base(StateType.Normal));
        currentName = "";
        currentLocation = "";
        currentStatus = "";
        LoadImages();
        SetPixbufs();
        this.Add(CreateWidgets());
        this.WidthRequest = this.maxWidth;
        this.Realized +=
     new EventHandler(OnWidgetRealized);
        TargetEntry[] targets =
     new TargetEntry[]
     {
      new TargetEntry ("text/ifolder-id", 0, (uint)iFolderWindow.DragTargetType.iFolderID)
     };
        this.DragDataGet += new DragDataGetHandler(HandleDragDataGet);
        Drag.SourceSet(this, Gdk.ModifierType.Button1Mask, targets, Gdk.DragAction.Move);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// UnSelect All
        /// </summary>
        public void UnselectAll()
        {
            foreach (iFolderViewGroup group in viewGroups)
            {
                group.Selection.SelectionChanged -= new EventHandler(SelectionChangedHandler);
                group.Selection.UnselectAll();
                group.Selection.SelectionChanged += new EventHandler(SelectionChangedHandler);
            }

            if (SelectionChanged != null)
            {
                currentSelection = null;
                SelectionChanged(null, EventArgs.Empty);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="holder">iFolder Holder</param>
        /// <param name="group">iFolderViewGroup</param>
        public iFolderViewItem(iFolderHolder holder, iFolderViewGroup group, TreeIter iter, int maxWidth)
        {
            this.holder   = holder;
            this.group    = group;
            this.iter     = iter;
            this.maxWidth = maxWidth;

            this.CanFocus = true;

            this.bSelected        = false;
            this.bMouseIsHovering = false;

            this.ModifyBg(StateType.Normal, this.Style.Base(StateType.Normal));
            this.ModifyBase(StateType.Normal, this.Style.Base(StateType.Normal));

            currentName     = "";
            currentLocation = "";
            currentStatus   = "";

//			domainController = DomainController.GetDomainController();

            LoadImages();
            SetPixbufs();

            this.Add(CreateWidgets());

            this.WidthRequest = this.maxWidth;

            this.Realized +=
                new EventHandler(OnWidgetRealized);

// FIXME: Fix things up so that if the user changes the theme, our icons will refresh too
//			if (!registeredForThemeChangeEvent)
//			{
//				IconTheme.Changed += new EventHandler(OnGtkIconThemeChanged);
//			}
            ///
            /// Set up drag and drop
            ///
            TargetEntry[] targets =
                new TargetEntry[]
            {
                new TargetEntry("text/ifolder-id", 0, (uint)iFolderWindow.DragTargetType.iFolderID)
            };

            this.DragDataGet += new DragDataGetHandler(HandleDragDataGet);
            Drag.SourceSet(this, Gdk.ModifierType.Button1Mask, targets, Gdk.DragAction.Move);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="parentWidget">Parent Widget</param>
        public iFolderIconView(Widget parentWidget)
        {
            this.ModifyBg(StateType.Normal, this.Style.Base(StateType.Normal));
            this.ModifyBase(StateType.Normal, this.Style.Base(StateType.Normal));
            this.CanFocus        = true;
            this.parentWidget    = parentWidget;
            this.alreadyDisposed = false;

            vbox = new VBox(false, 0);
            this.Add(vbox);

            currentSelection = null;

            viewGroups = new ArrayList();

            this.Realized +=
                new EventHandler(OnWidgetRealized);

            parentWidget.SizeAllocated +=
                new SizeAllocatedHandler(OnSizeAllocated);
        }
Ejemplo n.º 6
0
 public iFolderViewItem(iFolderHolder holder, iFolderViewGroup group, TreeIter iter, int maxWidth)
 {
     this.holder = holder;
        this.group = group;
        this.iter = iter;
        this.maxWidth = maxWidth;
        this.CanFocus = true;
        this.bSelected = false;
        this.bMouseIsHovering = false;
        this.ModifyBg(StateType.Normal, this.Style.Base(StateType.Normal));
        this.ModifyBase(StateType.Normal, this.Style.Base(StateType.Normal));
        currentName = "";
        currentLocation = "";
        currentStatus = "";
        domainController = DomainController.GetDomainController();
        LoadImages();
        SetPixbufs();
        this.Add(CreateWidgets());
        this.WidthRequest = this.maxWidth;
        this.Realized +=
     new EventHandler(OnWidgetRealized);
 }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="holder">iFolder Holder</param>
 /// <param name="button">Button</param>
 public iFolderClickedArgs(iFolderHolder holder, uint button)
 {
     this.holder = holder;
     this.button = button;
 }
Ejemplo n.º 9
0
        private void SimiasEventSyncCollectionHandler(SimiasEventArgs args)
        {
            try
            {
                if (args == null)
                {
                    Debug.PrintLine("SimiasEventSyncCollectionHandler received a null SimiasEventArgs");
                    return;
                }
                CollectionSyncEventArgs syncEventArgs =
                    args as CollectionSyncEventArgs;
                if (syncEventArgs == null || syncEventArgs.Name == null || syncEventArgs.ID == null)
                {
                    Debug.PrintLine("SimiasEventSyncCollectionHandler() Name, ID, Action, or Connected is null");
                    return;                     // Prevent a null object
                }

                if (ifdata.IsiFolder(syncEventArgs.ID))
                {
                    iFolderHolder ifHolder =
                        ifdata.GetiFolder(syncEventArgs.ID);

                    if (ifHolder != null)
                    {
                        switch (syncEventArgs.Action)
                        {
                        case Simias.Client.Event.Action.StartLocalSync:
                            ifHolder.State = iFolderState.SynchronizingLocal;
                            break;

                        case Simias.Client.Event.Action.StartSync:
                            ifHolder.State = iFolderState.Synchronizing;
                            break;

                        case Simias.Client.Event.Action.StopSync:
                            try
                            {
                                SyncSize syncSize = ifws.CalculateSyncSize(syncEventArgs.ID);
                                ifHolder.ObjectsToSync = syncSize.SyncNodeCount;
                            }
                            catch
                            {}

                            if (ifHolder.ObjectsToSync > 0)
                            {
                                ifHolder.State = iFolderState.Normal;
                            }
                            else
                            {
                                if (syncEventArgs.Connected || ifHolder.iFolder.Role == "Master")
                                {
                                    ifHolder.State = iFolderState.Normal;
                                }
                                else
                                {
                                    ifHolder.State = iFolderState.Disconnected;
                                }
                            }
                            break;
                        }

                        if ((ifHolder.iFolder.UnManagedPath == null) ||
                            (ifHolder.iFolder.UnManagedPath.Length == 0))
                        {
                            // Because the iFolder has no path
                            // re-read the iFolder and fire a changed event
                            ifHolder = ifdata.ReadiFolder(syncEventArgs.ID);
                            if (ifHolder != null)
                            {
                                lock (NodeEventQueue)
                                {
                                    NodeEventQueue.Enqueue(new SimiasEvent(
                                                               ifHolder.iFolder.ID, null,
                                                               null, SimiasEventType.ChangediFolder));
                                    SimiasEventFired.WakeupMain();
                                }
                            }
                        }
                    }
                }

                // pass the sync event on to the client
                lock (SyncEventQueue)
                {
                    SyncEventQueue.Enqueue(syncEventArgs);
                    SyncEventFired.WakeupMain();
                }
            }
            catch (Exception e)
            {
                if (printErrors)
                {
                    Debug.PrintLine("Exception in SimiasEventSyncCollectionHandler(): " + e.Message);
                    Debug.PrintLine(e.StackTrace);
                }
            }
        }
Ejemplo n.º 10
0
 private void UpdateActionsSensitivity(iFolderHolder holder)
 {
     if (holder == null)
        {
     SynchronizedFolderTasks.Visible = false;
        }
        else
        {
     if (holder.iFolder.IsSubscription)
     {
      OpenSynchronizedFolderButton.Visible = false;
      SynchronizeNowButton.Visible = false;
      ShareSynchronizedFolderButton.Visible = false;
      ViewFolderPropertiesButton.Visible = false;
      ResolveConflictsButton.Visible = false;
      RemoveiFolderButton.Visible = false;
      DownloadAvailableiFolderButton.Visible = true;
      DomainInformation domain =
       domainController.GetDomain(holder.iFolder.DomainID);
      if (domain == null ||
       domain.MemberUserID == holder.iFolder.OwnerID)
      {
       DeleteFromServerButton.Visible = true;
       RemoveMembershipButton.Visible = false;
      }
      else
      {
       DeleteFromServerButton.Visible = false;
       RemoveMembershipButton.Visible = true;
      }
     }
     else
     {
      DownloadAvailableiFolderButton.Visible = false;
      DeleteFromServerButton.Visible = false;
      RemoveMembershipButton.Visible = false;
      OpenSynchronizedFolderButton.Visible = true;
      SynchronizeNowButton.Visible = true;
      ShareSynchronizedFolderButton.Visible = true;
      ViewFolderPropertiesButton.Visible = true;
      RemoveiFolderButton.Visible = true;
      if (holder.iFolder.HasConflicts)
       ResolveConflictsButton.Visible = true;
      else
       ResolveConflictsButton.Visible = false;
     }
     SynchronizedFolderTasks.Visible = true;
     RemoveiFolderButton.Sensitive = true;
        }
 }
Ejemplo n.º 11
0
 private void UpdateActionsSensitivity(iFolderHolder holder)
 {
     OpenSynchronizedFolderButton.Visible = false;
        SynchronizeNowButton.Sensitive = false;
        ShareSynchronizedFolderButton.Sensitive = false;
        ViewFolderPropertiesButton.Visible = false;
        ResolveConflictsButton.Sensitive = false;
        RemoveiFolderButton.Sensitive = false;
       DownloadAvailableiFolderButton.Sensitive = false;
        MergeAvailableiFolderButton.Sensitive = false;
        DeleteFromServerButton.Sensitive = false;
        RemoveMembershipButton.Sensitive = false;
        ShowHideAllFoldersButton.Visible = false;
        if (holder == null)
        {
     SynchronizedFolderTasks.Visible = false;
        if(RemoveMembershipButton.Visible && DeleteFromServerButton.Visible)
     {
      RemoveMembershipButton.Visible = false;
     }
        }
        else
        {
     if (holder.iFolder.IsSubscription)
     {
      OpenSynchronizedFolderButton.Visible = false;
      SynchronizeNowButton.Sensitive = false;
      ShareSynchronizedFolderButton.Sensitive = false;
      ViewFolderPropertiesButton.Visible = false;
      ResolveConflictsButton.Sensitive = false;
      RemoveiFolderButton.Sensitive = false;
      DownloadAvailableiFolderButton.Sensitive = true;
      MergeAvailableiFolderButton.Sensitive = true;
      DomainInformation domain =
       domainController.GetDomain(holder.iFolder.DomainID);
      if (domain == null ||
       domain.MemberUserID == holder.iFolder.OwnerID)
      {
       DeleteFromServerButton.Sensitive = true;
       RemoveMembershipButton.Sensitive = false;
       DeleteFromServerButton.Visible = true;
       RemoveMembershipButton.Visible = false;
      }
      else
      {
       DeleteFromServerButton.Sensitive = false;
       RemoveMembershipButton.Sensitive = true;
       DeleteFromServerButton.Visible = false;
       RemoveMembershipButton.Visible = true;
      }
     }
     else
     {
      DownloadAvailableiFolderButton.Sensitive = false;
      MergeAvailableiFolderButton.Sensitive = false;
      DeleteFromServerButton.Sensitive = false;
      RemoveMembershipButton.Sensitive = false;
      SynchronizeNowButton.Sensitive = true;
      if (holder.State == iFolderState.Initial && holder.iFolder.State == "Available")
      {
      ShareSynchronizedFolderButton.Sensitive = false;
      ViewFolderPropertiesButton.Visible = false;
      }
      else
      {
      ShareSynchronizedFolderButton.Sensitive = true;
      }
      if (holder.iFolder.HasConflicts)
       ResolveConflictsButton.Sensitive = true;
      else
       ResolveConflictsButton.Sensitive = false;
      if( ( ( (holder.iFolder.State == "WaitSync") || (holder.iFolder.State == "Local") )
       && (holder.State == iFolderState.Synchronizing) )
      || (holder.iFolder.Role.Equals("Master"))
        )
      {
       RemoveiFolderButton.Sensitive = false;
      }
      else
      {
       RemoveiFolderButton.Sensitive = true;
      }
     }
     SynchronizedFolderTasks.Visible = true;
        }
 }
Ejemplo n.º 12
0
 public bool UpdateiFolderDetails(iFolderHolder holder)
 {
     if(holder != null && labelName != null)
       {
        string ifolderName = holder.iFolder.Name;
        if(holder.iFolder.Name.Length > displayableName)
        {
        ifolderName = ifolderName.Substring(0,displayableName) + "..." ;
        }
     labelName.Text = string.Format(Util.GS("Name: {0}"), ifolderName);
     labelOwner.Text = string.Format(Util.GS("Owner: {0}"),holder.iFolder.Owner);
     labelAccess.Text = string.Format(Util.GS("Access: {0}"),holder.iFolder.CurrentUserRights);
      if(holder.iFolder.IsSubscription)
        {
        labelOwner.Hide();
        }
        else
        {
        labelOwner.Show();
        }
      }
        return true;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="holder">iFolder Holder</param>
 public iFolderActivatedArgs(iFolderHolder holder)
 {
     this.holder = holder;
 }
Ejemplo n.º 14
0
 private Gdk.Pixbuf GetImage(iFolderHolder holder)
 {
     Gdk.Pixbuf returnimg = new Gdk.Pixbuf(Util.ImagesPath("ifolder32.png"));
        if (holder.iFolder.IsSubscription)
                 {
     returnimg = new Gdk.Pixbuf(Util.ImagesPath("ifolder-download32.png"));
        }
        else
        {
     if (holder.State == iFolderState.Synchronizing ||
      holder.State == iFolderState.SynchronizingLocal)
     {
      returnimg = new Gdk.Pixbuf(Util.ImagesPath("ifolder-sync32.png"));
     }
     else
     {
      if (holder.iFolder.HasConflicts)
      {
       returnimg = new Gdk.Pixbuf(Util.ImagesPath("ifolder-warning32.png"));
      }
      else
      {
       switch (holder.State)
       {
        case iFolderState.Disconnected:
     returnimg = new Gdk.Pixbuf(Util.ImagesPath("ifolder-warning32.png"));
     break;
        case iFolderState.NoPassphrase:
     returnimg = new Gdk.Pixbuf(Util.ImagesPath("ifolder-warning32.png"));
     break;
        case iFolderState.FailedSync:
     returnimg = new Gdk.Pixbuf(Util.ImagesPath("ifolder-error32.png"));
     break;
        case iFolderState.Initial:
     returnimg = new Gdk.Pixbuf(Util.ImagesPath("ifolder-waiting32.png"));
     break;
        case iFolderState.Normal:
        default:
     if (holder.ObjectsToSync > 0)
     {
      returnimg = new Gdk.Pixbuf(Util.ImagesPath("ifolder-waiting32.png"));
     }
     else
     {
      if( holder.iFolder.encryptionAlgorithm == null || holder.iFolder.encryptionAlgorithm == "")
      {
       if( holder.iFolder.shared == true)
       {
        returnimg = new Gdk.Pixbuf(Util.ImagesPath("ifolder_user_32.png"));
       }
       else
       {
        returnimg = new Gdk.Pixbuf(Util.ImagesPath("ifolder32.png"));
       }
      }
      else
      {
       returnimg = new Gdk.Pixbuf(Util.ImagesPath("encrypt-ilock32.png"));
      }
     }
     break;
       }
      }
     }
        }
        return returnimg;
 }
Ejemplo n.º 15
0
 private iFolderHolder AddiFolder(iFolderWeb ifolder)
 {
     Console.WriteLine("AddiFolder()");
     Console.WriteLine(Environment.StackTrace);
        lock (instanceLock)
        {
     iFolderHolder ifHolder = null;
     if (ifolder.CollectionID == null)
     {
      Console.WriteLine("**** CollectionID is null ****");
     }
     else if (ifolder.ID == null)
     {
      Console.WriteLine("**** ID is null ****");
     }
     Console.WriteLine("\t1");
     string ifolderID =
      ifolder.IsSubscription ?
       ifolder.CollectionID :
       ifolder.ID;
     Console.WriteLine("\t{0}", ifolderID);
     if (ifolderIters.ContainsKey(ifolderID))
     {
     Console.WriteLine("\t3");
      TreeIter iter = (TreeIter)ifolderIters[ifolderID];
     Console.WriteLine("\t4");
      ifHolder = (iFolderHolder)
       iFolderListStore.GetValue(iter, 0);
     Console.WriteLine("\t5");
      if (ifHolder != null)
      {
     Console.WriteLine("\t6");
       ifHolder.iFolder = ifolder;
       TreePath path = iFolderListStore.GetPath(iter);
     Console.WriteLine("\t7");
       if (path != null)
       {
     Console.WriteLine("\t8");
        iFolderChangedHandler changedHandler =
     new iFolderChangedHandler(
      path, iter, iFolderListStore);
     Console.WriteLine("\t9");
        GLib.Idle.Add(changedHandler.IdleHandler);
       }
      }
      else
      {
     Console.WriteLine("*** SOMETHING WENT BAD IN iFolderData.AddiFolder() ***");
      }
     }
     else
     {
     Console.WriteLine("\t10");
      ifHolder = new iFolderHolder(ifolder);
     Console.WriteLine("\t11");
      iFolderAddHandler addHandler =
       new iFolderAddHandler(ifHolder, this);
     Console.WriteLine("\t12");
      GLib.Idle.Add(addHandler.IdleHandler);
     }
     Console.WriteLine("\t13");
     return ifHolder;
        }
 }
Ejemplo n.º 16
0
 private void ProtectedAddiFolder(iFolderHolder holder)
 {
     Console.WriteLine("ProtectedAddiFolder()");
     Console.WriteLine(Environment.StackTrace);
        if (holder == null) return;
        lock(instanceLock)
        {
     iFolderWeb ifolder = holder.iFolder;
     string ifolderID =
      ifolder.IsSubscription ?
       ifolder.CollectionID :
       ifolder.ID;
     Console.WriteLine("\t{0}", ifolderID);
     if (!ifolderIters.ContainsKey(ifolderID))
     {
      TreeIter iter = iFolderListStore.AppendValues(holder);
      if (ifolder.IsSubscription)
      {
     Console.WriteLine("\tSubscription: {0}", ifolder.Name);
       ifolderIters[ifolder.CollectionID] = iter;
       subToiFolderMap[ifolder.ID] = ifolder.CollectionID;
      }
      else
      {
     Console.WriteLine("\tiFolder: {0}", ifolder.Name);
       ifolderIters[ifolder.ID] = iter;
      }
     }
        }
 }
Ejemplo n.º 17
0
        private void NodeDeletedHandler(NodeEventArgs nargs)
        {
            try
            {
                switch (nargs.Type)
                {
                case "Subscription":
                {
                    if (ifdata.ISPOBox(nargs.Collection))
                    {
                        lock (NodeEventQueue)
                        {
                            ifdata.DeliFolder(nargs.ID);
                            NodeEventQueue.Enqueue(new SimiasEvent(
                                                       nargs.Collection, null, null,
                                                       SimiasEventType.DeliFolder));
                            SimiasEventFired.WakeupMain();
                        }
                    }
                    break;
                }

                case "Collection":
                {
                    lock (NodeEventQueue)
                    {
                        iFolderHolder ifHolder =
                            ifdata.GetiFolder(nargs.Collection);
                        if ((ifHolder != null) &&
                            (!ifHolder.iFolder.IsSubscription))
                        {
                            ifdata.DeliFolder(nargs.ID);
                            NodeEventQueue.Enqueue(new SimiasEvent(
                                                       nargs.Collection, null, null,
                                                       SimiasEventType.DeliFolder));
                        }
                        SimiasEventFired.WakeupMain();
                    }
                    break;
                }

                case "Member":
                {
                    if (ifdata.IsiFolder(nargs.Collection))
                    {
                        lock (NodeEventQueue)
                        {
                            NodeEventQueue.Enqueue(new SimiasEvent(
                                                       nargs.Collection, null, nargs.ID,
                                                       SimiasEventType.DelUser));
                            SimiasEventFired.WakeupMain();
                        }
                    }
                    break;
                }

                case "Domain":
                {
                    // The user just successfully created/logged-into a domain
                    lock (NodeEventQueue)
                    {
                        NodeEventQueue.Enqueue(
                            new SimiasEvent(nargs.Collection, SimiasEventType.DelDomain));
                        SimiasEventFired.WakeupMain();
                    }
                    break;
                }
                }
            }
            catch (Exception e)
            {
                if (printErrors)
                {
                    Debug.PrintLine("Exception in NodeDeletedHandler(): " + e.Message);
                    Debug.PrintLine(e.StackTrace);
                }
            }
        }
Ejemplo n.º 18
0
        private void NodeChangedHandler(NodeEventArgs nargs)
        {
            try
            {
                switch (nargs.Type)
                {
                case "Collection":
                {
                    iFolderHolder ifHolder =
                        ifdata.ReadiFolder(nargs.Collection);

                    if ((ifHolder != null) &&
                        (ifHolder.iFolder.HasConflicts))
                    {
                        lock (NodeEventQueue)
                        {
                            NodeEventQueue.Enqueue(new SimiasEvent(
                                                       ifHolder.iFolder.ID, null, null,
                                                       SimiasEventType.ChangediFolder));
                            SimiasEventFired.WakeupMain();
                        }
                    }

                    break;
                }

                case "Member":
                {
                    if (ifdata.IsiFolder(nargs.Collection))
                    {
                        iFolderUser newuser =
                            ifdata.GetiFolderUserFromNodeID(
                                nargs.Collection, nargs.ID);

                        if ((newuser != null) &&
                            !ifdata.IsCurrentUser(newuser.UserID))
                        {
                            lock (NodeEventQueue)
                            {
                                NodeEventQueue.Enqueue(new SimiasEvent(
                                                           nargs.Collection, newuser,
                                                           newuser.UserID,
                                                           SimiasEventType.ChangedUser));
                                SimiasEventFired.WakeupMain();
                            }
                        }
                    }
                    break;
                }


                case "Subscription":
                {
                    if (ifdata.ISPOBox(nargs.Collection))
                    {
                        // The Collection is the PO Box so the node
                        // is most likely an invitation

                        iFolderHolder ifHolder =
                            ifdata.ReadAvailableiFolder(nargs.ID,
                                                        nargs.Collection);
                        if (ifHolder != null)
                        {
                            lock (NodeEventQueue)
                            {
                                NodeEventQueue.Enqueue(new SimiasEvent(
                                                           ifHolder.iFolder.CollectionID, null, null,
                                                           SimiasEventType.ChangediFolder));
                                SimiasEventFired.WakeupMain();
                            }
                        }
                    }
                    break;
                }
                }
            }
            catch (Exception e)
            {
                if (printErrors)
                {
                    Debug.PrintLine("Exception in NodeChangedHandler(): " + e.Message);
                    Debug.PrintLine(e.StackTrace);
                }
            }
        }
Ejemplo n.º 19
0
        private void NodeCreatedHandler(NodeEventArgs nargs)
        {
            try
            {
                switch (nargs.Type)
                {
                case "Subscription":
                {
                    //      if(ifdata.ISPOBox(nargs.Collection))
//                      {
//                          // The Collection is the PO Box so the node
//                          // is most likely an invitation

//                          iFolderHolder ifHolder =
//                              ifdata.ReadAvailableiFolder(nargs.ID,
//                                                          nargs.Collection);

//                          // if the iFolder already exists, ifdata will
//                          // return null to check it here
//                          if(ifHolder != null)
//                          {
//                              lock(NodeEventQueue)
//                              {
//                                  NodeEventQueue.Enqueue(new SimiasEvent(
//                                      ifHolder.iFolder.CollectionID, null, null,
//                                      SimiasEventType.NewiFolder));
//                                  SimiasEventFired.WakeupMain();
//                              }
//                          }
//                      }

                    break;
                }

                case "Member":
                {
                    if (ifdata.IsiFolder(nargs.Collection))
                    {
                        iFolderUser newuser =
                            ifdata.GetiFolderUserFromNodeID(
                                nargs.Collection, nargs.ID);

                        if ((newuser != null) &&
                            !ifdata.IsCurrentUser(newuser.UserID))
                        {
                            lock (NodeEventQueue)
                            {
                                NodeEventQueue.Enqueue(new SimiasEvent(
                                                           nargs.Collection, newuser,
                                                           newuser.UserID,
                                                           SimiasEventType.NewUser));
                                SimiasEventFired.WakeupMain();
                            }
                        }
                    }
                    break;
                }

                case "Collection":
                {
                    iFolderHolder ifHolder =
                        ifdata.ReadiFolder(nargs.Collection);

                    if (ifHolder != null)
                    {
                        lock (NodeEventQueue)
                        {
                            NodeEventQueue.Enqueue(new SimiasEvent(
                                                       ifHolder.iFolder.ID, null, null,
                                                       SimiasEventType.NewiFolder));
                            SimiasEventFired.WakeupMain();
                        }
                    }
                    break;
                }

                case "Domain":
                {
                    // The user just successfully created/logged-into a domain
                    lock (NodeEventQueue)
                    {
                        NodeEventQueue.Enqueue(
                            new SimiasEvent(nargs.Collection, SimiasEventType.NewDomain));
                        SimiasEventFired.WakeupMain();
                    }
                    break;
                }
                }
            }
            catch (Exception e)
            {
                if (printErrors)
                {
                    Debug.PrintLine("Exception in NodeCreatedHandler(): " + e.Message);
                    Debug.PrintLine(e.StackTrace);
                }
            }
        }
Ejemplo n.º 20
0
 public bool UpdateiFolderDetails(iFolderHolder holder)
 {
     if(holder != null && labelName != null)
        {
     labelName.Text = string.Format(Util.GS("Name:     {0}"),holder.iFolder.Name);
     labelOwner.Text = string.Format(Util.GS("Owner:    {0}"),holder.iFolder.Owner);
     labelAccess.Text = string.Format(Util.GS("Access:   {0}"),holder.iFolder.CurrentUserRights);
      if(holder.iFolder.IsSubscription)
     {
      labelOwner.Hide();
     }
     else
     {
      labelOwner.Show();
     }
        }
        return true;
 }
Ejemplo n.º 21
0
 public void UnselectAll()
 {
     foreach(iFolderViewGroup group in viewGroups)
        {
     group.Selection.SelectionChanged -= new EventHandler(SelectionChangedHandler);
     group.Selection.UnselectAll();
     group.Selection.SelectionChanged += new EventHandler(SelectionChangedHandler);
        }
        if (SelectionChanged != null)
        {
     currentSelection = null;
     SelectionChanged(null, EventArgs.Empty);
        }
 }
Ejemplo n.º 22
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);
        }
 }
Ejemplo n.º 23
0
 private void SelectionChangedHandler(object o, EventArgs args)
 {
     iFolderViewGroupSelection gSelect = (iFolderViewGroupSelection)o;
        iFolderViewGroup group = gSelect.ViewGroup;
        foreach(iFolderViewGroup tempGroup in viewGroups)
        {
     if (group != tempGroup)
     {
      tempGroup.Selection.SelectionChanged -= new EventHandler(SelectionChangedHandler);
      tempGroup.Selection.UnselectAll();
      tempGroup.Selection.SelectionChanged += new EventHandler(SelectionChangedHandler);
     }
        }
        if (SelectionChanged != null)
        {
     iFolderViewItem selectedItem = null;
     if (group.Selection.GetSelected(out selectedItem))
     {
      currentSelection = selectedItem.Holder;
      SelectionChanged(selectedItem.Holder, EventArgs.Empty);
     }
     else
     {
      currentSelection = null;
      SelectionChanged(null, EventArgs.Empty);
     }
        }
 }
Ejemplo n.º 24
0
 private bool MergeWithLocaliFolder(iFolderHolder holder, out bool cancelled)
 {
     bool status = false;
        cancelled = false;
        try
        {
     MigrationDialog migrationWindow = new MigrationDialog(this, ifws, simws, true, holder.iFolder.Name);
     migrationWindow.ShowAll();
     int res = migrationWindow.Run();
     String path = migrationWindow.MergePath;
     string UName = migrationWindow.UserName;
     migrationWindow.Hide();
     migrationWindow.Dispose();
     if( res == (int)ResponseType.Cancel )
     {
      cancelled = true;
     }
     if( res == (int)ResponseType.Ok && !cancelled && path != null)
     {
      ifdata.AcceptiFolderInvitation(holder.iFolder.ID, holder.iFolder.DomainID, path, true );
      MigrationDialog.RemoveFromRegistry( UName );
      status = true;
     }
     else if( path != null)
      cancelled = true;
        }
        catch(Exception e)
        {
     DisplayCreateOrSetupException(e);
        }
        return status;
 }
Ejemplo n.º 25
0
 public iFolderIconView(Widget parentWidget)
 {
     this.ModifyBg(StateType.Normal, this.Style.Base(StateType.Normal));
        this.ModifyBase(StateType.Normal, this.Style.Base(StateType.Normal));
        this.CanFocus = true;
        this.parentWidget = parentWidget;
        this.alreadyDisposed = false;
        vbox = new VBox(false, 0);
        this.Add(vbox);
        currentSelection = null;
        viewGroups = new ArrayList();
        this.Realized +=
     new EventHandler(OnWidgetRealized);
        parentWidget.SizeAllocated +=
     new SizeAllocatedHandler(OnSizeAllocated);
 }
Ejemplo n.º 26
0
 private void UpdateMenuSensitivity(iFolderHolder holder)
 {
     if (holder != null)
        {
        if( (holder.iFolder != null) &&
       ( (holder.State == iFolderState.Initial)|| (holder.State == iFolderState.Synchronizing) ) )
      {
     ShareMenuItem.Sensitive = false;
      OpenMenuItem.Sensitive = false;
      SyncNowMenuItem.Sensitive = false;
      ConflictMenuItem.Sensitive = false;
      RevertMenuItem.Sensitive = false;
      DeleteMenuItem.Sensitive = false;
      RemoveMenuItem.Sensitive = false;
      RemoveMenuItem.Visible = false;
      PropMenuItem.Sensitive = false;
      DownloadMenuItem.Sensitive = false;
      MergeMenuItem.Sensitive = false;
      }
     if( (holder.iFolder != null) &&
      (holder.iFolder.HasConflicts) )
     {
      ConflictMenuItem.Sensitive = true;
     }
     else
     {
      ConflictMenuItem.Sensitive = false;
     }
     if(!holder.iFolder.IsSubscription)
     {
      DownloadMenuItem.Sensitive = false;
      MergeMenuItem.Sensitive = false;
      if (holder.State == iFolderState.Initial && holder.iFolder.State == "Available")
      {
      ShareMenuItem.Sensitive = false;
       PropMenuItem.Sensitive = false;
      }
      else
      {
      ShareMenuItem.Sensitive = true;
       PropMenuItem.Sensitive = true;
      }
      OpenMenuItem.Sensitive = true;
      SyncNowMenuItem.Sensitive = true;
      if( ( ( (holder.iFolder.State == "WaitSync") || (holder.iFolder.State == "Local") )
       && (holder.State == iFolderState.Synchronizing) )
      || (holder.iFolder.Role.Equals("Master")) )
      {
       RevertMenuItem.Sensitive = false;
      }
      else
      {
       RevertMenuItem.Sensitive = true;
      }
      PropMenuItem.Sensitive = true;
      DeleteMenuItem.Sensitive = false;
      RemoveMenuItem.Sensitive = false;
     }
     else
     {
      DownloadMenuItem.Sensitive = true;
      MergeMenuItem.Sensitive = true;
      ShareMenuItem.Sensitive = false;
      OpenMenuItem.Sensitive = false;
      SyncNowMenuItem.Sensitive = false;
      RevertMenuItem.Sensitive = false;
      PropMenuItem.Sensitive = false;
      DomainInformation domain =
       domainController.GetDomain(holder.iFolder.DomainID);
      if (domain == null ||
       domain.MemberUserID == holder.iFolder.OwnerID)
      {
       DeleteMenuItem.Sensitive = true;
       DeleteMenuItem.Visible = true;
       RemoveMenuItem.Sensitive = false;
       RemoveMenuItem.Visible = false;
      }
      else
      {
       DeleteMenuItem.Sensitive = false;
       DeleteMenuItem.Visible = false;
       RemoveMenuItem.Sensitive = true;
       RemoveMenuItem.Visible = true;
      }
     }
        }
        else
        {
     ShareMenuItem.Sensitive = false;
     OpenMenuItem.Sensitive = false;
     SyncNowMenuItem.Sensitive = false;
                                        SyncNowMenuItem.Sensitive = false;
     ConflictMenuItem.Sensitive = false;
     RevertMenuItem.Sensitive = false;
     DeleteMenuItem.Sensitive = false;
     RemoveMenuItem.Sensitive = false;
     RemoveMenuItem.Visible = false;
     PropMenuItem.Sensitive = false;
     DownloadMenuItem.Sensitive = false;
     MergeMenuItem.Sensitive = false;
        }
 }
Ejemplo n.º 27
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();
        }
 }
Ejemplo n.º 28
0
 public bool UpdateUserDetails(iFolderHolder holder)
 {
     if(holder != null && labelFolderToSync != null)
        {
     labelFolderToSync.Text = string.Format(Util.GS("File/Folder to synchronize: {0}"), holder.ObjectsToSync);
     labelLastSyncTime.Text = string.Format(Util.GS("Last Successfull Sync time: {0}"),holder.iFolder.LastSyncTime);
     labeliFolderSize.Text = string.Format(Util.GS("iFolder Size: {0}"), GetFriendlySize(holder.iFolder.iFolderSize));
     DomainInformation domain = domainController.GetDomain(holder.iFolder.DomainID);
     UriBuilder serverUri = new UriBuilder(domain.HostUrl);
     labeliFolderServer.Text = string.Format(Util.GS("Server: {0}"),serverUri.Host);
     string iftype = null;
     if( (null == holder.iFolder.encryptionAlgorithm) || ("" == holder.iFolder.encryptionAlgorithm) )
     {
     iftype = string.Format(Util.GS("Regular"));
     }
     else
     {
     iftype = string.Format(Util.GS("Encrypted"));
     }
     labeliFolderType.Text= string.Format(Util.GS("iFolder Type: {0}"), iftype);
      if(holder.iFolder.IsSubscription)
     {
      labelFolderToSync.Hide();
      labelLastSyncTime.Hide();
      labeliFolderServer.Hide();
      labeliFolderSize.Show();
      labeliFolderType.Show();
     }
     else
     {
      labeliFolderSize.Hide();
      labeliFolderType.Hide();
      labelFolderToSync.Show();
      labelLastSyncTime.Show();
      labeliFolderServer.Show();
     }
        }
        return true;
 }
Ejemplo n.º 29
0
        public void RebuildTable()
        {
            if ((null == model) || (null == items) || (null == table))
            {
                iFolderViewGroup.log.Info("NULL Reference Exception: Object, model is -{0}-items is-{1}-table is -{2}-", model, items, table);
                return;                 // prevent null pointer exception
            }

            int numOfItems = model.IterNChildren();

            if (numOfItems > 0)
            {
                int availableWidth = currentWidth
                                     - (int)(contentVBox.BorderWidth * 2)
                                     - (int)(table.BorderWidth * 2);

                int numOfColumns = availableWidth / ItemMaxWidth;
                if (numOfColumns < 1)
                {
                    numOfColumns = 1;                           // Force at least one column
                }
                int numOfRows = numOfItems / numOfColumns;
                if ((numOfItems % numOfColumns) > 0)
                {
                    numOfRows++;
                }

                bFirstTableBuild = false;

                ///
                /// Clear out the old items
                ///
                items.Clear();

                foreach (Widget w in table.Children)
                {
                    table.Remove(w);
                    w.Destroy();
                }

                table.Resize((uint)numOfRows, (uint)numOfColumns);

                int currentRow    = 0;
                int currentColumn = 0;

                TreeIter iter;
                if (model.GetIterFirst(out iter))
                {
                    do
                    {
                        iFolderHolder holder = (iFolderHolder)model.GetValue(iter, 0);
                        if (holder != null)
                        {
                            iFolderViewItem item = new iFolderViewItem(holder, this, iter, ItemMaxWidth);
                            if (null == item)
                            {
                                iFolderViewGroup.log.Info("NULL Reference Exception: Object item is NULL");
                                return;                                 //prevent null pointer exception
                            }

                            table.Attach(item,
                                         (uint)currentColumn, (uint)currentColumn + 1,
                                         (uint)currentRow, (uint)currentRow + 1,
                                         AttachOptions.Shrink | AttachOptions.Fill,
                                         0, 0, 0);

                            // Save off the item so we can quickly reference it later
                            TreePath path = model.GetPath(iter);
                            items[path.ToString()] = item;

                            // Register for the click events
                            item.LeftClicked +=
                                new EventHandler(OnItemLeftClicked);
                            item.RightClicked +=
                                new EventHandler(OnItemRightClicked);
                            item.DoubleClicked +=
                                new EventHandler(OnItemDoubleClicked);

                            currentColumn = ((currentColumn + 1) % numOfColumns);
                            if (currentColumn == 0)
                            {
                                currentRow++;
                            }
                        }
                    } while (model.IterNext(ref iter));
                }

                table.ShowAll();
            }
            else
            {
                items.Clear();
                foreach (Widget w in table.Children)
                {
                    table.Remove(w);
                    w.Destroy();
                }
            }
        }
Ejemplo n.º 30
0
 public iFolderActivatedArgs(iFolderHolder holder)
 {
     this.holder = holder;
 }
Ejemplo n.º 31
0
 public iFolderAddHandler(iFolderHolder holder, iFolderData ifdata)
 {
     this.holder = holder;
     this.ifdata = ifdata;
 }
Ejemplo n.º 32
0
 public iFolderClickedArgs(iFolderHolder holder, uint button)
 {
     this.holder = holder;
        this.button = button;
 }
Ejemplo n.º 33
0
 private iFolderHolder AddiFolder(iFolderWeb ifolder)
 {
     lock (instanceLock)
        {
     iFolderHolder ifHolder = null;
     string ifolderID =
      ifolder.IsSubscription ?
       ifolder.CollectionID :
       ifolder.ID;
     if (ifolderIters.ContainsKey(ifolderID))
     {
      TreeIter iter = (TreeIter)ifolderIters[ifolderID];
      ifHolder = (iFolderHolder)
       iFolderListStore.GetValue(iter, 0);
      if (ifHolder != null)
      {
       ifHolder.iFolder = ifolder;
       TreePath path = iFolderListStore.GetPath(iter);
       if (path != null)
       {
        iFolderChangedHandler changedHandler =
     new iFolderChangedHandler(
      path, iter, iFolderListStore);
        GLib.Idle.Add(changedHandler.IdleHandler);
       }
      }
     }
     else
     {
      ifHolder = new iFolderHolder(ifolder);
      ifHolder.State = iFolderState.Initial;
      iFolderAddHandler addHandler =
       new iFolderAddHandler(ifHolder, this);
      GLib.Idle.Add(addHandler.IdleHandler);
     }
     return ifHolder;
        }
 }
Ejemplo n.º 34
0
 private void DownloadiFolder(iFolderHolder holder)
 {
     if (holder != null && holder.iFolder.IsSubscription)
        {
     string newPath = "";
         int rc = 0;
         do
         {
             iFolderAcceptDialog iad =
                     new iFolderAcceptDialog(holder.iFolder, Util.LastSetupPath);
             iad.TransientFor = this;
             rc = iad.Run();
             newPath = ParseAndReplaceTildeInPath(iad.Path);
             iad.Hide();
             iad.Destroy();
             if(rc != -5)
                 return;
             try
             {
                 ifdata.AcceptiFolderInvitation(
         holder.iFolder.ID,
         holder.iFolder.DomainID,
         newPath);
       iFoldersIconView.UnselectAll();
                 rc = 0;
                 Util.LastSetupPath = newPath;
             }
             catch(Exception e)
             {
                 DisplayCreateOrSetupException(e);
             }
         }
         while(rc == -5);
        }
 }
Ejemplo n.º 35
0
 private void ProtectedAddiFolder(iFolderHolder holder)
 {
     if (holder == null) return;
        lock(instanceLock)
        {
     iFolderWeb ifolder = holder.iFolder;
     string ifolderID =
      ifolder.IsSubscription ?
       ifolder.CollectionID :
       ifolder.ID;
     if (!ifolderIters.ContainsKey(ifolderID))
     {
      TreeIter iter = iFolderListStore.AppendValues(holder);
      if (ifolder.IsSubscription)
      {
       ifolderIters[ifolder.CollectionID] = iter;
      }
      else
      {
       ifolderIters[ifolder.ID] = iter;
      }
     }
        }
 }
Ejemplo n.º 36
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;
     }
        }
 }
Ejemplo n.º 37
0
 private void OniFolderSyncEvent(object o, CollectionSyncEventArgs args)
 {
     if (args == null || args.ID == null || args.Name == null)
     return;
        switch(args.Action)
        {
     case Simias.Client.Event.Action.StartSync:
     {
      collectionSynchronizing = args.ID;
      iFolderHolderSyncing = ifdata.GetiFolder( collectionSynchronizing);
      break;
     }
     case Simias.Client.Event.Action.StopSync:
     {
      currentIconAnimationDirection = 0;
       if (collectionSynchronizing != null)
       {
        iFolderHolder ifHolder = ifdata.GetiFolder(collectionSynchronizing);
        if (ifHolder != null)
        {
     if (synchronizationErrors.ContainsKey(ifHolder.iFolder.ID))
     {
      Hashtable collectionSyncErrors = (Hashtable)synchronizationErrors[ifHolder.iFolder.ID];
      ICollection errors = collectionSyncErrors.Keys;
      Debug.PrintLine(String.Format("Number of errors: {0}", errors.Count));
      ArrayList keysToClear = new ArrayList();
      bool showErrorBaloon = false;
      bool showGenericBaloon = true;
      foreach(SyncStatus syncStatusKey in errors)
      {
       string errMsg = (string) collectionSyncErrors[syncStatusKey];
       if (errMsg != null && errMsg.Length > 0)
       {
        showErrorBaloon = true;
        NotifyWindow notifyWin = new NotifyWindow(
     tIcon, string.Format(Util.GS("Incomplete Synchronization: {0}"), ifHolder.iFolder.Name),
     errMsg,
     Gtk.MessageType.Warning, 5000);
        notifyWin.LinkClicked +=
     new LinkClickedEventHandler(OnNotifyWindowLinkClicked);
        notifyWin.ShowAll();
        showGenericBaloon = false;
        keysToClear.Add(syncStatusKey);
       }
      }
      if( showErrorBaloon == true)
      {
       if( showGenericBaloon )
       {
        NotifyWindow notifyWin = new NotifyWindow(
        tIcon, string.Format(Util.GS("Incomplete Synchronization: {0}"), ifHolder.iFolder.Name),
        Util.GS("Synchronization log contains the information regarding the files that are not synchronized"),
        Gtk.MessageType.Warning, 5000);
        notifyWin.LinkClicked +=
        new LinkClickedEventHandler(OnNotifyWindowLinkClicked);
        notifyWin.ShowAll();
       }
      }
      foreach(SyncStatus syncStatusKey in keysToClear)
      {
       collectionSyncErrors.Remove( syncStatusKey);
      }
      Debug.PrintLine(String.Format("After removing keys count: {0}", collectionSyncErrors.Count));
     }
        }
       }
      collectionSynchronizing = null;
      break;
     }
        }
        gAppIcon.Pixbuf = RunningPixbuf;
 }
Ejemplo n.º 38
0
 private void UpdateMenuSensitivity(iFolderHolder holder)
 {
     if (holder != null)
        {
     if( (holder.iFolder != null) &&
      (holder.iFolder.HasConflicts) )
     {
      ConflictMenuItem.Sensitive = true;
     }
     else
     {
      ConflictMenuItem.Sensitive = false;
     }
     if(!holder.iFolder.IsSubscription)
     {
      DownloadMenuItem.Sensitive = false;
      ShareMenuItem.Sensitive = true;
      OpenMenuItem.Sensitive = true;
      SyncNowMenuItem.Sensitive = true;
      if (holder.iFolder.Role.Equals("Master"))
       RevertMenuItem.Sensitive = false;
      else
       RevertMenuItem.Sensitive = true;
      PropMenuItem.Sensitive = true;
      DeleteMenuItem.Sensitive = false;
      RemoveMenuItem.Sensitive = false;
     }
     else
     {
      DownloadMenuItem.Sensitive = true;
      ShareMenuItem.Sensitive = false;
      OpenMenuItem.Sensitive = false;
      SyncNowMenuItem.Sensitive = false;
      RevertMenuItem.Sensitive = false;
      PropMenuItem.Sensitive = false;
      DomainInformation domain =
       domainController.GetDomain(holder.iFolder.DomainID);
      if (domain == null ||
       domain.MemberUserID == holder.iFolder.OwnerID)
      {
       DeleteMenuItem.Sensitive = true;
       DeleteMenuItem.Visible = true;
       RemoveMenuItem.Sensitive = false;
       RemoveMenuItem.Visible = false;
      }
      else
      {
       DeleteMenuItem.Sensitive = false;
       DeleteMenuItem.Visible = false;
       RemoveMenuItem.Sensitive = true;
       RemoveMenuItem.Visible = true;
      }
     }
        }
        else
        {
     ShareMenuItem.Sensitive = false;
     OpenMenuItem.Sensitive = false;
     SyncNowMenuItem.Sensitive = false;
     ConflictMenuItem.Sensitive = false;
     RevertMenuItem.Sensitive = false;
     DeleteMenuItem.Sensitive = false;
     RemoveMenuItem.Sensitive = false;
     RemoveMenuItem.Visible = false;
     PropMenuItem.Sensitive = false;
     DownloadMenuItem.Sensitive = false;
        }
 }
Ejemplo n.º 39
0
 public void UnselectAll()
 {
     iFolderIconView.CheckThread();
        foreach(iFolderViewGroup group in viewGroups)
        {
     group.Selection.SelectionChanged -= SelectionChangedHandler;
     group.Selection.UnselectAll();
     group.Selection.SelectionChanged += SelectionChangedHandler;
        }
        if (SelectionChanged != null)
        {
     currentSelection = null;
     SelectionChanged(null, EventArgs.Empty);
        }
 }
Ejemplo n.º 40
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;
 }
Ejemplo n.º 41
0
 private void SelectionChangedHandler(object o, EventArgs args)
 {
     iFolderIconView.CheckThread();
     Console.WriteLine("iFolderIconView.SelectionChangedHandler()");
        iFolderViewGroupSelection gSelect = (iFolderViewGroupSelection)o;
        iFolderViewGroup group = gSelect.ViewGroup;
        foreach(iFolderViewGroup tempGroup in viewGroups)
        {
     if (group != tempGroup)
     {
      tempGroup.Selection.SelectionChanged -= SelectionChangedHandler;
      tempGroup.Selection.UnselectAll();
      tempGroup.Selection.SelectionChanged += SelectionChangedHandler;
     }
        }
        if (SelectionChanged != null)
        {
     iFolderViewItem selectedItem = null;
     if (group.Selection.GetSelected(out selectedItem))
     {
      currentSelection = selectedItem.Holder;
      SelectionChanged(selectedItem.Holder, EventArgs.Empty);
     }
     else
     {
      currentSelection = null;
      SelectionChanged(null, EventArgs.Empty);
     }
        }
 }