-rw-r--r-- | libkcal/sharpformat.cpp | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index b88e729..24b8349 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp @@ -63,9 +63,8 @@ using namespace KCal; class SharpParser : public QObject { public: SharpParser( Calendar *calendar ) : mCalendar( calendar ) { - oldCategories = 0; } bool startElement( Calendar *existingCalendar, const QStringList & attList, QString qName ) { @@ -169,9 +168,9 @@ class SharpParser : public QObject event->recurrence()->unsetRecurs(); } QString categoryList = attList[1] ; - event->setCategories( lookupCategories( categoryList ) ); + event->setCategories( categoryList ); // strange 0 semms to mean: alarm enabled if ( attList[8] == "0" ) { Alarm *alarm; @@ -223,9 +222,9 @@ class SharpParser : public QObject if ( priority == 0 ) priority = 3; todo->setPriority( priority ); QString categoryList = attList[1]; - todo->setCategories( lookupCategories( categoryList ) ); + todo->setCategories( categoryList ); QString hasDateStr = attList[3]; // due @@ -270,13 +269,8 @@ class SharpParser : public QObject return true; } - void setCategoriesList ( QStringList * c ) - { - oldCategories = c; - } - QDateTime fromString ( QString s, bool useTz = true ) { QDateTime dt; int y,m,t,h,min,sec; y = s.mid(0,4).toInt(); @@ -300,47 +294,16 @@ class SharpParser : public QObject return dt; } - QStringList lookupCategories( const QString &categoryList ) - { - QStringList categoryIds = QStringList::split( ";", categoryList ); - QStringList categories; - QStringList::ConstIterator it; - for( it = categoryIds.begin(); it != categoryIds.end(); ++it ) { - QString cate = category( *it ); - if ( oldCategories ) { - if ( ! oldCategories->contains( cate ) ) - oldCategories->append( cate ); - } - categories.append(cate ); - } - return categories; - } - private: Calendar *mCalendar; - QStringList * oldCategories; - static QString category( const QString &id ) - { - QMap<QString,QString>::ConstIterator it = mCategoriesMap.find( id ); - if ( it == mCategoriesMap.end() ) return id; - else return *it; - } - - static void setCategory( const QString &id, const QString &name ) - { - mCategoriesMap.insert( id, name ); - } - - static QMap<QString,QString> mCategoriesMap; }; -QMap<QString,QString> SharpParser::mCategoriesMap; SharpFormat::SharpFormat() { - mCategories = 0; + } SharpFormat::~SharpFormat() { @@ -1017,9 +980,9 @@ bool SharpFormat::fromString2Cal( Calendar *calendar,Calendar *existingCalendar, int end = text.find ("\n",start)+1; bool ok = true; start = end; SharpParser handler( calendar ); - handler.setCategoriesList( mCategories ); + // handler.setCategoriesList( mCategories ); while ( start > 0 ) { templist.clear(); ok = true; while ( ok ) { |