Commit 8e46d835 authored by atraczyk's avatar atraczyk Committed by Andreas Traczyk

ui/ux: order smartlist better

- add new contacts to the top of the smartlist
- serialize/deserialize the smartlist/contact list preserving the order
  of the items

Change-Id: I265b4df40d26712d77a682c0d5900609a72ad285
Tuleap: #790
parent 40afd723
......@@ -72,7 +72,7 @@
VerticalScrollBarVisibility="Hidden">
<StackPanel MaxWidth="500"
Width="310">
<TextBlock Text="Ring version: 2016/12/29"
<TextBlock Text="Ring version: 2017/1/3"
TextWrapping="Wrap"
TextAlignment="Justify"
Margin="0,0,0,24"
......
......@@ -146,7 +146,7 @@ ContactsViewModel::Stringify()
{
JsonArray^ jsonArray = ref new JsonArray();
for (unsigned int i = 0; i < contactsList_->Size; i++) {
for (int i = contactsList_->Size - 1; i >= 0; i--) {
jsonArray->Append(contactsList_->GetAt(i)->ToJsonObject());
}
......@@ -170,7 +170,7 @@ ContactsViewModel::Destringify(String^ data)
String^ lastTime;
JsonArray^ contactlist = jsonObject->GetNamedArray(contactListKey, ref new JsonArray());
for (unsigned int i = 0; i < contactlist->Size; i++) {
for (int i = contactlist->Size - 1; i >= 0; i--) {
IJsonValue^ contact = contactlist->GetAt(i);
if (contact->ValueType == JsonValueType::Object) {
JsonObject^ jsonContactObject = contact->GetObject();
......
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap uap3 mp">
<Identity Name="Savoir-faireLinux.GNURing" Publisher="CN=8121A5F7-3CA1-4CAA-92B2-4F595B011941" Version="1.1.20.0" />
<Identity Name="Savoir-faireLinux.GNURing" Publisher="CN=8121A5F7-3CA1-4CAA-92B2-4F595B011941" Version="1.1.21.0" />
<mp:PhoneIdentity PhoneProductId="2385953f-9019-423d-aa82-d1bbacfa258b" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>GNU Ring</DisplayName>
......
......@@ -121,7 +121,8 @@ SmartPanel::SmartPanel()
ContactsViewModel::instance->contactAdded += ref new ContactAdded([this](Contact^ contact) {
auto smartPanelItem = ref new SmartPanelItem();
smartPanelItem->_contact = contact;
SmartPanelItemsViewModel::instance->itemsList->Append(smartPanelItem);
contact->_lastTime;
SmartPanelItemsViewModel::instance->itemsList->InsertAt(0, smartPanelItem);
});
RingD::instance->exportOnRingEnded += ref new RingClientUWP::ExportOnRingEnded(this, &RingClientUWP::Views::SmartPanel::OnexportOnRingEnded);
......@@ -154,8 +155,8 @@ SmartPanel::OnstateChange(Platform::String ^callId, RingClientUWP::CallStatus st
case CallStatus::ENDED:
{
auto callsList = DRing::getCallList();
if (callsList.empty())
_settingsMenuButton_->Visibility = VIS::Visible;
if (callsList.empty())
_settingsMenuButton_->Visibility = VIS::Visible;
break;
}
case CallStatus::IN_PROGRESS:
......
......@@ -89,11 +89,19 @@ void RingClientUWP::ViewModel::SmartPanelItemsViewModel::removeItem(SmartPanelIt
void RingClientUWP::ViewModel::SmartPanelItemsViewModel::moveItemToTheTop(SmartPanelItem ^ item)
{
unsigned int index;
unsigned int spi_index, cl_index;
if (itemsList->IndexOf(item, &spi_index)) {
if (spi_index != 0) {
auto contactList = ContactsViewModel::instance->contactsList;
auto contactListItem = ContactsViewModel::instance->findContactByName(item->_contact->_name);
contactList->IndexOf(contactListItem, &cl_index);
contactList->RemoveAt(cl_index);
contactList->Append(contactListItem);
ContactsViewModel::instance->saveContactsToFile();
if (itemsList->IndexOf(item, &index)) {
if (index != 0) {
itemsList->RemoveAt(index);
itemsList->RemoveAt(spi_index);
itemsList->InsertAt(0, item);
item->_isHovered = false;
}
......
......@@ -56,11 +56,17 @@ VCard::receiveChunk(const std::string& args, const std::string& payload)
m_mParts.clear();
bool foundUID = false;
while (std::getline(_payload, _line)) {
if (_line.find("UID:") != std::string::npos)
if (_line.find("UID:") != std::string::npos) {
foundUID = true;
break;
}
}
m_mParts[Property::UID] = _line.substr(4);
if (foundUID)
m_mParts[Property::UID] = _line.substr(4);
else
m_mParts[Property::UID] = Utils::genID(0LL, 9999999999999LL);
bool fnFound = false;
while (std::getline(_payload, _line)) {
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment