]> git.sur5r.net Git - bacula/bacula/commitdiff
Merge Dirk's additions
authorKern Sibbald <kern@sibbald.com>
Tue, 20 Mar 2007 21:27:04 +0000 (21:27 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 20 Mar 2007 21:27:04 +0000 (21:27 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4372 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/Makefile
bacula/src/qt-console/bat.pro
bacula/src/qt-console/joblist/joblist.cpp [new file with mode: 0644]
bacula/src/qt-console/joblist/joblist.h [new file with mode: 0644]
bacula/src/qt-console/joblist/joblist.ui [new file with mode: 0644]
bacula/src/qt-console/mainwin.cpp
bacula/src/qt-console/mediaedit/mediaedit.cpp [new file with mode: 0644]
bacula/src/qt-console/mediaedit/mediaedit.h [new file with mode: 0644]
bacula/src/qt-console/mediaedit/mediaedit.ui [new file with mode: 0644]
bacula/src/qt-console/medialist/medialist.cpp
bacula/src/qt-console/medialist/medialist.h

index 1ff7f57ecb9581927f6fdc56a0e7cd3f2dcb22f0..4bfc3e2ff37c30f6dc38e6b3a1204638931b31fb 100644 (file)
@@ -1,6 +1,6 @@
 #############################################################################
 # Makefile for building: bat
-# Generated by qmake (2.01a) (Qt 4.2.1) on: Thu Mar 15 21:12:02 2007
+# Generated by qmake (2.01a) (Qt 4.2.1) on: Tue Mar 20 22:04:12 2007
 # Project:  bat.pro
 # Template: app
 # Command: /usr/bin/qmake -unix -o Makefile bat.pro
@@ -58,13 +58,17 @@ SOURCES       = main.cpp \
                run/run.cpp \
                run/runcmd.cpp \
                select/select.cpp \
-               medialist/medialist.cpp moc/moc_mainwin.cpp \
+               medialist/medialist.cpp \
+               mediaedit/mediaedit.cpp \
+               joblist/joblist.cpp moc/moc_mainwin.cpp \
                moc/moc_console.cpp \
                moc/moc_restore.cpp \
                moc/moc_label.cpp \
                moc/moc_run.cpp \
                moc/moc_select.cpp \
                moc/moc_medialist.cpp \
+               moc/moc_mediaedit.cpp \
+               moc/moc_joblist.cpp \
                qrc_main.cpp
 OBJECTS       = obj/main.o \
                obj/bat_conf.o \
@@ -80,6 +84,8 @@ OBJECTS       = obj/main.o \
                obj/runcmd.o \
                obj/select.o \
                obj/medialist.o \
+               obj/mediaedit.o \
+               obj/joblist.o \
                obj/moc_mainwin.o \
                obj/moc_console.o \
                obj/moc_restore.o \
@@ -87,6 +93,8 @@ OBJECTS       = obj/main.o \
                obj/moc_run.o \
                obj/moc_select.o \
                obj/moc_medialist.o \
+               obj/moc_mediaedit.o \
+               obj/moc_joblist.o \
                obj/qrc_main.o
 DIST          = /usr/share/qt4/mkspecs/common/unix.conf \
                /usr/share/qt4/mkspecs/common/g++.conf \
@@ -133,7 +141,7 @@ first: all
 
 all: Makefile $(TARGET)
 
-$(TARGET): ui/ui_main.h ui/ui_label.h ui/ui_console.h ui/ui_restore.h ui/ui_prerestore.h ui/ui_brestore.h ui/ui_run.h ui/ui_runcmd.h ui/ui_select.h ui/ui_medialist.h $(OBJECTS)  
+$(TARGET): ui/ui_main.h ui/ui_label.h ui/ui_console.h ui/ui_restore.h ui/ui_prerestore.h ui/ui_brestore.h ui/ui_run.h ui/ui_runcmd.h ui/ui_select.h ui/ui_medialist.h ui/ui_mediaedit.h ui/ui_joblist.h $(OBJECTS)  
        $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
 
 Makefile: bat.pro  /usr/share/qt4/mkspecs/default/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \
@@ -178,7 +186,7 @@ qmake:  FORCE
 
 dist: 
        @$(CHK_DIR_EXISTS) obj/bat1.0.0 || $(MKDIR) obj/bat1.0.0 
-       $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/bat1.0.0/ && $(COPY_FILE) --parents mainwin.h bat.h bat_conf.h qstd.h console/console.h restore/restore.h label/label.h run/run.h select/select.h medialist/medialist.h obj/bat1.0.0/ && $(COPY_FILE) --parents main.qrc obj/bat1.0.0/ && $(COPY_FILE) --parents main.cpp bat_conf.cpp mainwin.cpp qstd.cpp console/authenticate.cpp console/console.cpp restore/prerestore.cpp restore/restore.cpp restore/brestore.cpp label/label.cpp run/run.cpp run/runcmd.cpp select/select.cpp medialist/medialist.cpp obj/bat1.0.0/ && $(COPY_FILE) --parents main.ui label/label.ui console/console.ui restore/restore.ui restore/prerestore.ui restore/brestore.ui run/run.ui run/runcmd.ui select/select.ui medialist/medialist.ui obj/bat1.0.0/ && (cd `dirname obj/bat1.0.0` && $(TAR) bat1.0.0.tar bat1.0.0 && $(COMPRESS) bat1.0.0.tar) && $(MOVE) `dirname obj/bat1.0.0`/bat1.0.0.tar.gz . && $(DEL_FILE) -r obj/bat1.0.0
+       $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/bat1.0.0/ && $(COPY_FILE) --parents mainwin.h bat.h bat_conf.h qstd.h console/console.h restore/restore.h label/label.h run/run.h select/select.h medialist/medialist.h mediaedit/mediaedit.h joblist/joblist.h obj/bat1.0.0/ && $(COPY_FILE) --parents main.qrc obj/bat1.0.0/ && $(COPY_FILE) --parents main.cpp bat_conf.cpp mainwin.cpp qstd.cpp console/authenticate.cpp console/console.cpp restore/prerestore.cpp restore/restore.cpp restore/brestore.cpp label/label.cpp run/run.cpp run/runcmd.cpp select/select.cpp medialist/medialist.cpp mediaedit/mediaedit.cpp joblist/joblist.cpp obj/bat1.0.0/ && $(COPY_FILE) --parents main.ui label/label.ui console/console.ui restore/restore.ui restore/prerestore.ui restore/brestore.ui run/run.ui run/runcmd.ui select/select.ui medialist/medialist.ui mediaedit/mediaedit.ui joblist/joblist.ui obj/bat1.0.0/ && (cd `dirname obj/bat1.0.0` && $(TAR) bat1.0.0.tar bat1.0.0 && $(COMPRESS) bat1.0.0.tar) && $(MOVE) `dirname obj/bat1.0.0`/bat1.0.0.tar.gz . && $(DEL_FILE) -r obj/bat1.0.0
 
 
 yaccclean:
@@ -202,9 +210,9 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean
 
 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
 
-compiler_moc_header_make_all: moc/moc_mainwin.cpp moc/moc_console.cpp moc/moc_restore.cpp moc/moc_label.cpp moc/moc_run.cpp moc/moc_select.cpp moc/moc_medialist.cpp
+compiler_moc_header_make_all: moc/moc_mainwin.cpp moc/moc_console.cpp moc/moc_restore.cpp moc/moc_label.cpp moc/moc_run.cpp moc/moc_select.cpp moc/moc_medialist.cpp moc/moc_mediaedit.cpp moc/moc_joblist.cpp
 compiler_moc_header_clean:
-       -$(DEL_FILE) moc/moc_mainwin.cpp moc/moc_console.cpp moc/moc_restore.cpp moc/moc_label.cpp moc/moc_run.cpp moc/moc_select.cpp moc/moc_medialist.cpp
+       -$(DEL_FILE) moc/moc_mainwin.cpp moc/moc_console.cpp moc/moc_restore.cpp moc/moc_label.cpp moc/moc_run.cpp moc/moc_select.cpp moc/moc_medialist.cpp moc/moc_mediaedit.cpp moc/moc_joblist.cpp
 moc/moc_mainwin.cpp: ui/ui_main.h \
                label/label.h \
                ui/ui_label.h \
@@ -254,6 +262,16 @@ moc/moc_medialist.cpp: ui/ui_medialist.h \
                /usr/bin/moc
        /usr/bin/moc $(DEFINES) $(INCPATH) medialist/medialist.h -o moc/moc_medialist.cpp
 
+moc/moc_mediaedit.cpp: ui/ui_mediaedit.h \
+               mediaedit/mediaedit.h \
+               /usr/bin/moc
+       /usr/bin/moc $(DEFINES) $(INCPATH) mediaedit/mediaedit.h -o moc/moc_mediaedit.cpp
+
+moc/moc_joblist.cpp: ui/ui_joblist.h \
+               joblist/joblist.h \
+               /usr/bin/moc
+       /usr/bin/moc $(DEFINES) $(INCPATH) joblist/joblist.h -o moc/moc_joblist.cpp
+
 compiler_rcc_make_all: qrc_main.cpp
 compiler_rcc_clean:
        -$(DEL_FILE) qrc_main.cpp
@@ -280,9 +298,9 @@ compiler_image_collection_clean:
        -$(DEL_FILE) qmake_image_collection.cpp
 compiler_moc_source_make_all:
 compiler_moc_source_clean:
-compiler_uic_make_all: ui/ui_main.h ui/ui_label.h ui/ui_console.h ui/ui_restore.h ui/ui_prerestore.h ui/ui_brestore.h ui/ui_run.h ui/ui_runcmd.h ui/ui_select.h ui/ui_medialist.h
+compiler_uic_make_all: ui/ui_main.h ui/ui_label.h ui/ui_console.h ui/ui_restore.h ui/ui_prerestore.h ui/ui_brestore.h ui/ui_run.h ui/ui_runcmd.h ui/ui_select.h ui/ui_medialist.h ui/ui_mediaedit.h ui/ui_joblist.h
 compiler_uic_clean:
-       -$(DEL_FILE) ui/ui_main.h ui/ui_label.h ui/ui_console.h ui/ui_restore.h ui/ui_prerestore.h ui/ui_brestore.h ui/ui_run.h ui/ui_runcmd.h ui/ui_select.h ui/ui_medialist.h
+       -$(DEL_FILE) ui/ui_main.h ui/ui_label.h ui/ui_console.h ui/ui_restore.h ui/ui_prerestore.h ui/ui_brestore.h ui/ui_run.h ui/ui_runcmd.h ui/ui_select.h ui/ui_medialist.h ui/ui_mediaedit.h ui/ui_joblist.h
 ui/ui_main.h: main.ui
        /usr/bin/uic main.ui -o ui/ui_main.h
 
@@ -313,6 +331,12 @@ ui/ui_select.h: select/select.ui
 ui/ui_medialist.h: medialist/medialist.ui
        /usr/bin/uic medialist/medialist.ui -o ui/ui_medialist.h
 
+ui/ui_mediaedit.h: mediaedit/mediaedit.ui
+       /usr/bin/uic mediaedit/mediaedit.ui -o ui/ui_mediaedit.h
+
+ui/ui_joblist.h: joblist/joblist.ui
+       /usr/bin/uic joblist/joblist.ui -o ui/ui_joblist.h
+
 compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_image_collection_clean compiler_moc_source_clean compiler_uic_clean 
 
 ####### Compile
@@ -543,6 +567,46 @@ obj/medialist.o: medialist/medialist.cpp bat.h \
                qstd.h
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/medialist.o medialist/medialist.cpp
 
+obj/mediaedit.o: mediaedit/mediaedit.cpp bat.h \
+               mainwin.h \
+               ui/ui_main.h \
+               label/label.h \
+               ui/ui_label.h \
+               run/run.h \
+               ui/ui_run.h \
+               ui/ui_runcmd.h \
+               restore/restore.h \
+               ui/ui_brestore.h \
+               ui/ui_restore.h \
+               ui/ui_prerestore.h \
+               medialist/medialist.h \
+               ui/ui_medialist.h \
+               bat_conf.h \
+               qstd.h \
+               mediaedit/mediaedit.h \
+               ui/ui_mediaedit.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/mediaedit.o mediaedit/mediaedit.cpp
+
+obj/joblist.o: joblist/joblist.cpp bat.h \
+               mainwin.h \
+               ui/ui_main.h \
+               label/label.h \
+               ui/ui_label.h \
+               run/run.h \
+               ui/ui_run.h \
+               ui/ui_runcmd.h \
+               restore/restore.h \
+               ui/ui_brestore.h \
+               ui/ui_restore.h \
+               ui/ui_prerestore.h \
+               medialist/medialist.h \
+               ui/ui_medialist.h \
+               bat_conf.h \
+               qstd.h \
+               joblist/joblist.h \
+               ui/ui_joblist.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/joblist.o joblist/joblist.cpp
+
 obj/moc_mainwin.o: moc/moc_mainwin.cpp 
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_mainwin.o moc/moc_mainwin.cpp
 
@@ -564,6 +628,12 @@ obj/moc_select.o: moc/moc_select.cpp
 obj/moc_medialist.o: moc/moc_medialist.cpp 
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_medialist.o moc/moc_medialist.cpp
 
+obj/moc_mediaedit.o: moc/moc_mediaedit.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_mediaedit.o moc/moc_mediaedit.cpp
+
+obj/moc_joblist.o: moc/moc_joblist.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_joblist.o moc/moc_joblist.cpp
+
 obj/qrc_main.o: qrc_main.cpp 
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/qrc_main.o qrc_main.cpp
 
index 0092b7bd8563785dd6530621576d96cfc69fbc3e..f4c77c9b4a4c02acab1fdebb4c0b333aab1a8116 100644 (file)
@@ -23,8 +23,7 @@ FORMS += console/console.ui
 FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui
 FORMS += run/run.ui run/runcmd.ui
 FORMS += select/select.ui
-FORMS += medialist/medialist.ui
-
+FORMS += medialist/medialist.ui mediaedit/mediaedit.ui joblist/joblist.ui
 
 HEADERS += mainwin.h bat.h bat_conf.h qstd.h
 SOURCES += main.cpp bat_conf.cpp mainwin.cpp qstd.cpp
@@ -49,6 +48,14 @@ SOURCES += run/run.cpp run/runcmd.cpp
 HEADERS += select/select.h
 SOURCES += select/select.cpp
 
-## Medialist
+## MediaList
 HEADERS += medialist/medialist.h
 SOURCES += medialist/medialist.cpp
+
+## MediaEdit
+HEADERS += mediaedit/mediaedit.h
+SOURCES += mediaedit/mediaedit.cpp
+
+## JobList
+HEADERS += joblist/joblist.h
+SOURCES += joblist/joblist.cpp
diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp
new file mode 100644 (file)
index 0000000..15c8a5b
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2000-2007 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 plus additions
+   that are listed 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 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
+#include <QAbstractEventDispatcher>
+#include "bat.h"
+#include "joblist.h"
+#include <QTableWidgetItem>
+
+JobList::JobList(Console *console, QString &medianame)
+{
+   printf("Listing Jobs on Media %s\n", medianame.toUtf8().data());
+   setupUi(this);
+   m_console = console;
+   tableWidget->clear();
+   tableWidget->setColumnCount(2);
+   tableWidget->setRowCount(5);
+   QTableWidgetItem* item = new QTableWidgetItem(medianame,1);
+   tableWidget->setItem(1, 1, item);
+}
diff --git a/bacula/src/qt-console/joblist/joblist.h b/bacula/src/qt-console/joblist/joblist.h
new file mode 100644 (file)
index 0000000..5ffff88
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef _JOBLIST_H_
+#define _JOBLIST_H_
+/*
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2000-2007 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 plus additions
+   that are listed 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 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
+/*
+ *   Version $Id: joblist.h 4230 2007-02-21 20:07:37Z kerns $
+ *
+ *   Kern Sibbald, January 2007
+ */
+
+#include <QtGui>
+#include "ui_joblist.h"
+#include "console.h"
+
+class JobList : public QWidget, public Ui::JobListForm
+{
+   Q_OBJECT 
+
+public:
+   JobList(Console *console, QString &medianame );
+
+public slots:
+
+private:
+   Console *m_console;
+};
+
+#endif /* _JOBLIST_H_ */
diff --git a/bacula/src/qt-console/joblist/joblist.ui b/bacula/src/qt-console/joblist/joblist.ui
new file mode 100644 (file)
index 0000000..e7a9142
--- /dev/null
@@ -0,0 +1,29 @@
+<ui version="4.0" >
+ <class>JobListForm</class>
+ <widget class="QWidget" name="JobListForm" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>621</width>
+    <height>460</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="0" column="0" >
+    <widget class="QTableWidget" name="tableWidget" />
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index d8e8cc34bc387f268cfbbf6e1e3aa710be3f86ce..dd67a27466cef75d3ad0976c16446dc73dcd55ff 100644 (file)
@@ -59,6 +59,7 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
    readSettings();
 
    m_console->connect();
+   m_medialist->populateTree();
 }
 
 void MainWin::createPages()
@@ -72,7 +73,7 @@ void MainWin::createPages()
    bRestore *brestore = new bRestore(stackedWidget);
    stackedWidget->addWidget(brestore);
 
-   m_medialist = new MediaList(stackedWidget);
+   m_medialist = new MediaList(stackedWidget, m_console);
    stackedWidget->addWidget(m_medialist);
 
    /* Just take the first Director */
@@ -228,9 +229,6 @@ void MainWin::treeItemDoubleClicked(QTreeWidgetItem *item, int column)
    int index = item->data(column, Qt::UserRole).toInt();
    if (index >= 0) {
       stackedWidget->setCurrentIndex(index);
-      if( index == 2 ){
-         m_medialist->DoDisplay(m_console);
-      }
    }
 }
 
diff --git a/bacula/src/qt-console/mediaedit/mediaedit.cpp b/bacula/src/qt-console/mediaedit/mediaedit.cpp
new file mode 100644 (file)
index 0000000..3519660
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2000-2007 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 plus additions
+   that are listed 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 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
+#include <QAbstractEventDispatcher>
+#include "bat.h"
+#include "mediaedit.h"
+#include <QTableWidgetItem>
+
+MediaEdit::MediaEdit(Console *console, QString &medianame)
+{
+   setupUi(this);
+   m_console = console;
+   tableWidget->clear();
+   tableWidget->setColumnCount(2);
+   tableWidget->setRowCount(5);
+   QTableWidgetItem* item = new QTableWidgetItem(medianame,1);
+   tableWidget->setItem(1, 1, item);
+}
diff --git a/bacula/src/qt-console/mediaedit/mediaedit.h b/bacula/src/qt-console/mediaedit/mediaedit.h
new file mode 100644 (file)
index 0000000..ed4f4c4
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef _MEDIAEDIT_H_
+#define _MEDIAEDIT_H_
+/*
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2000-2007 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 plus additions
+   that are listed 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 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
+
+#include <QtGui>
+#include "ui_mediaedit.h"
+#include "console.h"
+
+class MediaEdit : public QWidget, public Ui::MediaEdit
+{
+   Q_OBJECT 
+
+public:
+   MediaEdit(Console *console, QString &medianame );
+
+public slots:
+
+private:
+   Console *m_console;
+
+};
+
+#endif /* _MEDIAEDIT_H_ */
diff --git a/bacula/src/qt-console/mediaedit/mediaedit.ui b/bacula/src/qt-console/mediaedit/mediaedit.ui
new file mode 100644 (file)
index 0000000..792caa3
--- /dev/null
@@ -0,0 +1,29 @@
+<ui version="4.0" >
+ <class>MediaEdit</class>
+ <widget class="QWidget" name="MediaEdit" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>540</width>
+    <height>421</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="0" column="0" >
+    <widget class="QTableWidget" name="tableWidget" />
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index 6b1155211b6efbd74438d165f009cfc4aebd27f6..4a41cfdc42b1a2e08a0b41d3a2ea2bb87cbbeb5e 100644 (file)
 #include <QAbstractEventDispatcher>
 #include "bat.h"
 #include "medialist.h"
