Welcome, Guest
Please Login or Register.    Lost Password?

New context menu button?
(1 viewing) (1) Guest
Go to bottomPage: 12345
TOPIC: New context menu button?
#10583
Re:New context menu button? 4 Years, 11 Months ago  
do you mean this one:

<bitmap id="bitmap.todo.item" file="images/Todo-item.png" frames="3" />

?

how to make it be displayed for events?

like that:

<bitmap id="bitmap.events.item" file="images/Todo-item.png" frames="3" />

?
yoodilo
Expert Boarder
Posts: 103
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#10584
Re:New context menu button? 4 Years, 11 Months ago  
That's the image which is used in the button so you don't have to change it unless you want to. What you need to do is to edit the eventlist.xml file and add the button to the <item> element like it is in the todolist.xml. You also need to adjust the padding for the item's text so that it isn't drawn over the button and change the function (action) which is triggered when the button is clicked.
Rainy
Moderator
Posts: 5920
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#10586
Re:New context menu button? 4 Years, 11 Months ago  
Ah nice, thanks so far.
I'm now calling the a new function with the #GUID# as for the todo-task.

my looks like the following so far:

Code:

--
-- Adds given category to a certain event and thus helps to
-- blend out an event if the category is set to hidden
--
-- Parameters: 
--    strGuid - The unique identifier of the task.
--    strCat - Category
-- Return:
--    Nothing
--
function Global_AddCategoryToEvent(strGuid, cat)
  strEvent = Rainlendar_GetComponent(strGuid)

  if (strEvent) then
-- Something to do here:
    strEvent = Private_SetIcalProperty(strEvent, "STATUS", "NEEDS-ACTION")

    Rainlendar_UpdateComponent(strEvent)
    bChanges = Rainlendar_FlushComponents()
    if (bChanges == true) then
      -- Redraw the windows if there were changes that need to be shown
      Rainlendar_Redraw(1)
    end
  end
end



but there's nothing about the SetIcalProperty in the help file so I don't know how to add my category which is set to be hidden, which is named "hidden_cat", please help me with this line! thanks!

edit: ok these private functions are defined in the lua file itself, but I don't know how the concerning category-field is named and further, I dunno how to do debugging with rainlendar to alert some test-variables or so so I would now how to manipulate. probably something like:

strEvent = Private_SetIcalProperty(strEvent, "CATEGORY", "hidden_cat")

but as mentioned, I don't really know it.

edit2: ok as tried just one line above: doesn't work.
anohter question would be: would it be better to not write it into the components.lua because this file will be overwritten when upgrading but if yes, where? can i create a custom lua file? and what about the private functions icalset/get? do I have to copy them into the own lua-file to be able to call them?
yoodilo
Expert Boarder
Posts: 103
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2009/08/12 12:33 By yoodilo.
The administrator has disabled public write access.
 
#10588
Re:New context menu button? 4 Years, 11 Months ago  
You can find out the parameter names if you open the ics file in a text editor. The correct value for the category is "CATEGORIES".

Yes, you should put the new function to a separate file. All files with ".lua" extension are read automatically from the scripts folder. You can also call functions from other files so it's not necessary to make a copy of the Private_SetIcalProperty function.
Rainy
Moderator
Posts: 5920
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#10589
Re:New context menu button? 4 Years, 11 Months ago  
Wow nice, awesome! That works so far like that:

Code:

function Global_AddCategoryToEvent(strGuid)
  strEvent = Rainlendar_GetComponent(strGuid)

  if (strEvent) then
-- Something to do here:
cats =  Private_GetIcalProperty(strEvent, "CATEGORIES")..",Ausblenden"
strEvent = Private_SetIcalProperty(strEvent, "CATEGORIES", cats)

    Rainlendar_UpdateComponent(strEvent)
    bChanges = Rainlendar_FlushComponents()
    if (bChanges == true) then
      -- Redraw the windows if there were changes that need to be shown
      Rainlendar_Redraw(1)
    end
  end
end



now the following would be awesome:

if the event is recurrent, just delete the actual instance (or better to say: add today to the ignore list), otherwise really add the category. so the question would be:

how to delete this instance for recurrent events? I mean:
I see there's the entry

EXDATE;VALUE=DATE:20080812

but
a) when it's already ignored for another date, how to ADD a new ignoration so the other one is kept (since every entry should be in a new line in the ics-file)
b) how to set the date as formated above? and how to get the date of the day where I clicked the event. let's assume an event which is daily and I click the hide-icon for the event tomorrow, I want to add tomorrows's date to the ignore list and not today.

and second question:
how to read out if the event is recurrent? I see the "PRULE" but: Is the event ALWAYS recurrent if there's an entry "RRULE" and otherwise not? edit: seems so.
yoodilo
Expert Boarder
Posts: 103
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2009/08/13 02:30 By yoodilo.
The administrator has disabled public write access.
 
#10605
Re:New context menu button? 4 Years, 11 Months ago  
a) You would need to make a new function which would just add the property for the event. The last return statement in the Private_SetIcalProperty() function does this already so you can just remove the checks from the function which test if the property already exists.

b) That's probably not possible at the moment. I need to add a variable for that.
Rainy
Moderator
Posts: 5920
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 12345
get the latest posts directly to your desktop