예제 #1
0
        public bool DecorateNode(IResource res, RichText nodeText)
        {
            if (res.Type == NntpPlugin._newsGroup)
            {
                int count = 0;

                if (_groups2watchedHeads.ContainsKey(res))
                {
                    IResourceList groupItems = NntpPlugin.CollectArticles(res, false);
                    groupItems = groupItems.Intersect(_unreadArticles);

                    List <IResource> heads = _groups2watchedHeads[res];
                    foreach (IResource head in heads)
                    {
                        IResourceList thread = ConversationBuilder.UnrollConversationFromCurrent(head);
                        count += thread.Intersect(groupItems).Count;
                    }
                }

                if (count != 0)
                {
                    nodeText.Append(" !", _watchedTextStyle);
                }
                return(count != 0);
            }
            return(false);
        }
예제 #2
0
        public bool DecorateNode(IResource res, RichText nodeText)
        {
            if (res.Type == NntpPlugin._newsFolder || res.Type == NntpPlugin._newsServer)
            {
                int count;
                if (NewsFolders.IsDefaultFolder(res))
                {
                    IResourceList folderItems = NntpPlugin.CollectArticles(res, false);
                    IResource     wsp         = Core.WorkspaceManager.ActiveWorkspace;
                    if (wsp != null)
                    {
                        folderItems = folderItems.Intersect(wsp.GetLinksOfType(null, "WorkspaceVisible"), true);
                    }
                    if (NewsFolders.IsSentItems(res))
                    {
                        folderItems = folderItems.Intersect(_allUnread, true);
                    }
                    else
                    {
                        folderItems = folderItems.Minus(Core.ResourceStore.FindResourcesWithProp(null, Core.Props.IsDeleted));
                    }
                    count = folderItems.Count;
                }
                else
                {
                    IResourceList groups = new NewsTreeNode(res).Groups;
                    IResource     wsp    = Core.WorkspaceManager.ActiveWorkspace;
                    if (wsp != null)
                    {
                        groups = groups.Intersect(wsp.GetLinksOfType(null, "WorkspaceVisible"), true);
                    }
                    IResourceList articles = Core.ResourceStore.EmptyResourceList;
                    foreach (IResource group in groups.ValidResources)
                    {
                        articles = articles.Union(
                            group.GetLinksTo(null, NntpPlugin._propTo).Intersect(_allUnread), true);
                    }
                    count = articles.Count;
                }
                if (count != 0)
                {
                    nodeText.Append(" ");
                    nodeText.SetStyle(FontStyle.Bold, 0, res.DisplayName.Length);

                    /////////////////////////////////////////////////////////////////////
                    /// NewsFolders.IsDefaultFolder doesn't synchronously create folders,
                    /// so the check is necessary to avoid RunJobs to resource thread
                    /////////////////////////////////////////////////////////////////////
                    if (NewsFolders.IsDrafts(res))
                    {
                        nodeText.Append("[" + count + "]", _draftsTextStyle);
                    }
                    else
                    {
                        nodeText.Append("(" + count + ")", _unreadTextStyle);
                    }
                }
                return(true);
            }
            return(false);
        }