OSDN Git Service

検索タブでのFav操作でデータ不整合が発生する問題を修正
authorkiri_feather <kiri_feather@users.sourceforge.jp>
Fri, 5 Feb 2010 11:09:51 +0000 (11:09 +0000)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:10:55 +0000 (23:10 +0900)
1秒ごとにネットワークの死活チェックをしていたバグ修正
リスト再描画時に選択中ポストが既読にならないための対策を中止(戻し)
フォロワーリスト取得後の洗い替えの呼び出し位置を変更
ハッシュタグの数字のみチェックを外し

git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@84 e39ad16e-3079-482e-bb30-4b4d378143b6

Tween/AtIdSupplement.resx
Tween/StatusDictionary.vb
Tween/Tween.resx
Tween/Tween.vb
Tween/Twitter.vb

index 308015e..d5495e3 100644 (file)
   <data name="TextId.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
     <value>Fill</value>
   </data>
+  <data name="TextId.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
+    <value>Disable</value>
+  </data>
   <data name="TextId.Location" type="System.Drawing.Point, System.Drawing">
     <value>0, 0</value>
   </data>
index 477041a..1e4f7cb 100644 (file)
@@ -535,9 +535,9 @@ Public NotInheritable Class TabInformations
                         End If
                     Next
                 End If
-            Else
-                'TabType=PublicSearchの場合(Postの保存先がTabClass内)
-                If Not tab.Contains(Id) Then Exit Sub
+            End If
+            'TabType=PublicSearchの場合(Postの保存先がTabClass内)
+            If tab.Contains(Id) AndAlso tab.TabType = TabUsageType.PublicSearch Then
                 post = tab.Posts(Id)
                 If tab.UnreadManage AndAlso Not post.IsRead Then    '未読管理
                     SyncLock LockUnread
@@ -990,6 +990,7 @@ Public NotInheritable Class TabInformations
 
     Public ReadOnly Property Item(ByVal TabName As String, ByVal Index As Integer) As PostClass
         Get
+            If Not _tabs.ContainsKey(TabName) Then Return Nothing
             If _tabs(TabName).TabType = TabUsageType.PublicSearch Then
                 Return _tabs(TabName).Posts(_tabs(TabName).GetId(Index))
             Else
index cc67be4..46afef1 100644 (file)
     <value>StatusLabel</value>
   </data>
   <data name="&gt;&gt;StatusLabel.Type" xml:space="preserve">
-    <value>Tween.TweenCustomControl.ToolStripLabelHistory, Tween, Version=0.8.3685.16120, Culture=neutral, PublicKeyToken=null</value>
+    <value>Tween.TweenCustomControl.ToolStripLabelHistory, Tween, Version=0.8.3687.16027, Culture=neutral, PublicKeyToken=null</value>
   </data>
   <data name="&gt;&gt;HashStripSplitButton.Name" xml:space="preserve">
     <value>HashStripSplitButton</value>
index e7d77f3..cfc9c99 100644 (file)
@@ -1243,8 +1243,6 @@ Public Class TweenMain
         If _dmCounter > 0 Then _dmCounter -= 1
         If _pubSearchCounter > 0 Then _pubSearchCounter -= 1
 
-        If Not IsNetworkAvailable() Then Exit Sub
-
         If _homeCounter <= 0 AndAlso SettingDialog.TimelinePeriodInt > 0 Then
             GetTimeline(WORKERTYPE.Timeline, 1, 0, "")
         End If
@@ -1489,7 +1487,7 @@ Public Class TweenMain
         'If _curList.SelectedIndices.Count = 0 Then Exit Sub
 
         _curItemIndex = _curList.SelectedIndices(0)
-        If _curPost Is GetCurTabPost(_curItemIndex) Then Exit Sub 'refreshで既読化されるのを防ぐため追加
+        'If _curPost Is GetCurTabPost(_curItemIndex) Then Exit Sub 'refreshで既読化されるのを防ぐため追加
         _curPost = GetCurTabPost(_curItemIndex)
         If SettingDialog.UnreadManage Then _statuses.SetRead(True, _curTab.Text, _curItemIndex)
         'MyList.RedrawItems(MyList.SelectedIndices(0), MyList.SelectedIndices(0), False)   'RetrieveVirtualItemが発生することを期待
@@ -1853,7 +1851,14 @@ Public Class TweenMain
                             args.sIds.Add(post.Id)
                             post.IsFav = True    'リスト再描画必要
                             _favTimestamps.Add(Now)
