r17721 by jghali - 10689: Incorrect save filename when filename contains multiple points
scribus-commit
scribus-commit at lists.scribus.net
Sun Jul 15 14:35:16 UTC 2012
Author: jghali
Date: Sun Jul 15 14:35:16 2012
New Revision: 17721
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17721
Log:
10689: Incorrect save filename when filename contains multiple points
Modified:
branches/Version14x/Scribus/scribus/customfdialog.cpp
branches/Version14x/Scribus/scribus/pdfopts.cpp
branches/Version14x/Scribus/scribus/printdialog.cpp
branches/Version14x/Scribus/scribus/scribus.cpp
Modified: branches/Version14x/Scribus/scribus/customfdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17721&path=/branches/Version14x/Scribus/scribus/customfdialog.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/customfdialog.cpp (original)
+++ branches/Version14x/Scribus/scribus/customfdialog.cpp Sun Jul 15 14:35:16 2012
@@ -456,26 +456,28 @@
void CustomFDialog::handleCompress()
{
- QFileInfo tmp;
- tmp.setFile(selectedFile());
- QString e(tmp.completeSuffix());
- QStringList ex = e.split(".", QString::SkipEmptyParts);
- QString baseExt = "";
- for (int a = 0; a < ex.count(); a++)
+ QString fileName;
+ QFileInfo tmp(selectedFile());
+ QString fn(tmp.fileName());
+ QStringList fc = fn.split(".", QString::KeepEmptyParts);
+ if (fc.count() > 0)
+ fileName = fc.at(0);
+ for (int a = 1; a < fc.count(); a++)
{
- if ((ex[a] != "sla") && (ex[a] != "SLA") && (ex[a] != "gz") && (ex[a] != "GZ"))
- baseExt += "."+ex[a];
+ if (fc.at(a).compare("sla", Qt::CaseInsensitive) == 0)
+ continue;
+ if (fc.at(a).compare("gz", Qt::CaseInsensitive) == 0)
+ continue;
+ if (fc.at(a).compare(ext, Qt::CaseInsensitive) == 0)
+ continue;
+ if (fc.at(a).compare(extZip, Qt::CaseInsensitive) == 0)
+ continue;
+ fileName += "." + fc[a];
}
if (SaveZip->isChecked())
- {
- if (e != extZip)
- tmp.setFile(tmp.baseName() + baseExt + "." + extZip);
- }
+ tmp.setFile(fileName + "." + extZip);
else
- {
- if (e != ext)
- tmp.setFile(tmp.baseName() + baseExt + "." + ext);
- }
+ tmp.setFile(fileName + "." + ext);
setSelection(tmp.fileName());
}
Modified: branches/Version14x/Scribus/scribus/pdfopts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17721&path=/branches/Version14x/Scribus/scribus/pdfopts.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/pdfopts.cpp (original)
+++ branches/Version14x/Scribus/scribus/pdfopts.cpp Sun Jul 15 14:35:16 2012
@@ -75,9 +75,14 @@
else
{
QFileInfo fi(docFileName);
+ QString completeBaseName = fi.completeBaseName();
+ if (completeBaseName.endsWith(".sla", Qt::CaseInsensitive))
+ if (completeBaseName.length() > 4) completeBaseName.chop(4);
+ if (completeBaseName.endsWith(".gz", Qt::CaseInsensitive))
+ if (completeBaseName.length() > 3) completeBaseName.chop(3);
if (fi.exists())
{
- QString fileName(fi.path()+"/"+fi.baseName()+".pdf");
+ QString fileName(fi.path() + "/" + completeBaseName + ".pdf");
fileNameLineEdit->setText( QDir::toNativeSeparators(fileName) );
}
else
@@ -86,7 +91,7 @@
QString pdfdir = dirs->get("pdf", fi.path());
if (pdfdir.right(1) != "/")
pdfdir += "/";
- QString fileName(pdfdir+fi.baseName()+".pdf");
+ QString fileName(pdfdir + completeBaseName + ".pdf");
fileNameLineEdit->setText( QDir::toNativeSeparators(fileName) );
}
}
Modified: branches/Version14x/Scribus/scribus/printdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17721&path=/branches/Version14x/Scribus/scribus/printdialog.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/printdialog.cpp (original)
+++ branches/Version14x/Scribus/scribus/printdialog.cpp Sun Jul 15 14:35:16 2012
@@ -313,7 +313,14 @@
if (fi.isRelative()) // if (m_doc->DocName.startsWith( tr("Document")))
LineEdit1->setText( QDir::toNativeSeparators(QDir::currentPath() + "/" + m_doc->DocName + ".ps") );
else
- LineEdit1->setText( QDir::toNativeSeparators(fi.path() + "/" + fi.baseName() + ".ps") );
+ {
+ QString completeBaseName = fi.completeBaseName();
+ if (completeBaseName.endsWith(".sla", Qt::CaseInsensitive))
+ if (completeBaseName.length() > 4) completeBaseName.chop(4);
+ if (completeBaseName.endsWith(".gz", Qt::CaseInsensitive))
+ if (completeBaseName.length() > 3) completeBaseName.chop(3);
+ LineEdit1->setText( QDir::toNativeSeparators(fi.path() + "/" + completeBaseName + ".ps") );
+ }
}
// Get page description language supported by the selected printer
Modified: branches/Version14x/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17721&path=/branches/Version14x/Scribus/scribus/scribus.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scribus.cpp (original)
+++ branches/Version14x/Scribus/scribus/scribus.cpp Sun Jul 15 14:35:16 2012
@@ -4521,8 +4521,13 @@
if (doc->hasName)
{
QFileInfo fi(doc->DocName);
+ QString completeBaseName = fi.completeBaseName();
+ if (completeBaseName.endsWith(".sla", Qt::CaseInsensitive))
+ completeBaseName.chop(4);
+ else if (completeBaseName.endsWith(".gz", Qt::CaseInsensitive))
+ completeBaseName.chop(3);
wdir = QDir::fromNativeSeparators( fi.path() );
- fna = QDir::fromNativeSeparators( fi.path()+"/"+fi.baseName()+".sla" );
+ fna = QDir::fromNativeSeparators( fi.path()+"/"+completeBaseName+".sla" );
}
else
{
@@ -4878,7 +4883,12 @@
if (!doc->DocName.startsWith( tr("Document")))
{
QFileInfo fi(doc->DocName);
- doc->Print_Options.filename = fi.path()+"/"+fi.baseName()+".ps";
+ QString completeBaseName = fi.completeBaseName();
+ if (completeBaseName.endsWith(".sla", Qt::CaseInsensitive))
+ if (completeBaseName.length() > 4) completeBaseName.chop(4);
+ if (completeBaseName.endsWith(".gz", Qt::CaseInsensitive))
+ if (completeBaseName.length() > 3) completeBaseName.chop(3);
+ doc->Print_Options.filename = fi.path()+"/"+completeBaseName+".ps";
}
else
{
@@ -8864,8 +8874,8 @@
if (!defNa.isEmpty())
{
QFileInfo f(defNa);
- dia->setExtension(f.completeSuffix());
- dia->setZipExtension(f.completeSuffix() + ".gz");
+ dia->setExtension(f.suffix());
+ dia->setZipExtension(f.suffix() + ".gz");
dia->setSelection(defNa);
}
if (optionFlags & fdDirectoriesOnly)
More information about the scribus-commit
mailing list