| 12 |
TFavoriteFolder = class |
TFavoriteFolder = class |
| 13 |
end; |
end; |
| 14 |
|
|
| 15 |
TFavoriteBoardItem = class |
TFavoriteItem = class(TObject) |
| 16 |
private |
private |
|
FItem : TBoard; |
|
| 17 |
FURL : string; |
FURL : string; |
| 18 |
FTitle : string; |
FTitle : string; |
| 19 |
|
public |
| 20 |
|
function GetItemTitle : string; virtual;abstract; |
| 21 |
|
property URL : string read FURL write FURL; // Item が取得できなくても URL は常に保持される |
| 22 |
|
property Title : string read FTitle write FTitle; |
| 23 |
|
end; |
| 24 |
|
TFavoriteBoardItem = class(TFavoriteItem) |
| 25 |
|
private |
| 26 |
|
FItem : TBoard; |
| 27 |
function GetItem : TBoard; |
function GetItem : TBoard; |
| 28 |
public |
public |
| 29 |
constructor Create( inURL : string; inTitle : string = ''; inItem : TBoard = nil ); |
constructor Create( inURL : string; inTitle : string = ''; inItem : TBoard = nil ); |
| 30 |
constructor CreateWithItem( inItem : TBoard ); |
constructor CreateWithItem( inItem : TBoard ); |
| 31 |
destructor Destory; |
destructor Destory; |
| 32 |
|
function GetItemTitle : string; override; |
| 33 |
property Item : TBoard read GetItem write FItem; |
property Item : TBoard read GetItem write FItem; |
|
property URL : string read FURL write FURL; // Item が取得できなくても URL は常に保持される |
|
|
property Title : string read FTitle write FTitle; |
|
| 34 |
end; |
end; |
| 35 |
|
|
| 36 |
TFavoriteThreadItem = class |
TFavoriteThreadItem = class(TFavoriteItem) |
| 37 |
private |
private |
| 38 |
FItem : TThreadItem; |
FItem : TThreadItem; |
|
FURL : string; |
|
|
FTitle : string; |
|
| 39 |
function GetItem : TThreadItem; |
function GetItem : TThreadItem; |
| 40 |
public |
public |
| 41 |
constructor Create( inURL : string; inTitle : string = ''; inItem : TThreadItem = nil ); |
constructor Create( inURL : string; inTitle : string = ''; inItem : TThreadItem = nil ); |
| 42 |
constructor CreateWithItem( inItem : TThreadItem ); |
constructor CreateWithItem( inItem : TThreadItem ); |
| 43 |
destructor Destory; |
destructor Destory; |
| 44 |
|
function GetItemTitle : string; override; |
| 45 |
property Item : TThreadItem read GetItem write FItem; |
property Item : TThreadItem read GetItem write FItem; |
|
property URL : string read FURL write FURL; // Item が取得できなくても URL は常に保持される |
|
|
property Title : string read FTitle write FTitle; |
|
| 46 |
end; |
end; |
| 47 |
|
|
| 48 |
TFavoriteDM = class(TDataModule) |
TFavoriteDM = class(TDataModule) |
| 116 |
FItem.Free; |
FItem.Free; |
| 117 |
inherited; |
inherited; |
| 118 |
end; |
end; |
| 119 |
|
//! 保持している板のタイトルを返す |
| 120 |
|
function TFavoriteBoardItem.GetItemTitle : string; |
| 121 |
|
begin |
| 122 |
|
Result := ''; |
| 123 |
|
//一度も板を開いていないとき(起動時にキャビネットをお気に入りとか) |
| 124 |
|
//のときにFItemがnilなのでそのときはべっと検索 |
| 125 |
|
if FItem = nil then begin |
| 126 |
|
FItem := BBSsFindBoardFromURL(URL); |
| 127 |
|
end; |
| 128 |
|
if FItem <> nil then begin |
| 129 |
|
try |
| 130 |
|
if not FItem.IsThreadDatRead then begin |
| 131 |
|
GikoSys.ReadSubjectFile(FItem); |
| 132 |
|
end; |
| 133 |
|
except |
| 134 |
|
end; |
| 135 |
|
Result := FItem.Title; |
| 136 |
|
end; |
| 137 |
|
end; |
| 138 |
function TFavoriteBoardItem.GetItem : TBoard; |
function TFavoriteBoardItem.GetItem : TBoard; |
| 139 |
var |
var |
| 140 |
protocol, host, path, document, port, bookmark : string; |
protocol, host, path, document, port, bookmark : string; |
| 141 |
BBSID{, BBSKey} : string; |
BBSID : string; |
| 142 |
tmpURL{, boardURL} : string; |
tmpURL : string; |
|
// category : TCategory; |
|
|
{i, bi: Integer;} |
|
|
{tmpThread: TThreadItem;} |
|
|
{tmpBoard: TBoard;} |
|
| 143 |
begin |
begin |
| 144 |
|
|
| 145 |
if FItem = nil then begin |
if FItem = nil then begin |
| 194 |
FItem.Free; |
FItem.Free; |
| 195 |
inherited; |
inherited; |
| 196 |
end; |
end; |
| 197 |
|
//! 保持しているスレのタイトルを返す |
| 198 |
|
function TFavoriteThreadItem.GetItemTitle : string; |
| 199 |
|
begin |
| 200 |
|
Result := ''; |
| 201 |
|
if FItem = nil then begin |
| 202 |
|
FItem := BBSsFindThreadFromURL(URL); |
| 203 |
|
end; |
| 204 |
|
if FItem <> nil then begin |
| 205 |
|
Result := FItem.Title; |
| 206 |
|
end; |
| 207 |
|
end; |
| 208 |
|
|
| 209 |
function TFavoriteThreadItem.GetItem : TThreadItem; |
function TFavoriteThreadItem.GetItem : TThreadItem; |
| 210 |
var |
var |