Remove remaining dependencies on Solid.
This commit is contained in:
parent
5ca8d30570
commit
af6917f359
|
@ -45,11 +45,6 @@ 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/)
|
||||
|
||||
add_subdirectory(lib)
|
||||
|
|
|
@ -51,9 +51,6 @@ int main(int argc, char* argv[])
|
|||
if (!loadBackend())
|
||||
return 0;
|
||||
|
||||
if (!checkAccessibleDevices())
|
||||
return 0;
|
||||
|
||||
MainWindow* mainWindow = new MainWindow();
|
||||
mainWindow->show();
|
||||
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
#include <kmenu.h>
|
||||
#include <kstringhandler.h>
|
||||
|
||||
#include <solid/device.h>
|
||||
|
||||
#include <QProcess>
|
||||
#include <QFileInfo>
|
||||
#include <QApplication>
|
||||
|
@ -215,56 +213,3 @@ bool loadBackend()
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool checkAccessibleDevices()
|
||||
{
|
||||
if (getSolidDeviceList().empty())
|
||||
{
|
||||
KMessageBox::error(NULL,
|
||||
i18nc("@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;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<Solid::Device> getSolidDeviceList()
|
||||
{
|
||||
#ifdef ENABLE_UDISKS2
|
||||
QString predicate = "StorageVolume.usage == 'PartitionTable'";
|
||||
|
||||
#else
|
||||
QString predicate = "[ [ [ StorageDrive.driveType == 'HardDisk' OR StorageDrive.driveType == 'CompactFlash'] OR "
|
||||
"[ StorageDrive.driveType == 'MemoryStick' OR StorageDrive.driveType == 'SmartMedia'] ] OR "
|
||||
"[ 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 ? "] ]" : "]";
|
||||
}
|
||||
|
||||
return Solid::Device::listFromQuery(predicate);
|
||||
}
|
||||
|
|
|
@ -31,11 +31,6 @@ class QIcon;
|
|||
class QPoint;
|
||||
class QTreeWidget;
|
||||
|
||||
namespace Solid
|
||||
{
|
||||
class Device;
|
||||
}
|
||||
|
||||
LIBPARTITIONMANAGERPRIVATE_EXPORT void registerMetaTypes();
|
||||
LIBPARTITIONMANAGERPRIVATE_EXPORT bool checkPermissions();
|
||||
|
||||
|
@ -50,8 +45,6 @@ LIBPARTITIONMANAGERPRIVATE_EXPORT void showColumnsContextMenu(const QPoint& p, Q
|
|||
|
||||
LIBPARTITIONMANAGERPRIVATE_EXPORT bool loadBackend();
|
||||
|
||||
LIBPARTITIONMANAGERPRIVATE_EXPORT QList<Solid::Device> getSolidDeviceList();
|
||||
|
||||
LIBPARTITIONMANAGERPRIVATE_EXPORT bool checkAccessibleDevices();
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue