gui: Ctrl+N new window shortcut + KF5 draft persistence
- Expose GuiActivator as "activator" context property - Add Ctrl+N shortcut to open a new window (both KF5 and KF6) - Add per-session draft text persistence to main-kf5.qml (KF6 ChatPane.qml already had this from previous commit)
This commit is contained in:
parent
1d2fffdcab
commit
756e4086b3
|
|
@ -708,6 +708,12 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
// --- Window shortcuts ---
|
||||
Shortcut {
|
||||
sequence: "Ctrl+N"
|
||||
onActivated: activator.NewWindow()
|
||||
}
|
||||
|
||||
// --- Split pane shortcuts ---
|
||||
Shortcut {
|
||||
sequence: "Ctrl+\\"
|
||||
|
|
@ -819,6 +825,10 @@ ApplicationWindow {
|
|||
property string paneCwd: ""
|
||||
property int chatOffset: 0
|
||||
|
||||
// Per-session draft text storage
|
||||
property var _drafts: ({})
|
||||
property string _prevSessionId: ""
|
||||
|
||||
Component.onCompleted: {
|
||||
// Create a dedicated ChatBlockModel for this pane
|
||||
paneModel = Qt.createQmlObject(
|
||||
|
|
@ -844,7 +854,20 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
onSessionIdChanged: refreshPaneChat()
|
||||
onSessionIdChanged: {
|
||||
// Save draft from previous session
|
||||
if (_prevSessionId !== "") {
|
||||
_drafts[_prevSessionId] = panePrompt.text
|
||||
}
|
||||
refreshPaneChat()
|
||||
// Restore draft for new session (or empty)
|
||||
if (sessionId !== "") {
|
||||
panePrompt.text = _drafts[sessionId] || ""
|
||||
} else {
|
||||
panePrompt.text = ""
|
||||
}
|
||||
_prevSessionId = sessionId
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: dbus
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ int main(int argc, char *argv[])
|
|||
engine.rootContext()->setContextProperty("dbus", dbus);
|
||||
engine.rootContext()->setContextProperty("theme", theme);
|
||||
engine.rootContext()->setContextProperty("chatModel", chatModel);
|
||||
engine.rootContext()->setContextProperty("activator", &activator);
|
||||
engine.rootContext()->setContextProperty("systemTrayAvailable",
|
||||
QSystemTrayIcon::isSystemTrayAvailable());
|
||||
|
||||
|
|
|
|||
|
|
@ -529,6 +529,12 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
// --- Window shortcuts ---
|
||||
Shortcut {
|
||||
sequence: "Ctrl+N"
|
||||
onActivated: activator.NewWindow()
|
||||
}
|
||||
|
||||
// --- Split pane shortcuts ---
|
||||
Shortcut {
|
||||
sequence: "Ctrl+\\"
|
||||
|
|
|
|||
Reference in New Issue