update correctly the importing procedure

--there were some issues with the use of LayoutSettings
in places that we shouldnt use it. LayoutSettings now
is used to load only layouts with version>=2
pull/1/head
Michail Vourlakos 8 years ago
parent 7418c60a3f
commit fee7761d85

@ -194,10 +194,12 @@ QString Importer::layoutCanBeImported(QString oldAppletsPath, QString newName)
return QString();
}
LayoutSettings oldLSettings(this, oldAppletsPath);
KSharedConfigPtr lConfig = KSharedConfig::openConfig(oldAppletsPath);
KConfigGroup m_layoutGroup = KConfigGroup(lConfig, "LayoutSettings");
int layoutVersion = m_layoutGroup.readEntry("version", 1);
//! old file layout appears to not be old as its version is >=2
if (oldLSettings.version() >= 2) {
if (layoutVersion >= 2) {
return QString();
}
@ -219,8 +221,8 @@ QString Importer::layoutCanBeImported(QString oldAppletsPath, QString newName)
}
}
QFile newLayoutFile(layoutDir.absolutePath() + "/" + newName + ".layout.latte");
QString newLayoutPath = newLayoutFile.fileName();
QString newLayoutPath = layoutDir.absolutePath() + "/" + newName + ".layout.latte";
QFile newLayoutFile(newLayoutPath);
QStringList filter;
filter.append(QString(newName + "*.layout.latte"));

@ -28,15 +28,16 @@ namespace Latte {
LayoutSettings::LayoutSettings(QObject *parent, QString layoutFile, QString layoutName)
: QObject(parent)
{
qDebug() << "Layout file to create object: " << layoutFile;
qDebug() << "Layout file to create object: " << layoutFile << " with name: " << layoutName;
if (QFile(layoutFile).exists()) {
if (layoutName.isEmpty()) {
int lastSlash = layoutFile.lastIndexOf("/");
layoutName = layoutFile.remove(0, lastSlash + 1);
QString tempLayoutFile = layoutFile;
layoutName = tempLayoutFile.remove(0, lastSlash + 1);
int ext = layoutName.lastIndexOf(".latterc");
layoutName = layoutName.remove(ext, 8);
int ext = layoutName.lastIndexOf(".layout.latte");
layoutName = layoutName.remove(ext, 13);
}
KSharedConfigPtr lConfig = KSharedConfig::openConfig(layoutFile);

Loading…
Cancel
Save