[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: Re: feature idea: recent address
From: Daniel Naber <dnaber () mini ! gt ! owl ! de>
Date: 2000-04-30 14:42:35
[Download RAW message or body]
On Fre, 28 Apr 2000, Don Sanders wrote:
> There are problems with this.
>
> 1) Currently up/down arrows can be used to traverse the fields in the
> composer window. But up/down is used by combo boxes to traverse the list of
> items in the combo box. So you have a clash there.
I see. For me, using Tab to switch between is fine. We would have to disable
one of the cursor functions. I don't know.
> 2) You will have to do some work to keep the address book stuff working. eg
> Ctrl-T email address autocompletion functionality, (including the drop down
> list when multiple completions are possible).
Another idea is this. Whenever you compose a new mail, KCombobox offers
you the most recent addresses. If you start typing an address, the list grows
with all the autocomplete matches (automatically), e.g. you type "kma", it
shows:
kma (here's your cursor)
kmail@kde.org
kmail-something@kde.org
Recent adresses:
blah@de.de
anotherone@de.de
foo@bar.de
I'll attach a patch that works for me but doesn't yet solve your two issues.
I don't know when/if I'll do that, at least the patch can't get lost this way.
The other patch just shows better feedback if there haven't been new mails
(exp. pop3 only)
Regards
Daniel
["recent-addresses.diff" (text/plain)]
--- kmcomposewin.h.org Sat Apr 29 19:53:20 2000
+++ kmcomposewin.h Sun Apr 30 00:59:08 2000
@@ -270,6 +270,9 @@
void rethinkHeaderLine(int value, int mask, int& row,
const QString labelStr, QLabel* lbl,
QComboBox* cbx, QCheckBox *chk);
+ void rethinkHeaderLine(int value, int mask, int& row,
+ const QString labelStr, QLabel* lbl,
+ QComboBox* cbx, QPushButton* btn=NULL);
/** Initialization methods */
void setupActions();
@@ -279,9 +282,9 @@
/** Header fields. */
const QString subject(void) const { return mEdtSubject.text(); }
- const QString to(void) const { return mEdtTo.text(); }
- const QString cc(void) const { return mEdtCc.text(); }
- const QString bcc(void) const { return mEdtBcc.text(); }
+ const QString to(void) const { return mEdtTo.currentText(); }
+ const QString cc(void) const { return mEdtCc.currentText(); }
+ const QString bcc(void) const { return mEdtBcc.currentText(); }
const QString from(void) const { return mEdtFrom.text(); }
const QString replyTo(void) const { return mEdtReplyTo.text(); }
#ifdef KRN
@@ -307,7 +310,8 @@
/** Open addressbook and append selected addresses to the given
edit field. */
- void addrBookSelInto(KMLineEdit* destEdit);
+ void addrBookSelInto(KMLineEdit* aLineEdit);
+ void addrBookSelInto(QComboBox* aComboBox);
private:
/** Get message including signing and encrypting it */
@@ -329,8 +333,8 @@
protected:
QWidget mMainWidget;
- QComboBox mIdentity, mTransport;
- KMLineEdit mEdtFrom, mEdtReplyTo, mEdtTo, mEdtCc, mEdtBcc, mEdtSubject;
+ QComboBox mIdentity, mTransport, mEdtTo, mEdtCc, mEdtBcc;
+ KMLineEdit mEdtFrom, mEdtSubject, mEdtReplyTo;
QLabel mLblIdentity, mLblTransport;
QLabel mLblFrom, mLblReplyTo, mLblTo, mLblCc, mLblBcc, mLblSubject;
QCheckBox mBtnIdentity, mBtnTransport;
@@ -348,6 +352,7 @@
KMMessage *mMsg;
QListView *mAtmListBox;
QList<QListViewItem> mAtmItemList;
+ QStringList mRecentAddressList;
KMMsgPartList mAtmList;
bool mAutoSign, mAutoPgpSign, mShowToolBar, mAutoDeleteMsg;
long mShowHeaders;
--- kmcomposewin.cpp.org Sat Apr 29 19:53:48 2000
+++ kmcomposewin.cpp Sun Apr 30 01:11:18 2000
@@ -119,8 +119,8 @@
mMainWidget(this),
mIdentity(&mMainWidget), mTransport(true, &mMainWidget),
mEdtFrom(this,&mMainWidget), mEdtReplyTo(this,&mMainWidget),
- mEdtTo(this,&mMainWidget), mEdtCc(this,&mMainWidget),
- mEdtBcc(this,&mMainWidget), mEdtSubject(this,&mMainWidget, "subjectLine"),
+ mEdtTo(true,&mMainWidget), mEdtCc(true,&mMainWidget),
+ mEdtBcc(true,&mMainWidget), mEdtSubject(this,&mMainWidget, "subjectLine"),
mLblIdentity(&mMainWidget), mLblTransport(&mMainWidget),
mLblFrom(&mMainWidget), mLblReplyTo(&mMainWidget), mLblTo(&mMainWidget),
mLblCc(&mMainWidget), mLblBcc(&mMainWidget), mLblSubject(&mMainWidget),
@@ -228,6 +228,7 @@
int w, h, maxTransportItems;
config->setGroup("Composer");
+ mRecentAddressList = config->readListEntry("recent-addresses",';');
mAutoSign = config->readEntry("signature","manual") == "auto";
mShowToolBar = config->readNumEntry("show-toolbar", 1);
mDefEncoding = config->readEntry("encoding", "base64");
@@ -374,8 +375,28 @@
{
KConfig *config = kapp->config();
QString str;
-
+
config->setGroup("Composer");
+
+ // Remember addresses so the user can choose from recent To/Cc/Bcc's next time:
+ if( ! mEdtBcc.currentText().isEmpty() ) {
+ mRecentAddressList.remove(mEdtBcc.currentText()); // avoid double entries
+ mRecentAddressList.prepend(mEdtBcc.currentText()); // insert at top
+ }
+ if( ! mEdtCc.currentText().isEmpty() ) {
+ mRecentAddressList.remove(mEdtCc.currentText());
+ mRecentAddressList.prepend(mEdtCc.currentText());
+ }
+ if( ! mEdtTo.currentText().isEmpty() ) { // check this too, user might have cancelled
+ mRecentAddressList.remove(mEdtTo.currentText());
+ mRecentAddressList.prepend(mEdtTo.currentText());
+ }
+ unsigned int maxEntries = config->readUnsignedNumEntry("max-recent-addresses", 10);
+ while( mRecentAddressList.count() > maxEntries ) {
+ mRecentAddressList.remove(mRecentAddressList.last());
+ }
+ config->writeEntry("recent-addresses", mRecentAddressList, ';');
+
config->writeEntry("signature", mAutoSign?"auto":"manual");
config->writeEntry("show-toolbar", mShowToolBar);
config->writeEntry("encoding", mDefEncoding);
@@ -654,6 +675,45 @@
//-----------------------------------------------------------------------------
+void KMComposeWin::rethinkHeaderLine(int aValue, int aMask, int& aRow,
+ const QString aLabelStr, QLabel* aLbl,
+ QComboBox* aCbx, QPushButton* aBtn)
+{
+ if (aValue & aMask)
+ {
+ aLbl->setText(aLabelStr);
+ aLbl->adjustSize();
+ aLbl->resize((int)aLbl->sizeHint().width(),aLbl->sizeHint().height() + 6);
+ aLbl->setMinimumSize(aLbl->size());
+ aLbl->show();
+ aLbl->setBuddy(aCbx);
+ mGrid->addWidget(aLbl, aRow, 0);
+
+ aCbx->show();
+ aCbx->setMinimumSize(100, aLbl->height()+2);
+ aCbx->setMaximumSize(1000, aLbl->height()+2);
+ mEdtList.append(aCbx);
+
+ if (aBtn)
+ {
+ mGrid->addWidget(aCbx, aRow, 1);
+ mGrid->addWidget(aBtn, aRow, 2);
+ aBtn->setFixedSize(aBtn->sizeHint().width(), aLbl->height());
+ aBtn->show();
+ }
+ else mGrid->addMultiCellWidget(aCbx, aRow, aRow, 1, 2);
+ aRow++;
+ }
+ else
+ {
+ aLbl->hide();
+ aCbx->hide();
+ if (aBtn) aBtn->hide();
+ }
+}
+
+
+//-----------------------------------------------------------------------------
void KMComposeWin::setupActions(void)
{
if (kernel->msgSender()->sendImmediate()) //default == send now?
@@ -917,12 +977,19 @@
}
mMsg = newMsg;
- mEdtTo.setText(mMsg->to());
+ mEdtTo.insertItem(mMsg->to());
+ mEdtCc.insertItem(mMsg->cc());
+ mEdtBcc.insertItem(mMsg->bcc());
+ // offer recently used addresses:
+ for ( QStringList::Iterator it = mRecentAddressList.begin(); it != mRecentAddressList.end(); ++it ) {
+ mEdtTo.insertItem((*it).latin1());
+ mEdtCc.insertItem((*it).latin1());
+ mEdtBcc.insertItem((*it).latin1());
+ }
+
mEdtFrom.setText(mMsg->from());
- mEdtCc.setText(mMsg->cc());
mEdtSubject.setText(mMsg->subject());
mEdtReplyTo.setText(mMsg->replyTo());
- mEdtBcc.setText(mMsg->bcc());
#ifdef KRN
mEdtNewsgroups.setText(mMsg->groups());
mEdtFollowupTo.setText(mMsg->followup());
@@ -1325,6 +1392,29 @@
else txt += ' ';
}
aLineEdit->setText(txt + dlg.address());
+}
+
+
+//-----------------------------------------------------------------------------
+void KMComposeWin::addrBookSelInto(QComboBox* aComboBox)
+{
+ KMAddrBookSelDlg dlg(kernel->addrBook());
+ QString txt;
+
+ //assert(aComboBox!=NULL);
+ if(!aComboBox)
+ {
+ debug("KMComposeWin::addrBookSelInto() : aComboBox == NULL\n");
+ return;
+ }
+ if (dlg.exec()==QDialog::Rejected) return;
+ txt = QString(aComboBox->currentText()).stripWhiteSpace();
+ if (!txt.isEmpty())
+ {
+ if (txt.right(1).at(0)!=',') txt += ", ";
+ else txt += ' ';
+ }
+ aComboBox->changeItem(txt + dlg.address(), aComboBox->currentItem());
}
["exp-pop-feedback.diff" (text/plain)]
--- kmacctexppop.cpp.org Sat Apr 29 00:47:40 2000
+++ kmacctexppop.cpp Sat Apr 29 00:53:36 2000
@@ -444,8 +444,11 @@
debug( "stage == Quit" );
job = 0L;
stage = Idle;
- KMBroadcastStatus::instance()->setStatusMsg(
- i18n( "Transmission completed..." ));
+ if( idsOfMsgs.count() > 0 ) {
+ KMBroadcastStatus::instance()->setStatusMsg(i18n("Transmission completed (%1 \
mails)...").arg(idsOfMsgs.count())); + } else {
+ KMBroadcastStatus::instance()->setStatusMsg(i18n("No new mails."));
+ }
KMBroadcastStatus::instance()->setStatusProgressEnable( false );
KMBroadcastStatus::instance()->reset();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic