Diffstat (limited to 'noncore/apps/confedit/listviewitemconffile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/confedit/listviewitemconffile.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp index b075063..228421b 100644 --- a/noncore/apps/confedit/listviewitemconffile.cpp +++ b/noncore/apps/confedit/listviewitemconffile.cpp @@ -80,2 +80,9 @@ void ListViewItemConfFile::parseFile() +void ListViewItemConfFile::remove() +{ + QFile::remove(confFileInfo->absFilePath()); + QFile::remove(backupFileName()); + delete this; +} + void ListViewItemConfFile::revert() @@ -86,5 +93,4 @@ void ListViewItemConfFile::revert() }else{ - QString backup = confFileInfo->absFilePath()+"~"; QFile conf(confFileInfo->absFilePath()); - QFile back(backup); + QFile back(backupFileName()); @@ -104,6 +110,4 @@ void ListViewItemConfFile::save() if (!_changed) return; - QString backup = confFileInfo->absFilePath()+"~"; - qDebug("make backup to "+backup); QFile conf(confFileInfo->absFilePath()); - QFile back(backup); + QFile back(backupFileName()); @@ -112,3 +116,2 @@ void ListViewItemConfFile::save() - #define SIZE 124 char buf[SIZE]; @@ -132,3 +135,8 @@ bool ListViewItemConfFile::revertable() { - return _changed || QFile(confFileInfo->absFilePath()+"~").exists(); -}
\ No newline at end of file + return _changed || QFile(backupFileName()).exists(); +} + +QString ListViewItemConfFile::backupFileName() +{ + return confFileInfo->absFilePath()+"~"; +} |