diff --git a/src/application/xqchildmodel.cpp b/src/application/xqchildmodel.cpp index ebcf41f..769b07d 100644 --- a/src/application/xqchildmodel.cpp +++ b/src/application/xqchildmodel.cpp @@ -98,6 +98,8 @@ void XQChildModel::addSectionEntry( const QString& key, const XQNodePtr& content void XQChildModel::initContextMenu() { + _sections.dump(); + // __fixme! add a menu title _contextMenu->clear(); @@ -117,7 +119,7 @@ void XQChildModel::initContextMenu() // __fixme! set 'toggle section ' entry //contextMenu.actions().first()->setText(""); - _contextMenu->addAction( "icn29Dummy", "Toggle Section", XQCommand::cmdToggleSection, hasSel); + _contextMenu->addAction( "icn29Dummy", "Hide Section", XQCommand::cmdToggleSection, true ); } diff --git a/src/main.cpp b/src/main.cpp index faa7ede..68b724f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -80,7 +80,7 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - //app.setStyle("fusion"); + //app.setStyle("WindowsVista"); XQMainWindow window; window.show(); diff --git a/src/model/xqviewmodel.cpp b/src/model/xqviewmodel.cpp index 6e5114b..7cac038 100644 --- a/src/model/xqviewmodel.cpp +++ b/src/model/xqviewmodel.cpp @@ -419,7 +419,7 @@ void XQViewModel::cmdDelete( const XQCommand& command ) } } -//! macht 'delete' wirder rückgängig. +//! macht 'delete' wieder rückgängig. void XQViewModel::cmdDeleteUndo( const XQCommand& command ) { @@ -432,18 +432,16 @@ void XQViewModel::cmdDeleteUndo( const XQCommand& command ) void XQViewModel::cmdNew( const XQCommand& command ) { - // __fix - /* - const QModelIndex& origin = command.originIndex(); - if( !origin.isValid() ) - throw XQException("cmdNewRow failed: index not valid "); - XQItem* target = xqItemFromIndex( origin ); + + const QModelIndex& origin = command.originIndex(); + + + XQItem& target = xqItemFromIndex( origin ); // current data node - XQNodePtr node = target->contentNode(); + XQNodePtr node = target.contentNode(); // we create a new data node - //XQNodePtr newNode = new XQNodePtr( node->tag_name(), node->parent() ); XQNodePtr newNode = XQNode::make_node( node->tag_name(), node->tag_value(), node->parent() ); // store node in node->parent() //node->add_before_me( newNode ); @@ -451,7 +449,7 @@ void XQViewModel::cmdNew( const XQCommand& command ) const XQModelSection& section = _sections.sectionFromIndex( origin ); // create new item row - XQItemList list = _itemFactory.createGenericRow( newNode, section.sheetRootNode ); + XQItemList list =_itemFactory.makeRow( section.sheetRootNode(), newNode ); // add it to the treeview ... insertRow( origin.row(), list ); @@ -460,32 +458,30 @@ void XQViewModel::cmdNew( const XQCommand& command ) treeTable()->setCurrentIndex( list[0]->index() ); // ... editable treeTable()->edit( list[0]->index() ); - */ + } void XQViewModel::toggleSection( const XQModelSection& section ) { - - /* - if(_treeTable) { - - qDebug() << " ---- FIRZ: " << _sections.keyOf( sec ); + const QModelIndex& index = section.persistentModelIndex(); + qDebug() << " ---- toggle section: FIRZ: " << index.isValid() << " : " << index.data().toString() << " : " << section.contentType();//_sections.keyOf( sec ); int fstRow = _sections.firstRow( index ); int lstRow = _sections.lastRow( index ); _treeTable->toggleRowsHidden(fstRow, lstRow ); - - - + emit sectionToggled( section ); } - */ - emit sectionToggled( section ); } +void XQViewModel::toggleSection( const QString& sectionKey ) +{ + +} + //! entfernt die neu angelegte zeile. void XQViewModel::cmdNewUndo( const XQCommand& command ) diff --git a/src/model/xqviewmodel.h b/src/model/xqviewmodel.h index 95ec3b5..3f2cc19 100644 --- a/src/model/xqviewmodel.h +++ b/src/model/xqviewmodel.h @@ -56,6 +56,7 @@ public: void expandNewItem(const QModelIndex& index); void toggleSection( const XQModelSection& section ); + void toggleSection( const QString& sectionKey ); //little helpers const XQItem& xqRootItem(); @@ -118,8 +119,7 @@ signals: protected: void addSection(const XQItemList& list, const XQNodePtr& sheetNode ); - virtual void initContextMenu(){} - + virtual void initContextMenu() = 0; // __fixme: should be created from xml virtual void setupViewProperties(); diff --git a/xml/modelsheets.xml b/xml/modelsheets.xml index a34039f..00372f5 100644 --- a/xml/modelsheets.xml +++ b/xml/modelsheets.xml @@ -110,8 +110,8 @@
- - + +