kitchensync

configgui.cpp

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2005 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
00019     USA.
00020 */
00021 
00022 #include "configgui.h"
00023 
00024 
00025 #include "configguiblank.h"
00026 #include "configguifile.h"
00027 #include "configguignokii.h"
00028 #include "configguigpe.h"
00029 #include "configguiirmc.h"
00030 #include "configguildap.h"
00031 #include "configguiopie.h"
00032 #include "configguipalm.h"
00033 #include "configguisyncmlhttp.h"
00034 #include "configguisyncmlobex.h"
00035 #include "configguigcalendar.h"
00036 
00037 #include "memberinfo.h"
00038 
00039 #include <kdialog.h>
00040 #include <klocale.h>
00041 #include <klineedit.h>
00042 
00043 #include <qlayout.h>
00044 #include <qlabel.h>
00045 #include <qtextedit.h>
00046 
00047 ConfigGui::ConfigGui( const QSync::Member &member, QWidget *parent )
00048   : QWidget( parent ), mMember( member )
00049 {
00050   mTopLayout = new QVBoxLayout( this );
00051   mTopLayout->setSpacing( KDialog::spacingHint() );
00052   mTopLayout->setMargin( KDialog::marginHint() );
00053 
00054   QBoxLayout *nameLayout = new QHBoxLayout( mTopLayout );
00055 
00056   QLabel *label = new QLabel( i18n("Name:"), this );
00057   nameLayout->addWidget( label );
00058 
00059   mNameEdit = new KLineEdit( this );
00060   nameLayout->addWidget( mNameEdit );
00061 }
00062 
00063 void ConfigGui::setInstanceName( const QString &t )
00064 {
00065   mNameEdit->setText( t );
00066 }
00067 
00068 QString ConfigGui::instanceName() const
00069 {
00070   return mNameEdit->text();
00071 }
00072 
00073 ConfigGui *ConfigGui::Factory::create( const QSync::Member &member,
00074   QWidget *parent )
00075 {
00076   QString name = member.pluginName();
00077   if ( name == "file-sync" ) {
00078     return new ConfigGuiFile( member, parent );
00079   } else if ( name == "palm-sync" ) {
00080     return new ConfigGuiPalm( member, parent );
00081   } else if ( name == "irmc-sync" ) {
00082     return new ConfigGuiIRMC( member, parent );
00083   } else if ( name == "syncml-obex-client" ) {
00084     return new ConfigGuiSyncmlObex( member, parent );
00085   } else if ( name == "syncml-http-server" ) {
00086     return new ConfigGuiSyncmlHttp( member, parent );
00087   } else if ( name == "opie-sync" ) {
00088     return new ConfigGuiOpie( member, parent );
00089   } else if ( name == "gnokii-sync" ) {
00090     return new ConfigGuiGnokii( member, parent );
00091   } else if ( name == "gpe-sync" ) {
00092     return new ConfigGuiGpe( member, parent );
00093   } else if ( name == "google-calendar" ) {
00094     return new ConfigGuiGoogleCalendar( member, parent );
00095   } else if ( name == "ldap-sync" ) {
00096     return new ConfigGuiLdap( member, parent );
00097   } else if ( name == "kdepim-sync" ) {
00098     return new ConfigGuiBlank( member, parent ); 
00099   } else {
00100     return new ConfigGuiXml( member, parent );
00101   }
00102 }
00103 
00104 
00105 ConfigGuiXml::ConfigGuiXml( const QSync::Member &member, QWidget *parent )
00106   : ConfigGui( member, parent )
00107 {
00108   mTextEdit = new QTextEdit( this );
00109   topLayout()->addWidget( mTextEdit );  
00110 }
00111 
00112 void ConfigGuiXml::load( const QString &xml )
00113 {
00114   mTextEdit->setText( xml );
00115 }
00116 
00117 QString ConfigGuiXml::save()
00118 {
00119   return mTextEdit->text();
00120 }
KDE Home | KDE Accessibility Home | Description of Access Keys