本文整理汇总了C++中Todo::relatedTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Todo::relatedTo方法的具体用法?C++ Todo::relatedTo怎么用?C++ Todo::relatedTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Todo
的用法示例。
在下文中一共展示了Todo::relatedTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: changeIncidenceDisplay
void KOTodoView::changeIncidenceDisplay(Incidence *incidence, int action)
{
// The todo view only displays todos, so exit on all other incidences
if ( incidence->type() != "Todo" )
return;
CalFilter *filter = calendar()->filter();
bool isFiltered = filter && !filter->filterIncidence( incidence );
Todo *todo = static_cast<Todo *>(incidence);
if ( todo ) {
KOTodoViewItem *todoItem = 0;
if ( mTodoMap.contains( todo ) ) {
todoItem = mTodoMap[todo];
}
switch ( action ) {
case KOGlobals::INCIDENCEADDED:
case KOGlobals::INCIDENCEEDITED:
// If it's already there, edit it, otherwise just add
if ( todoItem ) {
if ( isFiltered ) {
scheduleRemoveTodoItem( todoItem );
} else {
// correctly update changes in relations
Todo*parent = dynamic_cast<Todo*>( todo->relatedTo() );
KOTodoViewItem*parentItem = 0;
if ( parent && mTodoMap.contains(parent) ) {
parentItem = mTodoMap[ parent ];
}
if ( todoItem->parent() != parentItem ) {
// The relations changed
if ( parentItem ) {
parentItem->insertItem( todoItem );
} else {
mTodoListView->insertItem( todoItem );
}
}
todoItem->construct();
}
} else {
if ( !isFiltered ) {
insertTodoItem( todo );
}
}
mTodoListView->sort();
break;
case KOGlobals::INCIDENCEDELETED:
if ( todoItem ) {
scheduleRemoveTodoItem( todoItem );
}
break;
default:
QTimer::singleShot( 0, this, SLOT( updateView() ) );
}
} else {
// use a QTimer here, because when marking todos finished using
// the checkbox, this slot gets called, but we cannot update the views
// because we're still inside KOTodoViewItem::stateChange
QTimer::singleShot(0,this,SLOT(updateView()));
}
}
示例2: createTodoList
void HtmlExport::createTodoList ( QTextStream *ts )
{
Todo::List rawTodoList = mCalendar->todos();
Todo::List::Iterator it = rawTodoList.begin();
while ( it != rawTodoList.end() ) {
Todo *ev = *it;
Todo *subev = ev;
if ( ev->relatedTo() ) {
if ( ev->relatedTo()->type()=="Todo" ) {
if ( rawTodoList.find( static_cast<Todo *>( ev->relatedTo() ) ) ==
rawTodoList.end() ) {
rawTodoList.append( static_cast<Todo *>( ev->relatedTo() ) );
}
}
}
it = rawTodoList.find( subev );
++it;
}
// FIXME: Sort list by priorities. This is brute force and should be
// replaced by a real sorting algorithm.
Todo::List todoList;
for ( int i = 1; i <= 9; ++i ) {
for( it = rawTodoList.begin(); it != rawTodoList.end(); ++it ) {
if ( (*it)->priority() == i && checkSecrecy( *it ) ) {
todoList.append( *it );
}
}
}
for( it = rawTodoList.begin(); it != rawTodoList.end(); ++it ) {
if ( (*it)->priority() == 0 && checkSecrecy( *it ) ) {
todoList.append( *it );
}
}
int columns = 3;
*ts << "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">\n";
*ts << " <tr>\n";
*ts << " <th class=\"sum\">" << i18n("Task") << "</th>\n";
*ts << " <th>" << i18n("Priority") << "</th>\n";
*ts << " <th>" << i18n("Completed") << "</th>\n";
if ( mSettings->taskDueDate() ) {
*ts << " <th>" << i18n("Due Date") << "</th>\n";
++columns;
}
if ( mSettings->taskLocation() ) {
*ts << " <th>" << i18n("Location") << "</th>\n";
++columns;
}
if ( mSettings->taskCategories() ) {
*ts << " <th>" << i18n("Categories") << "</th>\n";
++columns;
}
if ( mSettings->taskAttendees() ) {
*ts << " <th>" << i18n("Attendees") << "</th>\n";
++columns;
}
*ts << " </tr>\n";
// Create top-level list.
for( it = todoList.begin(); it != todoList.end(); ++it ) {
if ( !(*it)->relatedTo() ) createTodo( ts, *it );
}
// Create sub-level lists
for( it = todoList.begin(); it != todoList.end(); ++it ) {
Incidence::List relations = (*it)->relations();
if (relations.count()) {
// Generate sub-task list of event ev
*ts << " <tr>\n";
*ts << " <td class=\"subhead\" colspan=";
*ts << "\"" << QString::number(columns) << "\"";
*ts << "><a name=\"sub" << (*it)->uid() << "\"></a>"
<< i18n("Sub-Tasks of: ") << "<a href=\"#"
<< (*it)->uid() << "\"><b>" << cleanChars( (*it)->summary())
<< "</b></a></td>\n";
*ts << " </tr>\n";
Todo::List sortedList;
// FIXME: Sort list by priorities. This is brute force and should be
// replaced by a real sorting algorithm.
for ( int i = 1; i <= 9; ++i ) {
Incidence::List::ConstIterator it2;
for( it2 = relations.begin(); it2 != relations.end(); ++it2 ) {
Todo *ev3 = dynamic_cast<Todo *>( *it2 );
if ( ev3 && ev3->priority() == i ) sortedList.append( ev3 );
}
}
Incidence::List::ConstIterator it2;
for( it2 = relations.begin(); it2 != relations.end(); ++it2 ) {
Todo *ev3 = dynamic_cast<Todo *>( *it2 );
if ( ev3 && ev3->priority() == 0 ) sortedList.append( ev3 );
}
Todo::List::ConstIterator it3;
for( it3 = sortedList.begin(); it3 != sortedList.end(); ++it3 ) {
createTodo( ts, *it3 );
}
}
//.........这里部分代码省略.........