forked from qt-creator/qt-creator
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:
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QDir>
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
@@ -227,7 +226,7 @@ QStandardItemModel *NickNameDialog::createModel(QObject *parent)
|
|||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NickNameDialog::populateModelFromMailCapFile(const QString &fileName,
|
bool NickNameDialog::populateModelFromMailCapFile(const FilePath &fileName,
|
||||||
QStandardItemModel *model,
|
QStandardItemModel *model,
|
||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
@@ -236,7 +235,7 @@ bool NickNameDialog::populateModelFromMailCapFile(const QString &fileName,
|
|||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
FileReader reader;
|
FileReader reader;
|
||||||
if (!reader.fetch(FilePath::fromString(fileName), QIODevice::Text, errorMessage))
|
if (!reader.fetch(fileName, QIODevice::Text, errorMessage))
|
||||||
return false;
|
return false;
|
||||||
// Split into lines and read
|
// Split into lines and read
|
||||||
NickNameEntry entry;
|
NickNameEntry entry;
|
||||||
@@ -247,7 +246,7 @@ bool NickNameDialog::populateModelFromMailCapFile(const QString &fileName,
|
|||||||
model->appendRow(entry.toModelRow());
|
model->appendRow(entry.toModelRow());
|
||||||
} else {
|
} else {
|
||||||
qWarning("%s: Invalid mail cap entry at line %d: '%s'\n",
|
qWarning("%s: Invalid mail cap entry at line %d: '%s'\n",
|
||||||
qPrintable(QDir::toNativeSeparators(fileName)),
|
qPrintable(fileName.toUserOutput()),
|
||||||
i + 1, qPrintable(lines.at(i)));
|
i + 1, qPrintable(lines.at(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,10 @@ class QSortFilterProxyModel;
|
|||||||
class QStandardItemModel;
|
class QStandardItemModel;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Utils { class TreeView; }
|
namespace Utils {
|
||||||
|
class FilePath;
|
||||||
|
class TreeView;
|
||||||
|
}
|
||||||
|
|
||||||
namespace VcsBase::Internal {
|
namespace VcsBase::Internal {
|
||||||
|
|
||||||
@@ -29,7 +32,7 @@ public:
|
|||||||
|
|
||||||
// Utilities to initialize/populate the model
|
// Utilities to initialize/populate the model
|
||||||
static QStandardItemModel *createModel(QObject *parent);
|
static QStandardItemModel *createModel(QObject *parent);
|
||||||
static bool populateModelFromMailCapFile(const QString &file,
|
static bool populateModelFromMailCapFile(const Utils::FilePath &file,
|
||||||
QStandardItemModel *model,
|
QStandardItemModel *model,
|
||||||
QString *errorMessage);
|
QString *errorMessage);
|
||||||
|
|
||||||
|
@@ -138,7 +138,7 @@ QStandardItemModel *VcsPlugin::nickNameModel()
|
|||||||
void VcsPlugin::populateNickNameModel()
|
void VcsPlugin::populateNickNameModel()
|
||||||
{
|
{
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
if (!NickNameDialog::populateModelFromMailCapFile(settings().nickNameMailMap.value(),
|
if (!NickNameDialog::populateModelFromMailCapFile(settings().nickNameMailMap.filePath(),
|
||||||
d->m_nickNameModel,
|
d->m_nickNameModel,
|
||||||
&errorMessage)) {
|
&errorMessage)) {
|
||||||
qWarning("%s", qPrintable(errorMessage));
|
qWarning("%s", qPrintable(errorMessage));
|
||||||
|
Reference in New Issue
Block a user