KCal::Journal *APIBlog::journalFromPosting(KBlog::BlogPosting *blog) { if(!blog) return 0; KCal::Journal *j = new KCal::Journal(); QDateTime dt = blog->dateTime(); QDateTime creationDt = blog->creationDateTime(); QDateTime modificationDt = blog->modificationDateTime(); kdDebug() << "dt =" << dt.toString(Qt::ISODate) << endl; kdDebug() << "creationDt =" << creationDt.toString(Qt::ISODate) << endl; kdDebug() << "modificationDt=" << modificationDt.toString(Qt::ISODate) << endl; if(dt.isValid() && !dt.isNull()) { j->setDtStart(dt); } else if(creationDt.isValid() && !creationDt.isNull()) { j->setDtStart(creationDt); } else if(modificationDt.isValid() && !modificationDt.isNull()) { j->setDtStart(modificationDt); } j->setCreated(blog->creationDateTime()); j->setLastModified(blog->modificationDateTime()); j->setFloats(false); kdDebug() << "Date for blog " << blog->title() << " is " << blog->dateTime().toString() << endl; j->setSummary(blog->title()); j->setDescription(blog->content()); j->setCategories(QStringList(blog->category())); j->setOrganizer(blog->userID()); j->setCustomProperty("KCalBloggerRes", "UserID", blog->userID()); j->setCustomProperty("KCalBloggerRes", "BlogID", blog->blogID()); j->setCustomProperty("KCalBloggerRes", "PostID", blog->postID()); // TODO: Set the read-only flag in the resource! // j->setReadOnly( readOnly() ); return j; }