Exemple #1
0
        private void  RegisterPropertyTypes()
        {
            IPropTypeCollection props = Core.ResourceStore.PropTypes;

            SearchRankPropId = props.Register("SearchRank", PropDataType.Double, PropTypeFlags.Virtual);
            props.RegisterDisplayName(SearchRankPropId, "Search Rank");

            SimilarityPropId       = props.Register("Similarity", PropDataType.Double, PropTypeFlags.Virtual);
            ContextPropId          = props.Register("Context", PropDataType.String, PropTypeFlags.Virtual);
            ProximityPropId        = props.Register("Proximity", PropDataType.Int, PropTypeFlags.Virtual);
            ContextHighlightPropId = props.Register("HighlightContext", PropDataType.String, PropTypeFlags.Virtual);

            props.Register(DocumentSectionResource.SectionHelpDescription, PropDataType.String, PropTypeFlags.Internal);
            props.Register("SectionShortName", PropDataType.String, PropTypeFlags.Internal);
            props.Register("SectionOrder", PropDataType.Int, PropTypeFlags.Internal);

            Core.ResourceStore.ResourceTypes.Register(DocumentSectionResource.DocSectionResName, "", ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex);
            Core.ResourceStore.RegisterUniqueRestriction(DocumentSectionResource.DocSectionResName, Core.Props.Name);

            RegisterDocumentSection(DocumentSection.BodySection, "Full content of the resource", null);
            RegisterDocumentSection(DocumentSection.SubjectSection, "Describes subject (or heading, title) of the e-mail, article, etc", "SU");
            RegisterDocumentSection(DocumentSection.AnnotationSection, "A note added by way of comment or explanation", "AN");
            RegisterDocumentSection(DocumentSection.SourceSection, "Identifies a source of the resource - person, site, server, etc.", "SRC");

            RegisterIndexVersioningTypes();
        }
Exemple #2
0
        /**
         * Registers the resource and property types used by address books,
         * and creates the address book root.
         */

        private static void RegisterTypes()
        {
            IResourceStore      store = Core.ResourceStore;
            IPropTypeCollection props = Core.ResourceStore.PropTypes;

            store.ResourceTypes.Register("AddressBook", "Address Book", "Name", ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex);
            _propInAddressBook = props.Register("InAddressBook", PropDataType.Link, PropTypeFlags.DirectedLink);
            _propDeepName      = props.Register("DeepName", PropDataType.String);
            props.Register("IsNonExportable", PropDataType.Bool, PropTypeFlags.Internal);
            props.RegisterDisplayName(_propInAddressBook, "In Address Book", "Contains");

            _addressBookRoot = Core.ResourceTreeManager.GetRootForType("AddressBook");
            Core.ResourceTreeManager.SetResourceNodeSort(_addressBookRoot, "Name");

            if (store.ResourceTypes.Exist("AddressBookRoot"))
            {
                IResourceList abRootsOld = store.GetAllResources("AddressBookRoot");
                if (abRootsOld.Count > 0)
                {
                    IResource abRootOld = abRootsOld [0];
                    foreach (IResource res in abRootOld.GetLinksTo(null, "Parent"))
                    {
                        res.SetProp("Parent", _addressBookRoot);
                    }
                    abRootOld.Delete();
                }
            }

            _typesRegistered = true;
        }
