Complete KF5 port:
* Expose backend versions in a similar manner to backend Id. * Fix configure dialog signals.
This commit is contained in:
parent
02ffa73bb5
commit
d52ea34cf7
|
@ -70,6 +70,12 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT CoreBackend : public QObject
|
|||
*/
|
||||
QString id() { return m_id; }
|
||||
|
||||
/**
|
||||
* Return the plugin's version from JSON metadata
|
||||
* @return the plugin's version from JSON metadata
|
||||
*/
|
||||
QString version() { return m_version; }
|
||||
|
||||
/**
|
||||
* Initialize the plugin's FileSystem support
|
||||
*/
|
||||
|
@ -140,9 +146,10 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT CoreBackend : public QObject
|
|||
|
||||
private:
|
||||
void setId(const QString& id) { m_id = id; }
|
||||
void setVersion(const QString& version) { m_version = version; }
|
||||
|
||||
private:
|
||||
QString m_id;
|
||||
QString m_id, m_version;
|
||||
|
||||
class CoreBackendPrivate;
|
||||
CoreBackendPrivate* d;
|
||||
|
|
|
@ -67,10 +67,13 @@ bool CoreBackendManager::load(const QString& name)
|
|||
|
||||
QString id = loader.metaData().toVariantMap().value(QStringLiteral("MetaData"))
|
||||
.toMap().value(QStringLiteral("KPlugin")).toMap().value(QStringLiteral("Id")).toString();
|
||||
QString version = loader.metaData().toVariantMap().value(QStringLiteral("MetaData"))
|
||||
.toMap().value(QStringLiteral("KPlugin")).toMap().value(QStringLiteral("Version")).toString();
|
||||
if ( id.isEmpty() )
|
||||
return false;
|
||||
|
||||
backend()->setId( id );
|
||||
backend()->setVersion ( version );
|
||||
qDebug() << "Loaded backend plugin: " << backend()->id();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include <QFileDialog>
|
||||
#include <QMenu>
|
||||
#include <QPointer>
|
||||
#include <QPushButton>
|
||||
#include <QReadLocker>
|
||||
#include <QStatusBar>
|
||||
#include <QTemporaryFile>
|
||||
|
@ -538,10 +539,9 @@ void MainWindow::on_m_PartitionManagerWidget_selectedPartitionChanged(const Part
|
|||
|
||||
void MainWindow::scanDevices()
|
||||
{
|
||||
// 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(Log::information) << i18nc("@info/plain", "Using backend plugin: %1 (%2)",
|
||||
CoreBackendManager::self()->backend()->id(),
|
||||
CoreBackendManager::self()->backend()->version());
|
||||
|
||||
Log() << i18nc("@info/plain", "Scanning devices...");
|
||||
|
||||
|
@ -941,7 +941,6 @@ void MainWindow::onFileSystemSupport()
|
|||
|
||||
void MainWindow::onSettingsChanged()
|
||||
{
|
||||
// FIXME: port KF5
|
||||
if (CoreBackendManager::self()->backend()->id() != Config::backend())
|
||||
{
|
||||
CoreBackendManager::self()->unload();
|
||||
|
@ -972,9 +971,8 @@ void MainWindow::onConfigureOptions()
|
|||
// FIXME: we'd normally use settingsChanged(), according to the kde api docs. however, this
|
||||
// is emitted each time the user changes any of our own settings (backend, default file system), without
|
||||
// applying or clicking ok. so the below is the workaround for that.
|
||||
// FIXME: port KF5
|
||||
connect(dlg, SIGNAL(applyClicked()), SLOT(onSettingsChanged()));
|
||||
connect(dlg, SIGNAL(okClicked()), SLOT(onSettingsChanged()));
|
||||
connect(dlg->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, &MainWindow::onSettingsChanged);
|
||||
connect(dlg->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &MainWindow::onSettingsChanged);
|
||||
|
||||
dlg->show();
|
||||
}
|
||||
|
|
|
@ -42,19 +42,6 @@ PartWidget::PartWidget(QWidget* parent, const Partition* p) :
|
|||
m_Active(false)
|
||||
{
|
||||
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)
|
||||
//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);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ QString HtmlReport::header()
|
|||
s << "<table>\n"
|
||||
<< tableLine(i18n("Date:"), QLocale().toString(QDateTime::currentDateTime(), QLocale::ShortFormat))
|
||||
<< tableLine(i18n("Program version:"), QCoreApplication::applicationVersion())
|
||||
// << tableLine(i18n("Backend:"), QString("%1 (%2)").arg(CoreBackendManager::self()->backend()->about().displayName()).arg(CoreBackendManager::self()->backend()->about().version())) /* FIXME: port KF5 */
|
||||
<< tableLine(i18n("Backend:"), QStringLiteral("%1 (%2)").arg(CoreBackendManager::self()->backend()->id()).arg(CoreBackendManager::self()->backend()->version()))
|
||||
<< tableLine(i18n("KDE Frameworks version:"), QStringLiteral(KXMLGUI_VERSION_STRING))
|
||||
<< tableLine(i18n("Machine:"), unameString)
|
||||
<< "</table>\n<br/>\n";
|
||||
|
|
Loading…
Reference in New Issue