Added some context menu stuff

Added context menus for rules and preview. Not all items work, though.
There seems to be a bug with detecting whether a file was applied, need
to look into that.