当前位置: 首页>>代码示例>>C++>>正文


C++ Todo::setPercentComplete方法代码示例

本文整理汇总了C++中Todo::setPercentComplete方法的典型用法代码示例。如果您正苦于以下问题:C++ Todo::setPercentComplete方法的具体用法?C++ Todo::setPercentComplete怎么用?C++ Todo::setPercentComplete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Todo的用法示例。


在下文中一共展示了Todo::setPercentComplete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setNewPercentage

void KOTodoView::setNewPercentage( KOTodoViewItem *item, int percentage )
{
  kdDebug(5850) << "KOTodoView::setNewPercentage( " << percentage << "), item = " << item << endl;
  if ( !item || !mChanger  ) return;
  Todo *todo = item->todo();
  if ( !todo ) return;

  if ( !todo->isReadOnly () && mChanger->beginChange( todo ) ) {
    Todo *oldTodo = todo->clone();

/*  Old code to make sub-items's percentage related to this one's:
    QListViewItem *myChild = firstChild();
    KOTodoViewItem *item;
    while( myChild ) {
      item = static_cast<KOTodoViewItem*>(myChild);
      item->stateChange(state);
      myChild = myChild->nextSibling();
    }*/
    if ( percentage == 100 ) {
      todo->setCompleted( QDateTime::currentDateTime() );
      // If the todo does recur, it doesn't get set as completed. However, the
      // item is still checked. Uncheck it again.
      if ( !todo->isCompleted() ) item->setState( QCheckListItem::Off );
      else todo->setPercentComplete( percentage );
    } else {
      todo->setCompleted( false );
      todo->setPercentComplete( percentage );
    }
    item->construct();
    if ( todo->doesRecur() && percentage == 100 )
      mChanger->changeIncidence( oldTodo, todo, KOGlobals::COMPLETION_MODIFIED_WITH_RECURRENCE );
    else
      mChanger->changeIncidence( oldTodo, todo, KOGlobals::COMPLETION_MODIFIED );
    mChanger->endChange( todo );
    delete oldTodo;
  } else {
    item->construct();
    kdDebug(5850) << "No active item, active item is read-only, or locking failed" << endl;
  }
}
开发者ID:,项目名称:,代码行数:40,代码来源:

示例2: testValidity

void TodoTest::testValidity()
{
    QDate dt = QDate::currentDate();
    Todo *todo = new Todo();
    todo->setDtStart(KDateTime(dt));
    todo->setDtDue(KDateTime(dt).addDays(1));
    todo->setSummary(QStringLiteral("To-do1 Summary"));
    todo->setDescription(QStringLiteral("This is a description of the first to-do"));
    todo->setLocation(QStringLiteral("the place"));
    todo->setPercentComplete(5);
    //KDE5: QVERIFY( todo->typeStr() == i18n( "to-do" ) );
    QVERIFY(todo->summary() == QLatin1String("To-do1 Summary"));
    QVERIFY(todo->location() == QLatin1String("the place"));
    QVERIFY(todo->percentComplete() == 5);
}
开发者ID:KDE,项目名称:kcalcore,代码行数:15,代码来源:testtodo.cpp

示例3: copyTodoToDate

