Commit 17105950 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use QLatin1Char('/') here

parent 1136cf50
......@@ -215,7 +215,7 @@ void ThemeEditorMainWindow::slotOpenTheme()
bool ThemeEditorMainWindow::loadTheme(const QString &directory)
{
if (!directory.isEmpty()) {
const QString filename = directory + QDir::separator() + QLatin1String("theme.themerc");
const QString filename = directory + QLatin1String("/theme.themerc");
if (!QFileInfo::exists(filename)) {
KMessageBox::error(this, i18n("Directory does not contain a theme file. We cannot load theme."));
return false;
......
......@@ -138,7 +138,7 @@ bool ThemeEditorPage::themeWasChanged() const
void ThemeEditorPage::installTheme(const QString &themePath)
{
QDir dir(themePath);
QDir themeDir(themePath + QDir::separator() + mDesktopPage->themeName());
QDir themeDir(themePath + QLatin1Char('/') + mDesktopPage->themeName());
if (themeDir.exists()) {
if (KMessageBox::questionYesNo(this, i18n("Theme already exists. Do you want to overwrite it?"), i18n("Theme already exists")) == KMessageBox::No) {
return;
......@@ -149,7 +149,7 @@ void ThemeEditorPage::installTheme(const QString &themePath)
return;
}
}
const QString newPath = themePath + QDir::separator() + mDesktopPage->themeName();
const QString newPath = themePath + QLatin1Char('/') + mDesktopPage->themeName();
mEditorPage->installTheme(newPath);
for (EditorPage *page : qAsConst(mExtraPage)) {
page->installTheme(newPath);
......@@ -164,10 +164,10 @@ void ThemeEditorPage::uploadTheme()
mEditorPage->preview()->updateViewer();
QTemporaryDir tmp;
const QString themename = mDesktopPage->themeName();
const QString zipFileName = tmp.path() + QDir::separator() + themename + QLatin1String(".zip");
const QString zipFileName = tmp.path() + QLatin1Char('/') + themename + QLatin1String(".zip");
KZip *zip = new KZip(zipFileName);
if (zip->open(QIODevice::WriteOnly)) {
const QString previewFileName = tmp.path() + QDir::separator() + themename + QLatin1String("_preview.png");
const QString previewFileName = tmp.path() + QLatin1Char('/') + themename + QLatin1String("_preview.png");
//qCDebug(CONTACTPRINTTHEMEEDITOR_LOG)<<" previewFileName"<<previewFileName;
QStringList lst;
lst << previewFileName;
......@@ -270,13 +270,13 @@ void ThemeEditorPage::loadTheme(const QString &filename)
{
if (mThemeSession->loadSession(filename)) {
mDesktopPage->loadTheme(mThemeSession->projectDirectory());
mEditorPage->loadTheme(mThemeSession->projectDirectory() + QDir::separator() + mThemeSession->mainPageFileName());
mEditorPage->loadTheme(mThemeSession->projectDirectory() + QLatin1Char('/') + mThemeSession->mainPageFileName());
mEditorPage->preview()->setThemePath(mThemeSession->projectDirectory(), mThemeSession->mainPageFileName());
const QStringList lstExtraPages = mThemeSession->extraPages();
for (const QString &page : lstExtraPages) {
EditorPage *extraPage = createExtraPage(page);
extraPage->loadTheme(mThemeSession->projectDirectory() + QDir::separator() + page);
extraPage->loadTheme(mThemeSession->projectDirectory() + QLatin1Char('/') + page);
}
mTabWidget->setCurrentIndex(0);
setChanged(false);
......
......@@ -212,7 +212,7 @@ void ContactEditorMainWindow::slotOpenTheme()
bool ContactEditorMainWindow::loadTheme(const QString &directory)
{
if (!directory.isEmpty()) {
const QString filename = directory + QDir::separator() + QLatin1String("theme.themerc");
const QString filename = directory + QLatin1String("/theme.themerc");
if (!QFileInfo::exists(filename)) {
KMessageBox::error(this, i18n("Directory does not contain a theme file. We cannot load theme."));
return false;
......
......@@ -133,7 +133,7 @@ bool ContactEditorPage::themeWasChanged() const
void ContactEditorPage::installTheme(const QString &themePath)
{
QDir dir(themePath);
QDir themeDir(themePath + QDir::separator() + mDesktopPage->themeName());
QDir themeDir(themePath + QLatin1Char('/') + mDesktopPage->themeName());
if (themeDir.exists()) {
if (KMessageBox::questionYesNo(this, i18n("Theme already exists. Do you want to overwrite it?"), i18n("Theme already exists")) == KMessageBox::No) {
return;
......@@ -144,7 +144,7 @@ void ContactEditorPage::installTheme(const QString &themePath)
return;
}
}
const QString newPath = themePath + QDir::separator() + mDesktopPage->themeName();
const QString newPath = themePath + QLatin1Char('/') + mDesktopPage->themeName();
mEditorPage->installTheme(newPath);
mEditorGroupPage->installTheme(newPath);
mEditorGroupEmbeddedPage->installTheme(newPath);
......@@ -163,12 +163,12 @@ void ContactEditorPage::uploadTheme()
mEditorPage->preview()->updateViewer();
QTemporaryDir tmp;
const QString themename = mDesktopPage->themeName();
const QString zipFileName = tmp.path() + QDir::separator() + themename + QLatin1String(".zip");
const QString zipFileName = tmp.path() + QLatin1Char('/') + themename + QLatin1String(".zip");
KZip *zip = new KZip(zipFileName);
if (zip->open(QIODevice::WriteOnly)) {
//TODO reactivate it when we will be able to create a preview
const QString previewContactFileName = tmp.path() + QDir::separator() + themename + QLatin1String("contact_preview.png");
const QString previewContactGroupFileName = tmp.path() + QDir::separator() + themename + QLatin1String("contactgroup_preview.png");
const QString previewContactFileName = tmp.path() + QLatin1Char('/') + themename + QLatin1String("contact_preview.png");
const QString previewContactGroupFileName = tmp.path() + QLatin1Char('/') + themename + QLatin1String("contactgroup_preview.png");
QStringList lst;
lst << previewContactFileName << previewContactGroupFileName;
......@@ -293,17 +293,17 @@ void ContactEditorPage::loadTheme(const QString &filename)
if (mThemeSession->loadSession(filename)) {
const QString projectDirectory = mThemeSession->projectDirectory();
mDesktopPage->loadTheme(projectDirectory);
mEditorGroupPage->loadTheme(projectDirectory + QDir::separator() + QLatin1String("contactgroup.html"));
mEditorGroupEmbeddedPage->loadTheme(projectDirectory + QDir::separator() + QLatin1String("contactgroup_embedded.html"));
mEditorEmbeddedPage->loadTheme(projectDirectory + QDir::separator() + QLatin1String("contact_embedded.html"));
mEditorGroupPage->loadTheme(projectDirectory + QLatin1String("/contactgroup.html"));
mEditorGroupEmbeddedPage->loadTheme(projectDirectory + QLatin1String("/contactgroup_embedded.html"));
mEditorEmbeddedPage->loadTheme(projectDirectory + QLatin1String("/contact_embedded.html"));
mEditorPage->loadTheme(projectDirectory + QDir::separator() + mThemeSession->mainPageFileName());
mEditorPage->loadTheme(projectDirectory + QLatin1Char('/') + mThemeSession->mainPageFileName());
mEditorPage->preview()->setThemePath(projectDirectory, mThemeSession->mainPageFileName());
const QStringList lstExtraPages = mThemeSession->extraPages();
for (const QString &page : lstExtraPages) {
EditorPage *extraPage = createExtraPage(page);
extraPage->loadTheme(projectDirectory + QDir::separator() + page);
extraPage->loadTheme(projectDirectory + QLatin1Char('/') + page);
}
mTabWidget->setCurrentIndex(0);
setChanged(false);
......
......@@ -166,7 +166,7 @@ QString DesktopFilePage::themeName() const
void DesktopFilePage::loadTheme(const QString &path)
{
const QString filename = path + QDir::separator() + mDefaultDesktopName;
const QString filename = path + QLatin1Char('/') + mDefaultDesktopName;
KDesktopFile desktopFile(filename);
mName->setText(desktopFile.desktopGroup().readEntry(QStringLiteral("Name")));
mDescription->setPlainText(desktopFile.desktopGroup().readEntry(QStringLiteral("Description")));
......@@ -184,7 +184,7 @@ void DesktopFilePage::loadTheme(const QString &path)
void DesktopFilePage::saveTheme(const QString &path)
{
const QString filename = path + QDir::separator() + mDefaultDesktopName;
const QString filename = path + QLatin1Char('/') + mDefaultDesktopName;
saveAsFilename(filename);
}
......@@ -211,7 +211,7 @@ void DesktopFilePage::saveAsFilename(const QString &filename)
void DesktopFilePage::installTheme(const QString &themePath)
{
const QString filename = themePath + QDir::separator() + mDefaultDesktopName;
const QString filename = themePath + QLatin1Char('/') + mDefaultDesktopName;
saveAsFilename(filename);
}
......
......@@ -91,7 +91,7 @@ void EditorPage::saveTheme(const QString &path)
return;
}
const QString filename = path + QDir::separator() + mPageFileName;
const QString filename = path + QLatin1Char('/') + mPageFileName;
saveAsFilename(filename);
}
......@@ -122,6 +122,6 @@ void EditorPage::createZip(const QString &themeName, KZip *zip)
void EditorPage::installTheme(const QString &themePath)
{
const QString filename = themePath + QDir::separator() + mPageFileName;
const QString filename = themePath + QLatin1Char('/') + mPageFileName;
saveAsFilename(filename);
}
......@@ -114,7 +114,7 @@ void ManageThemes::slotDeleteTheme()
}
if (KMessageBox::questionYesNo(this, msg, i18n("Remove theme")) == KMessageBox::Yes) {
for (QListWidgetItem *item : selectItems) {
if (QDir((d->mLocalDirectory + QDir::separator() + item->text())).removeRecursively()) {
if (QDir((d->mLocalDirectory + QLatin1Char('/') + item->text())).removeRecursively()) {
delete item;
} else {
KMessageBox::error(this, i18n("Theme \"%1\" cannot be deleted. Please contact your administrator.", item->text()), i18n("Delete theme failed"));
......
......@@ -88,7 +88,7 @@ bool ThemeSession::loadSession(const QString &session)
void ThemeSession::writeSession(const QString &directory)
{
QString themeDirectory = (directory.isEmpty() ? mProjectDirectory : directory);
KConfig config(themeDirectory + QDir::separator() + QLatin1String("theme.themerc"));
KConfig config(themeDirectory + QLatin1String("/theme.themerc"));
KConfigGroup global = config.group(QStringLiteral("Global"));
global.writeEntry(QStringLiteral("path"), themeDirectory);
global.writeEntry(QStringLiteral("mainPageName"), mMainPageFileName);
......
......@@ -241,7 +241,7 @@ void ThemeEditorMainWindow::slotOpenTheme()
bool ThemeEditorMainWindow::loadTheme(const QString &directory)
{
if (!directory.isEmpty()) {
const QString filename = directory + QDir::separator() + QLatin1String("theme.themerc");
const QString filename = directory + QLatin1String("/theme.themerc");
if (!QFileInfo::exists(filename)) {
KMessageBox::error(this, i18n("Directory does not contain a theme file. We cannot load theme."));
return false;
......
......@@ -161,7 +161,7 @@ bool ThemeEditorPage::themeWasChanged() const
void ThemeEditorPage::installTheme(const QString &themePath)
{
QDir dir(themePath);
QDir themeDir(themePath + QDir::separator() + mDesktopPage->themeName());
QDir themeDir(themePath + QLatin1Char('/') + mDesktopPage->themeName());
if (themeDir.exists()) {
if (KMessageBox::questionYesNo(this, i18n("Theme already exists. Do you want to overwrite it?"), i18n("Theme already exists")) == KMessageBox::No) {
return;
......@@ -172,7 +172,7 @@ void ThemeEditorPage::installTheme(const QString &themePath)
return;
}
}
const QString newPath = themePath + QDir::separator() + mDesktopPage->themeName();
const QString newPath = themePath + QLatin1Char('/') + mDesktopPage->themeName();
mEditorPage->setPageFileName(mDesktopPage->filename());
mEditorPage->installTheme(newPath);
for (EditorPage *page : qAsConst(mExtraPage)) {
......@@ -188,10 +188,10 @@ void ThemeEditorPage::uploadTheme()
mEditorPage->preview()->updateViewer();
QTemporaryDir tmp;
const QString themename = mDesktopPage->themeName();
const QString zipFileName = tmp.path() + QDir::separator() + themename + QLatin1String(".zip");
const QString zipFileName = tmp.path() + QLatin1Char('/') + themename + QLatin1String(".zip");
KZip *zip = new KZip(zipFileName);
if (zip->open(QIODevice::WriteOnly)) {
const QString previewFileName = tmp.path() + QDir::separator() + themename + QLatin1String("_preview.png");
const QString previewFileName = tmp.path() + QLatin1Char('/') + themename + QLatin1String("_preview.png");
//qCDebug(HEADERTHEMEEDITOR_LOG)<<" previewFileName"<<previewFileName;
QStringList lst;
lst << previewFileName;
......@@ -296,13 +296,13 @@ void ThemeEditorPage::loadTheme(const QString &filename)
{
if (mThemeSession->loadSession(filename)) {
mDesktopPage->loadTheme(mThemeSession->projectDirectory());
mEditorPage->loadTheme(mThemeSession->projectDirectory() + QDir::separator() + mThemeSession->mainPageFileName());
mEditorPage->loadTheme(mThemeSession->projectDirectory() + QLatin1Char('/') + mThemeSession->mainPageFileName());
mEditorPage->preview()->setThemePath(mThemeSession->projectDirectory(), mThemeSession->mainPageFileName());
const QStringList lstExtraPages = mThemeSession->extraPages();
for (const QString &page : lstExtraPages) {
EditorPage *extraPage = createExtraPage(page);
extraPage->loadTheme(mThemeSession->projectDirectory() + QDir::separator() + page);
extraPage->loadTheme(mThemeSession->projectDirectory() + QLatin1Char('/') + page);
}
mTabWidget->setCurrentIndex(0);
setChanged(false);
......
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