Port to QStandardPaths

This commit is contained in:
Montel Laurent 2014-10-07 13:21:58 +02:00
parent 49129b788a
commit 08013f87d0
3 changed files with 12 additions and 9 deletions

View File

@ -17,8 +17,9 @@
#include <kbookmarkmenu.h>
#include <QtCore/QDebug>
#include <QApplication>
#include <kstandarddirs.h>
#include <kurl.h>
#include <QStandardPaths>
// local includes
#include "document_p.h"
@ -138,7 +139,7 @@ BookmarkManager::BookmarkManager( DocumentPrivate * document )
d->document = document;
d->file = KStandardDirs::locateLocal( "data", "okular/bookmarks.xml" );
d->file = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + "okular/bookmarks.xml" ;
d->manager = KBookmarkManager::managerForFile( d->file, "okular" );
d->manager->setEditorOptions( QGuiApplication::applicationDisplayName(), false );

View File

@ -50,7 +50,7 @@
#include <kprocess.h>
#include <krun.h>
#include <kshell.h>
#include <kstandarddirs.h>
#include <ktoolinvocation.h>
#include <kzip.h>
@ -90,6 +90,7 @@
#include <config-okular.h>
#include <KFormat>
#include <QStandardPaths>
using namespace Okular;
@ -2122,11 +2123,11 @@ QString DocumentPrivate::docDataFileName(const KUrl &url, qint64 document_size)
QString fn = url.fileName();
fn = QString::number( document_size ) + '.' + fn + ".xml";
QString newokular = "okular/docdata/" + fn;
QString newokularfile = KStandardDirs::locateLocal( "data", newokular );
QString newokularfile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + newokular ;
if ( !QFile::exists( newokularfile ) )
{
QString oldkpdf = "kpdf/" + fn;
QString oldkpdffile = KStandardDirs::locateLocal( "data", oldkpdf );
QString oldkpdffile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + oldkpdf ;
if ( QFile::exists( oldkpdffile ) )
{
// ### copy or move?

View File

@ -28,6 +28,7 @@
#include <ktempdir.h>
#include <QtCore/QDebug>
#include <kdeversion.h>
#include <QStandardPaths>
#include "debug_p.h"
@ -124,9 +125,9 @@ int FilePrinter::doPrintFiles( QPrinter &printer, QStringList fileList, FileDele
exe = "lpr-cups";
} else if ( !KStandardDirs::findExe("lpr.cups").isEmpty() ) {
exe = "lpr.cups";
} else if ( !KStandardDirs::findExe("lpr").isEmpty() ) {
} else if ( !QStandardPaths::findExecutable("lpr").isEmpty() ) {
exe = "lpr";
} else if ( !KStandardDirs::findExe("lp").isEmpty() ) {
} else if ( !QStandardPaths::findExecutable("lp").isEmpty() ) {
exe = "lp";
} else {
return -9;
@ -227,12 +228,12 @@ QString FilePrinter::pageListToPageRange( const QList<int> &pageList )
bool FilePrinter::ps2pdfAvailable()
{
return ( !KStandardDirs::findExe("ps2pdf").isEmpty() );
return ( !QStandardPaths::findExecutable("ps2pdf").isEmpty() );
}
bool FilePrinter::pdf2psAvailable()
{
return ( !KStandardDirs::findExe("pdf2ps").isEmpty() );
return ( !QStandardPaths::findExecutable("pdf2ps").isEmpty() );
}
bool FilePrinter::cupsAvailable()