mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-10 23:23:52 +01:00
Some refacts.
This commit is contained in:
parent
b79d6b2ccd
commit
1be6bf3f4a
@ -78,14 +78,10 @@ void FeedsView::clearSelectedFeeds() {
|
||||
}
|
||||
|
||||
void FeedsView::addNewCategory() {
|
||||
QPointer<FormCategoryDetails> form_pointer = new FormCategoryDetails(m_sourceModel,
|
||||
this);
|
||||
FeedsModelCategory *output_item;
|
||||
FeedsModelRootItem *parent_item;
|
||||
QPointer<FormCategoryDetails> form_pointer = new FormCategoryDetails(m_sourceModel, this);
|
||||
FormCategoryDetailsAnswer answer = form_pointer.data()->exec(NULL, NULL);
|
||||
|
||||
if (form_pointer.data()->exec(NULL,
|
||||
output_item,
|
||||
parent_item) == QDialog::Accepted) {
|
||||
if (answer.m_dialogCode == QDialog::Accepted) {
|
||||
// User submitted some new category and
|
||||
// it now resides in output_item pointer,
|
||||
// parent_item contains parent_that user selected for
|
||||
|
@ -35,9 +35,10 @@ void FormCategoryDetails::setEditableCategory(FeedsModelCategory *editable_categ
|
||||
m_ui->m_btnIcon->setIcon(editable_category->icon());
|
||||
}
|
||||
|
||||
int FormCategoryDetails::exec(FeedsModelCategory *input_category,
|
||||
FeedsModelCategory *output_item,
|
||||
FeedsModelRootItem *parent_item) {
|
||||
FormCategoryDetailsAnswer FormCategoryDetails::exec(FeedsModelCategory *input_category,
|
||||
FeedsModelCategory *input_parent_category) {
|
||||
FormCategoryDetailsAnswer answer;
|
||||
|
||||
if (input_category == NULL) {
|
||||
// User is adding new category.
|
||||
}
|
||||
@ -46,9 +47,9 @@ int FormCategoryDetails::exec(FeedsModelCategory *input_category,
|
||||
setEditableCategory(input_category);
|
||||
}
|
||||
|
||||
int result = QDialog::exec();
|
||||
answer.m_dialogCode = QDialog::exec();
|
||||
|
||||
return result;
|
||||
return answer;
|
||||
}
|
||||
|
||||
void FormCategoryDetails::initialize() {
|
||||
|
@ -14,6 +14,13 @@ class FeedsModelCategory;
|
||||
class FeedsModel;
|
||||
class FeedsModelRootItem;
|
||||
|
||||
class FormCategoryDetailsAnswer {
|
||||
public:
|
||||
int m_dialogCode;
|
||||
FeedsModelCategory *m_outputItem;
|
||||
FeedsModelRootItem *m_outputParentItem;
|
||||
};
|
||||
|
||||
class FormCategoryDetails : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
@ -34,9 +41,8 @@ class FormCategoryDetails : public QDialog {
|
||||
// in the database.
|
||||
// NOTE: Newly EDITED category IS COPY of its original.
|
||||
// SO NO ORIGINAL MODEL DATA ARE EDITED OR CHANGED.
|
||||
int exec(FeedsModelCategory *input_category,
|
||||
FeedsModelCategory *output_item,
|
||||
FeedsModelRootItem *parent_item);
|
||||
FormCategoryDetailsAnswer exec(FeedsModelCategory *input_category,
|
||||
FeedsModelCategory *input_parent_category);
|
||||
|
||||
protected:
|
||||
// Sets the category which will be edited.
|
||||
|
Loading…
Reference in New Issue
Block a user