Commit fe0f8a9d authored by Sergio Martins's avatar Sergio Martins
Browse files

A couple of readability improvments while debugging this code.

GIT_SILENT
parent 959bc12f
......@@ -690,11 +690,11 @@ void MultiAgendaView::doRestoreConfig( const KConfigGroup &configGroup )
checkableProxy->setSourceModel( columnFilterProxy );
checkableProxy->setSelectionModel( qsm );
const KConfigGroup g = configGroup.config()->group( configGroup.name()
+ "_subView_"
+ QByteArray::number( i ) );
const KConfigGroup group = configGroup.config()->group( configGroup.name() +
"_subView_" +
QByteArray::number( i ) );
KViewStateMaintainer<ETMViewStateSaver> saver( g );
KViewStateMaintainer<ETMViewStateSaver> saver( group );
saver.setSelectionModel( checkableProxy->selectionModel() );
saver.restoreState();
......@@ -712,13 +712,13 @@ void MultiAgendaView::doSaveConfig( KConfigGroup &configGroup )
const QStringList titleList = d->mCustomColumnTitles.toList();
configGroup.writeEntry( "ColumnTitles", titleList );
int idx = 0;
Q_FOREACH ( KCheckableProxyModel *i, d->mCollectionSelectionModels ) {
KConfigGroup g = configGroup.config()->group( configGroup.name() +
"_subView_" +
QByteArray::number( idx ) );
foreach( KCheckableProxyModel *checkableProxyModel, d->mCollectionSelectionModels ) {
KConfigGroup group = configGroup.config()->group( configGroup.name() +
"_subView_" +
QByteArray::number( idx ) );
++idx;
KViewStateMaintainer<ETMViewStateSaver> saver( g );
saver.setSelectionModel( i->selectionModel() );
KViewStateMaintainer<ETMViewStateSaver> saver( group );
saver.setSelectionModel( checkableProxyModel->selectionModel() );
saver.saveState();
}
}
......
......@@ -495,7 +495,7 @@ void AlarmDialog::setTimer()
while ( *it ) {
ReminderListItem *item = static_cast<ReminderListItem *>( *it );
if ( item->mRemindAt > QDateTime::currentDateTime() ) {
int secs = QDateTime::currentDateTime().secsTo( item->mRemindAt );
const int secs = QDateTime::currentDateTime().secsTo( item->mRemindAt );
nextReminderAt = nextReminderAt <= 0 ? secs : qMin( nextReminderAt, secs );
}
++it;
......@@ -741,7 +741,7 @@ void AlarmDialog::closeEvent( QCloseEvent * )
void AlarmDialog::updateButtons()
{
int count = selectedItems().count();
const int count = selectedItems().count();
kDebug() << "selected items=" << count;
enableButton( User3, count > 0 ); // enable Dismiss, if >1 selected
enableButton( User1, count == 1 ); // enable Edit, if only 1 selected
......
......@@ -70,11 +70,10 @@ KOAlarmClient::KOAlarmClient( QObject *parent )
#ifndef KORGAC_AKONADI_AGENT
KConfig korgConfig( KStandardDirs::locate( "config", "korganizerrc" ) );
KConfigGroup generalGroup( &korgConfig, "General" );
bool showDock = generalGroup.readEntry( "ShowReminderDaemon", true );
const bool showDock = generalGroup.readEntry( "ShowReminderDaemon", true );
if ( showDock ) {
mDocker = new AlarmDockWindow;
connect( this, SIGNAL(reminderCount(int)), mDocker, SLOT(slotUpdate(int)) );
connect( mDocker, SIGNAL(quitSignal()), SLOT(slotQuit()) );
}
......@@ -105,13 +104,13 @@ KOAlarmClient::KOAlarmClient( QObject *parent )
connect( &mCheckTimer, SIGNAL(timeout()), SLOT(checkAlarms()) );
KConfigGroup alarmGroup( KGlobal::config(), "Alarms" );
int interval = alarmGroup.readEntry( "Interval", 60 );
const int interval = alarmGroup.readEntry( "Interval", 60 );
kDebug() << "KOAlarmClient check interval:" << interval << "seconds.";
mLastChecked = alarmGroup.readEntry( "CalendarsLastChecked", QDateTime() );
// load reminders that were active when quitting
KConfigGroup genGroup( KGlobal::config(), "General" );
int numReminders = genGroup.readEntry( "Reminders", 0 );
const int numReminders = genGroup.readEntry( "Reminders", 0 );
for ( int i=1; i<=numReminders; ++i ) {
const QString group( QString( "Incidence-%1" ).arg( i ) );
const KConfigGroup incGroup( KGlobal::config(), group );
......@@ -182,7 +181,7 @@ void KOAlarmClient::checkAlarms()
void KOAlarmClient::createReminder( CalendarSupport::Calendar *calendar,
const Akonadi::Item &aitem,
const QDateTime &dt,
const QDateTime &remindAtDate,
const QString &displayText )
{
if ( !CalendarSupport::hasIncidence( aitem ) ) {
......@@ -203,12 +202,12 @@ void KOAlarmClient::createReminder( CalendarSupport::Calendar *calendar,
}
}
mDialog->addIncidence( aitem, dt, displayText );
mDialog->addIncidence( aitem, remindAtDate, displayText );
mDialog->wakeUp();
#else
const Incidence::Ptr incidence = CalendarSupport::incidence( aitem );
Q_UNUSED( calendar );
Q_UNUSED( dt );
Q_UNUSED( remindAtDate );
Q_UNUSED( displayText );
#if defined(Q_WS_MAEMO_5)
......@@ -263,17 +262,15 @@ void KOAlarmClient::forceAlarmCheck()
void KOAlarmClient::dumpDebug()
{
KConfigGroup cfg( KGlobal::config(), "Alarms" );
QDateTime lastChecked = cfg.readEntry( "CalendarsLastChecked", QDateTime() );
const QDateTime lastChecked = cfg.readEntry( "CalendarsLastChecked", QDateTime() );
kDebug() << "Last Check:" << lastChecked;
}
QStringList KOAlarmClient::dumpAlarms()
{
KDateTime start = KDateTime( QDateTime::currentDateTime().date(),
QTime( 0, 0 ), KDateTime::LocalZone );
KDateTime end = start.addDays( 1 ).addSecs( -1 );
const KDateTime start = KDateTime( QDateTime::currentDateTime().date(),
QTime( 0, 0 ), KDateTime::LocalZone );
const KDateTime end = start.addDays( 1 ).addSecs( -1 );
QStringList lst;
// Don't translate, this is for debugging purposes.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment