Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit f1637bee authored by Nate Graham's avatar Nate Graham 🔩

[Plasmoid] Clean up layout

Summary:
This patch cleans up the Search plasmoid's layout to essentially match that of KRunner (but without the side buttons).

It also cleans up the layout-related code a bit as there were some workarounds and hacks that are no longer needed.

Test Plan:
Bottom panel, open: {F6387268, size=full}

Bottom panel, showing search results: {F6387270, size=full}

Top panel, open: {F6387274, size=full}

Top panel, showing search results: {F6387275, size=full}

Free-floating widget, open: {F6387276, size=full}

Free-floating widget, showing search results: {F6387277, size=full}

Reviewers: #plasma, broulik, #vdg, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, Codezela, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D16622
parent 4222e4e0
......@@ -164,11 +164,13 @@ MouseArea {
PlasmaComponents.ListItem {
id: listItem
readonly property int indexModifier: reversed ? 0 : 1
// fake pressed look
checked: resultDelegate.pressed
separatorVisible: resultDelegate.sectionHasChanged
&& !resultDelegate.isCurrent
&& (index === 0 || resultDelegate.ListView.view.currentIndex !== (index - 1))
&& (index === 0 || resultDelegate.ListView.view.currentIndex !== (index - indexModifier))
Item {
id: labelWrapper
......
......@@ -26,9 +26,8 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
import "globals.js" as Globals
/*
* The SearchField is a simple " Search |___input___|" widget.
* The only complex part is aligning the "Search" text on the right
* and an internal timer to reduce the number of textChanged signals
* The SearchField is a simple text field widget. The only complex part
* is the internal timer to reduce the number of textChanged signals
* using searchTextChanged.
*/
Item {
......@@ -38,31 +37,14 @@ Item {
height: childrenRect.height
width: Globals.PlasmoidWidth
PlasmaComponents.Label {
id: searchText
anchors {
left: parent.left
top: parent.top
}
// We cannot use anchors.rightMargin as this has an anchor on
// left, so the rightMargin has no effect.
// Because of this we also need to apply an appropriate leftMargin
// on the textField below
width: Globals.CategoryWidth - Globals.CategoryRightMargin
horizontalAlignment: Text.AlignRight
text: i18n("Search")
}
PlasmaComponents.TextField {
id: textField
clearButtonShown: true
placeholderText: i18n("Search...")
anchors {
left: searchText.right
left: parent.left
right: parent.right
top: parent.top
leftMargin: Globals.CategoryRightMargin
}
focus: true
......
......@@ -43,25 +43,14 @@ Item {
return plasmoid.location == PlasmaCore.Types.BottomEdge;
}
// The wrapper just exists for giving an appropriate top/bottom margin
// when it is placed on the top/bottom edge of the screen
Item {
id: wrapper
//
// The +20 is so that the minimumHeight is always at least 20+. If the height
// is too small then Plasma will ignore the fact that it is a PopupApplet
// and put the SearchField directly in the panel.
//
property int minimumHeight: listView.count ? listView.contentHeight + searchField.height + 5
: searchField.height + 20
: searchField.height
property int maximumHeight: minimumHeight
anchors.fill: parent
anchors {
fill: parent
topMargin: isBottomEdge() ? 0 : 7
bottomMargin: isBottomEdge() ? 7 : 0
}
SearchField {
id: searchField
......@@ -69,6 +58,7 @@ Item {
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.height / 2
}
onSearchTextChanged: {
listView.setQueryString(text)
......@@ -83,12 +73,6 @@ Item {
anchors {
left: parent.left
right: parent.right
// vHanda: Random number - Is there some way to use consisten margins?
// PlasmaCore.FrameSvg does have margins, but one needs to construct
// a PlasmaCore.FrameSvg for that
topMargin: isBottomEdge() ? 0 : 5
bottomMargin: isBottomEdge() ? 5 : 0
}
reversed: isBottomEdge()
......@@ -129,9 +113,6 @@ Item {
function setTextFieldFocus(shown) {
searchField.setFocus();
searchField.selectAll();
//if (!shown)
// listView.clearPreview();
}
function loadSettings() {
......
Markdown is supported
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