Commit 7d40a4a4 authored by Edric Milaret's avatar Edric Milaret

UI: add history tool-buttons

Buttons to sort history entry

Refs #73116

Change-Id: Iab4f35c403a0445c0a257c58f1dc9d0c170060f5
parent db76aa8e
......@@ -114,18 +114,22 @@ win32 {
$$RUNTIMEDIR/libfreetype-6.dll $$RUNTIMEDIR/libglib-2.0-0.dll \
$$RUNTIMEDIR/libharfbuzz-0.dll \
$$RUNTIMEDIR/libintl-8.dll $$RUNTIMEDIR/libpcre-1.dll \
$$RUNTIMEDIR/libpcre16-0.dll $$RUNTIMEDIR/libpng16-16.dll
$$RUNTIMEDIR/libpcre16-0.dll $$RUNTIMEDIR/libpng16-16.dll \
$$RUNTIMEDIR/libjpeg-62.dll
QTDEPSRUNTIME.path = $$OUT_PWD/release
QTPLATFORMS.files = $$(QTDIR)/plugins/platforms/qwindows.dll
QTPLATFORMS.path = $$OUT_PWD/release/platforms
QTPLUGINIMAGE.files = $$(QTDIR)/plugins/imageformats/
QTPLUGINIMAGE.path = $$OUT_PWD/release
LIBSTD.files = $$RUNTIMEDIR/libgcc_s_sjlj-1.dll $$RUNTIMEDIR/libstdc++-6.dll \
$$RUNTIMEDIR/libwinpthread-1.dll
LIBSTD.path = $$OUT_PWD/release
INSTALLS += RINGTONES PACKAGING LICENSE RUNTIME QTRUNTIME QTDEPSRUNTIME \
QTPLATFORMS LIBSTD
QTPLUGINIMAGE QTPLATFORMS LIBSTD
}
......@@ -36,7 +36,8 @@
CallWidget::CallWidget(QWidget *parent) :
NavWidget(Main ,parent),
ui(new Ui::CallWidget)
ui(new Ui::CallWidget),
menu_(new QMenu())
{
ui->setupUi(this);
......@@ -83,6 +84,73 @@ CallWidget::CallWidget(QWidget *parent) :
ui->historyList->setItemDelegate(new HistoryDelegate());
historyModel.release();
auto sortActionGroup = new QActionGroup(this);
auto alphabetAction = new QAction("Alphetical Order Ascending", this);
alphabetAction->setCheckable(true);
sortActionGroup->addAction(alphabetAction);
menu_->addAction(alphabetAction);
connect(alphabetAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::Name));
historyModel->setSortRole(static_cast<int>(Call::Role::Name));
historyModel->sort(0,Qt::AscendingOrder);
});
auto alphabetDownAction = new QAction("Alphetical Order Descending", this);
alphabetDownAction->setCheckable(true);
sortActionGroup->addAction(alphabetDownAction);
menu_->addAction(alphabetDownAction);
connect(alphabetDownAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::Name));
historyModel->setSortRole(static_cast<int>(Call::Role::Name));
historyModel->sort(0,Qt::DescendingOrder);
});
auto dateAction = new QAction("Date Order Ascending", this);
dateAction->setCheckable(true);
sortActionGroup->addAction(dateAction);
menu_->addAction(dateAction);
connect(dateAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::FuzzyDate));
historyModel->setSortRole(static_cast<int>(Call::Role::Date));
historyModel->sort(0,Qt::AscendingOrder);
});
auto dateDownAction = new QAction("Date Order Descending", this);
dateDownAction->setCheckable(true);
sortActionGroup->addAction(dateDownAction);
menu_->addAction(dateDownAction);
connect(dateDownAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::FuzzyDate));
historyModel->setSortRole(static_cast<int>(Call::Role::Date));
historyModel->sort(0,Qt::DescendingOrder);
});
dateDownAction->setChecked(true);
dateDownAction->trigger();
auto callsNumberAction = new QAction("Number of calls ascending", this);
callsNumberAction->setCheckable(true);
sortActionGroup->addAction(callsNumberAction);
menu_->addAction(callsNumberAction);
connect(callsNumberAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::CallCount));
historyModel->setSortRole(static_cast<int>(Call::Role::CallCount));
historyModel->sort(0,Qt::AscendingOrder);
});
auto callsDownNumberAction = new QAction("Number of calls descending", this);
callsDownNumberAction->setCheckable(true);
sortActionGroup->addAction(callsDownNumberAction);
menu_->addAction(callsDownNumberAction);
connect(callsDownNumberAction, &QAction::triggered, this, [=]() {
CategorizedHistoryModel::instance()->setCategoryRole(static_cast<int>(Call::Role::CallCount));
historyModel->setSortRole(static_cast<int>(Call::Role::CallCount));
historyModel->sort(0,Qt::DescendingOrder);
});
ui->sortToolButton->setMenu(menu_);
ui->sortToolButton->setPopupMode(QToolButton::InstantPopup);
CategorizedContactModel::instance()->setSortAlphabetical(false);
ui->contactView->setModel(CategorizedContactModel::instance());
ui->contactView->setItemDelegate(new ContactDelegate());
......@@ -281,18 +349,14 @@ CallWidget::atExit() {
void
CallWidget::on_contactView_doubleClicked(const QModelIndex &index)
{
auto contact = index.data((int)ContactMethod::Role::Uri);
QString uri;
if (contact.isValid()) {
uri = contact.toString();
} else {
auto var = index.data((int)Person::Role::Object);
if (var.isValid()) {
Person* person = var.value<Person*>();
if (person->phoneNumbers().size() > 0) {
uri = person->phoneNumbers().at(0)->uri();
}
auto var = index.child(0,0).data(
static_cast<int>(Person::Role::Object));
if (var.isValid()) {
Person* person = var.value<Person*>();
if (person->phoneNumbers().size() > 0) {
uri = person->phoneNumbers().at(0)->uri();
}
}
if (not uri.isEmpty()) {
......
......@@ -22,6 +22,7 @@
#include <QWidget>
#include <QVector>
#include <QString>
#include <QMenu>
#include "navwidget.h"
......@@ -80,6 +81,8 @@ private:
CallModel* callModel_;
int outputVolume_;
int inputVolume_;
QMenu *menu_;
private:
void findRingAccount();
void setActualCall(Call *value);
};
......
This diff is collapsed.
......@@ -532,6 +532,9 @@
<height>50</height>
</size>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
......
......@@ -17,5 +17,7 @@
<file>images/plus.png</file>
<file>images/settings.png</file>
<file>images/speaker-off.png</file>
<file>images/account.png</file>
<file>images/sort-variant.png</file>
</qresource>
</RCC>
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