Commit c0f52f81 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

katesession: Launch new session as a normal kate session

Kate will take care of creating it
parent 15786d19
......@@ -22,7 +22,6 @@ PlasmaComponents.ListItem {
id: menuItem
signal itemSelected(string uuid)
signal newSession(string sessionname)
signal remove(string uuid)
property bool showInput: false
......@@ -99,7 +98,7 @@ PlasmaComponents.ListItem {
PlasmaComponents3.ToolButton {
icon.name: "dialog-ok"
enabled: sessionname.text.replace(/^\s+|\s+$/g, '').length>0
onClicked: {menuItem.newSession(sessionname.text.replace(/^\s+|\s+$/g, '')); showInput=false;}
onClicked: {menuItem.itemSelected(sessionname.text.replace(/^\s+|\s+$/g, '')); showInput=false;}
PlasmaComponents3.ToolTip {
text: i18n("Create new session and start Kate")
......@@ -133,7 +132,7 @@ PlasmaComponents.ListItem {
}
Component.onCompleted: {
toolButtonsLayout.visible = Qt.binding(function () { return (type == ProfilesModel.NewSession) && (menuListView.currentIndex == index); });
toolButtonsLayout.visible = Qt.binding(() => (type == ProfilesModel.DefaultSession) && (menuListView.currentIndex == index));
}
}
}
......
......@@ -18,7 +18,6 @@ PlasmaExtras.ScrollArea {
property alias model: menuListView.model
signal itemSelected(string uuid)
signal remove(string uuid)
signal newSession(string sessionName)
ListView {
id: menuListView
......@@ -39,7 +38,6 @@ PlasmaExtras.ScrollArea {
onItemSelected: menu.itemSelected(uuid)
onRemove: menu.remove(uuid)
onNewSession:menu.newSession(sessionname)
}
}
}
......@@ -135,7 +135,6 @@ Item {
plasmoid.expanded = false;
}
onRemove: sessionsSource.serviceAction(uuid, "remove")
onNewSession: sessionsSource.newSession(sessionName)
}
}
}
......
......@@ -44,7 +44,7 @@ void ProfilesModel::loadProfiles()
if (m_appName == QLatin1String("kate")) {
const QDir sessionsDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/kate/sessions"));
profilesPaths = sessionsDir.entryList({QStringLiteral("*.katesession")}, QDir::Files, QDir::Name);
m_data << ProfileData{i18n("Start Kate (no arguments)"), QString(), m_appName, ProfilesModel::Type::Default};
m_data << ProfileData{i18n("Start Kate (no arguments)"), QString(), m_appName, ProfilesModel::Type::EmptySession};
m_data << ProfileData{i18n("New Kate Session"), QString(), QStringLiteral("document-new"), ProfilesModel::Type::NewSession};
} else {
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, m_appName, QStandardPaths::LocateDirectory);
......@@ -65,7 +65,7 @@ void ProfilesModel::loadProfiles()
iconName = m_appName;
}
m_data.append(ProfileData{name, profileIdentifier, iconName, ProfilesModel::Type::Default});
m_data.append(ProfileData{name, profileIdentifier, iconName, ProfilesModel::Type::DefaultSession});
}
endResetModel();
}
......
......@@ -33,7 +33,8 @@ public:
};
enum Type {
Default,
DefaultSession,
EmptySession,
NewSession,
};
Q_ENUM(Type)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment