show an error message box if no accessible devices are found on program launch
svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1250081
This commit is contained in:
parent
3cdd18fae5
commit
b4d02bda27
|
@ -51,6 +51,9 @@ int main(int argc, char* argv[])
|
|||
if (!loadBackend())
|
||||
return 0;
|
||||
|
||||
if (!checkAccessibleDevices())
|
||||
return 0;
|
||||
|
||||
MainWindow* mainWindow = new MainWindow();
|
||||
mainWindow->show();
|
||||
|
||||
|
|
|
@ -203,6 +203,20 @@ 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()
|
||||
{
|
||||
QString predicate = "StorageDrive.driveType == 'HardDisk'";
|
||||
|
@ -229,7 +243,5 @@ QList<Solid::Device> getSolidDeviceList()
|
|||
predicate += ']';
|
||||
}
|
||||
|
||||
kDebug() << predicate;
|
||||
|
||||
return Solid::Device::listFromQuery(predicate);
|
||||
}
|
||||
|
|
|
@ -52,4 +52,6 @@ LIBPARTITIONMANAGERPRIVATE_EXPORT bool loadBackend();
|
|||
|
||||
LIBPARTITIONMANAGERPRIVATE_EXPORT QList<Solid::Device> getSolidDeviceList();
|
||||
|
||||
LIBPARTITIONMANAGERPRIVATE_EXPORT bool checkAccessibleDevices();
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue