viewsdialog:do not update layouts model for views

work/spdx
Michail Vourlakos 4 years ago
parent 195a24b33c
commit cedcbddd4d

@ -216,36 +216,36 @@ QString Layouts::iconsPath() const
return m_iconsPath;
}
void Layouts::initializeSelectedLayoutViews()
const Latte::Data::ViewsTable Layouts::selectedLayoutViews()
{
Latte::Data::ViewsTable views;
int selectedRow = m_view->currentIndex().row();
if (selectedRow >= 0) {
QString selectedId = m_proxyModel->data(m_proxyModel->index(selectedRow, Model::Layouts::IDCOLUMN), Qt::UserRole).toString();
Data::Layout selectedCurrentData = m_model->currentData(selectedId);
if (!selectedCurrentData.views.isInitialized) {
Data::Layout originalSelectedData = selectedLayoutOriginalData();
CentralLayout *central = m_handler->corona()->layoutsManager()->synchronizer()->centralLayout(originalSelectedData.name);
if (selectedRow < 0) {
return views;
}
bool islayoutactive{true};
QString selectedId = m_proxyModel->data(m_proxyModel->index(selectedRow, Model::Layouts::IDCOLUMN), Qt::UserRole).toString();
Data::Layout selectedCurrentData = m_model->currentData(selectedId);
if (!central) {
islayoutactive = false;
central = new CentralLayout(this, selectedCurrentData.id);
}
Data::Layout originalSelectedData = selectedLayoutOriginalData();
CentralLayout *central = m_handler->corona()->layoutsManager()->synchronizer()->centralLayout(originalSelectedData.name);
selectedCurrentData.views = central->viewsTable();
selectedCurrentData.views.isInitialized = true;
originalSelectedData.views = selectedCurrentData.views;
bool islayoutactive{true};
m_model->setOriginalViewsForLayout(originalSelectedData);
m_model->setLayoutProperties(selectedCurrentData);
if (!central) {
islayoutactive = false;
central = new CentralLayout(this, selectedCurrentData.id);
}
if (!islayoutactive) {
central->deleteLater();
}
}
selectedCurrentData.views = central->viewsTable();
selectedCurrentData.views.isInitialized = true;
if (!islayoutactive) {
central->deleteLater();
}
return selectedCurrentData.views;
}
const Latte::Data::LayoutIcon Layouts::selectedLayoutIcon() const

@ -77,6 +77,7 @@ public:
const Latte::Data::Layout selectedLayoutCurrentData() const;
const Latte::Data::Layout selectedLayoutOriginalData() const;
const Latte::Data::LayoutIcon selectedLayoutIcon() const;
const Latte::Data::ViewsTable selectedLayoutViews();
void selectRow(const QString &id);
void setLayoutProperties(const Latte::Data::Layout &layout);
@ -86,8 +87,7 @@ public:
void save();
void removeSelected();
void toggleEnabledForSelected();
void toggleLockedForSelected();
void initializeSelectedLayoutViews();
void toggleLockedForSelected();
QString iconsPath() const;
QString colorPath(const QString color) const;

@ -160,9 +160,8 @@ void ViewsHandler::initViewTemplatesSubMenu()
void ViewsHandler::reload()
{
m_dialog->layoutsController()->initializeSelectedLayoutViews();
o_data = m_dialog->layoutsController()->selectedLayoutCurrentData();
o_data.views = m_dialog->layoutsController()->selectedLayoutViews();
Latte::Data::LayoutIcon icon = m_dialog->layoutsController()->selectedLayoutIcon();

Loading…
Cancel
Save