author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /libkdepim/externalapphandler.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/externalapphandler.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index f376e6c..3fc548a 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -36,13 +36,15 @@ $Id$ | |||
36 | 36 | ||
37 | #ifndef DESKTOP_VERSION | 37 | #ifndef DESKTOP_VERSION |
38 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
39 | #include <qtopia/qcopenvelope_qws.h> | 39 | #include <qtopia/qcopenvelope_qws.h> |
40 | #else | 40 | #else |
41 | #include <qapplication.h> | 41 | #include <qapplication.h> |
42 | #include <qprocess.h> | 42 | #include <q3process.h> |
43 | //Added by qt3to4: | ||
44 | #include <Q3CString> | ||
43 | #endif | 45 | #endif |
44 | 46 | ||
45 | #include <kstaticdeleter.h> | 47 | #include <kstaticdeleter.h> |
46 | #include <kmessagebox.h> | 48 | #include <kmessagebox.h> |
47 | 49 | ||
48 | 50 | ||
@@ -120,13 +122,13 @@ void QCopTransferItem::setSourceChannel(const QString& sourceChannel) | |||
120 | if ( !sourceChannel.isEmpty()) | 122 | if ( !sourceChannel.isEmpty()) |
121 | _sourceChannel = sourceChannel; | 123 | _sourceChannel = sourceChannel; |
122 | } | 124 | } |
123 | 125 | ||
124 | 126 | ||
125 | /*********************************************************************************/ | 127 | /*********************************************************************************/ |
126 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 128 | bool QCopTransferItem::appMessage( const Q3CString& cmsg, const QByteArray& data ) |
127 | { | 129 | { |
128 | 130 | ||
129 | // copied from old mail2 | 131 | // copied from old mail2 |
130 | /* | 132 | /* |
131 | static int ii = 0; | 133 | static int ii = 0; |
132 | 134 | ||
@@ -143,13 +145,13 @@ bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data | |||
143 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); | 145 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); |
144 | 146 | ||
145 | //we are in the target and get a request from the source | 147 | //we are in the target and get a request from the source |
146 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) | 148 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) |
147 | { | 149 | { |
148 | 150 | ||
149 | QDataStream stream( data, IO_ReadOnly ); | 151 | QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly ); |
150 | 152 | ||
151 | 153 | ||
152 | QString sourceChannel; | 154 | QString sourceChannel; |
153 | QString uid; | 155 | QString uid; |
154 | QString param1; | 156 | QString param1; |
155 | QString param2; | 157 | QString param2; |
@@ -223,19 +225,19 @@ bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QSt | |||
223 | #endif | 225 | #endif |
224 | 226 | ||
225 | } | 227 | } |
226 | 228 | ||
227 | 229 | ||
228 | /*********************************************************************************/ | 230 | /*********************************************************************************/ |
229 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 231 | bool QCopMapTransferItem::appMessage( const Q3CString& cmsg, const QByteArray& data ) |
230 | { | 232 | { |
231 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 233 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
232 | 234 | ||
233 | if (res == false) | 235 | if (res == false) |
234 | { | 236 | { |
235 | QDataStream stream( data, IO_ReadOnly ); | 237 | QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly ); |
236 | 238 | ||
237 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); | 239 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); |
238 | 240 | ||
239 | //we are in the source and get an answer from the target | 241 | //we are in the source and get an answer from the target |
240 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 242 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
241 | { | 243 | { |
@@ -302,22 +304,22 @@ bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QString | |||
302 | #endif | 304 | #endif |
303 | 305 | ||
304 | } | 306 | } |
305 | 307 | ||
306 | 308 | ||
307 | /*********************************************************************************/ | 309 | /*********************************************************************************/ |
308 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 310 | bool QCopListTransferItem::appMessage( const Q3CString& cmsg, const QByteArray& data ) |
309 | { | 311 | { |
310 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 312 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
311 | #ifdef DEBUG_EXT_APP_HANDLER | 313 | #ifdef DEBUG_EXT_APP_HANDLER |
312 | qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 314 | qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
313 | #endif | 315 | #endif |
314 | 316 | ||
315 | if (res == false) | 317 | if (res == false) |
316 | { | 318 | { |
317 | QDataStream stream( data, IO_ReadOnly ); | 319 | QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly ); |
318 | 320 | ||
319 | #ifdef DEBUG_EXT_APP_HANDLER | 321 | #ifdef DEBUG_EXT_APP_HANDLER |
320 | qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 322 | qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
321 | #endif | 323 | #endif |
322 | 324 | ||
323 | //we are in the source and get an answer from the target | 325 | //we are in the source and get an answer from the target |
@@ -515,15 +517,15 @@ void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& la | |||
515 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); | 517 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); |
516 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); | 518 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); |
517 | mDefaultItems.append(dai); | 519 | mDefaultItems.append(dai); |
518 | } | 520 | } |
519 | 521 | ||
520 | 522 | ||
521 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) | 523 | Q3PtrList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) |
522 | { | 524 | { |
523 | QList<DefaultAppItem> list; | 525 | Q3PtrList<DefaultAppItem> list; |
524 | 526 | ||
525 | DefaultAppItem* dai; | 527 | DefaultAppItem* dai; |
526 | 528 | ||
527 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 529 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
528 | { | 530 | { |
529 | if (dai->_type == type) | 531 | if (dai->_type == type) |
@@ -743,13 +745,13 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS | |||
743 | #ifdef DEBUG_EXT_APP_HANDLER | 745 | #ifdef DEBUG_EXT_APP_HANDLER |
744 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | 746 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); |
745 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); | 747 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); |
746 | #endif | 748 | #endif |
747 | qDebug("%s --- %s %s --- %s %s", channel.latin1(), message.latin1(),message2.latin1(), parameters.latin1(), parameters2.latin1() ); | 749 | qDebug("%s --- %s %s --- %s %s", channel.latin1(), message.latin1(),message2.latin1(), parameters.latin1(), parameters2.latin1() ); |
748 | //KMessageBox::sorry( 0, message2 ); | 750 | //KMessageBox::sorry( 0, message2 ); |
749 | QProcess * proc = new QProcess( this ); | 751 | Q3Process * proc = new Q3Process( this ); |
750 | int i = 0; | 752 | int i = 0; |
751 | proc->addArgument( channel ); | 753 | proc->addArgument( channel ); |
752 | 754 | ||
753 | if ( message.find (" " ) > 0 ) { | 755 | if ( message.find (" " ) > 0 ) { |
754 | QStringList list = QStringList::split( " ", message ); | 756 | QStringList list = QStringList::split( " ", message ); |
755 | int i = 0; | 757 | int i = 0; |
@@ -769,13 +771,13 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS | |||
769 | QString arg = "to='%1'"; | 771 | QString arg = "to='%1'"; |
770 | arg = arg.arg( emails ) + ","+parameters2;; | 772 | arg = arg.arg( emails ) + ","+parameters2;; |
771 | 773 | ||
772 | //KMessageBox::sorry( 0,arg ); | 774 | //KMessageBox::sorry( 0,arg ); |
773 | //qDebug("2add%sdd ",arg.latin1() ); | 775 | //qDebug("2add%sdd ",arg.latin1() ); |
774 | proc->addArgument( arg); | 776 | proc->addArgument( arg); |
775 | proc->launch(""); | 777 | proc->launch(QString()); |
776 | #endif | 778 | #endif |
777 | 779 | ||
778 | return true; | 780 | return true; |
779 | } | 781 | } |
780 | 782 | ||
781 | /************************************************************************** | 783 | /************************************************************************** |
@@ -828,13 +830,13 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e | |||
828 | //US we need no names in the To field. The emailadresses are enough | 830 | //US we need no names in the To field. The emailadresses are enough |
829 | 831 | ||
830 | passParameters(&e, parameters, name, emailadress); | 832 | passParameters(&e, parameters, name, emailadress); |
831 | #else // DESKTOP_VERSION | 833 | #else // DESKTOP_VERSION |
832 | 834 | ||
833 | //KMessageBox::sorry( 0,channel ); | 835 | //KMessageBox::sorry( 0,channel ); |
834 | QProcess * proc = new QProcess( this ); | 836 | Q3Process * proc = new Q3Process( this ); |
835 | proc->addArgument( channel ); | 837 | proc->addArgument( channel ); |
836 | if ( message.find (" " ) > 0 ) { | 838 | if ( message.find (" " ) > 0 ) { |
837 | QStringList list = QStringList::split( " ", message ); | 839 | QStringList list = QStringList::split( " ", message ); |
838 | int i = 0; | 840 | int i = 0; |
839 | while ( i < list.count ( ) ) { | 841 | while ( i < list.count ( ) ) { |
840 | //qDebug("add%sdd ",list[i].latin1() ); | 842 | //qDebug("add%sdd ",list[i].latin1() ); |
@@ -847,13 +849,13 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e | |||
847 | 849 | ||
848 | } | 850 | } |
849 | parameters = translateMessage(parameters, name, emailadress); | 851 | parameters = translateMessage(parameters, name, emailadress); |
850 | 852 | ||
851 | //KMessageBox::information(0,parameters); | 853 | //KMessageBox::information(0,parameters); |
852 | proc->addArgument( parameters ); | 854 | proc->addArgument( parameters ); |
853 | proc->launch(""); | 855 | proc->launch(QString()); |
854 | #endif | 856 | #endif |
855 | 857 | ||
856 | return true; | 858 | return true; |
857 | } | 859 | } |
858 | 860 | ||
859 | /************************************************************************** | 861 | /************************************************************************** |
@@ -1229,13 +1231,13 @@ void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& paramete | |||
1229 | 1231 | ||
1230 | 1232 | ||
1231 | /************************************************************************** | 1233 | /************************************************************************** |
1232 | * | 1234 | * |
1233 | **************************************************************************/ | 1235 | **************************************************************************/ |
1234 | 1236 | ||
1235 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) | 1237 | void ExternalAppHandler::appMessage( const Q3CString& cmsg, const QByteArray& data ) |
1236 | { | 1238 | { |
1237 | qDebug("ExternalAppHandler::appMessage %s %x", cmsg.data(), this); | 1239 | qDebug("ExternalAppHandler::appMessage %s %x", cmsg.data(), this); |
1238 | if ( cmsg == "nextView()" ) { | 1240 | if ( cmsg == "nextView()" ) { |
1239 | qDebug("nextView()"); | 1241 | qDebug("nextView()"); |
1240 | QTimer::singleShot( 0, this, SIGNAL ( nextView() )); | 1242 | QTimer::singleShot( 0, this, SIGNAL ( nextView() )); |
1241 | return; | 1243 | return; |