Odyssey: know when user clicks USE or SAVE prefs button

3 posts / 0 new
Last post
jabirulo
jabirulo's picture
Offline
Last seen: 3 weeks 12 hours ago
Joined: 2013-05-30 00:53
Odyssey: know when user clicks USE or SAVE prefs button

Hi, I just added an entry in Odyssey beta kas1e and otehrs are updting fixing.

I have almost all gui/objects finsihed (bugs apart), and I implemented such new entry like oenctextmenu and mimetypes (as a separate ..classgroup, ..listclass), Working fine :-)
But alas the useragent list is a separate ASCII file where useragents are saved and need to know when user click on SAVE (or USE) buton to..well ,erm save new usergagent file :-)

putting some debug I get:
...
(USE)
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/appclass.cpp:2387 handleMM_OWBApp_PrefsSave] SaveENVARC=0x00000000
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:489 handleMUIM_Export] UserAgent EXPORT:
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:254 save_useragents] SAVing user-agents...
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:270 save_useragents] 'PROGDIR:Conf/useragents.prefs' FILE:
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:283 save_useragents] skipping built-in user-agents (1)
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/appclass.cpp:2393 handleMM_OWBApp_PrefsSave] prefs_update()
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:85 get_user_agent_strings] get_user_agent_strings() 0x57405a2c
...

(SAVE)
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/appclass.cpp:2387 handleMM_OWBApp_PrefsSave] SaveENVARC=0x00000001
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:489 handleMUIM_Export] UserAgent EXPORT:
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:254 save_useragents] SAVing user-agents...
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:270 save_useragents] 'PROGDIR:Conf/useragents.prefs' FILE:
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:283 save_useragents] skipping built-in user-agents (1)
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:489 handleMUIM_Export] UserAgent EXPORT:
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:254 save_useragents] SAVing user-agents...
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:270 save_useragents] 'PROGDIR:Conf/useragents.prefs' FILE:
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:283 save_useragents] skipping built-in user-agents (1)
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/appclass.cpp:2393 handleMM_OWBApp_PrefsSave] prefs_update()
[/amiga/Odyssey/odyssey-r155188-1.23/Source/WebKit/OrigynWebBrowser/Api/MorphOS/useragentgroupclass.cpp:85 get_user_agent_strings] get_user_agent_strings() 0x57405a2c
...

CONTINUES ON BELOW POST/REPLY..

jabirulo
jabirulo's picture
Offline
Last seen: 3 weeks 12 hours ago
Joined: 2013-05-30 00:53
Re: Odyssey know whne user click USE or SAVE prefs button

The (SAVE) performs a double EXPORT, 'cos 1st save to ENVARC: and then to ENV:

As you can "see" there is "SaveENVARC" variable that tels me if user clicked on USE or SAVE, but this check is on appclass.cpp source:
...

  1. DEFSMETHOD(OWBApp_PrefsSave)
  2. {
  3. GETDATA;
  4. D(bug("SaveENVARC=0x%08x\n",msg->SaveENVARC));
  5. if (msg->SaveENVARC)
  6. {
  7. DoMethod(obj, MUIM_Application_Save, APPLICATION_ENVARC_PREFS);
  8. }
  9. DoMethod(obj, MUIM_Application_Save, APPLICATION_ENV_PREFS);
  10. D(bug("prefs_update()\n"));
  11. prefs_update(obj, data);
  12.  
  13. return set(data->prefswin, MUIA_Window_Open, FALSE);
  14. }

and such metod then "calls" useragent EXPORT method (useragents.cpp):

  1. DEFMMETHOD(Export)
  2. {
  3. GETDATA;
  4. ULONG id;
  5. D(bug("UserAgent EXPORT (%d):\n",ua_savefile));
  6. if(id=(muiNotifyData(obj)->mnd_ObjectID)) // id = MAKE_ID('S','M','0','2')
  7. {
  8. //D(bug("id=0x%08x\n",id));
  9. save_useragents(obj, data);
  10. }
  11.  
  12. return 0;
  13. }

Is tehre a way I can get in EXPORT the "SaveENVARC" variable?
Or how to "pass" "SaveENVARC" to EXPORT so the I can check for such variable value.

My knowledge in MUI is very very basic, any help/tips will be helpfull. TiA

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

jabirulo
jabirulo's picture
Offline
Last seen: 3 weeks 12 hours ago
Joined: 2013-05-30 00:53
Re: Odyssey: know when user clicks USE or SAVE prefs button

aaaand think got the solution.

Just added a new method (MM_PrefsWindow_SaveUserAgents) to appclass.cpp, now it only saves when user clicks on SAVE button:

  1. DEFSMETHOD(OWBApp_PrefsSave)
  2. {
  3. GETDATA;
  4. D(bug("SaveENVARC=0x%08x\n",msg->SaveENVARC));
  5. if (msg->SaveENVARC)
  6. {
  7. DoMethod(data->prefswin, MM_PrefsWindow_SaveUserAgents); //SpoofUserAgent
  8.  
  9. DoMethod(obj, MUIM_Application_Save, APPLICATION_ENVARC_PREFS);
  10. }
  11. DoMethod(obj, MUIM_Application_Save, APPLICATION_ENV_PREFS);
  12. D(bug("prefs_update()\n"));
  13. prefs_update(obj, data);
  14.  
  15. return set(data->prefswin, MUIA_Window_Open, FALSE);
  16. }

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

Log in or register to post comments