History-Problem

Baumann, Thomas baumann at valudo.de
Wed Jul 21 10:09:07 BST 2004


OK, hopefully last try....

Hi there,

I have problems implementing a history to my KHTML-based browser. I'm sorry
for posting so much code here, but I am not quite sure wheather this problem
is related to my wrong implementation of save-/restoreState, or any other
reason. It would be nice if one of you could have a look at it. One of you
should know how to implement a "KHistory" and could point me to the problem
quite quickly­.

I have got my own history-obejcts looking like this:

class HistoryItem {
   public:
      HistoryItem(KParts::BrowserExtension* sender = 0, const KURL url =
KURL(), const KParts::URLArgs urlArgs = KParts::URLArgs());
      KParts::BrowserExtension* sender();
      KURL url();
      KParts::URLArgs urlArgs();
      QByteArray state;
      ...
};

Everytime my BrowserExtension emits openURLNotify, the browser saves the
current state and url of the part like this:

// store state of browserExtension
HistoryItem* item = new HistoryItem(_myKHTML->browserExtension(),
_myKHTML->url(), _myKHTML->browserExtension()->urlArgs());
QDataStream stream(item->state, IO_WriteOnly);
item->sender()->saveState(stream);

Now, when I press the Back-Button, the method chooses the right HistoryItem.
I'm sure it is the right one, as it is the correct item->url() and the
correct index. But unfortunately, the part ALWAYS restores the previos site.

// restore state of browserExtension
QDataStream stream(item->state, IO_ReadOnly);
item->sender()->restoreState(stream);

I'm very much helpless now. I also had a look at the Konqueror-sources, of
course, but I cannot find anything different to my implementation. The only
thing I can see is, that Konqueror sends some kind of event using
sendOpenURLEvent() in KonqView after restoring the browserExtension-state.

As I am very tired of this problem now (spending hours of time), I'm asking
you guys.
Thanks a lot for this and any other problem I've asked this list so far!!!

Regards,
Thomas




More information about the kfm-devel mailing list