23 #include "configguigcalendar.h"
25 #include <tdelocale.h>
30 #include <tqlineedit.h>
32 ConfigGuiGoogleCalendar::ConfigGuiGoogleCalendar(
const QSync::Member &member, TQWidget *parent )
33 : ConfigGui( member, parent )
35 TQBoxLayout *userLayout =
new TQHBoxLayout( topLayout() );
37 TQLabel *userLbl=
new TQLabel( i18n(
"Username:"),
this );
38 userLayout->addWidget(userLbl);
40 mUsername =
new TQLineEdit(
this);
41 userLayout->addWidget(mUsername);
44 TQBoxLayout *passLayout =
new TQHBoxLayout( topLayout() );
46 TQLabel *passLbl =
new TQLabel( i18n(
"Password:"),
this );
47 passLayout->addWidget(passLbl);
49 mPassword =
new TQLineEdit(
this);
50 mPassword->setEchoMode(TQLineEdit::Password);
51 passLayout->addWidget(mPassword);
53 topLayout()->addWidget(
new TQLabel( i18n(
"Please notice that currently the password is stored as plain text in the plugin configuration file"),
this ));
55 TQBoxLayout *urlLayout =
new TQHBoxLayout( topLayout() );
56 TQLabel *urlLbl =
new TQLabel( i18n(
"Calendar URL:"),
this );
57 urlLayout->addWidget(urlLbl);
59 mUrl =
new TQLineEdit(
this);
60 urlLayout->addWidget(mUrl);
62 topLayout()->addStretch( 1 );
65 void ConfigGuiGoogleCalendar::load(
const TQString &xml )
68 doc.setContent( xml );
69 TQDomElement docElement = doc.documentElement();
71 for( n = docElement.firstChild(); !n.isNull(); n = n.nextSibling() ) {
72 TQDomElement e = n.toElement();
73 if ( e.tagName() ==
"username" ) {
74 mUsername->setText(e.text());
75 }
else if ( e.tagName() ==
"password" ) {
76 mPassword->setText(e.text());
77 }
else if ( e.tagName() ==
"url" ) {
78 mUrl->setText(e.text());
83 TQString ConfigGuiGoogleCalendar::save()
const
86 TQDomElement root = doc.createElement(
"config");
87 doc.appendChild(root);
89 TQDomElement un = doc.createElement(
"username");
91 un.appendChild(doc.createTextNode(mUsername->text()));
93 TQDomElement pass = doc.createElement(
"password");
94 root.appendChild(pass);
95 pass.appendChild(doc.createTextNode(mPassword->text()));
97 TQDomElement url = doc.createElement(
"url");
98 root.appendChild(url);
99 url.appendChild(doc.createTextNode(mUrl->text()));
102 return doc.toString();