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