Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit ec3ae035 authored by Laurent Montel's avatar Laurent Montel 😁

Fix some clazy warning

parent 0d20fdd8
......@@ -62,7 +62,7 @@ void ConfigWizard::initCommandPage()
addPage(commandWidget);
commandWidget->setFinalPage(true);
} else
commandWidget = 0;
commandWidget = nullptr;
}
void ConfigWizard::initBookPage()
......@@ -75,10 +75,10 @@ void ConfigWizard::initBookPage()
bookWidget->setTitle(i18n("Initial Phrase Book"));
addPage(bookWidget);
bookWidget->setFinalPage(true);
if (commandWidget != 0)
if (commandWidget != nullptr)
commandWidget->setFinalPage(false);
} else
bookWidget = 0;
bookWidget = nullptr;
}
void ConfigWizard::initCompletion()
......@@ -98,7 +98,7 @@ void ConfigWizard::initCompletion()
}
if (KSharedConfig::openConfig()->hasGroup("Completion")) {
completionWidget = 0;
completionWidget = nullptr;
return;
}
......@@ -108,31 +108,31 @@ void ConfigWizard::initCompletion()
addPage(completionWidget);
completionWidget->setFinalPage(true);
if (commandWidget != 0)
if (commandWidget != nullptr)
commandWidget->setFinalPage(false);
if (bookWidget != 0)
if (bookWidget != nullptr)
bookWidget->setFinalPage(false);
} else
completionWidget = 0;
completionWidget = nullptr;
}
void ConfigWizard::saveConfig()
{
if (commandWidget != 0) {
if (commandWidget != nullptr) {
commandWidget->ok();
commandWidget->saveOptions(QStringLiteral("TTS System"));
}
if (bookWidget != 0)
if (bookWidget != nullptr)
bookWidget->createBook();
if (completionWidget != 0)
if (completionWidget != nullptr)
completionWidget->ok();
}
bool ConfigWizard::requestConfiguration()
{
if (commandWidget != 0 || bookWidget != 0 || completionWidget != 0)
if (commandWidget != nullptr || bookWidget != nullptr || completionWidget != nullptr)
return (exec() == QDialog::Accepted);
else
return false;
......@@ -140,7 +140,7 @@ bool ConfigWizard::requestConfiguration()
bool ConfigWizard::configurationNeeded()
{
return (commandWidget != 0 || bookWidget != 0 || completionWidget != 0);
return (commandWidget != nullptr || bookWidget != nullptr || completionWidget != nullptr);
}
void ConfigWizard::help()
......
......@@ -47,7 +47,7 @@
#include "optionsdialog.h"
#include "configwizard.h"
KMouthApp::KMouthApp(QWidget* , const QString& name): KXmlGuiWindow(0)
KMouthApp::KMouthApp(QWidget* , const QString& name): KXmlGuiWindow(nullptr)
{
setWindowIcon(QIcon::fromTheme(QStringLiteral("kmouth")));
setObjectName(name);
......@@ -89,7 +89,7 @@ KMouthApp::KMouthApp(QWidget* , const QString& name): KXmlGuiWindow(0)
fileSaveAs->setEnabled(false);
filePrint->setEnabled(false);
printer = 0;
printer = nullptr;
}
KMouthApp::~KMouthApp()
......@@ -273,7 +273,7 @@ void KMouthApp::saveOptions()
// FIXME: KToolBar no longer has barPos() method.
// cg.writeEntry("ToolBarPos", (int) toolBar("mainToolBar")->barPos());
if (phraseList != 0)
if (phraseList != nullptr)
phraseList->saveCompletionOptions();
optionsDialog->saveOptions();
KConfigGroup cg2(KSharedConfig::openConfig(), "mainToolBar");
......@@ -322,7 +322,7 @@ void KMouthApp::readOptions()
toolBar(QStringLiteral("phrasebookBar"))->applySettings(KSharedConfig::openConfig()->group("phrasebookBar"));
slotPhrasebookConfirmed();
if (phraseList != 0)
if (phraseList != nullptr)
phraseList->readCompletionOptions();
}
......@@ -373,11 +373,11 @@ void KMouthApp::slotFilePrint()
{
slotStatusMsg(i18n("Printing..."));
if (printer == 0) {
if (printer == nullptr) {
printer = new QPrinter();
}
QPrintDialog *printDialog = new QPrintDialog(printer, 0);
QPrintDialog *printDialog = new QPrintDialog(printer, nullptr);
if (printDialog->exec()) {
phraseList->print(printer);
......
......@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
KAboutData aboutData(QStringLiteral("kmouth"),
i18n("KMouth"),
QLatin1String(KMOUTH_VERSION),
QStringLiteral(KMOUTH_VERSION),
i18n("A type-and-say front end for speech synthesizers"),
KAboutLicense::GPL,
i18n("(c) 2002/2003, Gunnar Schmi Dt"),
......
......@@ -155,7 +155,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
pageGeneral->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
addPage(pageGeneral);
completionWidget = new WordCompletionWidget(0, "Word Completion widget");
completionWidget = new WordCompletionWidget(nullptr, "Word Completion widget");
KPageWidgetItem *pageCompletion = new KPageWidgetItem(completionWidget, i18n("Word Completion"));
pageCompletion->setHeader(i18n("Word Completion"));
pageCompletion->setIcon(QIcon::fromTheme(QStringLiteral("keyboard")));
......
......@@ -303,7 +303,7 @@ int PhraseBook::save(QWidget *parent, const QString &title, QUrl &url, bool phra
}
if (QFile::exists(url.toLocalFile())) {
if (KMessageBox::warningContinueCancel(0, QStringLiteral("<qt>%1</qt>").arg(i18n("The file %1 already exists. "
if (KMessageBox::warningContinueCancel(nullptr, QStringLiteral("<qt>%1</qt>").arg(i18n("The file %1 already exists. "
"Do you want to overwrite it?", url.url())), i18n("File Exists"), KGuiItem(i18n("&Overwrite"))) == KMessageBox::Cancel) {
return 0;
}
......@@ -311,26 +311,26 @@ int PhraseBook::save(QWidget *parent, const QString &title, QUrl &url, bool phra
bool result;
if (fdlg.selectedNameFilter() == QLatin1String("*.phrasebook")) {
if (url.fileName(0).contains(QLatin1Char('.')) == 0) {
if (url.fileName(nullptr).contains(QLatin1Char('.')) == 0) {
url = url.adjusted(QUrl::RemoveFilename);
url.setPath(url.path() + url.fileName(0) + QStringLiteral(".phrasebook"));
} else if (url.fileName(0).rightRef(11).contains(QLatin1String(".phrasebook"), Qt::CaseInsensitive) == 0) {
int filetype = KMessageBox::questionYesNoCancel(0, QStringLiteral("<qt>%1</qt>").arg(i18n("Your chosen filename <i>%1</i> has a different extension than <i>.phrasebook</i>. "
url.setPath(url.path() + url.fileName(nullptr) + QStringLiteral(".phrasebook"));
} else if (url.fileName(nullptr).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) {
return 0;
}
if (filetype == KMessageBox::Yes) {
url = url.adjusted(QUrl::RemoveFilename);
url.setPath(url.path() + url.fileName(0) + QStringLiteral(".phrasebook"));
url.setPath(url.path() + url.fileName(nullptr) + QStringLiteral(".phrasebook"));
}
}
result = save(url, true);
} else if (fdlg.selectedNameFilter() == QLatin1String("*.txt")) {
if (url.fileName(0).rightRef(11).contains(QLatin1String(".phrasebook"), Qt::CaseInsensitive) == 0) {
if (url.fileName(nullptr).rightRef(11).contains(QLatin1String(".phrasebook"), Qt::CaseInsensitive) == 0) {
result = save(url, false);
} else {
int filetype = KMessageBox::questionYesNoCancel(0, QStringLiteral("<qt>%1</qt>").arg(i18n("Your chosen filename <i>%1</i> has the extension <i>.phrasebook</i>. "
int filetype = KMessageBox::questionYesNoCancel(nullptr, QStringLiteral("<qt>%1</qt>").arg(i18n("Your chosen filename <i>%1</i> has the extension <i>.phrasebook</i>. "
"Do you wish to save in phrasebook format?", url.fileName())), i18n("File Extension"), KGuiItem(i18n("As Phrasebook")), KGuiItem(i18n("As Plain Text")));
if (filetype == KMessageBox::Cancel) {
return 0;
......@@ -452,7 +452,7 @@ QString PhraseBook::displayPath(QString filename)
void PhraseBook::addToGUI(QMenu *popup, KToolBar *toolbar, KActionCollection *phrases,
QObject *receiver, const char *slot) const
{
if ((popup != 0) || (toolbar != 0)) {
if ((popup != nullptr) || (toolbar != nullptr)) {
QStack<QWidget*> stack;
QWidget *parent = popup;
int level = 0;
......@@ -465,7 +465,7 @@ void PhraseBook::addToGUI(QMenu *popup, KToolBar *toolbar, KActionCollection *ph
menu->setDelayed(false);
if (parent == popup)
toolbar->addAction(menu);
if (parent != 0) {
if (parent != nullptr) {
parent->addAction(menu);
stack.push(parent);
}
......@@ -482,7 +482,7 @@ void PhraseBook::addToGUI(QMenu *popup, KToolBar *toolbar, KActionCollection *ph
phrase.getShortcut(), receiver, slot, phrases);
if (parent == popup)
toolbar->addAction(action);
if (parent != 0)
if (parent != nullptr)
parent->addAction(action);
} else {
Phrase phrase = (*it).getPhrase();
......
......@@ -512,8 +512,8 @@ void PhraseBookDialog::contextMenuRequested(const QPoint &pos)
name = QStringLiteral("phrasebook_popup_nosel");
QMenu *popup = (QMenu *)factory()->container(name, this);
if (popup != 0) {
popup->popup(m_ui->treeView->mapToGlobal(pos), 0);
if (popup != nullptr) {
popup->popup(m_ui->treeView->mapToGlobal(pos), nullptr);
}
}
......@@ -553,7 +553,7 @@ void PhraseBookDialog::slotPaste()
const QMimeData *data = QApplication::clipboard()->mimeData();
QModelIndex index = m_ui->treeView->selectionModel()->currentIndex();
QStandardItem *item = m_bookModel->itemFromIndex(index);
while (item != NULL && !item->isDropEnabled())
while (item != nullptr && !item->isDropEnabled())
item = item->parent();
QDomDocument document;
document.setContent(data->text());
......@@ -565,7 +565,7 @@ QModelIndex PhraseBookDialog::getCurrentParent()
{
QModelIndex currentIndex = m_ui->treeView->currentIndex();
QStandardItem *item = m_bookModel->itemFromIndex(currentIndex);
if (item != NULL && !item->isDropEnabled()) // If it's not a book
if (item != nullptr && !item->isDropEnabled()) // If it's not a book
currentIndex = currentIndex.parent();
return currentIndex;
}
......@@ -648,7 +648,7 @@ void PhraseBookDialog::slotImportPhrasebook(const QUrl &url)
document.setContent(&file);
QDomNode node = document.documentElement();
QStandardItem *item = 0;
QStandardItem *item = nullptr;
if (node.hasAttributes()) {
// It has attributes, so add it directly
item = deserializeBook(node, parentItem);
......
......@@ -355,8 +355,8 @@ void PhraseList::contextMenuRequested(const QPoint &pos)
KMouthApp *theApp = (KMouthApp *) parentWidget();
KXMLGUIFactory *factory = theApp->factory();
QMenu *popup = (QMenu *)factory->container(name, theApp);
if (popup != 0) {
popup->exec(pos, 0);
if (popup != nullptr) {
popup->exec(pos, nullptr);
}
}
......
......@@ -52,7 +52,7 @@ void TextToSpeechSystem::speak(const QString &text, const QString &language)
}
if (codec < Speech::UseCodec)
(new Speech())->speak(ttsCommand, stdIn, text, language, codec, 0);
(new Speech())->speak(ttsCommand, stdIn, text, language, codec, nullptr);
else
(new Speech())->speak(ttsCommand, stdIn, text, language, Speech::UseCodec,
codecList->at(codec - Speech::UseCodec));
......
......@@ -173,7 +173,7 @@ void WordCompletionWidget::deleteDictionary()
int row = dictionaryView->currentIndex().row();
const QStandardItem *nameItem = model->item(row, 0);
if (nameItem != 0) {
if (nameItem != nullptr) {
removedDictionaryFiles += nameItem->data().toString();
qDeleteAll(model->takeRow(row));
}
......@@ -203,13 +203,13 @@ void WordCompletionWidget::exportDictionary()
{
const QStandardItem *nameItem = model->item(dictionaryView->currentIndex().row(), 0);
if (nameItem != 0) {
if (nameItem != nullptr) {
QUrl url = QFileDialog::getSaveFileUrl(this, i18n("Export Dictionary"));
if (url.isEmpty() || !url.isValid())
return;
if (url.isLocalFile() && QFile::exists(url.toLocalFile())) {
if (KMessageBox::warningContinueCancel(0, QStringLiteral("<qt>%1</qt>").arg(i18n("The file %1 already exists. "
if (KMessageBox::warningContinueCancel(nullptr, QStringLiteral("<qt>%1</qt>").arg(i18n("The file %1 already exists. "
"Do you want to overwrite it?", url.url())), i18n("File Exists"), KGuiItem(i18n("&Overwrite"))) == KMessageBox::Cancel) {
return;
}
......@@ -245,7 +245,7 @@ void WordCompletionWidget::nameChanged(const QString &text)
{
const QStandardItem *nameItem = model->item(dictionaryView->currentIndex().row(), 0);
if (nameItem != 0) {
if (nameItem != nullptr) {
QString old = nameItem->text();
if (old != text) {
......@@ -261,7 +261,7 @@ void WordCompletionWidget::languageSelected()
{
const QStandardItem *languageItem = model->item(dictionaryView->currentIndex().row(), 1);
if (languageItem != 0) {
if (languageItem != nullptr) {
QString old = languageItem->text();
QString text = languageButton->current();
......
......@@ -128,7 +128,7 @@ WordMap XMLParser::getList()
QProgressDialog *progressDialog()
{
QProgressDialog *pdlg = new QProgressDialog(i18n("Creating Word List"), i18n("Parsing the KDE documentation..."), 0, 100);
pdlg->setCancelButton(0);
pdlg->setCancelButton(nullptr);
pdlg->setAutoReset(false);
pdlg->setAutoClose(false);
return pdlg;
......@@ -219,7 +219,7 @@ void addWordsFromFile(WordMap &map, QString filename, QTextCodec *codec)
QFile file(filename);
if (file.open(QIODevice::ReadOnly)) {
QTextStream stream(&file);
Q_ASSERT(codec != 0);
Q_ASSERT(codec != nullptr);
stream.setCodec(codec);
while (!stream.atEnd())
addWords(map, stream.readLine());
......
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