author | zecke <zecke> | 2003-02-14 18:23:40 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-14 18:23:40 (UTC) |
commit | fc117979a54fca11e591395b130cfef307deb66f (patch) (side-by-side diff) | |
tree | c2aa7bb2e46a1506b9a8332c8e026aa04b550d2f /core/pim/todo/todotemplatemanager.cpp | |
parent | 1f5bb42810965f86ae02fea7cb9df20cbe9aa22f (diff) | |
download | opie-fc117979a54fca11e591395b130cfef307deb66f.zip opie-fc117979a54fca11e591395b130cfef307deb66f.tar.gz opie-fc117979a54fca11e591395b130cfef307deb66f.tar.bz2 |
Remove the #ifdef for QWS
Fix saving of templates
The backends want's to load before it saves...
Oliver now things should work again
Diffstat (limited to 'core/pim/todo/todotemplatemanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/todotemplatemanager.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/pim/todo/todotemplatemanager.cpp b/core/pim/todo/todotemplatemanager.cpp index 02941ac..5b83f76 100644 --- a/core/pim/todo/todotemplatemanager.cpp +++ b/core/pim/todo/todotemplatemanager.cpp @@ -10,13 +10,13 @@ using namespace Todo; TemplateManager::TemplateManager() { m_path = Global::applicationFileName("todolist", "templates.xml"); } TemplateManager::~TemplateManager() { - + save(); } void TemplateManager::load() { Config conf("todolist_templates"); OTodoAccessXML *xml = new OTodoAccessXML( QString::fromLatin1("template"), m_path ); OTodoAccess todoDB(xml ); @@ -28,22 +28,24 @@ void TemplateManager::load() { OTodo ev = (*it); conf.setGroup( QString::number( ev.uid() ) ); QString str = conf.readEntry("Name", QString::null ); if (str.isEmpty() ) continue; - m_templates.insert( str, - ev ); + m_templates.insert( str, ev ); } } void TemplateManager::save() { + qWarning("Saving!!!!"); Config conf("todolist_templates"); OTodoAccessXML *res = new OTodoAccessXML( "template", m_path ); OTodoAccess db(res); + db.load(); + db.clear(); QMap<QString, OTodo>::Iterator it; for ( it = m_templates.begin(); it != m_templates.end(); ++it ) { OTodo ev = it.data(); conf.setGroup( QString::number( ev.uid() ) ); @@ -53,13 +55,17 @@ void TemplateManager::save() { } db.save(); } void TemplateManager::addEvent( const QString& str, const OTodo& ev) { qWarning("AddEvent"+ str ); - m_templates.replace( str, ev ); + OTodo todo = ev; + if( ev.uid() == 0 ) + todo.setUid(1); // generate a new uid + + m_templates.replace( str, todo ); } void TemplateManager::removeEvent( const QString& str ) { m_templates.remove( str ); } QStringList TemplateManager::templates() const { QStringList list; |