Development :  K-Meleon Web Browser Forum
K-Meleon development related discussions. 
Forms history options for Preference panel.
Posted by: desga2
Date: June 07, 2015 11:19AM

Hi,

This attached files add Forms history options to Preference panel for K-Meleon 75 RC4.
Attached preview image in file FormHistory.jpg

Please, spell check english in files and post fixed it to I can fixed it on files.

- Modified files:
\K-Meleon75\browser\omni\chrome\kmeleon\content\kmprefs\kmprefs\ovrl-history.xul
\K-Meleon75\browser\omni\chrome\en-US\locale\kmprefs\kmprefs\ovrl-history.dtd

- Instructions:

1) Test it in english language. Change your K-Meleon language preference to english (F2 preferences -> GUI Appearance -> Language).

2) Close K-Meleon 75 RC4.

3) Unzip with 7zip \K-Meleon75\browser\omni.ja archive

4) Unzip omni_FormHistory.7z attached file in omni.ja unziped folder (\K-Meleon75\browser\omni) to overwrite modified files.

5) Repack omni folder in omni.ja archive, with 7zip create archive with the content of the omni folder. omni.ja archive is a zip file without compress.

6) Backup original omni.ja, rename it or move to another location.
And move the new repacked omni.ja to \K-Meleon75\browser\ folder.


Greetings.

K-Meleon in Spanish

Attachments: omni_FormHistory.7z (2.3 KB)   FormHistory.jpg (75.8 KB)  
Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: rodocop
Date: June 07, 2015 05:59PM

It's great job, desga!

Already updated ru-locale with new strings for your additions!

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: desga2
Date: June 08, 2015 07:22PM

Locale es-ES updated for Forms History here:
http://kmeleonbrowser.org/forum/read.php?2,133713,133969#msg-133969

K-Meleon in Spanish



Edited 1 time(s). Last edit at 06/08/2015 07:23PM by desga2.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: desga2
Date: June 26, 2015 06:54PM

Updated to version 2, now Form History Clear button works!

- TO DO for 75.1:

Dorian must add a ClearForms() function to privacy.dll kplugin and add entry in menus:
In file: \K-Meleon75\browser\defaults\settings\menus.cfg
in menu:
# ----- Privacy

%ifplugin privacy
&Clear Data{
Clear C&ache=privacy(ClearCache)
Clear &Cookies=privacy(ClearCookies)
Clear Pass&words=privacy(ClearSignon)
Clear &History=privacy(ClearHistory)
Clear &URL Bar History=privacy(ClearMRU)
Clear &Forms History=privacy(ClearForms)
-
Clear Au&tomatically...=privacy(Config)
}
%endif

- Also add it to Clear Au&tomatically...=privacy(Config) "Privacy Plugin Settings" dialog.
- And modify macro function Clear All in file: \K-Meleon75\macros\main.kmm
kPrivacy_ClearAll{
macroinfo=_("Clear all privacy related data");
if (confirm(_("Clear all privacy related data"), _("Clear All"), YESNO, QUESTION) == "YES") {
plugin(privacy,ClearCache);
plugin(privacy,ClearCookies);
plugin(privacy,ClearHistory);
plugin(privacy,ClearMRU);
plugin(privacy,ClearForms);
plugin(privacy,ClearSignon);
}
}


Greetings.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 06/26/2015 07:00PM by desga2.

Attachments: omni_FormHistory_2.7z (2.4 KB)   FormHistory_2.jpg (75.6 KB)  
Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: adodupan
Date: June 29, 2015 04:41PM

Quote
desga2
Dorian must add a ClearForms() function to privacy.dll kplugin and add entry in menus:
In file: \K-Meleon75\browser\defaults\settings\menus.cfg

- Also add it to Clear Au&tomatically...=privacy(Config) "Privacy Plugin Settings" dialog.
- And modify macro function Clear All in file: \K-Meleon75\macros\main.kmm

I don't know if you follow what Dorian doing in the last months,
just for info, kmeleon's user interface does not depend on macro plugin like before.
Jsbridge plugin offers some functions, you can write a many things in javascript now.
This means, you can use jsbridge plugin instead of two plugins (macro and privacy plugins). It is much simpler and faster.

Also, when you want to use a comment in javascript, you should use
// comment
/* comment */
/** comment **/


Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: rodocop
Date: June 29, 2015 06:00PM

adodupan,

does it mean we can make something like dynamical context menu items, driven by extensions like in FF?

Please, explain it more deeper for less qualified persons like me - what are the new possibilities available through new JSbridge?



