# HG changeset patch # User sheepluva # Date 1318888886 -7200 # Node ID e658c6f698ddd1ba880b55f43f3371303ad53ca8 # Parent e8c302637b107b8279effa397e40ad3b29bb830e don't hoard empty friends/ignore-lists on the HDD diff -r e8c302637b10 -r e658c6f698dd QTfrontend/ui/widget/chatwidget.cpp --- a/QTfrontend/ui/widget/chatwidget.cpp Mon Oct 17 22:48:11 2011 +0200 +++ b/QTfrontend/ui/widget/chatwidget.cpp Tue Oct 18 00:01:26 2011 +0200 @@ -258,6 +258,21 @@ void HWChatWidget::saveList(QStringList & list, const QString & file) { QFile txt(cfgdir->absolutePath() + "/" + file); + + // list empty? => rather have no file for the list than an empty one + if (list.isEmpty()) + { + if (txt.exists()) + { + // try to remove file, if successful we're done here. + if (txt.remove()) + return; + } + else + // there is no file + return; + } + if(!txt.open(QIODevice::WriteOnly | QIODevice::Truncate)) return; QTextStream stream(&txt);