Merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-14 into lp:ubuntu-filemanager-app

Proposed by Carlos Jose Mazieri on 2015-07-19
Status: Merged
Approved by: Carlos Jose Mazieri on 2015-08-25
Approved revision: 448
Merged at revision: 453
Proposed branch: lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-14
Merge into: lp:ubuntu-filemanager-app
Prerequisite: lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-13
Diff against target: 571 lines (+395/-3)
14 files modified
src/plugin/folderlistmodel/CMakeLists.txt (+6/-0)
src/plugin/folderlistmodel/disk/disklocation.cpp (+8/-0)
src/plugin/folderlistmodel/disk/disklocation.h (+1/-0)
src/plugin/folderlistmodel/disk/disklocationitemdir.cpp (+61/-0)
src/plugin/folderlistmodel/disk/disklocationitemdir.h (+45/-0)
src/plugin/folderlistmodel/folderlistmodel.pri (+6/-2)
src/plugin/folderlistmodel/location.h (+10/-0)
src/plugin/folderlistmodel/locationitemdir.cpp (+34/-0)
src/plugin/folderlistmodel/locationitemdir.h (+41/-0)
src/plugin/folderlistmodel/smb/qsambaclient/qsambaclient.pri (+2/-0)
src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemdir.cpp (+128/-0)
src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemdir.h (+42/-0)
src/plugin/folderlistmodel/smb/smblocation.cpp (+9/-0)
src/plugin/folderlistmodel/smb/smblocation.h (+2/-1)
To merge this branch: bzr merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-actions-14
Reviewer Review Type Date Requested Status
Carlos Jose Mazieri Approve on 2015-08-25
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-08-24
Arto Jalkanen 2015-07-19 Approve on 2015-08-22
Review via email: mp+265213@code.launchpad.net

Commit message

Inherited Location classes now provide inherited LocationItemDir classes which will replace Qt QDir class in Actions.
DiskLocation provides DiskLocationItemDir and SmbLocation provides SmbLocationItemDir

Description of the change

LocationItemDir classes are provided by Location inherited classes.

To post a comment you must log in.
Arto Jalkanen (ajalkane) wrote :

See diff comment.

review: Needs Fixing

Yes, it is a memory leak.

I will fix that.

Arto Jalkanen (ajalkane) :
review: Approve
447. By Carlos Jose Mazieri on 2015-08-24

avoiding merge conflicts

448. By Carlos Jose Mazieri on 2015-08-24

removed unused files added by mistake after fixing the merge conflic in CMakeLists.txt

