mirror of
https://gitdl.cn/https://github.com/chakralinux/desktop.git
synced 2025-01-24 10:32:13 +08:00
801 lines
28 KiB
Diff
801 lines
28 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 4f2afd5..2cc5968 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -50,7 +50,7 @@ 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(${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${UUID_INCLUDE_DIRS} ${BLKID_INCLUDE_DIRS} lib/ src/ build/)
|
|
|
|
add_subdirectory(lib)
|
|
add_subdirectory(src)
|
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
|
index e02b47a..f29d7f2 100644
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -28,17 +28,35 @@ file(GLOB partitionmanagerprivate_SRCS
|
|
config/*.cpp
|
|
)
|
|
|
|
+file(GLOB partitionmanagerprivate_core_HDRS
|
|
+ core/*.h
|
|
+)
|
|
+file(GLOB partitionmanagerprivate_fs_HDRS
|
|
+ fs/*.h
|
|
+)
|
|
+file(GLOB partitionmanagerprivate_util_HDRS
|
|
+ util/*.h
|
|
+)
|
|
+file(GLOB partitionmanagerprivate_ops_HDRS
|
|
+ ops/*.h
|
|
+)
|
|
+
|
|
file(GLOB partitionmanagerprivate_UIFILES config/*.ui gui/*.ui)
|
|
|
|
kde4_add_ui_files(partitionmanagerprivate_SRCS ${partitionmanagerprivate_UIFILES})
|
|
|
|
kde4_add_kcfg_files(partitionmanagerprivate_SRCS config.kcfgc)
|
|
|
|
-kde4_add_library(partitionmanagerprivate SHARED ${partitionmanagerprivate_SRCS})
|
|
+kde4_add_library(tribepartitionmanager 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})
|
|
+target_link_libraries(tribepartitionmanager libfatlabel ${KDE4_KDECORE_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KIO_LIBS}
|
|
+ ${UUID_LIBRARIES} ${BLKID_LIBRARIES} ${LIBATASMART_LIBRARIES} ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS})
|
|
|
|
-install(TARGETS partitionmanagerprivate ${INSTALL_TARGETS_DEFAULT_ARGS})
|
|
+install(TARGETS tribepartitionmanager ${INSTALL_TARGETS_DEFAULT_ARGS})
|
|
+install(FILES ${partitionmanagerprivate_core_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/tribepartitionmanager/core)
|
|
+install(FILES ${partitionmanagerprivate_fs_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/tribepartitionmanager/fs)
|
|
+install(FILES ${partitionmanagerprivate_util_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/tribepartitionmanager/util)
|
|
+install(FILES ${partitionmanagerprivate_ops_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/tribepartitionmanager/ops)
|
|
|
|
############################################
|
|
|
|
@@ -48,7 +66,7 @@ kde4_add_app_icon(partitionmanager_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../icons/hi
|
|
|
|
kde4_add_executable(partitionmanager ${partitionmanager_SRCS})
|
|
|
|
-target_link_libraries(partitionmanager partitionmanagerprivate ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS})
|
|
+target_link_libraries(partitionmanager tribepartitionmanager ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS})
|
|
|
|
install(TARGETS partitionmanager ${INSTALL_TARGETS_DEFAULT_ARGS})
|
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/partitionmanager.appdata.xml DESTINATION share/appdata)
|
|
diff --git a/src/backend/corebackendmanager.cpp b/src/backend/corebackendmanager.cpp
|
|
index a4ac5d6..4121678 100644
|
|
--- a/src/backend/corebackendmanager.cpp
|
|
+++ b/src/backend/corebackendmanager.cpp
|
|
@@ -17,9 +17,6 @@
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
|
***************************************************************************/
|
|
|
|
-#include "backend/corebackendmanager.h"
|
|
-#include "backend/corebackend.h"
|
|
-
|
|
#include <QStringList>
|
|
#include <QString>
|
|
|
|
@@ -31,6 +28,9 @@
|
|
#include <kservice.h>
|
|
#include <kservicetypetrader.h>
|
|
|
|
+#include <backend/corebackendmanager.h>
|
|
+#include <backend/corebackend.h>
|
|
+
|
|
#include <config.h>
|
|
|
|
CoreBackendManager::CoreBackendManager() :
|
|
@@ -66,11 +66,10 @@ bool CoreBackendManager::load(const QString& name)
|
|
{
|
|
m_Backend = factory->create<CoreBackend>(NULL);
|
|
backend()->setAboutData(factory->componentData().aboutData());
|
|
- kDebug() << "Loaded backend plugin: " << backend()->about().programName() << ", " << backend()->about().version();
|
|
return true;
|
|
}
|
|
|
|
- kWarning() << "Could not load plugin for core backend " << name << ": " << loader.errorString();
|
|
+ qWarning() << "Could not load plugin for core backend " << name << ": " << loader.errorString();
|
|
return false;
|
|
}
|
|
|
|
diff --git a/src/backend/corebackendmanager.h b/src/backend/corebackendmanager.h
|
|
index 133b861..f1cb442 100644
|
|
--- a/src/backend/corebackendmanager.h
|
|
+++ b/src/backend/corebackendmanager.h
|
|
@@ -21,6 +21,8 @@
|
|
|
|
#define COREBACKENDMANAGER__H
|
|
|
|
+#include <QDebug>
|
|
+
|
|
#include "util/libpartitionmanagerexport.h"
|
|
|
|
#include <kservice.h>
|
|
@@ -50,7 +52,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT CoreBackendManager
|
|
/**
|
|
* @return the name of the default backend plugin
|
|
*/
|
|
- static QString defaultBackendName() { return "pmlibpartedbackendplugin"; }
|
|
+ static QString defaultBackendName() { return "plugintribepmlibparted"; }
|
|
|
|
/**
|
|
* @return a list of available backend plugins
|
|
@@ -72,7 +74,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT CoreBackendManager
|
|
/**
|
|
* @return a pointer to the currently loaded backend
|
|
*/
|
|
- CoreBackend* backend() { return m_Backend; }
|
|
+ CoreBackend* backend() { return m_Backend; }
|
|
|
|
private:
|
|
CoreBackend* m_Backend;
|
|
diff --git a/src/config/configurepageadvanced.ui b/src/config/configurepageadvanced.ui
|
|
index f64025e..f69929c 100644
|
|
--- a/src/config/configurepageadvanced.ui
|
|
+++ b/src/config/configurepageadvanced.ui
|
|
@@ -10,6 +10,9 @@
|
|
<height>420</height>
|
|
</rect>
|
|
</property>
|
|
+ <property name="windowTitle">
|
|
+ <string comment="KDE::DoNotExtract">Form</string>
|
|
+ </property>
|
|
<layout class="QVBoxLayout" name="verticalLayout">
|
|
<item>
|
|
<widget class="QGroupBox" name="groupBox">
|
|
diff --git a/src/core/devicescanner.cpp b/src/core/devicescanner.cpp
|
|
index f30713a..e8096af 100644
|
|
--- a/src/core/devicescanner.cpp
|
|
+++ b/src/core/devicescanner.cpp
|
|
@@ -40,6 +40,7 @@ DeviceScanner::DeviceScanner(QObject* parent, OperationStack& ostack) :
|
|
|
|
void DeviceScanner::setupConnections()
|
|
{
|
|
+ CoreBackendManager::self()->load("plugintribepmlibparted");
|
|
connect(CoreBackendManager::self()->backend(), SIGNAL(scanProgress(QString,int)), SIGNAL(progress(QString,int)));
|
|
}
|
|
|
|
diff --git a/src/core/devicescanner.h b/src/core/devicescanner.h
|
|
index c3625cf..96ed1a1 100644
|
|
--- a/src/core/devicescanner.h
|
|
+++ b/src/core/devicescanner.h
|
|
@@ -22,15 +22,17 @@
|
|
|
|
#include <QThread>
|
|
|
|
+#include "util/libpartitionmanagerexport.h"
|
|
+
|
|
class OperationStack;
|
|
|
|
-/** Thread to scan for all available Devices on this computer.
|
|
+/** @brief Thread to scan for all available Devices on this computer.
|
|
|
|
This class is used to find all Devices on the computer and to create new Device instances for each of them. It's subclassing QThread to run asynchronously.
|
|
|
|
@author Volker Lanz <vl@fidra.de>
|
|
*/
|
|
-class DeviceScanner : public QThread
|
|
+class LIBPARTITIONMANAGERPRIVATE_EXPORT DeviceScanner : public QThread
|
|
{
|
|
Q_OBJECT
|
|
|
|
diff --git a/src/core/operationrunner.h b/src/core/operationrunner.h
|
|
index 439a36e..448537e 100644
|
|
--- a/src/core/operationrunner.h
|
|
+++ b/src/core/operationrunner.h
|
|
@@ -24,18 +24,19 @@
|
|
#include <QThread>
|
|
#include <QMutex>
|
|
#include <qglobal.h>
|
|
+#include "util/libpartitionmanagerexport.h"
|
|
|
|
class Operation;
|
|
class OperationStack;
|
|
class Report;
|
|
|
|
-/** Thread to run the Operations in the OperationStack.
|
|
+/** @brief Thread to run the Operations in the OperationStack.
|
|
|
|
Runs the OperationStack when the user applies operations.
|
|
|
|
@author Volker Lanz <vl@fidra.de>
|
|
*/
|
|
-class OperationRunner : public QThread
|
|
+class LIBPARTITIONMANAGERPRIVATE_EXPORT OperationRunner : public QThread
|
|
{
|
|
Q_OBJECT
|
|
Q_DISABLE_COPY(OperationRunner)
|
|
diff --git a/src/core/operationstack.h b/src/core/operationstack.h
|
|
index f6185d6..2083214 100644
|
|
--- a/src/core/operationstack.h
|
|
+++ b/src/core/operationstack.h
|
|
@@ -26,20 +26,21 @@
|
|
#include <QReadWriteLock>
|
|
|
|
#include <qglobal.h>
|
|
+#include "util/libpartitionmanagerexport.h"
|
|
|
|
class Device;
|
|
class Partition;
|
|
class Operation;
|
|
class DeviceScanner;
|
|
|
|
-/** The list of Operations the user wants to have performed.
|
|
+/** @brief The list of Operations the user wants to have performed.
|
|
|
|
OperationStack also handles the Devices that were found on this computer and the merging of
|
|
Operations, e.g., when the user first creates a Partition, then deletes it.
|
|
|
|
@author Volker Lanz <vl@fidra.de>
|
|
*/
|
|
-class OperationStack : public QObject
|
|
+class LIBPARTITIONMANAGERPRIVATE_EXPORT OperationStack : public QObject
|
|
{
|
|
Q_OBJECT
|
|
Q_DISABLE_COPY(OperationStack)
|
|
diff --git a/src/core/partition.h b/src/core/partition.h
|
|
index fe5d274..ecbb49a 100644
|
|
--- a/src/core/partition.h
|
|
+++ b/src/core/partition.h
|
|
@@ -101,6 +101,10 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT Partition : public PartitionNode
|
|
friend class SetPartFlagsJob;
|
|
friend class RestoreFileSystemJob;
|
|
|
|
+ friend class PartitionManager;
|
|
+ friend class PartitionPage;
|
|
+ friend class PMHandler;
|
|
+
|
|
friend QTextStream& operator<<(QTextStream& stream, const Partition& p);
|
|
|
|
public:
|
|
diff --git a/src/core/partitiontable.cpp b/src/core/partitiontable.cpp
|
|
index 2362aa3..e4936dd 100644
|
|
--- a/src/core/partitiontable.cpp
|
|
+++ b/src/core/partitiontable.cpp
|
|
@@ -166,6 +166,7 @@ QString PartitionTable::flagName(Flag f)
|
|
case PartitionTable::FlagPalo: return i18nc("@item partition flag", "palo");
|
|
case PartitionTable::FlagPrep: return i18nc("@item partition flag", "prep");
|
|
case PartitionTable::FlagMsftReserved: return i18nc("@item partition flag", "msft-reserved");
|
|
+ case PartitionTable::FlagBiosGrubBoot: return i18nc("@item partition flag", "bios_grub");
|
|
|
|
default:
|
|
break;
|
|
@@ -190,6 +191,7 @@ QList<PartitionTable::Flag> PartitionTable::flagList()
|
|
rval.append(PartitionTable::FlagPalo);
|
|
rval.append(PartitionTable::FlagPrep);
|
|
rval.append(PartitionTable::FlagMsftReserved);
|
|
+ rval.append(PartitionTable::FlagBiosGrubBoot);
|
|
|
|
return rval;
|
|
}
|
|
diff --git a/src/core/partitiontable.h b/src/core/partitiontable.h
|
|
index 86addad..6243a32 100644
|
|
--- a/src/core/partitiontable.h
|
|
+++ b/src/core/partitiontable.h
|
|
@@ -83,7 +83,8 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT PartitionTable : public PartitionNode
|
|
FlagHpService = 128,
|
|
FlagPalo = 256,
|
|
FlagPrep = 512,
|
|
- FlagMsftReserved = 1024
|
|
+ FlagMsftReserved = 1024,
|
|
+ FlagBiosGrubBoot = 2048
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(Flags, Flag)
|
|
diff --git a/src/fs/filesystem.h b/src/fs/filesystem.h
|
|
index 5a8de35..5d32ade 100644
|
|
--- a/src/fs/filesystem.h
|
|
+++ b/src/fs/filesystem.h
|
|
@@ -27,18 +27,19 @@
|
|
#include <QStringList>
|
|
#include <QString>
|
|
#include <QList>
|
|
+#include "util/libpartitionmanagerexport.h"
|
|
|
|
class Device;
|
|
class Report;
|
|
|
|
-/** Base class for all FileSystems.
|
|
+/** @brief Base class for all FileSystems.
|
|
|
|
Represents a file system and handles support for various types of operations that can
|
|
be performed on those.
|
|
|
|
@author Volker Lanz <vl@fidra.de>
|
|
*/
|
|
-class FileSystem
|
|
+class LIBPARTITIONMANAGERPRIVATE_EXPORT FileSystem
|
|
{
|
|
Q_DISABLE_COPY(FileSystem)
|
|
|
|
diff --git a/src/gui/devicepropswidgetbase.ui b/src/gui/devicepropswidgetbase.ui
|
|
index 2a669b0..83028ca 100644
|
|
--- a/src/gui/devicepropswidgetbase.ui
|
|
+++ b/src/gui/devicepropswidgetbase.ui
|
|
@@ -10,6 +10,9 @@
|
|
<height>361</height>
|
|
</rect>
|
|
</property>
|
|
+ <property name="windowTitle">
|
|
+ <string>Form</string>
|
|
+ </property>
|
|
<layout class="QGridLayout" name="gridLayout">
|
|
<item row="0" column="0" colspan="2">
|
|
<widget class="PartTableWidget" name="m_PartTableWidget" native="true">
|
|
diff --git a/src/gui/partpropswidgetbase.ui b/src/gui/partpropswidgetbase.ui
|
|
index 275ac3b..add2269 100644
|
|
--- a/src/gui/partpropswidgetbase.ui
|
|
+++ b/src/gui/partpropswidgetbase.ui
|
|
@@ -10,6 +10,9 @@
|
|
<height>502</height>
|
|
</rect>
|
|
</property>
|
|
+ <property name="windowTitle">
|
|
+ <string>Form</string>
|
|
+ </property>
|
|
<layout class="QGridLayout" name="gridLayout">
|
|
<item row="0" column="0" colspan="2">
|
|
<widget class="PartWidget" name="m_PartWidget" native="true">
|
|
diff --git a/src/gui/sizedialogwidgetbase.ui b/src/gui/sizedialogwidgetbase.ui
|
|
index 61009af..40f6635 100644
|
|
--- a/src/gui/sizedialogwidgetbase.ui
|
|
+++ b/src/gui/sizedialogwidgetbase.ui
|
|
@@ -10,6 +10,9 @@
|
|
<height>347</height>
|
|
</rect>
|
|
</property>
|
|
+ <property name="windowTitle">
|
|
+ <string>Form</string>
|
|
+ </property>
|
|
<layout class="QGridLayout" name="gridLayout">
|
|
<item row="0" column="0" colspan="2">
|
|
<widget class="PartResizerWidget" name="m_PartResizerWidget" native="true">
|
|
diff --git a/src/main.cpp b/src/main.cpp
|
|
index 87d069a..8534c8c 100644
|
|
--- a/src/main.cpp
|
|
+++ b/src/main.cpp
|
|
@@ -51,9 +51,6 @@ int main(int argc, char* argv[])
|
|
if (!loadBackend())
|
|
return 0;
|
|
|
|
- if (!checkAccessibleDevices())
|
|
- return 0;
|
|
-
|
|
MainWindow* mainWindow = new MainWindow();
|
|
mainWindow->show();
|
|
|
|
diff --git a/src/ops/createfilesystemoperation.h b/src/ops/createfilesystemoperation.h
|
|
index 348362b..fd863ca 100644
|
|
--- a/src/ops/createfilesystemoperation.h
|
|
+++ b/src/ops/createfilesystemoperation.h
|
|
@@ -21,6 +21,8 @@
|
|
|
|
#define CREATEFILESYSTEMOPERATION__H
|
|
|
|
+#include "util/libpartitionmanagerexport.h"
|
|
+
|
|
#include "ops/operation.h"
|
|
|
|
#include "fs/filesystem.h"
|
|
@@ -34,13 +36,13 @@ class DeleteFileSystemJob;
|
|
class CreateFileSystemJob;
|
|
class CheckFileSystemJob;
|
|
|
|
-/** Create a FileSystem.
|
|
+/** @brief Create a FileSystem.
|
|
|
|
Creates a FileSystem on a given Partition and Device.
|
|
|
|
@author Volker Lanz <vl@fidra.de>
|
|
*/
|
|
-class CreateFileSystemOperation : public Operation
|
|
+class LIBPARTITIONMANAGERPRIVATE_EXPORT CreateFileSystemOperation : public Operation
|
|
{
|
|
friend class OperationStack;
|
|
|
|
diff --git a/src/ops/deleteoperation.h b/src/ops/deleteoperation.h
|
|
index 6511741..2c2e9a8 100644
|
|
--- a/src/ops/deleteoperation.h
|
|
+++ b/src/ops/deleteoperation.h
|
|
@@ -22,6 +22,7 @@
|
|
#define DELETEOPERATION__H
|
|
|
|
#include "ops/operation.h"
|
|
+#include "util/libpartitionmanagerexport.h"
|
|
|
|
#include <QString>
|
|
|
|
@@ -35,7 +36,7 @@ class DeletePartitionJob;
|
|
/** Delete a Partition.
|
|
@author Volker Lanz <vl@fidra.de>
|
|
*/
|
|
-class DeleteOperation : public Operation
|
|
+class LIBPARTITIONMANAGERPRIVATE_EXPORT DeleteOperation : public Operation
|
|
{
|
|
friend class OperationStack;
|
|
|
|
diff --git a/src/ops/newoperation.h b/src/ops/newoperation.h
|
|
index dc8e44a..230e6d5 100644
|
|
--- a/src/ops/newoperation.h
|
|
+++ b/src/ops/newoperation.h
|
|
@@ -22,6 +22,7 @@
|
|
#define NEWOPERATION__H
|
|
|
|
#include "ops/operation.h"
|
|
+#include "util/libpartitionmanagerexport.h"
|
|
|
|
#include <QString>
|
|
|
|
@@ -34,13 +35,13 @@ class SetFileSystemLabelJob;
|
|
class SetPartFlagsJob;
|
|
class CheckFileSystemJob;
|
|
|
|
-/** Create a Partition.
|
|
+/** @brief Create a Partition.
|
|
|
|
Creates the given Partition on the given Device.
|
|
|
|
@author Volker Lanz <vl@fidra.de>
|
|
*/
|
|
-class NewOperation : public Operation
|
|
+class LIBPARTITIONMANAGERPRIVATE_EXPORT NewOperation : public Operation
|
|
{
|
|
friend class OperationStack;
|
|
|
|
diff --git a/src/ops/resizeoperation.h b/src/ops/resizeoperation.h
|
|
index 39717d0..38d46de 100644
|
|
--- a/src/ops/resizeoperation.h
|
|
+++ b/src/ops/resizeoperation.h
|
|
@@ -24,6 +24,7 @@
|
|
#include "ops/operation.h"
|
|
|
|
#include "core/partition.h"
|
|
+#include "util/libpartitionmanagerexport.h"
|
|
|
|
#include <QString>
|
|
|
|
@@ -47,7 +48,7 @@ class CheckFileSystemJob;
|
|
|
|
@author Volker Lanz <vl@fidra.de>
|
|
*/
|
|
-class ResizeOperation : public Operation
|
|
+class LIBPARTITIONMANAGERPRIVATE_EXPORT ResizeOperation : public Operation
|
|
{
|
|
friend class OperationStack;
|
|
|
|
diff --git a/src/plugins/dummy/CMakeLists.txt b/src/plugins/dummy/CMakeLists.txt
|
|
index b58b25b..4f54405 100644
|
|
--- a/src/plugins/dummy/CMakeLists.txt
|
|
+++ b/src/plugins/dummy/CMakeLists.txt
|
|
@@ -19,7 +19,7 @@ file (GLOB pmdummybackendplugin_SRCS *.cpp)
|
|
|
|
kde4_add_plugin(pmdummybackendplugin ${pmdummybackendplugin_SRCS})
|
|
|
|
-target_link_libraries(pmdummybackendplugin partitionmanagerprivate ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} ${LIBPARTED_LIBS} ${BLKID_LIBRARIES} ${KDE4_SOLID_LIBS})
|
|
+target_link_libraries(pmdummybackendplugin tribepartitionmanager ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} ${LIBPARTED_LIBS} ${BLKID_LIBRARIES} ${KDE4_SOLID_LIBS})
|
|
|
|
install(TARGETS pmdummybackendplugin DESTINATION ${PLUGIN_INSTALL_DIR})
|
|
install(FILES pmdummybackendplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
|
diff --git a/src/plugins/libparted/CMakeLists.txt b/src/plugins/libparted/CMakeLists.txt
|
|
index 39b93fb..fb48e0e 100644
|
|
--- a/src/plugins/libparted/CMakeLists.txt
|
|
+++ b/src/plugins/libparted/CMakeLists.txt
|
|
@@ -29,9 +29,11 @@ include_directories(${LIBPARTED_INCLUDE_DIR})
|
|
|
|
file (GLOB pmlibpartedbackendplugin_SRCS *.cpp)
|
|
|
|
-kde4_add_plugin(pmlibpartedbackendplugin ${pmlibpartedbackendplugin_SRCS})
|
|
+kde4_add_library(plugintribepmlibparted SHARED ${pmlibpartedbackendplugin_SRCS})
|
|
|
|
-target_link_libraries(pmlibpartedbackendplugin partitionmanagerprivate ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} ${LIBPARTED_LIBS} ${BLKID_LIBRARIES} ${KDE4_SOLID_LIBS})
|
|
+target_link_libraries(plugintribepmlibparted tribepartitionmanager ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} ${LIBPARTED_LIBS} ${BLKID_LIBRARIES} ${KDE4_SOLID_LIBS})
|
|
|
|
-install(TARGETS pmlibpartedbackendplugin DESTINATION ${PLUGIN_INSTALL_DIR})
|
|
+set_target_properties(plugintribepmlibparted PROPERTIES PREFIX "")
|
|
+
|
|
+install(TARGETS plugintribepmlibparted DESTINATION ${PLUGIN_INSTALL_DIR})
|
|
install(FILES pmlibpartedbackendplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
|
diff --git a/src/plugins/libparted/libpartedbackend.cpp b/src/plugins/libparted/libpartedbackend.cpp
|
|
index b14d52a..679762f 100644
|
|
--- a/src/plugins/libparted/libpartedbackend.cpp
|
|
+++ b/src/plugins/libparted/libpartedbackend.cpp
|
|
@@ -20,6 +20,8 @@
|
|
/** @file
|
|
*/
|
|
|
|
+#include <QDebug>
|
|
+
|
|
#include "plugins/libparted/libpartedbackend.h"
|
|
#include "plugins/libparted/libparteddevice.h"
|
|
|
|
@@ -49,15 +51,13 @@
|
|
#include <kpluginfactory.h>
|
|
#include <kaboutdata.h>
|
|
|
|
-#include <solid/device.h>
|
|
-#include <solid/deviceinterface.h>
|
|
-#include <solid/block.h>
|
|
-#include <solid/storagedrive.h>
|
|
-
|
|
#include <parted/parted.h>
|
|
#include <unistd.h>
|
|
#include <blkid/blkid.h>
|
|
|
|
+#include "../../config.h"
|
|
+
|
|
+
|
|
K_PLUGIN_FACTORY(LibPartedBackendFactory, registerPlugin<LibPartedBackend>(); )
|
|
|
|
static KAboutData createPluginAboutData()
|
|
@@ -95,16 +95,19 @@ static struct
|
|
{ PED_PARTITION_HPSERVICE, PartitionTable::FlagHpService },
|
|
{ PED_PARTITION_PALO, PartitionTable::FlagPalo },
|
|
{ PED_PARTITION_PREP, PartitionTable::FlagPrep },
|
|
- { PED_PARTITION_MSFT_RESERVED, PartitionTable::FlagMsftReserved }
|
|
+ { PED_PARTITION_MSFT_RESERVED, PartitionTable::FlagMsftReserved },
|
|
+ { PED_PARTITION_BIOS_GRUB, PartitionTable::FlagBiosGrubBoot }
|
|
};
|
|
|
|
+static QString s_lastPartedExceptionMessage;
|
|
+
|
|
/** Callback to handle exceptions from libparted
|
|
@param e the libparted exception to handle
|
|
*/
|
|
static PedExceptionOption pedExceptionHandler(PedException* e)
|
|
{
|
|
- /** @todo These messages should end up in the Report, not in the GlobalLog. */
|
|
Log(Log::error) << i18nc("@info/plain", "LibParted Exception: %1", QString::fromLocal8Bit(e->message));
|
|
+ s_lastPartedExceptionMessage = QString::fromLocal8Bit(e->message);
|
|
return PED_EXCEPTION_UNHANDLED;
|
|
}
|
|
|
|
@@ -398,9 +401,10 @@ void LibPartedBackend::scanDevicePartitions(PedDevice*, Device& d, PedDisk* pedD
|
|
partitions.append(part);
|
|
}
|
|
|
|
+ Config::instance("partitionmanagerrc");
|
|
d.partitionTable()->updateUnallocated(d);
|
|
|
|
- if (d.partitionTable()->isSectorBased(d))
|
|
+ if (d.partitionTable()->isSectorBased(d))
|
|
d.partitionTable()->setType(d, PartitionTable::msdos_sectorbased);
|
|
|
|
foreach(const Partition* part, partitions)
|
|
@@ -441,62 +445,23 @@ Device* LibPartedBackend::scanDevice(const QString& device_node)
|
|
return d;
|
|
}
|
|
|
|
-static quint32 countDevices(const QList<Solid::Device>& driveList)
|
|
-{
|
|
- quint32 rval = 0;
|
|
-
|
|
- foreach(const Solid::Device& solidDevice, driveList)
|
|
- {
|
|
- (void) solidDevice; // Silence compiler warning.
|
|
-#ifndef ENABLE_UDISKS2
|
|
- const Solid::StorageDrive* solidDrive = solidDevice.as<Solid::StorageDrive>();
|
|
- if (solidDrive->driveType() == Solid::StorageDrive::HardDisk ||
|
|
- solidDrive->driveType() == Solid::StorageDrive::CompactFlash ||
|
|
- solidDrive->driveType() == Solid::StorageDrive::MemoryStick ||
|
|
- solidDrive->driveType() == Solid::StorageDrive::SmartMedia ||
|
|
- solidDrive->driveType() == Solid::StorageDrive::SdMmc ||
|
|
- solidDrive->driveType() == Solid::StorageDrive::Xd)
|
|
-#endif
|
|
- rval++;
|
|
- }
|
|
- return rval;
|
|
-}
|
|
-
|
|
QList<Device*> LibPartedBackend::scanDevices()
|
|
{
|
|
QList<Device*> result;
|
|
|
|
- const QList<Solid::Device> driveList = getSolidDeviceList();
|
|
- const quint32 totalDevices = countDevices(driveList);
|
|
-
|
|
- quint32 count = 0;
|
|
-
|
|
- foreach(const Solid::Device& solidDevice, driveList)
|
|
+ ped_device_probe_all();
|
|
+ PedDevice* pedDevice = NULL;
|
|
+ while (true)
|
|
{
|
|
-#ifndef ENABLE_UDISKS2
|
|
- const Solid::StorageDrive* solidDrive = solidDevice.as<Solid::StorageDrive>();
|
|
-
|
|
- if (solidDrive->driveType() != Solid::StorageDrive::HardDisk &&
|
|
- solidDrive->driveType() != Solid::StorageDrive::CompactFlash &&
|
|
- solidDrive->driveType() != Solid::StorageDrive::MemoryStick &&
|
|
- solidDrive->driveType() != Solid::StorageDrive::SmartMedia &&
|
|
- solidDrive->driveType() != Solid::StorageDrive::SdMmc &&
|
|
- solidDrive->driveType() != Solid::StorageDrive::Xd)
|
|
+ pedDevice = ped_device_get_next(pedDevice);
|
|
+ if (!pedDevice)
|
|
+ break;
|
|
+ if (pedDevice->type == PED_DEVICE_DM)
|
|
continue;
|
|
-#endif
|
|
-
|
|
- const Solid::Block* solidBlock = solidDevice.as<Solid::Block>();
|
|
-
|
|
- Device* d = scanDevice(solidBlock->device());
|
|
- kWarning() << solidBlock->device();
|
|
-
|
|
- if (d != NULL)
|
|
- {
|
|
- d->setIconName(solidDevice.icon());
|
|
+ QString path = QString::fromUtf8(pedDevice->path);
|
|
+ Device* d = scanDevice(path);
|
|
+ if (d)
|
|
result.append(d);
|
|
- }
|
|
-
|
|
- emitScanProgress(solidBlock->device(), (++count) * 100 / totalDevices);
|
|
}
|
|
|
|
return result;
|
|
@@ -605,3 +570,9 @@ PedPartitionFlag LibPartedBackend::getPedFlag(PartitionTable::Flag flag)
|
|
return static_cast<PedPartitionFlag>(-1);
|
|
}
|
|
|
|
+QString LibPartedBackend::lastPartedExceptionMessage()
|
|
+{
|
|
+ return s_lastPartedExceptionMessage;
|
|
+}
|
|
+
|
|
+#include "libpartedbackend.moc"
|
|
diff --git a/src/plugins/libparted/libpartedbackend.h b/src/plugins/libparted/libpartedbackend.h
|
|
index 48cd344..43fcfc6 100644
|
|
--- a/src/plugins/libparted/libpartedbackend.h
|
|
+++ b/src/plugins/libparted/libpartedbackend.h
|
|
@@ -67,6 +67,8 @@ class LibPartedBackend : public CoreBackend
|
|
virtual Device* scanDevice(const QString& device_node);
|
|
virtual QList<Device*> scanDevices();
|
|
|
|
+ static QString lastPartedExceptionMessage();
|
|
+
|
|
private:
|
|
static FileSystem::Type detectFileSystem(PedPartition* pedPartition);
|
|
static PedPartitionFlag getPedFlag(PartitionTable::Flag flag);
|
|
diff --git a/src/plugins/libparted/libpartedpartitiontable.cpp b/src/plugins/libparted/libpartedpartitiontable.cpp
|
|
index d954bfa..4bf66b4 100644
|
|
--- a/src/plugins/libparted/libpartedpartitiontable.cpp
|
|
+++ b/src/plugins/libparted/libpartedpartitiontable.cpp
|
|
@@ -193,7 +193,10 @@ 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() << i18nc("@info/plain", "Failed to add partition <filename>%1</filename> to device <filename>%2</filename>.", partition.deviceNode(), QString::fromUtf8(pedDisk()->dev->path));
|
|
+ report.line() << LibPartedBackend::lastPartedExceptionMessage();
|
|
+ }
|
|
|
|
ped_constraint_destroy(pedConstraint);
|
|
|
|
diff --git a/src/plugins/libparted/pmlibpartedbackendplugin.desktop b/src/plugins/libparted/pmlibpartedbackendplugin.desktop
|
|
index 763df34..05c7c58 100644
|
|
--- a/src/plugins/libparted/pmlibpartedbackendplugin.desktop
|
|
+++ b/src/plugins/libparted/pmlibpartedbackendplugin.desktop
|
|
@@ -88,8 +88,8 @@ Type=Service
|
|
ServiceTypes=PartitionManager/Plugin
|
|
Icon=preferences-plugin
|
|
|
|
-X-KDE-Library=pmlibpartedbackendplugin
|
|
-X-KDE-PluginInfo-Name=pmlibpartedbackendplugin
|
|
+X-KDE-Library=plugintribepmlibparted
|
|
+X-KDE-PluginInfo-Name=plugintribepmlibparted
|
|
X-KDE-PluginInfo-Author=Volker Lanz
|
|
X-KDE-PluginInfo-Email=vl@fidra.de
|
|
X-KDE-PluginInfo-License=GPL
|
|
diff --git a/src/util/capacity.h b/src/util/capacity.h
|
|
index e18e6db..40f50a8 100644
|
|
--- a/src/util/capacity.h
|
|
+++ b/src/util/capacity.h
|
|
@@ -25,15 +25,16 @@ class Partition;
|
|
class Device;
|
|
|
|
#include <qglobal.h>
|
|
+#include "util/libpartitionmanagerexport.h"
|
|
|
|
-/** Represent any kind of capacity.
|
|
+/** @brief Represent any kind of capacity.
|
|
|
|
Any kind of capacity that can be expressed in units of Byte, KiB, MiB and so on. Also prints
|
|
capacities in nicely formatted ways.
|
|
|
|
@author Volker Lanz <vl@fidra.de>
|
|
*/
|
|
-class Capacity
|
|
+class LIBPARTITIONMANAGERPRIVATE_EXPORT Capacity
|
|
{
|
|
public:
|
|
/** Units we can deal with */
|
|
diff --git a/src/util/helpers.cpp b/src/util/helpers.cpp
|
|
index fe55c36..f9f06fc 100644
|
|
--- a/src/util/helpers.cpp
|
|
+++ b/src/util/helpers.cpp
|
|
@@ -191,14 +191,14 @@ void showColumnsContextMenu(const QPoint& p, QTreeWidget& tree)
|
|
|
|
bool loadBackend()
|
|
{
|
|
- if (CoreBackendManager::self()->load(Config::backend()) == false)
|
|
+ if (CoreBackendManager::self()->load("plugintribepmlibparted") == false)
|
|
{
|
|
if (CoreBackendManager::self()->load(CoreBackendManager::defaultBackendName()))
|
|
{
|
|
KMessageBox::sorry(NULL,
|
|
i18nc("@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()),
|
|
+ "tribepmlibparted", CoreBackendManager::defaultBackendName()),
|
|
i18nc("@title:window", "Error: Could Not Load Backend Plugin"));
|
|
Config::setBackend(CoreBackendManager::defaultBackendName());
|
|
}
|
|
@@ -207,7 +207,7 @@ bool loadBackend()
|
|
KMessageBox::error(NULL,
|
|
i18nc("@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()),
|
|
+ "tribepmlibparted", CoreBackendManager::defaultBackendName()),
|
|
i18nc("@title:window", "Error: Could Not Load Backend Plugin"));
|
|
return false;
|
|
}
|
|
@@ -241,30 +241,30 @@ QList<Solid::Device> getSolidDeviceList()
|
|
"[ StorageDrive.driveType == 'SdMmc' OR StorageDrive.driveType == 'Xd'] ]";
|
|
#endif
|
|
|
|
- KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
|
|
- if (args->count() > 0)
|
|
- {
|
|
- predicate = " [ " + predicate + " AND ";
|
|
-
|
|
- qint32 brackets = (args->count() + 1) / 2;
|
|
- brackets = args->count() == 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)
|
|
- {
|
|
- predicate += QString("Block.device == '%1' ").arg(args->arg(i));
|
|
-
|
|
- if (right_bracket)
|
|
- predicate += i == 1 ? "] " : "] ] ";
|
|
- if (i < args->count() - 1)
|
|
- predicate += "OR ";
|
|
- if (right_bracket && i != args->count() - 2 && i != args->count()-1)
|
|
- predicate += "[ ";
|
|
- }
|
|
- predicate += right_bracket && brackets > 0 ? "] ]" : "]";
|
|
- }
|
|
+// KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
|
|
+// if (args->count() > 0)
|
|
+// {
|
|
+// predicate = " [ " + predicate + " AND ";
|
|
+//
|
|
+// qint32 brackets = (args->count() + 1) / 2;
|
|
+// brackets = args->count() == 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)
|
|
+// {
|
|
+// predicate += QString("Block.device == '%1' ").arg(args->arg(i));
|
|
+//
|
|
+// if (right_bracket)
|
|
+// predicate += i == 1 ? "] " : "] ] ";
|
|
+// if (i < args->count() - 1)
|
|
+// predicate += "OR ";
|
|
+// if (right_bracket && i != args->count() - 2 && i != args->count()-1)
|
|
+// predicate += "[ ";
|
|
+// }
|
|
+// predicate += right_bracket && brackets > 0 ? "] ]" : "]";
|
|
+// }
|
|
|
|
return Solid::Device::listFromQuery(predicate);
|
|
}
|