summaryrefslogtreecommitdiff
path: root/noncore/apps/confedit/listviewitemconfigentry.cpp
Unidiff
Diffstat (limited to 'noncore/apps/confedit/listviewitemconfigentry.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/confedit/listviewitemconfigentry.cpp21
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,24 +1,25 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 // (c) 2002 Patrick S. Vogtp <tille@handhelds.org> 9 // (c) 2002 Patrick S. Vogtp <tille@handhelds.org>
10 10
11#include "listviewitemconfigentry.h" 11#include "listviewitemconfigentry.h"
12#include "listviewitemconffile.h" 12#include "listviewitemconffile.h"
13#include <qtextstream.h>
13 14
14ListViewItemConfigEntry::ListViewItemConfigEntry(ListViewItemConfFile *parent, QString group, QString key) 15ListViewItemConfigEntry::ListViewItemConfigEntry(ListViewItemConfFile *parent, QString group, QString key)
15 : ListViewItemConf(parent) 16 : ListViewItemConf(parent)
16{ 17{
17 _fileItem = parent; 18 _fileItem = parent;
18 _file = parent->fileName(); 19 _file = parent->fileName();
19 _group = group; 20 _group = group;
20 setKey(key); 21 setKey(key);
21 _fileItem->unchanged(); 22 _fileItem->unchanged();
22} 23}
23 24
24ListViewItemConfigEntry::~ListViewItemConfigEntry() 25ListViewItemConfigEntry::~ListViewItemConfigEntry()
@@ -95,13 +96,33 @@ void ListViewItemConfigEntry::displayText()
95 }else{ 96 }else{
96 s += _key+" = "+_value; 97 s += _key+" = "+_value;
97 _type = Key; 98 _type = Key;
98 } 99 }
99 setText(0,s); 100 setText(0,s);
100} 101}
101 102
102void ListViewItemConfigEntry::changed() 103void ListViewItemConfigEntry::changed()
103{ 104{
104 _changed=true; 105 _changed=true;
105 displayText(); 106 displayText();
106 _fileItem->changed(); 107 _fileItem->changed();
108}
109
110void ListViewItemConfigEntry::save(QTextStream *t)
111{
112 QString s;
113 if (isGroup())
114 {
115 s += "["+_group+"]";
116 _type = Group;
117 }else{
118 s += _key+" = "+_value;
119 _type = Key;
120 }
121 s += "\n";
122 (*t) << s;
123 _changed = false;
124 for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling())
125 {
126 ((ListViewItemConfigEntry*)it)->save(t);
127 }
107} \ No newline at end of file 128} \ No newline at end of file