Commit d5fee962 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Don't use nullptr as flag value

parent 1b986f19
......@@ -309,10 +309,10 @@ int PhraseBook::save(QWidget *parent, const QString &title, QUrl &url, bool phra
bool result;
if (fdlg.selectedNameFilter() == QLatin1String("*.phrasebook")) {
if (url.fileName(nullptr).contains(QLatin1Char('.')) == 0) {
if (url.fileName(QUrl::PrettyDecoded).contains(QLatin1Char('.')) == 0) {
url = url.adjusted(QUrl::RemoveFilename);
url.setPath(url.path() + url.fileName(nullptr) + QStringLiteral(".phrasebook"));
} else if (url.fileName(nullptr).rightRef(11).contains(QLatin1String(".phrasebook"), Qt::CaseInsensitive) == 0) {
url.setPath(url.path() + url.fileName(QUrl::PrettyDecoded) + QStringLiteral(".phrasebook"));
} else if (url.fileName(QUrl::PrettyDecoded).rightRef(11).contains(QLatin1String(".phrasebook"), Qt::CaseInsensitive) == 0) {
int filetype = KMessageBox::questionYesNoCancel(nullptr, QStringLiteral("<qt>%1</qt>").arg(i18n("Your chosen filename <i>%1</i> has a different extension than <i>.phrasebook</i>. "
"Do you wish to add <i>.phrasebook</i> to the filename?", url.fileName())), i18n("File Extension"), KGuiItem(i18n("Add")), KGuiItem(i18n("Do Not Add")));
if (filetype == KMessageBox::Cancel) {
......@@ -320,12 +320,12 @@ int PhraseBook::save(QWidget *parent, const QString &title, QUrl &url, bool phra
}
if (filetype == KMessageBox::Yes) {
url = url.adjusted(QUrl::RemoveFilename);
url.setPath(url.path() + url.fileName(nullptr) + QStringLiteral(".phrasebook"));
url.setPath(url.path() + url.fileName(QUrl::PrettyDecoded) + QStringLiteral(".phrasebook"));
}
}
result = save(url, true);
} else if (fdlg.selectedNameFilter() == QLatin1String("*.txt")) {
if (url.fileName(nullptr).rightRef(11).contains(QLatin1String(".phrasebook"), Qt::CaseInsensitive) == 0) {
if (url.fileName(QUrl::PrettyDecoded).rightRef(11).contains(QLatin1String(".phrasebook"), Qt::CaseInsensitive) == 0) {
result = save(url, false);
} else {
int filetype = KMessageBox::questionYesNoCancel(nullptr, QStringLiteral("<qt>%1</qt>").arg(i18n("Your chosen filename <i>%1</i> has the extension <i>.phrasebook</i>. "
......
Markdown is supported
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