Commit fff5fd0b authored by Volker Krause's avatar Volker Krause
Browse files

add import from KEMailSettings

svn path=/trunk/KDE/kdepim/mailtransport/; revision=622563
parent f18d79ab
...@@ -14,6 +14,7 @@ Migration ...@@ -14,6 +14,7 @@ Migration
TransportManager TransportManager
---------------- ----------------
- load passwords if another instance opens the wallet - load passwords if another instance opens the wallet
- load passwords if application opens wallet
- add D-Bus interface for sending mails - add D-Bus interface for sending mails
Transport Transport
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <kconfig.h> #include <kconfig.h>
#include <kdebug.h> #include <kdebug.h>
#include <kemailsettings.h>
#include <klocale.h> #include <klocale.h>
#include <kmessagebox.h> #include <kmessagebox.h>
#include <krandom.h> #include <krandom.h>
...@@ -86,7 +87,7 @@ Transport* TransportManager::transportById(int id, bool def) const ...@@ -86,7 +87,7 @@ Transport* TransportManager::transportById(int id, bool def) const
if ( t->id() == id ) if ( t->id() == id )
return t; return t;
if ( def || id == 0 ) if ( def || (id == 0 && mDefaultTransportId != id) )
return transportById( mDefaultTransportId, false ); return transportById( mDefaultTransportId, false );
return 0; return 0;
} }
...@@ -137,6 +138,19 @@ void TransportManager::schedule(TransportJob * job) ...@@ -137,6 +138,19 @@ void TransportManager::schedule(TransportJob * job)
job->start(); job->start();
} }
void TransportManager::createDefaultTransport()
{
KEMailSettings kes;
Transport *t = createTransport();
t->setName( i18n("Default Transport") );
t->setHost( kes.getSetting( KEMailSettings::OutServer ) );
if ( t->isValid() ) {
t->writeConfig();
addTransport( t );
} else
kWarning() << k_funcinfo << "KEMailSettings does not contain a vaild transport setting." << endl;
}
TransportJob* TransportManager::createTransportJob( int transportId ) TransportJob* TransportManager::createTransportJob( int transportId )
{ {
Transport *t = transportById( transportId, false ); Transport *t = transportById( transportId, false );
......
...@@ -131,6 +131,12 @@ class MAILTRANSPORT_EXPORT TransportManager : public QObject ...@@ -131,6 +131,12 @@ class MAILTRANSPORT_EXPORT TransportManager : public QObject
*/ */
void schedule( TransportJob* job ); void schedule( TransportJob* job );
/**
Trys to create a transport based on KEMailSettings.
If the data in KEMailSettings is incomplete, no transport is created.
*/
void createDefaultTransport();
public slots: public slots:
/** /**
Returns true if there are no mail transports at all. Returns true if there are no mail transports at all.
......
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