kitchensync

configgui.cpp
1 /*
2  This file is part of KitchenSync.
3 
4  Copyright (c) 2005 Cornelius Schumacher <schumacher@kde.org>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19  USA.
20 */
21 
22 #include "configgui.h"
23 
24 
25 #include "configguiblank.h"
26 #include "configguifile.h"
27 #include "configguignokii.h"
28 #include "configguigpe.h"
29 #include "configguiirmc.h"
30 #include "configguildap.h"
31 #include "configguiopie.h"
32 #include "configguipalm.h"
33 #include "configguisyncmlhttp.h"
34 #include "configguisyncmlobex.h"
35 #include "configguigcalendar.h"
36 #include "configguijescs.h"
37 #include "configguievo2.h"
38 #include "configguimoto.h"
39 #include "configguisynce.h"
40 #include "configguisunbird.h"
41 
42 #include "memberinfo.h"
43 
44 #include <kdialog.h>
45 #include <tdelocale.h>
46 #include <klineedit.h>
47 
48 #include <tqlayout.h>
49 #include <tqlabel.h>
50 #include <tqtextedit.h>
51 
52 ConfigGui::ConfigGui( const QSync::Member &member, TQWidget *parent )
53  : TQWidget( parent ), mMember( member )
54 {
55  mTopLayout = new TQVBoxLayout( this );
56  mTopLayout->setSpacing( KDialog::spacingHint() );
57  mTopLayout->setMargin( KDialog::marginHint() );
58 
59  TQBoxLayout *nameLayout = new TQHBoxLayout( mTopLayout );
60 
61  TQLabel *label = new TQLabel( i18n("Name:"), this );
62  nameLayout->addWidget( label );
63 
64  mNameEdit = new KLineEdit( this );
65  nameLayout->addWidget( mNameEdit );
66 }
67 
68 void ConfigGui::setInstanceName( const TQString &t )
69 {
70  mNameEdit->setText( t );
71 }
72 
73 TQString ConfigGui::instanceName() const
74 {
75  return mNameEdit->text();
76 }
77 
78 ConfigGui *ConfigGui::Factory::create( const QSync::Member &member,
79  TQWidget *parent )
80 {
81  TQString name = member.pluginName();
82  if ( name == "file-sync" ) {
83  return new ConfigGuiFile( member, parent );
84  } else if ( name == "palm-sync" ) {
85  return new ConfigGuiPalm( member, parent );
86  } else if ( name == "irmc-sync" ) {
87  return new ConfigGuiIRMC( member, parent );
88  } else if ( name == "syncml-obex-client" ) {
89  return new ConfigGuiSyncmlObex( member, parent );
90  } else if ( name == "syncml-http-server" ) {
91  return new ConfigGuiSyncmlHttp( member, parent );
92  } else if ( name == "opie-sync" ) {
93  return new ConfigGuiOpie( member, parent );
94  } else if ( name == "gnokii-sync" ) {
95  return new ConfigGuiGnokii( member, parent );
96  } else if ( name == "gpe-sync" ) {
97  return new ConfigGuiGpe( member, parent );
98  } else if ( name == "google-calendar" ) {
99  return new ConfigGuiGoogleCalendar( member, parent );
100  } else if ( name == "ldap-sync" ) {
101  return new ConfigGuiLdap( member, parent );
102  } else if ( name == "tdepim-sync" ) {
103  return new ConfigGuiBlank( member, parent );
104  } else if ( name == "jescs-sync" ) {
105  return new ConfigGuiJescs( member, parent );
106  } else if ( name == "evo2-sync" ) {
107  return new ConfigGuiEvo2( member, parent );
108  } else if ( name == "moto-sync" ) {
109  return new ConfigGuiMoto( member, parent );
110  } else if ( name == "synce-plugin" ) {
111  return new ConfigGuiSynce( member, parent );
112  } else if ( name == "sunbird-sync" ) {
113  return new ConfigGuiSunbird( member, parent );
114  } else {
115  return new ConfigGuiXml( member, parent );
116  }
117 }
118 
119 
120 ConfigGuiXml::ConfigGuiXml( const QSync::Member &member, TQWidget *parent )
121  : ConfigGui( member, parent )
122 {
123  mTextEdit = new TQTextEdit( this );
124  topLayout()->addWidget( mTextEdit );
125 }
126 
127 void ConfigGuiXml::load( const TQString &xml )
128 {
129  mTextEdit->setText( xml );
130 }
131 
132 TQString ConfigGuiXml::save() const
133 {
134  return mTextEdit->text();
135 }