[Kget] Refactor transferhandler & transfergrouphandler?

Lukas Appelhans l.appelhans at gmx.de
Sun Aug 10 13:10:14 CEST 2008


Hey!
Am Freitag 08 August 2008 04:56:28 schrieb Ningyu Shi:
> Hi everybody,
>     I just fixed the bug which delete transfer causes crash. 
Great stuff!
>     During fixing
> that, I noticed the fucntion TransferTreeModel::isTransferGroup() is kind
> of inefficient which compares to all group pointers. After looking at class
> TransferHandler & TransferGroupHandler, I find the two share a lot of
> interfaces. So my suggestion is to have a Handler class which becomes the
> base class of TransferHandler & TransferGroupHandler with all those virtual
> functions as interfaces. Then we will save save pointer of Handler while
> creating index in the treemodel class. And
> TransferTreeModel::isTransferGroup() can be simply implemented as
>
> if (dynamic_cast<TransferGroupHandler*>)
>     return true;
>
> which seems to be better. I'm not sure about the other parts of the code,
> though. So what's ur opinion?
Well that Handler class looks good to me, but that dynamic_cast won't work. 
dynamic_cast never returns 0 but probably an invalid pointer...

Lukas


More information about the Kget mailing list