summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.h18
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp15
2 files changed, 21 insertions, 12 deletions
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index efcdd89..3cf9e06 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -36,104 +36,110 @@ $Id$
36class QCopEnvelope; 36class QCopEnvelope;
37 37
38 38
39class ExternalAppHandler; 39class ExternalAppHandler;
40 40
41class DefaultAppItem 41class 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
63class ExternalAppHandler 63class 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
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index c8b94db..4f4cc6a 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -96,110 +96,113 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
96 96
97 // mailclient page 97 // mailclient page
98 QWidget *externalAppsPage = new QWidget( this ); 98 QWidget *externalAppsPage = new QWidget( this );
99 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 99 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
100 KDialog::spacingHintSmall() ); 100 KDialog::spacingHintSmall() );
101 101
102 mExternalApps = new QComboBox( externalAppsPage ); 102 mExternalApps = new QComboBox( externalAppsPage );
103 103
104 QMap<ExternalAppHandler::Types, QString>::Iterator it; 104 QMap<ExternalAppHandler::Types, QString>::Iterator it;
105 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 105 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
106 mExternalApps->insertItem( it.data(), it.key() ); 106 mExternalApps->insertItem( it.data(), it.key() );
107 107
108 layout->addWidget( mExternalApps ); 108 layout->addWidget( mExternalApps );
109 109
110 connect( mExternalApps, SIGNAL( activated( int ) ), 110 connect( mExternalApps, SIGNAL( activated( int ) ),
111 this, SLOT (externalapp_changed( int ) ) ); 111 this, SLOT (externalapp_changed( int ) ) );
112 112
113 113
114 114
115 115
116 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 116 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
117 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 117 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
118 118
119 119
120 mClient = new QComboBox( mExternalAppGroupBox ); 120 mClient = new QComboBox( mExternalAppGroupBox );
121 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); 121 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
122 122
123 connect( mClient, SIGNAL( activated( int ) ), 123 connect( mClient, SIGNAL( activated( int ) ),
124 this, SLOT (client_changed( int ) ) ); 124 this, SLOT (client_changed( int ) ) );
125 125
126 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); 126 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
127 boxLayout->addWidget( lab, 1, 0 ); 127 boxLayout->addWidget( lab, 1, 0 );
128 mChannel = new QLineEdit(mExternalAppGroupBox); 128 mChannel = new QLineEdit(mExternalAppGroupBox);
129 mChannel->setReadOnly(true); 129 mChannel->setReadOnly(true);
130 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); 130 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
131 131
132 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); 132 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
133 boxLayout->addWidget( lab, 3, 0 ); 133 boxLayout->addWidget( lab, 3, 0 );
134 mMessage = new QLineEdit(mExternalAppGroupBox); 134 mMessage = new QLineEdit(mExternalAppGroupBox);
135 mMessage->setReadOnly(true); 135 mMessage->setReadOnly(true);
136 boxLayout->addWidget( mMessage , 4, 0); 136 boxLayout->addWidget( mMessage , 4, 0);
137 137
138 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); 138 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
139 boxLayout->addWidget( lab, 3, 1 ); 139 boxLayout->addWidget( lab, 3, 1 );
140 mParameters = new QLineEdit(mExternalAppGroupBox); 140 mParameters = new QLineEdit(mExternalAppGroupBox);
141 mParameters->setReadOnly(true); 141 mParameters->setReadOnly(true);
142 boxLayout->addWidget( mParameters, 4, 1 ); 142 boxLayout->addWidget( mParameters, 4, 1 );
143 143
144 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox);
145 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 );
146
144 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); 147 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
145 boxLayout->addWidget( lab, 5, 0 ); 148 boxLayout->addWidget( lab, 6, 0 );
146 mMessage2 = new QLineEdit(mExternalAppGroupBox); 149 mMessage2 = new QLineEdit(mExternalAppGroupBox);
147 mMessage2->setReadOnly(true); 150 mMessage2->setReadOnly(true);
148 boxLayout->addWidget( mMessage2 , 6, 0); 151 boxLayout->addWidget( mMessage2 , 7, 0);
149 152
150 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); 153 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
151 boxLayout->addWidget( lab, 5, 1 ); 154 boxLayout->addWidget( lab, 6, 1 );
152 mParameters2 = new QLineEdit(mExternalAppGroupBox); 155 mParameters2 = new QLineEdit(mExternalAppGroupBox);
153 mParameters2->setReadOnly(true); 156 mParameters2->setReadOnly(true);
154 boxLayout->addWidget( mParameters2, 6, 1 ); 157 boxLayout->addWidget( mParameters2, 7, 1 );
155 158
156 lab = new QLabel( i18n("HINT: Delimiter=; Data=%1 "), mExternalAppGroupBox); 159 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox);
157 boxLayout->addMultiCellWidget( lab, 7, 7, 0, 1 ); 160 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 );
158 161
159 162
160 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 163 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
161 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 164 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
162 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 165 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
163 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 166 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
164 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 167 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
165 168
166 169
167 170
168 layout->addWidget( mExternalAppGroupBox ); 171 layout->addWidget( mExternalAppGroupBox );
169 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); 172 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
170 173
171} 174}
172 175
173void KDEPIMConfigWidget::externalapp_changed( int newApp ) 176void KDEPIMConfigWidget::externalapp_changed( int newApp )
174{ 177{
175 // first store the current data 178 // first store the current data
176 saveEditFieldSettings(); 179 saveEditFieldSettings();
177 180
178 // set mCurrentApp 181 // set mCurrentApp
179 mCurrentApp = (ExternalAppHandler::Types)newApp; 182 mCurrentApp = (ExternalAppHandler::Types)newApp;
180 183
181 // set mCurrentClient 184 // set mCurrentClient
182 switch(mCurrentApp) 185 switch(mCurrentApp)
183 { 186 {
184 case(ExternalAppHandler::EMAIL): 187 case(ExternalAppHandler::EMAIL):
185 mCurrentClient = mEmailClient; 188 mCurrentClient = mEmailClient;
186 break; 189 break;
187 case(ExternalAppHandler::PHONE): 190 case(ExternalAppHandler::PHONE):
188 mCurrentClient = mPhoneClient; 191 mCurrentClient = mPhoneClient;
189 break; 192 break;
190 case(ExternalAppHandler::SMS): 193 case(ExternalAppHandler::SMS):
191 mCurrentClient = mSMSClient; 194 mCurrentClient = mSMSClient;
192 break; 195 break;
193 case(ExternalAppHandler::FAX): 196 case(ExternalAppHandler::FAX):
194 mCurrentClient = mFaxClient; 197 mCurrentClient = mFaxClient;
195 break; 198 break;
196 case(ExternalAppHandler::PAGER): 199 case(ExternalAppHandler::PAGER):
197 mCurrentClient = mPagerClient; 200 mCurrentClient = mPagerClient;
198 break; 201 break;
199 default: 202 default:
200 return; 203 return;
201 } 204 }
202 205
203 // and at last update the widgets 206 // and at last update the widgets
204 updateClientWidgets(); 207 updateClientWidgets();
205} 208}