[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Qt Program ==> Silly KDE File Dialog Messages (Wheezy)

(Sorry - tried to keep this short, but ended up going on a bit ...)

I've begun to teach myself C++ (I'm an old Algol/Fortran/Cobol dev - don't laugh) so that I may one day provide useful programming effort to (Debian-)KDE bug resolution - this is on my spiffy Debian Wheezy KDE desktop workstation which works fine for all normal purposes.

Eventually I'll need to grapple with KDE frameworks, but I've started by writing a GUI program using QtCreator, and now I've got to the stage of reading and writing files, I've noticed some spurious error/warning messages getting logged to the console whenever I call a file open dialog (QFileDialog widget), thus:

  KGlobal::locale::Warning your global KLocale is being 
  recreated with a valid main component instead of a fake 
  component, this usually means you tried to call i18n 
  related functions before your main component was created. 
  You should not do that since it most likely will not work 

  kfilemodule(1427) KSambaSharePrivate::findSmbConf: 
  KSambaShare: Could not find smb.conf! 

Environment: Debian 7.8 / KDE 4.8.4 / Qt 4.8.2 / QtCreator 2.5.0 / i686 system (in a VM)

Googling reveals many others have seen these messages (e.g.[1]), and it's generally said to be something to do with inadequate KDE/Qt integration

The "KGlobal" error is apparently caused by calling a KDE utility dialog when full KDE application initialisation (specifically of the KDE internationalisation facilities) has not been done. Obviously I can't solve it by doing the KDE initialisation properly - this isn't a full KDE program.  I've discovered it can be eliminated by setting the option QFileDialog::DontUseNativeDialog on the call to QFileDialog, which causes the Qt file dialog to be used instead of the KDE one - this works, but the KDE one is much nicer :(

The "KSambaShare" error occurs on systems without Samba installed, and can apparently be eliminated by creating an empty smb.conf somewhere where it can be found (/etc ?), which seems a terrible hack - especially as this occurs as soon as the dialog appears, and nobody is even _trying_ to use Samba/CIFS/SMB at that point.

So I'm just wondering: does every other Qt developer see the same when running their programs on Debian KDE ?  If KDE file open dialogs are meant to be useful to Qt programs (and why else would QtCreator encourage their use), then this is surely a bug of some sort - but if so, the bug has existed for years and over multiple Qt/KDE releases. Is there a neat way to avoid the messages, or does everyone just put up with the dismal situation ?

Interestingly, if I run VLC (a Qt prog) from the command-line, I only get these messages:

  VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
  [0x88378f0] main libvlc: Running vlc with the default interface. 
  Use 'cvlc' to use vlc without interface.
  kfilemodule(28855) KSambaSharePrivate::findSmbConf: 
  KSambaShare: Could not find smb.conf! 

The KSambaShare message occurs when I do VLC 'File|Open', which uses a KDE file open dialog.

The KGlobal message doesn't occur at all, which must mean they've found a way to eliminate it - but I don't relish digging into their source code on a hunt for the magic method.

[1] http://www.qtcentre.org/threads/44049-KGlobal-locale-Warning-error
All clues gratefully received,
Nick Boyce
Coding is easy: All you do is sit staring at a terminal till 
the drops of blood start forming on your forehead.

Reply to: