Ejemplo n.º 1
0
WeeklyRecurrence::WeeklyRecurrence(Budget *parent_budget, QDomElement *e, bool *valid) : Recurrence(parent_budget, e, valid) {
	i_frequency = e->attribute("frequency", "1").toInt();
	QString days = e->attribute("days");
	b_daysofweek[0] = days.indexOf('1') >= 0;
	b_daysofweek[1] = days.indexOf('2') >= 0;
	b_daysofweek[2] = days.indexOf('3') >= 0;
	b_daysofweek[3] = days.indexOf('4') >= 0;
	b_daysofweek[4] = days.indexOf('5') >= 0;
	b_daysofweek[5] = days.indexOf('6') >= 0;
	b_daysofweek[6] = days.indexOf('7') >= 0;
	if(valid) {
		bool b = false;
		for(int i = 0; i < 7; i++) {
			if(b_daysofweek[i]) {
				b = true;
				break;
			}
		}
		if(!b) *valid = false;
	}
	if(valid && i_frequency < 1) {
		*valid = false;
	}
	updateDates();
}
Ejemplo n.º 2
0
DailyRecurrence::DailyRecurrence(Budget *parent_budget, QDomElement *e, bool *valid) : Recurrence(parent_budget, e, valid) {
	i_frequency = e->attribute("frequency", "1").toInt();
	if(valid && i_frequency < 1) {
		*valid = false;
	}
	updateDates();
}
Ejemplo n.º 3
0
void TodoEditor::setupGui()
{
    startDateEdit = new QDateTimeEdit;
    dueDateEdit = new QDateTimeEdit;
    subjectLineEdit = new QLineEdit;
    descriptionTextEdit = new QTextEdit;
    doneButton = new QPushButton(tr("Done"));

    setupCombos();

    connect(startDateEdit, SIGNAL(editingFinished()),
        this, SLOT(updateDates()));
    connect(dueDateEdit, SIGNAL(editingFinished()), this, SLOT(updateDates()));
    connect(subjectLineEdit, SIGNAL(editingFinished()),
        this, SLOT(updateSubject()));
    connect(descriptionTextEdit, SIGNAL(textChanged()),
        this, SLOT(updateDescription()));
    connect(statusCombo, SIGNAL(activated(int)), this, SLOT(updateStatus(int)));
    connect(priorityCombo, SIGNAL(activated(int)),
        this, SLOT(updatePriority(int)));
    connect(alarmCombo, SIGNAL(activated(int)), this, SLOT(updateAlarm(int)));
    connect(doneButton, SIGNAL(clicked()), this, SLOT(finishEditing()));

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(new QLabel(tr("Subject:")));
    layout->addWidget(subjectLineEdit);
    layout->addWidget(new QLabel(tr("Start Date:")));
    layout->addWidget(startDateEdit);
    layout->addWidget(new QLabel(tr("Due Date:")));
    layout->addWidget(dueDateEdit);
    layout->addWidget(new QLabel(tr("Status:")));
    layout->addWidget(statusCombo);
    layout->addWidget(new QLabel(tr("Priority:")));
    layout->addWidget(priorityCombo);
    layout->addWidget(new QLabel(tr("Alarm:")));
    layout->addWidget(alarmCombo);
    layout->addWidget(new QLabel(tr("Description")));
    layout->addWidget(descriptionTextEdit);
    layout->addWidget(doneButton);

    setLayout(layout);
}
Ejemplo n.º 4
0
MonthlyRecurrence::MonthlyRecurrence(Budget *parent_budget, QDomElement *e, bool *valid) : Recurrence(parent_budget, e, valid) {
	i_day = e->attribute("day", "1").toInt();
	i_frequency = e->attribute("frequency", "1").toInt();
	i_week = e->attribute("week", "1").toInt();
	i_dayofweek = e->attribute("dayofweek", "-1").toInt();
	wh_weekendhandling = (WeekendHandling) e->attribute("weekendhandling", "0").toInt();
	if(valid && (i_day > 31 || i_day < -27 || i_frequency < 1 || i_week > 5 || i_week < -4 || i_dayofweek > 7)) {
		*valid = false;
	}
	updateDates();
}
Ejemplo n.º 5
0
void EditSubject::accept()
{
    if (!m_subject)
        return;
    m_subject->setHourCount(ui->hourCount->value());
    m_subject->setFirstClass(ui->firstClassDate->date());
    m_subject->clearDates();
    if (ui->autoDates->checkState()!=Qt::Checked)
    {
        m_subject->setDates(m_subjectDateModel->dateList());
    }
    updateDates();
}
Ejemplo n.º 6
0
void EditSubject::setSubject(const Subject &subject_)
{
    m_subject.reset();
    if (subject_.dates())
    {
        ui->autoDates->setChecked(false);
    }
    else
    {
        ui->autoDates->setChecked(true);
    }
    ui->hourCount->setValue(subject_.hourCount());
    ui->firstClassDate->setDate(subject_.firstClass());
    m_subject.reset(new Subject(subject_));
    updateDates();
}
Ejemplo n.º 7
0
void EditSubject::setDatesState(int state)
{
    m_subjectDateModel->setEditable(state!=Qt::Checked);
    accept();
    updateDates();
}