The Famous com.trolltech.plist Problem

14th May 2011

The latest release of Smart Shooter has finally passed the Apple app store review! The previous attempt had been rejected by Apple, with the reason being:

2.30 Apps that do not comply with the Mac OS X File System documentation will be rejected

In particular the report stated that a rogue file was being created and that it was called:

~/Library/Preferences/com.trolltech.plist

I use the QSettings class in Smart Shooter, but it correctly writes to the com.hartcw.SmartShooter.plist file. This is because the strings are given to the Qt API:

QCoreApplication::setApplicationName("SmartShooter");
QCoreApplication::setOrganizationName("HartCodeworks");
QCoreApplication::setOrganizationDomain("hartcw.com");

After some investigation, and reading of QTBUG-16549, it turns out that the com.trolltech.plist config file is used by various Qt classes for storing persistent global variables. For example this happens when using the QFileDialog or QColorDialog classes (which affects Smart Shooter).

So it seems the solution is to either need to wait until Qt 4.8 is released (not really an option for me), or apply some patches to the Qt source code and rebuild…

I decided on the second option, and began looking at the Qt source code. My pragmatic solution was to simply force all plist files created internally by Qt to follow the filename as specified on the QCoreApplication. As Qt is hosted on gitorious, I first created my own clone of the git repository at http://gitorious.org/~francis/qt/qt-smartshooter.

You can see my change commit here: http://qt.gitorious.org/~francis/qt/qt-smartshooter/commit/503f775db468496907589c25c3080d30300090ff

Disclaimer

Yes this is not the correct and generalised solution to the Qt problem, but I will leave this up to the Qt development team! My fix is specifically targeted at the exact problem I encountered..


blog comments powered by Disqus