Excerpts from Albert Astals Cid's message of 2015-03-08 23:41:20 +0100: > El Diumenge, 8 de març de 2015, a les 11:02:51, Stefano Crocco va escriure: > > Hello to everyone, > > I'm trying to port the User Agent Changer Konqueror plugin to KF5 (note that > > I'm not the original developer of the plugin), but I found a > > problem I can't understand and I'd need some help. > > > > For those unfamiliar, the UAChanger plugin displays a menu where the user > > can choose a fake user agent for a given web page or host. > > > > The problem I found is that the first time I change the UA, everything goes > > as expected. However, subsequent changes do nothing and restarting > > konqueror is needed to see them. > > > > What happens in the plugin is the following: > > > > - in response to the aboutToShow signal from the menu, the user agent of > > choiche for the current host is read using > > KProtocolManager::userAgentForHost (UAChangerPlugin::slotAboutToShow) > > - the user chooses a fake UA using the menu > > - the user's choice is stored in the config file .local/kio_httprc, in a > > group called as the host and an entry called UserAgent > > (UAChangerPlugin::slotItemSelected) > > - the KIO::Scheduler::emitReparseSlaveConfiguration method is called > > (UAChangerPlugin::reloadPage) > > - the document is reloaded (UAChangerPlugin::reload) > > > > It seems that everything goes correctly before reloading the document: the > > configuration file is correctly updated (I checked both using > > KConfigGroup::readEntry right after writing the setting and by looking at > > the contents of the file). However, this results in a change in the value > > returned by KProtocolManager::userAgentForHost only the first time the > > settings is changed: any other attemtp result in the same value being > > returned. > > > > I tried looking at the source code for KProtocolManager::userAgentForHost > > looking for clues, but I couldn't find anything suspicious. > > No expert but > > ./src/core/slaveconfig.cpp:199:MetaData SlaveConfig::configData(const QString > &protocol, const QString &host) > > Seems to be keeping a cache, that might explain the not changing, the same > code seems to be there in kdelibs though, does it work in konqueror based in > kdelibs4? > > Even if it does, i guess you should gdb-debug that part both in kdelibs4- > konqueror and in KF5-konqueror and see what's the difference. > > Cheers, > Akbert >
Thanks for the pointer. I'll look into it as soon as I have a bit of time. Stefano >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<