From 7a32089a2c317e2e1507477327936e7eea8c92ab Mon Sep 17 00:00:00 2001 From: Michael Haeckel Date: Tue, 24 Apr 2001 11:22:28 +0000 Subject: [PATCH] =?UTF-8?q?Specifiy=20an=20identity=20for=20every=20mailin?= =?UTF-8?q?g=20list.=20Patch=20by=20Ingo=20Kl=C3=B6cker=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/trunk/kdenetwork/kmail/; revision=93728 --- kmfolder.cpp | 2 ++ kmfolder.h | 6 ++++++ kmfolderdia.cpp | 30 ++++++++++++++++++++++++++---- kmfolderdia.h | 1 + kmfoldertree.cpp | 2 +- kmheaders.cpp | 28 ++++++++++++++++++++-------- kmmainwin.cpp | 5 ++++- 7 files changed, 60 insertions(+), 14 deletions(-) diff --git a/kmfolder.cpp b/kmfolder.cpp index d04c25005..ae0e0d0fe 100644 --- a/kmfolder.cpp +++ b/kmfolder.cpp @@ -1782,6 +1782,7 @@ void KMFolder::readConfig() mMailingListEnabled = config->readBoolEntry("MailingListEnabled"); mMailingListPostingAddress = config->readEntry("MailingListPostingAddress"); mMailingListAdminAddress = config->readEntry("MailingListAdminAddress"); + mMailingListIdentity = config->readEntry("MailingListIdentity"); } //----------------------------------------------------------------------------- @@ -1793,6 +1794,7 @@ void KMFolder::writeConfig() config->writeEntry("MailingListEnabled", mMailingListEnabled); config->writeEntry("MailingListPostingAddress", mMailingListPostingAddress); config->writeEntry("MailingListAdminAddress", mMailingListAdminAddress); + config->writeEntry("MailingListIdentity", mMailingListIdentity); } //----------------------------------------------------------------------------- diff --git a/kmfolder.h b/kmfolder.h index 527a55cab..168bdf2cb 100644 --- a/kmfolder.h +++ b/kmfolder.h @@ -256,6 +256,11 @@ public: const QString& mailingListAdminAddress() const { return mMailingListAdminAddress; } + void setMailingListIdentity(const QString &identity) + { mMailingListIdentity = identity; writeConfig(); } + const QString& mailingListIdentity() const + { return mMailingListIdentity; } + /** Tell the folder that a header field that is usually used for the index (subject, from, ...) has changed of given message. This method is usually called from within KMMessage::setSubject/set... */ @@ -379,6 +384,7 @@ protected: bool mMailingListEnabled; QString mMailingListPostingAddress; QString mMailingListAdminAddress; + QString mMailingListIdentity; QString mImapPath; QString mUidValidity; diff --git a/kmfolderdia.cpp b/kmfolderdia.cpp index 9e15d3a36..8b581dcca 100644 --- a/kmfolderdia.cpp +++ b/kmfolderdia.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -24,6 +25,7 @@ #include "kmacctmgr.h" #include "kmacctfolder.h" #include "kmfoldermgr.h" +#include "kmidentity.h" #include "kmfolderdia.moc" @@ -103,7 +105,7 @@ KMFolderDialog::KMFolderDialog(KMFolder* aFolder, KMFolderDir *aFolderDir, topLayout = new QVBoxLayout( page, 0, spacingHint() ); - hl = new QHBoxLayout(); + //hl = new QHBoxLayout(); topLayout->addSpacing( spacingHint()*2 ); holdsMailingList = new QCheckBox( i18n("folder holds a mailing-list"), page); @@ -112,16 +114,26 @@ KMFolderDialog::KMFolderDialog(KMFolder* aFolder, KMFolderDir *aFolderDir, topLayout->addWidget(holdsMailingList); + QGridLayout *grid = new QGridLayout(page, 2, 2, 0, 8); + grid->setColStretch(0, 1); + grid->setColStretch(1, 100); + topLayout->addSpacing( spacingHint()*2 ); - topLayout->addLayout( hl ); + topLayout->addLayout( grid ); topLayout->addSpacing( spacingHint()*2 ); + label = new QLabel( i18n("Identity:"), page ); + grid->addWidget( label, 0, 0 ); + mailingListIdentity = new QComboBox( page ); + mailingListIdentity->insertStringList( KMIdentity::identities() ); + mailingListIdentity->setMinimumSize(mailingListIdentity->sizeHint()); + grid->addWidget( mailingListIdentity, 0, 1 ); label = new QLabel( i18n("Post Address:"), page ); - hl->addWidget( label ); + grid->addWidget( label, 1, 0 ); mailingListPostAddress = new QLineEdit( page ); mailingListPostAddress->setMinimumSize(mailingListPostAddress->sizeHint()); - hl->addWidget( mailingListPostAddress ); + grid->addWidget( mailingListPostAddress, 1, 1 ); // hl = new QHBoxLayout(); // topLayout->addLayout( hl ); @@ -138,7 +150,14 @@ KMFolderDialog::KMFolderDialog(KMFolder* aFolder, KMFolderDir *aFolderDir, // mailingListAdminAddress->setText(folder->mailingListAdminAddress()); mailingListPostAddress->setEnabled(folder->isMailingList()); // mailingListAdminAddress->setEnabled(folder->isMailingList()); + mailingListIdentity->setEnabled(folder->isMailingList()); holdsMailingList->setChecked(folder->isMailingList()); + + for (int i=0; i < mailingListIdentity->count(); ++i) + if (mailingListIdentity->text(i) == folder->mailingListIdentity()) { + mailingListIdentity->setCurrentItem(i); + break; + } } kdDebug()<<"Exiting KMFolderDialog::KMFolderDialog()\n"; } @@ -216,6 +235,7 @@ void KMFolderDialog::slotOk() folder->setMailingListPostAddress( mailingListPostAddress->text() ); // folder->setMailingListAdminAddress( mailingListAdminAddress->text() ); folder->setMailingListAdminAddress( QString::null ); + folder->setMailingListIdentity( mailingListIdentity->currentText() ); KMFolderDialogInherited::slotOk(); } @@ -233,5 +253,7 @@ void KMFolderDialog::slotHoldsML( bool holdsML ) mailingListPostAddress->setEnabled(false); // mailingListAdminAddress->setEnabled(false); } + + mailingListIdentity->setEnabled(holdsML); } diff --git a/kmfolderdia.h b/kmfolderdia.h index 999de7e06..b03d1e364 100644 --- a/kmfolderdia.h +++ b/kmfolderdia.h @@ -38,6 +38,7 @@ protected: QCheckBox *holdsMailingList; QLineEdit *mailingListPostAddress; + QComboBox *mailingListIdentity; // QLineEdit *mailingListAdminAddress; }; diff --git a/kmfoldertree.cpp b/kmfoldertree.cpp index 07d96422b..0c1c9f75c 100644 --- a/kmfoldertree.cpp +++ b/kmfoldertree.cpp @@ -874,7 +874,7 @@ void KMFolderTree::mouseButtonPressed(int btn, QListViewItem *lvi, const QPoint KMMessage *msg = new KMMessage; msg->initHeader(); msg->setTo(fti->folder->mailingListPostAddress()); - KMComposeWin *win = new KMComposeWin(msg); + KMComposeWin *win = new KMComposeWin(msg,fti->folder->mailingListIdentity()); win->show(); } diff --git a/kmheaders.cpp b/kmheaders.cpp index 5647b4241..068d4ba2b 100644 --- a/kmheaders.cpp +++ b/kmheaders.cpp @@ -1328,13 +1328,16 @@ void KMHeaders::noQuoteReplyToMsg() { KMComposeWin *win; KMMessage *msg = currentMsg(); + QString id; if (!msg) return; kernel->kbp()->busy(); - win = new KMComposeWin(msg->createReply(FALSE, FALSE, "", TRUE), - msg->headerField( "X-KMail-Identity" )); + id = msg->headerField( "X-KMail-Identity" ); + if (id.isEmpty() && mFolder->isMailingList()) + id = mFolder->mailingListIdentity(); + win = new KMComposeWin(msg->createReply(FALSE, FALSE, "", TRUE),id); win->setCharset(msg->codec()->name(), TRUE); win->setReplyFocus(false); win->show(); @@ -1346,13 +1349,16 @@ void KMHeaders::replyToMsg (QString selection) { KMComposeWin *win; KMMessage *msg = currentMsg(); + QString id; if (!msg) return; kernel->kbp()->busy(); - win = new KMComposeWin(msg->createReply(FALSE, FALSE, selection), - msg->headerField( "X-KMail-Identity" )); + id = msg->headerField( "X-KMail-Identity" ); + if (id.isEmpty() && mFolder->isMailingList()) + id = mFolder->mailingListIdentity(); + win = new KMComposeWin(msg->createReply(FALSE, FALSE, selection),id); win->setCharset(msg->codec()->name(), TRUE); win->setReplyFocus(); win->show(); @@ -1365,12 +1371,15 @@ void KMHeaders::replyAllToMsg (QString selection) { KMComposeWin *win; KMMessage *msg = currentMsg(); + QString id; if (!msg) return; kernel->kbp()->busy(); - win = new KMComposeWin(msg->createReply(TRUE, FALSE, selection), - msg->headerField( "X-KMail-Identity" )); + id = msg->headerField( "X-KMail-Identity" ); + if (id.isEmpty() && mFolder->isMailingList()) + id = mFolder->mailingListIdentity(); + win = new KMComposeWin(msg->createReply(TRUE, FALSE, selection),id); win->setCharset(msg->codec()->name(), TRUE); win->setReplyFocus(); win->show(); @@ -1382,12 +1391,15 @@ void KMHeaders::replyListToMsg (QString selection) { KMComposeWin *win; KMMessage *msg = currentMsg(); + QString id; if (!msg) return; kernel->kbp()->busy(); - win = new KMComposeWin(msg->createReply(true, true, selection), - msg->headerField( "X-KMail-Identity" )); + id = msg->headerField( "X-KMail-Identity" ); + if (id.isEmpty() && mFolder->isMailingList()) + id = mFolder->mailingListIdentity(); + win = new KMComposeWin(msg->createReply(true, true, selection),id); win->setCharset(msg->codec()->name(), TRUE); win->setReplyFocus(); win->show(); diff --git a/kmmainwin.cpp b/kmmainwin.cpp index dd44b5398..f452340ba 100644 --- a/kmmainwin.cpp +++ b/kmmainwin.cpp @@ -685,9 +685,12 @@ void KMMainWin::slotCompose() if (mFolder && mFolder->isMailingList()) { kdDebug()<isMailingList() %1").arg( mFolder->mailingListPostAddress().latin1())<setTo(mFolder->mailingListPostAddress()); + + win = new KMComposeWin(msg,mFolder->mailingListIdentity()); } + else + win = new KMComposeWin(msg); - win = new KMComposeWin(msg); win->show(); }