aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/FileDialogs
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-10-29 17:42:06 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-10-29 17:42:06 +0000
commite290c0b9ab4076dfa63807c1dc7a6e6dcfb537ce (patch)
treef535efac0887177f860903d86ad818dd663e7782 /src/plugins/FileDialogs
parent1fe560aa126f9b801732d6468e66bd739a539449 (diff)
downloadqmmp-e290c0b9ab4076dfa63807c1dc7a6e6dcfb537ce.tar.gz
qmmp-e290c0b9ab4076dfa63807c1dc7a6e6dcfb537ce.tar.bz2
qmmp-e290c0b9ab4076dfa63807c1dc7a6e6dcfb537ce.zip
enabled read-only mode for file dialog
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1961 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/FileDialogs')
-rw-r--r--src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.cpp17
-rw-r--r--src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.h24
2 files changed, 3 insertions, 38 deletions
diff --git a/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.cpp b/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.cpp
index a35387a6e..0e4bd298f 100644
--- a/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.cpp
+++ b/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.cpp
@@ -61,14 +61,9 @@ QmmpFileDialogImpl::QmmpFileDialogImpl(QWidget * parent, Qt::WindowFlags f) : QD
{
setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
-#if QT_VERSION >= 0x040400
m_model = new QFileSystemModel(this);
m_model->setNameFilterDisables (false);
- m_model->setReadOnly(false);
-#else
- m_model = new QDirModel(this);
- m_model->setSorting(QDir::Type);
-#endif
+ m_model->setReadOnly(true);
fileListView->setModel(m_model);
treeView->setModel(m_model);
@@ -126,9 +121,7 @@ void QmmpFileDialogImpl::on_lookInComboBox_activated(const QString &path)
{
fileListView->setRootIndex(m_model->index(path));
treeView->setRootIndex(m_model->index(path));
-#if QT_VERSION >= 0x040400
m_model->setRootPath(path);
-#endif
}
}
@@ -140,9 +133,7 @@ void QmmpFileDialogImpl::on_upToolButton_clicked()
treeView->setRootIndex(fileListView->rootIndex());
lookInComboBox->setEditText(m_model->filePath(fileListView->rootIndex()));
fileListView->selectionModel()->clear ();
-#if QT_VERSION >= 0x040400
m_model->setRootPath(m_model->filePath(treeView->rootIndex()));
-#endif
}
void QmmpFileDialogImpl::on_treeView_doubleClicked(const QModelIndex& ind)
@@ -157,9 +148,7 @@ void QmmpFileDialogImpl::on_treeView_doubleClicked(const QModelIndex& ind)
treeView->selectionModel()->clear ();
fileListView->setRootIndex(ind);
fileListView->selectionModel()->clear ();
-#if QT_VERSION >= 0x040400
m_model->setRootPath(m_model->filePath(ind));
-#endif
}
else
{
@@ -183,9 +172,7 @@ void QmmpFileDialogImpl::on_fileListView_doubleClicked(const QModelIndex& ind)
fileListView->selectionModel()->clear ();
treeView->setRootIndex(ind);
treeView->selectionModel()->clear ();
-#if QT_VERSION >= 0x040400
m_model->setRootPath(m_model->filePath(ind));
-#endif
}
else
{
@@ -277,9 +264,7 @@ void QmmpFileDialogImpl::setModeAndMask(const QString& d,FileDialog::Mode m, con
{
fileListView->setRootIndex(m_model->index(path));
treeView->setRootIndex(m_model->index(path));
-#if QT_VERSION >= 0x040400
m_model->setRootPath(path);
-#endif
}
if (m == FileDialog::AddDirs || m == FileDialog::AddDir)
diff --git a/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.h b/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.h
index 76eb1f4e0..f77e49e18 100644
--- a/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.h
+++ b/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.h
@@ -25,14 +25,9 @@
#include <QDialog>
#include <QCompleter>
#include <QAbstractItemView>
-
#include <qmmpui/filedialog.h>
-
-#if QT_VERSION >= 0x040400
#include <QFileSystemModel>
-#else
-#include <QDirModel>
-#endif
+
class QmmpFileDialogImpl : public QDialog , private Ui::QmmpFileDialog
{
@@ -61,13 +56,6 @@ signals:
void filesAdded(const QStringList&);
protected:
-
-#if QT_VERSION >= 0x040400
- QFileSystemModel* m_model;
-#else
- QDirModel* m_model;
-#endif
-
virtual void hideEvent (QHideEvent *event);
private slots:
@@ -75,6 +63,7 @@ private slots:
private:
int m_mode;
+ QFileSystemModel* m_model;
void addToHistory(const QString &path);
void addFiles(const QStringList &list);
QStringList m_history;
@@ -93,12 +82,7 @@ public:
QString pathFromIndex(const QModelIndex &index) const
{
-#if QT_VERSION >= 0x040400
const QFileSystemModel *dirModel = static_cast<const QFileSystemModel *>(model());
-#else
- const QDirModel *dirModel = static_cast<const QDirModel *>(model());
-#endif
-
QString currentLocation = dirModel->filePath(m_itemView->rootIndex());
QString path = dirModel->filePath(index);
if (path.startsWith(currentLocation))
@@ -116,11 +100,7 @@ public:
QStringList parts;
if (!path.startsWith(QDir::separator()))
{
-#if QT_VERSION >= 0x040400
const QFileSystemModel *dirModel = static_cast<const QFileSystemModel *>(model());
-#else
- const QDirModel *dirModel = static_cast<const QDirModel *>(model());
-#endif
QString currentLocation = QDir::toNativeSeparators(dirModel->filePath(m_itemView->rootIndex()));
parts = QCompleter::splitPath(currentLocation);
}