void KOTodoView::copyTodoToDate( QDate date )
{
  QDateTime dt( date );

  if ( mActiveItem && mChanger ) {
    Todo *newTodo = mActiveItem->todo()->clone();
    newTodo->recreate();

   newTodo->setHasDueDate( !date.isNull() );
   newTodo->setDtDue( dt );
   newTodo->setPercentComplete( 0 );

   // avoid forking
   if ( newTodo->doesRecur() )
     newTodo->recurrence()->unsetRecurs();

   mChanger->addIncidence( newTodo, this );
 }
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例4: testTodoComparison

void ComparisonVisitorTest::testTodoComparison()
{
  const QString summary = QLatin1String( "Testing comparison" );
  const QString desc    = QLatin1String( "Testing ComparisonVisitor" );

  Todo reference;
  reference.setSummary( summary );
  reference.setDescription( desc );
  reference.setPercentComplete( 50 );

  // create a copy of the reference incidence
  Todo todo( reference );

  IncidenceBase *baseReference = &reference;
  IncidenceBase *baseIncidence = &todo;

  QVERIFY( mComparator.compare( baseIncidence, baseReference ) );

  // change a property of Todo (but not of IncidenceBase)
  todo.setPercentComplete( 100 );
  QVERIFY( !mComparator.compare( baseIncidence, baseReference ) );
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:22,代码来源:testcomparisonvisitor.cpp

示例5: acceptReply


//.........这里部分代码省略.........
        }
    }

    if (ev || to) {
        //get matching attendee in calendar
        kdDebug(5800) << "Scheduler::acceptTransaction match found!" << endl;
        Attendee::List attendeesIn = incidence->attendees();
        Attendee::List attendeesEv;
        Attendee::List attendeesNew;
        if (ev) attendeesEv = ev->attendees();
        if (to) attendeesEv = to->attendees();
        Attendee::List::ConstIterator inIt;
        Attendee::List::ConstIterator evIt;
        for ( inIt = attendeesIn.begin(); inIt != attendeesIn.end(); ++inIt ) {
            Attendee *attIn = *inIt;
            bool found = false;
            for ( evIt = attendeesEv.begin(); evIt != attendeesEv.end(); ++evIt ) {
                Attendee *attEv = *evIt;
                if (attIn->email().lower()==attEv->email().lower()) {
                    //update attendee-info
                    kdDebug(5800) << "Scheduler::acceptTransaction update attendee" << endl;
                    attEv->setStatus(attIn->status());
                    attEv->setDelegate(attIn->delegate());
                    attEv->setDelegator(attIn->delegator());
                    ret = true;
                    found = true;
                }
            }
            if ( !found && attIn->status() != Attendee::Declined )
                attendeesNew.append( attIn );
        }

        bool attendeeAdded = false;
        for ( Attendee::List::ConstIterator it = attendeesNew.constBegin(); it != attendeesNew.constEnd(); ++it ) {
            Attendee* attNew = *it;
            QString msg = i18n("%1 wants to attend %2 but was not invited.").arg( attNew->fullName() )
                          .arg( ev ? ev->summary() : to->summary() );
            if ( !attNew->delegator().isEmpty() )
                msg = i18n("%1 wants to attend %2 on behalf of %3.").arg( attNew->fullName() )
                      .arg( ev ? ev->summary() : to->summary() )
                      .arg( attNew->delegator() );
            if ( KMessageBox::questionYesNo( 0, msg, i18n("Uninvited attendee"),
                                             KGuiItem(i18n("Accept Attendance")), KGuiItem(i18n("Reject Attendance")) )
                    != KMessageBox::Yes )
            {
                KCal::Incidence *cancel = dynamic_cast<Incidence*>( incidence );
                if ( cancel )
                    cancel->addComment( i18n( "The organizer rejected your attendance at this meeting." ) );
                performTransaction( cancel ? cancel : incidence, Scheduler::Cancel, attNew->fullName() );
                delete cancel;
                continue;
            }

            Attendee *a = new Attendee( attNew->name(), attNew->email(), attNew->RSVP(),
                                        attNew->status(), attNew->role(), attNew->uid() );
            a->setDelegate( attNew->delegate() );
            a->setDelegator( attNew->delegator() );
            if ( ev )
                ev->addAttendee( a );
            else if ( to )
                to->addAttendee( a );
            ret = true;
            attendeeAdded = true;
        }

        // send update about new participants
        if ( attendeeAdded ) {
            if ( ev ) {
                ev->setRevision( ev->revision() + 1 );
                performTransaction( ev, Scheduler::Request );
            }
            if ( to ) {
                to->setRevision( ev->revision() + 1 );
                performTransaction( to, Scheduler::Request );
            }
        }

        if ( ret ) {
            // We set at least one of the attendees, so the incidence changed
            // Note: This should not result in a sequence number bump
            if ( ev )
                ev->updated();
            else if ( to )
                to->updated();
        }
        if ( to ) {
            // for VTODO a REPLY can be used to update the completion status of
            // a task. see RFC2446 3.4.3
            Todo *update = dynamic_cast<Todo*> ( incidence );
            Q_ASSERT( update );
            if ( update && ( to->percentComplete() != update->percentComplete() ) ) {
                to->setPercentComplete( update->percentComplete() );
                to->updated();
            }
        }
    } else
        kdError(5800) << "No incidence for scheduling\n";
    if (ret) deleteTransaction(incidence);
    return ret;
}
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的Todo::setPercentComplete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。