mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Finishing of attachments
This commit is contained in:
@@ -296,7 +296,7 @@ private:
|
||||
};
|
||||
|
||||
/// PDF document main class.
|
||||
class PDFDocument
|
||||
class PDFFORQTLIBSHARED_EXPORT PDFDocument
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(pdf::PDFDocument)
|
||||
|
||||
|
@@ -37,6 +37,7 @@ public:
|
||||
const QDateTime& getCreationDate() const { return m_creationDate; }
|
||||
const QDateTime& getModifiedDate() const { return m_modifiedDate; }
|
||||
const QByteArray& getChecksum() const { return m_checksum; }
|
||||
const PDFStream* getStream() const { return m_stream.getStream(); }
|
||||
|
||||
static PDFEmbeddedFile parse(const PDFDocument* document, PDFObject object);
|
||||
|
||||
|
@@ -565,7 +565,8 @@ void PDFAttachmentsTreeItemModel::update()
|
||||
auto it = subroots.find(fileTypeName);
|
||||
if (it == subroots.cend())
|
||||
{
|
||||
subroot = new PDFAttachmentsTreeItem(nullptr, icon, fileTypeDescription, QString(), nullptr);
|
||||
QIcon folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirIcon);
|
||||
subroot = new PDFAttachmentsTreeItem(nullptr, qMove(folderIcon), fileTypeDescription, QString(), nullptr);
|
||||
root->addCreatedChild(subroot);
|
||||
subroots[fileTypeName] = subroot;
|
||||
}
|
||||
@@ -585,7 +586,32 @@ void PDFAttachmentsTreeItemModel::update()
|
||||
|
||||
Qt::ItemFlags PDFAttachmentsTreeItemModel::flags(const QModelIndex& index) const
|
||||
{
|
||||
return PDFTreeItemModel::flags(index);
|
||||
if (!index.isValid())
|
||||
{
|
||||
return Qt::NoItemFlags;
|
||||
}
|
||||
|
||||
if (rowCount(index) > 0)
|
||||
{
|
||||
return Qt::ItemIsEnabled;
|
||||
}
|
||||
|
||||
if (index.column() == Title)
|
||||
{
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemNeverHasChildren;
|
||||
}
|
||||
|
||||
return Qt::ItemIsEnabled | Qt::ItemNeverHasChildren;
|
||||
}
|
||||
|
||||
const PDFFileSpecification* PDFAttachmentsTreeItemModel::getFileSpecification(const QModelIndex& index) const
|
||||
{
|
||||
if (index.isValid())
|
||||
{
|
||||
return static_cast<const PDFAttachmentsTreeItem*>(index.internalPointer())->getFileSpecification();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
@@ -213,6 +213,8 @@ public:
|
||||
virtual QVariant data(const QModelIndex& index, int role) const override;
|
||||
virtual void update() override;
|
||||
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
|
||||
const PDFFileSpecification* getFileSpecification(const QModelIndex& index) const;
|
||||
};
|
||||
|
||||
} // namespace pdf
|
||||
|
Reference in New Issue
Block a user