From: Dirk H Bartley Date: Sun, 22 Mar 2009 14:50:18 +0000 (+0000) Subject: Make table widget items read only again. X-Git-Tag: Release-3.0.0~121 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1af6c2c9163c0e608eb1241fcaa3e2b89e95173b;p=bacula%2Fbacula Make table widget items read only again. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8581 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/clients/clients.cpp b/bacula/src/qt-console/clients/clients.cpp index 95c5892549..eb05df07e8 100644 --- a/bacula/src/qt-console/clients/clients.cpp +++ b/bacula/src/qt-console/clients/clients.cpp @@ -162,6 +162,16 @@ void Clients::populateTable() /* Resize rows and columns */ tableWidget->resizeColumnsToContents(); tableWidget->resizeRowsToContents(); + + /* make read only */ + int rcnt = tableWidget->rowCount(); + int ccnt = tableWidget->columnCount(); + for(int r=0; r < rcnt; r++) { + for(int c=0; c < ccnt; c++) { + QTableWidgetItem* item = tableWidget->item(r, c); + item->setFlags(Qt::ItemFlags(item->flags() & (~Qt::ItemIsEditable))); + } + } } /* diff --git a/bacula/src/qt-console/fileset/fileset.cpp b/bacula/src/qt-console/fileset/fileset.cpp index 57b309a786..30d90a9e2f 100644 --- a/bacula/src/qt-console/fileset/fileset.cpp +++ b/bacula/src/qt-console/fileset/fileset.cpp @@ -149,6 +149,16 @@ void FileSet::populateTable() /* Resize rows and columns */ tableWidget->resizeColumnsToContents(); tableWidget->resizeRowsToContents(); + + /* make read only */ + int rcnt = tableWidget->rowCount(); + int ccnt = tableWidget->columnCount(); + for(int r=0; r < rcnt; r++) { + for(int c=0; c < ccnt; c++) { + QTableWidgetItem* item = tableWidget->item(r, c); + item->setFlags(Qt::ItemFlags(item->flags() & (~Qt::ItemIsEditable))); + } + } } /* diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index 5b9d48906b..0c9d330250 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -218,6 +218,16 @@ void JobList::populateTable() tr("The Jobs query returned no results.\n" "Press OK to continue?"), QMessageBox::Ok ); } + + /* make read only */ + int rcnt = mp_tableWidget->rowCount(); + int ccnt = mp_tableWidget->columnCount(); + for(int r=0; r < rcnt; r++) { + for(int c=0; c < ccnt; c++) { + QTableWidgetItem* item = mp_tableWidget->item(r, c); + item->setFlags(Qt::ItemFlags(item->flags() & (~Qt::ItemIsEditable))); + } + } } void JobList::prepareFilterWidgets() diff --git a/bacula/src/qt-console/jobs/jobs.cpp b/bacula/src/qt-console/jobs/jobs.cpp index f79e960cae..b8e9ffb08a 100644 --- a/bacula/src/qt-console/jobs/jobs.cpp +++ b/bacula/src/qt-console/jobs/jobs.cpp @@ -123,6 +123,16 @@ void Jobs::populateTable() /* Resize rows and columns */ tableWidget->resizeColumnsToContents(); tableWidget->resizeRowsToContents(); + + /* make read only */ + int rcnt = tableWidget->rowCount(); + int ccnt = tableWidget->columnCount(); + for(int r=0; r < rcnt; r++) { + for(int c=0; c < ccnt; c++) { + QTableWidgetItem* item = tableWidget->item(r, c); + item->setFlags(Qt::ItemFlags(item->flags() & (~Qt::ItemIsEditable))); + } + } } /* diff --git a/bacula/src/qt-console/restore/prerestore.cpp b/bacula/src/qt-console/restore/prerestore.cpp index 88f296b326..e78dd5dedd 100644 --- a/bacula/src/qt-console/restore/prerestore.cpp +++ b/bacula/src/qt-console/restore/prerestore.cpp @@ -202,7 +202,7 @@ void prerestorePage::job_name_change(int index) (void)index; job_defs.job_name = jobCombo->currentText(); - if (m_console->get_job_defaults(job_defs)) { + if (m_console->get_job_defaults(m_conn, job_defs)) { filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly)); clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly)); poolCombo->setCurrentIndex(poolCombo->findText(tr("Any"), Qt::MatchExactly)); @@ -240,7 +240,7 @@ int prerestorePage::jobdefsFromJob(QStringList &fieldlist, QString &jobId) " AND JobId=\'" + jobId + "\'"; if (mainWin->m_sqlDebug) { Pmsg1(000, "query = %s\n", query.toUtf8().data()); } QStringList results; - if (m_console->sql_cmd(query, results)) { + if (m_console->sql_cmd(m_conn, query, results)) { QString field; /* Iterate through the lines of results, there should only be one. */