NickNameDialog: Use more FilePath

Change-Id: Id7677a636977343ab6cef72ad0267f27981c640a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-10-04 17:44:50 +02:00
parent 26d9e6900e
commit 772d3d7c79
3 changed files with 9 additions and 7 deletions

View File

@@ -10,7 +10,6 @@
#include <QDebug>
#include <QDialogButtonBox>
#include <QDir>
#include <QPushButton>
#include <QStandardItemModel>
#include <QSortFilterProxyModel>
@@ -227,7 +226,7 @@ QStandardItemModel *NickNameDialog::createModel(QObject *parent)
return model;
}
bool NickNameDialog::populateModelFromMailCapFile(const QString &fileName,
bool NickNameDialog::populateModelFromMailCapFile(const FilePath &fileName,
QStandardItemModel *model,
QString *errorMessage)
{
@@ -236,7 +235,7 @@ bool NickNameDialog::populateModelFromMailCapFile(const QString &fileName,
if (fileName.isEmpty())
return true;
FileReader reader;
if (!reader.fetch(FilePath::fromString(fileName), QIODevice::Text, errorMessage))
if (!reader.fetch(fileName, QIODevice::Text, errorMessage))
return false;
// Split into lines and read
NickNameEntry entry;
@@ -247,7 +246,7 @@ bool NickNameDialog::populateModelFromMailCapFile(const QString &fileName,
model->appendRow(entry.toModelRow());
} else {
qWarning("%s: Invalid mail cap entry at line %d: '%s'\n",
qPrintable(QDir::toNativeSeparators(fileName)),
qPrintable(fileName.toUserOutput()),
i + 1, qPrintable(lines.at(i)));
}
}

View File

@@ -13,7 +13,10 @@ class QSortFilterProxyModel;
class QStandardItemModel;
QT_END_NAMESPACE
namespace Utils { class TreeView; }
namespace Utils {
class FilePath;
class TreeView;
}
namespace VcsBase::Internal {
@@ -29,7 +32,7 @@ public:
// Utilities to initialize/populate the model
static QStandardItemModel *createModel(QObject *parent);
static bool populateModelFromMailCapFile(const QString &file,
static bool populateModelFromMailCapFile(const Utils::FilePath &file,
QStandardItemModel *model,
QString *errorMessage);

View File

@@ -138,7 +138,7 @@ QStandardItemModel *VcsPlugin::nickNameModel()
void VcsPlugin::populateNickNameModel()
{
QString errorMessage;
if (!NickNameDialog::populateModelFromMailCapFile(settings().nickNameMailMap.value(),
if (!NickNameDialog::populateModelFromMailCapFile(settings().nickNameMailMap.filePath(),
d->m_nickNameModel,
&errorMessage)) {
qWarning("%s", qPrintable(errorMessage));