~ubuntu-branches/ubuntu/quantal/kdepimlibs/quantal-proposed

« back to all changes in this revision

Viewing changes to mailtransport/transport.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-07-08 00:32:40 UTC
  • mfrom: (1.1.63 upstream)
  • Revision ID: package-import@ubuntu.com-20110708003240-0gzufcu25rui82r1
Tags: 4:4.6.90-0ubuntu1
* New upstream release candidate
  - Bump build-dep on libakonadi-dev
  - update install files with new library versions
  - update libkcal4.install
  - refresh libakonadi-kde4.symbols, libkcalcore4.symbols,
    libkholidays4.symbols and libkimap4.symbols
  - exclude kde-runtime not kdebase-runtime in rules.
  - Update Vcs links for new location

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
*/
19
19
 
20
20
#include "transport.h"
 
21
#include "transport_p.h"
21
22
#include "legacydecrypt.h"
22
23
#include "mailtransport_defs.h"
23
24
#include "transportmanager.h"
38
39
using namespace MailTransport;
39
40
using namespace KWallet;
40
41
 
41
 
/**
42
 
 * Private class that helps to provide binary compatibility between releases.
43
 
 * @internal
44
 
 */
45
 
class TransportPrivate
46
 
{
47
 
  public:
48
 
    TransportType transportType;
49
 
    QString password;
50
 
    bool passwordLoaded;
51
 
    bool passwordDirty;
52
 
    bool storePasswordInFile;
53
 
    bool needsWalletMigration;
54
 
    QString oldName;
55
 
};
56
 
 
57
42
Transport::Transport( const QString &cfgGroup ) :
58
43
    TransportBase( cfgGroup ), d( new TransportPrivate )
59
44
{
62
47
  d->passwordDirty = false;
63
48
  d->storePasswordInFile = false;
64
49
  d->needsWalletMigration = false;
 
50
  d->passwordNeedsUpdateFromWallet = false;
65
51
  readConfig();
66
52
}
67
53
 
201
187
  }
202
188
 
203
189
  // we have everything we need
204
 
  if ( !storePassword() || d->passwordLoaded ) {
 
190
  if ( !storePassword() ) {
 
191
    return;
 
192
  }
 
193
 
 
194
  if ( d->passwordLoaded ) {
 
195
    if ( d->passwordNeedsUpdateFromWallet ) {
 
196
      d->passwordNeedsUpdateFromWallet = false;
 
197
      // read password if wallet is open, defer otherwise
 
198
      if ( Wallet::isOpen( Wallet::NetworkWallet() ) ) {
 
199
        // Don't read the password right away because this can lead
 
200
        // to reentrancy problems in KDBusServiceStarter when an application
 
201
        // run in Kontact creates the transports (due to a QEventLoop in the
 
202
        // synchronous KWallet openWallet call).
 
203
        QTimer::singleShot( 0, this, SLOT(readPassword()) );
 
204
      } else {
 
205
        d->passwordLoaded = false;
 
206
      }
 
207
    }
 
208
 
205
209
    return;
206
210
  }
207
211