← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-02 into lp:ubuntu-filemanager-app

 

Carlos Jose Mazieri has proposed merging lp:~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-02 into lp:ubuntu-filemanager-app with lp:~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-01 as a prerequisite.

Commit message:
improved DiskLocation::isThereDiskSpace() to work for files even they do not exist.

Requested reviews:
  Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot): continuous-integration
  Ubuntu File Manager Developers (ubuntu-filemanager-dev)

For more details, see:
https://code.launchpad.net/~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-02/+merge/276445

improved DiskLocation::isThereDiskSpace() to work for files even they do not exist.
-- 
Your team Ubuntu File Manager Developers is requested to review the proposed merge of lp:~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-02 into lp:ubuntu-filemanager-app.
=== modified file 'src/plugin/folderlistmodel/disk/disklocation.cpp'
--- src/plugin/folderlistmodel/disk/disklocation.cpp	2015-07-15 17:42:37 +0000
+++ src/plugin/folderlistmodel/disk/disklocation.cpp	2015-11-02 19:17:36 +0000
@@ -216,8 +216,15 @@
 {
     bool ret = true;
 #if defined(Q_OS_UNIX)
+    QFileInfo info(pathname);
+    bool   pathExists = info.exists();
+    while (!pathExists && info.absoluteFilePath() != QDir::rootPath())
+    {
+        info.setFile(info.absolutePath());
+        pathExists = info.exists();
+    }
     struct statvfs  vfs;
-    if ( ::statvfs( QFile::encodeName(pathname).constData(), &vfs) == 0 )
+    if ( ::statvfs( QFile::encodeName(info.absoluteFilePath()).constData(), &vfs) == 0 )
     {
         qint64 free =  vfs.f_bsize * vfs.f_bfree;
         ret = free > requiredSize;