From 16cefae7f276e12c20e203729aad23cfd90f0ec3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 9 Sep 2012 16:24:34 -0400 Subject: add an alert while a locally initiated pairing request is in progress Has a button to cancel the request. --- Assistant/Alert.hs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Assistant/Alert.hs') diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs index 666098c6f..a2f5db4e3 100644 --- a/Assistant/Alert.hs +++ b/Assistant/Alert.hs @@ -32,7 +32,7 @@ data AlertName = FileAlert TenseChunk | SanityCheckFixAlert | WarningAlert String - | PairRequestAlert String + | PairRequestReceivedAlert String deriving (Eq) {- The first alert is the new alert, the second is an old alert. @@ -148,6 +148,7 @@ makeAlertFiller success alert { alertClass = if c == Activity then c' else c , alertPriority = Filler , alertClosable = True + , alertButton = Nothing , alertIcon = Just $ if success then SuccessIcon else ErrorIcon } where @@ -285,8 +286,15 @@ sanityCheckFixAlert msg = Alert alerthead = "The daily sanity check found and fixed a problem:" alertfoot = "If these problems persist, consider filing a bug report." -pairRequestAlert :: String -> String -> AlertButton -> Alert -pairRequestAlert repo msg button = Alert +pairRequestAlert :: AlertButton -> Alert +pairRequestAlert button = baseActivityAlert + { alertData = [ UnTensed "Pairing request in progress" ] + , alertPriority = High + , alertButton = Just button + } + +pairRequestReceivedAlert :: String -> String -> AlertButton -> Alert +pairRequestReceivedAlert repo msg button = Alert { alertClass = Message , alertHeader = Nothing , alertMessageRender = tenseWords @@ -295,7 +303,7 @@ pairRequestAlert repo msg button = Alert , alertPriority = High , alertClosable = True , alertIcon = Just InfoIcon - , alertName = Just $ PairRequestAlert repo + , alertName = Just $ PairRequestReceivedAlert repo , alertCombiner = Just $ dataCombiner $ const id , alertButton = Just button } -- cgit v1.2.3