summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-10-30 15:56:24 (UTC)
committer zautrix <zautrix>2004-10-30 15:56:24 (UTC)
commitc8662dc632987a317386b923e24acb9507859528 (patch) (unidiff)
tree97ca9b266d075c3c0f2689769829c453f8118cd8 /kmicromail
parent632b43950f1ac2980c281eb8901d797deb0ba971 (diff)
downloadkdepimpi-c8662dc632987a317386b923e24acb9507859528.zip
kdepimpi-c8662dc632987a317386b923e24acb9507859528.tar.gz
kdepimpi-c8662dc632987a317386b923e24acb9507859528.tar.bz2
ompi desktop compile hack
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp26
-rw-r--r--kmicromail/defines.h2
-rw-r--r--kmicromail/editaccounts.cpp3
-rw-r--r--kmicromail/kmicromail.pro3
-rw-r--r--kmicromail/koprefsdialog.cpp2
-rw-r--r--kmicromail/libmailwrapper/libmailwrapper.pro3
-rw-r--r--kmicromail/mainwindow.cpp2
-rw-r--r--kmicromail/nntpgroupsdlg.cpp2
-rw-r--r--kmicromail/opiemail.cpp9
-rw-r--r--kmicromail/qpe/qdialog.h35
-rw-r--r--kmicromail/qpe/qdialog_hacked.cpp30
-rw-r--r--kmicromail/viewmail.cpp27
-rw-r--r--kmicromail/viewmail.h4
13 files changed, 114 insertions, 34 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 0cd0b23..5945b7f 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,422 +1,428 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3#include <kabc/addresseedialog.h>
4#include <kabc/stdaddressbook.h>
5#include <kabc/addressee.h>
6#ifdef DESKTOP_VERSION
7#include <qapplication.h>
8#include <kabc/addresseedialog.h>
9#endif //DESKTOP_VERSION
10#include <libkdepim/externalapphandler.h>
11
12#include "koprefs.h"
13
14#ifdef MINIKDE_KDIALOG_H
15#undef MINIKDE_KDIALOG_H
16#endif
17
18
3#include "composemail.h" 19#include "composemail.h"
4 20
5#include <libmailwrapper/smtpwrapper.h> 21#include <libmailwrapper/smtpwrapper.h>
6#include <libmailwrapper/storemail.h> 22#include <libmailwrapper/storemail.h>
7#include <libmailwrapper/abstractmail.h> 23#include <libmailwrapper/abstractmail.h>
8#include <libmailwrapper/mailtypes.h> 24#include <libmailwrapper/mailtypes.h>
9 25
10/* OPIE */ 26/* OPIE */
11//#include <opie2/ofiledialog.h> 27//#include <opie2/ofiledialog.h>
12//#include <opie2/odebug.h> 28//#include <opie2/odebug.h>
13#include <kfiledialog.h> 29#include <kfiledialog.h>
14//#include <qpe/resource.h> 30//#include <qpe/resource.h>
15#include <qpe/global.h> 31#include <qpe/global.h>
16//#include <qpe/contact.h> 32//#include <qpe/contact.h>
17 33
18 34
19#include <qcombobox.h> 35#include <qcombobox.h>
20#include <qcheckbox.h> 36#include <qcheckbox.h>
21#include <qiconset.h> 37#include <qiconset.h>
22#include <qtimer.h> 38#include <qtimer.h>
23#include <qmessagebox.h> 39#include <qmessagebox.h>
24#include <qpushbutton.h> 40#include <qpushbutton.h>
25#include <qmultilineedit.h> 41#include <qmultilineedit.h>
26#include <qlabel.h> 42#include <qlabel.h>
27#include <qtabwidget.h> 43#include <qtabwidget.h>
28#include <qlistview.h> 44#include <qlistview.h>
29#include <kabc/addresseedialog.h>
30#include <kabc/stdaddressbook.h>
31#include <kabc/addressee.h>
32#ifdef DESKTOP_VERSION
33#include <qapplication.h>
34#include <kabc/addresseedialog.h>
35#endif //DESKTOP_VERSION
36#include <libkdepim/externalapphandler.h>
37
38#include "koprefs.h"
39 45
40//using namespace Opie::Core; 46//using namespace Opie::Core;
41//using namespace Opie::Ui; 47//using namespace Opie::Ui;
42ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) 48ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal )
43 : ComposeMailUI( parent, name, modal ) 49 : ComposeMailUI( parent, name, modal )
44{ 50{
45 mPickLineEdit = 0; 51 mPickLineEdit = 0;
46 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 52 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
47 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 53 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
48 settings = s; 54 settings = s;
49 m_replyid = ""; 55 m_replyid = "";
50 if ( KOPrefs::instance()->mUseKapi) { 56 if ( KOPrefs::instance()->mUseKapi) {
51 KConfig config( locateLocal("config", "kabcrc") ); 57 KConfig config( locateLocal("config", "kabcrc") );
52 config.setGroup( "General" ); 58 config.setGroup( "General" );
53 QString whoami_uid = config.readEntry( "WhoAmI" ); 59 QString whoami_uid = config.readEntry( "WhoAmI" );
54 60
55 if ( whoami_uid.isEmpty() ) { 61 if ( whoami_uid.isEmpty() ) {
56 QMessageBox::information( 0, i18n( "Hint" ), 62 QMessageBox::information( 0, i18n( "Hint" ),
57 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 63 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
58 i18n( "Ok" ) ); 64 i18n( "Ok" ) );
59 65
60 66
61 fillSettings(); 67 fillSettings();
62 } else 68 } else
63 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); 69 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
64 70
65 71
66#ifdef DESKTOP_VERSION 72#ifdef DESKTOP_VERSION
67 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 73 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
68 QStringList mails = con.emails(); 74 QStringList mails = con.emails();
69 QString defmail = con.preferredEmail(); 75 QString defmail = con.preferredEmail();
70 if ( mails.count() == 0) 76 if ( mails.count() == 0)
71 QMessageBox::information( 0, i18n( "Hint" ), 77 QMessageBox::information( 0, i18n( "Hint" ),
72 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 78 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
73 i18n( "Ok" ) ); 79 i18n( "Ok" ) );
74 if (defmail.length()!=0) { 80 if (defmail.length()!=0) {
75 fromBox->insertItem(defmail); 81 fromBox->insertItem(defmail);
76 } 82 }
77 QStringList::ConstIterator sit = mails.begin(); 83 QStringList::ConstIterator sit = mails.begin();
78 for (;sit!=mails.end();++sit) { 84 for (;sit!=mails.end();++sit) {
79 if ( (*sit)==defmail) 85 if ( (*sit)==defmail)
80 continue; 86 continue;
81 fromBox->insertItem((*sit)); 87 fromBox->insertItem((*sit));
82 } 88 }
83 senderNameEdit->setText(con.formattedName()); 89 senderNameEdit->setText(con.formattedName());
84#endif 90#endif
85 91
86 } else { 92 } else {
87 fillSettings(); 93 fillSettings();
88 } 94 }
89 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); 95 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
90 96
91 attList->addColumn( i18n( "Name" ) ); 97 attList->addColumn( i18n( "Name" ) );
92 attList->addColumn( i18n( "Size" ) ); 98 attList->addColumn( i18n( "Size" ) );
93 QList<Account> accounts = settings->getAccounts(); 99 QList<Account> accounts = settings->getAccounts();
94 100
95 if ( QApplication::desktop()->width() < 320 ) 101 if ( QApplication::desktop()->width() < 320 )
96 smtpAccountBox->setMaximumWidth( 80 ); 102 smtpAccountBox->setMaximumWidth( 80 );
97 Account *it; 103 Account *it;
98 for ( it = accounts.first(); it; it = accounts.next() ) { 104 for ( it = accounts.first(); it; it = accounts.next() ) {
99 if ( it->getType()==MAILLIB::A_SMTP ) { 105 if ( it->getType()==MAILLIB::A_SMTP ) {
100 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 106 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
101 smtpAccountBox->insertItem( smtp->getAccountName() ); 107 smtpAccountBox->insertItem( smtp->getAccountName() );
102 smtpAccounts.append( smtp ); 108 smtpAccounts.append( smtp );
103 } 109 }
104 } 110 }
105 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 111 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
106 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 112 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
107 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 113 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
108 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 114 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
109 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 115 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
110 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 116 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
111 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 117 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
112 mMail = 0; 118 mMail = 0;
113 warnAttach = true; 119 warnAttach = true;
114 QIconSet icon; 120 QIconSet icon;
115 //icon = SmallIcon("fileexport"); 121 //icon = SmallIcon("fileexport");
116 icon = SmallIcon("filesave"); 122 icon = SmallIcon("filesave");
117 SaveButton->setIconSet (icon ) ; 123 SaveButton->setIconSet (icon ) ;
118 if ( QApplication::desktop()->width() < 320 ) { 124 if ( QApplication::desktop()->width() < 320 ) {
119 SaveButton->setText ("") ; 125 SaveButton->setText ("") ;
120 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; 126 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ;
121 } 127 }
122 else 128 else
123 SaveButton->setText (i18n("Save")); 129 SaveButton->setText (i18n("Save"));
124#ifndef DESKTOP_VERSION 130#ifndef DESKTOP_VERSION
125 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); 131 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold );
126 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); 132 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold );
127 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); 133 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold );
128#endif 134#endif
129 message->setFont ( KOPrefs::instance()->mComposeFont ); 135 message->setFont ( KOPrefs::instance()->mComposeFont );
130 message->setWordWrap (QMultiLineEdit::WidgetWidth); 136 message->setWordWrap (QMultiLineEdit::WidgetWidth);
131 if ( smtpAccounts.count() > 0 ) { 137 if ( smtpAccounts.count() > 0 ) {
132 fillValues( smtpAccountBox->currentItem() ); 138 fillValues( smtpAccountBox->currentItem() );
133 } else { 139 } else {
134 QMessageBox::information( 0, i18n( "Problem" ), 140 QMessageBox::information( 0, i18n( "Problem" ),
135 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), 141 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ),
136 i18n( "Ok" ) ); 142 i18n( "Ok" ) );
137 return; 143 return;
138 } 144 }
139 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 145 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
140 146
141 147
142} 148}
143 149
144void ComposeMail::fillSettings() 150void ComposeMail::fillSettings()
145{ 151{
146 if ( QApplication::desktop()->width() < 320 ) 152 if ( QApplication::desktop()->width() < 320 )
147 fromBox->setMaximumWidth( 100 ); 153 fromBox->setMaximumWidth( 100 );
148 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); 154 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
149 QStringList::ConstIterator sit = mailList.begin(); 155 QStringList::ConstIterator sit = mailList.begin();
150 int pref = 0; 156 int pref = 0;
151 for (;sit!=mailList.end();++sit) { 157 for (;sit!=mailList.end();++sit) {
152 fromBox->insertItem((*sit)); 158 fromBox->insertItem((*sit));
153 } 159 }
154 senderNameEdit->setText(KOPrefs::instance()->mName); 160 senderNameEdit->setText(KOPrefs::instance()->mName);
155} 161}
156 162
157 163
158void ComposeMail::saveAsDraft() 164void ComposeMail::saveAsDraft()
159{ 165{
160 166
161 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 167 Opie::Core::OSmartPointer<Mail> mail= new Mail();
162 mail->setMail(fromBox->currentText()); 168 mail->setMail(fromBox->currentText());
163 mail->setTo( toLine->text() ); 169 mail->setTo( toLine->text() );
164 mail->setName(senderNameEdit->text()); 170 mail->setName(senderNameEdit->text());
165 mail->setCC( ccLine->text() ); 171 mail->setCC( ccLine->text() );
166 mail->setBCC( bccLine->text() ); 172 mail->setBCC( bccLine->text() );
167 mail->setReply( replyLine->text() ); 173 mail->setReply( replyLine->text() );
168 mail->setSubject( subjectLine->text() ); 174 mail->setSubject( subjectLine->text() );
169 if (!m_replyid.isEmpty()) { 175 if (!m_replyid.isEmpty()) {
170 QStringList ids; 176 QStringList ids;
171 ids.append(m_replyid); 177 ids.append(m_replyid);
172 mail->setInreply(ids); 178 mail->setInreply(ids);
173 } 179 }
174 QString txt = message->text(); 180 QString txt = message->text();
175 if ( !sigMultiLine->text().isEmpty() ) { 181 if ( !sigMultiLine->text().isEmpty() ) {
176 txt.append( "\n--\n" ); 182 txt.append( "\n--\n" );
177 txt.append( sigMultiLine->text() ); 183 txt.append( sigMultiLine->text() );
178 } 184 }
179 mail->setMessage( txt ); 185 mail->setMessage( txt );
180 186
181 /* only use the default drafts folder name! */ 187 /* only use the default drafts folder name! */
182 Storemail wrapper(AbstractMail::draftFolder()); 188 Storemail wrapper(AbstractMail::draftFolder());
183 wrapper.storeMail(mail); 189 wrapper.storeMail(mail);
184 190
185 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 191 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
186 /* attachments we will ignore! */ 192 /* attachments we will ignore! */
187 if ( it != 0 ) { 193 if ( it != 0 ) {
188 if ( warnAttach ) 194 if ( warnAttach )
189 QMessageBox::warning(0,i18n("Store message"), 195 QMessageBox::warning(0,i18n("Store message"),
190 i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); 196 i18n("<center>Attachments will not be stored in \"Draft\" folder</center>"));
191 warnAttach = false; 197 warnAttach = false;
192 } 198 }
193 setStatus( i18n("Mail saved as draft!") ); 199 setStatus( i18n("Mail saved as draft!") );
194} 200}
195void ComposeMail::clearStatus() 201void ComposeMail::clearStatus()
196{ 202{
197 topLevelWidget()->setCaption( i18n("Compose mail") ); 203 topLevelWidget()->setCaption( i18n("Compose mail") );
198} 204}
199void ComposeMail::setStatus( QString status ) 205void ComposeMail::setStatus( QString status )
200{ 206{
201 topLevelWidget()->setCaption( status ); 207 topLevelWidget()->setCaption( status );
202 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; 208 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
203} 209}
204void ComposeMail::pickAddress( ) 210void ComposeMail::pickAddress( )
205{ 211{
206 212
207 QLineEdit *line = mPickLineEdit; 213 QLineEdit *line = mPickLineEdit;
208 if ( line == 0 ) 214 if ( line == 0 )
209 return; 215 return;
210#ifdef DESKTOP_VERSION 216#ifdef DESKTOP_VERSION
211 //qDebug(" ComposeMail::pickAddress "); 217 //qDebug(" ComposeMail::pickAddress ");
212 QString names ;//= AddressPicker::getNames(); 218 QString names ;//= AddressPicker::getNames();
213 219
214 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 220 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
215 uint i=0; 221 uint i=0;
216 for (i=0; i < list.count(); i++) { 222 for (i=0; i < list.count(); i++) {
217 if ( !list[i].preferredEmail().isEmpty()) { 223 if ( !list[i].preferredEmail().isEmpty()) {
218 if ( ! names.isEmpty() ) 224 if ( ! names.isEmpty() )
219 names+= ","; 225 names+= ",";
220 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 226 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
221 227
222 } 228 }
223 } 229 }
224 230
225 231
226 if ( line->text().isEmpty() ) { 232 if ( line->text().isEmpty() ) {
227 line->setText( names ); 233 line->setText( names );
228 } else if ( !names.isEmpty() ) { 234 } else if ( !names.isEmpty() ) {
229 line->setText( line->text() + ", " + names ); 235 line->setText( line->text() + ", " + names );
230 } 236 }
231#else 237#else
232 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); 238 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
233 // the result should now arrive through method insertAttendees 239 // the result should now arrive through method insertAttendees
234#endif 240#endif
235} 241}
236//the map includes name/email pairs, that comes from Ka/Pi 242//the map includes name/email pairs, that comes from Ka/Pi
237void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 243void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
238{ 244{
239 //qDebug("ComposeMail::insertAttendees "); 245 //qDebug("ComposeMail::insertAttendees ");
240 raise(); 246 raise();
241 247
242 if ( mPickLineEdit == 0 ) { //whoami received 248 if ( mPickLineEdit == 0 ) { //whoami received
243 QString defmail = uidList[0]; 249 QString defmail = uidList[0];
244 if ( emailList.count() == 0 ) 250 if ( emailList.count() == 0 )
245 QMessageBox::information( 0, i18n( "Hint" ), 251 QMessageBox::information( 0, i18n( "Hint" ),
246 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 252 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
247 i18n( "Ok" ) ); 253 i18n( "Ok" ) );
248 if (defmail.length()!=0) { 254 if (defmail.length()!=0) {
249 fromBox->insertItem(defmail); 255 fromBox->insertItem(defmail);
250 } 256 }
251 QStringList::ConstIterator sit = emailList.begin(); 257 QStringList::ConstIterator sit = emailList.begin();
252 int pref = 0; 258 int pref = 0;
253 for (;sit!=emailList.end();++sit) { 259 for (;sit!=emailList.end();++sit) {
254 if ( (*sit)==defmail) 260 if ( (*sit)==defmail)
255 continue; 261 continue;
256 fromBox->insertItem((*sit)); 262 fromBox->insertItem((*sit));
257 } 263 }
258 senderNameEdit->setText(nameList[0]); 264 senderNameEdit->setText(nameList[0]);
259 return; 265 return;
260 } 266 }
261 QString names ; 267 QString names ;
262 QLineEdit *line = mPickLineEdit; 268 QLineEdit *line = mPickLineEdit;
263 if (uid == this->name()) 269 if (uid == this->name())
264 { 270 {
265 for ( int i = 0; i < nameList.count(); i++) 271 for ( int i = 0; i < nameList.count(); i++)
266 { 272 {
267 QString _name = nameList[i]; 273 QString _name = nameList[i];
268 QString _email = emailList[i]; 274 QString _email = emailList[i];
269 QString _uid = uidList[i]; 275 QString _uid = uidList[i];
270 if ( ! _email.isEmpty() ) { 276 if ( ! _email.isEmpty() ) {
271 if ( ! names.isEmpty() ) 277 if ( ! names.isEmpty() )
272 names+= ","; 278 names+= ",";
273 names+= "\""+_name +"\"<" +_email +">"; 279 names+= "\""+_name +"\"<" +_email +">";
274 } 280 }
275 } 281 }
276 } 282 }
277 if ( line->text().isEmpty() ) { 283 if ( line->text().isEmpty() ) {
278 line->setText( names ); 284 line->setText( names );
279 } else if ( !names.isEmpty() ) { 285 } else if ( !names.isEmpty() ) {
280 line->setText( line->text() + ", " + names ); 286 line->setText( line->text() + ", " + names );
281 } 287 }
282} 288}
283 289
284void ComposeMail::setTo( const QString & to ) 290void ComposeMail::setTo( const QString & to )
285{ 291{
286 toLine->setText( to ); 292 toLine->setText( to );
287} 293}
288 294
289void ComposeMail::setSubject( const QString & subject ) 295void ComposeMail::setSubject( const QString & subject )
290{ 296{
291 subjectLine->setText( subject ); 297 subjectLine->setText( subject );
292} 298}
293 299
294void ComposeMail::setInReplyTo( const QString & messageId ) 300void ComposeMail::setInReplyTo( const QString & messageId )
295{ 301{
296 m_replyid = messageId; 302 m_replyid = messageId;
297} 303}
298 304
299void ComposeMail::setMessage( const QString & text ) 305void ComposeMail::setMessage( const QString & text )
300{ 306{
301 message->setText( text ); 307 message->setText( text );
302} 308}
303 309
304 310
305void ComposeMail::pickAddressTo() 311void ComposeMail::pickAddressTo()
306{ 312{
307 mPickLineEdit = toLine; 313 mPickLineEdit = toLine;
308 pickAddress( ); 314 pickAddress( );
309} 315}
310 316
311void ComposeMail::pickAddressCC() 317void ComposeMail::pickAddressCC()
312{ 318{
313 mPickLineEdit = ccLine; 319 mPickLineEdit = ccLine;
314 pickAddress( ); 320 pickAddress( );
315} 321}
316 322
317void ComposeMail::pickAddressBCC() 323void ComposeMail::pickAddressBCC()
318{ 324{
319 mPickLineEdit = bccLine; 325 mPickLineEdit = bccLine;
320 pickAddress( ); 326 pickAddress( );
321} 327}
322 328
323void ComposeMail::pickAddressReply() 329void ComposeMail::pickAddressReply()
324{ 330{
325 mPickLineEdit = replyLine; 331 mPickLineEdit = replyLine;
326 pickAddress( ); 332 pickAddress( );
327} 333}
328 334
329void ComposeMail::fillValues( int ) 335void ComposeMail::fillValues( int )
330{ 336{
331#if 0 337#if 0
332 SMTPaccount *smtp = smtpAccounts.at( current ); 338 SMTPaccount *smtp = smtpAccounts.at( current );
333 ccLine->clear(); 339 ccLine->clear();
334 if ( smtp->getUseCC() ) { 340 if ( smtp->getUseCC() ) {
335 ccLine->setText( smtp->getCC() ); 341 ccLine->setText( smtp->getCC() );
336 } 342 }
337 bccLine->clear(); 343 bccLine->clear();
338 if ( smtp->getUseBCC() ) { 344 if ( smtp->getUseBCC() ) {
339 bccLine->setText( smtp->getBCC() ); 345 bccLine->setText( smtp->getBCC() );
340 } 346 }
341 replyLine->clear(); 347 replyLine->clear();
342 if ( smtp->getUseReply() ) { 348 if ( smtp->getUseReply() ) {
343 replyLine->setText( smtp->getReply() ); 349 replyLine->setText( smtp->getReply() );
344 } 350 }
345 sigMultiLine->setText( smtp->getSignature() ); 351 sigMultiLine->setText( smtp->getSignature() );
346#endif 352#endif
347} 353}
348 354
349void ComposeMail::slotAdjustColumns() 355void ComposeMail::slotAdjustColumns()
350{ 356{
351 int currPage = tabWidget->currentPageIndex(); 357 int currPage = tabWidget->currentPageIndex();
352 358
353 tabWidget->showPage( attachTab ); 359 tabWidget->showPage( attachTab );
354 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 360 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
355 attList->setColumnWidth( 1, 80 ); 361 attList->setColumnWidth( 1, 80 );
356 362
357 tabWidget->setCurrentPage( currPage ); 363 tabWidget->setCurrentPage( currPage );
358} 364}
359 365
360void ComposeMail::addAttachment() 366void ComposeMail::addAttachment()
361{ 367{
362 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); 368 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this );
363 if ( !lnk.isEmpty() ) { 369 if ( !lnk.isEmpty() ) {
364 Attachment *att = new Attachment( lnk ); 370 Attachment *att = new Attachment( lnk );
365 (void) new AttachViewItem( attList, att ); 371 (void) new AttachViewItem( attList, att );
366 } 372 }
367} 373}
368 374
369void ComposeMail::removeAttachment() 375void ComposeMail::removeAttachment()
370{ 376{
371 if ( !attList->currentItem() ) { 377 if ( !attList->currentItem() ) {
372 QMessageBox::information( this, i18n( "Error" ), 378 QMessageBox::information( this, i18n( "Error" ),
373 i18n( "<p>Please select a File.</p>" ), 379 i18n( "<p>Please select a File.</p>" ),
374 i18n( "Ok" ) ); 380 i18n( "Ok" ) );
375 } else { 381 } else {
376 attList->takeItem( attList->currentItem() ); 382 attList->takeItem( attList->currentItem() );
377 } 383 }
378} 384}
379 385
380void ComposeMail::accept() 386void ComposeMail::accept()
381{ 387{
382 if ( smtpAccountBox->count() == 0 ) { 388 if ( smtpAccountBox->count() == 0 ) {
383 389
384 reject(); 390 reject();
385 return; 391 return;
386 } 392 }
387 393
388 if (! checkBoxLater->isChecked() ) { 394 if (! checkBoxLater->isChecked() ) {
389 int yesno = QMessageBox::warning(0,i18n("Stop editing message"), 395 int yesno = QMessageBox::warning(0,i18n("Stop editing message"),
390 i18n("Send this message?"), 396 i18n("Send this message?"),
391 i18n("Yes"), 397 i18n("Yes"),
392 i18n("Cancel")); 398 i18n("Cancel"));
393 399
394 if (yesno == 1) { 400 if (yesno == 1) {
395 return; 401 return;
396 } 402 }
397 } 403 }
398#if 0 404#if 0
399 odebug << "Sending Mail with " 405 odebug << "Sending Mail with "
400 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; 406 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl;
401#endif 407#endif
402 Opie::Core::OSmartPointer<Mail> mail=new Mail; 408 Opie::Core::OSmartPointer<Mail> mail=new Mail;
403 409
404 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 410 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
405 mail->setMail(fromBox->currentText()); 411 mail->setMail(fromBox->currentText());
406 412
407 if ( !toLine->text().isEmpty() ) { 413 if ( !toLine->text().isEmpty() ) {
408 mail->setTo( toLine->text() ); 414 mail->setTo( toLine->text() );
409 } else { 415 } else {
410 QMessageBox::warning(0,i18n("Sending mail"), 416 QMessageBox::warning(0,i18n("Sending mail"),
411 i18n("No Receiver spezified" ) ); 417 i18n("No Receiver spezified" ) );
412 return; 418 return;
413 } 419 }
414 420
415 mail->setName(senderNameEdit->text()); 421 mail->setName(senderNameEdit->text());
416 mail->setCC( ccLine->text() ); 422 mail->setCC( ccLine->text() );
417 mail->setBCC( bccLine->text() ); 423 mail->setBCC( bccLine->text() );
418 mail->setReply( replyLine->text() ); 424 mail->setReply( replyLine->text() );
419 mail->setSubject( subjectLine->text() ); 425 mail->setSubject( subjectLine->text() );
420 if (!m_replyid.isEmpty()) { 426 if (!m_replyid.isEmpty()) {
421 QStringList ids; 427 QStringList ids;
422 ids.append(m_replyid); 428 ids.append(m_replyid);
diff --git a/kmicromail/defines.h b/kmicromail/defines.h
index f2d7265..c890def 100644
--- a/kmicromail/defines.h
+++ b/kmicromail/defines.h
@@ -1,36 +1,36 @@
1#ifndef DEFINE_CONSTANTS_H 1#ifndef DEFINE_CONSTANTS_H
2#define DEFINE_CONSTANTS_H 2#define DEFINE_CONSTANTS_H
3 3
4 4
5 5
6#define USER_AGENT "KMicroMail v1.92" 6#define USER_AGENT "KOpieMail v1.9.11"
7 7
8#define PIXMAP_IMAPFOLDER SmallIcon ( "imapfolder" ) 8#define PIXMAP_IMAPFOLDER SmallIcon ( "imapfolder" )
9#define PIXMAP_POP3FOLDER SmallIcon ( "pop3folder" ) 9#define PIXMAP_POP3FOLDER SmallIcon ( "pop3folder" )
10#define PIXMAP_INBOXFOLDER SmallIcon ( "inbox" ) 10#define PIXMAP_INBOXFOLDER SmallIcon ( "inbox" )
11#define PIXMAP_MBOXFOLDER SmallIcon ( "mboxfolder" ) 11#define PIXMAP_MBOXFOLDER SmallIcon ( "mboxfolder" )
12#define PIXMAP_OUTBOXFOLDER SmallIcon ( "outbox" ) 12#define PIXMAP_OUTBOXFOLDER SmallIcon ( "outbox" )
13#define PIXMAP_LOCALFOLDER SmallIcon ( "localfolder" ) 13#define PIXMAP_LOCALFOLDER SmallIcon ( "localfolder" )
14#define PIXMAP_OFFLINE SmallIcon ( "notconnected" ) 14#define PIXMAP_OFFLINE SmallIcon ( "notconnected" )
15 15
16#define IMAP_PORT "143" 16#define IMAP_PORT "143"
17#define IMAP_SSL_PORT "993" 17#define IMAP_SSL_PORT "993"
18#define SMTP_PORT "25" 18#define SMTP_PORT "25"
19#define SMTP_SSL_PORT "465" 19#define SMTP_SSL_PORT "465"
20#define POP3_PORT "110" 20#define POP3_PORT "110"
21#define POP3_SSL_PORT "995" 21#define POP3_SSL_PORT "995"
22#define NNTP_PORT "119" 22#define NNTP_PORT "119"
23#define NNTP_SSL_PORT "563" 23#define NNTP_SSL_PORT "563"
24 24
25/* used for decoding imapfoldername */ 25/* used for decoding imapfoldername */
26#define UNDEFINED 64 26#define UNDEFINED 64
27#define MAXLINE 76 27#define MAXLINE 76
28#define UTF16MASK 0x03FFUL 28#define UTF16MASK 0x03FFUL
29#define UTF16SHIFT 10 29#define UTF16SHIFT 10
30#define UTF16BASE 0x10000UL 30#define UTF16BASE 0x10000UL
31#define UTF16HIGHSTART 0xD800UL 31#define UTF16HIGHSTART 0xD800UL
32#define UTF16HIGHEND 0xDBFFUL 32#define UTF16HIGHEND 0xDBFFUL
33#define UTF16LOSTART 0xDC00UL 33#define UTF16LOSTART 0xDC00UL
34#define UTF16LOEND 0xDFFFUL 34#define UTF16LOEND 0xDFFFUL
35 35
36#endif 36#endif
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index c931e45..0d30097 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -1,388 +1,389 @@
1 1
2#include <qdialog.h>
3#include "kapplication.h"
2#include "defines.h" 4#include "defines.h"
3#include "editaccounts.h" 5#include "editaccounts.h"
4#include "kapplication.h"
5/* OPIE */ 6/* OPIE */
6#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
7 8
8/* QT */ 9/* QT */
9#include <qstringlist.h> 10#include <qstringlist.h>
10 11
11#include <qcombobox.h> 12#include <qcombobox.h>
12#include <qcheckbox.h> 13#include <qcheckbox.h>
13#include <qmessagebox.h> 14#include <qmessagebox.h>
14#include <qpushbutton.h> 15#include <qpushbutton.h>
15#include <qlineedit.h> 16#include <qlineedit.h>
16#include <qlabel.h> 17#include <qlabel.h>
17#include <qtabwidget.h> 18#include <qtabwidget.h>
18#include <qlistview.h> 19#include <qlistview.h>
19#include <qspinbox.h> 20#include <qspinbox.h>
20#include <klocale.h> 21#include <klocale.h>
21 22
22#include <libmailwrapper/nntpwrapper.h> 23#include <libmailwrapper/nntpwrapper.h>
23 24
24using namespace Opie::Core; 25using namespace Opie::Core;
25 26
26AccountListItem::AccountListItem( QListView *parent, Account *a) 27AccountListItem::AccountListItem( QListView *parent, Account *a)
27 : QListViewItem( parent ) 28 : QListViewItem( parent )
28{ 29{
29 account = a; 30 account = a;
30 setText( 0, account->getAccountName() ); 31 setText( 0, account->getAccountName() );
31 QString ttext = ""; 32 QString ttext = "";
32 switch (account->getType()) { 33 switch (account->getType()) {
33 case MAILLIB::A_NNTP: 34 case MAILLIB::A_NNTP:
34 ttext="NNTP"; 35 ttext="NNTP";
35 break; 36 break;
36 case MAILLIB::A_POP3: 37 case MAILLIB::A_POP3:
37 ttext = "POP3"; 38 ttext = "POP3";
38 break; 39 break;
39 case MAILLIB::A_IMAP: 40 case MAILLIB::A_IMAP:
40 ttext = "IMAP"; 41 ttext = "IMAP";
41 break; 42 break;
42 case MAILLIB::A_SMTP: 43 case MAILLIB::A_SMTP:
43 ttext = "SMTP"; 44 ttext = "SMTP";
44 break; 45 break;
45 default: 46 default:
46 ttext = "UNKNOWN"; 47 ttext = "UNKNOWN";
47 break; 48 break;
48 } 49 }
49 setText( 1, ttext); 50 setText( 1, ttext);
50} 51}
51 52
52EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 53EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
53 : EditAccountsUI( parent, name, modal, flags ) 54 : EditAccountsUI( parent, name, modal, flags )
54{ 55{
55 settings = s; 56 settings = s;
56 57
57 mailList->addColumn( i18n( "Account" ) ); 58 mailList->addColumn( i18n( "Account" ) );
58 mailList->addColumn( i18n( "Type" ) ); 59 mailList->addColumn( i18n( "Type" ) );
59 60
60 newsList->addColumn( i18n( "Account" ) ); 61 newsList->addColumn( i18n( "Account" ) );
61 62
62 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); 63 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
63 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); 64 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
64 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); 65 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
65 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); 66 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
66 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); 67 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
67 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); 68 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) );
68 69
69 slotFillLists(); 70 slotFillLists();
70} 71}
71 72
72void EditAccounts::slotFillLists() 73void EditAccounts::slotFillLists()
73{ 74{
74 mailList->clear(); 75 mailList->clear();
75 newsList->clear(); 76 newsList->clear();
76 77
77 QList<Account> accounts = settings->getAccounts(); 78 QList<Account> accounts = settings->getAccounts();
78 Account *it; 79 Account *it;
79 for ( it = accounts.first(); it; it = accounts.next() ) 80 for ( it = accounts.first(); it; it = accounts.next() )
80 { 81 {
81 if ( it->getType()==MAILLIB::A_NNTP ) 82 if ( it->getType()==MAILLIB::A_NNTP )
82 { 83 {
83 (void) new AccountListItem( newsList, it ); 84 (void) new AccountListItem( newsList, it );
84 } 85 }
85 else 86 else
86 { 87 {
87 (void) new AccountListItem( mailList, it ); 88 (void) new AccountListItem( mailList, it );
88 } 89 }
89 } 90 }
90} 91}
91 92
92void EditAccounts::slotNewMail() 93void EditAccounts::slotNewMail()
93{ 94{
94 QString *selection = new QString(); 95 QString *selection = new QString();
95 SelectMailType selType( selection, this, 0, true ); 96 SelectMailType selType( selection, this, 0, true );
96 selType.show(); 97 selType.show();
97 if ( QDialog::Accepted == selType.exec() ) 98 if ( QDialog::Accepted == selType.exec() )
98 { 99 {
99 slotNewAccount( *selection ); 100 slotNewAccount( *selection );
100 } 101 }
101} 102}
102 103
103void EditAccounts::slotNewAccount( const QString &type ) 104void EditAccounts::slotNewAccount( const QString &type )
104{ 105{
105 if ( type.compare( i18n("IMAP") ) == 0 ) 106 if ( type.compare( i18n("IMAP") ) == 0 )
106 { 107 {
107 IMAPaccount *account = new IMAPaccount(); 108 IMAPaccount *account = new IMAPaccount();
108 IMAPconfig imap( account, this, 0, true ); 109 IMAPconfig imap( account, this, 0, true );
109 imap.showMaximized(); 110 imap.showMaximized();
110 if ( QDialog::Accepted == imap.exec() ) 111 if ( QDialog::Accepted == imap.exec() )
111 { 112 {
112 settings->addAccount( account ); 113 settings->addAccount( account );
113 account->save(); 114 account->save();
114 slotFillLists(); 115 slotFillLists();
115 } 116 }
116 else 117 else
117 { 118 {
118 account->remove(); 119 account->remove();
119 } 120 }
120 } 121 }
121 else if ( type.compare( i18n("POP3") ) == 0 ) 122 else if ( type.compare( i18n("POP3") ) == 0 )
122 { 123 {
123 POP3account *account = new POP3account(); 124 POP3account *account = new POP3account();
124 POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); 125 POP3config pop3( account, this, 0, true, WStyle_ContextHelp );
125 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) 126 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) )
126 { 127 {
127 settings->addAccount( account ); 128 settings->addAccount( account );
128 account->save(); 129 account->save();
129 slotFillLists(); 130 slotFillLists();
130 } 131 }
131 else 132 else
132 { 133 {
133 account->remove(); 134 account->remove();
134 } 135 }
135 } 136 }
136 else if ( type.compare( i18n("SMTP") ) == 0 ) 137 else if ( type.compare( i18n("SMTP") ) == 0 )
137 { 138 {
138 SMTPaccount *account = new SMTPaccount(); 139 SMTPaccount *account = new SMTPaccount();
139 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); 140 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp );
140 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) 141 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) )
141 { 142 {
142 settings->addAccount( account ); 143 settings->addAccount( account );
143 account->save(); 144 account->save();
144 slotFillLists(); 145 slotFillLists();
145 146
146 } 147 }
147 else 148 else
148 { 149 {
149 account->remove(); 150 account->remove();
150 } 151 }
151 } 152 }
152 else if ( type.compare( i18n("NNTP") ) == 0 ) 153 else if ( type.compare( i18n("NNTP") ) == 0 )
153 { 154 {
154 NNTPaccount *account = new NNTPaccount(); 155 NNTPaccount *account = new NNTPaccount();
155 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); 156 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp );
156 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) 157 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) )
157 { 158 {
158 settings->addAccount( account ); 159 settings->addAccount( account );
159 account->save(); 160 account->save();
160 slotFillLists(); 161 slotFillLists();
161 } 162 }
162 else 163 else
163 { 164 {
164 account->remove(); 165 account->remove();
165 } 166 }
166 } 167 }
167} 168}
168 169
169void EditAccounts::slotEditAccount( Account *account ) 170void EditAccounts::slotEditAccount( Account *account )
170{ 171{
171 if ( account->getType() == MAILLIB::A_IMAP ) 172 if ( account->getType() == MAILLIB::A_IMAP )
172 { 173 {
173 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); 174 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account);
174 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); 175 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp );
175 if ( QDialog::Accepted == KApplication::execDialog( &imap ) ) 176 if ( QDialog::Accepted == KApplication::execDialog( &imap ) )
176 { 177 {
177 slotFillLists(); 178 slotFillLists();
178 } 179 }
179 } 180 }
180 else if ( account->getType()==MAILLIB::A_POP3 ) 181 else if ( account->getType()==MAILLIB::A_POP3 )
181 { 182 {
182 POP3account *pop3Acc = static_cast<POP3account *>(account); 183 POP3account *pop3Acc = static_cast<POP3account *>(account);
183 POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); 184 POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp );
184 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) 185 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) )
185 { 186 {
186 slotFillLists(); 187 slotFillLists();
187 } 188 }
188 } 189 }
189 else if ( account->getType()==MAILLIB::A_SMTP ) 190 else if ( account->getType()==MAILLIB::A_SMTP )
190 { 191 {
191 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); 192 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account);
192 SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); 193 SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp );
193 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) 194 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) )
194 { 195 {
195 slotFillLists(); 196 slotFillLists();
196 } 197 }
197 } 198 }
198 else if ( account->getType()==MAILLIB::A_NNTP) 199 else if ( account->getType()==MAILLIB::A_NNTP)
199 { 200 {
200 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); 201 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
201 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); 202 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp );
202 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) 203 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) )
203 { 204 {
204 slotFillLists(); 205 slotFillLists();
205 } 206 }
206 } 207 }
207} 208}
208 209
209void EditAccounts::slotDeleteAccount( Account *account ) 210void EditAccounts::slotDeleteAccount( Account *account )
210{ 211{
211 if ( QMessageBox::information( this, i18n( "Question" ), 212 if ( QMessageBox::information( this, i18n( "Question" ),
212 i18n( "<p>Do you really want to delete the selected Account?</p>" ), 213 i18n( "<p>Do you really want to delete the selected Account?</p>" ),
213 i18n( "Yes" ), i18n( "No" ) ) == 0 ) 214 i18n( "Yes" ), i18n( "No" ) ) == 0 )
214 { 215 {
215 settings->delAccount( account ); 216 settings->delAccount( account );
216 slotFillLists(); 217 slotFillLists();
217 } 218 }
218} 219}
219 220
220void EditAccounts::slotEditMail() 221void EditAccounts::slotEditMail()
221{ 222{
222 if ( !mailList->currentItem() ) 223 if ( !mailList->currentItem() )
223 { 224 {
224 QMessageBox::information( this, i18n( "Error" ), 225 QMessageBox::information( this, i18n( "Error" ),
225 i18n( "<p>Please select an account.</p>" ), 226 i18n( "<p>Please select an account.</p>" ),
226 i18n( "Ok" ) ); 227 i18n( "Ok" ) );
227 return; 228 return;
228 } 229 }
229 230
230 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 231 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
231 slotEditAccount( a ); 232 slotEditAccount( a );
232} 233}
233 234
234void EditAccounts::slotDeleteMail() 235void EditAccounts::slotDeleteMail()
235{ 236{
236 if ( !mailList->currentItem() ) 237 if ( !mailList->currentItem() )
237 { 238 {
238 QMessageBox::information( this, i18n( "Error" ), 239 QMessageBox::information( this, i18n( "Error" ),
239 i18n( "<p>Please select an account.</p>" ), 240 i18n( "<p>Please select an account.</p>" ),
240 i18n( "Ok" ) ); 241 i18n( "Ok" ) );
241 return; 242 return;
242 } 243 }
243 244
244 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 245 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
245 slotDeleteAccount( a ); 246 slotDeleteAccount( a );
246} 247}
247 248
248void EditAccounts::slotNewNews() 249void EditAccounts::slotNewNews()
249{ 250{
250 slotNewAccount( "NNTP" ); 251 slotNewAccount( "NNTP" );
251} 252}
252 253
253void EditAccounts::slotEditNews() 254void EditAccounts::slotEditNews()
254{ 255{
255 if ( !newsList->currentItem() ) 256 if ( !newsList->currentItem() )
256 { 257 {
257 QMessageBox::information( this, i18n( "Error" ), 258 QMessageBox::information( this, i18n( "Error" ),
258 i18n( "<p>Please select an account.</p>" ), 259 i18n( "<p>Please select an account.</p>" ),
259 i18n( "Ok" ) ); 260 i18n( "Ok" ) );
260 return; 261 return;
261 } 262 }
262 263
263 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 264 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
264 slotEditAccount( a ); 265 slotEditAccount( a );
265} 266}
266 267
267void EditAccounts::slotDeleteNews() 268void EditAccounts::slotDeleteNews()
268{ 269{
269 if ( !newsList->currentItem() ) 270 if ( !newsList->currentItem() )
270 { 271 {
271 QMessageBox::information( this, i18n( "Error" ), 272 QMessageBox::information( this, i18n( "Error" ),
272 i18n( "<p>Please select an account.</p>" ), 273 i18n( "<p>Please select an account.</p>" ),
273 i18n( "Ok" ) ); 274 i18n( "Ok" ) );
274 return; 275 return;
275 } 276 }
276 277
277 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 278 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
278 slotDeleteAccount( a ); 279 slotDeleteAccount( a );
279} 280}
280 281
281void EditAccounts::slotAdjustColumns() 282void EditAccounts::slotAdjustColumns()
282{ 283{
283 int currPage = configTab->currentPageIndex(); 284 int currPage = configTab->currentPageIndex();
284 285
285 configTab->showPage( mailTab ); 286 configTab->showPage( mailTab );
286 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); 287 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 );
287 mailList->setColumnWidth( 1, 50 ); 288 mailList->setColumnWidth( 1, 50 );
288 289
289 configTab->showPage( newsTab ); 290 configTab->showPage( newsTab );
290 newsList->setColumnWidth( 0, newsList->visibleWidth() ); 291 newsList->setColumnWidth( 0, newsList->visibleWidth() );
291 292
292 configTab->setCurrentPage( currPage ); 293 configTab->setCurrentPage( currPage );
293} 294}
294 295
295void EditAccounts::accept() 296void EditAccounts::accept()
296{ 297{
297 settings->saveAccounts(); 298 settings->saveAccounts();
298 299
299 QDialog::accept(); 300 QDialog::accept();
300} 301}
301 302
302/** 303/**
303 * SelectMailType 304 * SelectMailType
304 */ 305 */
305 306
306SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) 307SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags )
307 : SelectMailTypeUI( parent, name, modal, flags ) 308 : SelectMailTypeUI( parent, name, modal, flags )
308{ 309{
309 selected = selection; 310 selected = selection;
310 selected->replace( 0, selected->length(), typeBox->currentText() ); 311 selected->replace( 0, selected->length(), typeBox->currentText() );
311 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); 312 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) );
312} 313}
313 314
314void SelectMailType::slotSelection( const QString &sel ) 315void SelectMailType::slotSelection( const QString &sel )
315{ 316{
316 selected->replace( 0, selected->length(), sel ); 317 selected->replace( 0, selected->length(), sel );
317} 318}
318 319
319/** 320/**
320 * IMAPconfig 321 * IMAPconfig
321 */ 322 */
322 323
323IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 324IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
324 : IMAPconfigUI( parent, name, modal, flags ) 325 : IMAPconfigUI( parent, name, modal, flags )
325{ 326{
326 data = account; 327 data = account;
327 328
328 fillValues(); 329 fillValues();
329 330
330 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 331 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
331 ComboBox1->insertItem( "Only if available", 0 ); 332 ComboBox1->insertItem( "Only if available", 0 );
332 ComboBox1->insertItem( "Always, Negotiated", 1 ); 333 ComboBox1->insertItem( "Always, Negotiated", 1 );
333 ComboBox1->insertItem( "Connect on secure port", 2 ); 334 ComboBox1->insertItem( "Connect on secure port", 2 );
334 ComboBox1->insertItem( "Run command instead", 3 ); 335 ComboBox1->insertItem( "Run command instead", 3 );
335 CommandEdit->hide(); 336 CommandEdit->hide();
336 ComboBox1->setCurrentItem( data->ConnectionType() ); 337 ComboBox1->setCurrentItem( data->ConnectionType() );
337} 338}
338 339
339void IMAPconfig::slotConnectionToggle( int index ) 340void IMAPconfig::slotConnectionToggle( int index )
340{ 341{
341 if ( index == 2 ) 342 if ( index == 2 )
342 { 343 {
343 portLine->setText( IMAP_SSL_PORT ); 344 portLine->setText( IMAP_SSL_PORT );
344 } 345 }
345 else if ( index == 3 ) 346 else if ( index == 3 )
346 { 347 {
347 portLine->setText( IMAP_PORT ); 348 portLine->setText( IMAP_PORT );
348 CommandEdit->show(); 349 CommandEdit->show();
349 } 350 }
350 else 351 else
351 { 352 {
352 portLine->setText( IMAP_PORT ); 353 portLine->setText( IMAP_PORT );
353 } 354 }
354} 355}
355 356
356void IMAPconfig::fillValues() 357void IMAPconfig::fillValues()
357{ 358{
358 accountLine->setText( data->getAccountName() ); 359 accountLine->setText( data->getAccountName() );
359 serverLine->setText( data->getServer() ); 360 serverLine->setText( data->getServer() );
360 portLine->setText( data->getPort() ); 361 portLine->setText( data->getPort() );
361 ComboBox1->setCurrentItem( data->ConnectionType() ); 362 ComboBox1->setCurrentItem( data->ConnectionType() );
362 userLine->setText( data->getUser() ); 363 userLine->setText( data->getUser() );
363 passLine->setText( data->getPassword() ); 364 passLine->setText( data->getPassword() );
364 prefixLine->setText(data->getPrefix()); 365 prefixLine->setText(data->getPrefix());
365 localFolder->setText( data->getLocalFolder() ); 366 localFolder->setText( data->getLocalFolder() );
366 int max = data->getMaxMailSize() ; 367 int max = data->getMaxMailSize() ;
367 if ( max ) { 368 if ( max ) {
368 CheckBoxDown->setChecked( true ); 369 CheckBoxDown->setChecked( true );
369 SpinBoxDown->setValue ( max ); 370 SpinBoxDown->setValue ( max );
370 } else { 371 } else {
371 CheckBoxDown->setChecked( false ); 372 CheckBoxDown->setChecked( false );
372 SpinBoxDown->setValue ( 5 ); 373 SpinBoxDown->setValue ( 5 );
373 } 374 }
374 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 375 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
375} 376}
376 377
377void IMAPconfig::accept() 378void IMAPconfig::accept()
378{ 379{
379 data->setAccountName( accountLine->text() ); 380 data->setAccountName( accountLine->text() );
380 data->setServer( serverLine->text() ); 381 data->setServer( serverLine->text() );
381 data->setPort( portLine->text() ); 382 data->setPort( portLine->text() );
382 data->setConnectionType( ComboBox1->currentItem() ); 383 data->setConnectionType( ComboBox1->currentItem() );
383 data->setUser( userLine->text() ); 384 data->setUser( userLine->text() );
384 data->setPassword( passLine->text() ); 385 data->setPassword( passLine->text() );
385 data->setPrefix(prefixLine->text()); 386 data->setPrefix(prefixLine->text());
386 data->setLocalFolder( localFolder->text() ); 387 data->setLocalFolder( localFolder->text() );
387 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 388 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
388 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 389 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
diff --git a/kmicromail/kmicromail.pro b/kmicromail/kmicromail.pro
index cd5a3c1..927dc8a 100644
--- a/kmicromail/kmicromail.pro
+++ b/kmicromail/kmicromail.pro
@@ -1,77 +1,78 @@
1CONFIG += qt warn_on 1CONFIG += qt warn_on
2 TEMPLATE= app 2 TEMPLATE= app
3HEADERS = defines.h \ 3HEADERS = defines.h \
4 editaccounts.h \ 4 editaccounts.h \
5 composemail.h \ 5 composemail.h \
6 accountview.h \ 6 accountview.h \
7 accountitem.h \ 7 accountitem.h \
8 mainwindow.h \ 8 mainwindow.h \
9 viewmail.h \ 9 viewmail.h \
10 viewmailbase.h \ 10 viewmailbase.h \
11 opiemail.h \ 11 opiemail.h \
12 mailistviewitem.h \ 12 mailistviewitem.h \
13 settingsdialog.h \ 13 settingsdialog.h \
14 statuswidget.h \ 14 statuswidget.h \
15 newmaildir.h \ 15 newmaildir.h \
16 selectstore.h \ 16 selectstore.h \
17 selectsmtp.h \ 17 selectsmtp.h \
18 ./qpe/qdialog.h \
18 nntpgroups.h \ 19 nntpgroups.h \
19 koprefs.h \ 20 koprefs.h \
20 koprefsdialog.h \ 21 koprefsdialog.h \
21 nntpgroupsdlg.h 22 nntpgroupsdlg.h
22 23
23SOURCES = main.cpp \ 24SOURCES = main.cpp \
24 opiemail.cpp \ 25 opiemail.cpp \
25 mainwindow.cpp \ 26 mainwindow.cpp \
26 accountview.cpp \ 27 accountview.cpp \
27 accountitem.cpp \ 28 accountitem.cpp \
28 composemail.cpp \ 29 composemail.cpp \
29 editaccounts.cpp \ 30 editaccounts.cpp \
30 viewmail.cpp \ 31 viewmail.cpp \
31 viewmailbase.cpp \ 32 viewmailbase.cpp \
32 mailistviewitem.cpp \ 33 mailistviewitem.cpp \
33 settingsdialog.cpp \ 34 settingsdialog.cpp \
34 statuswidget.cpp \ 35 statuswidget.cpp \
35 newmaildir.cpp \ 36 newmaildir.cpp \
36 selectstore.cpp \ 37 selectstore.cpp \
37 selectsmtp.cpp \ 38 selectsmtp.cpp \
38 nntpgroups.cpp \ 39 nntpgroups.cpp \
39 koprefs.cpp\ 40 koprefs.cpp\
40 koprefsdialog.cpp\ 41 koprefsdialog.cpp\
41 nntpgroupsdlg.cpp 42 nntpgroupsdlg.cpp
42 43
43INTERFACES = editaccountsui.ui \ 44INTERFACES = editaccountsui.ui \
44 selectmailtypeui.ui \ 45 selectmailtypeui.ui \
45 imapconfigui.ui \ 46 imapconfigui.ui \
46 pop3configui.ui \ 47 pop3configui.ui \
47 nntpconfigui.ui \ 48 nntpconfigui.ui \
48 smtpconfigui.ui \ 49 smtpconfigui.ui \
49 composemailui.ui \ 50 composemailui.ui \
50 settingsdialogui.ui \ 51 settingsdialogui.ui \
51 statuswidgetui.ui \ 52 statuswidgetui.ui \
52 newmaildirui.ui \ 53 newmaildirui.ui \
53 selectstoreui.ui \ 54 selectstoreui.ui \
54 nntpgroupsui.ui 55 nntpgroupsui.ui
55 56
56 57
57INCLUDEPATH += . .. ../libkdepim ../microkde ../microkde/kdecore libetpan/include ../microkde/kdeui 58INCLUDEPATH += ./qpe . .. ../libkdepim ../microkde ../microkde/kdecore libetpan/include ../microkde/kdeui
58LIBS += -L../bin -lmicromailwrapper -lmicrolibetpan -lmicrokde -lssl -lcrypto -lmicrokdepim -lmicrokabc 59LIBS += -L../bin -lmicromailwrapper -lmicrolibetpan -lmicrokde -lssl -lcrypto -lmicrokdepim -lmicrokabc
59 60
60DESTDIR= ../bin 61DESTDIR= ../bin
61TARGET = ompi 62TARGET = ompi
62 63
63DEFINES += DESKTOP_VERSION 64DEFINES += DESKTOP_VERSION
64unix : { 65unix : {
65OBJECTS_DIR = obj/unix 66OBJECTS_DIR = obj/unix
66MOC_DIR = moc/unix 67MOC_DIR = moc/unix
67} 68}
68win32: { 69win32: {
69DEFINES += _WIN32_ 70DEFINES += _WIN32_
70LIBS += mfc71u.lib 71LIBS += mfc71u.lib
71QMAKE_LINK += /NODEFAULTLIB:LIBC 72QMAKE_LINK += /NODEFAULTLIB:LIBC
72#QMAKE_LINK += /NODEFAULTLIB:MSVCRT 73#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
73#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib 74#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
74OBJECTS_DIR = obj/win 75OBJECTS_DIR = obj/win
75MOC_DIR = moc/win 76MOC_DIR = moc/win
76} 77}
77 78
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp
index 598d12f..c878fc9 100644
--- a/kmicromail/koprefsdialog.cpp
+++ b/kmicromail/koprefsdialog.cpp
@@ -1,407 +1,407 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
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#include <kdialog.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qvbox.h> 34#include <qvbox.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44 44
45#include <kcolorbutton.h> 45#include <kcolorbutton.h>
46#include <kdebug.h> 46#include <kdebug.h>
47#include <klocale.h> 47#include <klocale.h>
48#include <kglobal.h> 48#include <kglobal.h>
49#include <kfontdialog.h> 49#include <kfontdialog.h>
50#include <kfiledialog.h> 50#include <kfiledialog.h>
51#include <kmessagebox.h> 51#include <kmessagebox.h>
52#include <kcolordialog.h> 52#include <kcolordialog.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54#include <kemailsettings.h> 54#include <kemailsettings.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56 56
57#include <klineedit.h> 57#include <klineedit.h>
58 58
59 59
60#include "koprefs.h" 60#include "koprefs.h"
61 61
62#include "koprefsdialog.h" 62#include "koprefsdialog.h"
63//#include <kprefswidget.h> 63//#include <kprefswidget.h>
64 64
65 65
66KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 66KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
67 KPrefsDialog(KOPrefs::instance(),parent,name,true) 67 KPrefsDialog(KOPrefs::instance(),parent,name,true)
68{ 68{
69 69
70 setCaption( i18n("Settings - some need a restart (nr)")); 70 setCaption( i18n("Settings - some need a restart (nr)"));
71 setupGlobalTab(); 71 setupGlobalTab();
72 setupMainTab(); 72 setupMainTab();
73 setupMailTab();; 73 setupMailTab();;
74 setupFontsTab(); 74 setupFontsTab();
75 readConfig(); 75 readConfig();
76 76
77#if 0 77#if 0
78 78
79 setupMainTab(); 79 setupMainTab();
80 setupLocaleTab(); 80 setupLocaleTab();
81 setupTimeZoneTab(); 81 setupTimeZoneTab();
82 setupTimeTab(); 82 setupTimeTab();
83 setupLocaleDateTab(); 83 setupLocaleDateTab();
84 setupFontsTab(); 84 setupFontsTab();
85 setupColorsTab(); 85 setupColorsTab();
86 setupViewsTab(); 86 setupViewsTab();
87 //setupSyncTab(); 87 //setupSyncTab();
88 //setupSyncAlgTab(); 88 //setupSyncAlgTab();
89 //setupPrinterTab(); 89 //setupPrinterTab();
90 //setupGroupSchedulingTab(); 90 //setupGroupSchedulingTab();
91 //setupGroupAutomationTab(); 91 //setupGroupAutomationTab();
92#endif 92#endif
93} 93}
94 94
95#include "kpimglobalprefs.h" 95#include "kpimglobalprefs.h"
96 96
97KOPrefsDialog::~KOPrefsDialog() 97KOPrefsDialog::~KOPrefsDialog()
98{ 98{
99} 99}
100void KOPrefsDialog::setupGlobalTab() 100void KOPrefsDialog::setupGlobalTab()
101{ 101{
102 QFrame *topFrame = addPage(i18n("Global"),0,0); 102 QFrame *topFrame = addPage(i18n("Global"),0,0);
103 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); 103 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
104 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 104 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
105 topLayout->addWidget( kdelibcfg ); 105 topLayout->addWidget( kdelibcfg );
106 106
107 107
108} 108}
109void KOPrefsDialog::setupMainTab() 109void KOPrefsDialog::setupMainTab()
110{ 110{
111 QFrame *topFrame = addPage(i18n("General"),0,0); 111 QFrame *topFrame = addPage(i18n("General"),0,0);
112 112
113 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 113 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
114 topLayout->setSpacing(spacingHint()); 114 topLayout->setSpacing(spacingHint());
115 topLayout->setMargin(marginHint()); 115 topLayout->setMargin(marginHint());
116 116
117 117
118 mNameEdit = new QLineEdit(topFrame); 118 mNameEdit = new QLineEdit(topFrame);
119 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 119 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
120 topLayout->addWidget(mNameLabel,0,0); 120 topLayout->addWidget(mNameLabel,0,0);
121 topLayout->addWidget(mNameEdit,0,1); 121 topLayout->addWidget(mNameEdit,0,1);
122 122
123 mEmailEdit = new QLineEdit(topFrame); 123 mEmailEdit = new QLineEdit(topFrame);
124 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 124 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
125 topLayout->addWidget(mEmailLabel,1,0); 125 topLayout->addWidget(mEmailLabel,1,0);
126 topLayout->addWidget(mEmailEdit,1,1); 126 topLayout->addWidget(mEmailEdit,1,1);
127 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame); 127 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame);
128 topLayout->addMultiCellWidget(lab,2,2,0,1); 128 topLayout->addMultiCellWidget(lab,2,2,0,1);
129 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"), 129 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"),
130 &(KOPrefs::instance()->mUseKapi),topFrame); 130 &(KOPrefs::instance()->mUseKapi),topFrame);
131 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1); 131 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1);
132} 132}
133 133
134void KOPrefsDialog::setupMailTab() 134void KOPrefsDialog::setupMailTab()
135{ 135{
136 QFrame *topFrame = addPage(i18n("Mail"),0,0); 136 QFrame *topFrame = addPage(i18n("Mail"),0,0);
137 137
138 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 138 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
139 topLayout->setSpacing(spacingHint()); 139 topLayout->setSpacing(spacingHint());
140 topLayout->setMargin(marginHint()); 140 topLayout->setMargin(marginHint());
141 141
142 KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), 142 KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"),
143 &(KOPrefs::instance()->mViewAsHtml),topFrame); 143 &(KOPrefs::instance()->mViewAsHtml),topFrame);
144 topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); 144 topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1);
145 145
146 146
147 ttt = addWidBool(i18n("Send mails later"), 147 ttt = addWidBool(i18n("Send mails later"),
148 &(KOPrefs::instance()->mSendLater),topFrame); 148 &(KOPrefs::instance()->mSendLater),topFrame);
149 topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); 149 topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1);
150 150
151 151
152} 152}
153void KOPrefsDialog::setupFontsTab() 153void KOPrefsDialog::setupFontsTab()
154{ 154{
155 155
156 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 156 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
157 // DesktopIcon("fonts",KIcon::SizeMedium)); 157 // DesktopIcon("fonts",KIcon::SizeMedium));
158 158
159 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 159 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
160 topLayout->setSpacing(1); 160 topLayout->setSpacing(1);
161 topLayout->setMargin(3); 161 topLayout->setMargin(3);
162 KPrefsDialogWidFont * tVFont; 162 KPrefsDialogWidFont * tVFont;
163 int i = 0; 163 int i = 0;
164 KPrefsDialogWidFont *timeLabelsFont = 164 KPrefsDialogWidFont *timeLabelsFont =
165 addWidFont(i18n("OK"),i18n("Application(nr)"), 165 addWidFont(i18n("OK"),i18n("Application(nr)"),
166 &(KOPrefs::instance()->mAppFont),topFrame); 166 &(KOPrefs::instance()->mAppFont),topFrame);
167 topLayout->addWidget(timeLabelsFont->label(),i,0); 167 topLayout->addWidget(timeLabelsFont->label(),i,0);
168 topLayout->addWidget(timeLabelsFont->preview(),i,1); 168 topLayout->addWidget(timeLabelsFont->preview(),i,1);
169 topLayout->addWidget(timeLabelsFont->button(),i,2); 169 topLayout->addWidget(timeLabelsFont->button(),i,2);
170 ++i; 170 ++i;
171 171
172 172
173 timeLabelsFont = 173 timeLabelsFont =
174 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), 174 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"),
175 &(KOPrefs::instance()->mComposeFont),topFrame); 175 &(KOPrefs::instance()->mComposeFont),topFrame);
176 topLayout->addWidget(timeLabelsFont->label(),i,0); 176 topLayout->addWidget(timeLabelsFont->label(),i,0);
177 topLayout->addWidget(timeLabelsFont->preview(),i,1); 177 topLayout->addWidget(timeLabelsFont->preview(),i,1);
178 topLayout->addWidget(timeLabelsFont->button(),i,2); 178 topLayout->addWidget(timeLabelsFont->button(),i,2);
179 ++i; 179 ++i;
180 180
181 KPrefsDialogWidFont *timeBarFont = 181 KPrefsDialogWidFont *timeBarFont =
182 addWidFont(i18n("Hello"),i18n("Read mail:"), 182 addWidFont(i18n("Hello"),i18n("Read mail:"),
183 &(KOPrefs::instance()->mReadFont),topFrame); 183 &(KOPrefs::instance()->mReadFont),topFrame);
184 topLayout->addWidget(timeBarFont->label(),i,0); 184 topLayout->addWidget(timeBarFont->label(),i,0);
185 topLayout->addWidget(timeBarFont->preview(),i,1); 185 topLayout->addWidget(timeBarFont->preview(),i,1);
186 topLayout->addWidget(timeBarFont->button(),i,2); 186 topLayout->addWidget(timeBarFont->button(),i,2);
187 ++i; 187 ++i;
188 188
189 topLayout->setColStretch(1,1); 189 topLayout->setColStretch(1,1);
190 topLayout->setRowStretch(4,1); 190 topLayout->setRowStretch(4,1);
191 191
192} 192}
193void KOPrefsDialog::usrReadConfig() 193void KOPrefsDialog::usrReadConfig()
194{ 194{
195 195
196 mNameEdit->setText(KOPrefs::instance()->mName); 196 mNameEdit->setText(KOPrefs::instance()->mName);
197 mEmailEdit->setText(KOPrefs::instance()->mEmail); 197 mEmailEdit->setText(KOPrefs::instance()->mEmail);
198 kdelibcfg->readConfig(); 198 kdelibcfg->readConfig();
199} 199}
200void KOPrefsDialog::usrWriteConfig() 200void KOPrefsDialog::usrWriteConfig()
201{ 201{
202 KOPrefs::instance()->mName = mNameEdit->text(); 202 KOPrefs::instance()->mName = mNameEdit->text();
203 KOPrefs::instance()->mEmail = mEmailEdit->text(); 203 KOPrefs::instance()->mEmail = mEmailEdit->text();
204 kdelibcfg->writeConfig(); 204 kdelibcfg->writeConfig();
205 205
206 206
207} 207}
208 208
209#if 0 209#if 0
210void KOPrefsDialog::setupLocaleDateTab() 210void KOPrefsDialog::setupLocaleDateTab()
211{ 211{
212QFrame *topFrame = addPage(i18n("Date Format"),0,0); 212QFrame *topFrame = addPage(i18n("Date Format"),0,0);
213 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 213 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
214 topLayout->setSpacing(spacingHint()); 214 topLayout->setSpacing(spacingHint());
215 topLayout->setMargin(marginHint()); 215 topLayout->setMargin(marginHint());
216 int iii = 0; 216 int iii = 0;
217 217
218 218
219 KPrefsWidRadios *syncPrefsGroup = 219 KPrefsWidRadios *syncPrefsGroup =
220 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 220 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
221 QString format; 221 QString format;
222 if ( QApplication::desktop()->width() < 480 ) 222 if ( QApplication::desktop()->width() < 480 )
223 format = "(%d.%m.%Y)"; 223 format = "(%d.%m.%Y)";
224 else 224 else
225 format = "(%d.%m.%Y|%A %d %B %Y)"; 225 format = "(%d.%m.%Y|%A %d %B %Y)";
226 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 226 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
227 if ( QApplication::desktop()->width() < 480 ) 227 if ( QApplication::desktop()->width() < 480 )
228 format = "(%m.%d.%Y)"; 228 format = "(%m.%d.%Y)";
229 else 229 else
230 format = "(%m.%d.%Y|%A %B %d %Y)"; 230 format = "(%m.%d.%Y|%A %B %d %Y)";
231 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 231 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
232 if ( QApplication::desktop()->width() < 480 ) 232 if ( QApplication::desktop()->width() < 480 )
233 format = "(%Y-%m-%d)"; 233 format = "(%Y-%m-%d)";
234 else 234 else
235 format = "(%Y-%m-%d|%A %Y %B %d)"; 235 format = "(%Y-%m-%d|%A %Y %B %d)";
236 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 236 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
237 syncPrefsGroup->addRadio(i18n("User defined")); 237 syncPrefsGroup->addRadio(i18n("User defined"));
238 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 238 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
239 ++iii; 239 ++iii;
240 ++iii; 240 ++iii;
241 QLabel * lab; 241 QLabel * lab;
242 mUserDateFormatLong = new QLineEdit(topFrame); 242 mUserDateFormatLong = new QLineEdit(topFrame);
243 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 243 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
244 topLayout->addWidget(lab ,iii,0); 244 topLayout->addWidget(lab ,iii,0);
245 topLayout->addWidget(mUserDateFormatLong,iii,1); 245 topLayout->addWidget(mUserDateFormatLong,iii,1);
246 ++iii; 246 ++iii;
247 mUserDateFormatShort = new QLineEdit(topFrame); 247 mUserDateFormatShort = new QLineEdit(topFrame);
248 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 248 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
249 topLayout->addWidget(lab ,iii,0); 249 topLayout->addWidget(lab ,iii,0);
250 topLayout->addWidget(mUserDateFormatShort,iii,1); 250 topLayout->addWidget(mUserDateFormatShort,iii,1);
251 ++iii; 251 ++iii;
252 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 252 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
253 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 253 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
254 ++iii; 254 ++iii;
255 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 255 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
256 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 256 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
257 ++iii; 257 ++iii;
258 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 258 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
259 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 259 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
260 ++iii; 260 ++iii;
261 261
262} 262}
263 263
264void KOPrefsDialog::setupLocaleTab() 264void KOPrefsDialog::setupLocaleTab()
265{ 265{
266 QFrame *topFrame = addPage(i18n("Locale"),0,0); 266 QFrame *topFrame = addPage(i18n("Locale"),0,0);
267 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 267 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
268 topLayout->setSpacing(spacingHint()); 268 topLayout->setSpacing(spacingHint());
269 topLayout->setMargin(marginHint()); 269 topLayout->setMargin(marginHint());
270 int iii = 0; 270 int iii = 0;
271 KPrefsWidRadios *syncPrefsGroup = 271 KPrefsWidRadios *syncPrefsGroup =
272 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); 272 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
273 syncPrefsGroup->addRadio(i18n("English")); 273 syncPrefsGroup->addRadio(i18n("English"));
274 syncPrefsGroup->addRadio(i18n("German")); 274 syncPrefsGroup->addRadio(i18n("German"));
275 syncPrefsGroup->addRadio(i18n("French")); 275 syncPrefsGroup->addRadio(i18n("French"));
276 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 276 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
277 if ( QApplication::desktop()->width() < 300 ) 277 if ( QApplication::desktop()->width() < 300 )
278 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 278 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
279 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 279 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
280 ++iii; 280 ++iii;
281 281
282 syncPrefsGroup = 282 syncPrefsGroup =
283 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); 283 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
284 if ( QApplication::desktop()->width() > 300 ) 284 if ( QApplication::desktop()->width() > 300 )
285 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 285 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
286 syncPrefsGroup->addRadio(i18n("24:00")); 286 syncPrefsGroup->addRadio(i18n("24:00"));
287 syncPrefsGroup->addRadio(i18n("12:00am")); 287 syncPrefsGroup->addRadio(i18n("12:00am"));
288 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 288 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
289 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 289 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
290 ++iii; 290 ++iii;
291 KPrefsDialogWidBool *sb; 291 KPrefsDialogWidBool *sb;
292 if ( QApplication::desktop()->width() < 300 ) { 292 if ( QApplication::desktop()->width() < 300 ) {
293 sb = 293 sb =
294 addWidBool(i18n("Week starts on Sunday"), 294 addWidBool(i18n("Week starts on Sunday"),
295 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); 295 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
296 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 296 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
297 ++iii; 297 ++iii;
298 sb = 298 sb =
299 addWidBool(i18n("Use short date in (WN/E) view"), 299 addWidBool(i18n("Use short date in (WN/E) view"),
300 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 300 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
301 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 301 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
302 } 302 }
303 else { 303 else {
304 QWidget * hb = new QWidget( topFrame ); 304 QWidget * hb = new QWidget( topFrame );
305 QHBoxLayout *hbLayout = new QHBoxLayout(hb); 305 QHBoxLayout *hbLayout = new QHBoxLayout(hb);
306 sb = 306 sb =
307 addWidBool(i18n("Week starts on Sunday"), 307 addWidBool(i18n("Week starts on Sunday"),
308 &(KOPrefs::instance()->mWeekStartsOnSunday),hb); 308 &(KOPrefs::instance()->mWeekStartsOnSunday),hb);
309 hbLayout->addWidget(sb->checkBox() ); 309 hbLayout->addWidget(sb->checkBox() );
310 sb = 310 sb =
311 addWidBool(i18n("Use short date in (WN/E) view"), 311 addWidBool(i18n("Use short date in (WN/E) view"),
312 &(KOPrefs::instance()->mShortDateInViewer),hb); 312 &(KOPrefs::instance()->mShortDateInViewer),hb);
313 hbLayout->addWidget(sb->checkBox() ); 313 hbLayout->addWidget(sb->checkBox() );
314 topLayout->addMultiCellWidget(hb, iii,iii,0,1); 314 topLayout->addMultiCellWidget(hb, iii,iii,0,1);
315 315
316 } 316 }
317 //#ifndef DESKTOP_VERSION 317 //#ifndef DESKTOP_VERSION
318#if 0 318#if 0
319 ++iii; 319 ++iii;
320 sb = 320 sb =
321 addWidBool(i18n("Quick load/save (w/o Unicode)"), 321 addWidBool(i18n("Quick load/save (w/o Unicode)"),
322 &(KOPrefs::instance()->mUseQuicksave),topFrame); 322 &(KOPrefs::instance()->mUseQuicksave),topFrame);
323 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 323 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
324#endif 324#endif
325} 325}
326void KOPrefsDialog::showSyncPage() 326void KOPrefsDialog::showSyncPage()
327{ 327{
328 showPage ( 2 ) ; 328 showPage ( 2 ) ;
329 329
330} 330}
331void KOPrefsDialog::setupSyncAlgTab() 331void KOPrefsDialog::setupSyncAlgTab()
332{ 332{
333#if 0 333#if 0
334 QLabel * lab; 334 QLabel * lab;
335 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); 335 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0);
336 mSetupSyncAlgTab = topFrame; 336 mSetupSyncAlgTab = topFrame;
337 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 337 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
338 topLayout->setSpacing(spacingHint()); 338 topLayout->setSpacing(spacingHint());
339 topLayout->setMargin(marginHint()); 339 topLayout->setMargin(marginHint());
340 int iii = 0; 340 int iii = 0;
341 341
342 KPrefsDialogWidBool *sb = 342 KPrefsDialogWidBool *sb =
343 addWidBool(i18n("Ask for preferences before syncing"), 343 addWidBool(i18n("Ask for preferences before syncing"),
344 &(KOPrefs::instance()->mAskForPreferences),topFrame); 344 &(KOPrefs::instance()->mAskForPreferences),topFrame);
345 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 345 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
346 346
347 ++iii; 347 ++iii;
348 348
349 KPrefsWidRadios *syncPrefsGroup = 349 KPrefsWidRadios *syncPrefsGroup =
350 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), 350 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs),
351 topFrame); 351 topFrame);
352 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 352 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
353 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 353 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
354 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 354 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
355 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 355 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
356 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 356 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
357 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 357 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
358 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 358 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
359 ++iii; 359 ++iii;
360 sb = 360 sb =
361 addWidBool(i18n("Show summary after syncing"), 361 addWidBool(i18n("Show summary after syncing"),
362 &(KOPrefs::instance()->mShowSyncSummary),topFrame); 362 &(KOPrefs::instance()->mShowSyncSummary),topFrame);
363 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 363 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
364 364
365 ++iii; 365 ++iii;
366#endif 366#endif
367 367
368 368
369 369
370} 370}
371 371
372 372
373void KOPrefsDialog::setupSyncTab() 373void KOPrefsDialog::setupSyncTab()
374{ 374{
375#if 0 375#if 0
376 QLabel * lab; 376 QLabel * lab;
377 QFrame *topFrame = addPage(i18n("Sync Network"),0,0); 377 QFrame *topFrame = addPage(i18n("Sync Network"),0,0);
378 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 378 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
379 topLayout->setSpacing(spacingHint()); 379 topLayout->setSpacing(spacingHint());
380 topLayout->setMargin(marginHint()); 380 topLayout->setMargin(marginHint());
381 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); 381 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame);
382 int iii = 0; 382 int iii = 0;
383 topLayout->addMultiCellWidget(lab , iii,iii,0,1); 383 topLayout->addMultiCellWidget(lab , iii,iii,0,1);
384 ++iii; 384 ++iii;
385 385
386 mRemoteIPEdit = new QLineEdit(topFrame); 386 mRemoteIPEdit = new QLineEdit(topFrame);
387 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); 387 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame);
388 topLayout->addWidget(lab ,iii,0); 388 topLayout->addWidget(lab ,iii,0);
389 topLayout->addWidget(mRemoteIPEdit,iii,1); 389 topLayout->addWidget(mRemoteIPEdit,iii,1);
390 ++iii; 390 ++iii;
391 mRemoteUser = new QLineEdit(topFrame); 391 mRemoteUser = new QLineEdit(topFrame);
392 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); 392 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame);
393 topLayout->addWidget(lab ,iii,0); 393 topLayout->addWidget(lab ,iii,0);
394 topLayout->addWidget(mRemoteUser, iii,1); 394 topLayout->addWidget(mRemoteUser, iii,1);
395 ++iii; 395 ++iii;
396 396
397 mRemoteFile = new QLineEdit(topFrame); 397 mRemoteFile = new QLineEdit(topFrame);
398 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); 398 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame);
399 topLayout->addWidget(lab ,iii,0); 399 topLayout->addWidget(lab ,iii,0);
400 topLayout->addWidget(mRemoteFile,iii,1); 400 topLayout->addWidget(mRemoteFile,iii,1);
401 ++iii; 401 ++iii;
402 402
403 mLocalTempFile = new QLineEdit(topFrame); 403 mLocalTempFile = new QLineEdit(topFrame);
404 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); 404 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame);
405 topLayout->addWidget(lab ,iii,0); 405 topLayout->addWidget(lab ,iii,0);
406 topLayout->addWidget(mLocalTempFile,iii,1); 406 topLayout->addWidget(mLocalTempFile,iii,1);
407 ++iii; 407 ++iii;
diff --git a/kmicromail/libmailwrapper/libmailwrapper.pro b/kmicromail/libmailwrapper/libmailwrapper.pro
index 2b005d8..10d45b1 100644
--- a/kmicromail/libmailwrapper/libmailwrapper.pro
+++ b/kmicromail/libmailwrapper/libmailwrapper.pro
@@ -1,64 +1,65 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3 3
4HEADERS = mailwrapper.h \ 4HEADERS = mailwrapper.h \
5 imapwrapper.h \ 5 imapwrapper.h \
6 mailtypes.h \ 6 mailtypes.h \
7 pop3wrapper.h \ 7 pop3wrapper.h \
8 abstractmail.h \ 8 abstractmail.h \
9 smtpwrapper.h \ 9 smtpwrapper.h \
10 genericwrapper.h \ 10 genericwrapper.h \
11 mboxwrapper.h \ 11 mboxwrapper.h \
12 settings.h \ 12 settings.h \
13 logindialog.h \ 13 logindialog.h \
14 sendmailprogress.h \ 14 sendmailprogress.h \
15 statusmail.h \ 15 statusmail.h \
16 mhwrapper.h \ 16 mhwrapper.h \
17 nntpwrapper.h \ 17 nntpwrapper.h \
18 generatemail.h \ 18 generatemail.h \
19 storemail.h \ 19 storemail.h \
20 ../qpe/global.h 20 ../qpe/global.h
21 21
22SOURCES = imapwrapper.cpp \ 22SOURCES = imapwrapper.cpp \
23 mailwrapper.cpp \ 23 mailwrapper.cpp \
24 mailtypes.cpp \ 24 mailtypes.cpp \
25 pop3wrapper.cpp \ 25 pop3wrapper.cpp \
26 abstractmail.cpp \ 26 abstractmail.cpp \
27 smtpwrapper.cpp \ 27 smtpwrapper.cpp \
28 genericwrapper.cpp \ 28 genericwrapper.cpp \
29 mboxwrapper.cpp \ 29 mboxwrapper.cpp \
30 settings.cpp \ 30 settings.cpp \
31 logindialog.cpp \ 31 logindialog.cpp \
32 sendmailprogress.cpp \ 32 sendmailprogress.cpp \
33 statusmail.cpp \ 33 statusmail.cpp \
34 mhwrapper.cpp \ 34 mhwrapper.cpp \
35 nntpwrapper.cpp \ 35 nntpwrapper.cpp \
36 generatemail.cpp \ 36 generatemail.cpp \
37 storemail.cpp \ 37 storemail.cpp \
38 ./qpe/qdialog_hacked.cpp \
38 ../qpe/global.cpp 39 ../qpe/global.cpp
39 40
40INTERFACES = logindialogui.ui \ 41INTERFACES = logindialogui.ui \
41 sendmailprogressui.ui 42 sendmailprogressui.ui
42 43
43INCLUDEPATH += .. ../../microkde ../../microkde/kdecore ../libetpan/include 44INCLUDEPATH += ../qpe .. ../../microkde ../../microkde/kdecore ../libetpan/include
44LIBS += -lssl -lcrypto 45LIBS += -lssl -lcrypto
45 46
46#-lqpe -letpan 47#-lqpe -letpan
47 48
48DESTDIR = ../../bin 49DESTDIR = ../../bin
49TARGET = micromailwrapper 50TARGET = micromailwrapper
50 51
51DEFINES += DESKTOP_VERSION 52DEFINES += DESKTOP_VERSION
52unix : { 53unix : {
53OBJECTS_DIR = obj/unix 54OBJECTS_DIR = obj/unix
54MOC_DIR = moc/unix 55MOC_DIR = moc/unix
55} 56}
56win32: { 57win32: {
57DEFINES += _WIN32_ 58DEFINES += _WIN32_
58LIBS += mfc71u.lib 59LIBS += mfc71u.lib
59QMAKE_LINK += /NODEFAULTLIB:LIBC 60QMAKE_LINK += /NODEFAULTLIB:LIBC
60#QMAKE_LINK += /NODEFAULTLIB:MSVCRT 61#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
61#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib 62#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
62OBJECTS_DIR = obj/win 63OBJECTS_DIR = obj/win
63MOC_DIR = moc/win 64MOC_DIR = moc/win
64} 65}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index b19dbbe..7655385 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,305 +1,305 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qvbox.h> 4#include <qvbox.h>
5#include <qheader.h> 5#include <qheader.h>
6#include <qtimer.h> 6#include <qtimer.h>
7#include <qlayout.h> 7#include <qlayout.h>
8#include <kdialog.h> 8//#include <kdialog.h>
9#include <kiconloader.h> 9#include <kiconloader.h>
10#include <kapplication.h> 10#include <kapplication.h>
11 11
12#ifdef DESKTOP_VERSION 12#ifdef DESKTOP_VERSION
13#include <qapplication.h> 13#include <qapplication.h>
14#else 14#else
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#endif 16#endif
17#include "defines.h" 17#include "defines.h"
18#include "mainwindow.h" 18#include "mainwindow.h"
19#include <KDGanttMinimizeSplitter.h> 19#include <KDGanttMinimizeSplitter.h>
20 20
21 21
22#include <kabc/stdaddressbook.h> 22#include <kabc/stdaddressbook.h>
23 23
24MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 24MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
25 : QMainWindow( parent, name ) //, flags ) 25 : QMainWindow( parent, name ) //, flags )
26{ 26{
27 setCaption( i18n( "KOpieMail/Pi" ) ); 27 setCaption( i18n( "KOpieMail/Pi" ) );
28 setToolBarsMovable( false ); 28 setToolBarsMovable( false );
29 //KABC::StdAddressBook::self(); 29 //KABC::StdAddressBook::self();
30 toolBar = new QToolBar( this ); 30 toolBar = new QToolBar( this );
31 menuBar = new QPEMenuBar( toolBar ); 31 menuBar = new QPEMenuBar( toolBar );
32 mailMenu = new QPopupMenu( menuBar ); 32 mailMenu = new QPopupMenu( menuBar );
33 menuBar->insertItem( i18n( "Mail" ), mailMenu ); 33 menuBar->insertItem( i18n( "Mail" ), mailMenu );
34 settingsMenu = new QPopupMenu( menuBar ); 34 settingsMenu = new QPopupMenu( menuBar );
35 menuBar->insertItem( i18n( "Settings" ), settingsMenu ); 35 menuBar->insertItem( i18n( "Settings" ), settingsMenu );
36 36
37 addToolBar( toolBar ); 37 addToolBar( toolBar );
38 toolBar->setHorizontalStretchable( true ); 38 toolBar->setHorizontalStretchable( true );
39 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), 39 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"),
40 0, 0, this ); 40 0, 0, this );
41 connect(getMail, SIGNAL( activated() ), 41 connect(getMail, SIGNAL( activated() ),
42 SLOT( slotGetAllMail() ) ); 42 SLOT( slotGetAllMail() ) );
43 getMail->addTo( mailMenu ); 43 getMail->addTo( mailMenu );
44 44
45 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), 45 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"),
46 0, 0, this ); 46 0, 0, this );
47 getMail->addTo( toolBar ); 47 getMail->addTo( toolBar );
48 getMail->addTo( mailMenu ); 48 getMail->addTo( mailMenu );
49 connect(getMail, SIGNAL( activated() ), 49 connect(getMail, SIGNAL( activated() ),
50 SLOT( slotGetMail() ) ); 50 SLOT( slotGetMail() ) );
51 51
52 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), 52 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"),
53 0, 0, this ); 53 0, 0, this );
54 composeMail->addTo( toolBar ); 54 composeMail->addTo( toolBar );
55 composeMail->addTo( mailMenu ); 55 composeMail->addTo( mailMenu );
56 56
57 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , 57 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") ,
58 0, 0, this ); 58 0, 0, this );
59 sendQueued->addTo( toolBar ); 59 sendQueued->addTo( toolBar );
60 sendQueued->addTo( mailMenu ); 60 sendQueued->addTo( mailMenu );
61 61
62 /* 62 /*
63 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, 63 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC,
64 0, 0, this ); 64 0, 0, this );
65 syncFolders->addTo( toolBar ); 65 syncFolders->addTo( toolBar );
66 syncFolders->addTo( mailMenu ); 66 syncFolders->addTo( mailMenu );
67 */ 67 */
68 68
69 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , 69 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") ,
70 0, 0, this, 0, true ); 70 0, 0, this, 0, true );
71 showFolders->addTo( toolBar ); 71 showFolders->addTo( toolBar );
72 showFolders->addTo( mailMenu ); 72 showFolders->addTo( mailMenu );
73 showFolders->setOn( true ); 73 showFolders->setOn( true );
74 connect(showFolders, SIGNAL( toggled(bool) ), 74 connect(showFolders, SIGNAL( toggled(bool) ),
75 SLOT( slotShowFolders(bool) ) ); 75 SLOT( slotShowFolders(bool) ) );
76 76
77 /* 77 /*
78 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 78 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
79 0, 0, this ); 79 0, 0, this );
80 searchMails->addTo( toolBar ); 80 searchMails->addTo( toolBar );
81 searchMails->addTo( mailMenu ); 81 searchMails->addTo( mailMenu );
82 */ 82 */
83 83
84 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); 84 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
85 deleteMails->addTo( toolBar ); 85 deleteMails->addTo( toolBar );
86 deleteMails->addTo( mailMenu ); 86 deleteMails->addTo( mailMenu );
87 connect( deleteMails, SIGNAL( activated() ), 87 connect( deleteMails, SIGNAL( activated() ),
88 SLOT( slotDeleteMail() ) ); 88 SLOT( slotDeleteMail() ) );
89 89
90 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , 90 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") ,
91 0, 0, this ); 91 0, 0, this );
92 editSettings->addTo( settingsMenu ); 92 editSettings->addTo( settingsMenu );
93 connect( editSettings, SIGNAL( activated() ), 93 connect( editSettings, SIGNAL( activated() ),
94 SLOT( slotEditSettings() ) ); 94 SLOT( slotEditSettings() ) );
95 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 95 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
96 0, 0, this ); 96 0, 0, this );
97 editAccounts->addTo( settingsMenu ); 97 editAccounts->addTo( settingsMenu );
98 98
99 //setCentralWidget( view ); 99 //setCentralWidget( view );
100 100
101 QVBox* wrapperBox = new QVBox( this ); 101 QVBox* wrapperBox = new QVBox( this );
102 setCentralWidget( wrapperBox ); 102 setCentralWidget( wrapperBox );
103 103
104 // QWidget *view = new QWidget( wrapperBox ); 104 // QWidget *view = new QWidget( wrapperBox );
105 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 105 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
106 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 106 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
107 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 107 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
108 108
109 folderView = new AccountView( split ); 109 folderView = new AccountView( split );
110 folderView->header()->hide(); 110 folderView->header()->hide();
111 folderView->setRootIsDecorated( false ); 111 folderView->setRootIsDecorated( false );
112 folderView->addColumn( i18n( "Mailbox" ) ); 112 folderView->addColumn( i18n( "Mailbox" ) );
113 113
114 //layout->addWidget( folderView ); 114 //layout->addWidget( folderView );
115 115
116 mailView = new QListView( split ); 116 mailView = new QListView( split );
117 mailView->addColumn( i18n( " " ) ); 117 mailView->addColumn( i18n( " " ) );
118 mailView->addColumn( i18n( "Subject" ),QListView::Manual ); 118 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
119 mailView->addColumn( i18n( "Sender" ),QListView::Manual ); 119 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
120 mailView->addColumn( i18n( "Size" ),QListView::Manual); 120 mailView->addColumn( i18n( "Size" ),QListView::Manual);
121 mailView->addColumn( i18n( "Date" ),QListView::Manual); 121 mailView->addColumn( i18n( "Date" ),QListView::Manual);
122 mailView->setAllColumnsShowFocus(true); 122 mailView->setAllColumnsShowFocus(true);
123 //mailView->setSorting(-1); 123 //mailView->setSorting(-1);
124 mailView->setRootIsDecorated( false ); 124 mailView->setRootIsDecorated( false );
125 statusWidget = new StatusWidget( wrapperBox ); 125 statusWidget = new StatusWidget( wrapperBox );
126 statusWidget->hide(); 126 statusWidget->hide();
127 127
128 //layout->addWidget( mailView ); 128 //layout->addWidget( mailView );
129 //layout->setStretchFactor( folderView, 1 ); 129 //layout->setStretchFactor( folderView, 1 );
130 //layout->setStretchFactor( mailView, 2 ); 130 //layout->setStretchFactor( mailView, 2 );
131 131
132 slotAdjustLayout(); 132 slotAdjustLayout();
133#ifndef DESKTOP_VERSION 133#ifndef DESKTOP_VERSION
134 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 134 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
135 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 135 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
136#endif 136#endif
137 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 137 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
138 SLOT( mailLeftClicked(QListViewItem*) ) ); 138 SLOT( mailLeftClicked(QListViewItem*) ) );
139 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 139 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
140 SLOT( mailLeftClicked(QListViewItem*) ) ); 140 SLOT( mailLeftClicked(QListViewItem*) ) );
141 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 141 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
142 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 142 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
143 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 143 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
144 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 144 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
145 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 145 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
146 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 146 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
147// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 147// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
148 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 148 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
149 //mailView->setMultiSelection ( true ); 149 //mailView->setMultiSelection ( true );
150 mailView->setSelectionMode( QListView::Extended ); 150 mailView->setSelectionMode( QListView::Extended );
151 QValueList<int> list; 151 QValueList<int> list;
152 int fw = 100; 152 int fw = 100;
153 if ( QApplication::desktop()->width() > 320 ) 153 if ( QApplication::desktop()->width() > 320 )
154 fw = 50; 154 fw = 50;
155 list.append( fw ); 155 list.append( fw );
156 list.append( 100 ); 156 list.append( 100 );
157 split->setSizes( list ); 157 split->setSizes( list );
158 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 158 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
159 mailView->setShowSortIndicator ( true ); 159 mailView->setShowSortIndicator ( true );
160 QLabel *spacer = new QLabel( toolBar ); 160 QLabel *spacer = new QLabel( toolBar );
161 spacer->setBackgroundMode( QWidget::PaletteButton ); 161 spacer->setBackgroundMode( QWidget::PaletteButton );
162 toolBar->setStretchableWidget( spacer ); 162 toolBar->setStretchableWidget( spacer );
163 163
164 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); 164 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
165 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 165 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
166 if ( QApplication::desktop()->width() > 320 ) 166 if ( QApplication::desktop()->width() > 320 )
167 closeMail->addTo(toolBar); 167 closeMail->addTo(toolBar);
168 closeMail->addTo(mailMenu); 168 closeMail->addTo(mailMenu);
169 169
170 170
171 QPopupMenu* helpMenu = new QPopupMenu( menuBar ); 171 QPopupMenu* helpMenu = new QPopupMenu( menuBar );
172 menuBar->insertItem( i18n( "Help" ), helpMenu ); 172 menuBar->insertItem( i18n( "Help" ), helpMenu );
173 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); 173 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this);
174 connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); 174 connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
175 li->addTo(helpMenu); 175 li->addTo(helpMenu);
176 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); 176 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this);
177 connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); 177 connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
178 li->addTo(helpMenu); 178 li->addTo(helpMenu);
179 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); 179 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this);
180 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 180 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
181 li->addTo(helpMenu); 181 li->addTo(helpMenu);
182} 182}
183 183
184MainWindow::~MainWindow() 184MainWindow::~MainWindow()
185{ 185{
186} 186}
187 187
188void MainWindow::showLicence() 188void MainWindow::showLicence()
189{ 189{
190 KApplication::showLicence(); 190 KApplication::showLicence();
191} 191}
192void MainWindow::showAbout() 192void MainWindow::showAbout()
193{ 193{
194 QString version; 194 QString version;
195#include <../version> 195#include <../version>
196 196
197 QString cap = "About KOpieMail/Pi"; 197 QString cap = "About KOpieMail/Pi";
198 QString text =i18n("KOpieMail/Platform-independent\n") + 198 QString text =i18n("KOpieMail/Platform-independent\n") +
199 "(OM/Pi) " + version + " - " 199 "(OM/Pi) " + version + " - "
200 200
201#ifdef DESKTOP_VERSION 201#ifdef DESKTOP_VERSION
202 "Desktop Edition\n" 202 "Desktop Edition\n"
203#else 203#else
204 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" 204 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
205#endif 205#endif
206 "www.pi-sync.net\n\n" 206 "www.pi-sync.net\n\n"
207 207
208 208
209 209
210"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" 210"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n"
211 "KOpieMail/Pi is based on Opie Mail\n" 211 "KOpieMail/Pi is based on Opie Mail\n"
212 "Copyright (c) Rajko Albrecht and the Opie team\n" 212 "Copyright (c) Rajko Albrecht and the Opie team\n"
213 "KOpieMail/Pi is licensed under the GPL\n" 213 "KOpieMail/Pi is licensed under the GPL\n"
214 "\n" 214 "\n"
215 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" 215 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
216 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" 216 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
217 "libEtPan has its own licence - see LibEtPan licence\n"; 217 "libEtPan has its own licence - see LibEtPan licence\n";
218 218
219 KApplication::showText( cap, text ); 219 KApplication::showText( cap, text );
220} 220}
221void MainWindow::showEtpanLicence() 221void MainWindow::showEtpanLicence()
222{ 222{
223 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); 223 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
224 224
225} 225}
226void MainWindow::appMessage(const QCString &, const QByteArray &) 226void MainWindow::appMessage(const QCString &, const QByteArray &)
227{ 227{
228 qDebug("appMessage implemented by subclass"); 228 qDebug("appMessage implemented by subclass");
229} 229}
230 230
231void MainWindow::slotAdjustLayout() { 231void MainWindow::slotAdjustLayout() {
232 232
233 /* 233 /*
234 QWidget *d = QApplication::desktop(); 234 QWidget *d = QApplication::desktop();
235 235
236 if ( d->width() < d->height() ) { 236 if ( d->width() < d->height() ) {
237 layout->setDirection( QBoxLayout::TopToBottom ); 237 layout->setDirection( QBoxLayout::TopToBottom );
238 } else { 238 } else {
239 layout->setDirection( QBoxLayout::LeftToRight ); 239 layout->setDirection( QBoxLayout::LeftToRight );
240 } 240 }
241 */ 241 */
242} 242}
243 243
244void MainWindow::slotAdjustColumns() 244void MainWindow::slotAdjustColumns()
245{ 245{
246 bool hidden = folderView->isHidden(); 246 bool hidden = folderView->isHidden();
247 if ( hidden ) folderView->show(); 247 if ( hidden ) folderView->show();
248 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 248 folderView->setColumnWidth( 0, folderView->visibleWidth() );
249 if ( hidden ) folderView->hide(); 249 if ( hidden ) folderView->hide();
250 250
251 mailView->setColumnWidth( 0, 10 ); 251 mailView->setColumnWidth( 0, 10 );
252 mailView->setColumnWidth( 1, 100 ); 252 mailView->setColumnWidth( 1, 100 );
253 mailView->setColumnWidth( 2, 100 ); 253 mailView->setColumnWidth( 2, 100 );
254 mailView->setColumnWidth( 3, 50 ); 254 mailView->setColumnWidth( 3, 50 );
255 mailView->setColumnWidth( 4, 120 ); 255 mailView->setColumnWidth( 4, 120 );
256} 256}
257 257
258void MainWindow::slotEditSettings() 258void MainWindow::slotEditSettings()
259{ 259{
260} 260}
261 261
262void MainWindow::slotShowFolders( bool ) 262void MainWindow::slotShowFolders( bool )
263{ 263{
264 qDebug("not implemented: "); 264 qDebug("not implemented: ");
265} 265}
266 266
267void MainWindow::refreshMailView(const QValueList<RecMailP>&) 267void MainWindow::refreshMailView(const QValueList<RecMailP>&)
268{ 268{
269 qDebug("not implemented: "); 269 qDebug("not implemented: ");
270} 270}
271 271
272void MainWindow::mailLeftClicked(QListViewItem * ) 272void MainWindow::mailLeftClicked(QListViewItem * )
273{ 273{
274 qDebug("not implemented: "); 274 qDebug("not implemented: ");
275} 275}
276 276
277void MainWindow::displayMail() 277void MainWindow::displayMail()
278{ 278{
279 qDebug("not implemented: "); 279 qDebug("not implemented: ");
280} 280}
281 281
282void MainWindow::slotDeleteMail() 282void MainWindow::slotDeleteMail()
283{ 283{
284 qDebug("not implemented: "); 284 qDebug("not implemented: ");
285} 285}
286 286
287void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 287void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
288{ 288{
289 qDebug("not implemented: "); 289 qDebug("not implemented: ");
290} 290}
291 291
292void MainWindow::slotSendQueued() 292void MainWindow::slotSendQueued()
293{ 293{
294 qDebug("not implemented: "); 294 qDebug("not implemented: ");
295} 295}
296 296
297void MainWindow::slotEditAccounts() 297void MainWindow::slotEditAccounts()
298{ 298{
299 qDebug("not implemented: "); 299 qDebug("not implemented: ");
300} 300}
301 301
302void MainWindow::slotComposeMail() 302void MainWindow::slotComposeMail()
303{ 303{
304 qDebug("not implemented: "); 304 qDebug("not implemented: ");
305} 305}
diff --git a/kmicromail/nntpgroupsdlg.cpp b/kmicromail/nntpgroupsdlg.cpp
index a461bdf..f564b10 100644
--- a/kmicromail/nntpgroupsdlg.cpp
+++ b/kmicromail/nntpgroupsdlg.cpp
@@ -1,30 +1,30 @@
1#include "nntpgroupsdlg.h" 1#include "nntpgroupsdlg.h"
2#include "nntpgroups.h" 2#include "nntpgroups.h"
3#include <klocale.h> 3#include <klocale.h>
4 4
5#include <libmailwrapper/settings.h> 5#include <libmailwrapper/settings.h>
6 6
7#include <qlayout.h> 7#include <qlayout.h>
8 8
9NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name) 9NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name)
10 : QDialog(parent,name,true,WStyle_ContextHelp) 10 : QDialog(parent,name,true,0)
11{ 11{
12 setCaption(i18n("Subscribed newsgroups")); 12 setCaption(i18n("Subscribed newsgroups"));
13 m_Account = account; 13 m_Account = account;
14 QVBoxLayout*dlglayout = new QVBoxLayout(this); 14 QVBoxLayout*dlglayout = new QVBoxLayout(this);
15 dlglayout->setSpacing(2); 15 dlglayout->setSpacing(2);
16 dlglayout->setMargin(1); 16 dlglayout->setMargin(1);
17 groupsWidget = new NNTPGroups(account,this); 17 groupsWidget = new NNTPGroups(account,this);
18 dlglayout->addWidget(groupsWidget); 18 dlglayout->addWidget(groupsWidget);
19} 19}
20 20
21NNTPGroupsDlg::~NNTPGroupsDlg() 21NNTPGroupsDlg::~NNTPGroupsDlg()
22{ 22{
23} 23}
24 24
25void NNTPGroupsDlg::accept() 25void NNTPGroupsDlg::accept()
26{ 26{
27 groupsWidget->storeValues(); 27 groupsWidget->storeValues();
28 m_Account->save(); 28 m_Account->save();
29 QDialog::accept(); 29 QDialog::accept();
30} 30}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 153c7c0..e088b9e 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,405 +1,408 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3 3
4#include "koprefsdialog.h"
5#include <libkdepim/externalapphandler.h>
6#include <libkdepim/kpimglobalprefs.h>
7#ifdef MINIKDE_KDIALOG_H
8#undef MINIKDE_KDIALOG_H
9#endif
4#include "settingsdialog.h" 10#include "settingsdialog.h"
5#include "opiemail.h" 11#include "opiemail.h"
6#include "editaccounts.h" 12#include "editaccounts.h"
7#include "composemail.h" 13#include "composemail.h"
8#include "mailistviewitem.h" 14#include "mailistviewitem.h"
9#include "viewmail.h" 15#include "viewmail.h"
10#include "selectstore.h" 16#include "selectstore.h"
11#include "selectsmtp.h" 17#include "selectsmtp.h"
12#include "accountitem.h" 18#include "accountitem.h"
13#include "koprefsdialog.h"
14#include "klocale.h" 19#include "klocale.h"
15 20
16#include <qmessagebox.h> 21#include <qmessagebox.h>
17#include <qtimer.h> 22#include <qtimer.h>
18#include <qcursor.h> 23#include <qcursor.h>
19#include <qregexp.h> 24#include <qregexp.h>
20#include <libkdepim/externalapphandler.h>
21#include <libkdepim/kpimglobalprefs.h>
22 25
23#ifdef DESKTOP_VERSION 26#ifdef DESKTOP_VERSION
24#include <qapplication.h> 27#include <qapplication.h>
25#else 28#else
26#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
27#endif 30#endif
28#include <libmailwrapper/smtpwrapper.h> 31#include <libmailwrapper/smtpwrapper.h>
29#include <libmailwrapper/mailtypes.h> 32#include <libmailwrapper/mailtypes.h>
30#include <libmailwrapper/abstractmail.h> 33#include <libmailwrapper/abstractmail.h>
31/* OPIE */ 34/* OPIE */
32//#include <qpe/resource.h> 35//#include <qpe/resource.h>
33//#include <qpe/qpeapplication.h> 36//#include <qpe/qpeapplication.h>
34 37
35/* QT */ 38/* QT */
36 39
37//using namespace Opie::Core; 40//using namespace Opie::Core;
38 41
39OpieMail::OpieMail( QWidget *parent, const char *name ) 42OpieMail::OpieMail( QWidget *parent, const char *name )
40 : MainWindow( parent, name) //, WStyle_ContextHelp ) 43 : MainWindow( parent, name) //, WStyle_ContextHelp )
41{ 44{
42 settings = new Settings(); 45 settings = new Settings();
43 46
44 folderView->populate( settings->getAccounts() ); 47 folderView->populate( settings->getAccounts() );
45 48
46} 49}
47 50
48OpieMail::~OpieMail() 51OpieMail::~OpieMail()
49{ 52{
50 if (settings) delete settings; 53 if (settings) delete settings;
51} 54}
52 55
53void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 56void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
54{ 57{
55 58
56} 59}
57#include <stdlib.h> 60#include <stdlib.h>
58void OpieMail::message(const QCString &msg, const QByteArray &data) 61void OpieMail::message(const QCString &msg, const QByteArray &data)
59{ 62{
60 // copied from old mail2 63 // copied from old mail2
61 static int ii = 0; 64 static int ii = 0;
62 //qDebug("QCOP CALL ############################# %d ", ii); 65 //qDebug("QCOP CALL ############################# %d ", ii);
63 //QString mess ( msg ); 66 //QString mess ( msg );
64 //qDebug("Message = %s ",mess.latin1()); 67 //qDebug("Message = %s ",mess.latin1());
65 ++ii; 68 ++ii;
66 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 69 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
67 70
68 mPendingEmail = QString::null; 71 mPendingEmail = QString::null;
69 mPendingName = QString::null; 72 mPendingName = QString::null;
70 if (msg == "writeMail(QString,QString)") 73 if (msg == "writeMail(QString,QString)")
71 { 74 {
72 //qDebug("writeMail(QString,QString) "); 75 //qDebug("writeMail(QString,QString) ");
73 QDataStream stream(data,IO_ReadOnly); 76 QDataStream stream(data,IO_ReadOnly);
74 stream >> mPendingName >> mPendingEmail; 77 stream >> mPendingName >> mPendingEmail;
75 // removing the whitespaces at beginning and end is needed! 78 // removing the whitespaces at beginning and end is needed!
76 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 79 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
77 } 80 }
78 else if (msg == "newMail()") 81 else if (msg == "newMail()")
79 { 82 {
80 //qDebug("slotComposeMail() "); 83 //qDebug("slotComposeMail() ");
81 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 84 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
82 // and a QCOP call does not like a processevents in his execution 85 // and a QCOP call does not like a processevents in his execution
83 // with the Qtimer we call slotComposeMail() after we reached the main event loop 86 // with the Qtimer we call slotComposeMail() after we reached the main event loop
84 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 87 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
85 // slotComposeMail(); 88 // slotComposeMail();
86 } 89 }
87 else if (msg == "newMail(QString)") 90 else if (msg == "newMail(QString)")
88 { 91 {
89 //qDebug(" newMail(QString)"); 92 //qDebug(" newMail(QString)");
90 QDataStream stream(data,IO_ReadOnly); 93 QDataStream stream(data,IO_ReadOnly);
91 stream >> mPendingName; 94 stream >> mPendingName;
92 // the format is 95 // the format is
93 // NAME <EMAIL>:SUBJECT 96 // NAME <EMAIL>:SUBJECT
94 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 97 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
95 } else { 98 } else {
96 mPendingData = data; 99 mPendingData = data;
97 mPendingMessage = msg; 100 mPendingMessage = msg;
98 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 101 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
99 } 102 }
100 103
101 //qDebug("END OpieMail::message "); 104 //qDebug("END OpieMail::message ");
102} 105}
103void OpieMail::slotExtAppHandler() 106void OpieMail::slotExtAppHandler()
104{ 107{
105 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 108 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
106} 109}
107void OpieMail::slotwriteMail2(const QString& namemail ) 110void OpieMail::slotwriteMail2(const QString& namemail )
108{ 111{
109 //qDebug("OpieMail::slotwriteMail2 "); 112 //qDebug("OpieMail::slotwriteMail2 ");
110 //qApp->processEvents(); 113 //qApp->processEvents();
111 ComposeMail compose( settings, this, 0, true ); 114 ComposeMail compose( settings, this, 0, true );
112 if ( !namemail.isEmpty() ) { 115 if ( !namemail.isEmpty() ) {
113 QString to = namemail; 116 QString to = namemail;
114 if ( namemail.find( " <") > 1 ) { 117 if ( namemail.find( " <") > 1 ) {
115 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 118 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
116 } else 119 } else
117 if ( namemail.find( "<") > 1 ) { 120 if ( namemail.find( "<") > 1 ) {
118 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 121 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
119 } 122 }
120 int sub = to.find( ">:"); 123 int sub = to.find( ">:");
121 if ( sub > 0 ) { 124 if ( sub > 0 ) {
122 compose.setTo( to.left(sub+1) ); 125 compose.setTo( to.left(sub+1) );
123 compose.setSubject( to.mid(sub+2) ); 126 compose.setSubject( to.mid(sub+2) );
124 } else 127 } else
125 compose.setTo( to ); 128 compose.setTo( to );
126 } 129 }
127 compose.slotAdjustColumns(); 130 compose.slotAdjustColumns();
128 compose.showMaximized(); 131 compose.showMaximized();
129 compose.exec(); 132 compose.exec();
130 raise(); 133 raise();
131 //qDebug("retttich "); 134 //qDebug("retttich ");
132} 135}
133void OpieMail::slotwriteMail(const QString&name,const QString&email) 136void OpieMail::slotwriteMail(const QString&name,const QString&email)
134{ 137{
135 // qDebug("OpieMail::slotwriteMail "); 138 // qDebug("OpieMail::slotwriteMail ");
136 ComposeMail compose( settings, this, 0, true ); 139 ComposeMail compose( settings, this, 0, true );
137 if (!email.isEmpty()) 140 if (!email.isEmpty())
138 { 141 {
139 if (!name.isEmpty()) 142 if (!name.isEmpty())
140 { 143 {
141 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 144 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
142 } 145 }
143 else 146 else
144 { 147 {
145 compose.setTo(email); 148 compose.setTo(email);
146 } 149 }
147 } 150 }
148 compose.slotAdjustColumns(); 151 compose.slotAdjustColumns();
149 compose.showMaximized(); 152 compose.showMaximized();
150 compose.exec(); 153 compose.exec();
151 raise(); 154 raise();
152} 155}
153 156
154void OpieMail::slotComposeMail() 157void OpieMail::slotComposeMail()
155{ 158{
156 if ( mPendingEmail == QString::null && mPendingName == QString::null) 159 if ( mPendingEmail == QString::null && mPendingName == QString::null)
157 slotwriteMail2( QString () ); 160 slotwriteMail2( QString () );
158 else { 161 else {
159 if ( mPendingEmail == QString::null ) 162 if ( mPendingEmail == QString::null )
160 slotwriteMail2( mPendingName ); 163 slotwriteMail2( mPendingName );
161 else 164 else
162 slotwriteMail( mPendingName, mPendingEmail ); 165 slotwriteMail( mPendingName, mPendingEmail );
163 } 166 }
164 //slotwriteMail(0l,0l); 167 //slotwriteMail(0l,0l);
165} 168}
166 169
167void OpieMail::slotSendQueued() 170void OpieMail::slotSendQueued()
168{ 171{
169 SMTPaccount *smtp = 0; 172 SMTPaccount *smtp = 0;
170 173
171 QList<Account> list = settings->getAccounts(); 174 QList<Account> list = settings->getAccounts();
172 QList<SMTPaccount> smtpList; 175 QList<SMTPaccount> smtpList;
173 smtpList.setAutoDelete(false); 176 smtpList.setAutoDelete(false);
174 Account *it; 177 Account *it;
175 for ( it = list.first(); it; it = list.next() ) 178 for ( it = list.first(); it; it = list.next() )
176 { 179 {
177 if ( it->getType() == MAILLIB::A_SMTP ) 180 if ( it->getType() == MAILLIB::A_SMTP )
178 { 181 {
179 smtp = static_cast<SMTPaccount *>(it); 182 smtp = static_cast<SMTPaccount *>(it);
180 smtpList.append(smtp); 183 smtpList.append(smtp);
181 } 184 }
182 } 185 }
183 if (smtpList.count()==0) 186 if (smtpList.count()==0)
184 { 187 {
185 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); 188 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n"));
186 return; 189 return;
187 } 190 }
188 if (smtpList.count()==1) 191 if (smtpList.count()==1)
189 { 192 {
190 smtp = smtpList.at(0); 193 smtp = smtpList.at(0);
191 } 194 }
192 else 195 else
193 { 196 {
194 smtp = 0; 197 smtp = 0;
195 selectsmtp selsmtp; 198 selectsmtp selsmtp;
196 selsmtp.setSelectionlist(&smtpList); 199 selsmtp.setSelectionlist(&smtpList);
197 selsmtp.showMaximized(); 200 selsmtp.showMaximized();
198 if ( selsmtp.exec() == QDialog::Accepted ) 201 if ( selsmtp.exec() == QDialog::Accepted )
199 { 202 {
200 smtp = selsmtp.selected_smtp(); 203 smtp = selsmtp.selected_smtp();
201 } 204 }
202 } 205 }
203 if (smtp) 206 if (smtp)
204 { 207 {
205 SMTPwrapper * wrap = new SMTPwrapper(smtp); 208 SMTPwrapper * wrap = new SMTPwrapper(smtp);
206 if ( wrap->flushOutbox() ) 209 if ( wrap->flushOutbox() )
207 { 210 {
208 QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed")); 211 QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed"));
209 } 212 }
210 delete wrap; 213 delete wrap;
211 } 214 }
212} 215}
213 216
214void OpieMail::slotSearchMails() 217void OpieMail::slotSearchMails()
215{ 218{
216 qDebug("OpieMail::slotSearchMails():not implemented "); 219 qDebug("OpieMail::slotSearchMails():not implemented ");
217} 220}
218 221
219void OpieMail::slotEditSettings() 222void OpieMail::slotEditSettings()
220{ 223{
221#if 0 224#if 0
222 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 225 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
223 settingsDialog.showMaximized(); 226 settingsDialog.showMaximized();
224 settingsDialog.exec(); 227 settingsDialog.exec();
225#endif 228#endif
226 KOPrefsDialog settingsDialog( this, "koprefs", true ); 229 KOPrefsDialog settingsDialog( this, "koprefs", true );
227 settingsDialog.showMaximized(); 230 settingsDialog.showMaximized();
228 settingsDialog.exec(); 231 settingsDialog.exec();
229} 232}
230 233
231void OpieMail::slotEditAccounts() 234void OpieMail::slotEditAccounts()
232{ 235{
233 EditAccounts eaDialog( settings, this, 0, true ); 236 EditAccounts eaDialog( settings, this, 0, true );
234 eaDialog.slotAdjustColumns(); 237 eaDialog.slotAdjustColumns();
235 eaDialog.showMaximized(); 238 eaDialog.showMaximized();
236 eaDialog.exec(); 239 eaDialog.exec();
237 if ( settings ) delete settings; 240 if ( settings ) delete settings;
238 settings = new Settings(); 241 settings = new Settings();
239 242
240 folderView->populate( settings->getAccounts() ); 243 folderView->populate( settings->getAccounts() );
241} 244}
242 245
243void OpieMail::displayMail() 246void OpieMail::displayMail()
244{ 247{
245 QListViewItem*item = mailView->currentItem(); 248 QListViewItem*item = mailView->currentItem();
246 if (!item) return; 249 if (!item) return;
247 RecMailP mail = ((MailListViewItem*)item)->data(); 250 RecMailP mail = ((MailListViewItem*)item)->data();
248 RecBodyP body = folderView->fetchBody(mail); 251 RecBodyP body = folderView->fetchBody(mail);
249 ViewMail readMail( this,"", Qt::WType_Modal ); 252 ViewMail readMail( this,"", Qt::WType_Modal );
250 readMail.setBody( body ); 253 readMail.setBody( body );
251 readMail.setMail( mail ); 254 readMail.setMail( mail );
252 readMail.showMaximized(); 255 readMail.showMaximized();
253 readMail.exec(); 256 readMail.exec();
254 257
255 if ( readMail.deleted ) 258 if ( readMail.deleted )
256 { 259 {
257 folderView->refreshCurrent(); 260 folderView->refreshCurrent();
258 } 261 }
259 else 262 else
260 { 263 {
261 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 264 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
262 } 265 }
263} 266}
264void OpieMail::slotGetAllMail() 267void OpieMail::slotGetAllMail()
265{ 268{
266 QListViewItem * item = folderView->firstChild(); 269 QListViewItem * item = folderView->firstChild();
267 while ( item ){ 270 while ( item ){
268 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 271 ((AccountViewItem *)item)->contextMenuSelected( 101 );
269 item = item->nextSibling (); 272 item = item->nextSibling ();
270 } 273 }
271} 274}
272void OpieMail::slotGetMail() 275void OpieMail::slotGetMail()
273{ 276{
274 QListViewItem * item = folderView->currentItem(); 277 QListViewItem * item = folderView->currentItem();
275 if ( ! item ) return; 278 if ( ! item ) return;
276 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 279 ((AccountViewItem *)item)->contextMenuSelected( 101 );
277} 280}
278void OpieMail::slotDeleteMail() 281void OpieMail::slotDeleteMail()
279{ 282{
280 if (!mailView->currentItem()) return; 283 if (!mailView->currentItem()) return;
281 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 284 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
282 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 285 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
283 { 286 {
284 mail->Wrapper()->deleteMail( mail ); 287 mail->Wrapper()->deleteMail( mail );
285 folderView->refreshCurrent(); 288 folderView->refreshCurrent();
286 } 289 }
287} 290}
288void OpieMail::slotDeleteAllMail() 291void OpieMail::slotDeleteAllMail()
289{ 292{
290 293
291 QValueList<RecMailP> t; 294 QValueList<RecMailP> t;
292 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 295 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
293 { 296 {
294 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 297 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
295 while ( item ) { 298 while ( item ) {
296 if ( item->isSelected() ) { 299 if ( item->isSelected() ) {
297 t.append( item->data() ); 300 t.append( item->data() );
298 } 301 }
299 item = (MailListViewItem*)item->nextSibling(); 302 item = (MailListViewItem*)item->nextSibling();
300 } 303 }
301 } 304 }
302 else 305 else
303 return; 306 return;
304 if ( t.count() == 0 ) 307 if ( t.count() == 0 )
305 return; 308 return;
306 RecMailP mail = t.first(); 309 RecMailP mail = t.first();
307 mail->Wrapper()->deleteMailList(t); 310 mail->Wrapper()->deleteMailList(t);
308 folderView->refreshCurrent(); 311 folderView->refreshCurrent();
309 312
310 313
311} 314}
312void OpieMail::clearSelection() 315void OpieMail::clearSelection()
313{ 316{
314 mailView->clearSelection(); 317 mailView->clearSelection();
315 318
316} 319}
317 320
318void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 321void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
319{ 322{
320 if (!mailView->currentItem()) return; 323 if (!mailView->currentItem()) return;
321 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 324 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
322 /* just the RIGHT button - or hold on pda */ 325 /* just the RIGHT button - or hold on pda */
323 if (button!=2) {return;} 326 if (button!=2) {return;}
324 if (!item) return; 327 if (!item) return;
325 QPopupMenu *m = new QPopupMenu(0); 328 QPopupMenu *m = new QPopupMenu(0);
326 if (m) 329 if (m)
327 { 330 {
328 if (mailtype==MAILLIB::A_NNTP) { 331 if (mailtype==MAILLIB::A_NNTP) {
329 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); 332 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
330 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); 333 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
331 m->insertSeparator(); 334 m->insertSeparator();
332 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 335 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
333 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 336 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
334 } else { 337 } else {
335 if (folderView->currentisDraft()) { 338 if (folderView->currentisDraft()) {
336 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); 339 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
337 } 340 }
338 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); 341 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
339 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 342 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
340 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); 343 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
341 m->insertSeparator(); 344 m->insertSeparator();
342 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 345 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
343 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 346 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
344 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 347 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
345 } 348 }
346 m->setFocus(); 349 m->setFocus();
347 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 350 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
348 delete m; 351 delete m;
349 } 352 }
350} 353}
351 354
352void OpieMail::slotShowFolders( bool show ) 355void OpieMail::slotShowFolders( bool show )
353{ 356{
354 if ( show && folderView->isHidden() ) 357 if ( show && folderView->isHidden() )
355 { 358 {
356 folderView->show(); 359 folderView->show();
357 } 360 }
358 else if ( !show && !folderView->isHidden() ) 361 else if ( !show && !folderView->isHidden() )
359 { 362 {
360 folderView->hide(); 363 folderView->hide();
361 } 364 }
362} 365}
363 366
364void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 367void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
365{ 368{
366 MailListViewItem*item = 0; 369 MailListViewItem*item = 0;
367 mailView->clear(); 370 mailView->clear();
368 371
369 QValueList<RecMailP>::ConstIterator it; 372 QValueList<RecMailP>::ConstIterator it;
370 for (it = list.begin(); it != list.end();++it) 373 for (it = list.begin(); it != list.end();++it)
371 { 374 {
372 item = new MailListViewItem(mailView,item); 375 item = new MailListViewItem(mailView,item);
373 item->storeData((*it)); 376 item->storeData((*it));
374 item->showEntry(); 377 item->showEntry();
375 } 378 }
376} 379}
377 380
378void OpieMail::mailLeftClicked( QListViewItem *item ) 381void OpieMail::mailLeftClicked( QListViewItem *item )
379{ 382{
380 mailView->clearSelection(); 383 mailView->clearSelection();
381 /* just LEFT button - or tap with stylus on pda */ 384 /* just LEFT button - or tap with stylus on pda */
382 //if (button!=1) return; 385 //if (button!=1) return;
383 if (!item) return; 386 if (!item) return;
384 if (folderView->currentisDraft()) { 387 if (folderView->currentisDraft()) {
385 reEditMail(); 388 reEditMail();
386 } else { 389 } else {
387 displayMail(); 390 displayMail();
388 } 391 }
389} 392}
390 393
391void OpieMail::slotMoveCopyMail() 394void OpieMail::slotMoveCopyMail()
392{ 395{
393 if (!mailView->currentItem()) return; 396 if (!mailView->currentItem()) return;
394 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 397 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
395 AbstractMail*targetMail = 0; 398 AbstractMail*targetMail = 0;
396 QString targetFolder = ""; 399 QString targetFolder = "";
397 Selectstore sels; 400 Selectstore sels;
398 folderView->setupFolderselect(&sels); 401 folderView->setupFolderselect(&sels);
399 if (!sels.exec()) return; 402 if (!sels.exec()) return;
400 targetMail = sels.currentMail(); 403 targetMail = sels.currentMail();
401 targetFolder = sels.currentFolder(); 404 targetFolder = sels.currentFolder();
402 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 405 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
403 targetFolder.isEmpty()) 406 targetFolder.isEmpty())
404 { 407 {
405 return; 408 return;
diff --git a/kmicromail/qpe/qdialog.h b/kmicromail/qpe/qdialog.h
new file mode 100644
index 0000000..d671e34
--- a/dev/null
+++ b/kmicromail/qpe/qdialog.h
@@ -0,0 +1,35 @@
1
2#ifndef MINIKDE_KDIALOG_H
3
4#ifndef DEFINE_QDIALOG_HACK
5#define DEFINE_QDIALOG_HACK
6#warning call of include <qdialog.h>
7#warning including /usr/local/qt/include/qdialog.h
8#warning if you get an compiling error please adjust your path her
9
10#include "/usr/local/qt/include/qdialog.h"
11class QDialog_hacked : public QDialog
12{
13 //Q__OBJECT
14
15 public:
16 QDialog_hacked ( QWidget * parent=0, const char * name=0, bool modal=true, WFlags f=0 );
17
18};
19
20#define QDialog QDialog_hacked
21
22#endif
23
24#else
25#warning ******************************************
26#warning ******************************************
27#warning ******************************************
28#warning ******************************************
29#warning ******************************************
30#warning ******************************************
31#warning ******************************************
32#warning ******************************************
33#include "/usr/local/qt/include/qdialog.h"
34
35#endif
diff --git a/kmicromail/qpe/qdialog_hacked.cpp b/kmicromail/qpe/qdialog_hacked.cpp
new file mode 100644
index 0000000..e2ce21a
--- a/dev/null
+++ b/kmicromail/qpe/qdialog_hacked.cpp
@@ -0,0 +1,30 @@
1
2#include <qdialog.h>
3#include <qhbox.h>
4#include <qpushbutton.h>
5#include <klocale.h>
6#ifdef QDialog
7#undef QDialog
8#endif
9 QDialog_hacked::QDialog_hacked ( QWidget * parent, const char * name, bool modal, WFlags f )
10 : QDialog( parent,name,modal)
11 {
12 qDebug("******************** ");
13 qDebug("******************** ");
14 qDebug("******************** ");
15 qDebug("******************** ");
16 qDebug("New hacked QDialog == KDialogBase ");
17 //QTimer::singleShot( 1, this,SLOT(addaddbuttons()) );
18
19 setOrientation ( Vertical );
20 QHBox * hb = new QHBox ( this );
21 QPushButton *ok = new QPushButton( i18n("OK"), hb );
22 QPushButton *cancel = new QPushButton( i18n("Cancel"), hb );
23 setExtension ( hb );
24 showExtension ( true );
25 connect ( ok, SIGNAL ( clicked()),this, SLOT (accept() ) );
26 connect ( cancel, SIGNAL ( clicked()),this, SLOT (reject() ) );
27
28 }
29
30
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 0b4c322..f1e0225 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -1,533 +1,536 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2
3
4
5#include <kfiledialog.h>
6#include "koprefs.h"
7#include <klocale.h>
8#include <kglobal.h>
9#include <kapplication.h>
10
11#ifdef MINIKDE_KDIALOG_H
12#undef MINIKDE_KDIALOG_H
13#endif
14
2#include "composemail.h" 15#include "composemail.h"
3#include "viewmail.h" 16#include "viewmail.h"
4 17
5#include <libmailwrapper/settings.h> 18#include <libmailwrapper/settings.h>
6#include <libmailwrapper/abstractmail.h> 19#include <libmailwrapper/abstractmail.h>
7#include <libmailwrapper/mailtypes.h> 20#include <libmailwrapper/mailtypes.h>
8#include <kapplication.h>
9
10/* OPIE */
11//#include <opie2/odebug.h>
12//#include <opie2/ofiledialog.h>
13//#include <opie2/oimagescrollview.h>
14 21
15#include <kfiledialog.h> 22#include <qdialog.h>
16#include <kdialog.h>
17 23
18#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
19 25
20/* QT */ 26/* QT */
21#include <qtextbrowser.h> 27#include <qtextbrowser.h>
22#include <qmessagebox.h> 28#include <qmessagebox.h>
23#include <qtextstream.h> 29#include <qtextstream.h>
24#include <qaction.h> 30#include <qaction.h>
25#include <qpopupmenu.h> 31#include <qpopupmenu.h>
26#include <qfile.h> 32#include <qfile.h>
27#include <qlayout.h> 33#include <qlayout.h>
28#include "koprefs.h"
29#include <klocale.h>
30#include <kglobal.h>
31 34
32//using namespace Opie::Ui; 35//using namespace Opie::Ui;
33//using namespace Opie::Core; 36//using namespace Opie::Core;
34 37
35AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 38AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
36 const QString&fsize,int num,const QValueList<int>&path) 39 const QString&fsize,int num,const QValueList<int>&path)
37 : QListViewItem(parent,after),_partNum(num) 40 : QListViewItem(parent,after),_partNum(num)
38{ 41{
39 _path=path; 42 _path=path;
40 setText(0, mime); 43 setText(0, mime);
41 setText(1, desc); 44 setText(1, desc);
42 setText(2, file); 45 setText(2, file);
43 setText(3, fsize); 46 setText(3, fsize);
44} 47}
45 48
46AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 49AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
47 const QString&fsize,int num,const QValueList<int>&path) 50 const QString&fsize,int num,const QValueList<int>&path)
48 : QListViewItem(parent,after),_partNum(num) 51 : QListViewItem(parent,after),_partNum(num)
49{ 52{
50 _path=path; 53 _path=path;
51 setText(0, mime); 54 setText(0, mime);
52 setText(1, desc); 55 setText(1, desc);
53 setText(2, file); 56 setText(2, file);
54 setText(3, fsize); 57 setText(3, fsize);
55} 58}
56 59
57bool AttachItem::isParentof(const QValueList<int>&path) 60bool AttachItem::isParentof(const QValueList<int>&path)
58{ 61{
59 /* if not set, then no parent */ 62 /* if not set, then no parent */
60 if (path.count()==0||_path.count()==0) return false; 63 if (path.count()==0||_path.count()==0) return false;
61 /* the parent must have one digit less then a child */ 64 /* the parent must have one digit less then a child */
62 if (path.count()!=_path.count()+1) return false; 65 if (path.count()!=_path.count()+1) return false;
63 for (unsigned int i=0; i < _path.count();++i) 66 for (unsigned int i=0; i < _path.count();++i)
64 { 67 {
65 if (_path[i]!=path[i]) return false; 68 if (_path[i]!=path[i]) return false;
66 } 69 }
67 return true; 70 return true;
68} 71}
69 72
70AttachItem* ViewMail::searchParent(const QValueList<int>&path) 73AttachItem* ViewMail::searchParent(const QValueList<int>&path)
71{ 74{
72 QListViewItemIterator it( attachments ); 75 QListViewItemIterator it( attachments );
73 for ( ; it.current(); ++it ) 76 for ( ; it.current(); ++it )
74 { 77 {
75 AttachItem*ati = (AttachItem*)it.current(); 78 AttachItem*ati = (AttachItem*)it.current();
76 if (ati->isParentof(path)) return ati; 79 if (ati->isParentof(path)) return ati;
77 } 80 }
78 return 0; 81 return 0;
79} 82}
80 83
81AttachItem* ViewMail::lastChild(AttachItem*parent) 84AttachItem* ViewMail::lastChild(AttachItem*parent)
82{ 85{
83 if (!parent) return 0; 86 if (!parent) return 0;
84 AttachItem* item = (AttachItem*)parent->firstChild(); 87 AttachItem* item = (AttachItem*)parent->firstChild();
85 if (!item) return item; 88 if (!item) return item;
86 AttachItem*temp=0; 89 AttachItem*temp=0;
87 while( (temp=(AttachItem*)item->nextSibling())) 90 while( (temp=(AttachItem*)item->nextSibling()))
88 { 91 {
89 item = temp; 92 item = temp;
90 } 93 }
91 return item; 94 return item;
92} 95}
93 96
94void ViewMail::setBody(const RecBodyP&body ) 97void ViewMail::setBody(const RecBodyP&body )
95{ 98{
96 99
97 m_body = body; 100 m_body = body;
98 m_mail[2] = body->Bodytext(); 101 m_mail[2] = body->Bodytext();
99 attachbutton->setEnabled(body->Parts().count()>0); 102 attachbutton->setEnabled(body->Parts().count()>0);
100 attachments->setEnabled(body->Parts().count()>0); 103 attachments->setEnabled(body->Parts().count()>0);
101 if (body->Parts().count()==0) 104 if (body->Parts().count()==0)
102 { 105 {
103 return; 106 return;
104 } 107 }
105 AttachItem * curItem=0; 108 AttachItem * curItem=0;
106 AttachItem * parentItem = 0; 109 AttachItem * parentItem = 0;
107 QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); 110 QString type=body->Description()->Type()+"/"+body->Description()->Subtype();
108 QString desc,fsize; 111 QString desc,fsize;
109 double s = body->Description()->Size(); 112 double s = body->Description()->Size();
110 int w; 113 int w;
111 w=0; 114 w=0;
112 115
113 while (s>1024) 116 while (s>1024)
114 { 117 {
115 s/=1024; 118 s/=1024;
116 ++w; 119 ++w;
117 if (w>=2) break; 120 if (w>=2) break;
118 } 121 }
119 122
120 QString q=""; 123 QString q="";
121 switch(w) 124 switch(w)
122 { 125 {
123 case 1: 126 case 1:
124 q="k"; 127 q="k";
125 break; 128 break;
126 case 2: 129 case 2:
127 q="M"; 130 q="M";
128 break; 131 break;
129 default: 132 default:
130 break; 133 break;
131 } 134 }
132 135
133 { 136 {
134 /* I did not found a method to make a CONTENT reset on a QTextStream 137 /* I did not found a method to make a CONTENT reset on a QTextStream
135 so I use this construct that the stream will re-constructed in each 138 so I use this construct that the stream will re-constructed in each
136 loop. To let it work, the textstream is packed into a own area of 139 loop. To let it work, the textstream is packed into a own area of
137 code is it will be destructed after finishing its small job. 140 code is it will be destructed after finishing its small job.
138 */ 141 */
139 QTextOStream o(&fsize); 142 QTextOStream o(&fsize);
140 if (w>0) o.precision(2); else o.precision(0); 143 if (w>0) o.precision(2); else o.precision(0);
141 o.setf(QTextStream::fixed); 144 o.setf(QTextStream::fixed);
142 o << s << " " << q << "Byte"; 145 o << s << " " << q << "Byte";
143 } 146 }
144 147
145 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); 148 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist());
146 QString filename = ""; 149 QString filename = "";
147 150
148 for (unsigned int i = 0; i < body->Parts().count();++i) 151 for (unsigned int i = 0; i < body->Parts().count();++i)
149 { 152 {
150 filename = ""; 153 filename = "";
151 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); 154 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype();
152 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); 155 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin();
153 for (;it!=body->Parts()[i]->Parameters().end();++it) 156 for (;it!=body->Parts()[i]->Parameters().end();++it)
154 { 157 {
155 if (it.key().lower()=="name") 158 if (it.key().lower()=="name")
156 { 159 {
157 filename=it.data(); 160 filename=it.data();
158 } 161 }
159 } 162 }
160 s = body->Parts()[i]->Size(); 163 s = body->Parts()[i]->Size();
161 w = 0; 164 w = 0;
162 while (s>1024) 165 while (s>1024)
163 { 166 {
164 s/=1024; 167 s/=1024;
165 ++w; 168 ++w;
166 if (w>=2) break; 169 if (w>=2) break;
167 } 170 }
168 switch(w) 171 switch(w)
169 { 172 {
170 case 1: 173 case 1:
171 q="k"; 174 q="k";
172 break; 175 break;
173 case 2: 176 case 2:
174 q="M"; 177 q="M";
175 break; 178 break;
176 default: 179 default:
177 q=""; 180 q="";
178 break; 181 break;
179 } 182 }
180 QTextOStream o(&fsize); 183 QTextOStream o(&fsize);
181 if (w>0) o.precision(2); else o.precision(0); 184 if (w>0) o.precision(2); else o.precision(0);
182 o.setf(QTextStream::fixed); 185 o.setf(QTextStream::fixed);
183 o << s << " " << q << "Byte"; 186 o << s << " " << q << "Byte";
184 desc = body->Parts()[i]->Description(); 187 desc = body->Parts()[i]->Description();
185 parentItem = searchParent(body->Parts()[i]->Positionlist()); 188 parentItem = searchParent(body->Parts()[i]->Positionlist());
186 if (parentItem) 189 if (parentItem)
187 { 190 {
188 AttachItem*temp = lastChild(parentItem); 191 AttachItem*temp = lastChild(parentItem);
189 if (temp) curItem = temp; 192 if (temp) curItem = temp;
190 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 193 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
191 attachments->setRootIsDecorated(true); 194 attachments->setRootIsDecorated(true);
192 curItem = parentItem; 195 curItem = parentItem;
193 } 196 }
194 else 197 else
195 { 198 {
196 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 199 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
197 } 200 }
198 } 201 }
199} 202}
200 203
201 204
202void ViewMail::slotShowHtml( bool state ) 205void ViewMail::slotShowHtml( bool state )
203{ 206{
204 m_showHtml = state; 207 m_showHtml = state;
205 setText(); 208 setText();
206} 209}
207 210
208void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) 211void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
209{ 212{
210 if (!item ) 213 if (!item )
211 return; 214 return;
212 215
213 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 216 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
214 { 217 {
215 setText(); 218 setText();
216 return; 219 return;
217 } 220 }
218 QPopupMenu *menu = new QPopupMenu(); 221 QPopupMenu *menu = new QPopupMenu();
219 int ret=0; 222 int ret=0;
220 223
221 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 224 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
222 { 225 {
223 menu->insertItem( i18n( "Show Text" ), 1 ); 226 menu->insertItem( i18n( "Show Text" ), 1 );
224 } 227 }
225 if (item->text(0).left(6)=="image/") { 228 if (item->text(0).left(6)=="image/") {
226 menu->insertItem(i18n("Display image preview"),2); 229 menu->insertItem(i18n("Display image preview"),2);
227 } 230 }
228 menu->insertItem( i18n( "Save Attachment" ), 0 ); 231 menu->insertItem( i18n( "Save Attachment" ), 0 );
229 menu->insertSeparator(1); 232 menu->insertSeparator(1);
230 233
231 ret = menu->exec( point, 0 ); 234 ret = menu->exec( point, 0 );
232 235
233 switch(ret) 236 switch(ret)
234 { 237 {
235 case 0: 238 case 0:
236 { 239 {
237 //MimeTypes types; 240 //MimeTypes types;
238 //types.insert( "all", "*" ); 241 //types.insert( "all", "*" );
239 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); 242 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this );
240 243
241 if( !str.isEmpty() ) 244 if( !str.isEmpty() )
242 { 245 {
243 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 246 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
244 if (content) 247 if (content)
245 { 248 {
246 QFile output(str); 249 QFile output(str);
247 output.open(IO_WriteOnly); 250 output.open(IO_WriteOnly);
248 output.writeBlock(content->Content(),content->Length()); 251 output.writeBlock(content->Content(),content->Length());
249 output.close(); 252 output.close();
250 delete content; 253 delete content;
251 } 254 }
252 } 255 }
253 } 256 }
254 break ; 257 break ;
255 258
256 case 2: 259 case 2:
257 { 260 {
258#ifdef DESKTOP_VERSION 261#ifdef DESKTOP_VERSION
259 QString tmpfile = locateLocal( "tmp", "opiemail-image"); 262 QString tmpfile = locateLocal( "tmp", "opiemail-image");
260#else 263#else
261 QString tmpfile = "/tmp/opiemail-image"; 264 QString tmpfile = "/tmp/opiemail-image";
262#endif 265#endif
263 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 266 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
264 if (content) { 267 if (content) {
265 QFile output(tmpfile); 268 QFile output(tmpfile);
266 output.open(IO_WriteOnly); 269 output.open(IO_WriteOnly);
267 output.writeBlock(content->Content(),content->Length()); 270 output.writeBlock(content->Content(),content->Length());
268 output.close(); 271 output.close();
269 delete content; 272 delete content;
270 MailImageDlg iview(""); 273 MailImageDlg iview("");
271 iview.setName(tmpfile); 274 iview.setName(tmpfile);
272 KApplication::execDialog(&iview); 275 KApplication::execDialog(&iview);
273 output.remove(); 276 output.remove();
274 } 277 }
275 } 278 }
276 break; 279 break;
277 case 1: 280 case 1:
278 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 281 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
279 { 282 {
280 setText(); 283 setText();
281 } 284 }
282 else 285 else
283 { 286 {
284 if ( m_recMail->Wrapper() != 0l ) 287 if ( m_recMail->Wrapper() != 0l )
285 { // make sure that there is a wrapper , even after delete or simular actions 288 { // make sure that there is a wrapper , even after delete or simular actions
286 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 289 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
287 } 290 }
288 } 291 }
289 break; 292 break;
290 } 293 }
291 delete menu; 294 delete menu;
292} 295}
293 296
294 297
295void ViewMail::setMail(const RecMailP&mail ) 298void ViewMail::setMail(const RecMailP&mail )
296{ 299{
297 300
298 m_recMail = mail; 301 m_recMail = mail;
299 302
300 m_mail[0] = mail->getFrom(); 303 m_mail[0] = mail->getFrom();
301 m_mail[1] = mail->getSubject(); 304 m_mail[1] = mail->getSubject();
302 m_mail[3] = mail->getDate(); 305 m_mail[3] = mail->getDate();
303 m_mail[4] = mail->Msgid(); 306 m_mail[4] = mail->Msgid();
304 307
305 m_mail2[0] = mail->To(); 308 m_mail2[0] = mail->To();
306 m_mail2[1] = mail->CC(); 309 m_mail2[1] = mail->CC();
307 m_mail2[2] = mail->Bcc(); 310 m_mail2[2] = mail->Bcc();
308 311
309 setText(); 312 setText();
310} 313}
311 314
312 315
313 316
314ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 317ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
315 : ViewMailBase(parent, name, fl), _inLoop(false) 318 : ViewMailBase(parent, name, fl), _inLoop(false)
316{ 319{
317 m_gotBody = false; 320 m_gotBody = false;
318 deleted = false; 321 deleted = false;
319 322
320 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 323 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
321 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 324 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
322 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); 325 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
323 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); 326 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
324 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 327 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
325 328
326 attachments->setEnabled(m_gotBody); 329 attachments->setEnabled(m_gotBody);
327 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); 330 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
328 331
329 readConfig(); 332 readConfig();
330 attachments->setSorting(-1); 333 attachments->setSorting(-1);
331} 334}
332 335
333void ViewMail::readConfig() 336void ViewMail::readConfig()
334{ 337{
335 338
336 setFont ( KOPrefs::instance()->mReadFont ); 339 setFont ( KOPrefs::instance()->mReadFont );
337 m_showHtml = KOPrefs::instance()->mViewAsHtml; 340 m_showHtml = KOPrefs::instance()->mViewAsHtml;
338 showHtml->setOn( m_showHtml ); 341 showHtml->setOn( m_showHtml );
339} 342}
340 343
341void ViewMail::setText() 344void ViewMail::setText()
342{ 345{
343 346
344 QString toString; 347 QString toString;
345 QString ccString; 348 QString ccString;
346 QString bccString; 349 QString bccString;
347 350
348 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) 351 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
349 { 352 {
350 toString += (*it); 353 toString += (*it);
351 } 354 }
352 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) 355 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it )
353 { 356 {
354 ccString += (*it); 357 ccString += (*it);
355 } 358 }
356 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) 359 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it )
357 { 360 {
358 bccString += (*it); 361 bccString += (*it);
359 } 362 }
360 363
361 setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); 364 setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) );
362 365
363 m_mailHtml = "<html><body>" 366 m_mailHtml = "<html><body>"
364 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 367 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
365 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 368 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
366 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 369 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
367 "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" 370 "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
368 "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + 371 "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
369 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 372 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
370 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + 373 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] +
371 "</td></tr></table><font>"; 374 "</td></tr></table><font>";
372 375
373 if ( !m_showHtml ) 376 if ( !m_showHtml )
374 { 377 {
375 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); 378 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
376 } 379 }
377 else 380 else
378 { 381 {
379 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); 382 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
380 } 383 }
381 // remove later in favor of a real handling 384 // remove later in favor of a real handling
382 m_gotBody = true; 385 m_gotBody = true;
383} 386}
384 387
385 388
386ViewMail::~ViewMail() 389ViewMail::~ViewMail()
387{ 390{
388 m_recMail->Wrapper()->cleanMimeCache(); 391 m_recMail->Wrapper()->cleanMimeCache();
389 hide(); 392 hide();
390} 393}
391 394
392void ViewMail::hide() 395void ViewMail::hide()
393{ 396{
394 QWidget::hide(); 397 QWidget::hide();
395 398
396 if (_inLoop) 399 if (_inLoop)
397 { 400 {
398 _inLoop = false; 401 _inLoop = false;
399 qApp->exit_loop(); 402 qApp->exit_loop();
400 403
401 } 404 }
402 405
403} 406}
404 407
405void ViewMail::exec() 408void ViewMail::exec()
406{ 409{
407 show(); 410 show();
408 411
409 if (!_inLoop) 412 if (!_inLoop)
410 { 413 {
411 _inLoop = true; 414 _inLoop = true;
412 qApp->enter_loop(); 415 qApp->enter_loop();
413 } 416 }
414 417
415} 418}
416 419
417QString ViewMail::deHtml(const QString &string) 420QString ViewMail::deHtml(const QString &string)
418{ 421{
419 QString string_ = string; 422 QString string_ = string;
420 string_.replace(QRegExp("&"), "&amp;"); 423 string_.replace(QRegExp("&"), "&amp;");
421 string_.replace(QRegExp("<"), "&lt;"); 424 string_.replace(QRegExp("<"), "&lt;");
422 string_.replace(QRegExp(">"), "&gt;"); 425 string_.replace(QRegExp(">"), "&gt;");
423 string_.replace(QRegExp("\\n"), "<br>"); 426 string_.replace(QRegExp("\\n"), "<br>");
424 return string_; 427 return string_;
425} 428}
426 429
427void ViewMail::slotReply() 430void ViewMail::slotReply()
428{ 431{
429 if (!m_gotBody) 432 if (!m_gotBody)
430 { 433 {
431 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); 434 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok"));
432 return; 435 return;
433 } 436 }
434 437
435 QString rtext; 438 QString rtext;
436 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 439 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
437 .arg( m_mail[0] ) 440 .arg( m_mail[0] )
438 .arg( m_mail[3] ); 441 .arg( m_mail[3] );
439 442
440 QString text = m_mail[2]; 443 QString text = m_mail[2];
441 QStringList lines = QStringList::split(QRegExp("\\n"), text); 444 QStringList lines = QStringList::split(QRegExp("\\n"), text);
442 QStringList::Iterator it; 445 QStringList::Iterator it;
443 for (it = lines.begin(); it != lines.end(); it++) 446 for (it = lines.begin(); it != lines.end(); it++)
444 { 447 {
445 rtext += "> " + *it + "\n"; 448 rtext += "> " + *it + "\n";
446 } 449 }
447 rtext += "\n"; 450 rtext += "\n";
448 451
449 QString prefix; 452 QString prefix;
450 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; 453 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = "";
451 else prefix = "Re: "; // no i18n on purpose 454 else prefix = "Re: "; // no i18n on purpose
452 455
453 Settings *settings = new Settings(); 456 Settings *settings = new Settings();
454 ComposeMail composer( settings ,this, 0, true); 457 ComposeMail composer( settings ,this, 0, true);
455 if (m_recMail->Replyto().isEmpty()) { 458 if (m_recMail->Replyto().isEmpty()) {
456 composer.setTo( m_recMail->getFrom()); 459 composer.setTo( m_recMail->getFrom());
457 } else { 460 } else {
458 composer.setTo( m_recMail->Replyto()); 461 composer.setTo( m_recMail->Replyto());
459 } 462 }
460 composer.setSubject( prefix + m_mail[1] ); 463 composer.setSubject( prefix + m_mail[1] );
461 composer.setMessage( rtext ); 464 composer.setMessage( rtext );
462 composer.setInReplyTo(m_recMail->Msgid()); 465 composer.setInReplyTo(m_recMail->Msgid());
463 466
464 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 467 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
465 { 468 {
466 m_recMail->Wrapper()->answeredMail(m_recMail); 469 m_recMail->Wrapper()->answeredMail(m_recMail);
467 } 470 }
468} 471}
469 472
470void ViewMail::slotForward() 473void ViewMail::slotForward()
471{ 474{
472 if (!m_gotBody) 475 if (!m_gotBody)
473 { 476 {
474 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); 477 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok"));
475 return; 478 return;
476 } 479 }
477 480
478 QString ftext; 481 QString ftext;
479 ftext += QString("\n----- Forwarded message from %1 -----\n\n") 482 ftext += QString("\n----- Forwarded message from %1 -----\n\n")
480 .arg( m_mail[0] ); 483 .arg( m_mail[0] );
481 if (!m_mail[3].isNull()) 484 if (!m_mail[3].isNull())
482 ftext += QString("Date: %1\n") 485 ftext += QString("Date: %1\n")
483 .arg( m_mail[3] ); 486 .arg( m_mail[3] );
484 if (!m_mail[0].isNull()) 487 if (!m_mail[0].isNull())
485 ftext += QString("From: %1\n") 488 ftext += QString("From: %1\n")
486 .arg( m_mail[0] ); 489 .arg( m_mail[0] );
487 if (!m_mail[1].isNull()) 490 if (!m_mail[1].isNull())
488 ftext += QString("Subject: %1\n") 491 ftext += QString("Subject: %1\n")
489 .arg( m_mail[1] ); 492 .arg( m_mail[1] );
490 493
491 ftext += QString("\n%1\n") 494 ftext += QString("\n%1\n")
492 .arg( m_mail[2]); 495 .arg( m_mail[2]);
493 496
494 ftext += QString("----- End forwarded message -----\n"); 497 ftext += QString("----- End forwarded message -----\n");
495 498
496 Settings *settings = new Settings(); 499 Settings *settings = new Settings();
497 ComposeMail composer( settings ,this, 0, true); 500 ComposeMail composer( settings ,this, 0, true);
498 composer.setSubject( "Fwd: " + m_mail[1] ); 501 composer.setSubject( "Fwd: " + m_mail[1] );
499 composer.setMessage( ftext ); 502 composer.setMessage( ftext );
500 if ( QDialog::Accepted == KApplication::execDialog( &composer )) 503 if ( QDialog::Accepted == KApplication::execDialog( &composer ))
501 { 504 {
502 } 505 }
503} 506}
504 507
505void ViewMail::slotDeleteMail( ) 508void ViewMail::slotDeleteMail( )
506{ 509{
507 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 510 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
508 { 511 {
509 m_recMail->Wrapper()->deleteMail( m_recMail ); 512 m_recMail->Wrapper()->deleteMail( m_recMail );
510 hide(); 513 hide();
511 deleted = true; 514 deleted = true;
512 } 515 }
513} 516}
514 517
515MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) 518MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f)
516 : KDialog(parent,name,modal) 519 : QDialog(parent,name,modal)
517{ 520{
518 QVBoxLayout*dlglayout = new QVBoxLayout(this); 521 QVBoxLayout*dlglayout = new QVBoxLayout(this);
519 dlglayout->setSpacing(2); 522 dlglayout->setSpacing(2);
520 dlglayout->setMargin(1); 523 dlglayout->setMargin(1);
521 //m_imageview = new Opie::MM::OImageScrollView(this); 524 //m_imageview = new Opie::MM::OImageScrollView(this);
522 //dlglayout->addWidget(m_imageview); 525 //dlglayout->addWidget(m_imageview);
523} 526}
524 527
525MailImageDlg::~MailImageDlg() 528MailImageDlg::~MailImageDlg()
526{ 529{
527} 530}
528 531
529void MailImageDlg::setName(const QString&fname) 532void MailImageDlg::setName(const QString&fname)
530{ 533{
531 qDebug("viewmail.cpp: MailImageDlg::setName Pending"); 534 qDebug("viewmail.cpp: MailImageDlg::setName Pending");
532 // m_imageview->setImage(fname); 535 // m_imageview->setImage(fname);
533} 536}
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h
index c42577e..194ac8e 100644
--- a/kmicromail/viewmail.h
+++ b/kmicromail/viewmail.h
@@ -1,86 +1,86 @@
1#ifndef VIEWMAIL_H 1#ifndef VIEWMAIL_H
2#define VIEWMAIL_H 2#define VIEWMAIL_H
3 3
4#include "viewmailbase.h" 4#include "viewmailbase.h"
5#include <libmailwrapper/mailtypes.h> 5#include <libmailwrapper/mailtypes.h>
6 6
7#include <kdialog.h> 7#include <qdialog.h>
8 8
9#include <qlistview.h> 9#include <qlistview.h>
10#include <qmap.h> 10#include <qmap.h>
11#include <qstringlist.h> 11#include <qstringlist.h>
12#include <qvaluelist.h> 12#include <qvaluelist.h>
13 13
14//namespace Opie { namespace MM { class OImageScrollView; } } 14//namespace Opie { namespace MM { class OImageScrollView; } }
15 15
16class AttachItem : public QListViewItem 16class AttachItem : public QListViewItem
17{ 17{
18public: 18public:
19 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 19 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
20 const QString&fsize,int num,const QValueList<int>&path); 20 const QString&fsize,int num,const QValueList<int>&path);
21 AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 21 AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
22 const QString&fsize,int num,const QValueList<int>&path); 22 const QString&fsize,int num,const QValueList<int>&path);
23 int Partnumber() { return _partNum; } 23 int Partnumber() { return _partNum; }
24 bool isParentof(const QValueList<int>&path); 24 bool isParentof(const QValueList<int>&path);
25 25
26private: 26private:
27 int _partNum; 27 int _partNum;
28 /* needed for a better display of attachments */ 28 /* needed for a better display of attachments */
29 QValueList<int> _path; 29 QValueList<int> _path;
30}; 30};
31 31
32class ViewMail : public ViewMailBase 32class ViewMail : public ViewMailBase
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35 35
36public: 36public:
37 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 37 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
38 ~ViewMail(); 38 ~ViewMail();
39 39
40 void hide(); 40 void hide();
41 void exec(); 41 void exec();
42 void setMail(const RecMailP&mail ); 42 void setMail(const RecMailP&mail );
43 void setBody(const RecBodyP&body); 43 void setBody(const RecBodyP&body);
44 bool deleted; 44 bool deleted;
45 45
46protected: 46protected:
47 QString deHtml(const QString &string); 47 QString deHtml(const QString &string);
48 AttachItem* searchParent(const QValueList<int>&path); 48 AttachItem* searchParent(const QValueList<int>&path);
49 AttachItem* lastChild(AttachItem*parent); 49 AttachItem* lastChild(AttachItem*parent);
50 50
51protected slots: 51protected slots:
52 void slotReply(); 52 void slotReply();
53 void slotForward(); 53 void slotForward();
54 void setText(); 54 void setText();
55 void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); 55 void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
56 void slotDeleteMail( ); 56 void slotDeleteMail( );
57 void slotShowHtml( bool ); 57 void slotShowHtml( bool );
58 58
59private: 59private:
60 void readConfig(); 60 void readConfig();
61 61
62 bool _inLoop; 62 bool _inLoop;
63 QString m_mailHtml; 63 QString m_mailHtml;
64 bool m_gotBody; 64 bool m_gotBody;
65 RecBodyP m_body; 65 RecBodyP m_body;
66 RecMailP m_recMail; 66 RecMailP m_recMail;
67 bool m_showHtml; 67 bool m_showHtml;
68 68
69 // 0 from 1 subject 2 bodytext 3 date 69 // 0 from 1 subject 2 bodytext 3 date
70 QMap <int,QString> m_mail; 70 QMap <int,QString> m_mail;
71 // 0 to 1 cc 2 bcc 71 // 0 to 1 cc 2 bcc
72 QMap <int,QStringList> m_mail2; 72 QMap <int,QStringList> m_mail2;
73}; 73};
74 74
75class MailImageDlg:public KDialog 75class MailImageDlg:public QDialog
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78public: 78public:
79 MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); 79 MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0);
80 ~MailImageDlg(); 80 ~MailImageDlg();
81 void setName(const QString&); 81 void setName(const QString&);
82protected: 82protected:
83 //Opie::MM::OImageScrollView*m_imageview; 83 //Opie::MM::OImageScrollView*m_imageview;
84}; 84};
85 85
86#endif 86#endif