private static void RegisterMozillaProfiles(IEnumerable profiles) { foreach (MozillaProfile profile in profiles) { MozillaBookmarkProfile prf = new MozillaBookmarkProfile(profile.Name, _bookmarkService); _bookmarkService.RegisterProfile(prf); CookiesManager.RegisterCookieProvider(prf); } }
internal static void SetImportPropertiesOfProfiles() { IBookmarkService service = (IBookmarkService)Core.PluginLoader.GetPluginService(typeof(IBookmarkService)); string[] profiles = Core.SettingStore.ReadString("Favorites", "MozillaProfile").ToLower().Split(';'); foreach (IBookmarkProfile prf in service.Profiles) { MozillaBookmarkProfile mprf = prf as MozillaBookmarkProfile; if (mprf != null) { mprf.ImportAllowed = Array.IndexOf(profiles, mprf._profileName.ToLower()) >= 0; } } }
private static void OnlineUpdateMozillaProfiles() { MozillaBookmarkProfile.SetImportPropertiesOfProfiles(); IBookmarkService service = (IBookmarkService)Core.PluginLoader.GetPluginService(typeof(IBookmarkService)); foreach (IBookmarkProfile profile in service.Profiles) { MozillaBookmarkProfile mozillaPrf = profile as MozillaBookmarkProfile; if (mozillaPrf != null) { Core.ResourceAP.RunUniqueJob(new MethodInvoker(profile.StartImport)); } } }
private static BookmarkChange[] ParseChangesLog(string profileName) { IBookmarkService service = (IBookmarkService)Core.PluginLoader.GetPluginService(typeof(IBookmarkService)); IResource profileRoot = service.GetProfileRoot( BookmarkService.NormalizeProfileName("Mozilla/" + profileName)); if (profileRoot != null) { Trace.WriteLine("ParseChangesLog( " + profileName + " ) : profileRoot != null"); MozillaBookmarkProfile profile = service.GetOwnerProfile(profileRoot) as MozillaBookmarkProfile; if (profile != null) { Trace.WriteLine("ParseChangesLog( " + profileName + " ) : profile != null"); profile.IsActive = true; IStringList log = profileRoot.GetStringListProp(_propChangesLog); if (log.Count > 0) { Trace.WriteLine("ParseChangesLog( " + profileName + " ) : log.Count > 0"); BookmarkChange[] result = new BookmarkChange[log.Count]; for (int i = 0; i < result.Length; ++i) { string[] changeFields = log[i].Split('\x01'); result[i].type = Int32.Parse(changeFields[0]); result[i].id = Int32.Parse(changeFields[1]); result[i].rdfid = changeFields[2]; result[i].oldparent = changeFields[3]; result[i].oldparent_id = Int32.Parse(changeFields[4]); result[i].parent = changeFields[5]; result[i].parent_id = Int32.Parse(changeFields[6]); result[i].name = changeFields[7]; result[i].url = changeFields[8]; } profileRoot.DeleteProp(_propChangesLog); return(result); } } } return(null); }
public void RemoteRefreshBookmarks(string profilePath) { string profileName = ProfilePath2Name(profilePath); if (profileName != null) { IBookmarkService service = (IBookmarkService)Core.PluginLoader.GetPluginService(typeof(IBookmarkService)); IResource profileRoot = service.GetProfileRoot( BookmarkService.NormalizeProfileName("Mozilla/" + profileName)); if (profileRoot != null) { MozillaBookmarkProfile profile = service.GetOwnerProfile(profileRoot) as MozillaBookmarkProfile; if (profile != null) { profile.IsActive = true; Core.ResourceAP.QueueJob( "Refreshing bookmarks for " + profileName, new MethodInvoker(profile.StartImport)); } } } }
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(); } }