+#include "mediaedit/mediaedit.h"
+#include "joblist/joblist.h"
+#include <QMenu>
+//#include <QSize>
 
-MediaList::MediaList(QStackedWidget *parent)
+MediaList::MediaList(QStackedWidget *parent, Console *console)
 {
    setupUi(this);
    parent->addWidget(this);
    poollist = new QStringList();
 
    m_treeWidget = treeWidget;   /* our medialist screen */
+   m_console = console;
+   createConnections();
+   popupmedia="";
 }
 
-void MediaList::DoDisplay(Console *console)
+void MediaList::populateTree()
 {
    int stat;
    QTreeWidgetItem *mediatreeitem, *treeitem, *topItem;
 
-   m_console = console;
-
    m_treeWidget->clear();
    m_treeWidget->setColumnCount(3);
    topItem = new QTreeWidgetItem(m_treeWidget);
    topItem->setText(0, "Pools");
+   topItem->setData(0, Qt::UserRole, 0);
+   topItem->setExpanded( true );
+   //topItem->setSizeHint(0,QSize(1050,50));
 
    /* Start with a list of pools */
    poollist->clear();
@@ -72,6 +80,8 @@ void MediaList::DoDisplay(Console *console)
       m_console->setTreeItem(treeitem);
       poolitem->replace(QRegExp("\n"), "");
       treeitem->setText(0, poolitem->toUtf8().data());
+      treeitem->setData(0, Qt::UserRole, 1);
+      treeitem->setExpanded( true );
 
       /* iterate through the media in the pool */
       QString *mcmd = new QString("sqlquery\n");
@@ -85,7 +95,9 @@ void MediaList::DoDisplay(Console *console)
       while ((stat=m_console->read()) > 0) {
         *mediaread += m_console->msg();
       }
+      m_console->discardToPrompt();
       QStringList sqllinelist = mediaread->split("\n");
+      /* a regex todetermine if mediareadline is a line of interest. */
       QRegExp regex("^\\|.*\\|$");
       int recordcnter=0;
       QStringList *headerlist = new QStringList();
@@ -104,6 +116,7 @@ void MediaList::DoDisplay(Console *console)
                     if ( recorditemcnter == 0 ){
                        mediatreeitem = new QTreeWidgetItem(treeitem);
                     }
+                    mediatreeitem->setData(recorditemcnter, Qt::UserRole, 2);
                     mediatreeitem->setText(recorditemcnter, trimmeditem.toUtf8().data());
                  }
                  recorditemcnter+=1;
