diff options
Diffstat (limited to 'src/plugins/resourceeditor/qrceditor/resourcefile.cpp')
-rw-r--r-- | src/plugins/resourceeditor/qrceditor/resourcefile.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp index 81c211cb0a..cff7443c7f 100644 --- a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp +++ b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. @@ -448,6 +448,18 @@ QString ResourceFile::absolutePath(const QString &rel_path) const return QDir::cleanPath(rc); } +void ResourceFile::orderList() +{ + for (Prefix *p : m_prefix_list) { + std::sort(p->file_list.begin(), p->file_list.end(), [&](File *f1, File *f2) { + return *f1 < *f2; + }); + } + + if (!save()) + m_error_message = tr("Cannot save file."); +} + bool ResourceFile::contains(const QString &prefix, const QString &lang, const QString &file) const { int pref_idx = indexOfPrefix(prefix, lang); @@ -688,6 +700,11 @@ QList<QModelIndex> ResourceModel::nonExistingFiles() const return files; } +void ResourceModel::orderList() +{ + m_resource_file.orderList(); +} + Qt::ItemFlags ResourceModel::flags(const QModelIndex &index) const { Qt::ItemFlags f = QAbstractItemModel::flags(index); @@ -1234,7 +1251,7 @@ EntryBackup * RelativeResourceModel::removeEntry(const QModelIndex &index) deleteItem(index); return new FileEntryBackup(*this, prefixIndex.row(), index.row(), fileNameBackup, aliasBackup); } - Utils::RemoveFileDialog removeFileDialog(fileNameBackup, Core::ICore::mainWindow()); + Utils::RemoveFileDialog removeFileDialog(fileNameBackup, Core::ICore::dialogParent()); if (removeFileDialog.exec() == QDialog::Accepted) { deleteItem(index); Core::FileUtils::removeFile(fileNameBackup, removeFileDialog.isDeleteFileChecked()); |