Exemple #1
0
        public void Register()
        {
            _thePlugin      = this;
            _folderWatchers = new HashMap();
            _dbLocations    = new HashSet();
            _icqContacts    = new ArrayList();
            _icqMessages    = new ArrayList();
            _idResources    = new IntHashSet();

            RegisterTypes();

            IUIManager uiMgr = Core.UIManager;

            uiMgr.RegisterOptionsGroup("Instant Messaging", "The Instant Messaging options enable you to control how [product name] works with supported instant messaging programs.");
            OptionsPaneCreator icqPaneCreator = ICQOptionsPane.ICQOptionsPaneCreator;

            uiMgr.RegisterOptionsPane("Instant Messaging", "ICQ", icqPaneCreator,
                                      "The ICQ options enable you to specify which ICQ accounts should be indexed, and how [product name] should build conversations from ICQ messages.");
            uiMgr.AddOptionsChangesListener("Instant Messaging", "ICQ", ICQOptionsChanged);

            if (UINsCollection.GetUINs().Count > 0)
            {
                uiMgr.RegisterWizardPane("ICQ", icqPaneCreator, 10);
                Core.TabManager.RegisterResourceTypeTab("IM", "IM", _icqConversationResName, 2);
                _correspondentPane            = new CorrespondentCtrl();
                _correspondentPane.IniSection = "ICQ";
                _correspondentPane.SetCorresponentFilterList(Core.ResourceStore.FindResourcesWithProp(null, "ICQAcct"));

                Image img = Utils.TryGetEmbeddedResourceImageFromAssembly(Assembly.GetExecutingAssembly(), "ICQPlugin.Icons.Correspondents24.png");
                Core.LeftSidebar.RegisterResourceStructurePane("ICQCorrespondents", "IM", "ICQ Correspondents", img, _correspondentPane);
                Core.LeftSidebar.RegisterViewPaneShortcut("ICQCorrespondents", Keys.Control | Keys.Alt | Keys.Q);
            }

            IPluginLoader  loader        = Core.PluginLoader;
            IActionManager actionManager = Core.ActionManager;

            loader.RegisterResourceDisplayer(_icqConversationResName, this);
            actionManager.RegisterLinkClickAction(new ConversationLinkClickAction(), _icqConversationResName, null);
            _conversationManager = new IMConversationsManager(_icqConversationResName, "ICQ Conversation", "Subject",
                                                              GetConversationTimeSpan(), _propICQAcct, _propFromICQ, _propToICQ, this);
            _conversationManager.ReverseMode = GetReverseMode();
            SaveConversationAction saveConvAction = new SaveConversationAction(_conversationManager, _propNickName);

            actionManager.RegisterContextMenuAction(saveConvAction, ActionGroups.ITEM_OPEN_ACTIONS, ListAnchor.Last,
                                                    "Save to File...", null, _icqConversationResName, null);
            actionManager.RegisterActionComponent(saveConvAction, "SaveAs", _icqConversationResName, null);
            EmailConversationAction mailConvAction = new EmailConversationAction(_conversationManager, _propNickName);

            actionManager.RegisterContextMenuAction(mailConvAction, ActionGroups.ITEM_OPEN_ACTIONS, ListAnchor.Last,
                                                    "Send by Email", null, _icqConversationResName, null);
            actionManager.RegisterActionComponent(mailConvAction, "SendByMail", _icqConversationResName, null);
            loader.RegisterResourceSerializer(_icqAccountResName, new ICQAccountSerializer());
            loader.RegisterResourceTextProvider(_icqConversationResName, _conversationManager);
            loader.RegisterResourceTextProvider(_contactResName, this);

            Core.ResourceBrowser.RegisterLinksPaneFilter(_icqConversationResName, new ItemRecipientsFilter());
            Core.ResourceBrowser.RegisterLinksGroup("Accounts", new[] { _propICQAcct }, ListAnchor.First);

            //  Upgrade information about ICQ address book - set its
            //  ContentType property so that it could be filtered out when
            //  this plugin is switched off.
            IResource ab = Core.ResourceStore.FindUniqueResource("AddessBook", "Name", "ICQ Contacts");

            if (ab != null)
            {
                ab.SetProp("ContentType", _icqConversationResName);
            }

            Core.ResourceBrowser.SetDefaultViewSettings("IM", AutoPreviewMode.Off, true);
        }