[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:58:39 UTC 2016


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

The following commit has been merged in the master branch:
commit ba894b0abded5e920d9d74e077abd6e0df49efb2
Author: Thomas Richard <thomas9999 at gmail.com>
Date:   Sun Jan 9 17:49:23 2011 +0100

    Consistent use of the Ui files (using pointers)
    Delete private of
    Various UI fixes
---
 src/KCMTelepathyAccounts/account-edit-widget.cpp   | 32 ++++++++++++----------
 src/KCMTelepathyAccounts/account-edit-widget.ui    | 25 ++++-------------
 src/KCMTelepathyAccounts/parameter-edit-widget.cpp |  1 +
 src/KCMTelepathyAccounts/parameter-edit-widget.ui  |  9 ++++++
 .../protocol-select-widget.cpp                     |  1 +
 src/kcm-telepathy-accounts.cpp                     | 32 ++++++++++++----------
 src/kcm-telepathy-accounts.h                       | 10 +++++--
 src/main-widget.ui                                 |  8 +++---
 8 files changed, 63 insertions(+), 55 deletions(-)

diff --git a/src/KCMTelepathyAccounts/account-edit-widget.cpp b/src/KCMTelepathyAccounts/account-edit-widget.cpp
index b2afd2f..bb37484 100644
--- a/src/KCMTelepathyAccounts/account-edit-widget.cpp
+++ b/src/KCMTelepathyAccounts/account-edit-widget.cpp
@@ -46,7 +46,7 @@ public:
     QVariantMap parameterValues;
 
     AbstractAccountUi *accountUi;
-    Ui::AccountEditWidget ui;
+    Ui::AccountEditWidget *ui;
     AbstractAccountParametersWidget *mainOptionsWidget;
     QList<ProtocolParameterValue> advancedParameterValues;
 };
@@ -62,21 +62,17 @@ AccountEditWidget::AccountEditWidget(const QString &connectionManager,
     kDebug();
 
     // Set up the interface
-    d->ui.setupUi(this);
-
-    // create a layout on the central widget so that the config page is properly
-    // resized
-    QHBoxLayout* layout = new QHBoxLayout(d->ui.centralWidget);
-    layout->setContentsMargins(0,0,0,0);
+    d->ui = new Ui::AccountEditWidget;
+    d->ui->setupUi(this);
 
     d->connectionManager = connectionManager;
     d->protocol = protocol;
     d->parameters = parameters;
     d->parameterValues = parameterValues;
 
-    connect(d->ui.advancedButton, SIGNAL(clicked()),
+    connect(d->ui->advancedButton, SIGNAL(clicked()),
             this, SLOT(onAdvancedClicked()));
-    d->ui.advancedButton->setIcon(KIcon("configure"));
+    d->ui->advancedButton->setIcon(KIcon("configure"));
 
     loadWidgets();
 }
@@ -84,6 +80,9 @@ AccountEditWidget::AccountEditWidget(const QString &connectionManager,
 AccountEditWidget::~AccountEditWidget()
 {
     kDebug();
+
+    delete d->ui;
+    delete d;
 }
 
 bool AccountEditWidget::validateParameterValues() const
@@ -122,8 +121,11 @@ void AccountEditWidget::loadWidgets()
         // UI does exist, set it up.
         d->mainOptionsWidget = d->accountUi->mainOptionsWidget(d->parameters,
                                                                d->parameterValues,
-                                                               d->ui.centralWidget);
-        d->ui.advancedButton->setVisible(d->accountUi->hasAdvancedOptionsWidget());
+                                                               this);
+        //Widgets wrapped in a layout should not have double margins
+        d->mainOptionsWidget->layout()->setContentsMargins(0, 0, 0, 0);
+        d->ui->advancedButton->setVisible(d->accountUi->hasAdvancedOptionsWidget());
+        d->ui->verticalLayout->insertWidget(0, d->mainOptionsWidget);
 
         // check if all the parameters the UI supports are available in the CM plugin
         // also verify if the UI handle all mandatory parameters
@@ -159,11 +161,11 @@ void AccountEditWidget::loadWidgets()
         d->mainOptionsWidget = new ParameterEditWidget(
                 d->parameters,
                 d->parameterValues,
-                d->ui.centralWidget);
-        d->ui.advancedButton->setVisible(false);
+                this);
+        d->ui->advancedButton->setVisible(false);
+        d->ui->verticalLayout->insertWidget(0, d->mainOptionsWidget);
+        d->ui->verticalLayout->setStretch(0, 1);
     }
-
-    d->ui.centralWidget->layout()->addWidget(d->mainOptionsWidget);
 }
 
 void AccountEditWidget::onAdvancedClicked()
