Merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-browsing-01 into lp:ubuntu-filemanager-app
- samba-browsing-01
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Arto Jalkanen |
Approved revision: | 387 |
Merged at revision: | 395 |
Proposed branch: | lp:~carlos-mazieri/ubuntu-filemanager-app/samba-browsing-01 |
Merge into: | lp:ubuntu-filemanager-app |
Diff against target: |
472 lines (+304/-13) 4 files modified
src/plugin/folderlistmodel/diriteminfo.cpp (+246/-1) src/plugin/folderlistmodel/diriteminfo.h (+22/-4) src/plugin/folderlistmodel/dirmodel.cpp (+31/-8) src/plugin/folderlistmodel/dirmodel.h (+5/-0) |
To merge this branch: | bzr merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-browsing-01 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Arto Jalkanen | Approve | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+252216@code.launchpad.net |
Commit message
Class DirItemInfo which represents items being shown receives more attributes suitable for network like: DirItemInfo:
Description of the change
This starts a series of MPs that provides samba browsing in the filemanager plugin.
There will be some samba-browsing-nn MPs until a samba-browsing-
These changes provide browsing only, the development for samba Actions (copy/cut/pate, remove) will start next.
MPs from 01 to 03 are introduce new "Item Properties" and some refactoring to allow others network protocols be easily implemented.
Class DirItemInfo which represents items being shown receives more attributes suitable for network like: DirItemInfo:
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Arto Jalkanen (ajalkane) wrote : | # |
Please fix the few issues I inlined in comments.
Carlos Jose Mazieri (carlos-mazieri) wrote : | # |
Thanks, I will fix that.
- 387. By Carlos Jose Mazieri
-
Fixed DirItemInfo:
:removeExtraSla shes() using now QString: :indexOf( QLatin1String( ":/") to prevent common files using ':' in the names
Fixed documentation from DirItemInfo::fillFromStatBu f()
Expanded some if without space as "if(" to "if (" in class DirModel
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:387
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Arto Jalkanen (ajalkane) : | # |
Preview Diff
1 | === modified file 'src/plugin/folderlistmodel/diriteminfo.cpp' | |||
2 | --- src/plugin/folderlistmodel/diriteminfo.cpp 2014-05-09 21:03:22 +0000 | |||
3 | +++ src/plugin/folderlistmodel/diriteminfo.cpp 2015-03-16 21:40:07 +0000 | |||
4 | @@ -20,6 +20,8 @@ | |||
5 | 20 | */ | 20 | */ |
6 | 21 | 21 | ||
7 | 22 | #include "diriteminfo.h" | 22 | #include "diriteminfo.h" |
8 | 23 | #include <sys/types.h> | ||
9 | 24 | #include <sys/stat.h> | ||
10 | 23 | 25 | ||
11 | 24 | 26 | ||
12 | 25 | QMimeDatabase DirItemInfoPrivate::mimeDatabase; | 27 | QMimeDatabase DirItemInfoPrivate::mimeDatabase; |
13 | @@ -32,12 +34,18 @@ | |||
14 | 32 | ,_isSelected(false) | 34 | ,_isSelected(false) |
15 | 33 | ,_isAbsolute(false) | 35 | ,_isAbsolute(false) |
16 | 34 | ,_exists(false) | 36 | ,_exists(false) |
17 | 37 | ,_isFile(false) | ||
18 | 35 | ,_isDir(false) | 38 | ,_isDir(false) |
19 | 36 | ,_isSymLink(false) | 39 | ,_isSymLink(false) |
20 | 37 | ,_isRoot(false) | 40 | ,_isRoot(false) |
21 | 38 | ,_isReadable(false) | 41 | ,_isReadable(false) |
22 | 39 | ,_isWritable(false) | 42 | ,_isWritable(false) |
23 | 40 | ,_isExecutable(false) | 43 | ,_isExecutable(false) |
24 | 44 | ,_isLocalSharedDir(false) | ||
25 | 45 | ,_isHost(false) | ||
26 | 46 | ,_isWorkGroup(false) | ||
27 | 47 | ,_isNetworkShare(false) | ||
28 | 48 | ,_needsAuthentication(false) | ||
29 | 41 | ,_permissions(0) | 49 | ,_permissions(0) |
30 | 42 | ,_size(0) | 50 | ,_size(0) |
31 | 43 | { | 51 | { |
32 | @@ -53,19 +61,26 @@ | |||
33 | 53 | ,_isSelected(other._isSelected) | 61 | ,_isSelected(other._isSelected) |
34 | 54 | ,_isAbsolute(other._isAbsolute) | 62 | ,_isAbsolute(other._isAbsolute) |
35 | 55 | ,_exists(other._exists) | 63 | ,_exists(other._exists) |
36 | 64 | ,_isFile(other._isFile) | ||
37 | 56 | ,_isDir(other._isDir) | 65 | ,_isDir(other._isDir) |
38 | 57 | ,_isSymLink(other._isSymLink) | 66 | ,_isSymLink(other._isSymLink) |
39 | 58 | ,_isRoot(other._isRoot) | 67 | ,_isRoot(other._isRoot) |
40 | 59 | ,_isReadable(other._isReadable) | 68 | ,_isReadable(other._isReadable) |
41 | 60 | ,_isWritable(other._isWritable) | 69 | ,_isWritable(other._isWritable) |
42 | 61 | ,_isExecutable(other._isExecutable) | 70 | ,_isExecutable(other._isExecutable) |
43 | 71 | ,_isLocalSharedDir(other._isLocalSharedDir) | ||
44 | 72 | ,_isHost(other._isHost) | ||
45 | 73 | ,_isWorkGroup(false) | ||
46 | 74 | ,_isNetworkShare(false) | ||
47 | 75 | ,_needsAuthentication(false) | ||
48 | 62 | ,_permissions(other._permissions) | 76 | ,_permissions(other._permissions) |
49 | 63 | ,_size(other._size) | 77 | ,_size(other._size) |
50 | 64 | ,_created(other._created) | 78 | ,_created(other._created) |
51 | 65 | ,_lastModified(other._lastModified) | 79 | ,_lastModified(other._lastModified) |
52 | 66 | ,_lastRead(other._lastRead) | 80 | ,_lastRead(other._lastRead) |
53 | 67 | ,_path(other._path) | 81 | ,_path(other._path) |
55 | 68 | ,_fileName(other._fileName) | 82 | ,_fileName(other._fileName) |
56 | 83 | ,_normalizedPath(other._normalizedPath) | ||
57 | 69 | { | 84 | { |
58 | 70 | 85 | ||
59 | 71 | } | 86 | } |
60 | @@ -76,6 +91,21 @@ | |||
61 | 76 | ,_isLocal(true) | 91 | ,_isLocal(true) |
62 | 77 | ,_isRemote(false) | 92 | ,_isRemote(false) |
63 | 78 | ,_isSelected(false) | 93 | ,_isSelected(false) |
64 | 94 | ,_isAbsolute(false) | ||
65 | 95 | ,_exists(false) | ||
66 | 96 | ,_isFile(false) | ||
67 | 97 | ,_isDir(false) | ||
68 | 98 | ,_isSymLink(false) | ||
69 | 99 | ,_isRoot(false) | ||
70 | 100 | ,_isReadable(false) | ||
71 | 101 | ,_isWritable(false) | ||
72 | 102 | ,_isExecutable(false) | ||
73 | 103 | ,_isLocalSharedDir(false) | ||
74 | 104 | ,_isHost(false) | ||
75 | 105 | ,_isWorkGroup(false) | ||
76 | 106 | ,_isNetworkShare(false) | ||
77 | 107 | ,_needsAuthentication(false) | ||
78 | 108 | ,_permissions(0) | ||
79 | 79 | { | 109 | { |
80 | 80 | setFileInfo(fi); | 110 | setFileInfo(fi); |
81 | 81 | } | 111 | } |
82 | @@ -333,3 +363,218 @@ | |||
83 | 333 | filepath += d_ptr->_fileName; | 363 | filepath += d_ptr->_fileName; |
84 | 334 | return filepath; | 364 | return filepath; |
85 | 335 | } | 365 | } |
86 | 366 | |||
87 | 367 | bool DirItemInfo::permission(QFileDevice::Permissions permissions) const | ||
88 | 368 | { | ||
89 | 369 | return (d_ptr->_permissions & permissions) == permissions; | ||
90 | 370 | } | ||
91 | 371 | |||
92 | 372 | bool DirItemInfo::isSharedDir() const | ||
93 | 373 | { | ||
94 | 374 | return d_ptr->_isLocalSharedDir; | ||
95 | 375 | } | ||
96 | 376 | |||
97 | 377 | bool DirItemInfo::isHost() const | ||
98 | 378 | { | ||
99 | 379 | return d_ptr->_isHost; | ||
100 | 380 | } | ||
101 | 381 | |||
102 | 382 | |||
103 | 383 | bool DirItemInfo::isWorkGroup() const | ||
104 | 384 | { | ||
105 | 385 | return d_ptr->_isWorkGroup; | ||
106 | 386 | } | ||
107 | 387 | |||
108 | 388 | bool DirItemInfo::isShare() const | ||
109 | 389 | { | ||
110 | 390 | return d_ptr->_isNetworkShare; | ||
111 | 391 | } | ||
112 | 392 | |||
113 | 393 | /*! | ||
114 | 394 | * \brief DirItemInfo::isBrowsable() considers browsable items that can hold a list of items | ||
115 | 395 | * \return | ||
116 | 396 | */ | ||
117 | 397 | bool DirItemInfo::isBrowsable() const | ||
118 | 398 | { | ||
119 | 399 | return isDir() || isHost() || isShare() || isWorkGroup(); | ||
120 | 400 | } | ||
121 | 401 | |||
122 | 402 | bool DirItemInfo::needsAuthentication() const | ||
123 | 403 | { | ||
124 | 404 | return d_ptr->_needsAuthentication; | ||
125 | 405 | } | ||
126 | 406 | |||
127 | 407 | QString DirItemInfo::authenticationPath() const | ||
128 | 408 | { | ||
129 | 409 | return QLatin1String(0); | ||
130 | 410 | } | ||
131 | 411 | |||
132 | 412 | |||
133 | 413 | /*! | ||
134 | 414 | * \brief DirItemInfo::fillFromStatBuf() This was copied from \ref QFileSystemMetaData::fillFromStatBuf() | ||
135 | 415 | * \param statBuffer | ||
136 | 416 | */ | ||
137 | 417 | void DirItemInfo::fillFromStatBuf(const struct stat & statBuffer) | ||
138 | 418 | { | ||
139 | 419 | #define LinkType 0x00010000 | ||
140 | 420 | #define FileType 0x00020000 | ||
141 | 421 | #define DirectoryType 0x00040000 | ||
142 | 422 | #define SequentialType 0x00800000 | ||
143 | 423 | |||
144 | 424 | //size | ||
145 | 425 | d_ptr->_size = statBuffer.st_size; | ||
146 | 426 | //times | ||
147 | 427 | d_ptr->_lastModified = statBuffer.st_mtime ? | ||
148 | 428 | QDateTime::fromTime_t(statBuffer.st_mtime) : | ||
149 | 429 | QDateTime(QDate(), QTime()); | ||
150 | 430 | d_ptr->_created = statBuffer.st_ctime ? | ||
151 | 431 | QDateTime::fromTime_t(statBuffer.st_ctime) : | ||
152 | 432 | d_ptr->_lastModified ; | ||
153 | 433 | d_ptr->_lastRead = statBuffer.st_atime ? | ||
154 | 434 | QDateTime::fromTime_t(statBuffer.st_atime) : | ||
155 | 435 | d_ptr->_lastModified; | ||
156 | 436 | |||
157 | 437 | /* | ||
158 | 438 | //user, group | ||
159 | 439 | userId_ = statBuffer.st_uid; | ||
160 | 440 | groupId_ = statBuffer.st_gid; | ||
161 | 441 | */ | ||
162 | 442 | |||
163 | 443 | /* | ||
164 | 444 | * When handling filesystems other than local (e.g. any network) | ||
165 | 445 | * Permissions are relative to the user being used to access the resource | ||
166 | 446 | * | ||
167 | 447 | * So it is necessary to qualify the user accessing the resource as | ||
168 | 448 | * owner / belongs to group or / others | ||
169 | 449 | */ | ||
170 | 450 | // quint32 userMatches = 0; | ||
171 | 451 | QFile::Permissions readPermission = 0; | ||
172 | 452 | QFile::Permissions writePermission = 0; | ||
173 | 453 | QFile::Permissions execPermission = 0; | ||
174 | 454 | |||
175 | 455 | |||
176 | 456 | //owner permissions | ||
177 | 457 | if (statBuffer.st_mode & S_IRUSR) | ||
178 | 458 | { | ||
179 | 459 | readPermission |= QFile::ReadOwner; | ||
180 | 460 | } | ||
181 | 461 | if (statBuffer.st_mode & S_IWUSR) | ||
182 | 462 | { | ||
183 | 463 | writePermission |= QFile::WriteOwner; | ||
184 | 464 | } | ||
185 | 465 | if (statBuffer.st_mode & S_IXUSR) | ||
186 | 466 | { | ||
187 | 467 | execPermission |= QFile::ExeOwner; | ||
188 | 468 | } | ||
189 | 469 | //group permissions | ||
190 | 470 | if (statBuffer.st_mode & S_IRGRP) | ||
191 | 471 | { | ||
192 | 472 | readPermission |= QFile::ReadGroup; | ||
193 | 473 | } | ||
194 | 474 | if (statBuffer.st_mode & S_IWGRP) | ||
195 | 475 | { | ||
196 | 476 | writePermission |= QFile::WriteGroup; | ||
197 | 477 | } | ||
198 | 478 | if (statBuffer.st_mode & S_IXGRP) | ||
199 | 479 | { | ||
200 | 480 | execPermission |= QFile::ExeGroup; | ||
201 | 481 | } | ||
202 | 482 | //other permissions | ||
203 | 483 | if (statBuffer.st_mode & S_IROTH) | ||
204 | 484 | { | ||
205 | 485 | readPermission |= QFile::ReadOther; | ||
206 | 486 | } | ||
207 | 487 | if (statBuffer.st_mode & S_IWOTH) | ||
208 | 488 | { | ||
209 | 489 | writePermission |= QFile::WriteOther; | ||
210 | 490 | } | ||
211 | 491 | if (statBuffer.st_mode & S_IXOTH) | ||
212 | 492 | { | ||
213 | 493 | execPermission |= QFile::ExeOther; | ||
214 | 494 | } | ||
215 | 495 | |||
216 | 496 | /* | ||
217 | 497 | * Permissions are relative to a remote user | ||
218 | 498 | * it was necessary to be the user being accessing the file | ||
219 | 499 | */ | ||
220 | 500 | if (readPermission) | ||
221 | 501 | { | ||
222 | 502 | d_ptr->_isReadable = true; | ||
223 | 503 | } | ||
224 | 504 | if (writePermission) | ||
225 | 505 | { | ||
226 | 506 | d_ptr->_isWritable = true; | ||
227 | 507 | } | ||
228 | 508 | if (execPermission) | ||
229 | 509 | { | ||
230 | 510 | d_ptr->_isExecutable = true; | ||
231 | 511 | } | ||
232 | 512 | |||
233 | 513 | //set full permissions flag | ||
234 | 514 | d_ptr->_permissions = readPermission | writePermission | execPermission; | ||
235 | 515 | |||
236 | 516 | // Type | ||
237 | 517 | if ((statBuffer.st_mode & S_IFMT) == S_IFREG) | ||
238 | 518 | { | ||
239 | 519 | // d_ptr->_permissions |= FileType; | ||
240 | 520 | d_ptr->_isFile = true; | ||
241 | 521 | } | ||
242 | 522 | else if ((statBuffer.st_mode & S_IFMT) == S_IFDIR) | ||
243 | 523 | { | ||
244 | 524 | // d_ptr->_permissions |= DirectoryType; | ||
245 | 525 | d_ptr->_isDir = true; | ||
246 | 526 | } | ||
247 | 527 | else | ||
248 | 528 | { | ||
249 | 529 | // d_ptr->_permissions |= SequentialType; | ||
250 | 530 | } | ||
251 | 531 | } | ||
252 | 532 | |||
253 | 533 | |||
254 | 534 | |||
255 | 535 | QString DirItemInfo::removeExtraSlashes(const QString &url, int firstSlashIndex) | ||
256 | 536 | { | ||
257 | 537 | QString ret; | ||
258 | 538 | if (firstSlashIndex == -1) | ||
259 | 539 | { | ||
260 | 540 | firstSlashIndex = url.indexOf(QLatin1String(":/")); | ||
261 | 541 | if (firstSlashIndex != -1) | ||
262 | 542 | { | ||
263 | 543 | ++firstSlashIndex; | ||
264 | 544 | } | ||
265 | 545 | else | ||
266 | 546 | { | ||
267 | 547 | firstSlashIndex = -1; | ||
268 | 548 | } | ||
269 | 549 | } | ||
270 | 550 | if (firstSlashIndex >=0) | ||
271 | 551 | { | ||
272 | 552 | while ( firstSlashIndex < url.length() && url.at(firstSlashIndex) == QDir::separator()) | ||
273 | 553 | { | ||
274 | 554 | ++firstSlashIndex; | ||
275 | 555 | } | ||
276 | 556 | if (firstSlashIndex < url.length()) | ||
277 | 557 | { | ||
278 | 558 | ret = url.mid(firstSlashIndex); | ||
279 | 559 | } | ||
280 | 560 | } | ||
281 | 561 | else | ||
282 | 562 | { | ||
283 | 563 | ret = url; | ||
284 | 564 | firstSlashIndex = -1; | ||
285 | 565 | } | ||
286 | 566 | if (firstSlashIndex >= 0 && ret.endsWith(QDir::separator())) | ||
287 | 567 | { | ||
288 | 568 | ret.chop(1); | ||
289 | 569 | } | ||
290 | 570 | //replace any double slashes by just one | ||
291 | 571 | for(int charCounter = ret.size() -1; charCounter > 0; --charCounter) | ||
292 | 572 | { | ||
293 | 573 | if (ret.at(charCounter) == QDir::separator() && | ||
294 | 574 | ret.at(charCounter-1) == QDir::separator()) | ||
295 | 575 | { | ||
296 | 576 | ret.remove(charCounter,1); | ||
297 | 577 | } | ||
298 | 578 | } | ||
299 | 579 | return ret; | ||
300 | 580 | } | ||
301 | 336 | 581 | ||
302 | === modified file 'src/plugin/folderlistmodel/diriteminfo.h' | |||
303 | --- src/plugin/folderlistmodel/diriteminfo.h 2014-05-18 18:09:04 +0000 | |||
304 | +++ src/plugin/folderlistmodel/diriteminfo.h 2015-03-16 21:40:07 +0000 | |||
305 | @@ -101,16 +101,26 @@ | |||
306 | 101 | virtual QDateTime lastModified() const; | 101 | virtual QDateTime lastModified() const; |
307 | 102 | virtual QDateTime lastRead() const; | 102 | virtual QDateTime lastRead() const; |
308 | 103 | virtual QMimeType mimeType() const; | 103 | virtual QMimeType mimeType() const; |
309 | 104 | virtual bool isHost() const; | ||
310 | 105 | virtual bool isSharedDir() const; | ||
311 | 106 | virtual bool isWorkGroup() const; | ||
312 | 107 | virtual bool isShare() const; | ||
313 | 108 | virtual bool isBrowsable() const; | ||
314 | 109 | virtual bool needsAuthentication() const; | ||
315 | 110 | virtual QString authenticationPath() const; | ||
316 | 111 | virtual void setFile(const QString &dir, const QString & file); | ||
317 | 112 | virtual bool permission(QFile::Permissions permissions) const; | ||
318 | 113 | void fillFromStatBuf(const struct stat& statBuffer); | ||
319 | 104 | 114 | ||
321 | 105 | virtual void setFile(const QString &dir, const QString & file); | 115 | public: |
322 | 116 | static QString removeExtraSlashes(const QString &url, int firstSlashIndex = -1); | ||
323 | 106 | 117 | ||
324 | 107 | #if 0 | 118 | #if 0 |
325 | 108 | virtual QString path() const; | 119 | virtual QString path() const; |
326 | 109 | virtual QString owner() const; | 120 | virtual QString owner() const; |
327 | 110 | virtual uint ownerId() const; | 121 | virtual uint ownerId() const; |
328 | 111 | virtual QString group() const; | 122 | virtual QString group() const; |
331 | 112 | virtual uint groupId() const; | 123 | virtual uint groupId() const; |
330 | 113 | virtual bool permission(QFile::Permissions permissions) const; | ||
332 | 114 | #endif | 124 | #endif |
333 | 115 | 125 | ||
334 | 116 | protected: | 126 | protected: |
335 | @@ -149,7 +159,14 @@ | |||
336 | 149 | bool _isRoot :1; | 159 | bool _isRoot :1; |
337 | 150 | bool _isReadable :1; | 160 | bool _isReadable :1; |
338 | 151 | bool _isWritable :1; | 161 | bool _isWritable :1; |
340 | 152 | bool _isExecutable:1; | 162 | bool _isExecutable:1; |
341 | 163 | bool _isLocalSharedDir :1; //!< the directory in the local disk is shared folder (perhaps using Samba) | ||
342 | 164 | bool _isHost :1; //!< the item points to a host like fish://localhost, smb://10.10.200.1, etc. | ||
343 | 165 | bool _isWorkGroup :1; //!< specific to Samba | ||
344 | 166 | bool _isNetworkShare :1; //!< samba share (entry point) | ||
345 | 167 | bool _needsAuthentication:1;//!< the url may require authentication do access | ||
346 | 168 | |||
347 | 169 | |||
348 | 153 | QFile::Permissions _permissions; | 170 | QFile::Permissions _permissions; |
349 | 154 | qint64 _size; | 171 | qint64 _size; |
350 | 155 | QDateTime _created; | 172 | QDateTime _created; |
351 | @@ -158,6 +175,7 @@ | |||
352 | 158 | QString _path; | 175 | QString _path; |
353 | 159 | QString _fileName; | 176 | QString _fileName; |
354 | 160 | QString _normalizedPath; | 177 | QString _normalizedPath; |
355 | 178 | |||
356 | 161 | static QMimeDatabase mimeDatabase; | 179 | static QMimeDatabase mimeDatabase; |
357 | 162 | }; | 180 | }; |
358 | 163 | 181 | ||
359 | 164 | 182 | ||
360 | === modified file 'src/plugin/folderlistmodel/dirmodel.cpp' | |||
361 | --- src/plugin/folderlistmodel/dirmodel.cpp 2015-01-01 20:43:56 +0000 | |||
362 | +++ src/plugin/folderlistmodel/dirmodel.cpp 2015-03-16 21:40:07 +0000 | |||
363 | @@ -216,7 +216,12 @@ | |||
364 | 216 | roles.insert(FileSizeRole, QByteArray("fileSize")); | 216 | roles.insert(FileSizeRole, QByteArray("fileSize")); |
365 | 217 | roles.insert(IconSourceRole, QByteArray("iconSource")); | 217 | roles.insert(IconSourceRole, QByteArray("iconSource")); |
366 | 218 | roles.insert(FilePathRole, QByteArray("filePath")); | 218 | roles.insert(FilePathRole, QByteArray("filePath")); |
368 | 219 | roles.insert(IsDirRole, QByteArray("isDir")); | 219 | roles.insert(IsDirRole, QByteArray("isDir")); |
369 | 220 | roles.insert(IsHostRole, QByteArray("isHost")); | ||
370 | 221 | roles.insert(IsSmbWorkgroupRole, QByteArray("IsSmbWorkgroup")); | ||
371 | 222 | roles.insert(IsSmbShareRole, QByteArray("IsSmbShare")); | ||
372 | 223 | roles.insert(IsSharedDirRole, QByteArray("IsSharedDir")); | ||
373 | 224 | roles.insert(IsSharingAllowedRole, QByteArray("IsSharingAllowed")); | ||
374 | 220 | roles.insert(IsFileRole, QByteArray("isFile")); | 225 | roles.insert(IsFileRole, QByteArray("isFile")); |
375 | 221 | roles.insert(IsReadableRole, QByteArray("isReadable")); | 226 | roles.insert(IsReadableRole, QByteArray("isReadable")); |
376 | 222 | roles.insert(IsWritableRole, QByteArray("isWritable")); | 227 | roles.insert(IsWritableRole, QByteArray("isWritable")); |
377 | @@ -268,7 +273,7 @@ | |||
378 | 268 | { | 273 | { |
379 | 269 | QIcon icon; | 274 | QIcon icon; |
380 | 270 | QMimeType mime = mDirectoryContents.at(index.row()).mimeType(); | 275 | QMimeType mime = mDirectoryContents.at(index.row()).mimeType(); |
382 | 271 | if (mime.isValid()) | 276 | if (mime.isValid() && mDirectoryContents.at(index.row()).isLocal()) |
383 | 272 | { | 277 | { |
384 | 273 | if (QIcon::hasThemeIcon(mime.iconName()) ) { | 278 | if (QIcon::hasThemeIcon(mime.iconName()) ) { |
385 | 274 | icon = QIcon::fromTheme(mime.iconName()); | 279 | icon = QIcon::fromTheme(mime.iconName()); |
386 | @@ -333,9 +338,15 @@ | |||
387 | 333 | case ModifiedDateRole: | 338 | case ModifiedDateRole: |
388 | 334 | return fi.lastModified(); | 339 | return fi.lastModified(); |
389 | 335 | case FileSizeRole: { | 340 | case FileSizeRole: { |
391 | 336 | if (fi.isDir() && fi.isLocal()) | 341 | if (fi.isBrowsable()) |
392 | 337 | { | 342 | { |
394 | 338 | return dirItems(fi.diskFileInfo()); | 343 | if (fi.isLocal()) |
395 | 344 | { | ||
396 | 345 | return dirItems(fi.diskFileInfo()); | ||
397 | 346 | } | ||
398 | 347 | //it is possible to browse network folders and get its | ||
399 | 348 | //number of items, but it may take longer | ||
400 | 349 | return tr("unkown"); | ||
401 | 339 | } | 350 | } |
402 | 340 | return fileSize(fi.size()); | 351 | return fileSize(fi.size()); |
403 | 341 | } | 352 | } |
404 | @@ -357,7 +368,7 @@ | |||
405 | 357 | case IsDirRole: | 368 | case IsDirRole: |
406 | 358 | return fi.isDir(); | 369 | return fi.isDir(); |
407 | 359 | case IsFileRole: | 370 | case IsFileRole: |
409 | 360 | return !fi.isDir(); | 371 | return !fi.isBrowsable(); |
410 | 361 | case IsReadableRole: | 372 | case IsReadableRole: |
411 | 362 | return fi.isReadable(); | 373 | return fi.isReadable(); |
412 | 363 | case IsWritableRole: | 374 | case IsWritableRole: |
413 | @@ -366,6 +377,18 @@ | |||
414 | 366 | return fi.isExecutable(); | 377 | return fi.isExecutable(); |
415 | 367 | case IsSelectedRole: | 378 | case IsSelectedRole: |
416 | 368 | return fi.isSelected(); | 379 | return fi.isSelected(); |
417 | 380 | case IsHostRole: | ||
418 | 381 | return fi.isHost(); | ||
419 | 382 | case IsSmbWorkgroupRole: | ||
420 | 383 | return fi.isWorkGroup(); | ||
421 | 384 | case IsSmbShareRole: | ||
422 | 385 | return fi.isShare(); | ||
423 | 386 | case IsSharingAllowedRole: | ||
424 | 387 | return fi.isDir() && !fi.isSymLink() && !fi.isSharedDir() | ||
425 | 388 | && mCurLocation->type() == LocationsFactory::LocalDisk | ||
426 | 389 | && fi.isWritable() && fi.isExecutable() && fi.isReadable(); | ||
427 | 390 | case IsSharedDirRole: | ||
428 | 391 | return fi.isSharedDir(); | ||
429 | 369 | #ifndef DO_NOT_USE_TAG_LIB | 392 | #ifndef DO_NOT_USE_TAG_LIB |
430 | 370 | case TrackTitleRole: | 393 | case TrackTitleRole: |
431 | 371 | case TrackArtistRole: | 394 | case TrackArtistRole: |
432 | @@ -388,7 +411,7 @@ | |||
433 | 388 | qWarning() << Q_FUNC_INFO << this << "Got an unknown role: " << role; | 411 | qWarning() << Q_FUNC_INFO << this << "Got an unknown role: " << role; |
434 | 389 | #endif | 412 | #endif |
435 | 390 | break; | 413 | break; |
437 | 391 | } | 414 | }//switch (role) |
438 | 392 | 415 | ||
439 | 393 | return QVariant(); | 416 | return QVariant(); |
440 | 394 | } | 417 | } |
441 | @@ -1779,13 +1802,13 @@ | |||
442 | 1779 | case TrackGenreRole: | 1802 | case TrackGenreRole: |
443 | 1780 | return QString::fromUtf8(tag->genre().toCString(true)); | 1803 | return QString::fromUtf8(tag->genre().toCString(true)); |
444 | 1781 | case TrackLengthRole: | 1804 | case TrackLengthRole: |
446 | 1782 | if(!f.isNull() && f.audioProperties()) { | 1805 | if (!f.isNull() && f.audioProperties()) { |
447 | 1783 | return QString::number(f.audioProperties()->length()); | 1806 | return QString::number(f.audioProperties()->length()); |
448 | 1784 | } else { | 1807 | } else { |
449 | 1785 | return QString::number(0); | 1808 | return QString::number(0); |
450 | 1786 | } | 1809 | } |
451 | 1787 | case TrackCoverRole: | 1810 | case TrackCoverRole: |
453 | 1788 | if(!list.isEmpty()) { | 1811 | if (!list.isEmpty()) { |
454 | 1789 | TagLib::ID3v2::AttachedPictureFrame *Pic = static_cast<TagLib::ID3v2::AttachedPictureFrame *>(list.front()); | 1812 | TagLib::ID3v2::AttachedPictureFrame *Pic = static_cast<TagLib::ID3v2::AttachedPictureFrame *>(list.front()); |
455 | 1790 | QImage img; | 1813 | QImage img; |
456 | 1791 | img.loadFromData((const uchar *) Pic->picture().data(), Pic->picture().size()); | 1814 | img.loadFromData((const uchar *) Pic->picture().data(), Pic->picture().size()); |
457 | 1792 | 1815 | ||
458 | === modified file 'src/plugin/folderlistmodel/dirmodel.h' | |||
459 | --- src/plugin/folderlistmodel/dirmodel.h 2015-01-01 20:43:56 +0000 | |||
460 | +++ src/plugin/folderlistmodel/dirmodel.h 2015-03-16 21:40:07 +0000 | |||
461 | @@ -62,6 +62,11 @@ | |||
462 | 62 | IconSourceRole, | 62 | IconSourceRole, |
463 | 63 | FilePathRole, | 63 | FilePathRole, |
464 | 64 | IsDirRole, | 64 | IsDirRole, |
465 | 65 | IsHostRole, //!< it can also be used for other protocols than smb/cifs | ||
466 | 66 | IsSmbWorkgroupRole, | ||
467 | 67 | IsSmbShareRole, | ||
468 | 68 | IsSharedDirRole, //!< it can also be used for other protocols than smb/cifs | ||
469 | 69 | IsSharingAllowedRole,//!< true for local directories (not in Trash) and not IsSharedDirRole | ||
470 | 65 | IsFileRole, | 70 | IsFileRole, |
471 | 66 | IsReadableRole, | 71 | IsReadableRole, |
472 | 67 | IsWritableRole, | 72 | IsWritableRole, |
PASSED: Continuous integration, rev:386 91.189. 93.70:8080/ job/ubuntu- filemanager- app-ci/ 467/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 2301 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 2301/artifact/ work/output/ *zip*/output. zip 91.189. 93.70:8080/ job/ubuntu- filemanager- app-utopic- amd64-ci/ 183 91.189. 93.70:8080/ job/ubuntu- filemanager- app-vivid- amd64-ci/ 89
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- filemanager- app-ci/ 467/rebuild
http://