aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/locationinformation.cpp23
-rw-r--r--desktop-widgets/locationinformation.h3
2 files changed, 4 insertions, 22 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp
index 1c8c79aef..4dce409db 100644
--- a/desktop-widgets/locationinformation.cpp
+++ b/desktop-widgets/locationinformation.cpp
@@ -364,7 +364,6 @@ DiveLocationLineEdit::DiveLocationLineEdit(QWidget *parent) : QLineEdit(parent),
proxy(new DiveLocationFilterProxyModel()),
model(new DiveLocationModel()),
view(new DiveLocationListView()),
- currType(NO_DIVE_SITE),
currDs(nullptr)
{
proxy->setSourceModel(model);
@@ -443,13 +442,8 @@ void DiveLocationLineEdit::itemActivated(const QModelIndex &index)
idx = index.model()->index(index.row(), LocationInformationModel::NAME);
dive_site *ds = index.model()->index(index.row(), LocationInformationModel::DIVESITE).data().value<dive_site *>();
- currType = ds == RECENTLY_ADDED_DIVESITE ? NEW_DIVE_SITE : EXISTING_DIVE_SITE;
currDs = ds;
setText(idx.data().toString());
- if (currType == NEW_DIVE_SITE)
- qDebug() << "Setting a New dive site";
- else
- qDebug() << "Setting a Existing dive site";
if (view->isVisible())
view->hide();
emit diveSiteSelected();
@@ -509,12 +503,10 @@ void DiveLocationLineEdit::keyPressEvent(QKeyEvent *ev)
ev->key() != Qt::Key_Escape &&
ev->key() != Qt::Key_Return) {
- if (ev->key() != Qt::Key_Up && ev->key() != Qt::Key_Down) {
- currType = NEW_DIVE_SITE;
+ if (ev->key() != Qt::Key_Up && ev->key() != Qt::Key_Down)
currDs = RECENTLY_ADDED_DIVESITE;
- } else {
+ else
showPopup();
- }
} else if (ev->key() == Qt::Key_Escape) {
view->hide();
}
@@ -561,12 +553,10 @@ void DiveLocationLineEdit::setCurrentDiveSite(struct dive *d)
{
struct dive_site *ds = get_dive_site_for_dive(d);
currDs = ds;
- if (!currDs) {
- currType = NO_DIVE_SITE;
+ if (!currDs)
clear();
- } else {
+ else
setText(ds->name);
- }
location_t currentLocation = d ? dive_get_gps_location(d) : location_t{0, 0};
proxy->setCurrentLocation(currentLocation);
@@ -593,11 +583,6 @@ void DiveLocationLineEdit::showAllSites()
}
}
-DiveLocationLineEdit::DiveSiteType DiveLocationLineEdit::currDiveSiteType() const
-{
- return currType;
-}
-
struct dive_site *DiveLocationLineEdit::currDiveSite() const
{
// If there is no text, this corresponds to the empty dive site
diff --git a/desktop-widgets/locationinformation.h b/desktop-widgets/locationinformation.h
index 31a8194d8..b6122d2fe 100644
--- a/desktop-widgets/locationinformation.h
+++ b/desktop-widgets/locationinformation.h
@@ -83,13 +83,11 @@ signals:
class DiveLocationLineEdit : public QLineEdit {
Q_OBJECT
public:
- enum DiveSiteType { NO_DIVE_SITE, NEW_DIVE_SITE, EXISTING_DIVE_SITE };
DiveLocationLineEdit(QWidget *parent =0 );
void refreshDiveSiteCache();
void setTemporaryDiveSiteName(const QString& s);
bool eventFilter(QObject*, QEvent*);
void itemActivated(const QModelIndex& index);
- DiveSiteType currDiveSiteType() const;
struct dive_site *currDiveSite() const;
void fixPopupPosition();
void setCurrentDiveSite(struct dive *d);
@@ -111,7 +109,6 @@ private:
DiveLocationModel *model;
DiveLocationListView *view;
LocationFilterDelegate delegate;
- DiveSiteType currType;
struct dive_site *currDs;
};