Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Plasma
Discover
Commits
2a130e1c
Commit
2a130e1c
authored
Oct 06, 2017
by
Aleix Pol Gonzalez
🐧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve convergent logic
parent
aca8e26b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
112 additions
and
55 deletions
+112
-55
discover/qml/ApplicationsListPage.qml
discover/qml/ApplicationsListPage.qml
+0
-2
discover/qml/ConditionalLoader.qml
discover/qml/ConditionalLoader.qml
+2
-0
discover/qml/DiscoverDrawer.qml
discover/qml/DiscoverDrawer.qml
+15
-46
discover/qml/SearchField.qml
discover/qml/SearchField.qml
+69
-0
discover/qml/SearchPage.qml
discover/qml/SearchPage.qml
+25
-5
discover/qml/TopLevelPageData.qml
discover/qml/TopLevelPageData.qml
+0
-2
discover/resources.qrc
discover/resources.qrc
+1
-0
No files found.
discover/qml/ApplicationsListPage.qml
View file @
2a130e1c
...
...
@@ -51,8 +51,6 @@ DiscoverPage {
title
:
category
?
category
.
name
:
""
onSearchChanged
:
{
if
(
search
.
length
===
0
)
Navigation
.
openHome
()
appsModel
.
sortOrder
=
Qt
.
AscendingOrder
}
signal
clearSearch
()
...
...
discover/qml/ConditionalLoader.qml
View file @
2a130e1c
...
...
@@ -19,6 +19,7 @@
***************************************************************************/
import
QtQuick
2.1
import
QtQuick
.
Layouts
1.1
Loader
{
...
...
@@ -28,5 +29,6 @@ Loader
property
Component
componentFalse
property
bool
condition
Layout.minimumHeight
:
item
&&
item
.
Layout
?
item
.
Layout
.
minimumHeight
:
0
sourceComponent
:
condition
?
componentTrue
:
componentFalse
}
discover/qml/DiscoverDrawer.qml
View file @
2a130e1c
...
...
@@ -56,59 +56,28 @@ Kirigami.GlobalDrawer {
id
:
toploader
condition
:
drawer
.
wideScreen
Layout.fillWidth
:
true
componentTrue
:
TextField
{
componentFalse
:
Item
{
Layout.minimumHeight
:
1
Keys.forwardTo
:
[
window
.
pageStack
]
}
componentTrue
:
SearchField
{
id
:
searchField
visible
:
drawer
.
wideScreen
enabled
:
window
.
leftPage
&&
(
window
.
leftPage
.
searchFor
!=
null
||
window
.
leftPage
.
hasOwnProperty
(
"
search
"
))
Keys.forwardTo
:
[
window
.
pageStack
]
Component.onCompleted
:
{
searchField
.
forceActiveFocus
()
}
Shortcut
{
sequence
:
"
Ctrl+F
"
onActivated
:
{
searchField
.
forceActiveFocus
()
searchField
.
selectAll
()
}
}
placeholderText
:
(
!
enabled
||
!
window
.
leftPage
||
window
.
leftPage
.
title
.
length
===
0
)
?
i18n
(
"
Search...
"
)
:
i18n
(
"
Search in '%1'...
"
,
window
.
leftPage
.
title
)
onTextChanged
:
{
if
(
window
.
stack
.
depth
>
0
)
searchTimer
.
running
=
true
drawer
.
currentSearchText
=
text
}
Connections
{
ignoreUnknownSignals
:
true
target
:
window
.
leftPage
onClearSearch
:
{
searchField
.
text
=
""
}
}
page
:
window
.
leftPage
Connections
{
target
:
window
onCurrentTopLevelChanged
:
{
if
(
window
.
currentTopLevel
.
length
>
0
)
searchField
.
text
=
""
}
}
onCurrentSearchTextChanged
:
{
if
(
currentSearchText
.
length
===
0
)
Navigation
.
openHome
()
Timer
{
id
:
searchTimer
running
:
false
repeat
:
false
interval
:
200
onTriggered
:
{
var
curr
=
window
.
leftPage
;
if
(
!
curr
.
hasOwnProperty
(
"
search
"
))
{
Navigation
.
clearStack
()
Navigation
.
openApplicationList
(
{
search
:
parent
.
text
})
}
else
curr
.
search
=
parent
.
text
;
var
curr
=
window
.
leftPage
;
if
(
!
curr
.
hasOwnProperty
(
"
search
"
))
{
Navigation
.
clearStack
()
Navigation
.
openApplicationList
(
{
search
:
currentSearchText
})
}
else
{
curr
.
search
=
currentSearchText
;
}
}
}
...
...
discover/qml/SearchField.qml
0 → 100644
View file @
2a130e1c
/***************************************************************************
* Copyright © 2017 Aleix Pol Gonzalez <aleixpol@blue-systems.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
import
QtQuick
2.5
import
QtQuick
.
Controls
2.1
TextField
{
property
QtObject
page
property
string
currentSearchText
placeholderText
:
(
!
enabled
||
!
page
||
page
.
title
.
length
===
0
)
?
i18n
(
"
Search...
"
)
:
i18n
(
"
Search in '%1'...
"
,
window
.
leftPage
.
title
)
Shortcut
{
sequence
:
"
Ctrl+F
"
onActivated
:
{
searchField
.
forceActiveFocus
()
searchField
.
selectAll
()
}
}
onTextChanged
:
{
if
(
applicationWindow
().
stack
.
depth
>
0
)
searchTimer
.
running
=
true
}
Component.onCompleted
:
forceActiveFocus
()
Connections
{
ignoreUnknownSignals
:
true
target
:
page
onClearSearch
:
{
searchField
.
text
=
""
}
}
Connections
{
target
:
applicationWindow
()
onCurrentTopLevelChanged
:
{
if
(
applicationWindow
().
currentTopLevel
.
length
>
0
)
searchField
.
text
=
""
}
}
Timer
{
id
:
searchTimer
running
:
false
repeat
:
false
interval
:
200
onTriggered
:
{
currentSearchText
=
parent
.
text
}
}
}
discover/qml/SearchPage.qml
View file @
2a130e1c
...
...
@@ -18,14 +18,34 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
import
QtQuick
.
Controls
1.1
import
org
.
kde
.
discover
2.0
import
QtQuick
2.5
ApplicationsListPage
{
id
:
p
age
id
:
searchP
age
listHeaderExtra
:
TextField
{
signal
shown
()
Timer
{
interval
:
0
running
:
true
onTriggered
:
{
searchPage
.
shown
()
}
}
listHeaderExtra
:
SearchField
{
id
:
searchField
focus
:
true
onTextChanged
:
page
.
search
=
text
Connections
{
ignoreUnknownSignals
:
true
target
:
searchPage
onShown
:
{
searchField
.
forceActiveFocus
()
}
}
onCurrentSearchTextChanged
:
{
searchPage
.
search
=
currentSearchText
}
}
}
discover/qml/TopLevelPageData.qml
View file @
2a130e1c
...
...
@@ -17,9 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import
QtQuick
2.1
import
org
.
kde
.
kirigami
2.0
import
"
navigation.js
"
as
Navigation
Action
{
property
string
component
...
...
discover/resources.qrc
View file @
2a130e1c
...
...
@@ -32,6 +32,7 @@
<file>
qml/DiscoverDrawer.qml
</file>
<file>
qml/ActionListItem.qml
</file>
<file>
qml/LoadingPage.qml
</file>
<file>
qml/SearchField.qml
</file>
<file>
qml/navigation.js
</file>
</qresource>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment