diff options
-rw-r--r-- | qt-mobile/qml/main.qml | 4 | ||||
-rw-r--r-- | qt-mobile/qmlmanager.cpp | 4 | ||||
-rw-r--r-- | qt-mobile/qmlmanager.h | 2 | ||||
-rw-r--r-- | qt-models/divelistmodel.cpp | 3 | ||||
-rw-r--r-- | qt-models/divelistmodel.h | 2 |
5 files changed, 9 insertions, 6 deletions
diff --git a/qt-mobile/qml/main.qml b/qt-mobile/qml/main.qml index eadd220a3..703f4d17f 100644 --- a/qt-mobile/qml/main.qml +++ b/qt-mobile/qml/main.qml @@ -49,8 +49,10 @@ MobileComponents.ApplicationWindow { Action { text: "Add dive manually" onTriggered: { - manager.addDive(); detailsWindow.state = "edit" + detailsWindow.dive_id = manager.addDive(); + detailsWindow.number = manager.getNumber(detailsWindow.dive_id) + detailsWindow.date = manager.getDate(detailsWindow.dive_id) stackView.push(detailsWindow) } } diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index 3a62fb342..cdf844492 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -336,10 +336,10 @@ void QMLManager::saveChanges() mark_divelist_changed(false); } -void QMLManager::addDive() +QString QMLManager::addDive() { appendTextToLog("Adding new dive."); - DiveListModel::instance()->startAddDive(); + return DiveListModel::instance()->startAddDive(); } void QMLManager::applyGpsData() diff --git a/qt-mobile/qmlmanager.h b/qt-mobile/qmlmanager.h index be37f5a74..23b6bd41f 100644 --- a/qt-mobile/qmlmanager.h +++ b/qt-mobile/qmlmanager.h @@ -73,7 +73,7 @@ public slots: void provideAuth(QNetworkReply *reply, QAuthenticator *auth); void commitChanges(QString diveId, QString suit, QString buddy, QString diveMaster, QString notes); void saveChanges(); - void addDive(); + QString addDive(); void applyGpsData(); void sendGpsData(); void clearGpsData(); diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index fcdc0dfab..56205e26a 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -120,7 +120,7 @@ QHash<int, QByteArray> DiveListModel::roleNames() const } // create a new dive. set the current time and add it to the end of the dive list -void DiveListModel::startAddDive() +QString DiveListModel::startAddDive() { struct dive *d; d = alloc_dive(); @@ -132,6 +132,7 @@ void DiveListModel::startAddDive() d->number = nr; add_single_dive(-1, d); addDive(d); + return QString::number(d->id); } DiveListModel *DiveListModel::instance() diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h index b75a0f182..f050faab3 100644 --- a/qt-models/divelistmodel.h +++ b/qt-models/divelistmodel.h @@ -41,7 +41,7 @@ public: int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QHash<int, QByteArray> roleNames() const; - void startAddDive(); + QString startAddDive(); private: QList<Dive> m_dives; static DiveListModel *m_instance; |