int MinosTestExport::exportAllDetails( HANDLE minosContestFile, bool newfile ) { stanzaCount = 0; if ( newfile ) { // std::string lbuff = "<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' version='1.0'>" ; std::string lbuff = "<?xml version='1.0'?><stream:stream xmlns:stream='http://minos.goodey.org.uk/streams' xmlns='minos:client' version='1.0'>" ; lbuff += "\r\n" + fileHeader; DWORD ret = 0; bool res = WriteFile( minosContestFile, lbuff.c_str(), lbuff.length(), &ret, 0 ); if ( !res || ret != lbuff.length() ) { MinosParameters::getMinosParameters() ->mshowMessage( "bad reply from write!" ); } } exportMode( minosContestFile ); exportContest( minosContestFile ); exportQTH( minosContestFile ); exportEntry( minosContestFile ); exportStation( minosContestFile ); exportCurrent( minosContestFile ); exportOperators( minosContestFile ); exportBundles( minosContestFile ); return stanzaCount; }
// AND we need an export operator change int MinosTestExport::exportTest( HANDLE expfd, int mindump, int maxdump ) { stanzaCount = 0; std::string lbuff = "<?xml version='1.0'?><stream:stream xmlns:stream='http://minos.goodey.org.uk/streams' xmlns='minos:client' version='1.0'>" ; lbuff += "\r\n" + fileHeader; DWORD ret = 0; bool res = WriteFile( expfd, lbuff.c_str(), lbuff.length(), &ret, 0 ); if ( !res || ret != lbuff.length() ) { MinosParameters::getMinosParameters() ->mshowMessage( "bad reply from write!" ); } // export a sequence of Minos stanzas // Don't want to export Minos as read only! bool wasRO = ct->readOnly.getValue(); ct->readOnly.setValue( false ); exportMode( expfd ); ct->readOnly.setValue( wasRO ); exportContest( expfd ); exportQTH( expfd ); exportEntry( expfd ); exportStation( expfd ); exportCurrent( expfd ); exportOperators( expfd ); // not right... we need to log op changes exportBundles( expfd ); bool inDump = false; for ( unsigned int i = 0; i < ct->ctList.size(); i++ ) { BaseContact *dct = ct->ctList[ i ]; ContestContact *lct = dynamic_cast<ContestContact *>( dct ); if ( inDump && lct->contactFlags.getValue() & ( LOCAL_COMMENT | COMMENT_ONLY ) ) { exportComment( expfd, lct ); continue; } int serials = atoi( lct->serials.getValue().c_str() ); // dump the contact, until serial seen if ( ( serials >= mindump ) || ( mindump == 0 ) ) inDump = true; if ( inDump && ( serials <= maxdump ) ) { exportQSO( expfd, lct ); } // Cannot assume that all serials are in order, so we need to go through // the whole contest } return stanzaCount; }
void StationTreeView::contextMenuEvent( QContextMenuEvent* event ) { QModelIndex index = this->selectionModel()->currentIndex(); ModelTreeItem* item = static_cast<ModelTreeItem*>(index.internalPointer()); if (!item) // Otherwise sometimes it crashes when (unmotivated ;-) ) clicking in a treeview return; // The current index refers to a parent item (e.g. a listname) if (item->childCount() > 0) { QMenu menu; QAction* propertyAction = menu.addAction("Display list properties..."); QAction* exportAction = menu.addAction("Export to GMS..."); QAction* saveAction = menu.addAction("Save to file..."); menu.addSeparator(); QAction* removeAction = menu.addAction("Remove station list"); connect(propertyAction, SIGNAL(triggered()), this, SLOT(showPropertiesDialog())); connect(exportAction, SIGNAL(triggered()), this, SLOT(exportList())); connect(saveAction, SIGNAL(triggered()), this, SLOT(saveList())); connect(removeAction, SIGNAL(triggered()), this, SLOT(removeStationList())); menu.exec(event->globalPos()); } // The current index refers to a station object else { QString temp_name; QMenu menu; if (static_cast<StationTreeModel*>(model())->stationFromIndex(index, temp_name)->type() == GeoLib::Station::BOREHOLE) { QAction* stratAction = menu.addAction("Display Stratigraphy..."); QAction* exportAction = menu.addAction("Export to GMS..."); connect(stratAction, SIGNAL(triggered()), this, SLOT(displayStratigraphy())); connect(exportAction, SIGNAL(triggered()), this, SLOT(exportStation())); menu.exec(event->globalPos()); } else { menu.addAction("View Information..."); QAction* showDiagramAction = menu.addAction("View Diagram..."); connect(showDiagramAction, SIGNAL(triggered()), this, SLOT(showDiagramPrefsDialog())); menu.exec(event->globalPos()); } } }