本文整理汇总了C++中KDateTime::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ KDateTime::isNull方法的具体用法?C++ KDateTime::isNull怎么用?C++ KDateTime::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDateTime
的用法示例。
在下文中一共展示了KDateTime::isNull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refresh
void NemoCalendarEventQuery::refresh()
{
if (!mIsComplete)
return;
mKCal::ExtendedCalendar::Ptr calendar = NemoCalendarDb::calendar();
KCalCore::Event::Ptr event = mUid.isEmpty()?KCalCore::Event::Ptr():calendar->event(mUid);
if (event) {
if (mOccurrence) {
delete mOccurrence;
mOccurrence = 0;
}
mKCal::ExtendedCalendar::ExpandedIncidenceValidity eiv = {
event->dtStart().toLocalZone().dateTime(),
event->dtEnd().toLocalZone().dateTime()
};
if (!mStartTime.isNull() && event->recurs()) {
KDateTime startTime = KDateTime(mStartTime, KDateTime::Spec(KDateTime::LocalZone));
KCalCore::Recurrence *recurrence = event->recurrence();
if (recurrence->recursAt(startTime)) {
eiv.dtStart = startTime.toLocalZone().dateTime();
eiv.dtEnd = KCalCore::Duration(event->dtStart(), event->dtEnd()).end(startTime).toLocalZone().dateTime();
} else {
KDateTime match = recurrence->getNextDateTime(startTime);
if (match.isNull())
match = recurrence->getPreviousDateTime(startTime);
if (!match.isNull()) {
eiv.dtStart = match.toLocalZone().dateTime();
eiv.dtEnd = KCalCore::Duration(event->dtStart(), event->dtEnd()).end(match).toLocalZone().dateTime();
}
}
}
mOccurrence = new NemoCalendarEventOccurrence(qMakePair(eiv, event.dynamicCast<KCalCore::Incidence>()),
this);
emit occurrenceChanged();
emit eventChanged();
} else {
if (mOccurrence) {
delete mOccurrence;
mOccurrence = 0;
emit occurrenceChanged();
emit eventChanged();
}
}
}
示例2: getDateString
QString DateStringBuilder::getDateString(const KDateTime &dateTime, bool grouped)
{
if (!dateTime.isValid() || dateTime.isNull()) {
return QString();
}
QString day;
if (QDateTime().currentDateTime().date() == dateTime.date()) {
day = i18nc( "today", "Today" );
}
if (QDateTime().currentDateTime().date().addDays(1) == dateTime.date()) {
day = i18nc( "tomorrow", "Tomorrow" );
}
if (QDateTime().currentDateTime().date() == dateTime.date().addDays(1)) {
day = i18nc( "yesterday", "Yesterday" );
}
if (!grouped && !day.isEmpty()) {
return day.append("/t").append(dateTime.toString("%d.%m.%Y"));
}
if (!grouped && day.isEmpty()) {
return dateTime.toString("%:a %d.%m.%Y");
}
if (QDateTime().currentDateTime().date().weekNumber() == dateTime.date().weekNumber()) {
return dateTime.toString("%A");
}
//TODO last week
return dateTime.toString("%B");
//KGlobal::locale()->formatDate(pimitem->getPrimaryDate().dateTime());
//return pimitem->getPrimaryDate().dateTime().toString("ddd dd.MM hh:mm");
//return dateTime.toString("%:a %d.%m.%Y");
}
示例3: getFullDateTime
QString DateStringBuilder::getFullDateTime(const KDateTime &dateTime)
{
if (!dateTime.isValid() || dateTime.isNull()) {
return QString();
}
QString date;
date.append(getFullDate(dateTime));
date.append(" ");
date.append(dateTime.toString("%k:%M:%S"));
return date;
}
示例4: listRecentPosts
void GData::listRecentPosts( const QStringList &labels, int number,
const KDateTime &upMinTime, const KDateTime &upMaxTime,
const KDateTime &pubMinTime, const KDateTime &pubMaxTime )
{
kDebug();
Q_D( GData );
QString urlString( "http://www.blogger.com/feeds/" + blogId() + "/posts/default" );
if ( ! labels.empty() ) {
urlString += "/-/" + labels.join( "/" );
}
kDebug() << "listRecentPosts()";
KUrl url( urlString );
if ( !upMinTime.isNull() ) {
url.addQueryItem( "updated-min", upMinTime.toString() );
}
if( !upMaxTime.isNull() ) {
url.addQueryItem( "updated-max", upMaxTime.toString() );
}
if( !pubMinTime.isNull() ) {
url.addQueryItem( "published-min", pubMinTime.toString() );
}
if( !pubMaxTime.isNull() ) {
url.addQueryItem( "published-max", pubMaxTime.toString() );
}
Syndication::Loader *loader = Syndication::Loader::create();
if ( number > 0 ) {
d->mListRecentPostsMap[ loader ] = number;
}
connect( loader,
SIGNAL(loadingComplete(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)),
this,
SLOT(slotListRecentPosts(Syndication::Loader*,Syndication::FeedPtr,Syndication::ErrorCode)) );
loader->loadFrom( url.url() );
}
示例5: getGroupedDate
QString DateStringBuilder::getGroupedDate(const KDateTime &dateTime)
{
if (!dateTime.isValid() || dateTime.isNull()) {
return QString();
}
QDate currentDate = QDateTime::currentDateTime().date();
if (currentDate.weekNumber() == dateTime.date().weekNumber()) { //this week
return getDayName(dateTime);
}
if (currentDate.addDays(-7).weekNumber() == dateTime.date().weekNumber()) { //last week
return i18n("Last Week");
}
if (currentDate.year() == dateTime.date().year()) { //this year
return dateTime.toString("%B");
}
return dateTime.toString("%B %Y");
}
示例6: getDayName
QString getDayName(const KDateTime &dateTime)
{
if (!dateTime.isValid() || dateTime.isNull()) {
return QString();
}
QString day;
if (QDateTime().currentDateTime().date() == dateTime.date()) {
return i18n("Today" );
}
if (QDateTime().currentDateTime().date().addDays(1) == dateTime.date()) {
return i18n( "Tomorrow" );
}
if (QDateTime().currentDateTime().date() == dateTime.date().addDays(1)) {
return i18n("Yesterday" );
}
return dateTime.toString("%A");
}
示例7: getShortDate
QString DateStringBuilder::getShortDate(const KDateTime &dateTime)
{
if (!dateTime.isValid() || dateTime.isNull()) {
return QString();
}
QDate currentDate = QDateTime().currentDateTime().date();
if (currentDate.weekNumber() == dateTime.date().weekNumber() || currentDate.addDays(1) == dateTime.date()) { //this week or tomorrow (i.e. on sunday)
return getDayName(dateTime);
}
if (currentDate.year() == dateTime.date().year()) { //this year
//Micro optimization because this function showed up as hotspot
static QCache<uint, QString> cache;
uint hash = dateTime.date().month() ^ dateTime.date().day();
if (!cache.contains(hash)) {
cache.insert(hash, new QString(dateTime.toString("%d.%m")));
}
return *cache[hash];
}
return dateTime.toString("%d.%m.%Y");
}