kitchensync
configgui.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00041 #include "memberinfo.h"
00042
00043 #include <kdialog.h>
00044 #include <klocale.h>
00045 #include <klineedit.h>
00046
00047 #include <qlayout.h>
00048 #include <qlabel.h>
00049 #include <qtextedit.h>
00050
00051 ConfigGui::ConfigGui( const QSync::Member &member, QWidget *parent )
00052 : QWidget( parent ), mMember( member )
00053 {
00054 mTopLayout = new QVBoxLayout( this );
00055 mTopLayout->setSpacing( KDialog::spacingHint() );
00056 mTopLayout->setMargin( KDialog::marginHint() );
00057
00058 QBoxLayout *nameLayout = new QHBoxLayout( mTopLayout );
00059
00060 QLabel *label = new QLabel( i18n("Name:"), this );
00061 nameLayout->addWidget( label );
00062
00063 mNameEdit = new KLineEdit( this );
00064 nameLayout->addWidget( mNameEdit );
00065 }
00066
00067 void ConfigGui::setInstanceName( const QString &t )
00068 {
00069 mNameEdit->setText( t );
00070 }
00071
00072 QString ConfigGui::instanceName() const
00073 {
00074 return mNameEdit->text();
00075 }
00076
00077 ConfigGui *ConfigGui::Factory::create( const QSync::Member &member,
00078 QWidget *parent )
00079 {
00080 QString name = member.pluginName();
00081 if ( name == "file-sync" ) {
00082 return new ConfigGuiFile( member, parent );
00083 } else if ( name == "palm-sync" ) {
00084 return new ConfigGuiPalm( member, parent );
00085 } else if ( name == "irmc-sync" ) {
00086 return new ConfigGuiIRMC( member, parent );
00087 } else if ( name == "syncml-obex-client" ) {
00088 return new ConfigGuiSyncmlObex( member, parent );
00089 } else if ( name == "syncml-http-server" ) {
00090 return new ConfigGuiSyncmlHttp( member, parent );
00091 } else if ( name == "opie-sync" ) {
00092 return new ConfigGuiOpie( member, parent );
00093 } else if ( name == "gnokii-sync" ) {
00094 return new ConfigGuiGnokii( member, parent );
00095 } else if ( name == "gpe-sync" ) {
00096 return new ConfigGuiGpe( member, parent );
00097 } else if ( name == "google-calendar" ) {
00098 return new ConfigGuiGoogleCalendar( member, parent );
00099 } else if ( name == "ldap-sync" ) {
00100 return new ConfigGuiLdap( member, parent );
00101 } else if ( name == "kdepim-sync" ) {
00102 return new ConfigGuiBlank( member, parent );
00103 } else if ( name == "jescs-sync" ) {
00104 return new ConfigGuiJescs( member, parent );
00105 } else if ( name == "evo2-sync" ) {
00106 return new ConfigGuiEvo2( member, parent );
00107 } else if ( name == "moto-sync" ) {
00108 return new ConfigGuiMoto( member, parent );
00109 } else if ( name == "synce-plugin" ) {
00110 return new ConfigGuiSynce( member, parent );
00111 } else {
00112 return new ConfigGuiXml( member, parent );
00113 }
00114 }
00115
00116
00117 ConfigGuiXml::ConfigGuiXml( const QSync::Member &member, QWidget *parent )
00118 : ConfigGui( member, parent )
00119 {
00120 mTextEdit = new QTextEdit( this );
00121 topLayout()->addWidget( mTextEdit );
00122 }
00123
00124 void ConfigGuiXml::load( const QString &xml )
00125 {
00126 mTextEdit->setText( xml );
00127 }
00128
00129 QString ConfigGuiXml::save() const
00130 {
00131 return mTextEdit->text();
00132 }
|