]> git.sur5r.net Git - bacula/bacula/commitdiff
Default to never in overwrite in replace of runcmd.
authorDirk H Bartley <dbartley@schupan.com>
Sun, 20 May 2007 01:57:51 +0000 (01:57 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Sun, 20 May 2007 01:57:51 +0000 (01:57 +0000)
Fix of when and bootstrap entry boxes.  Still an issue with messages.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4844 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/mainwin.cpp
bacula/src/qt-console/mainwin.h
bacula/src/qt-console/run/run.cpp
bacula/src/qt-console/run/run.ui
bacula/src/qt-console/run/runcmd.cpp
bacula/src/qt-console/run/runcmd.ui

index 0e23313aa4003289f47f47648d5b619fc84c27bb..e6e33be1469f171fc84142a072cf181de30b1846 100644 (file)
@@ -49,7 +49,7 @@
 
 MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
 {
-
+   m_dtformat = "yyyy-MM-dd HH:mm:ss";
    mainWin = this;
    setupUi(this);                     /* Setup UI defined by main.ui (designer) */
    readPreferences();
index 0e965c6b8c71b03286cc84530d8c26615b1a6246..b14ae65386da0f68705860d12580ec895f5ca8c1 100644 (file)
@@ -78,6 +78,7 @@ public:
    int m_recordLimitVal;
    bool m_daysLimitCheck;
    int m_daysLimitVal;
+   QString m_dtformat;
 
 
 public slots:
index a0fa20e091cc5913a8bf2eb2cdd8a04be29bebaa..41c5e1673ccb7816ac13130dcdf327acee82dc5b 100644 (file)
@@ -56,7 +56,13 @@ runPage::runPage()
    clientCombo->addItems(m_console->client_list);
    poolCombo->addItems(m_console->pool_list);
    storageCombo->addItems(m_console->storage_list);
+   dateTimeEdit->setDisplayFormat(mainWin->m_dtformat);
    dateTimeEdit->setDateTime(dt.currentDateTime());
+   /*printf("listing messages resources");  ***FIME ***
+   foreach(QString mes, m_console->messages_list) {
+      printf("%s\n", mes.toUtf8().data());
+   }*/
+   messagesCombo->addItems(m_console->messages_list);
    job_name_change(0);
    connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
    connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
@@ -69,23 +75,28 @@ runPage::runPage()
 
 void runPage::okButtonPushed()
 {
-   char cmd[1000];
-
    this->hide();
-   
-   // ***FIXME**  add date/time from dateTimeEdit.
-   bsnprintf(cmd, sizeof(cmd),
-             "run job=\"%s\" fileset=\"%s\" level=%s client=\"%s\" pool=\"%s\" "
-             "storage=\"%s\" priority=\"%d\" yes\n",
-             jobCombo->currentText().toUtf8().data(),
-             filesetCombo->currentText().toUtf8().data(),
-             levelCombo->currentText().toUtf8().data(),
-             clientCombo->currentText().toUtf8().data(),
-             poolCombo->currentText().toUtf8().data(),
-             storageCombo->currentText().toUtf8().data(),
-             prioritySpin->value());
-
-   m_console->write_dir(cmd);
+   QString cmd;
+   QTextStream(&cmd) << "run" << 
+      " job=\"" << jobCombo->currentText() << "\"" <<
+      " fileset=\"" << filesetCombo->currentText() << "\"" <<
+      " level=\"" << levelCombo->currentText() << "\"" <<
+      " client=\"" << clientCombo->currentText() << "\"" <<
+      " pool=\"" << poolCombo->currentText() << "\"" <<
+      " storage=\"" << storageCombo->currentText() << "\"" <<
+      " priority=\"" << prioritySpin->value() << "\""
+      " when=\"" << dateTimeEdit->dateTime().toString(mainWin->m_dtformat) << "\"";
+   if (bootstrap->text() != "") {
+      cmd += " bootstrap=\"" + bootstrap->text() + "\""; 
+   }
+   cmd += " yes";
+//  messagesCombo->currentText().toUtf8().data(); FIXME messages not working
+
+   if (mainWin->m_commandDebug) {
+      Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
+   }
+
+   m_console->write_dir(cmd.toUtf8().data());
    m_console->display_text(cmd);
    m_console->displayToPrompt();
    m_console->notify(true);
@@ -120,7 +131,6 @@ void runPage::job_name_change(int index)
       clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly));
       poolCombo->setCurrentIndex(poolCombo->findText(job_defs.pool_name, Qt::MatchExactly));
       storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly));
