diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-09-15 00:26:33 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-09-15 00:26:41 -0400 |
commit | 4fc681f78b2e659d3db3da99fe7c640416fb3b43 (patch) | |
tree | 6d20d2864f98d4c3be1814d399bc669524ee6a42 /UI | |
parent | b431fc0fb9d3b4617e4331a549ea02fda236223b (diff) | |
download | keysafe-4fc681f78b2e659d3db3da99fe7c640416fb3b43.tar.gz |
Change format of ~/.keysafe/backup.log
Allow deserializing SecretKeySource so we can later know what gpg keys are
backed up.
Converted KeyId to Text as JSON can't handle ByteString.
Diffstat (limited to 'UI')
-rw-r--r-- | UI/Readline.hs | 3 | ||||
-rw-r--r-- | UI/Zenity.hs | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/UI/Readline.hs b/UI/Readline.hs index 0f852ea..7f19f67 100644 --- a/UI/Readline.hs +++ b/UI/Readline.hs @@ -17,6 +17,7 @@ import Data.Char import Text.Read import Control.Monad import qualified Data.ByteString.UTF8 as BU8 +import qualified Data.Text as T readlineUI :: UI readlineUI = UI @@ -129,7 +130,7 @@ myPromptKeyId title desc l = do putStrLn desc putStrLn "" forM_ nl $ \(n, ((Name name), (KeyId kid))) -> - putStrLn $ show n ++ ".\t" ++ BU8.toString name ++ " (keyid " ++ BU8.toString kid ++ ")" + putStrLn $ show n ++ ".\t" ++ BU8.toString name ++ " (keyid " ++ T.unpack kid ++ ")" prompt where nl = zip [1 :: Integer ..] l diff --git a/UI/Zenity.hs b/UI/Zenity.hs index 943be14..74810d9 100644 --- a/UI/Zenity.hs +++ b/UI/Zenity.hs @@ -15,6 +15,7 @@ import System.FilePath import System.Directory import System.Exit import qualified Data.ByteString.UTF8 as BU8 +import qualified Data.Text as T zenityUI :: UI zenityUI = UI @@ -122,12 +123,12 @@ myPromptKeyId title desc l = do , "--print-column", "ALL" , "--separator", "\BEL" , "--width", "500" - ] ++ concatMap (\(Name n, KeyId kid) -> [BU8.toString n, BU8.toString kid]) l + ] ++ concatMap (\(Name n, KeyId kid) -> [BU8.toString n, T.unpack kid]) l (ret, ok) <- waitZenity h if ok then do let (_n, _:kid) = break (== '\BEL') ret - return $ Just (KeyId (BU8.fromString kid)) + return $ Just (KeyId (T.pack kid)) else return Nothing myWithProgress :: Title -> Desc -> ((Percent -> IO ()) -> IO a) -> IO a |