[Kget] Obviously the patch...

Pino Toscano toscano.pino at tiscali.it
Wed May 7 11:25:18 CEST 2008


Alle mercoledì 07 maggio 2008, FiNeX ha scritto:
> +    checkAllButton->setEnabled( (count == m_proxyModel->rowCount() ||
> m_proxyModel->rowCount() == 0 ) ? false : true );

const int modelRowCount = m_proxyModel->rowCount();
checkAllButton->setEnabled( !(!modelRowCount || count == modelRowCount ) );

> +    uncheckAllButton->setEnabled( ( count > 0 ) ? true : false );

uncheckAllButton->setEnabled( count > 0 );

> +    // TODO: escape user input for avoding malicious user input! (FiNEX)

see QRegExp::escape()

> +    kDebug() << "Applying filter " << filter; 
> +
> +    checkAllButton->setText((textFilter.isEmpty() && id ==
> KGetLinkView::NoFilter)
>                      ? i18n("Select all") : i18n("Select all filtered"));
> +    uncheckAllButton->setText((textFilter.isEmpty() && id ==
> KGetLinkView::NoFilter)
> +                    ? i18n("Deselect all") : i18n("Deselect all 
filtered"));

const bool isFiltered = textFilter.isEmpty() && id == KGetLinkView::NoFilter;
then use it..

> +void KGetLinkView::uncheckAll()
> +{
> +    QStandardItemModel *itemsModel = (QStandardItemModel *) 
m_proxyModel->sourceModel();

this is C++, so static_cast (or qobject_cast, in this case)

> +    for(int 
> row=0;row<m_proxyModel->rowCount();row++) {

style..

> +        QModelIndex index =
> m_proxyModel->mapToSource(m_proxyModel->index(row, 3)); 

const QModelIndex index ...

> +static const QString VIDEO_FILES_REGEXP = ...

it's not something added by your patch, but NEVER use static non-POD objects 
in libraries.
Please convert them to const char*, or at least as static class members.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kget/attachments/20080507/c943e068/attachment.pgp 


More information about the Kget mailing list