← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~carlos-mazieri/ubuntu-filemanager-app/new-protocols-support-01 into lp:ubuntu-filemanager-app

 

Carlos Jose Mazieri has proposed merging lp:~carlos-mazieri/ubuntu-filemanager-app/new-protocols-support-01 into lp:ubuntu-filemanager-app.

Commit message:
Improved DirItemInfo and descendant classes:
* added DirItemInfo::setFile(const QString& newUrl) to change the current Item information
* fixed operator =

Requested reviews:
  Jenkins Bot (ubuntu-core-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/new-protocols-support-01/+merge/280387

This MP is compound of 5 parts.

Summary:
 Reduces the complexity to add support to new protocols in the File Manager.
 Improves the current Samba browsing by moving it into the secondary thread which makes it a little faster.
-- 
Your team Ubuntu File Manager Developers is requested to review the proposed merge of lp:~carlos-mazieri/ubuntu-filemanager-app/new-protocols-support-01 into lp:ubuntu-filemanager-app.
=== modified file 'src/plugin/folderlistmodel/diriteminfo.cpp'
--- src/plugin/folderlistmodel/diriteminfo.cpp	2015-09-20 20:44:29 +0000
+++ src/plugin/folderlistmodel/diriteminfo.cpp	2015-12-12 15:40:26 +0000
@@ -71,9 +71,9 @@
   ,_isExecutable(other._isExecutable)
   ,_isLocalSharedDir(other._isLocalSharedDir)
   ,_isHost(other._isHost)
-  ,_isWorkGroup(false)
-  ,_isNetworkShare(false)
-  ,_needsAuthentication(false)
+  ,_isWorkGroup(other._isWorkGroup)
+  ,_isNetworkShare(other._isNetworkShare)
+  ,_needsAuthentication(other._needsAuthentication)
   ,_permissions(other._permissions)
   ,_size(other._size)
   ,_created(other._created)
@@ -82,6 +82,7 @@
   ,_path(other._path)
   ,_fileName(other._fileName) 
   ,_normalizedPath(other._normalizedPath)
+  ,_authenticationPath(other._authenticationPath)
 {
 
 }
@@ -107,6 +108,7 @@
   ,_isNetworkShare(false)
   ,_needsAuthentication(false)
   ,_permissions(0)
+  ,_size(0)
 {
     setFileInfo(fi);
 }
@@ -326,6 +328,13 @@
    d_ptr->setFileInfo(f);
 }
 
+void DirItemInfo::setFile(const QString &fullname)
+{
+   QFileInfo f;
+   f.setFile(fullname);
+   d_ptr->setFileInfo(f);
+}
+
 QFileInfo DirItemInfo::diskFileInfo() const
 {
     QFileInfo fi(absoluteFilePath());
@@ -588,3 +597,8 @@
     d_ptr->_isReadable   = true;
     d_ptr->_isExecutable = true;
 }
+
+void DirItemInfo::setAsShare()
+{
+    d_ptr->_isNetworkShare = true;
+}

=== modified file 'src/plugin/folderlistmodel/diriteminfo.h'
--- src/plugin/folderlistmodel/diriteminfo.h	2015-09-13 14:20:30 +0000
+++ src/plugin/folderlistmodel/diriteminfo.h	2015-12-12 15:40:26 +0000
@@ -108,10 +108,12 @@
     virtual bool      isBrowsable() const;
     virtual bool      needsAuthentication() const;
     virtual QString   authenticationPath() const;
-    virtual void      setFile(const QString &dir, const QString & file);    
+    virtual void      setFile(const QString &dir, const QString & file);
+    virtual void      setFile(const QString &fullname);
     virtual bool      permission(QFile::Permissions permissions) const;
     void              fillFromStatBuf(const struct stat& statBuffer);
     void              setAsHost();
+    void              setAsShare();
 
 public:
     static QString    removeExtraSlashes(const QString &url, int firstSlashIndex = -1);

=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.cpp'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.cpp	2015-10-03 15:28:25 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.cpp	2015-12-12 15:40:26 +0000
@@ -136,21 +136,22 @@
         url.setPath(f.canonicalFilePath());
         smb_path = url.toString();
     }
-    smb_path += QDir::separator() + file;
+    if (!file.isEmpty())
+    {
+        smb_path += QDir::separator() + file;
+    }
     SmbItemInfo *other  = new SmbItemInfo( LocationUrl::SmbURL + DirItemInfo::removeExtraSlashes(smb_path),
                                            m_smb);
     if (other->isValid())
     {
         *this = *other;
     }
-    else
-    {
-        delete other;
-    }
+
+    delete other; //always delete
 }
 
-
-void SmbItemInfo::setAsShare()
+void SmbItemInfo::setFile(const QString &smb_path)
 {
-    d_ptr->_isNetworkShare = true;
+    return setFile(smb_path, QLatin1String(0));
 }
+

=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.h'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.h	2015-09-13 14:20:30 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.h	2015-12-12 15:40:26 +0000
@@ -40,9 +40,9 @@
     ~SmbItemInfo();
 
 public:
-    QString          sharePath() const;
-    void             setAsShare();  
+    QString          sharePath() const;   
     virtual void     setFile(const QString &dir, const QString & file);
+    virtual void     setFile(const QString &smb_path);
 
 protected:    
      void            setInfo(const QString &smb_path);

=== modified file 'src/plugin/folderlistmodel/urliteminfo.cpp'
--- src/plugin/folderlistmodel/urliteminfo.cpp	2015-09-07 20:32:36 +0000
+++ src/plugin/folderlistmodel/urliteminfo.cpp	2015-12-12 15:40:26 +0000
@@ -31,23 +31,25 @@
 UrlItemInfo::UrlItemInfo(const QString& urlPath, const QString& urlRoot):
      DirItemInfo()
 {
-    if (urlPath == urlRoot)
-    {
-        setRoot(urlPath);
-    }
-    else
-    {
-        if (!urlPath.startsWith(urlRoot))
+    if (!urlPath.isEmpty())
+    {
+        if (urlPath == urlRoot)
         {
-            d_ptr->_isValid    = false;
-            d_ptr->_isAbsolute = false;
+            setRoot(urlPath);
         }
         else
         {
-             init(urlPath);
+            if (!urlPath.startsWith(urlRoot))
+            {
+                d_ptr->_isValid    = false;
+                d_ptr->_isAbsolute = false;
+            }
+            else
+            {
+                init(urlPath);
+            }
         }
     }
-
 }