summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp3
-rw-r--r--libkcal/sharpformat.cpp45
-rw-r--r--libkcal/sharpformat.h2
-rw-r--r--microkde/kconfig.cpp8
4 files changed, 10 insertions, 48 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index f8d752a..2321087 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2300,13 +2300,14 @@ void CalendarView::manageCategories()
int count = 0;
if ( cp->addCat() ) {
count = addCategories();
if ( count ) {
topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
writeSettings();
- }
+ } else
+ topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
} else {
removeCategories();
updateView();
}
delete cp;
}
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp
index b88e729..24b8349 100644
--- a/libkcal/sharpformat.cpp
+++ b/libkcal/sharpformat.cpp
@@ -61,13 +61,12 @@ using namespace KCal;
//MDAY
class SharpParser : public QObject
{
public:
SharpParser( Calendar *calendar ) : mCalendar( calendar ) {
- oldCategories = 0;
}
bool startElement( Calendar *existingCalendar, const QStringList & attList, QString qName )
{
int i = 1;
bool skip = true;
@@ -167,13 +166,13 @@ class SharpParser : public QObject
}
} else {
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;
if ( event->alarms().count() > 0 )
alarm = event->alarms().first();
@@ -221,13 +220,13 @@ class SharpParser : public QObject
int priority = attList[6].toInt();
if ( priority == 0 ) priority = 3;
todo->setPriority( priority );
QString categoryList = attList[1];
- todo->setCategories( lookupCategories( categoryList ) );
+ todo->setCategories( categoryList );
QString hasDateStr = attList[3]; // due
if ( !hasDateStr.isEmpty() ) {
if ( hasDateStr.right(6) == "000000" ) {
@@ -268,17 +267,12 @@ class SharpParser : public QObject
}
//qDebug("end ");
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();
m = s.mid(4,2).toInt();
t = s.mid(6,2).toInt();
@@ -298,51 +292,20 @@ class SharpParser : public QObject
QDateTime dt;
dt.setTime_t( value.toUInt() );
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()
{
}
ulong SharpFormat::getCsum( const QStringList & attList)
@@ -1015,13 +978,13 @@ bool SharpFormat::fromString2Cal( Calendar *calendar,Calendar *existingCalendar,
int start = 0;
int len = text.length();
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 ) {
tempString = getPart( text, ok, start );
if ( start >= len || start == 0 ) {
diff --git a/libkcal/sharpformat.h b/libkcal/sharpformat.h
index 0b13862..a71177d 100644
--- a/libkcal/sharpformat.h
+++ b/libkcal/sharpformat.h
@@ -37,24 +37,22 @@ class SharpFormat : public QObject {
/** Create new iCalendar format. */
SharpFormat();
virtual ~SharpFormat();
bool load( Calendar * ,Calendar *);
bool save( Calendar * );
- void setCategoriesList ( QStringList * cat ){ mCategories = cat; }
bool fromString2Cal( Calendar *, Calendar *, const QString & , const QString & );
bool fromString( Calendar *, const QString & );
QString toString( Calendar * );
static ulong getCsum( const QStringList & );
private:
QString getEventString( Event* );
QString getTodoString( Todo* );
QString dtToString( const QDateTime& dt, bool useTZ = true );
- QStringList *mCategories;
int getNumFromRecord( QString answer,Incidence* inc ) ;
QString getPart( const QString & text, bool &ok, int &start );
};
}
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp
index 5b685d3..862166d 100644
--- a/microkde/kconfig.cpp
+++ b/microkde/kconfig.cpp
@@ -103,13 +103,13 @@ QString KConfig::readEntry( const QString &key, const QString &def )
QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key );
if ( it == mStringMap.end() ) {
return def;
}
- return *it;
+ return QString::fromUtf8((*it).latin1());
}
QSize KConfig::readSizeEntry( const QString &key, QSize* def )
{
QValueList<int> intlist = readIntListEntry(key);
@@ -132,13 +132,13 @@ QStringList KConfig::readListEntry( const QString &key )
{
QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key );
if ( it == mStringMap.end() ) {
return QStringList();
}
- return QStringList::split(":", *it );
+ return QStringList::split(":", QString::fromUtf8((*it).latin1()));
}
bool KConfig::readBoolEntry( const QString &key, bool def )
{
QMap<QString,bool>::ConstIterator it = mBoolMap.find( mGroup + key );
@@ -210,20 +210,20 @@ void KConfig::writeEntry( const QString & key , int num )
{
writeEntry( key, QString::number ( num ) );
}
void KConfig::writeEntry( const QString &key, const QString &value )
{
- mStringMap.insert( mGroup + key, value );
+ mStringMap.insert( mGroup + key, value.utf8() );
mDirty = true;
}
void KConfig::writeEntry( const QString &key, const QStringList &value )
{
- mStringMap.insert( mGroup + key, value.join(":") );
+ mStringMap.insert( mGroup + key, value.join(":").utf8() );
mDirty = true;
}
void KConfig::writeEntry( const QString &key, bool value)
{