1/*
2 Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
3
4 Based on MailTransport code by:
5 Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
6 Copyright (c) 2007 KovoKs <kovoks@kovoks.nl>
7
8 Based on KMail code by:
9 Copyright (c) 2001-2002 Michael Haeckel <haeckel@kde.org>
10
11 This library is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Library General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
15
16 This library is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
19 License for more details.
20
21 You should have received a copy of the GNU Library General Public License
22 along with this library; see the file COPYING.LIB. If not, write to the
23 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 02110-1301, USA.
25*/
26
27#include "transportconfigwidget.h"
28#include "transportconfigwidget_p.h"
29#include "transport.h"
30#include "transportmanager.h"
31
32#include <KConfigDialogManager>
33#include <KDebug>
34
35using namespace MailTransport;
36
37TransportConfigWidget::TransportConfigWidget( Transport *transport, QWidget *parent )
38 : QWidget( parent ), d_ptr( new TransportConfigWidgetPrivate )
39{
40 init( transport );
41}
42
43TransportConfigWidget::TransportConfigWidget( TransportConfigWidgetPrivate &dd,
44 Transport *transport, QWidget *parent )
45 : QWidget( parent ), d_ptr( &dd )
46{
47 init( transport );
48}
49
50TransportConfigWidget::~ TransportConfigWidget()
51{
52 delete d_ptr;
53}
54
55void TransportConfigWidget::init( Transport *transport )
56{
57 Q_D( TransportConfigWidget );
58 kDebug() << "this" << this << "d" << d;
59 Q_ASSERT( transport );
60 d->transport = transport;
61
62 d->manager = new KConfigDialogManager( this, transport );
63 //d->manager->updateWidgets(); // no-op; ui is set up in subclasses.
64}
65
66KConfigDialogManager *TransportConfigWidget::configManager() const
67{
68 Q_D( const TransportConfigWidget );
69 Q_ASSERT( d->manager );
70 return d->manager;
71}
72
73void TransportConfigWidget::apply()
74{
75 Q_D( TransportConfigWidget );
76 d->manager->updateSettings();
77 d->transport->forceUniqueName();
78 d->transport->writeConfig();
79 kDebug() << "Config written.";
80}
81
82