Commit 9a796d07 authored by Tobias Koenig's avatar Tobias Koenig
Browse files

Update the password of all Transport instances when

changing the password in the configuration dialog.

Fixes first part of bug 258350

CCBUG: 258350

svn path=/trunk/KDE/kdepimlibs/; revision=1216136
parent 569bab94
......@@ -18,6 +18,7 @@
*/
#include "transport.h"
#include "transport_p.h"
#include "legacydecrypt.h"
#include "mailtransport_defs.h"
#include "transportmanager.h"
......@@ -38,22 +39,6 @@
using namespace MailTransport;
using namespace KWallet;
/**
* Private class that helps to provide binary compatibility between releases.
* @internal
*/
class TransportPrivate
{
public:
TransportType transportType;
QString password;
bool passwordLoaded;
bool passwordDirty;
bool storePasswordInFile;
bool needsWalletMigration;
QString oldName;
};
Transport::Transport( const QString &cfgGroup ) :
TransportBase( cfgGroup ), d( new TransportPrivate )
{
......@@ -62,6 +47,7 @@ Transport::Transport( const QString &cfgGroup ) :
d->passwordDirty = false;
d->storePasswordInFile = false;
d->needsWalletMigration = false;
d->passwordNeedsUpdateFromWallet = false;
readConfig();
}
......@@ -201,7 +187,25 @@ void Transport::usrReadConfig()
}
// we have everything we need
if ( !storePassword() || d->passwordLoaded ) {
if ( !storePassword() ) {
return;
}
if ( d->passwordLoaded ) {
if ( d->passwordNeedsUpdateFromWallet ) {
d->passwordNeedsUpdateFromWallet = false;
// read password if wallet is open, defer otherwise
if ( Wallet::isOpen( Wallet::NetworkWallet() ) ) {
// Don't read the password right away because this can lead
// to reentrancy problems in KDBusServiceStarter when an application
// run in Kontact creates the transports (due to a QEventLoop in the
// synchronous KWallet openWallet call).
QTimer::singleShot( 0, this, SLOT(readPassword()) );
} else {
d->passwordLoaded = false;
}
}
return;
}
......
/*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef MAILTRANSPORT_TRANSPORT_P_H
#define MAILTRANSPORT_TRANSPORT_P_H
#include "transporttype.h"
/**
* Private class that helps to provide binary compatibility between releases.
* @internal
*/
class TransportPrivate
{
public:
MailTransport::TransportType transportType;
QString password;
bool passwordLoaded;
bool passwordDirty;
bool storePasswordInFile;
bool needsWalletMigration;
QString oldName;
bool passwordNeedsUpdateFromWallet;
};
#endif
......@@ -23,6 +23,7 @@
#include "sendmailjob.h"
#include "smtpjob.h"
#include "transport.h"
#include "transport_p.h"
#include "transportjob.h"
#include "transporttype.h"
#include "transporttype_p.h"
......@@ -449,6 +450,7 @@ void TransportManagerPrivate::readConfig()
if ( old->currentGroup() == QLatin1String( "Transport " ) + re.cap( 1 ) ) {
kDebug() << "reloading existing transport:" << s;
t = old;
t->d->passwordNeedsUpdateFromWallet = true;
t->readConfig();
oldTransports.removeAll( old );
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment