field = field.trimmed(); /* strip leading & trailing spaces */
p_tableitem = new QTableWidgetItem(field, 1);
p_tableitem->setForeground(blackBrush);
- p_tableitem->setFlags(0);
+ p_tableitem->setFlags(Qt::ItemIsSelectable);
runningTable->setItem(row, column, p_tableitem);
column += 1;
}
SLOT(consoleCancelJob()));
connect(actionDisableScheduledJob, SIGNAL(triggered()), this,
SLOT(consoleDisableJob()));
+ connect(runningTable, SIGNAL(
+ currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)),
+ this, SLOT(runningTableItemChanged(QTableWidgetItem *, QTableWidgetItem *)));
scheduledTable->setContextMenuPolicy(Qt::ActionsContextMenu);
scheduledTable->addAction(actionRefresh);
*/
void DirStat::consoleCancelJob()
{
- int currentrow = runningTable->currentRow();
- QTableWidgetItem *item = runningTable->item(currentrow, 0);
- if (item) {
- QString text = item->text();
+ foreach( QString job, m_selectedJobsList )
+ {
QString cmd("cancel jobid=");
- cmd += text;
+ cmd += job;
consoleCommand(cmd);
}
}
consoleCommand(cmd);
}
}
+/*
+ * Function to fill m_selectedJobsList with selected values
+ */
+void DirStat::runningTableItemChanged(QTableWidgetItem * /*currentItem*/, QTableWidgetItem * /*previousItem*/)
+{
+ QList<int> rowList;
+ QList<QTableWidgetItem *> sitems = runningTable->selectedItems();
+ foreach (QTableWidgetItem *sitem, sitems) {
+ int row = sitem->row();
+ if (!rowList.contains(row)) {
+ rowList.append(row);
+ }
+ }
+ m_selectedJobsList.clear();
+ foreach(int row, rowList) {
+ QTableWidgetItem * sitem = runningTable->item(row, 0);
+ m_selectedJobsList.append(sitem->text());
+ }
+ if (m_selectedJobsList.count() > 1) {
+ actionCancelRunning->setText(QString("Cancel list of %1 Jobs").arg(m_selectedJobsList.count()));
+ } else {
+ actionCancelRunning->setText("Cancel Single Job");
+ }
+}
<rect>
<x>0</x>
<y>0</y>
- <width>504</width>
- <height>410</height>
+ <width>409</width>
+ <height>326</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
- <property name="margin" >
+ <property name="leftMargin" >
<number>9</number>
</property>
- <property name="spacing" >
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
+ <property name="horizontalSpacing" >
+ <number>6</number>
+ </property>
+ <property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="0" >
</property>
<widget class="QTextEdit" name="textEdit" >
<property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>200</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</widget>
<widget class="QWidget" name="layoutWidget" >
<layout class="QVBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
<property name="spacing" >
<number>6</number>
</property>
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
<item>
<widget class="QLabel" name="scheduledLabel" >
<property name="layoutDirection" >
</widget>
<widget class="QWidget" name="layoutWidget_2" >
<layout class="QVBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
<property name="spacing" >
<number>6</number>
</property>
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
<item>
<widget class="QLabel" name="runningLabel" >
<property name="layoutDirection" >
</widget>
<widget class="QWidget" name="layoutWidget" >
<layout class="QVBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
<property name="spacing" >
<number>6</number>
</property>
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
<item>
<widget class="QLabel" name="terminatedLabel" >
<property name="layoutDirection" >