Diffstat (limited to 'kabc/plugins/qtopia/qtopiaconverter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/plugins/qtopia/qtopiaconverter.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp index 106596f..39d366b 100644 --- a/kabc/plugins/qtopia/qtopiaconverter.cpp +++ b/kabc/plugins/qtopia/qtopiaconverter.cpp @@ -1,106 +1,104 @@ /* This file is part of libkabc. Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ //US #include "kglobal.h" #include "klocale.h" #include "qtopiaconverter.h" #include <qfile.h> #include <qdir.h> #include <qtextstream.h> //#include <.h> -//#include <qpe/categories.h> #include <libkdepim/ksyncprofile.h> -//US #include <qpe/categoryselect.h> using namespace KABC; QtopiaConverter::QtopiaConverter() { m_edit = 0; } QtopiaConverter::~QtopiaConverter() { deinit(); } bool QtopiaConverter::init() { QString fn = QDir::homeDirPath() +"/Settings/Categories.xml"; m_edit = new CategoryEdit( fn); return true; } void QtopiaConverter::deinit() { if (m_edit) { delete m_edit; m_edit = 0; } } QString QtopiaConverter::categoriesToNumber( const QStringList &list, const QString &app ) { startover: QStringList dummy; QValueList<OpieCategories>::ConstIterator catIt; QValueList<OpieCategories> categories = m_edit->categories(); bool found = false; for ( QStringList::ConstIterator listIt = list.begin(); listIt != list.end(); ++listIt ) { /* skip empty category name */ if ( (*listIt).isEmpty() ) continue; found = false; for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { /* * We currently do not take app into account * if name matches and the id isn't already in dummy we'll add it */ if ( (*catIt).name() == (*listIt) && !dummy.contains(( *catIt).id() ) ) { // the same name found= true; dummy << (*catIt).id(); } } /* if not found and the category is not empty * * generate a new category and start over again * ugly goto to reiterate */ if ( !found && !(*listIt).isEmpty() ){ m_edit->addCategory( app, (*listIt) ); // generate a new category goto startover; } } return dummy.join(";"); |