From 335c5bcee65dcb5acea6a752e084fefa9b67c0fa Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Mon, 20 Jun 2016 07:58:29 +0200 Subject: [PATCH] Unified NULL macros for C++ 11. --- rssguard.pro | 15 ++-- src/core/feedsmodel.cpp | 34 +++---- src/core/feedsproxymodel.cpp | 2 +- src/core/message.cpp | 4 +- src/core/messagesmodel.cpp | 4 +- src/core/parsingfactory.cpp | 2 +- src/gui/basetoolbar.cpp | 2 +- src/gui/dialogs/formaddaccount.cpp | 2 +- src/gui/dialogs/formdatabasecleanup.cpp | 4 +- src/gui/dialogs/formmain.cpp | 2 +- src/gui/dialogs/formsettings.cpp | 8 +- src/gui/dialogs/formupdate.cpp | 4 +- src/gui/edittableview.cpp | 2 +- src/gui/feedmessageviewer.cpp | 8 +- src/gui/feedstoolbar.cpp | 2 +- src/gui/feedsview.cpp | 26 +++--- src/gui/messagestoolbar.cpp | 2 +- src/gui/messagesview.cpp | 6 +- src/gui/plaintoolbutton.cpp | 4 +- src/gui/statusbar.cpp | 14 +-- src/gui/systemtrayicon.cpp | 10 +-- src/gui/tabbar.cpp | 2 +- src/gui/tabwidget.cpp | 4 +- src/gui/webbrowser.h | 8 -- src/gui/webbrowser.ui | 46 ---------- src/gui/widgetwithstatus.cpp | 2 +- src/miscellaneous/application.cpp | 20 ++--- src/miscellaneous/databasefactory.cpp | 2 +- src/miscellaneous/databasequeries.cpp | 90 +++++++++---------- src/miscellaneous/skinfactory.cpp | 2 +- src/miscellaneous/systemfactory.cpp | 2 +- src/network-web/downloader.cpp | 8 +- src/network-web/downloadmanager.cpp | 6 +- src/qtsingleapplication/qtlocalpeer.cpp | 4 +- src/services/abstract/accountcheckmodel.cpp | 12 +-- src/services/abstract/feed.cpp | 2 +- src/services/abstract/gui/formfeeddetails.cpp | 10 +-- src/services/abstract/rootitem.cpp | 10 +-- src/services/abstract/serviceroot.cpp | 12 +-- .../owncloud/gui/formeditowncloudaccount.cpp | 4 +- .../owncloud/gui/formowncloudfeeddetails.cpp | 2 +- src/services/owncloud/owncloudcategory.cpp | 2 +- src/services/owncloud/owncloudfeed.cpp | 4 +- src/services/owncloud/owncloudserviceroot.cpp | 6 +- .../gui/formstandardcategorydetails.cpp | 10 +-- .../standard/gui/formstandardfeeddetails.cpp | 2 +- src/services/standard/standardcategory.cpp | 6 +- src/services/standard/standardfeed.cpp | 16 ++-- .../standardfeedsimportexportmodel.cpp | 6 +- .../standard/standardserviceentrypoint.cpp | 2 +- src/services/standard/standardserviceroot.cpp | 14 +-- src/services/tt-rss/gui/formeditaccount.cpp | 4 +- .../tt-rss/gui/formttrssfeeddetails.cpp | 2 +- src/services/tt-rss/ttrsscategory.cpp | 2 +- src/services/tt-rss/ttrssfeed.cpp | 4 +- src/services/tt-rss/ttrssserviceroot.cpp | 6 +- 56 files changed, 218 insertions(+), 273 deletions(-) delete mode 100644 src/gui/webbrowser.ui mode change 100644 => 100755 src/miscellaneous/databasequeries.cpp mode change 100644 => 100755 src/qtsingleapplication/qtlocalpeer.cpp mode change 100644 => 100755 src/services/abstract/accountcheckmodel.cpp mode change 100644 => 100755 src/services/abstract/gui/formfeeddetails.cpp mode change 100644 => 100755 src/services/owncloud/gui/formowncloudfeeddetails.cpp mode change 100644 => 100755 src/services/tt-rss/gui/formttrssfeeddetails.cpp diff --git a/rssguard.pro b/rssguard.pro index 4fda47db0..8bad137fc 100755 --- a/rssguard.pro +++ b/rssguard.pro @@ -266,9 +266,9 @@ HEADERS += src/core/feeddownloader.h \ src/gui/webviewer.h \ src/gui/webbrowser.h \ src/network-web/webpage.h \ - src/gui/locationlineedit.h \ - src/network-web/googlesuggest.h \ - src/gui/discoverfeedsbutton.h + src/gui/locationlineedit.h \ + src/network-web/googlesuggest.h \ + src/gui/discoverfeedsbutton.h SOURCES += src/core/feeddownloader.cpp \ src/core/feedsmodel.cpp \ @@ -377,9 +377,9 @@ SOURCES += src/core/feeddownloader.cpp \ src/gui/webviewer.cpp \ src/gui/webbrowser.cpp \ src/network-web/webpage.cpp \ - src/gui/locationlineedit.cpp \ - src/network-web/googlesuggest.cpp \ - src/gui/discoverfeedsbutton.cpp + src/gui/locationlineedit.cpp \ + src/network-web/googlesuggest.cpp \ + src/gui/discoverfeedsbutton.cpp FORMS += \ src/gui/toolbareditor.ui \ @@ -397,8 +397,7 @@ FORMS += \ src/services/owncloud/gui/formeditowncloudaccount.ui \ src/services/standard/gui/formstandardcategorydetails.ui \ src/services/standard/gui/formstandardimportexport.ui \ - src/services/tt-rss/gui/formeditaccount.ui \ - src/gui/webbrowser.ui + src/services/tt-rss/gui/formeditaccount.ui TRANSLATIONS += localization/qtbase-cs_CZ.ts \ localization/qtbase-da_DK.ts \ diff --git a/src/core/feedsmodel.cpp b/src/core/feedsmodel.cpp index d7a371d68..3d16dfc79 100755 --- a/src/core/feedsmodel.cpp +++ b/src/core/feedsmodel.cpp @@ -46,8 +46,8 @@ FeedsModel::FeedsModel(QObject *parent) : QAbstractItemModel(parent), m_autoUpdateTimer(new QTimer(this)), - m_feedDownloaderThread(NULL), m_feedDownloader(NULL), - m_dbCleanerThread(NULL), m_dbCleaner(NULL) { + m_feedDownloaderThread(nullptr), m_feedDownloader(nullptr), + m_dbCleanerThread(nullptr), m_dbCleaner(nullptr) { setObjectName(QSL("FeedsModel")); // Create root item. @@ -87,7 +87,7 @@ void FeedsModel::quit() { } // Close worker threads. - if (m_feedDownloaderThread != NULL && m_feedDownloaderThread->isRunning()) { + if (m_feedDownloaderThread != nullptr && m_feedDownloaderThread->isRunning()) { m_feedDownloader->stopRunningUpdate(); qDebug("Quitting feed downloader thread."); @@ -99,7 +99,7 @@ void FeedsModel::quit() { } } - if (m_dbCleanerThread != NULL && m_dbCleanerThread->isRunning()) { + if (m_dbCleanerThread != nullptr && m_dbCleanerThread->isRunning()) { qDebug("Quitting database cleaner thread."); m_dbCleanerThread->quit(); @@ -110,12 +110,12 @@ void FeedsModel::quit() { } // Close workers. - if (m_feedDownloader != NULL) { + if (m_feedDownloader != nullptr) { qDebug("Feed downloader exists. Deleting it from memory."); m_feedDownloader->deleteLater(); } - if (m_dbCleaner != NULL) { + if (m_dbCleaner != nullptr) { qDebug("Database cleaner exists. Deleting it from memory."); m_dbCleaner->deleteLater(); } @@ -133,7 +133,7 @@ void FeedsModel::updateFeeds(const QList &feeds) { return; } - if (m_feedDownloader == NULL) { + if (m_feedDownloader == nullptr) { m_feedDownloader = new FeedDownloader(); m_feedDownloaderThread = new QThread(); @@ -185,7 +185,7 @@ void FeedsModel::updateAllFeeds() { } DatabaseCleaner *FeedsModel::databaseCleaner() { - if (m_dbCleaner == NULL) { + if (m_dbCleaner == nullptr) { m_dbCleaner = new DatabaseCleaner(); m_dbCleanerThread = new QThread(); @@ -446,7 +446,7 @@ void FeedsModel::removeItem(const QModelIndex &index) { } void FeedsModel::removeItem(RootItem *deleting_item) { - if (deleting_item != NULL) { + if (deleting_item != nullptr) { QModelIndex index = indexForItem(deleting_item); QModelIndex parent_index = index.parent(); RootItem *parent_item = deleting_item->parent(); @@ -464,7 +464,7 @@ void FeedsModel::reassignNodeToNewParent(RootItem *original_node, RootItem *new_ RootItem *original_parent = original_node->parent(); if (original_parent != new_parent) { - if (original_parent != NULL) { + if (original_parent != nullptr) { int original_index_of_item = original_parent->childItems().indexOf(original_node); if (original_index_of_item >= 0) { @@ -510,12 +510,12 @@ StandardServiceRoot *FeedsModel::standardServiceRoot() const { foreach (ServiceRoot *root, serviceRoots()) { StandardServiceRoot *std_service_root; - if ((std_service_root = dynamic_cast(root)) != NULL) { + if ((std_service_root = dynamic_cast(root)) != nullptr) { return std_service_root; } } - return NULL; + return nullptr; } QList FeedsModel::feedsForScheduledUpdate(bool auto_update_now) { @@ -577,7 +577,7 @@ RootItem *FeedsModel::itemForIndex(const QModelIndex &index) const { } QModelIndex FeedsModel::indexForItem(const RootItem *item) const { - if (item == NULL || item->kind() == RootItemKind::Root) { + if (item == nullptr || item->kind() == RootItemKind::Root) { // Root item lies on invalid index. return QModelIndex(); } @@ -612,7 +612,7 @@ bool FeedsModel::hasAnyFeedNewMessages() const { } bool FeedsModel::isFeedUpdateRunning() const { - return m_feedDownloader != NULL && m_feedDownloader->isUpdateRunning(); + return m_feedDownloader != nullptr && m_feedDownloader->isUpdateRunning(); } void FeedsModel::reloadChangedLayout(QModelIndexList list) { @@ -687,7 +687,7 @@ bool FeedsModel::restoreAllBins() { foreach (ServiceRoot *root, serviceRoots()) { RecycleBin *bin_of_root = root->recycleBin(); - if (bin_of_root != NULL) { + if (bin_of_root != nullptr) { result &= bin_of_root->restore(); } } @@ -701,7 +701,7 @@ bool FeedsModel::emptyAllBins() { foreach (ServiceRoot *root, serviceRoots()) { RecycleBin *bin_of_root = root->recycleBin(); - if (bin_of_root != NULL) { + if (bin_of_root != nullptr) { result &= bin_of_root->empty(); } } @@ -727,7 +727,7 @@ void FeedsModel::loadActivatedServiceAccounts() { } void FeedsModel::stopRunningFeedUpdate() { - if (m_feedDownloader != NULL) { + if (m_feedDownloader != nullptr) { m_feedDownloader->stopRunningUpdate(); } } diff --git a/src/core/feedsproxymodel.cpp b/src/core/feedsproxymodel.cpp index 122958217..7ca4bb519 100755 --- a/src/core/feedsproxymodel.cpp +++ b/src/core/feedsproxymodel.cpp @@ -28,7 +28,7 @@ FeedsProxyModel::FeedsProxyModel(QObject *parent) - : QSortFilterProxyModel(parent), m_selectedItem(NULL), m_showUnreadOnly(false), m_hiddenIndices(QList >()) { + : QSortFilterProxyModel(parent), m_selectedItem(nullptr), m_showUnreadOnly(false), m_hiddenIndices(QList >()) { m_sourceModel = new FeedsModel(this); setObjectName(QSL("FeedsProxyModel")); diff --git a/src/core/message.cpp b/src/core/message.cpp index 758b03abe..d4f0824f6 100755 --- a/src/core/message.cpp +++ b/src/core/message.cpp @@ -73,7 +73,7 @@ Message::Message() { Message Message::fromSqlRecord(const QSqlRecord &record, bool *result) { if (record.count() != MSG_DB_CUSTOM_HASH_INDEX + 1) { - if (result != NULL) { + if (result != nullptr) { *result = false; return Message(); } @@ -95,7 +95,7 @@ Message Message::fromSqlRecord(const QSqlRecord &record, bool *result) { message.m_customId = record.value(MSG_DB_CUSTOM_ID_INDEX).toString(); message.m_customHash = record.value(MSG_DB_CUSTOM_HASH_INDEX).toString(); - if (result != NULL) { + if (result != nullptr) { *result = true; } diff --git a/src/core/messagesmodel.cpp b/src/core/messagesmodel.cpp index 76647f9e7..21809167e 100755 --- a/src/core/messagesmodel.cpp +++ b/src/core/messagesmodel.cpp @@ -40,7 +40,7 @@ MessagesModel::MessagesModel(QObject *parent) // via model, but via DIRECT SQL calls are used to do persistent messages. setEditStrategy(QSqlTableModel::OnManualSubmit); setTable(QSL("Messages")); - loadMessages(NULL); + loadMessages(nullptr); } MessagesModel::~MessagesModel() { @@ -70,7 +70,7 @@ void MessagesModel::setupFonts() { void MessagesModel::loadMessages(RootItem *item) { m_selectedItem = item; - if (item == NULL) { + if (item == nullptr) { setFilter("true != true"); } else { diff --git a/src/core/parsingfactory.cpp b/src/core/parsingfactory.cpp index b367c39f4..e7ac46ae1 100755 --- a/src/core/parsingfactory.cpp +++ b/src/core/parsingfactory.cpp @@ -99,7 +99,7 @@ QList ParsingFactory::parseAsATOM10(const QString &data) { new_message.m_created = current_time; } - // WARNING: There is a difference between "" and QString() in terms of NULL SQL values! + // WARNING: There is a difference between "" and QString() in terms of nullptr SQL values! // This is because of difference in QString::isNull() and QString::isEmpty(), the "" is not null // while QString() is. if (new_message.m_author.isNull()) { diff --git a/src/gui/basetoolbar.cpp b/src/gui/basetoolbar.cpp index 332c69600..99ec763d8 100755 --- a/src/gui/basetoolbar.cpp +++ b/src/gui/basetoolbar.cpp @@ -42,5 +42,5 @@ QAction *BaseBar::findMatchingAction(const QString &action, const QListcreateNewRoot(); - if (new_root != NULL) { + if (new_root != nullptr) { m_model->addServiceAccount(new_root, true); } else { diff --git a/src/gui/dialogs/formdatabasecleanup.cpp b/src/gui/dialogs/formdatabasecleanup.cpp index 8ad506cb9..6d0422276 100755 --- a/src/gui/dialogs/formdatabasecleanup.cpp +++ b/src/gui/dialogs/formdatabasecleanup.cpp @@ -24,7 +24,7 @@ #include -FormDatabaseCleanup::FormDatabaseCleanup(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormDatabaseCleanup), m_cleaner(NULL) { +FormDatabaseCleanup::FormDatabaseCleanup(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormDatabaseCleanup), m_cleaner(nullptr) { m_ui->setupUi(this); // Set flags and attributes. @@ -42,7 +42,7 @@ FormDatabaseCleanup::~FormDatabaseCleanup() { } void FormDatabaseCleanup::setCleaner(DatabaseCleaner *cleaner) { - if (m_cleaner != NULL) { + if (m_cleaner != nullptr) { disconnect(this, 0, m_cleaner, 0); disconnect(m_cleaner, 0, this, 0); } diff --git a/src/gui/dialogs/formmain.cpp b/src/gui/dialogs/formmain.cpp index 6fce5d30d..649c7ed8c 100755 --- a/src/gui/dialogs/formmain.cpp +++ b/src/gui/dialogs/formmain.cpp @@ -231,7 +231,7 @@ void FormMain::updateRecycleBinMenu() { RecycleBin *bin = activated_root->recycleBin(); QList context_menu; - if (bin == NULL) { + if (bin == nullptr) { QAction *no_action = new QAction(qApp->icons()->fromTheme(QSL("dialog-error")), tr("No recycle bin"), m_ui->m_menuRecycleBin); diff --git a/src/gui/dialogs/formsettings.cpp b/src/gui/dialogs/formsettings.cpp index 85de1d35f..b558d386a 100755 --- a/src/gui/dialogs/formsettings.cpp +++ b/src/gui/dialogs/formsettings.cpp @@ -52,7 +52,7 @@ #include -FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormSettings), m_settings(NULL) { +FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormSettings), m_settings(nullptr) { m_ui->setupUi(this); m_settings = qApp->settings(); @@ -145,7 +145,7 @@ void FormSettings::changeDefaultBrowserArguments(int index) { void FormSettings::onSkinSelected(QTreeWidgetItem *current, QTreeWidgetItem *previous) { Q_UNUSED(previous) - if (current != NULL) { + if (current != nullptr) { const Skin skin = current->data(0, Qt::UserRole).value(); m_ui->m_lblSelectedContents->setText(skin.m_visibleName); } @@ -456,7 +456,7 @@ void FormSettings::loadLanguage() { } void FormSettings::saveLanguage() { - if (m_ui->m_treeLanguages->currentItem() == NULL) { + if (m_ui->m_treeLanguages->currentItem() == nullptr) { qDebug("No localizations loaded in settings dialog, so no saving for them."); return; } @@ -737,7 +737,7 @@ void FormSettings::loadInterface() { } } - if (m_ui->m_treeSkins->currentItem() == NULL && + if (m_ui->m_treeSkins->currentItem() == nullptr && m_ui->m_treeSkins->topLevelItemCount() > 0) { // Currently active skin is NOT available, select another one as selected // if possible. diff --git a/src/gui/dialogs/formupdate.cpp b/src/gui/dialogs/formupdate.cpp index 5ab514e83..e6a236692 100755 --- a/src/gui/dialogs/formupdate.cpp +++ b/src/gui/dialogs/formupdate.cpp @@ -32,7 +32,7 @@ FormUpdate::FormUpdate(QWidget *parent) - : QDialog(parent), m_downloader(NULL), m_readyToInstall(false), m_ui(new Ui::FormUpdate) { + : QDialog(parent), m_downloader(nullptr), m_readyToInstall(false), m_ui(new Ui::FormUpdate) { m_ui->setupUi(this); m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Download update"), QDialogButtonBox::ActionRole); m_btnUpdate->setToolTip(tr("Download new installation files.")); @@ -190,7 +190,7 @@ void FormUpdate::startUpdate() { // Nothing is downloaded yet, but update for this system // is available and self-update feature is present. - if (m_downloader == NULL) { + if (m_downloader == nullptr) { // Initialie downloader. m_downloader = new Downloader(this); diff --git a/src/gui/edittableview.cpp b/src/gui/edittableview.cpp index 9f3b6fcc5..2e628dd8e 100755 --- a/src/gui/edittableview.cpp +++ b/src/gui/edittableview.cpp @@ -62,7 +62,7 @@ void EditTableView::removeSelected() { } void EditTableView::removeAll() { - if (model() != NULL) { + if (model() != nullptr) { model()->removeRows(0, model()->rowCount(rootIndex()), rootIndex()); } } diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp index e8ed9b959..475d50fe9 100755 --- a/src/gui/feedmessageviewer.cpp +++ b/src/gui/feedmessageviewer.cpp @@ -157,7 +157,7 @@ void FeedMessageViewer::setListHeadersEnabled(bool enable) { void FeedMessageViewer::switchFeedComponentVisibility() { QAction *sen = qobject_cast(sender()); - if (sen != NULL) { + if (sen != nullptr) { m_feedsWidget->setVisible(sen->isChecked()); } else { @@ -168,7 +168,7 @@ void FeedMessageViewer::switchFeedComponentVisibility() { void FeedMessageViewer::toggleShowOnlyUnreadFeeds() { const QAction *origin = qobject_cast(sender()); - if (origin == NULL) { + if (origin == nullptr) { m_feedsView->model()->invalidateReadFeedsFilter(true, false); } else { @@ -179,7 +179,7 @@ void FeedMessageViewer::toggleShowOnlyUnreadFeeds() { void FeedMessageViewer::updateMessageButtonsAvailability() { const bool one_message_selected = m_messagesView->selectionModel()->selectedRows().size() == 1; const bool atleast_one_message_selected = !m_messagesView->selectionModel()->selectedRows().isEmpty(); - const bool bin_loaded = m_messagesView->sourceModel()->loadedItem() != NULL && m_messagesView->sourceModel()->loadedItem()->kind() == RootItemKind::Bin; + const bool bin_loaded = m_messagesView->sourceModel()->loadedItem() != nullptr && m_messagesView->sourceModel()->loadedItem()->kind() == RootItemKind::Bin; const FormMain *form_main = qApp->mainForm(); form_main->m_ui->m_actionDeleteSelectedMessages->setEnabled(atleast_one_message_selected); @@ -196,7 +196,7 @@ void FeedMessageViewer::updateFeedButtonsAvailability() { const bool is_update_running = feedsView()->sourceModel()->isFeedUpdateRunning(); const bool critical_action_running = qApp->feedUpdateLock()->isLocked(); const RootItem *selected_item = feedsView()->selectedItem(); - const bool anything_selected = selected_item != NULL; + const bool anything_selected = selected_item != nullptr; const bool feed_selected = anything_selected && selected_item->kind() == RootItemKind::Feed; const bool category_selected = anything_selected && selected_item->kind() == RootItemKind::Category; const bool service_selected = anything_selected && selected_item->kind() == RootItemKind::ServiceRoot; diff --git a/src/gui/feedstoolbar.cpp b/src/gui/feedstoolbar.cpp index be0dc3e85..32c56aeb1 100755 --- a/src/gui/feedstoolbar.cpp +++ b/src/gui/feedstoolbar.cpp @@ -61,7 +61,7 @@ void FeedsToolBar::loadChangeableActions(const QStringList &actions) { foreach (const QString &action_name, actions) { QAction *matching_action = findMatchingAction(action_name, available_actions); - if (matching_action != NULL) { + if (matching_action != nullptr) { // Add existing standard action. addAction(matching_action); } diff --git a/src/gui/feedsview.cpp b/src/gui/feedsview.cpp index bcbdd5331..7bcba81ba 100755 --- a/src/gui/feedsview.cpp +++ b/src/gui/feedsview.cpp @@ -43,10 +43,10 @@ FeedsView::FeedsView(QWidget *parent) : QTreeView(parent), - m_contextMenuCategories(NULL), - m_contextMenuFeeds(NULL), - m_contextMenuEmptySpace(NULL), - m_contextMenuOtherItems(NULL) { + m_contextMenuCategories(nullptr), + m_contextMenuFeeds(nullptr), + m_contextMenuEmptySpace(nullptr), + m_contextMenuOtherItems(nullptr) { setObjectName(QSL("FeedsView")); // Allocate models. @@ -89,11 +89,11 @@ RootItem *FeedsView::selectedItem() const { const QModelIndexList selected_rows = selectionModel()->selectedRows(); if (selected_rows.isEmpty()) { - return NULL; + return nullptr; } else { RootItem *selected_item = m_sourceModel->itemForIndex(m_proxyModel->mapToSource(selected_rows.at(0))); - return selected_item == m_sourceModel->rootItem() ? NULL : selected_item; + return selected_item == m_sourceModel->rootItem() ? nullptr : selected_item; } } @@ -155,7 +155,7 @@ void FeedsView::sortByColumn(int column, Qt::SortOrder order) { void FeedsView::addFeedIntoSelectedAccount() { const RootItem *selected = selectedItem(); - if (selected != NULL) { + if (selected != nullptr) { ServiceRoot *root = selected->getParentServiceRoot(); if (root->supportsFeedAdding()) { @@ -173,7 +173,7 @@ void FeedsView::addFeedIntoSelectedAccount() { void FeedsView::addCategoryIntoSelectedAccount() { const RootItem *selected = selectedItem(); - if (selected != NULL) { + if (selected != nullptr) { ServiceRoot *root = selected->getParentServiceRoot(); if (root->supportsCategoryAdding()) { @@ -265,7 +265,7 @@ void FeedsView::deleteSelectedItem() { RootItem *selected_item = selectedItem(); - if (selected_item != NULL) { + if (selected_item != nullptr) { if (selected_item->canBeDeleted()) { // Ask user first. if (MessageBox::show(qApp->mainForm(), @@ -360,7 +360,7 @@ void FeedsView::expandItemDelayed(const QModelIndex &idx) { } QMenu *FeedsView::initializeContextMenuCategories(RootItem *clicked_item) { - if (m_contextMenuCategories == NULL) { + if (m_contextMenuCategories == nullptr) { m_contextMenuCategories = new QMenu(tr("Context menu for categories"), this); } else { @@ -386,7 +386,7 @@ QMenu *FeedsView::initializeContextMenuCategories(RootItem *clicked_item) { } QMenu *FeedsView::initializeContextMenuFeeds(RootItem *clicked_item) { - if (m_contextMenuFeeds == NULL) { + if (m_contextMenuFeeds == nullptr) { m_contextMenuFeeds = new QMenu(tr("Context menu for categories"), this); } else { @@ -412,7 +412,7 @@ QMenu *FeedsView::initializeContextMenuFeeds(RootItem *clicked_item) { } QMenu *FeedsView::initializeContextMenuEmptySpace() { - if (m_contextMenuEmptySpace == NULL) { + if (m_contextMenuEmptySpace == nullptr) { m_contextMenuEmptySpace = new QMenu(tr("Context menu for empty space"), this); m_contextMenuEmptySpace->addAction(qApp->mainForm()->m_ui->m_actionUpdateAllItems); m_contextMenuEmptySpace->addSeparator(); @@ -422,7 +422,7 @@ QMenu *FeedsView::initializeContextMenuEmptySpace() { } QMenu *FeedsView::initializeContextMenuOtherItem(RootItem *clicked_item) { - if (m_contextMenuOtherItems == NULL) { + if (m_contextMenuOtherItems == nullptr) { m_contextMenuOtherItems = new QMenu(tr("Context menu for other items"), this); } else { diff --git a/src/gui/messagestoolbar.cpp b/src/gui/messagestoolbar.cpp index d14f5f7f6..053e99674 100755 --- a/src/gui/messagestoolbar.cpp +++ b/src/gui/messagestoolbar.cpp @@ -70,7 +70,7 @@ void MessagesToolBar::loadChangeableActions(const QStringList& actions) { foreach (const QString &action_name, actions) { QAction *matching_action = findMatchingAction(action_name, available_actions); - if (matching_action != NULL) { + if (matching_action != nullptr) { // Add existing standard action. addAction(matching_action); } diff --git a/src/gui/messagesview.cpp b/src/gui/messagesview.cpp index ee0067ddf..f651ec6ac 100755 --- a/src/gui/messagesview.cpp +++ b/src/gui/messagesview.cpp @@ -35,7 +35,7 @@ MessagesView::MessagesView(QWidget *parent) : QTreeView(parent), - m_contextMenu(NULL), + m_contextMenu(nullptr), m_columnsAdjusted(false), m_batchUnreadSwitch(false) { m_proxyModel = new MessagesProxyModel(this); @@ -147,7 +147,7 @@ void MessagesView::contextMenuEvent(QContextMenuEvent *event) { } void MessagesView::initializeContextMenu() { - if (m_contextMenu == NULL) { + if (m_contextMenu == nullptr) { m_contextMenu = new QMenu(tr("Context menu for messages"), this); } @@ -161,7 +161,7 @@ void MessagesView::initializeContextMenu() { qApp->mainForm()->m_ui->m_actionSwitchImportanceOfSelectedMessages << qApp->mainForm()->m_ui->m_actionDeleteSelectedMessages); - if (m_sourceModel->loadedItem() != NULL && m_sourceModel->loadedItem()->kind() == RootItemKind::Bin) { + if (m_sourceModel->loadedItem() != nullptr && m_sourceModel->loadedItem()->kind() == RootItemKind::Bin) { m_contextMenu->addAction(qApp->mainForm()->m_ui->m_actionRestoreSelectedMessages); } } diff --git a/src/gui/plaintoolbutton.cpp b/src/gui/plaintoolbutton.cpp index fdb71f5be..eaed35b8d 100755 --- a/src/gui/plaintoolbutton.cpp +++ b/src/gui/plaintoolbutton.cpp @@ -67,9 +67,9 @@ void PlainToolButton::setChecked(bool checked) { } void PlainToolButton::reactOnActionChange(QAction *action) { - QAction *real_action = action == NULL ? qobject_cast(sender()) : action; + QAction *real_action = action == nullptr ? qobject_cast(sender()) : action; - if (real_action != NULL) { + if (real_action != nullptr) { setEnabled(real_action->isEnabled()); setCheckable(real_action->isCheckable()); setChecked(real_action->isChecked()); diff --git a/src/gui/statusbar.cpp b/src/gui/statusbar.cpp index d01592e0d..01cc3f63a 100755 --- a/src/gui/statusbar.cpp +++ b/src/gui/statusbar.cpp @@ -156,7 +156,7 @@ void StatusBar::loadChangeableActions(const QStringList &action_names) { action_to_add->setProperty("type", SPACER_ACTION_NAME); action_to_add->setProperty("name", tr("Toolbar spacer")); } - else if (matching_action != NULL) { + else if (matching_action != nullptr) { // Add originally toolbar action. PlainToolButton *tool_button = new PlainToolButton(this); tool_button->reactOnActionChange(matching_action); @@ -168,16 +168,16 @@ void StatusBar::loadChangeableActions(const QStringList &action_names) { connect(matching_action, SIGNAL(changed()), tool_button, SLOT(reactOnActionChange())); } else { - action_to_add = NULL; - widget_to_add = NULL; + action_to_add = nullptr; + widget_to_add = nullptr; } - if (action_to_add != NULL) { + if (action_to_add != nullptr) { action_to_add->setProperty("should_remove_widget", true); } } - if (action_to_add != NULL && widget_to_add != NULL) { + if (action_to_add != nullptr && widget_to_add != nullptr) { action_to_add->setProperty("widget", QVariant::fromValue((void*) widget_to_add)); addPermanentWidget(widget_to_add); addAction(action_to_add); @@ -198,13 +198,13 @@ bool StatusBar::eventFilter(QObject *watched, QEvent *event) { void StatusBar::clear() { while (!actions().isEmpty()) { QAction *act = actions().at(0); - QWidget *widget = act->property("widget").isValid() ? static_cast(act->property("widget").value()) : NULL; + QWidget *widget = act->property("widget").isValid() ? static_cast(act->property("widget").value()) : nullptr; bool should_remove_widget = act->property("should_remove_widget").isValid(); bool should_remove_action = act->property("should_remove_action").isValid(); removeAction(act); - if (widget != NULL) { + if (widget != nullptr) { removeWidget(widget); widget->setVisible(false); diff --git a/src/gui/systemtrayicon.cpp b/src/gui/systemtrayicon.cpp index 116c7db75..b4a142a50 100755 --- a/src/gui/systemtrayicon.cpp +++ b/src/gui/systemtrayicon.cpp @@ -35,7 +35,7 @@ TrayIconMenu::~TrayIconMenu() { } bool TrayIconMenu::event(QEvent *event) { - if (event->type() == QEvent::Show && Application::activeModalWidget() != NULL) { + if (event->type() == QEvent::Show && Application::activeModalWidget() != nullptr) { QTimer::singleShot(0, this, SLOT(hide())); qApp->showGuiMessage(QSL(STRFY(APP_LONG_NAME)), tr("Close opened modal dialogs first."), @@ -51,8 +51,8 @@ SystemTrayIcon::SystemTrayIcon(const QString &normal_icon, const QString &plain_ m_normalIcon(normal_icon), m_plainPixmap(plain_icon), m_font(QFont()), - m_bubbleClickTarget(NULL), - m_bubbleClickSlot(NULL) { + m_bubbleClickTarget(nullptr), + m_bubbleClickSlot(nullptr) { qDebug("Creating SystemTrayIcon instance."); m_font.setBold(true); @@ -167,7 +167,7 @@ void SystemTrayIcon::setNumber(int number, bool any_new_message) { void SystemTrayIcon::showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon icon, int milliseconds_timeout_hint, QObject *click_target, const char *click_slot) { - if (m_bubbleClickTarget != NULL && m_bubbleClickSlot != NULL) { + if (m_bubbleClickTarget != nullptr && m_bubbleClickSlot != nullptr) { // Disconnect previous bubble click signalling. disconnect(this, SIGNAL(messageClicked()), m_bubbleClickTarget, m_bubbleClickSlot); } @@ -175,7 +175,7 @@ void SystemTrayIcon::showMessage(const QString &title, const QString &message, Q m_bubbleClickSlot = (char*) click_slot; m_bubbleClickTarget = click_target; - if (click_target != NULL && click_slot != NULL) { + if (click_target != nullptr && click_slot != nullptr) { // Establish new connection for bubble click. connect(this, SIGNAL(messageClicked()), click_target, click_slot); } diff --git a/src/gui/tabbar.cpp b/src/gui/tabbar.cpp index d205cbcb9..c55be72b5 100755 --- a/src/gui/tabbar.cpp +++ b/src/gui/tabbar.cpp @@ -68,7 +68,7 @@ void TabBar::closeTabViaButton() { 0, this)); - if (close_button != NULL) { + if (close_button != nullptr) { // Find index of tab for this close button. for (int i = 0; i < count(); i++) { if (tabButton(i, button_position) == close_button) { diff --git a/src/gui/tabwidget.cpp b/src/gui/tabwidget.cpp index a55052c8e..d7b0a3905 100755 --- a/src/gui/tabwidget.cpp +++ b/src/gui/tabwidget.cpp @@ -31,7 +31,7 @@ #include -TabWidget::TabWidget(QWidget *parent) : QTabWidget(parent), m_menuMain(NULL) { +TabWidget::TabWidget(QWidget *parent) : QTabWidget(parent), m_menuMain(nullptr) { setTabBar(new TabBar(this)); setupMainMenuButton(); createConnections(); @@ -53,7 +53,7 @@ void TabWidget::setupMainMenuButton() { } void TabWidget::openMainMenu() { - if (m_menuMain == NULL) { + if (m_menuMain == nullptr) { m_menuMain = new QMenu(tr("Main menu"), this); m_menuMain->addMenu(qApp->mainForm()->m_ui->m_menuFile); m_menuMain->addMenu(qApp->mainForm()->m_ui->m_menuView); diff --git a/src/gui/webbrowser.h b/src/gui/webbrowser.h index 1b339d890..c5d810488 100755 --- a/src/gui/webbrowser.h +++ b/src/gui/webbrowser.h @@ -20,8 +20,6 @@ #include "gui/tabcontent.h" -//#include "ui_webbrowser.h" - #include "core/message.h" #include "network-web/webpage.h" #include "services/abstract/rootitem.h" @@ -30,10 +28,6 @@ #include -/*namespace Ui { - class MessagePreviewer; -}*/ - class QToolButton; class QVBoxLayout; class QHBoxLayout; @@ -99,8 +93,6 @@ class WebBrowser : public TabContent { QAction *m_actionReload; QAction *m_actionStop; - //QScopedPointer m_ui; - QList m_messages; QPointer m_root; }; diff --git a/src/gui/webbrowser.ui b/src/gui/webbrowser.ui deleted file mode 100644 index b719c3478..000000000 --- a/src/gui/webbrowser.ui +++ /dev/null @@ -1,46 +0,0 @@ - - - WebBrowser - - - - 0 - 0 - 502 - 396 - - - - - - - true - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - WebViewer - QWidget -
webviewer.h
-
-
- - -
diff --git a/src/gui/widgetwithstatus.cpp b/src/gui/widgetwithstatus.cpp index 794e13ac3..ff2dcb2d9 100755 --- a/src/gui/widgetwithstatus.cpp +++ b/src/gui/widgetwithstatus.cpp @@ -24,7 +24,7 @@ WidgetWithStatus::WidgetWithStatus(QWidget *parent) - : QWidget(parent), m_wdgInput(NULL) { + : QWidget(parent), m_wdgInput(nullptr) { m_layout = new QHBoxLayout(this); m_btnStatus = new PlainToolButton(this); m_btnStatus->setFocusPolicy(Qt::NoFocus); diff --git a/src/miscellaneous/application.cpp b/src/miscellaneous/application.cpp index 12dd36052..37ae29f23 100755 --- a/src/miscellaneous/application.cpp +++ b/src/miscellaneous/application.cpp @@ -42,9 +42,9 @@ Application::Application(const QString &id, int &argc, char **argv) : QtSingleApplication(id, argc, argv), - m_updateFeedsLock(NULL), m_updateMessagesLock(NULL), m_feedServices(QList()), m_userActions(QList()), m_mainForm(NULL), - m_trayIcon(NULL), m_settings(NULL), m_system(NULL), m_skins(NULL), - m_localization(NULL), m_icons(NULL), m_database(NULL), m_downloadManager(NULL) { + m_updateFeedsLock(nullptr), m_updateMessagesLock(nullptr), m_feedServices(QList()), m_userActions(QList()), m_mainForm(nullptr), + m_trayIcon(nullptr), m_settings(nullptr), m_system(nullptr), m_skins(nullptr), + m_localization(nullptr), m_icons(nullptr), m_database(nullptr), m_downloadManager(nullptr) { connect(this, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit())); connect(this, SIGNAL(commitDataRequest(QSessionManager&)), this, SLOT(onCommitData(QSessionManager&))); connect(this, SIGNAL(saveStateRequest(QSessionManager&)), this, SLOT(onSaveState(QSessionManager&))); @@ -69,7 +69,7 @@ QList Application::feedServices() { } QList Application::userActions() { - if (m_mainForm != NULL && m_userActions.isEmpty()) { + if (m_mainForm != nullptr && m_userActions.isEmpty()) { m_userActions = m_mainForm->allActions(); } @@ -99,7 +99,7 @@ void Application::eliminateFirstRun(const QString &version) { } IconFactory *Application::icons() { - if (m_icons == NULL) { + if (m_icons == nullptr) { m_icons = new IconFactory(this); } @@ -107,7 +107,7 @@ IconFactory *Application::icons() { } DownloadManager *Application::downloadManager() { - if (m_downloadManager == NULL) { + if (m_downloadManager == nullptr) { m_downloadManager = new DownloadManager(); connect(m_downloadManager, SIGNAL(downloadFinished()), mainForm()->statusBar(), SLOT(clearProgressDownload())); @@ -193,7 +193,7 @@ void Application::processExecutionMessage(const QString &message) { // Application was running, and someone wants to add new feed. StandardServiceRoot *root = qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsView()->sourceModel()->standardServiceRoot(); - if (root != NULL) { + if (root != nullptr) { root->checkArgumentForFeedAdding(msg); } else { @@ -207,7 +207,7 @@ void Application::processExecutionMessage(const QString &message) { } SystemTrayIcon *Application::trayIcon() { - if (m_trayIcon == NULL) { + if (m_trayIcon == nullptr) { m_trayIcon = new SystemTrayIcon(APP_ICON_PATH, APP_ICON_PLAIN_PATH, m_mainForm); connect(m_trayIcon, SIGNAL(shown()), m_mainForm->tabWidget()->feedMessageViewer()->feedsView()->sourceModel(), SLOT(notifyWithCounts())); @@ -222,11 +222,11 @@ void Application::showTrayIcon() { } void Application::deleteTrayIcon() { - if (m_trayIcon != NULL) { + if (m_trayIcon != nullptr) { qDebug("Disabling tray icon, deleting it and raising main application window."); m_mainForm->display(); delete m_trayIcon; - m_trayIcon = NULL; + m_trayIcon = nullptr; // Make sure that application quits when last window is closed. setQuitOnLastWindowClosed(true); diff --git a/src/miscellaneous/databasefactory.cpp b/src/miscellaneous/databasefactory.cpp index 50ec7f25d..cec4c234b 100755 --- a/src/miscellaneous/databasefactory.cpp +++ b/src/miscellaneous/databasefactory.cpp @@ -645,7 +645,7 @@ QSqlDatabase DatabaseFactory::mysqlInitializeDatabase(const QString &connection_ // Also, we set the SQLite driver as active one. qApp->settings()->setValue(GROUP(Database), Database::ActiveDriver, APP_DB_SQLITE_DRIVER); determineDriver(); - MessageBox::show(NULL, QMessageBox::Critical, tr("MySQL database not available"), + MessageBox::show(nullptr, QMessageBox::Critical, tr("MySQL database not available"), tr("%1 cannot use MySQL storage, it is not available. %1 is now switching to SQLite database. Start your MySQL server " "and make adjustments in application settings.").arg(STRFY(APP_NAME))); diff --git a/src/miscellaneous/databasequeries.cpp b/src/miscellaneous/databasequeries.cpp old mode 100644 new mode 100755 index 2a291f839..cc86080b8 --- a/src/miscellaneous/databasequeries.cpp +++ b/src/miscellaneous/databasequeries.cpp @@ -214,12 +214,12 @@ QMap > DatabaseQueries::getMessageCountsForCategory(QSqlDatab } } - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } @@ -261,12 +261,12 @@ QMap > DatabaseQueries::getMessageCountsForAccount(QSqlDataba } } - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } @@ -292,14 +292,14 @@ int DatabaseQueries::getMessageCountsForFeed(QSqlDatabase db, int feed_custom_id q.bindValue(QSL(":account_id"), account_id); if (q.exec() && q.next()) { - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } return q.value(0).toInt(); } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } @@ -323,14 +323,14 @@ int DatabaseQueries::getMessageCountsForBin(QSqlDatabase db, int account_id, boo q.bindValue(QSL(":account_id"), account_id); if (q.exec() && q.next()) { - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } return q.value(0).toInt(); } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } @@ -359,12 +359,12 @@ QList DatabaseQueries::getUndeletedMessagesForFeed(QSqlDatabase db, int } } - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } @@ -392,12 +392,12 @@ QList DatabaseQueries::getUndeletedMessagesForBin(QSqlDatabase db, int } } - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } @@ -424,12 +424,12 @@ QList DatabaseQueries::getUndeletedMessagesForAccount(QSqlDatabase db, } } - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } @@ -606,7 +606,7 @@ int DatabaseQueries::updateMessages(QSqlDatabase db, // just to keep the data consistent. if (db.exec("UPDATE Messages " "SET custom_id = (SELECT id FROM Messages t WHERE t.id = Messages.id) " - "WHERE Messages.custom_id IS NULL OR Messages.custom_id = '';").lastError().isValid()) { + "WHERE Messages.custom_id IS nullptr OR Messages.custom_id = '';").lastError().isValid()) { qWarning("Failed to set custom ID for all messages."); } @@ -614,12 +614,12 @@ int DatabaseQueries::updateMessages(QSqlDatabase db, db.rollback(); qDebug("Transaction commit for message downloader failed."); - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } @@ -794,7 +794,7 @@ QStringList DatabaseQueries::customIdsOfMessagesFromAccount(QSqlDatabase db, int q.prepare(QSL("SELECT custom_id FROM Messages WHERE is_deleted = 0 AND is_pdeleted = 0 AND account_id = :account_id;")); q.bindValue(QSL(":account_id"), account_id); - if (ok != NULL) { + if (ok != nullptr) { *ok = q.exec(); } else { @@ -815,7 +815,7 @@ QStringList DatabaseQueries::customIdsOfMessagesFromBin(QSqlDatabase db, int acc q.prepare(QSL("SELECT custom_id FROM Messages WHERE is_deleted = 1 AND is_pdeleted = 0 AND account_id = :account_id;")); q.bindValue(QSL(":account_id"), account_id); - if (ok != NULL) { + if (ok != nullptr) { *ok = q.exec(); } else { @@ -837,7 +837,7 @@ QStringList DatabaseQueries::customIdsOfMessagesFromFeed(QSqlDatabase db, int fe q.bindValue(QSL(":account_id"), account_id); q.bindValue(QSL(":feed"), feed_custom_id); - if (ok != NULL) { + if (ok != nullptr) { *ok = q.exec(); } else { @@ -869,14 +869,14 @@ QList DatabaseQueries::getOwnCloudAccounts(QSqlDatabase db, bool * roots.append(root); } - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } else { qWarning("OwnCloud: Getting list of activated accounts failed: '%s'.", qPrintable(query.lastError().text())); - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } @@ -905,14 +905,14 @@ QList DatabaseQueries::getTtRssAccounts(QSqlDatabase db, bool *ok) roots.append(root); } - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } else { qWarning("TT-RSS: Getting list of activated accounts failed: '%s'.", qPrintable(query.lastError().text())); - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } @@ -981,7 +981,7 @@ int DatabaseQueries::createAccount(QSqlDatabase db, const QString &code, bool *o if (!q.exec("SELECT max(id) FROM Accounts;") || !q.next()) { qWarning("Getting max ID from Accounts table failed: '%s'.", qPrintable(q.lastError().text())); - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } @@ -995,14 +995,14 @@ int DatabaseQueries::createAccount(QSqlDatabase db, const QString &code, bool *o q.bindValue(QSL(":type"), code); if (q.exec()) { - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } return id_to_assign; } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } @@ -1023,7 +1023,7 @@ Assignment DatabaseQueries::getOwnCloudCategories(QSqlDatabase db, int account_i if (!q.exec()) { qFatal("ownCloud: Query for obtaining categories failed. Error message: '%s'.", qPrintable(q.lastError().text())); - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } @@ -1036,7 +1036,7 @@ Assignment DatabaseQueries::getOwnCloudCategories(QSqlDatabase db, int account_i categories << pair; } - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } @@ -1054,7 +1054,7 @@ Assignment DatabaseQueries::getOwnCloudFeeds(QSqlDatabase db, int account_id, bo if (!q.exec()) { qFatal("ownCloud: Query for obtaining feeds failed. Error message: '%s'.", qPrintable(q.lastError().text())); - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } @@ -1067,7 +1067,7 @@ Assignment DatabaseQueries::getOwnCloudFeeds(QSqlDatabase db, int account_id, bo feeds << pair; } - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } @@ -1125,7 +1125,7 @@ int DatabaseQueries::addCategory(QSqlDatabase db, int parent_id, int account_id, if (!q.exec()) { qDebug("Failed to add category to database: '%s'.", qPrintable(q.lastError().text())); - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } @@ -1133,7 +1133,7 @@ int DatabaseQueries::addCategory(QSqlDatabase db, int parent_id, int account_id, return 0; } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } @@ -1209,14 +1209,14 @@ int DatabaseQueries::addFeed(QSqlDatabase db, int parent_id, int account_id, con q.bindValue(QSL(":id"), new_id); q.exec(); - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } return new_id; } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } @@ -1292,12 +1292,12 @@ QList DatabaseQueries::getAccounts(QSqlDatabase db, bool *ok) { roots.append(root); } - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } @@ -1318,12 +1318,12 @@ Assignment DatabaseQueries::getCategories(QSqlDatabase db, int account_id, bool qFatal("Query for obtaining categories failed. Error message: '%s'.", qPrintable(q.lastError().text())); - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } @@ -1351,12 +1351,12 @@ Assignment DatabaseQueries::getFeeds(QSqlDatabase db, int account_id, bool *ok) qFatal("Query for obtaining feeds failed. Error message: '%s'.", qPrintable(q.lastError().text())); - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } @@ -1463,12 +1463,12 @@ Assignment DatabaseQueries::getTtRssCategories(QSqlDatabase db, int account_id, if (!query_categories.exec()) { qFatal("Query for obtaining categories failed. Error message: '%s'.", qPrintable(query_categories.lastError().text())); - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } @@ -1496,12 +1496,12 @@ Assignment DatabaseQueries::getTtRssFeeds(QSqlDatabase db, int account_id, bool if (!query_feeds.exec()) { qFatal("Query for obtaining feeds failed. Error message: '%s'.", qPrintable(query_feeds.lastError().text())); - if (ok != NULL) { + if (ok != nullptr) { *ok = false; } } else { - if (ok != NULL) { + if (ok != nullptr) { *ok = true; } } diff --git a/src/miscellaneous/skinfactory.cpp b/src/miscellaneous/skinfactory.cpp index 51ae5ea0b..0a6955dfe 100755 --- a/src/miscellaneous/skinfactory.cpp +++ b/src/miscellaneous/skinfactory.cpp @@ -142,7 +142,7 @@ Skin SkinFactory::skinInfo(const QString &skin_name, bool *ok) const { skin_file.close(); skin_file.deleteLater(); - if (ok != NULL) { + if (ok != nullptr) { *ok = !skin.m_author.isEmpty() && !skin.m_version.isEmpty() && !skin.m_baseName.isEmpty() && !skin.m_email.isEmpty() && !skin.m_layoutMarkup.isEmpty(); diff --git a/src/miscellaneous/systemfactory.cpp b/src/miscellaneous/systemfactory.cpp index d5a5743fb..cf534d314 100755 --- a/src/miscellaneous/systemfactory.cpp +++ b/src/miscellaneous/systemfactory.cpp @@ -291,6 +291,6 @@ void SystemFactory::checkForUpdatesOnStartup() { qApp->showGuiMessage(tr("New version available"), tr("Click the bubble for more information."), QSystemTrayIcon::Information, - NULL, true, qApp->mainForm(), SLOT(showUpdates())); + nullptr, true, qApp->mainForm(), SLOT(showUpdates())); } } diff --git a/src/network-web/downloader.cpp b/src/network-web/downloader.cpp index 56e99d611..572455eba 100755 --- a/src/network-web/downloader.cpp +++ b/src/network-web/downloader.cpp @@ -23,7 +23,7 @@ Downloader::Downloader(QObject *parent) - : QObject(parent), m_activeReply(NULL), m_downloadManager(new SilentNetworkAccessManager(this)), + : QObject(parent), m_activeReply(nullptr), m_downloadManager(new SilentNetworkAccessManager(this)), m_timer(new QTimer(this)), m_customHeaders(QHash()), m_inputData(QByteArray()), m_targetProtected(false), m_targetUsername(QString()), m_targetPassword(QString()), m_lastOutputData(QByteArray()), m_lastOutputError(QNetworkReply::NoError), m_lastContentType(QVariant()) { @@ -110,7 +110,7 @@ void Downloader::finished() { } m_activeReply->deleteLater(); - m_activeReply = NULL; + m_activeReply = nullptr; if (reply_operation == QNetworkAccessManager::GetOperation) { runGetRequest(request); @@ -133,7 +133,7 @@ void Downloader::finished() { m_lastOutputError = reply->error(); m_activeReply->deleteLater(); - m_activeReply = NULL; + m_activeReply = nullptr; emit completed(m_lastOutputError, m_lastOutputData); } @@ -204,7 +204,7 @@ QVariant Downloader::lastContentType() const { } void Downloader::cancel() { - if (m_activeReply != NULL) { + if (m_activeReply != nullptr) { // Download action timed-out, too slow connection or target is not reachable. m_activeReply->abort(); } diff --git a/src/network-web/downloadmanager.cpp b/src/network-web/downloadmanager.cpp index 56a89bcc0..73b0dcc08 100755 --- a/src/network-web/downloadmanager.cpp +++ b/src/network-web/downloadmanager.cpp @@ -61,7 +61,7 @@ DownloadItem::~DownloadItem() { } void DownloadItem::init() { - if (m_reply == NULL) { + if (m_reply == nullptr) { return; } @@ -442,7 +442,7 @@ void DownloadItem::updateInfoAndUrlLabel() { DownloadManager::DownloadManager(QWidget *parent) : TabContent(parent), m_ui(new Ui::DownloadManager), m_autoSaver(new AutoSaver(this)), m_model(new DownloadModel(this)), - m_networkManager(SilentNetworkAccessManager::instance()), m_iconProvider(NULL), m_removePolicy(Never) { + m_networkManager(SilentNetworkAccessManager::instance()), m_iconProvider(nullptr), m_removePolicy(Never) { m_ui->setupUi(this); m_ui->m_viewDownloads->setShowGrid(false); m_ui->m_viewDownloads->verticalHeader()->hide(); @@ -505,7 +505,7 @@ void DownloadManager::download(const QUrl &url) { } void DownloadManager::handleUnsupportedContent(QNetworkReply *reply) { - if (reply == NULL || reply->url().isEmpty()) { + if (reply == nullptr || reply->url().isEmpty()) { return; } diff --git a/src/qtsingleapplication/qtlocalpeer.cpp b/src/qtsingleapplication/qtlocalpeer.cpp old mode 100644 new mode 100755 index 47f01205c..516042991 --- a/src/qtsingleapplication/qtlocalpeer.cpp +++ b/src/qtsingleapplication/qtlocalpeer.cpp @@ -109,7 +109,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) } QtLocalPeer::~QtLocalPeer() { - if (server != NULL) { + if (server != nullptr) { server->close(); } } @@ -157,7 +157,7 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout) Sleep(DWORD(ms)); #else struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; - nanosleep(&ts, NULL); + nanosleep(&ts, nullptr); #endif } if (!connOk) diff --git a/src/services/abstract/accountcheckmodel.cpp b/src/services/abstract/accountcheckmodel.cpp old mode 100644 new mode 100755 index d7713a172..6b797141a --- a/src/services/abstract/accountcheckmodel.cpp +++ b/src/services/abstract/accountcheckmodel.cpp @@ -23,7 +23,7 @@ AccountCheckModel::AccountCheckModel(QObject *parent) - : QAbstractItemModel(parent), m_rootItem(NULL), m_checkStates(QHash()), m_recursiveChange(false) { + : QAbstractItemModel(parent), m_rootItem(nullptr), m_checkStates(QHash()), m_recursiveChange(false) { } AccountCheckModel::~AccountCheckModel() { @@ -43,7 +43,7 @@ RootItem *AccountCheckModel::rootItem() const { } void AccountCheckModel::setRootItem(RootItem *root_item) { - if (m_rootItem != NULL) { + if (m_rootItem != nullptr) { delete m_rootItem; } @@ -51,7 +51,7 @@ void AccountCheckModel::setRootItem(RootItem *root_item) { } void AccountCheckModel::checkAllItems() { - if (m_rootItem != NULL) { + if (m_rootItem != nullptr) { foreach (RootItem *root_child, m_rootItem->childItems()) { if (root_child->kind() == RootItemKind::Feed || root_child->kind() == RootItemKind::Category) { setItemChecked(root_child, Qt::Checked); @@ -61,7 +61,7 @@ void AccountCheckModel::checkAllItems() { } void AccountCheckModel::uncheckAllItems() { - if (m_rootItem != NULL) { + if (m_rootItem != nullptr) { foreach (RootItem *root_child, m_rootItem->childItems()) { if (root_child->kind() == RootItemKind::Feed || root_child->kind() == RootItemKind::Category) { setData(indexForItem(root_child), Qt::Unchecked, Qt::CheckStateRole); @@ -87,7 +87,7 @@ QModelIndex AccountCheckModel::index(int row, int column, const QModelIndex &par } QModelIndex AccountCheckModel::indexForItem(RootItem *item) const { - if (item == NULL || item->kind() == RootItemKind::ServiceRoot || item->kind() == RootItemKind::Root) { + if (item == nullptr || item->kind() == RootItemKind::ServiceRoot || item->kind() == RootItemKind::Root) { // Root item lies on invalid index. return QModelIndex(); } @@ -150,7 +150,7 @@ int AccountCheckModel::rowCount(const QModelIndex &parent) const { else { RootItem *item = itemForIndex(parent); - if (item != NULL) { + if (item != nullptr) { return item->childCount(); } else { diff --git a/src/services/abstract/feed.cpp b/src/services/abstract/feed.cpp index c147eada8..3f7a36c45 100755 --- a/src/services/abstract/feed.cpp +++ b/src/services/abstract/feed.cpp @@ -168,7 +168,7 @@ int Feed::updateMessages(const QList &messages) { updateCounts(true); items_to_update.append(this); - if (getParentServiceRoot()->recycleBin() != NULL && anything_updated) { + if (getParentServiceRoot()->recycleBin() != nullptr && anything_updated) { getParentServiceRoot()->recycleBin()->updateCounts(true); items_to_update.append(getParentServiceRoot()->recycleBin()); } diff --git a/src/services/abstract/gui/formfeeddetails.cpp b/src/services/abstract/gui/formfeeddetails.cpp old mode 100644 new mode 100755 index b955f24d2..f1e84573c --- a/src/services/abstract/gui/formfeeddetails.cpp +++ b/src/services/abstract/gui/formfeeddetails.cpp @@ -42,7 +42,7 @@ FormFeedDetails::FormFeedDetails(ServiceRoot *service_root, QWidget *parent) : QDialog(parent), - m_editableFeed(NULL), + m_editableFeed(nullptr), m_serviceRoot(service_root) { initialize(); createConnections(); @@ -62,7 +62,7 @@ int FormFeedDetails::exec(Feed *input_feed, RootItem *parent_to_select, const QS // Load categories. loadCategories(m_serviceRoot->getSubTreeCategories(), m_serviceRoot); - if (input_feed == NULL) { + if (input_feed == nullptr) { // User is adding new category. setWindowTitle(tr("Add new feed")); @@ -76,7 +76,7 @@ int FormFeedDetails::exec(Feed *input_feed, RootItem *parent_to_select, const QS m_ui->m_cmbEncoding->setCurrentIndex(default_encoding_index); } - if (parent_to_select != NULL) { + if (parent_to_select != nullptr) { if (parent_to_select->kind() == RootItemKind::Category) { m_ui->m_cmbParentCategory->setCurrentIndex(m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select))); } @@ -217,7 +217,7 @@ void FormFeedDetails::guessFeed() { m_ui->m_txtUsername->lineEdit()->text(), m_ui->m_txtPassword->lineEdit()->text()); - if (result.first != NULL) { + if (result.first != nullptr) { // Icon or whole feed was guessed. m_ui->m_btnIcon->setIcon(result.first->icon()); m_ui->m_txtTitle->lineEdit()->setText(result.first->title()); @@ -261,7 +261,7 @@ void FormFeedDetails::guessIconOnly() { m_ui->m_txtUsername->lineEdit()->text(), m_ui->m_txtPassword->lineEdit()->text()); - if (result.first != NULL) { + if (result.first != nullptr) { // Icon or whole feed was guessed. m_ui->m_btnIcon->setIcon(result.first->icon()); diff --git a/src/services/abstract/rootitem.cpp b/src/services/abstract/rootitem.cpp index 05e0901eb..8d3677f20 100755 --- a/src/services/abstract/rootitem.cpp +++ b/src/services/abstract/rootitem.cpp @@ -27,7 +27,7 @@ RootItem::RootItem(RootItem *parent_item) - : QObject(NULL), + : QObject(nullptr), m_kind(RootItemKind::Root), m_id(NO_PARENT_CATEGORY), m_customId(NO_PARENT_CATEGORY), @@ -46,7 +46,7 @@ RootItem::~RootItem() { QString RootItem::hashCode() const { ServiceRoot *root = getParentServiceRoot(); - int acc_id = root == NULL ? 0 : root->accountId(); + int acc_id = root == nullptr ? 0 : root->accountId(); return QString::number(acc_id) + QL1S("-") + @@ -217,7 +217,7 @@ int RootItem::countOfAllMessages() const { } bool RootItem::isChildOf(const RootItem *root) const { - if (root == NULL) { + if (root == nullptr) { return false; } @@ -236,7 +236,7 @@ bool RootItem::isChildOf(const RootItem *root) const { } bool RootItem::isParentOf(const RootItem *child) const { - if (child == NULL) { + if (child == nullptr) { return false; } else { @@ -373,7 +373,7 @@ ServiceRoot *RootItem::getParentServiceRoot() const { } } - return NULL; + return nullptr; } bool RootItem::removeChild(RootItem *child) { diff --git a/src/services/abstract/serviceroot.cpp b/src/services/abstract/serviceroot.cpp index 021532002..a31269c61 100755 --- a/src/services/abstract/serviceroot.cpp +++ b/src/services/abstract/serviceroot.cpp @@ -152,7 +152,7 @@ bool ServiceRoot::cleanFeeds(QList items, bool clean_read_only) { RecycleBin *bin = recycleBin(); - if (bin != NULL) { + if (bin != nullptr) { bin->updateCounts(true); itemss.append(bin); } @@ -172,7 +172,7 @@ void ServiceRoot::storeNewFeedTree(RootItem *root) { if (DatabaseQueries::storeAccountTree(database, root, accountId())) { RecycleBin *bin = recycleBin(); - if (bin != NULL && !childItems().contains(bin)) { + if (bin != nullptr && !childItems().contains(bin)) { // As the last item, add recycle bin, which is needed. appendChild(bin); bin->updateCounts(true); @@ -224,7 +224,7 @@ void ServiceRoot::syncIn() { RootItem *new_tree = obtainNewTreeForSyncIn(); - if (new_tree != NULL) { + if (new_tree != nullptr) { // Purge old data from SQL and clean all model items. requestItemExpandStateSave(this); @@ -243,7 +243,7 @@ void ServiceRoot::syncIn() { removeLeftOverMessages(); foreach (RootItem *top_level_item, new_tree->childItems()) { - top_level_item->setParent(NULL); + top_level_item->setParent(nullptr); requestItemReassignment(top_level_item, this); } @@ -278,7 +278,7 @@ void ServiceRoot::syncIn() { } RootItem *ServiceRoot::obtainNewTreeForSyncIn() const { - return NULL; + return nullptr; } QStringList ServiceRoot::customIDSOfMessagesForItem(RootItem *item) { @@ -449,7 +449,7 @@ bool ServiceRoot::onAfterMessagesDelete(RootItem *selected_item, const QList() << bin); } else { - if (bin != NULL) { + if (bin != nullptr) { bin->updateCounts(true); itemChanged(QList() << selected_item << bin); } diff --git a/src/services/owncloud/gui/formeditowncloudaccount.cpp b/src/services/owncloud/gui/formeditowncloudaccount.cpp index 29cb34e3a..7cddeadf9 100755 --- a/src/services/owncloud/gui/formeditowncloudaccount.cpp +++ b/src/services/owncloud/gui/formeditowncloudaccount.cpp @@ -25,7 +25,7 @@ FormEditOwnCloudAccount::FormEditOwnCloudAccount(QWidget *parent) - : QDialog(parent), m_ui(new Ui::FormEditOwnCloudAccount), m_editableRoot(NULL) { + : QDialog(parent), m_ui(new Ui::FormEditOwnCloudAccount), m_editableRoot(nullptr) { m_ui->setupUi(this); m_btnOk = m_ui->m_buttonBox->button(QDialogButtonBox::Ok); @@ -131,7 +131,7 @@ void FormEditOwnCloudAccount::performTest() { void FormEditOwnCloudAccount::onClickedOk() { bool editing_account = true; - if (m_editableRoot == NULL) { + if (m_editableRoot == nullptr) { // We want to confirm newly created account. // So save new account into DB, setup its properties. m_editableRoot = new OwnCloudServiceRoot(); diff --git a/src/services/owncloud/gui/formowncloudfeeddetails.cpp b/src/services/owncloud/gui/formowncloudfeeddetails.cpp old mode 100644 new mode 100755 index a22b25dfc..312dcf05f --- a/src/services/owncloud/gui/formowncloudfeeddetails.cpp +++ b/src/services/owncloud/gui/formowncloudfeeddetails.cpp @@ -40,7 +40,7 @@ FormOwnCloudFeedDetails::FormOwnCloudFeedDetails(ServiceRoot *service_root, QWid } void FormOwnCloudFeedDetails::apply() { - if (m_editableFeed != NULL) { + if (m_editableFeed != nullptr) { bool renamed = false; if (m_ui->m_txtTitle->lineEdit()->text() != m_editableFeed->title()) { diff --git a/src/services/owncloud/owncloudcategory.cpp b/src/services/owncloud/owncloudcategory.cpp index 147a10aff..e229e8538 100755 --- a/src/services/owncloud/owncloudcategory.cpp +++ b/src/services/owncloud/owncloudcategory.cpp @@ -26,7 +26,7 @@ OwnCloudCategory::OwnCloudCategory(RootItem *parent) : Category(parent) { setIcon(qApp->icons()->fromTheme(QSL("folder"))); } -OwnCloudCategory::OwnCloudCategory(const QSqlRecord &record) : Category(NULL) { +OwnCloudCategory::OwnCloudCategory(const QSqlRecord &record) : Category(nullptr) { setIcon(qApp->icons()->fromTheme(QSL("folder"))); setId(record.value(CAT_DB_ID_INDEX).toInt()); setTitle(record.value(CAT_DB_TITLE_INDEX).toString()); diff --git a/src/services/owncloud/owncloudfeed.cpp b/src/services/owncloud/owncloudfeed.cpp index 2e8394f31..ecef6f216 100755 --- a/src/services/owncloud/owncloudfeed.cpp +++ b/src/services/owncloud/owncloudfeed.cpp @@ -30,7 +30,7 @@ OwnCloudFeed::OwnCloudFeed(RootItem *parent) : Feed(parent) { } -OwnCloudFeed::OwnCloudFeed(const QSqlRecord &record) : Feed(NULL) { +OwnCloudFeed::OwnCloudFeed(const QSqlRecord &record) : Feed(nullptr) { setTitle(record.value(FDS_DB_TITLE_INDEX).toString()); setId(record.value(FDS_DB_ID_INDEX).toInt()); setIcon(qApp->icons()->fromByteArray(record.value(FDS_DB_ICON_INDEX).toByteArray())); @@ -49,7 +49,7 @@ bool OwnCloudFeed::canBeEdited() const { bool OwnCloudFeed::editViaGui() { QPointer form_pointer = new FormOwnCloudFeedDetails(serviceRoot(), qApp->mainForm()); - form_pointer.data()->exec(this, NULL); + form_pointer.data()->exec(this, nullptr); delete form_pointer.data(); return false; } diff --git a/src/services/owncloud/owncloudserviceroot.cpp b/src/services/owncloud/owncloudserviceroot.cpp index bf9bcba1c..b1b398a33 100755 --- a/src/services/owncloud/owncloudserviceroot.cpp +++ b/src/services/owncloud/owncloudserviceroot.cpp @@ -35,7 +35,7 @@ OwnCloudServiceRoot::OwnCloudServiceRoot(RootItem *parent) : ServiceRoot(parent), m_recycleBin(new OwnCloudRecycleBin(this)), - m_actionSyncIn(NULL), m_serviceMenu(QList()), m_network(new OwnCloudNetworkFactory()) { + m_actionSyncIn(nullptr), m_serviceMenu(QList()), m_network(new OwnCloudNetworkFactory()) { setIcon(OwnCloudServiceEntryPoint().icon()); } @@ -210,7 +210,7 @@ void OwnCloudServiceRoot::addNewFeed(const QString &url) { QScopedPointer form_pointer(new FormOwnCloudFeedDetails(this, qApp->mainForm())); - form_pointer.data()->exec(NULL, this, url); + form_pointer.data()->exec(nullptr, this, url); qApp->feedUpdateLock()->unlock(); } @@ -251,7 +251,7 @@ RootItem *OwnCloudServiceRoot::obtainNewTreeForSyncIn() const { return feed_cats_response.feedsCategories(true); } else { - return NULL; + return nullptr; } } diff --git a/src/services/standard/gui/formstandardcategorydetails.cpp b/src/services/standard/gui/formstandardcategorydetails.cpp index 7bf83c78a..53ed4b0a7 100755 --- a/src/services/standard/gui/formstandardcategorydetails.cpp +++ b/src/services/standard/gui/formstandardcategorydetails.cpp @@ -41,7 +41,7 @@ FormStandardCategoryDetails::FormStandardCategoryDetails(StandardServiceRoot *service_root, QWidget *parent) - : QDialog(parent), m_editableCategory(NULL), m_serviceRoot(service_root) { + : QDialog(parent), m_editableCategory(nullptr), m_serviceRoot(service_root) { initialize(); createConnections(); @@ -79,7 +79,7 @@ int FormStandardCategoryDetails::exec(StandardCategory *input_category, RootItem // Load categories. loadCategories(m_serviceRoot->getSubTreeCategories(), m_serviceRoot, input_category); - if (input_category == NULL) { + if (input_category == nullptr) { // User is adding new category. setWindowTitle(tr("Add new category")); @@ -88,7 +88,7 @@ int FormStandardCategoryDetails::exec(StandardCategory *input_category, RootItem m_actionUseDefaultIcon->trigger(); // Load parent from suggested item. - if (parent_to_select != NULL) { + if (parent_to_select != nullptr) { if (parent_to_select->kind() == RootItemKind::Category) { m_ui->m_cmbParentCategory->setCurrentIndex(m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select))); } @@ -120,7 +120,7 @@ void FormStandardCategoryDetails::apply() { new_category->setDescription(m_ui->m_txtDescription->lineEdit()->text()); new_category->setIcon(m_ui->m_btnIcon->icon()); - if (m_editableCategory == NULL) { + if (m_editableCategory == nullptr) { // Add the category. if (new_category->addItself(parent)) { m_serviceRoot->requestItemReassignment(new_category, parent); @@ -251,7 +251,7 @@ void FormStandardCategoryDetails::loadCategories(const QList categori QVariant::fromValue((void*) root_item)); foreach (Category *category, categories) { - if (input_category != NULL && (category == input_category || category->isChildOf(input_category))) { + if (input_category != nullptr && (category == input_category || category->isChildOf(input_category))) { // This category cannot be selected as the new // parent for currently edited category, so // don't add it. diff --git a/src/services/standard/gui/formstandardfeeddetails.cpp b/src/services/standard/gui/formstandardfeeddetails.cpp index 4af48ad4d..13c0d0752 100755 --- a/src/services/standard/gui/formstandardfeeddetails.cpp +++ b/src/services/standard/gui/formstandardfeeddetails.cpp @@ -45,7 +45,7 @@ void FormStandardFeedDetails::apply() { new_feed->setAutoUpdateType(static_cast(m_ui->m_cmbAutoUpdateType->itemData(m_ui->m_cmbAutoUpdateType->currentIndex()).toInt())); new_feed->setAutoUpdateInitialInterval(m_ui->m_spinAutoUpdateInterval->value()); - if (m_editableFeed == NULL) { + if (m_editableFeed == nullptr) { // Add the feed. if (new_feed->addItself(parent)) { m_serviceRoot->requestItemReassignment(new_feed, parent); diff --git a/src/services/standard/standardcategory.cpp b/src/services/standard/standardcategory.cpp index 5d3a9becc..ac1ce03bb 100755 --- a/src/services/standard/standardcategory.cpp +++ b/src/services/standard/standardcategory.cpp @@ -37,7 +37,7 @@ StandardCategory::StandardCategory(RootItem *parent_item) : Category(parent_item } StandardCategory::StandardCategory(const StandardCategory &other) - : Category(NULL) { + : Category(nullptr) { setId(other.id()); setCustomId(other.customId()); setTitle(other.title()); @@ -100,7 +100,7 @@ bool StandardCategory::performDragDropChange(RootItem *target_item) { bool StandardCategory::editViaGui() { QScopedPointer form_pointer(new FormStandardCategoryDetails(serviceRoot(), qApp->mainForm())); - form_pointer.data()->exec(this, NULL); + form_pointer.data()->exec(this, nullptr); return false; } @@ -185,7 +185,7 @@ bool StandardCategory::editItself(StandardCategory *new_category_data) { } } -StandardCategory::StandardCategory(const QSqlRecord &record) : Category(NULL) { +StandardCategory::StandardCategory(const QSqlRecord &record) : Category(nullptr) { setId(record.value(CAT_DB_ID_INDEX).toInt()); setCustomId(id()); setTitle(record.value(CAT_DB_TITLE_INDEX).toString()); diff --git a/src/services/standard/standardfeed.cpp b/src/services/standard/standardfeed.cpp index 6a0677716..c15061391 100755 --- a/src/services/standard/standardfeed.cpp +++ b/src/services/standard/standardfeed.cpp @@ -53,7 +53,7 @@ StandardFeed::StandardFeed(RootItem *parent_item) } StandardFeed::StandardFeed(const StandardFeed &other) - : Feed(NULL) { + : Feed(nullptr) { m_passwordProtected = other.passwordProtected(); m_username = other.username(); m_password = other.password(); @@ -94,7 +94,7 @@ StandardServiceRoot *StandardFeed::serviceRoot() const { bool StandardFeed::editViaGui() { QScopedPointer form_pointer(new FormStandardFeedDetails(serviceRoot(), qApp->mainForm())); - form_pointer.data()->exec(this, NULL); + form_pointer.data()->exec(this, nullptr); return false; } @@ -184,7 +184,7 @@ QString StandardFeed::typeToString(StandardFeed::Type type) { void StandardFeed::fetchMetadataForItself() { QPair metadata = guessFeed(url(), username(), password()); - if (metadata.first != NULL && metadata.second == QNetworkReply::NoError) { + if (metadata.first != nullptr && metadata.second == QNetworkReply::NoError) { // Some properties are not updated when new metadata are fetched. metadata.first->setParent(parent()); metadata.first->setUrl(url()); @@ -211,7 +211,7 @@ void StandardFeed::fetchMetadataForItself() { QPair StandardFeed::guessFeed(const QString &url, const QString &username, const QString &password) { - QPair result; result.first = NULL; + QPair result; result.first = nullptr; QByteArray feed_contents; NetworkResult network_result = NetworkFactory::downloadFeedFile(url, @@ -239,13 +239,13 @@ QPair StandardFeed::guessFeed(const Q xml_schema_encoding = encoding_rexp.cap(0); } - if (result.first == NULL) { + if (result.first == nullptr) { result.first = new StandardFeed(); } QTextCodec *custom_codec = QTextCodec::codecForName(xml_schema_encoding.toLocal8Bit()); - if (custom_codec != NULL) { + if (custom_codec != nullptr) { // Feed encoding was probably guessed. xml_contents_encoded = custom_codec->toUnicode(feed_contents); result.first->setEncoding(xml_schema_encoding); @@ -450,7 +450,7 @@ QList StandardFeed::obtainNewMessages() { QTextCodec *codec = QTextCodec::codecForName(encoding().toLocal8Bit()); QString formatted_feed_contents; - if (codec == NULL) { + if (codec == nullptr) { // No suitable codec for this encoding was found. // Use non-converted data. formatted_feed_contents = feed_contents; @@ -487,7 +487,7 @@ QNetworkReply::NetworkError StandardFeed::networkError() const { return m_networkError; } -StandardFeed::StandardFeed(const QSqlRecord &record) : Feed(NULL) { +StandardFeed::StandardFeed(const QSqlRecord &record) : Feed(nullptr) { setTitle(record.value(FDS_DB_TITLE_INDEX).toString()); setId(record.value(FDS_DB_ID_INDEX).toInt()); setCustomId(id()); diff --git a/src/services/standard/standardfeedsimportexportmodel.cpp b/src/services/standard/standardfeedsimportexportmodel.cpp index 90a9e1acd..76b4f3f33 100755 --- a/src/services/standard/standardfeedsimportexportmodel.cpp +++ b/src/services/standard/standardfeedsimportexportmodel.cpp @@ -36,7 +36,7 @@ FeedsImportExportModel::FeedsImportExportModel(QObject *parent) } FeedsImportExportModel::~FeedsImportExportModel() { - if (m_rootItem != NULL && m_mode == Import) { + if (m_rootItem != nullptr && m_mode == Import) { // Delete all model items, but only if we are in import mode. Export mode shares // root item with main feed model, thus cannot be deleted from memory now. delete m_rootItem; @@ -139,7 +139,7 @@ bool FeedsImportExportModel::exportToOMPL20(QByteArray &result) { void FeedsImportExportModel::importAsOPML20(const QByteArray &data, bool fetch_metadata_online) { emit parsingStarted(); emit layoutAboutToBeChanged(); - setRootItem(NULL); + setRootItem(nullptr); emit layoutChanged(); QDomDocument opml_document; @@ -279,7 +279,7 @@ bool FeedsImportExportModel::exportToTxtURLPerLine(QByteArray &result) { void FeedsImportExportModel::importAsTxtURLPerLine(const QByteArray &data, bool fetch_metadata_online) { emit parsingStarted(); emit layoutAboutToBeChanged(); - setRootItem(NULL); + setRootItem(nullptr); emit layoutChanged(); int completed = 0, succeded = 0, failed = 0; diff --git a/src/services/standard/standardserviceentrypoint.cpp b/src/services/standard/standardserviceentrypoint.cpp index 4f76c6a21..0fe58c983 100755 --- a/src/services/standard/standardserviceentrypoint.cpp +++ b/src/services/standard/standardserviceentrypoint.cpp @@ -70,7 +70,7 @@ ServiceRoot *StandardServiceEntryPoint::createNewRoot() const { return root; } else { - return NULL; + return nullptr; } } diff --git a/src/services/standard/standardserviceroot.cpp b/src/services/standard/standardserviceroot.cpp index 9c01f37c2..50db70bfb 100755 --- a/src/services/standard/standardserviceroot.cpp +++ b/src/services/standard/standardserviceroot.cpp @@ -44,8 +44,8 @@ StandardServiceRoot::StandardServiceRoot(RootItem *parent) : ServiceRoot(parent), m_recycleBin(new RecycleBin(this)), - m_actionExportFeeds(NULL), m_actionImportFeeds(NULL), m_serviceMenu(QList()), - m_feedContextMenu(QList()), m_actionFeedFetchMetadata(NULL) { + m_actionExportFeeds(nullptr), m_actionImportFeeds(nullptr), m_serviceMenu(QList()), + m_feedContextMenu(QList()), m_actionFeedFetchMetadata(nullptr) { setTitle(qApp->system()->getUsername() + QL1S("@") + QL1S(STRFY(APP_LOW_NAME))); setIcon(StandardServiceEntryPoint().icon()); @@ -142,7 +142,7 @@ void StandardServiceRoot::addNewFeed(const QString &url) { } QScopedPointer form_pointer(new FormStandardFeedDetails(this, qApp->mainForm())); - form_pointer.data()->exec(NULL, NULL, url); + form_pointer.data()->exec(nullptr, nullptr, url); qApp->feedUpdateLock()->unlock(); } @@ -224,7 +224,7 @@ void StandardServiceRoot::checkArgumentForFeedAdding(const QString &argument) { QList StandardServiceRoot::getContextMenuForFeed(StandardFeed *feed) { if (m_feedContextMenu.isEmpty()) { // Initialize. - m_actionFeedFetchMetadata = new QAction(qApp->icons()->fromTheme(QSL("emblem-downloads")), tr("Fetch metadata"), NULL); + m_actionFeedFetchMetadata = new QAction(qApp->icons()->fromTheme(QSL("emblem-downloads")), tr("Fetch metadata"), nullptr); m_feedContextMenu.append(m_actionFeedFetchMetadata); } @@ -273,14 +273,14 @@ bool StandardServiceRoot::mergeImportExportModel(FeedsImportExportModel *model, // Add category failed, but this can mean that the same category (with same title) // already exists. If such a category exists in current parent, then find it and // add descendants to it. - RootItem *existing_category = NULL; + RootItem *existing_category = nullptr; foreach (RootItem *child, target_parent->childItems()) { if (child->kind() == RootItemKind::Category && child->title() == new_category_title) { existing_category = child; } } - if (existing_category != NULL) { + if (existing_category != nullptr) { original_parents.push(existing_category); new_parents.push(source_category); } @@ -328,7 +328,7 @@ void StandardServiceRoot::addNewCategory() { } QScopedPointer form_pointer(new FormStandardCategoryDetails(this, qApp->mainForm())); - form_pointer.data()->exec(NULL, NULL); + form_pointer.data()->exec(nullptr, nullptr); qApp->feedUpdateLock()->unlock(); } diff --git a/src/services/tt-rss/gui/formeditaccount.cpp b/src/services/tt-rss/gui/formeditaccount.cpp index 6f47fa030..076841cd1 100755 --- a/src/services/tt-rss/gui/formeditaccount.cpp +++ b/src/services/tt-rss/gui/formeditaccount.cpp @@ -26,7 +26,7 @@ FormEditAccount::FormEditAccount(QWidget *parent) - : QDialog(parent), m_ui(new Ui::FormEditAccount), m_editableRoot(NULL) { + : QDialog(parent), m_ui(new Ui::FormEditAccount), m_editableRoot(nullptr) { m_ui->setupUi(this); m_btnOk = m_ui->m_buttonBox->button(QDialogButtonBox::Ok); @@ -175,7 +175,7 @@ void FormEditAccount::performTest() { void FormEditAccount::onClickedOk() { bool editing_account = true; - if (m_editableRoot == NULL) { + if (m_editableRoot == nullptr) { // We want to confirm newly created account. // So save new account into DB, setup its properties. m_editableRoot = new TtRssServiceRoot(); diff --git a/src/services/tt-rss/gui/formttrssfeeddetails.cpp b/src/services/tt-rss/gui/formttrssfeeddetails.cpp old mode 100644 new mode 100755 index 3c6e52cac..27fe01d74 --- a/src/services/tt-rss/gui/formttrssfeeddetails.cpp +++ b/src/services/tt-rss/gui/formttrssfeeddetails.cpp @@ -41,7 +41,7 @@ FormTtRssFeedDetails::FormTtRssFeedDetails(ServiceRoot *service_root, QWidget *p } void FormTtRssFeedDetails::apply() { - if (m_editableFeed != NULL) { + if (m_editableFeed != nullptr) { // User edited auto-update status. Save it. TtRssFeed *new_feed_data = new TtRssFeed(); diff --git a/src/services/tt-rss/ttrsscategory.cpp b/src/services/tt-rss/ttrsscategory.cpp index c132b1cf4..55736060b 100755 --- a/src/services/tt-rss/ttrsscategory.cpp +++ b/src/services/tt-rss/ttrsscategory.cpp @@ -31,7 +31,7 @@ TtRssCategory::TtRssCategory(RootItem *parent) : Category(parent) { setIcon(qApp->icons()->fromTheme(QSL("folder"))); } -TtRssCategory::TtRssCategory(const QSqlRecord &record) : Category(NULL) { +TtRssCategory::TtRssCategory(const QSqlRecord &record) : Category(nullptr) { setIcon(qApp->icons()->fromTheme(QSL("folder"))); setId(record.value(CAT_DB_ID_INDEX).toInt()); setTitle(record.value(CAT_DB_TITLE_INDEX).toString()); diff --git a/src/services/tt-rss/ttrssfeed.cpp b/src/services/tt-rss/ttrssfeed.cpp index 9edcbc831..20addb27a 100755 --- a/src/services/tt-rss/ttrssfeed.cpp +++ b/src/services/tt-rss/ttrssfeed.cpp @@ -36,7 +36,7 @@ TtRssFeed::TtRssFeed(RootItem *parent) : Feed(parent) { } -TtRssFeed::TtRssFeed(const QSqlRecord &record) : Feed(NULL) { +TtRssFeed::TtRssFeed(const QSqlRecord &record) : Feed(nullptr) { setTitle(record.value(FDS_DB_TITLE_INDEX).toString()); setId(record.value(FDS_DB_ID_INDEX).toInt()); setIcon(qApp->icons()->fromByteArray(record.value(FDS_DB_ICON_INDEX).toByteArray())); @@ -102,7 +102,7 @@ bool TtRssFeed::canBeEdited() const { bool TtRssFeed::editViaGui() { QPointer form_pointer = new FormTtRssFeedDetails(serviceRoot(), qApp->mainForm()); - form_pointer.data()->exec(this, NULL); + form_pointer.data()->exec(this, nullptr); delete form_pointer.data(); return false; } diff --git a/src/services/tt-rss/ttrssserviceroot.cpp b/src/services/tt-rss/ttrssserviceroot.cpp index 45703d890..ec2cdfa5c 100755 --- a/src/services/tt-rss/ttrssserviceroot.cpp +++ b/src/services/tt-rss/ttrssserviceroot.cpp @@ -40,7 +40,7 @@ TtRssServiceRoot::TtRssServiceRoot(RootItem *parent) : ServiceRoot(parent), m_recycleBin(new TtRssRecycleBin(this)), - m_actionSyncIn(NULL), m_serviceMenu(QList()), m_network(new TtRssNetworkFactory()) { + m_actionSyncIn(nullptr), m_serviceMenu(QList()), m_network(new TtRssNetworkFactory()) { setIcon(TtRssServiceEntryPoint().icon()); } @@ -124,7 +124,7 @@ void TtRssServiceRoot::addNewFeed(const QString &url) { QScopedPointer form_pointer(new FormTtRssFeedDetails(this, qApp->mainForm())); - form_pointer.data()->exec(NULL, this, url); + form_pointer.data()->exec(nullptr, this, url); qApp->feedUpdateLock()->unlock(); } @@ -277,7 +277,7 @@ RootItem *TtRssServiceRoot::obtainNewTreeForSyncIn() const { return feed_cats_response.feedsCategories(true, m_network->url()); } else { - return NULL; + return nullptr; } }