summaryrefslogtreecommitdiffabout
path: root/kmicromail/composemail.cpp
Unidiff
Diffstat (limited to 'kmicromail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 35ad367..5f7a76f 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,44 +1,45 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3#include "composemail.h" 3#include "composemail.h"
4 4
5#include <libmailwrapper/smtpwrapper.h> 5#include <libmailwrapper/smtpwrapper.h>
6#include <libmailwrapper/storemail.h> 6#include <libmailwrapper/storemail.h>
7#include <libmailwrapper/abstractmail.h> 7#include <libmailwrapper/abstractmail.h>
8#include <libmailwrapper/mailtypes.h> 8#include <libmailwrapper/mailtypes.h>
9 9
10/* OPIE */ 10/* OPIE */
11//#include <opie2/ofiledialog.h> 11//#include <opie2/ofiledialog.h>
12//#include <opie2/odebug.h> 12//#include <opie2/odebug.h>
13#include <kfiledialog.h> 13#include <kfiledialog.h>
14//#include <qpe/resource.h> 14//#include <qpe/resource.h>
15#include <qpe/global.h> 15#include <qpe/global.h>
16//#include <qpe/contact.h> 16//#include <qpe/contact.h>
17 17
18 18
19#include <qcombobox.h> 19#include <qcombobox.h>
20#include <qcheckbox.h> 20#include <qcheckbox.h>
21#include <qiconset.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#ifdef DESKTOP_VERSION 32#ifdef DESKTOP_VERSION
32#include <kabc/addresseedialog.h> 33#include <kabc/addresseedialog.h>
33#else //DESKTOP_VERSION 34#else //DESKTOP_VERSION
34#include <libkdepim/externalapphandler.h> 35#include <libkdepim/externalapphandler.h>
35#endif //DESKTOP_VERSION 36#endif //DESKTOP_VERSION
36 37
37#include "koprefs.h" 38#include "koprefs.h"
38 39
39//using namespace Opie::Core; 40//using namespace Opie::Core;
40//using namespace Opie::Ui; 41//using namespace Opie::Ui;
41ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) 42ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal )
42 : ComposeMailUI( parent, name, modal ) 43 : ComposeMailUI( parent, name, modal )
43{ 44{
44 mPickLineEdit = 0; 45 mPickLineEdit = 0;
@@ -89,62 +90,75 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
89 90
90 attList->addColumn( i18n( "Name" ) ); 91 attList->addColumn( i18n( "Name" ) );
91 attList->addColumn( i18n( "Size" ) ); 92 attList->addColumn( i18n( "Size" ) );
92 QList<Account> accounts = settings->getAccounts(); 93 QList<Account> accounts = settings->getAccounts();
93 94
94 if ( QApplication::desktop()->width() < 320 ) 95 if ( QApplication::desktop()->width() < 320 )
95 smtpAccountBox->setMaximumWidth( 80 ); 96 smtpAccountBox->setMaximumWidth( 80 );
96 Account *it; 97 Account *it;
97 for ( it = accounts.first(); it; it = accounts.next() ) { 98 for ( it = accounts.first(); it; it = accounts.next() ) {
98 if ( it->getType()==MAILLIB::A_SMTP ) { 99 if ( it->getType()==MAILLIB::A_SMTP ) {
99 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 100 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
100 smtpAccountBox->insertItem( smtp->getAccountName() ); 101 smtpAccountBox->insertItem( smtp->getAccountName() );
101 smtpAccounts.append( smtp ); 102 smtpAccounts.append( smtp );
102 } 103 }
103 } 104 }
104 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 105 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
105 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 106 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
106 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 107 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
107 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 108 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
108 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 109 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
109 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 110 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
110 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 111 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
111 mMail = 0; 112 mMail = 0;
112 warnAttach = true; 113 warnAttach = true;
114 QIconSet icon;
115 //icon = SmallIcon("fileexport");
116 icon = SmallIcon("filesave");
117 SaveButton->setIconSet (icon ) ;
118 if ( QApplication::desktop()->width() < 320 ) {
119 SaveButton->setText ("") ;
120 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ;
121 }
122 else
123 SaveButton->setText (i18n("Save"));
124#ifndef DESKTOP_VERSION
125 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold );
126 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold );
127 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold );
128#endif
129 message->setFont ( KOPrefs::instance()->mComposeFont );
130 message->setWordWrap (QMultiLineEdit::WidgetWidth);
113 if ( smtpAccounts.count() > 0 ) { 131 if ( smtpAccounts.count() > 0 ) {
114 fillValues( smtpAccountBox->currentItem() ); 132 fillValues( smtpAccountBox->currentItem() );
115 } else { 133 } else {
116 QMessageBox::information( 0, i18n( "Problem" ), 134 QMessageBox::information( 0, i18n( "Problem" ),
117 i18n( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), 135 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ),
118 i18n( "Ok" ) ); 136 i18n( "Ok" ) );
119 return; 137 return;
120 } 138 }
121 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 139 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
122 message->setFont ( KOPrefs::instance()->mComposeFont ); 140
123 message->setWordWrap (QMultiLineEdit::WidgetWidth);
124#ifndef DESKTOP_VERSION
125 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold );
126#endif
127 141
128} 142}
129 143
130void ComposeMail::fillSettings() 144void ComposeMail::fillSettings()
131{ 145{
132 if ( QApplication::desktop()->width() < 320 ) 146 if ( QApplication::desktop()->width() < 320 )
133 fromBox->setMaximumWidth( 100 ); 147 fromBox->setMaximumWidth( 100 );
134 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); 148 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
135 QStringList::ConstIterator sit = mailList.begin(); 149 QStringList::ConstIterator sit = mailList.begin();
136 int pref = 0; 150 int pref = 0;
137 for (;sit!=mailList.end();++sit) { 151 for (;sit!=mailList.end();++sit) {
138 fromBox->insertItem((*sit)); 152 fromBox->insertItem((*sit));
139 } 153 }
140 senderNameEdit->setText(KOPrefs::instance()->mName); 154 senderNameEdit->setText(KOPrefs::instance()->mName);
141} 155}
142 156
143 157
144void ComposeMail::saveAsDraft() 158void ComposeMail::saveAsDraft()
145{ 159{
146 160
147 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 161 Opie::Core::OSmartPointer<Mail> mail= new Mail();
148 mail->setMail(fromBox->currentText()); 162 mail->setMail(fromBox->currentText());
149 mail->setTo( toLine->text() ); 163 mail->setTo( toLine->text() );
150 mail->setName(senderNameEdit->text()); 164 mail->setName(senderNameEdit->text());