I did a top approve myself as Arto had already done it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/plugin/folderlistmodel/CMakeLists.txt'
2--- src/plugin/folderlistmodel/CMakeLists.txt 2015-08-22 16:49:18 +0000
3+++ src/plugin/folderlistmodel/CMakeLists.txt 2015-08-24 22:18:12 +0000
4@@ -43,6 +43,8 @@
5 locationsfactory.h
6 locationurl.cpp
7 locationurl.h
8+ locationitemdir.cpp
9+ locationitemdir.h
10 locationitemdiriterator.cpp
11 locationitemdiriterator.h
12 locationitemfile.cpp
13@@ -57,6 +59,8 @@
14 disk/disklocationitemdiriterator.h
15 disk/disklocationitemfile.cpp
16 disk/disklocationitemfile.h
17+ disk/disklocationitemdir.cpp
18+ disk/disklocationitemdir.h
19 trash/qtrashdir.cpp
20 trash/qtrashdir.h
21 trash/qtrashutilinfo.cpp
22@@ -75,6 +79,8 @@
23 smb/qsambaclient/src/smblocationdiriterator.h
24 smb/qsambaclient/src/smblocationitemfile.cpp
25 smb/qsambaclient/src/smblocationitemfile.h
26+ smb/qsambaclient/src/smblocationitemdir.cpp
27+ smb/qsambaclient/src/smblocationitemdir.h
28 smb/qsambaclient/src/smbobject.cpp
29 smb/qsambaclient/src/smbobject.h
30 smb/smblocation.h
31
32=== modified file 'src/plugin/folderlistmodel/disk/disklocation.cpp'
33--- src/plugin/folderlistmodel/disk/disklocation.cpp 2015-07-15 16:04:58 +0000
34+++ src/plugin/folderlistmodel/disk/disklocation.cpp 2015-08-24 22:18:12 +0000
35@@ -26,6 +26,7 @@
36 #include "externalfswatcher.h"
37 #include "locationurl.h"
38 #include "disklocationitemfile.h"
39+#include "disklocationitemdir.h"
40
41
42 #if defined(Q_OS_UNIX)
43@@ -204,6 +205,13 @@
44 }
45
46
47+LocationItemDir *
48+DiskLocation::newDir(const QString &dir)
49+{
50+ return new DiskLocationItemDir(dir);
51+}
52+
53+
54 bool DiskLocation::isThereDiskSpace(const QString &pathname, qint64 requiredSize)
55 {
56 bool ret = true;
57
58=== modified file 'src/plugin/folderlistmodel/disk/disklocation.h'
59--- src/plugin/folderlistmodel/disk/disklocation.h 2015-07-15 16:04:58 +0000
60+++ src/plugin/folderlistmodel/disk/disklocation.h 2015-08-24 22:18:12 +0000
61@@ -67,6 +67,7 @@
62 QDir::Filters filters,
63 QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags);
64 virtual LocationItemFile * newFile(const QString & path);
65+ virtual LocationItemDir * newDir(const QString & dir = QLatin1String(0));
66 virtual bool isThereDiskSpace(const QString& pathname, qint64 requiredSize);
67 virtual QString urlBelongsToLocation(const QString& urlPath, int indexOfColonAndSlashe);
68
69
70=== added file 'src/plugin/folderlistmodel/disk/disklocationitemdir.cpp'
71--- src/plugin/folderlistmodel/disk/disklocationitemdir.cpp 1970-01-01 00:00:00 +0000
72+++ src/plugin/folderlistmodel/disk/disklocationitemdir.cpp 2015-08-24 22:18:12 +0000
73@@ -0,0 +1,61 @@
74+/**************************************************************************
75+ *
76+ * Copyright 2015 Canonical Ltd.
77+ * Copyright 2015 Carlos J Mazieri <carlos.mazieri@gmail.com>
78+ *
79+ * This program is free software; you can redistribute it and/or modify
80+ * it under the terms of the GNU Lesser General Public License as published by
81+ * the Free Software Foundation; version 3.
82+ *
83+ * This program is distributed in the hope that it will be useful,
84+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
85+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
86+ * GNU Lesser General Public License for more details.
87+ *
88+ * You should have received a copy of the GNU Lesser General Public License
89+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
90+ *
91+ * File: disklocationitemdir.cpp
92+ * Date: 16/05/2015
93+ */
94+
95+#include "disklocationitemdir.h"
96+#include <QDir>
97+
98+DiskLocationItemDir::DiskLocationItemDir(const QString &dir) : LocationItemDir(dir), m_qtQDir(new QDir())
99+{
100+ if(!dir.isNull() && !dir.isEmpty())
101+ {
102+ m_qtQDir->setPath(dir);
103+ }
104+}
105+
106+
107+DiskLocationItemDir::~DiskLocationItemDir()
108+{
109+ delete m_qtQDir;
110+}
111+
112+bool DiskLocationItemDir::exists() const
113+{
114+ return m_qtQDir->exists();
115+}
116+
117+
118+bool DiskLocationItemDir::mkdir(const QString& dir) const
119+{
120+ return m_qtQDir->mkdir(dir);
121+}
122+
123+
124+bool DiskLocationItemDir::mkpath(const QString& dir) const
125+{
126+ return m_qtQDir->mkpath(dir);
127+}
128+
129+
130+bool DiskLocationItemDir::rmdir(const QString& dir) const
131+{
132+ return m_qtQDir->rmdir(dir);
133+}
134+
135
136=== added file 'src/plugin/folderlistmodel/disk/disklocationitemdir.h'
137--- src/plugin/folderlistmodel/disk/disklocationitemdir.h 1970-01-01 00:00:00 +0000
138+++ src/plugin/folderlistmodel/disk/disklocationitemdir.h 2015-08-24 22:18:12 +0000
139@@ -0,0 +1,45 @@
140+/**************************************************************************
141+ *
142+ * Copyright 2015 Canonical Ltd.
143+ * Copyright 2015 Carlos J Mazieri <carlos.mazieri@gmail.com>
144+ *
145+ * This program is free software; you can redistribute it and/or modify
146+ * it under the terms of the GNU Lesser General Public License as published by
147+ * the Free Software Foundation; version 3.
148+ *
149+ * This program is distributed in the hope that it will be useful,
150+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
151+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
152+ * GNU Lesser General Public License for more details.
153+ *
154+ * You should have received a copy of the GNU Lesser General Public License
155+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
156+ *
157+ * File: disklocationitemdir.h
158+ * Date: 16/05/2015
159+ */
160+
161+#ifndef DISKLOCATIONITEMDIR_H
162+#define DISKLOCATIONITEMDIR_H
163+
164+#include "locationitemdir.h"
165+
166+class QDir;
167+
168+
169+class DiskLocationItemDir : public LocationItemDir
170+{
171+public:
172+ DiskLocationItemDir(const QString& dir = QLatin1String(0) );
173+ ~DiskLocationItemDir();
174+public:
175+ virtual bool exists() const;
176+ virtual bool mkdir(const QString& dir) const;
177+ virtual bool mkpath(const QString& dir) const;
178+ virtual bool rmdir(const QString& dir) const;
179+private:
180+ QDir * m_qtQDir;
181+
182+};
183+
184+#endif // DISKLOCATIONITEMDIR_H
185
186=== modified file 'src/plugin/folderlistmodel/folderlistmodel.pri'
187--- src/plugin/folderlistmodel/folderlistmodel.pri 2015-07-15 16:04:58 +0000
188+++ src/plugin/folderlistmodel/folderlistmodel.pri 2015-08-24 22:18:12 +0000
189@@ -16,6 +16,7 @@
190 $$PWD/locationitemdiriterator.cpp \
191 $$PWD/cleanurl.cpp \
192 $$PWD/locationitemfile.cpp \
193+ $$PWD/locationitemdir.cpp
194
195
196 HEADERS += $$PWD/dirmodel.h \
197@@ -37,15 +38,18 @@
198 $$PWD/locationitemdiriterator.h \
199 $$PWD/cleanurl.h \
200 $$PWD/locationitemfile.h \
201+ $$PWD/locationitemdir.h
202
203
204 SOURCES += $$PWD/disk/disklocation.cpp \
205 $$PWD/disk/disklocationitemdiriterator.cpp \
206- $$PWD/disk/disklocationitemfile.cpp
207+ $$PWD/disk/disklocationitemfile.cpp \
208+ $$PWD/disk/disklocationitemdir.cpp
209
210 HEADERS += $$PWD/disk/disklocation.h \
211 $$PWD/disk/disklocationitemdiriterator.h \
212- $$PWD/disk/disklocationitemfile.h
213+ $$PWD/disk/disklocationitemfile.h \
214+ $$PWD/disk/disklocationitemdir.h
215
216
217 SOURCES += $$PWD/trash/qtrashdir.cpp \
218
219=== modified file 'src/plugin/folderlistmodel/location.h'
220--- src/plugin/folderlistmodel/location.h 2015-07-15 16:04:58 +0000
221+++ src/plugin/folderlistmodel/location.h 2015-08-24 22:18:12 +0000
222@@ -31,6 +31,7 @@
223 class DirListWorker;
224 class LocationItemDirIterator;
225 class LocationItemFile;
226+class LocationItemDir;
227
228 /*!
229 * \brief The Location class represents any location (full path) where there are items to browse: directories, shares, from Disk and from Network.
230@@ -134,6 +135,15 @@
231 */
232 virtual LocationItemFile * newFile(const QString & path) = 0;
233
234+ /*!
235+ * \brief newDir() creates a LocationItemDir object which is simila to Qt QDir object
236+ *
237+ * It will be used in copy/paste/remove Actions
238+ *
239+ * \param dir
240+ * \return
241+ */
242+ virtual LocationItemDir * newDir(const QString & dir = QLatin1String(0)) = 0;
243
244 /*!
245 * \brief urlBelongsToLocation() Returns a good url if the \a urlPath is valid URL that belongs to its location
246
247=== added file 'src/plugin/folderlistmodel/locationitemdir.cpp'
248--- src/plugin/folderlistmodel/locationitemdir.cpp 1970-01-01 00:00:00 +0000
249+++ src/plugin/folderlistmodel/locationitemdir.cpp 2015-08-24 22:18:12 +0000
250@@ -0,0 +1,34 @@
251+/**************************************************************************
252+ *
253+ * Copyright 2015 Canonical Ltd.
254+ * Copyright 2015 Carlos J Mazieri <carlos.mazieri@gmail.com>
255+ *
256+ * This program is free software; you can redistribute it and/or modify
257+ * it under the terms of the GNU Lesser General Public License as published by
258+ * the Free Software Foundation; version 3.
259+ *
260+ * This program is distributed in the hope that it will be useful,
261+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
262+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
263+ * GNU Lesser General Public License for more details.
264+ *
265+ * You should have received a copy of the GNU Lesser General Public License
266+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
267+ *
268+ * File: locationitemdir.cpp
269+ * Date: 16/05/2015
270+ */
271+
272+#include "locationitemdir.h"
273+#include <QString>
274+
275+LocationItemDir::LocationItemDir(const QString& dir)
276+{
277+ Q_UNUSED(dir);
278+}
279+
280+
281+LocationItemDir::~LocationItemDir()
282+{
283+
284+}
285
286=== added file 'src/plugin/folderlistmodel/locationitemdir.h'
287--- src/plugin/folderlistmodel/locationitemdir.h 1970-01-01 00:00:00 +0000
288+++ src/plugin/folderlistmodel/locationitemdir.h 2015-08-24 22:18:12 +0000
289@@ -0,0 +1,41 @@
290+/**************************************************************************
291+ *
292+ * Copyright 2015 Canonical Ltd.
293+ * Copyright 2015 Carlos J Mazieri <carlos.mazieri@gmail.com>
294+ *
295+ * This program is free software; you can redistribute it and/or modify
296+ * it under the terms of the GNU Lesser General Public License as published by
297+ * the Free Software Foundation; version 3.
298+ *
299+ * This program is distributed in the hope that it will be useful,
300+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
301+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
302+ * GNU Lesser General Public License for more details.
303+ *
304+ * You should have received a copy of the GNU Lesser General Public License
305+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
306+ *
307+ * File: locationitemdir.h
308+ * Date: 16/05/2015
309+ */
310+
311+#ifndef LOCATIONITEMDIR_H
312+#define LOCATIONITEMDIR_H
313+
314+#include <QString>
315+
316+class LocationItemDir
317+{
318+public:
319+ virtual ~LocationItemDir();
320+public:
321+ virtual bool exists() const = 0;
322+ virtual bool mkdir(const QString& dir) const = 0;
323+ virtual bool mkpath(const QString& dir) const = 0;
324+ virtual bool rmdir(const QString& dir) const = 0;
325+protected:
326+ LocationItemDir ();
327+ LocationItemDir (const QString& dir = QLatin1String(0));
328+};
329+
330+#endif // LOCATIONITEMDIR_H
331
332=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/qsambaclient.pri'
333--- src/plugin/folderlistmodel/smb/qsambaclient/qsambaclient.pri 2015-07-15 16:04:58 +0000
334+++ src/plugin/folderlistmodel/smb/qsambaclient/qsambaclient.pri 2015-08-24 22:18:12 +0000
335@@ -6,6 +6,7 @@
336 $$PWD/src/smbobject.cpp \
337 $$PWD/src/smblocationdiriterator.cpp \
338 $$PWD/src/smblocationitemfile.cpp \
339+ $$PWD/src/smblocationitemdir.cpp
340
341
342 HEADERS += $$PWD/src/smbutil.h \
343@@ -15,6 +16,7 @@
344 $$PWD/src/smbobject.h \
345 $$PWD/src/smblocationdiriterator.h \
346 $$PWD/src/smblocationitemfile.h \
347+ $$PWD/src/smblocationitemdir.h
348
349
350 QT *= core network
351
352=== added file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemdir.cpp'
353--- src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemdir.cpp 1970-01-01 00:00:00 +0000
354+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemdir.cpp 2015-08-24 22:18:12 +0000
355@@ -0,0 +1,128 @@
356+/**************************************************************************
357+ *
358+ * Copyright 2015 Canonical Ltd.
359+ * Copyright 2015 Carlos J Mazieri <carlos.mazieri@gmail.com>
360+ *
361+ * This program is free software; you can redistribute it and/or modify
362+ * it under the terms of the GNU Lesser General Public License as published by
363+ * the Free Software Foundation; version 3.
364+ *
365+ * This program is distributed in the hope that it will be useful,
366+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
367+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
368+ * GNU Lesser General Public License for more details.
369+ *
370+ * You should have received a copy of the GNU Lesser General Public License
371+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
372+ *
373+ * File: smblocationitemdir.cpp
374+ * Date: 16/05/2015
375+ */
376+
377+#include "smblocationitemdir.h"
378+#include "locationitemfile.h"
379+#include "smbiteminfo.h"
380+#include "smbutil.h"
381+#include "locationurl.h"
382+
383+#include <QUrl>
384+
385+SmbLocationItemDir::SmbLocationItemDir(const QString &dir, Const_SmbUtil_Ptr smb)
386+ : LocationItemDir(dir), SmbObject(dir, smb)
387+{
388+
389+}
390+
391+
392+SmbLocationItemDir::~SmbLocationItemDir()
393+{
394+
395+}
396+
397+bool SmbLocationItemDir::exists() const
398+{
399+ bool ret = false;
400+ if (!cleanUrl().isEmpty())
401+ {
402+ SmbItemInfo item(cleanUrl(), m_smb);
403+ ret = item.exists();
404+ }
405+ return ret;
406+}
407+
408+
409+bool SmbLocationItemDir::mkdir(const QString& dir) const
410+{
411+ return this->mkpath(dir);
412+}
413+
414+
415+bool SmbLocationItemDir::mkpath(const QString& dir) const
416+{
417+#define MKDIR_NOT_CALLED_YET 0x300 // any value greater than zero as mkdir returns values <= zero
418+ bool ret = false;
419+ QString absPath = makeAbsoluteUrl(dir);
420+ QUrl url(absPath);
421+ if (url.isValid() && absPath.startsWith(LocationUrl::SmbURL))
422+ {
423+ QLatin1Char slash('/');
424+ QStringList paths = url.path().split(slash, QString::SkipEmptyParts);
425+ QString partPath = LocationUrl::SmbURL + url.host();
426+ ret = true;
427+ //first mkdir call updates this mkdir_return
428+ int mkdir_return = MKDIR_NOT_CALLED_YET;
429+ Smb::Context context = smbObj()->createContext();
430+ Q_ASSERT(context);
431+ //loop starts with share, appends each path and if it does exist tries to create it
432+ //for shares (counter == 0) it must exist, so it it is not created
433+ for(int counter = 0; ret && counter < paths.count(); ++counter)
434+ {
435+ partPath += slash + paths.at(counter);
436+ //if mkdir was called it means any path in the loop will not exist, so it is NOT necessary to call openDir()
437+ Smb::FileHandler fd = mkdir_return == MKDIR_NOT_CALLED_YET ?
438+ smbObj()->openDir(context,partPath) : 0;
439+ //OK if it already exists or if it was created
440+ //shares (the first path, when counter == 0) must already exist
441+ ret = fd != 0 || (counter > 0 &&
442+ (mkdir_return = ::smbc_getFunctionMkdir(context)(context, partPath.toLocal8Bit().constData(), LocationItemFile::getUmaskDirsCreation())) == 0
443+ );
444+ if (fd != 0)
445+ {
446+ smbObj()->closeHandle(context,fd);
447+ }
448+ }
449+ smbObj()->deleteContext(context);
450+ }
451+ return ret;
452+}
453+
454+
455+bool SmbLocationItemDir::rmdir(const QString& dir) const
456+{
457+ bool ret = false;
458+ QString fullpath = makeAbsoluteUrl(dir);
459+ if (fullpath.startsWith(LocationUrl::SmbURL))
460+ {
461+ Smb::Context context = smbObj()->createContext();
462+ Q_ASSERT(context);
463+ if (::smbc_getFunctionRmdir(context)(context,fullpath.toLocal8Bit().constData()) == 0)
464+ {
465+ ret = true;
466+ }
467+ smbObj()->deleteContext(context);
468+ }
469+ return ret;
470+}
471+
472+
473+QString SmbLocationItemDir::makeAbsoluteUrl(const QString &dir) const
474+{
475+ //dir should be a full URL like smb://host/share
476+ QString ret(dir);
477+ //verify if dir is relative
478+ if (!dir.startsWith(LocationUrl::SmbURL) && cleanUrl().startsWith(LocationUrl::SmbURL))
479+ {
480+ ret = cleanUrl() + QDir::separator() + dir;
481+ }
482+ return ret;
483+}
484
485=== added file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemdir.h'
486--- src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemdir.h 1970-01-01 00:00:00 +0000
487+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemdir.h 2015-08-24 22:18:12 +0000
488@@ -0,0 +1,42 @@
489+/**************************************************************************
490+ *
491+ * Copyright 2015 Canonical Ltd.
492+ * Copyright 2015 Carlos J Mazieri <carlos.mazieri@gmail.com>
493+ *
494+ * This program is free software; you can redistribute it and/or modify
495+ * it under the terms of the GNU Lesser General Public License as published by
496+ * the Free Software Foundation; version 3.
497+ *
498+ * This program is distributed in the hope that it will be useful,
499+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
500+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
501+ * GNU Lesser General Public License for more details.
502+ *
503+ * You should have received a copy of the GNU Lesser General Public License
504+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
505+ *
506+ * File: smblocationitemdir.h
507+ * Date: 16/05/2015
508+ */
509+
510+#ifndef SMBLOCATIONITEMDIR_H
511+#define SMBLOCATIONITEMDIR_H
512+
513+#include "locationitemdir.h"
514+#include "smbobject.h"
515+
516+class SmbLocationItemDir : public LocationItemDir, public SmbObject
517+{
518+public:
519+ SmbLocationItemDir(const QString& dir = QLatin1String(0), Const_SmbUtil_Ptr smb = 0 );
520+ ~SmbLocationItemDir();
521+public:
522+ virtual bool exists() const;
523+ virtual bool mkdir(const QString& dir) const;
524+ virtual bool mkpath(const QString& dir) const;
525+ virtual bool rmdir(const QString& dir) const;
526+private:
527+ QString makeAbsoluteUrl(const QString& dir) const;
528+};
529+
530+#endif // SMBLOCATIONITEMDIR_H
531
532=== modified file 'src/plugin/folderlistmodel/smb/smblocation.cpp'
533--- src/plugin/folderlistmodel/smb/smblocation.cpp 2015-07-15 16:04:58 +0000
534+++ src/plugin/folderlistmodel/smb/smblocation.cpp 2015-08-24 22:18:12 +0000
535@@ -28,6 +28,7 @@
536 #include "ioworkerthread.h"
537 #include "locationurl.h"
538 #include "smblocationitemfile.h"
539+#include "smblocationitemdir.h"
540
541
542 #if defined(Q_OS_UNIX)
543@@ -120,6 +121,14 @@
544 }
545
546
547+LocationItemDir *
548+SmbLocation::newDir(const QString &dir)
549+{
550+ return new SmbLocationItemDir(dir, m_smb);
551+}
552+
553+
554+
555 bool SmbLocation::isThereDiskSpace(const QString &pathname, qint64 requiredSize)
556 {
557 bool ret = false;
558
559=== modified file 'src/plugin/folderlistmodel/smb/smblocation.h'
560--- src/plugin/folderlistmodel/smb/smblocation.h 2015-07-15 16:04:58 +0000
561+++ src/plugin/folderlistmodel/smb/smblocation.h 2015-08-24 22:18:12 +0000
562@@ -43,7 +43,8 @@
563 QDir::Filters filters,
564 QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags);
565 virtual LocationItemFile * newFile(const QString & path);
566- virtual bool isThereDiskSpace(const QString& pathname, qint64 requiredSize);
567+ virtual LocationItemDir * newDir(const QString & dir = QLatin1String(0));
568+ virtual bool isThereDiskSpace(const QString& pathname, qint64 requiredSize);
569 virtual QString urlBelongsToLocation(const QString& urlPath, int indexOfColonAndSlashe);
570 virtual QString currentAuthenticationUser();
571 virtual QString currentAuthenticationPassword();

Subscribers

People subscribed via source and target branches