Merge lp:~carlos-mazieri/ubuntu-filemanager-app/sdcard-support into lp:~ajalkane/ubuntu-filemanager-app/sdcard-support

Proposed by Carlos Jose Mazieri
Status: Merged
Approved by: Arto Jalkanen
Approved revision: 359
Merged at revision: 359
Proposed branch: lp:~carlos-mazieri/ubuntu-filemanager-app/sdcard-support
Merge into: lp:~ajalkane/ubuntu-filemanager-app/sdcard-support
Diff against target: 122 lines (+57/-7)
4 files modified
src/plugin/placesmodel/placesmodel.cpp (+6/-4)
src/plugin/placesmodel/placesmodel.h (+1/-1)
src/plugin/placesmodel/qmtabparser.cpp (+40/-2)
src/plugin/placesmodel/qmtabparser.h (+10/-0)
To merge this branch: bzr merge lp:~carlos-mazieri/ubuntu-filemanager-app/sdcard-support
Reviewer Review Type Date Requested Status
Arto Jalkanen Approve
Review via email: mp+245500@code.launchpad.net

Commit message

This is a way of considering all mount points, not only sdcard or media mounts.

Description of the change

This is a way of considering all mount points, not only sdcard or media mounts.
This besides what we already have may be a final solution to local mount points.

Please review and do the improvements you think that is necessary, I did not find a good solution for QMtabParser::fsHasUserContent(), maybe it needs improvement.

To post a comment you must log in.
Revision history for this message
Arto Jalkanen (ajalkane) wrote :

Thank you Carlos, good additional features.

review: Approve
360. By Carlos Jose Mazieri

removed this undered file

Revision history for this message
Carlos Jose Mazieri (carlos-mazieri) wrote :

I have removed the diff file I have generated by mistake.

Revision history for this message
Arto Jalkanen (ajalkane) wrote :

I noticed it but somehow managed to forget about it by the time I was doing approving :P.

Well, is this supposed to be automatically merged like for trunk or do I need to do something...

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/plugin/placesmodel/placesmodel.cpp'
2--- src/plugin/placesmodel/placesmodel.cpp 2015-01-03 08:34:52 +0000
3+++ src/plugin/placesmodel/placesmodel.cpp 2015-01-03 16:39:24 +0000
4@@ -25,7 +25,7 @@
5 #include <QStandardPaths>
6 #include <QDebug>
7
8-PlacesModel::PlacesModel(QAbstractListModel *parent) :
9+PlacesModel::PlacesModel(QObject *parent) :
10 QAbstractListModel(parent)
11 {
12 m_userMountPath = "/media/" + qgetenv("USER") + "/";
13@@ -95,9 +95,11 @@
14 QSet<QString> userMounts;
15
16 foreach (QMtabEntry e, entries) {
17- qDebug() << Q_FUNC_INFO << "Considering" << e.dir;
18- if (e.dir.startsWith(m_userMountPath)) {
19- qDebug() << Q_FUNC_INFO << "Adding as userMount directory" << e.dir;
20+ qDebug() << Q_FUNC_INFO << "Considering" << "fsName:" << e.fsName << "dir:" << e.dir << "type:" << e.type;
21+ QFileInfo dir(e.dir);
22+ if (dir.isReadable() && dir.isExecutable())
23+ {
24+ qDebug() << Q_FUNC_INFO << "Adding as userMount directory dir" << e.dir;
25 userMounts << e.dir;
26 }
27 }
28
29=== modified file 'src/plugin/placesmodel/placesmodel.h'
30--- src/plugin/placesmodel/placesmodel.h 2015-01-03 08:34:52 +0000
31+++ src/plugin/placesmodel/placesmodel.h 2015-01-03 16:39:24 +0000
32@@ -42,7 +42,7 @@
33 Q_PROPERTY(QString locationVideos READ locationVideos CONSTANT)
34
35 public:
36- explicit PlacesModel(QAbstractListModel *parent = 0);
37+ explicit PlacesModel(QObject *parent = 0);
38 ~PlacesModel();
39 QString locationHome() const;
40 QString locationDocuments() const;
41
42=== modified file 'src/plugin/placesmodel/qmtabparser.cpp'
43--- src/plugin/placesmodel/qmtabparser.cpp 2015-01-03 08:34:52 +0000
44+++ src/plugin/placesmodel/qmtabparser.cpp 2015-01-03 16:39:24 +0000
45@@ -20,6 +20,9 @@
46
47 #include <mntent.h>
48
49+#include <QFileInfo>
50+#include <QStringList>
51+
52 class MtabFileGuard {
53 FILE *mtabFile;
54
55@@ -60,9 +63,44 @@
56 entry.opts = ent->mnt_opts;
57 entry.freq = ent->mnt_freq;
58 entry.passno = ent->mnt_passno;
59-
60- entries << entry;
61+ if (fsHasUserContent(entry)) {
62+ entries << entry;
63+ }
64 }
65
66 return entries;
67 }
68+
69+
70+bool QMtabParser::fsHasUserContent(const QMtabEntry &fs)
71+{
72+ //check for disk file systems like /dev/sda?
73+ bool ret = QFileInfo(fs.fsName).exists();
74+ if (!ret)
75+ {
76+ /*!
77+ * \link http://en.wikipedia.org/wiki/List_of_file_systems#Distributed_file_systems
78+ */
79+ static QStringList netFs = QStringList()
80+ << "v9fs"
81+ << "afs"
82+ << "nfs"
83+ << "smb"
84+ << "afp"
85+ << "dce"
86+ << "dfs"
87+ << "fal"
88+ << "sfs"
89+ << "ncp"
90+ << "dfs"
91+ << "cfs"
92+ << "coda"
93+ << "MooseFS"
94+ << "ssh"
95+ << "sftp"
96+ << "sshfs"
97+ ;
98+ ret = netFs.contains(fs.type, Qt::CaseSensitive);
99+ }
100+ return ret;
101+}
102
103=== modified file 'src/plugin/placesmodel/qmtabparser.h'
104--- src/plugin/placesmodel/qmtabparser.h 2015-01-03 08:34:52 +0000
105+++ src/plugin/placesmodel/qmtabparser.h 2015-01-03 16:39:24 +0000
106@@ -42,6 +42,16 @@
107 QList<QMtabEntry> parseEntries();
108
109 inline const QString& path() { return m_path; }
110+
111+private:
112+ /*!
113+ * \brief fsHasUserContent() consider Disk and Network file systems as valid
114+ * \param fs
115+ * \return TRUE if the filesystem is considered as having normal user files, FALSE when it is supposed to be system FS
116+ *
117+ * \sa \link http://en.wikipedia.org/wiki/List_of_file_systems
118+ */
119+ bool fsHasUserContent(const struct QMtabEntry& fs);
120 };
121
122 #endif // QMTABPARSER_H

Subscribers

People subscribed via source and target branches