Diffstat (limited to 'noncore/apps/confedit/listviewitemconfigentry.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/confedit/listviewitemconfigentry.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/noncore/apps/confedit/listviewitemconfigentry.cpp b/noncore/apps/confedit/listviewitemconfigentry.cpp index 16be46e..77ce17d 100644 --- a/noncore/apps/confedit/listviewitemconfigentry.cpp +++ b/noncore/apps/confedit/listviewitemconfigentry.cpp @@ -1,28 +1,29 @@ /*************************************************************************** * * * 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; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ // (c) 2002 Patrick S. Vogtp <tille@handhelds.org> #include "listviewitemconfigentry.h" #include "listviewitemconffile.h" +#include <qtextstream.h> ListViewItemConfigEntry::ListViewItemConfigEntry(ListViewItemConfFile *parent, QString group, QString key) : ListViewItemConf(parent) { _fileItem = parent; _file = parent->fileName(); _group = group; setKey(key); _fileItem->unchanged(); } ListViewItemConfigEntry::~ListViewItemConfigEntry() { } bool ListViewItemConfigEntry::isGroup() @@ -91,17 +92,37 @@ void ListViewItemConfigEntry::displayText() if (isGroup()) { s += "["+_group+"]"; _type = Group; }else{ s += _key+" = "+_value; _type = Key; } setText(0,s); } void ListViewItemConfigEntry::changed() { _changed=true; displayText(); _fileItem->changed(); +} + +void ListViewItemConfigEntry::save(QTextStream *t) +{ + QString s; + if (isGroup()) + { + s += "["+_group+"]"; + _type = Group; + }else{ + s += _key+" = "+_value; + _type = Key; + } + s += "\n"; + (*t) << s; + _changed = false; + for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling()) + { + ((ListViewItemConfigEntry*)it)->save(t); + } }
\ No newline at end of file |