r17720 by jghali - 10689: Incorrect save filename when filename contains multiple points
scribus-commit
scribus-commit at lists.scribus.net
Sun Jul 15 14:34:23 UTC 2012
Author: jghali
Date: Sun Jul 15 14:34:23 2012
New Revision: 17720
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17720
Log:
10689: Incorrect save filename when filename contains multiple points
Modified:
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/ui/customfdialog.cpp
trunk/Scribus/scribus/ui/pdfopts.cpp
trunk/Scribus/scribus/ui/printdialog.cpp
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17720&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Jul 15 14:34:23 2012
@@ -4476,8 +4476,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
{
@@ -4843,7 +4848,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
{
@@ -9073,8 +9083,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 (docom != NULL)
dia->SaveZip->setChecked(*docom);
Modified: trunk/Scribus/scribus/ui/customfdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17720&path=/trunk/Scribus/scribus/ui/customfdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/customfdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/customfdialog.cpp Sun Jul 15 14:34:23 2012
@@ -518,26 +518,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++)
- {
- if ((ex[a] != "sla") && (ex[a] != "SLA") && (ex[a] != "gz") && (ex[a] != "GZ"))
- baseExt += "."+ex[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 (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: trunk/Scribus/scribus/ui/pdfopts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17720&path=/trunk/Scribus/scribus/ui/pdfopts.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pdfopts.cpp (original)
+++ trunk/Scribus/scribus/ui/pdfopts.cpp Sun Jul 15 14:34:23 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: trunk/Scribus/scribus/ui/printdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17720&path=/trunk/Scribus/scribus/ui/printdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/printdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/printdialog.cpp Sun Jul 15 14:34:23 2012
@@ -316,7 +316,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
More information about the scribus-commit
mailing list