bool QLandmarkFileHandlerLmx::writeMediaLink(const QLandmark &landmark) { //only write out URIs which are absolute in accordance the specification //for lmx 1.0 if (isURIAbsolute(landmark.url().toString())) { m_writer->writeStartElement(m_ns, "mediaLink"); m_writer->writeTextElement(m_ns, "url", landmark.url().toString()); m_writer->writeEndElement(); } return true; }
bool QLandmarkFileHandlerLmx::writeLandmark(const QLandmark &landmark) { m_writer->writeStartElement(m_ns, "landmark"); if (!landmark.name().isEmpty()) m_writer->writeTextElement(m_ns, "name", landmark.name()); if (!landmark.description().isEmpty()) m_writer->writeTextElement(m_ns, "description", landmark.description()); if (landmark.coordinate().isValid()) if (!writeCoordinates(landmark)) return false; if (landmark.radius() > 0) m_writer->writeTextElement(m_ns, "coverageRadius", QString::number(landmark.radius())); if (!writeAddressInfo(landmark)) return false; if (!landmark.url().isEmpty()) if (!writeMediaLink(landmark)) return false; if (m_option != QLandmarkManager::ExcludeCategoryData) { for (int i = 0; i < landmark.categoryIds().size(); ++i) { if (!writeCategory(landmark.categoryIds().at(i))) return false; } } m_writer->writeEndElement(); return true; }
bool QLandmarkFileHandlerLmx::writeMediaLink(const QLandmark &landmark) { m_writer->writeStartElement(m_ns, "mediaLink"); m_writer->writeTextElement(m_ns, "url", landmark.url().toString()); m_writer->writeEndElement(); return true; }
// Initializes this landmark from the given landmark void QDeclarativeLandmark::setLandmark(const QLandmark& landmark) { // Elaborate but makes sure appropriate signals are sent // (this function is called when landmark updates). setPlace(landmark); // viewport, address, coordinate etc. setName(landmark.name()); setPhoneNumber(landmark.phoneNumber()); setDescription(landmark.description()); setRadius(landmark.radius()); setIconSource(landmark.iconUrl()); setUrl(landmark.url()); m_landmark = landmark; }
LandmarkAddDialog::LandmarkAddDialog(QWidget *parent, Qt::WindowFlags flags, const QLandmark &landmark) : QDialog(parent, flags) { setupUi(this); if (landmark != QLandmark()) { setWindowTitle("Edit Landmark"); lm = landmark; nameLineEdit->setText(landmark.name()); latitudeLineEdit->setText(QString::number(landmark.coordinate().latitude())); longitudeLineEdit->setText(QString::number(landmark.coordinate().longitude())); streetLineEdit->setText(landmark.address().street()); districtLineEdit->setText(landmark.address().district()); cityLineEdit->setText(landmark.address().city()); countyLineEdit->setText(landmark.address().county()); stateLineEdit->setText(landmark.address().state()); countryLineEdit->setText(landmark.address().country()); descriptionLineEdit->setText(landmark.description()); iconUrlLineEdit->setText(landmark.iconUrl().toString()); urlLineEdit->setText(landmark.url().toString()); phoneLineEdit->setText(landmark.phoneNumber()); radiusLineEdit->setText(QString::number(landmark.radius())); } else { setWindowTitle("Add Landmark"); } QLandmarkManager manager; QList<QLandmarkCategory> categories = manager.categories(); foreach( QLandmarkCategory category, categories) { QListWidgetItem *categoryItem = new QListWidgetItem(categoryList,QListWidgetItem::UserType + 1); categoryItem->setData(Qt::DisplayRole,category.name()); QVariant var; var.setValue(category.categoryId()); categoryItem->setData(Qt::UserRole, var); categoryItem->setFlags(Qt::ItemIsEnabled); if (landmark.categoryIds().contains(category.categoryId())) categoryItem->setCheckState(Qt::Checked); else categoryItem->setCheckState(Qt::Unchecked); }