← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

Carlos Jose Mazieri has proposed merging lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-03 into lp:ubuntu-filemanager-app with lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-02 as a prerequisite.

Commit message:
Removed some QFileInfo dependency because it will not work for remote locations, using class Location instead.

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/samba-actions-03/+merge/265194

Replaced some disk access using Qt Objects by Location similar objects
-- 
Your team Ubuntu File Manager Developers is requested to review the proposed merge of lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-03 into lp:ubuntu-filemanager-app.
=== modified file 'src/plugin/folderlistmodel/dirmodel.cpp'
--- src/plugin/folderlistmodel/dirmodel.cpp	2015-07-18 21:32:12 +0000
+++ src/plugin/folderlistmodel/dirmodel.cpp	2015-07-18 21:32:12 +0000
@@ -1509,80 +1509,51 @@
 
 bool DirModel::existsDir(const QString &folderName) const
 {
-    DirItemInfo d(setParentIfRelative(folderName));
+    DirItemInfo d = setParentIfRelative(folderName);
     return d.exists() && d.isDir();
 }
 
 bool  DirModel::canReadDir(const QString &folderName) const
 {
-    DirItemInfo d(setParentIfRelative(folderName));
-    return canReadDir(d.diskFileInfo());
+    DirItemInfo d = setParentIfRelative(folderName);
+    return d.isDir() && d.isReadable();
 }
 
-bool  DirModel::canReadDir(const QFileInfo & d) const
-{
-    return d.exists() && d.isDir() && d.isReadable() && d.isExecutable();
-}
 
 bool DirModel::existsFile(const QString &fileName) const
 {
-     DirItemInfo f(setParentIfRelative(fileName));
+     DirItemInfo f = setParentIfRelative(fileName);
      return f.exists() && f.isFile();
 }
 
 bool DirModel::canReadFile(const QString &fileName) const
 {
-    DirItemInfo  f(setParentIfRelative(fileName));
-    return canReadFile(f.diskFileInfo());
-}
-
-bool DirModel::canReadFile(const QFileInfo &f) const
-{
-    return f.exists() && f.isFile() && f.isReadable();
-}
-
+    DirItemInfo  f = setParentIfRelative(fileName);
+    return f.isReadable() && f.isFile();
+}
 
 
 QDateTime DirModel::curPathCreatedDate() const
-{
-   QDateTime d;
-   QFileInfo f(mCurrentDir);
-   if (f.exists())
-   {
-       d = f.created();
-   }
-   return d;
+{  
+    return mCurLocation->currentInfo()->created();
 }
 
 
 QDateTime DirModel::curPathModifiedDate() const
 {
-    QDateTime d;
-    QFileInfo f(mCurrentDir);
-    if (f.exists())
-    {
-        d = f.lastModified();
-    }
-    return d;
+     return mCurLocation->currentInfo()->lastModified();
 }
 
 
 QDateTime DirModel::curPathAccessedDate() const
 {
-    QDateTime d;
-    QFileInfo f(mCurrentDir);
-    if (f.exists())
-    {
-        d = f.lastRead();
-    }
-    return d;
+    return mCurLocation->currentInfo()->lastRead();
 }
 
 
 bool  DirModel::curPathIsWritable() const
 {
-    QFileInfo f(mCurrentDir);
-    return f.exists() && f.isWritable();
+     return mCurLocation->currentInfo()->isWritable();
 }
 
 QString DirModel::curPathCreatedDateLocaleShort() const
@@ -1621,16 +1592,14 @@
 }
 
 
-QFileInfo  DirModel::setParentIfRelative(const QString &fileOrDir) const
+DirItemInfo  DirModel::setParentIfRelative(const QString &fileOrDir) const
 {
-    QFileInfo myFi(fileOrDir);
-    if (myFi.isRelative())
+    QScopedPointer<DirItemInfo> myFi(mCurLocation->newItemInfo(fileOrDir));
+    if (!myFi->isAbsolute())
     {
-        myFi.setFile(mCurrentDir, fileOrDir);
-        QFileInfo abs(myFi.absoluteFilePath());
-        myFi = abs;
+        myFi->setFile(mCurrentDir, fileOrDir);
     }
-    return myFi;
+    return *myFi;
 }
 
 

=== modified file 'src/plugin/folderlistmodel/dirmodel.h'
--- src/plugin/folderlistmodel/dirmodel.h	2015-03-14 19:07:13 +0000
+++ src/plugin/folderlistmodel/dirmodel.h	2015-07-18 21:32:12 +0000
@@ -475,10 +475,8 @@
     QDir::Filter  currentDirFilter()  const;
     QString       dirItems(const DirItemInfo& fi) const;
     bool          cdIntoItem(const DirItemInfo& fi);
-    bool          openItem(const DirItemInfo& fi);  
-    bool          canReadDir(const QFileInfo& d)   const;
-    bool          canReadFile(const QFileInfo& f)  const;
-    QFileInfo     setParentIfRelative(const QString &fileOrDir) const;
+    bool          openItem(const DirItemInfo& fi);     
+    DirItemInfo   setParentIfRelative(const QString &fileOrDir) const;
     void          setPathFromCurrentLocation();
 
 private: