← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-07 into lp:ubuntu-filemanager-app

 

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

Commit message:
improved SmbUtil::findSmBServer()

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

For more details, see:
https://code.launchpad.net/~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-07/+merge/275832

improved SmbUtil::findSmBServer()
-- 
Your team Ubuntu File Manager Developers is requested to review the proposed merge of lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-07 into lp:ubuntu-filemanager-app.
=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp	2015-10-27 11:09:54 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp	2015-10-27 11:09:54 +0000
@@ -716,21 +716,25 @@
  */
 QString SmbUtil::findSmBServer(const smbc_dirent & dirent)
 {
-    QString host("localhost");
+    QString host;
     if (dirent.name[0] != 0)
     {
         QString name(dirent.name);
         host = name;
-        QString comment(dirent.comment);
-        if (!comment.isEmpty())
+    }
+    QString comment(dirent.comment);
+    if (!comment.isEmpty())
+    {
+        QString fullName = comment.split(QLatin1Char(' '), QString::SkipEmptyParts).first();
+        if (!fullName.isEmpty())
         {
-            QString fullName = comment.split(QLatin1Char(' '), QString::SkipEmptyParts).first();
-            if (!fullName.isEmpty() &&  fullName.startsWith(name), Qt::CaseSensitive)
-            {
-                host = fullName;
-            }
+            host = fullName;
         }
     }
+    if (host.isEmpty())
+    {
+        host = QLatin1String("localhost");
+    }
     return host.toLower();
 }
 


Follow ups