Edited 1 time(s). Last edit at 06/29/2015 06:01PM by rodocop.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: desga2
Date: June 30, 2015 11:42AM

Quote
adodupan
Quote
desga2
Dorian must add a ClearForms() function to privacy.dll kplugin and add entry in menus:
In file: \K-Meleon75\browser\defaults\settings\menus.cfg

- Also add it to Clear Au&tomatically...=privacy(Config) "Privacy Plugin Settings" dialog.
- And modify macro function Clear All in file: \K-Meleon75\macros\main.kmm

I don't know if you follow what Dorian doing in the last months,
just for info, kmeleon's user interface does not depend on macro plugin like before.
Jsbridge plugin offers some functions, you can write a many things in javascript now.
This means, you can use jsbridge plugin instead of two plugins (macro and privacy plugins). It is much simpler and faster.

Also, when you want to use a comment in javascript, you should use
// comment
/* comment */
/** comment **/

I know how to comment in JS, have you something against old style HTML comments? tongue sticking out smiley

I don't know how to use the new JSbridge functions and if this support javascript commands (to allow me load the FormHistory.jsm module and use its functions) but it's a good moment to learn it and document it.

- Links to code:
http://kmeleon.cvs.sourceforge.net/viewvc/kmeleon/k-meleon/JSBridge/nsIJSBridge.idl?revision=1.16&view=markup
http://kmeleon.cvs.sourceforge.net/viewvc/kmeleon/k-meleon/JSBridge/jscomp.h?revision=1.9&view=markup
http://kmeleon.cvs.sourceforge.net/viewvc/kmeleon/k-meleon/JSBridge/jscomp.cpp?revision=1.18&view=markup

Is needed to use RegisterCmd() function before SetMenu() or SetMenuCallback() ?
And after I suppose need to use the RebuildMenu() function.

All this functions must be called from a FormHistory.kmm macro, yes it's?

Please, if you know how to do it, can you post an example of how to use this functions?


Thanks and greetings.

K-Meleon in Spanish

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: adodupan
Date: June 30, 2015 02:45PM

