Exemple #1
0
 public bool AcceptLink(IResource displayedResource, int propId, IResource targetResource,
                        ref string linkTooltip)
 {
     if (propId == FavoritesPlugin._propParent && targetResource == BookmarkService.GetBookmarksRoot())
     {
         return(false);
     }
     return(true);
 }
Exemple #2
0
        public override void EnterPane()
        {
            _bookmarkFoldersBox.Items.Clear();
            _bookmarkFoldersBox.AddResourceHierarchy(
                BookmarkService.GetBookmarksRoot(), "Folder",
                FavoritesPlugin._propParent, new AcceptResourceDelegate(AcceptFolder));
            int id = Core.SettingStore.ReadInt(
                "Favorites", "CatAnnRoot", BookmarkService.GetBookmarksRoot().Id);

            _bookmarkFoldersBox.SelectedItem = Core.ResourceStore.TryLoadResource(id);
        }
Exemple #3
0
        public void Execute(IActionContext context)
        {
            IResourceList resources         = context.SelectedResources;
            IResource     folder            = BookmarkService.GetBookmarksRoot();
            IResource     selected          = folder;
            string        url               = context.CurrentUrl;
            bool          isWeblinkSelected = false;

            if (resources.Count > 0)
            {
                selected = resources[0];
            }
            else
            {
                if (FavoritesPlugin._favoritesTreePane.SelectedNode != null)
                {
                    selected = FavoritesPlugin._favoritesTreePane.SelectedNode;
                }
            }
            if (selected.Type == "Folder")
            {
                folder = selected;
            }
            else if (selected.Type == "Weblink")
            {
                folder            = BookmarkService.GetParent(selected);
                isWeblinkSelected = url != null && selected.GetPropText(FavoritesPlugin._propURL) == url;
            }
            else
            {
                selected = selected.GetLinkProp("Source");
                if (selected != null && selected.Type == "Weblink")
                {
                    folder            = BookmarkService.GetParent(selected);
                    isWeblinkSelected = url != null && selected.GetPropText(FavoritesPlugin._propURL) == url;
                }
            }

            using (AddFavoriteForm frm = new AddFavoriteForm(folder))
            {
                if (!isWeblinkSelected || Core.TabManager.CurrentTabId != "Web")
                {
                    if (url != null)
                    {
                        frm.SetURL(url);
                    }
                    if (context.CurrentPageTitle != null)
                    {
                        frm._nameBox.Text = context.CurrentPageTitle;
                    }
                }
                frm.ShowDialog(Core.MainWindow);
            }
        }
Exemple #4
0
        private static bool AcceptFolder(IResource folder)
        {
            bool result = folder.GetLinksTo(null, FavoritesPlugin._propParent).Minus(
                Core.ResourceStore.FindResourcesWithProp(null, FavoritesPlugin._propInvisible)).Count > 0;

            while (result && folder != null && folder != BookmarkService.GetBookmarksRoot())
            {
                if (folder.HasProp(FavoritesPlugin._propInvisible))
                {
                    result = false;
                    break;
                }
                folder = folder.GetLinkProp(FavoritesPlugin._propParent);
            }
            return(result);
        }
Exemple #5
0
 public void Execute(IActionContext context)
 {
     if (context.SelectedResources.Count == 0)
     {
         _parentFolder = BookmarkService.GetBookmarksRoot();
     }
     else
     {
         _parentFolder = context.SelectedResources[0];
         if (_parentFolder.Type == "Weblink")
         {
             _parentFolder = BookmarkService.GetParent(_parentFolder);
         }
     }
     Core.ResourceAP.QueueJob(JobPriority.Immediate, new MethodInvoker(NewFolder));
 }