-                            _statuses.GetTabByType(TabUsageType.Favorites).Add(post.Id, post.IsRead, False)
+                            If post.SearchTabName = "" Then
+                                '検索タブからのfavは、favタブへ追加せず
+                                _statuses.GetTabByType(TabUsageType.Favorites).Add(post.Id, post.IsRead, False)
+                            End If
+                            '検索タブに反映
+                            For Each tb As TabClass In _statuses.GetTabsByType(TabUsageType.PublicSearch)
+                                If tb.Contains(post.Id) Then tb.Posts(post.Id).IsFav = True
+                            Next
                         End If
                     End If
                 Next
@@ -1873,6 +1878,10 @@ Public Class TweenMain
                         If ret.Length = 0 Then
                             args.sIds.Add(post.Id)
                             post.IsFav = False    'リスト再描画必要
+                            '検索タブに反映
+                            For Each tb As TabClass In _statuses.GetTabsByType(TabUsageType.PublicSearch)
+                                If tb.Contains(post.Id) Then tb.Posts(post.Id).IsFav = False
+                            Next
                         End If
                     End If
                 Next
@@ -1896,10 +1905,8 @@ Public Class TweenMain
                 bw.ReportProgress(50, My.Resources.UpdateFollowersMenuItem1_ClickText1)
                 If SettingDialog.UseAPI Then
                     ret = Twitter.GetFollowersApi()
-                    Twitter.RefreshOwlApi()
                 Else
                     ret = Twitter.GetFollowers(False)       ' Followersリストキャッシュ有効
-                    Twitter.RefreshOwl()    '洗い換え
                 End If
             Case WORKERTYPE.OpenUri
                 Dim myPath As String = Convert.ToString(args.status)
@@ -2940,16 +2947,16 @@ Public Class TweenMain
 
     Private Sub AddNewTabForSearch(ByVal searchWord As String)
         Dim tabName As String = searchWord
-        For i As Integer = 0 To 10
+        For i As Integer = 0 To 100
             If _statuses.ContainsTab(tabName) Then
                 tabName += "_"
             Else
                 Exit For
             End If
         Next
-        _statuses.AddTab(tabName, TabUsageType.PublicSearch)
-        _statuses.Tabs(tabName).SearchWords = searchWord
         AddNewTab(tabName, False, TabUsageType.PublicSearch)