-      typeCombo->clear();
-      typeCombo->addItem(job_defs.type);
+      messagesCombo->setCurrentIndex(messagesCombo->findText(job_defs.messages_name, Qt::MatchExactly));
    }
 }
index 02679a1deba71d5e27ed00d841beca7fad452681..4bd95aecf939cd278378a1b59369c6e4723e0335 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>777</width>
-    <height>429</height>
+    <width>734</width>
+    <height>483</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="1" column="2" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>40</width>
-       <height>20</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item row="0" column="1" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Expanding</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>351</width>
-       <height>16</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item row="2" column="1" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Expanding</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>351</width>
-       <height>16</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
    <item row="1" column="1" >
     <layout class="QGridLayout" >
      <property name="margin" >
      <property name="spacing" >
       <number>6</number>
      </property>
-     <item row="0" column="0" >
+     <item row="3" column="0" >
+      <widget class="QLabel" name="label_11" >
+       <property name="text" >
+        <string>Level:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>levelCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="5" column="1" >
+      <widget class="QComboBox" name="poolCombo" />
+     </item>
+     <item row="9" column="0" >
+      <widget class="QLabel" name="label_5" >
+       <property name="text" >
+        <string>Bootstrap:</string>
+       </property>
+       <property name="openExternalLinks" >
+        <bool>true</bool>
+       </property>
+       <property name="buddy" >
+        <cstring>bootstrap</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="4" column="1" >
+      <widget class="QComboBox" name="filesetCombo" />
+     </item>
+     <item row="9" column="1" >
+      <widget class="QLineEdit" name="bootstrap" >
+       <property name="enabled" >
+        <bool>true</bool>
+       </property>
+       <property name="minimumSize" >
+        <size>
+         <width>200</width>
+         <height>0</height>
+        </size>
+       </property>
+       <property name="readOnly" >
+        <bool>false</bool>
+       </property>
+      </widget>
+     </item>
+     <item row="6" column="1" >
+      <widget class="QComboBox" name="storageCombo" />
+     </item>
+     <item row="8" column="1" >
+      <widget class="QDateTimeEdit" name="dateTimeEdit" >
+       <property name="dateTime" >
+        <datetime>
+         <hour>0</hour>
+         <minute>2</minute>
+         <second>0</second>
+         <year>2000</year>
+         <month>1</month>
+         <day>1</day>
+        </datetime>
+       </property>
+       <property name="displayFormat" >
+        <string>yyyy-mm-dd hh:mm:ss</string>
+       </property>
+       <property name="calendarPopup" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="0" >
+      <widget class="QLabel" name="label_6" >
+       <property name="text" >
+        <string>Job:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>jobCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item rowspan="6" row="3" column="3" >
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>56</width>
+         <height>151</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item row="5" column="0" >
+      <widget class="QLabel" name="label_3" >
+       <property name="text" >
+        <string>Pool:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>poolCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="2" colspan="2" >
+      <layout class="QHBoxLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item>
+        <widget class="QLabel" name="label_7" >
+         <property name="text" >
+          <string>Type:</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLabel" name="typeLabel" >
+         <property name="text" >
+          <string>&lt;h3>Backup&lt;h3/></string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item row="4" column="0" >
+      <widget class="QLabel" name="label_9" >
+       <property name="text" >
+        <string>FileSet:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>filesetCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="7" column="0" >
+      <widget class="QLabel" name="label_10" >
+       <property name="text" >
+        <string>Messages:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>messagesCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="0" colspan="4" >
       <layout class="QHBoxLayout" >
        <property name="margin" >
         <number>0</number>
        </item>
       </layout>
      </item>
