diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-06-10 09:53:50 +0300 |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-06-10 09:53:50 +0300 |
commit | 2d34a0f7cc4a7302871c942a827bd4278cdde10b (patch) | |
tree | 8de799055cdfc22bf3e9e7c1b757b7c568ca0c38 /demos/embedded/desktopservices/contenttab.cpp | |
parent | dcaa6ab545e7532b5455734bd8d234cb76b152fa (diff) | |
download | qt4-tools-2d34a0f7cc4a7302871c942a827bd4278cdde10b.tar.gz |
Implemented content filters for desktopservices example.
Now only the relevant files are shown under images and music tabs,
even the folder would contain other content types.
Diffstat (limited to 'demos/embedded/desktopservices/contenttab.cpp')
-rw-r--r-- | demos/embedded/desktopservices/contenttab.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/demos/embedded/desktopservices/contenttab.cpp b/demos/embedded/desktopservices/contenttab.cpp index 12e80f6ac2..450a08014d 100644 --- a/demos/embedded/desktopservices/contenttab.cpp +++ b/demos/embedded/desktopservices/contenttab.cpp @@ -66,9 +66,13 @@ ContentTab::~ContentTab() // NEW PUBLIC METHODS void ContentTab::init(const QDesktopServices::StandardLocation &location, + const QString &filter, const QString &icon) { setContentDir(location); + QStringList filterList; + filterList = filter.split(";"); + m_ContentDir.setNameFilters(filterList); setIcon(icon); connect(this, SIGNAL(itemClicked(QListWidgetItem *)), @@ -90,7 +94,7 @@ void ContentTab::setIcon(const QString &icon) void ContentTab::populateListWidget() { - QFileInfoList fileList = m_ContentDir.entryInfoList(QStringList(), QDir::Files, QDir::Time); + QFileInfoList fileList = m_ContentDir.entryInfoList(QDir::Files, QDir::Time); foreach(QFileInfo item, fileList) { new QListWidgetItem(m_Icon, itemName(item), this); } |