← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

Re: [Merge] lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-15 into lp:ubuntu-filemanager-app

 

Review: Approve

One diff comment

Diff comments:

> === modified file 'src/plugin/folderlistmodel/dirmodel.cpp'
> --- src/plugin/folderlistmodel/dirmodel.cpp	2015-07-19 16:40:43 +0000
> +++ src/plugin/folderlistmodel/dirmodel.cpp	2015-07-19 16:40:43 +0000
> @@ -642,22 +644,26 @@
>      return retval;
>  }
>  
> -void DirModel::mkdir(const QString &newDir)
> +
> +bool DirModel::mkdir(const QString &newDir)
>  {
> -    if (!allowAccess(mCurrentDir)) {
> -        qDebug() << Q_FUNC_INFO << "Access denied in current path" << mCurrentDir;
> -        return;
> -    }
> -
> -    QDir dir(mCurrentDir);
> -    bool retval = dir.mkdir(newDir);
> +    LocationItemDir *dir = mCurLocation->newDir(mCurrentDir);

Would be better to use QScopedPointer to ensure the object is deleted without having to manually call delete

> +    bool retval = dir->mkdir(newDir);
>      if (!retval) {
>          const char *errorStr = strerror(errno);
>          qDebug() << Q_FUNC_INFO << this << "Error creating new directory: " << errno << " (" << errorStr << ")";
>          emit error(QObject::tr("Error creating new folder"), errorStr);
>      } else {
> -        onItemAdded(dir.filePath(newDir));
> +        DirItemInfo *subItem = mCurLocation->newItemInfo(newDir);
> +        if (subItem->isRelative())
> +        {
> +            subItem->setFile(mCurrentDir, newDir);
> +        }
> +        onItemAdded(*subItem);
> +        delete subItem;
>      }
> +    delete dir;
> +    return retval;
>  }
>  
>  bool DirModel::showDirectories() const


-- 
https://code.launchpad.net/~carlos-mazieri/ubuntu-filemanager-app/samba-actions-15/+merge/265214
Your team Ubuntu File Manager Developers is subscribed to branch lp:ubuntu-filemanager-app.


References