Commit 5d6ff614 authored by Thomas McGuire's avatar Thomas McGuire
Browse files

API fixes: rename a method and merge with another

svn path=/trunk/KDE/kdepimlibs/; revision=1068299
parent dbb6623e
......@@ -96,7 +96,7 @@ void TransportManagementWidget::Private::updateButtonState()
void TransportManagementWidget::Private::addClicked()
{
TransportManager::self()->showNewTransportDialog( q );
TransportManager::self()->showTransportCreationDialog( q );
}
void TransportManagementWidget::Private::editClicked()
......
......@@ -225,29 +225,28 @@ void TransportManager::createDefaultTransport()
}
}
bool TransportManager::showNewTransportDialog( QWidget *parent )
bool TransportManager::showTransportCreationDialog( QWidget *parent,
ShowCondition showCondition )
{
QPointer<AddTransportDialog> dialog = new AddTransportDialog( parent );
bool accepted = ( dialog->exec() == QDialog::Accepted );
delete dialog;
return accepted;
}
bool TransportManager::promptCreateTransportIfNoneExists( QWidget *parent )
{
if ( !isEmpty() ) {
return true;
}
if ( showCondition == IfNoTransportExists ) {
if ( !isEmpty() ) {
return true;
}
const int response = KMessageBox::messageBox( parent,
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 ) {
return showNewTransportDialog( parent );
if ( response != KMessageBox::Continue ) {
return false;
}
}
return false;
QPointer<AddTransportDialog> dialog = new AddTransportDialog( parent );
const bool accepted = ( dialog->exec() == QDialog::Accepted );
delete dialog;
return accepted;
}
bool TransportManager::configureTransport( Transport *transport, QWidget *parent )
......
......@@ -164,24 +164,21 @@ class MAILTRANSPORT_EXPORT TransportManager : public QObject
*/
void createDefaultTransport();
/// Describes when to show the transport creation dialog
enum ShowCondition {
Always, ///< Show the transport creation dialog unconditionally
IfNoTransportExists ///< Only show the transport creation dialog if no transport currently
/// exists. Ask the user if he wants to add a transport in the other case.
};
/**
Shows a dialog for creating and configuring a new transport.
@param parent Parent widget of the dialog.
@param showCondition the condition under which the dialog is shown at all
@return True if a new transport has been created and configured.
@since 4.4
*/
bool showNewTransportDialog( QWidget *parent );
//TODO_AKONADI_REVIEW: rename to showTransportCreationDialog()
/**
If no transport exists, asks the user to create and configure one.
Returns true if a transport exists or the user created one. Otherwise
returns false.
@param parent Parent widget of the dialog.
@since 4.4
*/
bool promptCreateTransportIfNoneExists( QWidget *parent );
//TODO_AKONADI_REVIEW: merge the above methods, add enum 'Always' and 'IfNoneExists'
bool showTransportCreationDialog( QWidget *parent, ShowCondition showCondition = Always );
/**
Open a configuration dialog for an existing transport.
......
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