[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [ring-kde/profile] src: profile: Restore profile support
From: Emmanuel Lepage Vallee <emmanuel.lepage () savoirfairelinux ! com>
Date: 2015-07-17 18:00:59
Message-ID: E1ZG9wR-0000B1-7c () scm ! kde ! org
[Download RAW message or body]
Git commit a4dd16e41e656d7c89a56101342a2b0438945148 by Emmanuel Lepage Vallee.
Committed on 13/07/2015 at 21:24.
Pushed by lepagevalleeemmanuel into branch 'profile'.
profile: Restore profile support
This was disabled because the daemon wasn't ready
Refs #77149
M +0 -3 src/CMakeLists.txt
M +3 -0 src/conf/account/CMakeLists.txt
M +59 -4 src/conf/account/accountpages/account.cpp
M +7 -0 src/conf/account/accountpages/account.h
R +76 -24 src/conf/account/accountpages/dlgprofiles.cpp [from: src/conf/dlgprofiles.cpp - 059% \
similarity] R +7 -0 src/conf/account/accountpages/dlgprofiles.h [from: src/conf/dlgprofiles.h - \
092% similarity] R +242 -19 src/conf/account/accountpages/dlgprofiles.ui [from: \
src/conf/dlgprofiles.ui - 063% similarity] M +17 -1 src/conf/account/accountpages/tabs.ui
R +0 -0 src/conf/account/delegates/categorizeddelegate.cpp [from: \
src/delegates/categorizeddelegate.cpp - 100% similarity] R +0 -0 \
src/conf/account/delegates/categorizeddelegate.h [from: src/delegates/categorizeddelegate.h - 100% \
similarity] M +27 -6 src/conf/account/dlgaccount.cpp
M +2 -0 src/conf/account/dlgaccount.h
M +1 -1 src/conf/dlgaccessibility.cpp
M +1 -1 src/widgets/bookmarkdock.cpp
M +1 -1 src/widgets/contactdock.cpp
M +2 -2 src/widgets/historydock.cpp
http://commits.kde.org/ring-kde/a4dd16e41e656d7c89a56101342a2b0438945148
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index dba3338..6fadb91 100755
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -161,7 +161,6 @@ SET(
delegates/conferencedelegate.cpp
delegates/contactdelegate.cpp
delegates/historydelegate.cpp
- delegates/categorizeddelegate.cpp
delegates/phonenumberdelegate.cpp
delegates/delegatedropoverlay.cpp
delegates/dialpaddelegate.cpp
@@ -185,7 +184,6 @@ SET(
conf/dlghooks.cpp
conf/dlgaccessibility.cpp
conf/dlgpresence.cpp
- conf/dlgprofiles.cpp
configurator/localhistoryconfigurator.cpp
configurator/audiorecordingconfigurator.cpp
configurator/fallbackpersonconfigurator.cpp
@@ -274,7 +272,6 @@ SET(
conf/dlgaccessibility.ui
conf/dlgaudiorecording.ui
conf/dlgpresence.ui
- conf/dlgprofiles.ui
conf/dlgfallbackperson.ui
widgets/ui/player.ui
widgets/ui/playeroverlay.ui
diff --git a/src/conf/account/CMakeLists.txt b/src/conf/account/CMakeLists.txt
index 30b9123..6b249bf 100644
--- a/src/conf/account/CMakeLists.txt
+++ b/src/conf/account/CMakeLists.txt
@@ -47,6 +47,7 @@ QT5_WRAP_UI(accountdialog_SRCS accountpages/ringtone.ui)
QT5_WRAP_UI(accountdialog_SRCS accountpages/dlgdht.ui)
QT5_WRAP_UI(accountdialog_SRCS accountpages/security.ui)
QT5_WRAP_UI(accountdialog_SRCS accountpages/tabs.ui)
+QT5_WRAP_UI(accountdialog_SRCS accountpages/dlgprofiles.ui)
QT5_WRAP_UI(accountdialog_SRCS accountdlg.ui)
# Add pages
@@ -58,6 +59,7 @@ SET(accountdialog_SRCS ${accountdialog_SRCS}
widgets/accountstatusviewer.cpp
delegates/righticondelegate.cpp
+ delegates/categorizeddelegate.cpp
accountpages/advanced.cpp
accountpages/credentials.cpp
@@ -69,6 +71,7 @@ SET(accountdialog_SRCS ${accountdialog_SRCS}
accountpages/pagebase.cpp
accountpages/account.cpp
accountpages/dlgdht.cpp
+ accountpages/dlgprofiles.cpp
)
ADD_LIBRARY(accountdialog STATIC ${accountdialog_SRCS})
diff --git a/src/conf/account/accountpages/account.cpp b/src/conf/account/accountpages/account.cpp
index 973ce02..2febdac 100644
--- a/src/conf/account/accountpages/account.cpp
+++ b/src/conf/account/accountpages/account.cpp
@@ -20,6 +20,7 @@
//Ring
#include <account.h>
#include <accountmodel.h>
+#include <profilemodel.h>
//Binder
#include "accountserializationadapter.h"
@@ -29,6 +30,14 @@
Pages::Account::Account(QWidget *parent) : PageBase(parent)
{
setupUi(this);
+
+ connect(dlgProfile, &DlgProfiles::changed,[this]() {
+ emit changed();
+ });
+
+ //Remove profile
+ m_pPages->removeTab(m_pPages->count()-1);
+
}
void Pages::Account::setAccount(::Account* a)
@@ -48,20 +57,62 @@ void Pages::Account::setAccount(::Account* a)
switch (a->protocol()) {
case ::Account::Protocol::RING:
case ::Account::Protocol::IAX:
- tabWidget->setTabEnabled(4,false);
+ m_pPages->setTabEnabled(4,false);
break;
case ::Account::Protocol::SIP:
- tabWidget->setTabEnabled(4, a->id() != "IP2IP");
+ m_pPages->setTabEnabled(4, a->id() != "IP2IP");
break;
case ::Account::Protocol::COUNT__:
break;
}
}
+void Pages::Account::displayProfile(bool display)
+{
+ if (display) {
+ while (m_pPages->count())
+ m_pPages->removeTab(0);
+
+ m_pPages->insertTab(0,dlgProfile,tr("Profile"));
+ }
+ else if (m_pPages->count() == 1) {
+ m_pPages->removeTab(0);
+ m_pPages->insertTab(0, dlgRingtone ,tr("Ringtone" ));
+ m_pPages->insertTab(0, dlgSecurity ,tr("Security" ));
+ m_pPages->insertTab(0, dlgCredentials,tr("Credentials"));
+ m_pPages->insertTab(0, dlgCodec ,tr("Codecs" ));
+ m_pPages->insertTab(0, dlgNetwork ,tr("Network" ));
+ m_pPages->insertTab(0, dlgAdvanced ,tr("Advanced" ));
+ m_pPages->insertTab(0, dlgBasic ,tr("Basic" ));
+ m_pPages->setCurrentIndex(0);
+ }
+}
+
+void Pages::Account::setProfile(Person* p)
+{
+ dlgProfile->loadPerson(p);
+ m_lToSave << p;
+}
+
void Pages::Account::setAccount(const QModelIndex& idx)
{
- if (::Account* a = AccountModel::instance()->getAccountByModelIndex(idx))
+
+ QModelIndex i = idx;
+
+ if (i.model() == ProfileModel::instance())
+ i = ProfileModel::instance()->mapToSource(i);
+
+ if (!i.isValid()) {
+ Person* p = ProfileModel::instance()->getPerson(idx);
+ if (p) {
+ setProfile(p);
+ displayProfile(true);
+ }
+ }
+ else if (::Account* a = AccountModel::instance()->getAccountByModelIndex(i)) {
+ displayProfile(false);
setAccount(a);
+ }
}
void Pages::Account::updateWidgets()
@@ -73,6 +124,10 @@ void Pages::Account::updateWidgets()
void Pages::Account::updateSettings()
{
qDebug() << "Update settings";
+ dlgProfile->saveToPerson();
+
+ foreach(Person* p, m_lToSave)
+ p->save();
}
void Pages::Account::slotUpdateButtons()
@@ -83,7 +138,7 @@ void Pages::Account::slotUpdateButtons()
void Pages::Account::selectAlias()
{
- QLineEdit* le = dlgBasic->lrcfg_alias;
+ QLineEdit* le = dlgBasic->lrcfg_alias;
le->setSelection(0,le->text().size());
le->setFocus(Qt::OtherFocusReason);
diff --git a/src/conf/account/accountpages/account.h b/src/conf/account/accountpages/account.h
index 03d5428..ab6d4ba 100644
--- a/src/conf/account/accountpages/account.h
+++ b/src/conf/account/accountpages/account.h
@@ -23,6 +23,7 @@
#include "ui_tabs.h"
class Account;
+class Person;
namespace Pages {
@@ -41,14 +42,20 @@ public Q_SLOTS:
public Q_SLOTS:
virtual void setAccount(::Account* a) override;
+ void setProfile(Person* p);
void setAccount(const QModelIndex& idx);
private Q_SLOTS:
void slotUpdateButtons();
+ void displayProfile(bool display);
+
+Q_SIGNALS:
+ void changed();
private:
//Attributes
Account* m_pAccount;
+ QList<Person*> m_lToSave;
};
}
diff --git a/src/conf/dlgprofiles.cpp b/src/conf/account/accountpages/dlgprofiles.cpp
similarity index 59%
rename from src/conf/dlgprofiles.cpp
rename to src/conf/account/accountpages/dlgprofiles.cpp
index 74c07a8..7fccf7d 100644
--- a/src/conf/dlgprofiles.cpp
+++ b/src/conf/account/accountpages/dlgprofiles.cpp
@@ -26,7 +26,8 @@
#include "profilemodel.h"
#include "personmodel.h"
-DlgProfiles::DlgProfiles(QWidget *parent, const QString& name, const QString& uri) : QWidget(parent)
+DlgProfiles::DlgProfiles(QWidget *parent, const QString& name, const QString& uri) : QWidget(parent),
+m_pCurrentPerson(nullptr)
{
setupUi(this);
edit_cell->setText(uri);
@@ -44,36 +45,82 @@ bool DlgProfiles::checkValues()
return !edit_name->text().isEmpty();
}
-Person* DlgProfiles::create(CollectionInterface* col)
+void DlgProfiles::loadPerson(Person* profile)
{
- if(checkValues()) {
+ edit_formattedName ->setText( profile->formattedName () );
+ edit_name ->setText( profile->firstName () );
+ edit_lname ->setText( profile->secondName () );
+ edit_email ->setText( profile->preferredEmail() );
+ edit_organization ->setText( profile->organization () );
+
+ if(photoView->pixmap()) {
+ const QPixmap photo = profile->photo().value<QPixmap>();
+ photoView->setPixmap(photo);
+ }
- Person* profile = new Person(col);
- profile->setUid(QString::number(QDateTime::currentDateTime().currentMSecsSinceEpoch()).toUtf8());
- profile->setFirstName(edit_name->text());
- profile->setFamilyName(edit_lname->text());
- profile->setPreferredEmail(edit_email->text());
- profile->setFormattedName(edit_name->text() + ' ' + edit_lname->text());
- profile->setOrganization(edit_organization->text());
- if(photoView->pixmap()) {
- QPixmap photo = *photoView->pixmap();
- profile->setPhoto(QVariant::fromValue(photo));
- }
+ m_pCurrentPerson = profile;
+}
+
+bool DlgProfiles::saveToPerson(Person* p)
+{
+ Person* profile = p?p:m_pCurrentPerson;
+
+ if (!profile)
+ return false;
+
+ if (profile->uid().isEmpty())
+ profile->setUid ( \
QString::number(QDateTime::currentDateTime().currentMSecsSinceEpoch()).toUtf8()); +
+ profile->setFirstName ( edit_name->text() \
); + profile->setFamilyName ( edit_lname->text() \
); + profile->setPreferredEmail( edit_email->text() \
); + profile->setOrganization ( edit_organization->text() \
); +
+ if (!edit_formattedName->text().isEmpty())
+ profile->setFormattedName (edit_formattedName->text());
+ else if (profile->formattedName().isEmpty())
+ profile->setFormattedName ( edit_name->text() + ' ' + edit_lname->text() \
); +
+ if(photoView->pixmap()) {
+ const QPixmap photo = *photoView->pixmap();
+ profile->setPhoto(QVariant::fromValue(photo));
+ }
+
+ bool hasAddress = (
+ (!edit_address_1->text ().isEmpty()) ||
+ (!edit_city->text ().isEmpty()) ||
+ (!edit_country->text ().isEmpty()) ||
+ (!cb_address_type->currentText().isEmpty()) ||
+ (!edit_postal_code->text ().isEmpty()) ||
+ (!edit_state->text ().isEmpty()) );
+ if (hasAddress) {
Person::Address* test = new Person::Address();
- test->setAddressLine(edit_address_1->text());
- test->setCity(edit_city->text());
- test->setCountry(edit_country->text());
- test->setType(cb_address_type->currentText());
- test->setZipCode(edit_postal_code->text());
- test->setState(edit_state->text());
+ test->setAddressLine( edit_address_1 ->text ());
+ test->setCity ( edit_city ->text ());
+ test->setCountry ( edit_country ->text ());
+ test->setType ( cb_address_type ->currentText());
+ test->setZipCode ( edit_postal_code->text ());
+ test->setState ( edit_state ->text ());
profile->addAddress(test);
+ }
+
+ //Get values of custom fields
+ for (QString key : m_hCustomFields.keys()) {
+ profile->addCustomField(key, m_hCustomFields.value(key)->text());
+ }
+
+ return true;
+}
+
+Person* DlgProfiles::create(CollectionInterface* col)
+{
+ if(checkValues()) {
+
+ Person* profile = new Person(col);
- //Get values of custom fields
- for (QString key : m_hCustomFields.keys()) {
- profile->addCustomField(key, m_hCustomFields.value(key)->text());
- }
+ saveToPerson(profile);
return profile;
}
@@ -147,3 +194,8 @@ void DlgProfiles::addCustomField()
}
}
+void DlgProfiles::slotChanged()
+{
+ emit changed();
+}
+
diff --git a/src/conf/dlgprofiles.h b/src/conf/account/accountpages/dlgprofiles.h
similarity index 92%
rename from src/conf/dlgprofiles.h
rename to src/conf/account/accountpages/dlgprofiles.h
index 0c14f80..af4183d 100644
--- a/src/conf/dlgprofiles.h
+++ b/src/conf/account/accountpages/dlgprofiles.h
@@ -41,16 +41,23 @@ public:
private:
QHash<QString, QLineEdit*> m_hCustomFields;
+ Person* m_pCurrentPerson;
public Q_SLOTS:
+ void loadPerson(Person* p);
+ bool saveToPerson(Person* p = nullptr);
Person* create(CollectionInterface* col);
void cancel();
void accept();
void choosePhoto();
void addCustomField();
+private Q_SLOTS:
+ void slotChanged();
+
Q_SIGNALS:
void requestSave();
void requestCancel();
+ void changed();
};
#endif
diff --git a/src/conf/dlgprofiles.ui b/src/conf/account/accountpages/dlgprofiles.ui
similarity index 63%
rename from src/conf/dlgprofiles.ui
rename to src/conf/account/accountpages/dlgprofiles.ui
index 4461cb3..9d9ffbd 100644
--- a/src/conf/dlgprofiles.ui
+++ b/src/conf/account/accountpages/dlgprofiles.ui
@@ -167,58 +167,58 @@
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
- <item row="0" column="0">
+ <item row="1" column="0">
<widget class="QLabel" name="label_name">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
- <item row="1" column="0">
+ <item row="2" column="0">
<widget class="QLabel" name="label_lname">
<property name="text">
<string>Last Name</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<widget class="QLineEdit" name="edit_lname">
<property name="placeholderText">
<string>Family name...</string>
</property>
</widget>
</item>
- <item row="2" column="0">
+ <item row="3" column="0">
<widget class="QLabel" name="label_email">
<property name="text">
<string>Email</string>
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="3" column="1">
<widget class="QLineEdit" name="edit_email"/>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="label_cell">
<property name="text">
<string>Phone number</string>
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="4" column="1">
<widget class="QLineEdit" name="edit_cell"/>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="label_organization">
<property name="text">
<string>Organization</string>
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="5" column="1">
<widget class="QLineEdit" name="edit_organization"/>
</item>
- <item row="5" column="1">
+ <item row="6" column="1">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QPushButton" name="btn_add_field">
@@ -239,13 +239,27 @@
</item>
</layout>
</item>
- <item row="0" column="1">
+ <item row="1" column="1">
<widget class="QLineEdit" name="edit_name">
<property name="placeholderText">
<string>First name...</string>
</property>
</widget>
</item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Formatted name</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="edit_formattedName">
+ <property name="placeholderText">
+ <string>A pseudonym or a full name</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
@@ -270,8 +284,8 @@
<slot>choosePhoto()</slot>
<hints>
<hint type="sourcelabel">
- <x>76</x>
- <y>219</y>
+ <x>80</x>
+ <y>413</y>
</hint>
<hint type="destinationlabel">
<x>3</x>
@@ -286,8 +300,8 @@
<slot>addCustomField()</slot>
<hints>
<hint type="sourcelabel">
- <x>758</x>
- <y>246</y>
+ <x>820</x>
+ <y>191</y>
</hint>
<hint type="destinationlabel">
<x>822</x>
@@ -302,8 +316,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
- <x>699</x>
- <y>449</y>
+ <x>784</x>
+ <y>567</y>
</hint>
<hint type="destinationlabel">
<x>667</x>
@@ -318,8 +332,8 @@
<slot>cancel()</slot>
<hints>
<hint type="sourcelabel">
- <x>610</x>
- <y>452</y>
+ <x>695</x>
+ <y>567</y>
</hint>
<hint type="destinationlabel">
<x>500</x>
@@ -327,11 +341,220 @@
</hint>
</hints>
</connection>
+ <connection>
+ <sender>edit_formattedName</sender>
+ <signal>textChanged(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>222</x>
+ <y>23</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>238</x>
+ <y>3</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>edit_name</sender>
+ <signal>textChanged(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>209</x>
+ <y>46</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>217</x>
+ <y>1</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>edit_lname</sender>
+ <signal>textChanged(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>254</x>
+ <y>78</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>202</x>
+ <y>1</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>edit_lname</sender>
+ <signal>textChanged(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>315</x>
+ <y>75</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>102</x>
+ <y>2</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>edit_email</sender>
+ <signal>textChanged(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>387</x>
+ <y>107</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>351</x>
+ <y>1</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>edit_cell</sender>
+ <signal>textChanged(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>444</x>
+ <y>133</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>408</x>
+ <y>1</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>edit_organization</sender>
+ <signal>textChanged(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>489</x>
+ <y>154</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>466</x>
+ <y>2</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btn_add_field</sender>
+ <signal>clicked()</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>785</x>
+ <y>176</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>510</x>
+ <y>3</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>edit_address_1</sender>
+ <signal>textEdited(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>20</x>
+ <y>461</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>-5</x>
+ <y>277</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>edit_country</sender>
+ <signal>textEdited(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>97</x>
+ <y>479</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>1</x>
+ <y>317</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>edit_city</sender>
+ <signal>textEdited(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>330</x>
+ <y>481</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>2</x>
+ <y>361</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>edit_state</sender>
+ <signal>textEdited(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>571</x>
+ <y>491</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>-1</x>
+ <y>401</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>edit_postal_code</sender>
+ <signal>textChanged(QString)</signal>
+ <receiver>DlgProfiles</receiver>
+ <slot>slotChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>769</x>
+ <y>483</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>834</x>
+ <y>496</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
<slots>
<slot>accept()</slot>
<slot>cancel()</slot>
<slot>choosePhoto()</slot>
<slot>addCustomField()</slot>
+ <slot>slotChanged()</slot>
</slots>
</ui>
diff --git a/src/conf/account/accountpages/tabs.ui b/src/conf/account/accountpages/tabs.ui
index 33208cc..4abe65e 100644
--- a/src/conf/account/accountpages/tabs.ui
+++ b/src/conf/account/accountpages/tabs.ui
@@ -12,7 +12,7 @@
</property>
<layout class="QGridLayout">
<item row="0" column="0">
- <widget class="QTabWidget" name="tabWidget">
+ <widget class="QTabWidget" name="m_pPages">
<property name="currentIndex">
<number>0</number>
</property>
@@ -86,6 +86,16 @@
</item>
</layout>
</widget>
+ <widget class="QWidget" name="tab_8">
+ <attribute name="title">
+ <string>Profile</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_8">
+ <item>
+ <widget class="DlgProfiles" name="dlgProfile" native="true"/>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
</layout>
@@ -133,6 +143,12 @@
<header>accountpages/security.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>DlgProfiles</class>
+ <extends>QWidget</extends>
+ <header>accountpages/dlgprofiles.h</header>
+ <container>1</container>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/src/delegates/categorizeddelegate.cpp b/src/conf/account/delegates/categorizeddelegate.cpp
similarity index 100%
rename from src/delegates/categorizeddelegate.cpp
rename to src/conf/account/delegates/categorizeddelegate.cpp
diff --git a/src/delegates/categorizeddelegate.h b/src/conf/account/delegates/categorizeddelegate.h
similarity index 100%
rename from src/delegates/categorizeddelegate.h
rename to src/conf/account/delegates/categorizeddelegate.h
diff --git a/src/conf/account/dlgaccount.cpp b/src/conf/account/dlgaccount.cpp
index c1cc201..c134533 100644
--- a/src/conf/account/dlgaccount.cpp
+++ b/src/conf/account/dlgaccount.cpp
@@ -20,25 +20,30 @@
//Ring
#include <accountmodel.h>
+#include <profilemodel.h>
#include <account.h>
#include <protocolmodel.h>
#include "accountpages/account.h"
#include "delegates/righticondelegate.h"
+#include <delegates/categorizeddelegate.h>
#include <QtGui/QPainter>
#include <QtWidgets/QMessageBox>
-DlgAccount::DlgAccount(QWidget* parent) : QWidget(parent)
+DlgAccount::DlgAccount(QWidget* parent) : QWidget(parent),m_HasChanged(false)
{
setupUi(this);
- m_pAccountList->setModel ( AccountModel::instance() );
- m_pAccountList->setSelectionModel( AccountModel::instance()->selectionModel() );
+ m_pAccountList->setModel ( ProfileModel::instance() );
+ m_pAccountList->setSelectionModel( ProfileModel::instance()->selectionModel() );
- m_pAccountList->setItemDelegate(new RightIconDelegate(this, (int)Account::Role::SecurityLevelIcon, \
0.2f)); + CategorizedDelegate* delegate = new CategorizedDelegate(m_pAccountList);
+ delegate->setChildDelegate(new RightIconDelegate(this, (int)Account::Role::SecurityLevelIcon, 0.2f));
+
+ m_pAccountList->setItemDelegate(delegate);
m_pProtocolModel = new ProtocolModel();
@@ -55,12 +60,26 @@ DlgAccount::DlgAccount(QWidget* parent) : QWidget(parent)
const QModelIndex idx = AccountModel::instance()->index(0,0);
m_pAccountList->selectionModel()->setCurrentIndex(idx, QItemSelectionModel::ClearAndSelect);
m_pPanel->setAccount(idx);
+
+ m_pAccountList->expandAll();
+
+ connect(ProfileModel::instance(), &ProfileModel::rowsInserted, this, &DlgAccount::slotExpand);
+
+ connect(m_pPanel, &Pages::Account::changed, [this]() {
+ m_HasChanged = true;
+ updateButtons();
+ });
}
DlgAccount::~DlgAccount()
{
}
+void DlgAccount::slotExpand()
+{
+ m_pAccountList->expandAll();
+}
+
void DlgAccount::slotRemoveAccount()
{
const QModelIndex& idx = AccountModel::instance()->selectionModel()->currentIndex();
@@ -114,17 +133,19 @@ void DlgAccount::cancel()
bool DlgAccount::hasChanged()
{
- return AccountModel::instance()->editState() != AccountModel::EditState::SAVED;
+ return m_HasChanged || AccountModel::instance()->editState() != AccountModel::EditState::SAVED;
}
void DlgAccount::updateSettings()
{
+ m_pPanel->updateSettings();
AccountModel::instance()->save();
+ m_HasChanged = false;
}
void DlgAccount::updateWidgets()
{
-
+ m_HasChanged = false;
}
#include "dlgaccount.moc"
diff --git a/src/conf/account/dlgaccount.h b/src/conf/account/dlgaccount.h
index 16b6677..7346b78 100644
--- a/src/conf/account/dlgaccount.h
+++ b/src/conf/account/dlgaccount.h
@@ -41,6 +41,7 @@ public:
private:
Pages::Account* m_pCurrentAccount;
ProtocolModel* m_pProtocolModel;
+ bool m_HasChanged;
public Q_SLOTS:
//Housekeeping
@@ -54,6 +55,7 @@ public Q_SLOTS:
private Q_SLOTS:
void slotUpdateButtons();
void slotRemoveAccount();
+ void slotExpand();
Q_SIGNALS:
void updateButtons();
diff --git a/src/conf/dlgaccessibility.cpp b/src/conf/dlgaccessibility.cpp
index 576a658..9d28221 100644
--- a/src/conf/dlgaccessibility.cpp
+++ b/src/conf/dlgaccessibility.cpp
@@ -30,7 +30,7 @@
//Ring
#include <macromodel.h>
#include <macro.h>
-#include "../delegates/categorizeddelegate.h"
+#include <conf/account/delegates/categorizeddelegate.h>
///Constructor
DlgAccessibility::DlgAccessibility(KConfigDialog* parent)
diff --git a/src/widgets/bookmarkdock.cpp b/src/widgets/bookmarkdock.cpp
index b702351..1f80770 100644
--- a/src/widgets/bookmarkdock.cpp
+++ b/src/widgets/bookmarkdock.cpp
@@ -50,7 +50,7 @@
#include "availableaccountmodel.h"
#include "callmodel.h"
#include "categorizedtreeview.h"
-#include "../delegates/categorizeddelegate.h"
+#include <conf/account/delegates/categorizeddelegate.h>
#include "../delegates/historydelegate.h"
///Constructor
diff --git a/src/widgets/contactdock.cpp b/src/widgets/contactdock.cpp
index c9dcab7..5fc81cf 100644
--- a/src/widgets/contactdock.cpp
+++ b/src/widgets/contactdock.cpp
@@ -59,7 +59,7 @@
#include "klib/helperfunctions.h"
#include "klib/kcfg_settings.h"
#include "categorizedcontactmodel.h"
-#include "../delegates/categorizeddelegate.h"
+#include <conf/account/delegates/categorizeddelegate.h>
#include "../delegates/contactdelegate.h"
#include "../delegates/phonenumberdelegate.h"
diff --git a/src/widgets/historydock.cpp b/src/widgets/historydock.cpp
index d8d9ac4..83ee595 100755
--- a/src/widgets/historydock.cpp
+++ b/src/widgets/historydock.cpp
@@ -57,8 +57,8 @@
#include "phonedirectorymodel.h"
#include "collectioninterface.h"
#include "personmodel.h"
-#include "conf/dlgprofiles.h"
-#include "../delegates/categorizeddelegate.h"
+#include <conf/account/accountpages/dlgprofiles.h>
+#include <conf/account/delegates/categorizeddelegate.h>
#include "../delegates/historydelegate.h"
//Ring library
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic