OSDN Git Service

HAP削除用のCookieを受け付けないように修正
[gikonavigoeson/gikonavi.git] / Option.pas
index d9102d6..1274f05 100644 (file)
@@ -219,6 +219,12 @@ type
     gppRighBottomRB: TRadioButton;
     ResAnchorCheckBox: TCheckBox;
     IgnoreLimitResCountCheckBox: TCheckBox;
+    GroupBox25: TGroupBox;
+    Label25: TLabel;
+    BoukenComboBox: TComboBox;
+    BoukenModButton: TButton;
+    BoukenDelButton: TButton;
+    BoukenEdit: TEdit;
                procedure FormCreate(Sender: TObject);
                procedure FormDestroy(Sender: TObject);
                procedure ApplyButtonClick(Sender: TObject);
@@ -268,6 +274,9 @@ type
                 procedure ResRangeHoldCheckBoxClick(Sender: TObject);
                 procedure CroutOptionClick(Sender: TObject);
     procedure MaxRecordCountEditExit(Sender: TObject);
+    procedure BoukenDelButtonClick(Sender: TObject);
+    procedure BoukenComboBoxChange(Sender: TObject);
+    procedure BoukenModButtonClick(Sender: TObject);
        private
                { Private \90é\8c¾ }
                FClose: Boolean;
@@ -572,7 +581,8 @@ var
        Item: TListItem;
 //     s: string;
        idx: Integer;
-       FileList: TStringList;
+       FileList : TStringList;
+    DomainList : TStringList;
 begin
 
        //\93Ç\82Ý\8d\9e\82Ý\97p\83v\83\8d\83L\83V
@@ -723,7 +733,7 @@ begin
        Ord( grrAll ):  ResRangeHoldComboBox.ItemIndex := 0;
        Ord( grrKoko ): ResRangeHoldComboBox.ItemIndex := 2;
        Ord( grrNew ):  ResRangeHoldComboBox.ItemIndex := 3;
-       100:                                            ResRangeHoldComboBox.ItemIndex := 1;
+       10..65535:                                              ResRangeHoldComboBox.ItemIndex := 1;
        end;
        ResRangeHoldComboBox.Enabled := GikoSys.Setting.ResRangeHold;
        //\83^\83u\92Ç\89Á\88Ê\92u
@@ -876,7 +886,7 @@ begin
 
        //Be2ch\94F\8fØ
        BeUserIDEdit.Text := GikoSys.Setting.BeUserID;
-       BeCodeEdit.Text := GikoSys.Setting.BeCode;
+       BeCodeEdit.Text := GikoSys.Setting.BePassword;
        BeAutoLoginCheckBox.Checked := GikoSys.Setting.BeAutoLogin;
        //\97\9a\97ð\82Ì\8dÅ\91å\95Û\91\90\94
        MaxRecordCountEdit.Text := IntToStr(GikoSys.Setting.MaxRecordCount);
@@ -886,6 +896,18 @@ begin
     LoopBrowserTabsCB.Checked := GikoSys.Setting.LoopBrowserTabs;
     //
     IgnoreContextCheckBox.Checked := GikoSys.Setting.GestureIgnoreContext;
+
+    // \96`\8c¯\82Ì\8f\91\83h\83\81\83C\83\93\88ê\97\97\8eæ\93¾
+    BoukenComboBox.Text := '';
+    BoukenComboBox.Items.Clear;
+    DomainList := TStringList.Create;
+    GikoSys.GetBoukenDomain(DomainList);
+    for i := 0 to DomainList.Count - 1 do begin
+        BoukenComboBox.Items.Add( DomainList[i] ) ;
+    end;
+    DomainList.Free;
+    BoukenComboBox.ItemIndex := 0;
+    BoukenComboBox.OnChange(nil);
 end;
 
 procedure TOptionDialog.SaveSetting;
@@ -1013,7 +1035,7 @@ begin
        GikoSys.Setting.ResRangeHold := ResRangeHoldCheckBox.Checked;
        case ResRangeHoldComboBox.ItemIndex of
                0: GikoSys.Setting.ResRange := Ord( grrAll );
-               1: GikoSys.Setting.ResRange := 100;
+               1: GikoSys.Setting.ResRange := GikoSys.Setting.ResRangeExCount;
                2: GikoSys.Setting.ResRange := Ord( grrKoko );
                3: GikoSys.Setting.ResRange := Ord( grrNew );
        end;
@@ -1167,7 +1189,7 @@ begin
        GikoSys.Setting.UseUndecided := UseUndecidedCheckBox.Checked;
         //Be2ch
         GikoSys.Setting.BeUserID := BeUserIDEdit.Text;
-        GikoSys.Setting.BeCode := BeCodeEdit.Text;
+        GikoSys.Setting.BePassword := BeCodeEdit.Text;
                GikoSys.Setting.BeAutoLogin := BeAutoLoginCheckBox.Checked;
        //\97\9a\97ð\82Ì\8dÅ\91å\95Û\91\90\94
        GikoSys.Setting.MaxRecordCount := Max(StrToInt64Def(MaxRecordCountEdit.Text,100),1);
@@ -1175,6 +1197,7 @@ begin
     GikoSys.Setting.LoopBrowserTabs := LoopBrowserTabsCB.Checked;
 
     GikoSys.Setting.GestureIgnoreContext := IgnoreContextCheckBox.Checked;
+
 end;
 
 procedure TOptionDialog.SettingApply;
@@ -1321,17 +1344,29 @@ begin
        sndPlaySound(nil, SND_ASYNC);
        if OpenDialog.Execute then begin
                SoundFileEdit.Text := OpenDialog.FileName;
+        // \83A\83v\83\8a\94z\89º\82Ì\83t\83@\83C\83\8b\82Ì\8fê\8d\87\91\8a\91Î\83p\83X\82É\95Ï\8a·\82·\82é\81B
+        if (AnsiPos(GikoSys.Setting.GetAppDir,SoundFileEdit.Text) = 1) then begin
+            // .\ \82ª\82Â\82©\82È\82¢\82Ì\82Å\81A.\\82ð\92Ç\89Á
+            SoundFileEdit.Text := '.\' + ExtractRelativePath(
+                                      GikoSys.Setting.GetAppDir,
+                                      SoundFileEdit.Text);
+
+        end;
        end;
 end;
 
 procedure TOptionDialog.SoundPlayButtonClick(Sender: TObject);
+var
+    s : String;
 begin
-       if not FileExists(SoundFileEdit.Text) then begin
+    SetCurrentDir(GikoSys.Setting.GetAppDir);
+    s := ExpandFileName(SoundFileEdit.Text);
+       if not FileExists(s) then begin
                MsgBox(Handle, '\91\8dÝ\82µ\82È\82¢\83t\83@\83C\83\8b\82Å\82·', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
                SoundFileEdit.Text := '';
                Exit;
        end;
-       if not sndPlaySound(PChar(SoundFileEdit.Text), SND_ASYNC or SND_NOSTOP) then begin
+       if not sndPlaySound(PChar(s), SND_ASYNC or SND_NOSTOP) then begin
                sndPlaySound(nil, SND_ASYNC);
        end;
 end;
@@ -1351,7 +1386,8 @@ begin
        Item := SoundListView.Selected;
        if Item = nil then Exit;
 
-       if FileExists(SoundFileEdit.Text) then
+    SetCurrentDir(GikoSys.Setting.GetAppDir);
+       if FileExists(ExpandFileName(SoundFileEdit.Text)) then
                Item.SubItems[0] := SoundFileEdit.Text;
        if Trim(SoundFileEdit.Text) = '' then
                Item.SubItems[0] := '';
@@ -1685,5 +1721,58 @@ begin
         MaxRecordCountEdit.Text := '1';
 end;
 
+procedure TOptionDialog.BoukenDelButtonClick(Sender: TObject);
+begin
+    if ( BoukenComboBox.Items.IndexOf( BoukenComboBox.Text ) <> -1 ) then begin
+        if MsgBox(Self.Handle, BoukenComboBox.Text + ' \82ð\8dí\8f\9c\82µ\82Ü\82·\81B'#13#10 +
+            '\8dí\8f\9c\82·\82é\82Æ\95\9c\8c³\82Å\82«\82Ü\82¹\82ñ\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H', '\96`\8c¯\82Ì\8f\91\81@\83h\83\81\83C\83\93\8dí\8f\9c', MB_YESNO or MB_ICONQUESTION) = IDYES       then begin
+            GikoSys.DelBoukenCookie(BoukenComboBox.Text);
+            GikoSys.Setting.WriteBoukenSettingFile;
+            BoukenComboBox.Items.Delete(BoukenComboBox.ItemIndex);
+            if ( BoukenComboBox.Items.Count = 0 ) then begin
+                 BoukenComboBox.Text := '';
+            end;
+            BoukenComboBox.OnChange(nil);
+        end
+    end else begin
+        BoukenComboBox.Text := '';
+    end;
+end;
+
+procedure TOptionDialog.BoukenComboBoxChange(Sender: TObject);
+begin
+    BoukenEdit.Text := GikoSys.GetBoukenCookie('http://*' +BoukenComboBox.Text);
+end;
+
+procedure TOptionDialog.BoukenModButtonClick(Sender: TObject);
+var
+    DomainList : TStringList;
+    i : Integer;
+    s : String;
+begin
+    if ( Length(BoukenComboBox.Text) > 0 ) then begin
+        s := BoukenComboBox.Text;
+        GikoSys.SetBoukenCookie(BoukenEdit.Text, s);
+        GikoSys.Setting.WriteBoukenSettingFile;
+        // \96`\8c¯\82Ì\8f\91\83h\83\81\83C\83\93\88ê\97\97\8eæ\93¾
+        BoukenComboBox.Text := '';
+        BoukenComboBox.Items.Clear;
+        DomainList := TStringList.Create;
+        GikoSys.GetBoukenDomain(DomainList);
+        for i := 0 to DomainList.Count - 1 do begin
+            BoukenComboBox.Items.Add( DomainList[i] ) ;
+        end;
+        DomainList.Free;
+        BoukenComboBox.ItemIndex := 0;
+        for i := 0 to BoukenComboBox.Items.Count - 1 do begin
+            if ( BoukenComboBox.Items[i] = s) then begin
+                BoukenComboBox.ItemIndex := i;
+                Break;
+            end;
+        end;
+        BoukenComboBox.OnChange(nil);
+    end;
+end;
+
 end.