Commit 40cf8519 authored by Ahmad Samir's avatar Ahmad Samir Committed by Kurt Hindenburg
Browse files

For the fallback profile change the menu text to "Create New Profile"

This is less confusing; also matches what the code actually does.

BUG: 440885
FIXED-IN: 21.12
parent 68f1505d
......@@ -687,8 +687,8 @@ void SessionController::setupCommonActions()
// Profile Options
action = collection->addAction(QStringLiteral("edit-current-profile"), this, &SessionController::editCurrentProfile);
action->setText(i18n("Edit Current Profile..."));
action->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
setEditProfileActionText(SessionManager::instance()->sessionProfile(session()));
_switchProfileMenu = new KActionMenu(i18n("Switch Profile"), this);
collection->addAction(QStringLiteral("switch-profile"), _switchProfileMenu);
......@@ -874,6 +874,17 @@ void SessionController::switchProfile(const Profile::Ptr &profile)
SessionManager::instance()->setSessionProfile(session(), profile);
_switchProfileMenu->setIcon(QIcon::fromTheme(profile->icon()));
updateFilterList(profile);
setEditProfileActionText(profile);
}
void SessionController::setEditProfileActionText(const Profile::Ptr &profile)
{
QAction *action = actionCollection()->action(QStringLiteral("edit-current-profile"));
if (profile->isFallback()) {
action->setText(i18n("Create New Profile..."));
} else {
action->setText(i18n("Edit Current Profile..."));
}
}
void SessionController::prepareSwitchProfileMenu()
......@@ -898,6 +909,10 @@ void SessionController::changeCodec(QTextCodec* codec)
void SessionController::editCurrentProfile()
{
auto *dialog = new EditProfileDialog(QApplication::activeWindow());
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModal(true);
auto profile = SessionManager::instance()->sessionProfile(session());
auto state = EditProfileDialog::ExistingProfile;
// Don't edit the Fallback profile, instead create a new one
......@@ -910,11 +925,12 @@ void SessionController::editCurrentProfile()
profile = newProfile;
SessionManager::instance()->setSessionProfile(session(), profile);
state = EditProfileDialog::NewProfile;
connect(dialog, &QDialog::accepted, this, [this, profile]() {
setEditProfileActionText(profile);
});
}
auto *dialog = new EditProfileDialog(QApplication::activeWindow());
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModal(true);
dialog->setProfile(profile, state);
dialog->show();
......
......@@ -242,6 +242,8 @@ private Q_SLOTS:
void monitorProcessFinish(bool monitor);
void renameSession();
void switchProfile(const QExplicitlySharedDataPointer<Profile> &profile);
// Set the action text to either "Edit" or "Create New" Profile
void setEditProfileActionText(const QExplicitlySharedDataPointer<Profile> &profile);
void handleWebShortcutAction();
void configureWebShortcuts();
void sendSignal(QAction *action);
......
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