diff --git a/src/librssguard/gui/dialogs/formmain.cpp b/src/librssguard/gui/dialogs/formmain.cpp index c39c6d859..aa7b7d9ea 100755 --- a/src/librssguard/gui/dialogs/formmain.cpp +++ b/src/librssguard/gui/dialogs/formmain.cpp @@ -258,7 +258,10 @@ void FormMain::updateAddItemMenu() { m_ui->m_menuAddItem); root_menu->addAction(action_new_category); - connect(action_new_category, &QAction::triggered, activated_root, &ServiceRoot::addNewCategory); + connect(action_new_category, &QAction::triggered, + activated_root, [activated_root]() { + activated_root->addNewCategory(activated_root); + }); } if (activated_root->supportsFeedAdding()) { @@ -267,9 +270,10 @@ void FormMain::updateAddItemMenu() { m_ui->m_menuAddItem); root_menu->addAction(action_new_feed); - - // NOTE: Because of default arguments. - connect(action_new_feed, SIGNAL(triggered(bool)), activated_root, SLOT(addNewFeed())); + connect(action_new_feed, &QAction::triggered, + activated_root, [activated_root]() { + activated_root->addNewFeed(activated_root); + }); } if (!specific_root_actions.isEmpty()) { diff --git a/src/librssguard/gui/feedsview.cpp b/src/librssguard/gui/feedsview.cpp index 17a4d3e3c..59473aa1e 100755 --- a/src/librssguard/gui/feedsview.cpp +++ b/src/librssguard/gui/feedsview.cpp @@ -179,7 +179,7 @@ void FeedsView::addCategoryIntoSelectedAccount() { ServiceRoot* root = selected->getParentServiceRoot(); if (root->supportsCategoryAdding()) { - root->addNewCategory(); + root->addNewCategory(selectedItem()); } else { qApp->showGuiMessage(tr("Not supported"), diff --git a/src/librssguard/services/abstract/serviceroot.cpp b/src/librssguard/services/abstract/serviceroot.cpp index 25fcbebc1..51abbe4a3 100644 --- a/src/librssguard/services/abstract/serviceroot.cpp +++ b/src/librssguard/services/abstract/serviceroot.cpp @@ -271,7 +271,7 @@ void ServiceRoot::addNewFeed(RootItem* selected_item, const QString& url) { Q_UNUSED(url) } -void ServiceRoot::addNewCategory() {} +void ServiceRoot::addNewCategory(RootItem* selected_item) {} QMap ServiceRoot::storeCustomFeedsData() { QMap custom_data; diff --git a/src/librssguard/services/abstract/serviceroot.h b/src/librssguard/services/abstract/serviceroot.h index e2192c563..26c360da8 100644 --- a/src/librssguard/services/abstract/serviceroot.h +++ b/src/librssguard/services/abstract/serviceroot.h @@ -159,7 +159,7 @@ class ServiceRoot : public RootItem { public slots: virtual void addNewFeed(RootItem* selected_item, const QString& url = QString()); - virtual void addNewCategory(); + virtual void addNewCategory(RootItem* selected_item); virtual void syncIn(); protected: diff --git a/src/librssguard/services/standard/gui/formstandardcategorydetails.h b/src/librssguard/services/standard/gui/formstandardcategorydetails.h index e5bf2bd80..165b8a8db 100644 --- a/src/librssguard/services/standard/gui/formstandardcategorydetails.h +++ b/src/librssguard/services/standard/gui/formstandardcategorydetails.h @@ -23,9 +23,7 @@ class FormStandardCategoryDetails : public QDialog { Q_OBJECT public: - - // Constructors and destructors. - explicit FormStandardCategoryDetails(StandardServiceRoot* service_root, QWidget* parent = 0); + explicit FormStandardCategoryDetails(StandardServiceRoot* service_root, QWidget* parent = nullptr); virtual ~FormStandardCategoryDetails(); public slots: diff --git a/src/librssguard/services/standard/standardcategory.cpp b/src/librssguard/services/standard/standardcategory.cpp index 3356ccf2a..985729fee 100644 --- a/src/librssguard/services/standard/standardcategory.cpp +++ b/src/librssguard/services/standard/standardcategory.cpp @@ -52,8 +52,10 @@ bool StandardCategory::canBeDeleted() const { } bool StandardCategory::editViaGui() { - QScopedPointer form_pointer(new FormStandardCategoryDetails(serviceRoot(), qApp->mainFormWidget())); - form_pointer.data()->addEditCategory(this, nullptr); + QScopedPointer form_pointer(new FormStandardCategoryDetails(serviceRoot(), + qApp->mainFormWidget())); + + form_pointer->addEditCategory(this, nullptr); return false; } @@ -96,7 +98,7 @@ bool StandardCategory::addItself(RootItem* parent) { // Now, add category to persistent storage. QSqlDatabase database = qApp->database()->connection(metaObject()->className()); int new_id = DatabaseQueries::addStandardCategory(database, parent->id(), parent->getParentServiceRoot()->accountId(), - title(), description(), creationDate(), icon()); + title(), description(), creationDate(), icon()); if (new_id <= 0) { return false; @@ -114,8 +116,8 @@ bool StandardCategory::editItself(StandardCategory* new_category_data) { RootItem* new_parent = new_category_data->parent(); if (DatabaseQueries::editStandardCategory(database, new_parent->id(), original_category->id(), - new_category_data->title(), new_category_data->description(), - new_category_data->icon())) { + new_category_data->title(), new_category_data->description(), + new_category_data->icon())) { // Setup new model data for the original item. original_category->setDescription(new_category_data->description()); original_category->setIcon(new_category_data->icon()); diff --git a/src/librssguard/services/standard/standardserviceroot.cpp b/src/librssguard/services/standard/standardserviceroot.cpp index 2076aa315..85381f478 100644 --- a/src/librssguard/services/standard/standardserviceroot.cpp +++ b/src/librssguard/services/standard/standardserviceroot.cpp @@ -276,7 +276,7 @@ bool StandardServiceRoot::mergeImportExportModel(FeedsImportExportModel* model, return !some_feed_category_error; } -void StandardServiceRoot::addNewCategory() { +void StandardServiceRoot::addNewCategory(RootItem* selected_item) { if (!qApp->feedUpdateLock()->tryLock()) { // Lock was not obtained because // it is used probably by feed updater or application @@ -289,9 +289,10 @@ void StandardServiceRoot::addNewCategory() { return; } - QScopedPointer form_pointer(new FormStandardCategoryDetails(this, qApp->mainFormWidget())); + QScopedPointer form_pointer(new FormStandardCategoryDetails(this, + qApp->mainFormWidget())); - form_pointer.data()->addEditCategory(nullptr, nullptr); + form_pointer->addEditCategory(nullptr, selected_item); qApp->feedUpdateLock()->unlock(); } diff --git a/src/librssguard/services/standard/standardserviceroot.h b/src/librssguard/services/standard/standardserviceroot.h index 5eadc15d7..e1e660632 100644 --- a/src/librssguard/services/standard/standardserviceroot.h +++ b/src/librssguard/services/standard/standardserviceroot.h @@ -51,7 +51,7 @@ class StandardServiceRoot : public ServiceRoot { public slots: void addNewFeed(RootItem* selected_item, const QString& url = QString()); - void addNewCategory(); + void addNewCategory(RootItem* selected_item); void importFeeds(); void exportFeeds();