summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-17 01:36:32 (UTC)
committer alwin <alwin>2005-03-17 01:36:32 (UTC)
commite9865193fc0acdb84e0317f1188a70ca6f546ade (patch) (unidiff)
tree20f488006b89946512e6d064661687e21e456f5e
parent7a8d4feb0bb9009b0cd50e80f1d6f1d14ca966dc (diff)
downloadopie-e9865193fc0acdb84e0317f1188a70ca6f546ade.zip
opie-e9865193fc0acdb84e0317f1188a70ca6f546ade.tar.gz
opie-e9865193fc0acdb84e0317f1188a70ca6f546ade.tar.bz2
check anniversaries, too.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/holiday/birthday/birthday.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/core/pim/datebook/holiday/birthday/birthday.cpp b/core/pim/datebook/holiday/birthday/birthday.cpp
index a32e0ea..98e2d40 100644
--- a/core/pim/datebook/holiday/birthday/birthday.cpp
+++ b/core/pim/datebook/holiday/birthday/birthday.cpp
@@ -1,56 +1,71 @@
1#include "birthday.h" 1#include "birthday.h"
2 2
3#include <opie2/ocontactaccess.h> 3#include <opie2/ocontactaccess.h>
4 4
5#include <qobject.h> 5#include <qobject.h>
6 6
7Birthday::Birthday() 7Birthday::Birthday()
8 :Opie::Datebook::HolidayPlugin() 8 :Opie::Datebook::HolidayPlugin()
9{ 9{
10 m_contactdb = new Opie::OPimContactAccess("addressplugin"); 10 m_contactdb = new Opie::OPimContactAccess("addressplugin");
11/* 11/*
12 connect( m_contactdb, SIGNAL( signalChanged(const Opie::OPimContactAccess*) ), 12 connect( m_contactdb, SIGNAL( signalChanged(const Opie::OPimContactAccess*) ),
13 this, SLOT( refresh(const Opie::OPimContactAccess*) ) ); 13 this, SLOT( refresh(const Opie::OPimContactAccess*) ) );
14*/ 14*/
15} 15}
16 16
17QString Birthday::description() 17QString Birthday::description()
18{ 18{
19 return QObject::tr("Birthdays","holidays"); 19 return QObject::tr("Birthdays","holidays");
20} 20}
21 21
22QStringList Birthday::entries(const QDate&aDate) 22QStringList Birthday::entries(const QDate&aDate)
23{ 23{
24 QStringList ret; 24 QStringList ret;
25 if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDay ) ){ 25 if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDay ) ){
26 Opie::OPimContact querybirthdays; 26 Opie::OPimContact querybirthdays,queryanniversary;
27 QString pre;
27 querybirthdays.setBirthday(aDate); 28 querybirthdays.setBirthday(aDate);
29 queryanniversary.setAnniversary(aDate);
28 m_list = m_contactdb->queryByExample( querybirthdays,Opie::OPimContactAccess::DateDay| Opie::OPimContactAccess::DateMonth); 30 m_list = m_contactdb->queryByExample( querybirthdays,Opie::OPimContactAccess::DateDay| Opie::OPimContactAccess::DateMonth);
29 if ( m_list.count() > 0 ){ 31 if ( m_list.count() > 0 ){
30 QString pre = QObject::tr("Birthday","holidays")+" "; 32 pre = QObject::tr("Birthday","holidays")+" ";
33 int z = 0;
34 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
35 if (z) {
36 pre+=", ";
37 }
38 pre+=((*m_it).fullName());
39 ++z;
40 }
41 ret.append(pre);
42 }
43 m_list = m_contactdb->queryByExample( queryanniversary,Opie::OPimContactAccess::DateDay| Opie::OPimContactAccess::DateMonth);
44 if ( m_list.count() > 0 ){
45 pre = QObject::tr("Anniversary","holidays")+" ";
31 int z = 0; 46 int z = 0;
32 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 47 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
33 if (z) { 48 if (z) {
34 pre+=", "; 49 pre+=", ";
35 } 50 }
36 pre+=((*m_it).fullName()); 51 pre+=((*m_it).fullName());
37 ++z; 52 ++z;
38 } 53 }
39 ret.append(pre); 54 ret.append(pre);
40 } 55 }
41 } 56 }
42 return ret; 57 return ret;
43} 58}
44 59
45QStringList Birthday::entries(unsigned year, unsigned month, unsigned day) 60QStringList Birthday::entries(unsigned year, unsigned month, unsigned day)
46{ 61{
47 return entries(QDate(year,month,day)); 62 return entries(QDate(year,month,day));
48} 63}
49 64
50QMap<QDate,QStringList> Birthday::entries(const QDate&,const QDate&) 65QMap<QDate,QStringList> Birthday::entries(const QDate&,const QDate&)
51{ 66{
52 QMap<QDate,QStringList> ret; 67 QMap<QDate,QStringList> ret;
53 return ret; 68 return ret;
54} 69}
55 70
56EXPORT_HOLIDAY_PLUGIN(Birthday); 71EXPORT_HOLIDAY_PLUGIN(Birthday);