QTfrontend/ui/widget/chatwidget.cpp
changeset 6145 e658c6f698dd
parent 6060 fdfc01419815
child 6147 b4d7d8d62feb
equal deleted inserted replaced
6144:e8c302637b10 6145:e658c6f698dd
   256 }
   256 }
   257 
   257 
   258 void HWChatWidget::saveList(QStringList & list, const QString & file)
   258 void HWChatWidget::saveList(QStringList & list, const QString & file)
   259 {
   259 {
   260     QFile txt(cfgdir->absolutePath() + "/" + file);
   260     QFile txt(cfgdir->absolutePath() + "/" + file);
       
   261 
       
   262     // list empty? => rather have no file for the list than an empty one
       
   263     if (list.isEmpty())
       
   264     {
       
   265         if (txt.exists())
       
   266         {
       
   267             // try to remove file, if successful we're done here.
       
   268             if (txt.remove())
       
   269                 return;
       
   270         }
       
   271         else
       
   272             // there is no file
       
   273             return;
       
   274     }
       
   275 
   261     if(!txt.open(QIODevice::WriteOnly | QIODevice::Truncate))
   276     if(!txt.open(QIODevice::WriteOnly | QIODevice::Truncate))
   262         return;
   277         return;
   263     QTextStream stream(&txt);
   278     QTextStream stream(&txt);
   264     stream.setCodec("UTF-8");
   279     stream.setCodec("UTF-8");
   265 
   280