/* This file is part of KitchenSync. Copyright (c) 2005 Cornelius Schumacher Copyright (c) 2006 Eduardo Habkost 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 "configguibarry.h" #include #include #include #include #include ConfigGuiBarry::ConfigGuiBarry( const QSync::Member &member, QWidget *parent ) : ConfigGui( member, parent ) { QBoxLayout *userLayout = new QHBoxLayout( topLayout() ); QLabel *pinLbl= new QLabel( i18n("PIN:"), this ); userLayout->addWidget(pinLbl); mPin = new QLineEdit(this); userLayout->addWidget(mPin); mCalendar = new QCheckBox( i18n("Sync calendar"), this ); userLayout->addWidget( mCalendar ); mContacts = new QCheckBox( i18n("Sync contacts"), this ); userLayout->addWidget( mContacts ); topLayout()->addStretch( 1 ); } void ConfigGuiBarry::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() == "pin" ) { mPin->setText(e.text()); } else if ( e.tagName() == "calendar" ) { mCalendar->setChecked( e.text() == "1" ); } else if ( e.tagName() == "contacts" ) { mContacts->setChecked( e.text() == "1" ); } } } QString ConfigGuiBarry::save() const { QString xml; xml = "Device " + mPin->text(); if ( mCalendar->isChecked() ) xml += " 1"; else xml += " 0"; if ( mContacts->isChecked() ) xml += " 1"; else xml += " 0"; return xml; }