Make the synchronization between view and Terminal Panel less error-prone
Review Request #120768 - Created Oct. 23, 2014 and submitted
When the current directory of the Terminal Panel changes, we check if the new directory is equal to the view URL, and ignore the change if that is the case.
However, this can cause problems if the user navigates to a different URL in one view, and then activates another split view very quickly (or navigates to another URL very quickly, but it's more difficult to reproduce then).
To fix this problem, I propose to record a history of "cd" commands that Dolphin sends to the Terminal Panel in a queue. If a currentDirectoryChanged signal is received, and the new terminal directory is "dir", this patch does the following:
- If the queue is empty, change the view URL to "dir".
- Otherwise, take the queue's head, and check if it is equal to "dir". If that is the case, ignore the signal and return.
- Go back to step 1.
This ensures that every currentDirectoryChange signal that is caused by a "cd" that was sent from Dolphin to the terminal is ignored.
Fixes the problem for me. Synchronization between view and panel still works for me, and symbolic links are still handled correctly (see https://bugs.kde.org/show_bug.cgi?id=302037 ). Still, I think that master is the better target for this patch because I don't want to risk any regressions in 4.14.3 that we cannot fix any more in 4.14.x.