2022-05-04 Fred Gleason <fredg@paravelsystems.com>

* Added an 'show_unchanged' argument to the constructor of the
	'RDGroupListModel' model.
	* Modified the 'Edit Cart' dialog in rdlibrary(1) so as to
	default the 'Group:' and 'Usage:' controls to '[unchanged]' when
	opened in multi-edit mode.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2022-05-04 14:02:17 -04:00
parent f37fe2db9f
commit 0a633f27e5
10 changed files with 48 additions and 30 deletions

View File

@@ -36,7 +36,7 @@ RDCartFilter::RDCartFilter(bool show_drag_box,bool user_is_admin,
d_cart_model=NULL;
d_show_drag_box=show_drag_box;
d_group_model=new RDGroupListModel(true,user_is_admin,this);
d_group_model=new RDGroupListModel(true,false,user_is_admin,this);
//
// Filter Phrase

View File

@@ -22,11 +22,12 @@
#include "rdescape_string.h"
#include "rdgrouplistmodel.h"
RDGroupListModel::RDGroupListModel(bool show_all,bool user_is_admin,
QObject *parent)
RDGroupListModel::RDGroupListModel(bool show_all,bool show_unchanged,
bool user_is_admin,QObject *parent)
: QAbstractTableModel(parent)
{
d_show_all=show_all;
d_show_unchanged=show_unchanged;
d_user_is_admin=user_is_admin;
d_service_names.push_back(tr("ALL"));
d_sort_column=0;
@@ -200,7 +201,7 @@ QStringList RDGroupListModel::allGroupNames() const
{
QStringList ret;
if(d_show_all) {
if(d_show_all||d_show_unchanged) {
for(int i=1;i<d_texts.size();i++) {
ret.push_back(d_texts.at(i).at(0).toString());
}
@@ -348,7 +349,6 @@ void RDGroupListModel::updateModel()
RDSqlQuery *q=NULL;
QString sql=sqlFields()+filterSql();
// sql+="order by `NAME` ";
beginResetModel();
d_texts.clear();
d_colors.clear();
@@ -360,6 +360,12 @@ void RDGroupListModel::updateModel()
d_colors.push_back(QVariant());
d_icons.push_back(icons);
}
if(d_show_unchanged) {
d_texts.push_back(texts);
d_texts.back().push_back(tr("[unchanged]"));
d_colors.push_back(QVariant());
d_icons.push_back(icons);
}
q=new RDSqlQuery(sql);
while(q->next()) {

View File

@@ -33,7 +33,8 @@ class RDGroupListModel : public QAbstractTableModel
{
Q_OBJECT
public:
RDGroupListModel(bool show_all,bool user_is_admin,QObject *parent=0);
RDGroupListModel(bool show_all,bool show_unchanged,bool user_is_admin,
QObject *parent);
~RDGroupListModel();
QPalette palette();
void setPalette(const QPalette &pal);
@@ -75,6 +76,7 @@ class RDGroupListModel : public QAbstractTableModel
QList<QVariant> d_icons;
QList<QVariant> d_colors;
bool d_show_all;
bool d_show_unchanged;
bool d_user_is_admin;
QStringList d_visible_groups;
QStringList d_column_fields;

View File

@@ -42,7 +42,7 @@ RDListGroups::RDListGroups(QString *groupname,const QString &caption,
group_group_view=new RDTableView(this);
group_group_view->setGeometry(10,10,
sizeHint().width()-20,sizeHint().height()-80);
group_group_model=new RDGroupListModel(false,false,this);
group_group_model=new RDGroupListModel(false,false,false,this);
group_group_model->setFont(font());
group_group_model->setPalette(palette());
group_group_view->setModel(group_group_model);