Feature : add a slide menu on timeline by a right-click to display actions to do (Add a way to delete entirely the chat room from timeline).

Fix leaving chat room when emptying history and still in the chat room.
Delete chat room only if it is empty (no messages and no events), and if it has been left by the user.
Remove timeline from list only if the chat room is on Deleted state (doesn't exist on server and local).
This commit is contained in:
Julien Wadel 2022-08-26 16:53:03 +02:00
parent 1e91a4a94c
commit 50be00a386
27 changed files with 428 additions and 84 deletions

View file

@ -16,11 +16,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Animated file in chats/notifications.
- Round progress bar for transferring a file and allow to cancel it.
- hide all accounts if their custom parameter 'hidden' is set to 1.
- Right-click on a timeline will show a slide menu to do actions on the timeline.
### Fixed
- Crash on exit.
- Crash when using no account.
- Memory stability.
- Clean 3 chat behaviors : Leave chat room (in group info section of conversation menu), erase history (in conversation's menu), delete chat room (in slide menu, or if chat room is empty and left)
## 4.4.8 - 2022-07-04

View file

@ -1012,7 +1012,7 @@ Server url ikke konfigureret.</translation>
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3390,6 +3390,19 @@ Klik her: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1012,7 +1012,7 @@ Server URL ist nicht konfiguriert.</translation>
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3390,6 +3390,19 @@ Klicken Sie hier: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -823,7 +823,7 @@ Server URL not configured.</translation>
<message>
<source>conferencesDeleted</source>
<extracomment>&apos;Conference has been deleted&apos; : Message text in a banner to warn the user that the conference has been deleted.</extracomment>
<translation type="unfinished"></translation>
<translation>Conference has been deleted</translation>
</message>
</context>
<context>
@ -1012,8 +1012,8 @@ Server URL not configured.</translation>
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<translation>Delete</translation>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation>Delete history</translation>
</message>
<message>
<source>conversationMenuViewContact</source>
@ -3413,6 +3413,19 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<translation>Conferences</translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation>Are you sure you want to delete and leave this timeline?</translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation>After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.</translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1012,7 +1012,7 @@ URL del servidor no configurada.</translation>
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3390,6 +3390,19 @@ Haga clic aquí: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1012,7 +1012,7 @@ URL du serveur non configurée.</translation>
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3390,6 +3390,19 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<translation>Conférences</translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1006,7 +1006,7 @@ A kiszolgáló URL-je nincs konfigurálva.</translation>
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3377,6 +3377,19 @@ Kattintson ide: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1012,7 +1012,7 @@ URL del server non configurato.</translation>
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation>Elimina</translation>
</message>
<message>
@ -3390,6 +3390,19 @@ Clicca: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1006,7 +1006,7 @@
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3377,6 +3377,19 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1018,7 +1018,7 @@ Nesukonfigūruotas serverio url.</translation>
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3403,6 +3403,19 @@ Spustelėkite čia: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1012,7 +1012,7 @@ URL do servidor não configurado.</translation>
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3390,6 +3390,19 @@ Clique aqui: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1018,7 +1018,7 @@
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3403,6 +3403,19 @@
<translation>Конференции</translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1012,7 +1012,7 @@ Serverwebbadressen är inte konfigurerad.</translation>
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3390,6 +3390,19 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1006,7 +1006,7 @@ Sunucu url&apos;si yapılandırılmadı.</translation>
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3377,6 +3377,19 @@ Buraya tıklayın: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<translation>Toplantılar</translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1018,7 +1018,7 @@
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3403,6 +3403,19 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -1006,7 +1006,7 @@
</message>
<message>
<source>conversationMenuDelete</source>
<extracomment>&apos;Delete&apos; : Item menu to delete the chat</extracomment>
<extracomment>&apos;Delete history&apos; : Item menu to delete the chat&apos;s history</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -3377,6 +3377,19 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimelineItem</name>
<message>
<source>deleteTimeline</source>
<extracomment>&apos;Are you sure you want to delete and leave this timeline?&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>deleteTimelineTooltip</source>
<extracomment>&apos;After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.&apos;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UseAppSipAccount</name>
<message>

View file

@ -416,6 +416,7 @@
<file>ui/modules/Linphone/TelKeypad/TelKeypad.qml</file>
<file>ui/modules/Linphone/Timeline/Timeline.js</file>
<file>ui/modules/Linphone/Timeline/Timeline.qml</file>
<file>ui/modules/Linphone/Timeline/TimelineItem.qml</file>
<file>ui/modules/Linphone/View/ParticipantsListView.qml</file>
<file>ui/modules/Linphone/View/ParticipantsView.qml</file>
<file>ui/modules/Linphone/View/SipAddressesView.qml</file>

View file

@ -258,7 +258,8 @@ void ChatRoomModel::removeAllEntries () {
if(haveLogs)
emit CoreManager::getInstance()->callLogsCountChanged();
}
deleteChatRoom();
if( mChatRoom->isReadOnly())// = hasBeenLeft()
deleteChatRoom();
endResetModel();
emit allEntriesRemoved(mSelf.lock());
emit focused();// Removing all entries is like having focus. Don't wait asynchronous events.
@ -599,8 +600,11 @@ void ChatRoomModel::deleteChatRoom(){
}
void ChatRoomModel::leaveChatRoom (){
if(mChatRoom)
if(mChatRoom){
mChatRoom->leave();
if( mChatRoom->getHistorySize() == 0 && mChatRoom->getHistoryEventsSize() == 0)
deleteChatRoom();
}
}

View file

@ -138,7 +138,9 @@ class ColorListModel : public ProxyListModel {
ADD_COLOR("progress_bg", "black", "Background of round progress bar")
ADD_COLOR("progress_remaining_fg", "white", "Remaining progression color")
ADD_COLOR("timeline_bg_1", "#EFF0F2", "Timeline background color 1")
ADD_COLOR("timeline_bg_2", "#FFFFFF", "Timeline background color 2")
// Keywords: 'mKeywordsMap'
// s=standard, ma=main, l=list, sc=screen, me=menu

View file

@ -309,7 +309,8 @@ void TimelineListModel::onChatRoomStateChanged(const std::shared_ptr<linphone::C
if(timeline) {
if(timeline->getChatRoomModel())
timeline->getChatRoomModel()->resetMessageCount();
remove(timeline);
if(state == linphone::ChatRoom::State::Deleted)
remove(timeline);
}
}
}

View file

@ -67,7 +67,7 @@ void TimelineModel::connectTo(ChatRoomListener * listener){
// =============================================================================
QSharedPointer<TimelineModel> TimelineModel::create(std::shared_ptr<linphone::ChatRoom> chatRoom, const std::list<std::shared_ptr<linphone::CallLog>>& callLogs, QObject *parent){
if((!chatRoom || chatRoom->getState() != linphone::ChatRoom::State::Terminated) && (!CoreManager::getInstance()->getTimelineListModel() || !CoreManager::getInstance()->getTimelineListModel()->getTimeline(chatRoom, false)) ) {
if((!chatRoom || chatRoom->getState() != linphone::ChatRoom::State::Deleted) && (!CoreManager::getInstance()->getTimelineListModel() || !CoreManager::getInstance()->getTimelineListModel()->getTimeline(chatRoom, false)) ) {
QSharedPointer<TimelineModel> model = QSharedPointer<TimelineModel>::create(chatRoom, parent);
if(model && model->getChatRoomModel()){

View file

@ -84,7 +84,7 @@ void TimelineProxyModel::setFilterText(const QString& text){
bool TimelineProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const {
const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
auto timeline = sourceModel()->data(index).value<TimelineModel*>();
if(!timeline || !timeline->getChatRoomModel() || timeline->getChatRoomModel()->getState() == (int)linphone::ChatRoom::State::Terminated)
if(!timeline || !timeline->getChatRoomModel() || timeline->getChatRoomModel()->getState() == (int)linphone::ChatRoom::State::Deleted)
return false;
bool haveEncryption = timeline->getChatRoomModel()->haveEncryption();
if(!CoreManager::getInstance()->getSettingsModel()->getStandardChatEnabled() && !haveEncryption)

View file

@ -21,8 +21,8 @@ QtObject {
property int height: 60
property QtObject backgroundColor: QtObject {
property color a: ColorsList.add(sectionName+'_contact_bg_a', 'g10').color
property color b: ColorsList.add(sectionName+'_contact_bg_b', 'a').color
property color a: ColorsList.add(sectionName+'_contact_bg_a', 'timeline_bg_1').color
property color b: ColorsList.add(sectionName+'_contact_bg_b', 'timeline_bg_2').color
property color selected: ColorsList.add(sectionName+'_contact_bg_c', 'i').color
}
@ -64,4 +64,28 @@ QtObject {
property color borderColor: ColorsList.add(sectionName+'_searchField_border', 'border').color
property int pointSize: Units.dp * 9
}
property QtObject selectedDeleteAction: QtObject {
property int iconSize: 40
property string name : 'delete_on_selected'
property string icon : 'delete_custom'
property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 'me_h_b_inv_bg').color
property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 'me_n_b_inv_bg').color
property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 'me_p_b_inv_bg').color
property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 'me_n_b_inv_fg').color
property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 'me_h_b_inv_fg').color
property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 'me_p_b_inv_fg').color
}
property QtObject deleteAction: QtObject {
property int iconSize: 40
property string name : 'delete'
property string icon : 'delete_custom'
property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 'me_h_b_bg').color
property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 'me_n_b_bg').color
property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 'me_p_b_bg').color
property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 'me_h_b_fg').color
property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 'me_n_b_fg').color
property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 'me_p_b_fg').color
}
}

