Example #1
0
        public Icon GetResourceIcon(IResource resource)
        {
            if (Folder.IsIgnored(resource))
            {
                if (_ignored == null)
                {
                    _ignored = OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.IgnoredFolder.ico");
                }
                return(_ignored);
            }

            if (resource.GetIntProp(Core.Props.Open) == 1 ||
                resource.GetIntProp(PROP.OpenIgnoreFolder) == 1 ||
                resource.GetIntProp(PROP.OpenSelectFolder) == 1)
            {
                if (_opened == null)
                {
                    _opened = OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.OPENFOLD2.ICO");
                }
                return(_opened);
            }
            if (_closed == null)
            {
                _closed = OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.CLSDFOLD2.ICO");
            }
            return(_closed);
        }
Example #2
0
 public OutlookProcessor() : base(null, false)
 {
     _tracer = new Tracer("OutlookProcessor");
     try
     {
         OutlookSession.Init(this);
         OnSettingsChanged(null, null);
         IdlePeriod       = Settings.IdlePeriod * 60000;
         ThreadName       = "Outlook AsyncProcessor";
         ThreadPriority   = ThreadPriority.Normal;
         ThreadStarted   += new EventHandler(_outlookProcessor_ThreadStarted);
         ThreadFinished  += new EventHandler(_outlookProcessor_ThreadFinished);
         ProcessMessages  = true;
         ExceptionHandler = new AsyncExceptionHandler(HandleException);
         _UIManager       = Core.UIManager;
         _UIManager.RegisterIndicatorLight("Outlook", this, 10,
                                           OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.outlook_idle.ico"),
                                           OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.outlook_busy.ico"),
                                           OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.outlook_stuck.ico"));
         _UIManager.MainWindowClosing += new System.ComponentModel.CancelEventHandler(_UIManager_MainWindowClosing);
         StartThread();
         _inited = true;
     }
     catch (Exception exception)
     {
         SetLastException(exception);
     }
 }
Example #3
0
 public Icon GetDefaultIcon(string resType)
 {
     if (_closed == null)
     {
         _closed = OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.CLSDFOLD2.ICO");
     }
     return(_closed);
 }
Example #4
0
        public static void RegisterTypes(OutlookPlugin ownerPlugin, IContactManager contactManager)
        {
            string exts = Core.SettingStore.ReadString("FilePlugin", "EmailMessageFileExts");

            exts = (exts.Length == 0) ? ".msg" : exts + ",.msg";
            string[] extsArray = exts.Split(',');
            for (int i = 0; i < extsArray.Length; ++i)
            {
                extsArray[i] = extsArray[i].Trim();
            }
            Core.FileResourceManager.RegisterFileResourceType(
                STR.EmailFile, "Email File", STR.Name, 0, ownerPlugin, extsArray);
            RegisterMailTypes(ownerPlugin, contactManager);
        }
Example #5
0
        void IViewsConstructor.RegisterViewsFirstRun()
        {
            //-----------------------------------------------------------------
            //  All conditions, templates and actions must have their deep names
            //-----------------------------------------------------------------
            AscribeDeepName(FilterManagerProps.ConditionTemplateResName, OutlookViewsInitializer.LocatesInFolderName, OutlookViewsInitializer.LocatesInFolderDeep);
            AscribeDeepName(FilterManagerProps.ConditionTemplateResName, OutlookViewsInitializer.SentViaAccountName, OutlookViewsInitializer.SentViaAccountDeep);
            AscribeDeepName(FilterManagerProps.ConditionTemplateResName, OutlookViewsInitializer.SentToMailingListXName, OutlookViewsInitializer.SentToMailingListXDeep);
            AscribeDeepName(FilterManagerProps.ConditionTemplateResName, OutlookViewsInitializer.ImportantMailName, OutlookViewsInitializer.ImportantMailDeep);

            AscribeDeepName(FilterManagerProps.ConditionResName, OutlookViewsInitializer.HasAttachmentName, OutlookViewsInitializer.HasAttachmentDeep);
            AscribeDeepName(FilterManagerProps.ConditionResName, OutlookViewsInitializer.SentOnlyToMeName, OutlookViewsInitializer.SentOnlyToMeDeep);
            AscribeDeepName(FilterManagerProps.ConditionResName, OutlookViewsInitializer.AuthorInABName, OutlookViewsInitializer.AuthorInABDeep);

            AscribeDeepName(FilterManagerProps.RuleActionTemplateResName, OutlookViewsInitializer.CopyEmailToFolderName, OutlookViewsInitializer.CopyEmailToFolderDeep);
            AscribeDeepName(FilterManagerProps.RuleActionTemplateResName, OutlookViewsInitializer.MoveEmailToFolderName, OutlookViewsInitializer.MoveEmailToFolderDeep);
            AscribeDeepName(FilterManagerProps.RuleActionTemplateResName, OutlookViewsInitializer.SetImportanceActionName, OutlookViewsInitializer.SetImportanceActionDeep);

            //-----------------------------------------------------------------
            //  Register standard (for the plugin) tray icon rule.
            //-----------------------------------------------------------------
            Core.TrayIconManager.RegisterTrayIconRule("Unread mail message(s)", new string[1] {
                STR.Email
            },
                                                      new IResource[] { Core.FilterRegistry.Std.ResourceIsUnread },
                                                      null, OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.unread.ico"));

            //-----------------------------------------------------------------
            //  If necessary relink all rules from "Delete e-mail" action to
            //  standard and more generic "Delete Resource" action.
            //-----------------------------------------------------------------
            IResource action = Core.ResourceStore.FindUniqueResource(FilterManagerProps.RuleActionResName, Core.Props.Name, "Delete e-mail");

            if (action != null)
            {
                IResourceList linkedRules = action.GetLinksOfType(null, "LinkedAction");
                for (int i = 0; i < linkedRules.Count; i++)
                {
                    linkedRules[i].SetProp("LinkedAction", Core.FilterRegistry.Std.DeleteResourceAction);
                }
                action.Delete();
            }
        }
Example #6
0
        public static Icon[] GetOverlayIcon(IResource resource)
        {
            PairIDs folderIDs = PairIDs.Get(resource);

            if (folderIDs != null)
            {
                if (OutlookSession.WereProblemWithOpeningStorage(folderIDs.StoreId) ||
                    OutlookSession.WereProblemWithOpeningFolder(folderIDs.EntryId))
                {
                    if (_problem == null)
                    {
                        _problem    = new Icon[1];
                        _problem[0] = OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.inaccessible.ico");
                    }
                    return(_problem);
                }
            }
            return(null);
        }
Example #7
0
 internal MailIconProvider()
 {
     _forwarded[0] = OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.forward_arrow.ico");
     _replied[0]   = OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.reply_arrow.ico");
 }
Example #8
0
        private static void RegisterMailTypes(OutlookPlugin ownerPlugin, IContactManager contactManager)
        {
            if (RS.ResourceTypes.Exist("MAPIFolderRoot"))
            {
                IResourceList resourcesToDelete = RS.GetAllResources("MAPIFolderRoot");
                foreach (IResource resource in resourcesToDelete)
                {
                    resource.Delete();
                }
            }
            RegisterResources(ownerPlugin);
            PROP.SyncVersion =
                RS.PropTypes.Register(STR.SyncVersion, PropDataType.Int, PropTypeFlags.Internal | PropTypeFlags.NoSerialize);

            PROP.EntryID = ResourceTypeHelper.UpdatePropTypeRegistration(STR.EntryID, PropDataType.String,
                                                                         PropTypeFlags.Internal | PropTypeFlags.NoSerialize);
            PROP.StoreID   = RS.PropTypes.Register(STR.StoreID, PropDataType.String, PropTypeFlags.Internal | PropTypeFlags.NoSerialize);
            PROP.RecordKey = ResourceTypeHelper.UpdatePropTypeRegistration(STR.RecordKey, PropDataType.String,
                                                                           PropTypeFlags.Internal | PropTypeFlags.NoSerialize);
            PROP.InternetMsgID = ResourceTypeHelper.UpdatePropTypeRegistration(STR.InternetMsgID,
                                                                               PropDataType.String, PropTypeFlags.Internal);
            PROP.ReplyTo                  = ResourceTypeHelper.UpdatePropTypeRegistration(STR.ReplyTo, PropDataType.String, PropTypeFlags.Internal);
            PROP.ConversationIndex        = RS.PropTypes.Register("ConversationIndex", PropDataType.String, PropTypeFlags.Internal);
            PROP.ReplyToConversationIndex = RS.PropTypes.Register("ReplyToConversationIndex", PropDataType.String, PropTypeFlags.Internal);

            PROP.SentOn          = RS.PropTypes.Register(STR.SentOn, PropDataType.Date);
            PROP.LastReceiveDate = RS.PropTypes.Register(STR.LastReceiveDate, PropDataType.Date);

            PROP.Extension       = RS.PropTypes.Register(STR.Extension, PropDataType.String);
            PROP.ResType         = RS.PropTypes.Register("ResType", PropDataType.String, PropTypeFlags.Internal);
            PROP.AttachmentIndex = RS.PropTypes.Register(STR.AttachmentIndex, PropDataType.Int, PropTypeFlags.Internal);
            PROP.AttachMethod    = RS.PropTypes.Register(STR.AttachMethod, PropDataType.Int, PropTypeFlags.Internal);

            PROP.ResourceTransfer = RS.PropTypes.Register("ResorceTransfer", PropDataType.Bool, PropTypeFlags.Internal);

            CorrectDeletedItemsProperty();

            PROP.DeletedInIMAP         = RS.PropTypes.Register("DeletedInIMAP", PropDataType.Bool, PropTypeFlags.Internal);
            PROP.IgnoredFolder         = RS.PropTypes.Register("IgnoredFolder", PropDataType.Int, PropTypeFlags.Internal);
            PROP.DefaultFolderEntryIDs = RS.PropTypes.Register(STR.DefaultFolderEntryIDs, PropDataType.StringList, PropTypeFlags.Internal);
            PROP.MySelf           = Core.ContactManager.Props.Myself;
            PROP.Imported         = RS.PropTypes.Register(STR.Imported, PropDataType.Int, PropTypeFlags.Internal);
            PROP.OpenIgnoreFolder = RS.PropTypes.Register("OpenIgnoreFolder", PropDataType.Int, PropTypeFlags.Internal);
            PROP.OpenSelectFolder = RS.PropTypes.Register("OpenSelectFolder", PropDataType.Int, PropTypeFlags.Internal);
            PROP.MessageFlag      = RS.PropTypes.Register(STR.MessageFlag, PropDataType.String, PropTypeFlags.Internal);
            PROP.LastModifiedTime = ResourceTypeHelper.UpdatePropTypeRegistration("LastModifiedTime",
                                                                                  PropDataType.Date, PropTypeFlags.Internal);
            PROP.Priority        = RS.PropTypes.Register(STR.Priority, PropDataType.Int);
            PROP.EmbeddedMessage = RS.PropTypes.Register(STR.EmbeddedMessage, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.Importance      = RS.PropTypes.Register(STR.Importance, PropDataType.Int);
            PROP.SeeAll          = RS.PropTypes.Register("SeeAll", PropDataType.Bool, PropTypeFlags.Internal);
            PROP.ContainerClass  = RS.PropTypes.Register(STR.ContainerClass, PropDataType.String, PropTypeFlags.Internal);
            PROP.BodyFormat      = RS.PropTypes.Register(STR.BodyFormat, PropDataType.String, PropTypeFlags.Internal);
            PROP.DefaultFolder   = RS.PropTypes.Register(STR.DefaultFolder, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.MAPIVisible     = RS.PropTypes.Register(STR.MAPIVisible, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.ShowPictures    = RS.PropTypes.Register(STR.ShowPictures, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.NoFormat        = RS.PropTypes.Register(STR.NoFormat, PropDataType.Bool, PropTypeFlags.Internal);

            PROP.SyncComplete          = RS.PropTypes.Register("SyncComplete", PropDataType.Bool, PropTypeFlags.Internal);
            PROP.Target                = ResourceTypeHelper.UpdatePropTypeRegistration("Target", PropDataType.Link, PropTypeFlags.DirectedLink);
            PROP.IgnoreContactImport   = RS.PropTypes.Register(STR.IgnoreContactImport, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.DeletedItemsFolder    = RS.PropTypes.Register(STR.DeletedItemsFolder, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.DefaultDeletedItems   = RS.PropTypes.Register(STR.DefaultDeletedItems, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.DeletedItemsEntryID   = RS.PropTypes.Register(STR.DeletedItemsEntryID, PropDataType.String, PropTypeFlags.Internal);
            PROP.JunkEmailEntryID      = RS.PropTypes.Register(STR.JunkEmailEntryID, PropDataType.String, PropTypeFlags.Internal);
            PROP.PR_STORE_SUPPORT_MASK = RS.PropTypes.Register(STR.PR_STORE_SUPPORT_MASK, PropDataType.Int, PropTypeFlags.Internal);
            PROP.StoreSupported        = RS.PropTypes.Register(STR.StoreSupported, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.StoreTypeChecked      = RS.PropTypes.Register(STR.StoreTypeChecked, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.PR_CONTENT_COUNT      = RS.PropTypes.Register(STR.PR_CONTENT_COUNT, PropDataType.Int, PropTypeFlags.Internal);
            PROP.PR_ICON_INDEX         = RS.PropTypes.Register(STR.PR_ICON_INDEX, PropDataType.Int, PropTypeFlags.Internal);
            CommonProps.Register();

            if (RS.PropTypes.Exist(STR.PR_ATTACH_CONTENT_ID))
            {
                IResourceList list = RS.FindResourcesWithProp(STR.Email, STR.PR_ATTACH_CONTENT_ID);
                foreach (IResource mail in list)
                {
                    mail.SetProp(CommonProps.ContentId, mail.GetStringProp(STR.PR_ATTACH_CONTENT_ID));
                    mail.DeleteProp(STR.PR_ATTACH_CONTENT_ID);
                }
                IPropType propType = RS.PropTypes[STR.PR_ATTACH_CONTENT_ID];
                RS.PropTypes.Delete(propType.Id);
            }
            PROP.PR_ATTACH_NUM = RS.PropTypes.Register(STR.PR_ATTACH_NUM, PropDataType.Int, PropTypeFlags.Internal);
            PROP.LastMailDate  = RS.PropTypes.Register(STR.LastMailDate, PropDataType.Date, PropTypeFlags.Internal);
            PROP.OMTaskId      = RS.PropTypes.Register(STR.OMTaskId, PropDataType.String, PropTypeFlags.Internal | PropTypeFlags.NoSerialize);

            PROP.AttachmentPicWidth  = RS.PropTypes.Register(STR.Width, PropDataType.Int, PropTypeFlags.Internal);
            PROP.AttachmentPicHeight = RS.PropTypes.Register(STR.Height, PropDataType.Int, PropTypeFlags.Internal);

            PROP.From = contactManager.Props.LinkFrom;
            PROP.To   = contactManager.Props.LinkTo;
            PROP.CC   = contactManager.Props.LinkCC;

            PROP.EmailAccountFrom = Core.ContactManager.Props.LinkEmailAcctFrom;
            PROP.EmailAccountTo   = Core.ContactManager.Props.LinkEmailAcctTo;
            PROP.EmailAccountCC   = Core.ContactManager.Props.LinkEmailAcctCC;
            RS.RegisterLinkRestriction(STR.Email, PROP.From, "Contact", 0, 1);

            PROP.SelectedInFolder = RS.PropTypes.Register("SelectedInFolder", PropDataType.Link, PropTypeFlags.Internal);

            PROP.Attachment = Core.ResourceStore.PropTypes.Register(STR.Attachment, PropDataType.Link,
                                                                    PropTypeFlags.SourceLink | PropTypeFlags.DirectedLink, ownerPlugin);
            RS.PropTypes.RegisterDisplayName(PROP.Attachment, "Outlook Message", "Attachment");

            PROP.AttType            = RS.PropTypes.Register(STR.AttachmentType, PropDataType.Link, PropTypeFlags.Internal);
            PROP.OwnerStore         = RS.PropTypes.Register("OwnerStore", PropDataType.Link, PropTypeFlags.Internal);
            PROP.TopLevelCategory   = RS.PropTypes.Register("TopLevelCategory", PropDataType.Link, PropTypeFlags.Internal);
            PROP.InternalAttachment = RS.PropTypes.Register("InternalAttachment", PropDataType.Link, PropTypeFlags.Internal);

            IResource     propMAPIFolderLink = RS.FindUniqueResource("PropType", "Name", STR.MAPIFolder);
            PropTypeFlags flags = PropTypeFlags.Normal | PropTypeFlags.CountUnread;

            if (propMAPIFolderLink != null)
            {
                propMAPIFolderLink.SetProp("Flags", (int)flags);
                PROP.MAPIFolder = propMAPIFolderLink.GetIntProp("ID");
            }
            else
            {
                PROP.MAPIFolder = RS.PropTypes.Register(STR.MAPIFolder, PropDataType.Link, flags);
            }
            RS.PropTypes.RegisterDisplayName(PROP.MAPIFolder, "Outlook Folder");

            RS.ResourceTypes.Register(STR.Task, "Subject");

            RS.RegisterUniqueRestriction(STR.Email, PROP.EntryID);
            RS.RegisterUniqueRestriction(STR.OutlookABDescriptor, PROP.EntryID);
            RS.RegisterUniqueRestriction("AddressBook", PROP.EntryID);
            RS.RegisterUniqueRestriction(STR.MAPIInfoStore, PROP.EntryID);
            RS.RegisterUniqueRestriction(STR.MAPIInfoStore, PROP.DeletedItemsEntryID);
            RS.RegisterUniqueRestriction(STR.MAPIInfoStore, PROP.JunkEmailEntryID);
            RS.RegisterUniqueRestriction("Contact", PROP.EntryID);
            RS.RegisterUniqueRestriction(STR.MAPIStore, PROP.StoreID);

            RS.RegisterLinkRestriction(STR.Email, PROP.MAPIFolder, STR.MAPIFolder, 0, 1);
            RS.RegisterUniqueRestriction(STR.MAPIFolder, PROP.EntryID);
            RS.RegisterLinkRestriction(STR.MAPIFolder, Core.Props.Parent, null, 1, 1);
            RS.RegisterLinkRestriction(STR.MAPIFolder, PROP.OwnerStore, STR.MAPIStore, 1, 1);
            RS.RegisterLinkRestriction(STR.Email, PROP.OwnerStore, STR.MAPIStore, 0, 1);
            RS.DeleteUniqueRestriction(STR.Task, PROP.OMTaskId);
            RS.RegisterUniqueRestriction(STR.Task, PROP.EntryID);

            RemoveInvalidAttachmentResources();
            RemoveAttachmentResources();
            UpdateOutlookAttachments( );
            ChangeDatePropForMAPIStore();

            PROP.Status      = RS.PropTypes.Register("Status", PropDataType.Int);
            PROP.RemindDate  = RS.PropTypes.Register("RemindDate", PropDataType.Date);
            PROP.StartDate   = RS.PropTypes.Register("StartDate", PropDataType.Date);
            PROP.Description = RS.PropTypes.Register("Description", PropDataType.String);
            //  NB: this prop format must coinside with that in TasksPlugin.
            PROP.SuperTaskLink = RS.PropTypes.Register(STR.SuperTaskLink, PropDataType.Link, PropTypeFlags.DirectedLink | PropTypeFlags.Internal);
            RS.ResourceTypes.Register("SentItemsEnumSign", "", ResourceTypeFlags.NoIndex | ResourceTypeFlags.Internal);
            UpdateLastMailDateForFolders();
            RemoveWrongGlobalBooks();
            RemoveOMTaskIDs();
            UpdateDeletedItemsFolders();
            DeleteInvalidMAPIFolders();
            UpdateMapiInfoStores();
            _registered = true;
        }
Example #9
0
        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");
        }