diff --git a/src/KCMTelepathyAccounts/account-edit-widget.ui b/src/KCMTelepathyAccounts/account-edit-widget.ui
index 5a901a4..8e20ad1 100644
--- a/src/KCMTelepathyAccounts/account-edit-widget.ui
+++ b/src/KCMTelepathyAccounts/account-edit-widget.ui
@@ -7,29 +7,16 @@
     <x>0</x>
     <y>0</y>
     <width>394</width>
-    <height>63</height>
+    <height>25</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <property name="spacing">
-    <number>10</number>
+    <number>0</number>
+   </property>
+   <property name="margin">
+    <number>0</number>
    </property>
-   <item>
-    <widget class="QWidget" name="centralWidget" native="true">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="minimumSize">
-      <size>
-       <width>0</width>
-       <height>0</height>
-      </size>
-     </property>
-    </widget>
-   </item>
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
@@ -47,7 +34,7 @@
        <property name="sizeHint" stdset="0">
         <size>
          <width>40</width>
-         <height>20</height>
+         <height>0</height>
         </size>
        </property>
       </spacer>
diff --git a/src/KCMTelepathyAccounts/parameter-edit-widget.cpp b/src/KCMTelepathyAccounts/parameter-edit-widget.cpp
index 9d071e3..7dd1e53 100644
--- a/src/KCMTelepathyAccounts/parameter-edit-widget.cpp
+++ b/src/KCMTelepathyAccounts/parameter-edit-widget.cpp
@@ -72,6 +72,7 @@ ParameterEditWidget::~ParameterEditWidget()
 {
     kDebug();
 
+    delete d->ui;
     delete d;
 }
 
diff --git a/src/KCMTelepathyAccounts/parameter-edit-widget.ui b/src/KCMTelepathyAccounts/parameter-edit-widget.ui
index 25a2453..6c5e45c 100644
--- a/src/KCMTelepathyAccounts/parameter-edit-widget.ui
+++ b/src/KCMTelepathyAccounts/parameter-edit-widget.ui
@@ -10,7 +10,16 @@
     <height>300</height>
    </rect>
   </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
   <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="margin">
+    <number>0</number>
+   </property>
    <item>
     <widget class="QListView" name="parameterListView"/>
    </item>
diff --git a/src/KCMTelepathyAccounts/protocol-select-widget.cpp b/src/KCMTelepathyAccounts/protocol-select-widget.cpp
index fa4b3c6..f53c5b7 100644
--- a/src/KCMTelepathyAccounts/protocol-select-widget.cpp
+++ b/src/KCMTelepathyAccounts/protocol-select-widget.cpp
@@ -73,6 +73,7 @@ ProtocolSelectWidget::~ProtocolSelectWidget()
 {
     kDebug();
 
+    delete d->ui;
     delete d;
 }
 
diff --git a/src/kcm-telepathy-accounts.cpp b/src/kcm-telepathy-accounts.cpp
index 83550b8..554f6d1 100644
--- a/src/kcm-telepathy-accounts.cpp
+++ b/src/kcm-telepathy-accounts.cpp
@@ -20,6 +20,8 @@
 
 #include "kcm-telepathy-accounts.h"
 
+#include "ui_main-widget.h"
+
 #include "accounts-list-model.h"
 #include "add-account-assistant.h"
 #include "edit-account-dialog.h"
@@ -64,26 +66,27 @@ KCMTelepathyAccounts::KCMTelepathyAccounts(QWidget *parent, const QVariantList&
             SLOT(onAccountManagerReady(Tp::PendingOperation*)));
 
     // Set up the UI stuff.
-    setupUi(this);
+    m_ui = new Ui::MainWidget;
+    m_ui->setupUi(this);
 
     m_accountsListModel = new AccountsListModel(this);
-    m_accountsListView->setModel(m_accountsListModel);
+    m_ui->accountsListView->setModel(m_accountsListModel);
 
-    m_addAccountButton->setIcon(KIcon("list-add"));
-    m_editAccountButton->setIcon(KIcon("configure"));
-    m_removeAccountButton->setIcon(KIcon("edit-delete"));
+    m_ui->addAccountButton->setIcon(KIcon("list-add"));
+    m_ui->editAccountButton->setIcon(KIcon("configure"));
+    m_ui->removeAccountButton->setIcon(KIcon("edit-delete"));
 
     // Connect to useful signals from the UI elements.
