Commit 76f61eca authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

katesessions: Remove toolbutton for deleting session

This never did anything since it was created.

As discussed in the Kate chat, removing this defunct feature is fine, because
one can still manage the session from within kate.

BUG: 448754
parent c0f52f81
......@@ -22,18 +22,17 @@ PlasmaComponents.ListItem {
id: menuItem
signal itemSelected(string uuid)
signal remove(string uuid)
property bool showInput: false
height: Math.max(Math.max(label.height, toolButtonsLayout.implicitHeight), sessionnameditlayout.implicitHeight) + PlasmaCore.Units.smallSpacing
height: Math.max(label.height, sessionnameditlayout.implicitHeight) + PlasmaCore.Units.smallSpacing
MouseArea {
anchors.fill: parent
hoverEnabled: true
onClicked: {
if (type == ProfilesModel.Default)
if (profileIdentifier !== "")
menuItem.itemSelected(profileIdentifier);
else {
showInput=true;
......@@ -114,26 +113,5 @@ PlasmaComponents.ListItem {
}
}
}
RowLayout {
id: toolButtonsLayout
anchors {
right: label.right
verticalCenter: parent.verticalCenter
}
PlasmaComponents3.ToolButton {
icon.name: "edit-delete"
onClicked: menuItem.remove(UuidRole)
PlasmaComponents3.ToolTip {
text: i18n("Delete session")
}
}
Component.onCompleted: {
toolButtonsLayout.visible = Qt.binding(() => (type == ProfilesModel.DefaultSession) && (menuListView.currentIndex == index));
}
}
}
}
......@@ -17,7 +17,6 @@ PlasmaExtras.ScrollArea {
property alias view: menuListView
property alias model: menuListView.model
signal itemSelected(string uuid)
signal remove(string uuid)
ListView {
id: menuListView
......@@ -37,7 +36,6 @@ PlasmaExtras.ScrollArea {
width: menuListView.width
onItemSelected: menu.itemSelected(uuid)
onRemove: menu.remove(uuid)
}
}
}
......@@ -134,7 +134,6 @@ Item {
model.openProfile(profileIdentifier)
plasmoid.expanded = false;
}
onRemove: sessionsSource.serviceAction(uuid, "remove")
}
}
}
......
......@@ -44,8 +44,8 @@ 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::EmptySession};
m_data << ProfileData{i18n("New Kate Session"), QString(), QStringLiteral("document-new"), ProfilesModel::Type::NewSession};
m_data << ProfileData{i18n("Start Kate (no arguments)"), QString(), m_appName};
m_data << ProfileData{i18n("New Kate Session"), QString(), QStringLiteral("document-new")};
} else {
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, m_appName, QStandardPaths::LocateDirectory);
profilesPaths = KFileUtils::findAllUniqueFiles(dirs, {QStringLiteral("*.profile")});
......@@ -65,7 +65,7 @@ void ProfilesModel::loadProfiles()
iconName = m_appName;
}
m_data.append(ProfileData{name, profileIdentifier, iconName, ProfilesModel::Type::DefaultSession});
m_data.append(ProfileData{name, profileIdentifier, iconName});
}
endResetModel();
}
......@@ -76,7 +76,6 @@ QHash<int, QByteArray> ProfilesModel::roleNames() const
{NameRole, "name"},
{ProfileIdentifierRole, "profileIdentifier"},
{IconNameRole, "iconName"},
{TypeRole, "type"},
};
}
......@@ -90,8 +89,6 @@ QVariant ProfilesModel::data(const QModelIndex &index, int role) const
return data.profileIdentifier;
case IconNameRole:
return data.iconName;
case TypeRole:
return data.type;
default:
return QVariant();
}
......
......@@ -14,7 +14,6 @@ struct ProfileData {
QString name;
QString profileIdentifier;
QString iconName;
int type;
};
class ProfilesModel : public QAbstractListModel
......@@ -29,16 +28,8 @@ public:
NameRole = Qt::DisplayRole,
ProfileIdentifierRole = Qt::UserRole,
IconNameRole = Qt::DecorationRole,
TypeRole,
};
enum Type {
DefaultSession,
EmptySession,
NewSession,
};
Q_ENUM(Type)
QHash<int, QByteArray> roleNames() const override;
QVariant data(const QModelIndex &index, int role) const override;
Q_INVOKABLE void openProfile(const QString profileIdentifier);
......
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