[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdepim/wizards
From: Volker Krause <vkrause () kde ! org>
Date: 2007-05-25 15:11:48
Message-ID: 1180105908.492306.19800.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 668232 by vkrause:
Merge fixes from enterprise branch (668209, 668214 and 668225).
M +40 -7 kmailchanges.cpp
M +10 -0 kmailchanges.h
--- branches/KDE/3.5/kdepim/wizards/kmailchanges.cpp #668231:668232
@@ -30,6 +30,8 @@
#include <identity.h>
#include <kdebug.h>
#include <kstringhandler.h>
+#include <kwallet.h>
+using namespace KWallet;
static const char* s_folderContentsType[] = {
I18N_NOOP( "Calendar" ),
@@ -38,6 +40,7 @@
I18N_NOOP( "Tasks" ),
I18N_NOOP( "Journal" ) };
+Wallet* CreateImapAccount::mWallet = 0;
CreateImapAccount::CreateImapAccount( const QString &accountName, const QString &title )
: KConfigPropagator::Change( title ),
@@ -192,7 +195,14 @@
c.writeEntry( "use-tls", true );
}
+ if ( mEnableSavePassword ) {
+ if ( !writeToWallet( "account", accountId ) ) {
+ c.writeEntry( "pass", KStringHandler::obscure( mPassword ) );
+ c.writeEntry( "store-passwd", true );
+ }
+ }
+
c.setGroup( QString("Folder-%1").arg( uid ) );
c.writeEntry( "isOpen", true );
@@ -219,8 +229,10 @@
}
c.writeEntry( "user", mUser );
if ( mEnableSavePassword ) {
- c.writeEntry( "pass", KStringHandler::obscure( mPassword ) );
- c.writeEntry( "storepass", "true" );
+ if ( !writeToWallet( "transport", transportId ) ) {
+ c.writeEntry( "pass", KStringHandler::obscure( mPassword ) );
+ c.writeEntry( "storepass", true );
+ }
}
// Write email in "default kcontrol settings", used by IdentityManager
@@ -273,22 +285,24 @@
c.writeEntry( "Folder", uid );
c.writeEntry( "Id", uid );
c.writeEntry( "Type", "imap" );
- c.writeEntry( "auth", true );
+ c.writeEntry( "auth", "*" );
c.writeEntry( "Name", mAccountName );
c.writeEntry( "host", mServer );
c.writeEntry( "login", mUser );
if ( mEnableSavePassword ) {
- c.writeEntry( "pass", KStringHandler::obscure( mPassword ) );
- c.writeEntry( "store-passwd", true );
+ if ( !writeToWallet( "account", accCnt+1 ) ) {
+ c.writeEntry( "pass", KStringHandler::obscure( mPassword ) );
+ c.writeEntry( "store-passwd", true );
+ }
}
c.writeEntry( "port", "993" );
if ( mEncryption == SSL ) {
- c.writeEntry( "encryption", "SSL" );
+ c.writeEntry( "use-ssl", true );
} else if ( mEncryption == TLS ) {
- c.writeEntry( "encryption", "TLS" );
+ c.writeEntry( "use-tls", true );
}
if ( mAuthenticationSend == PLAIN ) {
@@ -310,3 +324,22 @@
c.setGroup( QString("Folder-%1").arg( uid ) );
c.writeEntry( "isOpen", true );
}
+
+bool CreateImapAccount::writeToWallet(const QString & type, int id)
+{
+ if ( !Wallet::isEnabled() )
+ return false;
+ if ( !mWallet || !mWallet->isOpen() ) {
+ delete mWallet;
+ WId window = 0;
+ if ( qApp->activeWindow() )
+ window = qApp->activeWindow()->winId();
+ mWallet = Wallet::openWallet( Wallet::NetworkWallet(), window );
+ if ( !mWallet )
+ return false;
+ if ( !mWallet->hasFolder( "kmail" ) )
+ mWallet->createFolder( "kmail" );
+ mWallet->setFolder( "kmail" );
+ }
+ return mWallet->writePassword( type + "-" + QString::number( id ), mPassword );
+}
--- branches/KDE/3.5/kdepim/wizards/kmailchanges.h #668231:668232
@@ -25,6 +25,10 @@
#include <kconfigpropagator.h>
#include <kconfig.h>
+namespace KWallet {
+ class Wallet;
+}
+
class CreateImapAccount : public KConfigPropagator::Change
{
public:
@@ -73,6 +77,9 @@
void setCustomWriter( CustomWriter * );
protected:
+ bool writeToWallet( const QString &type, int id );
+
+ protected:
QString mAccountName;
QString mServer;
@@ -95,6 +102,9 @@
int mExistingTransportId;
CustomWriter *mCustomWriter;
+
+ private:
+ static KWallet::Wallet *mWallet;
};
class CreateDisconnectedImapAccount : public CreateImapAccount
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic