bool KTimeZones::add(const KTimeZone &zone) { if (!zone.isValid()) return false; if (d->zones.find(zone.name()) != d->zones.end()) return false; // name already exists d->zones.insert(zone.name(), zone); return true; }
void TimeZoneCombo::setTimeZone(const KTimeZone& tz) { if (!tz.isValid()) return; int index = mZoneNames.indexOf(tz.name()); if (index >= 0) setCurrentIndex(index); }
QDateTime CityWeather::fromLocalTime(const QDateTime & dateTime) const { KTimeZone local = KSystemTimeZones::local(); if( m_timeZone.isValid() && local.name() != m_timeZone.name() ) return m_timeZone.convert(local, dateTime); return dateTime; }
void KoRdfCalendarEvent::updateFromEditorData() { QString predBase = "http://www.w3.org/2002/12/cal/icaltzd#"; if (!m_linkSubject.isValid()) { m_linkSubject = createNewUUIDNode(); } if (m_uid.size() <= 0) { m_uid = QUuid::createUuid().toString(); } kDebug(30015) << "KoRdfCalendarEvent::updateFromEditorData()"; kDebug(30015) << "context:" << context().toString(); kDebug(30015) << "Old summary:" << m_summary; kDebug(30015) << "New summary:" << editWidget.summary->text(); setRdfType(predBase + "Vevent"); updateTriple(m_summary, editWidget.summary->text(), predBase + "summary"); updateTriple(m_location, editWidget.location->text(), predBase + "location"); updateTriple(m_uid, m_uid, predBase + "uid"); KDateTime::Spec startTimespec = KSystemTimeZones::local(); QStringList selection = editWidget.tz->selection(); if (selection.size() > 0) { QString tzString = selection[0]; kDebug(30015) << "explicit time zone selected... tzString:" << tzString; KTimeZone ktz = KSystemTimeZones::zone(tzString); startTimespec = KDateTime::Spec(ktz); kDebug(30015) << "explicit time zone selected...startTimespec:" << ktz.name(); } KDateTime::Spec endTimespec = startTimespec; m_startTimespec = startTimespec; m_endTimespec = endTimespec; KDateTime dtstart(editWidget.startDate->date(), editWidget.startTime->time(), m_startTimespec); KDateTime dtend(editWidget.endDate->date(), editWidget.endTime->time(), m_endTimespec); kDebug(30015) << "m_startTimespec.offset:" << m_startTimespec.timeZone().currentOffset(); kDebug(30015) << "date:" << editWidget.startDate->date(); kDebug(30015) << "time:" << editWidget.startTime->time().toString(); kDebug(30015) << "dtstart:" << dtstart.toString(); kDebug(30015) << "qdtstart:" << dtstart.dateTime(); LiteralValue lv(dtstart.dateTime()); Node n = Node::createLiteralNode(lv); kDebug(30015) << "soprano::node:" << n.toString(); updateTriple(m_dtstart, dtstart, predBase + "dtstart"); updateTriple(m_dtend, dtend, predBase + "dtend"); if (documentRdf()) { const_cast<KoDocumentRdf*>(documentRdf())->emitSemanticObjectUpdated(hKoRdfSemanticItem(this)); } }