Commit 0246a11a authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Maemo: Improve file selection dialog for publishing.

- Make sure file names are completely visible.
- Show hidden files.
- Pre-unselect files of types unlikely to be included in the package.
parent a7319f38
......@@ -40,6 +40,8 @@
****************************************************************************/
#include "maemopublishedprojectmodel.h"
#include <QtCore/QFileInfo>
namespace Qt4ProjectManager {
namespace Internal {
namespace {
......@@ -49,6 +51,32 @@ const int IncludeColumn = 2;
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
......
......@@ -53,6 +53,7 @@ class MaemoPublishedProjectModel : public QFileSystemModel
Q_OBJECT
public:
explicit MaemoPublishedProjectModel(QObject *parent = 0);
void initFilesToExclude();
QStringList filesToExclude() const { return m_filesToExclude.toList(); }
private:
......@@ -65,6 +66,8 @@ private:
int role);
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
void initFilesToExclude(const QString &filePath);
QSet<QString> m_filesToExclude;
};
......
......@@ -54,8 +54,10 @@ MaemoPublishingFileSelectionDialog::MaemoPublishingFileSelectionDialog(const QSt
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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment