← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~carlos-mazieri/ubuntu-filemanager-app/samba-ui-06 into lp:ubuntu-filemanager-app

 

Carlos Jose Mazieri has proposed merging lp:~carlos-mazieri/ubuntu-filemanager-app/samba-ui-06 into lp:ubuntu-filemanager-app with lp:~carlos-mazieri/ubuntu-filemanager-app/samba-ui-05 as a prerequisite.

Commit message:
Fixed problems in the Authentication and using saved Password

Requested reviews:
  Ubuntu File Manager Developers (ubuntu-filemanager-dev)

For more details, see:
https://code.launchpad.net/~carlos-mazieri/ubuntu-filemanager-app/samba-ui-06/+merge/271738

Fixed problems in the Authentication and using saved Password
-- 
Your team Ubuntu File Manager Developers is requested to review the proposed merge of lp:~carlos-mazieri/ubuntu-filemanager-app/samba-ui-06 into lp:ubuntu-filemanager-app.
=== modified file 'src/plugin/folderlistmodel/diriteminfo.cpp'
--- src/plugin/folderlistmodel/diriteminfo.cpp	2015-09-19 16:16:16 +0000
+++ src/plugin/folderlistmodel/diriteminfo.cpp	2015-09-19 16:16:16 +0000
@@ -407,7 +407,7 @@
 
 QString DirItemInfo::authenticationPath() const
 {
-    return QLatin1String(0);
+    return  d_ptr->_authenticationPath;
 }
 
 

=== modified file 'src/plugin/folderlistmodel/diriteminfo.h'
--- src/plugin/folderlistmodel/diriteminfo.h	2015-09-19 16:16:16 +0000
+++ src/plugin/folderlistmodel/diriteminfo.h	2015-09-19 16:16:16 +0000
@@ -176,6 +176,7 @@
     QString   _path;
     QString   _fileName;
     QString   _normalizedPath;
+    QString   _authenticationPath;
 
     static QMimeDatabase mimeDatabase;
 };

=== modified file 'src/plugin/folderlistmodel/dirmodel.cpp'
--- src/plugin/folderlistmodel/dirmodel.cpp	2015-09-19 16:16:16 +0000
+++ src/plugin/folderlistmodel/dirmodel.cpp	2015-09-19 16:16:16 +0000
@@ -978,11 +978,24 @@
 bool  DirModel::cdIntoItem(const DirItemInfo &fi)
 {
     bool ret = false;
+    const DirItemInfo *item = &fi;
+    DirItemInfo *created_itemInfo = 0;
     if (fi.isBrowsable())
-    {
-        bool authentication = fi.needsAuthentication() &&
-                              !mCurLocation->useAuthenticationDataIfExists(fi);
-        if (authentication)
+    {              
+        bool needs_authentication = fi.needsAuthentication();
+        if (needs_authentication)
+        {
+           if (mCurLocation->useAuthenticationDataIfExists(fi))
+           {
+               //there is a password stored to try
+               created_itemInfo     = mCurLocation->newItemInfo(fi.urlPath());
+               item                 = created_itemInfo;
+               needs_authentication = item->needsAuthentication();
+           }
+        }
+        //item needs authentication and there is no user/password to try
+        // or there is a user/password already used but failed
+        if (needs_authentication)
         {
             mCurLocation->notifyItemNeedsAuthentication(&fi);
             //return true to avoid any error message to appear
@@ -990,15 +1003,23 @@
             ret = true;
         }
         else
-        {
-            if (fi.isContentReadable())
+        {                      
+            if (item->isContentReadable())
             {
-                mCurLocation->setInfoItem(fi);
+                mCurLocation->setInfoItem(*item);
                 setPathFromCurrentLocation();
                 ret = true;
             }
+            else
+            {
+                //some other error
+            }
         }
     }
+    if (created_itemInfo != 0)
+    {
+        delete created_itemInfo;
+    }
     return ret;
 }
 

=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.cpp'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.cpp	2015-07-13 20:41:48 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.cpp	2015-09-19 16:16:16 +0000
@@ -92,14 +92,11 @@
         break;
     }
     //all the information should be in place now
-    fillFromStatBuf(st);    
-}
-
-
-QString SmbItemInfo::authenticationPath() const
-{
-    return sharePath();
-}
+    fillFromStatBuf(st);
+    //set the field here to use on any DirItemInfo object
+    d_ptr->_authenticationPath = sharePath();
+}
+
 
 /*!
  * \brief SmbItemInfo::sharePath() returns the share part of the item

=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.h'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.h	2015-03-14 17:38:50 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.h	2015-09-19 16:16:16 +0000
@@ -41,8 +41,7 @@
 
 public:
     QString          sharePath() const;
-    void             setAsShare();
-    virtual QString  authenticationPath() const;
+    void             setAsShare();  
     virtual void     setFile(const QString &dir, const QString & file);
 
 protected:    


Follow ups