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

mailtransport

  • sources
  • kde-4.14
  • kdepimlibs
  • 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 ), configWidget( 0 ), q( qq )
46  {
47  }
48 
49  Transport *transport;
50  QWidget *configWidget;
51  TransportConfigDialog *q;
52 
53  // slots
54  void okClicked();
55  void slotTextChanged( const QString &text );
56 };
57 
58 void TransportConfigDialog::Private::okClicked()
59 {
60  if ( TransportConfigWidget *w = dynamic_cast<TransportConfigWidget*>( configWidget ) ) {
61  // It is not an Akonadi transport.
62  w->apply();
63  transport->writeConfig();
64  }
65 }
66 
67 void TransportConfigDialog::Private::slotTextChanged( const QString &text )
68 {
69  q->enableButtonOk( !text.isEmpty() );
70 }
71 
72 TransportConfigDialog::TransportConfigDialog( Transport *transport, QWidget *parent )
73  : KDialog( parent ), d( new Private( this ) )
74 {
75  Q_ASSERT( transport );
76  d->transport = transport;
77  setButtons( Ok|Cancel );
78  bool pathIsEmpty = false;
79  switch ( transport->type() ) {
80  case Transport::EnumType::SMTP:
81  {
82  d->configWidget = new SMTPConfigWidget( transport, this );
83  break;
84  }
85  case Transport::EnumType::Sendmail:
86  {
87  SendmailConfigWidget *sendMailWidget = new SendmailConfigWidget( transport, this );
88  d->configWidget = sendMailWidget;
89  connect( sendMailWidget, SIGNAL(enableButtonOk(bool)),
90  this, SLOT(enableButtonOk(bool)) );
91  pathIsEmpty = sendMailWidget->pathIsEmpty();
92  break;
93  }
94  case Transport::EnumType::Akonadi:
95  {
96  kWarning() << "Tried to configure an Akonadi transport.";
97  d->configWidget = new QLabel( i18n( "This outgoing account cannot be configured." ), this );
98  break;
99  }
100  default:
101  {
102  Q_ASSERT( false );
103  d->configWidget = 0;
104  break;
105  }
106  }
107  setMainWidget( d->configWidget );
108 
109  connect( this, SIGNAL(okClicked()), this, SLOT(okClicked()) );
110  enableButtonOk( !pathIsEmpty );
111 }
112 
113 TransportConfigDialog::~TransportConfigDialog()
114 {
115  delete d;
116 }
117 
118 #include "moc_transportconfigdialog.cpp"
QWidget
MailTransport::SendmailConfigWidget
Definition: sendmailconfigwidget.h:44
MailTransport::SMTPConfigWidget
Definition: smtpconfigwidget.h:44
MailTransport::TransportConfigDialog::~TransportConfigDialog
virtual ~TransportConfigDialog()
Destroys the transport config dialog.
Definition: transportconfigdialog.cpp:113
QString::isEmpty
bool isEmpty() const
QString
MailTransport::TransportConfigWidget
Definition: transportconfigwidget.h:59
MailTransport::TransportConfigDialog
Configuration dialog for a mail transport.
Definition: transportconfigdialog.h:40
QLabel
MailTransport::Transport
Represents the settings of a specific mail transport.
Definition: transport.h:50
MailTransport::TransportConfigDialog::TransportConfigDialog
TransportConfigDialog(Transport *transport, QWidget *parent=0)
Creates a new mail transport configuration dialog for the given Transport object. ...
Definition: transportconfigdialog.cpp:72
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:49 by doxygen 1.8.7 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 API Reference

Skip menu "kdepimlibs 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

Search



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