From 15401009f68f080ac59c55798e9381de1df0931c Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sat, 17 May 2008 20:32:00 +0000 Subject: [PATCH] This is the joblist sortable patch from Riccardo. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6981 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/console/console.cpp | 18 +++++++++++++----- bacula/src/qt-console/joblist/joblist.cpp | 7 ++++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index ec0e03376c..b177b4ba24 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -585,12 +585,18 @@ void Console::beginNewCommand() void Console::displayToPrompt() { int stat = 0; + QString buf; if (mainWin->m_commDebug) Pmsg0(000, "DisplaytoPrompt\n"); while (!m_at_prompt) { if ((stat=read()) > 0) { - display_text(msg()); + buf += msg(); + if (buf.size() >= 8196) { + display_text(buf); + buf.clear(); + } } } + display_text(buf); if (mainWin->m_commDebug) Pmsg1(000, "endDisplaytoPrompt=%d\n", stat); } @@ -598,12 +604,14 @@ void Console::discardToPrompt() { int stat = 0; if (mainWin->m_commDebug) Pmsg0(000, "discardToPrompt\n"); - while (!m_at_prompt) { - if ((stat=read()) > 0) { - if (mainWin->m_displayAll) display_text(msg()); + if (mainWin->m_displayAll) { + displayToPrompt(); + } else { + while (!m_at_prompt) { + stat=read(); } } - if (mainWin->m_commDebug) Pmsg1(000, "endDisplayToPrompt=%d\n", stat); + if (mainWin->m_commDebug) Pmsg1(000, "endDiscardToPrompt=%d\n", stat); } diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index 080012d913..0107eff392 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -138,6 +138,7 @@ void JobList::populateTable() mp_tableWidget->setColumnCount(headerlist.size()); mp_tableWidget->setHorizontalHeaderLabels(headerlist); mp_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); + mp_tableWidget->setSortingEnabled(false); /* rows move on insert if sorting enabled */ if (mainWin->m_sqlDebug) { Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data()); @@ -205,6 +206,10 @@ void JobList::populateTable() row++; } } + /* set default sorting */ + mp_tableWidget->sortByColumn(m_jobIdIndex, Qt::DescendingOrder); + mp_tableWidget->setSortingEnabled(true); + /* Resize the columns */ mp_tableWidget->resizeColumnsToContents(); mp_tableWidget->resizeRowsToContents(); @@ -329,7 +334,7 @@ void JobList::fillQueryString(QString &query) } } /* Descending */ - query += " ORDER BY Job.Starttime=0 DESC, Job.Starttime DESC, Job.JobId DESC"; + query += " ORDER BY Job.JobId DESC"; /* If Limit check box for limit records returned is checked */ if (limitCheckBox->checkState() == Qt::Checked) { QString limit; -- 2.39.5