|
|
|
|
@ -72,7 +72,7 @@ MainWindow::MainWindow() |
|
|
|
|
// If we are not using the global Konsole save geometry on exit,
|
|
|
|
|
// remove all Height and Width from [MainWindow] from konsolerc
|
|
|
|
|
// Each screen resolution will have entries (Width 1280=619)
|
|
|
|
|
KSharedConfigPtr konsoleConfig = KSharedConfig::openConfig("konsolerc"); |
|
|
|
|
KSharedConfigPtr konsoleConfig = KSharedConfig::openConfig(QStringLiteral("konsolerc")); |
|
|
|
|
KConfigGroup group = konsoleConfig->group("MainWindow"); |
|
|
|
|
QMap<QString, QString> configEntries = group.entryMap(); |
|
|
|
|
QMapIterator<QString, QString> i(configEntries); |
|
|
|
|
@ -175,7 +175,7 @@ void MainWindow::restoreMenuAccelerators() |
|
|
|
|
void MainWindow::correctStandardShortcuts() |
|
|
|
|
{ |
|
|
|
|
// replace F1 shortcut for help contents
|
|
|
|
|
QAction* helpAction = actionCollection()->action("help_contents"); |
|
|
|
|
QAction* helpAction = actionCollection()->action(QStringLiteral("help_contents")); |
|
|
|
|
if (helpAction) { |
|
|
|
|
actionCollection()->setDefaultShortcut(helpAction, QKeySequence()); |
|
|
|
|
} |
|
|
|
|
@ -183,7 +183,7 @@ void MainWindow::correctStandardShortcuts() |
|
|
|
|
// replace Ctrl+B shortcut for bookmarks only if user hasn't already
|
|
|
|
|
// changed the shortcut; however, if the user changed it to Ctrl+B
|
|
|
|
|
// this will still get changed to Ctrl+Shift+B
|
|
|
|
|
QAction* bookmarkAction = actionCollection()->action("add_bookmark"); |
|
|
|
|
QAction* bookmarkAction = actionCollection()->action(QStringLiteral("add_bookmark")); |
|
|
|
|
if (bookmarkAction && bookmarkAction->shortcut() == QKeySequence(Qt::CTRL + Qt::Key_B)) { |
|
|
|
|
actionCollection()->setDefaultShortcut(bookmarkAction, Qt::CTRL + Qt::SHIFT + Qt::Key_B); |
|
|
|
|
} |
|
|
|
|
@ -295,24 +295,24 @@ void MainWindow::setupActions() |
|
|
|
|
collection->setShortcutsConfigurable(_newTabMenuAction, true); |
|
|
|
|
_newTabMenuAction->setAutoRepeat(false); |
|
|
|
|
connect(_newTabMenuAction, &KActionMenu::triggered, this, &Konsole::MainWindow::newTab); |
|
|
|
|
collection->addAction("new-tab", _newTabMenuAction); |
|
|
|
|
collection->addAction(QStringLiteral("new-tab"), _newTabMenuAction); |
|
|
|
|
collection->setShortcutsConfigurable(_newTabMenuAction, true); |
|
|
|
|
|
|
|
|
|
menuAction = collection->addAction("clone-tab"); |
|
|
|
|
menuAction = collection->addAction(QStringLiteral("clone-tab")); |
|
|
|
|
menuAction->setIcon(QIcon::fromTheme(QStringLiteral("tab-duplicate"))); |
|
|
|
|
menuAction->setText(i18nc("@action:inmenu", "&Clone Tab")); |
|
|
|
|
collection->setDefaultShortcut(menuAction, QKeySequence()); |
|
|
|
|
menuAction->setAutoRepeat(false); |
|
|
|
|
connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::cloneTab); |
|
|
|
|
|
|
|
|
|
menuAction = collection->addAction("new-window"); |
|
|
|
|
menuAction = collection->addAction(QStringLiteral("new-window")); |
|
|
|
|
menuAction->setIcon(QIcon::fromTheme(QStringLiteral("window-new"))); |
|
|
|
|
menuAction->setText(i18nc("@action:inmenu", "New &Window")); |
|
|
|
|
collection->setDefaultShortcut(menuAction, Qt::CTRL + Qt::SHIFT + Qt::Key_N); |
|
|
|
|
menuAction->setAutoRepeat(false); |
|
|
|
|
connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::newWindow); |
|
|
|
|
|
|
|
|
|
menuAction = collection->addAction("close-window"); |
|
|
|
|
menuAction = collection->addAction(QStringLiteral("close-window")); |
|
|
|
|
menuAction->setIcon(QIcon::fromTheme(QStringLiteral("window-close"))); |
|
|
|
|
menuAction->setText(i18nc("@action:inmenu", "Close Window")); |
|
|
|
|
collection->setDefaultShortcut(menuAction, Qt::CTRL + Qt::SHIFT + Qt::Key_Q); |
|
|
|
|
@ -321,7 +321,7 @@ void MainWindow::setupActions() |
|
|
|
|
// Bookmark Menu
|
|
|
|
|
KActionMenu* bookmarkMenu = new KActionMenu(i18nc("@title:menu", "&Bookmarks"), collection); |
|
|
|
|
_bookmarkHandler = new BookmarkHandler(collection, bookmarkMenu->menu(), true, this); |
|
|
|
|
collection->addAction("bookmark", bookmarkMenu); |
|
|
|
|
collection->addAction(QStringLiteral("bookmark"), bookmarkMenu); |
|
|
|
|
connect(_bookmarkHandler, &Konsole::BookmarkHandler::openUrls, this, &Konsole::MainWindow::openUrls); |
|
|
|
|
|
|
|
|
|
// Settings Menu
|
|
|
|
|
@ -336,13 +336,13 @@ void MainWindow::setupActions() |
|
|
|
|
KStandardAction::keyBindings(this, SLOT(showShortcutsDialog()), collection); |
|
|
|
|
KStandardAction::preferences(this, SLOT(showSettingsDialog()), collection); |
|
|
|
|
|
|
|
|
|
menuAction = collection->addAction("manage-profiles"); |
|
|
|
|
menuAction = collection->addAction(QStringLiteral("manage-profiles")); |
|
|
|
|
menuAction->setText(i18nc("@action:inmenu", "Manage Profiles...")); |
|
|
|
|
menuAction->setIcon(QIcon::fromTheme(QStringLiteral("configure"))); |
|
|
|
|
connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::showManageProfilesDialog); |
|
|
|
|
|
|
|
|
|
// Set up an shortcut-only action for activating menu bar.
|
|
|
|
|
menuAction = collection->addAction("activate-menu"); |
|
|
|
|
menuAction = collection->addAction(QStringLiteral("activate-menu")); |
|
|
|
|
menuAction->setText(i18nc("@item", "Activate Menu")); |
|
|
|
|
collection->setDefaultShortcut(menuAction, Qt::CTRL + Qt::SHIFT + Qt::Key_F10); |
|
|
|
|
connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::activateMenuBar); |
|
|
|
|
@ -387,7 +387,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions) |
|
|
|
|
// NOTE: defaultProfile seems to not work here, sigh.
|
|
|
|
|
Profile::Ptr profile = ProfileManager::instance()->defaultProfile(); |
|
|
|
|
if (profile && profile->name() == sessionAction->text().remove('&')) { |
|
|
|
|
QIcon icon(KIconLoader::global()->loadIcon(profile->icon(), KIconLoader::Small, 0, KIconLoader::DefaultState, QStringList("emblem-favorite"))); |
|
|
|
|
QIcon icon(KIconLoader::global()->loadIcon(profile->icon(), KIconLoader::Small, 0, KIconLoader::DefaultState, QStringList(QStringLiteral("emblem-favorite")))); |
|
|
|
|
sessionAction->setIcon(icon); |
|
|
|
|
_newTabMenuAction->menu()->setDefaultAction(sessionAction); |
|
|
|
|
QFont actionFont = sessionAction->font(); |
|
|
|
|
@ -434,7 +434,7 @@ void MainWindow::openUrls(const QList<QUrl>& urls) |
|
|
|
|
if (url.isLocalFile()) |
|
|
|
|
createSession(defaultProfile, url.path()); |
|
|
|
|
|
|
|
|
|
else if (url.scheme() == "ssh") |
|
|
|
|
else if (url.scheme() == QLatin1String("ssh")) |
|
|
|
|
createSSHSession(defaultProfile, url); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -470,7 +470,7 @@ Session* MainWindow::createSession(Profile::Ptr profile, const QString& director |
|
|
|
|
if (!directory.isEmpty() && profile->startInCurrentSessionDir()) |
|
|
|
|
session->setInitialWorkingDirectory(directory); |
|
|
|
|
|
|
|
|
|
session->addEnvironmentEntry(QString("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(_viewManager->managerId())); |
|
|
|
|
session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(_viewManager->managerId())); |
|
|
|
|
|
|
|
|
|
// create view before starting the session process so that the session
|
|
|
|
|
// doesn't suffer a change in terminal size right after the session
|
|
|
|
|
@ -488,9 +488,9 @@ Session* MainWindow::createSSHSession(Profile::Ptr profile, const QUrl& url) |
|
|
|
|
|
|
|
|
|
Session* session = SessionManager::instance()->createSession(profile); |
|
|
|
|
|
|
|
|
|
QString sshCommand = "ssh "; |
|
|
|
|
QString sshCommand = QStringLiteral("ssh "); |
|
|
|
|
if (url.port() > -1) { |
|
|
|
|
sshCommand += QString("-p %1 ").arg(url.port()); |
|
|
|
|
sshCommand += QLatin1String("-p %1 ").arg(url.port()); |
|
|
|
|
} |
|
|
|
|
if (!url.userName().isEmpty()) { |
|
|
|
|
sshCommand += (url.userName() + '@'); |
|
|
|
|
@ -574,10 +574,10 @@ bool MainWindow::queryClose() |
|
|
|
|
processesRunning.count()), |
|
|
|
|
processesRunning, |
|
|
|
|
i18nc("@title", "Confirm Close"), |
|
|
|
|
KGuiItem(i18nc("@action:button", "Close &Window"), "window-close"), |
|
|
|
|
KGuiItem(i18nc("@action:button", "Close Current &Tab"), "tab-close"), |
|
|
|
|
KGuiItem(i18nc("@action:button", "Close &Window"), QStringLiteral("window-close")), |
|
|
|
|
KGuiItem(i18nc("@action:button", "Close Current &Tab"), QStringLiteral("tab-close")), |
|
|
|
|
KStandardGuiItem::cancel(), |
|
|
|
|
"CloseAllTabs"); |
|
|
|
|
QStringLiteral("CloseAllTabs")); |
|
|
|
|
|
|
|
|
|
switch (result) { |
|
|
|
|
case KMessageBox::Yes: |
|
|
|
|
@ -663,31 +663,31 @@ void MainWindow::showManageProfilesDialog() |
|
|
|
|
|
|
|
|
|
void MainWindow::showSettingsDialog(const bool showProfilePage) |
|
|
|
|
{ |
|
|
|
|
if (KConfigDialog::showDialog("settings")) |
|
|
|
|
if (KConfigDialog::showDialog(QStringLiteral("settings"))) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
KConfigDialog* settingsDialog = new KConfigDialog(this, "settings", KonsoleSettings::self()); |
|
|
|
|
KConfigDialog* settingsDialog = new KConfigDialog(this, QStringLiteral("settings"), KonsoleSettings::self()); |
|
|
|
|
settingsDialog->setFaceType(KPageDialog::Tabbed); |
|
|
|
|
|
|
|
|
|
GeneralSettings* generalSettings = new GeneralSettings(settingsDialog); |
|
|
|
|
settingsDialog->addPage(generalSettings, |
|
|
|
|
i18nc("@title Preferences page name", "General"), |
|
|
|
|
"utilities-terminal"); |
|
|
|
|
QStringLiteral("utilities-terminal")); |
|
|
|
|
|
|
|
|
|
ProfileSettings* profileSettings = new ProfileSettings(settingsDialog); |
|
|
|
|
KPageWidgetItem* profilePage = settingsDialog->addPage(profileSettings, |
|
|
|
|
i18nc("@title Preferences page name", "Profiles"), |
|
|
|
|
"configure"); |
|
|
|
|
QStringLiteral("configure")); |
|
|
|
|
|
|
|
|
|
TabBarSettings* tabBarSettings = new TabBarSettings(settingsDialog); |
|
|
|
|
settingsDialog->addPage(tabBarSettings, |
|
|
|
|
i18nc("@title Preferences page name", "TabBar"), |
|
|
|
|
"system-run"); |
|
|
|
|
QStringLiteral("system-run")); |
|
|
|
|
|
|
|
|
|
FileLocationSettings* fileLocationSettings = new FileLocationSettings(settingsDialog); |
|
|
|
|
settingsDialog->addPage(fileLocationSettings, |
|
|
|
|
i18nc("@title Preferences page name", "File Location"), |
|
|
|
|
"configure"); |
|
|
|
|
QStringLiteral("configure")); |
|
|
|
|
|
|
|
|
|
if (showProfilePage) |
|
|
|
|
settingsDialog->setCurrentPage(profilePage); |
|
|
|
|
@ -717,7 +717,7 @@ void MainWindow::applyKonsoleSettings() |
|
|
|
|
setNavigationStyleSheet(KonsoleSettings::tabBarStyleSheet()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setAutoSaveSettings("MainWindow", KonsoleSettings::saveGeometryOnExit()); |
|
|
|
|
setAutoSaveSettings(QStringLiteral("MainWindow"), KonsoleSettings::saveGeometryOnExit()); |
|
|
|
|
|
|
|
|
|
updateWindowCaption(); |
|
|
|
|
} |
|
|
|
|
|