Compare commits
8 Commits
27b85117c4
...
76ede03bd2
Author | SHA1 | Date |
---|---|---|
Albert Astals Cid | 76ede03bd2 | |
l10n daemon script | bbcfd8202b | |
l10n daemon script | 1006a8daeb | |
l10n daemon script | b6a52fe2b1 | |
l10n daemon script | 0681ebd790 | |
Andrius Štikonas | 858f8d9bae | |
Andrius Štikonas | d92ebc0b76 | |
Andrius Štikonas | e483bab0d5 |
|
@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
|||
|
||||
# KDE Application Version, managed by release script
|
||||
set (RELEASE_SERVICE_VERSION_MAJOR "22")
|
||||
set (RELEASE_SERVICE_VERSION_MINOR "03")
|
||||
set (RELEASE_SERVICE_VERSION_MINOR "07")
|
||||
set (RELEASE_SERVICE_VERSION_MICRO "70")
|
||||
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
|
||||
project(kpmcore VERSION ${RELEASE_SERVICE_VERSION})
|
||||
|
|
|
@ -295,7 +295,7 @@ static void writeEntry(QTextStream& s, const FstabEntry& entry, std::array<unsig
|
|||
<< entry.comment() << "\n";
|
||||
}
|
||||
|
||||
bool writeMountpoints(const FstabEntryList& fstabEntries, const QString& filename)
|
||||
bool writeMountpoints(const FstabEntryList& fstabEntries)
|
||||
{
|
||||
QString fstabContents;
|
||||
QTextStream out(&fstabContents);
|
||||
|
@ -306,5 +306,5 @@ bool writeMountpoints(const FstabEntryList& fstabEntries, const QString& filenam
|
|||
writeEntry(out, e, columnWidth);
|
||||
|
||||
ExternalCommand cmd;
|
||||
return cmd.createFile(fstabContents.toLocal8Bit(), filename);
|
||||
return cmd.writeFstab(fstabContents.toLocal8Bit());
|
||||
}
|
||||
|
|
|
@ -116,6 +116,6 @@ QString unescapeSpaces(const QString& mountPoint);
|
|||
|
||||
LIBKPMCORE_EXPORT FstabEntryList readFstabEntries(const QString& fstabPath = QStringLiteral("/etc/fstab"));
|
||||
LIBKPMCORE_EXPORT QStringList possibleMountPoints(const QString& deviceNode, const QString& fstabPath = QStringLiteral("/etc/fstab"));
|
||||
LIBKPMCORE_EXPORT bool writeMountpoints(const FstabEntryList& fstabEntries, const QString& filename = QStringLiteral("/etc/fstab"));
|
||||
LIBKPMCORE_EXPORT bool writeMountpoints(const FstabEntryList& fstabEntries);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
"Description[sv]": "Ett bakgrundsprogram till KDE:s partitionshanterare i testsyfte.",
|
||||
"Description[uk]": "Тестовий додаток сервера Керування розділами KDE.",
|
||||
"Description[x-test]": "xxA KDE Partition Manager dummy backend for testing purposes.xx",
|
||||
"Description[zh_CN]": "用于测试的 KDE 分区管理器虚拟后端。",
|
||||
"Description[zh_CN]": "用于测试的 KDE 分区管理器虚拟后端程序。",
|
||||
"Description[zh_TW]": "使用虛設後端的 KDE 磁碟分割區管理員,可用來測試。",
|
||||
"EnabledByDefault": true,
|
||||
"Icon": "preferences-plugin",
|
||||
|
@ -104,7 +104,7 @@
|
|||
"Name[sv]": "KDE:s partitionshanterare bakgrundsprogram för test",
|
||||
"Name[uk]": "Тестовий додаток сервера Керування розділами KDE",
|
||||
"Name[x-test]": "xxKDE Partition Manager Dummy Backendxx",
|
||||
"Name[zh_CN]": "KDE 分区管理器(虚拟后端)",
|
||||
"Name[zh_CN]": "KDE 分区管理器虚拟后端程序",
|
||||
"Name[zh_TW]": "KDE 磁碟分割區管理員 (虛設後端)",
|
||||
"Version": "1",
|
||||
"Website": "http://www.partitionmanager.org"
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
"Description[sv]": "Ett sfdisk bakgrundsprogram till KDE:s partitionshanterare",
|
||||
"Description[uk]": "Додаток sfdisk сервера Керування розділами KDE.",
|
||||
"Description[x-test]": "xxA KDE Partition Manager sfdisk backend.xx",
|
||||
"Description[zh_CN]": "使用 sfdisk 作为后端的 KDE 分区管理器。",
|
||||
"Description[zh_CN]": "KDE 分区管理器 sfdisk 后端程序。",
|
||||
"Description[zh_TW]": "使用 sfdisk 作為後端的 KDE 磁碟分割區管理員。",
|
||||
"EnabledByDefault": true,
|
||||
"Icon": "preferences-plugin",
|
||||
|
@ -103,7 +103,7 @@
|
|||
"Name[sv]": "KDE:s partitionshanterare sfdisk bakgrundsprogram",
|
||||
"Name[uk]": "Додаток sfdisk сервера Керування розділами KDE",
|
||||
"Name[x-test]": "xxKDE Partition Manager sfdisk Backendxx",
|
||||
"Name[zh_CN]": "KDE 分区管理器(sfdisk 后端)",
|
||||
"Name[zh_CN]": "KDE 分区管理器 sfdisk 后端程序",
|
||||
"Name[zh_TW]": "KDE 磁碟分割區管理員 (sfdisk 後端)",
|
||||
"Version": "1",
|
||||
"Website": "http://www.partitionmanager.org"
|
||||
|
|
|
@ -231,13 +231,13 @@ bool ExternalCommand::writeData(Report& commandReport, const QByteArray& buffer,
|
|||
return waitForDbusReply(pcall);
|
||||
}
|
||||
|
||||
bool ExternalCommand::createFile(const QByteArray& fileContents, const QString& filePath)
|
||||
bool ExternalCommand::writeFstab(const QByteArray& fileContents)
|
||||
{
|
||||
auto interface = helperInterface();
|
||||
if (!interface)
|
||||
return false;
|
||||
|
||||
QDBusPendingCall pcall = interface->CreateFile(filePath, fileContents);
|
||||
QDBusPendingCall pcall = interface->WriteFstab(fileContents);
|
||||
return waitForDbusReply(pcall);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
bool copyBlocks(const CopySource& source, CopyTarget& target);
|
||||
QByteArray readData(const CopySourceDevice& source);
|
||||
bool writeData(Report& commandReport, const QByteArray& buffer, const QString& deviceNode, const quint64 firstByte); // same as copyBlocks but from QByteArray
|
||||
bool createFile(const QByteArray& filePath, const QString& fileContents); // similar to writeData but creates a new file
|
||||
bool writeFstab(const QByteArray& fileContents);
|
||||
|
||||
/**< @param cmd the command to run */
|
||||
void setCommand(const QString& cmd);
|
||||
|
|
|
@ -126,29 +126,26 @@ bool ExternalCommandHelper::writeData(QFile& device, const QByteArray& buffer, c
|
|||
}
|
||||
|
||||
/** Creates a new file with given contents.
|
||||
@param filePath file to write to
|
||||
@param fileContents the data that we write
|
||||
@return true on success
|
||||
*/
|
||||
bool ExternalCommandHelper::CreateFile(const QString &filePath, const QByteArray& fileContents)
|
||||
bool ExternalCommandHelper::WriteFstab(const QByteArray& fileContents)
|
||||
{
|
||||
if (!isCallerAuthorized()) {
|
||||
return false;
|
||||
}
|
||||
// Do not allow using this helper for writing to arbitrary location
|
||||
if ( filePath != QStringLiteral("/etc/fstab") )
|
||||
return false;
|
||||
|
||||
QFile device(filePath);
|
||||
QString fstabPath = QStringLiteral("/etc/fstab");
|
||||
QFile fstabFile(fstabPath);
|
||||
|
||||
// WriteOnly implies O_TRUNC
|
||||
auto flags = QIODevice::WriteOnly | QIODevice::Unbuffered;
|
||||
if (!device.open(flags)) {
|
||||
qCritical() << xi18n("Could not open file <filename>%1</filename> for writing.", filePath);
|
||||
if (!fstabFile.open(flags)) {
|
||||
qCritical() << xi18n("Could not open file <filename>%1</filename> for writing.", fstabPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (device.write(fileContents) != fileContents.size()) {
|
||||
qCritical() << xi18n("Could not write to file <filename>%1</filename>.", filePath);
|
||||
if (fstabFile.write(fileContents) != fileContents.size()) {
|
||||
qCritical() << xi18n("Could not write to file <filename>%1</filename>.", fstabPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public Q_SLOTS:
|
|||
const QString& targetDevice, const qint64 targetOffset, const qint64 blockSize);
|
||||
Q_SCRIPTABLE QByteArray ReadData(const QString& device, const qint64 offset, const qint64 length);
|
||||
Q_SCRIPTABLE bool WriteData(const QByteArray& buffer, const QString& targetDevice, const qint64 targetOffset);
|
||||
Q_SCRIPTABLE bool CreateFile(const QString& filePath, const QByteArray& fileContents);
|
||||
Q_SCRIPTABLE bool WriteFstab(const QByteArray& fileContents);
|
||||
|
||||
private:
|
||||
bool isCallerAuthorized();
|
||||
|
|
|
@ -15,11 +15,14 @@ SPDX-License-Identifier: CC0-1.0
|
|||
<description xml:lang="es">Ejecutar la aplicación auxiliar de gestión de particiones con privilegios</description>
|
||||
<description xml:lang="fr">Lancer l'assistant de gestionnaire de partition en mode administrateur</description>
|
||||
<description xml:lang="it">Esegui l'helper per la gestione delle partizioni privilegiate</description>
|
||||
<description xml:lang="ko">상위 권한으로 파티션 관리자 도우미 실행</description>
|
||||
<description xml:lang="nl">Hulpprogramma voor partitiebeheerder met extra rechten uitvoeren</description>
|
||||
<description xml:lang="pl">Uruchom uprzywilejowane zarządzanie partycjami</description>
|
||||
<description xml:lang="pt_BR">Executa o auxiliar do gerenciador de partições com privilégios</description>
|
||||
<description xml:lang="sl">Zaženi pooblaščenega pomočnika skrbnika particij</description>
|
||||
<description xml:lang="sv">Kör hjälpverktyg för privilegierad partitionshanterare</description>
|
||||
<description xml:lang="uk">Запуск привілейованої допоміжної програми з керування розділами</description>
|
||||
<description xml:lang="zh_CN">使用管理员权限运行分区管理器辅助程序</description>
|
||||
<message>Administrative privileges are required to manage disks</message>
|
||||
<message xml:lang="ast">Ríquense los privilexos alministrativos pa xestionar discos</message>
|
||||
<message xml:lang="ca">Es requereixen privilegis d'administrador per a gestionar els discs</message>
|
||||
|
|
Loading…
Reference in New Issue