我试图制作一个从BBC新闻网站上删除新闻标题的应用程序,在检索到文件后向用户桌面发送通知,然后让用户选择打开一个窗口显示文章标题及其链接。除了最后一部分,一切都很好 - 我无法通过fdo-notify来执行操作。我不确定语法是什么,但这就是我所拥有的:
broadCastHeadlines = do
client <- connectSession
let startNote = Note { appName = "BBC News Headlines" , appImage = Nothing ,
summary="BBC News Headlines", actions = [], hints = [],
body=(Just $ Text "Latest Headlines"),
expiry = Never}
notification <- notify client startNote
headlines <- readHeadlinesFromFile
--let headlines' = unlines $ map show headlines
let endNote = Note { appName = "BBC News Headlines" , appImage = Nothing ,
summary="BBC News Headlines", actions = [(Action {actionName = "UI.main"}, "Open")], hints = [],
body=(Just $ Text ((getTitle $ head headlines) ++ " and " ++ (show $ length headlines) ++ " more stories.")), expiry = Never}
headlines `seq` replace client notification endNote
如何让Action运行UI.main?
这是图书馆资料库的链接:http://bitbucket.org/taejo/fdo-notify/