summaryrefslogtreecommitdiff
path: root/noncore/apps/confedit/listviewitemconffile.cpp
authortille <tille>2002-06-29 23:23:09 (UTC)
committer tille <tille>2002-06-29 23:23:09 (UTC)
commit0f179c0cc471b659b30dec4762c9c36678063f31 (patch) (side-by-side diff)
tree5350dc3b1c05991953011d01ad19cb12414abc1a /noncore/apps/confedit/listviewitemconffile.cpp
parenteb02223de534d315bfdcb0d521719c2d2e9a7235 (diff)
downloadopie-0f179c0cc471b659b30dec4762c9c36678063f31.zip
opie-0f179c0cc471b659b30dec4762c9c36678063f31.tar.gz
opie-0f179c0cc471b659b30dec4762c9c36678063f31.tar.bz2
revert
Diffstat (limited to 'noncore/apps/confedit/listviewitemconffile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/confedit/listviewitemconffile.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp
index 858726d..b075063 100644
--- a/noncore/apps/confedit/listviewitemconffile.cpp
+++ b/noncore/apps/confedit/listviewitemconffile.cpp
@@ -73,9 +73,32 @@ void ListViewItemConfFile::parseFile()
}
}
confFile.close();
+ unchanged();
setExpandable( _valid );
}
+
+void ListViewItemConfFile::revert()
+{
+ if (_changed)
+ {
+ parseFile();
+ }else{
+ QString backup = confFileInfo->absFilePath()+"~";
+ QFile conf(confFileInfo->absFilePath());
+ QFile back(backup);
+
+ if (!back.open(IO_ReadOnly)) return;
+ if (!conf.open(IO_WriteOnly)) return;
+
+ #define SIZE 124
+ char buf[SIZE];
+ while (int c = back.readBlock(buf, SIZE) ) conf.writeBlock(buf,c);
+ conf.close();
+ back.close();
+ }
+}
+
void ListViewItemConfFile::save()
{
if (!_changed) return;
@@ -101,6 +124,11 @@ void ListViewItemConfFile::save()
((ListViewItemConfigEntry*)it)->save(t);
}
conf.close();
- qDebug("no saveing yet...");
unchanged();
}
+
+
+bool ListViewItemConfFile::revertable()
+{
+ return _changed || QFile(confFileInfo->absFilePath()+"~").exists();
+} \ No newline at end of file