Commit e4a0cb19 authored by Elvis Angelaccio's avatar Elvis Angelaccio
Browse files

ArchiveEntry: introduce displayName

This property is meant as the visible name of the entry in the UI.
Currently this is always equal to the name property.
parent 6784a259
......@@ -119,6 +119,15 @@ QString Archive::Entry::fullPath(PathFormat format) const
}
}
QString Archive::Entry::displayName() const
{
if (m_displayName.isEmpty()) {
return m_name;
}
return m_displayName;
}
QString Archive::Entry::name() const
{
return m_name;
......@@ -129,6 +138,11 @@ QStringView Archive::Entry::nameView() const
return m_name;
}
void Archive::Entry::setDisplayName(const QString &displayName)
{
m_displayName = displayName;
}
void Archive::Entry::setIsDirectory(const bool isDirectory)
{
m_isDirectory = isDirectory;
......
......@@ -34,7 +34,10 @@ class Archive::Entry : public QObject
* below, so set those that are available.
*/
Q_PROPERTY(QString fullPath MEMBER m_fullPath WRITE setFullPath)
/// The internal name of the entry in the archive.
Q_PROPERTY(QString name READ name)
/// The visible name of the entry in the UI. This is currently always equal to the name of the entry.
Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName)
Q_PROPERTY(QString permissions MEMBER m_permissions)
Q_PROPERTY(QString owner MEMBER m_owner)
Q_PROPERTY(QString group MEMBER m_group)
......@@ -68,8 +71,10 @@ public:
void setParent(Entry *parent);
void setFullPath(const QString &fullPath);
QString fullPath(PathFormat format = WithTrailingSlash) const;
QString displayName() const;
QString name() const;
QStringView nameView() const;
void setDisplayName(const QString &displayName);
void setIsDirectory(const bool isDirectory);
bool isDir() const;
void setIsExecutable(const bool isExecutable);
......@@ -96,6 +101,7 @@ public:
private:
QVector<Entry*> m_entries;
QString m_name;
QString m_displayName;
Entry *m_parent;
QString m_fullPath;
......
Supports Markdown
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