Diffstat (limited to 'libkdepim/externalapphandler.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/externalapphandler.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index efcdd89..3cf9e06 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h | |||
@@ -1,139 +1,145 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef EXTERNALAPPHANDLER_H | 31 | #ifndef EXTERNALAPPHANDLER_H |
32 | #define EXTERNALAPPHANDLER_H | 32 | #define EXTERNALAPPHANDLER_H |
33 | 33 | ||
34 | #include <qlist.h> | 34 | #include <qlist.h> |
35 | 35 | ||
36 | class QCopEnvelope; | 36 | class QCopEnvelope; |
37 | 37 | ||
38 | 38 | ||
39 | class ExternalAppHandler; | 39 | class ExternalAppHandler; |
40 | 40 | ||
41 | class DefaultAppItem | 41 | class DefaultAppItem |
42 | { | 42 | { |
43 | public: | 43 | public: |
44 | DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) | 44 | DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) |
45 | : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) | 45 | : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) |
46 | {} | 46 | {} |
47 | 47 | ||
48 | DefaultAppItem() | 48 | DefaultAppItem() |
49 | { } | 49 | { } |
50 | 50 | ||
51 | public: | 51 | public: |
52 | int _type; | 52 | int _type; |
53 | int _id; | 53 | int _id; |
54 | QString _label; | 54 | QString _label; |
55 | QString _channel; | 55 | QString _channel; |
56 | QString _message; | 56 | QString _message; |
57 | QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; | 57 | QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; |
58 | QString _message2; | 58 | QString _message2; |
59 | QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; | 59 | QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; |
60 | 60 | ||
61 | }; | 61 | }; |
62 | 62 | ||
63 | class ExternalAppHandler | 63 | class ExternalAppHandler |
64 | { | 64 | { |
65 | public: | 65 | public: |
66 | virtual ~ExternalAppHandler(); | 66 | virtual ~ExternalAppHandler(); |
67 | 67 | ||
68 | static ExternalAppHandler *instance(); | 68 | static ExternalAppHandler *instance(); |
69 | 69 | ||
70 | enum Types { | 70 | enum Types { |
71 | EMAIL = 0, | 71 | EMAIL = 0, |
72 | PHONE = 1, | 72 | PHONE = 1, |
73 | SMS = 2, | 73 | SMS = 2, |
74 | FAX = 3, | 74 | FAX = 3, |
75 | PAGER = 4 | 75 | PAGER = 4 |
76 | }; | 76 | }; |
77 | 77 | ||
78 | enum Availability { | 78 | enum Availability { |
79 | UNDEFINED = -1, | 79 | UNDEFINED = -1, |
80 | UNAVAILABLE = 0, | 80 | UNAVAILABLE = 0, |
81 | AVAILABLE = 1 | 81 | AVAILABLE = 1 |
82 | }; | 82 | }; |
83 | 83 | ||
84 | //calls the emailapplication with a number of attachments that need to be send | 84 | //calls the emailapplication with a number of attachments that need to be send. |
85 | bool mailAttachments( const QString& urls ); | 85 | //either parameter can be left empty. |
86 | bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); | ||
86 | 87 | ||
87 | //calls the emailapplication and creates a mail with parameter emails as recipients | 88 | //calls the emailapplication and creates a mail with parameter emailadress as recipients |
88 | bool mailToContacts( const QString& emails ); | 89 | bool mailToOneContact( const QString& name, const QString& emailadress ); |
90 | |||
91 | //calls the emailapplication and creates a mail with parameter as recipients | ||
92 | // parameters format is | ||
93 | // NAME <EMAIL>:SUBJECT | ||
94 | bool mailToOneContact( const QString& adressline ); | ||
89 | 95 | ||
90 | //calls the phoneapplication with the number | 96 | //calls the phoneapplication with the number |
91 | bool callByPhone( const QString& phonenumber ); | 97 | bool callByPhone( const QString& phonenumber ); |
92 | 98 | ||
93 | //calls the smsapplication with the number | 99 | //calls the smsapplication with the number |
94 | bool callBySMS( const QString& phonenumber ); | 100 | bool callBySMS( const QString& phonenumber ); |
95 | 101 | ||
96 | //calls the pagerapplication with the number | 102 | //calls the pagerapplication with the number |
97 | bool callByPager( const QString& pagernumber ); | 103 | bool callByPager( const QString& pagernumber ); |
98 | 104 | ||
99 | //calls the faxapplication with the number | 105 | //calls the faxapplication with the number |
100 | bool callByFax( const QString& faxnumber ); | 106 | bool callByFax( const QString& faxnumber ); |
101 | 107 | ||
102 | bool isEmailAppAvailable(); | 108 | bool isEmailAppAvailable(); |
103 | bool isSMSAppAvailable(); | 109 | bool isSMSAppAvailable(); |
104 | bool isPhoneAppAvailable(); | 110 | bool isPhoneAppAvailable(); |
105 | bool isFaxAppAvailable(); | 111 | bool isFaxAppAvailable(); |
106 | bool isPagerAppAvailable(); | 112 | bool isPagerAppAvailable(); |
107 | 113 | ||
108 | 114 | ||
109 | 115 | ||
110 | //loadConfig clears the cache and checks again if the applications are available or not | 116 | //loadConfig clears the cache and checks again if the applications are available or not |
111 | void loadConfig(); | 117 | void loadConfig(); |
112 | 118 | ||
113 | QList<DefaultAppItem> getAvailableDefaultItems(Types); | 119 | QList<DefaultAppItem> getAvailableDefaultItems(Types); |
114 | DefaultAppItem* getDefaultItem(Types, int); | 120 | DefaultAppItem* getDefaultItem(Types, int); |
115 | 121 | ||
116 | 122 | ||
117 | private: | 123 | private: |
118 | ExternalAppHandler(); | 124 | ExternalAppHandler(); |
119 | QList<DefaultAppItem> mDefaultItems; | 125 | QList<DefaultAppItem> mDefaultItems; |
120 | 126 | ||
121 | Availability mEmailAppAvailable; | 127 | Availability mEmailAppAvailable; |
122 | Availability mPhoneAppAvailable; | 128 | Availability mPhoneAppAvailable; |
123 | Availability mFaxAppAvailable; | 129 | Availability mFaxAppAvailable; |
124 | Availability mSMSAppAvailable; | 130 | Availability mSMSAppAvailable; |
125 | Availability mPagerAppAvailable; | 131 | Availability mPagerAppAvailable; |
126 | 132 | ||
127 | 133 | ||
128 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); | 134 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); |
129 | 135 | ||
130 | QString& translateMessage(QString& message, const QString& emails) const; | 136 | QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; |
131 | void passParameter(QCopEnvelope* e, const QString& parameters, const QString& param1) const; | 137 | void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; |
132 | 138 | ||
133 | 139 | ||
134 | static ExternalAppHandler *sInstance; | 140 | static ExternalAppHandler *sInstance; |
135 | 141 | ||
136 | 142 | ||
137 | }; | 143 | }; |
138 | 144 | ||
139 | #endif | 145 | #endif |