Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
mikeMoreno committed Feb 12, 2022
1 parent 2e360f8 commit 70a0bf1
Showing 3 changed files with 19 additions and 12 deletions.
9 changes: 9 additions & 0 deletions Waffle.Lib/LinkLine.cs
Original file line number Diff line number Diff line change
@@ -19,5 +19,14 @@ public override string GetLink()
{
return Raw;
}

public string GetUserFriendlyName()
{
var absoluteUrl = Raw;
absoluteUrl = absoluteUrl.Replace("gopher://", "");
absoluteUrl = absoluteUrl.TrimEnd('/');

return absoluteUrl;
}
}
}
15 changes: 4 additions & 11 deletions Waffle/Forms/BookmarkAdder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Waffle.Lib;

namespace Waffle.Forms
{
@@ -8,29 +9,21 @@ public partial class BookmarkAdder : Form

private List<BookmarkEntity> BookmarkEntities { get; }

public BookmarkAdder(string absoluteUrl)
public BookmarkAdder(LinkLine linkLine)
{
InitializeComponent();

absoluteUrl = absoluteUrl.Trim();

this.absoluteUrl = absoluteUrl;
this.absoluteUrl = linkLine.Raw;

txtName.Text = GetUserFriendlyName(absoluteUrl);
txtName.Text = linkLine.GetUserFriendlyName();

BookmarkEntities = LoadBookmarks();

PopulateBookmarkTree(BookmarkEntities);
}

private static string GetUserFriendlyName(string absoluteUrl)
{
absoluteUrl = absoluteUrl.Replace("gopher://", "");
absoluteUrl = absoluteUrl.TrimEnd('/');

return absoluteUrl;
}

private void PopulateBookmarkTree(List<BookmarkEntity> bookmarkEntities)
{
bookmarkTree.Nodes.Clear();
7 changes: 6 additions & 1 deletion Waffle/Forms/Main.cs
Original file line number Diff line number Diff line change
@@ -157,6 +157,8 @@ private async Task VisitSiteAsync(string absoluteUrl)

var selectedTab = tabSitePages.SelectedTab as RequestTab;

selectedTab.Text = linkLine.GetUserFriendlyName();

var pageRenderer = selectedTab.Controls.OfType<PageRenderer>().Single();

if (!pageRenderer.VisitedUrls.Any())
@@ -363,7 +365,10 @@ private void btnFavorite_Click(object sender, EventArgs e)
return;
}

using var favAdder = new BookmarkAdder(txtUrl.Text);
using var favAdder = new BookmarkAdder(new LinkLine(txtUrl.Text)
{

});

var ans = favAdder.ShowDialog();
}

0 comments on commit 70a0bf1

Please sign in to comment.