kontact

sdsummarywidget.h
00001 /*
00002     This file is part of Kontact.
00003     Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
00004     Copyright (c) 2004 Allen Winter <winter@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of TQt, and distribute the resulting executable,
00022     without including the source code for TQt in the source distribution.
00023 */
00024 
00025 #ifndef SDSUMMARYWIDGET_H
00026 #define SDSUMMARYWIDGET_H
00027 
00028 #include <tqptrlist.h>
00029 #include <tqwidget.h>
00030 
00031 #include <libkcal/calendarresources.h>
00032 #include <libkholidays/kholidays.h>
00033 
00034 #include "summary.h"
00035 
00036 namespace Kontact {
00037   class Plugin;
00038 }
00039 
00040 class TQGridLayout;
00041 class TQLabel;
00042 
00043 class SDSummaryWidget : public Kontact::Summary
00044 {
00045   Q_OBJECT
00046   
00047 
00048   public:
00049     SDSummaryWidget( Kontact::Plugin *plugin, TQWidget *parent,
00050                      const char *name = 0 );
00051 
00052     TQStringList configModules() const;
00053     void configUpdated();
00054     void updateSummary( bool force = false ) { Q_UNUSED( force ); updateView(); }
00055 
00056   protected:
00057     virtual bool eventFilter( TQObject *obj, TQEvent* e );
00058 
00059   private slots:
00060     void updateView();
00061     void popupMenu( const TQString &uid );
00062     void mailContact( const TQString &uid );
00063     void viewContact( const TQString &uid );
00064 
00065   private:
00066     int span( KCal::Event *event );
00067     int dayof( KCal::Event *event, const TQDate &date );
00068     bool initHolidays();
00069     void dateDiff( const TQDate &date, int &days, int &years );
00070     TQGridLayout *mLayout;
00071     TQPtrList<TQLabel> mLabels;
00072     Kontact::Plugin *mPlugin;
00073     KCal::CalendarResources *mCalendar;
00074     int mDaysAhead;
00075     bool mShowBirthdaysFromKAB;
00076     bool mShowBirthdaysFromCal;
00077     bool mShowAnniversariesFromKAB;
00078     bool mShowAnniversariesFromCal;
00079     bool mShowHolidays;
00080     bool mShowSpecialsFromCal;
00081 
00082     KHolidays *mHolidays;
00083 };
00084 
00085 #endif