• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

mailtransport

  • mailtransport
transportconfigdialog.cpp
1 /*
2  Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
3  Copyright (c) 2007 KovoKs <kovoks@kovoks.nl>
4  Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
5 
6  Based on KMail code by:
7  Copyright (c) 2001-2002 Michael Haeckel <haeckel@kde.org>
8 
9  This library is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or (at your
12  option) any later version.
13 
14  This library is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
17  License for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to the
21  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  02110-1301, USA.
23 */
24 
25 #include "transportconfigdialog.h"
26 #include "transport.h"
27 #include "transportconfigwidget.h"
28 #include "transportmanager.h"
29 #include "transporttype.h"
30 #include "sendmailconfigwidget.h"
31 #include "smtpconfigwidget.h"
32 
33 #include <QLabel>
34 #include <QString>
35 
36 #include <KDebug>
37 #include <KLocalizedString>
38 
39 using namespace MailTransport;
40 
41 class MailTransport::TransportConfigDialog::Private
42 {
43  public:
44  Private(TransportConfigDialog *qq)
45  : transport(0),
46  configWidget(0),
47  q(qq)
48  {
49 
50  }
51 
52  Transport *transport;
53  QWidget *configWidget;
54  TransportConfigDialog *q;
55 
56  // slots
57  void okClicked();
58  void slotTextChanged(const QString &text);
59 };
60 
61 void TransportConfigDialog::Private::okClicked()
62 {
63  if ( TransportConfigWidget *w = dynamic_cast<TransportConfigWidget*>( configWidget ) ) {
64  // It is not an Akonadi transport.
65  w->apply();
66  transport->writeConfig();
67  }
68 }
69 
70 void TransportConfigDialog::Private::slotTextChanged(const QString &text)
71 {
72  q->enableButtonOk(!text.isEmpty());
73 }
74 
75 
76 TransportConfigDialog::TransportConfigDialog( Transport *transport, QWidget *parent )
77  : KDialog( parent ), d( new Private(this) )
78 {
79  Q_ASSERT( transport );
80  d->transport = transport;
81  setButtons( Ok|Cancel );
82  bool pathIsEmpty = false;
83  switch ( transport->type() ) {
84  case Transport::EnumType::SMTP:
85  {
86  d->configWidget = new SMTPConfigWidget( transport, this );
87  break;
88  }
89  case Transport::EnumType::Sendmail:
90  {
91  SendmailConfigWidget *sendMailWidget = new SendmailConfigWidget( transport, this );
92  d->configWidget = sendMailWidget;
93  connect(sendMailWidget, SIGNAL(enableButtonOk(bool)), this, SLOT(enableButtonOk(bool)));
94  pathIsEmpty = sendMailWidget->pathIsEmpty();
95  break;
96  }
97  case Transport::EnumType::Akonadi:
98  {
99  kWarning() << "Tried to configure an Akonadi transport.";
100  d->configWidget = new QLabel( i18n( "This transport cannot be configured." ), this );
101  break;
102  }
103  default:
104  {
105  Q_ASSERT( false );
106  d->configWidget = 0;
107  break;
108  }
109  }
110  setMainWidget( d->configWidget );
111 
112  connect( this, SIGNAL(okClicked()), this, SLOT(okClicked()) );
113  enableButtonOk(!pathIsEmpty);
114 }
115 
116 TransportConfigDialog::~TransportConfigDialog()
117 {
118  delete d;
119 }
120 
121 #include "moc_transportconfigdialog.cpp"
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:26:53 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

mailtransport

Skip menu "mailtransport"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal