Select a directory with KFileWidget?

Andreas Pakulat apaku at gmx.de
Sat Jan 10 11:10:10 GMT 2009


On 10.01.09 00:35:37, Andreas Pakulat wrote:
> On 09.01.09 22:14:48, Rafael Fernández López wrote:
> > Hi,
> >
> >> Does that make sense? I can probably come up with the patch...
> >
> > Yes, just look at KFile:: values. You can OR them, something like:
> >
> > fileWidget->setMode(KFile::Files | KFile::Directory);
> 
> Stupid me, of course :)
> 
> Unfortunately that doesn't work. I only get highlightFile for real files,
> not when clicking on a directory. Is this supposed to work?
> 
> I also don't get any fileSelected signal at all.
> 
> I guess I should start looking into the code myself :)

Done that, though I didn't dig too deep into the codebase. One thing that
annoys me about KFileWidget is that its not really been written with
embedding it "anywhere" in mind, its clearly geared towards embedding into
a KDialog as a filedialog. Not even easily usable in a wizard dialog.

Anyway, my "solution" for KDE4.2 code is simply finding the KDirOperator
and connecting its urlEntered signal, as well as using the locationEdit's
editTextChanged signal.  This way I get notified about any of the changes
in the dialog wrt.  switching to a different directory or selecting some
file. Which allows me to update my wizard state apropriately. 

For 4.3 it would be nice if we could expose the KDirOperator via a new
non-virtual access or KFileWidget. (As far as I understood
KAbstractFileWidget exists only so kio doesn't need to link against kfile,
as that would produce a circular dependency). The attached patch does that,
Rafael, David what do you think?

Andreas

-- 
You will be imprisoned for contributing your time and skill to a bank robbery.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kfilewidget_add_diroperator_accessor.diff
Type: text/x-diff
Size: 989 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090110/f42f2387/attachment.diff>


More information about the kde-core-devel mailing list