Add "forward as attachment".

Patch by Ingo Klöcker <ingo.kloecker@epost.de>

svn path=/trunk/kdenetwork/kmail/; revision=94903
wilder-work
Michael Haeckel 25 years ago
parent ae16a29f43
commit ee58ec2314
  1. 5
      kmcomposewin.cpp
  2. 67
      kmheaders.cpp
  3. 1
      kmheaders.h
  4. 12
      kmmainwin.cpp
  5. 3
      kmmainwin.h
  6. 3
      kmmainwin.rc

@ -1302,7 +1302,10 @@ void KMComposeWin::msgPartToItem(const KMMessagePart* msgPart,
if (len > 9999) lenStr.sprintf("%uK", (len>>10));
else lenStr.sprintf("%u", len);
lvi->setText(0, msgPart->fileName());
if (!msgPart->fileName().isEmpty())
lvi->setText(0, msgPart->fileName());
else
lvi->setText(0, msgPart->name());
lvi->setText(1, lenStr);
lvi->setText(2, msgPart->contentTransferEncodingStr());
lvi->setText(3, msgPart->typeStr() + "/" + msgPart->subtypeStr());

@ -1304,15 +1304,77 @@ void KMHeaders::forwardMsg ()
KMMessage *msg = currentMsg();
if (!msg) return;
QString id = msg->headerField( "X-KMail-Identity" );
if (id.isEmpty() && mFolder->isMailingList())
id = mFolder->mailingListIdentity();
kernel->kbp()->busy();
win = new KMComposeWin(msg->createForward(),
msg->headerField( "X-KMail-Identity" ));
win = new KMComposeWin(msg->createForward(), id);
win->setCharset(msg->codec()->name(), TRUE);
win->show();
kernel->kbp()->idle();
}
//-----------------------------------------------------------------------------
void KMHeaders::forwardAttachedMsg ()
{
KMComposeWin *win;
KMMessageList* msgList = selectedMsgs();
QString id;
if (msgList->count() >= 2) {
// don't respect X-KMail-Identity headers because they might differ for
// the selected mails
if (mFolder->isMailingList())
id = mFolder->mailingListIdentity();
else
id = "";
}
else if (msgList->count() == 1) {
KMMessage *msg = currentMsg();
id = msg->headerField( "X-KMail-Identity" );
if (id.isEmpty() && mFolder->isMailingList())
id = mFolder->mailingListIdentity();
}
KMMessage *fwdMsg = new KMMessage;
fwdMsg->initHeader(id);
fwdMsg->setAutomaticFields(true);
kdDebug() << "Launching composer window\n" << endl;
kernel->kbp()->busy();
win = new KMComposeWin(fwdMsg, id);
kdDebug() << "Doing forward as attachment\n" << endl;
// iterate through all the messages to be forwarded
for (KMMsgBase *mb = msgList->first(); mb; mb = msgList->next()) {
int idx = mFolder->find(mb);
if (idx < 0) continue;
KMMessage *thisMsg = mFolder->getMsg(idx);
if (!thisMsg) continue;
// set the part
KMMessagePart *msgPart = new KMMessagePart;
msgPart->setTypeStr("message");
msgPart->setSubtypeStr("rfc822");
msgPart->setCharset(thisMsg->charset());
msgPart->setName("forwarded message");
msgPart->setCte(DwMime::kCte8bit); // is 8bit O.K.?
msgPart->setContentDescription(thisMsg->from()+": "+thisMsg->subject());
// THIS HAS TO BE AFTER setCte()!!!!
msgPart->setBodyEncoded(QCString(thisMsg->asString()));
msgPart->setCharset("");
thisMsg->setStatus(KMMsgStatusForwarded);
win->addAttach(msgPart);
}
win->show();
kernel->kbp()->idle();
}
//-----------------------------------------------------------------------------
void KMHeaders::redirectMsg()
{
@ -2445,6 +2507,7 @@ void KMHeaders::slotRMB()
mOwner->replyAction->plug(menu);
mOwner->replyAllAction->plug(menu);
mOwner->forwardAction->plug(menu);
mOwner->forwardAttachedAction->plug(menu);
mOwner->redirectAction->plug(menu);
mOwner->bounceAction->plug(menu);
}

@ -98,6 +98,7 @@ public:
virtual void undo();
virtual bool canUndo() const;
virtual void forwardMsg();
virtual void forwardAttachedMsg();
virtual void bounceMsg();
virtual void replyToMsg(QString selection=QString::null);
virtual void noQuoteReplyToMsg();

@ -897,6 +897,13 @@ void KMMainWin::slotForwardMsg()
}
//-----------------------------------------------------------------------------
void KMMainWin::slotForwardAttachedMsg()
{
mHeaders->forwardAttachedMsg();
}
//-----------------------------------------------------------------------------
void KMMainWin::slotRedirectMsg()
{
@ -1510,6 +1517,7 @@ void KMMainWin::slotMsgPopup(const KURL &aUrl, const QPoint& aPoint)
replyAction->plug(menu);
replyAllAction->plug(menu);
forwardAction->plug(menu);
forwardAttachedAction->plug(menu);
redirectAction->plug(menu);
bounceAction->plug(menu);
}
@ -1661,6 +1669,9 @@ void KMMainWin::setupMenuBar()
forwardAction = new KAction( i18n("&Forward..."), "mail_forward", Key_F, this,
SLOT(slotForwardMsg()), actionCollection(), "forward" );
forwardAttachedAction = new KAction( i18n("&Forward as attachment"), "mail_forward_attached", SHIFT+Key_F, this,
SLOT(slotForwardAttachedMsg()), actionCollection(), "forward_attached" );
redirectAction = new KAction( i18n("R&edirect..."), Key_E, this,
SLOT(slotRedirectMsg()), actionCollection(), "redirect" );
@ -2014,6 +2025,7 @@ void KMMainWin::updateMessageMenu()
copyActionMenu->setEnabled( mass_actions );
deleteAction->setEnabled( mass_actions );
forwardAction->setEnabled( mass_actions );
forwardAttachedAction->setEnabled( mass_actions );
action( "apply_filters" )->setEnabled( mass_actions );
bool single_actions = count == 1;

@ -77,7 +77,7 @@ public:
static void cleanup();
KAction *replyAction, *noQuoteReplyAction, *replyAllAction, *replyListAction,
*forwardAction, *redirectAction,
*forwardAction, *forwardAttachedAction, *redirectAction,
*deleteAction, *saveAsAction, *bounceAction, *editAction,
*printAction, *sendAgainAction;
KActionMenu *filterMenu, *statusMenu, *moveActionMenu, *copyActionMenu;
@ -137,6 +137,7 @@ protected slots:
void slotReplyAllToMsg();
void slotReplyListToMsg();
void slotForwardMsg();
void slotForwardAttachedMsg();
void slotRedirectMsg();
void slotBounceMsg();
void slotMessageQueuedOrDrafted();

@ -1,4 +1,4 @@
<!DOCTYPE kpartgui ><kpartgui version="17" name="kmmainwin" >
<!DOCTYPE kpartgui ><kpartgui version="18" name="kmmainwin" >
<MenuBar>
<Menu noMerge="1" name="file" >
<text>&amp;File</text>
@ -56,6 +56,7 @@
<Action name="reply_list" />
<Action name="noquotereply" />
<Action name="forward" />
<Action name="forward_attached" />
<Action name="redirect" />
<Action name="bounce" />
<Action name="send_again" />

Loading…
Cancel
Save