From 9ccde964284da2c2dcc42da5e04f818e45baa148 Mon Sep 17 00:00:00 2001 From: drw Date: Mon, 06 Jun 2005 19:09:03 +0000 Subject: Fix to show/not show birthdays and use checkboxes for selection in plugin config dialog (courtesy of hrw) --- (limited to 'core/pim') diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp index 7b6117e..4f1630d 100644 --- a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp @@ -36,9 +36,9 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* // Buttongroup to enable/disable shown stuff QVGroupBox* b_group = new QVGroupBox( this, "name" ); b_group -> setTitle( tr("Enable/Disable Views") ); - m_showBirthdayButton = new QRadioButton( b_group ); + m_showBirthdayButton = new QCheckBox( b_group ); m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) ); - m_showAnniversaryButton = new QRadioButton( b_group ); + m_showAnniversaryButton = new QCheckBox( b_group ); m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) ); QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) ); diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.h b/core/pim/today/plugins/addressbook/addresspluginconfig.h index e065ca2..1284fdc 100644 --- a/core/pim/today/plugins/addressbook/addresspluginconfig.h +++ b/core/pim/today/plugins/addressbook/addresspluginconfig.h @@ -24,7 +24,7 @@ #include #include -#include +#include class AddressBookPluginConfig : public TodayConfigWidget { Q_OBJECT @@ -49,8 +49,8 @@ private: Opie::OColorButton* entryColor; Opie::OColorButton* headlineColor; Opie::OColorButton* urgentColor; - QRadioButton* m_showBirthdayButton; - QRadioButton* m_showAnniversaryButton; + QCheckBox* m_showBirthdayButton; + QCheckBox* m_showAnniversaryButton; // how many lines should be showed in the AddressBook section int m_max_lines_task; diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp index df7c5e1..5662af2 100644 --- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp @@ -102,58 +102,58 @@ void AddressBookPluginWidget::getAddress() { if ( m_showBirthdays ){ owarn << "Searching from now (" << QDate::currentDate().toString() << ") until " << lookAheadDate.toString() << " ! " << oendl; - } - - if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ - - - Opie::OPimContact querybirthdays; - querybirthdays.setBirthday( lookAheadDate ); - m_list = m_contactdb->queryByExample( querybirthdays, - Opie::OPimContactAccess::DateDiff ); - if ( m_list.count() > 0 ){ - output = "" - + QObject::tr( "Next birthdays in %1 days:" ) - .arg( m_daysLookAhead ) - + "
"; - for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { - if ( ammount++ < m_maxLinesTask ){ - // Now we want to calculate how many days - //until birthday. We have to set - // the correct year to calculate the day diff... - QDate destdate = (*m_it).birthday(); - destdate.setYMD( QDate::currentDate().year(), - destdate.month(), destdate.day() ); - if ( QDate::currentDate().daysTo(destdate) < 0 ) - destdate.setYMD( QDate::currentDate().year()+1, + if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ + + + Opie::OPimContact querybirthdays; + querybirthdays.setBirthday( lookAheadDate ); + + m_list = m_contactdb->queryByExample( querybirthdays, + Opie::OPimContactAccess::DateDiff ); + if ( m_list.count() > 0 ){ + output = "" + + QObject::tr( "Next birthdays in %1 days:" ) + .arg( m_daysLookAhead ) + + "
"; + for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { + if ( ammount++ < m_maxLinesTask ){ + // Now we want to calculate how many days + //until birthday. We have to set + // the correct year to calculate the day diff... + QDate destdate = (*m_it).birthday(); + destdate.setYMD( QDate::currentDate().year(), destdate.month(), destdate.day() ); - - - if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) - output += "-" - + (*m_it).fullName() - + " (" - + QString::number(QDate::currentDate() - .daysTo(destdate)) - + " Days)
"; - - else - output += "-" - + (*m_it).fullName() - + " (" - + QString::number(QDate::currentDate() - .daysTo(destdate)) - + " Days)
"; + if ( QDate::currentDate().daysTo(destdate) < 0 ) + destdate.setYMD( QDate::currentDate().year()+1, + destdate.month(), destdate.day() ); + + + if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) + output += "-" + + (*m_it).fullName() + + " (" + + QString::number(QDate::currentDate() + .daysTo(destdate)) + + " Days)
"; + + else + output += "-" + + (*m_it).fullName() + + " (" + + QString::number(QDate::currentDate() + .daysTo(destdate)) + + " Days)
"; + } } + } else { + output = "" + + QObject::tr( "No birthdays in %1 days!" ) + .arg( m_daysLookAhead ) + + "
"; } - } else { - output = "" - + QObject::tr( "No birthdays in %1 days!" ) - .arg( m_daysLookAhead ) - + "
"; } - } + } if ( m_showAnniversaries ){ // Define the query for anniversaries and start search.. -- cgit v0.9.0.2