[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [krecipes] src/dialogs/recipeinput: Deduplicate code to categorize a recipe.
From:       José_Manuel_Santamaría_Lema <panfaust () gmail ! com>
Date:       2016-04-01 18:28:38
Message-ID: E1am3oE-0003Dn-JY () scm ! kde ! org
[Download RAW message or body]

Git commit abcc457ff67f8b395bd2b3af3414cfb2f75a1f0a by José Manuel Santamaría Lema.
Committed on 01/04/2016 at 18:26.
Pushed by joselema into branch 'master'.

Deduplicate code to categorize a recipe.

Categorizing is done via Ctrl+T

M  +3    -2    src/dialogs/recipeinput/recipegeneralinfoeditor.h
M  +1    -10   src/dialogs/recipeinput/recipeinputdialog.cpp

http://commits.kde.org/krecipes/abcc457ff67f8b395bd2b3af3414cfb2f75a1f0a

diff --git a/src/dialogs/recipeinput/recipegeneralinfoeditor.h \
b/src/dialogs/recipeinput/recipegeneralinfoeditor.h index 2ea968d..573c678 100644
--- a/src/dialogs/recipeinput/recipegeneralinfoeditor.h
+++ b/src/dialogs/recipeinput/recipegeneralinfoeditor.h
@@ -39,6 +39,9 @@ signals:
 	void changed();
 	void titleChanged(const QString & title);
 
+public slots:
+	void editCategoriesSlot();
+
 private slots:
 	void titleChangedSlot(const QString & title);
 
@@ -48,8 +51,6 @@ private slots:
 
 	void editAuthorsSlot();
 
-	void editCategoriesSlot();
-
 private:
 	RecipeDB::IdType createNewYieldIfNecessary( const QString &yield );
 	void showAuthors();
diff --git a/src/dialogs/recipeinput/recipeinputdialog.cpp \
b/src/dialogs/recipeinput/recipeinputdialog.cpp index 73d8a3d..466954c 100644
--- a/src/dialogs/recipeinput/recipeinputdialog.cpp
+++ b/src/dialogs/recipeinput/recipeinputdialog.cpp
@@ -16,7 +16,6 @@
 #include "ingredientseditor.h"
 #include "ratinglisteditor.h"
 #include "resizerecipedialog.h"
-#include "selectcategoriesdialog.h"
 
 #include "widgets/kretextedit.h"
 
@@ -361,15 +360,7 @@ void RecipeInputDialog::showRecipe( void )
 
 void RecipeInputDialog::addCategory( void )
 {
-       QPointer<SelectCategoriesDialog> editCategoriesDialog = new \
                SelectCategoriesDialog( this, loadedRecipe->categoryList, database );
-
-       if ( editCategoriesDialog->exec() == QDialog::Accepted ) { // user presses Ok
-		loadedRecipe->categoryList.clear();
-		editCategoriesDialog->getSelectedCategories( &( loadedRecipe->categoryList ) ); // \
                get the category list chosen
-		emit( recipeChanged() ); //Indicate that the recipe changed
-       }
-
-       delete editCategoriesDialog;
+	m_recipeGeneralInfoEditor->editCategoriesSlot();
 }
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic