kitchensync
configguigcalendar.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "configguigcalendar.h"
00024
00025 #include <klocale.h>
00026
00027 #include <tqlayout.h>
00028 #include <tqlabel.h>
00029 #include <tqdom.h>
00030 #include <tqlineedit.h>
00031
00032 ConfigGuiGoogleCalendar::ConfigGuiGoogleCalendar( const QSync::Member &member, TQWidget *parent )
00033 : ConfigGui( member, parent )
00034 {
00035 TQBoxLayout *userLayout = new TQHBoxLayout( topLayout() );
00036
00037 TQLabel *userLbl= new TQLabel( i18n("Username:"), this );
00038 userLayout->addWidget(userLbl);
00039
00040 mUsername = new TQLineEdit(this);
00041 userLayout->addWidget(mUsername);
00042
00043
00044 TQBoxLayout *passLayout = new TQHBoxLayout( topLayout() );
00045
00046 TQLabel *passLbl = new TQLabel( i18n("Password:"), this );
00047 passLayout->addWidget(passLbl);
00048
00049 mPassword = new TQLineEdit(this);
00050 mPassword->setEchoMode(TQLineEdit::Password);
00051 passLayout->addWidget(mPassword);
00052
00053 topLayout()->addWidget(new TQLabel( i18n("Please notice that currently the password is stored as plain text in the plugin configuration file"), this ));
00054
00055 TQBoxLayout *urlLayout = new TQHBoxLayout( topLayout() );
00056 TQLabel *urlLbl = new TQLabel( i18n("Calendar URL:"), this );
00057 urlLayout->addWidget(urlLbl);
00058
00059 mUrl = new TQLineEdit(this);
00060 urlLayout->addWidget(mUrl);
00061
00062 topLayout()->addStretch( 1 );
00063 }
00064
00065 void ConfigGuiGoogleCalendar::load( const TQString &xml )
00066 {
00067 TQDomDocument doc;
00068 doc.setContent( xml );
00069 TQDomElement docElement = doc.documentElement();
00070 TQDomNode n;
00071 for( n = docElement.firstChild(); !n.isNull(); n = n.nextSibling() ) {
00072 TQDomElement e = n.toElement();
00073 if ( e.tagName() == "username" ) {
00074 mUsername->setText(e.text());
00075 } else if ( e.tagName() == "password" ) {
00076 mPassword->setText(e.text());
00077 } else if ( e.tagName() == "url" ) {
00078 mUrl->setText(e.text());
00079 }
00080 }
00081 }
00082
00083 TQString ConfigGuiGoogleCalendar::save() const
00084 {
00085 TQDomDocument doc;
00086 TQDomElement root = doc.createElement("config");
00087 doc.appendChild(root);
00088
00089 TQDomElement un = doc.createElement("username");
00090 root.appendChild(un);
00091 un.appendChild(doc.createTextNode(mUsername->text()));
00092
00093 TQDomElement pass = doc.createElement("password");
00094 root.appendChild(pass);
00095 pass.appendChild(doc.createTextNode(mPassword->text()));
00096
00097 TQDomElement url = doc.createElement("url");
00098 root.appendChild(url);
00099 url.appendChild(doc.createTextNode(mUrl->text()));
00100
00101
00102 return doc.toString();
00103 }
|