summaryrefslogtreecommitdiff
path: root/noncore/apps/confedit/listviewitemconfigentry.cpp
authortille <tille>2002-06-30 01:05:42 (UTC)
committer tille <tille>2002-06-30 01:05:42 (UTC)
commit064b3d7b91a526a64c22facba228e3c2fec8fdc8 (patch) (side-by-side diff)
tree98221da79a27bc13b8214b92c8c936c529312e24 /noncore/apps/confedit/listviewitemconfigentry.cpp
parent1f9e13bb2d287a2495e2cbb0f8be0f53c883eae2 (diff)
downloadopie-064b3d7b91a526a64c22facba228e3c2fec8fdc8.zip
opie-064b3d7b91a526a64c22facba228e3c2fec8fdc8.tar.gz
opie-064b3d7b91a526a64c22facba228e3c2fec8fdc8.tar.bz2
late night
Diffstat (limited to 'noncore/apps/confedit/listviewitemconfigentry.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/confedit/listviewitemconfigentry.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/noncore/apps/confedit/listviewitemconfigentry.cpp b/noncore/apps/confedit/listviewitemconfigentry.cpp
index 77ce17d..b947514 100644
--- a/noncore/apps/confedit/listviewitemconfigentry.cpp
+++ b/noncore/apps/confedit/listviewitemconfigentry.cpp
@@ -10,24 +10,27 @@
#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);
+ _groupOrig = group;
+ _keyOrig = _key;
+ _valueOrig = _value;
_fileItem->unchanged();
}
ListViewItemConfigEntry::~ListViewItemConfigEntry()
{
}
bool ListViewItemConfigEntry::isGroup()
{
return _key.isEmpty();
}
@@ -98,31 +101,46 @@ void ListViewItemConfigEntry::displayText()
_type = Key;
}
setText(0,s);
}
void ListViewItemConfigEntry::changed()
{
_changed=true;
displayText();
_fileItem->changed();
}
+
+void ListViewItemConfigEntry::remove()
+{
+ delete this;
+}
+
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);
}
+}
+
+void ListViewItemConfigEntry::revert()
+{
+ _group = _groupOrig;
+ _key = _keyOrig;
+ _value = _valueOrig;
+ _changed=false;
+ displayText();
} \ No newline at end of file