|
|
|
@ -45,11 +45,9 @@
|
|
|
|
|
#include <QMimeData>
|
|
|
|
|
|
|
|
|
|
// KDE
|
|
|
|
|
#include <KActivities/Controller>
|
|
|
|
|
#include <KIO/OpenFileManagerWindowJob>
|
|
|
|
|
#include <KLocalizedString>
|
|
|
|
|
#include <KWindowSystem>
|
|
|
|
|
#include <KNewStuff3/KNS3/DownloadDialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define TWINENABLED "Enabled"
|
|
|
|
@ -82,59 +80,21 @@ SettingsDialog::SettingsDialog(QWidget *parent, Latte::Corona *corona)
|
|
|
|
|
connect(m_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked
|
|
|
|
|
, this, &SettingsDialog::restoreDefaults);
|
|
|
|
|
|
|
|
|
|
//! Global Menu
|
|
|
|
|
initGlobalMenu();
|
|
|
|
|
|
|
|
|
|
m_tabLayoutsHandler = new Settings::Handler::TabLayouts(this);
|
|
|
|
|
m_preferencesHandler = new Settings::Handler::Preferences(this);
|
|
|
|
|
|
|
|
|
|
m_layoutsController = new Settings::Controller::Layouts(m_tabLayoutsHandler);
|
|
|
|
|
|
|
|
|
|
m_inMemoryButtons = new QButtonGroup(this);
|
|
|
|
|
m_inMemoryButtons->addButton(m_ui->singleToolBtn, Latte::Types::SingleLayout);
|
|
|
|
|
m_inMemoryButtons->addButton(m_ui->multipleToolBtn, Latte::Types::MultipleLayouts);
|
|
|
|
|
m_inMemoryButtons->setExclusive(true);
|
|
|
|
|
|
|
|
|
|
if (KWindowSystem::isPlatformWayland()) {
|
|
|
|
|
m_inMemoryButtons->button(Latte::Types::MultipleLayouts)->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_ui->messageWidget->setVisible(false);
|
|
|
|
|
|
|
|
|
|
//! Global Menu
|
|
|
|
|
initGlobalMenu();
|
|
|
|
|
|
|
|
|
|
m_ui->buttonBox->button(QDialogButtonBox::Apply)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
|
|
|
|
|
m_ui->buttonBox->button(QDialogButtonBox::Reset)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
|
|
|
|
|
|
|
|
|
|
m_openUrlAction = new QAction(i18n("Open Location..."), this);
|
|
|
|
|
connect(m_openUrlAction, &QAction::triggered, this, [&]() {
|
|
|
|
|
QString file = m_openUrlAction->data().toString();
|
|
|
|
|
|
|
|
|
|
if (!file.isEmpty()) {
|
|
|
|
|
KIO::highlightInFileManager({file});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
loadSettings();
|
|
|
|
|
|
|
|
|
|
//! SIGNALS
|
|
|
|
|
connect(m_ui->layoutsView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, [&]() {
|
|
|
|
|
updatePerLayoutButtonsState();
|
|
|
|
|
updateApplyButtonsState();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(m_layoutsController, &Settings::Controller::Layouts::dataChanged, this, [&]() {
|
|
|
|
|
updateApplyButtonsState();
|
|
|
|
|
updatePerLayoutButtonsState();
|
|
|
|
|
});
|
|
|
|
|
connect(m_ui->tabWidget, &QTabWidget::currentChanged, this, &SettingsDialog::updateApplyButtonsState);
|
|
|
|
|
|
|
|
|
|
connect(m_inMemoryButtons, static_cast<void(QButtonGroup::*)(int, bool)>(&QButtonGroup::buttonToggled),
|
|
|
|
|
[ = ](int id, bool checked) {
|
|
|
|
|
|
|
|
|
|
if (checked) {
|
|
|
|
|
m_layoutsController->setInMultipleMode(id == Latte::Types::MultipleLayouts);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(m_ui->tabWidget, &QTabWidget::currentChanged, this, &SettingsDialog::on_currentPageChanged);
|
|
|
|
|
connect(m_tabLayoutsHandler, &Settings::Handler::TabLayouts::dataChanged, this, &SettingsDialog::updateApplyButtonsState);
|
|
|
|
|
|
|
|
|
|
connect(m_preferencesHandler, &Settings::Handler::Preferences::dataChanged, this, &SettingsDialog::updateApplyButtonsState);
|
|
|
|
|
connect(m_preferencesHandler, &Settings::Handler::Preferences::borderlessMaximizedChanged, this, [&]() {
|
|
|
|
@ -157,12 +117,13 @@ SettingsDialog::SettingsDialog(QWidget *parent, Latte::Corona *corona)
|
|
|
|
|
m_hideInlineMessageTimer.setInterval(2000);
|
|
|
|
|
connect(&m_hideInlineMessageTimer, &QTimer::timeout, this, [&]() {
|
|
|
|
|
m_ui->messageWidget->animatedHide();
|
|
|
|
|
m_ui->messageWidget->removeAction(m_openUrlAction);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(m_ui->messageWidget, &KMessageWidget::hideAnimationFinished, this, [&]() {
|
|
|
|
|
m_ui->messageWidget->removeAction(m_openUrlAction);
|
|
|
|
|
clearCurrentMessageActions();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
updateApplyButtonsState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SettingsDialog::~SettingsDialog()
|
|
|
|
@ -179,96 +140,9 @@ void SettingsDialog::initGlobalMenu()
|
|
|
|
|
layout()->setMenuBar(m_globalMenuBar);
|
|
|
|
|
|
|
|
|
|
initFileMenu();
|
|
|
|
|
initLayoutMenu();
|
|
|
|
|
initHelpMenu();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::initLayoutMenu()
|
|
|
|
|
{
|
|
|
|
|
if (!m_layoutMenu) {
|
|
|
|
|
m_layoutMenu = new QMenu(i18n("Layout"), m_globalMenuBar);
|
|
|
|
|
m_globalMenuBar->addMenu(m_layoutMenu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_switchLayoutAction = m_layoutMenu->addAction(i18nc("switch layout","Switch"));
|
|
|
|
|
m_switchLayoutAction->setToolTip(i18n("Switch to selected layout"));
|
|
|
|
|
m_switchLayoutAction->setIcon(QIcon::fromTheme("user-identity"));
|
|
|
|
|
m_switchLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Tab));
|
|
|
|
|
twinActionWithButton(m_ui->switchButton, m_switchLayoutAction);
|
|
|
|
|
connect(m_switchLayoutAction, &QAction::triggered, this, &SettingsDialog::on_switch_layout);
|
|
|
|
|
|
|
|
|
|
m_pauseLayoutAction = m_layoutMenu->addAction(i18nc("pause layout", "&Pause"));
|
|
|
|
|
m_pauseLayoutAction->setToolTip(i18n("Switch to selected layout"));
|
|
|
|
|
m_pauseLayoutAction->setIcon(QIcon::fromTheme("media-playback-pause"));
|
|
|
|
|
m_pauseLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
|
|
|
|
|
twinActionWithButton(m_ui->pauseButton, m_pauseLayoutAction);
|
|
|
|
|
connect(m_pauseLayoutAction, &QAction::triggered, this, &SettingsDialog::on_pause_layout);
|
|
|
|
|
|
|
|
|
|
m_layoutMenu->addSeparator();
|
|
|
|
|
|
|
|
|
|
m_newLayoutAction = m_layoutMenu->addAction(i18nc("new layout", "&New"));
|
|
|
|
|
m_newLayoutAction->setToolTip(i18n("New layout"));
|
|
|
|
|
m_newLayoutAction->setIcon(QIcon::fromTheme("add"));
|
|
|
|
|
m_newLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
|
|
|
|
|
twinActionWithButton(m_ui->newButton, m_newLayoutAction);
|
|
|
|
|
connect(m_newLayoutAction, &QAction::triggered, this, &SettingsDialog::on_new_layout);
|
|
|
|
|
|
|
|
|
|
m_copyLayoutAction = m_layoutMenu->addAction(i18nc("copy layout", "&Copy"));
|
|
|
|
|
m_copyLayoutAction->setToolTip(i18n("Copy selected layout"));
|
|
|
|
|
m_copyLayoutAction->setIcon(QIcon::fromTheme("edit-copy"));
|
|
|
|
|
m_copyLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
|
|
|
|
|
twinActionWithButton(m_ui->copyButton, m_copyLayoutAction);
|
|
|
|
|
connect(m_copyLayoutAction, &QAction::triggered, this, &SettingsDialog::on_copy_layout);
|
|
|
|
|
|
|
|
|
|
m_removeLayoutAction = m_layoutMenu->addAction(i18nc("remove layout", "Remove"));
|
|
|
|
|
m_removeLayoutAction->setToolTip(i18n("Remove selected layout"));
|
|
|
|
|
m_removeLayoutAction->setIcon(QIcon::fromTheme("delete"));
|
|
|
|
|
m_removeLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
|
|
|
|
|
twinActionWithButton(m_ui->removeButton, m_removeLayoutAction);
|
|
|
|
|
connect(m_removeLayoutAction, &QAction::triggered, this, &SettingsDialog::on_remove_layout);
|
|
|
|
|
|
|
|
|
|
m_layoutMenu->addSeparator();
|
|
|
|
|
|
|
|
|
|
m_lockedLayoutAction = m_layoutMenu->addAction(i18nc("locked layout", "&Locked"));
|
|
|
|
|
m_lockedLayoutAction->setToolTip(i18n("Lock/Unlock selected layout and make it read-only"));
|
|
|
|
|
m_lockedLayoutAction->setIcon(QIcon::fromTheme("object-locked"));
|
|
|
|
|
m_lockedLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
|
|
|
|
|
m_lockedLayoutAction->setCheckable(true);
|
|
|
|
|
twinActionWithButton(m_ui->lockedButton, m_lockedLayoutAction);
|
|
|
|
|
connect(m_lockedLayoutAction, &QAction::triggered, this, &SettingsDialog::on_locked_layout);
|
|
|
|
|
|
|
|
|
|
m_sharedLayoutAction = m_layoutMenu->addAction(i18nc("shared layout", "Sha&red"));
|
|
|
|
|
m_sharedLayoutAction->setToolTip(i18n("Share selected layout with other central layouts"));
|
|
|
|
|
m_sharedLayoutAction->setIcon(QIcon::fromTheme("document-share"));
|
|
|
|
|
m_sharedLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
|
|
|
|
|
m_sharedLayoutAction->setCheckable(true);
|
|
|
|
|
twinActionWithButton(m_ui->sharedButton, m_sharedLayoutAction);
|
|
|
|
|
connect(m_sharedLayoutAction, &QAction::triggered, this, &SettingsDialog::on_shared_layout);
|
|
|
|
|
|
|
|
|
|
m_layoutMenu->addSeparator();
|
|
|
|
|
|
|
|
|
|
m_importLayoutAction = m_layoutMenu->addAction(i18nc("import layout", "&Import..."));
|
|
|
|
|
m_importLayoutAction->setToolTip(i18n("Import layout file from your system"));
|
|
|
|
|
m_importLayoutAction->setIcon(QIcon::fromTheme("document-import"));
|
|
|
|
|
m_importLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I));
|
|
|
|
|
twinActionWithButton(m_ui->importButton, m_importLayoutAction);
|
|
|
|
|
connect(m_importLayoutAction, &QAction::triggered, this, &SettingsDialog::on_import_layout);
|
|
|
|
|
|
|
|
|
|
m_exportLayoutAction = m_layoutMenu->addAction(i18nc("export layout", "&Export..."));
|
|
|
|
|
m_exportLayoutAction->setToolTip(i18n("Export selected layout at your system"));
|
|
|
|
|
m_exportLayoutAction->setIcon(QIcon::fromTheme("document-export"));
|
|
|
|
|
m_exportLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_E));
|
|
|
|
|
twinActionWithButton(m_ui->exportButton, m_exportLayoutAction);
|
|
|
|
|
connect(m_exportLayoutAction, &QAction::triggered, this, &SettingsDialog::on_export_layout);
|
|
|
|
|
|
|
|
|
|
m_downloadLayoutAction = m_layoutMenu->addAction(i18nc("download layout", "&Download..."));
|
|
|
|
|
m_downloadLayoutAction->setToolTip(i18n("Download community layouts from KDE Store"));
|
|
|
|
|
m_downloadLayoutAction->setIcon(QIcon::fromTheme("get-hot-new-stuff"));
|
|
|
|
|
m_downloadLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D));
|
|
|
|
|
twinActionWithButton(m_ui->downloadButton, m_downloadLayoutAction);
|
|
|
|
|
connect(m_downloadLayoutAction, &QAction::triggered, this, &SettingsDialog::on_download_layout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::initFileMenu()
|
|
|
|
|
{
|
|
|
|
|
if (!m_fileMenu) {
|
|
|
|
@ -329,36 +203,9 @@ Ui::SettingsDialog *SettingsDialog::ui() const
|
|
|
|
|
return m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::twinActionWithButton(QPushButton *button, QAction *action)
|
|
|
|
|
QMenuBar *SettingsDialog::appMenuBar() const
|
|
|
|
|
{
|
|
|
|
|
button->setText(action->text());
|
|
|
|
|
button->setToolTip(action->toolTip());
|
|
|
|
|
button->setWhatsThis(action->whatsThis());
|
|
|
|
|
button->setIcon(action->icon());
|
|
|
|
|
button->setCheckable(action->isCheckable());
|
|
|
|
|
button->setChecked(action->isChecked());
|
|
|
|
|
|
|
|
|
|
m_twinActions[action] = button;
|
|
|
|
|
|
|
|
|
|
connect(button, &QPushButton::clicked, action, &QAction::trigger);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::setTwinProperty(QAction *action, const QString &property, QVariant value)
|
|
|
|
|
{
|
|
|
|
|
if (!m_twinActions.contains(action)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (property == TWINVISIBLE) {
|
|
|
|
|
action->setVisible(value.toBool());
|
|
|
|
|
m_twinActions[action]->setVisible(value.toBool());
|
|
|
|
|
} else if (property == TWINENABLED) {
|
|
|
|
|
action->setEnabled(value.toBool());
|
|
|
|
|
m_twinActions[action]->setEnabled(value.toBool());
|
|
|
|
|
} else if (property == TWINCHECKED) {
|
|
|
|
|
action->setChecked(value.toBool());
|
|
|
|
|
m_twinActions[action]->setChecked(value.toBool());
|
|
|
|
|
}
|
|
|
|
|
return m_globalMenuBar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Types::LatteConfigPage SettingsDialog::currentPage()
|
|
|
|
@ -382,194 +229,6 @@ void SettingsDialog::setCurrentPage(int page)
|
|
|
|
|
m_ui->tabWidget->setCurrentIndex(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_currentPageChanged(int page)
|
|
|
|
|
{
|
|
|
|
|
Types::LatteConfigPage cPage= static_cast<Types::LatteConfigPage>(page);
|
|
|
|
|
|
|
|
|
|
if (cPage == Types::LayoutPage) {
|
|
|
|
|
m_layoutMenu->setEnabled(true);
|
|
|
|
|
m_layoutMenu->menuAction()->setVisible(true);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
m_layoutMenu->menuAction()->setVisible(false);
|
|
|
|
|
m_layoutMenu->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateApplyButtonsState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_new_layout()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << Q_FUNC_INFO;
|
|
|
|
|
|
|
|
|
|
if (!m_layoutMenu->isEnabled() || !m_newLayoutAction->isEnabled() || currentPage() != Types::LayoutPage) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! find Default preset path
|
|
|
|
|
for (const auto &preset : m_corona->layoutsManager()->presetsPaths()) {
|
|
|
|
|
QString presetName = CentralLayout::layoutName(preset);
|
|
|
|
|
|
|
|
|
|
if (presetName == "Default") {
|
|
|
|
|
Settings::Data::Layout newlayout = m_layoutsController->addLayoutForFile(preset, presetName, true);
|
|
|
|
|
showInlineMessage(i18nc("settings:layout added successfully","Layout <b>%0</b> added successfully...").arg(newlayout.name),
|
|
|
|
|
KMessageWidget::Information,
|
|
|
|
|
SettingsDialog::INFORMATIONINTERVAL);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_copy_layout()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << Q_FUNC_INFO;
|
|
|
|
|
|
|
|
|
|
if (!m_layoutMenu->isEnabled() || !m_copyLayoutAction->isEnabled() || currentPage() != Types::LayoutPage) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_layoutsController->copySelectedLayout();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_download_layout()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << Q_FUNC_INFO;
|
|
|
|
|
|
|
|
|
|
if (!m_layoutMenu->isEnabled() || !m_downloadLayoutAction->isEnabled() || currentPage() != Types::LayoutPage) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KNS3::DownloadDialog dialog(QStringLiteral("latte-layouts.knsrc"), this);
|
|
|
|
|
dialog.resize(m_corona->universalSettings()->downloadWindowSize());
|
|
|
|
|
dialog.exec();
|
|
|
|
|
|
|
|
|
|
if (!dialog.changedEntries().isEmpty() || !dialog.installedEntries().isEmpty()) {
|
|
|
|
|
for (const auto &entry : dialog.installedEntries()) {
|
|
|
|
|
for (const auto &entryFile : entry.installedFiles()) {
|
|
|
|
|
Layouts::Importer::LatteFileVersion version = Layouts::Importer::fileVersion(entryFile);
|
|
|
|
|
|
|
|
|
|
if (version == Layouts::Importer::LayoutVersion2) {
|
|
|
|
|
Settings::Data::Layout downloaded = m_layoutsController->addLayoutForFile(entryFile);
|
|
|
|
|
showInlineMessage(i18nc("settings:layout downloaded successfully","Layout <b>%0</b> downloaded successfully...").arg(downloaded.name),
|
|
|
|
|
KMessageWidget::Information,
|
|
|
|
|
SettingsDialog::INFORMATIONINTERVAL);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_corona->universalSettings()->setDownloadWindowSize(dialog.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_remove_layout()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << Q_FUNC_INFO;
|
|
|
|
|
|
|
|
|
|
if (!m_layoutMenu->isEnabled() || !m_removeLayoutAction->isEnabled() || currentPage() != Types::LayoutPage) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!m_layoutsController->hasSelectedLayout()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Settings::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData();
|
|
|
|
|
|
|
|
|
|
if (selectedLayout.isActive) {
|
|
|
|
|
showInlineMessage(i18nc("settings: active layout remove","<b>Active</b> layouts can not be removed..."),
|
|
|
|
|
KMessageWidget::Error,
|
|
|
|
|
SettingsDialog::WARNINGINTERVAL);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (selectedLayout.isLocked) {
|
|
|
|
|
showInlineMessage(i18nc("settings: locked layout remove","Locked layouts can not be removed..."),
|
|
|
|
|
KMessageWidget::Error,
|
|
|
|
|
SettingsDialog::WARNINGINTERVAL);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qDebug() << Q_FUNC_INFO;
|
|
|
|
|
|
|
|
|
|
m_layoutsController->removeSelected();
|
|
|
|
|
|
|
|
|
|
updateApplyButtonsState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_locked_layout()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << Q_FUNC_INFO;
|
|
|
|
|
|
|
|
|
|
if (!m_layoutMenu->isEnabled() || !m_lockedLayoutAction->isEnabled() || currentPage() != Types::LayoutPage) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_layoutsController->toggleLockedForSelected();
|
|
|
|
|
|
|
|
|
|
updatePerLayoutButtonsState();
|
|
|
|
|
updateApplyButtonsState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_shared_layout()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << Q_FUNC_INFO;
|
|
|
|
|
|
|
|
|
|
if (!m_layoutMenu->isEnabled() || !m_sharedLayoutAction->isEnabled() || currentPage() != Types::LayoutPage) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_layoutsController->toggleSharedForSelected();
|
|
|
|
|
|
|
|
|
|
updatePerLayoutButtonsState();
|
|
|
|
|
updateApplyButtonsState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_import_layout()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << Q_FUNC_INFO;
|
|
|
|
|
|
|
|
|
|
if (!m_layoutMenu->isEnabled() || !m_importLayoutAction->isEnabled() || currentPage() != Types::LayoutPage) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QFileDialog *importFileDialog = new QFileDialog(this, i18nc("import layout", "Import Layout")
|
|
|
|
|
, QDir::homePath()
|
|
|
|
|
, QStringLiteral("layout.latte"));
|
|
|
|
|
|
|
|
|
|
importFileDialog->setWindowIcon(QIcon::fromTheme("document-import"));
|
|
|
|
|
importFileDialog->setLabelText(QFileDialog::Accept, i18nc("import layout","Import"));
|
|
|
|
|
importFileDialog->setFileMode(QFileDialog::AnyFile);
|
|
|
|
|
importFileDialog->setAcceptMode(QFileDialog::AcceptOpen);
|
|
|
|
|
importFileDialog->setDefaultSuffix("layout.latte");
|
|
|
|
|
|
|
|
|
|
QStringList filters;
|
|
|
|
|
filters << QString(i18nc("import latte layout", "Latte Dock Layout file v0.2") + "(*.layout.latte)")
|
|
|
|
|
<< QString(i18nc("import older latte layout", "Latte Dock Layout file v0.1") + "(*.latterc)");
|
|
|
|
|
importFileDialog->setNameFilters(filters);
|
|
|
|
|
|
|
|
|
|
connect(importFileDialog, &QFileDialog::finished, importFileDialog, &QFileDialog::deleteLater);
|
|
|
|
|
|
|
|
|
|
connect(importFileDialog, &QFileDialog::fileSelected, this, [&](const QString & file) {
|
|
|
|
|
Layouts::Importer::LatteFileVersion version = Layouts::Importer::fileVersion(file);
|
|
|
|
|
qDebug() << "VERSION :::: " << version;
|
|
|
|
|
|
|
|
|
|
if (version == Layouts::Importer::LayoutVersion2) {
|
|
|
|
|
Settings::Data::Layout importedlayout = m_layoutsController->addLayoutForFile(file);
|
|
|
|
|
showInlineMessage(i18nc("settings:layout imported successfully","Layout <b>%0</b> imported successfully...").arg(importedlayout.name),
|
|
|
|
|
KMessageWidget::Information,
|
|
|
|
|
SettingsDialog::INFORMATIONINTERVAL);
|
|
|
|
|
} else if (version == Layouts::Importer::ConfigVersion1) {
|
|
|
|
|
if (!m_layoutsController->importLayoutsFromV1ConfigFile(file)) {
|
|
|
|
|
showInlineMessage(i18nc("settings:deprecated layouts import failed","Import layouts from deprecated version <b>failed</b>..."),
|
|
|
|
|
KMessageWidget::Error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
importFileDialog->open();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_import_fullconfiguration()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << Q_FUNC_INFO;
|
|
|
|
@ -633,92 +292,6 @@ void SettingsDialog::on_import_fullconfiguration()
|
|
|
|
|
importFileDialog->open();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_export_layout()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << Q_FUNC_INFO;
|
|
|
|
|
|
|
|
|
|
if (!m_layoutMenu->isEnabled() || !m_exportLayoutAction->isEnabled() || currentPage() != Types::LayoutPage) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!m_layoutsController->hasSelectedLayout()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Settings::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData();
|
|
|
|
|
|
|
|
|
|
//! Update ALL active original layouts before exporting,
|
|
|
|
|
m_corona->layoutsManager()->synchronizer()->syncActiveLayoutsToOriginalFiles();
|
|
|
|
|
|
|
|
|
|
QFileDialog *exportFileDialog = new QFileDialog(this, i18n("Export Layout"), QDir::homePath(), QStringLiteral("layout.latte"));
|
|
|
|
|
|
|
|
|
|
exportFileDialog->setLabelText(QFileDialog::Accept, i18nc("export layout","Export"));
|
|
|
|
|
exportFileDialog->setFileMode(QFileDialog::AnyFile);
|
|
|
|
|
exportFileDialog->setAcceptMode(QFileDialog::AcceptSave);
|
|
|
|
|
exportFileDialog->setDefaultSuffix("layout.latte");
|
|
|
|
|
|
|
|
|
|
QStringList filters;
|
|
|
|
|
QString filter1(i18nc("export layout", "Latte Dock Layout file v0.2") + "(*.layout.latte)");
|
|
|
|
|
|
|
|
|
|
filters << filter1;
|
|
|
|
|
|
|
|
|
|
exportFileDialog->setNameFilters(filters);
|
|
|
|
|
|
|
|
|
|
connect(exportFileDialog, &QFileDialog::finished, exportFileDialog, &QFileDialog::deleteLater);
|
|
|
|
|
|
|
|
|
|
connect(exportFileDialog, &QFileDialog::fileSelected, this, [ &, selectedLayout](const QString & file) {
|
|
|
|
|
auto showExportLayoutError = [this](const Settings::Data::Layout &layout) {
|
|
|
|
|
showInlineMessage(i18nc("settings:layout export fail","Layout <b>%0</b> export <b>failed</b>...").arg(layout.name),
|
|
|
|
|
KMessageWidget::Error);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (QFile::exists(file) && !QFile::remove(file)) {
|
|
|
|
|
showExportLayoutError(selectedLayout);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (file.endsWith(".layout.latte")) {
|
|
|
|
|
if (!QFile(selectedLayout.id).copy(file)) {
|
|
|
|
|
showExportLayoutError(selectedLayout);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QFileInfo newFileInfo(file);
|
|
|
|
|
|
|
|
|
|
if (newFileInfo.exists() && !newFileInfo.isWritable()) {
|
|
|
|
|
QFile(file).setPermissions(QFileDevice::ReadUser | QFileDevice::WriteUser | QFileDevice::ReadGroup | QFileDevice::ReadOther);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CentralLayout layoutS(this, file);
|
|
|
|
|
layoutS.setActivities(QStringList());
|
|
|
|
|
layoutS.clearLastUsedActivity();
|
|
|
|
|
|
|
|
|
|
m_openUrlAction->setData(file);
|
|
|
|
|
m_ui->messageWidget->addAction(m_openUrlAction);
|
|
|
|
|
showInlineMessage(i18nc("settings:layout export success","Layout <b>%0</b> export succeeded...").arg(selectedLayout.name),
|
|
|
|
|
KMessageWidget::Information,
|
|
|
|
|
SettingsDialog::INFORMATIONWITHACTIONINTERVAL);
|
|
|
|
|
} else if (file.endsWith(".latterc")) {
|
|
|
|
|
auto showExportConfigurationError = [this]() {
|
|
|
|
|
showInlineMessage(i18n("Full configuration export <b>failed</b>..."), KMessageWidget::Error);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (m_corona->layoutsManager()->importer()->exportFullConfiguration(file)) {
|
|
|
|
|
m_openUrlAction->setData(file);
|
|
|
|
|
m_ui->messageWidget->addAction(m_openUrlAction);
|
|
|
|
|
showInlineMessage(i18n("Full configuration export succeeded..."),
|
|
|
|
|
KMessageWidget::Information,
|
|
|
|
|
SettingsDialog::INFORMATIONWITHACTIONINTERVAL);
|
|
|
|
|
} else {
|
|
|
|
|
showExportConfigurationError();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
exportFileDialog->open();
|
|
|
|
|
exportFileDialog->selectFile(selectedLayout.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_export_fullconfiguration()
|
|
|
|
|
{
|
|
|
|
|
//! Update ALL active original layouts before exporting,
|
|
|
|
@ -748,11 +321,23 @@ void SettingsDialog::on_export_fullconfiguration()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (m_corona->layoutsManager()->importer()->exportFullConfiguration(file)) {
|
|
|
|
|
m_openUrlAction->setData(file);
|
|
|
|
|
m_ui->messageWidget->addAction(m_openUrlAction);
|
|
|
|
|
QAction *openUrlAction = new QAction(i18n("Open Location..."), this);
|
|
|
|
|
openUrlAction->setData(file);
|
|
|
|
|
QList<QAction *> actions;
|
|
|
|
|
actions << openUrlAction;
|
|
|
|
|
|
|
|
|
|
connect(openUrlAction, &QAction::triggered, this, [&, openUrlAction]() {
|
|
|
|
|
QString file = openUrlAction->data().toString();
|
|
|
|
|
|
|
|
|
|
if (!file.isEmpty()) {
|
|
|
|
|
KIO::highlightInFileManager({file});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
showInlineMessage(i18n("Full configuration export succeeded..."),
|
|
|
|
|
KMessageWidget::Information,
|
|
|
|
|
SettingsDialog::INFORMATIONWITHACTIONINTERVAL);
|
|
|
|
|
SettingsDialog::INFORMATIONWITHACTIONINTERVAL,
|
|
|
|
|
actions);
|
|
|
|
|
} else {
|
|
|
|
|
showExportConfigurationError();
|
|
|
|
|
}
|
|
|
|
@ -817,10 +402,7 @@ void SettingsDialog::apply()
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveAllChanges();
|
|
|
|
|
|
|
|
|
|
updateApplyButtonsState();
|
|
|
|
|
updatePerLayoutButtonsState();
|
|
|
|
|
save();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::reset()
|
|
|
|
@ -832,7 +414,7 @@ void SettingsDialog::reset()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_ui->tabWidget->currentIndex() == Latte::Types::LayoutPage) {
|
|
|
|
|
m_layoutsController->reset();
|
|
|
|
|
m_tabLayoutsHandler->reset();
|
|
|
|
|
} else if (m_ui->tabWidget->currentIndex() == Latte::Types::PreferencesPage) {
|
|
|
|
|
m_preferencesHandler->reset();
|
|
|
|
|
}
|
|
|
|
@ -849,108 +431,13 @@ void SettingsDialog::restoreDefaults()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::loadSettings()
|
|
|
|
|
{
|
|
|
|
|
bool inMultiple{m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts};
|
|
|
|
|
|
|
|
|
|
if (inMultiple) {
|
|
|
|
|
m_ui->multipleToolBtn->setChecked(true);
|
|
|
|
|
} else {
|
|
|
|
|
m_ui->singleToolBtn->setChecked(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updatePerLayoutButtonsState();
|
|
|
|
|
updateApplyButtonsState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<int> SettingsDialog::currentSettings()
|
|
|
|
|
{
|
|
|
|
|
QList<int> settings;
|
|
|
|
|
settings << (int)m_ui->autostartChkBox->isChecked();
|
|
|
|
|
settings << (int)m_ui->badges3DStyleChkBox->isChecked();
|
|
|
|
|
settings << (int)m_ui->infoWindowChkBox->isChecked();
|
|
|
|
|
settings << (int)m_ui->metaPressChkBox->isChecked();
|
|
|
|
|
settings << (int)m_ui->metaPressHoldChkBox->isChecked();
|
|
|
|
|
settings << (int)m_ui->noBordersForMaximizedChkBox->isChecked();
|
|
|
|
|
settings << m_mouseSensitivityButtons->checkedId();
|
|
|
|
|
settings << m_ui->screenTrackerSpinBox->value();
|
|
|
|
|
settings << m_ui->outlineSpinBox->value();
|
|
|
|
|
|
|
|
|
|
return settings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_switch_layout()
|
|
|
|
|
{
|
|
|
|
|
if (!m_layoutMenu->isEnabled() || !m_switchLayoutAction->isEnabled() || currentPage() != Types::LayoutPage) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Settings::Data::Layout selectedLayoutCurrent = m_layoutsController->selectedLayoutCurrentData();
|
|
|
|
|
Settings::Data::Layout selectedLayoutOriginal = m_layoutsController->selectedLayoutOriginalData();
|
|
|
|
|
selectedLayoutOriginal = selectedLayoutOriginal.isEmpty() ? selectedLayoutCurrent : selectedLayoutOriginal;
|
|
|
|
|
|
|
|
|
|
if (m_layoutsController->dataAreChanged()) {
|
|
|
|
|
showInlineMessage(i18nc("settings:not permitted switching layout","You need to <b>apply</b> your changes first to switch layout..."),
|
|
|
|
|
KMessageWidget::Warning,
|
|
|
|
|
WARNINGINTERVAL);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!m_layoutsController->selectedLayoutIsCurrentActive()) {
|
|
|
|
|
bool appliedShared = m_layoutsController->inMultipleMode() && selectedLayoutCurrent.isShared();
|
|
|
|
|
bool freeActivitiesLayoutUpdated{false};
|
|
|
|
|
|
|
|
|
|
if (!appliedShared && selectedLayoutCurrent.activities.isEmpty()) {
|
|
|
|
|
m_layoutsController->setOriginalLayoutForFreeActivities(selectedLayoutOriginal.id);
|
|
|
|
|
freeActivitiesLayoutUpdated = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_layoutsController->inMultipleMode()) {
|
|
|
|
|
m_corona->layoutsManager()->switchToLayout(selectedLayoutOriginal.name);
|
|
|
|
|
} else {
|
|
|
|
|
if (freeActivitiesLayoutUpdated) {
|
|
|
|
|
m_corona->layoutsManager()->switchToLayout(selectedLayoutOriginal.name);
|
|
|
|
|
} else {
|
|
|
|
|
CentralLayout singleLayout(this, selectedLayoutCurrent.id);
|
|
|
|
|
|
|
|
|
|
QString switchToActivity = selectedLayoutCurrent.isForFreeActivities() ? singleLayout.lastUsedActivity() : selectedLayoutCurrent.activities[0];
|
|
|
|
|
|
|
|
|
|
if (!m_corona->activitiesConsumer()->runningActivities().contains(switchToActivity)) {
|
|
|
|
|
m_corona->layoutsManager()->synchronizer()->activitiesController()->startActivity(switchToActivity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_corona->layoutsManager()->synchronizer()->activitiesController()->setCurrentActivity(switchToActivity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updatePerLayoutButtonsState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::on_pause_layout()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << Q_FUNC_INFO;
|
|
|
|
|
|
|
|
|
|
if (!m_layoutMenu->isEnabled() || !m_pauseLayoutAction->isEnabled() || currentPage() != Types::LayoutPage) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setTwinProperty(m_pauseLayoutAction, TWINENABLED, false);
|
|
|
|
|
|
|
|
|
|
Settings::Data::Layout selectedLayoutCurrent = m_layoutsController->selectedLayoutCurrentData();
|
|
|
|
|
Settings::Data::Layout selectedLayoutOriginal = m_layoutsController->selectedLayoutOriginalData();
|
|
|
|
|
selectedLayoutOriginal = selectedLayoutOriginal.isEmpty() ? selectedLayoutCurrent : selectedLayoutOriginal;
|
|
|
|
|
|
|
|
|
|
m_corona->layoutsManager()->synchronizer()->pauseLayout(selectedLayoutOriginal.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::updateApplyButtonsState()
|
|
|
|
|
{
|
|
|
|
|
bool changed{false};
|
|
|
|
|
|
|
|
|
|
//! Ok, Apply Buttons
|
|
|
|
|
|
|
|
|
|
if ((currentPage() == Latte::Types::LayoutPage && m_layoutsController->dataAreChanged())
|
|
|
|
|
if ((currentPage() == Latte::Types::LayoutPage && m_tabLayoutsHandler->dataAreChanged())
|
|
|
|
|
||(currentPage() == Latte::Types::PreferencesPage && m_preferencesHandler->dataAreChanged())) {
|
|
|
|
|
changed = true;
|
|
|
|
|
}
|
|
|
|
@ -978,67 +465,6 @@ void SettingsDialog::updateApplyButtonsState()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::updatePerLayoutButtonsState()
|
|
|
|
|
{
|
|
|
|
|
if (!m_layoutsController->hasSelectedLayout()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Settings::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData();
|
|
|
|
|
|
|
|
|
|
//! Switch Button
|
|
|
|
|
if ((m_layoutsController->inMultipleMode() && selectedLayout.isShared())
|
|
|
|
|
|| m_layoutsController->selectedLayoutIsCurrentActive()) {
|
|
|
|
|
setTwinProperty(m_switchLayoutAction, TWINENABLED, false);
|
|
|
|
|
} else {
|
|
|
|
|
setTwinProperty(m_switchLayoutAction, TWINENABLED, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Pause Button
|
|
|
|
|
if (!m_layoutsController->inMultipleMode()) {
|
|
|
|
|
//! Single Layout mode
|
|
|
|
|
setTwinProperty(m_pauseLayoutAction, TWINVISIBLE, false);
|
|
|
|
|
} else {
|
|
|
|
|
setTwinProperty(m_pauseLayoutAction, TWINVISIBLE, true);
|
|
|
|
|
|
|
|
|
|
if (selectedLayout.isActive
|
|
|
|
|
&& !selectedLayout.isForFreeActivities()
|
|
|
|
|
&& !selectedLayout.isShared()) {
|
|
|
|
|
setTwinProperty(m_pauseLayoutAction, TWINENABLED, true);
|
|
|
|
|
} else {
|
|
|
|
|
setTwinProperty(m_pauseLayoutAction, TWINENABLED, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Remove Layout Button
|
|
|
|
|
/* if (selectedLayout.isActive || selectedLayout.isLocked) {
|
|
|
|
|
m_ui->removeButton->setEnabled(false);
|
|
|
|
|
} else {
|
|
|
|
|
m_ui->removeButton->setEnabled(true);
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
//! Layout Locked Button
|
|
|
|
|
if (selectedLayout.isLocked) {
|
|
|
|
|
setTwinProperty(m_lockedLayoutAction, TWINCHECKED, true);
|
|
|
|
|
} else {
|
|
|
|
|
setTwinProperty(m_lockedLayoutAction, TWINCHECKED, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! UI Elements that need to be enabled/disabled
|
|
|
|
|
if (m_layoutsController->inMultipleMode()) {
|
|
|
|
|
setTwinProperty(m_sharedLayoutAction, TWINVISIBLE, true);
|
|
|
|
|
} else {
|
|
|
|
|
setTwinProperty(m_sharedLayoutAction, TWINVISIBLE, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Layout Shared Button
|
|
|
|
|
if (selectedLayout.isShared()) {
|
|
|
|
|
setTwinProperty(m_sharedLayoutAction, TWINCHECKED, true);
|
|
|
|
|
} else {
|
|
|
|
|
setTwinProperty(m_sharedLayoutAction, TWINCHECKED, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::showLayoutInformation()
|
|
|
|
|
{
|
|
|
|
|
/* int currentRow = m_ui->layoutsView->currentIndex().row();
|
|
|
|
@ -1099,8 +525,8 @@ void SettingsDialog::dropEvent(QDropEvent *event)
|
|
|
|
|
QString layoutPath = urlList[i].path();
|
|
|
|
|
|
|
|
|
|
if (layoutPath.endsWith(".layout.latte")) {
|
|
|
|
|
Settings::Data::Layout importedlayout = m_layoutsController->addLayoutForFile(layoutPath);
|
|
|
|
|
layoutNames << importedlayout.name;
|
|
|
|
|
// Settings::Data::Layout importedlayout = m_layoutsController->addLayoutForFile(layoutPath);
|
|
|
|
|
// layoutNames << importedlayout.name;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1122,7 +548,7 @@ void SettingsDialog::keyPressEvent(QKeyEvent *event)
|
|
|
|
|
if (m_ui->messageWidget->isVisible()) {
|
|
|
|
|
m_hideInlineMessageTimer.stop();
|
|
|
|
|
m_ui->messageWidget->animatedHide();
|
|
|
|
|
m_ui->messageWidget->removeAction(m_openUrlAction);
|
|
|
|
|
clearCurrentMessageActions();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1132,8 +558,8 @@ void SettingsDialog::keyPressEvent(QKeyEvent *event)
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::keyReleaseEvent(QKeyEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (event && event->key() == Qt::Key_Delete && currentPage() == Types::LayoutPage){
|
|
|
|
|
on_remove_layout();
|
|
|
|
|
if (event && currentPage() == Types::LayoutPage){
|
|
|
|
|
m_tabLayoutsHandler->on_keyReleaseEvent(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QDialog::keyReleaseEvent(event);
|
|
|
|
@ -1146,21 +572,40 @@ void SettingsDialog::updateWindowActivities()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::saveAllChanges()
|
|
|
|
|
void SettingsDialog::save()
|
|
|
|
|
{
|
|
|
|
|
if (currentPage() == Latte::Types::LayoutPage) {
|
|
|
|
|
m_layoutsController->save();
|
|
|
|
|
m_tabLayoutsHandler->save();
|
|
|
|
|
} else if (currentPage() == Latte::Types::PreferencesPage) {
|
|
|
|
|
m_preferencesHandler->save();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::showInlineMessage(const QString &msg, const KMessageWidget::MessageType &type, const int &hideInterval)
|
|
|
|
|
void SettingsDialog::clearCurrentMessageActions()
|
|
|
|
|
{
|
|
|
|
|
while(m_currentMessageActions.count() > 0) {
|
|
|
|
|
QAction *action = m_currentMessageActions.takeAt(0);
|
|
|
|
|
m_ui->messageWidget->removeAction(action);
|
|
|
|
|
action->deleteLater();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::showInlineMessage(const QString &msg, const KMessageWidget::MessageType &type, const int &hideInterval, QList<QAction *> actions)
|
|
|
|
|
{
|
|
|
|
|
if (msg.isEmpty()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!m_currentMessageActions.isEmpty()) {
|
|
|
|
|
clearCurrentMessageActions();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_currentMessageActions = actions;
|
|
|
|
|
|
|
|
|
|
for (int i=0; i<actions.count(); ++i) {
|
|
|
|
|
m_ui->messageWidget->addAction(actions[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_hideInlineMessageTimer.stop();
|
|
|
|
|
|
|
|
|
|
if (m_ui->messageWidget->isVisible()) {
|
|
|
|
|