author | drw <drw> | 2005-06-06 19:09:03 (UTC) |
---|---|---|
committer | drw <drw> | 2005-06-06 19:09:03 (UTC) |
commit | 9ccde964284da2c2dcc42da5e04f818e45baa148 (patch) (side-by-side diff) | |
tree | aafeed7ef6bcceaf1271a7f3b748b3fd9634c0f6 /core | |
parent | 85a043b065f0b43470bc15dc6594eb520f379505 (diff) | |
download | opie-9ccde964284da2c2dcc42da5e04f818e45baa148.zip opie-9ccde964284da2c2dcc42da5e04f818e45baa148.tar.gz opie-9ccde964284da2c2dcc42da5e04f818e45baa148.tar.bz2 |
Fix to show/not show birthdays and use checkboxes for selection in plugin config dialog (courtesy of hrw)
3 files changed, 52 insertions, 52 deletions
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 @@ -35,11 +35,11 @@ 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!" ) ); QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries 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 @@ -23,9 +23,9 @@ #include <opie2/ocolorbutton.h> #include <qwidget.h> #include <qspinbox.h> -#include <qradiobutton.h> +#include <qcheckbox.h> class AddressBookPluginConfig : public TodayConfigWidget { Q_OBJECT @@ -48,10 +48,10 @@ private: QSpinBox* SpinUrgentClip; 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; // clip the lines after X chars 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 @@ -101,60 +101,60 @@ void AddressBookPluginWidget::getAddress() { int ammount = 0; 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 = "<font color=" + m_headlineColor + ">" - + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) - .arg( m_daysLookAhead ) - + "</font> <br>"; - 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 = "<font color=" + m_headlineColor + ">" + + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) + .arg( m_daysLookAhead ) + + "</font> <br>"; + 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 += "<font color=" + m_urgentColor + "><b>-" - + (*m_it).fullName() - + " (" - + QString::number(QDate::currentDate() - .daysTo(destdate)) - + " Days) </b></font><br>"; - - else - output += "<font color=" + m_entryColor + "><b>-" - + (*m_it).fullName() - + " (" - + QString::number(QDate::currentDate() - .daysTo(destdate)) - + " Days) </b></font><br>"; + if ( QDate::currentDate().daysTo(destdate) < 0 ) + destdate.setYMD( QDate::currentDate().year()+1, + destdate.month(), destdate.day() ); + + + if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) + output += "<font color=" + m_urgentColor + "><b>-" + + (*m_it).fullName() + + " (" + + QString::number(QDate::currentDate() + .daysTo(destdate)) + + " Days) </b></font><br>"; + + else + output += "<font color=" + m_entryColor + "><b>-" + + (*m_it).fullName() + + " (" + + QString::number(QDate::currentDate() + .daysTo(destdate)) + + " Days) </b></font><br>"; + } } + } else { + output = "<font color=" + m_headlineColor + ">" + + QObject::tr( "No birthdays in <b> %1 </b> days!" ) + .arg( m_daysLookAhead ) + + "</font> <br>"; } - } else { - output = "<font color=" + m_headlineColor + ">" - + QObject::tr( "No birthdays in <b> %1 </b> days!" ) - .arg( m_daysLookAhead ) - + "</font> <br>"; } - } + } if ( m_showAnniversaries ){ // Define the query for anniversaries and start search.. Opie::OPimContact queryanniversaries; |