Exemplo n.º 1
0
QString KNotesApp::newNote( const QString& name, const QString& text )
{
    // create the new note
    KCal::Journal *journal = new KCal::Journal();

    // new notes have the current date/time as title if none was given
    if ( !name.isEmpty() )
        journal->setSummary( name );
    else
        journal->setSummary( KGlobal::locale()->formatDateTime( QDateTime::currentDateTime() ) );

    // the body of the note
    journal->setDescription( text );

    m_manager->addNewNote( journal );

    showNote( journal->uid() );

    return journal->uid();
}
Exemplo n.º 2
0
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;
}