Initial port to KDE Frameworks 5.

The port is mostly complete:
    * A few unported items are marked with FIXME: port KF5.
    * KCFG configuration for QGroupBox is not working yet.
This commit is contained in:
Andrius Štikonas 2014-05-18 21:41:48 +01:00
parent 5eb2a06da4
commit f3dd3157a6
86 changed files with 615 additions and 568 deletions

View File

@ -17,13 +17,12 @@
project(partitionmanager)
cmake_minimum_required(VERSION 2.6.2)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
set(CMAKE_USE_RELATIVE_PATHS OFF)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(QT_MIN_VERSION "5.3.0")
set(VERSION_MAJOR "1")
set(VERSION_MINOR "0")
set(VERSION_RELEASE "60")
@ -31,26 +30,59 @@ set(VERSION_SUFFIX "")
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}${VERSION_SUFFIX})
add_definitions(-D'VERSION="${VERSION}"')
set(KDE_MIN_VERSION 4.4)
find_package(KDE4 REQUIRED)
find_package(ECM 0.0.10 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
include(ECMInstallIcons)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
include(FeatureSummary)
include(GenerateExportHeader)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core
DBus
Widgets
Sql
Test
)
# Load the frameworks we need
find_package(KF5 CONFIG REQUIRED COMPONENTS
Config
DocTools
FrameworkIntegration
GuiAddons
I18n
IconThemes
Init
JobWidgets
KIO
Service
Parts
TextEditor
WindowSystem
XmlGui
WidgetsAddons
)
# use sane compile flags
add_definitions(
-fexceptions
)
find_package(MSGFMT REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(BLKID REQUIRED blkid)
pkg_check_modules(LIBATASMART REQUIRED libatasmart)
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions(${KDE4_ENABLE_EXCEPTIONS})
include(KDE4Defaults)
include(MacroLibrary)
option(ENABLE_UDISKS2 "Use UDisks2 backend." OFF)
if (ENABLE_UDISKS2)
add_definitions(-DENABLE_UDISKS2)
endif (ENABLE_UDISKS2)
include_directories(${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${UUID_INCLUDE_DIRS} ${BLKID_INCLUDE_DIRS} lib/ src/)
include_directories(${Qt5Core_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} ${BLKID_INCLUDE_DIRS} lib/ src/)
add_subdirectory(lib)
add_subdirectory(src)

View File

@ -21,7 +21,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
INCLUDE(CheckCSourceCompiles)
include(CheckCSourceCompiles)
include(CheckFunctionExists)
if (LIBPARTED_INCLUDE_DIR AND LIBPARTED_LIBRARY)
# Already in cache, be silent

View File

@ -1 +1,10 @@
kde4_install_icons(${ICON_INSTALL_DIR})
# collect the needed icon files
set (PARTITIONMANAGER_ICONS
hi16-apps-partitionmanager.png
hi22-apps-partitionmanager.png
hi32-apps-partitionmanager.png
hi48-apps-partitionmanager.png
hi64-apps-partitionmanager.png
hi128-apps-partitionmanager.png
)
ecm_install_icons(ICONS ${PARTITIONMANAGER_ICONS} DESTINATION ${ICON_INSTALL_DIR})

View File

@ -30,13 +30,26 @@ file(GLOB partitionmanagerprivate_SRCS
file(GLOB partitionmanagerprivate_UIFILES config/*.ui gui/*.ui)
kde4_add_ui_files(partitionmanagerprivate_SRCS ${partitionmanagerprivate_UIFILES})
qt5_wrap_ui(partitionmanagerprivate_SRCS ${partitionmanagerprivate_UIFILES})
kde4_add_kcfg_files(partitionmanagerprivate_SRCS config.kcfgc)
kconfig_add_kcfg_files(partitionmanagerprivate_SRCS config.kcfgc)
install(FILES config.kcfg DESTINATION ${KCFG_INSTALL_DIR})
kde4_add_library(partitionmanagerprivate SHARED ${partitionmanagerprivate_SRCS})
target_link_libraries(partitionmanagerprivate libfatlabel ${KDE4_KDECORE_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KIO_LIBS} ${UUID_LIBRARIES} ${BLKID_LIBRARIES} ${LIBATASMART_LIBRARIES} ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS})
add_library(partitionmanagerprivate SHARED ${partitionmanagerprivate_SRCS})
generate_export_header(partitionmanagerprivate EXPORT_FILE_NAME libpartitionmanager_export.h)
target_link_libraries( partitionmanagerprivate libfatlabel
${UUID_LIBRARIES} ${BLKID_LIBRARIES} ${LIBATASMART_LIBRARIES}
KF5::I18n
KF5::IconThemes
KF5::JobWidgets
KF5::KIOCore
KF5::KIOWidgets
KF5::Service
KF5::Solid
KF5::XmlGui
KF5::WidgetsAddons
)
install(TARGETS partitionmanagerprivate ${INSTALL_TARGETS_DEFAULT_ARGS})
@ -44,11 +57,9 @@ install(TARGETS partitionmanagerprivate ${INSTALL_TARGETS_DEFAULT_ARGS})
file(GLOB partitionmanager_SRCS main.cpp)
kde4_add_app_icon(partitionmanager_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../icons/hi*-apps-partitionmanager.png")
add_executable(partitionmanager ${partitionmanager_SRCS})
kde4_add_executable(partitionmanager ${partitionmanager_SRCS})
target_link_libraries(partitionmanager partitionmanagerprivate ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS})
target_link_libraries(partitionmanager partitionmanagerprivate)
install(TARGETS partitionmanager ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES gui/partitionmanagerui.rc DESTINATION ${DATA_INSTALL_DIR}/partitionmanager)

View File

@ -24,7 +24,6 @@
#include "util/libpartitionmanagerexport.h"
#include <QString>
#include <qglobal.h>
class CoreBackendPartition;
class CoreBackendPartitionTable;

View File

@ -24,12 +24,10 @@
#include <QStringList>
#include <QString>
#include <kpluginfactory.h>
#include <kpluginloader.h>
#include <KAboutData>
#include <KLocalizedString>
#include <kaboutdata.h>
#include <kservice.h>
#include <kservicetypetrader.h>
#include <KPluginLoader>
#include <KServiceTypeTrader>
#include <config.h>
@ -65,8 +63,9 @@ bool CoreBackendManager::load(const QString& name)
if (factory != NULL)
{
m_Backend = factory->create<CoreBackend>(NULL);
backend()->setAboutData(factory->componentData().aboutData());
qDebug() << "Loaded backend plugin: " << backend()->about().programName() << ", " << backend()->about().version();
// FIXME: port KF5
// backend()->setAboutData(factory->componentData().aboutData());
// qDebug() << "Loaded backend plugin: " << backend()->about().displayName() << ", " << backend()->about().version();
return true;
}

View File

@ -23,7 +23,7 @@
#include "util/libpartitionmanagerexport.h"
#include <kservice.h>
#include <KService>
class QString;
class QStringList;

View File

@ -20,6 +20,7 @@
#if !defined(COREBACKENDPARTITIONTABLE__H)
#define COREBACKENDPARTITIONTABLE__H
#include "libpartitionmanager_export.h"
#include "util/libpartitionmanagerexport.h"

View File

@ -33,11 +33,9 @@
#include "ui_configurepagefilesystemcolors.h"
#include <kiconloader.h>
#include <kservice.h>
#include <kmessagebox.h>
#include <kcmdlineargs.h>
#include <KIconThemes/KIconLoader>
#include <KLocalizedString>
#include <KMessageBox>
#include <QIcon>
@ -55,31 +53,32 @@ ConfigureOptionsDialog::ConfigureOptionsDialog(QWidget* parent, const OperationS
KPageWidgetItem* item = NULL;
item = addPage(&generalPageWidget(), i18nc("@title:tab general application settings", "General"), QString(), i18n("General Settings"));
item->setIcon(KIcon(DesktopIcon("partitionmanager")));
item->setIcon(KIconLoader().loadIcon(QLatin1String("partitionmanager"), KIconLoader::Desktop));
connect(&generalPageWidget().comboDefaultFileSystem(), SIGNAL(activated(int)), SLOT(onComboDefaultFileSystemActivated(int)));
item = addPage(&fileSystemColorsPageWidget(), i18nc("@title:tab", "File System Colors"), QString(), i18n("File System Color Settings"));
item->setIcon(KIcon(DesktopIcon("format-fill-color")));
item->setIcon(KIconLoader().loadIcon(QLatin1String("format-fill-color"), KIconLoader::Desktop));
if (KCmdLineArgs::parsedArgs()->isSet("advconfig"))
if (QCoreApplication::arguments().contains(QLatin1String("--advconfig")))
{
item = addPage(&advancedPageWidget(), i18nc("@title:tab advanced application settings", "Advanced"), QString(), i18n("Advanced Settings"));
item->setIcon(KIcon(DesktopIcon("configure")));
item->setIcon(KIconLoader().loadIcon(QLatin1String("configure"), KIconLoader::Desktop));
connect(&advancedPageWidget().comboBackend(), SIGNAL(activated(int)), SLOT(onComboBackendActivated(int)));
}
else
advancedPageWidget().setVisible(false);
restoreDialogSize(KConfigGroup(KGlobal::config(), "configureOptionsDialog"));
KConfigGroup kcg(KSharedConfig::openConfig(), "configureOptionsDialogs");
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
}
/** Destroys a ConfigureOptionsDialog instance */
ConfigureOptionsDialog::~ConfigureOptionsDialog()
{
KConfigGroup kcg(KGlobal::config(), "configureOptionsDialog");
saveDialogSize(kcg);
KConfigGroup kcg(KSharedConfig::openConfig(), "configureOptionsDialog");
kcg.writeEntry("Geometry", saveGeometry());
}
void ConfigureOptionsDialog::updateSettings()
@ -150,7 +149,7 @@ void ConfigureOptionsDialog::onComboBackendActivated(int)
Q_ASSERT(advancedPageWidget().isVisible());
if (operationStack().size() == 0 || KMessageBox::warningContinueCancel(this,
i18nc("@info",
xi18nc("@info",
"<para>Do you really want to change the backend?</para>"
"<para><warning>This will also rescan devices and thus clear the list of pending operations.</warning></para>"),
i18nc("@title:window", "Really Change Backend?"),

View File

@ -21,7 +21,7 @@
#define CONFIGUREOPTIONSDIALOG__H
#include <kconfigdialog.h>
#include <KConfigWidgets/KConfigDialog>
class GeneralPageWidget;
class FileSystemColorsPageWidget;

View File

@ -156,7 +156,7 @@
</widget>
</item>
<item>
<widget class="KButtonGroup" name="kcfg_shredSource">
<widget class="QGroupBox" name="kcfg_shredSource">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>

View File

@ -32,7 +32,7 @@
#include <QDebug>
#include <KLocalizedString>
#include <kmountpoint.h>
#include <KIOCore/KMountPoint>
/** Creates a new Partition object.
@param parent the Partition's parent. May be another Partition (for logicals) or a PartitionTable. Must not be NULL.

View File

@ -85,10 +85,10 @@ bool PartitionAlignment::isAligned(const Device& d, const Partition& p, bool qui
bool PartitionAlignment::isAligned(const Device& d, const Partition& p, qint64 newFirst, qint64 newLast, bool quiet)
{
if (firstDelta(d, p, newFirst) && !quiet)
Log(Log::warning) << i18nc("@info/plain", "Partition <filename>%1</filename> is not properly aligned (first sector: %2, modulo: %3).", p.deviceNode(), newFirst, firstDelta(d, p, newFirst));
Log(Log::warning) << xi18nc("@info/plain", "Partition <filename>%1</filename> is not properly aligned (first sector: %2, modulo: %3).", p.deviceNode(), newFirst, firstDelta(d, p, newFirst));
if (lastDelta(d, p, newLast) && !quiet)
Log(Log::warning) << i18nc("@info/plain", "Partition <filename>%1</filename> is not properly aligned (last sector: %2, modulo: %3).", p.deviceNode(), newLast, lastDelta(d, p, newLast));
Log(Log::warning) << xi18nc("@info/plain", "Partition <filename>%1</filename> is not properly aligned (last sector: %2, modulo: %3).", p.deviceNode(), newLast, lastDelta(d, p, newLast));
return firstDelta(d, p, newFirst) == 0 && lastDelta(d, p, newLast) == 0;
}

View File

@ -31,7 +31,6 @@
#include "util/globallog.h"
#include <KLocalizedString>
#include <kglobal.h>
#include <QDebug>
#include <QFile>
@ -401,7 +400,7 @@ QString PartitionTable::tableTypeToName(TableType l)
if (l == tableTypes[i].type)
return tableTypes[i].name;
return i18nc("@item/plain partition table name", "unknown");
return i18nc("@item partition table name", "unknown");
}
qint64 PartitionTable::maxPrimariesForTableType(TableType l)

View File

@ -22,8 +22,8 @@
#include <QLocale>
#include <kglobal.h>
#include <klocale.h>
#include <KLocalizedString>
#include <KFormat>
#include <atasmart.h>
@ -77,7 +77,7 @@ static QString getPrettyValue(qint64 value, qint64 unit)
switch (unit)
{
case SK_SMART_ATTRIBUTE_UNIT_MSECONDS:
rval = KGlobal::locale()->formatDuration(value);
rval = KFormat().formatDuration(value);
break;
case SK_SMART_ATTRIBUTE_UNIT_SECTORS:

View File

@ -21,7 +21,6 @@
#include "core/smartattribute.h"
#include <KLocalizedString>
#include <kglobal.h>
#include <QDebug>
#include <QString>

View File

@ -25,9 +25,9 @@
#include <QString>
#include <QRegExp>
#include <QTemporaryDir>
#include <KLocalizedString>
#include <ktempdir.h>
namespace FS
{
@ -134,33 +134,33 @@ namespace FS
bool btrfs::resize(Report& report, const QString& deviceNode, qint64 length) const
{
KTempDir tempDir;
if (!tempDir.exists())
QTemporaryDir tempDir;
if (!tempDir.isValid())
{
report.line() << i18nc("@info/plain", "Resizing Btrfs file system on partition <filename>%1</filename> failed: Could not create temp dir.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing Btrfs file system on partition <filename>%1</filename> failed: Could not create temp dir.", deviceNode);
return false;
}
bool rval = false;
ExternalCommand mountCmd(report, "mount", QStringList() << "-v" << "-t" << "btrfs" << deviceNode << tempDir.name());
ExternalCommand mountCmd(report, "mount", QStringList() << "-v" << "-t" << "btrfs" << deviceNode << tempDir.path());
if (mountCmd.run(-1) && mountCmd.exitCode() == 0)
{
ExternalCommand resizeCmd(report, "btrfs", QStringList() << "filesystem" << "resize" << QString::number(length) << tempDir.name());
ExternalCommand resizeCmd(report, "btrfs", QStringList() << "filesystem" << "resize" << QString::number(length) << tempDir.path());
if (resizeCmd.run(-1) && resizeCmd.exitCode() == 0)
rval = true;
else
report.line() << i18nc("@info/plain", "Resizing Btrfs file system on partition <filename>%1</filename> failed: btrfs file system resize failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing Btrfs file system on partition <filename>%1</filename> failed: btrfs file system resize failed.", deviceNode);
ExternalCommand unmountCmd(report, "umount", QStringList() << tempDir.name());
ExternalCommand unmountCmd(report, "umount", QStringList() << tempDir.path());
if (!unmountCmd.run(-1) && unmountCmd.exitCode() == 0 )
report.line() << i18nc("@info/plain", "Warning: Resizing Btrfs file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Warning: Resizing Btrfs file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);
}
else
report.line() << i18nc("@info/plain", "Resizing Btrfs file system on partition <filename>%1</filename> failed: Initial mount failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing Btrfs file system on partition <filename>%1</filename> failed: Initial mount failed.", deviceNode);
return rval;
}

View File

@ -133,7 +133,7 @@ namespace FS
bool fat16::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
report.line() << i18nc("@info/plain", "Setting label for partition <filename>%1</filename> to %2", deviceNode, newLabel);
report.line() << xi18nc("@info/plain", "Setting label for partition <filename>%1</filename> to %2", deviceNode, newLabel);
return fatlabel_set_label(deviceNode.toLocal8Bit(), newLabel.toLocal8Bit()) == 0;
}

View File

@ -21,8 +21,6 @@
#define FILESYSTEM__H
#include <kurl.h>
#include <qglobal.h>
#include <QStringList>
#include <QString>
@ -50,7 +48,7 @@ class FileSystem
explicit SupportTool(const QString& n = QString(), const QUrl& u = QUrl()) : name(n), url(u) {}
const QString name;
const KUrl url;
const QUrl url;
};
/** Supported FileSystem types */

View File

@ -25,9 +25,9 @@
#include <QStringList>
#include <QRegExp>
#include <QTemporaryDir>
#include <KLocalizedString>
#include <ktempdir.h>
#include <unistd.h>
@ -156,33 +156,33 @@ namespace FS
bool jfs::resize(Report& report, const QString& deviceNode, qint64) const
{
KTempDir tempDir;
if (!tempDir.exists())
QTemporaryDir tempDir;
if (!tempDir.isValid())
{
report.line() << i18nc("@info/plain", "Resizing JFS file system on partition <filename>%1</filename> failed: Could not create temp dir.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing JFS file system on partition <filename>%1</filename> failed: Could not create temp dir.", deviceNode);
return false;
}
bool rval = false;
ExternalCommand mountCmd(report, "mount", QStringList() << "-v" << "-t" << "jfs" << deviceNode << tempDir.name());
ExternalCommand mountCmd(report, "mount", QStringList() << "-v" << "-t" << "jfs" << deviceNode << tempDir.path());
if (mountCmd.run(-1))
{
ExternalCommand resizeMountCmd(report, "mount", QStringList() << "-v" << "-t" << "jfs" << "-o" << "remount,resize" << deviceNode << tempDir.name());
ExternalCommand resizeMountCmd(report, "mount", QStringList() << "-v" << "-t" << "jfs" << "-o" << "remount,resize" << deviceNode << tempDir.path());
if (resizeMountCmd.run(-1))
rval = true;
else
report.line() << i18nc("@info/plain", "Resizing JFS file system on partition <filename>%1</filename> failed: Remount failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing JFS file system on partition <filename>%1</filename> failed: Remount failed.", deviceNode);
ExternalCommand unmountCmd(report, "umount", QStringList() << tempDir.name());
ExternalCommand unmountCmd(report, "umount", QStringList() << tempDir.path());
if (!unmountCmd.run(-1))
report.line() << i18nc("@info/plain", "Warning: Resizing JFS file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Warning: Resizing JFS file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);
}
else
report.line() << i18nc("@info/plain", "Resizing JFS file system on partition <filename>%1</filename> failed: Initial mount failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing JFS file system on partition <filename>%1</filename> failed: Initial mount failed.", deviceNode);
return rval;
}

View File

@ -139,7 +139,7 @@ namespace FS
{
QUuid uuid = QUuid::createUuid();
ExternalCommand cmd(report, "cryptsetup", QStringList() << "luksUUID" << deviceNode << "--uuid" << uuid);
ExternalCommand cmd(report, "cryptsetup", QStringList() << "luksUUID" << deviceNode << "--uuid" << uuid.toString());
return cmd.run(-1) && cmd.exitCode() == 0;
}

View File

@ -24,11 +24,12 @@
#include "util/report.h"
#include <cmath>
#include <QString>
#include <QTemporaryDir>
#include <QUuid>
#include <KLocalizedString>
#include <KTempDir>
namespace FS
{
@ -138,33 +139,33 @@ namespace FS
bool nilfs2::resize(Report& report, const QString& deviceNode, qint64 length) const
{
KTempDir tempDir;
if (!tempDir.exists())
QTemporaryDir tempDir;
if (!tempDir.isValid())
{
report.line() << i18nc("@info/plain", "Resizing NILFS2 file system on partition <filename>%1</filename> failed: Could not create temp dir.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing NILFS2 file system on partition <filename>%1</filename> failed: Could not create temp dir.", deviceNode);
return false;
}
bool rval = false;
ExternalCommand mountCmd(report, "mount", QStringList() << "-v" << "-t" << "nilfs2" << deviceNode << tempDir.name());
ExternalCommand mountCmd(report, "mount", QStringList() << "-v" << "-t" << "nilfs2" << deviceNode << tempDir.path());
if (mountCmd.run(-1) && mountCmd.exitCode() == 0)
{
ExternalCommand resizeCmd(report, "nilfs-resize", QStringList() << "-v" << "-y" << deviceNode << QString::number(length));
if (resizeCmd.run(-1) && resizeCmd.exitCode() == 0)
rval = true;
else
report.line() << i18nc("@info/plain", "Resizing NILFS2 file system on partition <filename>%1</filename> failed: NILFS2 file system resize failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing NILFS2 file system on partition <filename>%1</filename> failed: NILFS2 file system resize failed.", deviceNode);
ExternalCommand unmountCmd(report, "umount", QStringList() << tempDir.name());
ExternalCommand unmountCmd(report, "umount", QStringList() << tempDir.path());
if (!unmountCmd.run(-1) && unmountCmd.exitCode() == 0 )
report.line() << i18nc("@info/plain", "Warning: Resizing NILFS2 file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Warning: Resizing NILFS2 file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);
}
else
report.line() << i18nc("@info/plain", "Resizing NILFS2 file system on partition <filename>%1</filename> failed: Initial mount failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing NILFS2 file system on partition <filename>%1</filename> failed: Initial mount failed.", deviceNode);
return rval;
}
@ -178,7 +179,7 @@ namespace FS
bool nilfs2::updateUUID(Report& report, const QString& deviceNode) const
{
QUuid uuid = QUuid::createUuid();
ExternalCommand cmd(report, "nilfs-tune", QStringList() << "-U" << uuid << deviceNode);
ExternalCommand cmd(report, "nilfs-tune", QStringList() << "-U" << uuid.toString() << deviceNode);
return cmd.run(-1) && cmd.exitCode() == 0;
}
}

View File

@ -194,7 +194,7 @@ namespace FS
bool ntfs::updateBootSector(Report& report, const QString& deviceNode) const
{
report.line() << i18nc("@info/plain", "Updating boot sector for NTFS file system on partition <filename>%1</filename>.", deviceNode);
report.line() << xi18nc("@info/plain", "Updating boot sector for NTFS file system on partition <filename>%1</filename>.", deviceNode);
quint32 n = firstSector();
char* s = reinterpret_cast<char*>(&n);
@ -207,23 +207,23 @@ namespace FS
QFile device(deviceNode);
if (!device.open(QFile::ReadWrite | QFile::Unbuffered))
{
Log() << i18nc("@info/plain", "Could not open partition <filename>%1</filename> for writing when trying to update the NTFS boot sector.", deviceNode);
Log() << xi18nc("@info/plain", "Could not open partition <filename>%1</filename> for writing when trying to update the NTFS boot sector.", deviceNode);
return false;
}
if (!device.seek(0x1c))
{
Log() << i18nc("@info/plain", "Could not seek to position 0x1c on partition <filename>%1</filename> when trying to update the NTFS boot sector.", deviceNode);
Log() << xi18nc("@info/plain", "Could not seek to position 0x1c on partition <filename>%1</filename> when trying to update the NTFS boot sector.", deviceNode);
return false;
}
if (device.write(s, 4) != 4)
{
Log() << i18nc("@info/plain", "Could not write new start sector to partition <filename>%1</filename> when trying to update the NTFS boot sector.", deviceNode);
Log() << xi18nc("@info/plain", "Could not write new start sector to partition <filename>%1</filename> when trying to update the NTFS boot sector.", deviceNode);
return false;
}
Log() << i18nc("@info/plain", "Updated NTFS boot sector for partition <filename>%1</filename> successfully.", deviceNode);
Log() << xi18nc("@info/plain", "Updated NTFS boot sector for partition <filename>%1</filename> successfully.", deviceNode);
return true;
}

View File

@ -26,8 +26,8 @@
#include <QString>
#include <QStringList>
#include <QRegExp>
#include <QTemporaryDir>
#include <ktempdir.h>
#include <KLocalizedString>
#include <unistd.h>
@ -163,33 +163,33 @@ namespace FS
bool xfs::resize(Report& report, const QString& deviceNode, qint64) const
{
KTempDir tempDir;
if (!tempDir.exists())
QTemporaryDir tempDir;
if (!tempDir.isValid())
{
report.line() << i18nc("@info/plain", "Resizing XFS file system on partition <filename>%1</filename> failed: Could not create temp dir.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing XFS file system on partition <filename>%1</filename> failed: Could not create temp dir.", deviceNode);
return false;
}
bool rval = false;
ExternalCommand mountCmd(report, "mount", QStringList() << "-v" << "-t" << "xfs" << deviceNode << tempDir.name());
ExternalCommand mountCmd(report, "mount", QStringList() << "-v" << "-t" << "xfs" << deviceNode << tempDir.path());
if (mountCmd.run(-1))
{
ExternalCommand resizeCmd(report, "xfs_growfs", QStringList() << tempDir.name());
ExternalCommand resizeCmd(report, "xfs_growfs", QStringList() << tempDir.path());
if (resizeCmd.run(-1))
rval = true;
else
report.line() << i18nc("@info/plain", "Resizing XFS file system on partition <filename>%1</filename> failed: xfs_growfs failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing XFS file system on partition <filename>%1</filename> failed: xfs_growfs failed.", deviceNode);
ExternalCommand unmountCmd(report, "umount", QStringList() << tempDir.name());
ExternalCommand unmountCmd(report, "umount", QStringList() << tempDir.path());
if (!unmountCmd.run(-1))
report.line() << i18nc("@info/plain", "Warning: Resizing XFS file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Warning: Resizing XFS file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);
}
else
report.line() << i18nc("@info/plain", "Resizing XFS file system on partition <filename>%1</filename> failed: Initial mount failed.", deviceNode);
report.line() << xi18nc("@info/plain", "Resizing XFS file system on partition <filename>%1</filename> failed: Initial mount failed.", deviceNode);
return rval;
}

View File

@ -31,26 +31,25 @@
#include "util/report.h"
#include "util/htmlreport.h"
#include <QApplication>
#include <QCloseEvent>
#include <QDialogButtonBox>
#include <QFont>
#include <QKeyEvent>
#include <QFile>
#include <QFileDialog>
#include <QKeyEvent>
#include <QPushButton>
#include <QTemporaryFile>
#include <QTextStream>
#include <kapplication.h>
#include <KLocalizedString>
#include <KAboutData>
#include <KConfigGroup>
#include <KIOWidgets/KRun>
#include <KIO/CopyJob>
#include <KJobUiDelegate>
#include <KLocalizedString>
#include <KMessageBox>
#include <KSharedConfig>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <krun.h>
#include <ktemporaryfile.h>
#include <kaboutdata.h>
#include <kio/netaccess.h>
#include <kio/jobuidelegate.h>
#include <kio/copyjob.h>
const QString ApplyProgressDialog::m_TimeFormat = "hh:mm:ss";
@ -196,7 +195,7 @@ void ApplyProgressDialog::onCancelButton()
if (operationRunner().isCancelling())
return;
KApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
cancelButton->setEnabled(false);
setStatus(i18nc("@info:progress", "Waiting for operation to finish..."));
@ -208,7 +207,7 @@ void ApplyProgressDialog::onCancelButton()
operationRunner().suspendMutex().lock();
cancelButton->setEnabled(true);
KApplication::restoreOverrideCursor();
QApplication::restoreOverrideCursor();
if (KMessageBox::questionYesNo(this, i18nc("@info", "Do you really want to cancel?"), i18nc("@title:window", "Cancel Running Operations"), KGuiItem(i18nc("@action:button", "Yes, Cancel Operations"), "dialog-ok"), KStandardGuiItem::no()) == KMessageBox::Yes)
// in the meantime while we were showing the messagebox, the runner might have finished.
@ -412,27 +411,28 @@ void ApplyProgressDialog::keyPressEvent(QKeyEvent* e)
void ApplyProgressDialog::saveReport()
{
const KUrl url = KFileDialog::getSaveUrl(KUrl("kfiledialog://saveReport"));
const QUrl url = QFileDialog::getSaveFileUrl();
if (url.isEmpty())
return;
KTemporaryFile tempFile;
QTemporaryFile tempFile;
if (tempFile.open())
{
QTextStream s(&tempFile);
HtmlReport html;
s << html.header()
<< report().toHtml()
<< html.footer();
tempFile.close();
KIO::CopyJob* job = KIO::move(tempFile.fileName(), url, KIO::HideProgressInfo);
if (!KIO::NetAccess::synchronousRun(job, NULL))
KIO::CopyJob* job = KIO::move(QUrl::fromLocalFile(tempFile.fileName()), url, KIO::HideProgressInfo);
job->exec();
if ( job->error() )
job->ui()->showErrorMessage();
}
else
@ -441,11 +441,11 @@ void ApplyProgressDialog::saveReport()
void ApplyProgressDialog::browserReport()
{
KTemporaryFile file;
QTemporaryFile file;
// Make sure the temp file is created somewhere another user can read it: KRun::runUrl() will open
// the file as the logged in user, not as the user running our application.
file.setFileTemplate("/tmp/" + KGlobal::mainComponent().aboutData()->appName() + "-XXXXXX.html");
file.setFileTemplate("/tmp/" + QCoreApplication::applicationName() + "-XXXXXX.html");
file.setAutoRemove(false);
if (file.open())
@ -453,7 +453,7 @@ void ApplyProgressDialog::browserReport()
QTextStream s(&file);
HtmlReport html;
s << html.header()
<< report().toHtml()
<< html.footer();
@ -465,5 +465,5 @@ void ApplyProgressDialog::browserReport()
KMessageBox::sorry(this, i18nc("@info", "The configured external browser could not be run. Please check your settings."), i18nc("@title:window", "Could Not Launch Browser."));
}
else
KMessageBox::sorry(this, i18nc("@info", "Could not create temporary file <filename>%1</filename> for writing.", file.fileName()), i18nc("@title:window", "Could Not Launch Browser."));
KMessageBox::sorry(this, xi18nc("@info", "Could not create temporary file <filename>%1</filename> for writing.", file.fileName()), i18nc("@title:window", "Could Not Launch Browser."));
}

View File

@ -23,12 +23,12 @@
#include "core/device.h"
#include "core/partitiontable.h"
#include <KLocalizedString>
#include <KMessageBox>
#include <QDialogButtonBox>
#include <QPushButton>
#include <KLocalizedString>
#include <KMessageBox>
#include <config.h>
CreatePartitionTableDialog::CreatePartitionTableDialog(QWidget* parent, const Device& d) :
@ -39,7 +39,7 @@ CreatePartitionTableDialog::CreatePartitionTableDialog(QWidget* parent, const De
QVBoxLayout *mainLayout = new QVBoxLayout(this);
setLayout(mainLayout);
mainLayout->addWidget(&widget());
setWindowTitle(i18nc("@title:window", "Create a New Partition Table on <filename>%1</filename>", device().deviceNode()));
setWindowTitle(xi18nc("@title:window", "Create a New Partition Table on <filename>%1</filename>", device().deviceNode()));
dialogButtonBox = new QDialogButtonBox;
createButton = dialogButtonBox->addButton( QDialogButtonBox::Ok );
createButton->setText(i18n("Create &New Partition Table"));
@ -67,7 +67,7 @@ void CreatePartitionTableDialog::onMSDOSToggled(bool on)
if (on && device().totalSectors() > 0xffffffff)
{
if (KMessageBox::warningContinueCancel(this,
i18nc("@info",
xi18nc("@info",
"<para>Do you really want to create an MS-Dos partition table on <filename>%1</filename>?</para>"
"<para>This device has more than 2^32 sectors. That is the most the MS-Dos partition table type supports, so you will not be able to use the whole device.</para>", device().deviceNode()),
i18nc("@title:window", "Really Create MS-Dos Partition Table Type?"),

View File

@ -38,7 +38,7 @@ DecryptLuksDialog::DecryptLuksDialog(QWidget* parent, const QString& deviceNode)
QVBoxLayout *mainLayout = new QVBoxLayout(this);
setLayout(mainLayout);
mainLayout->addWidget(&widget());
setWindowTitle(i18nc("@title:window", "Decrypt LUKS partition on <filename>%1</filename>", this->deviceNode()));
setWindowTitle(xi18nc("@title:window", "Decrypt LUKS partition on <filename>%1</filename>", this->deviceNode()));
QDialogButtonBox* dialogButtonBox = new QDialogButtonBox;
QPushButton* decryptButton = new QPushButton;

View File

@ -32,7 +32,7 @@
#include <KLocalizedString>
#include <KSharedConfig>
#include <KConfigGroup>
#include <kiconloader.h>
#include <KIconThemes/KIconLoader>
#include <QDialogButtonBox>
#include <QPointer>
@ -51,7 +51,7 @@ DevicePropsDialog::DevicePropsDialog(QWidget* parent, Device& d) :
mainLayout = new QVBoxLayout(this);
setLayout(mainLayout);
mainLayout->addWidget(&dialogWidget());
setWindowTitle(i18nc("@title:window", "Device Properties: <filename>%1</filename>", device().deviceNode()));
setWindowTitle(xi18nc("@title:window", "Device Properties: <filename>%1</filename>", device().deviceNode()));
setupDialog();
setupConnections();
@ -126,12 +126,12 @@ void DevicePropsDialog::setupDialog()
if (device().smartStatus().status())
{
dialogWidget().smartStatusText().setText(i18nc("@label SMART disk status", "good"));
dialogWidget().smartStatusIcon().setPixmap(SmallIcon("dialog-ok"));
dialogWidget().smartStatusIcon().setPixmap(KIconLoader().loadIcon(QLatin1String("dialog-ok"), KIconLoader::Small));
}
else
{
dialogWidget().smartStatusText().setText(i18nc("@label SMART disk status", "BAD"));
dialogWidget().smartStatusIcon().setPixmap(SmallIcon("dialog-warning"));
dialogWidget().smartStatusIcon().setPixmap(KIconLoader().loadIcon(QLatin1String("dialog-warning"), KIconLoader::Small));
}
}
else

View File

@ -25,6 +25,7 @@
#include <KConfigGroup>
#include <KSharedConfig>
#include <KLocalizedString>
EditMountOptionsDialog::EditMountOptionsDialog(QWidget* parent, const QStringList& options) :
QDialog(parent),

View File

@ -22,7 +22,9 @@
#include "core/partition.h"
#include <kmessagebox.h>
#include <KMessageBox>
#include <KGuiItem>
#include <KStandardGuiItem>
#include <KLocalizedString>
#include <KConfigGroup>
#include <KSharedConfig>
@ -35,7 +37,7 @@ EditMountPointDialog::EditMountPointDialog(QWidget* parent, Partition& p) :
QVBoxLayout *mainLayout = new QVBoxLayout(this);
setLayout(mainLayout);
mainLayout->addWidget(&widget());
setWindowTitle(i18nc("@title:window", "Edit mount point for <filename>%1</filename>", p.deviceNode()));
setWindowTitle(xi18nc("@title:window", "Edit mount point for <filename>%1</filename>", p.deviceNode()));
KConfigGroup kcg(KSharedConfig::openConfig(), "editMountPointDialog");
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
@ -51,7 +53,7 @@ EditMountPointDialog::~EditMountPointDialog()
void EditMountPointDialog::accept()
{
if (KMessageBox::warningContinueCancel(this,
i18nc("@info", "<para>Are you sure you want to save the changes you made to the system table file <filename>/etc/fstab</filename>?</para>"
xi18nc("@info", "<para>Are you sure you want to save the changes you made to the system table file <filename>/etc/fstab</filename>?</para>"
"<para><warning>This will overwrite the existing file on your hard drive now. This <strong>can not be undone</strong>.</warning></para>"),
i18nc("@title:window", "Really save changes?"),
KGuiItem(i18nc("@action:button", "Save changes"), "arrow-right"),

View File

@ -26,14 +26,13 @@
#include "fs/filesystem.h"
#include <KLocalizedString>
#include <kfiledialog.h>
#include <klineedit.h>
#include <kmountpoint.h>
#include <kmessagebox.h>
#include <KIOCore/KMountPoint>
#include <KMessageBox>
#include <QString>
#include <QWidget>
#include <QFile>
#include <QFileDialog>
#include <QPointer>
#include <QDebug>
@ -145,7 +144,7 @@ void EditMountPointDialogWidget::setupOptions(const QStringList& options)
void EditMountPointDialogWidget::on_m_ButtonSelect_clicked(bool)
{
const QString s = KFileDialog::getExistingDirectory(KUrl(editPath().text()), this);
const QString s = QFileDialog::getExistingDirectory(this, editPath().text());
if (!s.isEmpty())
editPath().setText(s);
}
@ -178,7 +177,7 @@ bool EditMountPointDialogWidget::readMountpoints(const QString& filename)
if (fp == NULL)
{
KMessageBox::sorry(this,
i18nc("@info", "Could not open mount point file <filename>%1</filename>.", filename),
xi18nc("@info", "Could not open mount point file <filename>%1</filename>.", filename),
i18nc("@title:window", "Error while reading mount points"));
return false;
}
@ -298,7 +297,7 @@ bool EditMountPointDialogWidget::writeMountpoints(const QString& filename)
if (!rval)
KMessageBox::sorry(this,
i18nc("@info", "Could not save mount points to file <filename>%1</filename>.", filename),
xi18nc("@info", "Could not save mount points to file <filename>%1</filename>.", filename),
i18nc("@title:window", "Error While Saving Mount Points"));
return rval;

View File

@ -26,6 +26,7 @@
#include <QDialogButtonBox>
#include <QDialog>
#include <KIconThemes/KIconLoader>
#include <KLocalizedString>
#include <KConfigGroup>
#include <KSharedConfig>
@ -66,8 +67,8 @@ QSize FileSystemSupportDialog::sizeHint() const
void FileSystemSupportDialog::setupDialog()
{
QPixmap yes(BarIcon("dialog-ok"));
QPixmap no(BarIcon("dialog-error"));
QIcon yes = QIcon(KIconLoader().loadIcon(QLatin1String("dialog-ok"), KIconLoader::Toolbar));
QIcon no = QIcon(KIconLoader().loadIcon(QLatin1String("dialog-error"), KIconLoader::Toolbar));
dialogWidget().tree().clear();

View File

@ -27,13 +27,13 @@
#include "util/capacity.h"
#include <QDockWidget>
#include <QFontDatabase>
#include <QFrame>
#include <QGridLayout>
#include <QLabel>
#include <QFrame>
#include <QDockWidget>
#include <QLocale>
#include <kglobalsettings.h>
#include <KLocalizedString>
/** Creates a new InfoPane instance
@ -77,7 +77,7 @@ int InfoPane::createHeader(const QString& title, const int num_cols)
void InfoPane::createLabels(const QString& title, const QString& value, const int num_cols, int& x, int& y)
{
QLabel* labelTitle = new QLabel(title, this);
labelTitle->setFont(KGlobalSettings::smallestReadableFont());
labelTitle->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
labelTitle->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
QPalette palette = labelTitle->palette();
@ -90,7 +90,7 @@ void InfoPane::createLabels(const QString& title, const QString& value, const in
QLabel* labelValue = new QLabel(value, this);
labelValue->setTextInteractionFlags(Qt::TextBrowserInteraction);
labelValue->setFont(KGlobalSettings::smallestReadableFont());
labelValue->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
gridLayout().addWidget(labelValue, y, x + 1, 1, 1);
x += 2;

View File

@ -24,14 +24,13 @@
#include "util/globallog.h"
#include "util/capacity.h"
#include <kmenu.h>
#include <kactioncollection.h>
#include <KIconThemes/KIconLoader>
class ListDeviceWidgetItem : public QListWidgetItem
{
public:
ListDeviceWidgetItem(const Device& d) :
QListWidgetItem(DesktopIcon(d.iconName()), d.prettyName()),
QListWidgetItem(QIcon(KIconLoader().loadIcon(d.iconName(), KIconLoader::Desktop)), d.prettyName()),
deviceNode(d.deviceNode())
{
setToolTip(d.prettyName());

View File

@ -24,8 +24,7 @@
#include "util/globallog.h"
#include "util/capacity.h"
#include <kmenu.h>
#include <kactioncollection.h>
#include <KIconThemes/KIconLoader>
/** Creates a new ListOperations instance.
@param parent the parent widget
@ -44,7 +43,7 @@ void ListOperations::updateOperations(const OperationStack::Operations& ops)
foreach (const Operation* op, ops)
{
QListWidgetItem* item = new QListWidgetItem(SmallIcon(op->iconName()), op->description());
QListWidgetItem* item = new QListWidgetItem(QIcon(KIconLoader().loadIcon(op->iconName(), KIconLoader::Small)), op->description());
item->setToolTip(op->description());
listOperations().addItem(item);
}

View File

@ -50,33 +50,29 @@
#include "util/helpers.h"
#include <kstandardaction.h>
#include <kactioncollection.h>
#include <ktoolbar.h>
#include <kstatusbar.h>
#include <kmenubar.h>
#include <kmessagebox.h>
#include <kaboutdata.h>
#include <kcomponentdata.h>
#include <kstandardguiitem.h>
#include <kaction.h>
#include <kapplication.h>
#include <KLocalizedString>
#include <kxmlguifactory.h>
#include <kfiledialog.h>
#include <kio/netaccess.h>
#include <kio/jobuidelegate.h>
#include <kio/copyjob.h>
#include <ktemporaryfile.h>
#include <QApplication>
#include <QCloseEvent>
#include <QReadLocker>
#include <QPointer>
#include <QFile>
#include <QDateTime>
#include <QFile>
#include <QFileDialog>
#include <QMenu>
#include <QPointer>
#include <QReadLocker>
#include <QStatusBar>
#include <QTemporaryFile>
#include <QTextStream>
#include <KXmlGui/KActionCollection>
#include <KMessageBox>
#include <KAboutData>
#include <KIconThemes/KIconLoader>
#include <KLocalizedString>
#include <KXmlGui/KXMLGUIFactory>
#include <KJobUiDelegate>
#include <KIO/CopyJob>
#include <KIO/Job>
#include <KJobWidgets/KJobWidgets>
#include <config.h>
#include <unistd.h>
@ -140,10 +136,10 @@ void MainWindow::closeEvent(QCloseEvent* event)
if (operationStack().size() > 0)
{
if (KMessageBox::warningContinueCancel(this,
i18ncp("@info", "<para>Do you really want to quit the application?</para><para>There is still an operation pending.</para>",
"<para>Do you really want to quit the application?</para><para>There are still %1 operations pending.</para>", operationStack().size()),
xi18ncp("@info", "<para>Do you really want to quit the application?</para><para>There is still an operation pending.</para>",
"<para>Do you really want to quit the application?</para><para>There are still %1 operations pending.</para>", operationStack().size()),
i18nc("@title:window", "Discard Pending Operations and Quit?"),
KGuiItem(i18nc("@action:button", "Quit <application>%1</application>", KGlobal::mainComponent().aboutData()->programName()), "arrow-right"),
KGuiItem(xi18nc("@action:button", "Quit <application>%1</application>", QGuiApplication::applicationDisplayName()), "arrow-right"),
KStandardGuiItem::cancel(), "reallyQuit") == KMessageBox::Cancel)
{
event->ignore();
@ -190,21 +186,21 @@ void MainWindow::setupActions()
undoOperation->setToolTip(i18nc("@info:tooltip", "Undo the last operation"));
undoOperation->setStatusTip(i18nc("@info:status", "Remove the last operation from the list."));
undoOperation->setShortcut(Qt::CTRL | Qt::Key_Z);
undoOperation->setIcon(BarIcon("edit-undo"));
undoOperation->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("edit-undo"), KIconLoader::Toolbar)));
QAction* clearAllOperations = actionCollection()->addAction("clearAllOperations", this, SLOT(onClearAllOperations()));
clearAllOperations->setEnabled(false);
clearAllOperations->setText(i18nc("@action:inmenu clear the list of operations", "Clear"));
clearAllOperations->setToolTip(i18nc("@info:tooltip", "Clear all operations"));
clearAllOperations->setStatusTip(i18nc("@info:status", "Empty the list of pending operations."));
clearAllOperations->setIcon(BarIcon("dialog-cancel"));
clearAllOperations->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("dialog-cancel"), KIconLoader::Toolbar)));
QAction* applyAllOperations = actionCollection()->addAction("applyAllOperations", this, SLOT(onApplyAllOperations()));
applyAllOperations->setEnabled(false);
applyAllOperations->setText(i18nc("@action:inmenu apply all operations", "Apply"));
applyAllOperations->setToolTip(i18nc("@info:tooltip", "Apply all operations"));
applyAllOperations->setStatusTip(i18nc("@info:status", "Apply the pending operations in the list."));
applyAllOperations->setIcon(BarIcon("dialog-ok-apply"));
applyAllOperations->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("dialog-ok-apply"), KIconLoader::Toolbar)));
// Device actions
QAction* refreshDevices = actionCollection()->addAction("refreshDevices", this, SLOT(onRefreshDevices()));
@ -212,7 +208,7 @@ void MainWindow::setupActions()
refreshDevices->setToolTip(i18nc("@info:tooltip", "Refresh all devices"));
refreshDevices->setStatusTip(i18nc("@info:status", "Renew the devices list."));
refreshDevices->setShortcut(Qt::Key_F5);
refreshDevices->setIcon(BarIcon("view-refresh"));
refreshDevices->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("view-refresh"), KIconLoader::Toolbar)));
QAction* createNewPartitionTable = actionCollection()->addAction("createNewPartitionTable", this, SLOT(onCreateNewPartitionTable()));
createNewPartitionTable->setEnabled(false);
@ -220,21 +216,21 @@ void MainWindow::setupActions()
createNewPartitionTable->setToolTip(i18nc("@info:tooltip", "Create a new partition table"));
createNewPartitionTable->setStatusTip(i18nc("@info:status", "Create a new and empty partition table on a device."));
createNewPartitionTable->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_N);
createNewPartitionTable->setIcon(BarIcon("edit-clear"));
createNewPartitionTable->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("edit-clear"), KIconLoader::Toolbar)));
QAction* exportPartitionTable = actionCollection()->addAction("exportPartitionTable", this, SLOT(onExportPartitionTable()));
exportPartitionTable->setEnabled(false);
exportPartitionTable->setText(i18nc("@action:inmenu", "Export Partition Table"));
exportPartitionTable->setToolTip(i18nc("@info:tooltip", "Export a partition table"));
exportPartitionTable->setStatusTip(i18nc("@info:status", "Export the device's partition table to a text file."));
exportPartitionTable->setIcon(BarIcon("document-export"));
exportPartitionTable->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("document-export"), KIconLoader::Toolbar)));
QAction* importPartitionTable = actionCollection()->addAction("importPartitionTable", this, SLOT(onImportPartitionTable()));
importPartitionTable->setEnabled(false);
importPartitionTable->setText(i18nc("@action:inmenu", "Import Partition Table"));
importPartitionTable->setToolTip(i18nc("@info:tooltip", "Import a partition table"));
importPartitionTable->setStatusTip(i18nc("@info:status", "Import a partition table from a text file."));
importPartitionTable->setIcon(BarIcon("document-import"));
importPartitionTable->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("document-import"), KIconLoader::Toolbar)));
QAction* smartStatusDevice = actionCollection()->addAction("smartStatusDevice", this, SLOT(onSmartStatusDevice()));
smartStatusDevice->setEnabled(false);
@ -247,7 +243,7 @@ void MainWindow::setupActions()
propertiesDevice->setText(i18nc("@action:inmenu", "Properties"));
propertiesDevice->setToolTip(i18nc("@info:tooltip", "Show device properties dialog"));
propertiesDevice->setStatusTip(i18nc("@info:status", "View and modify device properties"));
propertiesDevice->setIcon(BarIcon("document-properties"));
propertiesDevice->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("document-properties"), KIconLoader::Toolbar)));
// Partition actions
QAction* newPartition = actionCollection()->addAction("newPartition", &pmWidget(), SLOT(onNewPartition()));
@ -256,7 +252,7 @@ void MainWindow::setupActions()
newPartition->setToolTip(i18nc("@info:tooltip", "New partition"));
newPartition->setStatusTip(i18nc("@info:status", "Create a new partition."));
newPartition->setShortcut(Qt::CTRL | Qt::Key_N);
newPartition->setIcon(BarIcon("document-new"));
newPartition->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("document-new"), KIconLoader::Toolbar)));
QAction* resizePartition = actionCollection()->addAction("resizePartition", &pmWidget(), SLOT(onResizePartition()));
resizePartition->setEnabled(false);
@ -264,7 +260,7 @@ void MainWindow::setupActions()
resizePartition->setToolTip(i18nc("@info:tooltip", "Resize or move partition"));
resizePartition->setStatusTip(i18nc("@info:status", "Shrink, grow or move an existing partition."));
resizePartition->setShortcut(Qt::CTRL | Qt::Key_R);
resizePartition->setIcon(BarIcon("arrow-right-double"));
resizePartition->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("arrow-right-double"), KIconLoader::Toolbar)));
QAction* deletePartition = actionCollection()->addAction("deletePartition", &pmWidget(), SLOT(onDeletePartition()));
deletePartition->setEnabled(false);
@ -272,7 +268,7 @@ void MainWindow::setupActions()
deletePartition->setToolTip(i18nc("@info:tooltip", "Delete partition"));
deletePartition->setStatusTip(i18nc("@info:status", "Delete a partition."));
deletePartition->setShortcut(Qt::Key_Delete);
deletePartition->setIcon(BarIcon("edit-delete"));
deletePartition->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("edit-delete"), KIconLoader::Toolbar)));
QAction* shredPartition = actionCollection()->addAction("shredPartition", &pmWidget(), SLOT(onShredPartition()));
shredPartition->setEnabled(false);
@ -280,7 +276,7 @@ void MainWindow::setupActions()
shredPartition->setToolTip(i18nc("@info:tooltip", "Shred partition"));
shredPartition->setStatusTip(i18nc("@info:status", "Shred a partition so that its contents cannot be restored."));
shredPartition->setShortcut(Qt::SHIFT | Qt::Key_Delete);
shredPartition->setIcon(BarIcon("edit-delete-shred"));
shredPartition->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("edit-delete-shred"), KIconLoader::Toolbar)));
QAction* copyPartition = actionCollection()->addAction("copyPartition", &pmWidget(), SLOT(onCopyPartition()));
copyPartition->setEnabled(false);
@ -288,7 +284,7 @@ void MainWindow::setupActions()
copyPartition->setToolTip(i18nc("@info:tooltip", "Copy partition"));
copyPartition->setStatusTip(i18nc("@info:status", "Copy an existing partition."));
copyPartition->setShortcut(Qt::CTRL | Qt::Key_C);
copyPartition->setIcon(BarIcon("edit-copy"));
copyPartition->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("edit-copy"), KIconLoader::Toolbar)));
QAction* pastePartition = actionCollection()->addAction("pastePartition", &pmWidget(), SLOT(onPastePartition()));
pastePartition->setEnabled(false);
@ -296,7 +292,7 @@ void MainWindow::setupActions()
pastePartition->setToolTip(i18nc("@info:tooltip", "Paste partition"));
pastePartition->setStatusTip(i18nc("@info:status", "Paste a copied partition."));
pastePartition->setShortcut(Qt::CTRL | Qt::Key_V);
pastePartition->setIcon(BarIcon("edit-paste"));
pastePartition->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("edit-paste"), KIconLoader::Toolbar)));
QAction* editMountPoint = actionCollection()->addAction("editMountPoint", &pmWidget(), SLOT(onEditMountPoint()));
editMountPoint->setEnabled(false);
@ -315,28 +311,28 @@ void MainWindow::setupActions()
checkPartition->setText(i18nc("@action:inmenu", "Check"));
checkPartition->setToolTip(i18nc("@info:tooltip", "Check partition"));
checkPartition->setStatusTip(i18nc("@info:status", "Check a filesystem on a partition for errors."));
checkPartition->setIcon(BarIcon("flag"));
checkPartition->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("flag"), KIconLoader::Toolbar)));
QAction* propertiesPartition = actionCollection()->addAction("propertiesPartition", &pmWidget(), SLOT(onPropertiesPartition()));
propertiesPartition->setEnabled(false);
propertiesPartition->setText(i18nc("@action:inmenu", "Properties"));
propertiesPartition->setToolTip(i18nc("@info:tooltip", "Show partition properties dialog"));
propertiesPartition->setStatusTip(i18nc("@info:status", "View and modify partition properties (label, partition flags, etc.)"));
propertiesPartition->setIcon(BarIcon("document-properties"));
propertiesPartition->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("document-properties"), KIconLoader::Toolbar)));
QAction* backup = actionCollection()->addAction("backupPartition", &pmWidget(), SLOT(onBackupPartition()));
backup->setEnabled(false);
backup->setText(i18nc("@action:inmenu", "Backup"));
backup->setToolTip(i18nc("@info:tooltip", "Backup partition"));
backup->setStatusTip(i18nc("@info:status", "Backup a partition to an image file."));
backup->setIcon(BarIcon("document-export"));
backup->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("document-export"), KIconLoader::Toolbar)));
QAction* restore = actionCollection()->addAction("restorePartition", &pmWidget(), SLOT(onRestorePartition()));
restore->setEnabled(false);
restore->setText(i18nc("@action:inmenu", "Restore"));
restore->setToolTip(i18nc("@info:tooltip", "Restore partition"));
restore->setStatusTip(i18nc("@info:status", "Restore a partition from an image file."));
restore->setIcon(BarIcon("document-import"));
restore->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("document-import"), KIconLoader::Toolbar)));
// View actions
QAction* fileSystemSupport = actionCollection()->addAction("fileSystemSupport", this, SLOT(onFileSystemSupport()));
@ -357,13 +353,13 @@ void MainWindow::setupActions()
clearLog->setText(i18nc("@action:inmenu", "Clear Log"));
clearLog->setToolTip(i18nc("@info:tooltip", "Clear the log output"));
clearLog->setStatusTip(i18nc("@info:status", "Clear the log output panel."));
clearLog->setIcon(BarIcon("edit-clear-list"));
clearLog->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("edit-clear-list"), KIconLoader::Toolbar)));
QAction* saveLog = actionCollection()->addAction("saveLog", &treeLog(), SLOT(onSaveLog()));
saveLog->setText(i18nc("@action:inmenu", "Save Log"));
saveLog->setToolTip(i18nc("@info:tooltip", "Save the log output"));
saveLog->setStatusTip(i18nc("@info:status", "Save the log output to a file."));
saveLog->setIcon(BarIcon("document-save"));
saveLog->setIcon(QIcon(KIconLoader().loadIcon(QLatin1String("document-save"), KIconLoader::Toolbar)));
}
void MainWindow::setupConnections()
@ -383,7 +379,6 @@ void MainWindow::loadConfig()
{
dockLog().setVisible(false);
dockInformation().setVisible(false);
toolBar("deviceToolBar")->setVisible(false);
}
}
@ -473,9 +468,7 @@ void MainWindow::updateWindowTitle()
QString title;
if (pmWidget().selectedDevice())
title = pmWidget().selectedDevice()->deviceNode() + " - ";
title += KGlobal::mainComponent().aboutData()->programName() + ' ' + KGlobal::mainComponent().aboutData()->version();
title = pmWidget().selectedDevice()->deviceNode();
setWindowTitle(title);
}
@ -545,9 +538,10 @@ void MainWindow::on_m_PartitionManagerWidget_selectedPartitionChanged(const Part
void MainWindow::scanDevices()
{
Log(Log::information) << i18nc("@info/plain", "Using backend plugin: %1 (%2)",
CoreBackendManager::self()->backend()->about().programName(),
CoreBackendManager::self()->backend()->about().version());
// FIXME: port KF5
// Log(Log::information) << i18nc("@info/plain", "Using backend plugin: %1 (%2)",
// CoreBackendManager::self()->backend()->about().displayName(),
// CoreBackendManager::self()->backend()->about().version());
Log() << i18nc("@info/plain", "Scanning devices...");
@ -556,7 +550,7 @@ void MainWindow::scanDevices()
pmWidget().clear();
KApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
scanProgressDialog().setEnabled(true);
scanProgressDialog().show();
@ -582,7 +576,7 @@ void MainWindow::on_m_DeviceScanner_finished()
pmWidget().updatePartitions();
Log() << i18nc("@info/plain", "Scan finished.");
KApplication::restoreOverrideCursor();
QApplication::restoreOverrideCursor();
// try to set the seleted device, either from the saved one or just select the
// first device
@ -619,7 +613,7 @@ void MainWindow::onSelectedDeviceMenuTriggered(bool)
if (action == NULL || action->parent() != devicesMenu)
return;
foreach (QAction* entry, qFindChildren<QAction*>(devicesMenu))
foreach (QAction* entry, devicesMenu->findChildren<QAction*>())
entry->setChecked(entry == action);
listDevices().setSelectedDevice(action->data().toString());
@ -629,14 +623,14 @@ void MainWindow::on_m_ListDevices_selectionChanged(const QString& device_node)
{
QMenu* devicesMenu = static_cast<QMenu*>(guiFactory()->container("selectedDevice", this));
foreach (QAction* entry, qFindChildren<QAction*>(devicesMenu))
foreach (QAction* entry, devicesMenu->findChildren<QAction*>())
entry->setChecked(entry->data().toString() == device_node);
}
void MainWindow::onRefreshDevices()
{
if (operationStack().size() == 0 || KMessageBox::warningContinueCancel(this,
i18nc("@info",
xi18nc("@info",
"<para>Do you really want to rescan the devices?</para>"
"<para><warning>This will also clear the list of pending operations.</warning></para>"),
i18nc("@title:window", "Really Rescan the Devices?"),
@ -655,7 +649,7 @@ void MainWindow::onApplyAllOperations()
opList.append(op->description());
if (KMessageBox::warningContinueCancelList(this,
i18nc("@info",
xi18nc("@info",
"<para>Do you really want to apply the pending operations listed below?</para>"
"<para><warning>This will permanently modify your disks.</warning></para>"),
opList, i18nc("@title:window", "Apply Pending Operations?"),
@ -739,15 +733,18 @@ void MainWindow::onImportPartitionTable()
{
Q_ASSERT(pmWidget().selectedDevice());
const KUrl url = KFileDialog::getOpenUrl(KUrl("kfiledialog://importPartitionTable"));
const QUrl url = QFileDialog::getOpenFileUrl(this, "kfiledialog://importPartitionTable");
if (url.isEmpty())
return;
QString fileName;
if (!KIO::NetAccess::download(url, fileName, this))
KIO::FileCopyJob *job = KIO::file_copy(url, fileName);
KJobWidgets::setWindow(job, this);
job->exec();
if ( job->error() )
{
KMessageBox::error(this, i18nc("@info", "Could not open input file <filename>%1</filename> for import: %2", url.fileName(), KIO::NetAccess::lastErrorString()), i18nc("@title:window", "Error Importing Partition Table"));
KMessageBox::error(this, xi18nc("@info", "Could not open input file <filename>%1</filename> for import: %2", url.fileName(), job->errorString()), i18nc("@title:window", "Error Importing Partition Table"));
return;
}
@ -755,7 +752,7 @@ void MainWindow::onImportPartitionTable()
if (!file.open(QFile::ReadOnly))
{
KMessageBox::error(this, i18nc("@info", "Could not open temporary file <filename>%1</filename> while trying to import from <filename>%2</filename>.", fileName, url.fileName()), i18nc("@title:window", "Error Importing Partition Table"));
KMessageBox::error(this, xi18nc("@info", "Could not open temporary file <filename>%1</filename> while trying to import from <filename>%2</filename>.", fileName, url.fileName()), i18nc("@title:window", "Error Importing Partition Table"));
return;
}
@ -781,7 +778,7 @@ void MainWindow::onImportPartitionTable()
if (!haveMagic && rxMagic.indexIn(line) == -1)
{
KMessageBox::error(this, i18nc("@info", "The import file <filename>%1</filename> does not contain a valid partition table.", fileName), i18nc("@title:window", "Error While Importing Partition Table"));
KMessageBox::error(this, xi18nc("@info", "The import file <filename>%1</filename> does not contain a valid partition table.", fileName), i18nc("@title:window", "Error While Importing Partition Table"));
return;
}
else
@ -909,16 +906,16 @@ void MainWindow::onExportPartitionTable()
Q_ASSERT(pmWidget().selectedDevice());
Q_ASSERT(pmWidget().selectedDevice()->partitionTable());
const KUrl url = KFileDialog::getSaveUrl(KUrl("kfiledialog://exportPartitionTable"));
const QUrl url = QFileDialog::getSaveFileUrl();
if (url.isEmpty())
return;
KTemporaryFile tempFile;
QTemporaryFile tempFile;
if (!tempFile.open())
{
KMessageBox::error(this, i18nc("@info", "Could not create temporary file when trying to save to <filename>%1</filename>.", url.fileName()), i18nc("@title:window", "Error Exporting Partition Table"));
KMessageBox::error(this, xi18nc("@info", "Could not create temporary file when trying to save to <filename>%1</filename>.", url.fileName()), i18nc("@title:window", "Error Exporting Partition Table"));
return;
}
@ -931,7 +928,8 @@ void MainWindow::onExportPartitionTable()
tempFile.close();
KIO::CopyJob* job = KIO::move(tempFile.fileName(), url, KIO::HideProgressInfo);
if (!KIO::NetAccess::synchronousRun(job, NULL))
job->exec();
if ( job->error() )
job->ui()->showErrorMessage();
}
@ -943,7 +941,7 @@ void MainWindow::onFileSystemSupport()
void MainWindow::onSettingsChanged()
{
if (CoreBackendManager::self()->backend()->about().appName() != Config::backend())
if (CoreBackendManager::self()->backend()->about().productName() != Config::backend())
{
CoreBackendManager::self()->unload();
// FIXME: if loadBackend() fails to load the configured backend and loads the default
@ -1042,7 +1040,7 @@ static QStringList checkSupportInNode(const PartitionNode* parent)
.arg(p->deviceNode())
.arg(p->fileSystem().name())
.arg(p->fileSystem().supportToolName().name)
.arg(p->fileSystem().supportToolName().url.prettyUrl());
.arg(p->fileSystem().supportToolName().url.toString());
}
return rval;
@ -1059,7 +1057,7 @@ void MainWindow::checkFileSystemSupport()
if (!supportList.isEmpty())
KMessageBox::information(this,
i18nc("@info",
xi18nc("@info",
"<para>No support tools were found for file systems currently present on hard disks in this computer:</para>"
"<table style='margin-top:12px'>"
"<tr>"

View File

@ -29,7 +29,7 @@
#include "ui_mainwindowbase.h"
#include <kxmlguiwindow.h>
#include <KXmlGui/KXmlGuiWindow>
class ApplyProgressDialog;
class ScanProgressDialog;
@ -37,6 +37,8 @@ class Device;
class Partition;
class InfoPane;
class KActionCollection;
class QWidget;
class QLabel;
class QCloseEvent;

View File

@ -30,9 +30,9 @@
#include "util/capacity.h"
#include "util/helpers.h"
#include <QFontDatabase>
#include <QtAlgorithms>
#include <kglobalsettings.h>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KSharedConfig>
@ -181,7 +181,7 @@ void NewDialog::updateHideAndShow()
{
dialogWidget().label().setReadOnly(true);
dialogWidget().noSetLabel().setVisible(true);
dialogWidget().noSetLabel().setFont(KGlobalSettings::smallestReadableFont());
dialogWidget().noSetLabel().setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
QPalette palette = dialogWidget().noSetLabel().palette();
QColor f = palette.color(QPalette::Foreground);

View File

@ -49,17 +49,16 @@
#include "util/report.h"
#include "util/helpers.h"
#include <KLocalizedString>
#include <kmenu.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <kglobal.h>
#include <QCursor>
#include <QFileDialog>
#include <QLocale>
#include <QPointer>
#include <QReadLocker>
#include <KIconThemes/KIconLoader>
#include <KLocalizedString>
#include <KMessageBox>
#include <config.h>
class PartitionTreeWidgetItem : public QTreeWidgetItem
@ -216,7 +215,7 @@ static QTreeWidgetItem* createTreeWidgetItem(const Partition& p)
item->setText(i, p.mountPoint());
if (p.isMounted())
item->setIcon(i, SmallIcon("object-locked"));
item->setIcon(i, QIcon(KIconLoader().loadIcon(QLatin1String("object-locked"), KIconLoader::Small)));
i++;
item->setText(i++, p.fileSystem().label());
@ -254,7 +253,7 @@ void PartitionManagerWidget::updatePartitions()
deviceItem->setFont(0, font);
deviceItem->setText(0, selectedDevice()->prettyName());
deviceItem->setIcon(0, DesktopIcon(selectedDevice()->iconName()));
deviceItem->setIcon(0, QIcon(KIconLoader().loadIcon(selectedDevice()->iconName(), KIconLoader::Desktop)));
deviceItem->setSizeHint(0, QSize(0, 32));
treePartitions().addTopLevelItem(deviceItem);
@ -404,12 +403,12 @@ void PartitionManagerWidget::onMountPartition()
if (p->canMount())
{
if (!p->mount(report))
KMessageBox::detailedSorry(this, i18nc("@info", "The file system on partition <filename>%1</filename> could not be mounted.", p->deviceNode()), QString("<pre>%1</pre>").arg(report.toText()), i18nc("@title:window", "Could Not Mount File System."));
KMessageBox::detailedSorry(this, xi18nc("@info", "The file system on partition <filename>%1</filename> could not be mounted.", p->deviceNode()), QString("<pre>%1</pre>").arg(report.toText()), i18nc("@title:window", "Could Not Mount File System."));
}
else if (p->canUnmount())
{
if (!p->unmount(report))
KMessageBox::detailedSorry(this, i18nc("@info", "The file system on partition <filename>%1</filename> could not be unmounted.", p->deviceNode()), QString("<pre>%1</pre>").arg(report.toText()), i18nc("@title:window", "Could Not Unmount File System."));
KMessageBox::detailedSorry(this, xi18nc("@info", "The file system on partition <filename>%1</filename> could not be unmounted.", p->deviceNode()), QString("<pre>%1</pre>").arg(report.toText()), i18nc("@title:window", "Could Not Unmount File System."));
}
if (p->roles().has(PartitionRole::Logical))
@ -450,7 +449,7 @@ static bool checkTooManyPartitions(QWidget* parent, const Device& d, const Parti
if (p.roles().has(PartitionRole::Unallocated) && d.partitionTable()->numPrimaries() >= d.partitionTable()->maxPrimaries() && !p.roles().has(PartitionRole::Logical))
{
KMessageBox::sorry(parent, i18ncp("@info",
KMessageBox::sorry(parent, xi18ncp("@info",
"<para>There is already one primary partition on this device. This is the maximum number its partition table type can handle.</para>"
"<para>You cannot create, paste or restore a primary partition on it before you delete an existing one.</para>",
"<para>There are already %1 primary partitions on this device. This is the maximum number its partition table type can handle.</para>"
@ -519,7 +518,7 @@ void PartitionManagerWidget::onDeletePartition(bool shred)
if (selectedPartition()->number() > 0 && selectedPartition()->parent()->highestMountedChild() > selectedPartition()->number())
{
KMessageBox::sorry(this,
i18nc("@info",
xi18nc("@info",
"<para>The partition <filename>%1</filename> cannot currently be deleted because one or more partitions with higher logical numbers are still mounted.</para>"
"<para>Please unmount all partitions with higher logical numbers than %2 first.</para>",
selectedPartition()->deviceNode(), selectedPartition()->number()),
@ -582,7 +581,7 @@ void PartitionManagerWidget::onResizePartition()
if (dlg->exec() == QDialog::Accepted)
{
if (dlg->resizedFirstSector() == p.firstSector() && dlg->resizedLastSector() == p.lastSector())
Log(Log::information) << i18nc("@info/plain", "Partition <filename>%1</filename> has the same position and size after resize/move. Ignoring operation.", p.deviceNode());
Log(Log::information) << xi18nc("@info/plain", "Partition <filename>%1</filename> has the same position and size after resize/move. Ignoring operation.", p.deviceNode());
else
operationStack().push(new ResizeOperation(*selectedDevice(), p, dlg->resizedFirstSector(), dlg->resizedLastSector()));
}
@ -612,7 +611,7 @@ void PartitionManagerWidget::onCopyPartition()
}
setClipboardPartition(selectedPartition());
Log() << i18nc("@info/plain", "Partition <filename>%1</filename> has been copied to the clipboard.", selectedPartition()->deviceNode());
Log() << xi18nc("@info/plain", "Partition <filename>%1</filename> has been copied to the clipboard.", selectedPartition()->deviceNode());
}
void PartitionManagerWidget::onPastePartition()
@ -681,7 +680,7 @@ bool PartitionManagerWidget::showInsertDialog(Partition& insertedPartition, qint
return false;
}
else if (KMessageBox::warningContinueCancel(this,
i18nc("@info", "<para><warning>You are about to lose all data on partition "
xi18nc("@info", "<para><warning>You are about to lose all data on partition "
"<filename>%1</filename>.</warning></para>"
"<para>Overwriting one partition with another (or with an image file) will "
"destroy all data on this target partition.</para>"
@ -698,11 +697,11 @@ bool PartitionManagerWidget::showInsertDialog(Partition& insertedPartition, qint
if (insertedPartition.length() < sourceLength)
{
if (overwrite)
KMessageBox::error(this, i18nc("@info",
KMessageBox::error(this, xi18nc("@info",
"<para>The selected partition is not large enough to hold the source partition or the backup file.</para>"
"<para>Pick another target or resize this partition so it is as large as the source.</para>"), i18nc("@title:window", "Target Not Large Enough"));
else
KMessageBox::sorry(this, i18nc("@info",
KMessageBox::sorry(this, xi18nc("@info",
"<para>It is not possible to create the target partition large enough to hold the source.</para>"
"<para>This may happen if not all partitions on a device are correctly aligned "
"or when copying a primary partition into an extended partition.</para>"),
@ -738,13 +737,13 @@ void PartitionManagerWidget::onBackupPartition()
return;
}
QString fileName = KFileDialog::getSaveFileName(KUrl("kfiledialog://backupPartition"));
QString fileName = QFileDialog::getSaveFileName(this, "kfiledialog://backupPartition");
// QString fileName = "/tmp/backuptest.img";
if (fileName.isEmpty())
return;
if (!QFile::exists(fileName) || KMessageBox::warningContinueCancel(this, i18nc("@info", "Do you want to overwrite the existing file <filename>%1</filename>?", fileName), i18nc("@title:window", "Overwrite Existing File?"), KGuiItem(i18nc("@action:button", "Overwrite File"), "arrow-right"), KStandardGuiItem::cancel()) == KMessageBox::Continue)
if (!QFile::exists(fileName) || KMessageBox::warningContinueCancel(this, xi18nc("@info", "Do you want to overwrite the existing file <filename>%1</filename>?", fileName), i18nc("@title:window", "Overwrite Existing File?"), KGuiItem(i18nc("@action:button", "Overwrite File"), "arrow-right"), KStandardGuiItem::cancel()) == KMessageBox::Continue)
operationStack().push(new BackupOperation(*selectedDevice(), *selectedPartition(), fileName));
}
@ -762,7 +761,7 @@ void PartitionManagerWidget::onRestorePartition()
if (checkTooManyPartitions(this, *selectedDevice(), *selectedPartition()))
return;
QString fileName = KFileDialog::getOpenFileName(KUrl("kfiledialog://backupPartition"));
QString fileName = QFileDialog::getOpenFileName(this, "kfiledialog://restorePartition");
// QString fileName = "/tmp/backuptest.img";
if (!fileName.isEmpty() && QFile::exists(fileName))
@ -771,7 +770,7 @@ void PartitionManagerWidget::onRestorePartition()
if (restorePartition->length() > selectedPartition()->length())
{
KMessageBox::error(this, i18nc("@info", "The file system in the image file <filename>%1</filename> is too large to be restored to the selected partition.", fileName), i18nc("@title:window", "Not Enough Space to Restore File System."));
KMessageBox::error(this, xi18nc("@info", "The file system in the image file <filename>%1</filename> is too large to be restored to the selected partition.", fileName), i18nc("@title:window", "Not Enough Space to Restore File System."));
delete restorePartition;
return;
}

View File

@ -29,17 +29,16 @@
#include "util/helpers.h"
#include <QComboBox>
#include <QDialogButtonBox>
#include <QFontDatabase>
#include <QLineEdit>
#include <QLocale>
#include <QPushButton>
#include <QtAlgorithms>
#include <kmessagebox.h>
#include <KConfigGroup>
#include <KSharedConfig>
#include <KLocalizedString>
#include <kpushbutton.h>
#include <klineedit.h>
#include <KMessageBox>
#include <KSharedConfig>
/** Creates a new PartPropsDialog
@param parent pointer to the parent widget
@ -59,7 +58,7 @@ PartPropsDialog::PartPropsDialog(QWidget* parent, Device& d, Partition& p) :
setLayout(mainLayout);
mainLayout->addWidget(&dialogWidget());
setWindowTitle(i18nc("@title:window", "Partition properties: <filename>%1</filename>", partition().deviceNode()));
setWindowTitle(xi18nc("@title:window", "Partition properties: <filename>%1</filename>", partition().deviceNode()));
setupDialog();
setupConnections();
@ -126,7 +125,7 @@ void PartPropsDialog::setupDialog()
if (partition().roles().has(PartitionRole::Extended))
statusText = i18nc("@label partition state", "At least one logical partition is mounted.");
else if (!partition().mountPoint().isEmpty())
statusText = i18nc("@label partition state", "mounted on <filename>%1</filename>", mp);
statusText = xi18nc("@label partition state", "mounted on <filename>%1</filename>", mp);
else
statusText = i18nc("@label partition state", "mounted");
}
@ -200,7 +199,7 @@ void PartPropsDialog::updateHideAndShow()
{
dialogWidget().label().setReadOnly(true);
dialogWidget().noSetLabel().setVisible(true);
dialogWidget().noSetLabel().setFont(KGlobalSettings::smallestReadableFont());
dialogWidget().noSetLabel().setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
QPalette palette = dialogWidget().noSetLabel().palette();
QColor f = palette.color(QPalette::Foreground);
@ -339,9 +338,9 @@ void PartPropsDialog::updatePartitionFileSystem()
void PartPropsDialog::onFilesystemChanged(int)
{
if (partition().state() == Partition::StateNew || warnFileSystemChange() || KMessageBox::warningContinueCancel(this,
i18nc("@info", "<para><warning>You are about to lose all data on partition <filename>%1</filename>.</warning></para>"
xi18nc("@info", "<para><warning>You are about to lose all data on partition <filename>%1</filename>.<warning></para>"
"<para>Changing the file system on a partition already on disk will erase all its contents. If you continue now and apply the resulting operation in the main window, all data on <filename>%1</filename> will unrecoverably be lost.</para>", partition().deviceNode()),
i18nc("@title:window", "Really Recreate <filename>%1</filename> with File System %2?", partition().deviceNode(), dialogWidget().fileSystem().currentText()),
xi18nc("@title:window", "Really Recreate <filename>%1</filename> with File System %2?", partition().deviceNode(), dialogWidget().fileSystem().currentText()),
KGuiItem(i18nc("@action:button", "Change the File System"), "arrow-right"),
KGuiItem(i18nc("@action:button", "Do Not Change the File System"), "dialog-cancel"), "reallyChangeFileSystem") == KMessageBox::Continue)
{
@ -364,9 +363,9 @@ void PartPropsDialog::onFilesystemChanged(int)
void PartPropsDialog::onRecreate(int state)
{
if (state == Qt::Checked && (warnFileSystemChange() || KMessageBox::warningContinueCancel(this,
i18nc("@info", "<para><warning>You are about to lose all data on partition <filename>%1</filename>.</warning></para>"
"<para>Recreating a file system will erase all its contents. If you continue now and apply the resulting operation in the main window, all data on <filename>%1</filename> will unrecoverably be lost.</para>", partition().deviceNode()),
i18nc("@title:window", "Really Recreate File System on <filename>%1</filename>?", partition().deviceNode()),
xi18nc("@info", "<para><warning>You are about to lose all data on partition <filename>%1</filename>.</warning></para>"
"<para>Recreating a file system will erase all its contents. If you continue now and apply the resulting operation in the main window, all data on <filesystem>%1</filesyste> will unrecoverably be lost.</p>", partition().deviceNode()),
xi18nc("@title:window", "Really Recreate File System on <filename>%1</filename>?", partition().deviceNode()),
KGuiItem(i18nc("@action:button", "Recreate the File System"), "arrow-right"),
KGuiItem(i18nc("@action:button", "Do Not Recreate the File System"), "dialog-cancel"), "reallyRecreateFileSystem") == KMessageBox::Continue))
{

View File

@ -28,9 +28,7 @@
#include <QPainter>
#include <QStyleOptionButton>
#include <QApplication>
#include <QPlastiqueStyle>
#include <kglobalsettings.h>
#include <QFontDatabase>
#include <config.h>
@ -43,19 +41,20 @@ PartWidget::PartWidget(QWidget* parent, const Partition* p) :
m_Partition(NULL),
m_Active(false)
{
setFont(KGlobalSettings::smallestReadableFont());
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
// Check if user is running a GTK style; in that case, use plastique as a fallback
// style for the PartWidget to work around GTK styles not showing the FS colors
// correctly.
// Inspired by Aurélien Gâteau's similar workaround in Gwenview (230aebbd)
if (qstrcmp(QApplication::style()->metaObject()->className(), "QGtkStyle") == 0)
//FIXME: port KF5. Is this still necessary?
/*if (qstrcmp(QApplication::style()->metaObject()->className(), "QGtkStyle") == 0)
{
QStyle* style = new QPlastiqueStyle();
style->setParent(this);
setStyle(style);
}
}*/
init(p);
}

View File

@ -47,7 +47,7 @@ ResizeDialog::ResizeDialog(QWidget* parent, Device& d, Partition& p, qint64 minF
m_ResizedFirstSector(p.firstSector()),
m_ResizedLastSector(p.lastSector())
{
setWindowTitle(i18nc("@title:window", "Resize/move partition: <filename>%1</filename>", partition().deviceNode()));
setWindowTitle(xi18nc("@title:window", "Resize/move partition: <filename>%1</filename>", partition().deviceNode()));
dialogWidget().hideRole();
dialogWidget().hideFileSystem();

View File

@ -35,7 +35,7 @@ void ScanProgressDialog::setDeviceName(const QString& d)
if (d.isEmpty())
setLabelText(i18nc("@label", "Scanning..."));
else
setLabelText(i18nc("@label", "Scanning device: <filename>%1</filename>", d));
setLabelText(xi18nc("@label", "Scanning device: <filename>%1</filename>", d));
}
void ScanProgressDialog::showEvent(QShowEvent* e)

View File

@ -27,28 +27,24 @@
#include "util/helpers.h"
#include "util/htmlreport.h"
#include <kpushbutton.h>
#include <kiconloader.h>
#include <KLocalizedString>
#include <KConfigGroup>
#include <KSharedConfig>
#include <kfiledialog.h>
#include <kio/copyjob.h>
#include <kio/netaccess.h>
#include <kio/jobuidelegate.h>
#include <kmessagebox.h>
#include <ktemporaryfile.h>
#include <kicon.h>
#include <kglobalsettings.h>
#include <kglobal.h>
#include <QDialogButtonBox>
#include <QFileDialog>
#include <QFontDatabase>
#include <QPushButton>
#include <QTreeWidgetItem>
#include <QTextStream>
#include <QTemporaryFile>
#include <QTextDocument>
#include <QTextStream>
#include <QTreeWidgetItem>
#include <qglobal.h>
#include <KConfigGroup>
#include <KFormat>
#include <KLocalizedString>
#include <KIconThemes/KIconLoader>
#include <KIO/CopyJob>
#include <KJobUiDelegate>
#include <KMessageBox>
#include <sys/utsname.h>
#include <unistd.h>
@ -66,7 +62,7 @@ SmartDialog::SmartDialog(QWidget* parent, Device& d) :
QVBoxLayout *mainLayout = new QVBoxLayout(this);
setLayout(mainLayout);
mainLayout->addWidget(&dialogWidget());
setWindowTitle(i18nc("@title:window", "SMART Properties: <filename>%1</filename>", device().deviceNode()));
setWindowTitle(xi18nc("@title:window", "SMART Properties: <filename>%1</filename>", device().deviceNode()));
buttonBox = new QDialogButtonBox(this);
buttonBox->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Close);
@ -100,7 +96,7 @@ void SmartDialog::setupDialog()
else
{
dialogWidget().statusText().setText(i18nc("@label SMART disk status", "BAD"));
dialogWidget().statusIcon().setPixmap(SmallIcon("dialog-warning"));
dialogWidget().statusIcon().setPixmap(KIconLoader().loadIcon(QLatin1String("dialog-warning"), KIconLoader::Small));
}
dialogWidget().modelName().setText(device().smartStatus().modelName());
@ -112,14 +108,14 @@ void SmartDialog::setupDialog()
? QLocale().toString(device().smartStatus().badSectors())
: i18nc("@label SMART number of bad sectors", "none");
dialogWidget().badSectors().setText(badSectors);
dialogWidget().poweredOn().setText(KGlobal::locale()->formatDuration(device().smartStatus().poweredOn()));
dialogWidget().poweredOn().setText(KFormat().formatDuration(device().smartStatus().poweredOn()));
dialogWidget().powerCycles().setText(QLocale().toString(device().smartStatus().powerCycles()));
dialogWidget().overallAssessment().setText(SmartStatus::overallAssessmentToString(device().smartStatus().overall()));
dialogWidget().selfTests().setText(SmartStatus::selfTestStatusToString(device().smartStatus().selfTestStatus()));
dialogWidget().treeSmartAttributes().clear();
const QFont f = KGlobalSettings::smallestReadableFont();
const QFont f = QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont);
const QString size = f.pixelSize() != -1 ? QString("%1px").arg(f.pixelSize()) : QString("%1pt").arg(f.pointSize());
const QString st = QString("<span style=\"font-family:%1;font-size:%2;\">").arg(f.family()).arg(size);
@ -175,7 +171,7 @@ QString SmartDialog::toHtml() const
<< HtmlReport::tableLine(i18n("Firmware revision:"), device().smartStatus().firmware())
<< HtmlReport::tableLine(i18n("Temperature:"), SmartStatus::tempToString(device().smartStatus().temp()))
<< HtmlReport::tableLine(i18n("Bad sectors:"), badSectors)
<< HtmlReport::tableLine(i18n("Powered on for:"), KGlobal::locale()->formatDuration(device().smartStatus().poweredOn()))
<< HtmlReport::tableLine(i18n("Powered on for:"), KFormat().formatDuration(device().smartStatus().poweredOn()))
<< HtmlReport::tableLine(i18n("Power cycles:"), QLocale().toString(device().smartStatus().powerCycles()))
<< HtmlReport::tableLine(i18n("Self tests:"), SmartStatus::selfTestStatusToString(device().smartStatus().selfTestStatus()))
<< HtmlReport::tableLine(i18n("Overall assessment:"), SmartStatus::overallAssessmentToString(device().smartStatus().overall()));
@ -185,7 +181,7 @@ QString SmartDialog::toHtml() const
if (device().smartStatus().isValid())
{
const QFont f = KGlobalSettings::smallestReadableFont();
const QFont f = QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont);
const QString size = f.pixelSize() != -1 ? QString("%1px").arg(f.pixelSize()) : QString("%1pt").arg(f.pointSize());
const QString st = QString("<span style=\"font-family:%1;font-size:%2;\">").arg(f.family()).arg(size);
@ -222,12 +218,12 @@ QString SmartDialog::toHtml() const
void SmartDialog::saveSmartReport()
{
const KUrl url = KFileDialog::getSaveUrl(KUrl("kfiledialog://saveSMARTReport"));
const QUrl url = QFileDialog::getSaveFileUrl();
if (url.isEmpty())
return;
KTemporaryFile tempFile;
QTemporaryFile tempFile;
if (tempFile.open())
{
@ -241,11 +237,12 @@ void SmartDialog::saveSmartReport()
tempFile.close();
KIO::CopyJob* job = KIO::move(tempFile.fileName(), url, KIO::HideProgressInfo);
if (!KIO::NetAccess::synchronousRun(job, NULL))
KIO::CopyJob* job = KIO::move(QUrl::fromLocalFile(tempFile.fileName()), url, KIO::HideProgressInfo);
job->exec();
if ( job->error() )
job->ui()->showErrorMessage();
}
else
KMessageBox::sorry(this, i18nc("@info", "Could not create temporary file when trying to save to <filename>%1</filename>.", url.fileName()), i18nc("@title:window", "Could Not Save SMART Report."));
KMessageBox::sorry(this, xi18nc("@info", "Could not create temporary file when trying to save to <filename>%1</filename>.", url.fileName()), i18nc("@title:window", "Could Not Save SMART Report."));
}

View File

@ -24,23 +24,21 @@
#include "util/globallog.h"
#include "util/helpers.h"
#include <kactioncollection.h>
#include <kiconloader.h>
#include <kfiledialog.h>
#include <KLocalizedString>
#include <kmessagebox.h>
#include <kstandardguiitem.h>
#include <kio/netaccess.h>
#include <kio/jobuidelegate.h>
#include <kio/copyjob.h>
#include <ktemporaryfile.h>
#include <QDateTime>
#include <QDebug>
#include <QFile>
#include <QFileDialog>
#include <QMenu>
#include <QTemporaryFile>
#include <QTextStream>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QDateTime>
#include <QTextStream>
#include <KIconThemes/KIconLoader>
#include <KIO/CopyJob>
#include <KJobUiDelegate>
#include <KLocalizedString>
#include <KMessageBox>
#include <config.h>
@ -121,15 +119,15 @@ void TreeLog::onClearLog()
void TreeLog::onSaveLog()
{
const KUrl url = KFileDialog::getSaveUrl(KUrl("kfiledialog://saveLog"));
const QUrl url = QFileDialog::getSaveFileUrl();
if (!url.isEmpty())
{
KTemporaryFile tempFile;
QTemporaryFile tempFile;
if (!tempFile.open())
{
KMessageBox::error(this, i18nc("@info", "Could not create temporary output file to save <filename>%1</filename>.", url.fileName()), i18nc("@title:window", "Error Saving Log File"));
KMessageBox::error(this, xi18nc("@info", "Could not create temporary output file to save <filename>%1</filename>.", url.fileName()), i18nc("@title:window", "Error Saving Log File"));
return;
}
@ -144,7 +142,8 @@ void TreeLog::onSaveLog()
tempFile.close();
KIO::CopyJob* job = KIO::move(tempFile.fileName(), url, KIO::HideProgressInfo);
if (!KIO::NetAccess::synchronousRun(job, NULL))
job->exec();
if ( job->error() )
job->ui()->showErrorMessage();
}
}
@ -170,7 +169,7 @@ void TreeLog::onNewLogMessage(Log::Level logLevel, const QString& s)
{
QTreeWidgetItem* item = new QTreeWidgetItem();
item->setIcon(0, SmallIcon(icons[logLevel]));
item->setIcon(0, QIcon(KIconLoader().loadIcon(icons[logLevel], KIconLoader::Small)));
item->setText(1, QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
item->setText(2, s);

View File

@ -51,9 +51,9 @@ qint32 BackupFileSystemJob::numSteps() const
bool BackupFileSystemJob::run(Report& parent)
{
bool rval = false;
Report* report = jobStarted(parent);
if (sourcePartition().fileSystem().supportBackup() == FileSystem::cmdSupportFileSystem)
rval = sourcePartition().fileSystem().backup(*report, sourceDevice(), sourcePartition().deviceNode(), fileName());
else if (sourcePartition().fileSystem().supportBackup() == FileSystem::cmdSupportCore)
@ -62,13 +62,13 @@ bool BackupFileSystemJob::run(Report& parent)
CopyTargetFile copyTarget(fileName(), sourceDevice().logicalSectorSize());
if (!copySource.open())
report->line() << i18nc("@info/plain", "Could not open file system on source partition <filename>%1</filename> for backup.", sourcePartition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open file system on source partition <filename>%1</filename> for backup.", sourcePartition().deviceNode());
else if (!copyTarget.open())
report->line() << i18nc("@info/plain", "Could not create backup file <filename>%1</filename>.", fileName());
report->line() << xi18nc("@info/plain", "Could not create backup file <filename>%1</filename>.", fileName());
else
rval = copyBlocks(*report, copyTarget, copySource);
}
jobFinished(*report, rval);
return rval;
@ -76,5 +76,5 @@ bool BackupFileSystemJob::run(Report& parent)
QString BackupFileSystemJob::description() const
{
return i18nc("@info/plain", "Back up file system on partition <filename>%1</filename> to <filename>%2</filename>", sourcePartition().deviceNode(), fileName());
return xi18nc("@info/plain", "Back up file system on partition <filename>%1</filename> to <filename>%2</filename>", sourcePartition().deviceNode(), fileName());
}

View File

@ -53,5 +53,5 @@ bool CheckFileSystemJob::run(Report& parent)
QString CheckFileSystemJob::description() const
{
return i18nc("@info/plain", "Check file system on partition <filename>%1</filename>", partition().deviceNode());
return xi18nc("@info/plain", "Check file system on partition <filename>%1</filename>", partition().deviceNode());
}

View File

@ -57,7 +57,7 @@ bool CopyFileSystemJob::run(Report& parent)
Report* report = jobStarted(parent);
if (targetPartition().fileSystem().length() < sourcePartition().fileSystem().length())
report->line() << i18nc("@info/plain", "Cannot copy file system: File system on target partition <filename>%1</filename> is smaller than the file system on source partition <filename>%2</filename>.", targetPartition().deviceNode(), sourcePartition().deviceNode());
report->line() << xi18nc("@info/plain", "Cannot copy file system: File system on target partition <filename>%1</filename> is smaller than the file system on source partition <filename>%2</filename>.", targetPartition().deviceNode(), sourcePartition().deviceNode());
else if (sourcePartition().fileSystem().supportCopy() == FileSystem::cmdSupportFileSystem)
rval = sourcePartition().fileSystem().copy(*report, targetPartition().deviceNode(), sourcePartition().deviceNode());
else if (sourcePartition().fileSystem().supportCopy() == FileSystem::cmdSupportCore)
@ -66,9 +66,9 @@ bool CopyFileSystemJob::run(Report& parent)
CopyTargetDevice copyTarget(targetDevice(), targetPartition().fileSystem().firstSector(), targetPartition().fileSystem().lastSector());
if (!copySource.open())
report->line() << i18nc("@info/plain", "Could not open file system on source partition <filename>%1</filename> for copying.", sourcePartition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open file system on source partition <filename>%1</filename> for copying.", sourcePartition().deviceNode());
else if (!copyTarget.open())
report->line() << i18nc("@info/plain", "Could not open file system on target partition <filename>%1</filename> for copying.", targetPartition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open file system on target partition <filename>%1</filename> for copying.", targetPartition().deviceNode());
else
{
rval = copyBlocks(*report, copyTarget, copySource);
@ -101,5 +101,5 @@ bool CopyFileSystemJob::run(Report& parent)
QString CopyFileSystemJob::description() const
{
return i18nc("@info/plain", "Copy file system on partition <filename>%1</filename> to partition <filename>%2</filename>", sourcePartition().deviceNode(), targetPartition().deviceNode());
return xi18nc("@info/plain", "Copy file system on partition <filename>%1</filename> to partition <filename>%2</filename>", sourcePartition().deviceNode(), targetPartition().deviceNode());
}

View File

@ -67,17 +67,17 @@ bool CreateFileSystemJob::run(Report& parent)
backendPartitionTable->commit();
}
else
report->line() << i18nc("@info/plain", "Failed to set the system type for the file system on partition <filename>%1</filename>.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "Failed to set the system type for the file system on partition <filename>%1</filename>.", partition().deviceNode());
delete backendPartitionTable;
}
else
report->line() << i18nc("@info/plain", "Could not open partition table on device <filename>%1</filename> to set the system type for partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open partition table on device <filename>%1</filename> to set the system type for partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
delete backendDevice;
}
else
report->line() << i18nc("@info/plain", "Could not open device <filename>%1</filename> to set the system type for partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open device <filename>%1</filename> to set the system type for partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
}
}
@ -88,5 +88,5 @@ bool CreateFileSystemJob::run(Report& parent)
QString CreateFileSystemJob::description() const
{
return i18nc("@info/plain", "Create file system <filename>%1</filename> on partition <filename>%2</filename>", partition().fileSystem().name(), partition().deviceNode());
return xi18nc("@info/plain", "Create file system <filename>%1</filename> on partition <filename>%2</filename>", partition().fileSystem().name(), partition().deviceNode());
}

View File

@ -68,17 +68,17 @@ bool CreatePartitionJob::run(Report& parent)
backendPartitionTable->commit();
}
else
report->line() << i18nc("@info/plain", "Failed to add partition <filename>%1</filename> to device <filename>%2</filename>.", partition().deviceNode(), device().deviceNode());
report->line() << xi18nc("@info/plain", "Failed to add partition <filename>%1</filename> to device <filename>%2</filename>.", partition().deviceNode(), device().deviceNode());
delete backendPartitionTable;
}
else
report->line() << i18nc("@info/plain", "Could not open partition table on device <filename>%1</filename> to create new partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open partition table on device <filename>%1</filename> to create new partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
delete backendDevice;
}
else
report->line() << i18nc("@info/plain", "Could not open device <filename>%1</filename> to create new partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open device <filename>%1</filename> to create new partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
jobFinished(*report, rval);
@ -88,7 +88,7 @@ bool CreatePartitionJob::run(Report& parent)
QString CreatePartitionJob::description() const
{
if (partition().number() > 0)
return i18nc("@info/plain", "Create new partition <filename>%1</filename>", partition().deviceNode());
return xi18nc("@info/plain", "Create new partition <filename>%1</filename>", partition().deviceNode());
return i18nc("@info/plain", "Create new partition on device <filename>%1</filename>", device().deviceNode());
return xi18nc("@info/plain", "Create new partition on device <filename>%1</filename>", device().deviceNode());
}

View File

@ -56,7 +56,7 @@ bool CreatePartitionTableJob::run(Report& parent)
delete backendDevice;
}
else
report->line() << i18nc("@info/plain", "Creating partition table failed: Could not open device <filename>%1</filename>.", device().deviceNode());
report->line() << xi18nc("@info/plain", "Creating partition table failed: Could not open device <filename>%1</filename>.", device().deviceNode());
jobFinished(*report, rval);
@ -65,5 +65,5 @@ bool CreatePartitionTableJob::run(Report& parent)
QString CreatePartitionTableJob::description() const
{
return i18nc("@info/plain", "Create new partition table on device <filename>%1</filename>", device().deviceNode());
return xi18nc("@info/plain", "Create new partition table on device <filename>%1</filename>", device().deviceNode());
}

View File

@ -79,7 +79,7 @@ bool DeleteFileSystemJob::run(Report& parent)
rval = backendPartitionTable->clobberFileSystem(*report, partition());
if (!rval)
report->line() << i18nc("@info/plain", "Could not delete file system on <filename>%1</filename>.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not delete file system on <filename>%1</filename>.", partition().deviceNode());
else
backendPartitionTable->commit();
@ -87,12 +87,12 @@ bool DeleteFileSystemJob::run(Report& parent)
}
else
report->line() << i18nc("@info/plain", "Could not open partition table on device <filename>%1</filename> to delete file system on <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open partition table on device <filename>%1</filename> to delete file system on <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
delete backendDevice;
}
else
report->line() << i18nc("@info/plain", "Could not delete file system signature for partition <filename>%1</filename>: Failed to open device <filename>%2</filename>.", partition().deviceNode(), device().deviceNode());
report->line() << xi18nc("@info/plain", "Could not delete file system signature for partition <filename>%1</filename>: Failed to open device <filename>%2</filename>.", partition().deviceNode(), device().deviceNode());
}
jobFinished(*report, rval);
@ -102,5 +102,5 @@ bool DeleteFileSystemJob::run(Report& parent)
QString DeleteFileSystemJob::description() const
{
return i18nc("@info/plain", "Delete file system on <filename>%1</filename>", partition().deviceNode());
return xi18nc("@info/plain", "Delete file system on <filename>%1</filename>", partition().deviceNode());
}

View File

@ -69,7 +69,7 @@ bool DeletePartitionJob::run(Report& parent)
rval = backendPartitionTable->deletePartition(*report, partition());
if (!rval)
report->line() << i18nc("@info/plain", "Could not delete partition <filename>%1</filename>.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not delete partition <filename>%1</filename>.", partition().deviceNode());
else
backendPartitionTable->commit();
@ -77,12 +77,12 @@ bool DeletePartitionJob::run(Report& parent)
}
else
report->line() << i18nc("@info/plain", "Could not open partition table on device <filename>%1</filename> to delete partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open partition table on device <filename>%1</filename> to delete partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
delete backendDevice;
}
else
report->line() << i18nc("@info/plain", "Deleting partition failed: Could not open device <filename>%1</filename>.", device().deviceNode());
report->line() << xi18nc("@info/plain", "Deleting partition failed: Could not open device <filename>%1</filename>.", device().deviceNode());
jobFinished(*report, rval);
@ -91,5 +91,5 @@ bool DeletePartitionJob::run(Report& parent)
QString DeletePartitionJob::description() const
{
return i18nc("@info/plain", "Delete the partition <filename>%1</filename>", partition().deviceNode());
return xi18nc("@info/plain", "Delete the partition <filename>%1</filename>", partition().deviceNode());
}

View File

@ -31,7 +31,7 @@
#include <QIcon>
#include <QTime>
#include <kiconloader.h>
#include <KIconThemes/KIconLoader>
#include <KLocalizedString>
Job::Job() :
@ -162,14 +162,14 @@ bool Job::rollbackCopyBlocks(Report& report, CopyTarget& origTarget, CopySource&
CopySourceDevice undoSource(ctd.device(), undoSourceFirstSector, undoSourceLastSector);
if (!undoSource.open())
{
report.line() << i18nc("@info/plain", "Could not open device <filename>%1</filename> to rollback copying.", ctd.device().deviceNode());
report.line() << xi18nc("@info/plain", "Could not open device <filename>%1</filename> to rollback copying.", ctd.device().deviceNode());
return false;
}
CopyTargetDevice undoTarget(csd.device(), undoTargetFirstSector, undoTargetLastSector);
if (!undoTarget.open())
{
report.line() << i18nc("@info/plain", "Could not open device <filename>%1</filename> to rollback copying.", csd.device().deviceNode());
report.line() << xi18nc("@info/plain", "Could not open device <filename>%1</filename> to rollback copying.", csd.device().deviceNode());
return false;
}
@ -192,7 +192,7 @@ Report* Job::jobStarted(Report& parent)
{
emit started();
return parent.newChild(i18nc("@info/plain", "Job: %1", description()));
return parent.newChild(i18nc("@info/plain", "Job: %1", description()));
}
void Job::jobFinished(Report& report, bool b)
@ -219,7 +219,7 @@ QIcon Job::statusIcon() const
if (status() < 0 || static_cast<quint32>(status()) >= sizeof(icons) / sizeof(icons[0]))
return QIcon();
return SmallIcon(icons[status()]);
return QIcon(KIconLoader().loadIcon(icons[status()], KIconLoader::Small));
}
/** @return the Job's current status text */

View File

@ -60,9 +60,9 @@ bool MoveFileSystemJob::run(Report& parent)
CopyTargetDevice moveTarget(device(), newStart(), newStart() + partition().fileSystem().length());
if (!moveSource.open())
report->line() << i18nc("@info/plain", "Could not open file system on partition <filename>%1</filename> for moving.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open file system on partition <filename>%1</filename> for moving.", partition().deviceNode());
else if (!moveTarget.open())
report->line() << i18nc("@info/plain", "Could not create target for moving file system on partition <filename>%1</filename>.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not create target for moving file system on partition <filename>%1</filename>.", partition().deviceNode());
else
{
rval = copyBlocks(*report, moveTarget, moveSource);
@ -74,7 +74,7 @@ bool MoveFileSystemJob::run(Report& parent)
partition().fileSystem().setLastSector(newStart() + savedLength);
}
else if (!rollbackCopyBlocks(*report, moveTarget, moveSource))
report->line() << i18nc("@info/plain", "Rollback for file system on partition <filename>%1</filename> failed.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "Rollback for file system on partition <filename>%1</filename> failed.", partition().deviceNode());
report->line() << i18nc("@info/plain", "Closing device. This may take a few seconds.");
}
@ -90,5 +90,5 @@ bool MoveFileSystemJob::run(Report& parent)
QString MoveFileSystemJob::description() const
{
return i18nc("@info/plain", "Move the file system on partition <filename>%1</filename> to sector %2", partition().deviceNode(), newStart());
return xi18nc("@info/plain", "Move the file system on partition <filename>%1</filename> to sector %2", partition().deviceNode(), newStart());
}

View File

@ -73,7 +73,7 @@ bool ResizeFileSystemJob::run(Report& parent)
if (partition().fileSystem().length() == newLength())
{
report->line() << i18ncp("@info/plain", "The file system on partition <filename>%2</filename> already has the requested length of 1 sector.", "The file system on partition <filename>%2</filename> already has the requested length of %1 sectors.", newLength(), partition().deviceNode());
report->line() << xi18ncp("@info/plain", "The file system on partition <filename>%2</filename> already has the requested length of 1 sector.", "The file system on partition <filename>%2</filename> already has the requested length of %1 sectors.", newLength(), partition().deviceNode());
rval = true;
}
else
@ -100,7 +100,7 @@ bool ResizeFileSystemJob::run(Report& parent)
}
default:
report->line() << i18nc("@info/plain", "The file system on partition <filename>%1</filename> cannot be resized because there is no support for it.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "The file system on partition <filename>%1</filename> cannot be resized because there is no support for it.", partition().deviceNode());
break;
}
@ -138,12 +138,12 @@ bool ResizeFileSystemJob::resizeFileSystemBackend(Report& report)
delete backendPartitionTable;
}
else
report.line() << i18nc("@info/plain", "Could not open partition <filename>%1</filename> while trying to resize the file system.", partition().deviceNode());
report.line() << xi18nc("@info/plain", "Could not open partition <filename>%1</filename> while trying to resize the file system.", partition().deviceNode());
delete backendDevice;
}
else
report.line() << i18nc("@info/plain", "Could not read geometry for partition <filename>%1</filename> while trying to resize the file system.", partition().deviceNode());
report.line() << xi18nc("@info/plain", "Could not read geometry for partition <filename>%1</filename> while trying to resize the file system.", partition().deviceNode());
return rval;
}
@ -151,7 +151,7 @@ bool ResizeFileSystemJob::resizeFileSystemBackend(Report& report)
QString ResizeFileSystemJob::description() const
{
if (isMaximizing())
return i18nc("@info/plain", "Maximize file system on <filename>%1</filename> to fill the partition", partition().deviceNode());
return xi18nc("@info/plain", "Maximize file system on <filename>%1</filename> to fill the partition", partition().deviceNode());
return i18ncp("@info/plain", "Resize file system on partition <filename>%2</filename> to 1 sector", "Resize file system on partition <filename>%2</filename> to %1 sectors", newLength(), partition().deviceNode());
return xi18ncp("@info/plain", "Resize file system on partition <filename>%2</filename> to 1 sector", "Resize file system on partition <filename>%2</filename> to %1 sectors", newLength(), partition().deviceNode());
}

View File

@ -71,9 +71,9 @@ bool RestoreFileSystemJob::run(Report& parent)
CopySourceFile copySource(fileName(), copyTarget.sectorSize());
if (!copySource.open())
report->line() << i18nc("@info/plain", "Could not open backup file <filename>%1</filename> to restore from.", fileName());
report->line() << xi18nc("@info/plain", "Could not open backup file <filename>%1</filename> to restore from.", fileName());
else if (!copyTarget.open())
report->line() << i18nc("@info/plain", "Could not open target partition <filename>%1</filename> to restore to.", targetPartition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open target partition <filename>%1</filename> to restore to.", targetPartition().deviceNode());
else
{
rval = copyBlocks(*report, copyTarget, copySource);
@ -112,5 +112,5 @@ bool RestoreFileSystemJob::run(Report& parent)
QString RestoreFileSystemJob::description() const
{
return i18nc("@info/plain", "Restore the file system from file <filename>%1</filename> to partition <filename>%2</filename>", fileName(), targetPartition().deviceNode());
return xi18nc("@info/plain", "Restore the file system from file <filename>%1</filename> to partition <filename>%2</filename>", fileName(), targetPartition().deviceNode());
}

View File

@ -48,7 +48,7 @@ bool SetFileSystemLabelJob::run(Report& parent)
// just ignore the request and say all is well. This helps in operations because
// we don't have to check for support to avoid having a failed job.
if (partition().fileSystem().supportSetLabel() == FileSystem::cmdSupportNone)
report->line() << i18nc("@info/plain", "File system on partition <filename>%1</filename> does not support setting labels. Job ignored.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "File system on partition <filename>%1</filename> does not support setting labels. Job ignored.", partition().deviceNode());
else if (partition().fileSystem().supportSetLabel() == FileSystem::cmdSupportFileSystem)
{
rval = partition().fileSystem().writeLabel(*report, partition().deviceNode(), label());
@ -64,5 +64,5 @@ bool SetFileSystemLabelJob::run(Report& parent)
QString SetFileSystemLabelJob::description() const
{
return i18nc("@info/plain", "Set the file system label on partition <filename>%1</filename> to \"%2\"", partition().deviceNode(), label());
return xi18nc("@info/plain", "Set the file system label on partition <filename>%1</filename> to \"%2\"", partition().deviceNode(), label());
}

View File

@ -82,7 +82,7 @@ bool SetPartFlagsJob::run(Report& parent)
if (!backendPartition->setFlag(*report, f, state))
{
report->line() << i18nc("@info/plain", "There was an error setting flag %1 for partition <filename>%2</filename> to state %3.", PartitionTable::flagName(f), partition().deviceNode(), state ? i18nc("@info/plain flag turned on, active", "on") : i18nc("@info/plain flag turned off, inactive", "off"));
report->line() << xi18nc("@info/plain", "There was an error setting flag %1 for partition <filename>%2</filename> to state %3.", PartitionTable::flagName(f), partition().deviceNode(), state ? i18nc("@info/plain flag turned on, active", "on") : i18nc("@info/plain flag turned off, inactive", "off"));
rval = false;
}
@ -91,7 +91,7 @@ bool SetPartFlagsJob::run(Report& parent)
delete backendPartition;
}
else
report->line() << i18nc("@info/plain", "Could not find partition <filename>%1</filename> on device <filename>%2</filename> to set partition flags.", partition().deviceNode(), device().deviceNode());
report->line() << xi18nc("@info/plain", "Could not find partition <filename>%1</filename> on device <filename>%2</filename> to set partition flags.", partition().deviceNode(), device().deviceNode());
if (rval)
backendPartitionTable->commit();
@ -99,12 +99,12 @@ bool SetPartFlagsJob::run(Report& parent)
delete backendPartitionTable;
}
else
report->line() << i18nc("@info/plain", "Could not open partition table on device <filename>%1</filename> to set partition flags for partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open partition table on device <filename>%1</filename> to set partition flags for partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
delete backendDevice;
}
else
report->line() << i18nc("@info/plain", "Could not open device <filename>%1</filename> to set partition flags for partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open device <filename>%1</filename> to set partition flags for partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
if (rval)
partition().setFlags(flags());
@ -117,7 +117,7 @@ bool SetPartFlagsJob::run(Report& parent)
QString SetPartFlagsJob::description() const
{
if (PartitionTable::flagNames(flags()).size() == 0)
return QString(i18nc("@info/plain", "Clear flags for partition <filename>%1</filename>", partition().deviceNode()));
return QString(xi18nc("@info/plain", "Clear flags for partition <filename>%1</filename>", partition().deviceNode()));
return i18nc("@info/plain", "Set the flags for partition <filename>%1</filename> to \"%2\"", partition().deviceNode(), PartitionTable::flagNames(flags()).join(","));
return xi18nc("@info/plain", "Set the flags for partition <filename>%1</filename> to \"%2\"", partition().deviceNode(), PartitionTable::flagNames(flags()).join(","));
}

View File

@ -78,7 +78,7 @@ bool SetPartGeometryJob::run(Report& parent)
delete backendDevice;
}
else
report->line() << i18nc("@info/plain", "Could not open device <filename>%1</filename> while trying to resize/move partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open device <filename>%1</filename> while trying to resize/move partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
jobFinished(*report, rval);
@ -87,5 +87,5 @@ bool SetPartGeometryJob::run(Report& parent)
QString SetPartGeometryJob::description() const
{
return i18nc("@info/plain", "Set geometry of partition <filename>%1</filename>: Start sector: %2, length: %3", partition().deviceNode(), newStart(), newLength());
return xi18nc("@info/plain", "Set geometry of partition <filename>%1</filename>: Start sector: %2, length: %3", partition().deviceNode(), newStart(), newLength());
}

View File

@ -71,7 +71,7 @@ bool ShredFileSystemJob::run(Report& parent)
if (!copySource.open())
report->line() << i18nc("@info/plain", "Could not open random data source to overwrite file system.");
else if (!copyTarget.open())
report->line() << i18nc("@info/plain", "Could not open target partition <filename>%1</filename> to restore to.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "Could not open target partition <filename>%1</filename> to restore to.", partition().deviceNode());
else
{
rval = copyBlocks(*report, copyTarget, copySource);
@ -86,5 +86,5 @@ bool ShredFileSystemJob::run(Report& parent)
QString ShredFileSystemJob::description() const
{
return i18nc("@info/plain", "Shred the file system on <filename>%1</filename>", partition().deviceNode());
return xi18nc("@info/plain", "Shred the file system on <filename>%1</filename>", partition().deviceNode());
}

View File

@ -24,24 +24,35 @@
#include "util/helpers.h"
#include <kapplication.h>
#include <kcmdlineargs.h>
#include <kmessagebox.h>
#include <kaboutdata.h>
#include <QApplication>
#include <QCommandLineParser>
#include <KAboutData>
#include <KMessageBox>
#include <KLocalizedString>
#include <config.h>
int main(int argc, char* argv[])
int Q_DECL_IMPORT main(int argc, char* argv[])
{
KCmdLineArgs::init(argc, argv, createPartitionManagerAboutData());
KCmdLineOptions options;
options.add("dontsu", ki18nc("@info:shell", "Do not try to gain super user privileges"));
options.add("advconfig", ki18nc("@info:shell", "Show advanced tab in configuration dialog"));
options.add("+[device]", ki18nc("@info:shell", "Device(s) to manage"));
KCmdLineArgs::addCmdLineOptions(options);
QApplication app(argc, argv);
KAboutData *aboutData = createPartitionManagerAboutData();
KAboutData::setApplicationData(*aboutData);
KApplication app;
app.setApplicationName(aboutData->componentName());
app.setApplicationDisplayName(aboutData->displayName());
app.setOrganizationDomain(aboutData->organizationDomain());
app.setApplicationVersion(aboutData->version());
QCommandLineParser parser;
parser.setApplicationDescription( aboutData->shortDescription() );
parser.addHelpOption();
parser.addVersionOption();
parser.addOption( QCommandLineOption( QLatin1Literal("dontsu"), i18nc("@info:shell", "Do not try to gain super user privileges")));
parser.addOption( QCommandLineOption( QLatin1Literal("advconfig"), i18nc("@info:shell", "Show advanced tab in configuration dialog")));
parser.addPositionalArgument( QStringLiteral("device"), i18nc("@info:shell", "Device(s) to manage"), QStringLiteral("[device...]") );
parser.process(app);
registerMetaTypes();
if (!checkPermissions())

View File

@ -47,7 +47,7 @@ BackupOperation::BackupOperation(Device& d, Partition& p, const QString& filenam
QString BackupOperation::description() const
{
return QString(i18nc("@info/plain", "Backup partition <filename>%1</filename> (%2, %3) to <filename>%4</filename>", backupPartition().deviceNode(), Capacity::formatByteSize(backupPartition().capacity()), backupPartition().fileSystem().name(), fileName()));
return QString(xi18nc("@info/plain", "Backup partition <filename>%1</filename> (%2, %3) to <filename>%4</filename>", backupPartition().deviceNode(), Capacity::formatByteSize(backupPartition().capacity()), backupPartition().fileSystem().name(), fileName()));
}
/** Can the given Partition be backed up?

View File

@ -58,7 +58,7 @@ bool CheckOperation::targets(const Partition& p) const
QString CheckOperation::description() const
{
return QString(i18nc("@info/plain", "Check and repair partition <filename>%1</filename> (%2, %3)", checkedPartition().deviceNode(), Capacity::formatByteSize(checkedPartition().capacity()), checkedPartition().fileSystem().name()));
return QString(xi18nc("@info/plain", "Check and repair partition <filename>%1</filename> (%2, %3)", checkedPartition().deviceNode(), Capacity::formatByteSize(checkedPartition().capacity()), checkedPartition().fileSystem().name()));
}
/** Can a Partition be checked?

View File

@ -162,12 +162,12 @@ bool CopyOperation::execute(Report& parent)
// if maximizing doesn't work, just warn the user, don't fail
if (!maximizeJob()->run(*report))
{
report->line() << i18nc("@info/plain", "Warning: Maximizing file system on target partition <filename>%1</filename> to the size of the partition failed.", copiedPartition().deviceNode());
report->line() << xi18nc("@info/plain", "Warning: Maximizing file system on target partition <filename>%1</filename> to the size of the partition failed.", copiedPartition().deviceNode());
warning = true;
}
}
else
report->line() << i18nc("@info/plain", "Checking target partition <filename>%1</filename> after copy failed.", copiedPartition().deviceNode());
report->line() << xi18nc("@info/plain", "Checking target partition <filename>%1</filename> after copy failed.", copiedPartition().deviceNode());
}
else
{
@ -184,7 +184,7 @@ bool CopyOperation::execute(Report& parent)
report->line() << i18nc("@info/plain", "Creating target partition for copying failed.");
}
else
report->line() << i18nc("@info/plain", "Checking source partition <filename>%1</filename> failed.", sourcePartition().deviceNode());
report->line() << xi18nc("@info/plain", "Checking source partition <filename>%1</filename> failed.", sourcePartition().deviceNode());
if (rval)
setStatus(warning ? StatusFinishedWarning : StatusFinishedSuccess);
@ -201,7 +201,7 @@ QString CopyOperation::updateDescription() const
if (overwrittenPartition())
{
if (copiedPartition().length() == overwrittenPartition()->length())
return QString(i18nc("@info/plain", "Copy partition <filename>%1</filename> (%2, %3) to <filename>%4</filename> (%5, %6)",
return QString(xi18nc("@info/plain", "Copy partition <filename>%1</filename> (%2, %3) to <filename>%4</filename> (%5, %6)",
sourcePartition().deviceNode(),
Capacity::formatByteSize(sourcePartition().capacity()),
sourcePartition().fileSystem().name(),
@ -210,7 +210,7 @@ QString CopyOperation::updateDescription() const
overwrittenPartition()->fileSystem().name()
));
return QString(i18nc("@info/plain", "Copy partition <filename>%1</filename> (%2, %3) to <filename>%4</filename> (%5, %6) and grow it to %7",
return QString(xi18nc("@info/plain", "Copy partition <filename>%1</filename> (%2, %3) to <filename>%4</filename> (%5, %6) and grow it to %7",
sourcePartition().deviceNode(),
Capacity::formatByteSize(sourcePartition().capacity()),
sourcePartition().fileSystem().name(),
@ -222,7 +222,7 @@ QString CopyOperation::updateDescription() const
}
if (copiedPartition().length() == sourcePartition().length())
return QString(i18nc("@info/plain", "Copy partition <filename>%1</filename> (%2, %3) to unallocated space (starting at %4) on <filename>%5</filename>",
return QString(xi18nc("@info/plain", "Copy partition <filename>%1</filename> (%2, %3) to unallocated space (starting at %4) on <filename>%5</filename>",
sourcePartition().deviceNode(),
Capacity::formatByteSize(sourcePartition().capacity()),
sourcePartition().fileSystem().name(),
@ -230,7 +230,7 @@ QString CopyOperation::updateDescription() const
targetDevice().deviceNode()
));
return QString(i18nc("@info/plain", "Copy partition <filename>%1</filename> (%2, %3) to unallocated space (starting at %4) on <filename>%5</filename> and grow it to %6",
return QString(xi18nc("@info/plain", "Copy partition <filename>%1</filename> (%2, %3) to unallocated space (starting at %4) on <filename>%5</filename> and grow it to %6",
sourcePartition().deviceNode(),
Capacity::formatByteSize(sourcePartition().capacity()),
sourcePartition().fileSystem().name(),

View File

@ -93,5 +93,5 @@ bool CreateFileSystemOperation::execute(Report& parent)
QString CreateFileSystemOperation::description() const
{
return QString(i18nc("@info/plain", "Create filesystem %1 on partition <filename>%2</filename>", newFileSystem()->name(), partition().deviceNode()));
return QString(xi18nc("@info/plain", "Create filesystem %1 on partition <filename>%2</filename>", newFileSystem()->name(), partition().deviceNode()));
}

View File

@ -99,5 +99,5 @@ bool CreatePartitionTableOperation::canCreate(const Device* device)
QString CreatePartitionTableOperation::description() const
{
return QString(i18nc("@info/plain", "Create a new partition table (type: %1) on <filename>%2</filename>", partitionTable()->typeName(), targetDevice().deviceNode()));
return QString(xi18nc("@info/plain", "Create a new partition table (type: %1) on <filename>%2</filename>", partitionTable()->typeName(), targetDevice().deviceNode()));
}

View File

@ -82,9 +82,9 @@ void DeleteOperation::undo()
QString DeleteOperation::description() const
{
if (isSecure())
return QString(i18nc("@info/plain", "Shred partition <filename>%1</filename> (%2, %3)", deletedPartition().deviceNode(), Capacity::formatByteSize(deletedPartition().capacity()), deletedPartition().fileSystem().name()));
return QString(xi18nc("@info/plain", "Shred partition <filename>%1</filename> (%2, %3)", deletedPartition().deviceNode(), Capacity::formatByteSize(deletedPartition().capacity()), deletedPartition().fileSystem().name()));
else
return QString(i18nc("@info/plain", "Delete partition <filename>%1</filename> (%2, %3)", deletedPartition().deviceNode(), Capacity::formatByteSize(deletedPartition().capacity()), deletedPartition().fileSystem().name()));
return QString(xi18nc("@info/plain", "Delete partition <filename>%1</filename> (%2, %3)", deletedPartition().deviceNode(), Capacity::formatByteSize(deletedPartition().capacity()), deletedPartition().fileSystem().name()));
}
void DeleteOperation::checkAdjustLogicalNumbers(Partition& p, bool undo)

View File

@ -109,7 +109,7 @@ void NewOperation::undo()
QString NewOperation::description() const
{
return QString(i18nc("@info/plain", "Create a new partition (%1, %2) on <filename>%3</filename>", Capacity::formatByteSize(newPartition().capacity()), newPartition().fileSystem().name(), targetDevice().deviceNode()));
return QString(xi18nc("@info/plain", "Create a new partition (%1, %2) on <filename>%3</filename>", Capacity::formatByteSize(newPartition().capacity()), newPartition().fileSystem().name(), targetDevice().deviceNode()));
}
/** Can a Partition be created somewhere?

View File

@ -30,7 +30,7 @@
#include <QIcon>
#include <QString>
#include <kiconloader.h>
#include <KIconThemes/KIconLoader>
#include <KLocalizedString>
Operation::Operation() :
@ -115,7 +115,7 @@ QIcon Operation::statusIcon() const
if (status() == StatusNone)
return QIcon();
return SmallIcon(icons[status()]);
return QIcon(KIconLoader().loadIcon(icons[status()], KIconLoader::Small));
}
void Operation::addJob(Job* job)

View File

@ -162,7 +162,7 @@ bool ResizeOperation::execute(Report& parent)
if (moveExtendedJob())
{
if (!(rval = moveExtendedJob()->run(*report)))
report->line() << i18nc("@info/plain", "Moving extended partition <filename>%1</filename> failed.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "Moving extended partition <filename>%1</filename> failed.", partition().deviceNode());
}
else
{
@ -172,14 +172,14 @@ bool ResizeOperation::execute(Report& parent)
if (rval)
{
if (!(rval = checkResizedJob()->run(*report)))
report->line() << i18nc("@info/plain", "Checking partition <filename>%1</filename> after resize/move failed.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "Checking partition <filename>%1</filename> after resize/move failed.", partition().deviceNode());
}
else
report->line() << i18nc("@info/plain", "Resizing/moving partition <filename>%1</filename> failed.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "Resizing/moving partition <filename>%1</filename> failed.", partition().deviceNode());
}
}
else
report->line() << i18nc("@info/plain", "Checking partition <filename>%1</filename> before resize/move failed.", partition().deviceNode());
report->line() << xi18nc("@info/plain", "Checking partition <filename>%1</filename> before resize/move failed.", partition().deviceNode());
setStatus(rval ? StatusFinishedSuccess : StatusError);
@ -210,28 +210,28 @@ QString ResizeOperation::description() const
switch(resizeAction())
{
case MoveLeft:
return i18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the left by %2", partition().deviceNode(), moveDelta);
return xi18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the left by %2", partition().deviceNode(), moveDelta);
case MoveRight:
return i18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the right by %2", partition().deviceNode(), moveDelta);
return xi18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the right by %2", partition().deviceNode(), moveDelta);
case Grow:
return i18nc("@info/plain describe resize/move action", "Grow partition <filename>%1</filename> from %2 to %3", partition().deviceNode(), origCapacity, newCapacity);
return xi18nc("@info/plain describe resize/move action", "Grow partition <filename>%1</filename> from %2 to %3", partition().deviceNode(), origCapacity, newCapacity);
case Shrink:
return i18nc("@info/plain describe resize/move action", "Shrink partition <filename>%1</filename> from %2 to %3", partition().deviceNode(), origCapacity, newCapacity);
return xi18nc("@info/plain describe resize/move action", "Shrink partition <filename>%1</filename> from %2 to %3", partition().deviceNode(), origCapacity, newCapacity);
case MoveLeftGrow:
return i18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the left by %2 and grow it from %3 to %4", partition().deviceNode(), moveDelta, origCapacity, newCapacity);
return xi18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the left by %2 and grow it from %3 to %4", partition().deviceNode(), moveDelta, origCapacity, newCapacity);
case MoveRightGrow:
return i18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the right by %2 and grow it from %3 to %4", partition().deviceNode(), moveDelta, origCapacity, newCapacity);
return xi18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the right by %2 and grow it from %3 to %4", partition().deviceNode(), moveDelta, origCapacity, newCapacity);
case MoveLeftShrink:
return i18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the left by %2 and shrink it from %3 to %4", partition().deviceNode(), moveDelta, origCapacity, newCapacity);
return xi18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the left by %2 and shrink it from %3 to %4", partition().deviceNode(), moveDelta, origCapacity, newCapacity);
case MoveRightShrink:
return i18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the right by %2 and shrink it from %3 to %4", partition().deviceNode(), moveDelta, origCapacity, newCapacity);
return xi18nc("@info/plain describe resize/move action", "Move partition <filename>%1</filename> to the right by %2 and shrink it from %3 to %4", partition().deviceNode(), moveDelta, origCapacity, newCapacity);
default:
qWarning() << "Could not determine what to do with partition " << partition().deviceNode() << ".";
@ -268,13 +268,13 @@ bool ResizeOperation::shrink(Report& report)
{
if (shrinkResizeJob() && !shrinkResizeJob()->run(report))
{
report.line() << i18nc("@info/plain", "Resize/move failed: Could not resize file system to shrink partition <filename>%1</filename>.", partition().deviceNode());
report.line() << xi18nc("@info/plain", "Resize/move failed: Could not resize file system to shrink partition <filename>%1</filename>.", partition().deviceNode());
return false;
}
if (shrinkSetGeomJob() && !shrinkSetGeomJob()->run(report))
{
report.line() << i18nc("@info/plain", "Resize/move failed: Could not shrink partition <filename>%1</filename>.", partition().deviceNode());
report.line() << xi18nc("@info/plain", "Resize/move failed: Could not shrink partition <filename>%1</filename>.", partition().deviceNode());
return false;
/** @todo if this fails, no one undoes the shrinking of the file system above, because we
@ -294,17 +294,17 @@ bool ResizeOperation::move(Report& report)
const qint64 oldStart = partition().firstSector();
if (moveSetGeomJob() && !moveSetGeomJob()->run(report))
{
report.line() << i18nc("@info/plain", "Moving partition <filename>%1</filename> failed.", partition().deviceNode());
report.line() << xi18nc("@info/plain", "Moving partition <filename>%1</filename> failed.", partition().deviceNode());
return false;
}
if (moveFileSystemJob() && !moveFileSystemJob()->run(report))
{
report.line() << i18nc("@info/plain", "Moving the filesystem for partition <filename>%1</filename> failed. Rolling back.", partition().deviceNode());
report.line() << xi18nc("@info/plain", "Moving the filesystem for partition <filename>%1</filename> failed. Rolling back.", partition().deviceNode());
// see above: We now have to move back the partition itself.
if (!SetPartGeometryJob(targetDevice(), partition(), oldStart, partition().length()).run(report))
report.line() << i18nc("@info/plain", "Moving back partition <filename>%1</filename> to its original position failed.", partition().deviceNode());
report.line() << xi18nc("@info/plain", "Moving back partition <filename>%1</filename> to its original position failed.", partition().deviceNode());
return false;
}
@ -318,16 +318,16 @@ bool ResizeOperation::grow(Report& report)
if (growSetGeomJob() && !growSetGeomJob()->run(report))
{
report.line() << i18nc("@info/plain", "Resize/move failed: Could not grow partition <filename>%1</filename>.", partition().deviceNode());
report.line() << xi18nc("@info/plain", "Resize/move failed: Could not grow partition <filename>%1</filename>.", partition().deviceNode());
return false;
}
if (growResizeJob() && !growResizeJob()->run(report))
{
report.line() << i18nc("@info/plain", "Resize/move failed: Could not resize the file system on partition <filename>%1</filename>", partition().deviceNode());
report.line() << xi18nc("@info/plain", "Resize/move failed: Could not resize the file system on partition <filename>%1</filename>", partition().deviceNode());
if (!SetPartGeometryJob(targetDevice(), partition(), partition().firstSector(), oldLength).run(report))
report.line() << i18nc("@info/plain", "Could not restore old partition size for partition <filename>%1</filename>.", partition().deviceNode());
report.line() << xi18nc("@info/plain", "Could not restore old partition size for partition <filename>%1</filename>.", partition().deviceNode());
return false;
}

View File

@ -141,10 +141,10 @@ bool RestoreOperation::execute(Report& parent)
// or the image length, whichever is larger. If this fails, don't return an error, just
// warn the user.
if ((warning = !maximizeJob()->run(*report)))
report->line() << i18nc("@info/plain", "Warning: Maximizing file system on target partition <filename>%1</filename> to the size of the partition failed.", restorePartition().deviceNode());
report->line() << xi18nc("@info/plain", "Warning: Maximizing file system on target partition <filename>%1</filename> to the size of the partition failed.", restorePartition().deviceNode());
}
else
report->line() << i18nc("@info/plain", "Checking target file system on partition <filename>%1</filename> after the restore failed.", restorePartition().deviceNode());
report->line() << xi18nc("@info/plain", "Checking target file system on partition <filename>%1</filename> after the restore failed.", restorePartition().deviceNode());
}
else
{
@ -170,9 +170,9 @@ bool RestoreOperation::execute(Report& parent)
QString RestoreOperation::description() const
{
if (overwrittenPartition())
return QString(i18nc("@info/plain", "Restore partition from <filename>%1</filename> to <filename>%2</filename>", fileName(), overwrittenPartition()->deviceNode()));
return QString(xi18nc("@info/plain", "Restore partition from <filename>%1</filename> to <filename>%2</filename>", fileName(), overwrittenPartition()->deviceNode()));
return QString(i18nc("@info/plain", "Restore partition on <filename>%1</filename> at %2 from <filename>%3</filename>", targetDevice().deviceNode(), Capacity::formatByteSize(restorePartition().firstSector() * targetDevice().logicalSectorSize()), fileName()));
return QString(xi18nc("@info/plain", "Restore partition on <filename>%1</filename> at %2 from <filename>%3</filename>", targetDevice().deviceNode(), Capacity::formatByteSize(restorePartition().firstSector() * targetDevice().logicalSectorSize()), fileName()));
}
void RestoreOperation::setOverwrittenPartition(Partition* p)

View File

@ -67,7 +67,7 @@ void SetFileSystemLabelOperation::undo()
QString SetFileSystemLabelOperation::description() const
{
if (oldLabel().isEmpty())
return QString(i18nc("@info/plain", "Set label for partition <filename>%1</filename> to \"%2\"", labeledPartition().deviceNode(), newLabel()));
return QString(xi18nc("@info/plain", "Set label for partition <filename>%1</filename> to \"%2\"", labeledPartition().deviceNode(), newLabel()));
return QString(i18nc("@info/plain", "Set label for partition <filename>%1</filename> from \"%2\" to \"%3\"", labeledPartition().deviceNode(), oldLabel(), newLabel()));
return QString(xi18nc("@info/plain", "Set label for partition <filename>%1</filename> from \"%2\" to \"%3\"", labeledPartition().deviceNode(), oldLabel(), newLabel()));
}

View File

@ -71,7 +71,7 @@ void SetPartFlagsOperation::undo()
QString SetPartFlagsOperation::description() const
{
if (PartitionTable::flagNames(newFlags()).size() == 0)
return QString(i18nc("@info/plain", "Clear flags for partition <filename>%1</filename>", flagPartition().deviceNode()));
return QString(i18nc("@info/plain", "Set flags for partition <filename>%1</filename> to \"%2\"", flagPartition().deviceNode(), PartitionTable::flagNames(newFlags()).join(",")));
return QString(xi18nc("@info/plain", "Clear flags for partition <filename>%1</filename>", flagPartition().deviceNode()));
return QString(xi18nc("@info/plain", "Set flags for partition <filename>%1</filename> to \"%2\"", flagPartition().deviceNode(), PartitionTable::flagNames(newFlags()).join(",")));
}

View File

@ -17,7 +17,7 @@
file (GLOB pmdummybackendplugin_SRCS *.cpp)
kde4_add_plugin(pmdummybackendplugin ${pmdummybackendplugin_SRCS})
add_library(pmdummybackendplugin SHARED ${pmdummybackendplugin_SRCS})
target_link_libraries(pmdummybackendplugin partitionmanagerprivate ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} ${LIBPARTED_LIBS} ${BLKID_LIBRARIES} ${KDE4_SOLID_LIBS})

View File

@ -33,31 +33,28 @@
#include <QStringList>
#include <KLocalizedString>
#include <kpluginfactory.h>
#include <kaboutdata.h>
#include <KPluginFactory>
#include <KAboutData>
K_PLUGIN_FACTORY(DummyBackendFactory, registerPlugin<DummyBackend>(); )
static KAboutData createPluginAboutData()
{
KAboutData about(
"pmdummybackendplugin",
NULL,
ki18nc("@title", "Dummy Backend Plugin"),
QString(VERSION).toUtf8(),
ki18n("KDE Partition Manager dummy backend."),
KAboutData::License_GPL,
ki18n("Copyright 2010 Volker Lanz"));
QStringLiteral("pmdummybackendplugin"),
i18nc("@title", "Dummy Backend Plugin"),
"1.1.60",
i18n("KDE Partition Manager dummy backend."),
KAboutLicense::GPL,
i18n("Copyright 2010 Volker Lanz"),
QString());
about.addAuthor(ki18nc("@info:credit", "Volker Lanz"), KLocalizedString(), "vl@fidra.de");
about.addAuthor(i18nc("@info:credit", "Volker Lanz"), "Maintainer", "vl@fidra.de");
about.setHomepage("http://www.partitionmanager.org");
return about;
}
K_EXPORT_PLUGIN(DummyBackendFactory(createPluginAboutData()))
DummyBackend::DummyBackend(QObject*, const QList<QVariant>&) :
CoreBackend()
{
@ -120,3 +117,5 @@ bool DummyBackend::closeDevice(CoreBackendDevice* core_device)
{
return core_device->close();
}
#include "dummybackend.moc"

View File

@ -29,9 +29,9 @@ include_directories(${LIBPARTED_INCLUDE_DIR})
file (GLOB pmlibpartedbackendplugin_SRCS *.cpp)
kde4_add_plugin(pmlibpartedbackendplugin ${pmlibpartedbackendplugin_SRCS})
add_library(pmlibpartedbackendplugin SHARED ${pmlibpartedbackendplugin_SRCS})
target_link_libraries(pmlibpartedbackendplugin partitionmanagerprivate ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} ${LIBPARTED_LIBS} ${BLKID_LIBRARIES} ${KDE4_SOLID_LIBS})
target_link_libraries(pmlibpartedbackendplugin partitionmanagerprivate ${LIBPARTED_LIBS} ${BLKID_LIBRARIES} KF5::KIOCore)
install(TARGETS pmlibpartedbackendplugin DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES pmlibpartedbackendplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR})

View File

@ -44,15 +44,15 @@
#include <QDebug>
#include <KLocalizedString>
#include <kmountpoint.h>
#include <kdiskfreespaceinfo.h>
#include <kpluginfactory.h>
#include <kaboutdata.h>
#include <KIOCore/KMountPoint>
#include <KIOCore/KDiskFreeSpaceInfo>
#include <KPluginFactory>
#include <KAboutData>
#include <solid/device.h>
#include <solid/deviceinterface.h>
#include <solid/block.h>
#include <solid/storagedrive.h>
#include <Solid/Device>
#include <Solid/DeviceInterface>
#include <Solid/Block>
#include <Solid/StorageDrive>
#include <parted/parted.h>
#include <unistd.h>
@ -63,22 +63,20 @@ K_PLUGIN_FACTORY(LibPartedBackendFactory, registerPlugin<LibPartedBackend>(); )
static KAboutData createPluginAboutData()
{
KAboutData about(
"pmlibpartedbackendplugin",
NULL,
ki18nc("@title", "LibParted Backend Plugin"),
QStringLiteral("pmlibpartedbackendplugin"),
i18nc("@title", "LibParted Backend Plugin"),
QString("%1, libparted version: %2").arg(VERSION).arg(ped_get_version()).toUtf8(),
ki18n("KDE Partition Manager backend for libparted."),
KAboutData::License_GPL,
ki18n("Copyright 2008,2009,2010 Volker Lanz"));
i18n("KDE Partition Manager backend for libparted."),
KAboutLicense::GPL,
i18n("Copyright 2008,2009,2010 Volker Lanz"),
QString());
about.addAuthor(ki18nc("@info:credit", "Volker Lanz"), KLocalizedString(), "vl@fidra.de");
about.addAuthor(i18nc("@info:credit", "Volker Lanz"), "Maintainer", "vl@fidra.de");
about.setHomepage("http://www.partitionmanager.org");
return about;
}
K_EXPORT_PLUGIN(LibPartedBackendFactory(createPluginAboutData()))
static struct
{
PedPartitionFlag pedFlag;
@ -419,7 +417,7 @@ Device* LibPartedBackend::scanDevice(const QString& device_node)
if (pedDevice == NULL)
{
Log(Log::warning) << i18nc("@info/plain", "Could not access device <filename>%1</filename>", device_node);
Log(Log::warning) << xi18nc("@info/plain", "Could not access device <filename>%1</filename>", device_node);
return NULL;
}
@ -605,3 +603,4 @@ PedPartitionFlag LibPartedBackend::getPedFlag(PartitionTable::Flag flag)
return static_cast<PedPartitionFlag>(-1);
}
#include "libpartedbackend.moc"

View File

@ -24,6 +24,7 @@
#include "backend/corebackend.h"
#include "core/partitiontable.h"
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h"

View File

@ -96,7 +96,7 @@ bool LibPartedDevice::createPartitionTable(Report& report, const PartitionTable&
if (pedDiskType == NULL)
{
report.line() << i18nc("@info/plain", "Creating partition table failed: Could not retrieve partition table type \"%1\" for <filename>%2</filename>.", ptable.typeName(), deviceNode());
report.line() << xi18nc("@info/plain", "Creating partition table failed: Could not retrieve partition table type \"%1\" for <filename>%2</filename>.", ptable.typeName(), deviceNode());
return false;
}
@ -104,7 +104,7 @@ bool LibPartedDevice::createPartitionTable(Report& report, const PartitionTable&
if (dev == NULL)
{
report.line() << i18nc("@info/plain", "Creating partition table failed: Could not open backend device <filename>%1</filename>.", deviceNode());
report.line() << xi18nc("@info/plain", "Creating partition table failed: Could not open backend device <filename>%1</filename>.", deviceNode());
return false;
}
@ -112,7 +112,7 @@ bool LibPartedDevice::createPartitionTable(Report& report, const PartitionTable&
if (disk == NULL)
{
report.line() << i18nc("@info/plain", "Creating partition table failed: Could not create a new partition table in the backend for device <filename>%1</filename>.", deviceNode());
report.line() << xi18nc("@info/plain", "Creating partition table failed: Could not create a new partition table in the backend for device <filename>%1</filename>.", deviceNode());
return false;
}

View File

@ -163,7 +163,7 @@ QString LibPartedPartitionTable::createPartition(Report& report, const Partition
if (pedType == static_cast<int>(0xffffffff))
{
report.line() << i18nc("@info/plain", "Unknown partition role for new partition <filename>%1</filename> (roles: %2)", partition.deviceNode(), partition.roles().toString());
report.line() << xi18nc("@info/plain", "Unknown partition role for new partition <filename>%1</filename> (roles: %2)", partition.deviceNode(), partition.roles().toString());
return "";
}
@ -173,7 +173,7 @@ QString LibPartedPartitionTable::createPartition(Report& report, const Partition
if (pedPartition == NULL)
{
report.line() << i18nc("@info/plain", "Failed to create new partition <filename>%1</filename>.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Failed to create new partition <filename>%1</filename>.", partition.deviceNode());
return "";
}
@ -192,7 +192,7 @@ QString LibPartedPartitionTable::createPartition(Report& report, const Partition
if (ped_disk_add_partition(pedDisk(), pedPartition, pedConstraint))
rval = QString(ped_partition_get_path(pedPartition));
else
report.line() << i18nc("@info/plain", "Failed to add partition <filename>%1</filename> to device <filename>%2</filename>.", partition.deviceNode(), pedDisk()->dev->path);
report.line() << xi18nc("@info/plain", "Failed to add partition <filename>%1</filename> to device <filename>%2</filename>.", partition.deviceNode(), pedDisk()->dev->path);
ped_constraint_destroy(pedConstraint);
@ -214,10 +214,10 @@ bool LibPartedPartitionTable::deletePartition(Report& report, const Partition& p
rval = ped_disk_delete_partition(pedDisk(), pedPartition);
if (!rval)
report.line() << i18nc("@info/plain", "Could not delete partition <filename>%1</filename>.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Could not delete partition <filename>%1</filename>.", partition.deviceNode());
}
else
report.line() << i18nc("@info/plain", "Deleting partition failed: Partition to delete (<filename>%1</filename>) not found on disk.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Deleting partition failed: Partition to delete (<filename>%1</filename>) not found on disk.", partition.deviceNode());
return rval;
}
@ -241,16 +241,16 @@ bool LibPartedPartitionTable::updateGeometry(Report& report, const Partition& pa
if (ped_disk_set_partition_geom(pedDisk(), pedPartition, pedConstraint, sector_start, sector_end))
rval = true;
else
report.line() << i18nc("@info/plain", "Could not set geometry for partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Could not set geometry for partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
}
else
report.line() << i18nc("@info/plain", "Could not get constraint for partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Could not get constraint for partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
}
else
report.line() << i18nc("@info/plain", "Could not get geometry for partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Could not get geometry for partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
}
else
report.line() << i18nc("@info/plain", "Could not open partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Could not open partition <filename>%1</filename> while trying to resize/move it.", partition.deviceNode());
return rval;
}
@ -269,7 +269,7 @@ bool LibPartedPartitionTable::clobberFileSystem(Report& report, const Partition&
rval = ped_geometry_write(&pedPartition->geom, "0000000", 65536 / pedDevice()->sector_size, 1);
if (!rval)
report.line() << i18nc("@info/plain", "Failed to erase filesystem signature on partition <filename>%1</filename>.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Failed to erase filesystem signature on partition <filename>%1</filename>.", partition.deviceNode());
ped_device_close(pedDevice());
}
@ -278,7 +278,7 @@ bool LibPartedPartitionTable::clobberFileSystem(Report& report, const Partition&
rval = true;
}
else
report.line() << i18nc("@info/plain", "Could not delete file system on partition <filename>%1</filename>: Failed to get partition.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Could not delete file system on partition <filename>%1</filename>: Failed to get partition.", partition.deviceNode());
return rval;
}
@ -306,18 +306,18 @@ bool LibPartedPartitionTable::resizeFileSystem(Report& report, const Partition&
ped_timer_destroy(pedTimer);
if (!rval)
report.line() << i18nc("@info/plain", "Could not resize file system on partition <filename>%1</filename>.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Could not resize file system on partition <filename>%1</filename>.", partition.deviceNode());
}
else
report.line() << i18nc("@info/plain", "Could not get geometry for resized partition <filename>%1</filename> while trying to resize the file system.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Could not get geometry for resized partition <filename>%1</filename> while trying to resize the file system.", partition.deviceNode());
ped_file_system_close(pedFileSystem);
}
else
report.line() << i18nc("@info/plain", "Could not open partition <filename>%1</filename> while trying to resize the file system.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Could not open partition <filename>%1</filename> while trying to resize the file system.", partition.deviceNode());
}
else
report.line() << i18nc("@info/plain", "Could not read geometry for partition <filename>%1</filename> while trying to resize the file system.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Could not read geometry for partition <filename>%1</filename> while trying to resize the file system.", partition.deviceNode());
#else
Q_UNUSED(report);
Q_UNUSED(partition);
@ -336,7 +336,7 @@ FileSystem::Type LibPartedPartitionTable::detectFileSystemBySector(Report& repor
if (pedPartition)
rval = LibPartedBackend::detectFileSystem(pedPartition);
else
report.line() << i18nc("@info/plain", "Could not determine file system of partition at sector %1 on device <filename>%2</filename>.", sector, device.deviceNode());
report.line() << xi18nc("@info/plain", "Could not determine file system of partition at sector %1 on device <filename>%2</filename>.", sector, device.deviceNode());
return rval;
}
@ -346,10 +346,10 @@ bool LibPartedPartitionTable::setPartitionSystemType(Report& report, const Parti
PedFileSystemType* pedFsType = (partition.roles().has(PartitionRole::Extended) || partition.fileSystem().type() == FileSystem::Unformatted) ? NULL : getPedFileSystemType(partition.fileSystem().type());
PedPartition* pedPartition = ped_disk_get_partition_by_sector(pedDisk(), partition.firstSector());
if (pedFsType == NULL || pedPartition == NULL)
{
report.line() << i18nc("@info/plain", "Could not update the system type for partition <filename>%1</filename>.", partition.deviceNode());
report.line() << xi18nc("@info/plain", "Could not update the system type for partition <filename>%1</filename>.", partition.deviceNode());
return false;
}

View File

@ -22,8 +22,8 @@
#include "core/partition.h"
#include "core/device.h"
#include <kglobal.h>
#include <klocale.h>
#include <KFormat>
#include <KLocalizedString>
#include <QDebug>
@ -149,5 +149,5 @@ QString Capacity::formatByteSize(double size, int precision)
{
if (size < 0)
return invalidString();
return KGlobal::locale()->formatByteSize(size, precision);
return KFormat().formatByteSize(size, precision);
}

View File

@ -24,27 +24,25 @@
#include "ops/operation.h"
#include <kaboutdata.h>
#include <KAboutData>
#include <KMessageBox>
#include <KLocalizedString>
#include <kmessagebox.h>
#include <kglobal.h>
#include <kcomponentdata.h>
#include <kstandarddirs.h>
#include <kcmdlineargs.h>
#include <kstringhandler.h>
#include <solid/device.h>
#include <Solid/Device>
#include <QProcess>
#include <QFileInfo>
#include <QAction>
#include <QApplication>
#include <QMenu>
#include <QPainter>
#include <QCollator>
#include <QFileInfo>
#include <QIcon>
#include <QMenu>
#include <QHeaderView>
#include <QPainter>
#include <QPixmap>
#include <QProcess>
#include <QStandardPaths>
#include <QRect>
#include <QTreeWidget>
#include <QHeaderView>
#include <config.h>
@ -59,13 +57,12 @@ void registerMetaTypes()
static QString suCommand()
{
KStandardDirs d;
const char* candidates[] = { "kdesu", "kdesudo", "gksudo", "gksu" };
QString rval;
for (quint32 i = 0; i < sizeof(candidates) / sizeof(candidates[0]); i++)
{
rval = d.locate("exe", candidates[i]);
rval = QStandardPaths::findExecutable(candidates[i]);
if (QFileInfo(rval).isExecutable())
return rval;
}
@ -77,11 +74,10 @@ bool checkPermissions()
{
if (geteuid() != 0)
{
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
// only try to gain root privileges if we have a valid (kde|gk)su(do) command and
// we did not try so before: the dontsu-option is there to make sure there are no
// endless loops of calling the same non-working (kde|gk)su(do) binary again and again.
if (!suCommand().isEmpty() && !args->isSet("dontsu"))
if (!suCommand().isEmpty() && !QCoreApplication::arguments().contains(QLatin1String("--dontsu")))
{
QStringList argList;
@ -93,18 +89,18 @@ bool checkPermissions()
if (suCmd.indexOf("kdesu") != -1)
argList << "-c";
argList << args->allArguments().join(" ") + " --dontsu";
argList << QCoreApplication::arguments() << " --dontsu";
if (QProcess::execute(suCmd, argList) == 0)
return false;
}
return KMessageBox::warningContinueCancel(NULL, i18nc("@info",
return KMessageBox::warningContinueCancel(NULL, xi18nc("@info",
"<para><warning>You do not have administrative privileges.</warning></para>"
"<para>It is possible to run <application>%1</application> without these privileges. "
"You will, however, <emphasis>not</emphasis> be allowed to apply operations.</para>"
"<para>Do you want to continue running <application>%1</application>?</para>",
KGlobal::mainComponent().aboutData()->programName()),
QGuiApplication::applicationDisplayName()),
i18nc("@title:window", "No administrative privileges"),
KGuiItem(i18nc("@action:button", "Run without administrative privileges"), "arrow-right"),
KStandardGuiItem::cancel(),
@ -117,20 +113,22 @@ bool checkPermissions()
KAboutData* createPartitionManagerAboutData()
{
KAboutData* about = new KAboutData(
"partitionmanager",
NULL,
ki18nc("@title", "<application>KDE Partition Manager</application>"),
VERSION,
ki18nc("@title", "Manage your disks, partitions and file systems"),
KAboutData::License_GPL,
ki18nc("@info:credit", "(c) 2008, 2009, 2010, 2011 Volker Lanz")
);
QStringLiteral("partitionmanager"),
xi18nc("@title", "<application>KDE Partition Manager</application>"),
QStringLiteral(VERSION),
i18nc("@title", "Manage your disks, partitions and file systems"),
KAboutLicense::GPL,
i18nc("@info:credit", "(c) 2008, 2009, 2010, 2011 Volker Lanz"),
QString());
about->setOrganizationDomain(QByteArray("kde.org"));
about->setProgramIconName(QStringLiteral("partitionmanager"));
about->setProductName(QByteArray("partitionmanager"));
about->addAuthor(ki18nc("@info:credit", "Volker Lanz"), KLocalizedString(), "vl@fidra.de");
about->setHomepage("http://www.partitionmanager.org");
about->addAuthor(i18nc("@info:credit", "Volker Lanz"), QString(), QStringLiteral("vl@fidra.de"));
about->setHomepage(QStringLiteral("http://www.partitionmanager.org"));
about->addCredit(ki18n("Hugo Pereira Da Costa"), ki18nc("@info:credit", "Partition Widget Design"), "hugo@oxygen-icons.org");
about->addCredit(ki18n("Andrius Štikonas"), ki18nc("@info:credit", "Btrfs support"), "stikonas@gmail.com");
about->addCredit(i18n("Hugo Pereira Da Costa"), i18nc("@info:credit", "Partition Widget Design"), QStringLiteral("hugo@oxygen-icons.org"));
about->addCredit(i18n("Andrius Štikonas"), i18nc("@info:credit", "Btrfs support"), QStringLiteral("andrius@stikonas.eu"));
return about;
}
@ -142,7 +140,10 @@ bool caseInsensitiveLessThan(const QString& s1, const QString& s2)
bool naturalLessThan(const QString& s1, const QString& s2)
{
return KStringHandler::naturalCompare(s1, s2) < 0;
QCollator c;
c.setNumericMode(true);
c.setCaseSensitivity(Qt::CaseSensitive);
return c.compare(s1, s2) < 0;
}
QIcon createFileSystemColor(FileSystem::Type type, quint32 size)
@ -193,7 +194,7 @@ bool loadBackend()
if (CoreBackendManager::self()->load(CoreBackendManager::defaultBackendName()))
{
KMessageBox::sorry(NULL,
i18nc("@info", "<para>The configured backend plugin \"%1\" could not be loaded.</para>"
xi18nc("@info", "<para>The configured backend plugin \"%1\" could not be loaded.</para>"
"<para>Loading the default backend plugin \"%2\" instead.</para>",
Config::backend(), CoreBackendManager::defaultBackendName()),
i18nc("@title:window", "Error: Could Not Load Backend Plugin"));
@ -202,7 +203,7 @@ bool loadBackend()
else
{
KMessageBox::error(NULL,
i18nc("@info", "<para>Neither the configured (\"%1\") nor the default (\"%2\") backend "
xi18nc("@info", "<para>Neither the configured (\"%1\") nor the default (\"%2\") backend "
"plugin could be loaded.</para><para>Please check your installation.</para>",
Config::backend(), CoreBackendManager::defaultBackendName()),
i18nc("@title:window", "Error: Could Not Load Backend Plugin"));
@ -218,7 +219,7 @@ bool checkAccessibleDevices()
if (getSolidDeviceList().empty())
{
KMessageBox::error(NULL,
i18nc("@info", "<para>No usable devices could be found.</para><para>Make sure you have sufficient "
xi18nc("@info", "<para>No usable devices could be found.</para><para>Make sure you have sufficient "
"privileges to access block devices on your system.</para>"),
i18nc("@title:window", "Error: No Usable Devices Found"));
return false;
@ -238,26 +239,27 @@ QList<Solid::Device> getSolidDeviceList()
"[ StorageDrive.driveType == 'SdMmc' OR StorageDrive.driveType == 'Xd'] ]";
#endif
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
if (args->count() > 0)
QStringList argList;
int argc = argList.size();
if (argc > 0)
{
predicate = " [ " + predicate + " AND ";
qint32 brackets = (args->count() + 1) / 2;
brackets = args->count() == 1 ? 0 : brackets;
qint32 brackets = (argc + 1) / 2;
brackets = argc == 1 ? 0 : brackets;
for (qint32 i = 0; i < brackets; i++)
predicate += "[ ";
bool right_bracket = false;
for (qint32 i = 0; i < args->count(); i++, right_bracket =! right_bracket)
for (qint32 i = 0; i < argc; i++, right_bracket =! right_bracket)
{
predicate += QString("Block.device == '%1' ").arg(args->arg(i));
predicate += QString("Block.device == '%1' ").arg(argList[i]);
if (right_bracket)
predicate += i == 1 ? "] " : "] ] ";
if (i < args->count() - 1)
if (i < argc - 1)
predicate += "OR ";
if (right_bracket && i != args->count() - 2 && i != args->count()-1)
if (right_bracket && i != argc - 2 && i != argc - 1)
predicate += "[ ";
}
predicate += right_bracket && brackets > 0 ? "] ]" : "]";

View File

@ -22,17 +22,15 @@
#include "backend/corebackend.h"
#include "backend/corebackendmanager.h"
#include <kglobal.h>
#include <kaboutdata.h>
#include <kdatetime.h>
#include <KLocalizedString>
#include <kglobalsettings.h>
#include <kcomponentdata.h>
#include <QApplication>
#include <QDateTime>
#include <QString>
#include <QTextStream>
#include <QTextDocument>
#include <KAboutData>
#include <KLocalizedString>
#include <sys/utsname.h>
#include <unistd.h>
@ -42,8 +40,8 @@ QString HtmlReport::tableLine(const QString& label, const QString contents)
QTextStream s(&rval);
s << "<tr>\n"
<< QString("<td style='font-weight:bold;padding-right:20px;'>%1</td>\n").arg(Qt::escape(label))
<< QString("<td>%1</td>\n").arg(Qt::escape(contents))
<< QString("<td style='font-weight:bold;padding-right:20px;'>%1</td>\n").arg(QString(label).toHtmlEscaped())
<< QString("<td>%1</td>\n").arg(QString(contents).toHtmlEscaped())
<< "</tr>\n";
s.flush();
@ -62,14 +60,14 @@ QString HtmlReport::header()
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"
"<head>\n"
" <title>"
<< i18n("%1: SMART Status Report", Qt::escape(KGlobal::mainComponent().aboutData()->programName()))
<< i18n("%1: SMART Status Report", QGuiApplication::applicationDisplayName().toHtmlEscaped())
<< "</title>\n"
" <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>\n"
"</head>\n\n"
"<body>\n";
s << "<h1>"
<< i18n("%1: SMART Status Report", Qt::escape(KGlobal::mainComponent().aboutData()->programName()))
<< i18n("%1: SMART Status Report", QGuiApplication::applicationDisplayName().toHtmlEscaped())
<< "</h1>\n\n";
struct utsname info;
@ -78,9 +76,9 @@ QString HtmlReport::header()
s << "<table>\n"
<< tableLine(i18n("Date:"), QLocale().toString(QDateTime::currentDateTime(), QLocale::ShortFormat))
<< tableLine(i18n("Program version:"), KGlobal::mainComponent().aboutData()->version())
<< tableLine(i18n("Backend:"), QString("%1 (%2)").arg(CoreBackendManager::self()->backend()->about().programName()).arg(CoreBackendManager::self()->backend()->about().version()))
<< tableLine(i18n("KDE version:"), KDE_VERSION_STRING)
<< tableLine(i18n("Program version:"), QCoreApplication::applicationVersion())
// << tableLine(i18n("Backend:"), QString("%1 (%2)").arg(CoreBackendManager::self()->backend()->about().displayName()).arg(CoreBackendManager::self()->backend()->about().version()))
// << tableLine(i18n("KDE version:"), KDE_VERSION_STRING) /* FIXME: port KF5 */
<< tableLine(i18n("Machine:"), unameString)
<< "</table>\n<br/>\n";

View File

@ -16,14 +16,14 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "libpartitionmanager_export.h"
#if !defined(LIBPARTITIONMANAGEREXPORT__H)
#define LIBPARTITIONMANAGEREXPORT__H
#include <kdemacros.h>
#if !defined(LIBPARTITIONMANAGERPRIVATE_EXPORT)
# define LIBPARTITIONMANAGERPRIVATE_EXPORT KDE_EXPORT
#define LIBPARTITIONMANAGERPRIVATE_EXPORT Q_DECL_EXPORT
#endif
#endif

View File

@ -25,12 +25,7 @@
#include <QTextDocument>
#include <kdeversion.h>
#include <kdatetime.h>
#include <kglobal.h>
#include <kaboutdata.h>
#include <KLocalizedString>
#include <kcomponentdata.h>
#include <sys/utsname.h>
#include <unistd.h>
@ -80,10 +75,10 @@ QString Report::toHtml() const
s += "<div style='margin-left:24px;margin-top:12px;margin-bottom:12px'>\n";
if (!command().isEmpty())
s += "\n<b>" + Qt::escape(command()) + "</b>\n\n";
s += "\n<b>" + QString(command()).toHtmlEscaped() + "</b>\n\n";
if (!output().isEmpty())
s += "<pre>" + Qt::escape(output()) + "</pre>\n\n";
s += "<pre>" + QString(output()).toHtmlEscaped() + "</pre>\n\n";
if (children().size() == 0)
s += "<br/>\n";
@ -92,7 +87,7 @@ QString Report::toHtml() const
s += child->toHtml();
if (!status().isEmpty())
s += "<b>" + Qt::escape(status()) + "</b><br/>\n\n";
s += "<b>" + QString(status()).toHtmlEscaped() + "</b><br/>\n\n";
if (parent() != NULL)
s += "</div>\n\n";