FItem : TBoard;
FURL : string;
FTitle : string;
+ function GetItem : TBoard;
public
constructor Create( inURL : string; inTitle : string = ''; inItem : TBoard = nil );
- property Item : TBoard read FItem write FItem;
+ constructor CreateWithItem( inItem : TBoard );
+ property Item : TBoard read GetItem write FItem;
property URL : string read FURL write FURL; // Item \82ª\8eæ\93¾\82Å\82«\82È\82\82Ä\82à URL \82Í\8fí\82É\95Û\8e\9d\82³\82ê\82é
property Title : string read FTitle write FTitle;
end;
FItem : TThreadItem;
FURL : string;
FTitle : string;
+ function GetItem : TThreadItem;
public
constructor Create( inURL : string; inTitle : string = ''; inItem : TThreadItem = nil );
- property Item : TThreadItem read FItem write FItem;
+ constructor CreateWithItem( inItem : TThreadItem );
+ property Item : TThreadItem read GetItem write FItem;
property URL : string read FURL write FURL; // Item \82ª\8eæ\93¾\82Å\82«\82È\82\82Ä\82à URL \82Í\8fí\82É\95Û\8e\9d\82³\82ê\82é
property Title : string read FTitle write FTitle;
end;
end;
+constructor TFavoriteBoardItem.CreateWithItem(
+ inItem : TBoard
+);
+begin
+
+ Create( inItem.URL, inItem.Title, inItem );
+
+end;
+
+function TFavoriteBoardItem.GetItem : TBoard;
+begin
+
+ if FItem = nil then begin
+ FItem := BBSsFindBoardFromURL( URL );
+ // \8b\8c\8e®\82Ì\82¨\8bC\82É\93ü\82è\82Æ\82Ì\8cÝ\8a·\90«\82Ì\82½\82ß
+ if FItem = nil then
+ // \81¦\8dì\82Á\82Ä\82à\81A\92Ç\89Á\82·\82é\83J\83e\83S\83\8a\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82\95Û\97¯
+ FItem := TBoard.Create( nil, URL );
+ end;
+
+ Result := FItem;
+
+end;
+
constructor TFavoriteThreadItem.Create(
inURL : string;
inTitle : string = '';
end;
+constructor TFavoriteThreadItem.CreateWithItem(
+ inItem : TThreadItem
+);
+begin
+
+ Create( inItem.URL, inItem.Title, inItem );
+
+end;
+
+function TFavoriteThreadItem.GetItem : TThreadItem;
+var
+ threadItem : TThreadItem;
+ board : TBoard;
+ boardURL : string;
+ i : Integer;
+begin
+
+ if FItem = nil then begin
+ boardURL := GikoSys.GetThreadURL2BoardURL( URL );
+ board := BBSsFindBoardFromURL( boardURL );
+
+ if board = nil then
+ // \81¦\8dì\82Á\82Ä\82à\81A\92Ç\89Á\82·\82é\83J\83e\83S\83\8a\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82\95Û\97¯
+ board := TBoard.Create( nil, boardURL )
+ else
+ FItem := board.FindThreadFromURL( URL );
+
+ if FItem = nil then begin
+ FItem := TThreadItem.Create( board.BoardPlugIn, URL );
+
+ FItem.Title := Title;
+ board.Add( FItem );
+ end;
+ end;
+
+ Result := FItem;
+
+end;
+
procedure TFavoriteDM.DataModuleCreate(Sender: TObject);
begin
//FTreeView := TreeView;
ParentNode := FStack.Peek;
if TObject(ParentNode.Data) is TFavoriteFolder then begin
if Node.Attributes['favtype'] = 'board' then begin
- board := BBSsFindBoardFromURL( Node.Attributes[ 'url' ] );
// \8b\8c\8e®\82Ì\82¨\8bC\82É\93ü\82è\82Æ\82Ì\8cÝ\8a·\90«\82Ì\82½\82ß
- if board = nil then begin
- if Node.Attributes[ 'url' ] = '' then begin
- board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] );
- if board = nil then
- Exit;
- end else begin
- // \81¦\8dì\82Á\82Ä\82à\81A\92Ç\89Á\82·\82é\83J\83e\83S\83\8a\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82\95Û\97¯
- board := TBoard.Create( nil, Node.Attributes[ 'url' ] );
- end;
+ if Length( Node.Attributes[ 'bbs' ] ) > 0 then begin
+ board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] );
+ FavBoard := TFavoriteBoardItem.Create(
+ board.URL, Node.Attributes[ 'title' ], board );
+ end else begin
+ FavBoard := TFavoriteBoardItem.Create(
+ Node.Attributes[ 'url' ], Node.Attributes[ 'title' ], board );
end;
- FavBoard := TFavoriteBoardItem.Create( board.URL, Node.Attributes['title'], board );
CurrentNode := FTreeView.Items.AddChildObject(ParentNode, Node.Attributes['title'], FavBoard);
CurrentNode.ImageIndex := 15;
CurrentNode.SelectedIndex := 15;
end else if Node.Attributes['favtype'] = 'thread' then begin
- url := Node.Attributes[ 'url' ];
- threadItem := BBSsFindThreadFromURL( url );
// \8b\8c\8e®\82Ì\82¨\8bC\82É\93ü\82è\82Æ\82Ì\8cÝ\8a·\90«\82Ì\82½\82ß
- if threadItem = nil then begin
- if Node.Attributes[ 'url' ] = '' then begin
- board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] );
- if board = nil then
- Exit;
- if not board.IsThreadDatRead then
- GikoSys.ReadSubjectFile( board );
- threadItem := board.Find( Node.Attributes[ 'thread' ] );
- if threadItem = nil then begin
- threadItem := TThreadItem.Create(
- board.BoardPlugIn,
- GikoSys.Get2chBoard2ThreadURL( board, ChangeFileExt( Node.Attributes[ 'thread' ], '' ) ) );
- threadItem.Title := Node.Attributes[ 'title' ];
- board.Add( threadItem );
- end;
- end else begin
- board := BBSsFindBoardFromURL( GikoSys.Get2chThreadURL2BoardURL( url ) );
-
- //===== \83v\83\89\83O\83C\83\93
- try
- jBound := Length( BoardPlugIns ) - 1;
- for j := 0 to jBound do begin
- if Assigned( Pointer( BoardPlugIns[ j ].Module ) ) then begin
- if BoardPlugIns[ j ].AcceptURL( url ) = atThread then begin
- threadItem := TThreadItem.Create( BoardPlugIns[ j ], url );
-
- Break;
- end;
- end;
- end;
- except
- // exception \82ª\94\90¶\82µ\82½\8fê\8d\87\82Í\93à\95\94\8f\88\97\9d\82É\94C\82¹\82½\82¢\82Ì\82Å\82±\82±\82Å\82Í\89½\82à\82µ\82È\82¢
- end;
-
- //===== \93à\95\94
- if board = nil then
- // \81¦\8dì\82Á\82Ä\82à\81A\92Ç\89Á\82·\82é\83J\83e\83S\83\8a\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82\95Û\97¯
- board := TBoard.Create( nil, Node.Attributes[ 'url' ] );
-
- if threadItem = nil then
- threadItem := TThreadItem.Create( nil, url );
-
+ if Length( Node.Attributes[ 'bbs' ] ) > 0 then begin
+ board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] );
+ if board = nil then
+ Exit;
+
+ if not board.IsThreadDatRead then
+ GikoSys.ReadSubjectFile( board );
+ threadItem := board.Find( Node.Attributes[ 'thread' ] );
+ if threadItem = nil then begin
+ threadItem := TThreadItem.Create(
+ board.BoardPlugIn,
+ GikoSys.Get2chBoard2ThreadURL( board, ChangeFileExt( Node.Attributes[ 'thread' ], '' ) ) );
threadItem.Title := Node.Attributes[ 'title' ];
board.Add( threadItem );
end;
+ FavThread := TFavoriteThreadItem.Create(
+ threadItem.URL, Node.Attributes[ 'title' ], threadItem );
+ end else begin
+ FavThread := TFavoriteThreadItem.Create(
+ Node.Attributes[ 'url' ], Node.Attributes[ 'title' ], threadItem );
end;
- FavThread := TFavoriteThreadItem.Create( threadItem.URL, Node.Attributes['title'], threadItem );
CurrentNode := FTreeView.Items.AddChildObject(ParentNode, Node.Attributes['title'], FavThread);
CurrentNode.ImageIndex := 16;
CurrentNode.SelectedIndex := 16;
for i := 0 to Node.Count - 1 do begin
if TObject(Node.Item[i].Data) is TFavoriteFolder then begin
if Node.Item[ i ].Expanded then
- s := Format('<folder title="%s" expanded="true">', [HttpEncode(Node.Item[i].Text)])
+ s := Format('<folder title="%s" expanded="true">', [HtmlEncode(Node.Item[i].Text)])
else
- s := Format('<folder title="%s" expanded="false">', [HttpEncode(Node.Item[i].Text)]);
+ s := Format('<folder title="%s" expanded="false">', [HtmlEncode(Node.Item[i].Text)]);
SaveList.Add(s);
AddSaveString(Node.Item[i], SaveList);
SaveList.Add('</folder>');
end else if TObject(Node.Item[i].Data) is TFavoriteBoardItem then begin
FavBoard := TFavoriteBoardItem(Node.Item[i].Data);
s := Format('<favitem type="2ch" favtype="board" url="%s" title="%s"/>',
- [HttpEncode( FavBoard.URL ), HttpEncode(FavBoard.Title)]);
+ [HtmlEncode( FavBoard.URL ), HtmlEncode(Node.Item[ i ].Text)]);
SaveList.Add(s);
end else if TObject(Node.Item[i].Data) is TFavoriteThreadItem then begin
FavThread := TFavoriteThreadItem(Node.Item[i].Data);
s := Format('<favitem type="2ch" favtype="thread" url="%s" title="%s"/>',
- [HttpEncode( FavThread.URL ), HttpEncode(FavThread.Title)]);
+ [HtmlEncode( FavThread.URL ), HtmlEncode(Node.Item[ i ].Text)]);
SaveList.Add(s);
end;
end;