fix #934,change quit button to close button

--exhausted to discuss this so often so in the
end it may be my perspective wrong. Quit button
in dock settings window changed to Close button
and the Quit option moved to menu bar of the
general Latte settings window with shortcut
Ctrl+Q
pull/2/head
Michail Vourlakos
parent 5c164f671c
commit eb3feb4a4e

@ -1722,30 +1722,6 @@ QList<int> DockView::freeEdges() const
return edgesInt;
}
void DockView::closeApplication()
{
//! this code must be called asynchronously because it is called
//! also from qml (Settings window).
QTimer::singleShot(50, [this]() {
DockCorona *dockCorona = qobject_cast<DockCorona *>(this->corona());
DockConfigView *configView = qobject_cast<DockConfigView *>(m_configView);
if (configView) {
configView->hideConfigWindow();
} else if (m_configView) {
m_configView->close();
}
if (dockCorona) {
dockCorona->layoutManager()->hideAllDocks();
}
if (dockCorona)
dockCorona->closeApplication();
});
}
void DockView::deactivateApplets()
{
if (!containment()) {

@ -230,8 +230,6 @@ public slots:
Q_INVOKABLE bool tasksPresent();
Q_INVOKABLE bool latteTasksPresent();
Q_INVOKABLE void closeApplication();
void updateAbsDockGeometry(bool bypassChecks = false);
protected slots:

@ -626,8 +626,15 @@ int DockCorona::primaryScreenId() const
void DockCorona::closeApplication()
{
//! this code must be called asynchronously because it is called
//! also from qml (Settings window).
QTimer::singleShot(5, [this]() {
m_layoutManager->hideLatteSettingsDialog();
m_layoutManager->hideAllDocks();
});
//! give the time for the docks to hide themselves
QTimer::singleShot(400, [this]() {
QTimer::singleShot(500, [this]() {
qGuiApp->quit();
});
}

@ -1160,6 +1160,14 @@ void LayoutManager::showLatteSettingsDialog(int page)
m_latteSettingsDialog->activateWindow();
}
void LayoutManager::hideLatteSettingsDialog()
{
if (m_latteSettingsDialog) {
m_latteSettingsDialog->deleteLater();
m_latteSettingsDialog = nullptr;
}
}
void LayoutManager::showInfoWindow(QString info, int duration, QStringList activities)
{
foreach (auto screen, qGuiApp->screens()) {

@ -112,6 +112,7 @@ public slots:
void showAboutDialog();
void updateColorizerSupport();
void hideLatteSettingsDialog();
Q_INVOKABLE void showLatteSettingsDialog(int page = Latte::Dock::LayoutPage);
//! switch to specified layout, default previousMemoryUsage means that it didnt change

@ -119,13 +119,21 @@ SettingsDialog::SettingsDialog(QWidget *parent, DockCorona *corona)
//! About Menu
QMenuBar *menuBar = new QMenuBar(this);
QMenuBar *rightAlignedMenuBar = new QMenuBar(menuBar);
// QMenuBar *rightAlignedMenuBar = new QMenuBar(menuBar);
layout()->setMenuBar(menuBar);
menuBar->setCornerWidget(rightAlignedMenuBar);
//menuBar->setCornerWidget(rightAlignedMenuBar);
QMenu *helpMenu = new QMenu(i18n("Help"), rightAlignedMenuBar);
rightAlignedMenuBar->addMenu(helpMenu);
QMenu *fileMenu = new QMenu(i18n("File"), menuBar);
menuBar->addMenu(fileMenu);
QMenu *helpMenu = new QMenu(i18n("Help"), menuBar);
//rightAlignedMenuBar->addMenu(helpMenu);
menuBar->addMenu(helpMenu);
QAction *quitAction = fileMenu->addAction(i18n("Quit Latte"));
quitAction->setIcon(QIcon::fromTheme("application-exit"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
QAction *aboutAction = helpMenu->addAction(i18n("About Latte"));
aboutAction->setIcon(QIcon::fromTheme("latte-dock"));
@ -163,6 +171,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, DockCorona *corona)
});
connect(aboutAction, &QAction::triggered, m_corona, &DockCorona::aboutApplication);
connect(quitAction, &QAction::triggered, m_corona, &DockCorona::closeApplication);
//! update all layouts view when runningActivities changed. This way we update immediately
//! the running Activities in Activities checkboxes which are shown as bold

@ -496,16 +496,16 @@ FocusScope {
}
PlasmaComponents.Button {
id: quit
id: closeButton
Layout.fillWidth: true
Layout.alignment: Qt.AlignRight
text: i18n("Quit")
iconSource: "application-exit"
tooltip: i18n("Quit Latte")
text: i18n("Close")
iconSource: "dialog-close"
tooltip: i18n("Close settings window")
onClicked: dock.closeApplication()
onClicked: dockConfig.hideConfigWindow();
}
}
}

Loading…
Cancel
Save