[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Howto invoke KPasswordDialog without having a KApplication
From:       bk <bk390934 () skynet ! be>
Date:       2003-09-13 22:41:02
[Download RAW message or body]

On Saturday 13 September 2003 19:22, Gav Wood wrote:
> On Saturday 13 September 2003 15:20, bk wrote:
> > I need to invoke KPasswordDialog from within a non-gui library which is
> > not "attached" to any KDE or Qt application.
> >
> > When I try to do this I get this on stderr:
> > "QPaintDevice: Must construct a QApplication before a QPaintDevice"
> >
> > Obviously I need a QApplication /  KApplication instance but in this case
> > I simply don't have any because it is part of a "KDE unaware library"
> > which in turn is not even used in a KDE application.
> >
> > What are my options?
>
> what i would do is rethink your design. either your program has a gui or
> not.
>
> if not, then at runtime the program should not require X running, never
> mind kde, so it should not depend on being able to use a KPasswordDialog,
> KDE, Qt or X at all.
>
> if you're sure that you need a gui for your application (a KPasswordDialog
> being all or part of that gui) then go ahead and create a KApplication
> object (perhaps temporarily, just while you need the dialog).
>
> afaik kde and qt are designed (and quite rightly so) that you cannot simply
> use a KPasswordDialog without first declaring that the application is to be
> a kde app with all the various resources available.
>
> the only other option is to create a command line kde app that requests a
> password and outputs it to std out for your non-kde app to catch. hardly
> elegant, but it could work.
>
> gav


Thanks for the advice but in reality I have to add 1 dialog box to an 
otherwise GUI-less library. It's very specific (a library to use a 
smartcard). Even when the library is called from non-KDE applications (e.g. 
Mozilla) in a KDE desktop it should display a native KDE dialog asking for a 
password (a PIN actually). I have no choice in the design. This is simply the 
way it is. It works fine with GTK but I'ld also like to have a Qt/KDE 
equivalent.

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic