Samstag, 10. November 2007

KUrlNavigator on windows - or: Never try to fix a bug

While trying to fix a bug in kate I hit a lot of other problems. First it was not compilable (although it was not monday) because kdelibs wanted to have soprano 1.97.2. Then another bug in the cmake scripts hit me. Saro fixed this and I was happy to see if me fix for the bug was correct.

So I started kate, opened a file and... crash! Next start with debugger, kate asked me if I want to overwrite 'Default Session.katesession', I select yes but kate doesn't care and asks me again. After checking if the permissions are correct I decided to start another debugger and see what kio_file is doing. I ended up using an own implementation of FileProtocol::rename() for windows. Also moved out copy(), delete() and some other functions (think we should move all those functions into platform specific sources).

Now kate overwrites the file without asking me more than once and I can go further to see why the first crash happens. But this time it was an easy one. I forgot to install kdebase-runtime (wiped out complete kde4 installation before) and now KIconloader tried to add an empty QPixmap to (Q)KPixmapCache. Looks like nobody else did this before on windows because it simply can't work. Ok, added a hack, wrote a mail to qt-bugs and installed kdebase-runtime.

Started kate again and waited for the next crash. Out of curiosity there was none... opening a file worked like a charm. Ok, at least on the first sight ;)
Changed some things in KUrl and KUrlNavigator to fix problems because it's assumed everywhere that '/' is the one and only root path. Not that big problem and in the end I fixed my first bug from bugs.kde.org :)

While fighting with KUrlNavigator I saw that we can't change the drive - I can just open and save documents on the same drive like kate. Because having kate on every single drive isn't a good option I came to the conclusion that KUrlNavigator needs some tweaks for win32.
Now I wonder how you would like to have KUrlNavigator on windows. Here the screen shot from the native file open dialog:



As you can see there are two pseudo directories above the drives. I would like to add this to KUrlNavigator too - except you've a better idea how to select the drives. But keep in mind that we should use a similar approach like above to not confuse the users.