-     <item row="1" column="0" >
-      <layout class="QGridLayout" >
-       <property name="margin" >
-        <number>0</number>
+     <item row="1" column="1" >
+      <widget class="QComboBox" name="jobCombo" />
+     </item>
+     <item row="2" column="2" >
+      <widget class="QLabel" name="label_4" >
+       <property name="text" >
+        <string>Priority:</string>
        </property>
-       <property name="spacing" >
-        <number>6</number>
+       <property name="buddy" >
+        <cstring>prioritySpin</cstring>
        </property>
-       <item row="0" column="2" >
-        <widget class="QLabel" name="label_7" >
-         <property name="text" >
-          <string>Type:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>typeCombo</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="6" column="0" >
-        <widget class="QLabel" name="label_10" >
-         <property name="text" >
-          <string>Messages:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>messagesCombo</cstring>
-         </property>
-        </widget>
-       </item>
-       <item rowspan="6" row="2" column="3" >
-        <spacer>
-         <property name="orientation" >
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" >
-          <size>
-           <width>20</width>
-           <height>171</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item row="5" column="1" >
-        <widget class="QComboBox" name="storageCombo" />
-       </item>
-       <item row="4" column="1" >
-        <widget class="QComboBox" name="poolCombo" />
-       </item>
-       <item row="7" column="0" >
-        <widget class="QLabel" name="label" >
-         <property name="text" >
-          <string>When:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>dateTimeEdit</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="0" >
-        <widget class="QLabel" name="label_9" >
-         <property name="text" >
-          <string>FileSet:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>filesetCombo</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="8" column="1" >
-        <widget class="QLineEdit" name="bootstrap" >
-         <property name="enabled" >
-          <bool>false</bool>
-         </property>
-         <property name="minimumSize" >
-          <size>
-           <width>200</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="readOnly" >
-          <bool>false</bool>
-         </property>
-        </widget>
-       </item>
-       <item row="7" column="1" >
-        <widget class="QDateTimeEdit" name="dateTimeEdit" >
-         <property name="dateTime" >
-          <datetime>
-           <hour>0</hour>
-           <minute>2</minute>
-           <second>0</second>
-           <year>2000</year>
-           <month>1</month>
-           <day>1</day>
-          </datetime>
-         </property>
-         <property name="displayFormat" >
-          <string>yyyy-mm-dd hh:mm:ss</string>
-         </property>
-         <property name="calendarPopup" >
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="3" >
-        <widget class="QSpinBox" name="prioritySpin" >
-         <property name="maximum" >
-          <number>10000</number>
-         </property>
-         <property name="minimum" >
-          <number>1</number>
-         </property>
-         <property name="value" >
-          <number>10</number>
-         </property>
-        </widget>
-       </item>
-       <item row="6" column="1" >
-        <widget class="QComboBox" name="messagesCombo" />
-       </item>
-       <item row="2" column="1" >
-        <widget class="QComboBox" name="levelCombo" />
-       </item>
-       <item row="3" column="1" >
-        <widget class="QComboBox" name="filesetCombo" />
-       </item>
-       <item row="4" column="0" >
-        <widget class="QLabel" name="label_3" >
-         <property name="text" >
-          <string>Pool:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>poolCombo</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="8" column="0" >
-        <widget class="QLabel" name="label_5" >
-         <property name="text" >
-          <string>Bootstrap:</string>
-         </property>
-         <property name="openExternalLinks" >
-          <bool>true</bool>
-         </property>
-         <property name="buddy" >
-          <cstring>bootstrap</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="3" >
-        <widget class="QComboBox" name="typeCombo" >
-         <property name="sizePolicy" >
-          <sizepolicy>
-           <hsizetype>5</hsizetype>
-           <vsizetype>0</vsizetype>
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="minimumSize" >
-          <size>
-           <width>150</width>
-           <height>0</height>
-          </size>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="0" >
-        <widget class="QLabel" name="label_8" >
-         <property name="text" >
-          <string>Client:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>clientCombo</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="0" >
-        <widget class="QLabel" name="label_6" >
-         <property name="text" >
-          <string>Job:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>jobCombo</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="5" column="0" >
-        <widget class="QLabel" name="label_2" >
-         <property name="text" >
-          <string>Storage:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>storageCombo</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="0" >
-        <widget class="QLabel" name="label_11" >
-         <property name="text" >
-          <string>Level:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>levelCombo</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="2" >
-        <widget class="QLabel" name="label_4" >
-         <property name="text" >
-          <string>Priority:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>prioritySpin</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="1" >
-        <widget class="QComboBox" name="clientCombo" />
-       </item>
-       <item row="0" column="1" >
-        <widget class="QComboBox" name="jobCombo" />
-       </item>
-      </layout>
+      </widget>
+     </item>
+     <item row="3" column="1" >
+      <widget class="QComboBox" name="levelCombo" />
      </item>
      <item row="2" column="0" >
