Skip to content

Commit

Permalink
List other items.
Browse files Browse the repository at this point in the history
  • Loading branch information
textbrowser committed Nov 15, 2022
1 parent 7a4740e commit 8b72e7f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 12 deletions.
58 changes: 48 additions & 10 deletions Source/biblioteq_batch_activities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ biblioteq_batch_activities::biblioteq_batch_activities(biblioteq *parent):
{
m_qmain = parent;
m_ui.setupUi(this);

QAction *action1 = nullptr;
QAction *action2 = nullptr;

m_ui.discover_list->addAction
(action1 = new QAction(tr("List Discovered Items"), this));
m_ui.discover_list->addAction
(action2 = new QAction(tr("List Other Items"), this));
connect(action1,
SIGNAL(triggered(void)),
this,
SLOT(slotListDiscoveredItems(void)));
connect(action2,
SIGNAL(triggered(void)),
this,
SLOT(slotListDiscoveredItems(void)));
connect(m_qmain,
SIGNAL(fontChanged(const QFont &)),
this,
Expand All @@ -67,8 +83,8 @@ biblioteq_batch_activities::biblioteq_batch_activities(biblioteq *parent):
SLOT(slotClose(void)));
connect(m_ui.discover_list,
SIGNAL(clicked(void)),
this,
SLOT(slotListDiscoveredItems(void)));
m_ui.discover_list,
SLOT(showMenu(void)));
connect(m_ui.discover_scan,
SIGNAL(returnPressed(void)),
this,
Expand Down Expand Up @@ -442,6 +458,11 @@ void biblioteq_batch_activities::slotListDiscoveredItems(void)
if(m_ui.discover_table->rowCount() == 0)
return;

auto action = qobject_cast<QAction *> (sender());

if(!action)
return;

QApplication::setOverrideCursor(Qt::WaitCursor);

QList<QVariant> values;
Expand All @@ -450,6 +471,7 @@ void biblioteq_batch_activities::slotListDiscoveredItems(void)
QString cdFrontCover("'' AS front_cover ");
QString dvdFrontCover("'' AS front_cover ");
QString greyLiteratureFrontCover("'' AS front_cover ");
QString in(action->text().contains(tr("Other")) ? " NOT IN " : " IN ");
QString journalFrontCover("'' AS front_cover ");
QString magazineFrontCover("'' AS front_cover ");
QString photographCollectionFrontCover("'' AS image_scaled ");
Expand Down Expand Up @@ -536,7 +558,8 @@ void biblioteq_batch_activities::slotListDiscoveredItems(void)
"grey_literature.myoid = "
"item_borrower.item_oid "
"AND item_borrower.type = 'Grey Literature' "
"WHERE grey_literature.document_id IN ";
"WHERE grey_literature.document_id";
str.append(in);
str.append(where);
}
else if(type == "Photograph Collection")
Expand All @@ -558,7 +581,8 @@ void biblioteq_batch_activities::slotListDiscoveredItems(void)
"photograph_collection.myoid, " +
photographCollectionFrontCover +
"FROM photograph_collection "
"WHERE photograph_collection.id IN ";
"WHERE photograph_collection.id";
str.append(in);
str.append(where);
}
else
Expand Down Expand Up @@ -601,18 +625,32 @@ void biblioteq_batch_activities::slotListDiscoveredItems(void)

if(type == "Book")
{
str.append("book.accession_number IN ");
str.append("COALESCE(book.accession_number, '')");
str.append(in);
str.append(bookWhere);
str.append(" OR ");
str.append("book.id IN ");

if(in.contains("NOT"))
str.append(" AND ");
else
str.append(" OR ");

str.append("COALESCE(book.id, '')");
str.append(in);
str.append(bookWhere);
str.append(" OR ");
str.append("book.isbn13 IN ");

if(in.contains("NOT"))
str.append(" AND ");
else
str.append(" OR ");

str.append("COALESCE(book.isbn13, '')");
str.append(in);
str.append(bookWhere);
}
else
str.append(QString("%1.id IN %2").
str.append(QString("%1.id %2 %3").
arg(type.toLower().remove(" ")).
arg(in).
arg(where));

str.append(" ");
Expand Down
7 changes: 5 additions & 2 deletions UI/biblioteq_batch_activities_browser.ui
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,11 @@
<height>32</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
Expand Down

0 comments on commit 8b72e7f

Please sign in to comment.