summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-10-25 23:39:43 (UTC)
committer zautrix <zautrix>2004-10-25 23:39:43 (UTC)
commit7bf9517920766c9cd5e032af9cdd1e07d6604b6b (patch) (unidiff)
tree10ff3855615ba19505907be8ab2f0268f76f3ae1 /kmicromail
parente7c948b76a46c923c21f2f35c677912b462fa1f4 (diff)
downloadkdepimpi-7bf9517920766c9cd5e032af9cdd1e07d6604b6b.zip
kdepimpi-7bf9517920766c9cd5e032af9cdd1e07d6604b6b.tar.gz
kdepimpi-7bf9517920766c9cd5e032af9cdd1e07d6604b6b.tar.bz2
kopiemail fixes
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 5f7a76f..c504fdd 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -53,135 +53,132 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
53 QString whoami_uid = config.readEntry( "WhoAmI" ); 53 QString whoami_uid = config.readEntry( "WhoAmI" );
54 54
55 if ( whoami_uid.isEmpty() ) { 55 if ( whoami_uid.isEmpty() ) {
56 QMessageBox::information( 0, i18n( "Hint" ), 56 QMessageBox::information( 0, i18n( "Hint" ),
57 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 57 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
58 i18n( "Ok" ) ); 58 i18n( "Ok" ) );
59 59
60 60
61 fillSettings(); 61 fillSettings();
62 } else 62 } else
63 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); 63 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
64 64
65 65
66#ifdef DESKTOP_VERSION 66#ifdef DESKTOP_VERSION
67 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 67 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
68 QStringList mails = con.emails(); 68 QStringList mails = con.emails();
69 QString defmail = con.preferredEmail(); 69 QString defmail = con.preferredEmail();
70 if ( mails.count() == 0) 70 if ( mails.count() == 0)
71 QMessageBox::information( 0, i18n( "Hint" ), 71 QMessageBox::information( 0, i18n( "Hint" ),
72 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 72 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
73 i18n( "Ok" ) ); 73 i18n( "Ok" ) );
74 if (defmail.length()!=0) { 74 if (defmail.length()!=0) {
75 fromBox->insertItem(defmail); 75 fromBox->insertItem(defmail);
76 } 76 }
77 QStringList::ConstIterator sit = mails.begin(); 77 QStringList::ConstIterator sit = mails.begin();
78 for (;sit!=mails.end();++sit) { 78 for (;sit!=mails.end();++sit) {
79 if ( (*sit)==defmail) 79 if ( (*sit)==defmail)
80 continue; 80 continue;
81 fromBox->insertItem((*sit)); 81 fromBox->insertItem((*sit));
82 } 82 }
83 senderNameEdit->setText(con.formattedName()); 83 senderNameEdit->setText(con.formattedName());
84#endif 84#endif
85 85
86 } else { 86 } else {
87 fillSettings(); 87 fillSettings();
88 } 88 }
89 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); 89 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
90 90
91 attList->addColumn( i18n( "Name" ) ); 91 attList->addColumn( i18n( "Name" ) );
92 attList->addColumn( i18n( "Size" ) ); 92 attList->addColumn( i18n( "Size" ) );
93 QList<Account> accounts = settings->getAccounts(); 93 QList<Account> accounts = settings->getAccounts();
94 94
95 if ( QApplication::desktop()->width() < 320 ) 95 if ( QApplication::desktop()->width() < 320 )
96 smtpAccountBox->setMaximumWidth( 80 ); 96 smtpAccountBox->setMaximumWidth( 80 );
97 Account *it; 97 Account *it;
98 for ( it = accounts.first(); it; it = accounts.next() ) { 98 for ( it = accounts.first(); it; it = accounts.next() ) {
99 if ( it->getType()==MAILLIB::A_SMTP ) { 99 if ( it->getType()==MAILLIB::A_SMTP ) {
100 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 100 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
101 smtpAccountBox->insertItem( smtp->getAccountName() ); 101 smtpAccountBox->insertItem( smtp->getAccountName() );
102 smtpAccounts.append( smtp ); 102 smtpAccounts.append( smtp );
103 } 103 }
104 } 104 }
105 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 105 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
106 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 106 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
107 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 107 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
108 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 108 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
109 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 109 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
110 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 110 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
111 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 111 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
112 mMail = 0; 112 mMail = 0;
113 warnAttach = true; 113 warnAttach = true;
114 QIconSet icon; 114 QIconSet icon;
115 //icon = SmallIcon("fileexport"); 115 //icon = SmallIcon("fileexport");
116 icon = SmallIcon("filesave"); 116 icon = SmallIcon("filesave");
117
118 SaveButton->setText ("") ;
117 SaveButton->setIconSet (icon ) ; 119 SaveButton->setIconSet (icon ) ;
118 if ( QApplication::desktop()->width() < 320 ) { 120 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ;
119 SaveButton->setText ("") ;
120 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ;
121 }
122 else
123 SaveButton->setText (i18n("Save"));
124#ifndef DESKTOP_VERSION 121#ifndef DESKTOP_VERSION
125 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); 122 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold );
126 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); 123 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold );
127 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); 124 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold );
128#endif 125#endif
129 message->setFont ( KOPrefs::instance()->mComposeFont ); 126 message->setFont ( KOPrefs::instance()->mComposeFont );
130 message->setWordWrap (QMultiLineEdit::WidgetWidth); 127 message->setWordWrap (QMultiLineEdit::WidgetWidth);
131 if ( smtpAccounts.count() > 0 ) { 128 if ( smtpAccounts.count() > 0 ) {
132 fillValues( smtpAccountBox->currentItem() ); 129 fillValues( smtpAccountBox->currentItem() );
133 } else { 130 } else {
134 QMessageBox::information( 0, i18n( "Problem" ), 131 QMessageBox::information( 0, i18n( "Problem" ),
135 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), 132 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ),
136 i18n( "Ok" ) ); 133 i18n( "Ok" ) );
137 return; 134 return;
138 } 135 }
139 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 136 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
140 137
141 138
142} 139}
143 140
144void ComposeMail::fillSettings() 141void ComposeMail::fillSettings()
145{ 142{
146 if ( QApplication::desktop()->width() < 320 ) 143 if ( QApplication::desktop()->width() < 320 )
147 fromBox->setMaximumWidth( 100 ); 144 fromBox->setMaximumWidth( 100 );
148 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); 145 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
149 QStringList::ConstIterator sit = mailList.begin(); 146 QStringList::ConstIterator sit = mailList.begin();
150 int pref = 0; 147 int pref = 0;
151 for (;sit!=mailList.end();++sit) { 148 for (;sit!=mailList.end();++sit) {
152 fromBox->insertItem((*sit)); 149 fromBox->insertItem((*sit));
153 } 150 }
154 senderNameEdit->setText(KOPrefs::instance()->mName); 151 senderNameEdit->setText(KOPrefs::instance()->mName);
155} 152}
156 153
157 154
158void ComposeMail::saveAsDraft() 155void ComposeMail::saveAsDraft()
159{ 156{
160 157
161 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 158 Opie::Core::OSmartPointer<Mail> mail= new Mail();
162 mail->setMail(fromBox->currentText()); 159 mail->setMail(fromBox->currentText());
163 mail->setTo( toLine->text() ); 160 mail->setTo( toLine->text() );
164 mail->setName(senderNameEdit->text()); 161 mail->setName(senderNameEdit->text());
165 mail->setCC( ccLine->text() ); 162 mail->setCC( ccLine->text() );
166 mail->setBCC( bccLine->text() ); 163 mail->setBCC( bccLine->text() );
167 mail->setReply( replyLine->text() ); 164 mail->setReply( replyLine->text() );
168 mail->setSubject( subjectLine->text() ); 165 mail->setSubject( subjectLine->text() );
169 if (!m_replyid.isEmpty()) { 166 if (!m_replyid.isEmpty()) {
170 QStringList ids; 167 QStringList ids;
171 ids.append(m_replyid); 168 ids.append(m_replyid);
172 mail->setInreply(ids); 169 mail->setInreply(ids);
173 } 170 }
174 QString txt = message->text(); 171 QString txt = message->text();
175 if ( !sigMultiLine->text().isEmpty() ) { 172 if ( !sigMultiLine->text().isEmpty() ) {
176 txt.append( "\n--\n" ); 173 txt.append( "\n--\n" );
177 txt.append( sigMultiLine->text() ); 174 txt.append( sigMultiLine->text() );
178 } 175 }
179 mail->setMessage( txt ); 176 mail->setMessage( txt );
180 177
181 /* only use the default drafts folder name! */ 178 /* only use the default drafts folder name! */
182 Storemail wrapper(AbstractMail::draftFolder()); 179 Storemail wrapper(AbstractMail::draftFolder());
183 wrapper.storeMail(mail); 180 wrapper.storeMail(mail);
184 181
185 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 182 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
186 /* attachments we will ignore! */ 183 /* attachments we will ignore! */
187 if ( it != 0 ) { 184 if ( it != 0 ) {