summaryrefslogtreecommitdiffstats
path: root/kitchensync/src/configguigcalendar.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /kitchensync/src/configguigcalendar.cpp
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kitchensync/src/configguigcalendar.cpp')
-rw-r--r--kitchensync/src/configguigcalendar.cpp103
1 files changed, 103 insertions, 0 deletions
diff --git a/kitchensync/src/configguigcalendar.cpp b/kitchensync/src/configguigcalendar.cpp
new file mode 100644
index 000000000..0434de789
--- /dev/null
+++ b/kitchensync/src/configguigcalendar.cpp
@@ -0,0 +1,103 @@
+/*
+ This file is part of KitchenSync.
+
+ Copyright (c) 2005 Cornelius Schumacher <schumacher@kde.org>
+ Copyright (c) 2006 Eduardo Habkost <ehabkost@raisama.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include "configguigcalendar.h"
+
+#include <klocale.h>
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qdom.h>
+#include <qlineedit.h>
+
+ConfigGuiGoogleCalendar::ConfigGuiGoogleCalendar( const QSync::Member &member, QWidget *parent )
+ : ConfigGui( member, parent )
+{
+ QBoxLayout *userLayout = new QHBoxLayout( topLayout() );
+
+ QLabel *userLbl= new QLabel( i18n("Username:"), this );
+ userLayout->addWidget(userLbl);
+
+ mUsername = new QLineEdit(this);
+ userLayout->addWidget(mUsername);
+
+
+ QBoxLayout *passLayout = new QHBoxLayout( topLayout() );
+
+ QLabel *passLbl = new QLabel( i18n("Password:"), this );
+ passLayout->addWidget(passLbl);
+
+ mPassword = new QLineEdit(this);
+ mPassword->setEchoMode(QLineEdit::Password);
+ passLayout->addWidget(mPassword);
+
+ topLayout()->addWidget(new QLabel( i18n("Please notice that currently the password is stored as plain text in the plugin configuration file"), this ));
+
+ QBoxLayout *urlLayout = new QHBoxLayout( topLayout() );
+ QLabel *urlLbl = new QLabel( i18n("Calendar URL:"), this );
+ urlLayout->addWidget(urlLbl);
+
+ mUrl = new QLineEdit(this);
+ urlLayout->addWidget(mUrl);
+
+ topLayout()->addStretch( 1 );
+}
+
+void ConfigGuiGoogleCalendar::load( const QString &xml )
+{
+ QDomDocument doc;
+ doc.setContent( xml );
+ QDomElement docElement = doc.documentElement();
+ QDomNode n;
+ for( n = docElement.firstChild(); !n.isNull(); n = n.nextSibling() ) {
+ QDomElement e = n.toElement();
+ if ( e.tagName() == "username" ) {
+ mUsername->setText(e.text());
+ } else if ( e.tagName() == "password" ) {
+ mPassword->setText(e.text());
+ } else if ( e.tagName() == "url" ) {
+ mUrl->setText(e.text());
+ }
+ }
+}
+
+QString ConfigGuiGoogleCalendar::save() const
+{
+ QDomDocument doc;
+ QDomElement root = doc.createElement("config");
+ doc.appendChild(root);
+
+ QDomElement un = doc.createElement("username");
+ root.appendChild(un);
+ un.appendChild(doc.createTextNode(mUsername->text()));
+
+ QDomElement pass = doc.createElement("password");
+ root.appendChild(pass);
+ pass.appendChild(doc.createTextNode(mPassword->text()));
+
+ QDomElement url = doc.createElement("url");
+ root.appendChild(url);
+ url.appendChild(doc.createTextNode(mUrl->text()));
+
+ //TODO: Implement me!
+ return doc.toString();
+}