Avoid assert in kfileitem.cpp

By reloading a document (F5) with unsaved changes, one easily triggers:
ASSERT: "!d->m_url.isEmpty()" in file
/home/krf/devel/src/kdelibs/kio/kio/kfileitem.cpp, line 1662
Merge remote-tracking branch 'origin/1.7'
json: Improve test output
Improve output of PersistentSymbolTable::dump
Minor: Cleanup includes
json: 'identifiedTypeQid' -> 'identifiedTypeDeclartion'

We now just return the IdentifiedType's declaration. This makes this
function more generically useful
json: Introduce 'isDefinition' function
Make shell scripts portable and stable.

This patch makes provided scripts run on a generic Unix, and not only
on bash-enabled ones. Also, some concepts were changed to more correct
ones.

REVIEW: 119192
Merge branch '1.7'
Move ForegroundLock to util/

No need for it to be in interfaces/
Make it compile

.../kdevplatform/util/foregroundlock.cpp:60:
undefined reference to `pthread_mutex_trylock'
.../kdevplatform/util/foregroundlock.cpp:72:
undefined reference to `pthread_mutex_timedlock'
Make it possible to set an environment for a ParseJob.

This is then used to query env files on whether they need to be updated.
Will be used in kdev-clang.
Make it possible to keep the duchain data across TestFile destruction.

Useful for a unit test I'm writing in kdev-clang.