mirror of
https://github.com/linuxdeepin/gio-qt.git
synced 2024-12-27 07:26:09 +01:00
feat: able to get icon from DGioFileInfo
This commit is contained in:
parent
8ddb30527b
commit
72fe073e31
4 changed files with 13 additions and 0 deletions
|
@ -54,6 +54,7 @@ public:
|
||||||
QString basename() const;
|
QString basename() const;
|
||||||
QString path() const;
|
QString path() const;
|
||||||
QString uri() const;
|
QString uri() const;
|
||||||
|
|
||||||
QExplicitlySharedDataPointer<DGioFileInfo> createFileInfo(QString attr = "*", DGioFileQueryInfoFlags queryInfoFlags = FILE_QUERY_INFO_NONE);
|
QExplicitlySharedDataPointer<DGioFileInfo> createFileInfo(QString attr = "*", DGioFileQueryInfoFlags queryInfoFlags = FILE_QUERY_INFO_NONE);
|
||||||
QExplicitlySharedDataPointer<DGioFileInfo> createFileSystemInfo(QString attr = "*");
|
QExplicitlySharedDataPointer<DGioFileInfo> createFileSystemInfo(QString attr = "*");
|
||||||
QExplicitlySharedDataPointer<DGioFileIterator> createFileIterator(QString attr = "*", DGioFileQueryInfoFlags queryInfoFlags = FILE_QUERY_INFO_NONE);
|
QExplicitlySharedDataPointer<DGioFileIterator> createFileIterator(QString attr = "*", DGioFileQueryInfoFlags queryInfoFlags = FILE_QUERY_INFO_NONE);
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
DGioFileType fileType() const;
|
DGioFileType fileType() const;
|
||||||
quint64 fileSize() const;
|
quint64 fileSize() const;
|
||||||
|
QStringList themedIconNames() const;
|
||||||
|
|
||||||
// filesystem info.
|
// filesystem info.
|
||||||
bool fsReadOnly() const;
|
bool fsReadOnly() const;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "dgiofileinfo.h"
|
#include "dgiofileinfo.h"
|
||||||
|
#include "dgiohelper.h"
|
||||||
|
|
||||||
#include <giomm/fileinfo.h>
|
#include <giomm/fileinfo.h>
|
||||||
|
|
||||||
|
@ -127,6 +128,15 @@ quint64 DGioFileInfo::fileSize() const
|
||||||
return static_cast<quint64>(d->getGmmFileInfoInstance()->get_size());
|
return static_cast<quint64>(d->getGmmFileInfoInstance()->get_size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList DGioFileInfo::themedIconNames() const
|
||||||
|
{
|
||||||
|
Q_D(const DGioFileInfo);
|
||||||
|
|
||||||
|
Glib::RefPtr<const Icon> icon = d->getGmmFileInfoInstance()->get_icon();
|
||||||
|
|
||||||
|
return DGioPrivate::getThemedIconNames(icon);
|
||||||
|
}
|
||||||
|
|
||||||
bool DGioFileInfo::fsReadOnly() const
|
bool DGioFileInfo::fsReadOnly() const
|
||||||
{
|
{
|
||||||
Q_D(const DGioFileInfo);
|
Q_D(const DGioFileInfo);
|
||||||
|
|
|
@ -31,6 +31,7 @@ void DGioSimpleFileInfoTest::testCase_RegularFile()
|
||||||
QCOMPARE(file->basename(), tmpFileInfo.fileName());
|
QCOMPARE(file->basename(), tmpFileInfo.fileName());
|
||||||
QCOMPARE(file->path(), tmpFileInfo.absoluteFilePath());
|
QCOMPARE(file->path(), tmpFileInfo.absoluteFilePath());
|
||||||
QCOMPARE(fi->fileSize(), tmpFileInfo.size());
|
QCOMPARE(fi->fileSize(), tmpFileInfo.size());
|
||||||
|
QVERIFY(fi->themedIconNames().contains("text-plain")); // is this check okay? better approach?
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_APPLESS_MAIN(DGioSimpleFileInfoTest)
|
QTEST_APPLESS_MAIN(DGioSimpleFileInfoTest)
|
||||||
|
|
Loading…
Reference in a new issue