MpcImportWindow.cpp   MpcImportWindow.cpp 
skipping to change at line 205 skipping to change at line 205
//Resetting the dialog should not reset the timer //Resetting the dialog should not reset the timer
//resetCountdown(); //resetCountdown();
resetNotFound(); resetNotFound();
enableInterface(true); enableInterface(true);
} }
void MpcImportWindow::populateBookmarksList() void MpcImportWindow::populateBookmarksList()
{ {
ui->comboBoxBookmarks->clear(); ui->comboBoxBookmarks->clear();
ui->comboBoxBookmarks->addItem("Select bookmark..."); ui->comboBoxBookmarks->addItem(q_("Select bookmark..."));
QStringList bookmarkTitles(bookmarks.value(importType).keys()); QStringList bookmarkTitles(bookmarks.value(importType).keys());
bookmarkTitles.sort(); bookmarkTitles.sort();
ui->comboBoxBookmarks->addItems(bookmarkTitles); ui->comboBoxBookmarks->addItems(bookmarkTitles);
} }
void MpcImportWindow::retranslate() void MpcImportWindow::retranslate()
{ {
if (dialog) if (dialog)
{ {
ui->retranslateUi(dialog); ui->retranslateUi(dialog);
skipping to change at line 332 skipping to change at line 332
void MpcImportWindow::selectFile() void MpcImportWindow::selectFile()
{ {
QStringList directories = QStandardPaths::standardLocations(QStandar dPaths::DesktopLocation) + QStringList directories = QStandardPaths::standardLocations(QStandar dPaths::DesktopLocation) +
QStandardPaths::st andardLocations(QStandardPaths::HomeLocation) << "/"; QStandardPaths::st andardLocations(QStandardPaths::HomeLocation) << "/";
QString filePath = QFileDialog::getOpenFileName(NULL, "Select a text file", directories[0]); QString filePath = QFileDialog::getOpenFileName(NULL, "Select a text file", directories[0]);
ui->lineEditFilePath->setText(filePath); ui->lineEditFilePath->setText(filePath);
} }
void MpcImportWindow::bookmarkSelected(QString bookmarkTitle) void MpcImportWindow::bookmarkSelected(QString bookmarkTitle)
{ {
if (bookmarkTitle.isEmpty() || bookmarkTitle == "Select bookmark..." ) if (bookmarkTitle.isEmpty() || bookmarks.value(importType).value(boo kmarkTitle).isEmpty())
{ {
ui->lineEditURL->clear(); ui->lineEditURL->clear();
return; return;
} }
QString bookmarkUrl = bookmarks.value(importType).value(bookmarkTitl e); QString bookmarkUrl = bookmarks.value(importType).value(bookmarkTitl e);
ui->lineEditURL->setText(bookmarkUrl); ui->lineEditURL->setText(bookmarkUrl);
} }
void MpcImportWindow::populateCandidateObjects(QList<SsoElements> objects) void MpcImportWindow::populateCandidateObjects(QList<SsoElements> objects)
{ {
skipping to change at line 720 skipping to change at line 720
sendQueryToUrl(QUrl("http://stellarium.org/mpc-mpeph")); sendQueryToUrl(QUrl("http://stellarium.org/mpc-mpeph"));
//sendQueryToUrl(QUrl("http://scully.cfa.harvard.edu/cgi-bin/mpeph2. cgi")); //sendQueryToUrl(QUrl("http://scully.cfa.harvard.edu/cgi-bin/mpeph2. cgi"));
} }
void MpcImportWindow::sendQueryToUrl(QUrl url) void MpcImportWindow::sendQueryToUrl(QUrl url)
{ {
QUrlQuery q(url); QUrlQuery q(url);
q.addQueryItem("ty","e");//Type: ephemerides q.addQueryItem("ty","e");//Type: ephemerides
q.addQueryItem("TextArea", query);//Object name query q.addQueryItem("TextArea", query);//Object name query
//q.addQueryItem("e", "-1");//Elements format: MPC 1-line q.addQueryItem("e", "-1");//Elements format: MPC 1-line
//Switch to MPC 1-line format --AW
//XEphem's format is used instead because it doesn't truncate object names. //XEphem's format is used instead because it doesn't truncate object names.
q.addQueryItem("e", "3");//Elements format: XEphem //q.addQueryItem("e", "3");//Elements format: XEphem
//Yes, all of the rest are necessary //Yes, all of the rest are necessary
q.addQueryItem("d",""); q.addQueryItem("d","");
q.addQueryItem("l",""); q.addQueryItem("l","");
q.addQueryItem("i",""); q.addQueryItem("i","");
q.addQueryItem("u","d"); q.addQueryItem("u","d");
q.addQueryItem("uto", "0"); q.addQueryItem("uto", "0");
q.addQueryItem("c", ""); q.addQueryItem("c", "");
q.addQueryItem("long", ""); q.addQueryItem("long", "");
q.addQueryItem("lat", ""); q.addQueryItem("lat", "");
q.addQueryItem("alt", ""); q.addQueryItem("alt", "");
skipping to change at line 845 skipping to change at line 846
{ {
Q_ASSERT(reply); Q_ASSERT(reply);
QList<SsoElements> objects; QList<SsoElements> objects;
QTemporaryFile file; QTemporaryFile file;
if (file.open()) if (file.open())
{ {
file.write(reply->readAll()); file.write(reply->readAll());
file.close(); file.close();
QRegExp cometProvisionalDesignation("[PCDX]/");
QRegExp cometDesignation("(\\d)+[PCDX]/");
QString queryData = ui->lineEditQuery->text().trimmed();
if (cometDesignation.indexIn(queryData) == 0 || cometProvisi
onalDesignation.indexIn(queryData) == 0)
objects = readElementsFromFile(MpcComets, file.fileN
ame());
else
objects = readElementsFromFile(MpcMinorPlanets, file
.fileName());
/* /*
//Try to read it as a comet first? //Try to read it as a comet first?
objects = readElementsFromFile(MpcComets, file.fileName()); objects = readElementsFromFile(MpcComets, file.fileName());
if (objects.isEmpty()) if (objects.isEmpty())
objects = readElementsFromFile(MpcMinorPlanets, file .fileName()); objects = readElementsFromFile(MpcMinorPlanets, file .fileName());
*/ */
objects = ssoManager->readXEphemOneLineElementsFromFile(file //XEphem given wrong data for comets --AW
.fileName()); //objects = ssoManager->readXEphemOneLineElementsFromFile(fi
le.fileName());
} }
else else
{ {
qWarning() << "Unable to open a temporary file. Aborting ope ration."; qWarning() << "Unable to open a temporary file. Aborting ope ration.";
} }
if (objects.isEmpty()) if (objects.isEmpty())
{ {
qWarning() << "No objects found in the file downloaded from" qWarning() << "No objects found in the file downloaded from"
<< reply->url().toString(); << reply->url().toString();
 End of changes. 6 change blocks. 
6 lines changed or deleted 20 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/