View file

@ -3,6 +3,7 @@ import QtQuick.Layouts 1.3
import QtQuick.Controls 2.5
import Common 1.0
import Common.Styles 1.0
import Linphone 1.0
import Linphone.Styles 1.0
import ColorsList 1.0
@ -10,6 +11,7 @@ import ColorsList 1.0
import UtilsCpp 1.0
import 'Timeline.js' as Logic
import 'qrc:/ui/scripts/Utils/utils.js' as Utils
// =============================================================================
@ -361,66 +363,12 @@ Rectangle {
Layout.fillWidth: true
currentIndex: -1
delegate: Item {
height: TimelineStyle.contact.height
width: parent ? parent.width : 0
Contact {
id: contactView
property bool isSelected: $modelData != undefined && $modelData.selected //view.currentIndex === index
anchors.fill: parent
color: isSelected
? TimelineStyle.contact.backgroundColor.selected
: (
index % 2 == 0
? TimelineStyle.contact.backgroundColor.a
: TimelineStyle.contact.backgroundColor.b
)
displayUnreadMessageCount: SettingsModel.standardChatEnabled || SettingsModel.secureChatEnabled
entry: $modelData.chatRoomModel
sipAddressColor: isSelected
? TimelineStyle.contact.sipAddress.color.selected
: TimelineStyle.contact.sipAddress.color.normal
usernameColor: isSelected
? TimelineStyle.contact.username.color.selected
: TimelineStyle.contact.username.color.normal
TooltipArea {
id: contactTooltip
text: UtilsCpp.toDateTimeString($modelData.chatRoomModel.lastUpdateTime)
isClickable: true
}
Icon{
icon: TimelineStyle.ephemeralTimer.icon
iconSize: TimelineStyle.ephemeralTimer.iconSize
overwriteColor: $modelData && $modelData.selected ? TimelineStyle.ephemeralTimer.selectedTimerColor : TimelineStyle.ephemeralTimer.timerColor
anchors.right:parent.right
anchors.bottom:parent.bottom
anchors.bottomMargin: 7
anchors.rightMargin: 7
visible: $modelData.chatRoomModel.ephemeralEnabled
}
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
propagateComposedEvents: true
preventStealing: false
onClicked: {
if(mouse.button == Qt.LeftButton){
timeline.entryClicked($modelData)
if(view.updateSelectionModels)
$modelData.selected = true
view.currentIndex = index;
}else{
contactTooltip.show()
}
}
}
delegate: TimelineItem{
timelineModel: $modelData
modelIndex: index
Connections{
target:$modelData
target: $modelData
onSelectedChanged:{
gc()
if(view.updateSelectionModels && selected) {

View file

@ -0,0 +1,166 @@
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.5
import Common 1.0
import Common.Styles 1.0
import Linphone 1.0
import Linphone.Styles 1.0
import ColorsList 1.0
import UtilsCpp 1.0
import 'Timeline.js' as Logic
import 'qrc:/ui/scripts/Utils/utils.js' as Utils
// =============================================================================
Item {
id: mainItem
property TimelineModel timelineModel
property bool optionsToggled: false
property int modelIndex: 0
height: TimelineStyle.contact.height
width: parent ? parent.width : 0
state: optionsToggled ? 'options' : 'normal'
states: [State {
name: "normal"
}, State {
name: "options"
}
]
transitions: [Transition {
from: 'normal'
to: 'options'
//NumberAnimation { target: contactView; property: 'x'; to:-contactView.width; duration: 200;}
NumberAnimation { target: optionsView; property: 'x'; to:0; duration: 200;}
},
Transition {
from: 'options'
to: 'normal'
//NumberAnimation { target: contactView; property: 'x'; to:0; duration: 200;}
NumberAnimation { target: optionsView; property: 'x'; to:optionsView.width; duration: 200;}
}
]
Contact {
id: contactView
property bool isSelected: mainItem.timelineModel != undefined && mainItem.timelineModel.selected //view.currentIndex === index
height: mainItem.height
width: mainItem.width
color: isSelected
? TimelineStyle.contact.backgroundColor.selected
: (
mainItem.modelIndex % 2 == 0
? TimelineStyle.contact.backgroundColor.a
: TimelineStyle.contact.backgroundColor.b
)
displayUnreadMessageCount: SettingsModel.standardChatEnabled || SettingsModel.secureChatEnabled
entry: mainItem.timelineModel && mainItem.timelineModel.chatRoomModel
sipAddressColor: isSelected
? TimelineStyle.contact.sipAddress.color.selected
: TimelineStyle.contact.sipAddress.color.normal
usernameColor: isSelected
? TimelineStyle.contact.username.color.selected
: TimelineStyle.contact.username.color.normal
TooltipArea {
id: contactTooltip
text: mainItem.timelineModel && UtilsCpp.toDateTimeString(mainItem.timelineModel.chatRoomModel.lastUpdateTime)
isClickable: true
}
Icon{
icon: TimelineStyle.ephemeralTimer.icon
iconSize: TimelineStyle.ephemeralTimer.iconSize
overwriteColor: mainItem.timelineModel && mainItem.timelineModel.selected ? TimelineStyle.ephemeralTimer.selectedTimerColor : TimelineStyle.ephemeralTimer.timerColor
anchors.right:parent.right
anchors.bottom:parent.bottom
anchors.bottomMargin: 7
anchors.rightMargin: 7
visible: mainItem.timelineModel && mainItem.timelineModel.chatRoomModel.ephemeralEnabled
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
propagateComposedEvents: true
preventStealing: false
onClicked: {
if(mouse.button == Qt.LeftButton){
timeline.entryClicked(mainItem.timelineModel)
if(view.updateSelectionModels)
mainItem.timelineModel.selected = true
view.currentIndex = mainItem.modelIndex;
}else{
mainItem.optionsToggled = !mainItem.optionsToggled
}
}
}
}
Item{
id: optionsView
height: mainItem.height
width: mainItem.width
x:width
visible: x!=width
RowLayout{
anchors.fill: parent
MouseArea {
Layout.fillHeight: true
Layout.fillWidth: true
onClicked: {
mainItem.optionsToggled = !mainItem.optionsToggled
}
}
Rectangle{
Layout.fillHeight: true
Layout.preferredWidth: optionsLayout.width
color: contactView.color
MouseArea {// Grabber
anchors.fill: parent
cursorShape: Qt.ArrowCursor
}
RowLayout{
id: optionsLayout
anchors.centerIn: parent
/* TODO
CheckBoxText {
id: securedCheckBox
Layout.alignment: Qt.AlignCenter
text: ''
onClicked: {
}
}*/
ActionButton{
id: deleteButton
Layout.alignment: Qt.AlignCenter
Layout.rightMargin: 6
isCustom: true
colorSet: contactView.isSelected ? TimelineStyle.selectedDeleteAction : TimelineStyle.deleteAction
onClicked: window.attachVirtualWindow(Utils.buildCommonDialogUri('ConfirmDialog'), {
//: 'Are you sure you want to delete and leave this timeline?'
descriptionText: qsTr('deleteTimeline'),
}, function (status) {
if (status) {
mainItem.timelineModel.chatRoomModel.deleteChatRoom()
}
})
TooltipArea {
//: 'After confirmation, it will erase all history, leave the chat room if it is a group chat and delete it in database.'
text: qsTr('deleteTimelineTooltip')
}
}
}
}
}
}
}

View file

@ -58,6 +58,7 @@ Sticker 1.0 Sticker/Sticker.qml
TelKeypad 1.0 TelKeypad/TelKeypad.qml
Timeline 1.0 Timeline/Timeline.qml
TimelineItem 1.0 Timeline/TimelineItem.qml
ParticipantsListView 1.0 View/ParticipantsListView.qml
ParticipantsView 1.0 View/ParticipantsView.qml

View file

@ -471,7 +471,7 @@ ColumnLayout {
}
MenuItem{
id: deleteMenuItem
//: 'Delete' : Item menu to delete the chat
//: 'Delete history' : Item menu to delete the chat's history
text: qsTr('conversationMenuDelete')
iconMenu: MenuItemStyle.deleteEntry.icon
iconSizeMenu: 40