+        _statuses.AddTab(tabName, TabUsageType.PublicSearch)
+        DirectCast(ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch"), ComboBox).Text = searchWord
         SaveConfigsTabs()
         ListTab.SelectedIndex = ListTab.TabPages.Count - 1
         Me.SearchButton_Click(ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch"), Nothing)
@@ -3900,7 +3907,7 @@ RETRY:
             If idx > -1 Then
                 ListTab.SelectedIndex = i
                 lst = DirectCast(ListTab.TabPages(i).Tag, DetailsListView)
-                _curTab = ListTab.TabPages(i)
+                '_curTab = ListTab.TabPages(i)
                 Exit For
             End If
         Next
@@ -3912,7 +3919,7 @@ RETRY:
                 If idx > -1 Then
                     ListTab.SelectedIndex = i
                     lst = DirectCast(ListTab.TabPages(i).Tag, DetailsListView)
-                    _curTab = ListTab.TabPages(i)
+                    '_curTab = ListTab.TabPages(i)
                     Exit For
                 End If
             Next
@@ -3922,7 +3929,7 @@ RETRY:
         If idx = -1 Then
             ListTab.SelectedIndex = 0
             lst = DirectCast(ListTab.TabPages(0).Tag, DetailsListView)
-            _curTab = ListTab.TabPages(0)
+            '_curTab = ListTab.TabPages(0)
             If _statuses.SortOrder = SortOrder.Ascending Then
                 idx = lst.VirtualListSize - 1
             Else
@@ -3942,11 +3949,6 @@ RETRY:
             Else
                 lst.EnsureVisible(idx)
             End If
-            If SettingDialog.UnreadManage Then _statuses.SetRead(True, _curTab.Text, idx)
-            ChangeCacheStyleRead(True, idx, _curTab)   '既読へ(フォント、文字色)
-            ColorizeList()
-            TimerColorize.Stop()
-            TimerColorize.Start()
         End If
         lst.Focus()
     End Sub
@@ -4261,7 +4263,7 @@ RETRY:
             End If
         End If
         _anchorFlag = False
-        If (e.Control OrElse My.Computer.Keyboard.CtrlKeyDown) AndAlso Not e.Alt AndAlso Not e.Shift Then
+        If e.Control AndAlso Not e.Alt AndAlso Not e.Shift Then
             ' CTRLキーが押されている場合
             If e.KeyCode = Keys.Home OrElse e.KeyCode = Keys.End Then
                 TimerColorize.Stop()
@@ -4381,7 +4383,7 @@ RETRY:
             If idx < 0 Then idx = ListTab.TabPages.Count - 1
         End If
         ListTab.SelectedIndex = idx
-        'ListTabSelect(ListTab.TabPages(idx))
+        ListTabSelect(ListTab.TabPages(idx))
     End Sub
 
     Private Sub CopyStot()
@@ -5660,6 +5662,7 @@ RETRY:
                 SaveConfigsTabs()
                 If tabUsage = TabUsageType.PublicSearch Then
                     ListTab.SelectedIndex = ListTab.TabPages.Count - 1
+                    ListTabSelect(ListTab.TabPages(ListTab.TabPages.Count - 1))
                     ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch").Focus()
                 End If
             End If
index 5035067..2b01d47 100644 (file)
@@ -2513,20 +2513,22 @@ Public Module Twitter
                     Next
                 End SyncLock
                 If Not _endingFlag AndAlso follower.Count > 1 Then UpdateCache()
-                Return "Can't get followers. Use cache."
+                ret = "Can't get followers. Use cache."
             Else
                 ' エラーが発生しているならFollowersリストクリア
                 SyncLock LockObj
                     follower.Clear()
                     follower.Add(_uid.ToLower())
                 End SyncLock
-                Return "Can't get followers."
+                ret = "Can't get followers."
             End If
+        Else
+            SyncLock LockObj
+                follower = tmpFollower
+            End SyncLock
+            ret = ""
         End If
 
-        SyncLock LockObj
-            follower = tmpFollower
-        End SyncLock
         If Not _endingFlag AndAlso follower.Count > 1 Then UpdateCache()
 
 #If DEBUG Then
@@ -2534,18 +2536,19 @@ Public Module Twitter
         'Console.WriteLine(sw.ElapsedMilliseconds)
 #End If
 
-        Return ""
+        TabInformations.GetInstance.RefreshOwl(follower)
+        Return ret
     End Function
 
 #End Region
 
-    Public Sub RefreshOwl()
-        TabInformations.GetInstance.RefreshOwl(follower)
-    End Sub
+    'Public Sub RefreshOwl()
+    '    TabInformations.GetInstance.RefreshOwl(follower)
+    'End Sub
 
-    Public Sub RefreshOwlApi()
-        TabInformations.GetInstance.RefreshOwl(followerId)
-    End Sub
+    'Public Sub RefreshOwlApi()
+    '    TabInformations.GetInstance.RefreshOwl(followerId)
+    'End Sub
 
     Public Property Username() As String
         Get
@@ -3732,15 +3735,20 @@ Public Module Twitter
     Public Function GetFollowersApi() As String
         If _endingFlag Then Return ""
         Dim page As Long = -1
+        Dim tmpFollower As New List(Of Long)(followerId)
 
         followerId.Clear()
-
         Do
             Dim ret As String = FollowerApi(page)
-            If ret <> "" Then Return ret
+            If ret <> "" Then
+                followerId.Clear()
+                followerId.AddRange(tmpFollower)
+                Return ret
+            End If
         Loop While page > 0
 
-        RefreshOwlApi()
+        TabInformations.GetInstance.RefreshOwl(followerId)
+
         Return ""
     End Function
 
@@ -3826,7 +3834,7 @@ Public Module Twitter
         'Dim rgh As New Regex("(^|[ .!,\-:;<>?])#([^] !""#$%&'()*+,.:;<=>?@\-[\^`{|}~\r\n]+)")
         Dim rgh As New Regex("(^|[^a-zA-Z0-9_/])[##]([a-zA-Z0-9_]+)")
         Dim mh As Match = rgh.Match(retStr)
-        If mh.Success AndAlso Not IsNumeric(mh.Result("$2")) Then
+        If mh.Success Then
             retStr = rgh.Replace(retStr, "$1<a href=""" + _protocol + "twitter.com/search?q=%23$2"">#$2</a>")
         End If
         While mh.Success