This patch has been applied to the svn.  Kern, If you would be willing
to view the changes to the console class, that would be apprecieated.


On Sat, 2008-05-17 at 19:50 +0200, rghetta wrote:
> Hello Dirk and Kern,
> attached you find the sorting patch we discussed.
> To recap:
> - change joblist ordering to jobid descending.
> - enable column sorting as suggested by Marc Schiffbauer
> 
> Listing of Job files was very slow on my machine, so I added a buffer of 
> about 8KB to console::displayToPrompt() to speed thing up.
> 
> Regards,
> Riccardo
> plain text document attachment (jobsort.patch)
> Index: bacula/src/qt-console/console/console.cpp
> ===================================================================
> --- bacula/src/qt-console/console/console.cpp (revision 6980)
> +++ bacula/src/qt-console/console/console.cpp (working copy)
> @@ -585,12 +585,18 @@
>  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 @@
>  { 
>     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);
>  }
>  
> 
> Index: bacula/src/qt-console/joblist/joblist.cpp
> ===================================================================
> --- bacula/src/qt-console/joblist/joblist.cpp (revision 6980)
> +++ bacula/src/qt-console/joblist/joblist.cpp (working copy)
> @@ -138,6 +138,7 @@
>     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 @@
>           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 @@
>        }
>     }
>     /* 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;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to