void StationTreeView::saveList() { TreeItem* item = static_cast<StationTreeModel*>(model())->getItem( this->selectionModel()->currentIndex()); QString listName = item->data(0).toString(); QString fileName = QFileDialog::getSaveFileName(this, "Save station list", "","*.stn"); if (!fileName.isEmpty()) emit stationListSaved(listName, fileName); }
void StationTreeView::writeToFile() { QModelIndex index (this->selectionModel()->currentIndex()); if (!index.isValid()) OGSError::box("No station list selected."); else { TreeItem* item = static_cast<StationTreeModel*>(model())->getItem(index); QString listName = item->data(0).toString(); QString fileName = QFileDialog::getSaveFileName(this, "Save station list", LastSavedFileDirectory::getDir() + listName, "*.stn"); if (!fileName.isEmpty()) { LastSavedFileDirectory::setDir(fileName); emit stationListSaved(listName, fileName); } } }