Compare commits

...

2 Commits

Author SHA1 Message Date
Jacopo De Simoi 3c4e1ea62f Leaner appearance 7 years ago
Jacopo De Simoi 9e16df7503 Add shortcut to hide panel 7 years ago
  1. 40
      lookandfeel/contents/runcommand/RunCommand.qml
  2. 28
      shell/shellcorona.cpp
  3. 3
      shell/shellcorona.h

@ -54,13 +54,13 @@ ColumnLayout {
Layout.alignment: Qt.AlignTop
PlasmaComponents.ToolButton {
iconSource: "configure"
visible: false
onClicked: {
runnerWindow.visible = false
runnerWindow.displayConfiguration()
}
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Configure")
Accessible.description: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Configure Search Plugins")
visible: runnerWindow.canConfigure
tooltip: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Configure...")
}
PlasmaComponents.TextField {
@ -117,16 +117,28 @@ ColumnLayout {
}
}
Keys.onPressed: {
allowCompletion = (event.key !== Qt.Key_Backspace && event.key !== Qt.Key_Delete)
if ((length === 0) && ((event.key == Qt.Key_P) || (event.key == Qt.Key_N)) && (event.modifiers & Qt.ControlModifier)) {
root.showHistory = true;
}
allowCompletion = (event.key !== Qt.Key_Backspace && event.key !== Qt.Key_Delete);
if (event.modifiers & Qt.ControlModifier) {
if (event.key == Qt.Key_J) {
move_down()
event.accepted = true;
} else if (event.key == Qt.Key_K) {
move_up()
event.accepted = true;
}
Keys.onUpPressed: {
if (length === 0) {
root.showHistory = true;
listView.forceActiveFocus();
} else if (results.count > 0) {
results.forceActiveFocus();
results.decrementCurrentIndex();
}
}
Keys.onDownPressed: {
if (length === 0) {
root.showHistory = true;
listView.forceActiveFocus();
} else if (results.count > 0) {
results.forceActiveFocus();
results.incrementCurrentIndex();
}
}
Keys.onUpPressed: move_up()
@ -169,6 +181,7 @@ ColumnLayout {
}
PlasmaComponents.ToolButton {
iconSource: "window-close"
visible: false
onClicked: runnerWindow.visible = false
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Close")
Accessible.description: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Close Search")
@ -271,8 +284,15 @@ ColumnLayout {
queryField.text += event.text;
queryField.focus = true;
}
if ((event.key == Qt.Key_P) && (event.modifiers & Qt.ControlModifier)) {
decrementCurrentIndex();
event.accepted=true;
}
else if ((event.key == Qt.Key_N) && (event.modifiers & Qt.ControlModifier)) {
incrementCurrentIndex();
event.accepted=true;
}
}
Keys.onUpPressed: decrementCurrentIndex()
Keys.onDownPressed: incrementCurrentIndex()

@ -162,6 +162,8 @@ ShellCorona::ShellCorona(QObject *parent)
connect(this, &ShellCorona::containmentAdded,
this, &ShellCorona::handleContainmentAdded);
QAction *dashboardAction = actions()->addAction(QStringLiteral("show dashboard"));
QObject::connect(dashboardAction, &QAction::triggered,
this, &ShellCorona::setDashboardShown);
@ -177,6 +179,21 @@ ShellCorona::ShellCorona(QObject *parent)
dashboardAction->setData(Plasma::Types::ControlAction);
KGlobalAccel::self()->setGlobalShortcut(dashboardAction, Qt::CTRL + Qt::Key_F12);
QAction *panelAction = actions()->addAction(QStringLiteral("show panel"));
QObject::connect(panelAction, &QAction::triggered,
this, &ShellCorona::togglePanelVisibility);
panelAction->setText(i18n("Toggle Panel"));
// connect(KWindowSystem::self(), &KWindowSystem::showingDesktopChanged, [panelAction](bool showing) {
// panelAction->setText(showing ? i18n("Hide Desktop") : i18n("Show Desktop"));
// panelAction->setChecked(showing);
// });
// panelAction->setAutoRepeat(true);
// panelAction->setCheckable(true);
// panelAction->setIcon(QIcon::fromTheme(QStringLiteral("panel-show")));
// panelAction->setData(Plasma::Types::ControlAction);
KGlobalAccel::self()->setGlobalShortcut(panelAction, Qt::CTRL + Qt::Key_F11);
checkAddPanelAction();
connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), this, SLOT(checkAddPanelAction(QStringList)));
@ -1102,6 +1119,16 @@ QList<PanelView *> ShellCorona::panelsForScreen(QScreen *screen) const
return ret;
}
void ShellCorona::togglePanelVisibility()
{
for (auto it = m_panelViews.constBegin(), end = m_panelViews.constEnd(); it != end; ++it) {
if (it.value()->screen() != qGuiApp->primaryScreen()) {
continue;
}
it.value()->setVisible(!it.value()->isVisible());
}
}
DesktopView* ShellCorona::desktopForScreen(QScreen* screen) const
{
return m_desktopViewforId.value(m_screenPool->id(screen->name()));
@ -2119,4 +2146,3 @@ void ShellCorona::activateTaskManagerEntry(int index)
#include "moc_shellcorona.cpp"

@ -187,6 +187,7 @@ protected Q_SLOTS:
void showAlternativesForApplet(Plasma::Applet *applet);
void togglePanelVisibility();
private Q_SLOTS:
void createWaitingPanels();
void handleContainmentAdded(Plasma::Containment *c);
@ -253,5 +254,3 @@ private:
};
#endif // SHELLCORONA_H

Loading…
Cancel
Save