D17697: Fix the list of file types in Kig "Open File" dialog

Tomaz Canabrava noreply at phabricator.kde.org
Mon Dec 24 13:03:34 GMT 2018


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

INLINE COMMENTS

> kig.cpp:221
>  
> -  const QString file_name = QFileDialog::getOpenFileName(0, QString(), currentDir,  m_mimeTypes.join( " " ) );
> -
> -  if (!file_name.isEmpty()) openUrl( QUrl::fromLocalFile( file_name ) );
> +  QPointer<QFileDialog> fileOpenDialog = new QFileDialog(this);
> +  fileOpenDialog->setWindowTitle(i18nc("@title:window", "Open File"));

I find this to ve a repeated pattern in your code:
1 - QPointer<Something> = new QType()
2 - Does nothing that's required for a QPointer
3 - Explicitly delete the pointer.

You should use QPointer if you are unsure that the pointer will be pointing to something as you can check .isNull() , 
if you need to delete the thing later, try to use QScopedPointer if you really *need* it to be on the heap
if you don't need it to be on the heap, just add it to stack.
This QFileDialog can be on the stack, I belive.

REPOSITORY
  R331 Kig

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

To: yurchor, #kde_edu, pino, tcanabrava
Cc: tcanabrava, aacid, cfeck, pino, apol, kde-edu, narvaez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20181224/e3d0e555/attachment.html>


More information about the kde-edu mailing list