-    connect(m_addAccountButton,
+    connect(m_ui->addAccountButton,
             SIGNAL(clicked()),
             SLOT(onAddAccountClicked()));
-    connect(m_editAccountButton,
+    connect(m_ui->editAccountButton,
             SIGNAL(clicked()),
             SLOT(onEditAccountClicked()));
-    connect(m_removeAccountButton,
+    connect(m_ui->removeAccountButton,
             SIGNAL(clicked()),
             SLOT(onRemoveAccountClicked()));
-    connect(m_accountsListView->selectionModel(),
+    connect(m_ui->accountsListView->selectionModel(),
             SIGNAL(currentChanged(QModelIndex, QModelIndex)),
             SLOT(onSelectedItemChanged()));
 }
@@ -92,6 +95,7 @@ KCMTelepathyAccounts::~KCMTelepathyAccounts()
 {
     kDebug();
 
+    delete m_ui;
     // TODO: Implement me!
 }
 
@@ -134,9 +138,9 @@ void KCMTelepathyAccounts::onAccountCreated(const Tp::AccountPtr &account)
 
 void KCMTelepathyAccounts::onSelectedItemChanged()
 {
-    bool isAccount = m_accountsListView->currentIndex().isValid();
-    m_removeAccountButton->setEnabled(isAccount);
-    m_editAccountButton->setEnabled(isAccount);
+    bool isAccount = m_ui->accountsListView->currentIndex().isValid();
+    m_ui->removeAccountButton->setEnabled(isAccount);
+    m_ui->editAccountButton->setEnabled(isAccount);
 }
 
 void KCMTelepathyAccounts::onAddAccountClicked()
@@ -162,7 +166,7 @@ void KCMTelepathyAccounts::onEditAccountClicked()
         return;
     }
 
-    QModelIndex index = m_accountsListView->currentIndex();
+    QModelIndex index = m_ui->accountsListView->currentIndex();
     AccountItem *item = m_accountsListModel->itemForIndex(index);
 
     if (!item)
@@ -176,7 +180,7 @@ void KCMTelepathyAccounts::onEditAccountClicked()
 void KCMTelepathyAccounts::onRemoveAccountClicked()
 {
     kDebug();
-    QModelIndex index = m_accountsListView->currentIndex();
+    QModelIndex index = m_ui->accountsListView->currentIndex();
 
      if ( KMessageBox::warningContinueCancel( this, i18n( "Are you sure you want to remove the account \"%1\"?", m_accountsListModel->data(index, Qt::DisplayRole).toString()),
                                         i18n( "Remove Account" ), KGuiItem(i18n( "Remove Account" ), "edit-delete"), KStandardGuiItem::cancel(),
diff --git a/src/kcm-telepathy-accounts.h b/src/kcm-telepathy-accounts.h
index 9ea44c3..a8961f7 100644
--- a/src/kcm-telepathy-accounts.h
+++ b/src/kcm-telepathy-accounts.h
@@ -21,8 +21,6 @@
 #ifndef TELEPATHY_ACCOUNTS_KCM_KCM_TELEPATHY_ACCOUNTS_H
 #define TELEPATHY_ACCOUNTS_KCM_KCM_TELEPATHY_ACCOUNTS_H
 
-#include "ui_main-widget.h"
-
 #include <KCModule>
 
 #include <TelepathyQt4/AccountManager>
@@ -34,7 +32,11 @@ namespace Tp {
     class PendingOperation;
 }
 
-class KCMTelepathyAccounts : public KCModule, Ui::MainWidget
+namespace Ui {
+    class MainWidget;
+}
+
+class KCMTelepathyAccounts : public KCModule
 {
     Q_OBJECT
     Q_DISABLE_COPY(KCMTelepathyAccounts);
@@ -58,6 +60,8 @@ private Q_SLOTS:
     void onRemoveAccountClicked();
 
 private:
+    Ui::MainWidget *m_ui;
+
     Tp::AccountManagerPtr m_accountManager;
     AccountsListModel *m_accountsListModel;
     AddAccountAssistant *m_addAccountAssistant;
diff --git a/src/main-widget.ui b/src/main-widget.ui
index b8ad1e5..1499951 100644
--- a/src/main-widget.ui
+++ b/src/main-widget.ui
@@ -14,7 +14,7 @@
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
-      <widget class="QListView" name="m_accountsListView">
+      <widget class="QListView" name="accountsListView">
        <property name="iconSize">
         <size>
          <width>32</width>
@@ -31,14 +31,14 @@
           <enum>QLayout::SetFixedSize</enum>
          </property>
          <item>
-          <widget class="KPushButton" name="m_addAccountButton">
+          <widget class="KPushButton" name="addAccountButton">
            <property name="text">
             <string>Add Account</string>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="KPushButton" name="m_editAccountButton">
+          <widget class="KPushButton" name="editAccountButton">
            <property name="enabled">
             <bool>false</bool>
            </property>
@@ -48,7 +48,7 @@
           </widget>
          </item>
          <item>
-          <widget class="KPushButton" name="m_removeAccountButton">
+          <widget class="KPushButton" name="removeAccountButton">
            <property name="enabled">
             <bool>false</bool>
            </property>

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list