MCPcopy Create free account
hub / github.com/KDE/labplot / saveProjectAs

Method saveProjectAs

src/frontend/MainWin.cpp:1735–1759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1733}
1734
1735bool MainWin::saveProjectAs() {
1736 KConfigGroup conf = Settings::group(QStringLiteral("MainWin"));
1737 const QString& dir = conf.readEntry("LastOpenDir", "");
1738 QString path = QFileDialog::getSaveFileName(this,
1739 i18nc("@title:window", "Save Project As"),
1740 dir + m_project->fileName(),
1741 i18n("LabPlot Projects (*.lml *.lml.gz *.lml.bz2 *.lml.xz *.LML *.LML.GZ *.LML.BZ2 *.LML.XZ)"));
1742 // The "Automatically select file name extension (.lml)" option does not change anything
1743
1744 if (path.isEmpty()) // "Cancel" was clicked
1745 return false;
1746
1747 if (!path.endsWith(QLatin1String(".lml"), Qt::CaseInsensitive))
1748 path.append(QLatin1String(".lml"));
1749
1750 // save new "last open directory"
1751 int pos = path.lastIndexOf(QLatin1String("/"));
1752 if (pos != -1) {
1753 const QString& newDir = path.left(pos);
1754 if (newDir != dir)
1755 conf.writeEntry("LastOpenDir", newDir);
1756 }
1757
1758 return save(path);
1759}
1760
1761/*!
1762 * auxiliary function that does the actual saving of the project

Callers

nothing calls this directly

Calls 4

groupFunction · 0.85
appendMethod · 0.80
fileNameMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected