]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Add option to shutdown after rendering, only works for KDE sessions:
[kdenlive] / src / mainwindow.cpp
index fbab57bc184afd3fe85714194c96241e3e0c9bd5..5c2f461ea2acbd4727b9afbef6fadac24b5dbc71 100644 (file)
@@ -1669,6 +1669,7 @@ void MainWindow::slotRenderProject()
     if (!m_renderWidget) {
         QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) : KdenliveSettings::defaultprojectfolder();
         m_renderWidget = new RenderWidget(projectfolder, this);
+        connect(m_renderWidget, SIGNAL(shutdown()), this, SLOT(slotShutdown()));
         connect(m_renderWidget, SIGNAL(selectedRenderProfile(const QString &, const QString &, const QString&)), this, SLOT(slotSetDocumentRenderProfile(const QString &, const QString &, const QString&)));
         connect(m_renderWidget, SIGNAL(prepareRenderingData(bool, bool, const QString&)), this, SLOT(slotPrepareRendering(bool, bool, const QString&)));
         connect(m_renderWidget, SIGNAL(abortProcess(const QString &)), this, SIGNAL(abortRenderJob(const QString &)));
@@ -2861,4 +2862,16 @@ void MainWindow::slotRevert()
     doOpenFile(url, NULL);
 }
 
+
+void MainWindow::slotShutdown()
+{
+    if (m_activeDocument) m_activeDocument->setModified(false);
+    // Call shutdown
+    QDBusConnectionInterface* interface = QDBusConnection::sessionBus().interface();
+    if (interface && interface->isServiceRegistered("org.kde.ksmserver")) {
+        QDBusInterface smserver("org.kde.ksmserver", "/KSMServer", "org.kde.KSMServerInterface");
+        smserver.call("logout", 1, 2, 2);
+    }
+}
+
 #include "mainwindow.moc"