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 #include "configguijescs.h"
00037 #include "configguievo2.h"
00038 #include "configguimoto.h"
00039 #include "configguisynce.h"
00040 #include "configguisunbird.h"
00041 
00042 #include "memberinfo.h"
00043 
00044 #include <kdialog.h>
00045 #include <tdelocale.h>
00046 #include <klineedit.h>
00047 
00048 #include <tqlayout.h>
00049 #include <tqlabel.h>
00050 #include <tqtextedit.h>
00051 
00052 ConfigGui::ConfigGui( const QSync::Member &member, TQWidget *parent )
00053   : TQWidget( parent ), mMember( member )
00054 {
00055   mTopLayout = new TQVBoxLayout( this );
00056   mTopLayout->setSpacing( KDialog::spacingHint() );
00057   mTopLayout->setMargin( KDialog::marginHint() );
00058 
00059   TQBoxLayout *nameLayout = new TQHBoxLayout( mTopLayout );
00060 
00061   TQLabel *label = new TQLabel( i18n("Name:"), this );
00062   nameLayout->addWidget( label );
00063 
00064   mNameEdit = new KLineEdit( this );
00065   nameLayout->addWidget( mNameEdit );
00066 }
00067 
00068 void ConfigGui::setInstanceName( const TQString &t )
00069 {
00070   mNameEdit->setText( t );
00071 }
00072 
00073 TQString ConfigGui::instanceName() const
00074 {
00075   return mNameEdit->text();
00076 }
00077 
00078 ConfigGui *ConfigGui::Factory::create( const QSync::Member &member,
00079   TQWidget *parent )
00080 {
00081   TQString name = member.pluginName();
00082   if ( name == "file-sync" ) {
00083     return new ConfigGuiFile( member, parent );
00084   } else if ( name == "palm-sync" ) {
00085     return new ConfigGuiPalm( member, parent );
00086   } else if ( name == "irmc-sync" ) {
00087     return new ConfigGuiIRMC( member, parent );
00088   } else if ( name == "syncml-obex-client" ) {
00089     return new ConfigGuiSyncmlObex( member, parent );
00090   } else if ( name == "syncml-http-server" ) {
00091     return new ConfigGuiSyncmlHttp( member, parent );
00092   } else if ( name == "opie-sync" ) {
00093     return new ConfigGuiOpie( member, parent );
00094   } else if ( name == "gnokii-sync" ) {
00095     return new ConfigGuiGnokii( member, parent );
00096   } else if ( name == "gpe-sync" ) {
00097     return new ConfigGuiGpe( member, parent );
00098   } else if ( name == "google-calendar" ) {
00099     return new ConfigGuiGoogleCalendar( member, parent );
00100   } else if ( name == "ldap-sync" ) {
00101     return new ConfigGuiLdap( member, parent );
00102   } else if ( name == "tdepim-sync" ) {
00103     return new ConfigGuiBlank( member, parent ); 
00104   } else if ( name == "jescs-sync" ) {
00105     return new ConfigGuiJescs( member, parent );
00106   } else if ( name == "evo2-sync" ) {
00107     return new ConfigGuiEvo2( member, parent );
00108   } else if ( name == "moto-sync" ) {
00109     return new ConfigGuiMoto( member, parent );
00110   } else if ( name == "synce-plugin" ) {
00111     return new ConfigGuiSynce( member, parent );
00112   } else if ( name == "sunbird-sync" ) {
00113     return new ConfigGuiSunbird( member, parent );
00114   } else {
00115     return new ConfigGuiXml( member, parent );
00116   }
00117 }
00118 
00119 
00120 ConfigGuiXml::ConfigGuiXml( const QSync::Member &member, TQWidget *parent )
00121   : ConfigGui( member, parent )
00122 {
00123   mTextEdit = new TQTextEdit( this );
00124   topLayout()->addWidget( mTextEdit );  
00125 }
00126 
00127 void ConfigGuiXml::load( const TQString &xml )
00128 {
00129   mTextEdit->setText( xml );
00130 }
00131 
00132 TQString ConfigGuiXml::save() const
00133 {
00134   return mTextEdit->text();
00135 }