Exemple #3
0
        internal static void Register()
        {
            IResourceStore      store     = Core.ResourceStore;
            IPropTypeCollection propTypes = store.PropTypes;

            _propUIN                = propTypes.Register("UIN", PropDataType.Int);
            _propNickName           = propTypes.Register("NickName", PropDataType.String);
            _propScreenName         = propTypes.Register("ScreenName", PropDataType.String);
            _propJabberID           = propTypes.Register("JabberID", PropDataType.String);
            _propYahooID            = propTypes.Register("YahooID", PropDataType.String);
            _propFirstMirandaImport = propTypes.Register("FirstMirandaImport", PropDataType.Date);
            _propLastMirandaImport  = propTypes.Register("LastMirandaImport", PropDataType.Date);
            _propFromAccount        = propTypes.Register("FromAccount", PropDataType.Link, PropTypeFlags.Internal);
            _propToAccount          = propTypes.Register("ToAccount", PropDataType.Link, PropTypeFlags.Internal);

            IResource propMirandaAcct = store.FindUniqueResource("PropType", "Name", "MirandaAcct");

            if (propMirandaAcct != null)
            {
                propMirandaAcct.SetProp("Flags", (int)PropTypeFlags.ContactAccount);
                _propMirandaAcct = propMirandaAcct.GetIntProp("ID");
            }
            else
            {
                _propMirandaAcct = store.PropTypes.Register("MirandaAcct", PropDataType.Link, PropTypeFlags.ContactAccount);
            }
            store.PropTypes.RegisterDisplayName(_propMirandaAcct, "Miranda Account");
        }
Exemple #4
0
        private void RegisterTypes()
        {
            IResourceStore          store    = Core.ResourceStore;
            IResourceTypeCollection resTypes = store.ResourceTypes;

            resTypes.Register(_Note, "Note", "Subject", ResourceTypeFlags.Normal, this);

            IPropTypeCollection propTypes = store.PropTypes;

            _propLastUpdated = propTypes.Register("LastUpdated", PropDataType.Date, PropTypeFlags.Internal);
        }
Exemple #5
0
        /// <summary>
        /// Return true if property with such name exists (registered) in the system and
        /// its underlying type is Date.
        /// </summary>
        /// <param name="propName">Name of a property.</param>
        public static bool IsDateProperty(string propName)
        {
            if (propName == null)
            {
                return(false);
            }

            IPropTypeCollection propTypes = Core.ResourceStore.PropTypes;

            return(propTypes.Exist(propName) && (propTypes[propName].DataType == PropDataType.Date));
        }
Exemple #6
0
        public static string LinkTypeDisplayName(string deepName)
        {
            IPropTypeCollection propTypes = Core.ResourceStore.PropTypes;

            foreach (IPropType pt in propTypes)
            {
                if (pt.Name == deepName)
                {
                    return(pt.DisplayName);
                }
            }
            throw new ApplicationException("No such link type for conversion");
        }
Exemple #7
0
        public QueryForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            RestoreSettings();
            IPropTypeCollection props = Core.ResourceStore.PropTypes;

            foreach (IPropType propType in props)
            {
                comboBox1.Items.Add(propType.Name);
            }
        }
Exemple #8
0
        private void RegisterIndexVersioningTypes()
        {
            IPropTypeCollection props = Core.ResourceStore.PropTypes;

            _needDiscard = !File.Exists(OMEnv.TokenTreeFileName);
//            _needDiscard = !props.Exist( "InTextIndex" ) || !File.Exists( OMEnv.TokenTreeFileName );
//            DocInIndexProp = props.Register( "InTextIndex", PropDataType.Bool, PropTypeFlags.Internal );

            //  The resource (single and unique) of this type keeps the current version of the
            //  text index. It has the single property "TextIndexVersion" (see below).
            Core.ResourceStore.ResourceTypes.Register("TextIndexVersion", "Name",
                                                      ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex);

            //  This property keeps the current version of the text index (do not mix it with
            //  the version of text index format. Each time the index is rebuilt, the value of this
            //  property is increased by 1, thus invalidating all resource which reference to the
            //  older version of the index through their "InTextIndexVersion" property (see below).
            TextIndexVersionProp = props.Register("TextIndexVersion", PropDataType.Int, PropTypeFlags.Internal);

            //  Property "InTextIndexVersion" keeps the version of text index in which the
            //  resource was indexed. If the value of this property is less than current version of
            //  the index (in the "TextIndexVersion" property, see above), then this resource will be
            //  reindexed.
            DocInVersionIndexProp = props.Register("InTextIndexVersion", PropDataType.Int, PropTypeFlags.Internal);

            //  Delete the old property.
            if (props.Exist("InTextIndex"))
            {
                props.Delete(props["InTextIndex"].Id);
            }

            //  Load the current version of the index. In the case of the very first loading
            //  (when switching to the new versioning scheme) version is set to 1 and written back
            //  to the ResourceStore.
            IResourceList versions = Core.ResourceStore.FindResourcesWithProp(null, TextIndexVersionProp);

            if (versions.Count == 0)
            {
                _indexVersionRes = Core.ResourceStore.BeginNewResource("TextIndexVersion");
                _indexVersionRes.SetProp(TextIndexVersionProp, 1);
                _indexVersionRes.EndUpdate();
            }
            else
            {
                _indexVersionRes = versions[0];
            }
            _indexVersion = _indexVersionRes.GetIntProp(TextIndexVersionProp);
        }
Exemple #9
0
        private void RegisterTypes()
        {
            IResourceTypeCollection resTypes = Core.ResourceStore.ResourceTypes;

            resTypes.Register("Weblink", "Web Bookmark", "Name", ResourceTypeFlags.NoIndex, this);
            resTypes["Weblink"].DisplayName = "Web Bookmark";
            resTypes.Register("Folder", "Name", ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex);
            IPropTypeCollection propTypes = Core.ResourceStore.PropTypes;

            _propURL         = propTypes.Register("URL", PropDataType.String);
            _propParent      = propTypes.Register("Parent", PropDataType.Link, PropTypeFlags.DirectedLink);
            _propETag        = propTypes.Register("ETag", PropDataType.String, PropTypeFlags.Internal);
            _propLastUpdated = propTypes.Register("LastUpdated", PropDataType.Date, PropTypeFlags.Internal);
            _propUpdateFreq  = propTypes.Register("UpdateFreq", PropDataType.Int, PropTypeFlags.Internal);
            _propIsUnread    = propTypes.Register("IsUnread", PropDataType.Bool);
            _propContent     = propTypes.Register("Content", PropDataType.Blob, PropTypeFlags.Internal);
            _propBookmarkId  = propTypes.Register("BookmarkId", PropDataType.String, PropTypeFlags.Internal);
            _propChangesLog  = propTypes.Register("ChangesLog", PropDataType.StringList, PropTypeFlags.Internal);
            _propFaviconUrl  = propTypes.Register("FaviconUrl", PropDataType.String, PropTypeFlags.Internal);
            _propInvisible   = propTypes.Register("Invisible", PropDataType.Bool, PropTypeFlags.Internal);
            if (propTypes.Exist("Path"))
            {
                propTypes.Delete(propTypes["Path"].Id);
            }
            if (propTypes.Exist("IsIEFavoritesRoot"))
            {
                IResource ieRoot = Core.ResourceStore.FindUniqueResource("Folder", "IsIEFavoritesRoot", true);
                if (ieRoot != null)
                {
                    ieRoot.SetProp(Core.Props.Name, ieRoot.DisplayName);
                    ieRoot.DisplayName = "";
                }
                propTypes.Delete(propTypes["IsIEFavoritesRoot"].Id);
            }
            if (propTypes.Exist("IsMozillaRoot"))
            {
                IResource mozillaRoot = Core.ResourceStore.FindUniqueResource("Folder", "IsMozillaRoot", true);
                if (mozillaRoot != null)
                {
                    _bookmarkService.DeleteFolder(mozillaRoot);
                }
                propTypes.Delete(propTypes["IsMozillaRoot"].Id);
            }
        }
Exemple #10
0
        public void Register()
        {
            _bookmarkService = new BookmarkService();

            RegisterTypes();

            IUIManager uiMgr = Core.UIManager;

            uiMgr.RegisterWizardPane("Import Bookmarks", ImportBookmarksOptionsPane.StartupWizardPaneCreator, 1);
            uiMgr.RegisterOptionsGroup("Internet", "The Internet options enable you to control how [product name] works with several types of online content.");
            OptionsPaneCreator favoritesPaneCreator = FavoritesOptionsPane.FavoritesOptionsPaneCreator;

            uiMgr.RegisterOptionsPane("Internet", "Favorites", favoritesPaneCreator,
                                      "The Favorites options enable you to control how your Internet Explorer Favorites are imported and synchronized with Internet Explorer.");
            ImportBookmarksOptionsPane.AddPane(favoritesPaneCreator);

            if (OperaBookmarkProfile.OperaBookmarksPath().Length > 0)
            {
                OptionsPaneCreator operaPaneCreator = OperaOptionsPane.CreatePane;
                uiMgr.RegisterOptionsPane("Internet", "Opera Bookmarks", operaPaneCreator,
                                          "The Opera Bookmarks options enable you to control how your Opera Bookmarks are imported.");
                ImportBookmarksOptionsPane.AddPane(operaPaneCreator);
            }

            OptionsPaneCreator downloadOptionsPaneCreator = DownloadOptionsPane.DownloadOptionsPaneCreator;

            uiMgr.RegisterOptionsPane("Internet", "Web Pages", downloadOptionsPaneCreator,
                                      "The Web Pages options enable you to control how your bookmarked Web pages are downloaded.");
            IPropTypeCollection propTypes = Core.ResourceStore.PropTypes;
            int sourceId = propTypes["Source"].Id;

            propTypes.RegisterDisplayName(sourceId, "Web Bookmark");
            Core.TabManager.RegisterResourceTypeTab("Web", "Web", new[] { "Weblink", "Folder" }, sourceId, 4);
            uiMgr.RegisterResourceLocationLink("Weblink", _propParent, "Folder");
            uiMgr.RegisterResourceLocationLink("Folder", _propParent, "Folder");
            uiMgr.RegisterResourceSelectPane("Weblink", typeof(ResourceTreeSelectPane));
            Core.WorkspaceManager.RegisterWorkspaceType("Weblink",
                                                        new[] { Core.ResourceStore.PropTypes["Source"].Id }, WorkspaceResourceType.Container);
            Core.WorkspaceManager.RegisterWorkspaceFolderType("Folder", "Weblink", new[] { _propParent });
            IPluginLoader loader = Core.PluginLoader;

            loader.RegisterResourceDisplayer("Weblink", this);
            loader.RegisterStreamProvider("Weblink", this);
            loader.RegisterResourceUIHandler("Folder", this);
            loader.RegisterResourceUIHandler("Weblink", this);
            loader.RegisterResourceTextProvider(null, this);
            _favIconManager = (FavIconManager)Core.GetComponentImplementation(typeof(FavIconManager));

            Image img = Utils.TryGetEmbeddedResourceImageFromAssembly(Assembly.GetExecutingAssembly(), "Favorites.Icons.Favorites24.png");

            _favoritesTreePane = Core.LeftSidebar.RegisterResourceStructureTreePane("Favorites", "Web", "Bookmarks", img, "Weblink");
            _favoritesTreePane.WorkspaceFilterTypes = new[] { "Weblink", "Folder" };
            _favoritesTreePane.EnableDropOnEmpty(this);
            JetResourceTreePane realPane = (JetResourceTreePane)_favoritesTreePane;

            realPane.AddNodeDecorator(new WeblinkNodeDecorator());
            realPane.AddNodeFilter(new BookmarkProfileFilter());
            _favoritesTreePane.ToolTipCallback = DisplayWeblinkError;
            Core.LeftSidebar.RegisterViewPaneShortcut("Favorites", Keys.Control | Keys.Alt | Keys.B);

            Core.ResourceIconManager.RegisterResourceIconProvider("Weblink", this);
            Core.ResourceIconManager.RegisterPropTypeIcon(Core.ResourceStore.PropTypes["Source"].Id, LoadIconFromAssembly("favorites1.ico"));
            _emptyWeblinkIcon = LoadIconFromAssembly("weblink_empty.ico");
            _errorWeblinkIcon = LoadIconFromAssembly("weblink_error.ico");
            WebLinksPaneFilter filter = new WebLinksPaneFilter();

            Core.ResourceBrowser.RegisterLinksPaneFilter("Weblink", filter);
            Core.ResourceBrowser.RegisterLinksPaneFilter("Folder", filter);
            Core.ResourceBrowser.RegisterResourceDisplayForwarder("Weblink", ForwardWeblinkDisplay);
            Core.FilterEngine.RegisterRuleApplicableResourceType("Weblink");

            Core.RemoteControllerManager.AddRemoteCall("Favorites.ExportMozillaBookmarkChanges.1",
                                                       new RemoteExportMozillaBookmarkChangesDelegate(RemoteExportMozillaBookmarkChanges));
            Core.RemoteControllerManager.AddRemoteCall("Favorites.SetMozillaBookmarkId.1",
                                                       new RemoteSetMozillaBookmarkIdDelegate(RemoteSetMozillaBookmarkId));
            Core.RemoteControllerManager.AddRemoteCall("Favorites.RefreshMozillaBookmarks.1",
                                                       new RemoteRefreshBookmarksDelegate(RemoteRefreshBookmarks));
            Core.RemoteControllerManager.AddRemoteCall("Favorites.AnnotateWeblink.1",
                                                       new RemoteAnnotateWeblinkDelegate(RemoteAnnotateWeblink));

            Core.DisplayColumnManager.RegisterDisplayColumn("Weblink", 0,
                                                            new ColumnDescriptor(new[] { "Name", "DisplayName" }, 300, ColumnDescriptorFlags.AutoSize));
            Core.DisplayColumnManager.RegisterDisplayColumn("Weblink", 1, new ColumnDescriptor("LastUpdated", 120));

            /**
             * bookmark profiles
             */
            Core.PluginLoader.RegisterPluginService(_bookmarkService);
            _favoritesProfile = new IEFavoritesBookmarkProfile(_bookmarkService);
            _bookmarkService.RegisterProfile(_favoritesProfile);
            if (OperaBookmarkProfile.OperaBookmarksPath().Length > 0)
            {
                _operaProfile = new OperaBookmarkProfile(_bookmarkService);
                _bookmarkService.RegisterProfile(_operaProfile);
            }
            if (MozillaProfiles.PresentOnComputer)
            {
                OptionsPaneCreator mozillaPaneCreator = MozillaOptionsPane.MozillaOptionsPaneCreator;
                uiMgr.RegisterOptionsPane("Internet", "Mozilla Bookmarks", mozillaPaneCreator,
                                          "The Mozilla Bookmarks options enable you to select Mozilla or Firefox profile which bookmarks are imported.");
                ImportBookmarksOptionsPane.AddPane(mozillaPaneCreator);
                RegisterMozillaProfiles(MozillaProfiles.GetMozillaProfiles());
                RegisterMozillaProfiles(MozillaProfiles.GetFirefoxProfiles());
                RegisterMozillaProfiles(MozillaProfiles.GetFirefox09Profiles());
                RegisterMozillaProfiles(MozillaProfiles.GetAbsoluteFirefoxProfiles());
                MozillaBookmarkProfile.SetImportPropertiesOfProfiles();
            }
        }
Exemple #11
0
        private void RegisterTypes()
        {
            IPropTypeCollection propTypes = Core.ResourceStore.PropTypes;

            _propLastSynchUpdate = propTypes.Register("LastSynchronizeDate", PropDataType.Date, PropTypeFlags.Internal, this);
        }