summaryrefslogtreecommitdiffstats
path: root/TreeView.hs
diff options
context:
space:
mode:
Diffstat (limited to 'TreeView.hs')
-rw-r--r--TreeView.hs60
1 files changed, 2 insertions, 58 deletions
diff --git a/TreeView.hs b/TreeView.hs
index 470913b..dff50e8 100644
--- a/TreeView.hs
+++ b/TreeView.hs
@@ -4,7 +4,7 @@
module TreeView
- ( TreeView (..)
+ ( module Export
, getMessage
, getSearchTerm
, isTVMessage
@@ -12,14 +12,12 @@ module TreeView
, fromSearchResults
, fromMessageForest
, fromMessageTree
- , treeViewId
, loadSubForest
, unloadSubForest
, hasUnloadedSubForest
) where
-import qualified Data.CaseInsensitive as CI
import qualified Data.Text as T
import Control.Applicative
import Data.Monoid
@@ -27,61 +25,7 @@ import Data.Tree
import Notmuch
import Notmuch.Message
import Notmuch.SearchResult
-
-
-type LineNr = Int
-
-
-data TreeView
- = TVMessage Message
- | TVMessageHeaderField Message (CI.CI T.Text)
- | TVMessagePart Message MessagePart
- | TVMessageQuoteLine Message MessagePart LineNr String
- | TVMessageLine Message MessagePart LineNr String
- | TVSearch String
- | TVSearchResult SearchResult
- deriving (Show)
-
-
-instance Eq TreeView where
- x1 == x2 = treeViewId x1 == treeViewId x2
-
-
-data TreeViewId
- = TVIDMessage T.Text
- | TVIDMessageHeaderField T.Text T.Text
- | TVIDMessagePart T.Text Int
- | TVIDMessageLine T.Text Int Int
- | TVIDSearch T.Text
- | TVIDSearchResult T.Text
- deriving (Eq,Show)
-
-
-treeViewId :: TreeView -> TreeViewId
-treeViewId = \case
- TVMessage m ->
- TVIDMessage (fromMessage m)
-
- TVMessageHeaderField m mhf ->
- TVIDMessageHeaderField (fromMessage m) (CI.foldedCase mhf)
-
- TVMessagePart m mp ->
- TVIDMessagePart (fromMessage m) (partID mp)
-
- TVMessageLine m mp lineNr _ ->
- TVIDMessageLine (fromMessage m) (partID mp) lineNr
-
- TVMessageQuoteLine m mp lineNr _ ->
- TVIDMessageLine (fromMessage m) (partID mp) lineNr
-
- TVSearch s ->
- TVIDSearch (T.pack s)
-
- TVSearchResult sr ->
- TVIDSearchResult (T.pack $ unThreadID $ searchThread sr)
-
- where
- fromMessage = T.pack . unMessageID . messageId
+import TreeView.Types as Export
getMessage :: TreeView -> Maybe Message