Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-client-uwp
Commits
5a197d5c
Commit
5a197d5c
authored
Oct 25, 2016
by
Nicolas Jager
Browse files
smartpanel : delete ring account from the panel
Change-Id: Ie40094e31cfb975ea7f518f068b6c38eb5504e6b Tuleap: #1246
parent
d8e49595
Changes
4
Hide whitespace changes
Inline
Side-by-side
AccountListItem.h
View file @
5a197d5c
...
...
@@ -37,20 +37,21 @@ public:
property
bool
_isSelected
{
void
set
(
bool
value
)
{
isSelected_
=
value
;
NotifyPropertyChanged
(
"_isSelected"
);
if
(
!
_disconnected
)
NotifyPropertyChanged
(
"_isSelected"
);
}
bool
get
()
{
return
isSelected_
;
}
}
property
bool
_editionMode
;
property
bool
_disconnected
;
protected:
void
NotifyPropertyChanged
(
String
^
propertyName
);
private:
bool
isSelected_
;
};
}
}
...
...
AccountListItemsViewModel.cpp
View file @
5a197d5c
...
...
@@ -60,3 +60,14 @@ RingClientUWP::ViewModel::AccountListItemsViewModel::findItem(String^ accountId)
return
nullptr
;
}
void
RingClientUWP
::
ViewModel
::
AccountListItemsViewModel
::
removeItem
(
AccountListItem
^
item
)
{
unsigned
int
index
;
itemsList_
->
IndexOf
(
item
,
&
index
);
item
->
_disconnected
=
true
;
// avoid disconected exception.
itemsList_
->
RemoveAt
(
index
);
}
AccountListItemsViewModel.h
View file @
5a197d5c
...
...
@@ -43,6 +43,7 @@ internal:
/* functions */
AccountListItem
^
findItem
(
String
^
accountId
);
void
removeItem
(
AccountListItem
^
item
);
/* properties */
property
Vector
<
AccountListItem
^>^
itemsList
...
...
SmartPanel.xaml.cpp
View file @
5a197d5c
...
...
@@ -727,6 +727,8 @@ void RingClientUWP::Views::SmartPanel::_editAccountMenuButton__Click(Platform::O
auto
account
=
AccountListItemsViewModel
::
instance
->
_selectedItem
->
_account
;
_aliasTextBoxEditionMenu_
->
Text
=
account
->
name_
;
_accountEditionMenuGrid_
->
Visibility
=
Windows
::
UI
::
Xaml
::
Visibility
::
Visible
;
_deleteAccountBtnEditionMenu_
->
IsChecked
=
false
;
_deleteAccountBtnEditionMenu_
->
IsEnabled
=
(
AccountListItemsViewModel
::
instance
->
itemsList
->
Size
>
1
)
?
true
:
false
;
}
...
...
@@ -739,19 +741,19 @@ void RingClientUWP::Views::SmartPanel::_acceptAccountModification__Click(Platfor
// mettre ca en visibility du bouton delete
auto
accountsListSize
=
dynamic_cast
<
Vector
<
AccountListItem
^>^>
(
_accountsList_
->
ItemsSource
)
->
Size
;
/* if the delete button is toggled, just delete the account */
if
(
_deleteAccountBtnEditionMenu_
->
IsChecked
&&
accountsListSize
>
1
)
{
RingD
::
instance
->
deleteAccount
(
accountId
);
AccountListItem
^
item
;
for
each
(
item
in
AccountListItemsViewModel
::
instance
->
itemsList
)
if
(
item
->
_account
->
accountID_
==
accountId
)
break
;
/* rebuild a new list of accounts without the one to delete */
auto
newAccountList
=
ref
new
Vector
<
AccountListItem
^>
();
for
each
(
AccountListItem
^
item
in
AccountListItemsViewModel
::
instance
->
itemsList
)
{
if
(
item
->
_account
->
accountID_
!=
accountId
)
newAccountList
->
Append
(
item
);
}
if
(
item
)
AccountListItemsViewModel
::
instance
->
removeItem
(
item
);
_accountsList_
->
ItemsSource
=
newA
ccount
List
;
RingD
::
instance
->
deleteAccount
(
a
ccount
Id
)
;
}
else
{
}
else
{
/* otherwise edit the account */
account
->
name_
=
_aliasTextBoxEditionMenu_
->
Text
;
account
->
_upnpState
=
_upnpState_
->
IsOn
;
...
...
@@ -774,4 +776,4 @@ void RingClientUWP::Views::SmartPanel::_cancelAccountModification__Click(Platfor
void
RingClientUWP
::
Views
::
SmartPanel
::
OnaccountUpdated
(
RingClientUWP
::
Account
^
account
)
{
updatePageContent
();
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment