From: Hans F. <fu...@us...> - 2004-06-29 14:24:17
|
Update of /cvsroot/neelix/neelix/view/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29132/view/qt Modified Files: mw.ui qt.rb Log Message: Delete now works, if you're running an up-to-date cvs tree of qtruby. The trick is the i.dispose call. If you have an older qtruby, it will do the delete in the db before crashing. Index: mw.ui =================================================================== RCS file: /cvsroot/neelix/neelix/view/qt/mw.ui,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- mw.ui 25 Jun 2004 04:27:18 -0000 1.5 +++ mw.ui 29 Jun 2004 14:24:07 -0000 1.6 @@ -9,7 +9,7 @@ <x>0</x> <y>0</y> <width>747</width> - <height>531</height> + <height>537</height> </rect> </property> <property name="caption"> @@ -284,7 +284,7 @@ <cstring>tab</cstring> </property> <attribute name="title"> - <string>Directions</string> + <string>&Directions</string> </attribute> <hbox> <property name="name"> @@ -297,6 +297,18 @@ <property name="enabled"> <bool>true</bool> </property> + <property name="textFormat"> + <enum>PlainText</enum> + </property> + <property name="wordWrap"> + <enum>FixedColumnWidth</enum> + </property> + <property name="wrapColumnOrWidth"> + <number>72</number> + </property> + <property name="tabChangesFocus"> + <bool>true</bool> + </property> </widget> </hbox> </widget> @@ -305,7 +317,7 @@ <cstring>tab</cstring> </property> <attribute name="title"> - <string>Notes</string> + <string>&Notes</string> </attribute> <hbox> <property name="name"> @@ -315,6 +327,18 @@ <property name="name"> <cstring>note_edit</cstring> </property> + <property name="textFormat"> + <enum>PlainText</enum> + </property> + <property name="wordWrap"> + <enum>FixedColumnWidth</enum> + </property> + <property name="wrapColumnOrWidth"> + <number>72</number> + </property> + <property name="tabChangesFocus"> + <bool>true</bool> + </property> </widget> </hbox> </widget> @@ -617,9 +641,9 @@ <tabstop>tottime_entry</tabstop> <tabstop>yields_entry</tabstop> <tabstop>ingredients_table</tabstop> - <tabstop>editTab</tabstop> <tabstop>directions_edit</tabstop> <tabstop>note_edit</tabstop> + <tabstop>editTab</tabstop> </tabstops> <slots> <slot>recipename_changed(const QString&)</slot> @@ -641,6 +665,7 @@ <slot>editAdd_Recipe()</slot> <slot>author_changed(const QString&)</slot> <slot>fileNew()</slot> + <slot>shelf_selectionChanged()</slot> </slots> <layoutdefaults spacing="6" margin="11"/> </UI> Index: qt.rb =================================================================== RCS file: /cvsroot/neelix/neelix/view/qt/qt.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- qt.rb 25 Jun 2004 04:27:18 -0000 1.5 +++ qt.rb 29 Jun 2004 14:24:07 -0000 1.6 @@ -11,6 +11,7 @@ build_shelf @counterStack.enabled = false @shelf.currentItem = @shelf.firstChild + shelf_currentChanged end def build_shelf $replicator.cookbooks.each do |cookbook| @@ -68,8 +69,8 @@ # fileOpen # fileSaveAs # editAdd_Ingredient - # editDelete + # exit def fileExit $qApp.quit end @@ -116,11 +117,36 @@ @recipe_entry.setFocus @recipe_entry.selectAll end + def editDelete + i = @shelf.currentItem + d = i.data + + case d + when Cookbook + Presenter::deleteCookbook(d) + when Category + Presenter::deleteCategory(i.parent.data, d) + when Recipe + Presenter::deleteRecipe(i.parent.data, d) + end + + i.dispose + end def helpAbout AboutDialog.new.exec end def shelf_currentChanged + if not @shelf.currentItem + @counterStack.enabled = false + @editAdd_CookbookAction.enabled = true + @editAdd_CategoryAction.enabled = false + @editAdd_RecipeAction.enabled = false + @editAdd_IngredientAction.enabled = false + @editDeleteAction.enabled = false + return + end + i = @shelf.currentItem.data self.counter_currentItem = i @@ -134,6 +160,7 @@ @editAdd_CategoryAction.enabled = true @editAdd_RecipeAction.enabled = false @editAdd_IngredientAction.enabled = false + @editDeleteAction.enabled = true when Category @counterStack.enabled = false @@ -141,6 +168,7 @@ @editAdd_CategoryAction.enabled = false @editAdd_RecipeAction.enabled = true @editAdd_IngredientAction.enabled = false + @editDeleteAction.enabled = true when Recipe @counterStack.enabled = true @@ -148,6 +176,15 @@ @editAdd_CategoryAction.enabled = false @editAdd_RecipeAction.enabled = false @editAdd_IngredientAction.enabled = true + @editDeleteAction.enabled = true + else + @counterStack.enabled = false + + @editAdd_CookbookAction.enabled = true + @editAdd_CategoryAction.enabled = false + @editAdd_RecipeAction.enabled = false + @editAdd_IngredientAction.enabled = false + @editDeleteAction.enabled = false end end def shelf_item_renamed(item,col,text) |