[SCM] ktp-accounts-kcm packaging branch, master, updated. debian/15.12.1-1-1157-gc4589c5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:02:14 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=32c6caf

The following commit has been merged in the master branch:
commit 32c6caf33392bbafd0ad10e1e4d0ed45ac6645d5
Author: George Kiagiadakis <george.kiagiadakis at collabora.com>
Date:   Mon Jun 11 13:55:44 2012 +0300

    AbstractAccountParametersWidget: Reset parameters with disabled widgets to their default values when submitting changes
---
 .../abstract-account-parameters-widget.cpp                   | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/KCMTelepathyAccounts/abstract-account-parameters-widget.cpp b/src/KCMTelepathyAccounts/abstract-account-parameters-widget.cpp
index 04dbac3..c2b9a67 100644
--- a/src/KCMTelepathyAccounts/abstract-account-parameters-widget.cpp
+++ b/src/KCMTelepathyAccounts/abstract-account-parameters-widget.cpp
@@ -45,6 +45,7 @@ public:
     }
     ParameterEditModel *parameterModel;
     QDataWidgetMapper *mapper;
+    QList<QWidget*> mappedWidgets;
     QMap<QPersistentModelIndex,ValidatedLineEdit*> validatedWidgets;
     QString errorMessage;
 };
@@ -139,6 +140,8 @@ void AbstractAccountParametersWidget::handleParameter(const QString &parameterNa
         if (!(index.flags() & Qt::ItemIsEnabled)) {
             dataWidget->setEnabled(false);
         }
+
+        d->mappedWidgets.append(dataWidget);
     }
 }
 
@@ -151,6 +154,15 @@ void AbstractAccountParametersWidget::submit()
         d->parameterModel->setData(i.key(), i.value()->validationState(), ParameterEditModel::ValidityRole);
         ++i;
     }
+
+    //reset disabled widgets to their default values
+    Q_FOREACH (QWidget *w, d->mappedWidgets) {
+        if (!w->isEnabled()) {
+            QModelIndex index = d->parameterModel->index(d->mapper->mappedSection(w), 0);
+            QVariant defaultValue = d->parameterModel->data(index, ParameterEditModel::DefaultValueRole);
+            d->parameterModel->setData(index, defaultValue, Qt::EditRole);
+        }
+    }
 }
 
 ParameterEditModel* AbstractAccountParametersWidget::parameterModel() const

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list