void ActivityReportConfigurationDialog::slotStandardTimeSpansChanged() { const TimeSpans timeSpans; m_timespans = timeSpans.standardTimeSpans(); NamedTimeSpan customRange = { tr( "Select Range" ), timeSpans.thisWeek().timespan }; m_timespans << customRange; m_ui->comboBox->clear(); for ( int i = 0; i < m_timespans.size(); ++i ) { m_ui->comboBox->addItem( m_timespans[i].name ); } }
void WeeklyTimesheetConfigurationDialog::slotStandardTimeSpansChanged() { const TimeSpans timeSpans; m_weekInfo = timeSpans.last4Weeks(); NamedTimeSpan custom = { tr( "Manual Selection" ), timeSpans.thisWeek().timespan }; m_weekInfo << custom; m_ui->comboBoxWeek->clear(); for ( int i = 0; i < m_weekInfo.size(); ++i ) { m_ui->comboBoxWeek->addItem( m_weekInfo[i].name ); } // Set current index to "Last Week" as that's what you'll usually want m_ui->comboBoxWeek->setCurrentIndex( 1 ); }