mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-24 05:33:50 +03:00
provide reset button functionality
This commit is contained in:
parent
e50d9e33a7
commit
fcfcf8ca51
@ -73,8 +73,6 @@ void ExportTemplateDialog::initButtons()
|
|||||||
{
|
{
|
||||||
connect(m_ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked,
|
connect(m_ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked,
|
||||||
this, &ExportTemplateDialog::onCancel);
|
this, &ExportTemplateDialog::onCancel);
|
||||||
connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), &QPushButton::clicked,
|
|
||||||
this, &ExportTemplateDialog::onCancel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportTemplateDialog::initExtractButton(const QString &tooltip)
|
void ExportTemplateDialog::initExtractButton(const QString &tooltip)
|
||||||
|
@ -79,7 +79,7 @@ void ExportTemplateHandler::init()
|
|||||||
m_ui->appletsTable->horizontalHeader()->setStretchLastSection(true);
|
m_ui->appletsTable->horizontalHeader()->setStretchLastSection(true);
|
||||||
m_ui->appletsTable->verticalHeader()->setVisible(false);
|
m_ui->appletsTable->verticalHeader()->setVisible(false);
|
||||||
|
|
||||||
//! Layouts
|
//! Applets Model
|
||||||
m_appletsProxyModel = new QSortFilterProxyModel(this);
|
m_appletsProxyModel = new QSortFilterProxyModel(this);
|
||||||
m_appletsProxyModel->setSourceModel(m_appletsModel);
|
m_appletsProxyModel->setSourceModel(m_appletsModel);
|
||||||
m_appletsProxyModel->setSortRole(Model::Applets::SORTINGROLE);
|
m_appletsProxyModel->setSortRole(Model::Applets::SORTINGROLE);
|
||||||
@ -87,6 +87,10 @@ void ExportTemplateHandler::init()
|
|||||||
m_appletsProxyModel->sort(Model::Applets::NAMECOLUMN, Qt::AscendingOrder);
|
m_appletsProxyModel->sort(Model::Applets::NAMECOLUMN, Qt::AscendingOrder);
|
||||||
|
|
||||||
m_ui->appletsTable->setModel(m_appletsProxyModel);
|
m_ui->appletsTable->setModel(m_appletsProxyModel);
|
||||||
|
|
||||||
|
//! Reset
|
||||||
|
connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), &QPushButton::clicked,
|
||||||
|
this, &ExportTemplateHandler::onReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportTemplateHandler::initDefaults()
|
void ExportTemplateHandler::initDefaults()
|
||||||
@ -117,6 +121,12 @@ void ExportTemplateHandler::loadViewApplets(Latte::View *view)
|
|||||||
m_parentDialog->setWindowTitle(i18n("Export View Template"));
|
m_parentDialog->setWindowTitle(i18n("Export View Template"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExportTemplateHandler::onReset()
|
||||||
|
{
|
||||||
|
m_appletsModel->setSelected(o_data);
|
||||||
|
c_data = o_data;
|
||||||
|
}
|
||||||
|
|
||||||
bool ExportTemplateHandler::dataAreChanged() const
|
bool ExportTemplateHandler::dataAreChanged() const
|
||||||
{
|
{
|
||||||
return o_data != c_data;
|
return o_data != c_data;
|
||||||
|
@ -85,6 +85,9 @@ private:
|
|||||||
void loadLayoutApplets(const QString &layoutName, const QString &layoutId);
|
void loadLayoutApplets(const QString &layoutName, const QString &layoutId);
|
||||||
void loadViewApplets(Latte::View *view);
|
void loadViewApplets(Latte::View *view);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onReset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Dialog::ExportTemplateDialog *m_parentDialog{nullptr};
|
Dialog::ExportTemplateDialog *m_parentDialog{nullptr};
|
||||||
Ui::ExportTemplateDialog *m_ui{nullptr};
|
Ui::ExportTemplateDialog *m_ui{nullptr};
|
||||||
|
@ -93,6 +93,21 @@ void Applets::setData(const Latte::Data::AppletsTable &applets)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Applets::setSelected(const Latte::Data::AppletsTable &applets)
|
||||||
|
{
|
||||||
|
for(int i=0; i<applets.rowCount(); ++i) {
|
||||||
|
int pos = m_appletsTable.indexOf(applets[i].id);
|
||||||
|
|
||||||
|
if (pos>=0 && applets[i].isSelected != m_appletsTable[pos].isSelected) {
|
||||||
|
QVector<int> roles;
|
||||||
|
roles << Qt::CheckStateRole;
|
||||||
|
|
||||||
|
m_appletsTable[pos].isSelected = applets[i].isSelected;
|
||||||
|
emit dataChanged(index(pos, NAMECOLUMN), index(pos, NAMECOLUMN), roles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Qt::ItemFlags Applets::flags(const QModelIndex &index) const
|
Qt::ItemFlags Applets::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
const int column = index.column();
|
const int column = index.column();
|
||||||
|
@ -67,6 +67,7 @@ public:
|
|||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
|
|
||||||
void setData(const Latte::Data::AppletsTable &applets);
|
void setData(const Latte::Data::AppletsTable &applets);
|
||||||
|
void setSelected(const Latte::Data::AppletsTable &applets);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clear();
|
void clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user