ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #00705
[Merge] lp:~carlos-mazieri/ubuntu-filemanager-app/samba-browsing-06 into lp:ubuntu-filemanager-app
Carlos Jose Mazieri has proposed merging lp:~carlos-mazieri/ubuntu-filemanager-app/samba-browsing-06 into lp:ubuntu-filemanager-app with lp:~carlos-mazieri/ubuntu-filemanager-app/samba-browsing-05 as a prerequisite.
Commit message:
Samba Listing classes
Requested reviews:
Ubuntu File Manager Developers (ubuntu-filemanager-dev)
For more details, see:
https://code.launchpad.net/~carlos-mazieri/ubuntu-filemanager-app/samba-browsing-06/+merge/252975
Introduces classes:
SmbListWorker which is a IORequest and will build a list of samba items to the model
SmbLocationDirIterator which is a implementation of Qt QDirIterator class for Samba
--
Your team Ubuntu File Manager Developers is requested to review the proposed merge of lp:~carlos-mazieri/ubuntu-filemanager-app/samba-browsing-06 into lp:ubuntu-filemanager-app.
=== modified file 'po/com.ubuntu.filemanager.pot'
--- po/com.ubuntu.filemanager.pot 2015-02-13 14:09:47 +0000
+++ po/com.ubuntu.filemanager.pot 2015-03-14 18:07:13 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-01-07 00:30+0100\n"
+"POT-Creation-Date: 2015-03-14 14:53-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -27,7 +27,7 @@
msgstr[1] ""
#: ../src/app/qml/components/PathHistoryRow.qml:84
-#: ../src/app/qml/ui/FolderListPage.qml:813
+#: ../src/app/qml/ui/FolderListPage.qml:830
msgid "Device"
msgstr ""
@@ -84,8 +84,8 @@
#: ../src/app/qml/ui/FileActionDialog.qml:45
#: ../src/app/qml/ui/FileOperationProgressDialog.qml:44
#: ../src/app/qml/ui/FolderListPage.qml:343
-#: ../src/app/qml/ui/FolderListPage.qml:656
-#: ../src/app/qml/ui/FolderListPage.qml:723
+#: ../src/app/qml/ui/FolderListPage.qml:673
+#: ../src/app/qml/ui/FolderListPage.qml:740
#: ../src/app/qml/ui/GoToDialog.qml:67
msgid "Cancel"
msgstr ""
@@ -164,7 +164,7 @@
#: ../src/app/qml/ui/FolderListPage.qml:79
#: ../src/app/qml/ui/FolderListPage.qml:97
-#: ../src/app/qml/ui/FolderListPage.qml:593
+#: ../src/app/qml/ui/FolderListPage.qml:610
msgid "Properties"
msgstr ""
@@ -219,123 +219,123 @@
msgid "Select"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:408
+#: ../src/app/qml/ui/FolderListPage.qml:425
msgid "No files"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:428
-#: ../src/app/qml/ui/FolderListPage.qml:554
+#: ../src/app/qml/ui/FolderListPage.qml:445
+#: ../src/app/qml/ui/FolderListPage.qml:571
msgid "Delete"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:429
+#: ../src/app/qml/ui/FolderListPage.qml:446
#, qt-format
msgid "Are you sure you want to permanently delete '%1'?"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:434
+#: ../src/app/qml/ui/FolderListPage.qml:451
msgid "Deleting files"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:452
-#: ../src/app/qml/ui/FolderListPage.qml:567
+#: ../src/app/qml/ui/FolderListPage.qml:469
+#: ../src/app/qml/ui/FolderListPage.qml:584
msgid "Rename"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:453
+#: ../src/app/qml/ui/FolderListPage.qml:470
msgid "Enter a new name"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:462
+#: ../src/app/qml/ui/FolderListPage.qml:479
msgid "Could not rename"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:463
+#: ../src/app/qml/ui/FolderListPage.qml:480
msgid "Insufficient permissions or name already exists?"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:481
+#: ../src/app/qml/ui/FolderListPage.qml:498
msgid "Extract Archive"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:482
+#: ../src/app/qml/ui/FolderListPage.qml:499
#, qt-format
msgid "Are you sure you want to extract '%1' here?"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:531
+#: ../src/app/qml/ui/FolderListPage.qml:548
msgid "Cut"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:542
+#: ../src/app/qml/ui/FolderListPage.qml:559
msgid "Copy"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:582
-#: ../src/app/qml/ui/FolderListPage.qml:703
+#: ../src/app/qml/ui/FolderListPage.qml:599
+#: ../src/app/qml/ui/FolderListPage.qml:720
msgid "Extract archive"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:613
+#: ../src/app/qml/ui/FolderListPage.qml:630
msgid "File operation error"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:644
+#: ../src/app/qml/ui/FolderListPage.qml:661
#, qt-format
msgid "Extracting archive '%1'"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:665
+#: ../src/app/qml/ui/FolderListPage.qml:682
msgid "OK"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:680
+#: ../src/app/qml/ui/FolderListPage.qml:697
msgid "Extracting failed"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:681
+#: ../src/app/qml/ui/FolderListPage.qml:698
#, qt-format
msgid "Extracting the archive '%1' failed."
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:695
+#: ../src/app/qml/ui/FolderListPage.qml:712
msgid "Archive file"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:696
+#: ../src/app/qml/ui/FolderListPage.qml:713
msgid "Do you want to extract the archive here?"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:713
+#: ../src/app/qml/ui/FolderListPage.qml:730
msgid "Open with another app"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:781
+#: ../src/app/qml/ui/FolderListPage.qml:798
msgid "~/Desktop"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:791
+#: ../src/app/qml/ui/FolderListPage.qml:808
msgid "~/Public"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:793
+#: ../src/app/qml/ui/FolderListPage.qml:810
msgid "~/Programs"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:795
+#: ../src/app/qml/ui/FolderListPage.qml:812
msgid "~/Templates"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:811
+#: ../src/app/qml/ui/FolderListPage.qml:828
msgid "Home"
msgstr ""
-#: ../src/app/qml/ui/FolderListPage.qml:881
+#: ../src/app/qml/ui/FolderListPage.qml:898
msgid "Folder not accessible"
msgstr ""
#. TRANSLATORS: this refers to a folder name
-#: ../src/app/qml/ui/FolderListPage.qml:883
+#: ../src/app/qml/ui/FolderListPage.qml:900
#, qt-format
msgid "Can not access %1"
msgstr ""
@@ -402,19 +402,23 @@
msgid "Filter"
msgstr ""
-#: ../src/plugin/folderlistmodel/dirmodel.cpp:418
+#: ../src/plugin/folderlistmodel/dirmodel.cpp:350
+msgid "unkown"
+msgstr ""
+
+#: ../src/plugin/folderlistmodel/dirmodel.cpp:444
msgid "path or url may not exist or cannot be read"
msgstr ""
-#: ../src/plugin/folderlistmodel/dirmodel.cpp:585
+#: ../src/plugin/folderlistmodel/dirmodel.cpp:611
msgid "Rename error"
msgstr ""
-#: ../src/plugin/folderlistmodel/dirmodel.cpp:610
+#: ../src/plugin/folderlistmodel/dirmodel.cpp:636
msgid "Error creating new folder"
msgstr ""
-#: ../src/plugin/folderlistmodel/dirmodel.cpp:1252
+#: ../src/plugin/folderlistmodel/dirmodel.cpp:1261
msgid "items"
msgstr ""
=== modified file 'src/plugin/folderlistmodel/CMakeLists.txt'
--- src/plugin/folderlistmodel/CMakeLists.txt 2015-03-14 18:07:13 +0000
+++ src/plugin/folderlistmodel/CMakeLists.txt 2015-03-14 18:07:13 +0000
@@ -58,11 +58,15 @@
trash/trashiteminfo.cpp
trash/trashiteminfo.h
trash/trashlocation.cpp
- trash/trashlocation.h
+ trash/trashlocation.h
+ smb/smblistworker.cpp
+ smb/smblistworker.h
smb/qsambaclient/src/smbutil.cpp
smb/qsambaclient/src/smbutil.h
smb/qsambaclient/src/smbiteminfo.cpp
smb/qsambaclient/src/smbiteminfo.h
+ smb/qsambaclient/src/smblocationdiriterator.cpp
+ smb/qsambaclient/src/smblocationdiriterator.h
smb/qsambaclient/src/smbobject.cpp
smb/qsambaclient/src/smbobject.h
net/netauthenticationdata.cpp
=== modified file 'src/plugin/folderlistmodel/iorequest.h'
--- src/plugin/folderlistmodel/iorequest.h 2015-03-14 18:07:13 +0000
+++ src/plugin/folderlistmodel/iorequest.h 2015-03-14 18:07:13 +0000
@@ -48,7 +48,8 @@
enum RequestType
{
DirList,
- DirListExternalFSChanges
+ DirListExternalFSChanges,
+ SambaList
};
virtual void run() = 0;
RequestType type() const;
=== added file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationdiriterator.cpp'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationdiriterator.cpp 1970-01-01 00:00:00 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationdiriterator.cpp 2015-03-14 18:07:13 +0000
@@ -0,0 +1,136 @@
+/**************************************************************************
+ *
+ * Copyright 2015 Canonical Ltd.
+ * Copyright 2015 Carlos J Mazieri <carlos.mazieri@xxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * File: smblocationdiriterator.cpp
+ * Date: 10/01/2015
+ */
+
+#include "smblocationdiriterator.h"
+#include "smbiteminfo.h"
+#include "smbutil.h"
+
+#define INIT_ATTR(path,smb) SmbObject(path,smb), m_curItem(-1)
+
+#define GOOD_INDEX() (m_curItem >= 0 && m_curItem < m_urlItems.count())
+
+
+SmbLocationDirIterator::SmbLocationDirIterator(const QString &path,
+ const QStringList &nameFilters,
+ QDir::Filters filters,
+ QDirIterator::IteratorFlags flags,
+ Const_SmbUtil_Ptr smb)
+ : LocationItemDirIterator(path, nameFilters, filters, flags)
+ , INIT_ATTR(path, smb)
+{
+ bool recursive = flags == QDirIterator::Subdirectories ? true : false;
+ m_urlItems = smbObj()->listContent(path, recursive, filters, nameFilters);
+}
+
+
+SmbLocationDirIterator::SmbLocationDirIterator(const QString &path,
+ QDir::Filters filters,
+ QDirIterator::IteratorFlags flags,
+ Const_SmbUtil_Ptr smb)
+ : LocationItemDirIterator(path,filters,flags)
+ , INIT_ATTR(path, smb)
+{
+ bool recursive = flags == QDirIterator::Subdirectories ? true : false;
+ m_urlItems = smbObj()->listContent(path, recursive, filters);
+}
+
+
+SmbLocationDirIterator::SmbLocationDirIterator(const QString &path,
+ QDirIterator::IteratorFlags flags,
+ Const_SmbUtil_Ptr smb)
+ : LocationItemDirIterator(path,flags)
+ , INIT_ATTR(path, smb)
+{
+ bool recursive = flags == QDirIterator::Subdirectories ? true : false;
+ m_urlItems = smbObj()->listContent(path, recursive);
+}
+
+
+SmbLocationDirIterator::~SmbLocationDirIterator()
+{
+
+}
+
+
+QString SmbLocationDirIterator::next()
+{
+ QString ret;
+ if (hasNext())
+ {
+ ret = m_urlItems.at(++m_curItem);
+ }
+ return ret;
+}
+
+
+bool SmbLocationDirIterator::hasNext() const
+{
+ return m_urlItems.count() > 0 && m_curItem < (m_urlItems.count() -1);
+}
+
+
+DirItemInfo SmbLocationDirIterator::fileInfo() const
+{
+ if (GOOD_INDEX())
+ {
+ SmbItemInfo info(m_urlItems.at(m_curItem), m_smb);
+ return info;
+ }
+ return SmbItemInfo();
+}
+
+
+QString SmbLocationDirIterator::fileName() const
+{
+ QString file;
+ if (GOOD_INDEX())
+ {
+ QStringList paths = UrlItemInfo::separatePathFilename(m_urlItems.at(m_curItem));
+ if (paths.count() == 2)
+ {
+ file = paths.at(1);
+ }
+ }
+ return file;
+}
+
+
+QString SmbLocationDirIterator::path() const
+{
+ QString ret;
+ QStringList separated = UrlItemInfo::separatePathFilename(cleanUrl());
+ if (separated.count() > 0)
+ {
+ ret = separated.at(0);
+ }
+ return ret;
+}
+
+
+QString SmbLocationDirIterator::filePath() const
+{
+ QString fullpathname;
+ if (GOOD_INDEX())
+ {
+ fullpathname = m_urlItems.at(m_curItem);
+ }
+ return fullpathname;
+}
=== added file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationdiriterator.h'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationdiriterator.h 1970-01-01 00:00:00 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationdiriterator.h 2015-03-14 18:07:13 +0000
@@ -0,0 +1,48 @@
+/**************************************************************************
+ *
+ * Copyright 2015 Canonical Ltd.
+ * Copyright 2015 Carlos J Mazieri <carlos.mazieri@xxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * File: smblocationdiriterator.h
+ * Date: 10/01/2015
+ */
+
+#ifndef SMBLOCATIONDIRITERATOR_H
+#define SMBLOCATIONDIRITERATOR_H
+
+#include "locationitemdiriterator.h"
+#include "smbobject.h"
+
+class SmbLocationDirIterator: public LocationItemDirIterator, public SmbObject
+{
+public:
+ ~SmbLocationDirIterator();
+public:
+ virtual DirItemInfo fileInfo() const;
+ virtual QString fileName() const;
+ virtual QString filePath() const;
+ virtual bool hasNext() const;
+ virtual QString next() ;
+ virtual QString path() const;
+public:
+ SmbLocationDirIterator(const QString & path, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags, Const_SmbUtil_Ptr smb = 0);
+ SmbLocationDirIterator(const QString & path, QDir::Filters filters, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags, Const_SmbUtil_Ptr smb = 0);
+ SmbLocationDirIterator(const QString & path, const QStringList & nameFilters, QDir::Filters filters = QDir::NoFilter, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags, Const_SmbUtil_Ptr smb = 0);
+private:
+ QStringList m_urlItems;
+ int m_curItem;
+};
+
+#endif // SMBLOCATIONDIRITERATOR_H
=== added file 'src/plugin/folderlistmodel/smb/smblistworker.cpp'
--- src/plugin/folderlistmodel/smb/smblistworker.cpp 1970-01-01 00:00:00 +0000
+++ src/plugin/folderlistmodel/smb/smblistworker.cpp 2015-03-14 18:07:13 +0000
@@ -0,0 +1,63 @@
+/**************************************************************************
+ *
+ * Copyright 2015 Canonical Ltd.
+ * Copyright 2015 Carlos J Mazieri <carlos.mazieri@xxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * File: smblistworker.cpp
+ * Date: 17/01/2015
+ */
+
+#include "smblistworker.h"
+#include "smblocationdiriterator.h"
+
+SmbListWorker::SmbListWorker(const QString &pathName,
+ QDir::Filter filter,
+ const bool isRecursive,
+ bool parentIsHost,
+ Const_SmbUtil_Ptr smb)
+ : DirListWorker(pathName, filter, isRecursive)
+ , SmbObject(pathName, smb)
+ , m_parentIsHost(parentIsHost)
+{
+ mLoaderType = NetworkLoader;
+}
+
+/*!
+ * \brief SmbListWorker::getNetworkContent() it fills a \ref DirItemInfoList with samba (share/directory) content
+ * \return the list of \ref SmbItemInfo items
+ */
+DirItemInfoList SmbListWorker::getNetworkContent()
+{
+ DirItemInfoList smbContent;
+
+ QDirIterator::IteratorFlags flags = mIsRecursive ?
+ QDirIterator::Subdirectories :
+ QDirIterator::NoIteratorFlags;
+
+ SmbLocationDirIterator dir(mPathName, mFilter, flags, m_smb);
+ while (dir.hasNext())
+ {
+ QString next = dir.next();
+ SmbItemInfo item (next, m_smb);
+ if (m_parentIsHost)
+ {
+ item.setAsShare();
+ }
+ smbContent.append(item);
+ }
+
+ return smbContent;
+}
+
=== added file 'src/plugin/folderlistmodel/smb/smblistworker.h'
--- src/plugin/folderlistmodel/smb/smblistworker.h 1970-01-01 00:00:00 +0000
+++ src/plugin/folderlistmodel/smb/smblistworker.h 2015-03-14 18:07:13 +0000
@@ -0,0 +1,40 @@
+/**************************************************************************
+ *
+ * Copyright 2015 Canonical Ltd.
+ * Copyright 2015 Carlos J Mazieri <carlos.mazieri@xxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * File: smblistworker.h
+ * Date: 17/01/2015
+ */
+
+#ifndef SMBLISTWORKER_H
+#define SMBLISTWORKER_H
+
+#include "iorequestworker.h"
+#include "smbiteminfo.h"
+
+class SmbListWorker : public DirListWorker, public SmbObject
+{
+ Q_OBJECT
+public:
+ explicit SmbListWorker(const QString &pathName, QDir::Filter filter, const bool isRecursive, bool parentIsHost, Const_SmbUtil_Ptr smb);
+
+private:
+ DirItemInfoList getNetworkContent();
+private:
+ bool m_parentIsHost;
+};
+
+#endif // SMBLISTWORKER_H
Follow ups