diff options
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/locationinformation.cpp | 14 | ||||
-rw-r--r-- | desktop-widgets/locationinformation.h | 1 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.cpp | 5 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.h | 1 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.ui | 7 |
5 files changed, 28 insertions, 0 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index 9f61459b6..dbbe9bf75 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -579,6 +579,20 @@ void DiveLocationLineEdit::showPopup() setTemporaryDiveSiteName(text()); } +void DiveLocationLineEdit::showAllSites() +{ + if (!view->isVisible()) { + // By setting the "temporary dive site name" to the empty string, + // all dive sites are shown sorted by distance from the site of + // the current dive. + setTemporaryDiveSiteName(QString()); + + // By selecting the whole text, the user can immediately start + // typing to activate the full-text filter. + selectAll(); + } +} + DiveLocationLineEdit::DiveSiteType DiveLocationLineEdit::currDiveSiteType() const { return currType; diff --git a/desktop-widgets/locationinformation.h b/desktop-widgets/locationinformation.h index 0f7470af6..31a8194d8 100644 --- a/desktop-widgets/locationinformation.h +++ b/desktop-widgets/locationinformation.h @@ -93,6 +93,7 @@ public: struct dive_site *currDiveSite() const; void fixPopupPosition(); void setCurrentDiveSite(struct dive *d); + void showAllSites(); signals: void diveSiteSelected(); diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index e70e79ce2..af1928e2d 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -829,6 +829,11 @@ void MainTab::on_location_diveSiteSelected() Command::editDiveSite(newDs, false); } +void MainTab::on_locationPopupButton_clicked() +{ + ui.location->showAllSites(); +} + void MainTab::on_diveTripLocation_editingFinished() { if (!currentTrip) diff --git a/desktop-widgets/tab-widgets/maintab.h b/desktop-widgets/tab-widgets/maintab.h index cdb761afd..351449cd7 100644 --- a/desktop-widgets/tab-widgets/maintab.h +++ b/desktop-widgets/tab-widgets/maintab.h @@ -57,6 +57,7 @@ slots: void acceptChanges(); void rejectChanges(); void on_location_diveSiteSelected(); + void on_locationPopupButton_clicked(); void on_divemaster_editingFinished(); void on_buddy_editingFinished(); void on_suit_editingFinished(); diff --git a/desktop-widgets/tab-widgets/maintab.ui b/desktop-widgets/tab-widgets/maintab.ui index 24d21fece..ee0e66b1e 100644 --- a/desktop-widgets/tab-widgets/maintab.ui +++ b/desktop-widgets/tab-widgets/maintab.ui @@ -217,6 +217,13 @@ <widget class="DiveLocationLineEdit" name="location"/> </item> <item> + <widget class="QToolButton" name="locationPopupButton"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item> <widget class="QToolButton" name="editDiveSiteButton"> <property name="toolTip"> <string>Edit dive site</string> |