replace simple regexp with .endsWith()

This commit is contained in:
Stefan Bühler 2012-04-09 21:16:56 +02:00
parent e99e35c8a7
commit 0e3c60e8a1
3 changed files with 3 additions and 4 deletions

View File

@ -140,8 +140,7 @@ namespace qcross {
QString fileName = QFileDialog::getOpenFileName(this, tr("Select a package to import"),
QString(), tr("QCross Package (*.cpk)"));
if (!fileName.isEmpty()) {
/* if (!File::exists(QCROSS_STRING_DATAPATH))
QDir::mkpath(QCROSS_STRING_DATAPATH);*/
QDir().mkpath(QCROSS_STRING_DATAPATH);
QString newFileName = QCROSS_STRING_DATAPATH + QDir::separator() + fileName.section(QDir::separator(), -1);
if (QFile::copy(fileName, newFileName))

View File

@ -23,7 +23,7 @@
#include <libqnono/constants.h>
#define QCROSS_STRING_DATAPATH ((QDir::homePath() + QDir::separator()) + ".qcross")
#define QCROSS_STRING_DATAPATH (QDir::homePath() + QDir::separator() + ".config" + QDir::separator() + "qcross")
#define QCROSS_STRING_PACKAGE_EXT ".cpk"
#endif

View File

@ -153,7 +153,7 @@ namespace qcrossedit {
QString fileName = QFileDialog::getSaveFileName(this, tr("Select a file name for the current package"),
QString(), tr("QCross Package (*.cpk)"));
if (!fileName.isEmpty()) {
if (!QRegExp("*.cpk").exactMatch(fileName))
if (!fileName.endsWith(".cpk", Qt::CaseInsensitive))
fileName.append(".cpk");
m_Package->setFileName(fileName);