Summary: | When changing identity, the transport is then reset to the wrong one | ||
---|---|---|---|
Product: | [Unmaintained] kmail | Reporter: | David Anderson <david> |
Component: | general | Assignee: | kdepim bugs <kdepim-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | mmodem00 |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Fedora RPMs | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
David Anderson
2006-08-17 18:55:57 UTC
See also bug 126288. It could be the same bug if the reporters only saw one of cases in which it manifests itself. I also confirm this, a very annoying bug. *** Bug 133422 has been marked as a duplicate of this bug. *** SVN commit 596514 by kloecker: Fix bug 132560 (When changing identity, the transport is then reset to the wrong one) I've got this patch on my harddisk for a long time. The patch should also fix a few other transport related bugs. BUG:132560 M +37 -31 kmcomposewin.cpp M +8 -0 kmcomposewin.h --- branches/KDE/3.5/kdepim/kmail/kmcomposewin.cpp #596513:596514 @@ -620,18 +620,11 @@ while ( transportHistory.count() > (uint)GlobalSettings::self()->maxTransportEntries() ) transportHistory.remove( transportHistory.last() ); mTransport->insertStringList( transportHistory ); - if (mBtnTransport->isChecked() && !currentTransport.isEmpty()) - { - for (int i = 0; i < mTransport->count(); i++) - if (mTransport->text(i) == currentTransport) - mTransport->setCurrentItem(i); - mTransport->setEditText( currentTransport ); + mTransport->setCurrentText( GlobalSettings::self()->defaultTransport() ); + if ( mBtnTransport->isChecked() ) { + setTransport( currentTransport ); } - if ( !mBtnTransport->isChecked() ) { - mTransport->setCurrentText( GlobalSettings::self()->defaultTransport() ); - } - QString fccName = ""; if ( mBtnFcc->isChecked() ) { fccName = GlobalSettings::self()->previousFcc(); @@ -1659,6 +1652,37 @@ } //----------------------------------------------------------------------------- +void KMComposeWin::setTransport( const QString & transport ) +{ + kdDebug(5006) << "KMComposeWin::setTransport( \"" << transport << "\" )" << endl; + // Don't change the transport combobox if transport is empty + if ( transport.isEmpty() ) + return; + + bool transportFound = false; + for ( int i = 0; i < mTransport->count(); ++i ) { + if ( mTransport->text(i) == transport ) { + transportFound = true; + mTransport->setCurrentItem(i); + kdDebug(5006) << "transport found, it's no. " << i << " in the list" << endl; + break; + } + } + if ( !transportFound ) { // unknown transport + kdDebug(5006) << "unknown transport \"" << transport << "\"" << endl; + if ( transport.startsWith("smtp://") || transport.startsWith("smtps://") || + transport.startsWith("file://") ) { + // set custom transport + mTransport->setEditText( transport ); + } + else { + // neither known nor custom transport -> use default transport + mTransport->setCurrentText( GlobalSettings::self()->defaultTransport() ); + } + } +} + +//----------------------------------------------------------------------------- void KMComposeWin::setMsg(KMMessage* newMsg, bool mayAutoSign, bool allowDecryption, bool isModified) { @@ -1778,12 +1802,7 @@ QString transport = newMsg->headerField("X-KMail-Transport"); if (!mBtnTransport->isChecked() && !transport.isEmpty()) - { - for (int i = 0; i < mTransport->count(); i++) - if (mTransport->text(i) == transport) - mTransport->setCurrentItem(i); - mTransport->setEditText( transport ); - } + setTransport( transport ); if (!mBtnFcc->isChecked()) { @@ -4293,24 +4312,11 @@ if ( transp.isEmpty() ) { mMsg->removeHeaderField("X-KMail-Transport"); - transp = mTransport->text(0); + transp = GlobalSettings::self()->defaultTransport(); } else mMsg->setHeaderField("X-KMail-Transport", transp); - bool found = false; - int i; - for (i = 0; i < mTransport->count(); i++) { - if (mTransport->text(i) == transp) { - found = true; - mTransport->setCurrentItem(i); - break; - } - } - if (found == false) { - if (i == mTransport->maxCount()) mTransport->setMaxCount(i + 1); - mTransport->insertItem(transp,i); - mTransport->setCurrentItem(i); - } + setTransport( transp ); } mDictionaryCombo->setCurrentByDictionary( ident.dictionary() ); --- branches/KDE/3.5/kdepim/kmail/kmcomposewin.h #596513:596514 @@ -649,6 +649,14 @@ */ static bool validateAddresses( QWidget * parent, const QString & addresses ); + /** + * Sets the transport combobox to @p transport. If @p transport is empty + * then the combobox remains unchanged. If @p transport is neither a known transport + * nor a custom transport then the combobox is set to the default transport. + * @param transport the transport the combobox should be set to + */ + void setTransport( const QString & transport ); + private slots: /** * Compress an attachemnt with the given index was this fix already commited in branch_3.5? Yes, I've committed the fix two hours ago to the 3.5 branch. |