Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 49250053 authored by Laurent Montel's avatar Laurent Montel 😁 Committed by Pali Rohár

Port KSaveFile

parent 2e552ee2
......@@ -26,7 +26,7 @@
#include <QTextCodec>
#include <QTextStream>
#include <ksavefile.h>
#include <QSaveFile>
#include <kstandarddirs.h>
#include <KLocalizedString>
......@@ -151,8 +151,8 @@ void HighlightConfig::save()
const QString fileName = KStandardDirs::locateLocal( "appdata", QString::fromLatin1( "highlight.xml" ) );
KSaveFile file( fileName );
if( file.open() )
QSaveFile file( fileName );
if( file.open(QIODevice::WriteOnly) )
{
QTextStream stream ( &file );
stream.setCodec(QTextCodec::codecForName("UTF-8"));
......
......@@ -29,7 +29,7 @@
#include <kdebug.h>
#include <kstandarddirs.h>
#include <ksavefile.h>
#include <QSaveFile>
#include "kopeteglobal.h"
#include "kopetecontact.h"
......@@ -355,8 +355,8 @@ void HistoryLogger::saveToDisk()
QTime t;
t.start(); //mesure the time needed to save.
KSaveFile file( m_toSaveFileName );
if( file.open() )
QSaveFile file( m_toSaveFileName );
if( file.open(QIODevice::WriteOnly) )
{
QString buf;
QTextStream stream( &buf, QIODevice::WriteOnly );
......@@ -364,7 +364,7 @@ void HistoryLogger::saveToDisk()
m_toSaveDocument.doctype().save( stream, 1 );
m_toSaveDocument.documentElement().save( stream, 1 ); // QDomDocument::save() override stream codec to UTF-8
file.write( buf.toUtf8() );
file.finalize();
file.commit();
m_saveTimerTime=qMin(t.elapsed()*1000, 300000);
//a time 1000 times supperior to the time needed to save. but with a upper limit of 5 minutes
......
......@@ -36,7 +36,7 @@
#include <kdebug.h>
#include <kstandarddirs.h>
#include <ksavefile.h>
#include <QSaveFile>
#include "kopeteglobal.h"
#include "kopetecontact.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment