[Test] public void UnreadResourceEntersWorkspace() { Core.ResourceStore.ResourceTypes.Register("Folder", "Name"); int propInFolder = Core.ResourceStore.PropTypes.Register("InFolder", PropDataType.Link, PropTypeFlags.CountUnread); _wsManager.RegisterWorkspaceType("Folder", new int[] { propInFolder }, WorkspaceResourceType.Container); IResource ws = _wsManager.CreateWorkspace("Test"); IResource folder = _storage.NewResource("Folder"); _wsManager.AddResourceToWorkspace(ws, folder); UnreadState theState = _unreadManager.SetUnreadState("", ws); Assert.AreEqual(0, theState.GetUnreadCount(folder)); IResource email = _storage.NewResource("Email"); email.SetProp(_propUnread, true); Assert.AreEqual(0, theState.GetUnreadCount(folder)); email.AddLink("InFolder", folder); Assert.AreEqual(1, theState.GetUnreadCount(folder)); email.DeleteLink("InFolder", folder); Assert.AreEqual(0, theState.GetUnreadCount(folder)); }
[SetUp] public void SetUp() { _core = new TestCore(); _storage = _core.ResourceStore; _workspaceManager = Core.WorkspaceManager; _workspaceManager.RegisterWorkspaceType("Category", new int[] { (Core.CategoryManager as CategoryManager).PropCategory }, WorkspaceResourceType.Filter); _workspace = _workspaceManager.CreateWorkspace("WS"); _storage.ResourceTypes.Register("Folder", "Name"); _storage.ResourceTypes.Register("Email", "Name"); _treePane = new ViewsCategoriesPane(); }
[Test] public void UnreadCountersForViewsInWorkspace() { Core.ResourceStore.ResourceTypes.Register( "Folder", "Name" ); int propInFolder = Core.ResourceStore.PropTypes.Register( "InFolder", PropDataType.Link ); _wsManager.RegisterWorkspaceType( "Folder", new int[] { propInFolder }, WorkspaceResourceType.Container ); IResource condition = _registry.RecreateStandardCondition( "Today", "Today", null, "Date", ConditionOp.InRange, "Today", "+1" ); IResource today = _registry.RegisterView( "Today", new IResource[ 1 ]{ condition }, null ); _engine.InitializeCriteria(); IResource ws = _wsManager.CreateWorkspace( "Test" ); IResource folder = _storage.NewResource( "Folder" ); _wsManager.AddResourceToWorkspace( ws, folder ); UnreadState theState = _unreads.SetUnreadState( "", ws ); Assert.AreEqual( 0, theState.GetUnreadCount( today ) ); _emailResource.AddLink( propInFolder, folder ); Assert.AreEqual( 1, theState.GetUnreadCount( today ) ); }
public void Register() { _instance = this; _isReader = Core.ProductFullName.EndsWith("Reader"); _colorScheme = new ColorScheme(Assembly.GetExecutingAssembly(), "ContactsPlugin.Icons.", Core.ResourceIconManager.IconColorDepth); Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ContactsPlugin.Icons.ContactColorScheme.xml"); _colorScheme.Load(stream); AddressBook.Initialize(); Core.ResourceTreeManager.SetViewsExclusive("Contact"); IUIManager uiMgr = Core.UIManager; Core.TabManager.RegisterResourceTypeTab(_tabName, _tabName, new[] { "Contact", "AddressBook" }, 10); uiMgr.RegisterResourceSelectPane("Contact", typeof(CorrespondentCtrl)); uiMgr.RegisterResourceSelectPane("EmailAccount", typeof(EmailAccountSelector)); IWorkspaceManager mgr = Core.WorkspaceManager; mgr.RegisterWorkspaceType("Contact", new[] { -Core.ContactManager.Props.LinkFrom, -Core.ContactManager.Props.LinkTo, -Core.ContactManager.Props.LinkCC }, WorkspaceResourceType.Filter); #if !READER mgr.RegisterWorkspaceType("EmailAccount", new[] { -Core.ContactManager.Props.LinkEmailAcctFrom, -Core.ContactManager.Props.LinkEmailAcctTo, -Core.ContactManager.Props.LinkEmailAcctCC }, WorkspaceResourceType.Filter); mgr.RegisterWorkspaceSelectorFilter("EmailAccount", new EmailAccountFilter()); mgr.SetWorkspaceTabName("EmailAccount", "Email Accounts"); #endif Core.PluginLoader.RegisterViewsConstructor(new ContactsUpgrade1ViewsConstructor()); Core.PluginLoader.RegisterViewsConstructor(new ContactsViewsConstructor()); Core.PluginLoader.RegisterViewsConstructor(new ContactsUpgrade2ViewsConstructor()); Core.PluginLoader.RegisterViewsConstructor(new ContactsUpgrade3ViewsConstructor()); //----------------------------------------------------------------- // Register Search Extensions to narrow the list of results using // simple phrases in search queries: for restricting the resource // type to Contact (three synonyms). //----------------------------------------------------------------- Core.SearchQueryExtensions.RegisterResourceTypeRestriction("in", "contacts", "Contact"); Core.SearchQueryExtensions.RegisterResourceTypeRestriction("in", "contact", "Contact"); Core.SearchQueryExtensions.RegisterResourceTypeRestriction("in", "c", "Contact"); IDisplayColumnManager colManager = Core.DisplayColumnManager; colManager.RegisterPropertyToTextCallback(Core.ContactManager.Props.LinkFrom, SubstituteName); Core.UIManager.RegisterDisplayInContextHandler("Contact", new DisplayContactInContextHandler()); Core.UIManager.RegisterResourceLocationLink("AddressBook", 0, "AddressBook"); Core.PluginLoader.RegisterResourceTextProvider("Contact", this); Core.PluginLoader.RegisterResourceDisplayer("Contact", this); Core.PluginLoader.RegisterResourceSerializer("Contact", new ContactSerializer()); Core.PluginLoader.RegisterResourceSerializer("Phone", new PhoneSerializer()); Core.PluginLoader.RegisterResourceSerializer("EmailAccount", new EmailAccountSerializer()); Core.ActionManager.RegisterLinkClickAction(new DisplayMailsForEmailAccount(), "EmailAccount", null); if (!_isReader) { IResource abRoot = AddressBook.AddressBookRoot; if (abRoot != null) { Assembly theAsm = Assembly.GetExecutingAssembly(); Image img = Utils.TryGetEmbeddedResourceImageFromAssembly(theAsm, "ContactsPlugin.Icons.AddressBook24.png"); _addressBookPane = Core.LeftSidebar.RegisterResourceStructureTreePane("AddressBooks", _tabName, "Address Books", img, "AddressBook"); _addressBookPane.RegisterToolbarAction(new CreateABAction(), LoadIconFromAssembly("addressbook.ico"), null, "Create Address Book", null); Core.LeftSidebar.RegisterViewPaneShortcut("AddressBooks", Keys.Control | Keys.Alt | Keys.D); } } else { Core.ResourceBrowser.RegisterLinksPaneFilter("Contact", new ReaderABLinkFilter()); } Core.ResourceBrowser.RegisterLinksPaneFilter("Contact", new SkipEmailAddressesFilter()); Core.ResourceIconManager.RegisterOverlayIconProvider("Contact", new ContactOverlayIconProvider()); Core.PluginLoader.RegisterResourceDeleter("Contact", new ContactDeleter()); Core.PluginLoader.RegisterResourceDeleter("ContactName", new ContactDeleter()); RegisterContactBlocks(); Core.ResourceIconManager.RegisterResourceLargeIcon("Contact", LoadIconFromAssembly("ContactLarge.ico")); Core.ResourceBrowser.RegisterLinksGroup("Accounts", new[] { Core.ContactManager.Props.LinkEmailAcct }, ListAnchor.First); }
public void Register() { _plugin = this; _tracer.Trace("Start registering..."); Core.AddExceptionReportData("\nOutlookPlugin is enabled"); Settings.LoadSettings(); REGISTRY.RegisterTypes(this, Core.ContactManager); _tracer.Trace("Start OutlookProcessor..."); _outlookProcessor = new OutlookProcessor(); _outlookUIHandler = new OutlookUIHandler(); if (!_outlookProcessor.IsStarted) { _tracer.Trace("OutlookProcessor failed to start"); Core.AddExceptionReportData("\nOutlookProcessor failed to start"); Core.AddExceptionReportData("\nOutlook plugin cannot be loaded.\n" + _outlookProcessor.LastException.Message); MsgBox.Error("Outlook plugin", "Outlook plugin cannot be loaded.\n" + _outlookProcessor.LastException.Message); _startupStatus = false; Core.ActionManager.DisableXmlActionConfiguration(Assembly.GetExecutingAssembly()); return; } _tracer.Trace("Start OutlookProcessor OK"); _outlookProcessor.SynchronizeMAPIInfoStores(); if (Settings.ExportTasks) { _tracer.Trace("prepare ExportTasks"); _outlookProcessor.ExportTasks(); } Core.PluginLoader.RegisterResourceUIHandler(STR.MAPIFolder, _outlookUIHandler); Core.PluginLoader.RegisterResourceDragDropHandler(STR.MAPIFolder, _outlookUIHandler); Core.PluginLoader.RegisterResourceDragDropHandler(Core.ResourceTreeManager.GetRootForType(STR.MAPIFolder).Type, new OutlookRootDragDropHandler()); IUIManager uiManager = Core.UIManager; Core.TabManager.RegisterResourceTypeTab("Email", "Mail", new[] { STR.Email, STR.MAPIFolder }, PROP.Attachment, 1); Image img = Utils.TryGetEmbeddedResourceImageFromAssembly(Assembly.GetExecutingAssembly(), "OutlookPlugin.Icons.Folders24.png"); IResourceTreePane outlookFolders = Core.LeftSidebar.RegisterResourceStructureTreePane("MAPIFolders", "Email", "Outlook Folders", img, STR.MAPIFolder); if (outlookFolders != null) { outlookFolders.AddNodeFilter(new OutlookFoldersFilter()); ((ResourceTreePaneBase)outlookFolders).AddNodeDecorator(new TotalCountDecorator(STR.MAPIFolder, PROP.MAPIFolder)); outlookFolders.ToolTipCallback = GetMAPIFolderToolTip; Settings.OutlookFolders = outlookFolders; Core.LeftSidebar.RegisterViewPaneShortcut("MAPIFolders", Keys.Control | Keys.Alt | Keys.O); } uiManager.RegisterResourceLocationLink(STR.Email, PROP.MAPIFolder, STR.MAPIFolder); CorrespondentCtrl correspondentPane = new CorrespondentCtrl { IniSection = "Outlook" }; img = Utils.TryGetEmbeddedResourceImageFromAssembly(Assembly.GetExecutingAssembly(), "OutlookPlugin.Icons.Correspondents24.png"); Core.LeftSidebar.RegisterViewPane("Correspondents", "Email", "Correspondents", img, correspondentPane); img = Utils.TryGetEmbeddedResourceImageFromAssembly(Assembly.GetExecutingAssembly(), "OutlookPlugin.Icons.Attachments24.png"); Core.LeftSidebar.RegisterViewPane("Attachments", "Email", "Attachments", img, new AttachmentsCtrl()); Core.LeftSidebar.RegisterViewPaneShortcut("Attachments", Keys.Control | Keys.Alt | Keys.T); RegisterCustomColumns(); RegisterOptionsPanes(); uiManager.RegisterResourceSelectPane(STR.MAPIFolder, typeof(MAPIFoldersTreeSelectPane)); IWorkspaceManager workspaceMgr = Core.WorkspaceManager; if (workspaceMgr != null) { workspaceMgr.RegisterWorkspaceType(STR.MAPIFolder, new[] { PROP.MAPIFolder }, WorkspaceResourceType.Container); workspaceMgr.RegisterWorkspaceType(STR.Email, new[] { -PROP.Attachment }, WorkspaceResourceType.None); workspaceMgr.RegisterWorkspaceSelectorFilter(STR.MAPIFolder, new OutlookFoldersFilter()); } ResourceTextProvider textProvider = new ResourceTextProvider(); Core.PluginLoader.RegisterResourceTextProvider(STR.Email, textProvider); Core.PluginLoader.RegisterResourceTextProvider(STR.EmailFile, textProvider); ResourceDisplayer displayer = new ResourceDisplayer(); Core.PluginLoader.RegisterResourceDisplayer(STR.Email, displayer); Core.PluginLoader.RegisterResourceDisplayer(STR.EmailFile, displayer); Core.PluginLoader.RegisterStreamProvider(STR.Email, new StreamProvider()); Core.PluginLoader.RegisterViewsConstructor(new OutlookUpgrade1ViewsInitializer()); Core.PluginLoader.RegisterViewsConstructor(new OutlookViewsInitializer()); Core.PluginLoader.RegisterViewsConstructor(new OutlookUpgrade2ViewsInitializer()); //----------------------------------------------------------------- // Register Search Extensions to narrow the list of results using // simple phrases in search queries: for restricting the resource // type to emails (three synonyms). //----------------------------------------------------------------- Core.SearchQueryExtensions.RegisterResourceTypeRestriction("in", "mail", STR.Email); Core.SearchQueryExtensions.RegisterResourceTypeRestriction("in", "mails", STR.Email); Core.SearchQueryExtensions.RegisterResourceTypeRestriction("in", "email", STR.Email); Core.ExpirationRuleManager.RegisterResourceType(PROP.MAPIFolder, STR.MAPIFolder, STR.Email); //----------------------------------------------------------------- Core.PluginLoader.RegisterPluginService(this); Core.ResourceIconManager.RegisterPropTypeIcon(PROP.Attachment, LoadIconFromAssembly("OutlookPlugin.Icons.attachment.ico")); Core.ResourceBrowser.RegisterLinksPaneFilter(STR.Email, new OutlookLinksPaneFilter()); Core.ResourceBrowser.RegisterLinksPaneFilter(STR.Task, new OutlookLinksPaneFilterForTasks()); Core.ContactManager.RegisterContactMergeFilter(new EntryIdMergeFilter()); Core.ResourceBrowser.RegisterLinksPaneFilter("Email", new ItemRecipientsFilter()); FolderIconProvider folderIconProvider = new FolderIconProvider(); Core.ResourceIconManager.RegisterResourceIconProvider(STR.MAPIFolder, folderIconProvider); Core.ResourceIconManager.RegisterOverlayIconProvider(STR.MAPIFolder, folderIconProvider); Core.ResourceIconManager.RegisterOverlayIconProvider(STR.Email, new MailIconProvider()); if (Core.ResourceStore.GetAllResources("SentItemsEnumSign").Count == 0) { OutlookSession.OutlookProcessor.RunJob("Detect owner e-mail", new MethodInvoker(OwnerEmailDetector.Detect)); } ResourceDeleters.Register(); EmailThreadingHandler threadingHandler = new EmailThreadingHandler(); Core.PluginLoader.RegisterResourceThreadingHandler("Email", threadingHandler); Core.PluginLoader.RegisterResourceThreadingHandler(PROP.Attachment, threadingHandler); Core.StateChanged += Core_StateChanged; Core.ResourceBrowser.SetDefaultViewSettings("Email", AutoPreviewMode.UnreadItems, true); _tracer.Trace("End of Register"); }