--------------Boundary-00=_3BQ4LPIJ5BVGUSG7S4M2 Content-Type: text/plain Content-Transfer-Encoding: 8bit (To store in the fridge for post-freeze time) Now middle-clicking on a mailing-list folder pops up a composer with the 'To' field set to the mailing-list address. -- Guillaume. http://www.telegraph-road.org --------------Boundary-00=_3BQ4LPIJ5BVGUSG7S4M2 Content-Type: text/plain; name="kmail_mailing_list_folder_patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="kmail_mailing_list_folder_patch" Only in kmail: .libs Only in kmail: kmail Only in kmail: kmailIface.kidl Only in kmail: kmailIface_skel.cpp Only in kmail: kmailIface_stub.cpp Only in kmail: kmailIface_stub.h Only in kmail: kmail_meta_unload.cpp diff -x *.moc -x *.sniffdir -x *.o -x *.proj -x *~ -x Makefile -b -u -r kmail.old/kmcomposewin.cpp kmail/kmcomposewin.cpp --- kmail.old/kmcomposewin.cpp Thu Aug 17 10:09:34 2000 +++ kmail/kmcomposewin.cpp Thu Aug 31 00:55:09 2000 @@ -1936,6 +1936,7 @@ signatures and we should respect it: */ mEditor->insertLine("-- ", -1); mEditor->insertLine(sigText, -1); + mEditor->update(); mEditor->setModified(mod); } } diff -x *.moc -x *.sniffdir -x *.o -x *.proj -x *~ -x Makefile -b -u -r kmail.old/kmfolder.cpp kmail/kmfolder.cpp --- kmail.old/kmfolder.cpp Thu Aug 17 10:09:34 2000 +++ kmail/kmfolder.cpp Wed Aug 30 00:23:07 2000 @@ -2,6 +2,7 @@ // Author: Stefan Taferner #include +#include #include "kmglobal.h" #include "kmfolder.h" @@ -102,9 +103,8 @@ //----------------------------------------------------------------------------- const QString KMFolder::location() const { - QString sLocation; + QString sLocation(path()); - sLocation = path().copy(); if (!sLocation.isEmpty()) sLocation += '/'; sLocation += name(); @@ -115,9 +115,8 @@ //----------------------------------------------------------------------------- const QString KMFolder::indexLocation() const { - QString sLocation; + QString sLocation(path()); - sLocation = path().copy(); if (!sLocation.isEmpty()) sLocation += '/'; sLocation += '.'; sLocation += name(); @@ -129,9 +128,8 @@ //----------------------------------------------------------------------------- const QString KMFolder::subdirLocation() const { - QString sLocation; + QString sLocation(path()); - sLocation = path().copy(); if (!sLocation.isEmpty()) sLocation += '/'; sLocation += '.'; sLocation += name(); @@ -591,7 +589,6 @@ return 0; } - //----------------------------------------------------------------------------- void KMFolder::setAutoCreateIndex(bool autoIndex) { @@ -663,7 +660,6 @@ } } - //----------------------------------------------------------------------------- void KMFolder::markNewAsUnread() { @@ -1369,6 +1365,8 @@ KConfig* config = kapp->config(); config->setGroup("Folder-" + idString()); unreadMsgs = config->readNumEntry("UnreadMsgs", -1); + mMailingListPostingAddress = config->readEntry("MailingListPostingAddress"); + mMailingListAdminAddress = config->readEntry("MailingListAdminAddress"); } //----------------------------------------------------------------------------- @@ -1377,6 +1375,8 @@ KConfig* config = kapp->config(); config->setGroup("Folder-" + idString()); config->writeEntry("UnreadMsgs", countUnread()); + config->writeEntry("MailingListPostingAddress", mMailingListPostingAddress); + config->writeEntry("MailingListAdminAddress", mMailingListAdminAddress); } //----------------------------------------------------------------------------- diff -x *.moc -x *.sniffdir -x *.o -x *.proj -x *~ -x Makefile -b -u -r kmail.old/kmfolder.h kmail/kmfolder.h --- kmail.old/kmfolder.h Sun May 21 08:37:14 2000 +++ kmail/kmfolder.h Wed Aug 30 00:39:02 2000 @@ -212,6 +212,14 @@ /** Returns TRUE if accounts are associated with this folder. */ bool hasAccounts() const { return (mAcctList != NULL); } + /** Returns TRUE if this folder is associated with a mailing-list. */ + bool isMailingList() const { return (mMailingListPostingAddress != QString::null) && !mMailingListPostingAddress.isEmpty(); } + void setMailingListPostAddress(const QString &address) { mMailingListPostingAddress = address; } + const QString& mailingListPostAddress() const { return mMailingListPostingAddress; } + + void setMailingListAdminAddress(const QString &address) { mMailingListAdminAddress = address; } + const QString& mailingListAdminAddress() const { return mMailingListAdminAddress; } + /** 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... */ @@ -306,6 +314,10 @@ QString mWhoField; // name of the field that is used for "From" in listbox bool mIsSystemFolder; KMAcctList* mAcctList; + + QString mMailingListPostingAddress; + QString mMailingListAdminAddress; + long unreadMsgs; // number of unread messages, -1 if not yet set bool needsCompact; //sven: true if on destruct folder needs to be compacted. KMFolderDir* mChild; diff -x *.moc -x *.sniffdir -x *.o -x *.proj -x *~ -x Makefile -b -u -r kmail.old/kmfolderdia.cpp kmail/kmfolderdia.cpp --- kmail.old/kmfolderdia.cpp Sat Jul 15 12:03:47 2000 +++ kmail/kmfolderdia.cpp Wed Aug 30 00:40:34 2000 @@ -2,6 +2,7 @@ #include +#include #include #include #include @@ -11,9 +12,11 @@ #include #include #include +#include #include #include +#include #include "kmmainwin.h" #include "kmglobal.h" @@ -28,12 +31,22 @@ //----------------------------------------------------------------------------- KMFolderDialog::KMFolderDialog(KMFolder* aFolder, KMFolderDir *aFolderDir, QWidget *aParent, const QString& aCap): - KMFolderDialogInherited( aParent, "KMFolderDialog", TRUE, - aCap, KDialogBase::Ok|KDialogBase::Cancel ), +// KMFolderDialogInherited( aParent, "KMFolderDialog", TRUE, +// aCap, KDialogBase::Ok|KDialogBase::Cancel ), + KMFolderDialogInherited( KDialogBase::Tabbed, + aCap, KDialogBase::Ok|KDialogBase::Cancel, + KDialogBase::Ok, aParent, "KMFolderDialog", TRUE ), folder((KMAcctFolder*)aFolder),mFolderDir( aFolderDir ) { - QWidget *page = new QWidget(this); - setMainWidget( page ); + +// QWidget *page = new QWidget(this); +// setMainWidget( page ); +// QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); + + // Main tab + // + QFrame *page = addPage(i18n("Folder Position"), i18n("Where the folder is located in the tree") ); + QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); QHBoxLayout *hl = new QHBoxLayout(); @@ -78,6 +91,56 @@ if (curFolder->child() == aFolderDir) fileInFolder->setCurrentItem( i ); } + + // Mailing-list data tab + // + page = addPage(i18n("Associated Mailing List"), i18n("Email addresses of the mailing-list related to this folder") ); + + topLayout = new QVBoxLayout( page, 0, spacingHint() ); + + hl = new QHBoxLayout(); + topLayout->addSpacing( spacingHint()*2 ); + + holdsMailingList = new QCheckBox( i18n("folder holds a mailing-list"), page); + QObject::connect(holdsMailingList, SIGNAL(toggled(bool)), + this, SLOT(slotHoldsML(bool))); + + topLayout->addWidget(holdsMailingList); + + topLayout->addSpacing( spacingHint()*2 ); + topLayout->addLayout( hl ); + topLayout->addSpacing( spacingHint()*2 ); + + + label = new QLabel( i18n("Post Address:"), page ); + hl->addWidget( label ); + mailingListPostAddress = new QLineEdit( page ); + mailingListPostAddress->setMinimumSize(mailingListPostAddress->sizeHint()); + hl->addWidget( mailingListPostAddress ); + + hl = new QHBoxLayout(); + topLayout->addLayout( hl ); + + label = new QLabel( i18n("Admin Address:"), page ); + hl->addWidget( label ); + mailingListAdminAddress = new QLineEdit( page ); + mailingListAdminAddress->setMinimumSize(mailingListAdminAddress->sizeHint()); + hl->addWidget( mailingListAdminAddress ); + + if (folder && folder->isMailingList()) + { + mailingListPostAddress->setText(folder->mailingListPostAddress()); + mailingListAdminAddress->setText(folder->mailingListAdminAddress()); + + mailingListPostAddress->setEnabled(true); + mailingListAdminAddress->setEnabled(true); + holdsMailingList->setChecked(true); + } + else { + mailingListPostAddress->setEnabled(false); + mailingListAdminAddress->setEnabled(false); + holdsMailingList->setChecked(false); + } } @@ -145,5 +208,33 @@ kernel->folderMgr()->contentsChanged(); } + if (holdsMailingList->isChecked()) + { + folder->setMailingListPostAddress(mailingListPostAddress->text()); + folder->setMailingListAdminAddress(mailingListAdminAddress->text()); + } else + { + folder->setMailingListPostAddress(QString::null); + folder->setMailingListAdminAddress(QString::null); + } + KMFolderDialogInherited::slotOk(); } + +//----------------------------------------------------------------------------- +void KMFolderDialog::slotHoldsML( bool holdsML ) +{ + if ( holdsML ) + { + mailingListPostAddress->setEnabled(true); + mailingListAdminAddress->setEnabled(true); + } + else + { + mailingListPostAddress->clear(); + mailingListAdminAddress->clear(); + mailingListPostAddress->setEnabled(false); + mailingListAdminAddress->setEnabled(false); + } +} + diff -x *.moc -x *.sniffdir -x *.o -x *.proj -x *~ -x Makefile -b -u -r kmail.old/kmfolderdia.h kmail/kmfolderdia.h --- kmail.old/kmfolderdia.h Sun Jul 2 18:53:11 2000 +++ kmail/kmfolderdia.h Tue Aug 29 02:20:11 2000 @@ -7,6 +7,7 @@ #include class KMAcctFolder; +class QCheckBox; class QPushButton; class QLineEdit; class QListBox; @@ -25,6 +26,7 @@ protected slots: virtual void slotOk( void ); + virtual void slotHoldsML( bool ); protected: QComboBox *fileInFolder; @@ -32,6 +34,10 @@ KMAcctFolder* folder; KMFolderDir* mFolderDir; QValueList > mFolders; + + QCheckBox *holdsMailingList; + QLineEdit *mailingListPostAddress; + QLineEdit *mailingListAdminAddress; }; #endif /*__KMFOLDERDIA*/ diff -x *.moc -x *.sniffdir -x *.o -x *.proj -x *~ -x Makefile -b -u -r kmail.old/kmfoldertree.cpp kmail/kmfoldertree.cpp --- kmail.old/kmfoldertree.cpp Thu Aug 17 10:09:34 2000 +++ kmail/kmfoldertree.cpp Thu Aug 31 01:38:15 2000 @@ -22,6 +22,7 @@ #include "kmfolder.h" #include "kmfoldertree.h" #include "kmfolderdia.h" +#include "kmcomposewin.h" QPixmap* KMFolderTree::pixDir = 0; QPixmap* KMFolderTree::pixNode = 0; @@ -202,6 +203,9 @@ connect( this, SIGNAL( rightButtonPressed( QListViewItem*, const QPoint &, int)), this, SLOT( rightButtonPressed( QListViewItem*, const QPoint &, int))); + + connect( this, SIGNAL( mouseButtonPressed( int, QListViewItem*, const QPoint &, int)), + this, SLOT( mouseButtonPressed( int, QListViewItem*, const QPoint &, int))); } bool KMFolderTree::event(QEvent *e) @@ -562,6 +566,29 @@ folderMenu->exec (p, 0); triggerUpdate(); delete folderMenu; +} + +//----------------------------------------------------------------------------- +// If middle button and folder holds mailing-list, create a message to that list + +void KMFolderTree::mouseButtonPressed(int btn, QListViewItem *lvi, const QPoint &p, int) +{ + // react on middle-button only + if (btn != Qt::MidButton) return; + + // get underlying folder + KMFolderTreeItem* fti = dynamic_cast(lvi); + + if (!fti || !fti->folder) + return; + if (!fti->folder->isMailingList()) + return; + + KMMessage *msg = new KMMessage; + msg->setTo(fti->folder->mailingListPostAddress()); + KMComposeWin *win = new KMComposeWin(msg); + win->show(); + } //----------------------------------------------------------------------------- diff -x *.moc -x *.sniffdir -x *.o -x *.proj -x *~ -x Makefile -b -u -r kmail.old/kmfoldertree.h kmail/kmfoldertree.h --- kmail.old/kmfoldertree.h Thu Aug 17 10:09:34 2000 +++ kmail/kmfoldertree.h Thu Aug 31 01:20:22 2000 @@ -125,6 +125,7 @@ protected slots: void autoScroll(); void rightButtonPressed( QListViewItem *, const QPoint &, int); + void mouseButtonPressed( int btn, QListViewItem *, const QPoint &, int); }; #endif diff -x *.moc -x *.sniffdir -x *.o -x *.proj -x *~ -x Makefile -b -u -r kmail.old/kmmessage.cpp kmail/kmmessage.cpp --- kmail.old/kmmessage.cpp Thu Aug 17 10:09:35 2000 +++ kmail/kmmessage.cpp Wed Aug 30 22:04:26 2000 @@ -669,6 +669,14 @@ if (replyToAll) { + // glaurent - check if the folder holds a mailing-list + if (parent()->isMailingList()) + { + // Reply to mailing-list posting address + toStr = parent()->mailingListPostAddress(); + } + else // normal reply + { int i; // sanders only include the replyTo address if it's != to the from address QString rep = replyToStr; @@ -720,6 +728,7 @@ ccStr.truncate(ccStr.length()-1); msg->setCc(ccStr); } + } } else --------------Boundary-00=_3BQ4LPIJ5BVGUSG7S4M2--