Siria, your knowledge may have already surpassed what I'm about to say, but I've written the following to help (and answer) you and others, as well as to document my own progress and put desga2's suggestions into action. Your question is one I asked myself, which is how I got here, and I've learned how to do some of what you desired to do.
To add new context menus two things must be done, a menu must be invoked in the toolbars.cfg just as desga2 has shown, and the menus themselves must be defined in the menus.cfg.
Menu reference:
http://kmeleon.sourceforge.net/wiki/ConfigFiles#menus
Creating new menus:
I began defining my own menus by clicking
Edit -- Configuration -- Menus in the K-Meleon menu, which opened a text file I could edit called "menus.cfg". Note: if one doesn't open up when you do the same you'll need to make a copy of the one in the "K-Meleon\defaults\profile" folder and place it in your active user folder, then it will open on command.
Apparently K-Meleon will process the main menus.cfg in the "K-Meleon\defaults\settings" folder and then process any additional menus defined in the customized menus.cfg in the active profile folder, with the customized menus replacing the default ones if they have the same names.
I added the following entries to the empty menus.cfg, to create three separate menus I could point to at will:
DoonCookieLookie{
View Cookies=ID_COOKIES_VIEWER
}
DoonCookieTasting{
Cookie Permissions=ID_COOKIE_PERM
}
DoonCachePeek{
View Cache=macros(moz_AboutCache)
}
- The first menu, named DoonCookieLookie, defines a context menu item called "View Cookies", and when it is clicked on the cookie viewer will open. The "=" sign points to the command "ID_COOKIES_VIEWER", which is a standard "Command ID" you can find listed in the wiki documentation. I attached this menu to the delete cookies button on my privacy bar.
- The second menu, named DoonCookieTasting, defines a context menu item called "Cookie Permissions", and when it is clicked the cookie permissions dialog will pop up. The command itself is defined just like the first menu. I attached this menu to the toggle cookies button on my privacy bar.
- The third menu, named DoonCachePeek, defines a context menu item called "View Cache", and when it is clicked it will display the cache as if you had typed "about:cache" in the url bar. I attached this menu to the toggle images button on my privacy bar.
The command in this third menu invokes a default, pre-defined macro. Following the "=" sign you see "macros(moz_AboutCache)". The word "macros" there tells K-Meleon the command to issue is a macro, and the "(moz_AboutCache)" defines the macro to be invoked.
This whole macro invoking command line was quite an adventure for me. I didn't have any notes or examples to follow, I just studied the menus and macros until I could figure out what might open the cache. I must have tried 20 commands until I got that one to work, many of them were just guesses and stuff pasted in from the macro file.
In the process I learned a lot and now understand the basic structure of macro files (similar to menus in many respects), even though I have no clue how to program one, and most of it's contents is noise to me. On that note, the menus themselves (menus.cfg) were just a bunch of noise a few days ago, but over time the structure and meaning of it all sank into my brain, thanks to hours of staring at them, tracing the relationships, and also thanks to the help files provided, which finally made sense of it all. Without studying the structures themselves the help files weren't helpful to me. I say this to encourage others who may be bewildered by it all, like many things, if you can break things down into small pieces it's not so difficult, just as desga2 said. I'm writing this posting
immediately after learning what I've learned in order to help other newbies like myself.
Also, for the sake of an example: I could have compiled those three commands, along with others, into single custom menu, like this:
DoonContextMenu{
View Cookies=ID_COOKIES_VIEWER
Cookie Permissions=ID_COOKIE_PERM
View Cache=macros(moz_AboutCache)
}
Attaching menus to toolbar buttons:
Connecting menus to privacy bar buttons. Menus are always referred to by
name, and will be found and used if they are in a menus.cfg (they can also be in a macro.kmm, like the one named "Reloa&ding" in
main.kmm, but I don't know how they work).
In my case I edited toolbars.cfg and changed this:
Images{
macros(pref_ToggleImages)
Block Images. Press F9 to toggle.
privbar_red.bmp[1]
privbar_green.bmp[1]
}
to this: (note the addition to the second line)
Images{
macros(pref_ToggleImages)|DoonCachePeek
Block Images. Press F9 to toggle.
privbar_red.bmp[1]
privbar_green.bmp[1]
}
Adding the "|" sign followed by a menu name, after the command, will add a right-click context menu to the toolbar button.
I added the "|MenuName" to the Cookies and Clear Cookies buttons too, as in
"macros(pref_ToggleCookies)|DoonCookieTasting" and
"privacy(ClearCookies)|DoonCookieLookie".
End of story.
Here's an additional tweak. Taking a cue from others, in toolbars.cfg I added a "|&Privacy" to the Stop button, to add the whole privacy menu (from the tools menu) as a right-click context menu, which is a very handy and logical place for many of the commands.
Stop{
ID_NAV_STOP|&Privacy
Stop loading this page
toolhot.bmp[2]
toolcold.bmp[2]
tooldead.bmp[2]
}
Lastly, just for fun, here is a picture of my customized Klassic skin privacy bar:
That is an animated gif showing the different states, if you have animations disabled you won't be seeing much of anything. It's a quick hack job that was intended to shorten the buttons, and the buttons shown are the only ones I'm interested in at this time. It's not much to look at but I'm amused by the image squasher. :-)
I must say that I love the privacy bar and use the image and javascript toggles constantly, that toolbar it's easily one of the biggest reasons K-Meleon is so appealing to me!
Edited 5 time(s). Last edit at 10/23/2009 06:28AM by Doon.