OSDN Git Service

検索タブからでも関連発言表示できるように
authorkiri_feather <kiri_feather@users.sourceforge.jp>
Mon, 27 Dec 2010 16:25:48 +0000 (16:25 +0000)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:18:01 +0000 (23:18 +0900)
関連発言タブでEscape押下により、確認なしでタブ削除&元のタブへ戻る
関連発言タブの新着通知をデフォルトオフに

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

Tween/FilterDialog.vb
Tween/StatusDictionary.vb
Tween/Tween.vb
Tween/Twitter.vb

index 459bbb6..f526345 100644 (file)
@@ -810,7 +810,7 @@ Public Class FilterDialog
         If ListTabs.SelectedIndex > -1 AndAlso ListTabs.SelectedItem.ToString <> "" Then
             Dim tb As String = ListTabs.SelectedItem.ToString
             Dim idx As Integer = ListTabs.SelectedIndex
-            If DirectCast(Me.Owner, TweenMain).RemoveSpecifiedTab(tb) Then
+            If DirectCast(Me.Owner, TweenMain).RemoveSpecifiedTab(tb, True) Then
                 ListTabs.Items.RemoveAt(idx)
                 idx -= 1
                 If idx < 0 Then idx = 0
index fec2129..0400fde 100644 (file)
@@ -1559,21 +1559,12 @@ End Class
 <Serializable()> _
 Public NotInheritable Class TabClass
     Private _unreadManage As Boolean = False
-    Private _notify As Boolean = False
-    Private _soundFile As String = ""
     Private _filters As List(Of FiltersClass)
-    Private _oldestUnreadItem As Long = -1     'ID
     Private _unreadCount As Integer = 0
     Private _ids As List(Of Long)
-    Private _filterMod As Boolean = False
     Private _tmpIds As New List(Of TemporaryId)
-    Private _tabName As String = ""
     Private _tabType As TabUsageType = TabUsageType.Undefined
-    Private _posts As New Dictionary(Of Long, PostClass)
     Private _sorter As New IdComparerClass
-    Private _oldestId As Long = Long.MaxValue   '古いポスト取得用
-    Private _sinceId As Long = 0
-    Private _relationTargetPost As PostClass = Nothing
 
     Private ReadOnly _lockObj As New Object
 
@@ -1644,55 +1635,25 @@ Public NotInheritable Class TabClass
 #End Region
 
     <Xml.Serialization.XmlIgnore()> _
+    Public Property BackToTab() As TabClass
+
+    <Xml.Serialization.XmlIgnore()> _
     Public Property RelationTargetPost() As PostClass
-        Get
-            Return _relationTargetPost
-        End Get
-        Set(ByVal value As PostClass)
-            _relationTargetPost = value
-        End Set
-    End Property
 
     <Xml.Serialization.XmlIgnore()> _
-    Public Property OldestId() As Long
-        Get
-            Return _oldestId
-        End Get
-        Set(ByVal value As Long)
-            _oldestId = value
-        End Set
-    End Property
+    Public Property OldestId() As Long = Long.MaxValue
 
     <Xml.Serialization.XmlIgnore()> _
     Public Property SinceId() As Long
-        Get
-            Return _sinceId
-        End Get
-        Set(ByVal value As Long)
-            _sinceId = value
-        End Set
-    End Property
 
     <Xml.Serialization.XmlIgnore()> _
-    Public Property Posts() As Dictionary(Of Long, PostClass)
-        Get
-            Return _posts
-        End Get
-        Set(ByVal value As Dictionary(Of Long, PostClass))
-            _posts = value
-        End Set
-    End Property
-
-    'Public Function SearchedPost(ByVal Id As Long) As PostClass
-    '    If Not _posts.ContainsKey(Id) Then Return Nothing
-    '    Return _posts(Id)
-    'End Function
+    Public Property Posts() As New Dictionary(Of Long, PostClass)
 
     Public Function GetTemporaryPosts() As PostClass()
         Dim tempPosts As New List(Of PostClass)
         If _tmpIds.Count = 0 Then Return tempPosts.ToArray
         For Each tempId As TemporaryId In _tmpIds
-            tempPosts.Add(_posts(tempId.Id))
+            tempPosts.Add(_Posts(tempId.Id))
         Next
         Return tempPosts.ToArray
     End Function
@@ -1717,7 +1678,7 @@ Public NotInheritable Class TabClass
         _soundFile = ""
         _unreadManage = True
         _ids = New List(Of Long)
-        _oldestUnreadItem = -1
+        Me.OldestUnreadId = -1
         _tabType = TabUsageType.Undefined
         _listInfo = Nothing
     End Sub
@@ -1729,7 +1690,7 @@ Public NotInheritable Class TabClass
         _soundFile = ""
         _unreadManage = True
         _ids = New List(Of Long)
-        _oldestUnreadItem = -1
+        Me.OldestUnreadId = -1
         _tabType = TabType
         Me.ListInfo = list
         If Me.IsInnerStorageTabType Then
