Commit 45630456 authored by Yew Ming Chen's avatar Yew Ming Chen
Browse files

make EBN Krazy happy

svn path=/trunk/KDE/kdeutils/ark/; revision=887872
parent 2725ea70
......@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "addtoarchive.h"
#include "kerfuffle/adddialog.h"
#include <QFileInfo>
#include <QDir>
......@@ -28,8 +30,6 @@
#include <kmessagebox.h>
#include <klocale.h>
#include "addtoarchive.h"
#include "kerfuffle/adddialog.h"
......@@ -109,11 +109,11 @@ bool AddToArchive::startAdding( void )
base = fi.absoluteFilePath();
if (base.right(1) == "/") {
if (base.endsWith('/')) {
base.chop(1);
}
QString finalName = base + "." + m_autoFilenameSuffix;
QString finalName = base + '.' + m_autoFilenameSuffix;
kDebug( 1601 ) << "Autoset filename to " + finalName;
archive = Kerfuffle::factory(finalName);
......
......@@ -59,7 +59,7 @@ void BatchExtract::addExtraction(Kerfuffle::Archive* archive,bool preservePaths,
QDir dest(destinationFolder);
dest.mkdir(subfolder);
autoDestination = destinationFolder + "/" + subfolder;
autoDestination = destinationFolder + '/' + subfolder;
}
}
......@@ -106,7 +106,7 @@ void BatchExtract::start()
kDebug( 1601 ) << "Creating subfolder" << subfolder;
QDir dest(destinationFolder);
dest.mkpath(subfolder);
destinationFolder += "/" + subfolder;
destinationFolder += '/' + subfolder;
}
foreach (Kerfuffle::Archive *archive, inputs)
......
......@@ -19,14 +19,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "adddialog.h"
#include "ui_adddialog.h"
#include "kerfuffle/archive.h"
#include <QStandardItemModel>
#include <kfileplacesmodel.h>
#include "adddialog.h"
#include "ui_adddialog.h"
#include "kerfuffle/archive.h"
namespace Kerfuffle
{
......
......@@ -89,24 +89,24 @@ namespace Kerfuffle
//we loop through all items and find the highest common folder they share
if (files.size() > 1) {
QStringList common = files.first().split("/", QString::SkipEmptyParts);
QStringList common = files.first().split('/', QString::SkipEmptyParts);
if (common.size() > 1) {
common.removeLast(); //We don't need the filename
foreach(const QString &selectedEntry, files) {
QStringList parts = selectedEntry.split("/", QString::SkipEmptyParts);
QStringList parts = selectedEntry.split('/', QString::SkipEmptyParts);
for (int i = common.size() - 1; i > -1; --i) {
if (common.at(i) != parts.at(i))
common.removeLast();
}
}
commonBase = common.join("/") + "/";
commonBase = common.join("/") + '/';
}
}
else if (files.size() == 1) {
QStringList parts = files.first().split("/", QString::SkipEmptyParts);
QStringList parts = files.first().split('/', QString::SkipEmptyParts);
parts.removeLast(); //take of the filename
return parts.join("/") + "/";
return parts.join("/") + '/';
}
return commonBase;
}
......@@ -117,24 +117,24 @@ namespace Kerfuffle
//we loop through all items and find the highest common folder they share
if (files.size() > 1) {
QStringList common = files.first().toString().split("/", QString::SkipEmptyParts);
QStringList common = files.first().toString().split('/', QString::SkipEmptyParts);
if (common.size() > 1) {
common.removeLast(); //We don't need the filename
foreach(const QVariant &selectedEntry, files) {
QStringList parts = selectedEntry.toString().split("/", QString::SkipEmptyParts);
QStringList parts = selectedEntry.toString().split('/', QString::SkipEmptyParts);
for (int i = common.size() - 1; i > -1; --i) {
if (common.at(i) != parts.at(i))
common.removeLast();
}
}
commonBase = common.join("/") + "/";
commonBase = common.join("/") + '/';
}
}
else if (files.size() == 1) {
QStringList parts = files.first().toString().split("/", QString::SkipEmptyParts);
QStringList parts = files.first().toString().split('/', QString::SkipEmptyParts);
parts.removeLast(); //take of the filename
return parts.join("/") + "/";
return parts.join("/") + '/';
}
return commonBase;
}
......
......@@ -115,7 +115,7 @@ namespace Kerfuffle
}
}
QString pathWithSubfolder = url().path(KUrl::AddTrailingSlash) + subfolder() + "/";
QString pathWithSubfolder = url().path(KUrl::AddTrailingSlash) + subfolder() + '/';
kDebug (1601) << pathWithSubfolder << " exists: " << KStandardDirs::exists(pathWithSubfolder);
if (extractToSubfolder() && KStandardDirs::exists(pathWithSubfolder)) {
int overWrite = KMessageBox::questionYesNo( NULL, i18n("The folder '%1' already exists. Are you sure you want to extract here?",pathWithSubfolder ), i18n("Folder exists") , KGuiItem(i18n("Extract here")), KGuiItem(i18n("Cancel")));
......
......@@ -74,7 +74,7 @@ namespace Kerfuffle
class KERFUFFLE_EXPORT OverwriteQuery : public Query
{
public:
OverwriteQuery(QString filename);
explicit OverwriteQuery(QString filename);
void execute();
bool responseCancelled();
bool responseOverwriteAll();
......@@ -92,7 +92,7 @@ namespace Kerfuffle
class KERFUFFLE_EXPORT PasswordNeededQuery : public Query
{
public:
PasswordNeededQuery(QString archiveFilename, bool incorrectTryAgain = false);
explicit PasswordNeededQuery(QString archiveFilename, bool incorrectTryAgain = false);
void execute();
bool responseCancelled();
......
......@@ -424,8 +424,8 @@ QMimeData * ArchiveModel::mimeData ( const QModelIndexList & indexes ) const
} else
noFallback = true;
if (archiveName.right(1) != "/") {
archiveName.append("/");
if (!archiveName.endsWith('/')) {
archiveName.append('/');
}
//Populate the internal list of files
......@@ -564,7 +564,7 @@ void ArchiveModel::slotEntryRemoved( const QString & path )
{
// TODO: Do something
kDebug (1601) << "Removed node at path " << path;
ArchiveNode *entry = m_rootNode->findByPath( path.split("/") );
ArchiveNode *entry = m_rootNode->findByPath( path.split('/') );
if ( entry )
{
ArchiveDirNode *parent = entry->parent();
......@@ -630,7 +630,7 @@ void ArchiveModel::slotNewEntry( const ArchiveEntry& entry )
/// 1. Skip already created nodes
if (m_rootNode){
ArchiveNode *existing = m_rootNode->findByPath( entry[ FileName ].toString().split("/") );
ArchiveNode *existing = m_rootNode->findByPath( entry[ FileName ].toString().split('/') );
if ( existing ) {
kDebug (1601) << "Refreshing entry for" << entry[FileName].toString();
//TODO: benchmark whether it's a bad idea to reset the entry here.
......
......@@ -128,7 +128,7 @@ void p7zipInterface::listReadStdout()
// process all lines until the last '\n'
int indx = m_stdOutData.lastIndexOf('\n');
QString leftString = QString::fromLocal8Bit(m_stdOutData.left(indx + 1));
QStringList lines = leftString.split( "\n", QString::SkipEmptyParts );
QStringList lines = leftString.split( '\n', QString::SkipEmptyParts );
foreach(const QString &line, lines)
{
listProcessLine(m_state, line);
......@@ -481,7 +481,7 @@ bool p7zipInterface::addFiles( const QStringList & files, const CompressionOptio
bool hasWarning = false;
QString warningMessages;
while (kp.waitForReadyRead()) {
QStringList lines = QString(kp.readAll()).split("\n");
QStringList lines = QString(kp.readAll()).split('\n');
foreach(const QString &line, lines) {
if (line.startsWith("Compressing"))
{
......
......@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef SEVENZIPPLUGIN_H
#define SEVENZIPPLUGIN_H
#ifndef _7ZIPPLUGIN_H
#define _7ZIPPLUGIN_H
#include "kerfuffle/archiveinterface.h"
#include <QProcess>
......
......@@ -23,7 +23,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <QString>
#include "kerfuffle/archiveinterface.h"
#include "kerfuffle/archivefactory.h"
......@@ -40,7 +39,6 @@
#include <QByteArray>
#include <QFile>
#include <QDir>
#include <QFileInfo>
using namespace Kerfuffle;
......@@ -115,8 +113,8 @@ class LibGzipInterface: public ReadWriteArchiveInterface
Q_UNUSED(files);
QString outputFilename = destinationDirectory;
if (destinationDirectory.right(1) != "/")
outputFilename += "/";
if (!destinationDirectory.endsWith('/'))
outputFilename += '/';
outputFilename += uncompressedFilename();
......
......@@ -43,12 +43,10 @@ typedef quint32 off_t;
#include <KDebug>
#include <QDateTime>
#include <QString>
#include <QFileInfo>
#include <QByteArray>
#include <QFile>
#include <QDir>
#include <QFileInfo>
using namespace Kerfuffle;
......
......@@ -295,7 +295,7 @@ bool RARInterface::addFiles( const QStringList & files, const CompressionOptions
//for debug output:
while (kp.waitForReadyRead()) {
QStringList lines = QString(kp.readAll()).split("\n");
QStringList lines = QString(kp.readAll()).split('\n');
foreach(const QString &line, lines) {
int pos = line.indexOf('%');
if (pos < 2 || pos == -1) continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment