2001-08-01 07:48:08 +04:00
|
|
|
/* -*- Mode: C#; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2004-04-19 02:14:17 +04:00
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
2001-08-01 07:48:08 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
2004-04-19 02:14:17 +04:00
|
|
|
* License.
|
2001-08-01 07:48:08 +04:00
|
|
|
*
|
|
|
|
* The Original Code is Manticore.
|
2004-04-19 02:14:17 +04:00
|
|
|
*
|
2001-08-01 07:48:08 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2004-04-19 02:14:17 +04:00
|
|
|
* Silverstone Interactive.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2001
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2001-08-01 07:48:08 +04:00
|
|
|
*
|
|
|
|
* Contributor(s):
|
2004-04-19 02:14:17 +04:00
|
|
|
* Ben Goodger <ben@netscape.com> (Original Author)
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-08-01 07:48:08 +04:00
|
|
|
*
|
2004-04-19 02:14:17 +04:00
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2001-08-01 07:48:08 +04:00
|
|
|
|
|
|
|
namespace Silverstone.Manticore.Bookmarks
|
|
|
|
{
|
|
|
|
using System;
|
|
|
|
using System.Drawing;
|
|
|
|
using System.Collections;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
2001-11-18 00:27:36 +03:00
|
|
|
using Silverstone.Manticore.App;
|
|
|
|
using Silverstone.Manticore.Core;
|
2001-08-01 07:48:08 +04:00
|
|
|
using Silverstone.Manticore.Toolkit;
|
2001-11-18 00:27:36 +03:00
|
|
|
using Silverstone.Manticore.Bookmarks;
|
2001-11-18 07:50:25 +03:00
|
|
|
using Silverstone.Manticore.Browser;
|
2001-08-01 07:48:08 +04:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Summary description for BookmarksWindow.
|
|
|
|
/// </summary>
|
|
|
|
public class BookmarksWindow : ManticoreWindow
|
|
|
|
{
|
2001-11-18 11:44:46 +03:00
|
|
|
private StatusBar mStatusBar;
|
|
|
|
private StatusBarPanel mStatusBarPanel;
|
2001-11-18 00:27:36 +03:00
|
|
|
private BookmarksTreeView mBookmarksTree;
|
2001-08-01 07:48:08 +04:00
|
|
|
|
|
|
|
private BaseTreeBuilder mBuilder = null;
|
|
|
|
|
|
|
|
public BookmarksWindow()
|
|
|
|
{
|
2001-11-18 07:50:25 +03:00
|
|
|
mType = "BookmarksWindow";
|
|
|
|
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void Init()
|
|
|
|
{
|
|
|
|
// Set up UI
|
|
|
|
InitializeComponent();
|
2001-08-01 07:48:08 +04:00
|
|
|
|
2001-11-18 11:44:46 +03:00
|
|
|
base.Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
#region Windows Form Designer generated code
|
|
|
|
/// <summary>
|
|
|
|
/// Required method for Designer support - do not modify
|
|
|
|
/// the contents of this method with the code editor.
|
|
|
|
/// </summary>
|
|
|
|
private void InitializeComponent()
|
|
|
|
{
|
|
|
|
mStatusBar = new StatusBar();
|
|
|
|
mStatusBarPanel = new StatusBarPanel();
|
|
|
|
((ISupportInitialize)mStatusBarPanel).BeginInit();
|
|
|
|
SuspendLayout();
|
|
|
|
|
|
|
|
mStatusBar.Name = "statusBar";
|
|
|
|
mStatusBar.Panels.Add(mStatusBarPanel);
|
|
|
|
mStatusBar.TabIndex = 0;
|
|
|
|
mStatusBar.Text = "";
|
|
|
|
mStatusBarPanel.Text = "";
|
|
|
|
Controls.Add(mStatusBar);
|
|
|
|
|
2001-11-18 00:27:36 +03:00
|
|
|
mBookmarksTree = new BookmarksTreeView("BookmarksRoot");
|
2001-11-18 11:44:46 +03:00
|
|
|
mBookmarksTree.Dock = DockStyle.Fill;
|
2001-11-18 00:27:36 +03:00
|
|
|
mBookmarksTree.ImageIndex = -1;
|
|
|
|
mBookmarksTree.Name = "bookmarksTree";
|
|
|
|
mBookmarksTree.SelectedImageIndex = -1;
|
|
|
|
mBookmarksTree.Size = new System.Drawing.Size(584, 409);
|
|
|
|
mBookmarksTree.TabIndex = 1;
|
2001-08-01 07:48:08 +04:00
|
|
|
|
2001-11-18 00:27:36 +03:00
|
|
|
mBookmarksTree.AfterSelect += new TreeViewEventHandler(OnTreeAfterSelect);
|
|
|
|
mBookmarksTree.DoubleClick += new EventHandler(OnTreeDoubleClick);
|
|
|
|
|
|
|
|
Controls.Add(mBookmarksTree);
|
|
|
|
mBookmarksTree.Build();
|
2001-08-01 07:48:08 +04:00
|
|
|
|
2001-11-18 11:44:46 +03:00
|
|
|
|
|
|
|
AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
|
|
|
ClientSize = new System.Drawing.Size(584, 429);
|
|
|
|
Name = "BookmarksWindow";
|
|
|
|
Text = Environment.UserName + "'s Bookmarks";
|
|
|
|
((ISupportInitialize)(mStatusBarPanel)).EndInit();
|
|
|
|
ResumeLayout(false);
|
2001-08-01 07:48:08 +04:00
|
|
|
}
|
|
|
|
#endregion
|
2001-11-18 00:27:36 +03:00
|
|
|
|
|
|
|
protected void OnTreeAfterSelect(Object sender, TreeViewEventArgs e)
|
|
|
|
{
|
|
|
|
ManticoreTreeNode node = e.Node as ManticoreTreeNode;
|
|
|
|
Bookmarks bmks = ServiceManager.Bookmarks;
|
|
|
|
String bookmarkURL = bmks.GetBookmarkAttribute(node.Data as String, "url");
|
2001-11-18 11:44:46 +03:00
|
|
|
mStatusBar.Text = bookmarkURL;
|
2001-11-18 00:27:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
protected void OnTreeDoubleClick(Object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
ManticoreTreeNode node = mBookmarksTree.SelectedNode as ManticoreTreeNode;
|
|
|
|
Bookmarks bmks = ServiceManager.Bookmarks;
|
|
|
|
String bookmarkURL = bmks.GetBookmarkAttribute(node.Data as String, "url");
|
2001-11-18 07:50:25 +03:00
|
|
|
if (bookmarkURL != "")
|
|
|
|
{
|
|
|
|
WindowMediator wm = ServiceManager.WindowMediator;
|
|
|
|
BrowserWindow window = wm.GetMostRecentWindow("BrowserWindow") as BrowserWindow;
|
|
|
|
if (window != null)
|
|
|
|
window.LoadURL(bookmarkURL);
|
|
|
|
}
|
2001-11-18 00:27:36 +03:00
|
|
|
}
|
|
|
|
|
2001-08-01 07:48:08 +04:00
|
|
|
}
|
|
|
|
}
|