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) (unidiff)
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()
73 } 73 }
74 } 74 }
75 confFile.close(); 75 confFile.close();
76 unchanged();
76 setExpandable( _valid ); 77 setExpandable( _valid );
77} 78}
78 79
80
81void ListViewItemConfFile::revert()
82{
83 if (_changed)
84 {
85 parseFile();
86 }else{
87 QString backup = confFileInfo->absFilePath()+"~";
88 QFile conf(confFileInfo->absFilePath());
89 QFile back(backup);
90
91 if (!back.open(IO_ReadOnly)) return;
92 if (!conf.open(IO_WriteOnly)) return;
93
94 #define SIZE 124
95 char buf[SIZE];
96 while (int c = back.readBlock(buf, SIZE) ) conf.writeBlock(buf,c);
97 conf.close();
98 back.close();
99 }
100}
101
79void ListViewItemConfFile::save() 102void ListViewItemConfFile::save()
80{ 103{
81 if (!_changed) return; 104 if (!_changed) return;
@@ -101,6 +124,11 @@ void ListViewItemConfFile::save()
101 ((ListViewItemConfigEntry*)it)->save(t); 124 ((ListViewItemConfigEntry*)it)->save(t);
102 } 125 }
103 conf.close(); 126 conf.close();
104 qDebug("no saveing yet...");
105 unchanged(); 127 unchanged();
106} 128}
129
130
131bool ListViewItemConfFile::revertable()
132{
133 return _changed || QFile(confFileInfo->absFilePath()+"~").exists();
134} \ No newline at end of file