kitchensync
configguijescs.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "configguijescs.h"
00023
00024 #include <tqcheckbox.h>
00025 #include <tqdom.h>
00026 #include <tqlabel.h>
00027 #include <tqlayout.h>
00028
00029 #include <klineedit.h>
00030 #include <kdialog.h>
00031 #include <klocale.h>
00032
00033 ConfigGuiJescs::ConfigGuiJescs( const QSync::Member &member, TQWidget *parent )
00034 : ConfigGui( member, parent )
00035 {
00036 initGUI();
00037 }
00038
00039 void ConfigGuiJescs::load( const TQString &xml )
00040 {
00041 TQDomDocument doc;
00042 doc.setContent( xml );
00043 TQDomElement docElement = doc.documentElement();
00044 TQDomNode node;
00045 for( node = docElement.firstChild(); !node.isNull(); node = node.nextSibling() ) {
00046 TQDomElement element = node.toElement();
00047 if ( element.tagName() == "url" ) {
00048 mUrl->setText( element.text() );
00049 } else if ( element.tagName() == "username" ) {
00050 mUsername->setText( element.text() );
00051 } else if ( element.tagName() == "password" ) {
00052 mPassword->setText( element.text() );
00053 } else if ( element.tagName() == "del_notify" ) {
00054 mDelNotify->setChecked( element.text() == "1" );
00055 }
00056 }
00057 }
00058
00059 TQString ConfigGuiJescs::save() const
00060 {
00061 int delNotifyState;
00062 TQString config = "<config>\n";
00063
00064 config += TQString( "<url>%1</url>\n" ).arg( mUrl->text() );
00065 config += TQString( "<username>%1</username>\n" ).arg( mUsername->text() );
00066 config += TQString( "<password>%1</password>\n" ).arg( mPassword->text() );
00067 if ( mDelNotify->isChecked() ) { delNotifyState = 1;
00068 } else { delNotifyState = 0;
00069 }
00070 config += TQString( "<del_notify>%1</del_notify>\n" ).arg( delNotifyState );
00071
00072 config += "</config>";
00073
00074 return config;
00075 }
00076
00077 void ConfigGuiJescs::initGUI()
00078 {
00079 TQGridLayout *layout = new TQGridLayout( topLayout(), 12, 3, KDialog::spacingHint() );
00080 layout->setMargin( KDialog::marginHint() );
00081
00082 layout->addWidget( new TQLabel( i18n( "URL:" ), this ), 0, 0 );
00083 mUrl = new KLineEdit( this );
00084 layout->addMultiCellWidget( mUrl, 0, 0, 1, 2 );
00085
00086 layout->addWidget( new TQLabel( i18n( "Username:" ), this ), 1, 0 );
00087 mUsername = new KLineEdit( this );
00088 layout->addMultiCellWidget( mUsername, 1, 1, 1, 2 );
00089
00090 layout->addWidget( new TQLabel( i18n( "Password:" ), this ), 2, 0 );
00091 mPassword = new KLineEdit( this );
00092 mPassword->setEchoMode( KLineEdit::Password );
00093 layout->addMultiCellWidget( mPassword, 2, 2, 1, 2 );
00094
00095 mDelNotify = new TQCheckBox( this );
00096 mDelNotify->setText( "Notify attendees about event/task deletion" );
00097 layout->addMultiCellWidget( mDelNotify, 3, 3, 0, 2 );
00098 }
|