void AccountActionsManager::handleAccountSetLocation () { IAccount *account = GetAccountFromSender (sender (), Q_FUNC_INFO); if (!account) return; QObject *obj = account->GetQObject (); ISupportGeolocation *loc = qobject_cast<ISupportGeolocation*> (obj); if (!loc) { qWarning () << Q_FUNC_INFO << obj << "doesn't support geolocation"; return; } LocationDialog dia (MW_); if (dia.exec () != QDialog::Accepted) return; loc->SetGeolocationInfo (dia.GetInfo ()); }
void LocationEditor::buttonClicked() { LocationDialog dialog; dialog.setLongitude(this->startLongitude); dialog.setLatitude(this->startLatitude); dialog.setAltitude(this->startAltitude); dialog.exec(); double lon = dialog.getLongitude(); double lat = dialog.getLatitude(); double alt = dialog.getAltitude(); startAltitude = alt; startLongitude = lon; startLatitude = lat; if (dialog.okPressed()) { NoteTable ntable(global.db); if (lon == 0.0 && lat == 0.0) { setText(defaultText); ntable.resetGeography(currentLid, true); return; } this->setText(dialog.locationText()); ntable.setGeography(currentLid, lon,lat,alt, true); } }