Frameworks/Epics/Splitting kdelibs/Common Solutions: Difference between revisions
Appearance
Created page with "== KDebug == Replace KDebug by QDebug and the traces shouldn't be activated in release mode. == KWarning == Replace KWarning by QWarning and the traces shouldn't be activated ..." |
No edit summary |
||
Line 1: | Line 1: | ||
== KDebug == | == KDebug/KWarning == | ||
Replace KDebug by QDebug | Replace KDebug by QDebug. | ||
Replace KWarning by QWarning. | |||
the traces shouldn't be activated in release mode. | |||
For example : | |||
kWarning(7041) << "warning message" | kWarning(7041) << "warning message" | ||
Line 17: | Line 16: | ||
== KTemporaryFile == | == KTemporaryFile == | ||
Replace KTemporaryFile by QTemporaryFile | Replace KTemporaryFile by QTemporaryFile. | ||
For example : | |||
tmpFile = new KTemporaryFile(); | tmpFile = new KTemporaryFile(); | ||
Line 29: | Line 28: | ||
tmpFile = new QTemporaryFile(); | tmpFile = new QTemporaryFile(); | ||
tmpFile->setFileTemplate(QLatin1String("prefix-XXXXXX.txt")); | tmpFile->setFileTemplate(QLatin1String("prefix-XXXXXX.txt")); | ||
== KStandardPaths == | |||
Replace KStandardPaths by QStandardPath. | |||
For example to replace findAllResources : | |||
const QStringList magicFiles = KGlobal::dirs()->findAllResources("xdgdata-mime", QLatin1String("magic")); | |||
You have this solution : | |||
const QStringList magicFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,QLatin1String("mime/magic")); | |||
Another example to replace locateLocal : | |||
const QString pathDefaultMimeType = KGlobal::dirs()->locateLocal("xdgdata-mime", defaultMimeType+QLatin1String(".xml")); | |||
You have this solution : | |||
const QString pathDefaultMimeType = QStandardPaths::storageLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/mime/") + defaultMimeType + QLatin1String(".xml"); | |||
Another example to replace findExe: | |||
const QString umd = KStandardDirs::findExe(QString::fromLatin1("update-mime-database")); | |||
You have this solution : | |||
const QString umd = QStandardPaths::findExecutable(QString::fromLatin1("update-mime-database")); | |||
== KMimeType == | == KMimeType == | ||
Work in progress. | |||
Not yet in Qt5 or libinqt5, so this dependency has no solution yet. | |||
== KSaveFile == | == KSaveFile == | ||
Work in progress. | |||
Not yet in Qt5 or libinqt5, so this dependency has no solution yet. |
Revision as of 20:02, 3 December 2011
KDebug/KWarning
Replace KDebug by QDebug. Replace KWarning by QWarning.
the traces shouldn't be activated in release mode.
For example :
kWarning(7041) << "warning message"
Can be replaced by :
qWarning() << "warning message"
KTemporaryFile
Replace KTemporaryFile by QTemporaryFile.
For example :
tmpFile = new KTemporaryFile(); tmpFile->setPrefix(QLatin1String("prefix-")); tmpFile->setSuffix(QLatin1String(".txt"));
Can be replaced by :
tmpFile = new QTemporaryFile(); tmpFile->setFileTemplate(QLatin1String("prefix-XXXXXX.txt"));
KStandardPaths
Replace KStandardPaths by QStandardPath.
For example to replace findAllResources :
const QStringList magicFiles = KGlobal::dirs()->findAllResources("xdgdata-mime", QLatin1String("magic"));
You have this solution :
const QStringList magicFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,QLatin1String("mime/magic"));
Another example to replace locateLocal :
const QString pathDefaultMimeType = KGlobal::dirs()->locateLocal("xdgdata-mime", defaultMimeType+QLatin1String(".xml"));
You have this solution :
const QString pathDefaultMimeType = QStandardPaths::storageLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/mime/") + defaultMimeType + QLatin1String(".xml");
Another example to replace findExe:
const QString umd = KStandardDirs::findExe(QString::fromLatin1("update-mime-database"));
You have this solution :
const QString umd = QStandardPaths::findExecutable(QString::fromLatin1("update-mime-database"));
KMimeType
Work in progress. Not yet in Qt5 or libinqt5, so this dependency has no solution yet.
KSaveFile
Work in progress. Not yet in Qt5 or libinqt5, so this dependency has no solution yet.