[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:57:30 UTC 2016


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

The following commit has been merged in the master branch:
commit 74de8d385a2b6187deb5dfe231d5f27e4677f337
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Fri Jul 24 19:15:29 2009 +0000

    Show a message box telling you to enter all mandatory parameters if they aren't entered when you click finished.
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1002009
---
 src/add-account-assistant.cpp | 21 ++++++++++++++++++++-
 src/parameter-edit-model.cpp  | 11 +++++++++++
 src/parameter-edit-model.h    |  1 +
 src/parameter-edit-widget.cpp |  6 ++++++
 src/parameter-edit-widget.h   |  1 +
 src/parameter-item.cpp        |  5 +++++
 src/parameter-item.h          |  3 ++-
 7 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/src/add-account-assistant.cpp b/src/add-account-assistant.cpp
index 6eea5b2..07ca308 100644
--- a/src/add-account-assistant.cpp
+++ b/src/add-account-assistant.cpp
@@ -26,6 +26,7 @@
 
 #include <KDebug>
 #include <KLocale>
+#include <KMessageBox>
 #include <KPageWidgetItem>
 #include <KTabWidget>
 
@@ -129,7 +130,25 @@ void AddAccountAssistant::accept()
 {
     kDebug();
 
-    // TODO: Implement me!
+    // Check we are being called from page 2.
+    if (currentPage() != d->pageTwo) {
+        kWarning() << "Called accept() from a non-final page :(.";
+        return;
+    }
+
+    // Get the mandatory properties.
+    QMap<Tp::ProtocolParameter*, QVariant> mandatoryParameterValues =
+            d->mandatoryParametersWidget->parameterValues();
+
+    foreach (const QVariant &value, mandatoryParameterValues.values()) {
+        if (value.toString().isEmpty()) {
+            KMessageBox::error(this, i18n("Please enter all mandatory parameters."));
+            return;
+        }
+    }
+
+    QMap<Tp::ProtocolParameter*, QVariant> optionalParameterValues =
+            d->optionalParametersWidget->parameterValues();
 }
 
 void AddAccountAssistant::reject()
diff --git a/src/parameter-edit-model.cpp b/src/parameter-edit-model.cpp
index 114cd72..1ba2823 100644
--- a/src/parameter-edit-model.cpp
+++ b/src/parameter-edit-model.cpp
@@ -122,6 +122,17 @@ void ParameterEditModel::addItem(Tp::ProtocolParameter *parameter, const QVarian
     endInsertRows();
 }
 
+QMap<Tp::ProtocolParameter*, QVariant> ParameterEditModel::parameterValues() const
+{
+    QMap<Tp::ProtocolParameter*, QVariant> values;
+
+    foreach (ParameterItem *item, m_items) {
+        values.insert(item->parameter(), item->value());
+    }
+
+    return values;
+}
+
 
 #include "parameter-edit-model.moc"
 
diff --git a/src/parameter-edit-model.h b/src/parameter-edit-model.h
index 7836900..bfe1e55 100644
--- a/src/parameter-edit-model.h
+++ b/src/parameter-edit-model.h
@@ -53,6 +53,7 @@ public:
     virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
 
     void addItem(Tp::ProtocolParameter *parameter, const QVariant &originalValue);
+    QMap<Tp::ProtocolParameter*, QVariant> parameterValues() const;
 
 private:
     QList<ParameterItem*> m_items;
diff --git a/src/parameter-edit-widget.cpp b/src/parameter-edit-widget.cpp
index b9a4fcb..028a58a 100644
--- a/src/parameter-edit-widget.cpp
+++ b/src/parameter-edit-widget.cpp
@@ -79,6 +79,12 @@ void ParameterEditWidget::setParameters(const Tp::ProtocolParameterList &paramet
     }
 }
 
+QMap<Tp::ProtocolParameter*, QVariant> ParameterEditWidget::parameterValues() const
+{
+    return d->model->parameterValues();
+}
+
+
 void ParameterEditWidget::onDelegateDataChanged(const QModelIndex &index, const QVariant &value, int role)
 {
     d->model->setData(index, value, role);
diff --git a/src/parameter-edit-widget.h b/src/parameter-edit-widget.h
index 642849b..cbcef0d 100644
--- a/src/parameter-edit-widget.h
+++ b/src/parameter-edit-widget.h
@@ -34,6 +34,7 @@ public:
     ~ParameterEditWidget();
 
     void setParameters(const Tp::ProtocolParameterList &parameters);
+    QMap<Tp::ProtocolParameter*, QVariant> parameterValues() const;
 
 private Q_SLOTS:
     void onDelegateDataChanged(const QModelIndex &index, const QVariant &value, int role);
diff --git a/src/parameter-item.cpp b/src/parameter-item.cpp
index 91ee8c5..3072dd7 100644
--- a/src/parameter-item.cpp
+++ b/src/parameter-item.cpp
@@ -73,6 +73,11 @@ bool ParameterItem::isRequiredForRegistration() const
     return m_parameter->requiredForRegistration();
 }
 
+Tp::ProtocolParameter *ParameterItem::parameter()
+{
+    return m_parameter;
+}
+
 void ParameterItem::setValue(const QVariant &value)
 {
     m_currentValue = value;
diff --git a/src/parameter-item.h b/src/parameter-item.h
index 5c8bedc..a41b7e6 100644
--- a/src/parameter-item.h
+++ b/src/parameter-item.h
@@ -43,11 +43,12 @@ public:
     bool isSecret() const;
     bool isRequired() const;
     bool isRequiredForRegistration() const;
+    Tp::ProtocolParameter *parameter();
 
     void setValue(const QVariant &value);
 
 private:
-    Tp::ProtocolParameter const *m_parameter;
+    Tp::ProtocolParameter *m_parameter;
     const QVariant m_originalValue;
     QVariant m_currentValue;
 };

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list