diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /plugins/kmail/bodypartformatter/text_calendar.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'plugins/kmail/bodypartformatter/text_calendar.cpp')
-rw-r--r-- | plugins/kmail/bodypartformatter/text_calendar.cpp | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/plugins/kmail/bodypartformatter/text_calendar.cpp b/plugins/kmail/bodypartformatter/text_calendar.cpp index ba9b16eb0..29a00afe3 100644 --- a/plugins/kmail/bodypartformatter/text_calendar.cpp +++ b/plugins/kmail/bodypartformatter/text_calendar.cpp @@ -66,9 +66,9 @@ #include <kapplication.h> #include <ktempfile.h> -#include <qurl.h> -#include <qdir.h> -#include <qtextstream.h> +#include <tqurl.h> +#include <tqdir.h> +#include <tqtextstream.h> #include <kdepimmacros.h> @@ -105,9 +105,9 @@ CalendarManager::CalendarManager() CalendarResourceManager *mgr = mCalendar->resourceManager(); for ( CalendarResourceManager::ActiveIterator it = mgr->activeBegin(); it != mgr->activeEnd(); ++it ) { if ( (*it)->type() == "imap" || (*it)->type() == "kolab" ) { - const QStringList subResources = (*it)->subresources(); - QMap<QString, int> prefixSet; // KDE4: QSet - for ( QStringList::ConstIterator subIt = subResources.begin(); subIt != subResources.end(); ++subIt ) { + const TQStringList subResources = (*it)->subresources(); + TQMap<TQString, int> prefixSet; // KDE4: QSet + for ( TQStringList::ConstIterator subIt = subResources.begin(); subIt != subResources.end(); ++subIt ) { if ( !(*subIt).contains( "/.INBOX.directory/" ) ) // we don't care about shared folders continue; @@ -143,7 +143,7 @@ class KMInvitationFormatterHelper : public KCal::InvitationFormatterHelper { public: KMInvitationFormatterHelper( KMail::Interface::BodyPart *bodyPart ) : mBodyPart( bodyPart ) {} - virtual QString generateLinkURL( const QString &id ) { return mBodyPart->makeLink( id ); } + virtual TQString generateLinkURL( const TQString &id ) { return mBodyPart->makeLink( id ); } KCal::Calendar* calendar() const { return CalendarManager::calendar(); } private: KMail::Interface::BodyPart *mBodyPart; @@ -160,17 +160,17 @@ class Formatter : public KMail::Interface::BodyPartFormatter return Ok; CalendarLocal cl( KPimPrefs::timezone() ); KMInvitationFormatterHelper helper( bodyPart ); - QString source; + TQString source; /* If the bodypart does not have a charset specified, we need to fall back to utf8, not the KMail fallback encoding, so get the contents as binary and decode explicitely. */ if ( bodyPart->contentTypeParameter( "charset").isEmpty() ) { - const QByteArray &ba = bodyPart->asBinary(); - source = QString::fromUtf8(ba); + const TQByteArray &ba = bodyPart->asBinary(); + source = TQString::fromUtf8(ba); } else { source = bodyPart->asText(); } - QString html = IncidenceFormatter::formatICalInvitation( source, &cl, &helper ); + TQString html = IncidenceFormatter::formatICalInvitation( source, &cl, &helper ); if ( html.isEmpty() ) return AsIcon; writer->queue( html ); @@ -179,9 +179,9 @@ class Formatter : public KMail::Interface::BodyPartFormatter } }; -static QString directoryForStatus( Attendee::PartStat status ) +static TQString directoryForStatus( Attendee::PartStat status ) { - QString dir; + TQString dir; switch ( status ) { case Attendee::Accepted: dir = "accepted"; @@ -209,7 +209,7 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler kdDebug() << "UrlHandler() (iCalendar)" << endl; } - Incidence* icalToString( const QString& iCal ) const + Incidence* icalToString( const TQString& iCal ) const { CalendarLocal calendar( KPimPrefs::timezone() ) ; ICalFormat format; @@ -222,7 +222,7 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler } - Attendee *findMyself( Incidence* incidence, const QString& receiver ) const + Attendee *findMyself( Incidence* incidence, const TQString& receiver ) const { Attendee::List attendees = incidence->attendees(); Attendee::List::ConstIterator it; @@ -279,11 +279,11 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler } Attendee* setStatusOnMyself( Incidence* incidence, Attendee* myself, - Attendee::PartStat status, const QString &receiver ) const + Attendee::PartStat status, const TQString &receiver ) const { Attendee* newMyself = 0; - QString name; - QString email; + TQString name; + TQString email; KPIM::getNameAndMail( receiver, name, email ); if ( name.isEmpty() && myself ) name = myself->name(); if ( email.isEmpty()&& myself ) email = myself->email(); @@ -293,7 +293,7 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler true, // RSVP, otherwise we would not be here status, myself ? myself->role() : heuristicalRole( incidence ), - myself ? myself->uid() : QString::null ); + myself ? myself->uid() : TQString::null ); if ( myself ) { newMyself->setDelegate( myself->delegate() ); newMyself->setDelegator( myself->delegator() ); @@ -316,15 +316,15 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler bool mail( Incidence* incidence, KMail::Callback& callback, Attendee::PartStat status, Scheduler::Method method = Scheduler::Reply, - const QString &to = QString::null, MailType type = Answer ) const + const TQString &to = TQString::null, MailType type = Answer ) const { ICalFormat format; format.setTimeZone( KPimPrefs::timezone(), false ); - QString msg = format.createScheduleMessage( incidence, method ); - QString summary = incidence->summary(); + TQString msg = format.createScheduleMessage( incidence, method ); + TQString summary = incidence->summary(); if ( summary.isEmpty() ) summary = i18n( "Incidence with no summary" ); - QString subject; + TQString subject; switch ( type ) { case Answer: subject = i18n( "Answer: %1" ).arg( summary ); @@ -342,29 +342,29 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler break; } - QString recv = to; + TQString recv = to; if ( recv.isEmpty() ) recv = incidence->organizer().fullName(); - QString statusString = directoryForStatus( status ); //it happens to return the right strings + TQString statusString = directoryForStatus( status ); //it happens to return the right strings return callback.mailICal( recv, msg, subject, statusString, type != Forward ); } void ensureKorganizerRunning() const { - QString error; - QCString dcopService; - int result = KDCOPServiceStarter::self()->findServiceFor( "DCOP/Organizer", QString::null, QString::null, &error, &dcopService ); + TQString error; + TQCString dcopService; + int result = KDCOPServiceStarter::self()->findServiceFor( "DCOP/Organizer", TQString::null, TQString::null, &error, &dcopService ); if ( result == 0 ) { // OK, so korganizer (or kontact) is running. Now ensure the object we want is available // [that's not the case when kontact was already running, but korganizer not loaded into it...] static const char* const dcopObjectId = "KOrganizerIface"; - QCString dummy; - if ( !kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", QByteArray(), dummy, dummy ) ) { + TQCString dummy; + if ( !kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", TQByteArray(), dummy, dummy ) ) { DCOPRef ref( dcopService, dcopService ); // talk to the KUniqueApplication or its kontact wrapper DCOPReply reply = ref.call( "load()" ); if ( reply.isValid() && (bool)reply ) { kdDebug() << "Loaded " << dcopService << " successfully" << endl; - Q_ASSERT( kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", QByteArray(), dummy, dummy ) ); + Q_ASSERT( kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", TQByteArray(), dummy, dummy ) ); } else kdWarning() << "Error loading " << dcopService << endl; } @@ -376,17 +376,17 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler kdWarning() << "Couldn't start DCOP/Organizer: " << dcopService << " " << error << endl; } - bool saveFile( const QString& receiver, const QString& iCal, - const QString& type ) const + bool saveFile( const TQString& receiver, const TQString& iCal, + const TQString& type ) const { KTempFile file( locateLocal( "data", "korganizer/income." + type + '/', true ) ); - QTextStream* ts = file.textStream(); + TQTextStream* ts = file.textStream(); if ( !ts ) { KMessageBox::error( 0, i18n("Could not save file to KOrganizer") ); return false; } - ts->setEncoding( QTextStream::UnicodeUTF8 ); + ts->setEncoding( TQTextStream::UnicodeUTF8 ); (*ts) << receiver << '\n' << iCal; file.close(); @@ -397,11 +397,11 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler return true; } - bool handleInvitation( const QString& iCal, Attendee::PartStat status, + bool handleInvitation( const TQString& iCal, Attendee::PartStat status, KMail::Callback &callback ) const { bool ok = true; - const QString receiver = callback.receiver(); + const TQString receiver = callback.receiver(); if ( receiver.isEmpty() ) // Must be some error. Still return true though, since we did handle it @@ -412,8 +412,8 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler if ( callback.askForComment( status ) ) { bool ok = false; - QString comment = KInputDialog::getMultiLineText( i18n("Reaction to Invitation"), - i18n("Comment:"), QString(), &ok ); + TQString comment = KInputDialog::getMultiLineText( i18n("Reaction to Invitation"), + i18n("Comment:"), TQString(), &ok ); if ( !ok ) return true; if ( !comment.isEmpty() ) @@ -421,17 +421,17 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler } // First, save it for KOrganizer to handle - QString dir = directoryForStatus( status ); + TQString dir = directoryForStatus( status ); if ( dir.isEmpty() ) return true; // unknown status if ( status != Attendee::Delegated ) // we do that below for delegated incidences saveFile( receiver, iCal, dir ); - QString delegateString; + TQString delegateString; bool delegatorRSVP = false; if ( status == Attendee::Delegated ) { DelegateSelector dlg; - if ( dlg.exec() == QDialog::Rejected ) + if ( dlg.exec() == TQDialog::Rejected ) return true; delegateString = dlg.delegate(); delegatorRSVP = dlg.rsvp(); @@ -447,7 +447,7 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler Attendee *myself = findMyself( incidence, receiver ); // find our delegator, we need to inform him as well - QString delegator; + TQString delegator; if ( myself && !myself->delegator().isEmpty() ) { Attendee::List attendees = incidence->attendees(); for ( Attendee::List::ConstIterator it = attendees.constBegin(); it != attendees.constEnd(); ++it ) { @@ -477,8 +477,8 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler } else if ( !myself && (status != Attendee::Declined) ) { // forwarded invitation Attendee* newMyself = 0; - QString name; - QString email; + TQString name; + TQString email; KPIM::getNameAndMail( receiver, name, email ); if ( !email.isEmpty() ) { newMyself = new Attendee( name, @@ -486,7 +486,7 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler true, // RSVP, otherwise we would not be here status, heuristicalRole( incidence ), - QString::null ); + TQString::null ); incidence->clearAttendees(); incidence->addAttendee( newMyself ); ok = mail( incidence, callback, status, Scheduler::Reply ); @@ -505,7 +505,7 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler myself = findMyself( incidence, receiver ); myself->setStatus( status ); myself->setDelegate( delegateString ); - QString name, email; + TQString name, email; KPIM::getNameAndMail( delegateString, name, email ); Attendee *delegate = new Attendee( name, email, true ); delegate->setDelegator( receiver ); @@ -513,7 +513,7 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler ICalFormat format; format.setTimeZone( KPimPrefs::timezone(), false ); - QString iCal = format.createScheduleMessage( incidence, Scheduler::Request ); + TQString iCal = format.createScheduleMessage( incidence, Scheduler::Request ); saveFile( receiver, iCal, dir ); ok = mail( incidence, callback, status, Scheduler::Request, delegateString, Delegation ); @@ -521,15 +521,15 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler return ok; } - void showCalendar( const QDate &date ) const + void showCalendar( const TQDate &date ) const { ensureKorganizerRunning(); // raise korganizer part in kontact or the korganizer app - kapp->dcopClient()->send( "korganizer", "korganizer", "newInstance()", QByteArray() ); - QByteArray arg; - QDataStream s( arg, IO_WriteOnly ); - s << QString( "kontact_korganizerplugin" ); - kapp->dcopClient()->send( "kontact", "KontactIface", "selectPlugin(QString)", arg ); + kapp->dcopClient()->send( "korganizer", "korganizer", "newInstance()", TQByteArray() ); + TQByteArray arg; + TQDataStream s( arg, IO_WriteOnly ); + s << TQString( "kontact_korganizerplugin" ); + kapp->dcopClient()->send( "kontact", "KontactIface", "selectPlugin(TQString)", arg ); KCalendarIface_stub *iface = new KCalendarIface_stub( kapp->dcopClient(), "korganizer", "CalendarIface" ); iface->showEventView(); @@ -537,24 +537,24 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler delete iface; } - bool handleIgnore( const QString&, KMail::Callback& c ) const + bool handleIgnore( const TQString&, KMail::Callback& c ) const { // simply move the message to trash ( new KMDeleteMsgCommand( c.getMsg()->getMsgSerNum() ) )->start(); return true; } - bool handleDeclineCounter( const QString &iCal, KMail::Callback &callback ) const + bool handleDeclineCounter( const TQString &iCal, KMail::Callback &callback ) const { - const QString receiver = callback.receiver(); + const TQString receiver = callback.receiver(); if ( receiver.isEmpty() ) return true; Incidence* incidence = icalToString( iCal ); if ( callback.askForComment( Attendee::Declined ) ) { bool ok = false; // ### string freeze - QString comment = KInputDialog::getMultiLineText( i18n("Reaction to Invitation") /* i18n("Decline Counter Proposal") */, - i18n("Comment:"), QString(), &ok ); + TQString comment = KInputDialog::getMultiLineText( i18n("Reaction to Invitation") /* i18n("Decline Counter Proposal") */, + i18n("Comment:"), TQString(), &ok ); if ( !ok ) return true; if ( !comment.isEmpty() ) @@ -564,9 +564,9 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler callback.sender(), DeclineCounter ); } - bool counterProposal( const QString &iCal, KMail::Callback &callback ) const + bool counterProposal( const TQString &iCal, KMail::Callback &callback ) const { - const QString receiver = callback.receiver(); + const TQString receiver = callback.receiver(); if ( receiver.isEmpty() ) return true; saveFile( receiver, iCal, "counter" ); @@ -576,15 +576,15 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler } bool handleClick( KMail::Interface::BodyPart *part, - const QString &path, KMail::Callback& c ) const + const TQString &path, KMail::Callback& c ) const { - QString iCal; + TQString iCal; /* If the bodypart does not have a charset specified, we need to fall back to utf8, not the KMail fallback encoding, so get the contents as binary and decode explicitely. */ if ( part->contentTypeParameter( "charset").isEmpty() ) { - const QByteArray &ba = part->asBinary(); - iCal = QString::fromUtf8(ba); + const TQByteArray &ba = part->asBinary(); + iCal = TQString::fromUtf8(ba); } else { iCal = part->asText(); } @@ -607,9 +607,9 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler if ( path == "forward" ) { Incidence* incidence = icalToString( iCal ); AttendeeSelector dlg; - if ( dlg.exec() == QDialog::Rejected ) + if ( dlg.exec() == TQDialog::Rejected ) return true; - QString fwdTo = dlg.attendees().join( ", " ); + TQString fwdTo = dlg.attendees().join( ", " ); if ( fwdTo.isEmpty() ) return true; result = mail( incidence, c, Attendee::Delegated /*### right ?*/, @@ -621,7 +621,7 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler } if ( path == "reply" || path == "cancel" || path == "accept_counter" ) { // These should just be saved with their type as the dir - const QString p = (path == "accept_counter" ? QString("reply") : path); + const TQString p = (path == "accept_counter" ? TQString("reply") : path); if ( saveFile( "Receiver Not Searched", iCal, p ) ) { if ( c.deleteInvitationAfterReply() ) ( new KMDeleteMsgCommand( c.getMsg()->getMsgSerNum() ) )->start(); @@ -634,14 +634,14 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler } bool handleContextMenuRequest( KMail::Interface::BodyPart *, - const QString &, - const QPoint & ) const + const TQString &, + const TQPoint & ) const { return false; } - QString statusBarMessage( KMail::Interface::BodyPart *, - const QString &path ) const + TQString statusBarMessage( KMail::Interface::BodyPart *, + const TQString &path ) const { if ( !path.isEmpty() ) { if ( path == "accept" ) @@ -672,7 +672,7 @@ class UrlHandler : public KMail::Interface::BodyPartURLHandler return i18n( "Remove incidence from my calendar" ); } - return QString::null; + return TQString::null; } }; |