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 "configguibarry.h"
00026 #include "configguiblank.h"
00027 #include "configguifile.h"
00028 #include "configguignokii.h"
00029 #include "configguigpe.h"
00030 #include "configguiirmc.h"
00031 #include "configguildap.h"
00032 #include "configguiopie.h"
00033 #include "configguipalm.h"
00034 #include "configguisyncmlhttp.h"
00035 #include "configguisyncmlobex.h"
00036 #include "configguigcalendar.h"
00037 #include "configguijescs.h"
00038 #include "configguievo2.h"
00039 #include "configguimoto.h"
00040 #include "configguisynce.h"
00041 #include "configguisunbird.h"
00042 
00043 #include "memberinfo.h"
00044 
00045 #include <kdialog.h>
00046 #include <klocale.h>
00047 #include <klineedit.h>
00048 
00049 #include <qlayout.h>
00050 #include <qlabel.h>
00051 #include <qtextedit.h>
00052 
00053 ConfigGui::ConfigGui( const QSync::Member &member, QWidget *parent )
00054   : QWidget( parent ), mMember( member )
00055 {
00056   mTopLayout = new QVBoxLayout( this );
00057   mTopLayout->setSpacing( KDialog::spacingHint() );
00058   mTopLayout->setMargin( KDialog::marginHint() );
00059 
00060   QBoxLayout *nameLayout = new QHBoxLayout( mTopLayout );
00061 
00062   QLabel *label = new QLabel( i18n("Name:"), this );
00063   nameLayout->addWidget( label );
00064 
00065   mNameEdit = new KLineEdit( this );
00066   nameLayout->addWidget( mNameEdit );
00067 }
00068 
00069 void ConfigGui::setInstanceName( const QString &t )
00070 {
00071   mNameEdit->setText( t );
00072 }
00073 
00074 QString ConfigGui::instanceName() const
00075 {
00076   return mNameEdit->text();
00077 }
00078 
00079 ConfigGui *ConfigGui::Factory::create( const QSync::Member &member,
00080   QWidget *parent )
00081 {
00082   QString name = member.pluginName();
00083   if ( name == "file-sync" ) {
00084     return new ConfigGuiFile( member, parent );
00085   } else if ( name == "palm-sync" ) {
00086     return new ConfigGuiPalm( member, parent );
00087   } else if ( name == "irmc-sync" ) {
00088     return new ConfigGuiIRMC( member, parent );
00089   } else if ( name == "syncml-obex-client" ) {
00090     return new ConfigGuiSyncmlObex( member, parent );
00091   } else if ( name == "syncml-http-server" ) {
00092     return new ConfigGuiSyncmlHttp( member, parent );
00093   } else if ( name == "opie-sync" ) {
00094     return new ConfigGuiOpie( member, parent );
00095   } else if ( name == "barry-sync" ) {
00096     return new ConfigGuiBarry( member, parent );
00097   } else if ( name == "gnokii-sync" ) {
00098     return new ConfigGuiGnokii( member, parent );
00099   } else if ( name == "gpe-sync" ) {
00100     return new ConfigGuiGpe( member, parent );
00101   } else if ( name == "google-calendar" ) {
00102     return new ConfigGuiGoogleCalendar( member, parent );
00103   } else if ( name == "ldap-sync" ) {
00104     return new ConfigGuiLdap( member, parent );
00105   } else if ( name == "kdepim-sync" ) {
00106     return new ConfigGuiBlank( member, parent ); 
00107   } else if ( name == "jescs-sync" ) {
00108     return new ConfigGuiJescs( member, parent );
00109   } else if ( name == "evo2-sync" ) {
00110     return new ConfigGuiEvo2( member, parent );
00111   } else if ( name == "moto-sync" ) {
00112     return new ConfigGuiMoto( member, parent );
00113   } else if ( name == "synce-plugin" ) {
00114     return new ConfigGuiSynce( member, parent );
00115   } else if ( name == "synce-opensync-plugin" ) {
00116     return new ConfigGuiBlank( member, parent );
00117   } else if ( name == "sunbird-sync" ) {
00118     return new ConfigGuiSunbird( member, parent );
00119   } else {
00120     return new ConfigGuiXml( member, parent );
00121   }
00122 }
00123 
00124 
00125 ConfigGuiXml::ConfigGuiXml( const QSync::Member &member, QWidget *parent )
00126   : ConfigGui( member, parent )
00127 {
00128   mTextEdit = new QTextEdit( this );
00129   topLayout()->addWidget( mTextEdit );  
00130 }
00131 
00132 void ConfigGuiXml::load( const QString &xml )
00133 {
00134   mTextEdit->setText( xml );
00135 }
00136 
00137 QString ConfigGuiXml::save() const
00138 {
00139   return mTextEdit->text();
00140 }
KDE Home | KDE Accessibility Home | Description of Access Keys