22 #include "configguisynce.h"
27 #include <tqcheckbox.h>
29 #include <klineedit.h>
31 #include <tdelocale.h>
33 ConfigGuiSynce::ConfigGuiSynce(
const QSync::Member &member, TQWidget *parent )
34 : ConfigGui( member, parent )
39 void ConfigGuiSynce::load(
const TQString &xml )
42 doc.setContent( xml );
43 TQDomElement docElement = doc.documentElement();
45 for( node = docElement.firstChild(); !node.isNull(); node = node.nextSibling() ) {
46 TQDomElement element = node.toElement();
47 if ( element.tagName() ==
"contact" ) {
48 mContacts->setChecked( element.text().toInt() == 1 );
49 }
else if ( element.tagName() ==
"todos" ) {
50 mTodos->setChecked( element.text().toInt() == 1 );
51 }
else if ( element.tagName() ==
"calendar" ) {
52 mCalendar->setChecked( element.text().toInt() == 1 );
53 }
else if ( element.tagName() ==
"file" ) {
54 mFile->setText( element.text() );
59 TQString ConfigGuiSynce::save()
const
61 TQString config =
"<config>\n";
63 config += TQString(
"<contact>%1</contact>\n" ).arg( mContacts->isChecked() ?
"1" :
"0" );
64 config += TQString(
"<todos>%1</todos>\n" ).arg( mTodos->isChecked() ?
"1" :
"0" );
65 config += TQString(
"<calendar>%1</calendar>\n" ).arg( mCalendar->isChecked() ?
"1" :
"0" );
66 config += TQString(
"<file>%1</file>\n" ).arg( mFile->text() );
68 config +=
"</config>";
73 void ConfigGuiSynce::initGUI()
75 TQGridLayout *layout =
new TQGridLayout( topLayout(), 12, 2, KDialog::spacingHint() );
76 layout->setMargin( KDialog::marginHint() );
78 mContacts =
new TQCheckBox(
this );
79 mContacts->setText(
"Sync Contacts" );
80 layout->addMultiCellWidget( mContacts, 0, 0, 0, 1 );
82 mTodos =
new TQCheckBox(
this );
83 mTodos->setText(
"Sync \'Todo\' items" );
84 layout->addMultiCellWidget( mTodos, 1, 1, 0, 1 );
86 mCalendar =
new TQCheckBox(
this );
87 mCalendar->setText(
"Sync Calendar" );
88 layout->addMultiCellWidget( mCalendar, 2, 2, 0, 1 );
90 layout->addWidget(
new TQLabel( i18n(
"File:" ),
this ), 3, 0 );
91 mFile =
new KLineEdit(
this );
92 layout->addWidget( mFile, 3, 1 );