Fix add selected category/feed s-s connection.
This commit is contained in:
parent
8a42fd43e5
commit
d5521fe2b8
8 changed files with 24 additions and 19 deletions
|
@ -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()) {
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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<QString, QVariantMap> ServiceRoot::storeCustomFeedsData() {
|
||||
QMap<QString, QVariantMap> custom_data;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -52,8 +52,10 @@ bool StandardCategory::canBeDeleted() const {
|
|||
}
|
||||
|
||||
bool StandardCategory::editViaGui() {
|
||||
QScopedPointer<FormStandardCategoryDetails> form_pointer(new FormStandardCategoryDetails(serviceRoot(), qApp->mainFormWidget()));
|
||||
form_pointer.data()->addEditCategory(this, nullptr);
|
||||
QScopedPointer<FormStandardCategoryDetails> form_pointer(new FormStandardCategoryDetails(serviceRoot(),
|
||||
qApp->mainFormWidget()));
|
||||
|
||||
form_pointer->addEditCategory(this, nullptr);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<FormStandardCategoryDetails> form_pointer(new FormStandardCategoryDetails(this, qApp->mainFormWidget()));
|
||||
QScopedPointer<FormStandardCategoryDetails> form_pointer(new FormStandardCategoryDetails(this,
|
||||
qApp->mainFormWidget()));
|
||||
|
||||
form_pointer.data()->addEditCategory(nullptr, nullptr);
|
||||
form_pointer->addEditCategory(nullptr, selected_item);
|
||||
qApp->feedUpdateLock()->unlock();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue