Merge branch 'Plasma/5.8' into Plasma/5.9
commit
55f2e72ce7
|
@ -83,6 +83,8 @@ ConfigurationModule::ConfigurationModule(QWidget *parent, const QVariantList &ar
|
||||||
{
|
{
|
||||||
m_proxyModel->setSourceModel(m_model);
|
m_proxyModel->setSourceModel(m_model);
|
||||||
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
m_proxyModel->sort(0);
|
||||||
connect(m_ui->filter, &QLineEdit::textChanged, m_proxyModel, &QSortFilterProxyModel::setFilterFixedString);
|
connect(m_ui->filter, &QLineEdit::textChanged, m_proxyModel, &QSortFilterProxyModel::setFilterFixedString);
|
||||||
|
|
||||||
m_quickView = new QQuickView(0);
|
m_quickView = new QQuickView(0);
|
||||||
|
@ -99,7 +101,6 @@ ConfigurationModule::ConfigurationModule(QWidget *parent, const QVariantList &ar
|
||||||
|
|
||||||
m_quickView->rootContext()->setContextProperty(QStringLiteral("decorationsModel"), m_proxyModel);
|
m_quickView->rootContext()->setContextProperty(QStringLiteral("decorationsModel"), m_proxyModel);
|
||||||
updateColors();
|
updateColors();
|
||||||
m_quickView->rootContext()->setContextProperty("savedIndex", savedIndex());
|
|
||||||
m_quickView->rootContext()->setContextProperty("_borderSizesIndex", 3); // 3 is normal
|
m_quickView->rootContext()->setContextProperty("_borderSizesIndex", 3); // 3 is normal
|
||||||
m_quickView->rootContext()->setContextProperty("leftButtons", m_leftButtons);
|
m_quickView->rootContext()->setContextProperty("leftButtons", m_leftButtons);
|
||||||
m_quickView->rootContext()->setContextProperty("rightButtons", m_rightButtons);
|
m_quickView->rootContext()->setContextProperty("rightButtons", m_rightButtons);
|
||||||
|
@ -300,14 +301,6 @@ QVector< KDecoration2::DecorationButtonType > readDecorationButtons(const KConfi
|
||||||
return buttonsFromString(config.readEntry(key, buttonsToString(defaultValue)));
|
return buttonsFromString(config.readEntry(key, buttonsToString(defaultValue)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConfigurationModule::savedIndex() const
|
|
||||||
{
|
|
||||||
const KConfigGroup config = KSharedConfig::openConfig("kwinrc")->group(s_pluginName);
|
|
||||||
const QString plugin = config.readEntry("library", s_defaultPlugin);
|
|
||||||
const QString theme = config.readEntry("theme", s_defaultTheme);
|
|
||||||
return m_proxyModel->mapFromSource(m_model->findDecoration(plugin, theme)).row();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigurationModule::load()
|
void ConfigurationModule::load()
|
||||||
{
|
{
|
||||||
s_loading = true;
|
s_loading = true;
|
||||||
|
@ -318,6 +311,9 @@ void ConfigurationModule::load()
|
||||||
const QVariant border = QVariant::fromValue(stringToSize(config.readEntry("BorderSize", s_borderSizeNormal)));
|
const QVariant border = QVariant::fromValue(stringToSize(config.readEntry("BorderSize", s_borderSizeNormal)));
|
||||||
m_ui->borderSizesCombo->setCurrentIndex(m_ui->borderSizesCombo->findData(border));
|
m_ui->borderSizesCombo->setCurrentIndex(m_ui->borderSizesCombo->findData(border));
|
||||||
|
|
||||||
|
int themeIndex = m_proxyModel->mapFromSource(m_model->findDecoration(plugin, theme)).row();
|
||||||
|
m_quickView->rootContext()->setContextProperty("savedIndex", themeIndex);
|
||||||
|
|
||||||
// buttons
|
// buttons
|
||||||
const auto &left = readDecorationButtons(config, "ButtonsOnLeft", QVector<KDecoration2::DecorationButtonType >{
|
const auto &left = readDecorationButtons(config, "ButtonsOnLeft", QVector<KDecoration2::DecorationButtonType >{
|
||||||
KDecoration2::DecorationButtonType::Menu,
|
KDecoration2::DecorationButtonType::Menu,
|
||||||
|
|
|
@ -57,8 +57,6 @@ public Q_SLOTS:
|
||||||
void defaults() override;
|
void defaults() override;
|
||||||
void load() override;
|
void load() override;
|
||||||
void save() override;
|
void save() override;
|
||||||
//what index is in the model the theme saved as current? needed to move the view at the proper index right at startup
|
|
||||||
int savedIndex() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *ev) override;
|
void showEvent(QShowEvent *ev) override;
|
||||||
|
|
|
@ -33,7 +33,9 @@ ScrollView {
|
||||||
cellWidth: 20 * units.gridUnit
|
cellWidth: 20 * units.gridUnit
|
||||||
cellHeight: cellWidth / 1.6
|
cellHeight: cellWidth / 1.6
|
||||||
onContentHeightChanged: {
|
onContentHeightChanged: {
|
||||||
|
if (gridView.currentIndex == -1) {
|
||||||
gridView.currentIndex = savedIndex;
|
gridView.currentIndex = savedIndex;
|
||||||
|
}
|
||||||
gridView.positionViewAtIndex(gridView.currentIndex, GridView.Visible);
|
gridView.positionViewAtIndex(gridView.currentIndex, GridView.Visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue