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
wilder
Ahmad Samir 5 years ago committed by Kurt Hindenburg
parent 68f1505d5f
commit 40cf8519d7
  1. 24
      src/session/SessionController.cpp
  2. 2
      src/session/SessionController.h

@ -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);

Loading…
Cancel
Save