From: Mart Lubbers Date: Mon, 27 Feb 2017 16:39:49 +0000 (+0100) Subject: finetune share viewing X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=76032aaf711f19e8ad97e701f66242d897ae3763;p=mTask.git finetune share viewing --- diff --git a/Shares/mTaskShare.dcl b/Shares/mTaskShare.dcl index 0f476d5..a9c6f39 100644 --- a/Shares/mTaskShare.dcl +++ b/Shares/mTaskShare.dcl @@ -9,4 +9,6 @@ import iTasks realShare :: String } -viewShares :: [MTaskShare] -> Task () +instance zero MTaskShare + +manageShares :: [MTaskShare] -> Task () diff --git a/Shares/mTaskShare.icl b/Shares/mTaskShare.icl index 836b504..0bb6265 100644 --- a/Shares/mTaskShare.icl +++ b/Shares/mTaskShare.icl @@ -2,10 +2,23 @@ implementation module Shares.mTaskShare import Utils.SDS import iTasks +from Data.Func import $ + +manageShares :: [MTaskShare] -> Task () +manageShares shares = forever (enterChoice "Choose share to update" [ChooseFromGrid id] shares + >&^ \st->whileUnchanged st $ \msh->case msh of + Nothing = viewShares shares @! zero + Just sh = viewSharedInformation "View value" [] (getSDSStore sh) + >>= \_->return sh + ) @! () viewShares :: [MTaskShare] -> Task () -viewShares st = anyTask (map viewer st) +viewShares sh = anyTask (map viewShare sh) <<@ ArrangeHorizontal @! () -viewer :: MTaskShare -> Task () -viewer m = viewSharedInformation "" [] (getSDSStore m) +viewShare :: MTaskShare -> Task () +viewShare m = viewSharedInformation "" [] (getSDSStore m) <<@ Title ("SDS: " +++ toString m.identifier) @! () + +instance zero MTaskShare where + zero = {initValue=0,withTask="",identifier=0,realShare=""} + diff --git a/miTask.icl b/miTask.icl index 09fb5dd..8faca2f 100644 --- a/miTask.icl +++ b/miTask.icl @@ -33,7 +33,7 @@ Start world = startEngine (mTaskManager mTaskManager :: Task () mTaskManager = anyTask [ viewmTasks @! () - , whileUnchanged sdsStore viewShares + , whileUnchanged sdsStore manageShares , whileUnchanged deviceStore $ manageDevices process ] <<@ ApplyLayout (sequenceLayouts [ arrangeWithSideBar 0 LeftSide 260 True