本文整理汇总了C++中Todo::isCompleted方法的典型用法代码示例。如果您正苦于以下问题:C++ Todo::isCompleted方法的具体用法?C++ Todo::isCompleted怎么用?C++ Todo::isCompleted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Todo
的用法示例。
在下文中一共展示了Todo::isCompleted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例2: updateView
void KOWhatsNextView::updateView()
{
KIconLoader kil("kdepim");
QString *ipath = new QString();
kil.loadIcon("kdepim",KIcon::NoGroup,32,KIcon::DefaultState,ipath);
mText = "<table width=\"100%\">\n";
mText += "<tr bgcolor=\"#3679AD\"><td><h1>";
mText += "<img src=\"";
mText += *ipath;
mText += "\">";
mText += "<font color=\"white\"> ";
mText += i18n("What's Next?") + "</font></h1>";
mText += "</td></tr>\n<tr><td>";
mText += "<h2>";
if ( mStartDate.daysTo( mEndDate ) < 1 ) {
mText += KGlobal::locale()->formatDate( mStartDate );
} else {
mText += i18n("Date from - to", "%1 - %2")
.arg( KGlobal::locale()->formatDate( mStartDate ) )
.arg( KGlobal::locale()->formatDate( mEndDate ) );
}
mText+="</h2>\n";
Event::List events;
for ( QDate date = mStartDate; date <= mEndDate; date = date.addDays( 1 ) )
events += calendar()->events(date, EventSortStartDate, SortDirectionAscending);
if (events.count() > 0) {
mText += "<p></p>";
kil.loadIcon("appointment",KIcon::NoGroup,22,KIcon::DefaultState,ipath);
mText += "<h2><img src=\"";
mText += *ipath;
mText += "\">";
mText += i18n("Events:") + "</h2>\n";
mText += "<table>\n";
Event::List::ConstIterator it;
for( it = events.begin(); it != events.end(); ++it ) {
Event *ev = *it;
if ( !ev->doesRecur() ){
appendEvent(ev);
} else {
// FIXME: This should actually be cleaned up. Libkcal should
// provide a method to return a list of all recurrences in a
// given time span.
Recurrence *recur = ev->recurrence();
int duration = ev->dtStart().secsTo( ev->dtEnd() );
QDateTime start = recur->getPreviousDateTime(
QDateTime( mStartDate, QTime() ) );
QDateTime end = start.addSecs( duration );
if ( end.date() >= mStartDate ) {
appendEvent( ev, start, end );
}
start = recur->getNextDateTime( start );
while ( start.isValid() && start.date() <= mEndDate ) {
appendEvent( ev, start );
start = recur->getNextDateTime( start );
}
}
}
mText += "</table>\n";
}
mTodos.clear();
Todo::List todos = calendar()->todos( TodoSortDueDate, SortDirectionAscending );
if ( todos.count() > 0 ) {
kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,ipath);
mText += "<h2><img src=\"";
mText += *ipath;
mText += "\">";
mText += i18n("To-do:") + "</h2>\n";
mText += "<ul>\n";
Todo::List::ConstIterator it;
for( it = todos.begin(); it != todos.end(); ++it ) {
Todo *todo = *it;
if ( !todo->isCompleted() && todo->hasDueDate() && todo->dtDue().date() <= mEndDate )
appendTodo(todo);
}
bool gotone = false;
int priority = 1;
while (!gotone && priority<=9 ) {
for( it = todos.begin(); it != todos.end(); ++it ) {
Todo *todo = *it;
if (!todo->isCompleted() && (todo->priority() == priority) ) {
appendTodo(todo);
gotone = true;
}
}
priority++;
kdDebug(5850) << "adding the todos..." << endl;
}
mText += "</ul>\n";
}
QStringList myEmails( KOPrefs::instance()->allEmails() );
int replies = 0;
events = calendar()->events( QDate::currentDate(), QDate(2975,12,6) );
Event::List::ConstIterator it2;
for( it2 = events.begin(); it2 != events.end(); ++it2 ) {
//.........这里部分代码省略.........