| 16 |
FItem : TBoard; |
FItem : TBoard; |
| 17 |
FURL : string; |
FURL : string; |
| 18 |
FTitle : string; |
FTitle : string; |
| 19 |
|
function GetItem : TBoard; |
| 20 |
public |
public |
| 21 |
constructor Create( inURL : string; inTitle : string = ''; inItem : TBoard = nil ); |
constructor Create( inURL : string; inTitle : string = ''; inItem : TBoard = nil ); |
| 22 |
property Item : TBoard read FItem write FItem; |
property Item : TBoard read GetItem write FItem; |
| 23 |
property URL : string read FURL write FURL; // Item が取得できなくても URL は常に保持される |
property URL : string read FURL write FURL; // Item が取得できなくても URL は常に保持される |
| 24 |
property Title : string read FTitle write FTitle; |
property Title : string read FTitle write FTitle; |
| 25 |
end; |
end; |
| 29 |
FItem : TThreadItem; |
FItem : TThreadItem; |
| 30 |
FURL : string; |
FURL : string; |
| 31 |
FTitle : string; |
FTitle : string; |
| 32 |
|
function GetItem : TThreadItem; |
| 33 |
public |
public |
| 34 |
constructor Create( inURL : string; inTitle : string = ''; inItem : TThreadItem = nil ); |
constructor Create( inURL : string; inTitle : string = ''; inItem : TThreadItem = nil ); |
| 35 |
property Item : TThreadItem read FItem write FItem; |
property Item : TThreadItem read GetItem write FItem; |
| 36 |
property URL : string read FURL write FURL; // Item が取得できなくても URL は常に保持される |
property URL : string read FURL write FURL; // Item が取得できなくても URL は常に保持される |
| 37 |
property Title : string read FTitle write FTitle; |
property Title : string read FTitle write FTitle; |
| 38 |
end; |
end; |
| 93 |
|
|
| 94 |
end; |
end; |
| 95 |
|
|
| 96 |
|
function TFavoriteBoardItem.GetItem : TBoard; |
| 97 |
|
begin |
| 98 |
|
|
| 99 |
|
if FItem = nil then begin |
| 100 |
|
FItem := BBSsFindBoardFromURL( URL ); |
| 101 |
|
// 旧式のお気に入りとの互換性のため |
| 102 |
|
if FItem = nil then |
| 103 |
|
// ※作っても、追加するカテゴリが無いので激しく保留 |
| 104 |
|
FItem := TBoard.Create( nil, URL ); |
| 105 |
|
end; |
| 106 |
|
|
| 107 |
|
Result := FItem; |
| 108 |
|
|
| 109 |
|
end; |
| 110 |
|
|
| 111 |
constructor TFavoriteThreadItem.Create( |
constructor TFavoriteThreadItem.Create( |
| 112 |
inURL : string; |
inURL : string; |
| 113 |
inTitle : string = ''; |
inTitle : string = ''; |
| 123 |
|
|
| 124 |
end; |
end; |
| 125 |
|
|
| 126 |
|
function TFavoriteThreadItem.GetItem : TThreadItem; |
| 127 |
|
var |
| 128 |
|
threadItem : TThreadItem; |
| 129 |
|
boardPlugIn : TBoardPlugIn; |
| 130 |
|
board : TBoard; |
| 131 |
|
boardURL : string; |
| 132 |
|
i : Integer; |
| 133 |
|
begin |
| 134 |
|
|
| 135 |
|
if FItem = nil then begin |
| 136 |
|
//===== プラグイン |
| 137 |
|
boardPlugIn := nil; |
| 138 |
|
try |
| 139 |
|
for i := Length( BoardPlugIns ) - 1 downto 0 do begin |
| 140 |
|
if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin |
| 141 |
|
if BoardPlugIns[ i ].AcceptURL( url ) = atThread then begin |
| 142 |
|
boardPlugIn := BoardPlugIns[ i ]; |
| 143 |
|
threadItem := TThreadItem.Create(boardPlugIn, URL ); |
| 144 |
|
boardURL := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) ); |
| 145 |
|
threadItem.Free; |
| 146 |
|
|
| 147 |
|
Break; |
| 148 |
|
end; |
| 149 |
|
end; |
| 150 |
|
end; |
| 151 |
|
except |
| 152 |
|
// exception が発生した場合は内部処理に任せたいのでここでは何もしない |
| 153 |
|
end; |
| 154 |
|
|
| 155 |
|
if Length( boardURL ) = 0 then |
| 156 |
|
boardURL := GikoSys.Get2chThreadURL2BoardURL( URL ); |
| 157 |
|
|
| 158 |
|
board := BBSsFindBoardFromURL( boardURL ); |
| 159 |
|
|
| 160 |
|
if board = nil then |
| 161 |
|
// ※作っても、追加するカテゴリが無いので激しく保留 |
| 162 |
|
board := TBoard.Create( nil, boardURL ) |
| 163 |
|
else |
| 164 |
|
FItem := board.FindThreadFromURL( URL ); |
| 165 |
|
|
| 166 |
|
if FItem = nil then |
| 167 |
|
FItem := TThreadItem.Create( boardPlugIn, URL ); |
| 168 |
|
|
| 169 |
|
FItem.Title := Title; |
| 170 |
|
board.Add( FItem ); |
| 171 |
|
end; |
| 172 |
|
|
| 173 |
|
Result := FItem; |
| 174 |
|
|
| 175 |
|
end; |
| 176 |
|
|
| 177 |
procedure TFavoriteDM.DataModuleCreate(Sender: TObject); |
procedure TFavoriteDM.DataModuleCreate(Sender: TObject); |
| 178 |
begin |
begin |
| 179 |
//FTreeView := TreeView; |
//FTreeView := TreeView; |
| 298 |
ParentNode := FStack.Peek; |
ParentNode := FStack.Peek; |
| 299 |
if TObject(ParentNode.Data) is TFavoriteFolder then begin |
if TObject(ParentNode.Data) is TFavoriteFolder then begin |
| 300 |
if Node.Attributes['favtype'] = 'board' then begin |
if Node.Attributes['favtype'] = 'board' then begin |
|
board := BBSsFindBoardFromURL( Node.Attributes[ 'url' ] ); |
|
| 301 |
// 旧式のお気に入りとの互換性のため |
// 旧式のお気に入りとの互換性のため |
| 302 |
if board = nil then begin |
if Length( Node.Attributes[ 'bbs' ] ) > 0 then begin |
| 303 |
if Node.Attributes[ 'url' ] = '' then begin |
board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] ); |
| 304 |
board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] ); |
FavBoard := TFavoriteBoardItem.Create( |
| 305 |
if board = nil then |
board.URL, Node.Attributes[ 'title' ], board ); |
| 306 |
Exit; |
end else begin |
| 307 |
end else begin |
FavBoard := TFavoriteBoardItem.Create( |
| 308 |
// ※作っても、追加するカテゴリが無いので激しく保留 |
Node.Attributes[ 'url' ], Node.Attributes[ 'title' ], board ); |
|
board := TBoard.Create( nil, Node.Attributes[ 'url' ] ); |
|
|
end; |
|
| 309 |
end; |
end; |
|
FavBoard := TFavoriteBoardItem.Create( board.URL, Node.Attributes['title'], board ); |
|
| 310 |
CurrentNode := FTreeView.Items.AddChildObject(ParentNode, Node.Attributes['title'], FavBoard); |
CurrentNode := FTreeView.Items.AddChildObject(ParentNode, Node.Attributes['title'], FavBoard); |
| 311 |
CurrentNode.ImageIndex := 15; |
CurrentNode.ImageIndex := 15; |
| 312 |
CurrentNode.SelectedIndex := 15; |
CurrentNode.SelectedIndex := 15; |
| 313 |
end else if Node.Attributes['favtype'] = 'thread' then begin |
end else if Node.Attributes['favtype'] = 'thread' then begin |
|
url := Node.Attributes[ 'url' ]; |
|
|
threadItem := BBSsFindThreadFromURL( url ); |
|
| 314 |
// 旧式のお気に入りとの互換性のため |
// 旧式のお気に入りとの互換性のため |
| 315 |
if threadItem = nil then begin |
if Length( Node.Attributes[ 'bbs' ] ) > 0 then begin |
| 316 |
if Node.Attributes[ 'url' ] = '' then begin |
board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] ); |
| 317 |
board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] ); |
if board = nil then |
| 318 |
if board = nil then |
Exit; |
| 319 |
Exit; |
|
| 320 |
if not board.IsThreadDatRead then |
if not board.IsThreadDatRead then |
| 321 |
GikoSys.ReadSubjectFile( board ); |
GikoSys.ReadSubjectFile( board ); |
| 322 |
threadItem := board.Find( Node.Attributes[ 'thread' ] ); |
threadItem := board.Find( Node.Attributes[ 'thread' ] ); |
| 323 |
if threadItem = nil then begin |
if threadItem = nil then begin |
| 324 |
threadItem := TThreadItem.Create( |
threadItem := TThreadItem.Create( |
| 325 |
board.BoardPlugIn, |
board.BoardPlugIn, |
| 326 |
GikoSys.Get2chBoard2ThreadURL( board, ChangeFileExt( Node.Attributes[ 'thread' ], '' ) ) ); |
GikoSys.Get2chBoard2ThreadURL( board, ChangeFileExt( Node.Attributes[ 'thread' ], '' ) ) ); |
|
threadItem.Title := Node.Attributes[ 'title' ]; |
|
|
board.Add( threadItem ); |
|
|
end; |
|
|
end else begin |
|
|
board := BBSsFindBoardFromURL( GikoSys.Get2chThreadURL2BoardURL( url ) ); |
|
|
|
|
|
//===== プラグイン |
|
|
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 が発生した場合は内部処理に任せたいのでここでは何もしない |
|
|
end; |
|
|
|
|
|
//===== 内部 |
|
|
if board = nil then |
|
|
// ※作っても、追加するカテゴリが無いので激しく保留 |
|
|
board := TBoard.Create( nil, Node.Attributes[ 'url' ] ); |
|
|
|
|
|
if threadItem = nil then |
|
|
threadItem := TThreadItem.Create( nil, url ); |
|
|
|
|
| 327 |
threadItem.Title := Node.Attributes[ 'title' ]; |
threadItem.Title := Node.Attributes[ 'title' ]; |
| 328 |
board.Add( threadItem ); |
board.Add( threadItem ); |
| 329 |
end; |
end; |
| 330 |
|
FavThread := TFavoriteThreadItem.Create( |
| 331 |
|
threadItem.URL, Node.Attributes[ 'title' ], threadItem ); |
| 332 |
|
end else begin |
| 333 |
|
FavThread := TFavoriteThreadItem.Create( |
| 334 |
|
Node.Attributes[ 'url' ], Node.Attributes[ 'title' ], threadItem ); |
| 335 |
end; |
end; |
|
FavThread := TFavoriteThreadItem.Create( threadItem.URL, Node.Attributes['title'], threadItem ); |
|
| 336 |
CurrentNode := FTreeView.Items.AddChildObject(ParentNode, Node.Attributes['title'], FavThread); |
CurrentNode := FTreeView.Items.AddChildObject(ParentNode, Node.Attributes['title'], FavThread); |
| 337 |
CurrentNode.ImageIndex := 16; |
CurrentNode.ImageIndex := 16; |
| 338 |
CurrentNode.SelectedIndex := 16; |
CurrentNode.SelectedIndex := 16; |