Fix a longstanding bug in "on_addButton_clicked()".

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4647 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2014-11-25 14:39:15 +00:00
parent 5c5283552a
commit 1e59bdf367

View File

@ -2150,26 +2150,23 @@ void MainWindow::on_addButton_clicked() //Add button
msgBox("Cannot open \"" + f2.fileName () + "\"."); msgBox("Cannot open \"" + f2.fileName () + "\".");
return; return;
} }
QTextStream in(&f1); QTextStream in(&f1); //Read from CALL3.TXT
QTextStream out(&f2); QTextStream out(&f2); //Copy into CALL3.TMP
QString hc=hisCall; QString hc=hisCall;
QString hc1=""; QString hc1="";
QString hc2="AAAAAA"; QString hc2="000000";
QString s; QString s;
do { do {
s=in.readLine(); s=in.readLine();
hc1=hc2; hc1=hc2;
if(s.mid(0,2)=="//") { if(s.mid(0,2)=="//") {
out << s + "\n"; out << s + "\n"; //Copy all comment lines
} else { } else {
int i1=s.indexOf(","); int i1=s.indexOf(",");
hc2=s.mid(0,i1); hc2=s.mid(0,i1);
if(hc>hc1 && hc<hc2) { if(hc>hc1 && hc<hc2) {
out << newEntry + "\n"; out << newEntry + "\n";
if(s.mid(0,6)=="ZZZZZZ") {
out << s + "\n"; out << s + "\n";
// exit; //Statement has no effect!
}
m_call3Modified=true; m_call3Modified=true;
} else if(hc==hc2) { } else if(hc==hc2) {
QString t=s + "\n\n is already in CALL3.TXT\n" + QString t=s + "\n\n is already in CALL3.TXT\n" +
@ -2187,9 +2184,7 @@ void MainWindow::on_addButton_clicked() //Add button
} while(!s.isNull()); } while(!s.isNull());
f1.close(); f1.close();
if(hc>hc1 && !m_call3Modified) { if(hc>hc1 && !m_call3Modified) out << newEntry + "\n";
out << newEntry + "\n";
}
if(m_call3Modified) { if(m_call3Modified) {
QDir data_path {m_config.data_path ()}; QDir data_path {m_config.data_path ()};
QFile f0(data_path.absoluteFilePath ("CALL3.OLD")); QFile f0(data_path.absoluteFilePath ("CALL3.OLD"));