Add const to the saveAs* members, step 2

This commit is contained in:
Debao Zhang
2014-01-06 14:16:51 +08:00
parent f92e34f374
commit fd7e8d84f7
3 changed files with 12 additions and 11 deletions
+8 -7
View File
@@ -191,9 +191,9 @@ bool DocumentPrivate::loadPackage(QIODevice *device)
return true;
}
bool DocumentPrivate::savePackage(QIODevice *device)
bool DocumentPrivate::savePackage(QIODevice *device) const
{
Q_Q(Document);
Q_Q(const Document);
ZipWriter zipWriter(device);
if (zipWriter.error())
return false;
@@ -202,6 +202,7 @@ bool DocumentPrivate::savePackage(QIODevice *device)
DocPropsApp docPropsApp;
DocPropsCore docPropsCore;
//: Todo
workbook->prepareDrawings();
// save worksheet xml files
@@ -724,9 +725,9 @@ QStringList Document::worksheetNames() const
* the document constructed, a default name "book1.xlsx" will be used.
* 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;
return saveAs(name);
@@ -736,7 +737,7 @@ bool Document::save()
* Saves the document to the file with the given \a name.
* Returns true if saved successfully.
*/
bool Document::saveAs(const QString &name)
bool Document::saveAs(const QString &name) const
{
QFile file(name);
if (file.open(QIODevice::WriteOnly))
@@ -748,9 +749,9 @@ bool Document::saveAs(const QString &name)
* \overload
* 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);
}
+3 -3
View File
@@ -97,9 +97,9 @@ public:
Q_DECL_DEPRECATED void setCurrentWorksheet(int index);
Q_DECL_DEPRECATED void setCurrentWorksheet(const QString &name);
bool save();
bool saveAs(const QString &xlsXname);
bool saveAs(QIODevice *device);
bool save() const;
bool saveAs(const QString &xlsXname) const;
bool saveAs(QIODevice *device) const;
private:
Q_DISABLE_COPY(Document)
+1 -1
View File
@@ -52,7 +52,7 @@ public:
void init();
bool loadPackage(QIODevice *device);
bool savePackage(QIODevice *device);
bool savePackage(QIODevice *device) const;
Document *q_ptr;
const QString defaultPackageName; //default name when package name not specified