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
72b42926
Commit
72b42926
authored
Oct 25, 2016
by
Nicolas Jager
Browse files
internal : add logic and ui to manage account deletion
Change-Id: I95fd4583575c3fdb1e826f92f10a28d03c74683f Tulesp: #1244
parent
6abfc0d2
Changes
6
Hide whitespace changes
Inline
Side-by-side
AccountListItem.cpp
View file @
72b42926
...
...
@@ -33,6 +33,7 @@ AccountListItem::AccountListItem(Account^ a)
{
_account
=
a
;
_editionMode
=
false
;
}
void
...
...
AccountListItem.h
View file @
72b42926
...
...
@@ -22,6 +22,8 @@ using namespace Windows::Data::Json;
using
namespace
Windows
::
UI
::
Xaml
;
using
namespace
Windows
::
UI
::
Xaml
::
Data
;
#include
<RingDebug.h>
namespace
RingClientUWP
{
namespace
Controls
{
...
...
RingD.cpp
View file @
72b42926
...
...
@@ -293,6 +293,19 @@ void RingClientUWP::RingD::updateAccount(String^ accountId)
tasksList_
.
push
(
task
);
}
void
RingClientUWP
::
RingD
::
deleteAccount
(
String
^
accountId
)
{
editModeOn_
=
true
;
auto
frame
=
dynamic_cast
<
Frame
^>
(
Window
::
Current
->
Content
);
dynamic_cast
<
RingClientUWP
::
MainPage
^>
(
frame
->
Content
)
->
showLoadingOverlay
(
true
,
true
);
auto
task
=
ref
new
RingD
::
Task
(
Request
::
DeleteAccount
);
task
->
_accountId
=
accountId
;
tasksList_
.
push
(
task
);
}
void
RingClientUWP
::
RingD
::
startDaemon
()
{
...
...
@@ -733,6 +746,14 @@ RingD::dequeueTasks()
DRing
::
setAccountDetails
(
Utils
::
toString
(
account
->
accountID_
),
accountDetails
);
break
;
}
case
Request
::
DeleteAccount
:
{
auto
accountId
=
task
->
_accountId
;
auto
accountId2
=
Utils
::
toString
(
accountId
);
DRing
::
removeAccount
(
accountId2
);
break
;
}
default:
break
;
}
...
...
RingD.h
View file @
72b42926
...
...
@@ -98,6 +98,7 @@ internal:
void
askToExportOnRing
(
String
^
accountId
,
String
^
password
);
void
eraseCacheFolder
();
void
updateAccount
(
String
^
accountId
);
void
deleteAccount
(
String
^
accountId
);
/* TODO : move members */
///bool hasConfig; // replaced by startingStatus
...
...
@@ -130,7 +131,8 @@ private:
RegisterDevice
,
GetKnownDevices
,
ExportOnRing
,
UpdateAccount
UpdateAccount
,
DeleteAccount
};
...
...
SmartPanel.xaml
View file @
72b42926
...
...
@@ -541,14 +541,14 @@
<ToggleSwitch x:Name="_upnpState_"
Margin="20,10"/>
<!-- delete account sub menu. -->
<!--
<StackPanel Orientation="Horizontal" Margin="10">
<StackPanel Orientation="Horizontal" Margin="10">
<TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}"
Text=""/>
<TextBlock Text="Delete account" Margin="10"/>
</StackPanel>
<ToggleButton x:Name="_deleteAccountBtnEditionMenu_"
Margin="20,10"
Content="Delete"/>
-->
Content="Delete"/>
</StackPanel>
<!-- buttons yes/no to accept the modification. -->
<Grid Grid.Row="1">
...
...
SmartPanel.xaml.cpp
View file @
72b42926
...
...
@@ -63,7 +63,13 @@ SmartPanel::SmartPanel()
/* connect delegates */
Configuration
::
UserPreferences
::
instance
->
selectIndex
+=
ref
new
SelectIndex
([
this
](
int
index
)
{
_accountsList_
->
SelectedIndex
=
index
;
if
(
_accountsList_
)
{
auto
accountsListSize
=
dynamic_cast
<
Vector
<
AccountListItem
^>^>
(
_accountsList_
->
ItemsSource
)
->
Size
;
if
(
accountsListSize
>
index
)
_accountsList_
->
SelectedIndex
=
index
;
else
_accountsList_
->
SelectedIndex
=
0
;
}
});
Configuration
::
UserPreferences
::
instance
->
loadProfileImage
+=
ref
new
LoadProfileImage
([
this
]()
{
StorageFolder
^
localfolder
=
ApplicationData
::
Current
->
LocalFolder
;
...
...
@@ -728,11 +734,30 @@ void RingClientUWP::Views::SmartPanel::_acceptAccountModification__Click(Platfor
{
auto
account
=
AccountListItemsViewModel
::
instance
->
_selectedItem
->
_account
;
auto
accountId
=
account
->
accountID_
;
account
->
name_
=
_aliasTextBoxEditionMenu_
->
Text
;
account
->
_upnpState
=
_upnpState_
->
IsOn
;
RingD
::
instance
->
updateAccount
(
accountId
);
// mettre ca en visibility du bouton delete
auto
accountsListSize
=
dynamic_cast
<
Vector
<
AccountListItem
^>^>
(
_accountsList_
->
ItemsSource
)
->
Size
;
if
(
_deleteAccountBtnEditionMenu_
->
IsChecked
&&
accountsListSize
>
1
)
{
RingD
::
instance
->
deleteAccount
(
accountId
);
/* 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
);
}
_accountsList_
->
ItemsSource
=
newAccountList
;
}
else
{
account
->
name_
=
_aliasTextBoxEditionMenu_
->
Text
;
account
->
_upnpState
=
_upnpState_
->
IsOn
;
RingD
::
instance
->
updateAccount
(
accountId
);
}
_accountEditionMenuGrid_
->
Visibility
=
Windows
::
UI
::
Xaml
::
Visibility
::
Collapsed
;
_accountsMenuGrid_
->
Visibility
=
Windows
::
UI
::
Xaml
::
Visibility
::
Collapsed
;
...
...
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