fix #85, removing Dock crashes Latte

v0.6
audoban 8 years ago
parent 280a6b4891
commit 5ab037a22a

@ -41,6 +41,7 @@ target_link_libraries(
Qt5::Qml Qt5::Qml
Qt5::X11Extras Qt5::X11Extras
KF5::I18n KF5::I18n
KF5::Declarative
KF5::CoreAddons KF5::CoreAddons
KF5::XmlGui KF5::XmlGui
KF5::Plasma KF5::Plasma

@ -28,6 +28,7 @@
#include <QScreen> #include <QScreen>
#include <KLocalizedContext> #include <KLocalizedContext>
#include <KDeclarative/KDeclarative>
#include <KWindowSystem> #include <KWindowSystem>
#include <KWindowEffects> #include <KWindowEffects>
@ -76,7 +77,10 @@ void DockConfigView::init()
setColor(Qt::transparent); setColor(Qt::transparent);
rootContext()->setContextProperty(QStringLiteral("dock"), m_dockView); rootContext()->setContextProperty(QStringLiteral("dock"), m_dockView);
rootContext()->setContextProperty(QStringLiteral("dockConfig"), this); rootContext()->setContextProperty(QStringLiteral("dockConfig"), this);
rootContext()->setContextObject(new KLocalizedContext(this)); KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine());
kdeclarative.setTranslationDomain(QStringLiteral("latte-dock"));
kdeclarative.setupBindings();
auto source = QUrl::fromLocalFile(m_dockView->containment()->corona()->kPackage().filePath("lattedockconfigurationui")); auto source = QUrl::fromLocalFile(m_dockView->containment()->corona()->kPackage().filePath("lattedockconfigurationui"));
setSource(source); setSource(source);
syncSlideEffect(); syncSlideEffect();

@ -83,9 +83,8 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
}, Qt::DirectConnection); }, Qt::DirectConnection);
auto *dockCorona = qobject_cast<DockCorona *>(this->corona()); auto *dockCorona = qobject_cast<DockCorona *>(this->corona());
if (dockCorona) { if (dockCorona)
connect(dockCorona, &DockCorona::docksCountChanged, this, &DockView::docksCountChanged); connect(dockCorona, &DockCorona::docksCountChanged, this, &DockView::docksCountChanged);
}
} }
DockView::~DockView() DockView::~DockView()
@ -115,7 +114,6 @@ void DockView::init()
updateFormFactor(); updateFormFactor();
syncGeometry(); syncGeometry();
}); });
engine()->rootContext()->setContextObject(new KLocalizedContext(this));
rootContext()->setContextProperty(QStringLiteral("dock"), this); rootContext()->setContextProperty(QStringLiteral("dock"), this);
setSource(corona()->kPackage().filePath("lattedockui")); setSource(corona()->kPackage().filePath("lattedockui"));
setVisible(true); setVisible(true);

@ -45,9 +45,9 @@ int main(int argc, char **argv)
{ {
QQuickWindow::setDefaultAlphaBuffer(true); QQuickWindow::setDefaultAlphaBuffer(true);
QApplication app(argc, argv); QApplication app(argc, argv);
KLocalizedString::setApplicationDomain("latte-dock");
app.setApplicationVersion(version); app.setApplicationVersion(version);
app.setOrganizationDomain(QStringLiteral("latte-dock")); app.setOrganizationDomain(QStringLiteral("latte-dock"));
KLocalizedString::setApplicationDomain("latte-dock");
app.setApplicationName(QStringLiteral("lattedock")); app.setApplicationName(QStringLiteral("lattedock"));
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("latte-dock"))); app.setWindowIcon(QIcon::fromTheme(QStringLiteral("latte-dock")));
//! set pattern for debug messages //! set pattern for debug messages

Loading…
Cancel
Save