+      <widget class="QLabel" name="label_8" >
+       <property name="text" >
+        <string>Client:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>clientCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="10" column="0" colspan="4" >
       <layout class="QHBoxLayout" >
        <property name="margin" >
         <number>0</number>
        </item>
       </layout>
      </item>
+     <item row="2" column="3" >
+      <widget class="QSpinBox" name="prioritySpin" >
+       <property name="maximum" >
+        <number>10000</number>
+       </property>
+       <property name="minimum" >
+        <number>1</number>
+       </property>
+       <property name="value" >
+        <number>10</number>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1" >
+      <widget class="QComboBox" name="clientCombo" />
+     </item>
+     <item row="6" column="0" >
+      <widget class="QLabel" name="label_2" >
+       <property name="text" >
+        <string>Storage:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>storageCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="7" column="1" >
+      <widget class="QComboBox" name="messagesCombo" />
+     </item>
+     <item row="8" column="0" >
+      <widget class="QLabel" name="label" >
+       <property name="text" >
+        <string>When:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>dateTimeEdit</cstring>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
+   <item row="1" column="2" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>40</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
    <item row="1" column="0" >
     <spacer>
      <property name="orientation" >
      </property>
     </spacer>
    </item>
+   <item row="2" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>351</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="0" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>351</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
   </layout>
  </widget>
  <resources/>
index f83de90820b24f8e9185e277ae27e14021c36708..a96692e4da3f4cfe10176e8ad0d39f91db26e10e 100644 (file)
@@ -74,6 +74,7 @@ void runCmdPage::fill()
    clientCombo->addItems(m_console->client_list);
    filesetCombo->addItems(m_console->fileset_list);
    replaceCombo->addItems(QStringList() << "never" << "always" << "ifnewer" << "ifolder");
+   replaceCombo->setCurrentIndex(replaceCombo->findText("never", Qt::MatchExactly));
    storageCombo->addItems(m_console->storage_list);
    dateTimeEdit->setDisplayFormat(m_dtformat);
 
@@ -129,7 +130,9 @@ void runCmdPage::fill()
          continue;
       }
       if (item.startsWith("Replace:")) {
-         replaceCombo->setCurrentIndex(replaceCombo->findText(val, Qt::MatchExactly));
+         int replaceIndex = replaceCombo->findText(val, Qt::MatchExactly);
+         if (replaceIndex >= 0)
+            replaceCombo->setCurrentIndex(replaceIndex);
          continue;
       }
    }
index 9778231eb0da94fc56ac20cafdd3d267e1ae9a28..2f32c5cfe16d3d20cb12014c53881f744b7d5981 100644 (file)
      <item row="1" column="0" >
       <widget class="QLabel" name="label_8" >
        <property name="text" >
-        <string>Client:</string>
+        <string>To client:</string>
        </property>
        <property name="buddy" >
         <cstring>clientCombo</cstring>