Ejemplo n.º 1
0
        public DragDropEffects DragOver(IResource targetResource, IDataObject data, DragDropEffects allowedEffect, int keyState)
        {
            if (data.GetDataPresent(typeof(IResourceList)))                // Dragging resources over
            {
                // The resources we're dragging
                IResourceList dragResources = (IResourceList)data.GetData(typeof(IResourceList));

                if (ListOfMailsOrLinkedAttachments(dragResources))
                {
                    return(DragDropEffects.Move);
                }
                if (!dragResources.AllResourcesOfType(STR.MAPIFolder))
                {
                    return(DragDropEffects.None);
                }
                foreach (IResource folder in dragResources.ValidResources)
                {
                    //  A default folder cannot be moved, so it can be dropped
                    //  only to its own parent for the sake of reordering
                    if ((Folder.IsDefault(folder)) && (Folder.GetParent(folder) != targetResource))
                    {
                        return(DragDropEffects.None);
                    }

                    // Don't allow dropping to self and own children
                    if ((folder == targetResource) || (Folder.IsAncestor(targetResource, folder)))
                    {
                        return(DragDropEffects.None);
                    }
                }
                return(DragDropEffects.Move);
            }
            return(DragDropEffects.None);
        }
Ejemplo n.º 2
0
 public bool CanRenameResource(IResource res)
 {
     if (res.Type == STR.MAPIFolder)
     {
         return(!Folder.IsDefault(res));
     }
     return(false);
 }
Ejemplo n.º 3
0
 protected override void ExecuteActionImpl(IResourceList selectedResources)
 {
     foreach (IResource folder in selectedResources.ValidResources)
     {
         if (folder.Id == _lastFolder.Id || Folder.IsDefault(folder) || Folder.IsAncestor(_lastFolder, folder))
         {
             StandartJobs.MessageBox("Cannot move folder '" + folder.DisplayName +
                                     "' to folder '" + _lastFolder.DisplayName + "'", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
     }
     new MoveFolderToFolderAction().DoMove(_lastFolder, selectedResources);
 }
Ejemplo n.º 4
0
        public static void DeleteFolder(IResource folder, bool deletedItems)
        {
            if (Folder.IsDefault(folder))
            {
                return;
            }
            IResourceList folders       = Folder.GetDefaultDeletedItemsFolder();
            HashSet       childrenNames = new HashSet();

            foreach (IResource resFolder in folders)
            {
                foreach (IResource child in Folder.GetSubFolders(resFolder))
                {
                    childrenNames.Add(child.GetPropText(Core.Props.Name));
                }
            }

            string name    = folder.GetPropText(Core.Props.Name);
            string oldName = name;
            bool   rename  = false;

            for (int j = 1;; j++)
            {
                if (!childrenNames.Contains(name))
                {
                    break;
                }
                name   = oldName + j.ToString();
                rename = true;
            }
            PairIDs pairIds = PairIDs.Get(folder);

            if (pairIds != null)
            {
                if (deletedItems && rename)
                {
                    OutlookSession.DeleteFolderWithRename(pairIds, name);
                }
                else
                {
                    OutlookSession.DeleteFolder(pairIds, deletedItems);
                }
            }

            if (!deletedItems)
            {
                Core.ResourceAP.QueueJob(JobPriority.AboveNormal,
                                         new ResourceDelegate(DeleteFolderResource), folder);
            }
        }
Ejemplo n.º 5
0
        public override void Update(IActionContext context, ref ActionPresentation presentation)
        {
            base.Update(context, ref presentation);
            if (context.Instance != Settings.OutlookFolders)
            {
                presentation.Visible = false;
                return;
            }
            IResource folder = context.SelectedResources[0];

            if (Folder.IsDefault(folder))
            {
                presentation.Visible = false;
            }
        }
Ejemplo n.º 6
0
 public override void Update(IActionContext context, ref ActionPresentation presentation)
 {
     if (context.SelectedResources.Count == 0 || !context.SelectedResources.AllResourcesOfType(STR.MAPIFolder))
     {
         presentation.Visible = false;
         return;
     }
     foreach (IResource folder in context.SelectedResources)
     {
         if (Folder.IsDefault(folder))
         {
             presentation.Enabled = false;
             return;
         }
     }
 }