summaryrefslogtreecommitdiff
path: root/noncore/net/mailit/writemail.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mailit/writemail.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mailit/writemail.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp
index 0336c83..dcf0c6e 100644
--- a/noncore/net/mailit/writemail.cpp
+++ b/noncore/net/mailit/writemail.cpp
@@ -114,50 +114,49 @@ void WriteMail::init()
grid->addWidget( ccInput, 0, 1 );
QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here"));
addressButton = new QToolButton( widget, "addressButton" );
addressButton->setPixmap( Resource::loadPixmap("AddressBook") );
addressButton->setToggleButton(TRUE);
grid->addWidget( addressButton, 0, 2 );
connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) );
QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook"));
emailInput = new QMultiLineEdit( widget, "emailInput" );
grid->addMultiCellWidget( emailInput, 2, 2, 0, 2);
- QWhatsThis::add(recipientsBox,QWidget::tr("Enter your mail text here"));
+ QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here"));
addressView = new QListView( widget, "addressView");
addressView->addColumn("Name");
addressView->addColumn("EMail");
addressView->setAllColumnsShowFocus(TRUE);
addressView->setMultiSelection(TRUE);
addressView->hide();
grid->addMultiCellWidget( addressView, 3, 3, 0, 2);
- QWhatsThis::add(recipientsBox,QWidget::tr("Chose the recipients from this list"));
+ QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list"));
okButton = new QToolButton(bar, "ok");
okButton->setPixmap( Resource::loadPixmap("enter") );
okButton->hide();
connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) );
QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here"));
setCentralWidget(widget);
}
void WriteMail::reject()
{
emit cancelMail();
}
-// need to insert date
void WriteMail::accept()
{
QStringList attachedFiles, attachmentsType;
int idCount = 0;
if (toInput->text() == "")
{
QMessageBox::warning(this,tr("No recipient"), tr("Send mail to whom?"), tr("OK\n"));
return;
}
if (! getRecipients(false) )
@@ -243,30 +242,41 @@ void WriteMail::getAddress()
emailInput->show();
}
}
void WriteMail::attachFile()
{
addAtt->showMaximized();
}
void WriteMail::reply(Email replyMail, bool replyAll)
{
int pos;
+ QString ccRecipients;
mail = replyMail;
mail.files.clear();
toInput->setText(mail.fromMail);
- //replyAll ? ccInput->setText(mail.c)
+
+ if (replyAll)
+ {
+ for (QStringList::Iterator it = mail.carbonCopies.begin();it != mail.carbonCopies.end(); ++it)
+ {
+ ccRecipients.append(*it);
+ ccRecipients.append(";");
+ }
+ ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end
+ ccInput->setText(ccRecipients);
+ }
addRecipients(replyAll);
subjectInput->setText(tr("Re: ") + mail.subject);
pos = 0;
mail.body.insert(pos, ">");
while (pos != -1) {
pos = mail.body.find('\n', pos);
if (pos != -1)
mail.body.insert(++pos, ">>");
}
@@ -312,41 +322,40 @@ bool WriteMail::getRecipients(bool ccField)
}
temp = temp.stripWhiteSpace();
if ( temp.find('@') == -1)
return false;
ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp);
addressList->addContact(temp, "");
return TRUE;
}
void WriteMail::addRecipients()
{
-
- addRecipients(false);
+ toInput->isVisible() ? addRecipients(false) : addRecipients(true);
}
void WriteMail::addRecipients(bool ccField)
{
QString recipients = "";
mail.recipients.clear();
QListViewItem *item = addressView->firstChild();
while (item != NULL) {
if ( item->isSelected() ) {
if (recipients == "") {
- recipients = item->text(0);
+ recipients = item->text(1);
} else {
- recipients += "; " + item->text(0);
+ recipients += "; " + item->text(1);
}
}
item = item->nextSibling();
}
ccField ? ccInput->setText(recipients):toInput->setText(recipients);
addressView->hide();
okButton->hide();
emailInput->show();
addressButton->setOn(FALSE);
showingAddressList = !showingAddressList;
@@ -367,15 +376,14 @@ void WriteMail::changeRecipients(int selection)
}
void WriteMail::setRecipient(const QString &recipient)
{
toInput->setText(recipient);
}
void WriteMail::newMail()
{
toInput->clear();
subjectInput->clear();
emailInput->clear();
- //to clear selected
setAddressList(addressList);
}