if (ua->api) user->signal(BNET_START_SELECT);
bsendmsg(ua, ua->prompt[0]);
for (i=1; i < ua->num_prompts; i++) {
- bsendmsg(ua, "%6d: %s\n", i, ua->prompt[i]);
+ if (ua->api) {
+ bsendmsg(ua, "%s", ua->prompt[i]);
+ } else {
+ bsendmsg(ua, "%6d: %s\n", i, ua->prompt[i]);
+ }
}
if (ua->api) user->signal(BNET_END_SELECT);
#############################################################################
# Makefile for building: bat
-# Generated by qmake (2.01a) (Qt 4.2.1) on: Mon Mar 5 17:45:21 2007
+# Generated by qmake (2.01a) (Qt 4.2.1) on: Fri Mar 9 09:22:17 2007
# Project: bat.pro
# Template: app
# Command: /usr/bin/qmake -unix -o Makefile bat.pro
CXXFLAGS = -pipe -g -D_REENTRANT -Wall -W $(DEFINES)
LEXFLAGS =
YACCFLAGS = -d
-INCPATH = -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include -I. -Iconsole -Irestore -I.. -Imoc -I.
+INCPATH = -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include -I. -Iconsole -Irestore -Iselect -I.. -Imoc -I.
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib -L../lib -lbac -lssl -lcrypto -lQtGui -L/usr/lib -L/usr/X11R6/lib -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl -lpthread
restore/restore.cpp \
restore/brestore.cpp \
label/label.cpp \
- run/run.cpp moc/moc_mainwin.cpp \
+ run/run.cpp \
+ select/select.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 \
qrc_main.cpp
OBJECTS = obj/main.o \
obj/bat_conf.o \
obj/brestore.o \
obj/label.o \
obj/run.o \
+ obj/select.o \
obj/moc_mainwin.o \
obj/moc_console.o \
obj/moc_restore.o \
obj/moc_label.o \
obj/moc_run.o \
+ obj/moc_select.o \
obj/qrc_main.o
DIST = /usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/g++.conf \
all: Makefile $(TARGET)
-$(TARGET): ui_main.h ui_label.h ui_console.h ui_restore.h ui_prerestore.h ui_brestore.h ui_run.h $(OBJECTS)
+$(TARGET): ui_main.h ui_label.h ui_console.h ui_restore.h ui_prerestore.h ui_brestore.h ui_run.h ui_select.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 \
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 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 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 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 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 select/select.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 select/select.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:
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
+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
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
+ -$(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_mainwin.cpp: ui_main.h \
label/label.h \
ui_label.h \
/usr/bin/moc
/usr/bin/moc $(DEFINES) $(INCPATH) run/run.h -o moc/moc_run.cpp
+moc/moc_select.cpp: ui_select.h \
+ select/select.h \
+ /usr/bin/moc
+ /usr/bin/moc $(DEFINES) $(INCPATH) select/select.h -o moc/moc_select.cpp
+
compiler_rcc_make_all: qrc_main.cpp
compiler_rcc_clean:
-$(DEL_FILE) qrc_main.cpp
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
-compiler_uic_make_all: ui_main.h ui_label.h ui_console.h ui_restore.h ui_prerestore.h ui_brestore.h ui_run.h
+compiler_uic_make_all: ui_main.h ui_label.h ui_console.h ui_restore.h ui_prerestore.h ui_brestore.h ui_run.h ui_select.h
compiler_uic_clean:
- -$(DEL_FILE) ui_main.h ui_label.h ui_console.h ui_restore.h ui_prerestore.h ui_brestore.h ui_run.h
+ -$(DEL_FILE) ui_main.h ui_label.h ui_console.h ui_restore.h ui_prerestore.h ui_brestore.h ui_run.h ui_select.h
ui_main.h: main.ui
/usr/bin/uic main.ui -o ui_main.h
ui_run.h: run/run.ui
/usr/bin/uic run/run.ui -o ui_run.h
+ui_select.h: select/select.ui
+ /usr/bin/uic select/select.ui -o ui_select.h
+
compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_image_collection_clean compiler_moc_source_clean compiler_uic_clean
####### Compile
qstd.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/run.o run/run.cpp
+obj/select.o: select/select.cpp bat.h \
+ mainwin.h \
+ ui_main.h \
+ label/label.h \
+ ui_label.h \
+ run/run.h \
+ ui_run.h \
+ restore/restore.h \
+ ui_brestore.h \
+ ui_restore.h \
+ ui_prerestore.h \
+ bat_conf.h \
+ qstd.h \
+ select/select.h \
+ ui_select.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/select.o select/select.cpp
+
obj/moc_mainwin.o: moc/moc_mainwin.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_mainwin.o moc/moc_mainwin.cpp
obj/moc_run.o: moc/moc_run.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_run.o moc/moc_run.cpp
+obj/moc_select.o: moc/moc_select.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_select.o moc/moc_select.cpp
+
obj/qrc_main.o: qrc_main.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/qrc_main.o qrc_main.cpp
TEMPLATE = app
TARGET = bat
DEPENDPATH += .
-INCLUDEPATH += . ./console ./restore
+INCLUDEPATH += . ./console ./restore ./select
INCLUDEPATH += ..
LIBS += -L../lib
LIBS += -lbac
FORMS += console/console.ui
FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui
FORMS += run/run.ui
+FORMS += select/select.ui
HEADERS += mainwin.h bat.h bat_conf.h qstd.h
# Run dialog
HEADERS += run/run.h
SOURCES += run/run.cpp
+
+# Select dialgo
+HEADERS += select/select.h
+SOURCES += select/select.cpp
break;
}
continue;
+ case BNET_START_SELECT:
+ new selectDialog(this);
+ break;
}
if (is_bnet_stop(m_sock)) { /* error or term request */
m_sock->close();
{
m_dir = dir;
}
-
#include <QtGui>
#include "ui_console.h"
#include "restore.h"
+#include "select.h"
#ifndef MAX_NAME_LENGTH
#define MAX_NAME_LENGTH 128
<ui version="4.0" >
<class>labelForm</class>
<widget class="QDialog" name="labelForm" >
+ <property name="windowModality" >
+ <enum>Qt::ApplicationModal</enum>
+ </property>
<property name="geometry" >
<rect>
<x>0</x>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>7</vsizetype>
- <horstretch>1</horstretch>
+ <horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
- <width>200</width>
+ <width>50</width>
<height>100</height>
</size>
</property>
<property name="maximumSize" >
<size>
- <width>400</width>
+ <width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy" >
<enum>Qt::StrongFocus</enum>
</property>
+ <property name="floating" >
+ <bool>false</bool>
+ </property>
+ <property name="features" >
+ <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable|QDockWidget::NoDockWidgetFeatures</set>
+ </property>
+ <property name="allowedAreas" >
+ <set>Qt::NoDockWidgetArea</set>
+ </property>
<property name="windowTitle" >
<string>Page Selector</string>
</property>
<height>0</height>
</size>
</property>
+ <property name="maximumSize" >
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="sizeIncrement" >
<size>
<width>0</width>
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
- <horstretch>200</horstretch>
+ <horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<ui version="4.0" >
<class>prerestoreForm</class>
<widget class="QDialog" name="prerestoreForm" >
+ <property name="windowModality" >
+ <enum>Qt::ApplicationModal</enum>
+ </property>
<property name="geometry" >
<rect>
<x>0</x>
<ui version="4.0" >
<class>restoreForm</class>
<widget class="QDialog" name="restoreForm" >
+ <property name="windowModality" >
+ <enum>Qt::ApplicationModal</enum>
+ </property>
<property name="geometry" >
<rect>
<x>0</x>
</item>
</layout>
</widget>
- <widget class="QWidget" name="" >
+ <widget class="QWidget" name="layoutWidget" >
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
<ui version="4.0" >
<class>runForm</class>
<widget class="QDialog" name="runForm" >
+ <property name="windowModality" >
+ <enum>Qt::ApplicationModal</enum>
+ </property>
<property name="geometry" >
<rect>
<x>0</x>
--- /dev/null
+/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2007-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.
+*/
+
+/*
+ * Select dialog class
+ *
+ * Kern Sibbald, March MMVII
+ *
+ * $Id: $
+ */
+
+#include "bat.h"
+#include "select.h"
+
+/*
+ * Setup all the combo boxes and display the dialog
+ */
+selectDialog::selectDialog(Console *console)
+{
+ QDateTime dt;
+ int stat;
+ QListWidgetItem *item;
+ int row = 0;
+
+ m_console = console;
+ setupUi(this);
+ connect(listBox, SIGNAL(currentRowChanged(int)), this, SLOT(index_change(int)));
+ m_console->read(); /* get title */
+ labelWidget->setText(m_console->msg());
+ while ((stat=m_console->read()) > 0) {
+ item = new QListWidgetItem;
+ item->setText(m_console->msg());
+ listBox->insertItem(row++, item);
+ }
+// Dmsg1(000, "Stat=%d\n", stat);
+ m_console->read(); /* get prompt signal */
+ m_console->read(); /* get prompt */
+// Dmsg1(000, "Prompt=%s", m_console->msg());
+ this->show();
+}
+
+void selectDialog::accept()
+{
+ char cmd[100];
+
+ this->hide();
+
+ bsnprintf(cmd, sizeof(cmd), "%d", m_index+1);
+ m_console->write_dir(cmd);
+ m_console->displayToPrompt();
+ delete this;
+ mainWin->resetFocus();
+}
+
+
+void selectDialog::reject()
+{
+ mainWin->set_status(" Canceled");
+ this->hide();
+ delete this;
+ mainWin->resetFocus();
+}
+
+/*
+ * Called here when the jobname combo box is changed.
+ * We load the default values for the new job in the
+ * other combo boxes.
+ */
+void selectDialog::index_change(int index)
+{
+// Dmsg1(000, "Index=%d\n", index);
+ m_index = index;
+}
--- /dev/null
+
+#ifndef _SELECT_H_
+#define _SELECT_H_
+
+#include <QtGui>
+#include "ui_select.h"
+#include "console.h"
+
+class selectDialog : public QDialog, public Ui::selectForm
+{
+ Q_OBJECT
+
+public:
+ selectDialog(Console *console);
+
+public slots:
+ void accept();
+ void reject();
+ void index_change(int index);
+
+private:
+ Console *m_console;
+ int m_index;
+
+};
+
+#endif /* _SELECT_H_ */
--- /dev/null
+<ui version="4.0" >
+ <class>selectForm</class>
+ <widget class="QDialog" name="selectForm" >
+ <property name="windowModality" >
+ <enum>Qt::NonModal</enum>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>377</width>
+ <height>323</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Selection dialog</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="2" column="0" >
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QListWidget" name="listBox" />
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="labelWidget" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>selectForm</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>selectForm</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>