Skip to content

Commit

Permalink
Ability to sort user list by last login time
Browse files Browse the repository at this point in the history
  • Loading branch information
CoBC authored and bear101 committed Oct 18, 2024
1 parent cea8278 commit 1749a22
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Default Qt Client
- All byte sizes converted to local format
- Option to use TeamTalk Sound Output device for default sound event playback mode
- Option to choose bitween text or emoji for user and channel info in channel list
- Last login time display in "User Accounts" dialog
- Last login time shown in "User Accounts" dialog
- Ability to sort by "Last Login Time" in "User Accounts" dialog
- Fixed gender changed from female to male when migrating to 5.17 release
- Fixed sound events disabled when migrating to 5.17 release
- Fixed language not set at first start
Expand Down
11 changes: 11 additions & 0 deletions Client/qtTeamTalk/useraccountsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ void UserAccountsDlg::slotTreeContextMenu(const QPoint& /*point*/)
const QString modified = "modified";
sortModified->setChecked((ttSettings->value(SETTINGS_DISPLAY_USERACCOUNT_SORT, SETTINGS_DISPLAY_USERACCOUNT_SORT_DEFAULT).toString() == modified)?true:false);
sortMenu->addAction(sortModified);
QAction* sortLogin = new QAction(sortMenu);
sortLogin->setText(tr("&Last Login Time (%1)").arg(m_proxyModel->sortOrder() == Qt::AscendingOrder?asc:desc));
sortLogin->setCheckable(true);
const QString lastLogin = "lastLogin";
sortLogin->setChecked((ttSettings->value(SETTINGS_DISPLAY_USERACCOUNT_SORT, SETTINGS_DISPLAY_USERACCOUNT_SORT_DEFAULT).toString() == lastLogin)?true:false);
sortMenu->addAction(sortLogin);
QAction* addUser = menu.addAction(tr("&Create New User Account"));
QAction* delUser = menu.addAction(tr("&Delete Selected User Account"));
QAction* editUser = menu.addAction(tr("&Edit Selected User Account"));
Expand Down Expand Up @@ -223,6 +229,11 @@ void UserAccountsDlg::slotTreeContextMenu(const QPoint& /*point*/)
ui.usersTableView->horizontalHeader()->setSortIndicator(COLUMN_INDEX_MODIFIED, m_proxyModel->sortColumn() == COLUMN_INDEX_MODIFIED ? sortToggle : Qt::AscendingOrder);
ttSettings->setValue(SETTINGS_DISPLAY_USERACCOUNT_SORT, modified);
}
else if (action == sortLogin)
{
ui.usersTableView->horizontalHeader()->setSortIndicator(COLUMN_INDEX_LASTLOGIN, m_proxyModel->sortColumn() == COLUMN_INDEX_LASTLOGIN ? sortToggle : Qt::AscendingOrder);
ttSettings->setValue(SETTINGS_DISPLAY_USERACCOUNT_SORT, lastLogin);
}
else if (action == addUser)
slotAddUser();
else if (action == delUser)
Expand Down
3 changes: 3 additions & 0 deletions Client/qtTeamTalk/useraccountsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ QVariant UserAccountsModel::data(const QModelIndex & index, int role /*= Qt::Dis
case COLUMN_INDEX_MODIFIED :
return _Q(m_users[index.row()].szLastModified);
break;
case COLUMN_INDEX_LASTLOGIN :
return _Q(m_users[index.row()].szLastLoginTime);
break;
default :
return data(index, Qt::DisplayRole);
break;
Expand Down

0 comments on commit 1749a22

Please sign in to comment.