本文整理汇总了C++中Todo::isReadOnly方法的典型用法代码示例。如果您正苦于以下问题:C++ Todo::isReadOnly方法的具体用法?C++ Todo::isReadOnly怎么用?C++ Todo::isReadOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Todo
的用法示例。
在下文中一共展示了Todo::isReadOnly方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setNewDate
void KOTodoView::setNewDate( QDate date )
{
if ( !mActiveItem || !mChanger ) return;
Todo *todo = mActiveItem->todo();
if ( !todo ) return;
if ( !todo->isReadOnly() && mChanger->beginChange( todo ) ) {
Todo *oldTodo = todo->clone();
QDateTime dt;
dt.setDate( date );
if ( !todo->doesFloat() )
dt.setTime( todo->dtDue().time() );
if ( date.isNull() )
todo->setHasDueDate( false );
else if ( !todo->hasDueDate() )
todo->setHasDueDate( true );
todo->setDtDue( dt );
mActiveItem->construct();
mChanger->changeIncidence( oldTodo, todo, KOGlobals::COMPLETION_MODIFIED );
mChanger->endChange( todo );
delete oldTodo;
} else {
kdDebug(5850) << "No active item, active item is read-only, or locking failed" << endl;
}
}
示例2: setNewPriority
void KOTodoView::setNewPriority(int index)
{
if ( !mActiveItem || !mChanger ) return;
Todo *todo = mActiveItem->todo();
if ( !todo->isReadOnly () &&
mChanger->beginChange( todo ) ) {
Todo *oldTodo = todo->clone();
todo->setPriority(mPriority[index]);
mActiveItem->construct();
mChanger->changeIncidence( oldTodo, todo, KOGlobals::PRIORITY_MODIFIED );
mChanger->endChange( todo );
delete oldTodo;
}
}
示例3: 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;
}
}
示例4: changedCategories
void KOTodoView::changedCategories(int index)
{
if ( !mActiveItem || !mChanger ) return;
Todo *todo = mActiveItem->todo();
if ( !todo ) return;
if ( !todo->isReadOnly() && mChanger->beginChange( todo ) ) {
Todo *oldTodo = todo->clone();
QStringList categories = todo->categories ();
if ( categories.find( mCategory[index] ) != categories.end() )
categories.remove( mCategory[index] );
else
categories.insert( categories.end(), mCategory[index] );
categories.sort();
todo->setCategories( categories );
mActiveItem->construct();
mChanger->changeIncidence( oldTodo, todo, KOGlobals::CATEGORY_MODIFIED );
mChanger->endChange( todo );
delete oldTodo;
} else {
kdDebug(5850) << "No active item, active item is read-only, or locking failed" << endl;
}
}