@@ -1765,10 +1726,10 @@ Public NotInheritable Class TabClass
 
         If Not Read AndAlso Me._unreadManage Then
             Me._unreadCount += 1
-            If Me._oldestUnreadItem = -1 Then
-                Me._oldestUnreadItem = ID
+            If Me.OldestUnreadId = -1 Then
+                Me.OldestUnreadId = ID
             Else
-                If ID < Me._oldestUnreadItem Then Me._oldestUnreadItem = ID
+                If ID < Me.OldestUnreadId Then Me.OldestUnreadId = ID
             End If
         End If
     End Sub
@@ -1844,7 +1805,7 @@ Public NotInheritable Class TabClass
 
         If Not Read AndAlso Me._unreadManage Then
             Me._unreadCount -= 1
-            Me._oldestUnreadItem = -1
+            Me.OldestUnreadId = -1
         End If
 
         Me._ids.Remove(Id)
@@ -1858,39 +1819,18 @@ Public NotInheritable Class TabClass
         Set(ByVal value As Boolean)
             Me._unreadManage = value
             If Not value Then
-                Me._oldestUnreadItem = -1
+                Me.OldestUnreadId = -1
                 Me._unreadCount = 0
             End If
         End Set
     End Property
 
     Public Property Notify() As Boolean
-        Get
-            Return _notify
-        End Get
-        Set(ByVal value As Boolean)
-            _notify = value
-        End Set
-    End Property
 
-    Public Property SoundFile() As String
-        Get
-            Return _soundFile
-        End Get
-        Set(ByVal value As String)
-            _soundFile = value
-        End Set
-    End Property
+    Public Property SoundFile() As String = ""
 
     <Xml.Serialization.XmlIgnore()> _
-    Public Property OldestUnreadId() As Long
-        Get
-            Return _oldestUnreadItem
-        End Get
-        Set(ByVal value As Long)
-            _oldestUnreadItem = value
-        End Set
-    End Property
+    Public Property OldestUnreadId() As Long = -1
 
     <Xml.Serialization.XmlIgnore()> _
     Public Property UnreadCount() As Integer
@@ -1918,7 +1858,7 @@ Public NotInheritable Class TabClass
     Public Sub RemoveFilter(ByVal filter As FiltersClass)
         SyncLock Me._lockObj
             _filters.Remove(filter)
-            _filterMod = True
+            Me.FilterModified = True
         End SyncLock
     End Sub
 
@@ -1926,7 +1866,7 @@ Public NotInheritable Class TabClass
         SyncLock Me._lockObj
             If _filters.Contains(filter) Then Return False
             _filters.Add(filter)
-            _filterMod = True
+            Me.FilterModified = True
             Return True
         End SyncLock
     End Function
@@ -1950,7 +1890,7 @@ Public NotInheritable Class TabClass
         original.ExSource = modified.ExSource
         original.MoveFrom = modified.MoveFrom
         original.SetMark = modified.SetMark
-        _filterMod = True
+        Me.FilterModified = True
     End Sub
 
     <Xml.Serialization.XmlIgnore()> _
@@ -1989,7 +1929,7 @@ Public NotInheritable Class TabClass
         _ids.Clear()
         _tmpIds.Clear()
         _unreadCount = 0
-        _oldestUnreadItem = -1
+        Me.OldestUnreadId = -1
         If _posts IsNot Nothing Then
             _posts.Clear()
         End If
@@ -2005,26 +1945,12 @@ Public NotInheritable Class TabClass
 
     <Xml.Serialization.XmlIgnore()> _
     Public Property FilterModified() As Boolean
-        Get
-            Return _filterMod
-        End Get
-        Set(ByVal value As Boolean)
-            _filterMod = value
-        End Set
-    End Property
 
     Public Function BackupIds() As Long()
         Return _ids.ToArray()
     End Function
 
-    Public Property TabName() As String
-        Get
-            Return _tabName
-        End Get
-        Set(ByVal value As String)
-            _tabName = value
-        End Set
-    End Property
+    Public Property TabName() As String = ""
 
     Public Property TabType() As TabUsageType
         Get
index 822efad..cd456e7 100644 (file)
@@ -3526,7 +3526,7 @@ Public Class TweenMain
         Return True
     End Function
 
-    Public Function RemoveSpecifiedTab(ByVal TabName As String) As Boolean
+    Public Function RemoveSpecifiedTab(ByVal TabName As String, ByVal confirm As Boolean) As Boolean
         Dim idx As Integer = 0
         For idx = 0 To ListTab.TabPages.Count - 1
             If ListTab.TabPages(idx).Text = TabName Then Exit For
@@ -3534,10 +3534,12 @@ Public Class TweenMain
 
         If _statuses.IsDefaultTab(TabName) Then Return False
 
-        Dim tmp As String = String.Format(My.Resources.RemoveSpecifiedTabText1, Environment.NewLine)
-        If MessageBox.Show(tmp, TabName + " " + My.Resources.RemoveSpecifiedTabText2, _
-                         MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Cancel Then
-            Return False
+        If confirm Then
+            Dim tmp As String = String.Format(My.Resources.RemoveSpecifiedTabText1, Environment.NewLine)
+            If MessageBox.Show(tmp, TabName + " " + My.Resources.RemoveSpecifiedTabText2, _
+                             MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Cancel Then
+                Return False
+            End If
         End If
 
         SetListProperty()   '他のタブに列幅等を反映
@@ -4815,6 +4817,25 @@ RETRY:
                 e.Handled = True
                 e.SuppressKeyPress = True
                 GetTimeline(WORKERTYPE.DirectMessegeRcv, 1, 0, "")
+            ElseIf e.KeyCode = Keys.Escape Then
+                If ListTab.SelectedTab IsNot Nothing AndAlso _statuses.Tabs(ListTab.SelectedTab.Text).TabType = TabUsageType.Related Then
+                    Dim relTp As TabPage = ListTab.SelectedTab
+                    Dim backToTab As TabClass = _statuses.Tabs(relTp.Text).BackToTab
+                    If backToTab IsNot Nothing Then
+                        Try
+                            For Each tp As TabPage In ListTab.TabPages
+                                If tp.Text = backToTab.TabName Then
+                                    ListTab.SelectTab(tp)
+                                    Exit For
+                                End If
+                            Next
+                        Catch ex As Exception
+
+                        End Try
+                    End If
+                    RemoveSpecifiedTab(relTp.Text, False)
+                    SaveConfigsTabs()
+                End If
             End If
         End If
 
@@ -6898,7 +6919,7 @@ RETRY:
     Private Sub DeleteTabMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DeleteTabMenuItem.Click, DeleteTbMenuItem.Click
         If String.IsNullOrEmpty(_rclickTabName) OrElse sender Is Me.DeleteTbMenuItem Then _rclickTabName = ListTab.SelectedTab.Text
 
-        RemoveSpecifiedTab(_rclickTabName)
+        RemoveSpecifiedTab(_rclickTabName, True)
         SaveConfigsTabs()
     End Sub
 
@@ -9858,6 +9879,7 @@ RETRY:
     Private Sub CopyUserIdStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyUserIdStripMenuItem.Click
         CopyUserId()
     End Sub
+
     Private Sub CopyUserId()
         If _curPost Is Nothing Then Exit Sub
         Dim clstr As String = _curPost.Name
@@ -9869,6 +9891,7 @@ RETRY:
     End Sub
 
     Private Sub ShowRelatedStatusesMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowRelatedStatusesMenuItem.Click, ShowRelatedStatusesMenuItem2.Click
+        Dim backToTab As TabClass = If(_curTab Is Nothing, _statuses.Tabs(ListTab.SelectedTab.Text), _statuses.Tabs(_curTab.Text))
         If Me.ExistCurrentPost AndAlso Not _curPost.IsDm Then
             'PublicSearchも除外した方がよい?
             If _statuses.GetTabByType(TabUsageType.Related) Is Nothing Then
@@ -9886,10 +9909,12 @@ RETRY:
                     _statuses.AddTab(tName, TabUsageType.Related, Nothing)
                 End If
                 _statuses.GetTabByName(tName).UnreadManage = False
+                _statuses.GetTabByName(tName).Notify = False
             End If
 
             Dim tb As TabClass = _statuses.GetTabByType(TabUsageType.Related)
             tb.RelationTargetPost = _curPost
+            tb.BackToTab = backToTab
             Me.ClearTab(tb.TabName, False)
             For i As Integer = 0 To ListTab.TabPages.Count - 1
                 If tb.TabName = ListTab.TabPages(i).Text Then
index 33e5299..3722a9a 100644 (file)
@@ -1612,10 +1612,21 @@ Public Class Twitter
     End Function
 
     Public Function GetRelatedResult(ByVal read As Boolean, ByVal tab As TabClass) As String
+        Dim rslt As String = ""
         Dim relPosts As New List(Of PostClass)
+        If tab.RelationTargetPost.Data.Contains("@") AndAlso tab.RelationTargetPost.InReplyToId = 0 Then
+            '検索結果対応
+            Dim p As PostClass = TabInformations.GetInstance.Item(tab.RelationTargetPost.Id)
+            If p IsNot Nothing AndAlso p.InReplyToId > 0 Then
+                tab.RelationTargetPost = p
+            Else
+                rslt = Me.GetStatusApi(read, tab.RelationTargetPost.Id, p)
+                If Not String.IsNullOrEmpty(rslt) Then Return rslt
+                tab.RelationTargetPost = p
+            End If
+        End If
         relPosts.Add(tab.RelationTargetPost.Copy)
         Dim tmpPost As PostClass = relPosts(0)
-        Dim rslt As String = ""
         Do
             rslt = Me.GetRelatedResultsApi(read, tmpPost, tab, relPosts)
             If Not String.IsNullOrEmpty(rslt) Then Exit Do