summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-07 22:51:36 (UTC)
committer zautrix <zautrix>2004-10-07 22:51:36 (UTC)
commit9f1b282aa2a72f3118a89dfebbc3c8132197213a (patch) (unidiff)
treeedb795e1dfbc0a192a692a43a4369c84526201dd
parent21ec296f7f2832920dac336bb9f9476c80d746f5 (diff)
downloadkdepimpi-9f1b282aa2a72f3118a89dfebbc3c8132197213a.zip
kdepimpi-9f1b282aa2a72f3118a89dfebbc3c8132197213a.tar.gz
kdepimpi-9f1b282aa2a72f3118a89dfebbc3c8132197213a.tar.bz2
ompi fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index e6f7daa..946e97d 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -27,192 +27,197 @@
27#include <qlistview.h> 27#include <qlistview.h>
28#include <kabc/addresseedialog.h> 28#include <kabc/addresseedialog.h>
29#include <kabc/stdaddressbook.h> 29#include <kabc/stdaddressbook.h>
30#include <kabc/addressee.h> 30#include <kabc/addressee.h>
31#ifdef DESKTOP_VERSION 31#ifdef DESKTOP_VERSION
32#include <kabc/addresseedialog.h> 32#include <kabc/addresseedialog.h>
33#else //DESKTOP_VERSION 33#else //DESKTOP_VERSION
34#include <libkdepim/externalapphandler.h> 34#include <libkdepim/externalapphandler.h>
35#endif //DESKTOP_VERSION 35#endif //DESKTOP_VERSION
36 36
37#include "koprefs.h" 37#include "koprefs.h"
38 38
39//using namespace Opie::Core; 39//using namespace Opie::Core;
40//using namespace Opie::Ui; 40//using namespace Opie::Ui;
41ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) 41ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal )
42 : ComposeMailUI( parent, name, modal ) 42 : ComposeMailUI( parent, name, modal )
43{ 43{
44 mPickLineEdit = 0; 44 mPickLineEdit = 0;
45 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 45 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
46 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 46 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
47 settings = s; 47 settings = s;
48 m_replyid = ""; 48 m_replyid = "";
49 if ( KOPrefs::instance()->mUseKapi) { 49 if ( KOPrefs::instance()->mUseKapi) {
50 KConfig config( locateLocal("config", "kabcrc") ); 50 KConfig config( locateLocal("config", "kabcrc") );
51 config.setGroup( "General" ); 51 config.setGroup( "General" );
52 QString whoami_uid = config.readEntry( "WhoAmI" ); 52 QString whoami_uid = config.readEntry( "WhoAmI" );
53 53
54 if ( whoami_uid.isEmpty() ) { 54 if ( whoami_uid.isEmpty() ) {
55 QMessageBox::information( 0, tr( "Hint" ), 55 QMessageBox::information( 0, tr( "Hint" ),
56 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 56 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
57 tr( "Ok" ) ); 57 tr( "Ok" ) );
58 58
59 59
60 fillSettings(); 60 fillSettings();
61 } else 61 } else
62 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); 62 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
63 63
64 64
65#ifdef DESKTOP_VERSION 65#ifdef DESKTOP_VERSION
66 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 66 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
67 QStringList mails = con.emails(); 67 QStringList mails = con.emails();
68 QString defmail = con.preferredEmail(); 68 QString defmail = con.preferredEmail();
69 if ( mails.count() == 0) 69 if ( mails.count() == 0)
70 QMessageBox::information( 0, tr( "Hint" ), 70 QMessageBox::information( 0, tr( "Hint" ),
71 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 71 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
72 tr( "Ok" ) ); 72 tr( "Ok" ) );
73 if (defmail.length()!=0) { 73 if (defmail.length()!=0) {
74 fromBox->insertItem(defmail); 74 fromBox->insertItem(defmail);
75 } 75 }
76 QStringList::ConstIterator sit = mails.begin(); 76 QStringList::ConstIterator sit = mails.begin();
77 for (;sit!=mails.end();++sit) { 77 for (;sit!=mails.end();++sit) {
78 if ( (*sit)==defmail) 78 if ( (*sit)==defmail)
79 continue; 79 continue;
80 fromBox->insertItem((*sit)); 80 fromBox->insertItem((*sit));
81 } 81 }
82 senderNameEdit->setText(con.formattedName()); 82 senderNameEdit->setText(con.formattedName());
83#endif 83#endif
84 84
85 } else { 85 } else {
86 fillSettings(); 86 fillSettings();
87 } 87 }
88 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); 88 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
89 89
90 attList->addColumn( tr( "Name" ) ); 90 attList->addColumn( tr( "Name" ) );
91 attList->addColumn( tr( "Size" ) ); 91 attList->addColumn( tr( "Size" ) );
92 QList<Account> accounts = settings->getAccounts(); 92 QList<Account> accounts = settings->getAccounts();
93 93
94 if ( QApplication::desktop()->width() < 320 ) 94 if ( QApplication::desktop()->width() < 320 )
95 smtpAccountBox->setMaximumWidth( 80 ); 95 smtpAccountBox->setMaximumWidth( 80 );
96 Account *it; 96 Account *it;
97 for ( it = accounts.first(); it; it = accounts.next() ) { 97 for ( it = accounts.first(); it; it = accounts.next() ) {
98 if ( it->getType()==MAILLIB::A_SMTP ) { 98 if ( it->getType()==MAILLIB::A_SMTP ) {
99 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 99 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
100 smtpAccountBox->insertItem( smtp->getAccountName() ); 100 smtpAccountBox->insertItem( smtp->getAccountName() );
101 smtpAccounts.append( smtp ); 101 smtpAccounts.append( smtp );
102 } 102 }
103 } 103 }
104 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 104 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
105 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 105 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
106 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 106 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
107 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 107 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
108 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 108 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
109 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 109 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
110 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 110 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
111 mMail = 0; 111 mMail = 0;
112 warnAttach = true; 112 warnAttach = true;
113 if ( smtpAccounts.count() > 0 ) { 113 if ( smtpAccounts.count() > 0 ) {
114 fillValues( smtpAccountBox->currentItem() ); 114 fillValues( smtpAccountBox->currentItem() );
115 } else { 115 } else {
116 QMessageBox::information( 0, tr( "Problem" ), 116 QMessageBox::information( 0, tr( "Problem" ),
117 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), 117 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
118 tr( "Ok" ) ); 118 tr( "Ok" ) );
119 return; 119 return;
120 } 120 }
121 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 121 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
122 message->setFont ( KOPrefs::instance()->mComposeFont ); 122 message->setFont ( KOPrefs::instance()->mComposeFont );
123 message->setWordWrap (QMultiLineEdit::WidgetWidth);
124#ifndef DESKTOP_VERSION
125 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold );
126#endif
127
123} 128}
124 129
125void ComposeMail::fillSettings() 130void ComposeMail::fillSettings()
126{ 131{
127 if ( QApplication::desktop()->width() < 320 ) 132 if ( QApplication::desktop()->width() < 320 )
128 fromBox->setMaximumWidth( 100 ); 133 fromBox->setMaximumWidth( 100 );
129 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); 134 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
130 QStringList::ConstIterator sit = mailList.begin(); 135 QStringList::ConstIterator sit = mailList.begin();
131 int pref = 0; 136 int pref = 0;
132 for (;sit!=mailList.end();++sit) { 137 for (;sit!=mailList.end();++sit) {
133 fromBox->insertItem((*sit)); 138 fromBox->insertItem((*sit));
134 } 139 }
135 senderNameEdit->setText(KOPrefs::instance()->mName); 140 senderNameEdit->setText(KOPrefs::instance()->mName);
136} 141}
137 142
138 143
139void ComposeMail::saveAsDraft() 144void ComposeMail::saveAsDraft()
140{ 145{
141 146
142 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 147 Opie::Core::OSmartPointer<Mail> mail= new Mail();
143 mail->setMail(fromBox->currentText()); 148 mail->setMail(fromBox->currentText());
144 mail->setTo( toLine->text() ); 149 mail->setTo( toLine->text() );
145 mail->setName(senderNameEdit->text()); 150 mail->setName(senderNameEdit->text());
146 mail->setCC( ccLine->text() ); 151 mail->setCC( ccLine->text() );
147 mail->setBCC( bccLine->text() ); 152 mail->setBCC( bccLine->text() );
148 mail->setReply( replyLine->text() ); 153 mail->setReply( replyLine->text() );
149 mail->setSubject( subjectLine->text() ); 154 mail->setSubject( subjectLine->text() );
150 if (!m_replyid.isEmpty()) { 155 if (!m_replyid.isEmpty()) {
151 QStringList ids; 156 QStringList ids;
152 ids.append(m_replyid); 157 ids.append(m_replyid);
153 mail->setInreply(ids); 158 mail->setInreply(ids);
154 } 159 }
155 QString txt = message->text(); 160 QString txt = message->text();
156 if ( !sigMultiLine->text().isEmpty() ) { 161 if ( !sigMultiLine->text().isEmpty() ) {
157 txt.append( "\n--\n" ); 162 txt.append( "\n--\n" );
158 txt.append( sigMultiLine->text() ); 163 txt.append( sigMultiLine->text() );
159 } 164 }
160 mail->setMessage( txt ); 165 mail->setMessage( txt );
161 166
162 /* only use the default drafts folder name! */ 167 /* only use the default drafts folder name! */
163 Storemail wrapper(AbstractMail::draftFolder()); 168 Storemail wrapper(AbstractMail::draftFolder());
164 wrapper.storeMail(mail); 169 wrapper.storeMail(mail);
165 170
166 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 171 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
167 /* attachments we will ignore! */ 172 /* attachments we will ignore! */
168 if ( it != 0 ) { 173 if ( it != 0 ) {
169 if ( warnAttach ) 174 if ( warnAttach )
170 QMessageBox::warning(0,tr("Store message"), 175 QMessageBox::warning(0,tr("Store message"),
171 tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); 176 tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
172 warnAttach = false; 177 warnAttach = false;
173 } 178 }
174 setStatus( tr("Mail saved as draft!") ); 179 setStatus( tr("Mail saved as draft!") );
175} 180}
176void ComposeMail::clearStatus() 181void ComposeMail::clearStatus()
177{ 182{
178 topLevelWidget()->setCaption( tr("Compose mail") ); 183 topLevelWidget()->setCaption( tr("Compose mail") );
179} 184}
180void ComposeMail::setStatus( QString status ) 185void ComposeMail::setStatus( QString status )
181{ 186{
182 topLevelWidget()->setCaption( status ); 187 topLevelWidget()->setCaption( status );
183 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; 188 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
184} 189}
185void ComposeMail::pickAddress( ) 190void ComposeMail::pickAddress( )
186{ 191{
187 192
188 QLineEdit *line = mPickLineEdit; 193 QLineEdit *line = mPickLineEdit;
189 if ( line == 0 ) 194 if ( line == 0 )
190 return; 195 return;
191#ifdef DESKTOP_VERSION 196#ifdef DESKTOP_VERSION
192 //qDebug(" ComposeMail::pickAddress "); 197 //qDebug(" ComposeMail::pickAddress ");
193 QString names ;//= AddressPicker::getNames(); 198 QString names ;//= AddressPicker::getNames();
194 199
195 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 200 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
196 uint i=0; 201 uint i=0;
197 for (i=0; i < list.count(); i++) { 202 for (i=0; i < list.count(); i++) {
198 if ( !list[i].preferredEmail().isEmpty()) { 203 if ( !list[i].preferredEmail().isEmpty()) {
199 if ( ! names.isEmpty() ) 204 if ( ! names.isEmpty() )
200 names+= ","; 205 names+= ",";
201 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 206 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
202 207
203 } 208 }
204 } 209 }
205 210
206 211
207 if ( line->text().isEmpty() ) { 212 if ( line->text().isEmpty() ) {
208 line->setText( names ); 213 line->setText( names );
209 } else if ( !names.isEmpty() ) { 214 } else if ( !names.isEmpty() ) {
210 line->setText( line->text() + ", " + names ); 215 line->setText( line->text() + ", " + names );
211 } 216 }
212#else 217#else
213 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); 218 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
214 // the result should now arrive through method insertAttendees 219 // the result should now arrive through method insertAttendees
215#endif 220#endif
216} 221}
217//the map includes name/email pairs, that comes from Ka/Pi 222//the map includes name/email pairs, that comes from Ka/Pi
218void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 223void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)