[Kget] Refactor transferhandler & transfergrouphandler?

Ningyu Shi shiningyu at gmail.com
Fri Aug 8 04:56:28 CEST 2008


Hi everybody,
    I just fixed the bug which delete transfer causes crash. 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?

Thanks
-- 
Ningyu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kget/attachments/20080807/fc948da5/attachment.html 


More information about the Kget mailing list