Commit eaa1c97e authored by Jonathan Armond's avatar Jonathan Armond
Browse files

Add a checkTransport method to TransportManager. Shows messagebox if no

outgoing accounts setup and gives user option to create one.

svn path=/trunk/KDE/kdepimlibs/; revision=986186
parent b29ce680
......@@ -22,6 +22,7 @@
#include "transport.h"
#include "smtpjob.h"
#include "sendmailjob.h"
#include "transportconfigdialog.h"
#include <kconfig.h>
#include <kdebug.h>
......@@ -202,6 +203,31 @@ void TransportManager::createDefaultTransport()
}
}
bool TransportManager::checkTransport( QWidget *parent )
{
if ( !isEmpty() )
return true;
const int response = KMessageBox::messageBox( parent,
KMessageBox::WarningContinueCancel,
i18n("You must create an outgoing account before sending."),
i18n("Create Account Now?"),
KGuiItem( i18n("Create Account Now") ) );
if ( response == KMessageBox::Continue ) {
Transport* transport = createTransport();
TransportConfigDialog* dialog = new TransportConfigDialog( transport, parent );
dialog->setAttribute( Qt::WA_DeleteOnClose );
dialog->setWindowModality( Qt::WindowModal );
if ( ( dialog->exec() == QDialog::Accepted ) && transport->isValid() ) {
addTransport( transport );
return true;
} else {
delete transport;
}
}
return false;
}
TransportJob *TransportManager::createTransportJob( int transportId )
{
Transport *t = transportById( transportId, false );
......
......@@ -139,6 +139,14 @@ class MAILTRANSPORT_EXPORT TransportManager : public QObject
*/
void createDefaultTransport();
/**
Check for an existing transport, and show a configuration dialog if not.
Returns true if transport exists or user creates one. Otherwise false.
@param parent Parent widget of the dialog
@since 4.4
*/
bool checkTransport( QWidget *parent );
public Q_SLOTS:
/**
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