/* Get a new context so we don't destroy restore command args */
UAContext *ua = new_ua_context(tree->ua->jcr);
ua->UA_sock = tree->ua->UA_sock; /* patch in UA socket */
+ BSOCK *user = ua->UA_sock;
bsendmsg(tree->ua, _(
"\nYou are now entering file selection mode where you add (mark) and\n"
if (!get_cmd(ua, "$ ")) {
break;
}
+ if (ua->api) user->signal(BNET_CMD_BEGIN);
parse_args_only(ua->cmd, &ua->args, &ua->argc, ua->argk, ua->argv, MAX_CMD_ARGS);
if (ua->argc == 0) {
bsendmsg(tree->ua, _("Invalid command. Enter \"done\" to exit.\n"));
+ if (ua->api) user->signal(BNET_CMD_FAILED);
continue;
}
}
if (!found) {
bsendmsg(tree->ua, _("Invalid command. Enter \"done\" to exit.\n"));
+ if (ua->api) user->signal(BNET_CMD_FAILED);
continue;
}
+ if (ua->api) user->signal(BNET_CMD_OK);
if (!stat) {
break;
}
m_sock->close();
m_sock = NULL;
}
- m_timer->stop();
+// m_timer->stop();
}
/*
lineEdit->setFocus();
}
+void MainWin::keyPressEvent(QKeyEvent *event)
+{
+ if (m_cmd_history.size() == 0) {
+ event->ignore();
+ return;
+ }
+ switch (event->key()) {
+ case Qt::Key_Down:
+// Dmsg0(000, "Down key pressed\n");
+ if (m_cmd_last < 0 || m_cmd_last >= (m_cmd_history.size()-1)) {
+ event->ignore();
+ return;
+ }
+ m_cmd_last++;
+ break;
+ case Qt::Key_Up:
+// Dmsg0(000, "Up key pressed\n");
+ if (m_cmd_last == 0) {
+ event->ignore();
+ return;
+ }
+ if (m_cmd_last < 0 || m_cmd_last > (m_cmd_history.size()-1)) {
+ m_cmd_last = m_cmd_history.size() - 1;
+ } else {
+ m_cmd_last--;
+ }
+ break;
+ default:
+ event->ignore();
+ return;
+ }
+ lineEdit->setText(m_cmd_history[m_cmd_last]);
+}
void MainWin::createConnections()
{
} else {
set_status("Director not connected. Click on connect button.");
}
+ m_cmd_history.append(cmdStr);
+ m_cmd_last = -1;
}
protected:
void closeEvent(QCloseEvent *event);
+ void keyPressEvent(QKeyEvent *event);
private:
void createConnections();
private:
QString m_UserInput;
Console *m_console;
+ QStringList m_cmd_history;
+ int m_cmd_last;
};
#endif /* _MAINWIN_H_ */
}
split_path_and_filename(p, &path, &pnl, &file, &fnl);
item.clear();
- item << "" << file << modes << user << group << size << date;
+ item << marked << file << modes << user << group << size << date;
QTreeWidgetItem *ti = new QTreeWidgetItem((QTreeWidget *)0, item);
ti->setTextAlignment(5, Qt::AlignRight); /* right align size */
items.append(ti);
char cmd[1000];
if (column == 0) { /* mark/unmark */
if (item->text(0) == "*") {
- bsnprintf(cmd, sizeof(cmd), "unmark \"%s\"\n", item->text(1).toUtf8().data());
+ bsnprintf(cmd, sizeof(cmd), "unmark \"%s\"", item->text(1).toUtf8().data());
item->setText(0, " ");
} else {
- bsnprintf(cmd, sizeof(cmd), "mark \"%s\"\n", item->text(1).toUtf8().data());
+ bsnprintf(cmd, sizeof(cmd), "mark \"%s\"", item->text(1).toUtf8().data());
item->setText(0, "*");
}
- m_console->write(cmd);
+ m_console->write_dir(cmd);
+ if (m_console->read() > 0) {
+ strip_trailing_junk(m_console->msg());
+ statusLine->setText(m_console->msg());
+ }
m_console->displayToPrompt();
return;
}
QTreeWidgetItem *item;
char cmd[1000];
foreach (item, items) {
- Dmsg1(000, "item=%s\n", item->text(1).toUtf8().data());
- if (item->text(0) == " ") {
- bsnprintf(cmd, sizeof(cmd), "mark \"%s\"", item->text(1).toUtf8().data());
- item->setText(0, "*");
- m_console->write(cmd);
- Dmsg1(000, "cmd=%s\n", cmd);
- m_console->displayToPrompt();
+ bsnprintf(cmd, sizeof(cmd), "mark \"%s\"", item->text(1).toUtf8().data());
+ item->setText(0, "*");
+ m_console->write_dir(cmd);
+ if (m_console->read() > 0) {
+ strip_trailing_junk(m_console->msg());
+ statusLine->setText(m_console->msg());
}
+ Dmsg1(100, "cmd=%s\n", cmd);
+ m_console->discardToPrompt();
}
}
QTreeWidgetItem *item;
char cmd[1000];
foreach (item, items) {
- if (item->text(0) == "*") {
- bsnprintf(cmd, sizeof(cmd), "unmark \"%s\"", item->text(1).toUtf8().data());
- item->setText(0, " ");
- m_console->write(cmd);
- Dmsg1(000, "cmd=%s\n", cmd);
- m_console->displayToPrompt();
+ bsnprintf(cmd, sizeof(cmd), "unmark \"%s\"", item->text(1).toUtf8().data());
+ item->setText(0, " ");
+ m_console->write_dir(cmd);
+ if (m_console->read() > 0) {
+ strip_trailing_junk(m_console->msg());
+ statusLine->setText(m_console->msg());
}
+ Dmsg1(100, "cmd=%s\n", cmd);
+ m_console->discardToPrompt();
}
}
int stat;
char cd_cmd[MAXSTRING];
- bsnprintf(cd_cmd, sizeof(cd_cmd), "cd \"%s\"\n", dir);
+ bsnprintf(cd_cmd, sizeof(cd_cmd), "cd \"%s\"", dir);
Dmsg2(100, "dir=%s cmd=%s\n", dir, cd_cmd);
m_console->write_dir(cd_cmd);
if ((stat = m_console->read()) > 0) {
<property name="windowTitle" >
<string>Restore File Selection</string>
</property>
- <layout class="QVBoxLayout" >
+ <layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>20</width>
- <height>16</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
+ <item row="1" column="0" >
<widget class="QSplitter" name="splitter" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</item>
</layout>
</widget>
- <widget class="QWidget" name="layoutWidget" >
+ <widget class="QWidget" name="" >
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
<property name="alternatingRowColors" >
<bool>true</bool>
</property>
+ <property name="selectionMode" >
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ <property name="horizontalScrollMode" >
+ <enum>QAbstractItemView::ScrollPerItem</enum>
+ </property>
+ <property name="uniformRowHeights" >
+ <bool>true</bool>
+ </property>
<property name="columnCount" >
<number>7</number>
</property>
</widget>
</widget>
</item>
- <item>
+ <item row="0" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</item>
</layout>
</item>
- <item>
+ <item row="3" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>