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

mailtransport

transportconfigdialog.cpp
00001 /*
00002     Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
00003     Copyright (c) 2007 KovoKs <kovoks@kovoks.nl>
00004     Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
00005 
00006     Based on KMail code by:
00007     Copyright (c) 2001-2002 Michael Haeckel <haeckel@kde.org>
00008 
00009     This library is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or (at your
00012     option) any later version.
00013 
00014     This library is distributed in the hope that it will be useful, but WITHOUT
00015     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00016     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00017     License for more details.
00018 
00019     You should have received a copy of the GNU Library General Public License
00020     along with this library; see the file COPYING.LIB.  If not, write to the
00021     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00022     02110-1301, USA.
00023 */
00024 
00025 #include "transportconfigdialog.h"
00026 #include "transport.h"
00027 #include "transportconfigwidget.h"
00028 #include "transportmanager.h"
00029 #include "transporttype.h"
00030 #include "sendmailconfigwidget.h"
00031 #include "smtpconfigwidget.h"
00032 
00033 #include <QLabel>
00034 #include <QString>
00035 
00036 #include <KDebug>
00037 #include <KLocalizedString>
00038 
00039 using namespace MailTransport;
00040 
00041 class MailTransport::TransportConfigDialog::Private
00042 {
00043   public:
00044     Transport *transport;
00045     QWidget *configWidget;
00046 
00047     // slots
00048     void okClicked();
00049 };
00050 
00051 void TransportConfigDialog::Private::okClicked()
00052 {
00053   if( TransportConfigWidget *w = dynamic_cast<TransportConfigWidget*>( configWidget ) ) {
00054     // It is not an Akonadi transport.
00055     w->apply();
00056     transport->writeConfig();
00057   }
00058 }
00059 
00060 TransportConfigDialog::TransportConfigDialog( Transport *transport, QWidget *parent )
00061   : KDialog( parent ), d( new Private )
00062 {
00063   Q_ASSERT( transport );
00064   d->transport = transport;
00065 
00066   switch( transport->type() ) {
00067     case Transport::EnumType::SMTP:
00068       {
00069         d->configWidget = new SMTPConfigWidget( transport, this );
00070         break;
00071       }
00072     case Transport::EnumType::Sendmail:
00073       {
00074         d->configWidget = new SendmailConfigWidget( transport, this );
00075         break;
00076       }
00077     case Transport::EnumType::Akonadi:
00078       {
00079         kWarning() << "Tried to configure an Akonadi transport.";
00080         d->configWidget = new QLabel( i18n( "This transport cannot be configured." ), this );
00081         break;
00082       }
00083     default:
00084       {
00085         Q_ASSERT( false );
00086         d->configWidget = 0;
00087         break;
00088       }
00089   }
00090   setMainWidget( d->configWidget );
00091 
00092   setButtons( Ok|Cancel );
00093   connect( this, SIGNAL(okClicked()), this, SLOT(okClicked()) );
00094 }
00095 
00096 TransportConfigDialog::~TransportConfigDialog()
00097 {
00098   delete d;
00099 }
00100 
00101 #include "transportconfigdialog.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 7 2012 23:58:59 by doxygen 1.8.0 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.8.3 API Reference

Skip menu "kdepimlibs-4.8.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • 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