summaryrefslogtreecommitdiffstats
path: root/kitchensync/src/configgui.cpp
blob: 553b2f5e5bfe343cb004d66ca4ad27b163dd0cfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
    This file is part of KitchenSync.

    Copyright (c) 2005 Cornelius Schumacher <[email protected]>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    USA.
*/

#include "configgui.h"


#include "configguiblank.h"
#include "configguifile.h"
#include "configguignokii.h"
#include "configguigpe.h"
#include "configguiirmc.h"
#include "configguildap.h"
#include "configguiopie.h"
#include "configguipalm.h"
#include "configguisyncmlhttp.h"
#include "configguisyncmlobex.h"
#include "configguigcalendar.h"
#include "configguijescs.h"
#include "configguievo2.h"
#include "configguimoto.h"
#include "configguisynce.h"
#include "configguisunbird.h"

#include "memberinfo.h"

#include <kdialog.h>
#include <klocale.h>
#include <klineedit.h>

#include <tqlayout.h>
#include <tqlabel.h>
#include <tqtextedit.h>

ConfigGui::ConfigGui( const QSync::Member &member, TQWidget *parent )
  : TQWidget( parent ), mMember( member )
{
  mTopLayout = new TQVBoxLayout( this );
  mTopLayout->setSpacing( KDialog::spacingHint() );
  mTopLayout->setMargin( KDialog::marginHint() );

  TQBoxLayout *nameLayout = new TQHBoxLayout( mTopLayout );

  TQLabel *label = new TQLabel( i18n("Name:"), this );
  nameLayout->addWidget( label );

  mNameEdit = new KLineEdit( this );
  nameLayout->addWidget( mNameEdit );
}

void ConfigGui::setInstanceName( const TQString &t )
{
  mNameEdit->setText( t );
}

TQString ConfigGui::instanceName() const
{
  return mNameEdit->text();
}

ConfigGui *ConfigGui::Factory::create( const QSync::Member &member,
  TQWidget *parent )
{
  TQString name = member.pluginName();
  if ( name == "file-sync" ) {
    return new ConfigGuiFile( member, parent );
  } else if ( name == "palm-sync" ) {
    return new ConfigGuiPalm( member, parent );
  } else if ( name == "irmc-sync" ) {
    return new ConfigGuiIRMC( member, parent );
  } else if ( name == "syncml-obex-client" ) {
    return new ConfigGuiSyncmlObex( member, parent );
  } else if ( name == "syncml-http-server" ) {
    return new ConfigGuiSyncmlHttp( member, parent );
  } else if ( name == "opie-sync" ) {
    return new ConfigGuiOpie( member, parent );
  } else if ( name == "gnokii-sync" ) {
    return new ConfigGuiGnokii( member, parent );
  } else if ( name == "gpe-sync" ) {
    return new ConfigGuiGpe( member, parent );
  } else if ( name == "google-calendar" ) {
    return new ConfigGuiGoogleCalendar( member, parent );
  } else if ( name == "ldap-sync" ) {
    return new ConfigGuiLdap( member, parent );
  } else if ( name == "tdepim-sync" ) {
    return new ConfigGuiBlank( member, parent ); 
  } else if ( name == "jescs-sync" ) {
    return new ConfigGuiJescs( member, parent );
  } else if ( name == "evo2-sync" ) {
    return new ConfigGuiEvo2( member, parent );
  } else if ( name == "moto-sync" ) {
    return new ConfigGuiMoto( member, parent );
  } else if ( name == "synce-plugin" ) {
    return new ConfigGuiSynce( member, parent );
  } else if ( name == "sunbird-sync" ) {
    return new ConfigGuiSunbird( member, parent );
  } else {
    return new ConfigGuiXml( member, parent );
  }
}


ConfigGuiXml::ConfigGuiXml( const QSync::Member &member, TQWidget *parent )
  : ConfigGui( member, parent )
{
  mTextEdit = new TQTextEdit( this );
  topLayout()->addWidget( mTextEdit );  
}

void ConfigGuiXml::load( const TQString &xml )
{
  mTextEdit->setText( xml );
}

TQString ConfigGuiXml::save() const
{
  return mTextEdit->text();
}