]> git.sur5r.net Git - bacula/bacula/commitdiff
First cut fileWidget tree
authorKern Sibbald <kern@sibbald.com>
Sat, 3 Mar 2007 21:11:24 +0000 (21:11 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 3 Mar 2007 21:11:24 +0000 (21:11 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4306 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/restore/restore.cpp
bacula/src/qt-console/restore/restore.ui

index 9addf96d30179fdef5c7d7bea31231188ba50f40..d5dc381263aa842d8118d569f3e8b1c5b7bdc8ec 100644 (file)
@@ -101,35 +101,44 @@ restoreDialog::restoreDialog(Console *console)
 {
    m_console = console;
    setupUi(this);
-   fillDirectory("/");
+   fillDirectory("/home/kern/bacula/k");
    this->show();
 }
 
 /*
  * Fill the CList box with files at path
  */
-void restoreDialog::fillDirectory(const char *path)
+void restoreDialog::fillDirectory(const char *dir)
 {
    char pathbuf[MAXSTRING];
    char modes[20], user[20], group[20], size[20], date[30];
-   char file[1000];
    char marked[10];
    int row = 0;
+   int pnl, fnl;
+   POOLMEM *file = get_pool_memory(PM_FNAME);
+   POOLMEM *path = get_pool_memory(PM_FNAME);
 
    m_console->setEnabled(false);
-   m_fname = path;
+   m_fname = dir;
 
 
    m_console->displayToPrompt();
-   bsnprintf(pathbuf, sizeof(pathbuf), "cd %s", path);
+   bsnprintf(pathbuf, sizeof(pathbuf), "cd %s", dir);
    Dmsg1(100, "%s\n", pathbuf);
 
+   QStringList titles;
+   titles << "Mark" << "File" << "Mode" << "User" << "Group" << "Size" << "Date";
+   fileWidget->setHeaderLabels(titles);
+
    m_console->write(pathbuf);
    m_console->display_text(pathbuf);
    m_console->displayToPrompt();
 
    m_console-> write_dir("dir");
    m_console->display_text("dir");
+
+   QList<QTreeWidgetItem *> items;
+   QStringList item;
    while (m_console->read() > 0) {
       char *p = m_console->msg();
       char *l;
@@ -137,7 +146,7 @@ void restoreDialog::fillDirectory(const char *path)
       if (*p == '$') {
          break;
       }
-      Dmsg1(200, "Got: %s\n", p);
+//    Dmsg1(000, "Got: %s\n", p);
       if (!*p) {
          continue;
       }
@@ -177,18 +186,19 @@ void restoreDialog::fillDirectory(const char *path)
       } else {
          bstrncpy(marked, " ", sizeof(marked));
       }
-//    split_path_and_filename(p, &restore->path, &restore->pnl,
-//                            &restore->file, &restore->fnl);
+      split_path_and_filename(p, &path, &pnl,
+                              &file, &fnl);
 
-//    Dmsg1(000, "restore->fname=%s\n", restore->fname);
-//    bstrncpy(file, restore->file, sizeof(file));
-      printf("modes=%s user=%s group=%s size=%s date=%s file=%s\n",
-         modes, user, group, size, date, file);
+//    printf("modes=%s user=%s group=%s size=%s date=%s path=%s file=%s\n",
+//       modes, user, group, size, date, path, file);
 
-//    append to list
+      item.clear();
+      item << "" << file << modes << user << group << size << date;
+      items.append(new QTreeWidgetItem((QTreeWidget *)0, item));
 
       row++;
    }
+   fileWidget->insertTopLevelItems(0, items);
 
-     m_console->setEnabled(true);
+   m_console->setEnabled(true);
 }
index 4f1136525a6f2047404280f47cd50ac58bb92a66..56c99e0218034071b94a2462e61334dfcadeafb3 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1047</width>
-    <height>764</height>
+    <width>688</width>
+    <height>649</height>
    </rect>
   </property>
   <property name="windowTitle" >
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
      </property>
-     <widget class="QTreeWidget" name="treeWidget" >
-      <property name="sizePolicy" >
-       <sizepolicy>
-        <hsizetype>5</hsizetype>
-        <vsizetype>7</vsizetype>
-        <horstretch>0</horstretch>
-        <verstretch>0</verstretch>
-       </sizepolicy>
-      </property>
-      <property name="minimumSize" >
-       <size>
-        <width>0</width>
-        <height>0</height>
-       </size>
-      </property>
-      <property name="maximumSize" >
-       <size>
-        <width>16777215</width>
-        <height>16777215</height>
-       </size>
-      </property>
-      <property name="sizeIncrement" >
-       <size>
-        <width>0</width>
-        <height>0</height>
-       </size>
-      </property>
-      <property name="alternatingRowColors" >
-       <bool>true</bool>
-      </property>
-      <property name="columnCount" >
-       <number>1</number>
-      </property>
-      <column>
-       <property name="text" >
-        <string>1</string>
-       </property>
-      </column>
-     </widget>
-     <widget class="QTreeWidget" name="fileWidget" >
-      <property name="sizePolicy" >
-       <sizepolicy>
-        <hsizetype>7</hsizetype>
-        <vsizetype>5</vsizetype>
-        <horstretch>188</horstretch>
-        <verstretch>1</verstretch>
-       </sizepolicy>
-      </property>
-      <property name="minimumSize" >
-       <size>
-        <width>400</width>
-        <height>0</height>
-       </size>
-      </property>
-      <property name="sizeIncrement" >
-       <size>
-        <width>0</width>
-        <height>0</height>
-       </size>
-      </property>
-      <property name="alternatingRowColors" >
-       <bool>true</bool>
-      </property>
-      <property name="columnCount" >
-       <number>7</number>
-      </property>
-      <column>
-       <property name="text" >
-        <string>1</string>
-       </property>
-      </column>
-      <column>
-       <property name="text" >
-        <string>1</string>
-       </property>
-      </column>
-      <column>
-       <property name="text" >
-        <string>2</string>
+     <widget class="QWidget" name="" >
+      <layout class="QVBoxLayout" >
+       <property name="margin" >
+        <number>0</number>
        </property>
-      </column>
-      <column>
-       <property name="text" >
-        <string>3</string>
-       </property>
-      </column>
-      <column>
-       <property name="text" >
-        <string>4</string>
+       <property name="spacing" >
+        <number>6</number>
        </property>
-      </column>
-      <column>
-       <property name="text" >
-        <string>5</string>
+       <item>
+        <layout class="QHBoxLayout" >
+         <property name="margin" >
+          <number>0</number>
+         </property>
+         <property name="spacing" >
+          <number>6</number>
+         </property>
+         <item>
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_3" >
+           <property name="text" >
+            <string>&lt;h2>Directories&lt;/h2></string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QTreeWidget" name="treeWidget" >
+         <property name="sizePolicy" >
+          <sizepolicy>
+           <hsizetype>5</hsizetype>
+           <vsizetype>7</vsizetype>
+           <horstretch>1</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="minimumSize" >
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="maximumSize" >
+          <size>
+           <width>16777215</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="sizeIncrement" >
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="alternatingRowColors" >
+          <bool>true</bool>
+         </property>
+         <property name="columnCount" >
+          <number>1</number>
+         </property>
+         <column>
+          <property name="text" >
+           <string>1</string>
+          </property>
+         </column>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="" >
+      <layout class="QVBoxLayout" >
+       <property name="margin" >
+        <number>0</number>
        </property>
-      </column>
-      <column>
-       <property name="text" >
-        <string>6</string>
+       <property name="spacing" >
+        <number>6</number>
        </property>
-      </column>
+       <item>
+        <layout class="QHBoxLayout" >
+         <property name="margin" >
+          <number>0</number>
+         </property>
+         <property name="spacing" >
+          <number>6</number>
+         </property>
+         <item>
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>61</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_2" >
+           <property name="text" >
+            <string>&lt;h2>Files&lt;/h2></string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>91</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QTreeWidget" name="fileWidget" >
+         <property name="sizePolicy" >
+          <sizepolicy>
+           <hsizetype>7</hsizetype>
+           <vsizetype>5</vsizetype>
+           <horstretch>144</horstretch>
+           <verstretch>1</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="minimumSize" >
+          <size>
+           <width>400</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="sizeIncrement" >
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="alternatingRowColors" >
+          <bool>true</bool>
+         </property>
+         <property name="columnCount" >
+          <number>7</number>
+         </property>
+         <column>
+          <property name="text" >
+           <string>1</string>
+          </property>
+         </column>
+         <column>
+          <property name="text" >
+           <string>1</string>
+          </property>
+         </column>
+         <column>
+          <property name="text" >
+           <string>2</string>
+          </property>
+         </column>
+         <column>
+          <property name="text" >
+           <string>3</string>
+          </property>
+         </column>
+         <column>
+          <property name="text" >
+           <string>4</string>
+          </property>
+         </column>
+         <column>
+          <property name="text" >
+           <string>5</string>
+          </property>
+         </column>
+         <column>
+          <property name="text" >
+           <string>6</string>
+          </property>
+         </column>
+        </widget>
+       </item>
+      </layout>
      </widget>
     </widget>
    </item>
      </item>
     </layout>
    </item>
+   <item>
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QLabel" name="label_4" >
+       <property name="text" >
+        <string>Status:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="lineEdit_2" />
+     </item>
+    </layout>
+   </item>
   </layout>
  </widget>
  <resources/>