@@ -115,3 +128,47 @@ void MediaList::DoDisplay(Console *console)
       m_treeWidget->setHeaderLabels(*headerlist);
    }
 }
+
+void MediaList::createConnections()
+{
+   connect(treeWidget, SIGNAL(itemPressed(QTreeWidgetItem *, int)), this,
+               SLOT(treeItemClicked(QTreeWidgetItem *, int)));
+   connect(treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this,
+               SLOT(treeItemDoubleClicked(QTreeWidgetItem *, int)));
+}
+
+void MediaList::treeItemClicked(QTreeWidgetItem *item, int column)
+{
+   int treedepth = item->data(column, Qt::UserRole).toInt();
+   QString text = item->text(0);
+   switch (treedepth){
+      case 1:
+        break;
+      case 2:
+        /* Can't figure out how to make a right button do this her Qt::LeftButton, Qt::RightButton, Qt::MidButton */
+        popupmedia = text;
+        QMenu *popup = new QMenu( m_treeWidget );
+        connect(popup->addAction("Edit Properties"), SIGNAL(triggered()), this, SLOT(editMedia()));
+        connect(popup->addAction("Show Jobs On Media"), SIGNAL(triggered()), this, SLOT(showJobs()));
+        popup->exec(QCursor::pos());
+   }
+}
+
+void MediaList::treeItemDoubleClicked(QTreeWidgetItem *item, int column)
+{
+   int treedepth = item->data(column, Qt::UserRole).toInt();
+   if (treedepth >= 0) {
+   }
+}
+
+void MediaList::editMedia()
+{
+   MediaEdit* edit = new MediaEdit(m_console, popupmedia);
+   edit->show();
+}
+
+void MediaList::showJobs()
+{
+   JobList* joblist = new JobList(m_console, popupmedia);
+   joblist->show();
+}
index cc11e9f4c8226afbce32412d2217b96c5ffc32d8..f8229953c4a5faee703c846a008bc390aea38061 100644 (file)
@@ -43,15 +43,24 @@ class MediaList : public QWidget, public Ui::MediaListForm
    Q_OBJECT 
 
 public:
-   MediaList(QStackedWidget *parent);
-   void DoDisplay(Console *console);
+   MediaList(QStackedWidget *parent,Console *console);
+   void populateTree();
+
 
 public slots:
+   void treeItemClicked(QTreeWidgetItem *item, int column);
+   void treeItemDoubleClicked(QTreeWidgetItem *item, int column);
+   void editMedia();
+   void showJobs();
+
+private:
+   void createConnections();
 
 private:
    Console *m_console;
    QTreeWidget *m_treeWidget;
    QStringList *poollist;
+   QString popupmedia;
 };
 
 #endif /* _MEDIALIST_H_ */