| 109 | } |
| 110 | |
| 111 | void ProtocolExp::accept() |
| 112 | { |
| 113 | if (_session->have_decoded_result() == false) |
| 114 | { |
| 115 | QString errMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_NO_DECODED_RESULT), "No data to export"); |
| 116 | MsgBox::Show(errMsg); |
| 117 | return; |
| 118 | } |
| 119 | |
| 120 | QDialog::accept(); |
| 121 | |
| 122 | if (_row_sel_list.empty()){ |
| 123 | return; |
| 124 | } |
| 125 | |
| 126 | QList<QString> supportedFormats; |
| 127 | for (int i = _format_combobox->count() - 1; i >= 0; i--) |
| 128 | { |
| 129 | supportedFormats.push_back(_format_combobox->itemText(i)); |
| 130 | } |
| 131 | |
| 132 | QString filter; |
| 133 | for (int i = 0; i < supportedFormats.count(); i++) |
| 134 | { |
| 135 | filter.append(supportedFormats[i]); |
| 136 | if (i < supportedFormats.count() - 1) |
| 137 | filter.append(";;"); |
| 138 | } |
| 139 | |
| 140 | AppConfig &app = AppConfig::Instance(); |
| 141 | QString default_filter = _format_combobox->currentText(); |
| 142 | QString default_name = app.userHistory.protocolExportPath + "/" + "decoder-"; |
| 143 | default_name += _session->get_session_time().toString("-yyMMdd-hhmmss"); |
| 144 | |
| 145 | QString file_name = QFileDialog::getSaveFileName( |
| 146 | this, |
| 147 | L_S(STR_PAGE_DLG, S_ID(IDS_DLG_EXPORT_DATA), "Export Data"), |
| 148 | default_name, filter, |
| 149 | &default_filter); |
| 150 | |
| 151 | if (file_name == ""){ |
| 152 | return; |
| 153 | } |
| 154 | |
| 155 | QFileInfo f(file_name); |
| 156 | QStringList list = default_filter.split('.').last().split(')'); |
| 157 | QString ext = list.first(); |
| 158 | if (f.suffix().compare(ext)) |
| 159 | //tr |
| 160 | file_name += "." + ext; |
| 161 | |
| 162 | QString fname = path::GetDirectoryName(file_name); |
| 163 | if (fname != app.userHistory.openDir) |
| 164 | { |
| 165 | app.userHistory.protocolExportPath = fname; |
| 166 | app.SaveHistory(); |
| 167 | } |
| 168 | _fileName = file_name; |
nothing calls this directly
no test coverage detected