本文整理汇总了C++中ITask::insertMetaAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ ITask::insertMetaAttribute方法的具体用法?C++ ITask::insertMetaAttribute怎么用?C++ ITask::insertMetaAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITask
的用法示例。
在下文中一共展示了ITask::insertMetaAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
bool LocalXmlBackend::start()
{
qsrand( QDateTime::currentDateTime().toMSecsSinceEpoch() );
QList<OpenTodoList::IAccount*> accounts = m_database->getAccounts(
OpenTodoList::IDatabase::QueryAny, 1 );
if ( accounts.isEmpty() ) {
m_account = m_database->createAccount();
m_account->setUuid( QUuid::createUuid() );
} else {
m_account = accounts.first();
}
m_account->setName( tr( "Local Todo Lists" ) );
m_database->insertAccount( m_account );
QStringList todoLists = locateTodoLists();
for ( const QString &todoListFile : todoLists ) {
fixTodoList( todoListFile );
ITodoList *todoList = m_database->createTodoList();
QDomDocument doc = documentForFile( todoListFile );
QByteArray todoListHash;
if ( domToTodoList( doc, todoList ) && todoListNeedsUpdate( todoList, todoListFile, todoListHash ) ) {
todoList->insertMetaAttribute( TodoListMetaFileName, todoListFile );
todoList->insertMetaAttribute( TodoListMetaHash, todoListHash );
todoList->setAccount( m_account->uuid() );
m_database->insertTodoList( todoList );
}
QStringList todos = locateTodos( todoListFile );
for ( const QString &todoFile : todos ) {
fixTodo( todoFile );
ITodo *todo = m_database->createTodo();
doc = documentForFile( todoFile );
QByteArray todoHash;
if ( domToTodo( doc, todo ) && todoNeedsUpdate( todo, todoFile, todoHash )) {
todo->insertMetaAttribute( TodoMetaFileName, todoFile );
todo->insertMetaAttribute( TodoMetaHash, todoHash );
todo->setTodoList( todoList->uuid() );
m_database->insertTodo( todo );
}
QStringList tasks = locateTasks( todoFile );
for ( const QString &taskFile : tasks ) {
ITask *task = m_database->createTask();
doc = documentForFile( taskFile );
QByteArray taskHash;
if ( domToTask( doc, task ) && taskNeedsUpdate( task, taskFile, taskHash ) ) {
task->insertMetaAttribute( TaskMetaFileName, taskFile );
task->insertMetaAttribute( TaskMetaHash, taskHash );
task->setTodo( todo->uuid() );
m_database->insertTask( task );
}
delete task;
}
delete todo;
}
delete todoList;
}
return true;
}