summaryrefslogtreecommitdiffstats
path: root/kontact/plugins/specialdates/sdsummarywidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kontact/plugins/specialdates/sdsummarywidget.cpp')
-rw-r--r--kontact/plugins/specialdates/sdsummarywidget.cpp182
1 files changed, 91 insertions, 91 deletions
diff --git a/kontact/plugins/specialdates/sdsummarywidget.cpp b/kontact/plugins/specialdates/sdsummarywidget.cpp
index 721073490..44c671559 100644
--- a/kontact/plugins/specialdates/sdsummarywidget.cpp
+++ b/kontact/plugins/specialdates/sdsummarywidget.cpp
@@ -22,11 +22,11 @@
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 <tqcursor.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqimage.h>
+#include <tqtooltip.h>
#include <dcopclient.h>
#include <dcopref.h>
@@ -65,9 +65,9 @@ class SDEntry
SDCategory category;
int yearsOld;
int daysTo;
- QDate date;
- QString summary;
- QString desc;
+ TQDate date;
+ TQString summary;
+ TQString desc;
int span; // #days in the special occassion.
KABC::Addressee addressee;
@@ -77,28 +77,28 @@ class SDEntry
}
};
-SDSummaryWidget::SDSummaryWidget( Kontact::Plugin *plugin, QWidget *parent,
+SDSummaryWidget::SDSummaryWidget( Kontact::Plugin *plugin, TQWidget *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 );
+ TQVBoxLayout *mainLayout = new TQVBoxLayout( this, 3, 3 );
- QPixmap icon = KGlobal::iconLoader()->loadIcon( "cookie",
+ TQPixmap icon = KGlobal::iconLoader()->loadIcon( "cookie",
KIcon::Desktop, KIcon::SizeMedium );
- QWidget *header = createHeader( this, icon, i18n( "Special Dates" ) );
+ TQWidget *header = createHeader( this, icon, i18n( "Special Dates" ) );
mainLayout->addWidget(header);
- mLayout = new QGridLayout( mainLayout, 7, 6, 3 );
+ mLayout = new TQGridLayout( 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() ) );
+ connect( ab, TQT_SIGNAL( addressBookChanged( AddressBook* ) ),
+ this, TQT_SLOT( updateView() ) );
+ connect( mPlugin->core(), TQT_SIGNAL( dayChanged( const TQDate& ) ),
+ this, TQT_SLOT( updateView() ) );
// Setup the Calendar
mCalendar = new KCal::CalendarResources( KPimPrefs::timezone() );
@@ -108,9 +108,9 @@ SDSummaryWidget::SDSummaryWidget( Kontact::Plugin *plugin, QWidget *parent,
if ( manager->isEmpty() ) {
KConfig config( "korganizerrc" );
config.setGroup( "General" );
- QString fileName = config.readPathEntry( "Active Calendar" );
+ TQString fileName = config.readPathEntry( "Active Calendar" );
- QString resourceName;
+ TQString resourceName;
if ( fileName.isEmpty() ) {
fileName = locateLocal( "data", "korganizer/std.ics" );
resourceName = i18n( "Default KOrganizer resource" );
@@ -129,10 +129,10 @@ SDSummaryWidget::SDSummaryWidget( Kontact::Plugin *plugin, QWidget *parent,
mCalendar = KOrg::StdCalendar::self();
mCalendar->load();
- connect( mCalendar, SIGNAL( calendarChanged() ),
- this, SLOT( updateView() ) );
- connect( mPlugin->core(), SIGNAL( dayChanged( const QDate& ) ),
- this, SLOT( updateView() ) );
+ connect( mCalendar, TQT_SIGNAL( calendarChanged() ),
+ this, TQT_SLOT( updateView() ) );
+ connect( mPlugin->core(), TQT_SIGNAL( dayChanged( const TQDate& ) ),
+ this, TQT_SLOT( updateView() ) );
// Update Configuration
configUpdated();
@@ -169,7 +169,7 @@ bool SDSummaryWidget::initHolidays()
{
KConfig hconfig( "korganizerrc" );
hconfig.setGroup( "Time & Date" );
- QString location = hconfig.readEntry( "Holidays" );
+ TQString location = hconfig.readEntry( "Holidays" );
if ( !location.isEmpty() ) {
if ( mHolidays ) delete mHolidays;
mHolidays = new KHolidays( location );
@@ -183,9 +183,9 @@ 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();
+ TQDate d = event->dtStart().date();
+ if ( d < TQDate::currentDate() ) {
+ d = TQDate::currentDate();
}
while ( d < event->dtEnd().date() ) {
span++;
@@ -196,12 +196,12 @@ int SDSummaryWidget::span( KCal::Event *event )
}
// day of a multiday Event
-int SDSummaryWidget::dayof( KCal::Event *event, const QDate& date )
+int SDSummaryWidget::dayof( KCal::Event *event, const TQDate& date )
{
int dayof=1;
- QDate d = event->dtStart().date();
- if ( d < QDate::currentDate() ) {
- d = QDate::currentDate();
+ TQDate d = event->dtStart().date();
+ if ( d < TQDate::currentDate() ) {
+ d = TQDate::currentDate();
}
while ( d < event->dtEnd().date() ) {
if ( d < date ) {
@@ -221,18 +221,18 @@ void SDSummaryWidget::updateView()
mLabels.setAutoDelete( false );
KABC::StdAddressBook *ab = KABC::StdAddressBook::self( true );
- QValueList<SDEntry> dates;
- QLabel *label = 0;
+ TQValueList<SDEntry> dates;
+ TQLabel *label = 0;
// No reason to show the date year
- QString savefmt = KGlobal::locale()->dateFormat();
+ TQString 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();
+ TQDate birthday = (*it).birthday().date();
if ( birthday.isValid() && mShowBirthdaysFromKAB ) {
SDEntry entry;
entry.type = IncidenceTypeContact;
@@ -246,10 +246,10 @@ void SDSummaryWidget::updateView()
dates.append( entry );
}
- QString anniversaryAsString =
+ TQString anniversaryAsString =
(*it).custom( "KADDRESSBOOK" , "X-Anniversary" );
if ( !anniversaryAsString.isEmpty() ) {
- QDate anniversary = QDate::fromString( anniversaryAsString, Qt::ISODate );
+ TQDate anniversary = TQDate::fromString( anniversaryAsString, Qt::ISODate );
if ( anniversary.isValid() && mShowAnniversariesFromKAB ) {
SDEntry entry;
entry.type = IncidenceTypeContact;
@@ -267,8 +267,8 @@ void SDSummaryWidget::updateView()
// Search for Birthdays, Anniversaries, Holidays, and Special Occasions
// in the Calendar
- QDate dt;
- QDate currentDate = QDate::currentDate();
+ TQDate dt;
+ TQDate currentDate = TQDate::currentDate();
for ( dt=currentDate;
dt<=currentDate.addDays( mDaysAhead - 1 );
dt=dt.addDays(1) ) {
@@ -280,8 +280,8 @@ void SDSummaryWidget::updateView()
for ( it=events.begin(); it!=events.end(); ++it ) {
ev = *it;
if ( !ev->categoriesStr().isEmpty() ) {
- QStringList::ConstIterator it2;
- QStringList c = ev->categories();
+ TQStringList::ConstIterator it2;
+ TQStringList c = ev->categories();
for ( it2=c.begin(); it2!=c.end(); ++it2 ) {
// Append Birthday Event?
@@ -360,8 +360,8 @@ void SDSummaryWidget::updateView()
for ( dt=currentDate;
dt<=currentDate.addDays( mDaysAhead - 1 );
dt=dt.addDays(1) ) {
- QValueList<KHoliday> holidays = mHolidays->getHolidays( dt );
- QValueList<KHoliday>::ConstIterator it = holidays.begin();
+ TQValueList<KHoliday> holidays = mHolidays->getHolidays( dt );
+ TQValueList<KHoliday>::ConstIterator it = holidays.begin();
for ( ; it != holidays.end(); ++it ) {
SDEntry entry;
entry.type = IncidenceTypeEvent;
@@ -382,21 +382,21 @@ void SDSummaryWidget::updateView()
if ( !dates.isEmpty() ) {
int counter = 0;
- QValueList<SDEntry>::Iterator addrIt;
- QString lines;
+ TQValueList<SDEntry>::Iterator addrIt;
+ TQString lines;
for ( addrIt = dates.begin(); addrIt != dates.end(); ++addrIt ) {
bool makeBold = (*addrIt).daysTo == 0; // i.e., today
// Pixmap
- QImage icon_img;
- QString icon_name;
+ TQImage icon_img;
+ TQString 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();
+ TQImage img = pic.data();
if ( img.width() > img.height() ) {
icon_img = img.scaleWidth( 32 );
} else {
@@ -408,7 +408,7 @@ void SDSummaryWidget::updateView()
icon_name = "kdmconfig";
pic = (*addrIt).addressee.photo();
if ( pic.isIntern() && !pic.data().isNull() ) {
- QImage img = pic.data();
+ TQImage img = pic.data();
if ( img.width() > img.height() ) {
icon_img = img.scaleWidth( 32 );
} else {
@@ -421,7 +421,7 @@ void SDSummaryWidget::updateView()
case CategoryOther:
icon_name = "cookie"; break;
}
- label = new QLabel( this );
+ label = new TQLabel( this );
if ( icon_img.isNull() ) {
label->setPixmap( KGlobal::iconLoader()->loadIcon( icon_name,
KIcon::Small ) );
@@ -434,11 +434,11 @@ void SDSummaryWidget::updateView()
mLabels.append( label );
// Event date
- QString datestr;
+ TQString datestr;
//Muck with the year -- change to the year 'daysTo' days away
int year = currentDate.addDays( (*addrIt).daysTo ).year();
- QDate sD = QDate::QDate( year,
+ TQDate sD = TQDate::TQDate( year,
(*addrIt).date.month(), (*addrIt).date.day() );
if ( (*addrIt).daysTo == 0 ) {
@@ -451,23 +451,23 @@ void SDSummaryWidget::updateView()
// Print the date span for multiday, floating events, for the
// first day of the event only.
if ( (*addrIt).span > 1 ) {
- QString endstr =
+ TQString endstr =
KGlobal::locale()->formatDate( sD.addDays( (*addrIt).span - 1 ) );
datestr += " -\n " + endstr;
}
- label = new QLabel( datestr, this );
+ label = new TQLabel( datestr, this );
label->setAlignment( AlignLeft | AlignVCenter );
mLayout->addWidget( label, counter, 1 );
mLabels.append( label );
if ( makeBold ) {
- QFont font = label->font();
+ TQFont font = label->font();
font.setBold( true );
label->setFont( font );
}
// Countdown
- label = new QLabel( this );
+ label = new TQLabel( this );
if ( (*addrIt).daysTo == 0 ) {
label->setText( i18n( "now" ) );
} else {
@@ -479,7 +479,7 @@ void SDSummaryWidget::updateView()
mLabels.append( label );
// What
- QString what;
+ TQString what;
switch( (*addrIt).category ) {
case CategoryBirthday:
what = i18n( "Birthday" ); break;
@@ -490,7 +490,7 @@ void SDSummaryWidget::updateView()
case CategoryOther:
what = i18n( "Special Occasion" ); break;
}
- label = new QLabel( this );
+ label = new TQLabel( this );
label->setText( what );
label->setAlignment( AlignLeft | AlignVCenter );
mLayout->addWidget( label, counter, 3 );
@@ -506,25 +506,25 @@ void SDSummaryWidget::updateView()
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& ) ) );
+ connect( urlLabel, TQT_SIGNAL( leftClickedURL( const TQString& ) ),
+ this, TQT_SLOT( mailContact( const TQString& ) ) );
+ connect( urlLabel, TQT_SIGNAL( rightClickedURL( const TQString& ) ),
+ this, TQT_SLOT( popupMenu( const TQString& ) ) );
} else {
- label = new QLabel( this );
+ label = new TQLabel( 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 );
+ TQToolTip::add( label, (*addrIt).desc );
}
}
// Age
if ( (*addrIt).category == CategoryBirthday ||
(*addrIt).category == CategoryAnniversary ) {
- label = new QLabel( this );
+ label = new TQLabel( this );
if ( (*addrIt).yearsOld <= 0 ) {
label->setText( "" );
} else {
@@ -538,7 +538,7 @@ void SDSummaryWidget::updateView()
counter++;
}
} else {
- label = new QLabel(
+ label = new TQLabel(
i18n( "No special dates within the next 1 day",
"No special dates pending within the next %n days",
mDaysAhead ), this, "nothing to see" );
@@ -553,15 +553,15 @@ void SDSummaryWidget::updateView()
KGlobal::locale()->setDateFormat( savefmt );
}
-void SDSummaryWidget::mailContact( const QString &uid )
+void SDSummaryWidget::mailContact( const TQString &uid )
{
KABC::StdAddressBook *ab = KABC::StdAddressBook::self( true );
- QString email = ab->findByUid( uid ).fullEmail();
+ TQString email = ab->findByUid( uid ).fullEmail();
- kapp->invokeMailer( email, QString::null );
+ kapp->invokeMailer( email, TQString::null );
}
-void SDSummaryWidget::viewContact( const QString &uid )
+void SDSummaryWidget::viewContact( const TQString &uid )
{
if ( !mPlugin->isRunningStandalone() )
mPlugin->core()->selectPlugin( "kontact_kaddressbookplugin" );
@@ -569,10 +569,10 @@ void SDSummaryWidget::viewContact( const QString &uid )
mPlugin->bringToForeground();
DCOPRef dcopCall( "kaddressbook", "KAddressBookIface" );
- dcopCall.send( "showContactEditor(QString)", uid );
+ dcopCall.send( "showContactEditor(TQString)", uid );
}
-void SDSummaryWidget::popupMenu( const QString &uid )
+void SDSummaryWidget::popupMenu( const TQString &uid )
{
KPopupMenu popup( this );
popup.insertItem( KGlobal::iconLoader()->loadIcon( "kmail", KIcon::Small ),
@@ -580,7 +580,7 @@ void SDSummaryWidget::popupMenu( const QString &uid )
popup.insertItem( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Small ),
i18n( "View &Contact" ), 1 );
- switch ( popup.exec( QCursor::pos() ) ) {
+ switch ( popup.exec( TQCursor::pos() ) ) {
case 0:
mailContact( uid );
break;
@@ -590,48 +590,48 @@ void SDSummaryWidget::popupMenu( const QString &uid )
}
}
-bool SDSummaryWidget::eventFilter( QObject *obj, QEvent* e )
+bool SDSummaryWidget::eventFilter( TQObject *obj, TQEvent* e )
{
if ( obj->inherits( "KURLLabel" ) ) {
KURLLabel* label = static_cast<KURLLabel*>( obj );
- if ( e->type() == QEvent::Enter )
+ if ( e->type() == TQEvent::Enter )
emit message( i18n( "Mail to:\"%1\"" ).arg( label->text() ) );
- if ( e->type() == QEvent::Leave )
- emit message( QString::null );
+ if ( e->type() == TQEvent::Leave )
+ emit message( TQString::null );
}
return Kontact::Summary::eventFilter( obj, e );
}
-void SDSummaryWidget::dateDiff( const QDate &date, int &days, int &years )
+void SDSummaryWidget::dateDiff( const TQDate &date, int &days, int &years )
{
- QDate currentDate;
- QDate eventDate;
+ TQDate currentDate;
+ TQDate 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 ;)
+ if ( TQDate::leapYear( date.year() ) && date.month() == 2 && date.day() == 29 ) {
+ currentDate = TQDate( date.year(), TQDate::currentDate().month(), TQDate::currentDate().day() );
+ if ( !TQDate::leapYear( TQDate::currentDate().year() ) )
+ eventDate = TQDate( date.year(), date.month(), 28 ); // celebrate one day earlier ;)
else
- eventDate = QDate( date.year(), date.month(), date.day() );
+ eventDate = TQDate( date.year(), date.month(), date.day() );
} else {
- currentDate = QDate( 0, QDate::currentDate().month(), QDate::currentDate().day() );
- eventDate = QDate( 0, date.month(), date.day() );
+ currentDate = TQDate( 0, TQDate::currentDate().month(), TQDate::currentDate().day() );
+ eventDate = TQDate( 0, date.month(), date.day() );
}
int offset = currentDate.daysTo( eventDate );
if ( offset < 0 ) {
days = 365 + offset;
- years = QDate::currentDate().year() + 1 - date.year();
+ years = TQDate::currentDate().year() + 1 - date.year();
} else {
days = offset;
- years = QDate::currentDate().year() - date.year();
+ years = TQDate::currentDate().year() - date.year();
}
}
-QStringList SDSummaryWidget::configModules() const
+TQStringList SDSummaryWidget::configModules() const
{
- return QStringList( "kcmsdsummary.desktop" );
+ return TQStringList( "kcmsdsummary.desktop" );
}
#include "sdsummarywidget.moc"