****************************************************************************/
#include "maemopublishedprojectmodel.h"
+#include <QtCore/QFileInfo>
+
namespace Qt4ProjectManager {
namespace Internal {
namespace {
MaemoPublishedProjectModel::MaemoPublishedProjectModel(QObject *parent)
: QFileSystemModel(parent)
{
+ setFilter(filter() | QDir::Hidden | QDir::System);
+}
+
+void MaemoPublishedProjectModel::initFilesToExclude()
+{
+ initFilesToExclude(rootPath());
+}
+
+void MaemoPublishedProjectModel::initFilesToExclude(const QString &filePath)
+{
+ QFileInfo fi(filePath);
+ if (fi.isDir()) {
+ const QStringList fileNames = QDir(filePath).entryList(QDir::Files
+ | QDir::Dirs | QDir::NoDotAndDotDot | QDir::System | QDir::Hidden);
+ foreach (const QString &fileName, fileNames)
+ initFilesToExclude(filePath + QLatin1Char('/') + fileName);
+ } else {
+ const QString &fileName = fi.fileName();
+ if (fi.isHidden() || fileName.endsWith(QLatin1String(".o"))
+ || fileName == QLatin1String("Makefile")
+ || fileName.contains(QLatin1String(".pro.user"))
+ || fileName.contains(QLatin1String(".so"))
+ || fileName.endsWith(QLatin1String(".a"))) {
+ m_filesToExclude.insert(filePath);
+ }
+ }
}
int MaemoPublishedProjectModel::columnCount(const QModelIndex &parent) const
Q_OBJECT
public:
explicit MaemoPublishedProjectModel(QObject *parent = 0);
+ void initFilesToExclude();
QStringList filesToExclude() const { return m_filesToExclude.toList(); }
private:
int role);
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ void initFilesToExclude(const QString &filePath);
+
QSet<QString> m_filesToExclude;
};
ui->setupUi(this);
m_projectModel = new MaemoPublishedProjectModel(this);
const QModelIndex rootIndex = m_projectModel->setRootPath(projectPath);
+ m_projectModel->initFilesToExclude();
ui->projectView->setModel(m_projectModel);
ui->projectView->setRootIndex(rootIndex);
+ ui->projectView->header()->setResizeMode(0, QHeaderView::ResizeToContents);
}
MaemoPublishingFileSelectionDialog::~MaemoPublishingFileSelectionDialog()