mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refactor: Remove unused context-based file operations
Remote file operations via DBus are no longer used
This commit is contained in:
@@ -146,18 +146,6 @@ namespace BlackCore
|
||||
//! Identifier of application, remote side if distributed
|
||||
virtual BlackMisc::CIdentifier getApplicationIdentifier() const = 0;
|
||||
|
||||
//! Remote enabled version of writing a text file
|
||||
virtual bool writeToFile(const QString &fileName, const QString &content) = 0;
|
||||
|
||||
//! Remote enabled version of reading a text file
|
||||
virtual QString readFromFile(const QString &fileName) const = 0;
|
||||
|
||||
//! Remote enabled version of deleting a file
|
||||
virtual bool removeFile(const QString &fileName) = 0;
|
||||
|
||||
//! Remote enabled version of file exists
|
||||
virtual bool existsFile(const QString &fileName) const = 0;
|
||||
|
||||
//! Forward to facade
|
||||
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
||||
|
||||
|
||||
@@ -103,15 +103,6 @@ namespace BlackCore
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
//! \copydoc IContextApplication::writeToFile
|
||||
virtual bool writeToFile(const QString &fileName, const QString &content) override
|
||||
{
|
||||
Q_UNUSED(fileName);
|
||||
Q_UNUSED(content);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return false;
|
||||
}
|
||||
|
||||
//! \copydoc IContextApplication::registerApplication
|
||||
virtual BlackMisc::CIdentifier registerApplication(const BlackMisc::CIdentifier &application) override
|
||||
{
|
||||
@@ -141,30 +132,6 @@ namespace BlackCore
|
||||
return BlackMisc::CIdentifier();
|
||||
}
|
||||
|
||||
//! \copydoc IContextApplication::readFromFile
|
||||
virtual QString readFromFile(const QString &fileName) const override
|
||||
{
|
||||
Q_UNUSED(fileName);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return QString();
|
||||
}
|
||||
|
||||
//! \copydoc IContextApplication::removeFile
|
||||
virtual bool removeFile(const QString &fileName) override
|
||||
{
|
||||
Q_UNUSED(fileName);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return false;
|
||||
}
|
||||
|
||||
//! \copydoc IContextApplication::existsFile
|
||||
virtual bool existsFile(const QString &fileName) const override
|
||||
{
|
||||
Q_UNUSED(fileName);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return false;
|
||||
}
|
||||
|
||||
//! \copydoc IContextApplication::dotCommandsHtmlHelp
|
||||
virtual QString dotCommandsHtmlHelp() const override
|
||||
{
|
||||
|
||||
@@ -104,20 +104,6 @@ namespace BlackCore::Context
|
||||
}
|
||||
}
|
||||
|
||||
bool CContextApplication::writeToFile(const QString &fileName, const QString &content)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << fileName << content.left(25); }
|
||||
if (fileName.isEmpty()) { return false; }
|
||||
QFile file(fileName);
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
QTextStream out(&file);
|
||||
out << content;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CIdentifier CContextApplication::registerApplication(const CIdentifier &application)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << application; }
|
||||
@@ -161,35 +147,6 @@ namespace BlackCore::Context
|
||||
return this->identifier();
|
||||
}
|
||||
|
||||
QString CContextApplication::readFromFile(const QString &fileName) const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << fileName; }
|
||||
QFile file(fileName);
|
||||
QString content;
|
||||
if (fileName.isEmpty()) return content;
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
QTextStream in(&file);
|
||||
in >> content;
|
||||
file.close();
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
bool CContextApplication::removeFile(const QString &fileName)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << fileName; }
|
||||
if (fileName.isEmpty()) { return false; }
|
||||
return QFile::remove(fileName);
|
||||
}
|
||||
|
||||
bool CContextApplication::existsFile(const QString &fileName) const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << fileName; }
|
||||
if (fileName.isEmpty()) return false;
|
||||
return QFile::exists(fileName);
|
||||
}
|
||||
|
||||
QString CContextApplication::dotCommandsHtmlHelp() const
|
||||
{
|
||||
return CSimpleCommandParser::commandsHtmlHelp();
|
||||
|
||||
@@ -71,9 +71,6 @@ namespace BlackCore
|
||||
//! \copydoc BlackCore::Context::IContextApplication::callHotkeyActionRemotely
|
||||
virtual void callHotkeyActionRemotely(const QString &action, bool argument, const BlackMisc::CIdentifier &origin) override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextApplication::writeToFile
|
||||
virtual bool writeToFile(const QString &fileName, const QString &content) override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextApplication::registerApplication
|
||||
virtual BlackMisc::CIdentifier registerApplication(const BlackMisc::CIdentifier &application) override;
|
||||
|
||||
@@ -86,15 +83,6 @@ namespace BlackCore
|
||||
//! \copydoc BlackCore::Context::IContextApplication::getApplicationIdentifier
|
||||
virtual BlackMisc::CIdentifier getApplicationIdentifier() const override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextApplication::readFromFile
|
||||
virtual QString readFromFile(const QString &fileName) const override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextApplication::removeFile
|
||||
virtual bool removeFile(const QString &fileName) override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextApplication::existsFile
|
||||
virtual bool existsFile(const QString &fileName) const override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextApplication::dotCommandsHtmlHelp
|
||||
virtual QString dotCommandsHtmlHelp() const override;
|
||||
|
||||
|
||||
@@ -129,30 +129,6 @@ namespace BlackCore::Context
|
||||
return m_dBusInterface->callDBusRet<BlackMisc::CIdentifier>(QLatin1String("getApplicationIdentifier"));
|
||||
}
|
||||
|
||||
bool CContextApplicationProxy::writeToFile(const QString &fileName, const QString &content)
|
||||
{
|
||||
if (fileName.isEmpty()) { return false; }
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("writeToFile"), fileName, content);
|
||||
}
|
||||
|
||||
QString CContextApplicationProxy::readFromFile(const QString &fileName) const
|
||||
{
|
||||
if (fileName.isEmpty()) { return {}; }
|
||||
return m_dBusInterface->callDBusRet<QString>(QLatin1String("readFromFile"), fileName);
|
||||
}
|
||||
|
||||
bool CContextApplicationProxy::removeFile(const QString &fileName)
|
||||
{
|
||||
if (fileName.isEmpty()) { return false; }
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("removeFile"), fileName);
|
||||
}
|
||||
|
||||
bool CContextApplicationProxy::existsFile(const QString &fileName) const
|
||||
{
|
||||
if (fileName.isEmpty()) { return false; }
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("existsFile"), fileName);
|
||||
}
|
||||
|
||||
QString CContextApplicationProxy::dotCommandsHtmlHelp() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<QString>(QLatin1String("dotCommandsHtmlHelp"));
|
||||
|
||||
@@ -86,18 +86,6 @@ namespace BlackCore
|
||||
//! \copydoc BlackCore::Context::IContextApplication::getApplicationIdentifier
|
||||
virtual BlackMisc::CIdentifier getApplicationIdentifier() const override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextApplication::writeToFile
|
||||
virtual bool writeToFile(const QString &fileName, const QString &content) override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextApplication::readFromFile
|
||||
virtual QString readFromFile(const QString &fileName) const override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextApplication::removeFile
|
||||
virtual bool removeFile(const QString &fileName) override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextApplication::existsFile
|
||||
virtual bool existsFile(const QString &fileName) const override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextApplication::dotCommandsHtmlHelp
|
||||
virtual QString dotCommandsHtmlHelp() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user