Add const to the saveAs* members, step 2
This commit is contained in:
@@ -191,9 +191,9 @@ bool DocumentPrivate::loadPackage(QIODevice *device)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DocumentPrivate::savePackage(QIODevice *device)
|
bool DocumentPrivate::savePackage(QIODevice *device) const
|
||||||
{
|
{
|
||||||
Q_Q(Document);
|
Q_Q(const Document);
|
||||||
ZipWriter zipWriter(device);
|
ZipWriter zipWriter(device);
|
||||||
if (zipWriter.error())
|
if (zipWriter.error())
|
||||||
return false;
|
return false;
|
||||||
@@ -202,6 +202,7 @@ bool DocumentPrivate::savePackage(QIODevice *device)
|
|||||||
DocPropsApp docPropsApp;
|
DocPropsApp docPropsApp;
|
||||||
DocPropsCore docPropsCore;
|
DocPropsCore docPropsCore;
|
||||||
|
|
||||||
|
//: Todo
|
||||||
workbook->prepareDrawings();
|
workbook->prepareDrawings();
|
||||||
|
|
||||||
// save worksheet xml files
|
// save worksheet xml files
|
||||||
@@ -724,9 +725,9 @@ QStringList Document::worksheetNames() const
|
|||||||
* the document constructed, a default name "book1.xlsx" will be used.
|
* the document constructed, a default name "book1.xlsx" will be used.
|
||||||
* Returns true if saved successfully.
|
* Returns true if saved successfully.
|
||||||
*/
|
*/
|
||||||
bool Document::save()
|
bool Document::save() const
|
||||||
{
|
{
|
||||||
Q_D(Document);
|
Q_D(const Document);
|
||||||
QString name = d->packageName.isEmpty() ? d->defaultPackageName : d->packageName;
|
QString name = d->packageName.isEmpty() ? d->defaultPackageName : d->packageName;
|
||||||
|
|
||||||
return saveAs(name);
|
return saveAs(name);
|
||||||
@@ -736,7 +737,7 @@ bool Document::save()
|
|||||||
* Saves the document to the file with the given \a name.
|
* Saves the document to the file with the given \a name.
|
||||||
* Returns true if saved successfully.
|
* Returns true if saved successfully.
|
||||||
*/
|
*/
|
||||||
bool Document::saveAs(const QString &name)
|
bool Document::saveAs(const QString &name) const
|
||||||
{
|
{
|
||||||
QFile file(name);
|
QFile file(name);
|
||||||
if (file.open(QIODevice::WriteOnly))
|
if (file.open(QIODevice::WriteOnly))
|
||||||
@@ -748,9 +749,9 @@ bool Document::saveAs(const QString &name)
|
|||||||
* \overload
|
* \overload
|
||||||
* This function writes a document to the given \a device.
|
* This function writes a document to the given \a device.
|
||||||
*/
|
*/
|
||||||
bool Document::saveAs(QIODevice *device)
|
bool Document::saveAs(QIODevice *device) const
|
||||||
{
|
{
|
||||||
Q_D(Document);
|
Q_D(const Document);
|
||||||
return d->savePackage(device);
|
return d->savePackage(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,9 +97,9 @@ public:
|
|||||||
Q_DECL_DEPRECATED void setCurrentWorksheet(int index);
|
Q_DECL_DEPRECATED void setCurrentWorksheet(int index);
|
||||||
Q_DECL_DEPRECATED void setCurrentWorksheet(const QString &name);
|
Q_DECL_DEPRECATED void setCurrentWorksheet(const QString &name);
|
||||||
|
|
||||||
bool save();
|
bool save() const;
|
||||||
bool saveAs(const QString &xlsXname);
|
bool saveAs(const QString &xlsXname) const;
|
||||||
bool saveAs(QIODevice *device);
|
bool saveAs(QIODevice *device) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(Document)
|
Q_DISABLE_COPY(Document)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
void init();
|
void init();
|
||||||
|
|
||||||
bool loadPackage(QIODevice *device);
|
bool loadPackage(QIODevice *device);
|
||||||
bool savePackage(QIODevice *device);
|
bool savePackage(QIODevice *device) const;
|
||||||
|
|
||||||
Document *q_ptr;
|
Document *q_ptr;
|
||||||
const QString defaultPackageName; //default name when package name not specified
|
const QString defaultPackageName; //default name when package name not specified
|
||||||
|
|||||||
Reference in New Issue
Block a user