diff options
Diffstat (limited to 'kalarm/dcophandler.cpp')
-rw-r--r-- | kalarm/dcophandler.cpp | 305 |
1 files changed, 0 insertions, 305 deletions
diff --git a/kalarm/dcophandler.cpp b/kalarm/dcophandler.cpp index c76f2a7fb..7f49ca573 100644 --- a/kalarm/dcophandler.cpp +++ b/kalarm/dcophandler.cpp @@ -36,9 +36,6 @@ #include "dcophandler.moc" static const char* DCOP_OBJECT_NAME = "request"; // DCOP name of KAlarm's request interface -#ifdef OLD_DCOP -static const char* DCOP_OLD_OBJECT_NAME = "display"; -#endif /*============================================================================= @@ -465,305 +462,3 @@ bool DcopHandler::convertRecurrence(KARecurrence& recurrence, const DateTime& st recurrence.set(type, recurInterval, recurCount, start, end); return true; } - - -#ifdef OLD_DCOP -/*============================================================================= -= DcopHandlerOld -= This class's function is simply to act as a receiver for DCOP requests. -=============================================================================*/ -DcopHandlerOld::DcopHandlerOld() - : TQWidget(), - DCOPObject(DCOP_OLD_OBJECT_NAME) -{ - kdDebug(5950) << "DcopHandlerOld::DcopHandlerOld()\n"; -} - -/****************************************************************************** -* Process a DCOP request. -*/ -bool DcopHandlerOld::process(const TQCString& func, const TQByteArray& data, TQCString& replyType, TQByteArray&) -{ - kdDebug(5950) << "DcopHandlerOld::process(): " << func << endl; - enum - { - OPERATION = 0x0007, // tqmask for main operation - HANDLE = 0x0001, - CANCEL = 0x0002, - TRIGGER = 0x0003, - SCHEDULE = 0x0004, - ALARM_TYPE = 0x00F0, // tqmask for SCHEDULE alarm type - MESSAGE = 0x0010, - FILE = 0x0020, - COMMAND = 0x0030, - EMAIL = 0x0040, - SCH_FLAGS = 0x0F00, // tqmask for SCHEDULE flags - REP_COUNT = 0x0100, - REP_END = 0x0200, - FONT = 0x0400, - PRE_096 = 0x1000, // old-style pre-0.9.6 deprecated method - PRE_091 = 0x2000 | PRE_096 // old-style pre-0.9.1 deprecated method - }; - replyType = "void"; - int function; - if (func == "handleEvent(const TQString&,const TQString&)" - || func == "handleEvent(TQString,TQString)") - function = HANDLE; - else if (func == "cancelEvent(const TQString&,const TQString&)" - || func == "cancelEvent(TQString,TQString)") - function = CANCEL; - else if (func == "triggerEvent(const TQString&,const TQString&)" - || func == "triggerEvent(TQString,TQString)") - function = TRIGGER; - - // scheduleMessage(message, dateTime, colour, colourfg, flags, audioURL, reminder, recurrence) - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,const TQString&)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQColor,TQ_UINT32,TQString,TQ_UINT32,TQString)") - function = SCHEDULE | MESSAGE; - // scheduleMessage(message, dateTime, colour, colourfg, font, flags, audioURL, reminder, recurrence) - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,const TQColor&,const TQFont&,TQ_UINT32,const TQString&,TQ_INT32,const TQString&)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQColor,TQFont,TQ_UINT32,TQString,TQ_UINT32,TQString)") - function = SCHEDULE | MESSAGE | FONT; - // scheduleFile(URL, dateTime, colour, flags, audioURL, reminder, recurrence) - else if (func == "scheduleFile(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,TQ_INT32,const TQString&)" - || func == "scheduleFile(TQString,TQDateTime,TQColor,TQ_UINT32,TQString,TQ_UINT32,TQString)") - function = SCHEDULE | FILE; - // scheduleCommand(commandLine, dateTime, flags, recurrence) - else if (func == "scheduleCommand(const TQString&,const TQDateTime&,TQ_UINT32,const TQString&)" - || func == "scheduleCommand(TQString,TQDateTime,TQ_UINT32,TQString)") - function = SCHEDULE | COMMAND; - // scheduleEmail(addresses, subject, message, attachments, dateTime, flags, recurrence) - else if (func == "scheduleEmail(const TQString&,const TQString&,const TQString&,const TQString&,const TQDateTime&,TQ_UINT32,const TQString&)" - || func == "scheduleEmail(TQString,TQString,TQString,TQString,TQDateTime,TQ_UINT32,TQString)") - function = SCHEDULE | EMAIL; - - // scheduleMessage(message, dateTime, colour, colourfg, flags, audioURL, reminder, recurType, interval, recurCount) - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,TQ_INT32,TQ_INT32,TQ_INT32)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQColor,TQ_UINT32,TQString,TQ_INT32,TQ_INT32,TQ_INT32,TQ_INT32)") - function = SCHEDULE | MESSAGE | REP_COUNT; - // scheduleFile(URL, dateTime, colour, flags, audioURL, reminder, recurType, interval, recurCount) - else if (func == "scheduleFile(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,TQ_INT32,TQ_INT32,TQ_INT32)" - || func == "scheduleFile(TQString,TQDateTime,TQColor,TQ_UINT32,TQString,TQ_INT32,TQ_INT32,TQ_INT32,TQ_INT32)") - function = SCHEDULE | FILE | REP_COUNT; - // scheduleCommand(commandLine, dateTime, flags, recurType, interval, recurCount) - else if (func == "scheduleCommand(const TQString&,const TQDateTime&,TQ_UINT32,TQ_INT32,TQ_INT32,TQ_INT32)" - || func == "scheduleCommand(TQString,TQDateTime,TQ_UINT32,TQ_INT32,TQ_INT32,TQ_INT32)") - function = SCHEDULE | COMMAND | REP_COUNT; - // scheduleEmail(addresses, subject, message, attachments, dateTime, flags, recurType, interval, recurCount) - else if (func == "scheduleEmail(const TQString&,const TQString&,const TQString&,const TQString&,const TQDateTime&,TQ_UINT32,TQ_INT32,TQ_INT32,TQ_INT32)" - || func == "scheduleEmail(TQString,TQString,TQString,TQString,TQDateTime,TQ_UINT32,TQ_INT32,TQ_INT32,TQ_INT32)") - function = SCHEDULE | EMAIL | REP_COUNT; - - // scheduleMessage(message, dateTime, colour, colourfg, flags, audioURL, reminder, recurType, interval, endTime) - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,TQ_INT32,TQ_INT32,const TQDateTime&)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQColor,TQ_UINT32,TQString,TQ_INT32,TQ_INT32,TQ_INT32,TQDateTime)") - function = SCHEDULE | MESSAGE | REP_END; - // scheduleFile(URL, dateTime, colour, flags, audioURL, reminder, recurType, interval, endTime) - else if (func == "scheduleFile(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,TQ_INT32,TQ_INT32,const TQDateTime&)" - || func == "scheduleFile(TQString,TQDateTime,TQColor,TQ_UINT32,TQString,TQ_INT32,TQ_INT32,TQ_INT32,TQDateTime)") - function = SCHEDULE | FILE | REP_END; - // scheduleCommand(commandLine, dateTime, flags, recurType, interval, endTime) - else if (func == "scheduleCommand(const TQString&,const TQDateTime&,TQ_UINT32,TQ_INT32,TQ_INT32,const TQDateTime&)" - || func == "scheduleCommand(TQString,TQDateTime,TQ_UINT32,TQ_INT32,TQ_INT32,TQDateTime)") - function = SCHEDULE | COMMAND | REP_END; - // scheduleEmail(addresses, subject, message, attachments, dateTime, flags, recurType, interval, endTime) - else if (func == "scheduleEmail(const TQString&,const TQString&,const TQString&,const TQString&,const TQDateTime&,TQ_UINT32,TQ_INT32,TQ_INT32,const TQDateTime&)" - || func == "scheduleEmail(TQString,TQString,TQString,TQString,TQDateTime,TQ_UINT32,TQ_INT32,TQ_INT32,TQDateTime)") - function = SCHEDULE | EMAIL | REP_END; - - // Deprecated methods: backwards compatibility with KAlarm pre-0.9.6 - // scheduleMessage(message, dateTime, colour, flags, audioURL, reminder, recurrence) - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,const TQString&)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQ_UINT32,TQString,TQ_UINT32,TQString)") - function = SCHEDULE | MESSAGE | PRE_096; - // scheduleMessage(message, dateTime, colour, font, flags, audioURL, reminder, recurrence) - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,const TQFont&,TQ_UINT32,const TQString&,TQ_INT32,const TQString&)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQFont,TQ_UINT32,TQString,TQ_UINT32,TQString)") - function = SCHEDULE | MESSAGE | FONT | PRE_096; - // scheduleMessage(message, dateTime, colour, flags, audioURL, reminder, recurType, interval, recurCount) - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,TQ_INT32,TQ_INT32,TQ_INT32)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQ_UINT32,TQString,TQ_INT32,TQ_INT32,TQ_INT32,TQ_INT32)") - function = SCHEDULE | MESSAGE | REP_COUNT | PRE_096; - // scheduleMessage(message, dateTime, colour, flags, audioURL, reminder, recurType, interval, endTime) - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,TQ_INT32,TQ_INT32,const TQDateTime&)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQ_UINT32,TQString,TQ_INT32,TQ_INT32,TQ_INT32,TQDateTime)") - function = SCHEDULE | MESSAGE | REP_END | PRE_096; - - // Deprecated methods: backwards compatibility with KAlarm pre-0.9.1 - // scheduleMessage(message, dateTime, colour, flags, audioURL) - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQ_UINT32,TQString)") - function = SCHEDULE | MESSAGE | PRE_091; - // scheduleFile(URL, dateTime, colour, flags, audioURL) - else if (func == "scheduleFile(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&)" - || func == "scheduleFile(TQString,TQDateTime,TQColor,TQ_UINT32,TQString)") - function = SCHEDULE | FILE | PRE_091; - // scheduleMessage(message, dateTime, colour, flags, audioURL, recurType, interval, recurCount) - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,TQ_INT32,TQ_INT32)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQ_UINT32,TQString,TQ_INT32,TQ_INT32,TQ_INT32)") - function = SCHEDULE | MESSAGE | REP_COUNT | PRE_091; - // scheduleFile(URL, dateTime, colour, flags, audioURL, recurType, interval, recurCount) - else if (func == "scheduleFile(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,TQ_INT32,TQ_INT32)" - || func == "scheduleFile(TQString,TQDateTime,TQColor,TQ_UINT32,TQString,TQ_INT32,TQ_INT32,TQ_INT32)") - function = SCHEDULE | FILE | REP_COUNT | PRE_091; - // scheduleMessage(message, dateTime, colour, flags, audioURL, recurType, interval, endTime) - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,TQ_INT32,const TQDateTime&)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQ_UINT32,TQString,TQ_INT32,TQ_INT32,TQDateTime)") - function = SCHEDULE | MESSAGE | REP_END | PRE_091; - // scheduleFile(URL, dateTime, colour, flags, audioURL, recurType, interval, endTime) - else if (func == "scheduleFile(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,const TQString&,TQ_INT32,TQ_INT32,const TQDateTime&)" - || func == "scheduleFile(TQString,TQDateTime,TQColor,TQ_UINT32,TQString,TQ_INT32,TQ_INT32,TQDateTime)") - function = SCHEDULE | FILE | REP_END | PRE_091; - - // Obsolete methods: backwards compatibility with KAlarm pre-0.7 - else if (func == "scheduleMessage(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,TQ_INT32,TQ_INT32)" - || func == "scheduleMessage(TQString,TQDateTime,TQColor,TQ_UINT32,TQ_INT32,TQ_INT32)" - || func == "scheduleFile(const TQString&,const TQDateTime&,const TQColor&,TQ_UINT32,TQ_INT32,TQ_INT32)" - || func == "scheduleFile(TQString,TQDateTime,TQColor,TQ_UINT32,TQ_INT32,TQ_INT32)" - || func == "scheduleCommand(const TQString&,const TQDateTime&,TQ_UINT32,TQ_INT32,TQ_INT32)" - || func == "scheduleCommand(TQString,TQDateTime,TQ_UINT32,TQ_INT32,TQ_INT32)" - // Obsolete methods: backwards compatibility with KAlarm pre-0.6 - || func == "cancelMessage(const TQString&,const TQString&)" - || func == "cancelMessage(TQString,TQString)" - || func == "displayMessage(const TQString&,const TQString&)" - || func == "displayMessage(TQString,TQString)") - { - kdError(5950) << "DcopHandlerOld::process(): obsolete DCOP function call: '" << func << "'" << endl; - return false; - } - else - { - kdError(5950) << "DcopHandlerOld::process(): unknown DCOP function" << endl; - return false; - } - - switch (function & OPERATION) - { - case HANDLE: // trigger or cancel event with specified ID from calendar file - case CANCEL: // cancel event with specified ID from calendar file - case TRIGGER: // trigger event with specified ID in calendar file - { - - TQDataStream arg(data, IO_ReadOnly); - TQString urlString, vuid; - arg >> urlString >> vuid; - switch (function) - { - case HANDLE: - return theApp()->handleEvent(urlString, vuid); - case CANCEL: - return theApp()->deleteEvent(urlString, vuid); - case TRIGGER: - return theApp()->triggerEvent(urlString, vuid); - } - break; - } - case SCHEDULE: // schedule a new event - { - KAEvent::Action action; - switch (function & ALARM_TYPE) - { - case MESSAGE: action = KAEvent::MESSAGE; break; - case FILE: action = KAEvent::FILE; break; - case COMMAND: action = KAEvent::COMMAND; break; - case EMAIL: action = KAEvent::EMAIL; break; - default: return false; - } - TQDataStream arg(data, IO_ReadOnly); - TQString text, audioFile, mailSubject; - float audioVolume = -1; - EmailAddressList mailAddresses; - TQStringList mailAttachments; - TQDateTime dateTime, endTime; - TQColor bgColour; - TQColor fgColour(TQt::black); - TQFont font; - TQ_UINT32 flags; - int lateCancel = 0; - KARecurrence recurrence; - TQ_INT32 reminderMinutes = 0; - if (action == KAEvent::EMAIL) - { - TQString addresses, attachments; - arg >> addresses >> mailSubject >> text >> attachments; - TQString bad = KAMail::convertAddresses(addresses, mailAddresses); - if (!bad.isEmpty()) - { - kdError(5950) << "DcopHandlerOld::process(): invalid email addresses: " << bad << endl; - return false; - } - if (mailAddresses.isEmpty()) - { - kdError(5950) << "DcopHandlerOld::process(): no email address\n"; - return false; - } - bad = KAMail::convertAttachments(attachments, mailAttachments); - if (!bad.isEmpty()) - { - kdError(5950) << "DcopHandlerOld::process(): invalid email attachment: " << bad << endl; - return false; - } - } - else - arg >> text; - arg.readRawBytes((char*)&dateTime, sizeof(dateTime)); - if (action != KAEvent::COMMAND) - arg.readRawBytes((char*)&bgColour, sizeof(bgColour)); - if (action == KAEvent::MESSAGE && !(function & PRE_096)) - arg.readRawBytes((char*)&fgColour, sizeof(fgColour)); - if (function & FONT) - { - arg.readRawBytes((char*)&font, sizeof(font)); - arg >> flags; - } - else - { - arg >> flags; - flags |= KAEvent::DEFAULT_FONT; - } - if (flags & KAEvent::LATE_CANCEL) - lateCancel = 1; - if (action == KAEvent::MESSAGE || action == KAEvent::FILE) - { - arg >> audioFile; - if (!(function & PRE_091)) - arg >> reminderMinutes; - } - if (function & (REP_COUNT | REP_END)) - { - KARecurrence::Type recurType; - TQ_INT32 recurCount = 0; - TQ_INT32 recurInterval; - TQ_INT32 type; - arg >> type >> recurInterval; - switch (type) - { - case 1: recurType = KARecurrence::MINUTELY; break; - case 3: recurType = KARecurrence::DAILY; break; - case 4: recurType = KARecurrence::WEEKLY; break; - case 6: recurType = KARecurrence::MONTHLY_DAY; break; - case 7: recurType = KARecurrence::ANNUAL_DATE; break; - default: - kdError(5950) << "DcopHandlerOld::process(): invalid simple repetition type: " << type << endl; - return false; - } - if (function & REP_COUNT) - arg >> recurCount; - else - arg.readRawBytes((char*)&endTime, sizeof(endTime)); - recurrence.set(recurType, recurInterval, recurCount, - DateTime(dateTime, flags & KAEvent::ANY_TIME), endTime); - } - else if (!(function & PRE_091)) - { - TQString rule; - arg >> rule; - recurrence.set(rule); - } - return theApp()->scheduleEvent(action, text, dateTime, lateCancel, flags, bgColour, fgColour, font, audioFile, - audioVolume, reminderMinutes, recurrence, 0, 0, 0, mailAddresses, mailSubject, mailAttachments); - } - } - return false; -} -#endif // OLD_DCOP |