summaryrefslogtreecommitdiffstats
path: root/kontact/plugins/specialdates
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /kontact/plugins/specialdates
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kontact/plugins/specialdates')
-rw-r--r--kontact/plugins/specialdates/Makefile.am31
-rw-r--r--kontact/plugins/specialdates/kcmsdsummary.cpp248
-rw-r--r--kontact/plugins/specialdates/kcmsdsummary.desktop126
-rw-r--r--kontact/plugins/specialdates/kcmsdsummary.h69
-rw-r--r--kontact/plugins/specialdates/sdsummarywidget.cpp637
-rw-r--r--kontact/plugins/specialdates/sdsummarywidget.h84
-rw-r--r--kontact/plugins/specialdates/specialdates_plugin.cpp70
-rw-r--r--kontact/plugins/specialdates/specialdates_plugin.h52
-rw-r--r--kontact/plugins/specialdates/specialdatesplugin.desktop92
9 files changed, 1409 insertions, 0 deletions
diff --git a/kontact/plugins/specialdates/Makefile.am b/kontact/plugins/specialdates/Makefile.am
new file mode 100644
index 000000000..7bedb2051
--- /dev/null
+++ b/kontact/plugins/specialdates/Makefile.am
@@ -0,0 +1,31 @@
+INCLUDES = -I$(top_srcdir)/kontact/interfaces \
+ -I$(top_srcdir)/libkdepim \
+ -I$(top_srcdir) $(all_includes)
+
+kde_module_LTLIBRARIES = libkontact_specialdatesplugin.la kcm_sdsummary.la
+libkontact_specialdatesplugin_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkontact_specialdatesplugin_la_LIBADD = \
+ $(top_builddir)/kontact/interfaces/libkpinterfaces.la \
+ $(top_builddir)/libkdepim/libkdepim.la \
+ $(top_builddir)/libkholidays/libkholidays.la \
+ $(top_builddir)/korganizer/libkorganizer_calendar.la \
+ $(top_builddir)/kaddressbook/libkaddressbook.la
+
+libkontact_specialdatesplugin_la_SOURCES = specialdates_plugin.cpp \
+ sdsummarywidget.cpp
+
+kcm_sdsummary_la_SOURCES = kcmsdsummary.cpp
+kcm_sdsummary_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) \
+ -avoid-version -no-undefined
+kcm_sdsummary_la_LIBADD = $(LIB_KDEUI)
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)/kontact
+service_DATA = specialdatesplugin.desktop
+
+kde_services_DATA = kcmsdsummary.desktop
+
+specialdatesiface_DIR = $(top_srcdir)/specialdates
+kmailIface_DIR = $(top_srcdir)/kmail
+kmailIface_DCOPIDLNG = true
diff --git a/kontact/plugins/specialdates/kcmsdsummary.cpp b/kontact/plugins/specialdates/kcmsdsummary.cpp
new file mode 100644
index 000000000..9bb0211a5
--- /dev/null
+++ b/kontact/plugins/specialdates/kcmsdsummary.cpp
@@ -0,0 +1,248 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
+ Copyright (c) 2004 Allen Winter <winter@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#include <qbuttongroup.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kaccelmanager.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <klocale.h>
+
+#include "kcmsdsummary.h"
+
+#include <kdepimmacros.h>
+
+extern "C"
+{
+ KDE_EXPORT KCModule *create_sdsummary( QWidget *parent, const char * )
+ {
+ return new KCMSDSummary( parent, "kcmsdsummary" );
+ }
+}
+
+KCMSDSummary::KCMSDSummary( QWidget *parent, const char *name )
+ : KCModule( parent, name )
+{
+ initGUI();
+
+ customDaysChanged( 1 );
+
+ connect( mDaysGroup, SIGNAL( clicked( int ) ), SLOT( modified() ) );
+ connect( mDaysGroup, SIGNAL( clicked( int ) ), SLOT( buttonClicked( int ) ) );
+ connect( mCalendarGroup, SIGNAL( clicked( int ) ), SLOT( modified() ) );
+ connect( mContactGroup, SIGNAL( clicked( int ) ), SLOT( modified() ) );
+ connect( mCustomDays, SIGNAL( valueChanged( int ) ), SLOT( modified() ) );
+ connect( mCustomDays, SIGNAL( valueChanged( int ) ), SLOT( customDaysChanged( int ) ) );
+
+ KAcceleratorManager::manage( this );
+
+ load();
+}
+
+void KCMSDSummary::modified()
+{
+ emit changed( true );
+}
+
+void KCMSDSummary::buttonClicked( int id )
+{
+ mCustomDays->setEnabled( id == 4 );
+}
+
+void KCMSDSummary::customDaysChanged( int value )
+{
+ mCustomDays->setSuffix( i18n( " day", " days", value ) );
+}
+
+void KCMSDSummary::initGUI()
+{
+ QGridLayout *layout = new QGridLayout( this, 3, 2, KDialog::spacingHint() );
+
+ mDaysGroup = new QButtonGroup( 0, Vertical, i18n( "Special Dates Summary" ), this );
+ QVBoxLayout *boxLayout = new QVBoxLayout( mDaysGroup->layout(),
+ KDialog::spacingHint() );
+
+ QLabel *label = new QLabel( i18n( "How many days should the special dates summary show at once?" ), mDaysGroup );
+ boxLayout->addWidget( label );
+
+ QRadioButton *button = new QRadioButton( i18n( "One day" ), mDaysGroup );
+ boxLayout->addWidget( button );
+
+ button = new QRadioButton( i18n( "Five days" ), mDaysGroup );
+ boxLayout->addWidget( button );
+
+ button = new QRadioButton( i18n( "One week" ), mDaysGroup );
+ boxLayout->addWidget( button );
+
+ button = new QRadioButton( i18n( "One month" ), mDaysGroup );
+ boxLayout->addWidget( button );
+
+ QHBoxLayout *hbox = new QHBoxLayout( boxLayout, KDialog::spacingHint() );
+
+ button = new QRadioButton( "", mDaysGroup );
+ hbox->addWidget( button );
+
+ mCustomDays = new QSpinBox( 1, 365, 1, mDaysGroup );
+ mCustomDays->setEnabled( false );
+ hbox->addWidget( mCustomDays );
+
+ hbox->addStretch( 1 );
+
+ layout->addMultiCellWidget( mDaysGroup, 0, 0, 0, 1 );
+
+ mCalendarGroup = new QButtonGroup( 1, Horizontal, i18n( "Special Dates From Calendar" ), this );
+
+ mShowBirthdaysFromCal = new QCheckBox( i18n( "Show birthdays" ), mCalendarGroup );
+ mShowAnniversariesFromCal = new QCheckBox( i18n( "Show anniversaries" ), mCalendarGroup );
+ mShowHolidays = new QCheckBox( i18n( "Show holidays" ), mCalendarGroup );
+
+ mShowSpecialsFromCal = new QCheckBox( i18n( "Show special occasions" ), mCalendarGroup );
+
+ mContactGroup = new QButtonGroup( 1, Horizontal, i18n( "Special Dates From Contact List" ), this );
+
+ mShowBirthdaysFromKAB = new QCheckBox( i18n( "Show birthdays" ), mContactGroup );
+ mShowAnniversariesFromKAB = new QCheckBox( i18n( "Show anniversaries" ), mContactGroup );
+
+ layout->addWidget( mCalendarGroup, 1, 0 );
+ layout->addWidget( mContactGroup, 1, 1 );
+
+ layout->setRowStretch( 2, 1 );
+}
+
+void KCMSDSummary::load()
+{
+ KConfig config( "kcmsdsummaryrc" );
+
+ config.setGroup( "Days" );
+ int days = config.readNumEntry( "DaysToShow", 7 );
+ if ( days == 1 )
+ mDaysGroup->setButton( 0 );
+ else if ( days == 5 )
+ mDaysGroup->setButton( 1 );
+ else if ( days == 7 )
+ mDaysGroup->setButton( 2 );
+ else if ( days == 31 )
+ mDaysGroup->setButton( 3 );
+ else {
+ mDaysGroup->setButton( 4 );
+ mCustomDays->setValue( days );
+ mCustomDays->setEnabled( true );
+ }
+
+ config.setGroup( "EventTypes" );
+
+ mShowBirthdaysFromKAB->
+ setChecked( config.readBoolEntry( "ShowBirthdaysFromContacts", true ) );
+ mShowBirthdaysFromCal->
+ setChecked( config.readBoolEntry( "ShowBirthdaysFromCalendar", true ) );
+
+ mShowAnniversariesFromKAB->
+ setChecked( config.readBoolEntry( "ShowAnniversariesFromContacts", true ) );
+ mShowAnniversariesFromCal->
+ setChecked( config.readBoolEntry( "ShowAnniversariesFromCalendar", true ) );
+
+ mShowHolidays->
+ setChecked( config.readBoolEntry( "ShowHolidays", true ) );
+
+ mShowSpecialsFromCal->
+ setChecked( config.readBoolEntry( "ShowSpecialsFromCalendar", true ) );
+
+ emit changed( false );
+}
+
+void KCMSDSummary::save()
+{
+ KConfig config( "kcmsdsummaryrc" );
+
+ config.setGroup( "Days" );
+
+ int days;
+ switch ( mDaysGroup->selectedId() ) {
+ case 0: days = 1; break;
+ case 1: days = 5; break;
+ case 2: days = 7; break;
+ case 3: days = 31; break;
+ case 4:
+ default: days = mCustomDays->value(); break;
+ }
+ config.writeEntry( "DaysToShow", days );
+
+ config.setGroup( "EventTypes" );
+
+ config.writeEntry( "ShowBirthdaysFromContacts",
+ mShowBirthdaysFromKAB->isChecked() );
+ config.writeEntry( "ShowBirthdaysFromCalendar",
+ mShowBirthdaysFromCal->isChecked() );
+
+ config.writeEntry( "ShowAnniversariesFromContacts",
+ mShowAnniversariesFromKAB->isChecked() );
+ config.writeEntry( "ShowAnniversariesFromCalendar",
+ mShowAnniversariesFromCal->isChecked() );
+
+ config.writeEntry( "ShowHolidays",
+ mShowHolidays->isChecked() );
+
+ config.writeEntry( "ShowSpecialsFromCalendar",
+ mShowSpecialsFromCal->isChecked() );
+
+ config.sync();
+
+ emit changed( false );
+}
+
+void KCMSDSummary::defaults()
+{
+ mDaysGroup->setButton( 7 );
+ mShowBirthdaysFromKAB->setChecked( true );
+ mShowBirthdaysFromCal->setChecked( true );
+ mShowAnniversariesFromKAB->setChecked( true );
+ mShowAnniversariesFromCal->setChecked( true );
+ mShowHolidays->setChecked( true );
+ mShowSpecialsFromCal->setChecked( true );
+
+ emit changed( true );
+}
+
+const KAboutData* KCMSDSummary::aboutData() const
+{
+ KAboutData *about = new KAboutData( I18N_NOOP( "kcmsdsummary" ),
+ I18N_NOOP( "Special Dates Configuration Dialog" ),
+ 0, 0, KAboutData::License_GPL,
+ I18N_NOOP( "(c) 2004 Tobias Koenig" ) );
+
+ about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
+ about->addAuthor( "Allen Winter", 0, "winter@kde.org" );
+
+ return about;
+}
+
+#include "kcmsdsummary.moc"
diff --git a/kontact/plugins/specialdates/kcmsdsummary.desktop b/kontact/plugins/specialdates/kcmsdsummary.desktop
new file mode 100644
index 000000000..f294c3835
--- /dev/null
+++ b/kontact/plugins/specialdates/kcmsdsummary.desktop
@@ -0,0 +1,126 @@
+[Desktop Entry]
+Icon=cookie
+Type=Service
+ServiceTypes=KCModule
+
+X-KDE-ModuleType=Library
+X-KDE-Library=sdsummary
+X-KDE-FactoryName=sdsummary
+X-KDE-ParentApp=kontact_specialdatesplugin
+X-KDE-ParentComponents=kontact_specialdatesplugin
+X-KDE-CfgDlgHierarchy=KontactSummary
+
+Name=Special Dates Overview
+Name[bg]=Преглед на специални случаи
+Name[ca]=Resum de dates especials
+Name[da]=Oversigt over særlige datoer
+Name[de]=Übersicht über besondere Termine
+Name[el]=Επισκόπηση σημαντικών ημερομηνιών
+Name[es]=Resumen de fechas especiales
+Name[et]=Tähtpäevade ülevaade
+Name[fr]=Aperçu des dates importantes
+Name[is]=Yfirlit sérstakra daga
+Name[it]=Panoramica delle date speciali
+Name[ja]=特別な日の要約
+Name[km]=ទិដ្ឋភាព​កាលបរិច្ឆេទ​ពិសេស
+Name[nds]=Översicht besünner Daten
+Name[nl]=Overzicht van speciale data
+Name[pl]=Daty specjalne
+Name[pt_BR]=Resumo de Datas Especiais
+Name[ru]=Сводка особых дат
+Name[sr]=Преглед посебних датума
+Name[sr@Latn]=Pregled posebnih datuma
+Name[sv]=Översikt av speciella datum
+Name[tr]=Özel Tarihlere Genel Bakış
+Name[zh_CN]=特殊日期概览
+Name[zh_TW]=特殊日期概觀
+Comment=Special Dates Summary Setup
+Comment[af]=Spesiale datums opsomming opstelling
+Comment[bg]=Настройки на специалните случаи
+Comment[ca]=Configuració del resum de les dates especials
+Comment[cs]=Nastavení souhrnu speciálních datumů
+Comment[da]=Opsummering af opsætning af særlige datoer
+Comment[de]=Einstellung der Übersicht über besondere Termine
+Comment[el]=Ρύθμιση σύνοψης σημαντικών ημερομηνιών
+Comment[es]=Configuración del resumen de las fechas especiales
+Comment[et]=Tähtpäevade kokkuvõtte seadistus
+Comment[eu]=Data berezien laburpenen konfigurazioa
+Comment[fa]=برپایی خلاصۀ تاریخهای ویژه
+Comment[fi]=Erikoispäivien yhteenvedon asetukset
+Comment[fr]=Configuration du résumé des dates particulières
+Comment[fy]=Spesjale datums oersichts opset
+Comment[gl]=Configuración do Resumo de Datas Especiais
+Comment[he]=תצורת תאריכים מיוחדים
+Comment[hu]=A fontos dátumok áttekintőjének beállításai
+Comment[is]=Yfirlitsuppsetning sérstakra daga
+Comment[it]=Impostazioni per le date speciali
+Comment[ja]=特別な日の要約設定
+Comment[ka]=განსაკუთრებულ თარიღთა დაიჯესტის კონფიგურაცია
+Comment[kk]=Ерекше күндер тұжырымының баптауы
+Comment[km]=រៀបចំ​សេចក្ដី​សង្ខេប​ថ្ងៃ​ពិសេស
+Comment[lt]=Ypatingų datų santraukos sąranka
+Comment[mk]=Поставувања за прегледот на специјални датуми
+Comment[ms]=Setup Ringkasan Tarikh Khusus
+Comment[nb]=Sammendragsoppsett for spesielle datoer
+Comment[nds]=Översicht över besünner Daag instellen
+Comment[ne]=विशेष मिति सारांश सेटअप
+Comment[nl]=Instellingen voor speciale data in overzicht
+Comment[nn]=Oppsett av samandrag for spesielle datoar
+Comment[pl]=Ustawienia podsumowania dat specjalnych
+Comment[pt]=Configuração do Sumário de Datas Especiais
+Comment[pt_BR]=Configuração do Resumo de Datas Especiais
+Comment[ru]=Настройка особых дат
+Comment[sk]=Nastavenie súhrnu špeciálnych dátumov
+Comment[sl]=Nastavitve povzetka posebnih datumov
+Comment[sr]=Подешавање сажетка посебних датума
+Comment[sr@Latn]=Podešavanje sažetka posebnih datuma
+Comment[sv]=Inställning av översikt av speciella datum
+Comment[ta]=விசேஷ தேதிகள் சுருக்க அமைப்பு
+Comment[th]=ต้้งค่าส่วนสรุปวันพิเศษ
+Comment[tr]=Özel Tarih Özeti Yapılandırması
+Comment[uk]=Налаштування підсумку особливих дат
+Comment[zh_CN]=特殊日期摘要设置
+Comment[zh_TW]=特殊日期摘要設定
+Keywords=birthday, anniversary, holiday, configure, settings
+Keywords[af]=birtday,anniversary, holiday, conifugre, settings, verjaarsdag, herdenking, vakansie
+Keywords[bg]=рождени, рожден, дни, ден, годишнина, годишнини, обобщение, birthday, anniversary, configure, settings
+Keywords[ca]=data de naixement, aniversari, vacances, configuració, arranjament
+Keywords[cs]=narozeniny,výročí,nastavení,nastavit,svátek
+Keywords[da]=fødselsdag, årsdag, helligdage, indstil, opsætning
+Keywords[de]=Geburtstag,Jahrestag,Feiertag,einstellen,Einstellungen,Einrichten
+Keywords[el]=γενέθλια, επέτειος, εορτή, ρύθμιση, ρυθμίσεις
+Keywords[es]=cumpleaños, aniversario, vacaciones, configurar, preferencias
+Keywords[et]=sünnipäev, tähtpäev, pidupäev, seadistamine, seadistused
+Keywords[eu]=urtebetezea, urteurrena, jaia, konfiguratu, ezarpenak
+Keywords[fa]=تولد، جشن سالانه، تعطیلات، پیکربندی، تنظیمات
+Keywords[fi]=syntymäpäivä, juhlapäivä, loma, aseta, asetukset
+Keywords[fr]=anniversaire,date de naissance,vacances,configurer,paramètres,préférences
+Keywords[fy]=verjaardag,jubileum,vakantie,instellingen,configuratie,feestdag, jierdei, fakânsje, ynstellings, feestdei
+Keywords[gl]=cumpreanos, aniversario, vacacións, configurar, opcións
+Keywords[he]=birthday, anniversary, holiday, configure, settings, יום הולדת, הולדת, שנה, יום שנה, חג, חגים, תצורה, הגדרות
+Keywords[hu]=születésnap,évforduló,szabadság,konfigurálás,beállítások
+Keywords[is]=afmæli, frídagar, stillingar, stilla
+Keywords[it]=compleanno, anniversario, vacanze, configura, impostazioni
+Keywords[ja]=誕生日,記念日,休日,設定,設定
+Keywords[ka]=დაბადების დღე,სახელობის დღე,დასვენების დღე,კონფიგურაცია,პარამეტრები
+Keywords[km]=ថ្ងៃ​ខួប​កំណើត,បុណ្យ​ខួប,វិស្សមកាល,កំណត់​រចនាសម្ព័ន្ធ,ការ​កំណត់
+Keywords[lt]=birthday, anniversary, holiday, configure, settings, konfigūruoti, nustatymai, gimtadieniai, išeiginės,sukaktys
+Keywords[mk]=birthday, anniversary, holiday, configure, settings, роденден, годишнина, конфигурирање, конфигурација, поставувања
+Keywords[ms]=tarikh lahir, ulang tahun, cuti, konfigur, seting
+Keywords[nb]=fødselsdag, jubileum, ferie, sette opp, innstillinger
+Keywords[nds]=Geboortsdag,Johrdag,Fierdag,instellen
+Keywords[ne]=जन्मदिन, वार्षिकोत्सव, बिदा, कन्फिगर, सेटिङ
+Keywords[nl]=verjaardag,jubileum,vakantie,instellingen,configuratie,feestdag
+Keywords[nn]=fødselsdag,bursdag,gebursdag,jubileum,ferie,helgedag,merkedag,oppsett,innstillingar
+Keywords[pl]=urodziny,rocznica,rocznice,wakacje,urlop,konfiguracja,ustawienia
+Keywords[pt]=data de nascimento, aniversário, feriado, configurar, configuração
+Keywords[pt_BR]=aniversário,aniversário de casamento, feriados,configurar,configurações
+Keywords[ru]=birthday,anniversary,configure,settings,дни рождения,настройки,праздники,годовщины
+Keywords[sl]=rojstni dan, obletnica, praznik, nastavi, nastavitve
+Keywords[sr]=birthday, anniversary, holiday, configure, settings, рођендан, годишњица, подеси, поставке, подешавања
+Keywords[sr@Latn]=birthday, anniversary, holiday, configure, settings, rođendan, godišnjica, podesi, postavke, podešavanja
+Keywords[sv]=födelsedag,årsdag,helgdag,anpassa,inställningar
+Keywords[ta]=பிறந்தநாள், ஆண்டுவிழா, விடுமுறை, வடிவமைப்பு, அமைப்புகள்
+Keywords[tr]=doğumgünü, evlilik yıldönümü, tatil, yapılandır, ypılandırma
+Keywords[uk]=birthday, anniversary, holiday, configure, settings, день народження, ювілей, свято, налаштування, параметри
+Keywords[zh_CN]=birthday, anniversary, holiday, configure, settings, 周年纪念, 配置, 设置, 假日
diff --git a/kontact/plugins/specialdates/kcmsdsummary.h b/kontact/plugins/specialdates/kcmsdsummary.h
new file mode 100644
index 000000000..60b2ea082
--- /dev/null
+++ b/kontact/plugins/specialdates/kcmsdsummary.h
@@ -0,0 +1,69 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
+ Copyright (c) 2004 Allen Winter <winter@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#ifndef KCMSDSUMMARY_H
+#define KCMSDSUMMARY_H
+
+#include <kcmodule.h>
+
+class QButtonGroup;
+class QCheckBox;
+class QSpinBox;
+
+class KAboutData;
+
+class KCMSDSummary : public KCModule
+{
+ Q_OBJECT
+
+ public:
+ KCMSDSummary( QWidget *parent = 0, const char *name = 0 );
+
+ virtual void load();
+ virtual void save();
+ virtual void defaults();
+ virtual const KAboutData* aboutData() const;
+
+ private slots:
+ void modified();
+ void buttonClicked( int );
+ void customDaysChanged( int );
+
+ private:
+ void initGUI();
+
+ QButtonGroup *mDaysGroup;
+ QButtonGroup *mCalendarGroup;
+ QButtonGroup *mContactGroup;
+ QCheckBox *mShowBirthdaysFromKAB;
+ QCheckBox *mShowBirthdaysFromCal;
+ QCheckBox *mShowAnniversariesFromKAB;
+ QCheckBox *mShowAnniversariesFromCal;
+ QCheckBox *mShowHolidays;
+ QCheckBox *mShowHolidaysFromCal;
+ QCheckBox *mShowSpecialsFromCal;
+ QSpinBox *mCustomDays;
+};
+
+#endif
diff --git a/kontact/plugins/specialdates/sdsummarywidget.cpp b/kontact/plugins/specialdates/sdsummarywidget.cpp
new file mode 100644
index 000000000..721073490
--- /dev/null
+++ b/kontact/plugins/specialdates/sdsummarywidget.cpp
@@ -0,0 +1,637 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
+ Copyright (c) 2004 Allen Winter <winter@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#include <qcursor.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qimage.h>
+#include <qtooltip.h>
+
+#include <dcopclient.h>
+#include <dcopref.h>
+#include <kabc/stdaddressbook.h>
+#include <korganizer/stdcalendar.h>
+#include <kapplication.h>
+#include <kdialog.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kparts/part.h>
+#include <kpopupmenu.h>
+#include <kstandarddirs.h>
+#include <kurllabel.h>
+#include <libkcal/event.h>
+#include <libkcal/resourcecalendar.h>
+#include <libkcal/resourcelocal.h>
+#include <libkdepim/kpimprefs.h>
+
+#include "core.h"
+#include "plugin.h"
+
+#include "sdsummarywidget.h"
+
+enum SDIncidenceType {
+ IncidenceTypeContact, IncidenceTypeEvent
+};
+enum SDCategory {
+ CategoryBirthday, CategoryAnniversary, CategoryHoliday, CategoryOther
+};
+
+class SDEntry
+{
+ public:
+ SDIncidenceType type;
+ SDCategory category;
+ int yearsOld;
+ int daysTo;
+ QDate date;
+ QString summary;
+ QString desc;
+ int span; // #days in the special occassion.
+ KABC::Addressee addressee;
+
+ bool operator<( const SDEntry &entry ) const
+ {
+ return daysTo < entry.daysTo;
+ }
+};
+
+SDSummaryWidget::SDSummaryWidget( Kontact::Plugin *plugin, QWidget *parent,
+ const char *name )
+ : Kontact::Summary( parent, name ), mPlugin( plugin ), mCalendar( 0 ), mHolidays( 0 )
+{
+ // Create the Summary Layout
+ QVBoxLayout *mainLayout = new QVBoxLayout( this, 3, 3 );
+
+ QPixmap icon = KGlobal::iconLoader()->loadIcon( "cookie",
+ KIcon::Desktop, KIcon::SizeMedium );
+
+ QWidget *header = createHeader( this, icon, i18n( "Special Dates" ) );
+ mainLayout->addWidget(header);
+
+ mLayout = new QGridLayout( mainLayout, 7, 6, 3 );
+ mLayout->setRowStretch( 6, 1 );
+
+ // Setup the Addressbook
+ KABC::StdAddressBook *ab = KABC::StdAddressBook::self( true );
+ connect( ab, SIGNAL( addressBookChanged( AddressBook* ) ),
+ this, SLOT( updateView() ) );
+ connect( mPlugin->core(), SIGNAL( dayChanged( const QDate& ) ),
+ this, SLOT( updateView() ) );
+
+ // Setup the Calendar
+ mCalendar = new KCal::CalendarResources( KPimPrefs::timezone() );
+ mCalendar->readConfig();
+
+ KCal::CalendarResourceManager *manager = mCalendar->resourceManager();
+ if ( manager->isEmpty() ) {
+ KConfig config( "korganizerrc" );
+ config.setGroup( "General" );
+ QString fileName = config.readPathEntry( "Active Calendar" );
+
+ QString resourceName;
+ if ( fileName.isEmpty() ) {
+ fileName = locateLocal( "data", "korganizer/std.ics" );
+ resourceName = i18n( "Default KOrganizer resource" );
+ } else {
+ resourceName = i18n( "Active Calendar" );
+ }
+
+ KCal::ResourceCalendar *defaultResource =
+ new KCal::ResourceLocal( fileName );
+
+ defaultResource->setResourceName( resourceName );
+
+ manager->add( defaultResource );
+ manager->setStandardResource( defaultResource );
+ }
+ mCalendar = KOrg::StdCalendar::self();
+ mCalendar->load();
+
+ connect( mCalendar, SIGNAL( calendarChanged() ),
+ this, SLOT( updateView() ) );
+ connect( mPlugin->core(), SIGNAL( dayChanged( const QDate& ) ),
+ this, SLOT( updateView() ) );
+
+ // Update Configuration
+ configUpdated();
+}
+
+void SDSummaryWidget::configUpdated()
+{
+ KConfig config( "kcmsdsummaryrc" );
+
+ config.setGroup( "Days" );
+ mDaysAhead = config.readNumEntry( "DaysToShow", 7 );
+
+ config.setGroup( "EventTypes" );
+ mShowBirthdaysFromKAB =
+ config.readBoolEntry( "ShowBirthdaysFromContacts", true );
+ mShowBirthdaysFromCal =
+ config.readBoolEntry( "ShowBirthdaysFromCalendar", true );
+
+ mShowAnniversariesFromKAB =
+ config.readBoolEntry( "ShowAnniversariesFromContacts", true );
+ mShowAnniversariesFromCal =
+ config.readBoolEntry( "ShowAnniversariesFromCalendar", true );
+
+ mShowHolidays =
+ config.readBoolEntry( "ShowHolidays", true );
+
+ mShowSpecialsFromCal =
+ config.readBoolEntry( "ShowSpecialsFromCalendar", true );
+
+ updateView();
+}
+
+bool SDSummaryWidget::initHolidays()
+{
+ KConfig hconfig( "korganizerrc" );
+ hconfig.setGroup( "Time & Date" );
+ QString location = hconfig.readEntry( "Holidays" );
+ if ( !location.isEmpty() ) {
+ if ( mHolidays ) delete mHolidays;
+ mHolidays = new KHolidays( location );
+ return true;
+ }
+ return false;
+}
+
+// number of days remaining in an Event
+int SDSummaryWidget::span( KCal::Event *event )
+{
+ int span=1;
+ if ( event->isMultiDay() && event->doesFloat() ) {
+ QDate d = event->dtStart().date();
+ if ( d < QDate::currentDate() ) {
+ d = QDate::currentDate();
+ }
+ while ( d < event->dtEnd().date() ) {
+ span++;
+ d=d.addDays( 1 );
+ }
+ }
+ return span;
+}
+
+// day of a multiday Event
+int SDSummaryWidget::dayof( KCal::Event *event, const QDate& date )
+{
+ int dayof=1;
+ QDate d = event->dtStart().date();
+ if ( d < QDate::currentDate() ) {
+ d = QDate::currentDate();
+ }
+ while ( d < event->dtEnd().date() ) {
+ if ( d < date ) {
+ dayof++;
+ }
+ d = d.addDays( 1 );
+ }
+ return dayof;
+}
+
+
+
+void SDSummaryWidget::updateView()
+{
+ mLabels.setAutoDelete( true );
+ mLabels.clear();
+ mLabels.setAutoDelete( false );
+
+ KABC::StdAddressBook *ab = KABC::StdAddressBook::self( true );
+ QValueList<SDEntry> dates;
+ QLabel *label = 0;
+
+ // No reason to show the date year
+ QString savefmt = KGlobal::locale()->dateFormat();
+ KGlobal::locale()->setDateFormat( KGlobal::locale()->
+ dateFormat().replace( 'Y', ' ' ) );
+
+ // Search for Birthdays and Anniversaries in the Addressbook
+ KABC::AddressBook::Iterator it;
+ for ( it = ab->begin(); it != ab->end(); ++it ) {
+ QDate birthday = (*it).birthday().date();
+ if ( birthday.isValid() && mShowBirthdaysFromKAB ) {
+ SDEntry entry;
+ entry.type = IncidenceTypeContact;
+ entry.category = CategoryBirthday;
+ dateDiff( birthday, entry.daysTo, entry.yearsOld );
+
+ entry.date = birthday;
+ entry.addressee = *it;
+ entry.span = 1;
+ if ( entry.daysTo <= mDaysAhead )
+ dates.append( entry );
+ }
+
+ QString anniversaryAsString =
+ (*it).custom( "KADDRESSBOOK" , "X-Anniversary" );
+ if ( !anniversaryAsString.isEmpty() ) {
+ QDate anniversary = QDate::fromString( anniversaryAsString, Qt::ISODate );
+ if ( anniversary.isValid() && mShowAnniversariesFromKAB ) {
+ SDEntry entry;
+ entry.type = IncidenceTypeContact;
+ entry.category = CategoryAnniversary;
+ dateDiff( anniversary, entry.daysTo, entry.yearsOld );
+
+ entry.date = anniversary;
+ entry.addressee = *it;
+ entry.span = 1;
+ if ( entry.daysTo <= mDaysAhead )
+ dates.append( entry );
+ }
+ }
+ }
+
+ // Search for Birthdays, Anniversaries, Holidays, and Special Occasions
+ // in the Calendar
+ QDate dt;
+ QDate currentDate = QDate::currentDate();
+ for ( dt=currentDate;
+ dt<=currentDate.addDays( mDaysAhead - 1 );
+ dt=dt.addDays(1) ) {
+ KCal::Event::List events = mCalendar->events( dt,
+ KCal::EventSortStartDate,
+ KCal::SortDirectionAscending );
+ KCal::Event *ev;
+ KCal::Event::List::ConstIterator it;
+ for ( it=events.begin(); it!=events.end(); ++it ) {
+ ev = *it;
+ if ( !ev->categoriesStr().isEmpty() ) {
+ QStringList::ConstIterator it2;
+ QStringList c = ev->categories();
+ for ( it2=c.begin(); it2!=c.end(); ++it2 ) {
+
+ // Append Birthday Event?
+ if ( mShowBirthdaysFromCal &&
+ ( ( *it2 ).upper() == i18n( "BIRTHDAY" ) ) ) {
+ SDEntry entry;
+ entry.type = IncidenceTypeEvent;
+ entry.category = CategoryBirthday;
+ entry.date = dt;
+ entry.summary = ev->summary();
+ entry.desc = ev->description();
+ dateDiff( ev->dtStart().date(), entry.daysTo, entry.yearsOld );
+ entry.span = 1;
+ dates.append( entry );
+ break;
+ }
+
+ // Append Anniversary Event?
+ if ( mShowAnniversariesFromCal &&
+ ( ( *it2 ).upper() == i18n( "ANNIVERSARY" ) ) ) {
+ SDEntry entry;
+ entry.type = IncidenceTypeEvent;
+ entry.category = CategoryAnniversary;
+ entry.date = dt;
+ entry.summary = ev->summary();
+ entry.desc = ev->description();
+ dateDiff( ev->dtStart().date(), entry.daysTo, entry.yearsOld );
+ entry.span = 1;
+ dates.append( entry );
+ break;
+ }
+
+ // Append Holiday Event?
+ if ( mShowHolidays &&
+ ( ( *it2 ).upper() == i18n( "HOLIDAY" ) ) ) {
+ SDEntry entry;
+ entry.type = IncidenceTypeEvent;
+ entry.category = CategoryHoliday;
+ entry.date = dt;
+ entry.summary = ev->summary();
+ entry.desc = ev->description();
+ dateDiff( dt, entry.daysTo, entry.yearsOld );
+ entry.yearsOld = -1; //ignore age of holidays
+ entry.span = span( ev );
+ if ( entry.span > 1 && dayof( ev, dt ) > 1 ) // skip days 2,3,...
+ break;
+ dates.append( entry );
+ break;
+ }
+
+ // Append Special Occasion Event?
+ if ( mShowSpecialsFromCal &&
+ ( ( *it2 ).upper() == i18n( "SPECIAL OCCASION" ) ) ) {
+ SDEntry entry;
+ entry.type = IncidenceTypeEvent;
+ entry.category = CategoryOther;
+ entry.date = dt;
+ entry.summary = ev->summary();
+ entry.desc = ev->description();
+ dateDiff( dt, entry.daysTo, entry.yearsOld );
+ entry.yearsOld = -1; //ignore age of special occasions
+ entry.span = span( ev );
+ if ( entry.span > 1 && dayof( ev, dt ) > 1 ) // skip days 2,3,...
+ break;
+ dates.append( entry );
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Seach for Holidays
+ if ( mShowHolidays ) {
+ if ( initHolidays() ) {
+ for ( dt=currentDate;
+ dt<=currentDate.addDays( mDaysAhead - 1 );
+ dt=dt.addDays(1) ) {
+ QValueList<KHoliday> holidays = mHolidays->getHolidays( dt );
+ QValueList<KHoliday>::ConstIterator it = holidays.begin();
+ for ( ; it != holidays.end(); ++it ) {
+ SDEntry entry;
+ entry.type = IncidenceTypeEvent;
+ entry.category = ((*it).Category==KHolidays::HOLIDAY)?CategoryHoliday:CategoryOther;
+ entry.date = dt;
+ entry.summary = (*it).text;
+ dateDiff( dt, entry.daysTo, entry.yearsOld );
+ entry.yearsOld = -1; //ignore age of holidays
+ entry.span = 1;
+ dates.append( entry );
+ }
+ }
+ }
+ }
+
+ // Sort, then Print the Special Dates
+ qHeapSort( dates );
+
+ if ( !dates.isEmpty() ) {
+ int counter = 0;
+ QValueList<SDEntry>::Iterator addrIt;
+ QString lines;
+ for ( addrIt = dates.begin(); addrIt != dates.end(); ++addrIt ) {
+ bool makeBold = (*addrIt).daysTo == 0; // i.e., today
+
+ // Pixmap
+ QImage icon_img;
+ QString icon_name;
+ KABC::Picture pic;
+ switch( (*addrIt).category ) { // TODO: better icons
+ case CategoryBirthday:
+ icon_name = "cookie";
+ pic = (*addrIt).addressee.photo();
+ if ( pic.isIntern() && !pic.data().isNull() ) {
+ QImage img = pic.data();
+ if ( img.width() > img.height() ) {
+ icon_img = img.scaleWidth( 32 );
+ } else {
+ icon_img = img.scaleHeight( 32 );
+ }
+ }
+ break;
+ case CategoryAnniversary:
+ icon_name = "kdmconfig";
+ pic = (*addrIt).addressee.photo();
+ if ( pic.isIntern() && !pic.data().isNull() ) {
+ QImage img = pic.data();
+ if ( img.width() > img.height() ) {
+ icon_img = img.scaleWidth( 32 );
+ } else {
+ icon_img = img.scaleHeight( 32 );
+ }
+ }
+ break;
+ case CategoryHoliday:
+ icon_name = "kdmconfig"; break;
+ case CategoryOther:
+ icon_name = "cookie"; break;
+ }
+ label = new QLabel( this );
+ if ( icon_img.isNull() ) {
+ label->setPixmap( KGlobal::iconLoader()->loadIcon( icon_name,
+ KIcon::Small ) );
+ } else {
+ label->setPixmap( icon_img );
+ }
+ label->setMaximumWidth( label->minimumSizeHint().width() );
+ label->setAlignment( AlignVCenter );
+ mLayout->addWidget( label, counter, 0 );
+ mLabels.append( label );
+
+ // Event date
+ QString datestr;
+
+ //Muck with the year -- change to the year 'daysTo' days away
+ int year = currentDate.addDays( (*addrIt).daysTo ).year();
+ QDate sD = QDate::QDate( year,
+ (*addrIt).date.month(), (*addrIt).date.day() );
+
+ if ( (*addrIt).daysTo == 0 ) {
+ datestr = i18n( "Today" );
+ } else if ( (*addrIt).daysTo == 1 ) {
+ datestr = i18n( "Tomorrow" );
+ } else {
+ datestr = KGlobal::locale()->formatDate( sD );
+ }
+ // Print the date span for multiday, floating events, for the
+ // first day of the event only.
+ if ( (*addrIt).span > 1 ) {
+ QString endstr =
+ KGlobal::locale()->formatDate( sD.addDays( (*addrIt).span - 1 ) );
+ datestr += " -\n " + endstr;
+ }
+
+ label = new QLabel( datestr, this );
+ label->setAlignment( AlignLeft | AlignVCenter );
+ mLayout->addWidget( label, counter, 1 );
+ mLabels.append( label );
+ if ( makeBold ) {
+ QFont font = label->font();
+ font.setBold( true );
+ label->setFont( font );
+ }
+
+ // Countdown
+ label = new QLabel( this );
+ if ( (*addrIt).daysTo == 0 ) {
+ label->setText( i18n( "now" ) );
+ } else {
+ label->setText( i18n( "in 1 day", "in %n days", (*addrIt).daysTo ) );
+ }
+
+ label->setAlignment( AlignLeft | AlignVCenter );
+ mLayout->addWidget( label, counter, 2 );
+ mLabels.append( label );
+
+ // What
+ QString what;
+ switch( (*addrIt).category ) {
+ case CategoryBirthday:
+ what = i18n( "Birthday" ); break;
+ case CategoryAnniversary:
+ what = i18n( "Anniversary" ); break;
+ case CategoryHoliday:
+ what = i18n( "Holiday" ); break;
+ case CategoryOther:
+ what = i18n( "Special Occasion" ); break;
+ }
+ label = new QLabel( this );
+ label->setText( what );
+ label->setAlignment( AlignLeft | AlignVCenter );
+ mLayout->addWidget( label, counter, 3 );
+ mLabels.append( label );
+
+ // Description
+ if ( (*addrIt).type == IncidenceTypeContact ) {
+ KURLLabel *urlLabel = new KURLLabel( this );
+ urlLabel->installEventFilter( this );
+ urlLabel->setURL( (*addrIt).addressee.uid() );
+ urlLabel->setText( (*addrIt).addressee.realName() );
+ urlLabel->setTextFormat( Qt::RichText );
+ mLayout->addWidget( urlLabel, counter, 4 );
+ mLabels.append( urlLabel );
+
+ connect( urlLabel, SIGNAL( leftClickedURL( const QString& ) ),
+ this, SLOT( mailContact( const QString& ) ) );
+ connect( urlLabel, SIGNAL( rightClickedURL( const QString& ) ),
+ this, SLOT( popupMenu( const QString& ) ) );
+ } else {
+ label = new QLabel( this );
+ label->setText( (*addrIt).summary );
+ label->setTextFormat( Qt::RichText );
+ mLayout->addWidget( label, counter, 4 );
+ mLabels.append( label );
+ if ( !(*addrIt).desc.isEmpty() ) {
+ QToolTip::add( label, (*addrIt).desc );
+ }
+ }
+
+ // Age
+ if ( (*addrIt).category == CategoryBirthday ||
+ (*addrIt).category == CategoryAnniversary ) {
+ label = new QLabel( this );
+ if ( (*addrIt).yearsOld <= 0 ) {
+ label->setText( "" );
+ } else {
+ label->setText( i18n( "one year", "%n years", (*addrIt).yearsOld ) );
+ }
+ label->setAlignment( AlignLeft | AlignVCenter );
+ mLayout->addWidget( label, counter, 5 );
+ mLabels.append( label );
+ }
+
+ counter++;
+ }
+ } else {
+ label = new QLabel(
+ i18n( "No special dates within the next 1 day",
+ "No special dates pending within the next %n days",
+ mDaysAhead ), this, "nothing to see" );
+ label->setAlignment( AlignHCenter | AlignVCenter );
+ mLayout->addMultiCellWidget( label, 0, 0, 0, 4 );
+ mLabels.append( label );
+ }
+
+ for ( label = mLabels.first(); label; label = mLabels.next() )
+ label->show();
+
+ KGlobal::locale()->setDateFormat( savefmt );
+}
+
+void SDSummaryWidget::mailContact( const QString &uid )
+{
+ KABC::StdAddressBook *ab = KABC::StdAddressBook::self( true );
+ QString email = ab->findByUid( uid ).fullEmail();
+
+ kapp->invokeMailer( email, QString::null );
+}
+
+void SDSummaryWidget::viewContact( const QString &uid )
+{
+ if ( !mPlugin->isRunningStandalone() )
+ mPlugin->core()->selectPlugin( "kontact_kaddressbookplugin" );
+ else
+ mPlugin->bringToForeground();
+
+ DCOPRef dcopCall( "kaddressbook", "KAddressBookIface" );
+ dcopCall.send( "showContactEditor(QString)", uid );
+}
+
+void SDSummaryWidget::popupMenu( const QString &uid )
+{
+ KPopupMenu popup( this );
+ popup.insertItem( KGlobal::iconLoader()->loadIcon( "kmail", KIcon::Small ),
+ i18n( "Send &Mail" ), 0 );
+ popup.insertItem( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Small ),
+ i18n( "View &Contact" ), 1 );
+
+ switch ( popup.exec( QCursor::pos() ) ) {
+ case 0:
+ mailContact( uid );
+ break;
+ case 1:
+ viewContact( uid );
+ break;
+ }
+}
+
+bool SDSummaryWidget::eventFilter( QObject *obj, QEvent* e )
+{
+ if ( obj->inherits( "KURLLabel" ) ) {
+ KURLLabel* label = static_cast<KURLLabel*>( obj );
+ if ( e->type() == QEvent::Enter )
+ emit message( i18n( "Mail to:\"%1\"" ).arg( label->text() ) );
+ if ( e->type() == QEvent::Leave )
+ emit message( QString::null );
+ }
+
+ return Kontact::Summary::eventFilter( obj, e );
+}
+
+void SDSummaryWidget::dateDiff( const QDate &date, int &days, int &years )
+{
+ QDate currentDate;
+ QDate eventDate;
+
+ if ( QDate::leapYear( date.year() ) && date.month() == 2 && date.day() == 29 ) {
+ currentDate = QDate( date.year(), QDate::currentDate().month(), QDate::currentDate().day() );
+ if ( !QDate::leapYear( QDate::currentDate().year() ) )
+ eventDate = QDate( date.year(), date.month(), 28 ); // celebrate one day earlier ;)
+ else
+ eventDate = QDate( date.year(), date.month(), date.day() );
+ } else {
+ currentDate = QDate( 0, QDate::currentDate().month(), QDate::currentDate().day() );
+ eventDate = QDate( 0, date.month(), date.day() );
+ }
+
+ int offset = currentDate.daysTo( eventDate );
+ if ( offset < 0 ) {
+ days = 365 + offset;
+ years = QDate::currentDate().year() + 1 - date.year();
+ } else {
+ days = offset;
+ years = QDate::currentDate().year() - date.year();
+ }
+}
+
+QStringList SDSummaryWidget::configModules() const
+{
+ return QStringList( "kcmsdsummary.desktop" );
+}
+
+#include "sdsummarywidget.moc"
diff --git a/kontact/plugins/specialdates/sdsummarywidget.h b/kontact/plugins/specialdates/sdsummarywidget.h
new file mode 100644
index 000000000..74cd08942
--- /dev/null
+++ b/kontact/plugins/specialdates/sdsummarywidget.h
@@ -0,0 +1,84 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
+ Copyright (c) 2004 Allen Winter <winter@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#ifndef SDSUMMARYWIDGET_H
+#define SDSUMMARYWIDGET_H
+
+#include <qptrlist.h>
+#include <qwidget.h>
+
+#include <libkcal/calendarresources.h>
+#include <libkholidays/kholidays.h>
+
+#include "summary.h"
+
+namespace Kontact {
+ class Plugin;
+}
+
+class QGridLayout;
+class QLabel;
+
+class SDSummaryWidget : public Kontact::Summary
+{
+ Q_OBJECT
+
+ public:
+ SDSummaryWidget( Kontact::Plugin *plugin, QWidget *parent,
+ const char *name = 0 );
+
+ QStringList configModules() const;
+ void configUpdated();
+ void updateSummary( bool force = false ) { Q_UNUSED( force ); updateView(); }
+
+ protected:
+ virtual bool eventFilter( QObject *obj, QEvent* e );
+
+ private slots:
+ void updateView();
+ void popupMenu( const QString &uid );
+ void mailContact( const QString &uid );
+ void viewContact( const QString &uid );
+
+ private:
+ int span( KCal::Event *event );
+ int dayof( KCal::Event *event, const QDate &date );
+ bool initHolidays();
+ void dateDiff( const QDate &date, int &days, int &years );
+ QGridLayout *mLayout;
+ QPtrList<QLabel> mLabels;
+ Kontact::Plugin *mPlugin;
+ KCal::CalendarResources *mCalendar;
+ int mDaysAhead;
+ bool mShowBirthdaysFromKAB;
+ bool mShowBirthdaysFromCal;
+ bool mShowAnniversariesFromKAB;
+ bool mShowAnniversariesFromCal;
+ bool mShowHolidays;
+ bool mShowSpecialsFromCal;
+
+ KHolidays::KHolidays *mHolidays;
+};
+
+#endif
diff --git a/kontact/plugins/specialdates/specialdates_plugin.cpp b/kontact/plugins/specialdates/specialdates_plugin.cpp
new file mode 100644
index 000000000..f0149fd9a
--- /dev/null
+++ b/kontact/plugins/specialdates/specialdates_plugin.cpp
@@ -0,0 +1,70 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
+ Copyright (c) 2004-2005 Allen Winter <winter@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#include <kaboutdata.h>
+#include <kgenericfactory.h>
+#include <klocale.h>
+#include <kparts/componentfactory.h>
+
+#include "core.h"
+#include "sdsummarywidget.h"
+
+#include "specialdates_plugin.h"
+
+typedef KGenericFactory< SpecialdatesPlugin, Kontact::Core > SpecialdatesPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libkontact_specialdatesplugin,
+ SpecialdatesPluginFactory( "kontact_specialdatesplugin" ) )
+
+SpecialdatesPlugin::SpecialdatesPlugin( Kontact::Core *core, const char *name, const QStringList& )
+ : Kontact::Plugin( core, core, name ),
+ mAboutData( 0 )
+{
+ setInstance( SpecialdatesPluginFactory::instance() );
+}
+
+SpecialdatesPlugin::~SpecialdatesPlugin()
+{
+}
+
+Kontact::Summary *SpecialdatesPlugin::createSummaryWidget( QWidget *parentWidget )
+{
+ return new SDSummaryWidget( this, parentWidget );
+}
+
+const KAboutData *SpecialdatesPlugin::aboutData()
+{
+ if ( !mAboutData ) {
+ mAboutData = new KAboutData( "specialdates",
+ I18N_NOOP( "Special Dates Summary" ),
+ "1.0",
+ I18N_NOOP( "Kontact Special Dates Summary" ),
+ KAboutData::License_LGPL,
+ I18N_NOOP( "(c) 2004-2005 The KDE PIM Team" ) );
+ mAboutData->addAuthor( "Allen Winter", "Current Maintainer", "winter@kde.org" );
+ mAboutData->addAuthor( "Tobias Koenig", "", "tokoe@kde.org" );
+ mAboutData->setProductName( "kontact/specialdates" );
+ }
+
+ return mAboutData;
+}
diff --git a/kontact/plugins/specialdates/specialdates_plugin.h b/kontact/plugins/specialdates/specialdates_plugin.h
new file mode 100644
index 000000000..6534afb5c
--- /dev/null
+++ b/kontact/plugins/specialdates/specialdates_plugin.h
@@ -0,0 +1,52 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
+ Copyright (c) 2004 Allen Winter <winter@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#ifndef SPECIALDATES_PLUGIN_H
+#define SPECIALDATES_PLUGIN_H
+
+#include "plugin.h"
+
+class SDSummaryWidget;
+
+class SpecialdatesPlugin : public Kontact::Plugin
+{
+ public:
+ SpecialdatesPlugin( Kontact::Core *core, const char *name, const QStringList& );
+ ~SpecialdatesPlugin();
+
+ int weight() const { return 310; }
+
+ const KAboutData *aboutData();
+
+ virtual Kontact::Summary *createSummaryWidget( QWidget *parentWidget );
+
+ protected:
+ virtual KParts::ReadOnlyPart *createPart() { return false; }
+
+ private:
+ KAboutData *mAboutData;
+
+};
+
+#endif
diff --git a/kontact/plugins/specialdates/specialdatesplugin.desktop b/kontact/plugins/specialdates/specialdatesplugin.desktop
new file mode 100644
index 000000000..bceb13ada
--- /dev/null
+++ b/kontact/plugins/specialdates/specialdatesplugin.desktop
@@ -0,0 +1,92 @@
+[Desktop Entry]
+Type=Service
+Icon=cookie
+ServiceTypes=Kontact/Plugin,KPluginInfo
+
+X-KDE-Library=libkontact_specialdatesplugin
+X-KDE-KontactPluginVersion=6
+X-KDE-KontactPluginHasPart=false
+X-KDE-KontactPluginHasSummary=true
+
+X-KDE-PluginInfo-Name=kontact_specialdatesplugin
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+
+Name=Special Dates
+Name[af]=Spesiale datums
+Name[ar]=التواريخ المرقومة
+Name[bg]=Специални случаи
+Name[br]=Deiziadoù dibar
+Name[ca]=Dates especials
+Name[cs]=Speciální data
+Name[da]=Særlige datoer
+Name[de]=Besondere Termine
+Name[el]=Σημαντικές ημερομηνίες
+Name[eo]=Specialaj Datoj
+Name[es]=Fechas especiales
+Name[et]=Tähtpäevad
+Name[eu]=Data bereziak
+Name[fa]=تاریخهای ویژه
+Name[fi]=Erikoispäivät
+Name[fr]=Dates importantes
+Name[fy]=Spesjale datums
+Name[ga]=Dátaí Speisialta
+Name[gl]=Datas Especiais
+Name[he]=תאריכים מיוחדים
+Name[hu]=Fontos dátumok
+Name[is]=Sérstakir dagar
+Name[it]=Date speciali
+Name[ja]=特別な日
+Name[ka]=განსაკუტრებული თარიღები
+Name[kk]=Ерекше күндер
+Name[km]=ថ្ងៃ​ពិសេស
+Name[lt]=Ypatingos datos
+Name[mk]=Специјални датуми
+Name[ms]=Tarikh Khusus
+Name[nb]=Spesielle datoer
+Name[nds]=Besünner Daag
+Name[ne]=विशेष मिति
+Name[nl]=Speciale data
+Name[nn]=Spesielle datoar
+Name[pl]=Daty specjalne
+Name[pt]=Datas Especiais
+Name[pt_BR]=Datas Especiais
+Name[ru]=Особые даты
+Name[sk]=Špeciálne dátumy
+Name[sl]=Posebni datumi
+Name[sr]=Посебни датуми
+Name[sr@Latn]=Posebni datumi
+Name[sv]=Speciella datum
+Name[ta]=விசேஷ தேதிகள்
+Name[th]=วันพิเศษ
+Name[tr]=Özel Tarihler
+Name[uk]=Особливі дати
+Name[uz]=Maxsus kunlar
+Name[uz@cyrillic]=Махсус кунлар
+Name[zh_CN]=特殊日期
+Name[zh_TW]=特殊日期
+Comment=Special Dates Component
+Comment[bg]=Обобщение на специалните случаи
+Comment[ca]=Component de dates especials
+Comment[da]=Komponent til særlige datoer
+Comment[de]=Komponente für Übersicht über besondere Termine
+Comment[el]=Συστατικό σημαντικών ημερομηνιών
+Comment[es]=Componente de fechas especiales
+Comment[et]=Tähtpäevade plugin
+Comment[fr]=Composant des dates importantes
+Comment[is]=Eining fyrir sérstaka daga
+Comment[it]=Componente per le date speciali
+Comment[ja]=特別な日コンポーネント
+Comment[km]=សមាសភាគ​កាលបរិច្ឆេទ​ពិសេស
+Comment[nds]=Komponent för besünner Daten
+Comment[nl]=Component voor overzicht van speciale data
+Comment[pl]=Składnik dat specjalnych
+Comment[pt_BR]=Componente de Datas Especiais
+Comment[ru]=Особые даты
+Comment[sr]=Компонента посебних датума
+Comment[sr@Latn]=Komponenta posebnih datuma
+Comment[sv]=Speciella datumkomponent
+Comment[tr]=Özel Tarihler Bileşeni
+Comment[zh_CN]=特殊日期组件
+Comment[zh_TW]=特殊日期組件