summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2005-08-22 20:51:25 (UTC)
committer zautrix <zautrix>2005-08-22 20:51:25 (UTC)
commitcfda06568cbd0e67ba0188f00622b348b57b27c0 (patch) (unidiff)
tree925a3d4553eae2946cb8c588abae872b78d494f2 /kmicromail
parentcb425b4c2d027d49f964368e94a52d3ba5e6aa31 (diff)
downloadkdepimpi-cfda06568cbd0e67ba0188f00622b348b57b27c0.zip
kdepimpi-cfda06568cbd0e67ba0188f00622b348b57b27c0.tar.gz
kdepimpi-cfda06568cbd0e67ba0188f00622b348b57b27c0.tar.bz2
fixxx
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp5
-rw-r--r--kmicromail/mailistviewitem.cpp3
-rw-r--r--kmicromail/mailistviewitem.h4
-rw-r--r--kmicromail/mainwindow.cpp16
-rw-r--r--kmicromail/mainwindow.h4
5 files changed, 19 insertions, 13 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 7b609fc..4bc4441 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,545 +1,546 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3 3
4#ifdef DESKTOP_VERSION 4#ifdef DESKTOP_VERSION
5#include <qapplication.h> 5#include <qapplication.h>
6#include <kabc/addresseedialog.h> 6#include <kabc/addresseedialog.h>
7#include <kabc/stdaddressbook.h> 7#include <kabc/stdaddressbook.h>
8#include <kabc/addressee.h> 8#include <kabc/addressee.h>
9#else 9#else
10#include <qpe/qpeapplication.h> 10#include <qpe/qpeapplication.h>
11#endif //DESKTOP_VERSION 11#endif //DESKTOP_VERSION
12#include <libkdepim/externalapphandler.h> 12#include <libkdepim/externalapphandler.h>
13 13
14#include "koprefs.h" 14#include "koprefs.h"
15#include <klocale.h> 15#include <klocale.h>
16#include <kglobal.h> 16#include <kglobal.h>
17 17
18#ifdef MINIKDE_KDIALOG_H 18#ifdef MINIKDE_KDIALOG_H
19#undef MINIKDE_KDIALOG_H 19#undef MINIKDE_KDIALOG_H
20#endif 20#endif
21 21
22 22
23#include "composemail.h" 23#include "composemail.h"
24 24
25#include <libmailwrapper/smtpwrapper.h> 25#include <libmailwrapper/smtpwrapper.h>
26#include <libmailwrapper/storemail.h> 26#include <libmailwrapper/storemail.h>
27#include <libmailwrapper/abstractmail.h> 27#include <libmailwrapper/abstractmail.h>
28#include <libmailwrapper/mailtypes.h> 28#include <libmailwrapper/mailtypes.h>
29 29
30/* OPIE */ 30/* OPIE */
31//#include <opie2/ofiledialog.h> 31//#include <opie2/ofiledialog.h>
32//#include <opie2/odebug.h> 32//#include <opie2/odebug.h>
33#include <kfiledialog.h> 33#include <kfiledialog.h>
34//#include <qpe/resource.h> 34//#include <qpe/resource.h>
35#include <qpe/global.h> 35#include <qpe/global.h>
36//#include <qpe/contact.h> 36//#include <qpe/contact.h>
37 37
38 38
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qiconset.h> 41#include <qiconset.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45#include <qmultilineedit.h> 45#include <qmultilineedit.h>
46#include <qlabel.h> 46#include <qlabel.h>
47#include <qtabwidget.h> 47#include <qtabwidget.h>
48#include <qlistview.h> 48#include <qlistview.h>
49 49
50//using namespace Opie::Core; 50//using namespace Opie::Core;
51//using namespace Opie::Ui; 51//using namespace Opie::Ui;
52ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) 52ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal )
53 : ComposeMailUI( parent, name, modal ) 53 : ComposeMailUI( parent, name, modal )
54{ 54{
55 55
56 topLevelWidget()->setCaption( i18n("Compose mail - Click OK to send ->") );
56 mPickLineEdit = 0; 57 mPickLineEdit = 0;
57 mEncoding = KOPrefs::instance()->mCurrentCodeName; 58 mEncoding = KOPrefs::instance()->mCurrentCodeName;
58 //managed from opiemail now 59 //managed from opiemail now
59 //connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 60 //connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
60 // this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 61 // this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
61 settings = sett; 62 settings = sett;
62 m_replyid = ""; 63 m_replyid = "";
63 if ( KOPrefs::instance()->mUseKapi) { 64 if ( KOPrefs::instance()->mUseKapi) {
64 KConfig config( locateLocal("config", "kabcrc") ); 65 KConfig config( locateLocal("config", "kabcrc") );
65 config.setGroup( "General" ); 66 config.setGroup( "General" );
66 QString whoami_uid = config.readEntry( "WhoAmI" ); 67 QString whoami_uid = config.readEntry( "WhoAmI" );
67 68
68 if ( whoami_uid.isEmpty() ) { 69 if ( whoami_uid.isEmpty() ) {
69 QMessageBox::information( 0, i18n( "Hint" ), 70 QMessageBox::information( 0, i18n( "Hint" ),
70 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 71 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
71 i18n( "Ok" ) ); 72 i18n( "Ok" ) );
72 73
73 74
74 fillSettings(); 75 fillSettings();
75 } else 76 } else
76 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); 77 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
77 78
78 79
79#ifdef DESKTOP_VERSION 80#ifdef DESKTOP_VERSION
80 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 81 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
81 QStringList mails = con.emails(); 82 QStringList mails = con.emails();
82 QString defmail = con.preferredEmail(); 83 QString defmail = con.preferredEmail();
83 if ( mails.count() == 0) 84 if ( mails.count() == 0)
84 QMessageBox::information( 0, i18n( "Hint" ), 85 QMessageBox::information( 0, i18n( "Hint" ),
85 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 86 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
86 i18n( "Ok" ) ); 87 i18n( "Ok" ) );
87 if (defmail.length()!=0) { 88 if (defmail.length()!=0) {
88 fromBox->insertItem(defmail); 89 fromBox->insertItem(defmail);
89 } 90 }
90 QStringList::ConstIterator sit = mails.begin(); 91 QStringList::ConstIterator sit = mails.begin();
91 for (;sit!=mails.end();++sit) { 92 for (;sit!=mails.end();++sit) {
92 if ( (*sit)==defmail) 93 if ( (*sit)==defmail)
93 continue; 94 continue;
94 fromBox->insertItem((*sit)); 95 fromBox->insertItem((*sit));
95 } 96 }
96 senderNameEdit->setText(con.formattedName()); 97 senderNameEdit->setText(con.formattedName());
97#endif 98#endif
98 99
99 } else { 100 } else {
100 fillSettings(); 101 fillSettings();
101 } 102 }
102 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); 103 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
103 104
104 attList->addColumn( i18n( "Name" ) ); 105 attList->addColumn( i18n( "Name" ) );
105 attList->addColumn( i18n( "Size" ) ); 106 attList->addColumn( i18n( "Size" ) );
106 QList<Account> accounts = settings->getAccounts(); 107 QList<Account> accounts = settings->getAccounts();
107 108
108 if ( QApplication::desktop()->width() < 320 ) 109 if ( QApplication::desktop()->width() < 320 )
109 smtpAccountBox->setMaximumWidth( 80 ); 110 smtpAccountBox->setMaximumWidth( 80 );
110 Account *it; 111 Account *it;
111 for ( it = accounts.first(); it; it = accounts.next() ) { 112 for ( it = accounts.first(); it; it = accounts.next() ) {
112 if ( it->getType()==MAILLIB::A_SMTP ) { 113 if ( it->getType()==MAILLIB::A_SMTP ) {
113 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 114 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
114 smtpAccountBox->insertItem( smtp->getAccountName() ); 115 smtpAccountBox->insertItem( smtp->getAccountName() );
115 smtpAccounts.append( smtp ); 116 smtpAccounts.append( smtp );
116 } 117 }
117 } 118 }
118 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 119 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
119 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 120 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
120 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 121 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
121 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 122 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
122 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 123 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
123 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 124 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
124 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 125 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
125 mMail = 0; 126 mMail = 0;
126 warnAttach = true; 127 warnAttach = true;
127 QIconSet icon; 128 QIconSet icon;
128 //icon = SmallIcon("fileexport"); 129 //icon = SmallIcon("fileexport");
129 icon = SmallIcon("filesave"); 130 icon = SmallIcon("filesave");
130 SaveButton->setIconSet (icon ) ; 131 SaveButton->setIconSet (icon ) ;
131 if ( QApplication::desktop()->width() < 320 ) { 132 if ( QApplication::desktop()->width() < 320 ) {
132 SaveButton->setText ("") ; 133 SaveButton->setText ("") ;
133 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; 134 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ;
134 } 135 }
135 else 136 else
136 SaveButton->setText (i18n("Save")); 137 SaveButton->setText (i18n("Save"));
137#ifndef DESKTOP_VERSION 138#ifndef DESKTOP_VERSION
138 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); 139 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold );
139 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); 140 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold );
140 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); 141 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold );
141#endif 142#endif
142 message->setFont ( KOPrefs::instance()->mComposeFont ); 143 message->setFont ( KOPrefs::instance()->mComposeFont );
143 message->setWordWrap (QMultiLineEdit::WidgetWidth); 144 message->setWordWrap (QMultiLineEdit::WidgetWidth);
144 if ( smtpAccounts.count() > 0 ) { 145 if ( smtpAccounts.count() > 0 ) {
145 fillValues( smtpAccountBox->currentItem() ); 146 fillValues( smtpAccountBox->currentItem() );
146 } else { 147 } else {
147 QMessageBox::information( 0, i18n( "Problem" ), 148 QMessageBox::information( 0, i18n( "Problem" ),
148 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), 149 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ),
149 i18n( "Ok" ) ); 150 i18n( "Ok" ) );
150 return; 151 return;
151 } 152 }
152 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 153 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
153 connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) ); 154 connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) );
154 if ( smtpAccountBox->count()) 155 if ( smtpAccountBox->count())
155 fillValues(0); 156 fillValues(0);
156#ifdef DESKTOP_VERSION 157#ifdef DESKTOP_VERSION
157 if ( QApplication::desktop()->width() <= 800 ) { 158 if ( QApplication::desktop()->width() <= 800 ) {
158 resize( QApplication::desktop()->size() ); 159 resize( QApplication::desktop()->size() );
159 } else 160 } else
160 resize( 800, 600 ); 161 resize( 800, 600 );
161 if ( QApplication::desktop()->width() >= 640 ) 162 if ( QApplication::desktop()->width() >= 640 )
162 senderNameEdit->setFixedWidth( 200 ); 163 senderNameEdit->setFixedWidth( 200 );
163#endif 164#endif
164} 165}
165 166
166void ComposeMail::fillSettings() 167void ComposeMail::fillSettings()
167{ 168{
168 if ( QApplication::desktop()->width() < 320 ) 169 if ( QApplication::desktop()->width() < 320 )
169 fromBox->setMaximumWidth( 100 ); 170 fromBox->setMaximumWidth( 100 );
170 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); 171 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
171 QStringList::ConstIterator sit = mailList.begin(); 172 QStringList::ConstIterator sit = mailList.begin();
172 int pref = 0; 173 int pref = 0;
173 for (;sit!=mailList.end();++sit) { 174 for (;sit!=mailList.end();++sit) {
174 fromBox->insertItem((*sit)); 175 fromBox->insertItem((*sit));
175 } 176 }
176 senderNameEdit->setText(KOPrefs::instance()->mName); 177 senderNameEdit->setText(KOPrefs::instance()->mName);
177} 178}
178void ComposeMail::saveSig() 179void ComposeMail::saveSig()
179{ 180{
180 if ( smtpAccountBox->count()) { 181 if ( smtpAccountBox->count()) {
181 int cur = smtpAccountBox->currentItem (); 182 int cur = smtpAccountBox->currentItem ();
182 SMTPaccount *smtp = smtpAccounts.at( cur ); 183 SMTPaccount *smtp = smtpAccounts.at( cur );
183 if ( smtp ) 184 if ( smtp )
184 smtp->setSignature( sigMultiLine->text()); 185 smtp->setSignature( sigMultiLine->text());
185 } 186 }
186} 187}
187void ComposeMail::saveAsDraft() 188void ComposeMail::saveAsDraft()
188{ 189{
189 190
190 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 191 Opie::Core::OSmartPointer<Mail> mail= new Mail();
191 mail->setMail(fromBox->currentText()); 192 mail->setMail(fromBox->currentText());
192 mail->setTo( toLine->text() ); 193 mail->setTo( toLine->text() );
193 mail->setName(senderNameEdit->text()); 194 mail->setName(senderNameEdit->text());
194 mail->setCC( ccLine->text() ); 195 mail->setCC( ccLine->text() );
195 mail->setBCC( bccLine->text() ); 196 mail->setBCC( bccLine->text() );
196 mail->setReply( replyLine->text() ); 197 mail->setReply( replyLine->text() );
197 mail->setSubject( subjectLine->text() ); 198 mail->setSubject( subjectLine->text() );
198 if (!m_replyid.isEmpty()) { 199 if (!m_replyid.isEmpty()) {
199 QStringList ids; 200 QStringList ids;
200 ids.append(m_replyid); 201 ids.append(m_replyid);
201 mail->setInreply(ids); 202 mail->setInreply(ids);
202 } 203 }
203 QString txt = message->text(); 204 QString txt = message->text();
204 if ( !sigMultiLine->text().isEmpty() ) { 205 if ( !sigMultiLine->text().isEmpty() ) {
205 txt.append( "\n--\n" ); 206 txt.append( "\n--\n" );
206 txt.append( sigMultiLine->text() ); 207 txt.append( sigMultiLine->text() );
207 } 208 }
208 mail->setMessage( txt ); 209 mail->setMessage( txt );
209 mail->setCharset (mEncoding); 210 mail->setCharset (mEncoding);
210 /* only use the default drafts folder name! */ 211 /* only use the default drafts folder name! */
211 Storemail wrapper(AbstractMail::draftFolder()); 212 Storemail wrapper(AbstractMail::draftFolder());
212 wrapper.storeMail(mail); 213 wrapper.storeMail(mail);
213 214
214 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 215 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
215 /* attachments we will ignore! */ 216 /* attachments we will ignore! */
216 if ( it != 0 ) { 217 if ( it != 0 ) {
217 if ( warnAttach ) 218 if ( warnAttach )
218 QMessageBox::warning(0,i18n("Store message"), 219 QMessageBox::warning(0,i18n("Store message"),
219 i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); 220 i18n("<center>Attachments will not be stored in \"Draft\" folder</center>"));
220 warnAttach = false; 221 warnAttach = false;
221 } 222 }
222 setStatus( i18n("Mail saved as draft!") ); 223 setStatus( i18n("Mail saved as draft!") );
223} 224}
224void ComposeMail::clearStatus() 225void ComposeMail::clearStatus()
225{ 226{
226 topLevelWidget()->setCaption( i18n("Compose mail") ); 227 topLevelWidget()->setCaption( i18n("Compose mail - Click OK to send ->") );
227} 228}
228void ComposeMail::setStatus( QString status ) 229void ComposeMail::setStatus( QString status )
229{ 230{
230 topLevelWidget()->setCaption( status ); 231 topLevelWidget()->setCaption( status );
231 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; 232 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
232} 233}
233void ComposeMail::pickAddress( ) 234void ComposeMail::pickAddress( )
234{ 235{
235 236
236 QLineEdit *line = mPickLineEdit; 237 QLineEdit *line = mPickLineEdit;
237 if ( line == 0 ) 238 if ( line == 0 )
238 return; 239 return;
239#ifdef DESKTOP_VERSION 240#ifdef DESKTOP_VERSION
240 //qDebug(" ComposeMail::pickAddress "); 241 //qDebug(" ComposeMail::pickAddress ");
241 QString names ;//= AddressPicker::getNames(); 242 QString names ;//= AddressPicker::getNames();
242 243
243 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 244 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
244 uint i=0; 245 uint i=0;
245 for (i=0; i < list.count(); i++) { 246 for (i=0; i < list.count(); i++) {
246 if ( !list[i].preferredEmail().isEmpty()) { 247 if ( !list[i].preferredEmail().isEmpty()) {
247 if ( ! names.isEmpty() ) 248 if ( ! names.isEmpty() )
248 names+= ","; 249 names+= ",";
249 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 250 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
250 251
251 } 252 }
252 } 253 }
253 254
254 255
255 if ( line->text().isEmpty() ) { 256 if ( line->text().isEmpty() ) {
256 line->setText( names ); 257 line->setText( names );
257 } else if ( !names.isEmpty() ) { 258 } else if ( !names.isEmpty() ) {
258 line->setText( line->text() + ", " + names ); 259 line->setText( line->text() + ", " + names );
259 } 260 }
260#else 261#else
261 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); 262 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
262 // the result should now arrive through method insertAttendees 263 // the result should now arrive through method insertAttendees
263#endif 264#endif
264} 265}
265//the map includes name/email pairs, that comes from Ka/Pi 266//the map includes name/email pairs, that comes from Ka/Pi
266void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 267void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
267{ 268{
268 //qDebug("ComposeMail::insertAttendees "); 269 //qDebug("ComposeMail::insertAttendees ");
269 raise(); 270 raise();
270 271
271 QString UID = uid; 272 QString UID = uid;
272 if ( uid.left( 18 ) == (this->name() +QString("pick2")) ) { 273 if ( uid.left( 18 ) == (this->name() +QString("pick2")) ) {
273 mPickLineEdit = toLine; 274 mPickLineEdit = toLine;
274 UID = this->name(); 275 UID = this->name();
275 subjectLine->setText( uid.mid( 18 ) ); 276 subjectLine->setText( uid.mid( 18 ) );
276 } 277 }
277 //qDebug("ccc %s %s ", uid.latin1(), this->name()); 278 //qDebug("ccc %s %s ", uid.latin1(), this->name());
278 if ( mPickLineEdit == 0 ) { //whoami received 279 if ( mPickLineEdit == 0 ) { //whoami received
279 QString defmail = uidList[0]; 280 QString defmail = uidList[0];
280 if ( emailList.count() == 0 ) 281 if ( emailList.count() == 0 )
281 QMessageBox::information( 0, i18n( "Hint" ), 282 QMessageBox::information( 0, i18n( "Hint" ),
282 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 283 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
283 i18n( "Ok" ) ); 284 i18n( "Ok" ) );
284 if (defmail.length()!=0) { 285 if (defmail.length()!=0) {
285 fromBox->insertItem(defmail); 286 fromBox->insertItem(defmail);
286 } 287 }
287 QStringList::ConstIterator sit = emailList.begin(); 288 QStringList::ConstIterator sit = emailList.begin();
288 int pref = 0; 289 int pref = 0;
289 for (;sit!=emailList.end();++sit) { 290 for (;sit!=emailList.end();++sit) {
290 if ( (*sit)==defmail) 291 if ( (*sit)==defmail)
291 continue; 292 continue;
292 fromBox->insertItem((*sit)); 293 fromBox->insertItem((*sit));
293 } 294 }
294 senderNameEdit->setText(nameList[0]); 295 senderNameEdit->setText(nameList[0]);
295 return; 296 return;
296 } 297 }
297 QString names ; 298 QString names ;
298 QLineEdit *line = mPickLineEdit; 299 QLineEdit *line = mPickLineEdit;
299 if (UID == this->name()) 300 if (UID == this->name())
300 { 301 {
301 for ( int i = 0; i < nameList.count(); i++) 302 for ( int i = 0; i < nameList.count(); i++)
302 { 303 {
303 QString _name = nameList[i]; 304 QString _name = nameList[i];
304 QString _email = emailList[i]; 305 QString _email = emailList[i];
305 QString _uid = uidList[i]; 306 QString _uid = uidList[i];
306 if ( ! _email.isEmpty() ) { 307 if ( ! _email.isEmpty() ) {
307 if ( ! names.isEmpty() ) 308 if ( ! names.isEmpty() )
308 names+= ","; 309 names+= ",";
309 names+= "\""+_name +"\"<" +_email +">"; 310 names+= "\""+_name +"\"<" +_email +">";
310 } 311 }
311 } 312 }
312 } 313 }
313 if ( line->text().isEmpty() ) { 314 if ( line->text().isEmpty() ) {
314 line->setText( names ); 315 line->setText( names );
315 } else if ( !names.isEmpty() ) { 316 } else if ( !names.isEmpty() ) {
316 line->setText( line->text() + ", " + names ); 317 line->setText( line->text() + ", " + names );
317 } 318 }
318} 319}
319 320
320void ComposeMail::setTo( const QString & to ) 321void ComposeMail::setTo( const QString & to )
321{ 322{
322 toLine->setText( to ); 323 toLine->setText( to );
323} 324}
324 325
325void ComposeMail::setSubject( const QString & subject ) 326void ComposeMail::setSubject( const QString & subject )
326{ 327{
327 subjectLine->setText( subject ); 328 subjectLine->setText( subject );
328} 329}
329 330
330void ComposeMail::setInReplyTo( const QString & messageId ) 331void ComposeMail::setInReplyTo( const QString & messageId )
331{ 332{
332 m_replyid = messageId; 333 m_replyid = messageId;
333} 334}
334 335
335void ComposeMail::setMessage( const QString & text ) 336void ComposeMail::setMessage( const QString & text )
336{ 337{
337 message->setText( text ); 338 message->setText( text );
338} 339}
339 340
340 341
341void ComposeMail::pickAddressTo() 342void ComposeMail::pickAddressTo()
342{ 343{
343 mPickLineEdit = toLine; 344 mPickLineEdit = toLine;
344 pickAddress( ); 345 pickAddress( );
345} 346}
346 347
347void ComposeMail::pickAddressCC() 348void ComposeMail::pickAddressCC()
348{ 349{
349 mPickLineEdit = ccLine; 350 mPickLineEdit = ccLine;
350 pickAddress( ); 351 pickAddress( );
351} 352}
352 353
353void ComposeMail::pickAddressBCC() 354void ComposeMail::pickAddressBCC()
354{ 355{
355 mPickLineEdit = bccLine; 356 mPickLineEdit = bccLine;
356 pickAddress( ); 357 pickAddress( );
357} 358}
358 359
359void ComposeMail::pickAddressReply() 360void ComposeMail::pickAddressReply()
360{ 361{
361 mPickLineEdit = replyLine; 362 mPickLineEdit = replyLine;
362 pickAddress( ); 363 pickAddress( );
363} 364}
364 365
365void ComposeMail::fillValues( int current ) 366void ComposeMail::fillValues( int current )
366{ 367{
367#if 0 368#if 0
368 SMTPaccount *smtp = smtpAccounts.at( current ); 369 SMTPaccount *smtp = smtpAccounts.at( current );
369 ccLine->clear(); 370 ccLine->clear();
370 if ( smtp->getUseCC() ) { 371 if ( smtp->getUseCC() ) {
371 ccLine->setText( smtp->getCC() ); 372 ccLine->setText( smtp->getCC() );
372 } 373 }
373 bccLine->clear(); 374 bccLine->clear();
374 if ( smtp->getUseBCC() ) { 375 if ( smtp->getUseBCC() ) {
375 bccLine->setText( smtp->getBCC() ); 376 bccLine->setText( smtp->getBCC() );
376 } 377 }
377 replyLine->clear(); 378 replyLine->clear();
378 if ( smtp->getUseReply() ) { 379 if ( smtp->getUseReply() ) {
379 replyLine->setText( smtp->getReply() ); 380 replyLine->setText( smtp->getReply() );
380 } 381 }
381#endif 382#endif
382 SMTPaccount *smtp = smtpAccounts.at( current ); 383 SMTPaccount *smtp = smtpAccounts.at( current );
383 if ( smtp ) 384 if ( smtp )
384 sigMultiLine->setText( smtp->getSignature() ); 385 sigMultiLine->setText( smtp->getSignature() );
385} 386}
386 387
387void ComposeMail::slotAdjustColumns() 388void ComposeMail::slotAdjustColumns()
388{ 389{
389 int currPage = tabWidget->currentPageIndex(); 390 int currPage = tabWidget->currentPageIndex();
390 391
391 tabWidget->showPage( attachTab ); 392 tabWidget->showPage( attachTab );
392 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 393 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
393 attList->setColumnWidth( 1, 80 ); 394 attList->setColumnWidth( 1, 80 );
394 395
395 tabWidget->setCurrentPage( currPage ); 396 tabWidget->setCurrentPage( currPage );
396} 397}
397 398
398void ComposeMail::addAttachment() 399void ComposeMail::addAttachment()
399{ 400{
400 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); 401 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this );
401 if ( !lnk.isEmpty() ) { 402 if ( !lnk.isEmpty() ) {
402 Attachment *att = new Attachment( lnk ); 403 Attachment *att = new Attachment( lnk );
403 (void) new AttachViewItem( attList, att ); 404 (void) new AttachViewItem( attList, att );
404 } 405 }
405} 406}
406 407
407void ComposeMail::removeAttachment() 408void ComposeMail::removeAttachment()
408{ 409{
409 if ( !attList->currentItem() ) { 410 if ( !attList->currentItem() ) {
410 QMessageBox::information( this, i18n( "Error" ), 411 QMessageBox::information( this, i18n( "Error" ),
411 i18n( "<p>Please select a File.</p>" ), 412 i18n( "<p>Please select a File.</p>" ),
412 i18n( "Ok" ) ); 413 i18n( "Ok" ) );
413 } else { 414 } else {
414 attList->takeItem( attList->currentItem() ); 415 attList->takeItem( attList->currentItem() );
415 } 416 }
416} 417}
417 418
418void ComposeMail::accept() 419void ComposeMail::accept()
419{ 420{
420 if ( smtpAccountBox->count() == 0 ) { 421 if ( smtpAccountBox->count() == 0 ) {
421 422
422 reject(); 423 reject();
423 return; 424 return;
424 } 425 }
425 426
426 if (! checkBoxLater->isChecked() ) { 427 if (! checkBoxLater->isChecked() ) {
427 int yesno = QMessageBox::warning(0,i18n("Stop editing message"), 428 int yesno = QMessageBox::warning(0, subjectLine->text().left ( 25 ),
428 i18n("Send this message?"), 429 i18n("Send this message?"),
429 i18n("Yes"), 430 i18n("Yes"),
430 i18n("Cancel")); 431 i18n("Cancel"));
431 432
432 if (yesno == 1) { 433 if (yesno == 1) {
433 return; 434 return;
434 } 435 }
435 } 436 }
436#if 0 437#if 0
437 odebug << "Sending Mail with " 438 odebug << "Sending Mail with "
438 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; 439 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl;
439#endif 440#endif
440 Opie::Core::OSmartPointer<Mail> mail=new Mail; 441 Opie::Core::OSmartPointer<Mail> mail=new Mail;
441 442
442 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 443 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
443 mail->setMail(fromBox->currentText()); 444 mail->setMail(fromBox->currentText());
444 445
445 if ( !toLine->text().isEmpty() ) { 446 if ( !toLine->text().isEmpty() ) {
446 mail->setTo( toLine->text() ); 447 mail->setTo( toLine->text() );
447 } else { 448 } else {
448 QMessageBox::warning(0,i18n("Sending mail"), 449 QMessageBox::warning(0,i18n("Sending mail"),
449 i18n("No Receiver spezified" ) ); 450 i18n("No Receiver spezified" ) );
450 return; 451 return;
451 } 452 }
452 453
453 mail->setName(senderNameEdit->text()); 454 mail->setName(senderNameEdit->text());
454 mail->setCC( ccLine->text() ); 455 mail->setCC( ccLine->text() );
455 mail->setBCC( bccLine->text() ); 456 mail->setBCC( bccLine->text() );
456 mail->setReply( replyLine->text() ); 457 mail->setReply( replyLine->text() );
457 mail->setSubject( subjectLine->text() ); 458 mail->setSubject( subjectLine->text() );
458 if (!m_replyid.isEmpty()) { 459 if (!m_replyid.isEmpty()) {
459 QStringList ids; 460 QStringList ids;
460 ids.append(m_replyid); 461 ids.append(m_replyid);
461 mail->setInreply(ids); 462 mail->setInreply(ids);
462 } 463 }
463 QString txt = message->text(); 464 QString txt = message->text();
464 if ( !sigMultiLine->text().isEmpty() ) { 465 if ( !sigMultiLine->text().isEmpty() ) {
465 txt.append( "\n--\n" ); 466 txt.append( "\n--\n" );
466 txt.append( sigMultiLine->text() ); 467 txt.append( sigMultiLine->text() );
467 } 468 }
468 mail->setMessage( txt ); 469 mail->setMessage( txt );
469 mail->setCharset (mEncoding); 470 mail->setCharset (mEncoding);
470 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 471 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
471 while ( it != 0 ) { 472 while ( it != 0 ) {
472 mail->addAttachment( it->getAttachment() ); 473 mail->addAttachment( it->getAttachment() );
473 it = (AttachViewItem *) it->nextSibling(); 474 it = (AttachViewItem *) it->nextSibling();
474 } 475 }
475 476
476 SMTPwrapper wrapper( smtp ); 477 SMTPwrapper wrapper( smtp );
477 if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) 478 if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) )
478 setStatus( tr ("Mail sent")); 479 setStatus( tr ("Mail sent"));
479 else { 480 else {
480 setStatus( tr ("Error: Something went wrong. Nothing sent")); 481 setStatus( tr ("Error: Something went wrong. Nothing sent"));
481 return; 482 return;
482 } 483 }
483 484
484 485
485 QDialog::accept(); 486 QDialog::accept();
486} 487}
487 488
488void ComposeMail::reject() 489void ComposeMail::reject()
489{ 490{
490 //qDebug("ComposeMail::reject() "); 491 //qDebug("ComposeMail::reject() ");
491 int yesno = QMessageBox::warning(0,i18n("Store message?"), 492 int yesno = QMessageBox::warning(0,i18n("Store message?"),
492 i18n("Store message into drafts?\n"), 493 i18n("Store message into drafts?\n"),
493 i18n("Yes"), 494 i18n("Yes"),
494 i18n("No")); 495 i18n("No"));
495 496
496 //qDebug("button %d ", yesno); 497 //qDebug("button %d ", yesno);
497 if (yesno == 0) { 498 if (yesno == 0) {
498 if ( toLine->text().isEmpty() ) { 499 if ( toLine->text().isEmpty() ) {
499 QMessageBox::warning(0,i18n("Sending mail"), 500 QMessageBox::warning(0,i18n("Sending mail"),
500 i18n("No Receiver spezified" ) ); 501 i18n("No Receiver spezified" ) );
501 return; 502 return;
502 } 503 }
503 saveAsDraft(); 504 saveAsDraft();
504 } 505 }
505 if (yesno == 2) { 506 if (yesno == 2) {
506 qDebug("return "); 507 qDebug("return ");
507 return; 508 return;
508 } 509 }
509 QDialog::reject(); 510 QDialog::reject();
510} 511}
511 512
512void ComposeMail::setCharset(const QString& charset) 513void ComposeMail::setCharset(const QString& charset)
513{ 514{
514 if ( !charset.isEmpty() ) 515 if ( !charset.isEmpty() )
515 mEncoding = charset; 516 mEncoding = charset;
516 qDebug("ComposeMail::setCharset %s ", mEncoding.latin1()); 517 qDebug("ComposeMail::setCharset %s ", mEncoding.latin1());
517} 518}
518ComposeMail::~ComposeMail() 519ComposeMail::~ComposeMail()
519{ 520{
520} 521}
521 522
522void ComposeMail::reEditMail(const RecMailP&current) 523void ComposeMail::reEditMail(const RecMailP&current)
523{ 524{
524 RecMailP data = current; 525 RecMailP data = current;
525 RecBodyP body = data->Wrapper()->fetchBody(current); 526 RecBodyP body = data->Wrapper()->fetchBody(current);
526 527
527 message->setText(body->Bodytext()); 528 message->setText(body->Bodytext());
528 subjectLine->setText( data->getSubject()); 529 subjectLine->setText( data->getSubject());
529 toLine->setText(data->To().join(",")); 530 toLine->setText(data->To().join(","));
530 ccLine->setText(data->CC().join(",")); 531 ccLine->setText(data->CC().join(","));
531 bccLine->setText(data->Bcc().join(",")); 532 bccLine->setText(data->Bcc().join(","));
532 replyLine->setText(data->Replyto()); 533 replyLine->setText(data->Replyto());
533 setCharset(body->getCharset()); 534 setCharset(body->getCharset());
534} 535}
535 536
536AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 537AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
537 : QListViewItem( parent ) 538 : QListViewItem( parent )
538{ 539{
539 attachment = att; 540 attachment = att;
540 if ( !attachment->getPixmap().isNull() ) 541 if ( !attachment->getPixmap().isNull() )
541 setPixmap( 0,attachment->getPixmap() ); 542 setPixmap( 0,attachment->getPixmap() );
542 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 543 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
543 setText( 1, QString::number( att->getSize() ) ); 544 setText( 1, QString::number( att->getSize() ) );
544} 545}
545 546
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index 5119744..15fa148 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -1,98 +1,99 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#include "mailistviewitem.h" 2#include "mailistviewitem.h"
3#include <libmailwrapper/abstractmail.h> 3#include <libmailwrapper/abstractmail.h>
4#include <qtextstream.h> 4#include <qtextstream.h>
5#include <kiconloader.h> 5#include <kiconloader.h>
6#include "koprefs.h" 6#include "koprefs.h"
7//#include <qpe/resource.h> 7//#include <qpe/resource.h>
8 8
9MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 9MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
10 :QListViewItem(parent,item),mail_data() 10 :KListViewItem(parent,item),mail_data()
11{ 11{
12} 12}
13 13
14void MailListViewItem::showEntry() 14void MailListViewItem::showEntry()
15{ 15{
16 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { 16 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
17 setPixmap( 0, SmallIcon ( "kmmsgreplied") ); 17 setPixmap( 0, SmallIcon ( "kmmsgreplied") );
18 mKeyMap.insert(0, "r" ); 18 mKeyMap.insert(0, "r" );
19 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { 19 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
20 /* I think it looks nicer if there are not such a log of icons but only on mails 20 /* I think it looks nicer if there are not such a log of icons but only on mails
21 replied or new - Alwin*/ 21 replied or new - Alwin*/
22 //setPixmap( 0,SmallIcon ("kmmsgunseen") ); 22 //setPixmap( 0,SmallIcon ("kmmsgunseen") );
23 mKeyMap.insert(0, "s" ); 23 mKeyMap.insert(0, "s" );
24 } else { 24 } else {
25 setPixmap( 0,SmallIcon ( "kmmsgnew") ); 25 setPixmap( 0,SmallIcon ( "kmmsgnew") );
26 mKeyMap.insert(0, "u" ); 26 mKeyMap.insert(0, "u" );
27 } 27 }
28 QString fsize = mail_data->MsgsizeString(); 28 QString fsize = mail_data->MsgsizeString();
29 // 1.23 29 // 1.23
30 // 11.23 30 // 11.23
31 // 111.23 31 // 111.23
32 // 999.23 maxlen 32 // 999.23 maxlen
33 QString fsort; 33 QString fsort;
34 switch(fsize.length() ) { 34 switch(fsize.length() ) {
35 case 6: 35 case 6:
36 fsort = "00" + fsize ; 36 fsort = "00" + fsize ;
37 break; 37 break;
38 case 7: 38 case 7:
39 fsort = "0" + fsize ; 39 fsort = "0" + fsize ;
40 break; 40 break;
41 default: 41 default:
42 fsort = fsize ; 42 fsort = fsize ;
43 break; 43 break;
44 44
45 } 45 }
46
46 setText(3, fsize ); 47 setText(3, fsize );
47 //qDebug("fsize *%s* ",fsize.latin1() ); 48 //qDebug("fsize *%s* ",fsize.latin1() );
48 //qDebug("fsort *%s* ",fsort.latin1() ); 49 //qDebug("fsort *%s* ",fsort.latin1() );
49 if ( fsize.right(2) == "kB" ) { 50 if ( fsize.right(2) == "kB" ) {
50 mKeyMap.insert(3, "k" + fsort); 51 mKeyMap.insert(3, "k" + fsort);
51 } else { 52 } else {
52 mKeyMap.insert(3, "M" +fsort ); 53 mKeyMap.insert(3, "M" +fsort );
53 } 54 }
54 setText(1,mail_data->getSubject()); 55 setText(1,mail_data->getSubject());
55 setText(2,mail_data->getFrom()); 56 setText(2,mail_data->getFrom());
56 mKeyMap.insert(4,mail_data->getIsoDate()); 57 mKeyMap.insert(4,mail_data->getIsoDate());
57 setText(4,mail_data->getDate()); 58 setText(4,mail_data->getDate());
58 if ( KOPrefs::instance()->mShowToField ) 59 if ( KOPrefs::instance()->mShowToField )
59 setText(5,mail_data->To()[0]); 60 setText(5,mail_data->To()[0]);
60} 61}
61 62
62void MailListViewItem::storeData(const RecMailP&data) 63void MailListViewItem::storeData(const RecMailP&data)
63{ 64{
64 mail_data = data; 65 mail_data = data;
65} 66}
66void MailListViewItem::setSortKey(int column,const QString &key) 67void MailListViewItem::setSortKey(int column,const QString &key)
67{ 68{
68 mKeyMap.insert(column,key); 69 mKeyMap.insert(column,key);
69} 70}
70QString MailListViewItem::key(int column, bool) const 71QString MailListViewItem::key(int column, bool) const
71{ 72{
72 // to make is fast, we use here special cases 73 // to make is fast, we use here special cases
73 if ( column == 3 || column == 4 || column == 0) { 74 if ( column == 3 || column == 4 || column == 0) {
74 return *mKeyMap.find(column); 75 return *mKeyMap.find(column);
75 } 76 }
76 if ( column == 1 ) { 77 if ( column == 1 ) {
77 if ( text(1).left(4).lower() == "re: " ) 78 if ( text(1).left(4).lower() == "re: " )
78 return text(1).mid(4); 79 return text(1).mid(4);
79 80
80 } 81 }
81 return text(column); 82 return text(column);
82 /* 83 /*
83 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 84 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
84 if (it == mKeyMap.end()) return text(column); 85 if (it == mKeyMap.end()) return text(column);
85 else return *it; 86 else return *it;
86 */ 87 */
87} 88}
88 89
89const RecMailP& MailListViewItem::data()const 90const RecMailP& MailListViewItem::data()const
90{ 91{
91 return mail_data; 92 return mail_data;
92} 93}
93 94
94MAILLIB::ATYPE MailListViewItem::wrapperType() 95MAILLIB::ATYPE MailListViewItem::wrapperType()
95{ 96{
96 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; 97 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
97 return mail_data->Wrapper()->getType(); 98 return mail_data->Wrapper()->getType();
98} 99}
diff --git a/kmicromail/mailistviewitem.h b/kmicromail/mailistviewitem.h
index 0fd44d3..b409c9d 100644
--- a/kmicromail/mailistviewitem.h
+++ b/kmicromail/mailistviewitem.h
@@ -1,27 +1,27 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#ifndef __MAILLISTVIEWITEM_H 2#ifndef __MAILLISTVIEWITEM_H
3#define __MAILLISTVIEWITEM_H 3#define __MAILLISTVIEWITEM_H
4 4
5#include <qlistview.h> 5#include <klistview.h>
6#include <libmailwrapper/mailtypes.h> 6#include <libmailwrapper/mailtypes.h>
7#include <libmailwrapper/maildefines.h> 7#include <libmailwrapper/maildefines.h>
8 8
9class MailListViewItem:public QListViewItem 9class MailListViewItem:public KListViewItem
10{ 10{
11public: 11public:
12 MailListViewItem(QListView * parent, MailListViewItem * after ); 12 MailListViewItem(QListView * parent, MailListViewItem * after );
13 virtual ~MailListViewItem(){} 13 virtual ~MailListViewItem(){}
14 14
15 void storeData(const RecMailP&data); 15 void storeData(const RecMailP&data);
16 const RecMailP&data()const; 16 const RecMailP&data()const;
17 void showEntry(); 17 void showEntry();
18 MAILLIB::ATYPE wrapperType(); 18 MAILLIB::ATYPE wrapperType();
19 QString key(int column, bool) const; 19 QString key(int column, bool) const;
20 void setSortKey(int column,const QString &key); 20 void setSortKey(int column,const QString &key);
21protected: 21protected:
22 RecMailP mail_data; 22 RecMailP mail_data;
23 private: 23 private:
24 QMap<int,QString> mKeyMap; 24 QMap<int,QString> mKeyMap;
25}; 25};
26 26
27#endif 27#endif
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index e3c5ec3..82a915e 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,429 +1,433 @@
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#include <qstatusbar.h> 14#include <qstatusbar.h>
15#include <kabc/stdaddressbook.h> 15#include <kabc/stdaddressbook.h>
16extern QStatusBar* globalSstatusBarMainWindow; 16extern QStatusBar* globalSstatusBarMainWindow;
17#else 17#else
18#include <qpe/qpeapplication.h> 18#include <qpe/qpeapplication.h>
19#include <klocale.h> 19#include <klocale.h>
20#endif 20#endif
21#include "defines.h" 21#include "defines.h"
22#include "koprefs.h" 22#include "koprefs.h"
23#include "mainwindow.h" 23#include "mainwindow.h"
24#include "mailistviewitem.h" 24#include "mailistviewitem.h"
25#include <KDGanttMinimizeSplitter.h> 25#include <KDGanttMinimizeSplitter.h>
26#include <libkdepim/kpimglobalprefs.h>
26 27
27#include "koprefs.h" 28#include "koprefs.h"
28 29
29MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 30MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
30 : QMainWindow( parent, name ) //, flags ) 31 : QMainWindow( parent, name ) //, flags )
31{ 32{
32#ifdef DESKTOP_VERSION 33#ifdef DESKTOP_VERSION
33 globalSstatusBarMainWindow = statusBar(); 34 globalSstatusBarMainWindow = statusBar();
34#endif 35#endif
35 setCaption( i18n( "KOpieMail/Pi" ) ); 36 setCaption( i18n( "KOpieMail/Pi" ) );
36 setToolBarsMovable( false ); 37 setToolBarsMovable( false );
37 //KABC::StdAddressBook::self(); 38 //KABC::StdAddressBook::self();
38 toolBar = new QToolBar( this ); 39 toolBar = new QToolBar( this );
39 menuBar = new QPEMenuBar( toolBar ); 40 menuBar = new QPEMenuBar( toolBar );
40 mailMenu = new QPopupMenu( menuBar ); 41 mailMenu = new QPopupMenu( menuBar );
41 menuBar->insertItem( i18n( "Mail" ), mailMenu ); 42 menuBar->insertItem( i18n( "Mail" ), mailMenu );
42 settingsMenu = new QPopupMenu( menuBar ); 43 settingsMenu = new QPopupMenu( menuBar );
43 menuBar->insertItem( i18n( "Settings" ), settingsMenu ); 44 menuBar->insertItem( i18n( "Settings" ), settingsMenu );
44 45
45 addToolBar( toolBar ); 46 addToolBar( toolBar );
46 toolBar->setHorizontalStretchable( true ); 47 toolBar->setHorizontalStretchable( true );
47 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), 48 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"),
48 0, 0, this ); 49 0, 0, this );
49 connect(getMail, SIGNAL( activated() ), 50 connect(getMail, SIGNAL( activated() ),
50 SLOT( slotGetAllMail() ) ); 51 SLOT( slotGetAllMail() ) );
51 getMail->addTo( mailMenu ); 52 getMail->addTo( mailMenu );
52 53
53 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), 54 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"),
54 0, 0, this ); 55 0, 0, this );
55 getMail->addTo( toolBar ); 56 getMail->addTo( toolBar );
56 getMail->addTo( mailMenu ); 57 getMail->addTo( mailMenu );
57 connect(getMail, SIGNAL( activated() ), 58 connect(getMail, SIGNAL( activated() ),
58 SLOT( slotGetMail() ) ); 59 SLOT( slotGetMail() ) );
59 60
60 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), 61 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"),
61 0, 0, this ); 62 0, 0, this );
62 composeMail->addTo( toolBar ); 63 composeMail->addTo( toolBar );
63 composeMail->addTo( mailMenu ); 64 composeMail->addTo( mailMenu );
64 65
65 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , 66 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") ,
66 0, 0, this ); 67 0, 0, this );
67 sendQueued->addTo( toolBar ); 68 sendQueued->addTo( toolBar );
68 sendQueued->addTo( mailMenu ); 69 sendQueued->addTo( mailMenu );
69 70
70 /* 71 /*
71 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, 72 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC,
72 0, 0, this ); 73 0, 0, this );
73 syncFolders->addTo( toolBar ); 74 syncFolders->addTo( toolBar );
74 syncFolders->addTo( mailMenu ); 75 syncFolders->addTo( mailMenu );
75 */ 76 */
76 77
77 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , 78 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") ,
78 0, 0, this, 0, true ); 79 0, 0, this, 0, true );
79 showFolders->addTo( toolBar ); 80 showFolders->addTo( toolBar );
80 showFolders->addTo( mailMenu ); 81 showFolders->addTo( mailMenu );
81 showFolders->setOn( true ); 82 showFolders->setOn( true );
82 connect(showFolders, SIGNAL( toggled(bool) ), 83 connect(showFolders, SIGNAL( toggled(bool) ),
83 SLOT( slotShowFolders(bool) ) ); 84 SLOT( slotShowFolders(bool) ) );
84 85
85 /* 86 /*
86 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 87 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
87 0, 0, this ); 88 0, 0, this );
88 searchMails->kopddTo( toolBar ); 89 searchMails->kopddTo( toolBar );
89 searchMails->addTo( mailMenu ); 90 searchMails->addTo( mailMenu );
90 */ 91 */
91 92
92 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); 93 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
93 deleteMails->addTo( toolBar ); 94 deleteMails->addTo( toolBar );
94 deleteMails->addTo( mailMenu ); 95 deleteMails->addTo( mailMenu );
95 connect( deleteMails, SIGNAL( activated() ), 96 connect( deleteMails, SIGNAL( activated() ),
96 SLOT( slotDeleteAllMail() ) ); 97 SLOT( slotDeleteAllMail() ) );
97 98
98 editSettings = new QAction( i18n( "Configure OM/Pi..." ), SmallIcon("SettingsIcon") , 99 editSettings = new QAction( i18n( "Configure OM/Pi..." ), SmallIcon("SettingsIcon") ,
99 0, 0, this ); 100 0, 0, this );
100 editSettings->addTo( settingsMenu ); 101 editSettings->addTo( settingsMenu );
101 connect( editSettings, SIGNAL( activated() ), 102 connect( editSettings, SIGNAL( activated() ),
102 SLOT( slotEditSettings() ) ); 103 SLOT( slotEditSettings() ) );
103 104
104 105
105 QAction * editSettings2 = new QAction( i18n( "Global Settings..." ), SmallIcon("SettingsIcon") , 106 QAction * editSettings2 = new QAction( i18n( "Global Settings..." ), SmallIcon("SettingsIcon") ,
106 0, 0, this ); 107 0, 0, this );
107 editSettings2->addTo( settingsMenu ); 108 editSettings2->addTo( settingsMenu );
108 connect( editSettings2, SIGNAL( activated() ), 109 connect( editSettings2, SIGNAL( activated() ),
109 SLOT( slotEditGlobalSettings() ) ); 110 SLOT( slotEditGlobalSettings() ) );
110 111
111 112
112 113
113 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 114 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
114 0, 0, this ); 115 0, 0, this );
115 editAccounts->addTo( settingsMenu ); 116 editAccounts->addTo( settingsMenu );
116 codecMenu = new QPopupMenu( menuBar ); 117 codecMenu = new QPopupMenu( menuBar );
117 codecMenu->insertItem( "Western (iso-8859-1)",0,0); 118 codecMenu->insertItem( "Western (iso-8859-1)",0,0);
118 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); 119 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1);
119 codecMenu->insertItem( "Western (iso-8859-15)",2,2); 120 codecMenu->insertItem( "Western (iso-8859-15)",2,2);
120 codecMenu->insertItem( "Chinese (big-5)",3,3); 121 codecMenu->insertItem( "Chinese (big-5)",3,3);
121 codecMenu->insertItem( "Unicode (utf-8)",4,4); 122 codecMenu->insertItem( "Unicode (utf-8)",4,4);
122 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); 123 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5);
123 //disabled 124 //disabled
124 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); 125 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu);
125 //setCentralWidget( view ); 126 //setCentralWidget( view );
126 127
127 QVBox* wrapperBox = new QVBox( this ); 128 QVBox* wrapperBox = new QVBox( this );
128 setCentralWidget( wrapperBox ); 129 setCentralWidget( wrapperBox );
129 130
130 // QWidget *view = new QWidget( wrapperBox ); 131 // QWidget *view = new QWidget( wrapperBox );
131 KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox); 132 KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox);
132 splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down); 133 splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down);
133 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor); 134 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor);
134 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 135 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
135 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 136 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
136 subLE = 0; 137 subLE = 0;
137 fromLE = 0; 138 fromLE = 0;
138 toLE = 0; 139 toLE = 0;
139 if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) { 140 if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) {
140 QWidget* infoBox = new QWidget( splithor ); 141 QWidget* infoBox = new QWidget( splithor );
141 QGridLayout *griLay = new QGridLayout( infoBox, 2,2); 142 QGridLayout *griLay = new QGridLayout( infoBox, 2,2);
142 if ( KOPrefs::instance()->mShowInfoSub ) { 143 if ( KOPrefs::instance()->mShowInfoSub ) {
143 griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 ); 144 griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 );
144 griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ; 145 griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ;
145 } 146 }
146 if ( KOPrefs::instance()->mShowInfoFrom ) { 147 if ( KOPrefs::instance()->mShowInfoFrom ) {
147 griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 ); 148 griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 );
148 griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ; 149 griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ;
149 } 150 }
150 if ( KOPrefs::instance()->mShowInfoTo ) { 151 if ( KOPrefs::instance()->mShowInfoTo ) {
151 griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 ); 152 griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 );
152 griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ; 153 griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ;
153 } 154 }
154 infoBox->setMaximumHeight( infoBox->sizeHint().height() ); 155 infoBox->setMaximumHeight( infoBox->sizeHint().height() );
155 if ( !KOPrefs::instance()->mShowInfoStart ) { 156 if ( !KOPrefs::instance()->mShowInfoStart ) {
156 QTimer::singleShot( 1,splithor, SLOT ( toggle() ) ); 157 QTimer::singleShot( 1,splithor, SLOT ( toggle() ) );
157 } 158 }
158 } 159 }
159 160
160 161
161 folderView = new AccountView( split ); 162 folderView = new AccountView( split );
162 folderView->header()->hide(); 163 folderView->header()->hide();
163 folderView->setRootIsDecorated( false ); 164 folderView->setRootIsDecorated( false );
164 folderView->addColumn( i18n( "Mailbox" ) ); 165 folderView->addColumn( i18n( "Mailbox" ) );
165 166
166 //layout->addWidget( folderView ); 167 //layout->addWidget( folderView );
167 168
168 mailView = new QListView( split ); 169 mailView = new KListView( split );
169 mailView->addColumn( i18n( " " ) ); 170 mailView->addColumn( i18n( " " ) );
170 mailView->addColumn( i18n( "Subject" ),QListView::Manual ); 171 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
171 mailView->addColumn( i18n( "Sender" ),QListView::Manual ); 172 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
172 mailView->addColumn( i18n( "Size" ),QListView::Manual); 173 mailView->addColumn( i18n( "Size" ),QListView::Manual);
173 mailView->addColumn( i18n( "Date" ),QListView::Manual); 174 mailView->addColumn( i18n( "Date" ),QListView::Manual);
174 if ( KOPrefs::instance()->mShowToField ) 175 if ( KOPrefs::instance()->mShowToField )
175 mailView->addColumn( i18n( "To" ),QListView::Manual); 176 mailView->addColumn( i18n( "To" ),QListView::Manual);
176 mailView->setAllColumnsShowFocus(true); 177 mailView->setAllColumnsShowFocus(true);
177 //mailView->setSorting(-1); 178 //mailView->setSorting(-1);
178 mailView->setRootIsDecorated( false ); 179 mailView->setRootIsDecorated( false );
179 statusWidget = new StatusWidget( wrapperBox ); 180 statusWidget = new StatusWidget( wrapperBox );
180 statusWidget->hide(); 181 statusWidget->hide();
181 182 mailView->setSelectionMode( QListView::Multi );
183 mailView->setMultiSelection( true);
184 mailView->setAlternateBackground(KPimGlobalPrefs::instance()->mAlternateColor );
182 //layout->addWidget( mailView ); 185 //layout->addWidget( mailView );
183 //layout->setStretchFactor( folderView, 1 ); 186 //layout->setStretchFactor( folderView, 1 );
184 //layout->setStretchFactor( mailView, 2 ); 187 //layout->setStretchFactor( mailView, 2 );
185 188
186 slotAdjustLayout(); 189 slotAdjustLayout();
187#ifndef DESKTOP_VERSION 190#ifndef DESKTOP_VERSION
188 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 191 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
189 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 192 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
190 if ( subLE ) 193 if ( subLE )
191 QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); 194 QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold);
192 if ( fromLE ) 195 if ( fromLE )
193 QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); 196 QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold);
194 if ( toLE ) 197 if ( toLE )
195 QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); 198 QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold);
196#endif 199#endif
197 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 200 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
198 SLOT( mailLeftClicked(QListViewItem*) ) ); 201 SLOT( mailLeftClicked(QListViewItem*) ) );
199 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 202 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
200 SLOT( mailLeftClicked(QListViewItem*) ) ); 203 SLOT( mailLeftClicked(QListViewItem*) ) );
201 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 204 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
202 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 205 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
203 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 206 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
204 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 207 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
205 208
206 connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this, 209 connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this,
207 SLOT( setInfoFields(QListViewItem*) ) ); 210 SLOT( setInfoFields(QListViewItem*) ) );
208 211
209 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 212 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
210 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 213 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
211// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 214// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
212 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 215 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
213 //mailView->setMultiSelection ( true ); 216 //mailView->setMultiSelection ( true );
214 mailView->setSelectionMode( QListView::Extended ); 217 //mailView->setSelectionMode( QListView::Extended );
215 QValueList<int> list; 218 QValueList<int> list;
216 int fw = 100; 219 int fw = 100;
217 if ( QApplication::desktop()->width() > 320 ) 220 if ( QApplication::desktop()->width() > 320 )
218 fw = 50; 221 fw = 50;
219 list.append( fw ); 222 list.append( fw );
220 list.append( 100 ); 223 list.append( 100 );
221 split->setSizes( list ); 224 split->setSizes( list );
222 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 225 QTimer::singleShot( 100, this, SLOT( slotAdjustColumns() ) );
223 mailView->setShowSortIndicator ( true ); 226 mailView->setShowSortIndicator ( true );
224 QLabel *spacer = new QLabel( toolBar ); 227 QLabel *spacer = new QLabel( toolBar );
225 spacer->setBackgroundMode( QWidget::PaletteButton ); 228 spacer->setBackgroundMode( QWidget::PaletteButton );
226 toolBar->setStretchableWidget( spacer ); 229 toolBar->setStretchableWidget( spacer );
227 230
228 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); 231 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
229 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 232 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
230 if ( QApplication::desktop()->width() > 320 ) 233 if ( QApplication::desktop()->width() > 320 )
231 closeMail->addTo(toolBar); 234 closeMail->addTo(toolBar);
232 closeMail->addTo(mailMenu); 235 closeMail->addTo(mailMenu);
233 236
234 237
235 QPopupMenu* helpMenu = new QPopupMenu( menuBar ); 238 QPopupMenu* helpMenu = new QPopupMenu( menuBar );
236 menuBar->insertItem( i18n( "Help" ), helpMenu ); 239 menuBar->insertItem( i18n( "Help" ), helpMenu );
237 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); 240 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this);
238 connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); 241 connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
239 li->addTo(helpMenu); 242 li->addTo(helpMenu);
240 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); 243 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this);
241 connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); 244 connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
242 li->addTo(helpMenu); 245 li->addTo(helpMenu);
243 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); 246 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this);
244 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 247 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
245 li->addTo(helpMenu); 248 li->addTo(helpMenu);
246 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); 249 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) );
247 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 250 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
248 menuBar->setMaximumWidth( menuBar->sizeHint().width()); 251 menuBar->setMaximumWidth( menuBar->sizeHint().width());
249 //menuBar->setMaximumSize( menuBar->sizeHint()); 252 //menuBar->setMaximumSize( menuBar->sizeHint());
250#ifdef DESKTOP_VERSION 253#ifdef DESKTOP_VERSION
251 resize ( 640, 480 ); 254 resize ( 640, 480 );
252#endif 255#endif
253} 256}
254 257
255MainWindow::~MainWindow() 258MainWindow::~MainWindow()
256{ 259{
257} 260}
258 261
259void MainWindow::setInfoFields(QListViewItem* item ) 262void MainWindow::setInfoFields(QListViewItem* item )
260{ 263{
261 if ( item == 0) { 264 if ( item == 0) {
262 if ( subLE ) subLE->setText(""); 265 if ( subLE ) subLE->setText("");
263 if ( fromLE ) fromLE->setText(""); 266 if ( fromLE ) fromLE->setText("");
264 if ( toLE ) toLE->setText(""); 267 if ( toLE ) toLE->setText("");
265 return; 268 return;
266 } 269 }
267 RecMailP mail = ((MailListViewItem*)item)->data(); 270 RecMailP mail = ((MailListViewItem*)item)->data();
268 if ( subLE ) subLE->setText(mail->getSubject()); 271 if ( subLE ) subLE->setText(mail->getSubject());
269 if ( fromLE ) fromLE->setText(mail->getFrom()); 272 if ( fromLE ) fromLE->setText(mail->getFrom());
270 if ( toLE ) toLE->setText(mail->To().join(";" )); 273 if ( toLE ) toLE->setText(mail->To().join(";" ));
271 if ( subLE ) subLE->setCursorPosition(0); 274 if ( subLE ) subLE->setCursorPosition(0);
272 if ( fromLE ) fromLE->setCursorPosition(0); 275 if ( fromLE ) fromLE->setCursorPosition(0);
273 if ( toLE ) toLE->setCursorPosition(0); 276 if ( toLE ) toLE->setCursorPosition(0);
274 277
275} 278}
276void MainWindow::slotSetCodec( int codec ) 279void MainWindow::slotSetCodec( int codec )
277{ 280{
278 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); 281 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false );
279 //qDebug("codec %d ", codec); 282 //qDebug("codec %d ", codec);
280 KOPrefs::instance()->mCurrentCodec = codec; 283 KOPrefs::instance()->mCurrentCodec = codec;
281 KOPrefs::instance()->isDirty = true; 284 KOPrefs::instance()->isDirty = true;
282 QString name; 285 QString name;
283 switch ( codec ) { 286 switch ( codec ) {
284 case 0: 287 case 0:
285 name = "iso-8859-1"; 288 name = "iso-8859-1";
286 break; 289 break;
287 case 1: 290 case 1:
288 name = "iso-8859-5"; 291 name = "iso-8859-5";
289 break; 292 break;
290 case 2: 293 case 2:
291 name = "iso-8859-15"; 294 name = "iso-8859-15";
292 break; 295 break;
293 case 3: 296 case 3:
294 name = "big-5"; 297 name = "big-5";
295 break; 298 break;
296 case 4: 299 case 4:
297 name = "utf-8"; 300 name = "utf-8";
298 break; 301 break;
299 case 5: 302 case 5:
300 name = KOPrefs::instance()->mSendCodec.lower(); 303 name = KOPrefs::instance()->mSendCodec.lower();
301 break; 304 break;
302 } 305 }
303 KOPrefs::instance()->mCurrentCodeName = name ; 306 KOPrefs::instance()->mCurrentCodeName = name ;
304 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); 307 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")");
305 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); 308 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true );
306} 309}
307void MainWindow::showLicence() 310void MainWindow::showLicence()
308{ 311{
309 KApplication::showLicence(); 312 KApplication::showLicence();
310} 313}
311void MainWindow::showAbout() 314void MainWindow::showAbout()
312{ 315{
313 QString version; 316 QString version;
314#include <../version> 317#include <../version>
315 318
316 QString cap = "About KOpieMail/Pi"; 319 QString cap = "About KOpieMail/Pi";
317 QString text =i18n("KOpieMail/Platform-independent\n") + 320 QString text =i18n("KOpieMail/Platform-independent\n") +
318 "(OM/Pi) " + version + " - " 321 "(OM/Pi) " + version + " - "
319 322
320#ifdef DESKTOP_VERSION 323#ifdef DESKTOP_VERSION
321 "Desktop Edition\n" 324 "Desktop Edition\n"
322#else 325#else
323 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" 326 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
324#endif 327#endif
325 "www.pi-sync.info\n\n" 328 "www.pi-sync.info\n\n"
326 329
327 330
328 331
329"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n" 332"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n"
330 "KOpieMail/Pi is based on Opie Mail\n" 333 "KOpieMail/Pi is based on Opie Mail\n"
331 "Copyright (c) Rajko Albrecht and the Opie team\n" 334 "Copyright (c) Rajko Albrecht and the Opie team\n"
332 "KOpieMail/Pi is licensed under the GPL\n" 335 "KOpieMail/Pi is licensed under the GPL\n"
333 "\n" 336 "\n"
334 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" 337 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
335 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" 338 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
336 "libEtPan has its own licence - see LibEtPan licence\n"; 339 "libEtPan has its own licence - see LibEtPan licence\n";
337 340
338 KApplication::showText( cap, text ); 341 KApplication::showText( cap, text );
339} 342}
340void MainWindow::showEtpanLicence() 343void MainWindow::showEtpanLicence()
341{ 344{
342 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); 345 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
343 346
344} 347}
345void MainWindow::appMessage(const QCString &, const QByteArray &) 348void MainWindow::appMessage(const QCString &, const QByteArray &)
346{ 349{
347 qDebug("appMessage implemented by subclass"); 350 qDebug("appMessage implemented by subclass");
348} 351}
349 352
350void MainWindow::slotAdjustLayout() { 353void MainWindow::slotAdjustLayout() {
351 354
352 /* 355 /*
353 QWidget *d = QApplication::desktop(); 356 QWidget *d = QApplication::desktop();
354 357
355 if ( d->width() < d->height() ) { 358 if ( d->width() < d->height() ) {
356 layout->setDirection( QBoxLayout::TopToBottom ); 359 layout->setDirection( QBoxLayout::TopToBottom );
357 } else { 360 } else {
358 layout->setDirection( QBoxLayout::LeftToRight ); 361 layout->setDirection( QBoxLayout::LeftToRight );
359 } 362 }
360 */ 363 */
361} 364}
362 365
363void MainWindow::slotAdjustColumns() 366void MainWindow::slotAdjustColumns()
364{ 367{
365 bool hidden = folderView->isHidden(); 368 bool hidden = folderView->isHidden();
366 if ( hidden ) folderView->show(); 369 if ( hidden ) folderView->show();
367 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 370 folderView->setColumnWidth( 0, folderView->visibleWidth() );
368 if ( hidden ) folderView->hide(); 371 if ( hidden ) folderView->hide();
369 372
370 mailView->setColumnWidth( 0, 10 ); 373 mailView->setColumnWidth( 0, 10 );
371 mailView->setColumnWidth( 1, 100 ); 374 mailView->setColumnWidth( 1, 100 );
372 mailView->setColumnWidth( 2, 100 ); 375 mailView->setColumnWidth( 2, 100 );
373 mailView->setColumnWidth( 3, 50 ); 376 mailView->setColumnWidth( 3, 70 );
374 mailView->setColumnWidth( 4, 120 ); 377 mailView->setColumnWidth( 4, 170 );
375 if ( KOPrefs::instance()->mShowToField ) 378 if ( KOPrefs::instance()->mShowToField )
376 mailView->setColumnWidth( 5, 100 ); 379 mailView->setColumnWidth( 5, 100 );
380 mailView->setColumnAlignment( 3, AlignRight);
377} 381}
378 382
379void MainWindow::slotEditSettings() 383void MainWindow::slotEditSettings()
380{ 384{
381} 385}
382void MainWindow::slotEditGlobalSettings() 386void MainWindow::slotEditGlobalSettings()
383{ 387{
384} 388}
385 389
386void MainWindow::slotShowFolders( bool ) 390void MainWindow::slotShowFolders( bool )
387{ 391{
388 qDebug("not implemented: "); 392 qDebug("not implemented: ");
389} 393}
390 394
391void MainWindow::refreshMailView(const QValueList<RecMailP>&) 395void MainWindow::refreshMailView(const QValueList<RecMailP>&)
392{ 396{
393 qDebug("not implemented: "); 397 qDebug("not implemented: ");
394} 398}
395 399
396void MainWindow::mailLeftClicked(QListViewItem * ) 400void MainWindow::mailLeftClicked(QListViewItem * )
397{ 401{
398 qDebug("not implemented: "); 402 qDebug("not implemented: ");
399} 403}
400 404
401void MainWindow::displayMail() 405void MainWindow::displayMail()
402{ 406{
403 qDebug("not implemented: "); 407 qDebug("not implemented: ");
404} 408}
405 409
406void MainWindow::slotDeleteMail() 410void MainWindow::slotDeleteMail()
407{ 411{
408 qDebug("not implemented: "); 412 qDebug("not implemented: ");
409} 413}
410 414
411void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 415void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
412{ 416{
413 qDebug("not implemented: "); 417 qDebug("not implemented: ");
414} 418}
415 419
416void MainWindow::slotSendQueued() 420void MainWindow::slotSendQueued()
417{ 421{
418 qDebug("not implemented: "); 422 qDebug("not implemented: ");
419} 423}
420 424
421void MainWindow::slotEditAccounts() 425void MainWindow::slotEditAccounts()
422{ 426{
423 qDebug("not implemented: "); 427 qDebug("not implemented: ");
424} 428}
425 429
426void MainWindow::slotComposeMail() 430void MainWindow::slotComposeMail()
427{ 431{
428 qDebug("not implemented: "); 432 qDebug("not implemented: ");
429} 433}
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h
index 6894039..178d2bb 100644
--- a/kmicromail/mainwindow.h
+++ b/kmicromail/mainwindow.h
@@ -1,74 +1,74 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3#ifndef MAINWINDOW_H 3#ifndef MAINWINDOW_H
4#define MAINWINDOW_H 4#define MAINWINDOW_H
5 5
6#include <qmainwindow.h> 6#include <qmainwindow.h>
7#include <qlistview.h> 7#include <klistview.h>
8#include <qaction.h> 8#include <qaction.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10 10
11#include <qtoolbar.h> 11#include <qtoolbar.h>
12#ifdef DESKTOP_VERSION 12#ifdef DESKTOP_VERSION
13#include <qmenubar.h> 13#include <qmenubar.h>
14#define QPEMenuBar QMenuBar 14#define QPEMenuBar QMenuBar
15#else 15#else
16#include <qpe/qpemenubar.h> 16#include <qpe/qpemenubar.h>
17#endif 17#endif
18 18
19#include "accountview.h" 19#include "accountview.h"
20#include "statuswidget.h" 20#include "statuswidget.h"
21 21
22#include <libmailwrapper/mailtypes.h> 22#include <libmailwrapper/mailtypes.h>
23#include <opie2/osmartpointer.h> 23#include <opie2/osmartpointer.h>
24 24
25class RecMail; 25class RecMail;
26 26
27class MainWindow : public QMainWindow 27class MainWindow : public QMainWindow
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30 30
31public: 31public:
32 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 32 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
33 virtual ~MainWindow(); 33 virtual ~MainWindow();
34 34
35public slots: 35public slots:
36 virtual void slotAdjustColumns(); 36 virtual void slotAdjustColumns();
37 virtual void appMessage(const QCString &msg, const QByteArray &data); 37 virtual void appMessage(const QCString &msg, const QByteArray &data);
38 virtual void slotComposeMail(); 38 virtual void slotComposeMail();
39 39
40protected slots: 40protected slots:
41 virtual void setInfoFields(QListViewItem* ); 41 virtual void setInfoFields(QListViewItem* );
42 virtual void slotSendQueued(); 42 virtual void slotSendQueued();
43 virtual void slotEditAccounts(); 43 virtual void slotEditAccounts();
44 virtual void slotShowFolders( bool show ); 44 virtual void slotShowFolders( bool show );
45 virtual void refreshMailView(const QValueList<RecMailP>&); 45 virtual void refreshMailView(const QValueList<RecMailP>&);
46 virtual void displayMail(); 46 virtual void displayMail();
47 virtual void slotGetMail() = 0; 47 virtual void slotGetMail() = 0;
48 virtual void slotGetAllMail() = 0; 48 virtual void slotGetAllMail() = 0;
49 virtual void slotDeleteMail(); 49 virtual void slotDeleteMail();
50 virtual void slotDeleteAllMail() = 0; 50 virtual void slotDeleteAllMail() = 0;
51 virtual void slotSetCodec(int); 51 virtual void slotSetCodec(int);
52 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 52 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
53 virtual void slotAdjustLayout(); 53 virtual void slotAdjustLayout();
54 virtual void slotEditSettings(); 54 virtual void slotEditSettings();
55 virtual void slotEditGlobalSettings(); 55 virtual void slotEditGlobalSettings();
56 virtual void mailLeftClicked( QListViewItem * ); 56 virtual void mailLeftClicked( QListViewItem * );
57 void showLicence(); 57 void showLicence();
58 void showAbout(); 58 void showAbout();
59 void showEtpanLicence(); 59 void showEtpanLicence();
60 60
61protected: 61protected:
62 QToolBar *toolBar; 62 QToolBar *toolBar;
63 StatusWidget *statusWidget; 63 StatusWidget *statusWidget;
64 QPEMenuBar *menuBar; 64 QPEMenuBar *menuBar;
65 QPopupMenu *mailMenu, *settingsMenu, *codecMenu; 65 QPopupMenu *mailMenu, *settingsMenu, *codecMenu;
66 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, 66 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
67 *editSettings, *editAccounts, *syncFolders; 67 *editSettings, *editAccounts, *syncFolders;
68 AccountView *folderView; 68 AccountView *folderView;
69 QListView *mailView; 69 KListView *mailView;
70 QLineEdit* toLE,*fromLE,*subLE; 70 QLineEdit* toLE,*fromLE,*subLE;
71 //QBoxLayout *layout; 71 //QBoxLayout *layout;
72}; 72};
73 73
74#endif 74#endif