[SCM] ktp-accounts-kcm packaging branch, master, updated. debian/15.12.1-1-1157-gc4589c5
Maximiliano Curia
maxy at moszumanska.debian.org
Fri May 27 23:59:31 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=9d21307
The following commit has been merged in the master branch:
commit 9d2130796964f8f7ad98196fbed1857831c87c83
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Sat Apr 23 00:57:24 2011 +0100
Disable non-editable edit fields where the value comes from a profile and is fixed
---
.../abstract-account-parameters-widget.cpp | 11 ++++++-----
src/KCMTelepathyAccounts/parameter-edit-model.cpp | 19 +++++++++++++++++++
src/KCMTelepathyAccounts/parameter-edit-model.h | 1 +
3 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/src/KCMTelepathyAccounts/abstract-account-parameters-widget.cpp b/src/KCMTelepathyAccounts/abstract-account-parameters-widget.cpp
index 31423df..c4f96af 100644
--- a/src/KCMTelepathyAccounts/abstract-account-parameters-widget.cpp
+++ b/src/KCMTelepathyAccounts/abstract-account-parameters-widget.cpp
@@ -100,14 +100,11 @@ void AbstractAccountParametersWidget::handleParameter(const QString ¶meterNa
Tp::ProtocolParameter foundParameter = d->parameterModel->parameter(parameterName);
- if(!foundParameter.isValid() || foundParameter.type() != parameterType)
- {
+ if(!foundParameter.isValid() || foundParameter.type() != parameterType) {
// hide widgets because they are not needed
kDebug() << "Field" << parameterName << "hidden";
dataWidget->hide();
- foreach(QWidget *label, labelWidgets)
- {
-
+ foreach(QWidget *label, labelWidgets) {
if(label) {
label->hide();
}
@@ -126,6 +123,10 @@ void AbstractAccountParametersWidget::handleParameter(const QString ¶meterNa
ValidatedLineEdit *validated = qobject_cast<ValidatedLineEdit*>(dataWidget);
if(validated) {
d->validatedWidgets.insert(index, validated);
+ }
+
+ if (! (index.flags() & Qt::ItemIsEnabled)) {
+ dataWidget->setEnabled(false);
}
}
}
diff --git a/src/KCMTelepathyAccounts/parameter-edit-model.cpp b/src/KCMTelepathyAccounts/parameter-edit-model.cpp
index e0040b9..4a58bde 100644
--- a/src/KCMTelepathyAccounts/parameter-edit-model.cpp
+++ b/src/KCMTelepathyAccounts/parameter-edit-model.cpp
@@ -109,6 +109,21 @@ QVariant ParameterEditModel::data(const QModelIndex &index, int role) const
return data;
}
+Qt::ItemFlags ParameterEditModel::flags(const QModelIndex &index) const
+{
+ Qt::ItemFlags flags = 0;
+ if (!index.isValid()) {
+ return flags;
+ }
+
+ flags |= Qt::ItemIsSelectable;
+
+ if (! m_items.at(index.row())->isMandatory()) {
+ flags |= Qt::ItemIsEnabled;
+ }
+ return flags;
+}
+
bool ParameterEditModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (!index.isValid()) {
@@ -117,6 +132,10 @@ bool ParameterEditModel::setData(const QModelIndex &index, const QVariant &value
}
if (role == ParameterEditModel::ValueRole || role == Qt::EditRole) {
+ //never edit items fixed in the profile.
+ if(m_items.at(index.row())->isMandatory()) {
+ return false;
+ }
m_items.at(index.row())->setValue(value);
Q_EMIT dataChanged(index, index);
diff --git a/src/KCMTelepathyAccounts/parameter-edit-model.h b/src/KCMTelepathyAccounts/parameter-edit-model.h
index 8083fcb..0dd3d60 100644
--- a/src/KCMTelepathyAccounts/parameter-edit-model.h
+++ b/src/KCMTelepathyAccounts/parameter-edit-model.h
@@ -63,6 +63,7 @@ public:
virtual int rowCount(const QModelIndex &index) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
QModelIndex indexForParameter(const Tp::ProtocolParameter ¶meter) const;
QModelIndex indexForParameter(const Tp::Profile::Parameter ¶meter) const;
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list