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

Proposed by Carlos Jose Mazieri on 2015-12-12
Status: Merged
Approved by: Nicholas Skaggs on 2016-01-14
Approved revision: 511
Merged at revision: 514
Proposed branch: lp:~carlos-mazieri/ubuntu-filemanager-app/new-protocols-support-01
Merge into: lp:ubuntu-filemanager-app
Diff against target: 163 lines (+44/-25)
5 files modified
src/plugin/folderlistmodel/diriteminfo.cpp (+17/-3)
src/plugin/folderlistmodel/diriteminfo.h (+3/-1)
src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.cpp (+9/-8)
src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.h (+2/-2)
src/plugin/folderlistmodel/urliteminfo.cpp (+13/-11)
To merge this branch: bzr merge lp:~carlos-mazieri/ubuntu-filemanager-app/new-protocols-support-01
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve on 2016-01-14
Arto Jalkanen 2015-12-12 Approve on 2016-01-10
Review via email: mp+280387@code.launchpad.net

Commit message

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

Description of the change

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.

To post a comment you must log in.
review: Approve (continuous-integration)
Arto Jalkanen (ajalkane) :
review: Approve

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/run-ap-tests-autolanding/9/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1409/console

review: Needs Fixing (continuous-integration)

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/run-ap-tests-autolanding/23/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1423/console

review: Needs Fixing (continuous-integration)

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/run-ap-tests-autolanding/24/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1424/console

review: Needs Fixing (continuous-integration)

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/run-ap-tests-autolanding/25/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1425/console

review: Needs Fixing (continuous-integration)

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/run-ap-tests-autolanding/38/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1441/console

review: Needs Fixing (continuous-integration)
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/plugin/folderlistmodel/diriteminfo.cpp'
2--- src/plugin/folderlistmodel/diriteminfo.cpp 2015-09-20 20:44:29 +0000
3+++ src/plugin/folderlistmodel/diriteminfo.cpp 2015-12-12 15:40:26 +0000
4@@ -71,9 +71,9 @@
5 ,_isExecutable(other._isExecutable)
6 ,_isLocalSharedDir(other._isLocalSharedDir)
7 ,_isHost(other._isHost)
8- ,_isWorkGroup(false)
9- ,_isNetworkShare(false)
10- ,_needsAuthentication(false)
11+ ,_isWorkGroup(other._isWorkGroup)
12+ ,_isNetworkShare(other._isNetworkShare)
13+ ,_needsAuthentication(other._needsAuthentication)
14 ,_permissions(other._permissions)
15 ,_size(other._size)
16 ,_created(other._created)
17@@ -82,6 +82,7 @@
18 ,_path(other._path)
19 ,_fileName(other._fileName)
20 ,_normalizedPath(other._normalizedPath)
21+ ,_authenticationPath(other._authenticationPath)
22 {
23
24 }
25@@ -107,6 +108,7 @@
26 ,_isNetworkShare(false)
27 ,_needsAuthentication(false)
28 ,_permissions(0)
29+ ,_size(0)
30 {
31 setFileInfo(fi);
32 }
33@@ -326,6 +328,13 @@
34 d_ptr->setFileInfo(f);
35 }
36
37+void DirItemInfo::setFile(const QString &fullname)
38+{
39+ QFileInfo f;
40+ f.setFile(fullname);
41+ d_ptr->setFileInfo(f);
42+}
43+
44 QFileInfo DirItemInfo::diskFileInfo() const
45 {
46 QFileInfo fi(absoluteFilePath());
47@@ -588,3 +597,8 @@
48 d_ptr->_isReadable = true;
49 d_ptr->_isExecutable = true;
50 }
51+
52+void DirItemInfo::setAsShare()
53+{
54+ d_ptr->_isNetworkShare = true;
55+}
56
57=== modified file 'src/plugin/folderlistmodel/diriteminfo.h'
58--- src/plugin/folderlistmodel/diriteminfo.h 2015-09-13 14:20:30 +0000
59+++ src/plugin/folderlistmodel/diriteminfo.h 2015-12-12 15:40:26 +0000
60@@ -108,10 +108,12 @@
61 virtual bool isBrowsable() const;
62 virtual bool needsAuthentication() const;
63 virtual QString authenticationPath() const;
64- virtual void setFile(const QString &dir, const QString & file);
65+ virtual void setFile(const QString &dir, const QString & file);
66+ virtual void setFile(const QString &fullname);
67 virtual bool permission(QFile::Permissions permissions) const;
68 void fillFromStatBuf(const struct stat& statBuffer);
69 void setAsHost();
70+ void setAsShare();
71
72 public:
73 static QString removeExtraSlashes(const QString &url, int firstSlashIndex = -1);
74
75=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.cpp'
76--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.cpp 2015-10-03 15:28:25 +0000
77+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.cpp 2015-12-12 15:40:26 +0000
78@@ -136,21 +136,22 @@
79 url.setPath(f.canonicalFilePath());
80 smb_path = url.toString();
81 }
82- smb_path += QDir::separator() + file;
83+ if (!file.isEmpty())
84+ {
85+ smb_path += QDir::separator() + file;
86+ }
87 SmbItemInfo *other = new SmbItemInfo( LocationUrl::SmbURL + DirItemInfo::removeExtraSlashes(smb_path),
88 m_smb);
89 if (other->isValid())
90 {
91 *this = *other;
92 }
93- else
94- {
95- delete other;
96- }
97+
98+ delete other; //always delete
99 }
100
101-
102-void SmbItemInfo::setAsShare()
103+void SmbItemInfo::setFile(const QString &smb_path)
104 {
105- d_ptr->_isNetworkShare = true;
106+ return setFile(smb_path, QLatin1String(0));
107 }
108+
109
110=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.h'
111--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.h 2015-09-13 14:20:30 +0000
112+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.h 2015-12-12 15:40:26 +0000
113@@ -40,9 +40,9 @@
114 ~SmbItemInfo();
115
116 public:
117- QString sharePath() const;
118- void setAsShare();
119+ QString sharePath() const;
120 virtual void setFile(const QString &dir, const QString & file);
121+ virtual void setFile(const QString &smb_path);
122
123 protected:
124 void setInfo(const QString &smb_path);
125
126=== modified file 'src/plugin/folderlistmodel/urliteminfo.cpp'
127--- src/plugin/folderlistmodel/urliteminfo.cpp 2015-09-07 20:32:36 +0000
128+++ src/plugin/folderlistmodel/urliteminfo.cpp 2015-12-12 15:40:26 +0000
129@@ -31,23 +31,25 @@
130 UrlItemInfo::UrlItemInfo(const QString& urlPath, const QString& urlRoot):
131 DirItemInfo()
132 {
133- if (urlPath == urlRoot)
134- {
135- setRoot(urlPath);
136- }
137- else
138- {
139- if (!urlPath.startsWith(urlRoot))
140+ if (!urlPath.isEmpty())
141+ {
142+ if (urlPath == urlRoot)
143 {
144- d_ptr->_isValid = false;
145- d_ptr->_isAbsolute = false;
146+ setRoot(urlPath);
147 }
148 else
149 {
150- init(urlPath);
151+ if (!urlPath.startsWith(urlRoot))
152+ {
153+ d_ptr->_isValid = false;
154+ d_ptr->_isAbsolute = false;
155+ }
156+ else
157+ {
158+ init(urlPath);
159+ }
160 }
161 }
162-
163 }
164
165

Subscribers

People subscribed via source and target branches