[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bacula-devel] revised patch: Re: patch: fix: job graphs don't work even with qwt


This patch has been applied.  Great work Riccardo!!

Thank you kindly

Dirk

On Mon, 2008-05-26 at 21:56 +0200, rgh wrote:
> Kern Sibbald wrote:
> > On Saturday 24 May 2008 18:38:57 rgh wrote:
> >> Kern Sibbald wrote:
> >>> Hello Riccardo,
> >>>
> >>> Nice. I like the idea of making the qwt buttons invisible.
> >>>
> >>> One small detail: I would prefer not to have assert()s in the code
> >>> because it is not very user friendly.  I suggest to either completely
> >>> ignore the condition (my preference) or possibly print a message in the
> >>> status line.
> >> Ah, ok. I'll remove the asserts, then.
> > 
> > Thanks.
> 
> Attached is the revised patch. I've added a bunch of other translation 
> changes and a bit of refactoring of comboboxes.
> 
> Ciao,
> Riccardo
> plain text document attachment (tr2.patch)
> Index: bacula/src/qt-console/status/storstat.cpp
> ===================================================================
> --- bacula/src/qt-console/status/storstat.cpp	(revision 7033)
> +++ bacula/src/qt-console/status/storstat.cpp	(working copy)
> @@ -58,7 +58,7 @@
>  {
>     m_storage = storage;
>     setupUi(this);
> -   m_name = tr("Storage Status") + " " + m_storage;
> +   m_name = tr("Storage Status %1").arg(m_storage);
>     m_closeable = true;
>     pgInitialize(parentTreeWidgetItem);
>     QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
> Index: bacula/src/qt-console/status/clientstat.cpp
> ===================================================================
> --- bacula/src/qt-console/status/clientstat.cpp	(revision 7033)
> +++ bacula/src/qt-console/status/clientstat.cpp	(working copy)
> @@ -43,7 +43,7 @@
>  {
>     m_client = client;
>     setupUi(this);
> -   m_name = tr("Client Status") + " " + m_client;
> +   m_name = tr("Client Status %1").arg(m_client);
>     m_closeable = true;
>     pgInitialize(parentTreeWidgetItem);
>     QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
> Index: bacula/src/qt-console/status/dirstat.cpp
> ===================================================================
> --- bacula/src/qt-console/status/dirstat.cpp	(revision 7033)
> +++ bacula/src/qt-console/status/dirstat.cpp	(working copy)
> @@ -394,8 +394,8 @@
>        m_selectedJobsList.append(sitem->text());
>     }
>     if (m_selectedJobsList.count() > 1) {
> -      actionCancelRunning->setText(QString("Cancel list of %1 Jobs").arg(m_selectedJobsList.count()));
> +      actionCancelRunning->setText(tr("Cancel list of %1 Jobs").arg(m_selectedJobsList.count()));
>     } else {
> -      actionCancelRunning->setText("Cancel Single Job");
> +      actionCancelRunning->setText(tr("Cancel Single Job"));
>     }
>  }
> Index: bacula/src/qt-console/mainwin.h
> ===================================================================
> --- bacula/src/qt-console/mainwin.h	(revision 7033)
> +++ bacula/src/qt-console/mainwin.h	(working copy)
> @@ -113,9 +113,7 @@
>     void estimateButtonClicked();
>     void browseButtonClicked();
>     void statusPageButtonClicked();
> -#ifdef HAVE_QWT
>     void jobPlotButtonClicked();
> -#endif 
>     void restoreButtonClicked();
>     void undockWindowButton();
>     void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
> Index: bacula/src/qt-console/bcomm/dircomm.cpp
> ===================================================================
> --- bacula/src/qt-console/bcomm/dircomm.cpp	(revision 7033)
> +++ bacula/src/qt-console/bcomm/dircomm.cpp	(working copy)
> @@ -107,11 +107,11 @@
>  
>     m_dir = dir;
>     if (!m_dir) {          
> -      mainWin->set_status("No Director found.");
> +      mainWin->set_status( tr("No Director found.") );
>        return;
>     }
>     if (m_sock) {
> -      mainWin->set_status("Already connected.");
> +      mainWin->set_status( tr("Already connected.") );
>        return;
>     }
>  
> @@ -177,7 +177,7 @@
>                            _("Director daemon"), m_dir->address,
>                            NULL, m_dir->DIRport, 0);
>     if (m_sock == NULL) {
> -      mainWin->set_status("Connection failed");
> +     mainWin->set_status( tr("Connection failed") );
>        return;
>     } else {
>        /* Update page selector to green to indicate that Console is connected */
> @@ -289,7 +289,7 @@
>        QApplication::setOverrideCursor(Qt::WaitCursor);
>        write(msg);
>     } else {
> -      mainWin->set_status(" Director not connected. Click on connect button.");
> +      mainWin->set_status( tr(" Director not connected. Click on connect button.") );
>        mainWin->actionConnect->setIcon(QIcon(":images/disconnected.png"));
>        QBrush redBrush(Qt::red);
>        QTreeWidgetItem *item = mainWin->getFromHash(this);
> @@ -518,10 +518,9 @@
>     if (is_connected()) {
>        return true;
>     } else {
> -      QString message("Director ");
> -      message += " is curerntly disconnected\n  Please reconnect!!";
> -      QMessageBox::warning(this, tr("Bat"),
> -         tr(message.toUtf8().data()), QMessageBox::Ok );
> +     QString message( tr("Director is currently disconnected\n  Please reconnect!"));
> +     QMessageBox::warning(this, "Bat",
> +         message.toUtf8().data(), QMessageBox::Ok );
>        return false;
>     }
>  }
> Index: bacula/src/qt-console/mount/mount.cpp
> ===================================================================
> --- bacula/src/qt-console/mount/mount.cpp	(revision 7033)
> +++ bacula/src/qt-console/mount/mount.cpp	(working copy)
> @@ -48,8 +48,7 @@
>     setupUi(this);
>     this->show();
>  
> -   QString labelText("Storage : ");
> -   labelText += storageName;
> +   QString labelText( tr("Storage : %1").arg(storageName) );
>     storageLabel->setText(labelText);
>  }
>  
> @@ -57,7 +56,7 @@
>  {
>     QString scmd;
>     if (m_storageName == "") {
> -      QMessageBox::warning(this, "No Storage name", "No Storage name given",
> +      QMessageBox::warning(this, tr("No Storage name"), tr("No Storage name given"),
>                             QMessageBox::Ok, QMessageBox::Ok);
>        return;
>     }
> @@ -69,10 +68,10 @@
>        Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data());
>     }
>  
> -   m_console->display_text("Context sensitive command :\n\n");
> +   m_console->display_text( tr("Context sensitive command :\n\n"));
>     m_console->display_text("****    ");
>     m_console->display_text(scmd + "    ****\n");
> -   m_console->display_text("Director Response :\n\n");
> +   m_console->display_text(tr("Director Response :\n\n"));
>  
>     m_console->write_dir(scmd.toUtf8().data());
>     m_console->displayToPrompt();
> Index: bacula/src/qt-console/jobgraphs/jobplot.h
> ===================================================================
> --- bacula/src/qt-console/jobgraphs/jobplot.h	(revision 7033)
> +++ bacula/src/qt-console/jobgraphs/jobplot.h	(working copy)
> @@ -128,6 +128,7 @@
>     void reGraph();
>  
>  private:
> +   void fillSymbolCombo(QComboBox *q);
>     void setSymbolType(int, int type);
>     void addCurve();
>     void writeSettings();
> Index: bacula/src/qt-console/jobgraphs/jobplot.cpp
> ===================================================================
> --- bacula/src/qt-console/jobgraphs/jobplot.cpp	(revision 7033)
> +++ bacula/src/qt-console/jobgraphs/jobplot.cpp	(working copy)
> @@ -37,6 +37,7 @@
>  
>  #include <QtGui>
>  #include "bat.h"
> +#include "util/comboutil.h"
>  #include "jobgraphs/jobplot.h"
>  
> 
> @@ -76,7 +77,7 @@
>  JobPlot::JobPlot(QTreeWidgetItem *parentTreeWidgetItem, JobPlotPass &passVals)
>  {
>     setupUserInterface();
> -   m_name = "JobPlot";
> +   m_name = tr("JobPlot");
>     pgInitialize(parentTreeWidgetItem);
>     readSplitterSettings();
>     QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
> @@ -134,13 +135,13 @@
>   */
>  void JobPlot::setupControls()
>  {
> -   QStringList graphType = QStringList() << /* "Fitted" <<*/ "Sticks" << "Lines" << "Steps" << "None";
> +   QStringList graphType = QStringList() << /* tr("Fitted") <<*/ tr("Sticks")
> +					 << tr("Lines") << tr("Steps") << tr("None");
>     controls->plotTypeCombo->addItems(graphType);
> -   QStringList symbolType = QStringList() << "Ellipse" << "Rect" << "Diamond" << "Triangle"
> -            << "DTrianle" << "UTriangle" << "LTriangle" << "RTriangle" << "Cross" << "XCross"
> -            << "HLine" << "Vline" << "Star1" << "Star2" << "Hexagon" << "None";
> -   controls->fileSymbolTypeCombo->addItems(symbolType);
> -   controls->byteSymbolTypeCombo->addItems(symbolType);
> +
> +   fillSymbolCombo(controls->fileSymbolTypeCombo);
> +   fillSymbolCombo(controls->byteSymbolTypeCombo);
> +
>     readControlSettings();
>  
>     controls->fileCheck->setCheckState(Qt::Checked);
> @@ -152,24 +153,25 @@
>     connect(controls->byteCheck, SIGNAL(stateChanged(int)), this, SLOT(byteCheckChanged(int)));
>     connect(controls->refreshButton, SIGNAL(pressed()), this, SLOT(reGraph()));
>  
> -   controls->clientComboBox->addItem("Any");
> +   controls->clientComboBox->addItem(tr("Any"));
>     controls->clientComboBox->addItems(m_console->client_list);
>  
>     QStringList volumeList;
>     m_console->getVolumeList(volumeList);
> -   controls->volumeComboBox->addItem("Any");
> +   controls->volumeComboBox->addItem(tr("Any"));
>     controls->volumeComboBox->addItems(volumeList);
> -   controls->jobComboBox->addItem("Any");
> +   controls->jobComboBox->addItem(tr("Any"));
>     controls->jobComboBox->addItems(m_console->job_list);
> -   controls->levelComboBox->addItem("Any");
> -   controls->levelComboBox->addItems( QStringList() << "F" << "D" << "I");
> -   controls->purgedComboBox->addItem("Any");
> -   controls->purgedComboBox->addItems( QStringList() << "0" << "1");
> -   controls->fileSetComboBox->addItem("Any");
> +
> +   levelComboFill(controls->levelComboBox);
> +
> +   boolComboFill(controls->purgedComboBox);
> +
> +   controls->fileSetComboBox->addItem(tr("Any"));
>     controls->fileSetComboBox->addItems(m_console->fileset_list);
>     QStringList statusLongList;
>     m_console->getStatusList(statusLongList);
> -   controls->statusComboBox->addItem("Any");
> +   controls->statusComboBox->addItem(tr("Any"));
>     controls->statusComboBox->addItems(statusLongList);
>  
>     if (m_pass.use) {
> @@ -177,27 +179,15 @@
>        controls->limitSpinBox->setValue(m_pass.recordLimitSpin);
>        controls->daysCheckBox->setCheckState(m_pass.daysLimitCheck);
>        controls->daysSpinBox->setValue(m_pass.daysLimitSpin);
> -      int jobIndex = controls->jobComboBox->findText(m_pass.jobCombo, Qt::MatchExactly); 
> -      if (jobIndex != -1)
> -         controls->jobComboBox->setCurrentIndex(jobIndex);
> -      int clientIndex = controls->clientComboBox->findText(m_pass.clientCombo, Qt::MatchExactly);
> -      if (clientIndex != -1)
> -         controls->clientComboBox->setCurrentIndex(clientIndex);
> -      int volumeIndex = controls->volumeComboBox->findText(m_pass.volumeCombo, Qt::MatchExactly);
> -      if (volumeIndex != -1)
> -         controls->volumeComboBox->setCurrentIndex(volumeIndex);
> -      int filesetIndex = controls->fileSetComboBox->findText(m_pass.fileSetCombo, Qt::MatchExactly);
> -      if (filesetIndex != -1)
> -         controls->fileSetComboBox->setCurrentIndex(filesetIndex);
> -      int purgedIndex = controls->purgedComboBox->findText(m_pass.purgedCombo, Qt::MatchExactly); 
> -      if (purgedIndex != -1)
> -         controls->purgedComboBox->setCurrentIndex(purgedIndex);
> -      int levelIndex = controls->levelComboBox->findText(m_pass.levelCombo, Qt::MatchExactly); 
> -      if (levelIndex != -1)
> -         controls->levelComboBox->setCurrentIndex(levelIndex);
> -      int statusIndex = controls->statusComboBox->findText(m_pass.statusCombo, Qt::MatchExactly); 
> -      if (statusIndex != -1)
> -         controls->statusComboBox->setCurrentIndex(statusIndex);
> +
> +      comboSel(controls->jobComboBox, m_pass.jobCombo);
> +      comboSel(controls->clientComboBox, m_pass.clientCombo);
> +      comboSel(controls->volumeComboBox, m_pass.volumeCombo);
> +      comboSel(controls->fileSetComboBox, m_pass.fileSetCombo);
> +      comboSel(controls->purgedComboBox, m_pass.purgedCombo);
> +      comboSel(controls->levelComboBox, m_pass.levelCombo);
> +      comboSel(controls->statusComboBox, m_pass.statusCombo);
> +
>     } else {
>        /* Set Defaults for check and spin for limits */
>        controls->limitCheckBox->setCheckState(mainWin->m_recordLimitCheck ? Qt::Checked : Qt::Unchecked);
> @@ -225,30 +215,19 @@
>              " LEFT OUTER JOIN FileSet ON (FileSet.FileSetId=Job.FileSetId)";
>  
>     QStringList conditions;
> -   int jobIndex = controls->jobComboBox->currentIndex();
> -   if ((jobIndex != -1) && (controls->jobComboBox->itemText(jobIndex) != "Any"))
> -      conditions.append("Job.Name='" + controls->jobComboBox->itemText(jobIndex) + "'");
> -   int clientIndex = controls->clientComboBox->currentIndex();
> -   if ((clientIndex != -1) && (controls->clientComboBox->itemText(clientIndex) != "Any"))
> -      conditions.append("Client.Name='" + controls->clientComboBox->itemText(clientIndex) + "'");
> +   comboCond(conditions, controls->jobComboBox, "Job.Name");
> +   comboCond(conditions, controls->clientComboBox, "Client.Name");
>     int volumeIndex = controls->volumeComboBox->currentIndex();
> -   if ((volumeIndex != -1) && (controls->volumeComboBox->itemText(volumeIndex) != "Any")) {
> +   if ((volumeIndex != -1) && (controls->volumeComboBox->itemText(volumeIndex) != tr("Any"))) {
>        query += " LEFT OUTER JOIN JobMedia ON (JobMedia.JobId=Job.JobId)"
>  	       " LEFT OUTER JOIN Media ON (JobMedia.MediaId=Media.MediaId)";
>        conditions.append("Media.VolumeName='" + controls->volumeComboBox->itemText(volumeIndex) + "'");
>     }
> -   int fileSetIndex = controls->fileSetComboBox->currentIndex();
> -   if ((fileSetIndex != -1) && (controls->fileSetComboBox->itemText(fileSetIndex) != "Any"))
> -      conditions.append("FileSet.FileSet='" + controls->fileSetComboBox->itemText(fileSetIndex) + "'");
> -   int purgedIndex = controls->purgedComboBox->currentIndex();
> -   if ((purgedIndex != -1) && (controls->purgedComboBox->itemText(purgedIndex) != "Any"))
> -      conditions.append("Job.PurgedFiles='" + controls->purgedComboBox->itemText(purgedIndex) + "'");
> -   int levelIndex = controls->levelComboBox->currentIndex();
> -   if ((levelIndex != -1) && (controls->levelComboBox->itemText(levelIndex) != "Any"))
> -      conditions.append("Job.Level='" + controls->levelComboBox->itemText(levelIndex) + "'");
> -   int statusIndex = controls->statusComboBox->currentIndex();
> -   if ((statusIndex != -1) && (controls->statusComboBox->itemText(statusIndex) != "Any"))
> -      conditions.append("Status.JobStatusLong='" + controls->statusComboBox->itemText(statusIndex) + "'");
> +   comboCond(conditions, controls->fileSetComboBox, "FileSet.FileSet");
> +   boolComboCond(conditions, controls->purgedComboBox, "Job.PurgedFiles");
> +   levelComboCond(conditions, controls->levelComboBox, "Job.Level");
> +   comboCond(conditions, controls->statusComboBox, "Status.JobStatusLong");
> +
>     /* If Limit check box For limit by days is checked  */
>     if (controls->daysCheckBox->checkState() == Qt::Checked) {
>        QDateTime stamp = QDateTime::currentDateTime().addDays(-controls->daysSpinBox->value());
> @@ -306,10 +285,10 @@
>           row++;
>        }
>     } 
> -   if ((controls->volumeComboBox->itemText(volumeIndex) != "Any") && (results.count() == 0)){
> +   if ((controls->volumeComboBox->itemText(volumeIndex) != tr("Any")) && (results.count() == 0)){
>        /* for context sensitive searches, let the user know if there were no
>         *        * results */
> -      QMessageBox::warning(this, tr("Bat"),
> +      QMessageBox::warning(this, "Bat",
>            tr("The Jobs query returned no results.\n"
>           "Press OK to continue?"), QMessageBox::Ok );
>     }
> @@ -354,23 +333,23 @@
>   */
>  void JobPlot::addCurve()
>  {
> -   m_jobPlot->setTitle("Files and Bytes backed up");
> +   m_jobPlot->setTitle(tr("Files and Bytes backed up"));
>     m_jobPlot->insertLegend(new QwtLegend(), QwtPlot::RightLegend);
>  
>     // Set axis titles
>     m_jobPlot->enableAxis(QwtPlot::yRight);
> -   m_jobPlot->setAxisTitle(QwtPlot::yRight, "<-- Bytes Kb");
> -   m_jobPlot->setAxisTitle(m_jobPlot->xBottom, "date of backup -->");
> -   m_jobPlot->setAxisTitle(m_jobPlot->yLeft, "Number of Files -->");
> +   m_jobPlot->setAxisTitle(QwtPlot::yRight, tr("<-- Bytes Kb"));
> +   m_jobPlot->setAxisTitle(m_jobPlot->xBottom, tr("date of backup -->"));
> +   m_jobPlot->setAxisTitle(m_jobPlot->yLeft, tr("Number of Files -->"));
>     m_jobPlot->setAxisScaleDraw(QwtPlot::xBottom, new DateTimeScaleDraw());
>  
>     // Insert new curves
> -   m_fileCurve = new QwtPlotCurve("Files");
> +   m_fileCurve = new QwtPlotCurve( tr("Files") );
>     m_fileCurve->setPen(QPen(Qt::red));
>     m_fileCurve->setCurveType(m_fileCurve->Yfx);
>     m_fileCurve->setYAxis(QwtPlot::yLeft);
>  
> -   m_byteCurve = new QwtPlotCurve("Bytes");
> +   m_byteCurve = new QwtPlotCurve(tr("Bytes"));
>     m_byteCurve->setPen(QPen(Qt::blue));
>     m_byteCurve->setCurveType(m_byteCurve->Yfx);
>     m_byteCurve->setYAxis(QwtPlot::yRight);
> @@ -430,19 +409,19 @@
>  void JobPlot::setPlotType(QString currentText)
>  {
>     QwtPlotCurve::CurveStyle style = QwtPlotCurve::NoCurve;
> -   if (currentText == "Fitted") {
> +   if (currentText == tr("Fitted")) {
>        style = QwtPlotCurve::Lines;
>        m_fileCurve->setCurveAttribute(QwtPlotCurve::Fitted);
>        m_byteCurve->setCurveAttribute(QwtPlotCurve::Fitted);
> -   } else if (currentText == "Sticks") {
> +   } else if (currentText == tr("Sticks")) {
>        style = QwtPlotCurve::Sticks;
> -   } else if (currentText == "Lines") {
> +   } else if (currentText == tr("Lines")) {
>        style = QwtPlotCurve::Lines;
>        m_fileCurve->setCurveAttribute(QwtPlotCurve::Fitted);
>        m_byteCurve->setCurveAttribute(QwtPlotCurve::Fitted);
> -   } else if (currentText == "Steps") {
> +   } else if (currentText == tr("Steps")) {
>        style = QwtPlotCurve::Steps;
> -   } else if (currentText == "None") {
> +   } else if (currentText == tr("None")) {
>        style = QwtPlotCurve::NoCurve;
>     }
>     m_fileCurve->setStyle(style);
> @@ -450,6 +429,27 @@
>     m_jobPlot->replot();
>  }
>  
> +void JobPlot::fillSymbolCombo(QComboBox *q)
> +{
> +  q->addItem( tr("Ellipse"), (int)QwtSymbol::Ellipse);
> +  q->addItem( tr("Rect"), (int)QwtSymbol::Rect); 
> +  q->addItem( tr("Diamond"), (int)QwtSymbol::Diamond);
> +  q->addItem( tr("Triangle"), (int)QwtSymbol::Triangle);
> +  q->addItem( tr("DTrianle"), (int)QwtSymbol::DTriangle);
> +  q->addItem( tr("UTriangle"), (int)QwtSymbol::UTriangle);
> +  q->addItem( tr("LTriangle"), (int)QwtSymbol::LTriangle);
> +  q->addItem( tr("RTriangle"), (int)QwtSymbol::RTriangle);
> +  q->addItem( tr("Cross"), (int)QwtSymbol::Cross);
> +  q->addItem( tr("XCross"), (int)QwtSymbol::XCross);
> +  q->addItem( tr("HLine"), (int)QwtSymbol::HLine);
> +  q->addItem( tr("Vline"), (int)QwtSymbol::VLine);
> +  q->addItem( tr("Star1"), (int)QwtSymbol::Star1);
> +  q->addItem( tr("Star2"), (int)QwtSymbol::Star2);
> +  q->addItem( tr("Hexagon"), (int)QwtSymbol::Hexagon); 
> +  q->addItem( tr("None"), (int)QwtSymbol::NoSymbol);
> +}
> +
> +
>  /*
>   * slot to respond to the symbol type combo changing
>   */
> @@ -467,44 +467,20 @@
>     QwtSymbol sym;
>     sym.setPen(QColor(Qt::black));
>     sym.setSize(7);
> -   if (index == 0) {
> -      sym.setStyle(QwtSymbol::Ellipse);
> -   } else if (index == 1) {
> -      sym.setStyle(QwtSymbol::Rect);
> -   } else if (index == 2) {
> -      sym.setStyle(QwtSymbol::Diamond);
> -   } else if (index == 3) {
> -      sym.setStyle(QwtSymbol::Triangle);
> -   } else if (index == 4) {
> -      sym.setStyle(QwtSymbol::DTriangle);
> -   } else if (index == 5) {
> -      sym.setStyle(QwtSymbol::UTriangle);
> -   } else if (index == 6) {
> -      sym.setStyle(QwtSymbol::LTriangle);
> -   } else if (index == 7) {
> -      sym.setStyle(QwtSymbol::RTriangle);
> -   } else if (index == 8) {
> -      sym.setStyle(QwtSymbol::Cross);
> -   } else if (index == 9) {
> -      sym.setStyle(QwtSymbol::XCross);
> -   } else if (index == 10) {
> -      sym.setStyle(QwtSymbol::HLine);
> -   } else if (index == 11) {
> -      sym.setStyle(QwtSymbol::VLine);
> -   } else if (index == 12) {
> -      sym.setStyle(QwtSymbol::Star1);
> -   } else if (index == 13) {
> -      sym.setStyle(QwtSymbol::Star2);
> -   } else if (index == 14) {
> -      sym.setStyle(QwtSymbol::Hexagon);
> -   }
> -   if (type == 0) {
> +
> +   QVariant style;
> +   if (0 == type) {
> +      style = controls->fileSymbolTypeCombo->itemData(index);
> +      sym.setStyle( (QwtSymbol::Style)style.toInt() );
>        sym.setBrush(QColor(Qt::yellow));
>        m_fileCurve->setSymbol(sym);
> -   }
> -   if (type == 1) {
> +   
> +   } else {
> +      style = controls->byteSymbolTypeCombo->itemData(index);
> +      sym.setStyle( (QwtSymbol::Style)style.toInt() );
>        sym.setBrush(QColor(Qt::blue));
>        m_byteCurve->setSymbol(sym);
> +
>     }
>     m_jobPlot->replot();
>  }
> Index: bacula/src/qt-console/mainwin.cpp
> ===================================================================
> --- bacula/src/qt-console/mainwin.cpp	(revision 7033)
> +++ bacula/src/qt-console/mainwin.cpp	(working copy)
> @@ -83,6 +83,11 @@
>  
>     createConnections();
>  
> +#ifndef HAVE_QWT
> +   actionJobPlot->setEnabled(false);
> +   actionJobPlot->setVisible(false);
> +#endif
> +
>     this->show();
>  
>     readSettings();
> @@ -468,14 +473,14 @@
>     new prerestorePage();
>  }
>  
> -#ifdef HAVE_QWT
>  void MainWin::jobPlotButtonClicked()
>  {
> +#ifdef HAVE_QWT
>     JobPlotPass pass;
>     pass.use = false;
>     new JobPlot(NULL, pass);
> +#endif
>  }
> -#endif
>  
>  /*
>   * The user just finished typing a line in the command line edit box
> @@ -687,6 +692,9 @@
>        break;
>     }
>     prefs.openPlotCheckBox->setCheckState(m_openPlot ? Qt::Checked : Qt::Unchecked);
> +#ifndef HAVE_QWT
> +   prefs.openPlotCheckBox->setVisible(false);
> +#endif
>     prefs.openBrowserCheckBox->setCheckState(m_openBrowser ? Qt::Checked : Qt::Unchecked);
>     prefs.openDirStatCheckBox->setCheckState(m_openDirStat ? Qt::Checked : Qt::Unchecked);
>     prefs.exec();
> Index: bacula/src/qt-console/restore/restore.cpp
> ===================================================================
> --- bacula/src/qt-console/restore/restore.cpp	(revision 7033)
> +++ bacula/src/qt-console/restore/restore.cpp	(working copy)
> @@ -395,8 +395,8 @@
>        m_console->discardToPrompt();
>     }
>     if (count == 0) {
> -      mainWin->set_status("Nothing selected, nothing done");
> -      statusLine->setText("Nothing selected, nothing done");
> +      mainWin->set_status(tr("Nothing selected, nothing done"));
> +      statusLine->setText(tr("Nothing selected, nothing done"));
>     }
>  
>  }
> @@ -420,7 +420,7 @@
>        Dmsg2(100, "cwd=%s msg=%s\n", m_cwd.toUtf8().data(), m_console->msg());
>     } else {
>        Dmsg1(000, "stat=%d\n", stat);
> -      QMessageBox::critical(this, "Error", "cd command failed", QMessageBox::Ok);
> +      QMessageBox::critical(this, "Error", tr("cd command failed"), QMessageBox::Ok);
>     }
>     m_console->discardToPrompt();
>     return true;  /* ***FIXME*** return real status */
> @@ -439,7 +439,7 @@
>        Dmsg2(100, "cwd=%s msg=%s\n", m_cwd.toUtf8().data(), m_console->msg());
>     } else {
>        Dmsg1(000, "Something went wrong read stat=%d\n", stat);
> -      QMessageBox::critical(this, "Error", ".pwd command failed", QMessageBox::Ok);
> +      QMessageBox::critical(this, "Error", tr(".pwd command failed"), QMessageBox::Ok);
>     }
>     m_console->discardToPrompt(); 
>     return m_cwd.toUtf8().data();
> Index: bacula/src/qt-console/restore/restoretree.cpp
> ===================================================================
> --- bacula/src/qt-console/restore/restoretree.cpp	(revision 7033)
> +++ bacula/src/qt-console/restore/restoretree.cpp	(working copy)
> @@ -174,7 +174,7 @@
>     prBar1->setVisible(true);
>     prBar1->setRange(0,taskcount);
>     prBar1->setValue(0);
> -   prLabel1->setText(tr("Task ") + QString("%1").arg(ontask)+ " of " + QString("%1").arg(taskcount));
> +   prLabel1->setText(tr("Task %1 of %2").arg(ontask).arg(taskcount));
>     prLabel1->setVisible(true);
>     prBar2->setVisible(true);
>     prBar2->setRange(0,0);
> @@ -192,7 +192,7 @@
>        m_prevDaysCheckState = daysCheckBox->checkState();
>        updateRefresh();
>        prBar1->setValue(ontask++);
> -      prLabel1->setText(tr("Task ") + QString("%1").arg(ontask)+ " of " + QString("%1").arg(taskcount));
> +      prLabel1->setText(tr("Task %1 of %2").arg(ontask).arg(taskcount));
>        prBar2->setValue(0);
>        prBar2->setRange(0,0);
>        prLabel2->setText(tr("Querying Jobs"));
> @@ -235,7 +235,7 @@
>        if (mainWin->m_sqlDebug)
>           Pmsg1(000, "Query cmd : %s\n", cmd.toUtf8().data());
>        prBar1->setValue(ontask++);
> -      prLabel1->setText(tr("Task ") + QString("%1").arg(ontask) + " of " + QString("%1").arg(taskcount));
> +      prLabel1->setText(tr("Task %1 of %2").arg(ontask).arg(taskcount));
>        prBar2->setValue(0);
>        prBar2->setRange(0,0);
>        prLabel2->setText(tr("Querying for Directories"));
> @@ -278,7 +278,7 @@
>     } else {
>       QMessageBox::warning(this, "Bat",
>          tr("No jobs were selected in the job query !!!.\n"
> -      "Press OK to continue?"),
> +      "Press OK to continue"),
>        QMessageBox::Ok );
>     }
>     prBar1->setVisible(false);
> @@ -381,7 +381,7 @@
>     bool ok = true, added = false;
>  
>     if ((mainWin->m_miscDebug) && (m_debugTrap)) {
> -      QString msg = QString(tr("In addDirectory cwd \"%1\" newdir \"%2\"\n"))
> +      QString msg = QString("In addDirectory cwd \"%1\" newdir \"%2\"\n")
>                      .arg(m_cwd)
>                      .arg(newdir);
>        Pmsg0(000, msg.toUtf8().data());
> @@ -435,7 +435,7 @@
>        } else {
>           ok = false;
>           if ((mainWin->m_miscDebug) && (m_debugTrap)) {
> -            QString msg = QString(tr("In else of if parent cwd \"%1\" newdir \"%2\"\n"))
> +            QString msg = QString("In else of if parent cwd \"%1\" newdir \"%2\"\n")
>                   .arg(m_cwd)
>                   .arg(newdir);
>              Pmsg0(000, msg.toUtf8().data());
> @@ -518,7 +518,7 @@
>             this, SLOT(fileTableItemChanged(QTableWidgetItem *)));
>     QBrush blackBrush(Qt::black);
>     QString directory = item->data(0, Qt::UserRole).toString();
> -   directoryLabel->setText(tr("Present Working Directory : ") + directory);
> +   directoryLabel->setText(tr("Present Working Directory: %1").arg(directory));
>     int pathid = m_directoryPathIdHash.value(directory, -1);
>     if (pathid != -1) {
>        QString cmd =
> @@ -1506,9 +1506,9 @@
>  {
>     /* Set progress bars and repaint */
>     prLabel1->setVisible(true);
> -   prLabel1->setText("Task 1 of 3");
> +   prLabel1->setText(tr("Task 1 of 3"));
>     prLabel2->setVisible(true);
> -   prLabel2->setText("Processing Checked directories");
> +   prLabel2->setText(tr("Processing Checked directories"));
>     prBar1->setVisible(true);
>     prBar1->setRange(0, 3);
>     prBar1->setValue(0);
> @@ -1613,8 +1613,8 @@
>        ++diter;
>     } /* while (*diter) */
>     prBar1->setValue(1);
> -   prLabel1->setText("Task 2 of 3");
> -   prLabel2->setText("Processing Exceptions");
> +   prLabel1->setText( tr("Task 2 of 3"));
> +   prLabel2->setText(tr("Processing Exceptions"));
>     prBar2->setRange(0, 0);
>     repaint();
>  
> @@ -1651,8 +1651,8 @@
>     } /* while ftera.hasNext */
>     /* The progress bars for the next step */
>     prBar1->setValue(2);
> -   prLabel1->setText("Task 3 of 3");
> -   prLabel2->setText("Filling Database Table");
> +   prLabel1->setText(tr("Task 3 of 3"));
> +   prLabel2->setText(tr("Filling Database Table"));
>     prBar2->setRange(0, vFMCounter);
>     vFMCounter = 0;
>     prBar2->setValue(vFMCounter);
> Index: bacula/src/qt-console/console/console.cpp
> ===================================================================
> --- bacula/src/qt-console/console/console.cpp	(revision 7033)
> +++ bacula/src/qt-console/console/console.cpp	(working copy)
> @@ -129,11 +129,11 @@
>     m_textEdit = textEdit;   /* our console screen */
>  
>     if (!m_dir) {          
> -      mainWin->set_status("No Director found.");
> +      mainWin->set_status( tr("No Director found."));
>        goto bail_out;
>     }
>     if (m_sock) {
> -      mainWin->set_status("Already connected.");
> +      mainWin->set_status( tr("Already connected."));
>        goto bail_out;
>     }
>  
> @@ -187,7 +187,7 @@
>        if (!m_dir->tls_ctx) {
>           display_textf(_("Failed to initialize TLS context for Director \"%s\".\n"),
>              m_dir->name());
> -         mainWin->set_status("Connection failed");
> +         mainWin->set_status( tr("Connection failed") );
>           goto bail_out;
>        }
>     }
> @@ -537,7 +537,7 @@
>        QApplication::setOverrideCursor(Qt::WaitCursor);
>        write(msg);
>     } else {
> -      mainWin->set_status(" Director not connected. Click on connect button.");
> +      mainWin->set_status( tr(" Director not connected. Click on connect button."));
>        mainWin->actionConnect->setIcon(QIcon(":images/disconnected.png"));
>        QBrush redBrush(Qt::red);
>        QTreeWidgetItem *item = mainWin->getFromHash(this);
> @@ -799,10 +799,8 @@
>     if (is_connected()) {
>        return true;
>     } else {
> -      QString message("Director ");
> -      message += " is currently disconnected\n  Please reconnect!!";
> -      QMessageBox::warning(this, "Bat",
> -         tr(message.toUtf8().data()), QMessageBox::Ok );
> +      QString message = tr("Director is currently disconnected\nPlease reconnect!");
> +      QMessageBox::warning(this, "Bat", message, QMessageBox::Ok );
>        return false;
>     }
>  }
> @@ -814,27 +812,21 @@
>  bool Console::preventInUseConnect()
>  {
>     if (!is_connected()) {
> -      QString message("Director ");
> -      message += m_dir->name();
> -      message += " is currently disconnected\n  Please reconnect!!";
> -      QMessageBox::warning(this, "Bat",
> -         tr(message.toUtf8().data()), QMessageBox::Ok );
> +      QString message = tr("Director %1 is currently disconnected\n"
> +			   "Please reconnect!").arg(m_dir->name());
> +      QMessageBox::warning(this, "Bat", message, QMessageBox::Ok );
>        return false;
>     } else if (!m_at_main_prompt){
> -      QString message("Director ");
> -      message += m_dir->name();
> -      message += " is currently busy\n  Please complete restore or other "
> -                 " operation !!  This is a limitation that will be resolved before a beta"
> -                 " release.  This is currently an alpha release.";
> -      QMessageBox::warning(this, "Bat",
> -         tr(message.toUtf8().data()), QMessageBox::Ok );
> +      QString message = tr("Director %1 is currently busy\n  Please complete "
> +			   "restore or other operation!  This is a limitation "
> +			   "that will be resolved before a beta release.  "
> +			   "This is currently an alpha release.").arg(m_dir->name());
> +      QMessageBox::warning(this, "Bat", message, QMessageBox::Ok );
>        return false;
>     } else if (!m_at_prompt){
> -      QString message("Director ");
> -      message += m_dir->name();
> -      message += " is currently not at a prompt\n  Please try again!!";
> -      QMessageBox::warning(this, "Bat",
> -         tr(message.toUtf8().data()), QMessageBox::Ok );
> +      QString message = tr("Director %1 is currently not at a prompt\n"
> +			   "  Please try again!").arg(m_dir->name());
> +      QMessageBox::warning(this, "Bat", message, QMessageBox::Ok );
>        return false;
>     } else {
>        return true;
> Index: bacula/src/qt-console/joblist/joblist.cpp
> ===================================================================
> --- bacula/src/qt-console/joblist/joblist.cpp	(revision 7033)
> +++ bacula/src/qt-console/joblist/joblist.cpp	(working copy)
> @@ -41,6 +41,7 @@
>  #include "jobgraphs/jobplot.h"
>  #endif
>  #include "util/fmtwidgetitem.h"
> +#include "util/comboutil.h"
>  
>  /*
>   * Constructor for the class
> @@ -226,47 +227,26 @@
>     if (!m_populated) {
>        clientComboBox->addItem(tr("Any"));
>        clientComboBox->addItems(m_console->client_list);
> -      int clientIndex = clientComboBox->findText(m_clientName, Qt::MatchExactly);
> -      if (clientIndex != -1)
> -         clientComboBox->setCurrentIndex(clientIndex);
> +      comboSel(clientComboBox, m_clientName);
>  
>        QStringList volumeList;
>        m_console->getVolumeList(volumeList);
>        volumeComboBox->addItem(tr("Any"));
>        volumeComboBox->addItems(volumeList);
> -      int volumeIndex = volumeComboBox->findText(m_mediaName, Qt::MatchExactly);
> -      if (volumeIndex != -1) {
> -         volumeComboBox->setCurrentIndex(volumeIndex);
> -      }
> +      comboSel(volumeComboBox, m_mediaName);
> +
>        jobComboBox->addItem(tr("Any"));
>        jobComboBox->addItems(m_console->job_list);
> -      int jobIndex = jobComboBox->findText(m_jobName, Qt::MatchExactly);
> -      if (jobIndex != -1) {
> -         jobComboBox->setCurrentIndex(jobIndex);
> -      }
> +      comboSel(jobComboBox, m_jobName);
>  
> -      levelComboBox->addItem(tr("Any"));
> -      levelComboBox->addItem(job_level_to_str(L_FULL), L_FULL);
> -      levelComboBox->addItem(job_level_to_str(L_INCREMENTAL), L_INCREMENTAL);
> -      levelComboBox->addItem(job_level_to_str(L_DIFFERENTIAL), L_DIFFERENTIAL);
> -      levelComboBox->addItem(job_level_to_str(L_SINCE), L_SINCE);
> -      levelComboBox->addItem(job_level_to_str(L_VERIFY_CATALOG), L_VERIFY_CATALOG);
> -      levelComboBox->addItem(job_level_to_str(L_VERIFY_INIT), L_VERIFY_INIT);
> -      levelComboBox->addItem(job_level_to_str(L_VERIFY_VOLUME_TO_CATALOG), L_VERIFY_VOLUME_TO_CATALOG);
> -      levelComboBox->addItem(job_level_to_str(L_VERIFY_DISK_TO_CATALOG), L_VERIFY_DISK_TO_CATALOG);
> -      levelComboBox->addItem(job_level_to_str(L_VERIFY_DATA), L_VERIFY_DATA);
> -      /* levelComboBox->addItem(job_level_to_str(L_BASE), L_BASE);  base jobs ignored */ 
> +      levelComboFill(levelComboBox);
>  
> -      purgedComboBox->addItem(tr("Any"), -1);
> -      purgedComboBox->addItem(tr("No"), 0);
> -      purgedComboBox->addItem(tr("Yes"), 1);
> +      boolComboFill(purgedComboBox);
>  
>        fileSetComboBox->addItem(tr("Any"));
>        fileSetComboBox->addItems(m_console->fileset_list);
> -      int filesetIndex = fileSetComboBox->findText(m_filesetName, Qt::MatchExactly);
> -      if (filesetIndex != -1) {
> -         fileSetComboBox->setCurrentIndex(filesetIndex);
> -      }
> +      comboSel(fileSetComboBox, m_filesetName);
> +
>        QStringList statusLongList;
>        m_console->getStatusList(statusLongList);
>        statusComboBox->addItem(tr("Any"));
> @@ -299,36 +279,14 @@
>                 " LEFT OUTER JOIN Media ON (JobMedia.MediaId=Media.MediaId) ";
>        conditions.append("Media.VolumeName='" + m_mediaName + "'");
>     }
> -   int clientIndex = clientComboBox->currentIndex();
> -   if (clientIndex != -1)
> -      m_clientName = clientComboBox->itemText(clientIndex);
> -   if (m_clientName != tr("Any")) {
> -      conditions.append("Client.Name='" + m_clientName + "'");
> -   }
> -   int jobIndex = jobComboBox->currentIndex();
> -   if (jobIndex != -1)
> -      m_jobName = jobComboBox->itemText(jobIndex);
> -   if ((jobIndex != -1) && (jobComboBox->itemText(jobIndex) != tr("Any"))) {
> -      conditions.append("Job.Name='" + jobComboBox->itemText(jobIndex) + "'");
> -   }
> -   int levelIndex = levelComboBox->currentIndex();
> -   if ((levelIndex != -1) && (levelComboBox->itemText(levelIndex) != tr("Any"))) {
> -      conditions.append( QString("Job.Level='%1'").arg(levelComboBox->itemData(levelIndex).toChar()) );
> -   }
> -   int statusIndex = statusComboBox->currentIndex();
> -   if ((statusIndex != -1) && (statusComboBox->itemText(statusIndex) != tr("Any"))) {
> -      conditions.append("Status.JobStatusLong='" + statusComboBox->itemText(statusIndex) + "'");
> -   }
> -   int purgedIndex = purgedComboBox->currentIndex();
> -   if (purgedIndex != -1 && purgedComboBox->itemData(purgedIndex).toInt() >= 0 ) {
> -      conditions.append("Job.PurgedFiles='" + purgedComboBox->itemData(purgedIndex).toString() + "'");
> -   }
> -   int fileSetIndex = fileSetComboBox->currentIndex();
> -   if (fileSetIndex != -1)
> -      m_filesetName = fileSetComboBox->itemText(fileSetIndex);
> -   if ((fileSetIndex != -1) && (fileSetComboBox->itemText(fileSetIndex) != tr("Any"))) {
> -      conditions.append("FileSet.FileSet='" + fileSetComboBox->itemText(fileSetIndex) + "'");
> -   }
> +
> +   comboCond(conditions, clientComboBox, "Client.Name");
> +   comboCond(conditions, jobComboBox, "Job.Name");
> +   levelComboCond(conditions, levelComboBox, "Job.Level");
> +   comboCond(conditions, statusComboBox, "Status.JobStatusLong");
> +   boolComboCond(conditions, purgedComboBox, "Job.PurgedFiles");
> +   comboCond(conditions, fileSetComboBox, "FileSet.FileSet");
> +
>     /* If Limit check box For limit by days is checked  */
>     if (daysCheckBox->checkState() == Qt::Checked) {
>        QDateTime stamp = QDateTime::currentDateTime().addDays(-daysSpinBox->value());
> @@ -448,6 +406,7 @@
>     connect(graphButton, SIGNAL(pressed()), this, SLOT(graphTable()));
>  #else
>     graphButton->setEnabled(false);
> +   graphButton->setVisible(false);
>  #endif
>     /* for the tableItemChanged to maintain m_currentJob */
>     connect(mp_tableWidget, SIGNAL(
> @@ -617,9 +576,9 @@
>  /*
>   * Graph this table
>   */
> -#ifdef HAVE_QWT
>  void JobList::graphTable()
>  {
> +#ifdef HAVE_QWT
>     JobPlotPass pass;
>     pass.recordLimitCheck = limitCheckBox->checkState();
>     pass.daysLimitCheck = daysCheckBox->checkState();
> @@ -635,8 +594,8 @@
>     pass.use = true;
>     QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(this);
>     new JobPlot(pageSelectorTreeWidgetItem, pass);
> -}
>  #endif
> +}
>  
>  /*
>   * Save user settings associated with this page
> Index: bacula/src/qt-console/joblist/joblist.h
> ===================================================================
> --- bacula/src/qt-console/joblist/joblist.h	(revision 7033)
> +++ bacula/src/qt-console/joblist/joblist.h	(working copy)
> @@ -68,9 +68,7 @@
>     void preRestoreFromTime();
>     void showLogForJob();
>     void consoleCancelJob();
> -#ifdef HAVE_QWT
>     void graphTable();
> -#endif
>  
>  private:
>     void createConnections();
> Index: bacula/src/qt-console/bat.pro.in
> ===================================================================
> --- bacula/src/qt-console/bat.pro.in	(revision 7033)
> +++ bacula/src/qt-console/bat.pro.in	(working copy)
> @@ -147,8 +147,8 @@
>  SOURCES += status/storstat.cpp
>  
>  # Utility sources
> -HEADERS += util/fmtwidgetitem.h
> -SOURCES += util/fmtwidgetitem.cpp
> +HEADERS += util/fmtwidgetitem.h util/comboutil.h
> +SOURCES += util/fmtwidgetitem.cpp util/comboutil.cpp
>  
>  INSTALLS += bins
>  INSTALLS += confs
> Index: bacula/src/qt-console/util/comboutil.h
> ===================================================================
> --- bacula/src/qt-console/util/comboutil.h	(revision 0)
> +++ bacula/src/qt-console/util/comboutil.h	(revision 0)
> @@ -0,0 +1,62 @@
> +#ifndef _COMBOUTIL_H_
> +#define _COMBOUTIL_H_
> +/*
> +   Bacula - The Network Backup Solution
> +
> +   Copyright (C) 2007-2008 Free Software Foundation Europe e.V.
> +
> +   The main author of Bacula is Kern Sibbald, with contributions from
> +   many others, a complete list can be found in the file AUTHORS.
> +   This program is Free Software; you can redistribute it and/or
> +   modify it under the terms of version two of the GNU General Public
> +   License as published by the Free Software Foundation and included
> +   in the file LICENSE.
> +
> +   This program is distributed in the hope that it will be useful, but
> +   WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> +   General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program; if not, write to the Free Software
> +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> +   02110-1301, USA.
> +
> +   Bacula is a registered trademark of John Walker.
> +   The licensor of Bacula is the Free Software Foundation Europe
> +   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zrich,
> +   Switzerland, email:ftf@xxxxxxxxxxxxxx
> +*/
> +/*
> + *   Version $Id$
> + *
> + *   Combobox helpers - Riccardo Ghetta, May 2008 
> + */
> +
> +class QComboBox;
> +class QString;
> +class QStringList;
> +
> +/* selects value val on combo, if exists */
> +void comboSel(QComboBox *combo, const QString &val);
> +
> +/* if the combo has selected something different from "Any" uses the selection
> + * to build a condition on field fldname and adds it to the condition list */
> +void comboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname);
> +
> +/* these helpers are used to give an uniform content to common combos.
> + * There are two routines per combo type:
> + * - XXXXComboFill fills the combo with values.
> + * - XXXXComboCond checks the combo and, if selected adds a condition
> + *   on the field fldName to the list of conditions cndList
> + */
> +
> +/* boolean combo (yes/no) */
> +void boolComboFill(QComboBox *combo);
> +void boolComboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname);
> +
> +/* backup level combo */
> +void levelComboFill(QComboBox *combo);
> +void levelComboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname);
> +
> +#endif /* _COMBOUTIL_H_ */
> 
> Property changes on: bacula/src/qt-console/util/comboutil.h
> ___________________________________________________________________
> Name: svn:eol-style
>    + native
> 
> Index: bacula/src/qt-console/util/comboutil.cpp
> ===================================================================
> --- bacula/src/qt-console/util/comboutil.cpp	(revision 0)
> +++ bacula/src/qt-console/util/comboutil.cpp	(revision 0)
> @@ -0,0 +1,108 @@
> +/*
> +   Bacula - The Network Backup Solution
> +
> +   Copyright (C) 2007-2008 Free Software Foundation Europe e.V.
> +
> +   The main author of Bacula is Kern Sibbald, with contributions from
> +   many others, a complete list can be found in the file AUTHORS.
> +   This program is Free Software; you can redistribute it and/or
> +   modify it under the terms of version two of the GNU General Public
> +   License as published by the Free Software Foundation and included
> +   in the file LICENSE.
> +
> +   This program is distributed in the hope that it will be useful, but
> +   WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> +   General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program; if not, write to the Free Software
> +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> +   02110-1301, USA.
> +
> +   Bacula is a registered trademark of John Walker.
> +   The licensor of Bacula is the Free Software Foundation Europe
> +   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zrich,
> +   Switzerland, email:ftf@xxxxxxxxxxxxxx
> +*/
> + 
> +/*
> + *   Version $Id$
> + *
> + *   ComboBox helper functions
> + *
> + *   Riccardo Ghetta, May 2008
> + *
> + */ 
> +
> +#include <QComboBox>
> +#include <QString>
> +#include <QStringList>
> +#include "bat.h"
> +#include "comboutil.h"
> +
> +static const QString QS_ANY(QObject::tr("Any"));
> +
> +
> +/* selects value val on combo, if exists */
> +void comboSel(QComboBox *combo, const QString &val)
> +{
> +  int index = combo->findText(val, Qt::MatchExactly);
> +  if (index != -1) {
> +     combo->setCurrentIndex(index);
> +  }
> +}
> +
> +/* if the combo has selected something different from "Any" uses the selection
> + * to build a condition on field fldname and adds it to the condition list */
> +void comboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname)
> +{
> +   int index = combo->currentIndex();
> +   if (index != -1 && combo->itemText(index) != QS_ANY) {
> +      cndlist.append( QString("%1='%2'").arg(fldname).arg(combo->itemText(index)) );
> +   }
> +}
> +
> +
> +/* boolean combo (yes/no) */
> +void boolComboFill(QComboBox *combo)
> +{
> +   combo->addItem(QS_ANY, -1);
> +   combo->addItem(QObject::tr("No"), 0);
> +   combo->addItem(QObject::tr("Yes"), 1);
> +}
> +
> +void boolComboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname)
> +{
> +   int index = combo->currentIndex();
> +   if (index != -1 && combo->itemData(index).toInt() >= 0 ) {
> +      QString cnd = combo->itemData(index).toString();
> +      cndlist.append( QString("%1='%2'").arg(fldname).arg(cnd) );
> +   }
> +}
> +
> +/* backup level combo */
> +void levelComboFill(QComboBox *combo)
> +{
> +   combo->addItem(QS_ANY);
> +   combo->addItem(job_level_to_str(L_FULL), L_FULL);
> +   combo->addItem(job_level_to_str(L_INCREMENTAL), L_INCREMENTAL);
> +   combo->addItem(job_level_to_str(L_DIFFERENTIAL), L_DIFFERENTIAL);
> +   combo->addItem(job_level_to_str(L_SINCE), L_SINCE);
> +   combo->addItem(job_level_to_str(L_VERIFY_CATALOG), L_VERIFY_CATALOG);
> +   combo->addItem(job_level_to_str(L_VERIFY_INIT), L_VERIFY_INIT);
> +   combo->addItem(job_level_to_str(L_VERIFY_VOLUME_TO_CATALOG), L_VERIFY_VOLUME_TO_CATALOG);
> +   combo->addItem(job_level_to_str(L_VERIFY_DISK_TO_CATALOG), L_VERIFY_DISK_TO_CATALOG);
> +   combo->addItem(job_level_to_str(L_VERIFY_DATA), L_VERIFY_DATA);
> +   /* combo->addItem(job_level_to_str(L_BASE), L_BASE);  base jobs ignored */ 
> +}
> +
> +void levelComboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname)
> +{
> +   int index = combo->currentIndex();
> +   if (index != -1 && combo->itemText(index) != QS_ANY ) {
> +      QString cnd = combo->itemData(index).toChar();
> +      cndlist.append( QString("%1='%2'").arg(fldname).arg(cnd) );
> +   }
> +}
> +
> 
> Property changes on: bacula/src/qt-console/util/comboutil.cpp
> ___________________________________________________________________
> Name: svn:eol-style
>    + native
> 
> -------------------------------------------------------------------------
> 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 Bacula-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/bacula-devel


-------------------------------------------------------------------------
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
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilotco.