Merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-04 into lp:ubuntu-filemanager-app
- samba-actions-04
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Arto Jalkanen |
Approved revision: | 436 |
Merged at revision: | 439 |
Proposed branch: | lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-04 |
Merge into: | lp:ubuntu-filemanager-app |
Prerequisite: | lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-03 |
Diff against target: |
426 lines (+72/-97) 5 files modified
src/plugin/folderlistmodel/dirmodel.cpp (+6/-33) src/plugin/folderlistmodel/dirmodel.h (+2/-4) src/plugin/folderlistmodel/filesystemaction.cpp (+48/-37) src/plugin/folderlistmodel/filesystemaction.h (+12/-5) src/plugin/test_folderlistmodel/regression/tst_folderlistmodel.cpp (+4/-18) |
To merge this branch: | bzr merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-04 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Arto Jalkanen | Approve | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+265195@code.launchpad.net |
Commit message
FileSystemA
The following methods were removed because the Location where the Action was performed needs to create its DirIteminfo for its items:
* Removed signals FileSystemActio
* Removed slots DirModel:
FileSystemA
Description of the change
Preparing FileSystemAction class to work based on Locations
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
- 436. By Carlos Jose Mazieri
-
Avoided using operator=() for DirItemInfo as it has the copy constructor
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:436
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/dirmodel.cpp' | |||
2 | --- src/plugin/folderlistmodel/dirmodel.cpp 2015-07-25 19:26:01 +0000 | |||
3 | +++ src/plugin/folderlistmodel/dirmodel.cpp 2015-07-25 19:26:01 +0000 | |||
4 | @@ -114,7 +114,7 @@ | |||
5 | 114 | , mAuthData(NetAuthenticationDataList::getInstance(this)) | 114 | , mAuthData(NetAuthenticationDataList::getInstance(this)) |
6 | 115 | , mLocationFactory(new LocationsFactory(this)) | 115 | , mLocationFactory(new LocationsFactory(this)) |
7 | 116 | , mCurLocation(0) | 116 | , mCurLocation(0) |
9 | 117 | , m_fsAction(new FileSystemAction(this) ) | 117 | , m_fsAction(new FileSystemAction(mLocationFactory,this) ) |
10 | 118 | { | 118 | { |
11 | 119 | mNameFilters = QStringList() << "*"; | 119 | mNameFilters = QStringList() << "*"; |
12 | 120 | 120 | ||
13 | @@ -126,15 +126,9 @@ | |||
14 | 126 | connect(m_fsAction, SIGNAL(added(DirItemInfo)), | 126 | connect(m_fsAction, SIGNAL(added(DirItemInfo)), |
15 | 127 | this, SLOT(onItemAdded(DirItemInfo))); | 127 | this, SLOT(onItemAdded(DirItemInfo))); |
16 | 128 | 128 | ||
17 | 129 | connect(m_fsAction, SIGNAL(added(QString)), | ||
18 | 130 | this, SLOT(onItemAdded(QString))); | ||
19 | 131 | |||
20 | 132 | connect(m_fsAction, SIGNAL(removed(DirItemInfo)), | 129 | connect(m_fsAction, SIGNAL(removed(DirItemInfo)), |
21 | 133 | this, SLOT(onItemRemoved(DirItemInfo))); | 130 | this, SLOT(onItemRemoved(DirItemInfo))); |
22 | 134 | 131 | ||
23 | 135 | connect(m_fsAction, SIGNAL(removed(QString)), | ||
24 | 136 | this, SLOT(onItemRemoved(QString))); | ||
25 | 137 | |||
26 | 138 | connect(m_fsAction, SIGNAL(error(QString,QString)), | 132 | connect(m_fsAction, SIGNAL(error(QString,QString)), |
27 | 139 | this, SIGNAL(error(QString,QString))); | 133 | this, SIGNAL(error(QString,QString))); |
28 | 140 | 134 | ||
29 | @@ -960,16 +954,6 @@ | |||
30 | 960 | return ret; | 954 | return ret; |
31 | 961 | } | 955 | } |
32 | 962 | 956 | ||
33 | 963 | /*! | ||
34 | 964 | * \brief DirModel::onItemRemoved() | ||
35 | 965 | * \param pathname full pathname of removed file | ||
36 | 966 | */ | ||
37 | 967 | void DirModel::onItemRemoved(const QString &pathname) | ||
38 | 968 | { | ||
39 | 969 | DirItemInfo info(pathname); | ||
40 | 970 | onItemRemoved(info); | ||
41 | 971 | } | ||
42 | 972 | |||
43 | 973 | 957 | ||
44 | 974 | void DirModel::onItemRemoved(const DirItemInfo &fi) | 958 | void DirModel::onItemRemoved(const DirItemInfo &fi) |
45 | 975 | { | 959 | { |
46 | @@ -993,17 +977,6 @@ | |||
47 | 993 | } | 977 | } |
48 | 994 | 978 | ||
49 | 995 | 979 | ||
50 | 996 | /*! | ||
51 | 997 | * \brief DirModel::onItemAdded() | ||
52 | 998 | * \param pathname full pathname of the added file | ||
53 | 999 | */ | ||
54 | 1000 | void DirModel::onItemAdded(const QString &pathname) | ||
55 | 1001 | { | ||
56 | 1002 | DirItemInfo info(pathname); | ||
57 | 1003 | onItemAdded(info); | ||
58 | 1004 | } | ||
59 | 1005 | |||
60 | 1006 | |||
61 | 1007 | void DirModel::onItemAdded(const DirItemInfo &fi) | 980 | void DirModel::onItemAdded(const DirItemInfo &fi) |
62 | 1008 | { | 981 | { |
63 | 1009 | int newRow = addItem(fi); | 982 | int newRow = addItem(fi); |
64 | @@ -1509,26 +1482,26 @@ | |||
65 | 1509 | 1482 | ||
66 | 1510 | bool DirModel::existsDir(const QString &folderName) const | 1483 | bool DirModel::existsDir(const QString &folderName) const |
67 | 1511 | { | 1484 | { |
69 | 1512 | DirItemInfo d = setParentIfRelative(folderName); | 1485 | DirItemInfo d(setParentIfRelative(folderName)); |
70 | 1513 | return d.exists() && d.isDir(); | 1486 | return d.exists() && d.isDir(); |
71 | 1514 | } | 1487 | } |
72 | 1515 | 1488 | ||
73 | 1516 | bool DirModel::canReadDir(const QString &folderName) const | 1489 | bool DirModel::canReadDir(const QString &folderName) const |
74 | 1517 | { | 1490 | { |
77 | 1518 | DirItemInfo d = setParentIfRelative(folderName); | 1491 | DirItemInfo d(setParentIfRelative(folderName)); |
78 | 1519 | return d.isDir() && d.isReadable(); | 1492 | return d.isDir() && d.isReadable() && d.isExecutable(); |
79 | 1520 | } | 1493 | } |
80 | 1521 | 1494 | ||
81 | 1522 | 1495 | ||
82 | 1523 | bool DirModel::existsFile(const QString &fileName) const | 1496 | bool DirModel::existsFile(const QString &fileName) const |
83 | 1524 | { | 1497 | { |
85 | 1525 | DirItemInfo f = setParentIfRelative(fileName); | 1498 | DirItemInfo f(setParentIfRelative(fileName)); |
86 | 1526 | return f.exists() && f.isFile(); | 1499 | return f.exists() && f.isFile(); |
87 | 1527 | } | 1500 | } |
88 | 1528 | 1501 | ||
89 | 1529 | bool DirModel::canReadFile(const QString &fileName) const | 1502 | bool DirModel::canReadFile(const QString &fileName) const |
90 | 1530 | { | 1503 | { |
92 | 1531 | DirItemInfo f = setParentIfRelative(fileName); | 1504 | DirItemInfo f(setParentIfRelative(fileName)); |
93 | 1532 | return f.isReadable() && f.isFile(); | 1505 | return f.isReadable() && f.isFile(); |
94 | 1533 | } | 1506 | } |
95 | 1534 | 1507 | ||
96 | 1535 | 1508 | ||
97 | === modified file 'src/plugin/folderlistmodel/dirmodel.h' | |||
98 | --- src/plugin/folderlistmodel/dirmodel.h 2015-07-25 19:26:01 +0000 | |||
99 | +++ src/plugin/folderlistmodel/dirmodel.h 2015-07-25 19:26:01 +0000 | |||
100 | @@ -461,10 +461,8 @@ | |||
101 | 461 | void clipboardChanged(); | 461 | void clipboardChanged(); |
102 | 462 | void enabledExternalFSWatcherChanged(bool); | 462 | void enabledExternalFSWatcherChanged(bool); |
103 | 463 | 463 | ||
108 | 464 | private slots: | 464 | private slots: |
109 | 465 | void onItemRemoved(const QString&); | 465 | void onItemRemoved(const DirItemInfo&); |
106 | 466 | void onItemRemoved(const DirItemInfo&); | ||
107 | 467 | void onItemAdded(const QString&); | ||
110 | 468 | void onItemAdded(const DirItemInfo&); | 466 | void onItemAdded(const DirItemInfo&); |
111 | 469 | void onItemChanged(const DirItemInfo&); | 467 | void onItemChanged(const DirItemInfo&); |
112 | 470 | 468 | ||
113 | 471 | 469 | ||
114 | === modified file 'src/plugin/folderlistmodel/filesystemaction.cpp' | |||
115 | --- src/plugin/folderlistmodel/filesystemaction.cpp 2014-12-29 11:29:21 +0000 | |||
116 | +++ src/plugin/folderlistmodel/filesystemaction.cpp 2015-07-25 19:26:01 +0000 | |||
117 | @@ -37,6 +37,9 @@ | |||
118 | 37 | #include "filesystemaction.h" | 37 | #include "filesystemaction.h" |
119 | 38 | #include "clipboard.h" | 38 | #include "clipboard.h" |
120 | 39 | #include "qtrashutilinfo.h" | 39 | #include "qtrashutilinfo.h" |
121 | 40 | #include "location.h" | ||
122 | 41 | #include "locationsfactory.h" | ||
123 | 42 | |||
124 | 40 | 43 | ||
125 | 41 | #if defined(Q_OS_UNIX) | 44 | #if defined(Q_OS_UNIX) |
126 | 42 | #include <sys/statvfs.h> | 45 | #include <sys/statvfs.h> |
127 | @@ -51,6 +54,7 @@ | |||
128 | 51 | #include <QDir> | 54 | #include <QDir> |
129 | 52 | #include <QThread> | 55 | #include <QThread> |
130 | 53 | #include <QTemporaryFile> | 56 | #include <QTemporaryFile> |
131 | 57 | #include <QScopedPointer> | ||
132 | 54 | 58 | ||
133 | 55 | /*! | 59 | /*! |
134 | 56 | * number of the files to work on a step, when this number is reached a signal is emitted | 60 | * number of the files to work on a step, when this number is reached a signal is emitted |
135 | @@ -177,14 +181,16 @@ | |||
136 | 177 | //=============================================================================================== | 181 | //=============================================================================================== |
137 | 178 | /*! | 182 | /*! |
138 | 179 | * \brief FileSystemAction::FileSystemAction | 183 | * \brief FileSystemAction::FileSystemAction |
139 | 184 | * \param LocationsFactory locationsFactory | ||
140 | 180 | * \param parent | 185 | * \param parent |
141 | 181 | */ | 186 | */ |
143 | 182 | FileSystemAction::FileSystemAction(QObject *parent) : | 187 | FileSystemAction::FileSystemAction(LocationsFactory *locationsFactory, QObject *parent) : |
144 | 183 | QObject(parent) | 188 | QObject(parent) |
145 | 184 | , m_curAction(0) | 189 | , m_curAction(0) |
146 | 185 | , m_cancelCurrentAction(false) | 190 | , m_cancelCurrentAction(false) |
147 | 186 | , m_busy(false) | 191 | , m_busy(false) |
148 | 187 | , m_clipboardChanged(false) | 192 | , m_clipboardChanged(false) |
149 | 193 | , m_locationsFactory(locationsFactory) | ||
150 | 188 | #if defined(REGRESSION_TEST_FOLDERLISTMODEL) //used in Unit/Regression tests | 194 | #if defined(REGRESSION_TEST_FOLDERLISTMODEL) //used in Unit/Regression tests |
151 | 189 | , m_forceUsingOtherFS(false) | 195 | , m_forceUsingOtherFS(false) |
152 | 190 | #endif | 196 | #endif |
153 | @@ -475,7 +481,7 @@ | |||
154 | 475 | { | 481 | { |
155 | 476 | removeTrashInfoFileFromEntry(curEntry); | 482 | removeTrashInfoFileFromEntry(curEntry); |
156 | 477 | } | 483 | } |
158 | 478 | emit removed(mainItem); | 484 | notifyActionOnItem(mainItem, ItemRemoved); |
159 | 479 | } | 485 | } |
160 | 480 | else | 486 | else |
161 | 481 | { | 487 | { |
162 | @@ -487,21 +493,24 @@ | |||
163 | 487 | //it is necessary to remove also (file).trashinfo file | 493 | //it is necessary to remove also (file).trashinfo file |
164 | 488 | removeTrashInfoFileFromEntry(curEntry); | 494 | removeTrashInfoFileFromEntry(curEntry); |
165 | 489 | } | 495 | } |
167 | 490 | emit removed(mainItem); | 496 | notifyActionOnItem(mainItem, ItemRemoved); |
168 | 491 | break; | 497 | break; |
169 | 492 | case ActionHardMoveRemove: // nothing to do | 498 | case ActionHardMoveRemove: // nothing to do |
170 | 493 | break; | 499 | break; |
171 | 494 | case ActionHardMoveCopy: | 500 | case ActionHardMoveCopy: |
172 | 495 | case ActionCopy: // ActionHardMoveCopy is lso checked here | 501 | case ActionCopy: // ActionHardMoveCopy is lso checked here |
173 | 496 | case ActionMove: | 502 | case ActionMove: |
182 | 497 | if (!curEntry->added && !curEntry->alreadyExists) | 503 | { |
183 | 498 | { | 504 | QScopedPointer <DirItemInfo> item(m_locationsFactory->currentLocation()->newItemInfo(curEntry->itemPaths.target())); |
184 | 499 | emit added(curEntry->itemPaths.target()); | 505 | if (!curEntry->added && !curEntry->alreadyExists) |
185 | 500 | curEntry->added = true; | 506 | { |
186 | 501 | } | 507 | curEntry->added = true; |
187 | 502 | else | 508 | notifyActionOnItem(*item, ItemAdded); |
188 | 503 | { | 509 | } |
189 | 504 | emit changed(DirItemInfo(curEntry->itemPaths.target())); | 510 | else |
190 | 511 | { | ||
191 | 512 | notifyActionOnItem(*item, ItemChanged); | ||
192 | 513 | } | ||
193 | 505 | } | 514 | } |
194 | 506 | if (curEntry->type == ActionHardMoveCopy) | 515 | if (curEntry->type == ActionHardMoveCopy) |
195 | 507 | { | 516 | { |
196 | @@ -674,8 +683,9 @@ | |||
197 | 674 | QDir entryDirObj(entryDir); | 683 | QDir entryDirObj(entryDir); |
198 | 675 | if (!entryDirObj.exists() && entryDirObj.mkpath(entryDir)) | 684 | if (!entryDirObj.exists() && entryDirObj.mkpath(entryDir)) |
199 | 676 | { | 685 | { |
201 | 677 | emit added(entryDir); | 686 | QScopedPointer <DirItemInfo> item(m_locationsFactory->currentLocation()->newItemInfo(entryDir)); |
202 | 678 | entry->added = true; | 687 | entry->added = true; |
203 | 688 | notifyActionOnItem(*item, ItemAdded); | ||
204 | 679 | } | 689 | } |
205 | 680 | } | 690 | } |
206 | 681 | QDir d(path); | 691 | QDir d(path); |
207 | @@ -732,11 +742,11 @@ | |||
208 | 732 | needsSize -= m_curAction->copyFile.target->size(); | 742 | needsSize -= m_curAction->copyFile.target->size(); |
209 | 733 | m_curAction->copyFile.target->close(); | 743 | m_curAction->copyFile.target->close(); |
210 | 734 | } | 744 | } |
213 | 735 | //check if there is disk space to copy source to target | 745 | //check if there is disk space to copy source to target |
214 | 736 | if (needsSize > 0 && !isThereDiskSpace(entry, needsSize )) | 746 | if (needsSize > 0 && !m_locationsFactory->currentLocation()->isThereDiskSpace(entry->itemPaths.targetPath(), needsSize)) |
215 | 737 | { | 747 | { |
216 | 738 | m_cancelCurrentAction = true; | 748 | m_cancelCurrentAction = true; |
218 | 739 | m_errorTitle = QObject::tr("There is no space on disk to copy"); | 749 | m_errorTitle = QObject::tr("There is no space to copy"); |
219 | 740 | m_errorMsg = m_curAction->copyFile.target->fileName(); | 750 | m_errorMsg = m_curAction->copyFile.target->fileName(); |
220 | 741 | } | 751 | } |
221 | 742 | } | 752 | } |
222 | @@ -758,14 +768,15 @@ | |||
223 | 758 | //depending on the file size it may take longer, the view needs to be informed | 768 | //depending on the file size it may take longer, the view needs to be informed |
224 | 759 | if (m_curAction->copyFile.isEntryItem && !m_cancelCurrentAction) | 769 | if (m_curAction->copyFile.isEntryItem && !m_cancelCurrentAction) |
225 | 760 | { | 770 | { |
226 | 771 | QScopedPointer <DirItemInfo> item(m_locationsFactory->currentLocation()->newItemInfo(target)); | ||
227 | 761 | if (!entry->alreadyExists) | 772 | if (!entry->alreadyExists) |
230 | 762 | { | 773 | { |
229 | 763 | emit added(target); | ||
231 | 764 | entry->added = true; | 774 | entry->added = true; |
232 | 775 | notifyActionOnItem(*item, ItemAdded); | ||
233 | 765 | } | 776 | } |
234 | 766 | else | 777 | else |
237 | 767 | { | 778 | { |
238 | 768 | emit changed(DirItemInfo(target)); | 779 | notifyActionOnItem(*item, ItemChanged); |
239 | 769 | } | 780 | } |
240 | 770 | } | 781 | } |
241 | 771 | } | 782 | } |
242 | @@ -1143,8 +1154,9 @@ | |||
243 | 1143 | m_curAction->copyFile.target->close(); | 1154 | m_curAction->copyFile.target->close(); |
244 | 1144 | } | 1155 | } |
245 | 1145 | if (m_curAction->copyFile.target->remove()) | 1156 | if (m_curAction->copyFile.target->remove()) |
248 | 1146 | { | 1157 | { |
249 | 1147 | emit removed(m_curAction->copyFile.targetName); | 1158 | QScopedPointer<DirItemInfo> item(m_locationsFactory->currentLocation()->newItemInfo(m_curAction->copyFile.targetName)); |
250 | 1159 | notifyActionOnItem(*item, ItemRemoved); | ||
251 | 1148 | } | 1160 | } |
252 | 1149 | } | 1161 | } |
253 | 1150 | m_curAction->copyFile.clear(); | 1162 | m_curAction->copyFile.clear(); |
254 | @@ -1172,8 +1184,9 @@ | |||
255 | 1172 | notifyProgress(); | 1184 | notifyProgress(); |
256 | 1173 | if (m_curAction->copyFile.isEntryItem && m_curAction->copyFile.amountSavedToRefresh <= 0) | 1185 | if (m_curAction->copyFile.isEntryItem && m_curAction->copyFile.amountSavedToRefresh <= 0) |
257 | 1174 | { | 1186 | { |
258 | 1187 | QScopedPointer <DirItemInfo> item(m_locationsFactory->currentLocation()->newItemInfo(m_curAction->copyFile.targetName)); | ||
259 | 1175 | m_curAction->copyFile.amountSavedToRefresh = AMOUNT_COPIED_TO_REFRESH_ITEM_INFO; | 1188 | m_curAction->copyFile.amountSavedToRefresh = AMOUNT_COPIED_TO_REFRESH_ITEM_INFO; |
261 | 1176 | emit changed(DirItemInfo(m_curAction->copyFile.targetName)); | 1189 | notifyActionOnItem(*item, ItemChanged); |
262 | 1177 | } | 1190 | } |
263 | 1178 | scheduleSlot(SLOT(processCopySingleFile())); | 1191 | scheduleSlot(SLOT(processCopySingleFile())); |
264 | 1179 | } | 1192 | } |
265 | @@ -1415,21 +1428,6 @@ | |||
266 | 1415 | return ret; | 1428 | return ret; |
267 | 1416 | } | 1429 | } |
268 | 1417 | 1430 | ||
269 | 1418 | //================================================================== | ||
270 | 1419 | bool FileSystemAction::isThereDiskSpace(const ActionEntry *entry, qint64 requiredSize) | ||
271 | 1420 | { | ||
272 | 1421 | bool ret = true; | ||
273 | 1422 | #if defined(Q_OS_UNIX) | ||
274 | 1423 | struct statvfs vfs; | ||
275 | 1424 | if ( ::statvfs( QFile::encodeName(entry->itemPaths.targetPath()).constData(), &vfs) == 0 ) | ||
276 | 1425 | { | ||
277 | 1426 | qint64 free = vfs.f_bsize * vfs.f_bfree; | ||
278 | 1427 | ret = free > requiredSize; | ||
279 | 1428 | } | ||
280 | 1429 | #endif | ||
281 | 1430 | return ret; | ||
282 | 1431 | } | ||
283 | 1432 | |||
284 | 1433 | 1431 | ||
285 | 1434 | //================================================================== | 1432 | //================================================================== |
286 | 1435 | /*! | 1433 | /*! |
287 | @@ -1508,3 +1506,16 @@ | |||
288 | 1508 | m_errorMsg = trashUtil.absInfo; | 1506 | m_errorMsg = trashUtil.absInfo; |
289 | 1509 | } | 1507 | } |
290 | 1510 | } | 1508 | } |
291 | 1509 | |||
292 | 1510 | |||
293 | 1511 | void FileSystemAction::notifyActionOnItem(const DirItemInfo& item, ActionNotification action) | ||
294 | 1512 | { | ||
295 | 1513 | switch(action) | ||
296 | 1514 | { | ||
297 | 1515 | case ItemAdded: emit added(item); break; | ||
298 | 1516 | case ItemRemoved: emit removed(item); break; | ||
299 | 1517 | case ItemChanged: emit changed(item); break; | ||
300 | 1518 | default: break; | ||
301 | 1519 | } | ||
302 | 1520 | } | ||
303 | 1521 | |||
304 | 1511 | 1522 | ||
305 | === modified file 'src/plugin/folderlistmodel/filesystemaction.h' | |||
306 | --- src/plugin/folderlistmodel/filesystemaction.h 2014-06-17 20:42:35 +0000 | |||
307 | +++ src/plugin/folderlistmodel/filesystemaction.h 2015-07-25 19:26:01 +0000 | |||
308 | @@ -51,7 +51,8 @@ | |||
309 | 51 | class DirModelMimeData; | 51 | class DirModelMimeData; |
310 | 52 | class QFile; | 52 | class QFile; |
311 | 53 | class QTemporaryFile; | 53 | class QTemporaryFile; |
313 | 54 | 54 | class Location; | |
314 | 55 | class LocationsFactory; | ||
315 | 55 | 56 | ||
316 | 56 | /*! | 57 | /*! |
317 | 57 | * \brief The FileSystemAction class does file system operations copy/cut/paste/remove items | 58 | * \brief The FileSystemAction class does file system operations copy/cut/paste/remove items |
318 | @@ -95,7 +96,7 @@ | |||
319 | 95 | { | 96 | { |
320 | 96 | Q_OBJECT | 97 | Q_OBJECT |
321 | 97 | public: | 98 | public: |
323 | 98 | explicit FileSystemAction(QObject *parent = 0); | 99 | explicit FileSystemAction(LocationsFactory *locationsFactory, QObject *parent = 0); |
324 | 99 | ~FileSystemAction(); | 100 | ~FileSystemAction(); |
325 | 100 | 101 | ||
326 | 101 | public: | 102 | public: |
327 | @@ -116,9 +117,7 @@ | |||
328 | 116 | 117 | ||
329 | 117 | signals: | 118 | signals: |
330 | 118 | void error(const QString& errorTitle, const QString &errorMessage); | 119 | void error(const QString& errorTitle, const QString &errorMessage); |
331 | 119 | void removed(const QString& item); | ||
332 | 120 | void removed(const DirItemInfo&); | 120 | void removed(const DirItemInfo&); |
333 | 121 | void added(const QString& ); | ||
334 | 122 | void added(const DirItemInfo& ); | 121 | void added(const DirItemInfo& ); |
335 | 123 | void changed(const DirItemInfo&); | 122 | void changed(const DirItemInfo&); |
336 | 124 | void progress(int curItem, int totalItems, int percent); | 123 | void progress(int curItem, int totalItems, int percent); |
337 | @@ -131,6 +130,13 @@ | |||
338 | 131 | bool processCopySingleFile(); | 130 | bool processCopySingleFile(); |
339 | 132 | 131 | ||
340 | 133 | private: | 132 | private: |
341 | 133 | enum ActionNotification | ||
342 | 134 | { | ||
343 | 135 | ItemAdded, | ||
344 | 136 | ItemRemoved, | ||
345 | 137 | ItemChanged | ||
346 | 138 | }; | ||
347 | 139 | |||
348 | 134 | enum ActionType | 140 | enum ActionType |
349 | 135 | { | 141 | { |
350 | 136 | ActionRemove, | 142 | ActionRemove, |
351 | @@ -213,6 +219,7 @@ | |||
352 | 213 | QString m_errorTitle; | 219 | QString m_errorTitle; |
353 | 214 | QString m_errorMsg; | 220 | QString m_errorMsg; |
354 | 215 | bool m_clipboardChanged; //!< this is set to false in \ref moveIntoCurrentPath() and \ref copyIntoCurrentPath(); | 221 | bool m_clipboardChanged; //!< this is set to false in \ref moveIntoCurrentPath() and \ref copyIntoCurrentPath(); |
355 | 222 | LocationsFactory * m_locationsFactory; | ||
356 | 216 | 223 | ||
357 | 217 | 224 | ||
358 | 218 | private: | 225 | private: |
359 | @@ -232,10 +239,10 @@ | |||
360 | 232 | void moveDirToTempAndRemoveItLater(const QString& dir); | 239 | void moveDirToTempAndRemoveItLater(const QString& dir); |
361 | 233 | bool makeBackupNameForCurrentItem(ActionEntry *entry); | 240 | bool makeBackupNameForCurrentItem(ActionEntry *entry); |
362 | 234 | bool endCopySingleFile(); | 241 | bool endCopySingleFile(); |
363 | 235 | bool isThereDiskSpace(const ActionEntry *entry, qint64 requiredSize); | ||
364 | 236 | void queueAction(Action *myAction); | 242 | void queueAction(Action *myAction); |
365 | 237 | void createTrashInfoFileFromEntry(ActionEntry *entry); | 243 | void createTrashInfoFileFromEntry(ActionEntry *entry); |
366 | 238 | void removeTrashInfoFileFromEntry(ActionEntry *entry); | 244 | void removeTrashInfoFileFromEntry(ActionEntry *entry); |
367 | 245 | void notifyActionOnItem(const DirItemInfo& item, ActionNotification action); | ||
368 | 239 | 246 | ||
369 | 240 | #if defined(REGRESSION_TEST_FOLDERLISTMODEL) //used in Unit/Regression tests | 247 | #if defined(REGRESSION_TEST_FOLDERLISTMODEL) //used in Unit/Regression tests |
370 | 241 | bool m_forceUsingOtherFS; | 248 | bool m_forceUsingOtherFS; |
371 | 242 | 249 | ||
372 | === modified file 'src/plugin/test_folderlistmodel/regression/tst_folderlistmodel.cpp' | |||
373 | --- src/plugin/test_folderlistmodel/regression/tst_folderlistmodel.cpp 2015-07-25 19:26:01 +0000 | |||
374 | +++ src/plugin/test_folderlistmodel/regression/tst_folderlistmodel.cpp 2015-07-25 19:26:01 +0000 | |||
375 | @@ -74,9 +74,7 @@ | |||
376 | 74 | TestDirModel(); | 74 | TestDirModel(); |
377 | 75 | ~TestDirModel(); | 75 | ~TestDirModel(); |
378 | 76 | 76 | ||
382 | 77 | protected slots: | 77 | protected slots: |
380 | 78 | void slotFileAdded(const QString& s) {m_filesAdded.append(s); } | ||
381 | 79 | void slotFileRemoved(const QString& s) {m_filesRemoved.append(s); } | ||
383 | 80 | void slotFileAdded(const DirItemInfo& f) {m_filesAdded.append(f.absoluteFilePath()); } | 78 | void slotFileAdded(const DirItemInfo& f) {m_filesAdded.append(f.absoluteFilePath()); } |
384 | 81 | void slotFileRemoved(const DirItemInfo& f) {m_filesRemoved.append(f.absoluteFilePath()); } | 79 | void slotFileRemoved(const DirItemInfo& f) {m_filesRemoved.append(f.absoluteFilePath()); } |
385 | 82 | void slotPathChamged(QString path) { m_currentPath = path;} | 80 | void slotPathChamged(QString path) { m_currentPath = path;} |
386 | @@ -211,17 +209,13 @@ | |||
387 | 211 | 209 | ||
388 | 212 | }; | 210 | }; |
389 | 213 | 211 | ||
391 | 214 | TestDirModel::TestDirModel() : m_deepDir_01(0) | 212 | TestDirModel::TestDirModel() : fsAction(new LocationsFactory(this), this) |
392 | 213 | ,m_deepDir_01(0) | ||
393 | 215 | ,m_deepDir_02(0) | 214 | ,m_deepDir_02(0) |
394 | 216 | ,m_deepDir_03(0) | 215 | ,m_deepDir_03(0) |
395 | 217 | ,m_dirModel_01(0) | 216 | ,m_dirModel_01(0) |
396 | 218 | ,m_dirModel_02(0) | 217 | ,m_dirModel_02(0) |
403 | 219 | { | 218 | { |
398 | 220 | connect(&fsAction, SIGNAL(added(QString)), | ||
399 | 221 | this, SLOT(slotFileAdded(QString)) ); | ||
400 | 222 | connect(&fsAction, SIGNAL(removed(QString)), | ||
401 | 223 | this, SLOT(slotFileRemoved(QString)) ); | ||
402 | 224 | |||
404 | 225 | connect(&fsAction, SIGNAL(added(DirItemInfo)), | 219 | connect(&fsAction, SIGNAL(added(DirItemInfo)), |
405 | 226 | this, SLOT(slotFileAdded(DirItemInfo))); | 220 | this, SLOT(slotFileAdded(DirItemInfo))); |
406 | 227 | connect(&fsAction, SIGNAL(removed(DirItemInfo)), | 221 | connect(&fsAction, SIGNAL(removed(DirItemInfo)), |
407 | @@ -401,19 +395,11 @@ | |||
408 | 401 | m_dirModel_01 = new DirModel(); | 395 | m_dirModel_01 = new DirModel(); |
409 | 402 | m_dirModel_02 = new DirModel(); | 396 | m_dirModel_02 = new DirModel(); |
410 | 403 | 397 | ||
411 | 404 | connect(m_dirModel_01->m_fsAction, SIGNAL(added(QString)), | ||
412 | 405 | this, SLOT(slotFileAdded(QString)) ); | ||
413 | 406 | connect(m_dirModel_01->m_fsAction, SIGNAL(removed(QString)), | ||
414 | 407 | this, SLOT(slotFileRemoved(QString)) ); | ||
415 | 408 | connect(m_dirModel_01->m_fsAction, SIGNAL(added(DirItemInfo)), | 398 | connect(m_dirModel_01->m_fsAction, SIGNAL(added(DirItemInfo)), |
416 | 409 | this, SLOT(slotFileAdded(DirItemInfo))); | 399 | this, SLOT(slotFileAdded(DirItemInfo))); |
417 | 410 | connect(m_dirModel_01->m_fsAction, SIGNAL(removed(DirItemInfo)), | 400 | connect(m_dirModel_01->m_fsAction, SIGNAL(removed(DirItemInfo)), |
418 | 411 | this, SLOT(slotFileRemoved(DirItemInfo))); | 401 | this, SLOT(slotFileRemoved(DirItemInfo))); |
419 | 412 | 402 | ||
420 | 413 | connect(m_dirModel_02->m_fsAction, SIGNAL(added(QString)), | ||
421 | 414 | this, SLOT(slotFileAdded(QString)) ); | ||
422 | 415 | connect(m_dirModel_02->m_fsAction, SIGNAL(removed(QString)), | ||
423 | 416 | this, SLOT(slotFileRemoved(QString)) ); | ||
424 | 417 | connect(m_dirModel_02->m_fsAction, SIGNAL(added(DirItemInfo)), | 403 | connect(m_dirModel_02->m_fsAction, SIGNAL(added(DirItemInfo)), |
425 | 418 | this, SLOT(slotFileAdded(DirItemInfo))); | 404 | this, SLOT(slotFileAdded(DirItemInfo))); |
426 | 419 | connect(m_dirModel_02->m_fsAction, SIGNAL(removed(DirItemInfo)), | 405 | connect(m_dirModel_02->m_fsAction, SIGNAL(removed(DirItemInfo)), |
PASSED: Continuous integration, rev:435 91.189. 93.70:8080/ job/ubuntu- filemanager- app-ci/ 509/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 3093 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 3093/artifact/ work/output/ *zip*/output. zip 91.189. 93.70:8080/ job/ubuntu- filemanager- app-utopic- amd64-ci/ 225 91.189. 93.70:8080/ job/ubuntu- filemanager- app-vivid- amd64-ci/ 131
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/ 509/rebuild
http://