Пример #1
0
void VCalParser::read()
{
	QString tmp;
	i = m_rawData->constBegin();

	while(i != m_rawData->constEnd()) {
		i++;

		// read until the next newline
		tmp = readLine();

		if( tmp == "BEGIN:VEVENT" && !atEnd ) {
			readEvent();
		}

		if( tmp == "BEGIN:VTODO" && !atEnd ) {
			readTodo();
		}

		if( tmp == "END:VCALENDAR" || atEnd ) {
			break;
		}

		tmp.clear();
	}

	qSort(m_events);

	if(nextEvent.isValid()) {
		nextEventIndex = m_events.indexOf(nextEvent);
	} else {
		// there seems to be no valid event in the near future
		nextEventIndex = m_events.size()-1;
	}
}
Пример #2
0
void KOTodoEditor::loadTemplate(/*const*/ CalendarLocal &cal)
{
    Todo::List todos = cal.todos();
    if(todos.count() == 0)
    {
        KMessageBox::error(this,
                           i18n("Template does not contain a valid to-do."));
    }
    else
    {
        readTodo(todos.first(), 0);
    }
}
Пример #3
0
void KOTodoEditor::editIncidence(Incidence *incidence, Calendar *calendar)
{
    kdDebug(5850) << k_funcinfo << endl;
    Todo *todo = dynamic_cast<Todo *>(incidence);
    if(todo)
    {
        init();

        mTodo = todo;
        mCalendar = calendar;
        readTodo(mTodo, mCalendar);
    }

    setCaption(i18n("Edit To-do"));
}
Пример #4
0
void KOEditorGeneralTodo::modified(Todo *todo, int modification)
{
    switch(modification)
    {
        case KOGlobals::PRIORITY_MODIFIED:
            mPriorityCombo->setCurrentItem(todo->priority());
            break;
        case KOGlobals::COMPLETION_MODIFIED:
            mCompletedCombo->setCurrentItem(todo->percentComplete() / 10);
            if(todo->isCompleted() && todo->hasCompletedDate())
            {
                mCompleted = todo->completed();
            }
            setCompletedDate();
            break;
        case KOGlobals::CATEGORY_MODIFIED:
            setCategories(todo->categories());
            break;
        case KOGlobals::UNKNOWN_MODIFIED: // fall through
        default:
            readTodo(todo, 0);
            break;
    }
}
Пример #5
0
void KOTodoEditor::reload()
{
    if(mTodo) readTodo(mTodo, mCalendar);
}