/*************************************************************************** * Copyright (C) 2007 by Tarek Saidi * * tarek.saidi@arcor.de * * * * 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; version 2 of the License. * * * * 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., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "Import_KeePassX_Xml.h" bool Import_KeePassX_Xml::importDatabase(QWidget* Parent, IDatabase* database){ db=database; GuiParent=Parent; QFile* file=openFile(GuiParent,identifier(),QStringList()<addGroup(&Group,ParentGroup); for(int i=0;inewEntry(Group); QDomNodeList ChildNodes=EntryElement.childNodes(); for(int i=0;isetTitle(ChildNodes.item(i).toElement().text()); else if(ChildNodes.item(i).toElement().tagName()=="username") entry->setUsername(ChildNodes.item(i).toElement().text()); else if(ChildNodes.item(i).toElement().tagName()=="password"){ SecString pw; QString cpw=ChildNodes.item(i).toElement().text(); pw.setString(cpw,true); entry->setPassword(pw); } else if(ChildNodes.item(i).toElement().tagName()=="url") entry->setUrl(ChildNodes.item(i).toElement().text()); else if(ChildNodes.item(i).toElement().tagName()=="icon") entry->setImage(ChildNodes.item(i).toElement().text().toInt()); else if(ChildNodes.item(i).toElement().tagName()=="creation") entry->setCreation(KpxDateTime::fromString(ChildNodes.item(i).toElement().text(),Qt::ISODate)); else if(ChildNodes.item(i).toElement().tagName()=="lastaccess") entry->setLastAccess(KpxDateTime::fromString(ChildNodes.item(i).toElement().text(),Qt::ISODate)); else if(ChildNodes.item(i).toElement().tagName()=="lastmod") entry->setLastMod(KpxDateTime::fromString(ChildNodes.item(i).toElement().text(),Qt::ISODate)); else if(ChildNodes.item(i).toElement().tagName()=="expire") entry->setExpire(KpxDateTime::fromString(ChildNodes.item(i).toElement().text(),Qt::ISODate)); else if(ChildNodes.item(i).toElement().tagName()=="bindesc") entry->setBinaryDesc(ChildNodes.item(i).toElement().text()); else if(ChildNodes.item(i).toElement().tagName()=="bin") entry->setBinary(QByteArray::fromBase64(ChildNodes.item(i).toElement().text().toAscii())); else if(ChildNodes.item(i).toElement().tagName()=="comment"){ QDomNodeList Lines=ChildNodes.item(i).childNodes(); QString comment; for(int i=0;isetComment(comment); } } return true; }