session rename: fix renameSession, use setProgram/setArguments
This commit is contained in:
parent
4bd7a60e78
commit
cd0f92e16d
|
|
@ -602,6 +602,11 @@ ApplicationWindow {
|
|||
border.color: theme.highlightColor
|
||||
radius: 2
|
||||
}
|
||||
onTextChanged: {
|
||||
if (index === renamingIndex) {
|
||||
renamingText = text
|
||||
}
|
||||
}
|
||||
Keys.onReturnPressed: commitRename()
|
||||
Keys.onEscapePressed: cancelRename()
|
||||
onAccepted: commitRename()
|
||||
|
|
|
|||
|
|
@ -27,6 +27,12 @@ static QString serverAddr()
|
|||
return "unix!" + ns + "/ollie";
|
||||
}
|
||||
|
||||
// Returns the path to ollie-9p binary, or empty string if not found.
|
||||
static QString ollie9pBin()
|
||||
{
|
||||
return QStandardPaths::findExecutable("ollie-9p");
|
||||
}
|
||||
|
||||
Ollie9pClient::Ollie9pClient(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
|
@ -275,15 +281,16 @@ bool Ollie9pClient::renameSession(const QString &sessionId, const QString &newNa
|
|||
{
|
||||
if (sessionId.isEmpty() || newName.isEmpty()) return false;
|
||||
|
||||
// Use ollie-9p mv (which uses 9P Twstat to rename the session directory).
|
||||
QString bin = QStandardPaths::findExecutable("ollie-9p");
|
||||
QString bin = ollie9pBin();
|
||||
if (bin.isEmpty()) {
|
||||
qDebug() << "renameSession: ollie-9p not found, cannot rename";
|
||||
return false;
|
||||
}
|
||||
|
||||
QProcess proc;
|
||||
proc.start(bin, {"-a", serverAddr(), "mv", "session/" + sessionId, "session/" + newName});
|
||||
proc.setProgram(bin);
|
||||
proc.setArguments({"-a", serverAddr(), "mv", "session/" + sessionId, "session/" + newName});
|
||||
proc.start();
|
||||
proc.waitForFinished(5000);
|
||||
|
||||
if (proc.exitCode() != 0) {
|
||||
|
|
|
|||
Reference in New Issue