[PATCH] KFileDialog overwrite confirmation

Rafael Fernández López ereslibre at kde.org
Mon Jul 14 01:24:24 BST 2008


Hi,

> Btw KAbstractFileWidget does not inherit QObject so i can't make it emitting
> signals. Can i make another class in the same files which emits the signal
> when called from KAbstractFileWidget? Or there is something prettier to do
> this?

OK, I didn't notice this. You are right.

Does this method needs to be virtual (as before said by others) ? If  
not, just add the implementation on KAbstractFileWidget too.

In the case it needs to be virtual, I guess you can do a workaround.  
We can forget the signal/slot thing for now. I would suggest adding a  
protected d pointer on KAbstractFileWidget, something like:

protected:
     KAbstractFileWidget::Private *d;

KAbstractFileWidget::Private is declared on "kabstractfilewiget_p.h",  
which contains the pure virtual method, that is called from your main  
call on KAbstractFileWidget, what means:

void KAbstractFileWidget::setConfirmOverwrite(bool enable)
{
     d->setConfirmOverwrite(enable);
}

 From all implementations you just have to make their d pointers to  
inherit this one that contains the pure virtual method, and  
reimplement them.

You can find an example about this on kdelibs/kdeui/jobs  
(kabstractwidgetjobtracker and kwidgetjobtracker).


Regards,
Rafael Fernández López.





More information about the kde-core-devel mailing list