D8056: Improve usability of "Open With" dialog by adding option to filter the application tree

David Faure noreply at phabricator.kde.org
Wed Nov 8 06:36:58 UTC 2017


dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> kopenwithdialog.cpp:463
>  
> -    if (d->appModel && !d->appModel->isDirectory(current)) {
> -        QString exec = d->appModel->execFor(current);
> +    QModelIndex sourceCurrent = static_cast<QTreeViewProxyFilter *>(model())->mapToSource(current);
> +

Use the member var instead of casting.

> kopenwithdialog.cpp:830
> +    //Update the filter regexp with the new text in the lineedit
> +    static_cast<QTreeViewProxyFilter *>(d->view->model())->setFilterFixedString(d->edit->text());
> +

Could the view have a method that returns the proxymodel (possibly as a QSortFilterProxyModel* if we don't actually need a subclass-typed pointer), to avoid this cast?
Such casts make refactoring more difficult, moving problems from compile-time to runtime.

> kopenwithdialog.cpp:1108
> +                }
> +                return false;
> +            }

All this "return false" cascade isn't really needed, a single return false at the end would do the job, or even better, calling the eventFilter method of the base class, just in case that's implemented for other reasons.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D8056

To: simgunz, dfaure, #frameworks, #vdg, ngraham, rkflx
Cc: rkflx, subdiff, fabianr, abetts, ngraham, alexeymin, #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20171108/8bc79d02/attachment.html>


More information about the Kde-frameworks-devel mailing list