mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
fix go to contact detail from call history
fix time zone cbox ui fixes
This commit is contained in:
parent
a18d86a74c
commit
a7f06efb47
12 changed files with 77 additions and 81 deletions
|
|
@ -93,7 +93,7 @@ bool ConferenceInfoProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sou
|
|||
return res;
|
||||
} else return mFilterType == -1;
|
||||
} else {
|
||||
return !mList->haveCurrentDate() &&
|
||||
mList->getCount() > 1; // if mlist count == 1 there is only the dummy row which we don't display alone
|
||||
return !mList->haveCurrentDate() && mList->getCount() > 1 &&
|
||||
mSearchText.isEmpty(); // if mlist count == 1 there is only the dummy row which we don't display alone
|
||||
}
|
||||
}
|
||||
|
|
@ -176,15 +176,11 @@ QVariant MagicSearchList::data(const QModelIndex &index, int role) const {
|
|||
|
||||
int MagicSearchList::findFriendIndexByAddress(const QString &address) {
|
||||
int i = 0;
|
||||
qDebug() << "[MagicSearchList] LOOKING FOR ADDRESS" << address;
|
||||
for (auto &item : mList) {
|
||||
qDebug() << "item" << item;
|
||||
auto isFriendCore = item.objectCast<FriendCore>();
|
||||
if (!isFriendCore) continue;
|
||||
qDebug() << "[MagicSearchList] SEARCH IN FRIEND" << isFriendCore->getDisplayName();
|
||||
for (auto &friendAddress : isFriendCore->getAllAddresses()) {
|
||||
for (int i = 0; i < getCount();) {
|
||||
auto friendCore = getAt<FriendCore>(i);
|
||||
if (!friendCore) continue;
|
||||
for (auto &friendAddress : friendCore->getAllAddresses()) {
|
||||
auto map = friendAddress.toMap();
|
||||
// qDebug() << "COMPARE" << map["address"].toString();
|
||||
if (map["address"].toString() == address) {
|
||||
return i;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,35 +58,21 @@ void TimeZoneList::initTimeZones() {
|
|||
}
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> TimeZoneList::roleNames() const {
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "$modelData";
|
||||
roles[Qt::DisplayRole + 1] = "$timeZoneModel";
|
||||
return roles;
|
||||
}
|
||||
|
||||
QVariant TimeZoneList::data(const QModelIndex &index, int role) const {
|
||||
int row = index.row();
|
||||
|
||||
if (!index.isValid() || row < 0 || row >= mList.count()) return QVariant();
|
||||
auto timeZoneModel = getAt<TimeZoneModel>(row);
|
||||
if (!timeZoneModel) return QVariant();
|
||||
if (role == Qt::DisplayRole) {
|
||||
int offset = timeZoneModel->getStandardTimeOffset() / 3600;
|
||||
int absOffset = std::abs(offset);
|
||||
int offset = timeZoneModel->getStandardTimeOffset() / 3600;
|
||||
int absOffset = std::abs(offset);
|
||||
|
||||
return QStringLiteral("(GMT%1%2%3:00) %4 %5")
|
||||
.arg(offset >= 0 ? "+" : "-")
|
||||
.arg(absOffset < 10 ? "0" : "")
|
||||
.arg(absOffset)
|
||||
.arg(timeZoneModel->getCountryName())
|
||||
.arg(timeZoneModel->getTimeZone().comment().isEmpty() ? ""
|
||||
: (" - " + timeZoneModel->getTimeZone().comment()));
|
||||
} else {
|
||||
return QVariant::fromValue(timeZoneModel.get());
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
return QStringLiteral("(GMT%1%2%3:00) %4 %5")
|
||||
.arg(offset >= 0 ? "+" : "-")
|
||||
.arg(absOffset < 10 ? "0" : "")
|
||||
.arg(absOffset)
|
||||
.arg(timeZoneModel->getCountryName())
|
||||
.arg(timeZoneModel->getTimeZone().comment().isEmpty() ? "" : (" - " + timeZoneModel->getTimeZone().comment()));
|
||||
}
|
||||
|
||||
int TimeZoneList::get(const QTimeZone &timeZone) const {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ public:
|
|||
void initTimeZones();
|
||||
int get(const QTimeZone &timeZone = QTimeZone::systemTimeZone()) const;
|
||||
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@ import SettingsCpp 1.0
|
|||
ApplicationWindow {
|
||||
id: mainWindow
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: forceActiveFocus()
|
||||
}
|
||||
|
||||
Component {
|
||||
id: popupComp
|
||||
InformationPopup{}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ Item {
|
|||
signal addAccountRequest()
|
||||
signal openNewCall()
|
||||
signal openCallHistory()
|
||||
signal displayContact(string contactAddress)
|
||||
signal displayContactRequested(string contactAddress)
|
||||
signal createContactRequested(string name, string address)
|
||||
|
||||
function goToNewCall() {
|
||||
|
|
@ -32,9 +32,9 @@ Item {
|
|||
tabbar.currentIndex = 0
|
||||
mainItem.openCallHistory()
|
||||
}
|
||||
function goToContactPage(contactAddress) {
|
||||
function displayContactPage(contactAddress) {
|
||||
tabbar.currentIndex = 1
|
||||
mainItem.displayContact(contactAddress)
|
||||
mainItem.displayContactRequested(contactAddress)
|
||||
}
|
||||
|
||||
function createContact(name, address) {
|
||||
|
|
@ -390,12 +390,12 @@ Item {
|
|||
id: contactPage
|
||||
Connections {
|
||||
target: mainItem
|
||||
function onCreateContactRequested (name, address) {
|
||||
function onCreateContactRequested(name, address) {
|
||||
contactPage.createContact(name, address)
|
||||
}
|
||||
function onDisplayContact (contactAddress) {
|
||||
contactPage.displayContact(contactAddress)
|
||||
}
|
||||
function onDisplayContactRequested(contactAddress) {
|
||||
contactPage.initialFriendToDisplay = contactAddress
|
||||
}
|
||||
}
|
||||
}
|
||||
Item{}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ AppWindow {
|
|||
mainWindowStackView.replace(mainPage, StackView.Immediate)
|
||||
mainWindowStackView.currentItem.goToNewCall()
|
||||
}
|
||||
function goToContactPage(contactAddress) {
|
||||
function displayContactPage(contactAddress) {
|
||||
mainWindowStackView.replace(mainPage, StackView.Immediate)
|
||||
mainWindowStackView.currentItem.goToContactPage(contactAddress)
|
||||
mainWindowStackView.currentItem.displayContactPage(contactAddress)
|
||||
}
|
||||
function transferCallSucceed() {
|
||||
mainWindowStackView.replace(mainPage, StackView.Immediate)
|
||||
|
|
|
|||
|
|
@ -49,12 +49,11 @@ ListView {
|
|||
signal contactAddedToSelection()
|
||||
|
||||
function selectContact(address) {
|
||||
console.log("select", address)
|
||||
var index = magicSearchProxy.findFriendIndexByAddress(address)
|
||||
console.log("index in selection", index)
|
||||
if (index != -1) {
|
||||
mainItem.currentIndex = index
|
||||
}
|
||||
return index
|
||||
}
|
||||
function addContactToSelection(address) {
|
||||
if (multiSelectionEnabled) {
|
||||
|
|
|
|||
|
|
@ -293,10 +293,10 @@ ColumnLayout {
|
|||
|
||||
ComboBox {
|
||||
id: timeZoneCbox
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredWidth: 307 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 30 * DefaultStyle.dp
|
||||
hoverEnabled: true
|
||||
listView.implicitHeight: 152 * DefaultStyle.dp
|
||||
listView.implicitHeight: 250 * DefaultStyle.dp
|
||||
constantImageSource: AppIcons.globe
|
||||
weight: 700 * DefaultStyle.dp
|
||||
leftMargin: 0
|
||||
|
|
@ -312,33 +312,33 @@ ColumnLayout {
|
|||
var modelIndex = timeZoneCbox.model.index(currentIndex, 0)
|
||||
mainItem.conferenceInfoGui.core.timeZoneModel = timeZoneCbox.model.data(modelIndex, Qt.DisplayRole + 1)
|
||||
}
|
||||
},
|
||||
|
||||
ComboBox {
|
||||
id: repeaterCbox
|
||||
enabled: false
|
||||
Component.onCompleted: console.log("TODO : handle conf repetition")
|
||||
constantImageSource: AppIcons.reloadArrow
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: height
|
||||
height: 30 * DefaultStyle.dp
|
||||
width: 307 * DefaultStyle.dp
|
||||
weight: 700 * DefaultStyle.dp
|
||||
leftMargin: 0
|
||||
currentIndex: 0
|
||||
background: Rectangle {
|
||||
visible: parent.hovered || parent.down
|
||||
anchors.fill: parent
|
||||
color: DefaultStyle.grey_100
|
||||
}
|
||||
model: [
|
||||
{text: qsTr("Une fois")},
|
||||
{text: qsTr("Tous les jours")},
|
||||
{text: qsTr("Tous les jours de la semaine (Lun-Ven)")},
|
||||
{text: qsTr("Toutes les semaines")},
|
||||
{text: qsTr("Tous les mois")}
|
||||
]
|
||||
}
|
||||
|
||||
// ComboBox {
|
||||
// id: repeaterCbox
|
||||
// enabled: false
|
||||
// Component.onCompleted: console.log("TODO : handle conf repetition")
|
||||
// constantImageSource: AppIcons.reloadArrow
|
||||
// Layout.fillWidth: true
|
||||
// Layout.preferredHeight: height
|
||||
// height: 30 * DefaultStyle.dp
|
||||
// width: 307 * DefaultStyle.dp
|
||||
// weight: 700 * DefaultStyle.dp
|
||||
// leftMargin: 0
|
||||
// currentIndex: 0
|
||||
// background: Rectangle {
|
||||
// visible: parent.hovered || parent.down
|
||||
// anchors.fill: parent
|
||||
// color: DefaultStyle.grey_100
|
||||
// }
|
||||
// model: [
|
||||
// {text: qsTr("Une fois")},
|
||||
// {text: qsTr("Tous les jours")},
|
||||
// {text: qsTr("Tous les jours de la semaine (Lun-Ven)")},
|
||||
// {text: qsTr("Toutes les semaines")},
|
||||
// {text: qsTr("Tous les mois")}
|
||||
// ]
|
||||
// }
|
||||
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import SettingsCpp
|
|||
AbstractMainPage {
|
||||
id: mainItem
|
||||
noItemButtonText: qsTr("Nouvel appel")
|
||||
emptyListText: qsTr("Historique d'appel vide")
|
||||
emptyListText: qsTr("Aucun appel")
|
||||
newItemIconSource: AppIcons.newCall
|
||||
|
||||
property var selectedRowHistoryGui
|
||||
|
|
@ -199,6 +199,11 @@ AbstractMainPage {
|
|||
}
|
||||
visible: historyListView.count === 0
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Binding on text {
|
||||
when: searchBar.text.length !== 0
|
||||
value: qsTr("Aucun appel correspondant")
|
||||
restoreMode: Binding.RestoreBindingOrValue
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
id: historyListView
|
||||
|
|
@ -552,7 +557,7 @@ AbstractMainPage {
|
|||
}
|
||||
onClicked: {
|
||||
detailOptions.close()
|
||||
if (detailOptions.friendGui) mainWindow.goToContactPage(contactDetail.contactAddress)
|
||||
if (detailOptions.friendGui) mainWindow.displayContactPage(contactDetail.contactAddress)
|
||||
else mainItem.createContactRequested(contactDetail.contactName, contactDetail.contactAddress)
|
||||
}
|
||||
}
|
||||
|
|
@ -563,6 +568,7 @@ AbstractMainPage {
|
|||
iconSource: AppIcons.copy
|
||||
}
|
||||
onClicked: {
|
||||
detailOptions.close()
|
||||
var success = UtilsCpp.copyToClipboard(mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress)
|
||||
if (success) UtilsCpp.showInformationPopup(qsTr("Copié"), qsTr("L'adresse a été copiée dans le presse-papier"), true)
|
||||
else UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Erreur lors de la copie de l'adresse"), false)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ AbstractMainPage {
|
|||
// disable left panel contact list interaction while a contact is being edited
|
||||
property bool leftPanelEnabled: true
|
||||
property FriendGui selectedContact
|
||||
property string initialFriendToDisplay
|
||||
|
||||
onSelectedContactChanged: {
|
||||
if (selectedContact) {
|
||||
if (!rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName != "contactDetail") rightPanelStackView.push(contactDetail)
|
||||
|
|
@ -42,10 +44,6 @@ AbstractMainPage {
|
|||
rightPanelStackView.push(contactEdition, {"contact": friendGui, "title": qsTr("Modifier contact"), "saveButtonText": qsTr("Enregistrer")})
|
||||
}
|
||||
|
||||
function displayContact(contactAddress) {
|
||||
contactList.selectContact(contactAddress)
|
||||
}
|
||||
|
||||
// rightPanelStackView.initialItem: contactDetail
|
||||
Binding {
|
||||
mainItem.showDefaultItem: false
|
||||
|
|
@ -311,6 +309,11 @@ AbstractMainPage {
|
|||
}
|
||||
ContactsList{
|
||||
id: contactList
|
||||
onCountChanged: {
|
||||
if (initialFriendToDisplay.length !== 0) {
|
||||
if (selectContact(initialFriendToDisplay) != -1) initialFriendToDisplay = ""
|
||||
}
|
||||
}
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: contentHeight
|
||||
interactive: false
|
||||
|
|
|
|||
|
|
@ -124,12 +124,9 @@ AbstractMainPage {
|
|||
property string objectName: "listLayout"
|
||||
Control.StackView.onDeactivated: {
|
||||
mainItem.selectedConference = null
|
||||
// mainItem.showDefaultItem.visible = false
|
||||
// mainItem.righPanelStackView.clear()
|
||||
}
|
||||
Control.StackView.onActivated: {
|
||||
mainItem.selectedConference = conferenceList.selectedConference
|
||||
// mainItem.showDefaultItem = conferenceList.count == 0
|
||||
}
|
||||
Binding {
|
||||
target: mainItem
|
||||
|
|
@ -183,6 +180,11 @@ AbstractMainPage {
|
|||
weight: 800 * DefaultStyle.dp
|
||||
}
|
||||
visible: mainItem.showDefaultItem
|
||||
Binding on text {
|
||||
when: searchBar.text.length !== 0
|
||||
value: qsTr("Aucune réunion correspondante")
|
||||
restoreMode: Binding.RestoreBindingOrValue
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue