kitchensync
configguievo2.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "configguievo2.h"
00023
00024 #include <tqdom.h>
00025 #include <tqlabel.h>
00026 #include <tqlayout.h>
00027 #include <tqstring.h>
00028
00029 #include <kurlrequester.h>
00030 #include <kurl.h>
00031 #include <kfile.h>
00032 #include <kdialog.h>
00033 #include <klocale.h>
00034
00035 ConfigGuiEvo2::ConfigGuiEvo2( const QSync::Member &member, TQWidget *parent )
00036 : ConfigGui( member, parent )
00037 {
00038 initGUI();
00039 }
00040
00041 void ConfigGuiEvo2::load( const TQString &xml )
00042 {
00043 TQDomDocument doc;
00044 doc.setContent( xml );
00045 TQDomElement docElement = doc.documentElement();
00046 TQDomNode node;
00047 for( node = docElement.firstChild(); !node.isNull(); node = node.nextSibling() ) {
00048 TQDomElement element = node.toElement();
00049 if ( element.tagName() == "address_path" ) {
00050 mAddressPath->setURL( element.text() );
00051 } else if ( element.tagName() == "calendar_path" ) {
00052 mCalendarPath->setURL( element.text() ) ;
00053 } else if ( element.tagName() == "tasks_path" ) {
00054 mTasksPath->setURL( element.text() );
00055 }
00056 }
00057 }
00058
00059 TQString ConfigGuiEvo2::save() const
00060 {
00061 TQString config = "<config>\n";
00062
00063 config += TQString( "<address_path>%1</address_path>\n" ).arg( mAddressPath->url() );
00064 config += TQString( "<calendar_path>%1</calendar_path>\n" ).arg( mCalendarPath->url() );
00065 config += TQString( "<tasks_path>%1</tasks_path>\n" ).arg( mTasksPath->url() );
00066
00067 config += "</config>";
00068
00069 return config;
00070 }
00071
00072 void ConfigGuiEvo2::initGUI()
00073 {
00074 TQGridLayout *layout = new TQGridLayout( topLayout(), 12, 3, KDialog::spacingHint() );
00075 layout->setMargin( KDialog::marginHint() );
00076
00077 layout->addWidget( new TQLabel( i18n( "Address Book location:" ), this ), 0, 0 );
00078 mAddressPath = new KURLRequester( this );
00079 mAddressPath->setMode( KFile::Directory );
00080 layout->addMultiCellWidget( mAddressPath, 0, 0, 1, 2 );
00081
00082 layout->addWidget( new TQLabel( i18n( "Calendar location:" ), this ), 1, 0 );
00083 mCalendarPath = new KURLRequester( this );
00084 mCalendarPath->setMode( KFile::Directory );
00085 layout->addMultiCellWidget( mCalendarPath, 1, 1, 1, 2 );
00086
00087 layout->addWidget( new TQLabel( i18n( "Task list location:" ), this ), 2, 0 );
00088 mTasksPath = new KURLRequester( this );
00089 mTasksPath->setMode( KFile::Directory );
00090 layout->addMultiCellWidget( mTasksPath, 2, 2, 1, 2 );
00091 }
|