summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-08-17 07:00:14 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-08-17 07:00:14 (GMT)
commit9541af7cfd5fae8a753804ef8341c8c567763bdb (patch)
tree7f41298755befd54d1dbc8f6eda7c6695d41060f
parent4493f67f381559570c706db1c5b22a838d680381 (diff)
Add a new button to the Find Dialog, that resolves using internetdso_resolver
Without the button: resolution was possible only when the search filtering did not return any results. Suppose you have "Shk 166" already in the database, but don't have "Shk 16". Typing just "Shk 16" will show and select "Shk 166" in the filtered list, with no way of asking KStars to query Sesame for "Shk 16". To allow for this, this commit adds a new button that enables internet search when the list has results, but an exact match has not been found. If an exact match exists in KStars, the button is grayed out to prevent multiple copies of the same object from forming. If no search text is available, once again the button is grayed out. The default action of hitting Enter is still as before. The button only appears if the resolution option is selected in the configuration dialog. The checkbox in the config dialog is still useful as this can be "messy" for some users who don't want to pollute their sky map with a bunch of wrong search results. CCMAIL: afedoskin3@gmail.com, kstars-devel@kde.org GUI:
-rw-r--r--kstars/dialogs/finddialog.cpp14
-rw-r--r--kstars/dialogs/finddialog.h5
-rw-r--r--kstars/dialogs/finddialog.ui7
3 files changed, 25 insertions, 1 deletions
diff --git a/kstars/dialogs/finddialog.cpp b/kstars/dialogs/finddialog.cpp
index 84a9d85..0e3fe4c 100644
--- a/kstars/dialogs/finddialog.cpp
+++ b/kstars/dialogs/finddialog.cpp
@@ -77,6 +77,10 @@ FindDialog::FindDialog( QWidget* parent ) :
buttonBox->addButton(detailB, QDialogButtonBox::ActionRole);
connect(detailB, SIGNAL(clicked()), this, SLOT(slotDetails()));
+ ui->InternetSearchButton->setVisible( Options::resolveNamesOnline() );
+ ui->InternetSearchButton->setEnabled( false );
+ connect( ui->InternetSearchButton, SIGNAL( clicked() ), this, SLOT( slotResolve() ) );
+
ui->FilterType->setCurrentIndex(0); // show all types of objects
fModel = new QStringListModel( this );
@@ -226,10 +230,11 @@ void FindDialog::filterByType() {
}
}
-void FindDialog::filterList() {
+void FindDialog::filterList() {
QString SearchText;
SearchText = processSearchText();
sortModel->setFilterFixedString( SearchText );
+ ui->InternetSearchButton->setText( i18n( "or search the internet for %1", SearchText ) );
filterByType();
initSelection();
@@ -250,7 +255,10 @@ void FindDialog::filterList() {
okB->setEnabled(true);
}
}
+ ui->InternetSearchButton->setEnabled( ! mItems.contains( SearchText ) ); // Disable searching the internet when an exact match for SearchText exists in KStars
}
+ else
+ ui->InternetSearchButton->setEnabled( false );
listFiltered = true;
}
@@ -324,6 +332,10 @@ void FindDialog::slotOk() {
finishProcessing( selObj, Options::resolveNamesOnline() );
}
+void FindDialog::slotResolve() {
+ finishProcessing( 0, true );
+}
+
void FindDialog::finishProcessing( SkyObject *selObj, bool resolve ) {
if( ! selObj && resolve ) {
CatalogEntryData cedata;
diff --git a/kstars/dialogs/finddialog.h b/kstars/dialogs/finddialog.h
index 87cd141..35e60a9 100644
--- a/kstars/dialogs/finddialog.h
+++ b/kstars/dialogs/finddialog.h
@@ -76,6 +76,11 @@ public slots:
*/
void slotOk();
+ /**
+ * @short This slot resolves the object on the internet, ignoring the selection on the list
+ */
+ void slotResolve();
+
private slots:
/** Init object list after opening dialog. */
void init();
diff --git a/kstars/dialogs/finddialog.ui b/kstars/dialogs/finddialog.ui
index 957f691..ea0dbbe 100644
--- a/kstars/dialogs/finddialog.ui
+++ b/kstars/dialogs/finddialog.ui
@@ -64,6 +64,13 @@
<item>
<widget class="QListView" name="SearchList"/>
</item>
+ <item>
+ <widget class="QPushButton" name="InternetSearchButton">
+ <property name="text">
+ <string>or search internet for (nothing)</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>