summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp1
-rw-r--r--kmicromail/mailistviewitem.cpp1
-rw-r--r--kmicromail/mailistviewitem.h1
-rw-r--r--kmicromail/main.cpp1
-rw-r--r--kmicromail/mainwindow.cpp2
-rw-r--r--kmicromail/mainwindow.h2
-rw-r--r--kmicromail/opiemail.cpp1
-rw-r--r--kmicromail/viewmail.cpp1
-rw-r--r--kmicromail/viewmailbase.cpp1
-rw-r--r--kmicromail/viewmailbase.h1
10 files changed, 12 insertions, 0 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 9060364..654cfc0 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,128 +1,129 @@
1// CHANGED 2004-08-06 Lutz Rogowski
1 2
2#include "composemail.h" 3#include "composemail.h"
3 4
4#include <libmailwrapper/smtpwrapper.h> 5#include <libmailwrapper/smtpwrapper.h>
5#include <libmailwrapper/storemail.h> 6#include <libmailwrapper/storemail.h>
6#include <libmailwrapper/abstractmail.h> 7#include <libmailwrapper/abstractmail.h>
7#include <libmailwrapper/mailtypes.h> 8#include <libmailwrapper/mailtypes.h>
8 9
9/* OPIE */ 10/* OPIE */
10//#include <opie2/ofiledialog.h> 11//#include <opie2/ofiledialog.h>
11//#include <opie2/odebug.h> 12//#include <opie2/odebug.h>
12#include <kfiledialog.h> 13#include <kfiledialog.h>
13//#include <qpe/resource.h> 14//#include <qpe/resource.h>
14#include <qpe/config.h> 15#include <qpe/config.h>
15#include <qpe/global.h> 16#include <qpe/global.h>
16//#include <qpe/contact.h> 17//#include <qpe/contact.h>
17 18
18 19
19#include <qcombobox.h> 20#include <qcombobox.h>
20#include <qcheckbox.h> 21#include <qcheckbox.h>
21#include <qtimer.h> 22#include <qtimer.h>
22#include <qmessagebox.h> 23#include <qmessagebox.h>
23#include <qpushbutton.h> 24#include <qpushbutton.h>
24#include <qmultilineedit.h> 25#include <qmultilineedit.h>
25#include <qlabel.h> 26#include <qlabel.h>
26#include <qtabwidget.h> 27#include <qtabwidget.h>
27#include <qlistview.h> 28#include <qlistview.h>
28#include <kabc/addresseedialog.h> 29#include <kabc/addresseedialog.h>
29#include <kabc/stdaddressbook.h> 30#include <kabc/stdaddressbook.h>
30#include <kabc/addressee.h> 31#include <kabc/addressee.h>
31 32
32 33
33 34
34//using namespace Opie::Core; 35//using namespace Opie::Core;
35//using namespace Opie::Ui; 36//using namespace Opie::Ui;
36ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 37ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
37 : ComposeMailUI( parent, name, modal, flags ) 38 : ComposeMailUI( parent, name, modal, flags )
38{ 39{
39 40
40 settings = s; 41 settings = s;
41 m_replyid = ""; 42 m_replyid = "";
42 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 43 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
43 QStringList mails = con.emails(); 44 QStringList mails = con.emails();
44 QString defmail = con.preferredEmail(); 45 QString defmail = con.preferredEmail();
45 if ( mails.count() == 0) 46 if ( mails.count() == 0)
46 QMessageBox::information( 0, tr( "Hint" ), 47 QMessageBox::information( 0, tr( "Hint" ),
47 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 48 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
48 tr( "Ok" ) ); 49 tr( "Ok" ) );
49 if (defmail.length()!=0) { 50 if (defmail.length()!=0) {
50 fromBox->insertItem(defmail); 51 fromBox->insertItem(defmail);
51 } 52 }
52 QStringList::ConstIterator sit = mails.begin(); 53 QStringList::ConstIterator sit = mails.begin();
53 for (;sit!=mails.end();++sit) { 54 for (;sit!=mails.end();++sit) {
54 if ( (*sit)==defmail) 55 if ( (*sit)==defmail)
55 continue; 56 continue;
56 fromBox->insertItem((*sit)); 57 fromBox->insertItem((*sit));
57 } 58 }
58 senderNameEdit->setText(con.formattedName()); 59 senderNameEdit->setText(con.formattedName());
59 Config cfg( "mail" ); 60 Config cfg( "mail" );
60 cfg.setGroup( "Compose" ); 61 cfg.setGroup( "Compose" );
61 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 62 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
62 63
63 attList->addColumn( tr( "Name" ) ); 64 attList->addColumn( tr( "Name" ) );
64 attList->addColumn( tr( "Size" ) ); 65 attList->addColumn( tr( "Size" ) );
65 66
66 QList<Account> accounts = settings->getAccounts(); 67 QList<Account> accounts = settings->getAccounts();
67 68
68 Account *it; 69 Account *it;
69 for ( it = accounts.first(); it; it = accounts.next() ) { 70 for ( it = accounts.first(); it; it = accounts.next() ) {
70 if ( it->getType()==MAILLIB::A_SMTP ) { 71 if ( it->getType()==MAILLIB::A_SMTP ) {
71 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 72 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
72 smtpAccountBox->insertItem( smtp->getAccountName() ); 73 smtpAccountBox->insertItem( smtp->getAccountName() );
73 smtpAccounts.append( smtp ); 74 smtpAccounts.append( smtp );
74 } 75 }
75 } 76 }
76 if ( smtpAccounts.count() > 0 ) { 77 if ( smtpAccounts.count() > 0 ) {
77 fillValues( smtpAccountBox->currentItem() ); 78 fillValues( smtpAccountBox->currentItem() );
78 } else { 79 } else {
79 QMessageBox::information( 0, tr( "Problem" ), 80 QMessageBox::information( 0, tr( "Problem" ),
80 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), 81 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
81 tr( "Ok" ) ); 82 tr( "Ok" ) );
82 return; 83 return;
83 } 84 }
84 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 85 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
85 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 86 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
86 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 87 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
87 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 88 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
88 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 89 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
89 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 90 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
90 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 91 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
91 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 92 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
92 mMail = 0; 93 mMail = 0;
93 warnAttach = true; 94 warnAttach = true;
94 95
95} 96}
96void ComposeMail::saveAsDraft() 97void ComposeMail::saveAsDraft()
97{ 98{
98 99
99 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 100 Opie::Core::OSmartPointer<Mail> mail= new Mail();
100 mail->setMail(fromBox->currentText()); 101 mail->setMail(fromBox->currentText());
101 mail->setTo( toLine->text() ); 102 mail->setTo( toLine->text() );
102 mail->setName(senderNameEdit->text()); 103 mail->setName(senderNameEdit->text());
103 mail->setCC( ccLine->text() ); 104 mail->setCC( ccLine->text() );
104 mail->setBCC( bccLine->text() ); 105 mail->setBCC( bccLine->text() );
105 mail->setReply( replyLine->text() ); 106 mail->setReply( replyLine->text() );
106 mail->setSubject( subjectLine->text() ); 107 mail->setSubject( subjectLine->text() );
107 if (!m_replyid.isEmpty()) { 108 if (!m_replyid.isEmpty()) {
108 QStringList ids; 109 QStringList ids;
109 ids.append(m_replyid); 110 ids.append(m_replyid);
110 mail->setInreply(ids); 111 mail->setInreply(ids);
111 } 112 }
112 QString txt = message->text(); 113 QString txt = message->text();
113 if ( !sigMultiLine->text().isEmpty() ) { 114 if ( !sigMultiLine->text().isEmpty() ) {
114 txt.append( "\n--\n" ); 115 txt.append( "\n--\n" );
115 txt.append( sigMultiLine->text() ); 116 txt.append( sigMultiLine->text() );
116 } 117 }
117 mail->setMessage( txt ); 118 mail->setMessage( txt );
118 119
119 /* only use the default drafts folder name! */ 120 /* only use the default drafts folder name! */
120 Storemail wrapper(AbstractMail::draftFolder()); 121 Storemail wrapper(AbstractMail::draftFolder());
121 wrapper.storeMail(mail); 122 wrapper.storeMail(mail);
122 123
123 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 124 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
124 /* attachments we will ignore! */ 125 /* attachments we will ignore! */
125 if ( it != 0 ) { 126 if ( it != 0 ) {
126 if ( warnAttach ) 127 if ( warnAttach )
127 QMessageBox::warning(0,tr("Store message"), 128 QMessageBox::warning(0,tr("Store message"),
128 tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); 129 tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index 1ca0ada..b92b0cf 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -1,128 +1,129 @@
1// CHANGED 2004-08-06 Lutz Rogowski
1#include "mailistviewitem.h" 2#include "mailistviewitem.h"
2#include <libmailwrapper/abstractmail.h> 3#include <libmailwrapper/abstractmail.h>
3#include <qtextstream.h> 4#include <qtextstream.h>
4#include <kiconloader.h> 5#include <kiconloader.h>
5//#include <qpe/resource.h> 6//#include <qpe/resource.h>
6 7
7MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 8MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
8 :QListViewItem(parent,item),mail_data() 9 :QListViewItem(parent,item),mail_data()
9{ 10{
10} 11}
11 12
12void MailListViewItem::showEntry() 13void MailListViewItem::showEntry()
13{ 14{
14 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { 15 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
15 setPixmap( 0, SmallIcon ( "kmmsgreplied") ); 16 setPixmap( 0, SmallIcon ( "kmmsgreplied") );
16 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { 17 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
17 /* I think it looks nicer if there are not such a log of icons but only on mails 18 /* I think it looks nicer if there are not such a log of icons but only on mails
18 replied or new - Alwin*/ 19 replied or new - Alwin*/
19 //setPixmap( 0,SmallIcon ("kmmsgunseen") ); 20 //setPixmap( 0,SmallIcon ("kmmsgunseen") );
20 } else { 21 } else {
21 setPixmap( 0,SmallIcon ( "kmmsgnew") ); 22 setPixmap( 0,SmallIcon ( "kmmsgnew") );
22 } 23 }
23 double s = mail_data->Msgsize(); 24 double s = mail_data->Msgsize();
24 int w = 0; 25 int w = 0;
25 s/=1024; 26 s/=1024;
26 if (s>999.0) { 27 if (s>999.0) {
27 s/=1024.0; 28 s/=1024.0;
28 ++w; 29 ++w;
29 } 30 }
30 QString fsort; 31 QString fsort;
31 fsort.sprintf( "%.2f", s ); 32 fsort.sprintf( "%.2f", s );
32 QString fsize = QString::number( s, 'f', 2 ); 33 QString fsize = QString::number( s, 'f', 2 );
33 // 1.23 34 // 1.23
34 // 11.23 35 // 11.23
35 // 111.23 36 // 111.23
36 // 999.23 maxlen 37 // 999.23 maxlen
37 switch(fsize.length() ) { 38 switch(fsize.length() ) {
38 case 4: 39 case 4:
39 fsort = "00" + fsize ; 40 fsort = "00" + fsize ;
40 break; 41 break;
41 case 5: 42 case 5:
42 fsort = "0" + fsize ; 43 fsort = "0" + fsize ;
43 break; 44 break;
44 default: 45 default:
45 fsort = fsize ; 46 fsort = fsize ;
46 break; 47 break;
47 48
48 } 49 }
49 if ( w == 0 ) { 50 if ( w == 0 ) {
50 setText(3, fsize + "kB" ); 51 setText(3, fsize + "kB" );
51 mKeyMap.insert(3, "k" + fsort); 52 mKeyMap.insert(3, "k" + fsort);
52 //setText(3, "kB" + fsort ); // test only 53 //setText(3, "kB" + fsort ); // test only
53 } else { 54 } else {
54 //setText(3, fsize + "MB"); 55 //setText(3, fsize + "MB");
55 mKeyMap.insert(4, "M" +fsort ); 56 mKeyMap.insert(4, "M" +fsort );
56 } 57 }
57 setText(1,mail_data->getSubject()); 58 setText(1,mail_data->getSubject());
58 setText(2,mail_data->getFrom()); 59 setText(2,mail_data->getFrom());
59 60
60 QString date = mail_data->getDate(); 61 QString date = mail_data->getDate();
61 62
62 int kom = date.find( ",")+2; 63 int kom = date.find( ",")+2;
63 if ( kom == 1 ) 64 if ( kom == 1 )
64 kom = 0; 65 kom = 0;
65 if ( date.mid(kom,1) == " ") 66 if ( date.mid(kom,1) == " ")
66 ++kom; 67 ++kom;
67 if ( date.mid(kom+1,1) == " " ) 68 if ( date.mid(kom+1,1) == " " )
68 date = "0" + date.mid( kom ); 69 date = "0" + date.mid( kom );
69 else if ( kom ) 70 else if ( kom )
70 date = date.mid( kom ); 71 date = date.mid( kom );
71 if ( kom || date.mid(2,1 ) == " ") { 72 if ( kom || date.mid(2,1 ) == " ") {
72 QString mon = date.mid(3,3); 73 QString mon = date.mid(3,3);
73 QString so = 00; 74 QString so = 00;
74 if ( mon == "Jan" ) 75 if ( mon == "Jan" )
75 so = "01"; 76 so = "01";
76 else if ( mon == "Feb" ) 77 else if ( mon == "Feb" )
77 so = "02"; 78 so = "02";
78 else if ( mon == "Mar" ) 79 else if ( mon == "Mar" )
79 so = "03"; 80 so = "03";
80 else if ( mon == "Apr" ) 81 else if ( mon == "Apr" )
81 so = "04"; 82 so = "04";
82 else if ( mon == "May" ) 83 else if ( mon == "May" )
83 so = "05"; 84 so = "05";
84 else if ( mon == "Jun" ) 85 else if ( mon == "Jun" )
85 so = "06"; 86 so = "06";
86 else if ( mon == "Jul" ) 87 else if ( mon == "Jul" )
87 so = "07"; 88 so = "07";
88 else if ( mon == "Aug" ) 89 else if ( mon == "Aug" )
89 so = "08"; 90 so = "08";
90 else if ( mon == "Sep" ) 91 else if ( mon == "Sep" )
91 so = "09"; 92 so = "09";
92 else if ( mon == "Oct" ) 93 else if ( mon == "Oct" )
93 so = "10"; 94 so = "10";
94 else if ( mon == "Nov" ) 95 else if ( mon == "Nov" )
95 so = "11"; 96 so = "11";
96 else if ( mon == "Dec" ) 97 else if ( mon == "Dec" )
97 so = "12"; 98 so = "12";
98 date = date.mid(7,4)+so+date.left(2)+date.mid(12,14); 99 date = date.mid(7,4)+so+date.left(2)+date.mid(12,14);
99 } 100 }
100 // if ( date.left(1) != "1" || date.left(1) != "2" ) 101 // if ( date.left(1) != "1" || date.left(1) != "2" )
101 // date = date.mid(5); 102 // date = date.mid(5);
102 mKeyMap.insert(4,date); 103 mKeyMap.insert(4,date);
103 setText(4,mail_data->getDate()); 104 setText(4,mail_data->getDate());
104} 105}
105 106
106void MailListViewItem::storeData(const RecMailP&data) 107void MailListViewItem::storeData(const RecMailP&data)
107{ 108{
108 mail_data = data; 109 mail_data = data;
109} 110}
110void MailListViewItem::setSortKey(int column,const QString &key) 111void MailListViewItem::setSortKey(int column,const QString &key)
111{ 112{
112 mKeyMap.insert(column,key); 113 mKeyMap.insert(column,key);
113} 114}
114QString MailListViewItem::key(int column, bool) const 115QString MailListViewItem::key(int column, bool) const
115{ 116{
116 // to make is fast, we use here special cases 117 // to make is fast, we use here special cases
117 if ( column == 3 || column == 4 ) { 118 if ( column == 3 || column == 4 ) {
118 return *mKeyMap.find(column); 119 return *mKeyMap.find(column);
119 } 120 }
120 if ( column == 1 ) { 121 if ( column == 1 ) {
121 if ( text(1).left(4).lower() == "re: " ) 122 if ( text(1).left(4).lower() == "re: " )
122 return text(1).mid(4); 123 return text(1).mid(4);
123 124
124 } 125 }
125 return text(column); 126 return text(column);
126 /* 127 /*
127 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 128 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
128 if (it == mKeyMap.end()) return text(column); 129 if (it == mKeyMap.end()) return text(column);
diff --git a/kmicromail/mailistviewitem.h b/kmicromail/mailistviewitem.h
index cf8040b..0fd44d3 100644
--- a/kmicromail/mailistviewitem.h
+++ b/kmicromail/mailistviewitem.h
@@ -1,26 +1,27 @@
1// CHANGED 2004-08-06 Lutz Rogowski
1#ifndef __MAILLISTVIEWITEM_H 2#ifndef __MAILLISTVIEWITEM_H
2#define __MAILLISTVIEWITEM_H 3#define __MAILLISTVIEWITEM_H
3 4
4#include <qlistview.h> 5#include <qlistview.h>
5#include <libmailwrapper/mailtypes.h> 6#include <libmailwrapper/mailtypes.h>
6#include <libmailwrapper/maildefines.h> 7#include <libmailwrapper/maildefines.h>
7 8
8class MailListViewItem:public QListViewItem 9class MailListViewItem:public QListViewItem
9{ 10{
10public: 11public:
11 MailListViewItem(QListView * parent, MailListViewItem * after ); 12 MailListViewItem(QListView * parent, MailListViewItem * after );
12 virtual ~MailListViewItem(){} 13 virtual ~MailListViewItem(){}
13 14
14 void storeData(const RecMailP&data); 15 void storeData(const RecMailP&data);
15 const RecMailP&data()const; 16 const RecMailP&data()const;
16 void showEntry(); 17 void showEntry();
17 MAILLIB::ATYPE wrapperType(); 18 MAILLIB::ATYPE wrapperType();
18 QString key(int column, bool) const; 19 QString key(int column, bool) const;
19 void setSortKey(int column,const QString &key); 20 void setSortKey(int column,const QString &key);
20protected: 21protected:
21 RecMailP mail_data; 22 RecMailP mail_data;
22 private: 23 private:
23 QMap<int,QString> mKeyMap; 24 QMap<int,QString> mKeyMap;
24}; 25};
25 26
26#endif 27#endif
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp
index 8a093c6..22f1200 100644
--- a/kmicromail/main.cpp
+++ b/kmicromail/main.cpp
@@ -1,57 +1,58 @@
1// CHANGED 2004-08-06 Lutz Rogowski
1 2
2#ifndef DESKTOP_VERSION 3#ifndef DESKTOP_VERSION
3#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
4#include <stdlib.h> 5#include <stdlib.h>
5#else 6#else
6#include <qapplication.h> 7#include <qapplication.h>
7#include <qstring.h> 8#include <qstring.h>
8#include <qwindowsstyle.h> 9#include <qwindowsstyle.h>
9#include <qplatinumstyle.h> 10#include <qplatinumstyle.h>
10#include <qsgistyle.h> 11#include <qsgistyle.h>
11#endif 12#endif
12#include "opiemail.h" 13#include "opiemail.h"
13#include <qdir.h> 14#include <qdir.h>
14#include <kstandarddirs.h> 15#include <kstandarddirs.h>
15#include <kglobal.h> 16#include <kglobal.h>
16#include <stdio.h> 17#include <stdio.h>
17#include "mainwindow.h" 18#include "mainwindow.h"
18 19
19using namespace Opie::Core; 20using namespace Opie::Core;
20int main( int argc, char **argv ) { 21int main( int argc, char **argv ) {
21 22
22#ifndef DESKTOP_VERSION 23#ifndef DESKTOP_VERSION
23 QPEApplication a( argc, argv ); 24 QPEApplication a( argc, argv );
24 a.setKeepRunning (); 25 a.setKeepRunning ();
25#else 26#else
26 QApplication a( argc, argv ); 27 QApplication a( argc, argv );
27 QApplication::setStyle( new QPlatinumStyle ()); 28 QApplication::setStyle( new QPlatinumStyle ());
28#endif 29#endif
29 30
30 KGlobal::setAppName( "kmicromail" ); 31 KGlobal::setAppName( "kmicromail" );
31 QString fileName ; 32 QString fileName ;
32#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
33 fileName = getenv("QPEDIR"); 34 fileName = getenv("QPEDIR");
34 if ( QApplication::desktop()->width() > 320 ) 35 if ( QApplication::desktop()->width() > 320 )
35 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/"); 36 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/");
36 else 37 else
37 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/"); 38 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/");
38#else 39#else
39 fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/"; 40 fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/";
40 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 41 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
41#endif 42#endif
42 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail"))); 43 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail")));
43 OpieMail mw; 44 OpieMail mw;
44#ifndef DESKTOP_VERSION 45#ifndef DESKTOP_VERSION
45 //qDebug("CONNECT "); 46 //qDebug("CONNECT ");
46 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); 47 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& )));
47 a.showMainWidget(&mw ); 48 a.showMainWidget(&mw );
48#else 49#else
49 a.setMainWidget(&mw ); 50 a.setMainWidget(&mw );
50 mw.show(); 51 mw.show();
51 //m.resize( 800, 600 ); 52 //m.resize( 800, 600 );
52 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 53 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
53#endif 54#endif
54 int rv = a.exec(); 55 int rv = a.exec();
55 return rv; 56 return rv;
56 57
57} 58}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index e020297..2de5b40 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,128 +1,130 @@
1
2// CHANGED 2004-08-06 Lutz Rogowski
1#include <qlabel.h> 3#include <qlabel.h>
2#include <qvbox.h> 4#include <qvbox.h>
3#include <qheader.h> 5#include <qheader.h>
4#include <qtimer.h> 6#include <qtimer.h>
5#include <qlayout.h> 7#include <qlayout.h>
6#include <kdialog.h> 8#include <kdialog.h>
7#include <kiconloader.h> 9#include <kiconloader.h>
8#include <kapplication.h> 10#include <kapplication.h>
9 11
10#ifndef DESKTOP_VERSION 12#ifndef DESKTOP_VERSION
11#include <qpe/qpeapplication.h> 13#include <qpe/qpeapplication.h>
12#endif 14#endif
13#include "defines.h" 15#include "defines.h"
14#include "mainwindow.h" 16#include "mainwindow.h"
15#include <KDGanttMinimizeSplitter.h> 17#include <KDGanttMinimizeSplitter.h>
16 18
17 19
18#include <kabc/stdaddressbook.h> 20#include <kabc/stdaddressbook.h>
19 21
20MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 22MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
21 : QMainWindow( parent, name ) //, flags ) 23 : QMainWindow( parent, name ) //, flags )
22{ 24{
23 setCaption( tr( "OpieMail/Pi" ) ); 25 setCaption( tr( "OpieMail/Pi" ) );
24 setToolBarsMovable( false ); 26 setToolBarsMovable( false );
25 KABC::StdAddressBook::self(); 27 KABC::StdAddressBook::self();
26 toolBar = new QToolBar( this ); 28 toolBar = new QToolBar( this );
27 menuBar = new QMenuBar( toolBar ); 29 menuBar = new QMenuBar( toolBar );
28 mailMenu = new QPopupMenu( menuBar ); 30 mailMenu = new QPopupMenu( menuBar );
29 menuBar->insertItem( tr( "Mail" ), mailMenu ); 31 menuBar->insertItem( tr( "Mail" ), mailMenu );
30 settingsMenu = new QPopupMenu( menuBar ); 32 settingsMenu = new QPopupMenu( menuBar );
31 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 33 menuBar->insertItem( tr( "Settings" ), settingsMenu );
32 34
33 addToolBar( toolBar ); 35 addToolBar( toolBar );
34 toolBar->setHorizontalStretchable( true ); 36 toolBar->setHorizontalStretchable( true );
35 37
36 38
37 39
38 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), 40 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"),
39 0, 0, this ); 41 0, 0, this );
40 composeMail->addTo( toolBar ); 42 composeMail->addTo( toolBar );
41 composeMail->addTo( mailMenu ); 43 composeMail->addTo( mailMenu );
42 44
43 sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , 45 sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") ,
44 0, 0, this ); 46 0, 0, this );
45 sendQueued->addTo( toolBar ); 47 sendQueued->addTo( toolBar );
46 sendQueued->addTo( mailMenu ); 48 sendQueued->addTo( mailMenu );
47 49
48 /* 50 /*
49 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 51 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
50 0, 0, this ); 52 0, 0, this );
51 syncFolders->addTo( toolBar ); 53 syncFolders->addTo( toolBar );
52 syncFolders->addTo( mailMenu ); 54 syncFolders->addTo( mailMenu );
53 */ 55 */
54 56
55 showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , 57 showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") ,
56 0, 0, this, 0, true ); 58 0, 0, this, 0, true );
57 showFolders->addTo( toolBar ); 59 showFolders->addTo( toolBar );
58 showFolders->addTo( mailMenu ); 60 showFolders->addTo( mailMenu );
59 showFolders->setOn( true ); 61 showFolders->setOn( true );
60 connect(showFolders, SIGNAL( toggled(bool) ), 62 connect(showFolders, SIGNAL( toggled(bool) ),
61 SLOT( slotShowFolders(bool) ) ); 63 SLOT( slotShowFolders(bool) ) );
62 64
63 /* 65 /*
64 searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), 66 searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ),
65 0, 0, this ); 67 0, 0, this );
66 searchMails->addTo( toolBar ); 68 searchMails->addTo( toolBar );
67 searchMails->addTo( mailMenu ); 69 searchMails->addTo( mailMenu );
68 */ 70 */
69 71
70 deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); 72 deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this);
71 deleteMails->addTo( toolBar ); 73 deleteMails->addTo( toolBar );
72 deleteMails->addTo( mailMenu ); 74 deleteMails->addTo( mailMenu );
73 connect( deleteMails, SIGNAL( activated() ), 75 connect( deleteMails, SIGNAL( activated() ),
74 SLOT( slotDeleteMail() ) ); 76 SLOT( slotDeleteMail() ) );
75 77
76 editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , 78 editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") ,
77 0, 0, this ); 79 0, 0, this );
78 editSettings->addTo( settingsMenu ); 80 editSettings->addTo( settingsMenu );
79 connect( editSettings, SIGNAL( activated() ), 81 connect( editSettings, SIGNAL( activated() ),
80 SLOT( slotEditSettings() ) ); 82 SLOT( slotEditSettings() ) );
81 editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , 83 editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") ,
82 0, 0, this ); 84 0, 0, this );
83 editAccounts->addTo( settingsMenu ); 85 editAccounts->addTo( settingsMenu );
84 86
85 //setCentralWidget( view ); 87 //setCentralWidget( view );
86 88
87 QVBox* wrapperBox = new QVBox( this ); 89 QVBox* wrapperBox = new QVBox( this );
88 setCentralWidget( wrapperBox ); 90 setCentralWidget( wrapperBox );
89 91
90 // QWidget *view = new QWidget( wrapperBox ); 92 // QWidget *view = new QWidget( wrapperBox );
91 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 93 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
92 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 94 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
93 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 95 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
94 96
95 folderView = new AccountView( split ); 97 folderView = new AccountView( split );
96 folderView->header()->hide(); 98 folderView->header()->hide();
97 folderView->setRootIsDecorated( false ); 99 folderView->setRootIsDecorated( false );
98 folderView->addColumn( tr( "Mailbox" ) ); 100 folderView->addColumn( tr( "Mailbox" ) );
99 101
100 //layout->addWidget( folderView ); 102 //layout->addWidget( folderView );
101 103
102 mailView = new QListView( split ); 104 mailView = new QListView( split );
103 mailView->addColumn( tr( " " ) ); 105 mailView->addColumn( tr( " " ) );
104 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 106 mailView->addColumn( tr( "Subject" ),QListView::Manual );
105 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 107 mailView->addColumn( tr( "Sender" ),QListView::Manual );
106 mailView->addColumn( tr( "Size" ),QListView::Manual); 108 mailView->addColumn( tr( "Size" ),QListView::Manual);
107 mailView->addColumn( tr( "Date" ),QListView::Manual); 109 mailView->addColumn( tr( "Date" ),QListView::Manual);
108 mailView->setAllColumnsShowFocus(true); 110 mailView->setAllColumnsShowFocus(true);
109 //mailView->setSorting(-1); 111 //mailView->setSorting(-1);
110 mailView->setRootIsDecorated( false ); 112 mailView->setRootIsDecorated( false );
111 statusWidget = new StatusWidget( wrapperBox ); 113 statusWidget = new StatusWidget( wrapperBox );
112 statusWidget->hide(); 114 statusWidget->hide();
113 115
114 //layout->addWidget( mailView ); 116 //layout->addWidget( mailView );
115 //layout->setStretchFactor( folderView, 1 ); 117 //layout->setStretchFactor( folderView, 1 );
116 //layout->setStretchFactor( mailView, 2 ); 118 //layout->setStretchFactor( mailView, 2 );
117 119
118 slotAdjustLayout(); 120 slotAdjustLayout();
119#ifndef DESKTOP_VERSION 121#ifndef DESKTOP_VERSION
120 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 122 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
121 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 123 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
122#endif 124#endif
123 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 125 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
124 SLOT( mailLeftClicked(QListViewItem*) ) ); 126 SLOT( mailLeftClicked(QListViewItem*) ) );
125 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 127 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
126 SLOT( mailLeftClicked(QListViewItem*) ) ); 128 SLOT( mailLeftClicked(QListViewItem*) ) );
127 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 129 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
128 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 130 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h
index d6dc6cc..f5b81aa 100644
--- a/kmicromail/mainwindow.h
+++ b/kmicromail/mainwindow.h
@@ -1,59 +1,61 @@
1
2// CHANGED 2004-08-06 Lutz Rogowski
1#ifndef MAINWINDOW_H 3#ifndef MAINWINDOW_H
2#define MAINWINDOW_H 4#define MAINWINDOW_H
3 5
4#include <qmainwindow.h> 6#include <qmainwindow.h>
5#include <qlistview.h> 7#include <qlistview.h>
6#include <qaction.h> 8#include <qaction.h>
7 9
8#include <qtoolbar.h> 10#include <qtoolbar.h>
9#include <qmenubar.h> 11#include <qmenubar.h>
10 12
11#include "accountview.h" 13#include "accountview.h"
12#include "statuswidget.h" 14#include "statuswidget.h"
13 15
14#include <libmailwrapper/mailtypes.h> 16#include <libmailwrapper/mailtypes.h>
15#include <opie2/osmartpointer.h> 17#include <opie2/osmartpointer.h>
16 18
17class RecMail; 19class RecMail;
18 20
19class MainWindow : public QMainWindow 21class MainWindow : public QMainWindow
20{ 22{
21 Q_OBJECT 23 Q_OBJECT
22 24
23public: 25public:
24 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 26 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
25 virtual ~MainWindow(); 27 virtual ~MainWindow();
26 28
27public slots: 29public slots:
28 virtual void slotAdjustColumns(); 30 virtual void slotAdjustColumns();
29 virtual void appMessage(const QCString &msg, const QByteArray &data); 31 virtual void appMessage(const QCString &msg, const QByteArray &data);
30 virtual void slotComposeMail(); 32 virtual void slotComposeMail();
31 33
32protected slots: 34protected slots:
33 virtual void slotSendQueued(); 35 virtual void slotSendQueued();
34 virtual void slotEditAccounts(); 36 virtual void slotEditAccounts();
35 virtual void slotShowFolders( bool show ); 37 virtual void slotShowFolders( bool show );
36 virtual void refreshMailView(const QValueList<RecMailP>&); 38 virtual void refreshMailView(const QValueList<RecMailP>&);
37 virtual void displayMail(); 39 virtual void displayMail();
38 virtual void slotDeleteMail(); 40 virtual void slotDeleteMail();
39 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 41 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
40 virtual void slotAdjustLayout(); 42 virtual void slotAdjustLayout();
41 virtual void slotEditSettings(); 43 virtual void slotEditSettings();
42 virtual void mailLeftClicked( QListViewItem * ); 44 virtual void mailLeftClicked( QListViewItem * );
43 void showLicence(); 45 void showLicence();
44 void showAbout(); 46 void showAbout();
45 void showEtpanLicence(); 47 void showEtpanLicence();
46 48
47protected: 49protected:
48 QToolBar *toolBar; 50 QToolBar *toolBar;
49 StatusWidget *statusWidget; 51 StatusWidget *statusWidget;
50 QMenuBar *menuBar; 52 QMenuBar *menuBar;
51 QPopupMenu *mailMenu, *settingsMenu; 53 QPopupMenu *mailMenu, *settingsMenu;
52 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, 54 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
53 *editSettings, *editAccounts, *syncFolders; 55 *editSettings, *editAccounts, *syncFolders;
54 AccountView *folderView; 56 AccountView *folderView;
55 QListView *mailView; 57 QListView *mailView;
56 //QBoxLayout *layout; 58 //QBoxLayout *layout;
57}; 59};
58 60
59#endif 61#endif
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 70fbcb2..d522ad0 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,128 +1,129 @@
1// CHANGED 2004-08-06 Lutz Rogowski
1 2
2#include "settingsdialog.h" 3#include "settingsdialog.h"
3#include "opiemail.h" 4#include "opiemail.h"
4#include "editaccounts.h" 5#include "editaccounts.h"
5#include "composemail.h" 6#include "composemail.h"
6#include "mailistviewitem.h" 7#include "mailistviewitem.h"
7#include "viewmail.h" 8#include "viewmail.h"
8#include "selectstore.h" 9#include "selectstore.h"
9#include "selectsmtp.h" 10#include "selectsmtp.h"
10 11
11#include <qmessagebox.h> 12#include <qmessagebox.h>
12 13
13#include <qpe/qpeapplication.h> 14#include <qpe/qpeapplication.h>
14#include <libmailwrapper/smtpwrapper.h> 15#include <libmailwrapper/smtpwrapper.h>
15#include <libmailwrapper/mailtypes.h> 16#include <libmailwrapper/mailtypes.h>
16#include <libmailwrapper/abstractmail.h> 17#include <libmailwrapper/abstractmail.h>
17/* OPIE */ 18/* OPIE */
18//#include <qpe/resource.h> 19//#include <qpe/resource.h>
19#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
20 21
21/* QT */ 22/* QT */
22 23
23using namespace Opie::Core; 24using namespace Opie::Core;
24 25
25OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) 26OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
26 : MainWindow( parent, name) //, WStyle_ContextHelp ) 27 : MainWindow( parent, name) //, WStyle_ContextHelp )
27{ 28{
28 settings = new Settings(); 29 settings = new Settings();
29 30
30 folderView->populate( settings->getAccounts() ); 31 folderView->populate( settings->getAccounts() );
31 32
32} 33}
33 34
34OpieMail::~OpieMail() 35OpieMail::~OpieMail()
35{ 36{
36 if (settings) delete settings; 37 if (settings) delete settings;
37} 38}
38 39
39void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 40void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
40{ 41{
41 42
42} 43}
43#include <stdlib.h> 44#include <stdlib.h>
44void OpieMail::message(const QCString &msg, const QByteArray &data) 45void OpieMail::message(const QCString &msg, const QByteArray &data)
45{ 46{
46 // copied from old mail2 47 // copied from old mail2
47 static int ii = 0; 48 static int ii = 0;
48 49
49 // block second call 50 // block second call
50 if ( ii < 2 ) { 51 if ( ii < 2 ) {
51 ++ii; 52 ++ii;
52 if ( ii > 1 ) { 53 if ( ii > 1 ) {
53 qDebug("qcop call blocked "); 54 qDebug("qcop call blocked ");
54 return; 55 return;
55 } 56 }
56 } 57 }
57 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 58 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
58 if (msg == "writeMail(QString,QString)") 59 if (msg == "writeMail(QString,QString)")
59 { 60 {
60 QDataStream stream(data,IO_ReadOnly); 61 QDataStream stream(data,IO_ReadOnly);
61 QString name, email; 62 QString name, email;
62 stream >> name >> email; 63 stream >> name >> email;
63 // removing the whitespaces at beginning and end is needed! 64 // removing the whitespaces at beginning and end is needed!
64 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); 65 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace());
65 } 66 }
66 else if (msg == "newMail()") 67 else if (msg == "newMail()")
67 { 68 {
68 slotComposeMail(); 69 slotComposeMail();
69 } 70 }
70 else if (msg == "newMail(QString)") 71 else if (msg == "newMail(QString)")
71 { 72 {
72 QDataStream stream(data,IO_ReadOnly); 73 QDataStream stream(data,IO_ReadOnly);
73 QString nameemail; 74 QString nameemail;
74 stream >> nameemail; 75 stream >> nameemail;
75 // the format is 76 // the format is
76 // NAME <EMAIL>:SUBJECT 77 // NAME <EMAIL>:SUBJECT
77 //qDebug("message %s ", nameemail.latin1()); 78 //qDebug("message %s ", nameemail.latin1());
78 79
79 slotwriteMail2( nameemail ); 80 slotwriteMail2( nameemail );
80 } 81 }
81} 82}
82void OpieMail::slotwriteMail2(const QString& namemail ) 83void OpieMail::slotwriteMail2(const QString& namemail )
83{ 84{
84 // qDebug("OpieMail::slotwriteMail2 "); 85 // qDebug("OpieMail::slotwriteMail2 ");
85 qApp->processEvents(); 86 qApp->processEvents();
86 ComposeMail compose( settings, this, 0, true ); 87 ComposeMail compose( settings, this, 0, true );
87 if ( !namemail.isEmpty() ) { 88 if ( !namemail.isEmpty() ) {
88 QString to = namemail; 89 QString to = namemail;
89 if ( namemail.find( " <") > 1 ) { 90 if ( namemail.find( " <") > 1 ) {
90 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 91 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
91 } else 92 } else
92 if ( namemail.find( "<") > 1 ) { 93 if ( namemail.find( "<") > 1 ) {
93 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 94 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
94 } 95 }
95 int sub = to.find( ">:"); 96 int sub = to.find( ">:");
96 if ( sub > 0 ) { 97 if ( sub > 0 ) {
97 compose.setTo( to.left(sub+1) ); 98 compose.setTo( to.left(sub+1) );
98 compose.setSubject( to.mid(sub+2) ); 99 compose.setSubject( to.mid(sub+2) );
99 } else 100 } else
100 compose.setTo( to ); 101 compose.setTo( to );
101 } 102 }
102 compose.slotAdjustColumns(); 103 compose.slotAdjustColumns();
103 compose.showMaximized(); 104 compose.showMaximized();
104 compose.exec(); 105 compose.exec();
105 //qDebug("retttich "); 106 //qDebug("retttich ");
106} 107}
107void OpieMail::slotwriteMail(const QString&name,const QString&email) 108void OpieMail::slotwriteMail(const QString&name,const QString&email)
108{ 109{
109 // qDebug("OpieMail::slotwriteMail "); 110 // qDebug("OpieMail::slotwriteMail ");
110 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); 111 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
111 if (!email.isEmpty()) 112 if (!email.isEmpty())
112 { 113 {
113 if (!name.isEmpty()) 114 if (!name.isEmpty())
114 { 115 {
115 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 116 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
116 } 117 }
117 else 118 else
118 { 119 {
119 compose.setTo(email); 120 compose.setTo(email);
120 } 121 }
121 } 122 }
122 compose.slotAdjustColumns(); 123 compose.slotAdjustColumns();
123 compose.showMaximized(); 124 compose.showMaximized();
124 compose.exec(); 125 compose.exec();
125} 126}
126 127
127void OpieMail::slotComposeMail() 128void OpieMail::slotComposeMail()
128{ 129{
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 703711d..67b77f8 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -1,128 +1,129 @@
1// CHANGED 2004-08-06 Lutz Rogowski
1#include "composemail.h" 2#include "composemail.h"
2#include "viewmail.h" 3#include "viewmail.h"
3 4
4#include <libmailwrapper/settings.h> 5#include <libmailwrapper/settings.h>
5#include <libmailwrapper/abstractmail.h> 6#include <libmailwrapper/abstractmail.h>
6#include <libmailwrapper/mailtypes.h> 7#include <libmailwrapper/mailtypes.h>
7#include <kapplication.h> 8#include <kapplication.h>
8 9
9/* OPIE */ 10/* OPIE */
10//#include <opie2/odebug.h> 11//#include <opie2/odebug.h>
11//#include <opie2/ofiledialog.h> 12//#include <opie2/ofiledialog.h>
12//#include <opie2/oimagescrollview.h> 13//#include <opie2/oimagescrollview.h>
13 14
14#include <kfiledialog.h> 15#include <kfiledialog.h>
15#include <kdialog.h> 16#include <kdialog.h>
16 17
17#include <qpe/config.h> 18#include <qpe/config.h>
18#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
19 20
20/* QT */ 21/* QT */
21#include <qtextbrowser.h> 22#include <qtextbrowser.h>
22#include <qmessagebox.h> 23#include <qmessagebox.h>
23#include <qtextstream.h> 24#include <qtextstream.h>
24#include <qaction.h> 25#include <qaction.h>
25#include <qpopupmenu.h> 26#include <qpopupmenu.h>
26#include <qfile.h> 27#include <qfile.h>
27#include <qlayout.h> 28#include <qlayout.h>
28 29
29//using namespace Opie::Ui; 30//using namespace Opie::Ui;
30//using namespace Opie::Core; 31//using namespace Opie::Core;
31 32
32AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 33AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
33 const QString&fsize,int num,const QValueList<int>&path) 34 const QString&fsize,int num,const QValueList<int>&path)
34 : QListViewItem(parent,after),_partNum(num) 35 : QListViewItem(parent,after),_partNum(num)
35{ 36{
36 _path=path; 37 _path=path;
37 setText(0, mime); 38 setText(0, mime);
38 setText(1, desc); 39 setText(1, desc);
39 setText(2, file); 40 setText(2, file);
40 setText(3, fsize); 41 setText(3, fsize);
41} 42}
42 43
43AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 44AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
44 const QString&fsize,int num,const QValueList<int>&path) 45 const QString&fsize,int num,const QValueList<int>&path)
45 : QListViewItem(parent,after),_partNum(num) 46 : QListViewItem(parent,after),_partNum(num)
46{ 47{
47 _path=path; 48 _path=path;
48 setText(0, mime); 49 setText(0, mime);
49 setText(1, desc); 50 setText(1, desc);
50 setText(2, file); 51 setText(2, file);
51 setText(3, fsize); 52 setText(3, fsize);
52} 53}
53 54
54bool AttachItem::isParentof(const QValueList<int>&path) 55bool AttachItem::isParentof(const QValueList<int>&path)
55{ 56{
56 /* if not set, then no parent */ 57 /* if not set, then no parent */
57 if (path.count()==0||_path.count()==0) return false; 58 if (path.count()==0||_path.count()==0) return false;
58 /* the parent must have one digit less then a child */ 59 /* the parent must have one digit less then a child */
59 if (path.count()!=_path.count()+1) return false; 60 if (path.count()!=_path.count()+1) return false;
60 for (unsigned int i=0; i < _path.count();++i) 61 for (unsigned int i=0; i < _path.count();++i)
61 { 62 {
62 if (_path[i]!=path[i]) return false; 63 if (_path[i]!=path[i]) return false;
63 } 64 }
64 return true; 65 return true;
65} 66}
66 67
67AttachItem* ViewMail::searchParent(const QValueList<int>&path) 68AttachItem* ViewMail::searchParent(const QValueList<int>&path)
68{ 69{
69 QListViewItemIterator it( attachments ); 70 QListViewItemIterator it( attachments );
70 for ( ; it.current(); ++it ) 71 for ( ; it.current(); ++it )
71 { 72 {
72 AttachItem*ati = (AttachItem*)it.current(); 73 AttachItem*ati = (AttachItem*)it.current();
73 if (ati->isParentof(path)) return ati; 74 if (ati->isParentof(path)) return ati;
74 } 75 }
75 return 0; 76 return 0;
76} 77}
77 78
78AttachItem* ViewMail::lastChild(AttachItem*parent) 79AttachItem* ViewMail::lastChild(AttachItem*parent)
79{ 80{
80 if (!parent) return 0; 81 if (!parent) return 0;
81 AttachItem* item = (AttachItem*)parent->firstChild(); 82 AttachItem* item = (AttachItem*)parent->firstChild();
82 if (!item) return item; 83 if (!item) return item;
83 AttachItem*temp=0; 84 AttachItem*temp=0;
84 while( (temp=(AttachItem*)item->nextSibling())) 85 while( (temp=(AttachItem*)item->nextSibling()))
85 { 86 {
86 item = temp; 87 item = temp;
87 } 88 }
88 return item; 89 return item;
89} 90}
90 91
91void ViewMail::setBody(const RecBodyP&body ) 92void ViewMail::setBody(const RecBodyP&body )
92{ 93{
93 94
94 m_body = body; 95 m_body = body;
95 m_mail[2] = body->Bodytext(); 96 m_mail[2] = body->Bodytext();
96 attachbutton->setEnabled(body->Parts().count()>0); 97 attachbutton->setEnabled(body->Parts().count()>0);
97 attachments->setEnabled(body->Parts().count()>0); 98 attachments->setEnabled(body->Parts().count()>0);
98 if (body->Parts().count()==0) 99 if (body->Parts().count()==0)
99 { 100 {
100 return; 101 return;
101 } 102 }
102 AttachItem * curItem=0; 103 AttachItem * curItem=0;
103 AttachItem * parentItem = 0; 104 AttachItem * parentItem = 0;
104 QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); 105 QString type=body->Description()->Type()+"/"+body->Description()->Subtype();
105 QString desc,fsize; 106 QString desc,fsize;
106 double s = body->Description()->Size(); 107 double s = body->Description()->Size();
107 int w; 108 int w;
108 w=0; 109 w=0;
109 110
110 while (s>1024) 111 while (s>1024)
111 { 112 {
112 s/=1024; 113 s/=1024;
113 ++w; 114 ++w;
114 if (w>=2) break; 115 if (w>=2) break;
115 } 116 }
116 117
117 QString q=""; 118 QString q="";
118 switch(w) 119 switch(w)
119 { 120 {
120 case 1: 121 case 1:
121 q="k"; 122 q="k";
122 break; 123 break;
123 case 2: 124 case 2:
124 q="M"; 125 q="M";
125 break; 126 break;
126 default: 127 default:
127 break; 128 break;
128 } 129 }
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp
index 584a0ac..705b57f 100644
--- a/kmicromail/viewmailbase.cpp
+++ b/kmicromail/viewmailbase.cpp
@@ -1,91 +1,92 @@
1// CHANGED 2004-08-06 Lutz Rogowski
1#include <qtextbrowser.h> 2#include <qtextbrowser.h>
2#include <qlistview.h> 3#include <qlistview.h>
3#include <qaction.h> 4#include <qaction.h>
4#include <qlabel.h> 5#include <qlabel.h>
5#include <qvbox.h> 6#include <qvbox.h>
6 7
7#include <qtoolbar.h> 8#include <qtoolbar.h>
8#include <qmenubar.h> 9#include <qmenubar.h>
9#include <kiconloader.h> 10#include <kiconloader.h>
10//#include <qpe/resource.h> 11//#include <qpe/resource.h>
11 12
12#include "viewmailbase.h" 13#include "viewmailbase.h"
13//#include "opendiag.h" 14//#include "opendiag.h"
14 15
15ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) 16ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
16 : QMainWindow(parent, name, fl) 17 : QMainWindow(parent, name, fl)
17{ 18{
18 19
19 setToolBarsMovable(false); 20 setToolBarsMovable(false);
20 21
21 toolbar = new QToolBar(this); 22 toolbar = new QToolBar(this);
22 menubar = new QMenuBar( toolbar ); 23 menubar = new QMenuBar( toolbar );
23 mailmenu = new QPopupMenu( menubar ); 24 mailmenu = new QPopupMenu( menubar );
24 menubar->insertItem( tr( "Mail" ), mailmenu ); 25 menubar->insertItem( tr( "Mail" ), mailmenu );
25 26
26 toolbar->setHorizontalStretchable(true); 27 toolbar->setHorizontalStretchable(true);
27 addToolBar(toolbar); 28 addToolBar(toolbar);
28 29
29 reply = new QAction(tr("Reply"),SmallIcon("reply"), 0, 0, this); 30 reply = new QAction(tr("Reply"),SmallIcon("reply"), 0, 0, this);
30 reply->addTo(toolbar); 31 reply->addTo(toolbar);
31 reply->addTo(mailmenu); 32 reply->addTo(mailmenu);
32 33
33 forward = new QAction(tr("Forward"),SmallIcon("forward"), 0, 0, this); 34 forward = new QAction(tr("Forward"),SmallIcon("forward"), 0, 0, this);
34 forward->addTo(toolbar); 35 forward->addTo(toolbar);
35 forward->addTo(mailmenu); 36 forward->addTo(mailmenu);
36 37
37 attachbutton = new QAction(tr("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); 38 attachbutton = new QAction(tr("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true);
38 attachbutton->addTo(toolbar); 39 attachbutton->addTo(toolbar);
39 attachbutton->addTo(mailmenu); 40 attachbutton->addTo(mailmenu);
40 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); 41 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
41 42
42 43
43 showHtml = new QAction( tr( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); 44 showHtml = new QAction( tr( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true );
44 showHtml->addTo( toolbar ); 45 showHtml->addTo( toolbar );
45 showHtml->addTo( mailmenu ); 46 showHtml->addTo( mailmenu );
46 47
47 deleteMail = new QAction(tr("Delete Mail"),SmallIcon("trash"), 0, 0, this); 48 deleteMail = new QAction(tr("Delete Mail"),SmallIcon("trash"), 0, 0, this);
48 deleteMail->addTo(toolbar); 49 deleteMail->addTo(toolbar);
49 deleteMail->addTo(mailmenu); 50 deleteMail->addTo(mailmenu);
50 closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); 51 closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this);
51 QLabel *spacer = new QLabel(toolbar); 52 QLabel *spacer = new QLabel(toolbar);
52 spacer->setBackgroundMode(QWidget::PaletteButton); 53 spacer->setBackgroundMode(QWidget::PaletteButton);
53 toolbar->setStretchableWidget(spacer); 54 toolbar->setStretchableWidget(spacer);
54 closeMail->addTo(toolbar); 55 closeMail->addTo(toolbar);
55 closeMail->addTo(mailmenu); 56 closeMail->addTo(mailmenu);
56 QVBox *view = new QVBox(this); 57 QVBox *view = new QVBox(this);
57 setCentralWidget(view); 58 setCentralWidget(view);
58 59
59 attachments = new QListView(view); 60 attachments = new QListView(view);
60 attachments->setMinimumHeight(90); 61 attachments->setMinimumHeight(90);
61 attachments->setMaximumHeight(90); 62 attachments->setMaximumHeight(90);
62 attachments->setAllColumnsShowFocus(true); 63 attachments->setAllColumnsShowFocus(true);
63 attachments->addColumn("Mime Type", 60); 64 attachments->addColumn("Mime Type", 60);
64 attachments->addColumn(tr("Description"), 100); 65 attachments->addColumn(tr("Description"), 100);
65 attachments->addColumn(tr("Filename"), 80); 66 attachments->addColumn(tr("Filename"), 80);
66 attachments->addColumn(tr("Size"), 80); 67 attachments->addColumn(tr("Size"), 80);
67 attachments->setSorting(-1); 68 attachments->setSorting(-1);
68 attachments->hide(); 69 attachments->hide();
69 70
70 browser = new QTextBrowser(view); 71 browser = new QTextBrowser(view);
71 72
72 //openDiag = new OpenDiag(view); 73 //openDiag = new OpenDiag(view);
73 //openDiag->hide(); 74 //openDiag->hide();
74 75
75} 76}
76 77
77void ViewMailBase::slotChangeAttachview(bool state) 78void ViewMailBase::slotChangeAttachview(bool state)
78{ 79{
79 if (state) attachments->show(); 80 if (state) attachments->show();
80 else attachments->hide(); 81 else attachments->hide();
81} 82}
82 83
83void ViewMailBase::keyPressEvent ( QKeyEvent * e ) 84void ViewMailBase::keyPressEvent ( QKeyEvent * e )
84{ 85{
85 if( e->key()==Qt::Key_Escape ) { 86 if( e->key()==Qt::Key_Escape ) {
86 close(); 87 close();
87 e->accept(); 88 e->accept();
88 return; 89 return;
89 } 90 }
90 QWidget::keyPressEvent(e); 91 QWidget::keyPressEvent(e);
91} 92}
diff --git a/kmicromail/viewmailbase.h b/kmicromail/viewmailbase.h
index c29d143..1c8948a 100644
--- a/kmicromail/viewmailbase.h
+++ b/kmicromail/viewmailbase.h
@@ -1,38 +1,39 @@
1// CHANGED 2004-08-06 Lutz Rogowski
1#ifndef VIEWMAILBASE_H 2#ifndef VIEWMAILBASE_H
2#define VIEWMAILBASE_H 3#define VIEWMAILBASE_H
3 4
4#include <qmainwindow.h> 5#include <qmainwindow.h>
5 6
6class QAction; 7class QAction;
7class OpenDiag; 8class OpenDiag;
8class QListView; 9class QListView;
9class QToolBar; 10class QToolBar;
10class QTextBrowser; 11class QTextBrowser;
11class QMenuBar; 12class QMenuBar;
12class QPopupMenu; 13class QPopupMenu;
13 14
14class ViewMailBase : public QMainWindow 15class ViewMailBase : public QMainWindow
15{ 16{
16 Q_OBJECT 17 Q_OBJECT
17 18
18public: 19public:
19 ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 20 ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
20 21
21protected: 22protected:
22 QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail; 23 QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail;
23 QListView *attachments; 24 QListView *attachments;
24 QToolBar *toolbar; 25 QToolBar *toolbar;
25 QTextBrowser *browser; 26 QTextBrowser *browser;
26 OpenDiag *openDiag; 27 OpenDiag *openDiag;
27 QMenuBar *menubar; 28 QMenuBar *menubar;
28 QPopupMenu *mailmenu; 29 QPopupMenu *mailmenu;
29 30
30protected slots: 31protected slots:
31 void slotChangeAttachview(bool state); 32 void slotChangeAttachview(bool state);
32 virtual void keyPressEvent ( QKeyEvent * e ); 33 virtual void keyPressEvent ( QKeyEvent * e );
33 34
34 35
35}; 36};
36 37
37#endif 38#endif
38 39