Commit 84893e79 authored by Toni Asensi Esteve's avatar Toni Asensi Esteve
Browse files

Archives: Replace "KRarcHandler" with "KrArcHandler" in order to follow norms

Differential Revision: https://phabricator.kde.org/D28866
parent ce79274d
......@@ -1723,7 +1723,7 @@ bool kio_krarcProtocol::checkStatus(int exitCode)
void kio_krarcProtocol::checkIf7zIsEncrypted(bool &encrypted, QString fileName)
{
// Reminder: If that function is modified, it's important to research if the
// changes must also be applied to `KRarcHandler::checkIf7zIsEncrypted()`
// changes must also be applied to `KrArcHandler::checkIf7zIsEncrypted()`
KRFUNC;
if (encryptedArchPath == fileName)
......
......@@ -252,7 +252,7 @@ QString KrArcBaseManager::getShortTypeFromMime(const QString &mime)
// Reminder: If a mime type is added/removed/modified in that
// member function, it's important to research if the type has to
// be added/removed/modified in the `krarc.protocol` file, or
// in `KRarcHandler::KRarcHandler()`
// in `KrArcHandler::KrArcHandler()`
// 7zip files are a not a normal case because their mimetype does not
// follow the norm of other types: zip, tar, lha, ace, arj, etc.
......
......@@ -163,7 +163,7 @@ bool AbstractThreadedJob::event(QEvent *e)
break;
case CMD_GET_PASSWORD: {
QString path = event->args()[ 0 ].value<QString>();
QString password = KRarcHandler::getPassword(path);
QString password = KrArcHandler::getPassword(path);
auto *resultResp = new QList<QVariant> ();
(*resultResp) << password;
......@@ -651,7 +651,7 @@ bool AbstractJobThread::getArchiveInformation(QString &path, QString &type, QStr
type = krArcMan.getType(encrypted, path, mime);
// Check that the archive is supported
if (!KRarcHandler::arcSupported(type)) {
if (!KrArcHandler::arcSupported(type)) {
sendError(KIO::ERR_NO_CONTENT, i18nc("%1=archive filename", "%1, unsupported archive type.", arcName));
return false;
}
......
......@@ -85,10 +85,10 @@ public:
static QStringList arcProtocols = QString("tar;bzip;bzip2;lzma;xz;gzip;krarc;zip").split(';');
QMap<QString, QString>* KRarcHandler::slaveMap = nullptr;
KWallet::Wallet * KRarcHandler::wallet = nullptr;
QMap<QString, QString>* KrArcHandler::slaveMap = nullptr;
KWallet::Wallet * KrArcHandler::wallet = nullptr;
KRarcHandler::KRarcHandler(QObject *parent) : QObject(parent)
KrArcHandler::KrArcHandler(QObject *parent) : QObject(parent)
{
// Reminder: If a mime type is added/removed/modified in that
// member function, it's important to research if the type has to
......@@ -128,7 +128,7 @@ KRarcHandler::KRarcHandler(QObject *parent) : QObject(parent)
#endif
}
QStringList KRarcHandler::supportedPackers()
QStringList KrArcHandler::supportedPackers()
{
QStringList packers;
......@@ -160,7 +160,7 @@ QStringList KRarcHandler::supportedPackers()
return packers;
}
bool KRarcHandler::arcSupported(QString type)
bool KrArcHandler::arcSupported(QString type)
{
// lst will contain the supported unpacker list...
const KConfigGroup group(krConfig, "Archives");
......@@ -195,7 +195,7 @@ bool KRarcHandler::arcSupported(QString type)
|| (type == "7z" && lst.contains("7z"));
}
long KRarcHandler::arcFileCount(const QString& archive, const QString& type, const QString& password, KRarcObserver *observer)
long KrArcHandler::arcFileCount(const QString& archive, const QString& type, const QString& password, KRarcObserver *observer)
{
int divideWith = 1;
......@@ -274,7 +274,7 @@ long KRarcHandler::arcFileCount(const QString& archive, const QString& type, con
return count / divideWith;
}
bool KRarcHandler::unpack(QString archive, const QString& type, const QString& password, const QString& dest, KRarcObserver *observer)
bool KrArcHandler::unpack(QString archive, const QString& type, const QString& password, const QString& dest, KRarcObserver *observer)
{
KConfigGroup group(krConfig, "Archives");
if (group.readEntry("Test Before Unpack", _TestBeforeUnpack)) {
......@@ -404,7 +404,7 @@ bool KRarcHandler::unpack(QString archive, const QString& type, const QString& p
return true; // SUCCESS
}
bool KRarcHandler::test(const QString& archive, const QString& type, const QString& password, KRarcObserver *observer, long count)
bool KrArcHandler::test(const QString& archive, const QString& type, const QString& password, KRarcObserver *observer, long count)
{
// choose the right packer for the job
QStringList packer;
......@@ -470,7 +470,7 @@ bool KRarcHandler::test(const QString& archive, const QString& type, const QStri
return true; // SUCCESS
}
bool KRarcHandler::pack(QStringList fileNames, QString type, const QString& dest, long count, QMap<QString, QString> extraProps, KRarcObserver *observer)
bool KrArcHandler::pack(QStringList fileNames, QString type, const QString& dest, long count, QMap<QString, QString> extraProps, KRarcObserver *observer)
{
// set the right packer to do the job
QStringList packer;
......@@ -606,7 +606,7 @@ bool KRarcHandler::pack(QStringList fileNames, QString type, const QString& dest
return true; // SUCCESS
}
bool KRarcHandler::openWallet()
bool KrArcHandler::openWallet()
{
if (!wallet) {
// find a suitable parent window
......@@ -619,7 +619,7 @@ bool KRarcHandler::openWallet()
return (wallet != nullptr);
}
QString KRarcHandler::getPassword(const QString& path)
QString KrArcHandler::getPassword(const QString& path)
{
QString password;
......@@ -675,7 +675,7 @@ QString KRarcHandler::getPassword(const QString& path)
return "";
}
bool KRarcHandler::isArchive(const QUrl &url)
bool KrArcHandler::isArchive(const QUrl &url)
{
QString protocol = url.scheme();
if (arcProtocols.indexOf(protocol) != -1)
......@@ -683,7 +683,7 @@ bool KRarcHandler::isArchive(const QUrl &url)
else return false;
}
QString KRarcHandler::getType(bool &encrypted, QString fileName, const QString& mime, bool checkEncrypted, bool fast)
QString KrArcHandler::getType(bool &encrypted, QString fileName, const QString& mime, bool checkEncrypted, bool fast)
{
QString result = detectArchive(encrypted, std::move(fileName), checkEncrypted, fast);
if (result.isNull()) {
......@@ -693,12 +693,12 @@ QString KRarcHandler::getType(bool &encrypted, QString fileName, const QString&
return result;
}
bool KRarcHandler::checkStatus(const QString& type, int exitCode)
bool KrArcHandler::checkStatus(const QString& type, int exitCode)
{
return KrArcBaseManager::checkStatus(type, exitCode);
}
void KRarcHandler::checkIf7zIsEncrypted(bool &encrypted, QString fileName)
void KrArcHandler::checkIf7zIsEncrypted(bool &encrypted, QString fileName)
{
// Reminder: If that function is modified, it's important to research if the
// changes must also be applied to `kio_krarcProtocol::checkIf7zIsEncrypted()`
......@@ -712,7 +712,7 @@ void KRarcHandler::checkIf7zIsEncrypted(bool &encrypted, QString fileName)
encrypted = proc.isEncrypted();
}
QString KRarcHandler::registeredProtocol(const QString& mimetype)
QString KrArcHandler::registeredProtocol(const QString& mimetype)
{
if (slaveMap == nullptr) {
slaveMap = new QMap<QString, QString>();
......@@ -735,7 +735,7 @@ QString KRarcHandler::registeredProtocol(const QString& mimetype)
return protocol;
}
void KRarcHandler::clearProtocolCache()
void KrArcHandler::clearProtocolCache()
{
if (slaveMap)
delete slaveMap;
......
......@@ -52,11 +52,11 @@ public slots:
virtual void incrementProgress(int) = 0;
};
class KRarcHandler: public QObject, public KrArcBaseManager
class KrArcHandler: public QObject, public KrArcBaseManager
{
Q_OBJECT
public:
explicit KRarcHandler(QObject *parent = nullptr);
explicit KrArcHandler(QObject *parent = nullptr);
// return the number of files in the archive
long arcFileCount(const QString& archive, const QString& type, const QString& password, KRarcObserver *observer);
......
......@@ -69,7 +69,7 @@ void KrBookmark::setIconName(const QString& iconName)
setIcon(Icon(iconName));
} else if (_url.isLocalFile()) {
setIcon(Icon("folder"));
} else if (KRarcHandler::isArchive(_url)) {
} else if (KrArcHandler::isArchive(_url)) {
setIcon(Icon("application-x-tar"));
} else {
setIcon(Icon("folder-html"));
......
......@@ -238,7 +238,7 @@ bool KRQuery::checkType(const QString& mime) const
if (type == mime)
return true;
if (type == i18n("Archives"))
return KRarcHandler::arcSupported(mime);
return KrArcHandler::arcSupported(mime);
if (type == i18n("Folders"))
return mime.contains("directory");
if (type == i18n("Image Files"))
......
......@@ -127,7 +127,7 @@ void KgArchives::slotAutoConfigure()
void KgArchives::disableNonExistingPackers()
{
KConfigGroup group(krConfig, "Archives");
group.writeEntry("Supported Packers", KRarcHandler::supportedPackers());
group.writeEntry("Supported Packers", KrArcHandler::supportedPackers());
}
......@@ -379,7 +379,7 @@ bool KgProtocols::apply()
group.writeEntry("Handled Protocols", protocolList);
krConfig->sync();
KRarcHandler::clearProtocolCache();
KrArcHandler::clearProtocolCache();
emit sigChanged();
return false;
......
......@@ -108,7 +108,7 @@ void KrResultTable::adjustRow(QGridLayout* grid)
KrArchiverResultTable::KrArchiverResultTable(QWidget* parent)
: KrResultTable(parent)
{
_supported = KRarcHandler::supportedPackers(); // get list of available packers
_supported = KrArcHandler::supportedPackers(); // get list of available packers
Archiver* tar = new Archiver("tar", "https://www.gnu.org/", PS("tar"), true, true);
Archiver* gzip = new Archiver("gzip", "https://www.gnu.org/", PS("gzip"), true, true);
......
......@@ -934,7 +934,7 @@ void ListPanel::keyPressEvent(QKeyEvent *e)
newPath = v->getUrl();
} else {
// If it's a supported compressed file
if (v && KRarcHandler::arcSupported(v->getMime())) {
if (v && KrArcHandler::arcSupported(v->getMime())) {
newPath = func->browsableArchivePath(v->getUrl().fileName());
} else {
newPath = virtualPath();
......
......@@ -154,7 +154,7 @@ PanelContextMenu::PanelContextMenu(KrPanel *krPanel, QWidget *parent)
// ...but user disabled archive browsing...
&& (!KConfigGroup(krConfig, "Archives").readEntry("ArchivesAsDirectories", _ArchivesAsDirectories)
// ...or the file is not a standard archive (e.g. odt, docx, etc.)...
|| !KRarcHandler::arcSupported(file->getMime()))) {
|| !KrArcHandler::arcSupported(file->getMime()))) {
// ...it will not be browsed as a directory by default, but add an option for it
QAction *browseAct = addAction(i18n("Browse Archive"));
browseAct->setData(QVariant(BROWSE_ID));
......
......@@ -140,7 +140,7 @@ void ListPanelFunc::openFileNameInternal(const QString &name, bool externallyExe
if (!arcPath.isEmpty()) {
bool browseAsDirectory = !externallyExecutable
|| (KConfigGroup(krConfig, "Archives").readEntry("ArchivesAsDirectories", _ArchivesAsDirectories)
&& (KRarcHandler::arcSupported(mime) || KrServices::isoSupported(mime)));
&& (KrArcHandler::arcSupported(mime) || KrServices::isoSupported(mime)));
if (browseAsDirectory) {
openUrl(arcPath);
return;
......
......@@ -128,7 +128,7 @@ void KRSearchMod::scanDirectory(const QUrl &url)
}
if (m_query->searchInArchives() && fileUrl.isLocalFile() &&
KRarcHandler::arcSupported(fileItem->getMime())) {
KrArcHandler::arcSupported(fileItem->getMime())) {
// query search in archive; NOTE: only supported for local files
QUrl archiveURL = fileUrl;
bool encrypted;
......
......@@ -31,7 +31,7 @@
KConfig *KrGlobal::config = nullptr;
KMountMan *KrGlobal::mountMan = nullptr;
KRarcHandler *KrGlobal::arcMan = nullptr;
KrArcHandler *KrGlobal::arcMan = nullptr;
KrBookmarkHandler *KrGlobal::bookman = nullptr;
KRslots *KrGlobal::slot = nullptr;
KrusaderView *KrGlobal::mainView = nullptr;
......
......@@ -29,7 +29,7 @@
class KConfig;
class KMountMan;
class KRarcHandler;
class KrArcHandler;
class KrBookmarkHandler;
class KRslots;
class KrusaderView;
......@@ -45,7 +45,7 @@ class KrGlobal
public:
static KConfig *config; // allow everyone to access the config
static KMountMan *mountMan; // krusader's Mount Manager
static KRarcHandler *arcMan; //! Manages archives in several parts of the code
static KrArcHandler *arcMan; //! Manages archives in several parts of the code
static KrBookmarkHandler *bookman;
static KRslots *slot;
static KrusaderView *mainView; // The GUI
......
......@@ -138,7 +138,7 @@ Krusader::Krusader(const QCommandLineParser &parser) : KParts::MainWindow(nullpt
}
// create an object that manages archives in several parts of the source code
KrGlobal::arcMan = new KRarcHandler(this);
KrGlobal::arcMan = new KrArcHandler(this);
// create MountMan
KrGlobal::mountMan = new KMountMan(this);
......
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