At the beginning, you should forget macros.dll and kmm files.
This code will add a menu item 'Clear &Forms History' in popup '&Clear Data' using a function SetMenuCallback().
I recommend function SetMenu() in this case, because this menu item will be enabled or not depending on whether formhistory database is empty or not.
But in your update missing part whether 'Clear' button is enabled or not (in init() function).
When you write this part, i will show you how you can use a function RegisterCmd().
After that, i will show you how you can use a properties file for this menu item (of course, if you don't know how).
Paste code in error console for testing:
Components.utils.import('resource://gre/modules/Services.jsm');
Components.utils.import('resource://gre/modules/FileUtils.jsm');
Components.utils.import('resource://gre/modules/FormHistory.jsm');
const JSB = Components.classes['@kmeleon/jsbridge;1'].getService(Components.interfaces.nsIJSBridge);
if (!FileUtils.getFile('KAPlugins', ['privacy.dll']).exists() || !Services.prefs.getBoolPref('kmeleon.plugins.privacy.load')) {
	JSB.SetMenu('PrivateData', JSB.MENU_POPUP, '&Clear Data', '');
	JSB.SetMenu('&Tools', JSB.MENU_PLUGIN, 'bmpmenu()', 1);
}
JSB.SetMenuCallback('&Clear Data', 'Clear &Forms History', function () {
	FormHistory.update({op: 'remove'});
});
JSB.SetMenu('&Clear Data', JSB.MENU_PLUGIN, 'bmpmenu()', 1);



Edited 1 time(s). Last edit at 06/30/2015 02:54PM by adodupan.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: rodocop
Date: June 30, 2015 07:20PM

We urgently need to document all the new possibilities of KM as its new features make it even more open to the third-parties than at past.

JS-driven menu - very big step ahead.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: desga2
Date: June 30, 2015 11:24PM

@adodupan:

OK, I tested your code in error console and works, but I need some .js, .jsm or .xul file where put this code and some way like $OnInit in Macros (kmm files) to load this code when KM start.

Need I to do a complete extension (add-on) with a .xpi file to do this?

Quote
adodupan

I recommend function SetMenu() in this case, because this menu item will be enabled or not depending on whether formhistory database is empty or not.
But in your update missing part whether 'Clear' button is enabled or not (in init() function).
When you write this part, i will show you how you can use a function RegisterCmd().
After that, i will show you how you can use a properties file for this menu item (of course, if you don't know how).

I didn't put disabled the 'Clear' button on init() function if formhistory database is empty or not, because I can't find some simple way to check if formhistory database is empty or not.
In old nsIFormHistory2 service the object have a property .hasEntries that return true or false, but this service is deprecated.
I think that I need read completely the formhistory database, store it in an array, and check if this array have some element.
But this is a lot of work and cause lost of performance if you have a big formhistory database.

I don't know how to use a function RegisterCmd() nor a properties file.


Thanks.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 06/30/2015 11:27PM by desga2.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: adodupan
Date: July 01, 2015 12:55AM

Be patient, i will show you all you need that you can finish your update.
I agree, callback to check if formhistory database empty, is not simple.
Put this in your xul file:
add new line in init() function
<!-- Added for Form History options -->
this.initFormBtn();  // new line
This is your callback - new function:
<!-- Added for Form History options -->
initFormBtn: function () {
  var count = 0;
  var done = false;
  FormHistory.count({}, {
    handleResult: function (result) {
      count = result;
    },
    handleError: function (error) {
      throw error;
    },
    handleCompletion: function (reason) {
      done = true;
    }
  });
  var timer = Components.classes['@mozilla.org/timer;1'].createInstance(Components.interfaces.nsITimer);
  timer.initWithCallback(function () {
    done = true;
  }, 1000, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
  var thread = Components.classes['@mozilla.org/thread-manager;1'].getService().mainThread;
  while (!done) {
    thread.processNextEvent(true);
  }
  document.getElementById('btnFormHistory').disabled = count == 0;
},

Now you need to create a new file ovrl-history.properties and put this file in the same folder where file is ovrl-history.dtd.
ovrl-history.properties file:
StatusbarMessage=Remove all Form History entries
ClearFormHistory=Clear &Form History
When you update files, run km and paste code in error console for testing:
Components.utils.import('resource://gre/modules/Services.jsm');
Components.utils.import('resource://gre/modules/FileUtils.jsm');
Components.utils.import('resource://gre/modules/FormHistory.jsm');
const JSB = Components.classes['@kmeleon/jsbridge;1'].getService(Components.interfaces.nsIJSBridge);
const fhBundle = Services.strings.createBundle('chrome://kmprefs/locale/kmprefs/ovrl-history.properties');
if (!FileUtils.getFile('KAPlugins', ['privacy.dll']).exists() || !Services.prefs.getBoolPref('kmeleon.plugins.privacy.load')) {
   JSB.SetMenu('PrivateData', JSB.MENU_POPUP, '&Clear Data', '');
   JSB.SetMenu('&Tools', JSB.MENU_PLUGIN, 'bmpmenu()', 1);
}
JSB.RegisterCmd('clearformhistorycmnd', fhBundle.GetStringFromName('StatusbarMessage'), function () {
   FormHistory.update({
      op: 'remove'
   });
}, '', function () {
   var count = 0;
   var done = false;
   FormHistory.count({}, {
      handleResult: function (result) {
         count = result;
      },
      handleError: function (error) {
         throw error;
      },
      handleCompletion: function (reason) {
         done = true;
      }
   });
   var timer = Components.classes['@mozilla.org/timer;1'].createInstance(Components.interfaces.nsITimer);
   timer.initWithCallback(function () {
      done = true;
   }, 1000, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
   var thread = Components.classes['@mozilla.org/thread-manager;1'].getService().mainThread;
   while (!done) {
      thread.processNextEvent(true);
   }
   return count != 0;
});
JSB.SetMenu('&Clear Data', JSB.MENU_COMMAND, fhBundle.GetStringFromName('ClearFormHistory'), 'clearformhistorycmnd');
JSB.SetMenu('&Clear Data', JSB.MENU_PLUGIN, 'bmpmenu()', 1);
If test is ok, i will show you how you can initiate code when you start km.



Edited 1 time(s). Last edit at 07/09/2015 08:56AM by adodupan.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: adodupan
Date: July 01, 2015 02:16AM

Everything above must be ok.

Now, it is necessary to register observer to get notification 'kmeleon-init'. This will initiate our code.
The easiest way to do this is to edit a file browser\omni.ja\components\kmHelper.js.
There is already registered observer and some code that we need.
We will make a small modification in our code, we will replace constant JSB with KMeleon, then we will put our code in function and put our function after notify function:
  clearformhistory: function () {
    const fhBundle = Services.strings.createBundle('chrome://kmprefs/locale/kmprefs/ovrl-history.properties');
    if (!FileUtils.getFile('KAPlugins', ['privacy.dll']).exists() || !Services.prefs.getBoolPref('kmeleon.plugins.privacy.load')) {
      KMeleon.SetMenu('PrivateData', KMeleon.MENU_POPUP, '&Clear Data', '');
      KMeleon.SetMenu('&Tools', KMeleon.MENU_PLUGIN, 'bmpmenu()', 1);
    }
    KMeleon.RegisterCmd('clearformhistorycmnd', fhBundle.GetStringFromName('StatusbarMessage'), function () {
      FormHistory.update({
        op: 'remove'
      });
    }, '', function () {
      var count = 0;
      var done = false;
      FormHistory.count({}, {
        handleResult: function (result) {
          count = result;
        },
        handleError: function (error) {
          throw error;
        },
        handleCompletion: function (reason) {
          done = true;
        }
      });
      var timer = Cc['@mozilla.org/timer;1'].createInstance(Ci.nsITimer);
      timer.initWithCallback(function () {
        done = true;
      }, 1000, Ci.nsITimer.TYPE_ONE_SHOT);
      var thread = Cc['@mozilla.org/thread-manager;1'].getService().mainThread;
      while (!done) {
        thread.processNextEvent(true);
      }
      return count != 0;
    });
    KMeleon.SetMenu('&Clear Data', KMeleon.MENU_COMMAND, fhBundle.GetStringFromName('ClearFormHistory'), 'clearformhistorycmnd');
    KMeleon.SetMenu('&Clear Data', KMeleon.MENU_PLUGIN, 'bmpmenu()', 1);
  },
You need to add a new line on top of a file kmHelper.js:
Cu.import('resource://gre/modules/AddonManager.jsm');
Cu.import('resource://gre/modules/FileUtils.jsm'); // new line
Add a new line here:
case 'kmeleon-init':	
  this.updatePrefs();
  this.initAddon();  
  Services.obs.removeObserver(this, 'kmeleon-init');
  this.clearformhistory(); // new line
  break;
That's it. Good luck in coding.

Best regards



Edited 1 time(s). Last edit at 07/09/2015 08:58AM by adodupan.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: siria
Date: July 01, 2015 11:10AM

It's great if KM75 allows Firefox-addon developers to have their xpi-addons work in KM also without modifications.
And it's great if desga learns how to do this too, it may be useful in adapting FF addons for KM.

But so far I fail to see any real advantages when using this way for native KM functions too?

Frankly, whether creating new KM functions this way really is a lot easier to implement for KM developers, compared to creating a new command like "privacy(clearForms)" etc., I start doubting it when looking at the length and complicatedness of all that code... And if even desga can't do it without additional courses, it means we're still completely dependent on Dorian anyway to add new stuff. And for him it's probably not much different creating things either one way or the other.

For us USERS it makes a great difference though:
no one can use those new native functions in macros or for easily tinkering with own menus or buttons, if a KM macro/plugin command is missing. If those commands exist, even if most users don't know how to do things themselves, they can simply ask in the forum and get helped in many cases with tips and little user macros.

That's one of the main differences between KM and Firefox - if users fully depend on the grace of developers to customize individual things or not.

So am really mighty glad that Dorian keeps macrolanguage still alive, parallel to all those js improvements for XPI-developers, and he even improved macro possibilities in KM75 smiling smiley smiling smiley

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: rodocop
Date: July 01, 2015 03:09PM

I also think KM should have support for both own and FF's extension systems.

But here I see that point is in calling FF-inbuilt functions so jsbridge seems to be more 'right' way to do this.

It would be great if such a guru like adodupan will teach us for new tricks and techniques (and maybe will return to create new stuff for KM by himself)



Edited 1 time(s). Last edit at 07/01/2015 03:12PM by rodocop.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: desga2
Date: July 04, 2015 04:36PM

Hi, a new release available:
- Added adodupan's code to option "Clear Form History" to menu.
- Fixed Download Directory bug

Thanks to adodupan for help me and post the above code.

- Note for translators:
You need add locale translations for: \K-Meleon75\browser\omni.ja\chrome\en-US\locale\kmprefs\kmprefs\ovrl-history.properties

2 strings modified need translation to fix Download Directory bug:
\K-Meleon75\browser\omni.ja\chrome\en-US\locale\kmprefs\pref-filetypes.dtd
<!ENTITY download.useDownloadDir "Save the file to system default download folder">
<!ENTITY download.folder "Use this Download Folder:">


Greetings.

K-Meleon in Spanish

Attachments: omni_FormHistory_3.7z (8.5 KB)   FormHistory_3.jpg (82.9 KB)  
Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: siria
Date: July 04, 2015 05:23PM

And thanks to desga smiling smiley

For the german download texts I'd suggest

Save the file to system default download folder
Datei im System-Standardordner für Downloads speichern
(frankly I'd rather skip the system and just say 'default':
Datei im Standard-Ordner für Downloads speichern )

Use this Download Folder:
Diesen Download-Ordner benutzen:



Edited 1 time(s). Last edit at 07/04/2015 05:27PM by siria.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: rodocop
Date: July 05, 2015 01:22PM

desga,
sorry, but I cannot find new menu items for Clear Forms History.

That's all right with Preferences, but where is menu item?

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: desga2
Date: July 05, 2015 04:36PM

Quote
rodocop
desga,
sorry, but I cannot find new menu items for Clear Forms History.

That's all right with Preferences, but where is menu item?

You can found it with right click in "Clear Cache" privacy bar button (at the end of menu) or
Tools -> Privacy -> Clear Data -> Clear Form History


Greetings.

K-Meleon in Spanish

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: rodocop
Date: July 05, 2015 06:56PM

Yes, I understand that it SHOULD be there, but it ISN'T...

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: desga2
Date: July 07, 2015 02:27PM

@rodocop:

What Windows version are you using?


Greetings.

K-Meleon in Spanish

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: cfpp2p
Date: July 07, 2015 04:11PM

Quote
desga2
@rodocop:

What Windows version are you using?


Greetings.

Hi everyone.
Same here: Windows XP

OK in preferances, nothing at menu

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: desga2
Date: July 07, 2015 08:03PM

Works in my Windows 7, but seems this not work in Windows XP and Windows 8.
Could be some antivirus/firewall lock?

Please, can you try this?:

Quote
adodupan
When you update files, run km and paste code in error console for testing:
Components.utils.import('resource://gre/modules/Services.jsm');
Components.utils.import('resource://gre/modules/FileUtils.jsm');
Components.utils.import('resource://gre/modules/FormHistory.jsm');
const JSB = Components.classes['@kmeleon/jsbridge;1'].getService(Components.interfaces.nsIJSBridge);
const fhBundle = Services.strings.createBundle('chrome://kmprefs/locale/kmprefs/ovrl-history.properties');
if (!FileUtils.getFile('KAPlugins', ['privacy.dll']).exists() || !Services.prefs.getBoolPref('kmeleon.plugins.privacy.load')) {
   JSB.SetMenu('PrivateData', JSB.MENU_POPUP, fhBundle.GetStringFromName('ClearData'), '');
   JSB.SetMenu(fhBundle.GetStringFromName('Tools'), JSB.MENU_PLUGIN, 'bmpmenu()', 1);
}
JSB.RegisterCmd('clearformhistorycmnd', fhBundle.GetStringFromName('StatusbarMessage'), function () {
   FormHistory.update({op: 'remove'});
}, '', function () {
   var count = 0;
   var done = false;
   FormHistory.count({}, {
      handleResult: function (result) {
         count = result;
      },
      handleError: function (error) {
         throw error;
      },
      handleCompletion: function (reason) {
         done = true;
      }
   });
   var timer = Components.classes['@mozilla.org/timer;1'].createInstance(Components.interfaces.nsITimer);
   timer.initWithCallback(function () {
      done = true;
   }, 1000, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
   var thread = Components.classes['@mozilla.org/thread-manager;1'].getService().mainThread;
   while (!done) {
      thread.processNextEvent(true);
   }
   return count != 0;
});
JSB.SetMenu(fhBundle.GetStringFromName('ClearData'), JSB.MENU_COMMAND, fhBundle.GetStringFromName('ClearFormHistory'), 'clearformhistorycmnd');
JSB.SetMenu(fhBundle.GetStringFromName('ClearData'), JSB.MENU_PLUGIN, 'bmpmenu()', 1);


Greetings.

K-Meleon in Spanish

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: rodocop
Date: July 07, 2015 10:58PM

Tried on fresh install. It works fine.

Something wrong with some additions made by myself. My bad. Sorry.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: rodocop
Date: July 08, 2015 12:29AM

Also it works on problem installation with fresh profile.

But I had no luck when tried to clean used profile from all the caches so it will appear!

desga, could be so that your kmHelper works only for newly created profiles?

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: rodocop
Date: July 08, 2015 08:55AM

Finally, I found the reason.

Menu for Clear Form History appears only for english locale. After switching to, for example, russian one it gets translated,

but

disappears after KM restart!

And appears again if switch locale back to en-US and restart again.

In other words, menu is present ONLY if KM starts with default en-US locale.



Edited 1 time(s). Last edit at 07/08/2015 08:56AM by rodocop.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: desga2
Date: July 08, 2015 10:31AM

It's strange I have this problem in Windows 8 with en-US languaje.
I had to change to Spanish and after to en-US again to menu entry was showed after restart KM.

Code haven't dependence of KM profile, but this could fail if it's old profile without formhistory.sqlite file.

The problem with translation is possible that menu entry is created before translated proccess and it's lost in translation proccess after.

adodupan or Dorian could help us, it could be so simple than change the call to function from 'kmeleon-init' event listener to other after translation event.


Greetings.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 07/08/2015 10:31AM by desga2.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: rodocop
Date: July 08, 2015 10:37AM

I can guess that you have Español as default locale for your browser.

So we should change 'english' to 'default' in my statement.

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: adodupan
Date: July 08, 2015 11:02AM

Try this
kmHelper.js file:
  clearformhistory: function () {
    const fhBundle = Services.strings.createBundle('chrome://kmprefs/locale/kmprefs/ovrl-history.properties');
    if (!FileUtils.getFile('KAPlugins', ['privacy.dll']).exists() || !Services.prefs.getBoolPref('kmeleon.plugins.privacy.load')) {
//    KMeleon.SetMenu('PrivateData', KMeleon.MENU_POPUP, fhBundle.GetStringFromName('ClearData'), '');
      KMeleon.SetMenu('PrivateData', KMeleon.MENU_POPUP, '&Clear Data', '');
//    KMeleon.SetMenu(fhBundle.GetStringFromName('Tools'), KMeleon.MENU_PLUGIN, 'bmpmenu()', 1);
      KMeleon.SetMenu('&Tools', KMeleon.MENU_PLUGIN, 'bmpmenu()', 1);
    }
    KMeleon.RegisterCmd('clearformhistorycmnd', fhBundle.GetStringFromName('StatusbarMessage'), function () {
      FormHistory.update({
        op: 'remove'
      });
    }, '', function () {
      var count = 0;
      var done = false;
      FormHistory.count({}, {
        handleResult: function (result) {
          count = result;
        },
        handleError: function (error) {
          throw error;
        },
        handleCompletion: function (reason) {
          done = true;
        }
      });
      var timer = Cc['@mozilla.org/timer;1'].createInstance(Ci.nsITimer);
      timer.initWithCallback(function () {
        done = true;
      }, 1000, Ci.nsITimer.TYPE_ONE_SHOT);
      var thread = Cc['@mozilla.org/thread-manager;1'].getService().mainThread;
      while (!done) {
        thread.processNextEvent(true);
      }
      return count != 0;
    });
//  KMeleon.SetMenu(fhBundle.GetStringFromName('ClearData'), KMeleon.MENU_COMMAND, fhBundle.GetStringFromName('ClearFormHistory'), 'clearformhistorycmnd');
    KMeleon.SetMenu('&Clear Data', KMeleon.MENU_COMMAND, fhBundle.GetStringFromName('ClearFormHistory'), 'clearformhistorycmnd');
//  KMeleon.SetMenu(fhBundle.GetStringFromName('ClearData'), KMeleon.MENU_PLUGIN, 'bmpmenu()', 1);
    KMeleon.SetMenu('&Clear Data', KMeleon.MENU_PLUGIN, 'bmpmenu()', 1);
  },
ovrl-history.properties file:
# ClearData=&Clear Data
# Tools=&Tools
StatusbarMessage=Remove all Form History entries
ClearFormHistory=Clear &Form History


Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: cfpp2p
Date: July 08, 2015 06:44PM

with or without adodupan's latest patch as long as I start with a fresh profile all is OK. Otherwise Windows XP I couldn't see:

Tools -> Privacy -> Clear Data -> Clear Form History

Would be nice to have "Clear All" include Form History

Options: ReplyQuote
Re: Forms history options for Preference panel.
Posted by: desga2
Date: July 08, 2015 07:40PM

Similar problem here, I start KM with modified code in en-US and menu entry is not showed, change language to other and select en-US again. Restart KM and now menu entry is showed.

Is it possible need a rebuildmenu() function?

K-Meleon in Spanish



Edited 1 time(s). Last edit at 07/08/2015 07:56PM by desga2.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.